﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
1027	SW/text mismatch on sample clipping in LMCS	peterchuang		"The SW/text has a mismatch that SW performs sample clipping after LMCS forward mapping for non-CIIP inter predictors but Spec skips this clipping after LMCS forward mapping.

It is suggested to align text with software because the design of the current LMCS was based on the results of software simulation. In addition, it is asserted that VTM8.0 has a more consistent design of sample clipping behavior between intra prediction, IBC prediction, CIIP inter prediction, and non-CIIP inter prediction.


In Spec. (JVET-Q2001-vE), in clause 8.7.5.2, the inter predictors are NOT clipped after LMCS forward mapping. The clipping operation is only performed on the reconstructed sample as shown as below.

–	Otherwise (CuPredMode[ 0 ][ xCurr ][ yCurr ] is equal to MODE_INTER and ciip_flag[ xCurr ][ yCurr ] is equal to 0), the following applies:
idxY =  predSamples[ i ][ j ] >> Log2( OrgCW )
predMapSamples[ i ][ j ] =  LmcsPivot[ idxY ] 
	 + ( ScaleCoeff[ idxY ] * ( predSamples[ i ][ j ] − InputPivot[ idxY ] ) + ( 1 << 10 ) ) >> 11 	(1232)
	with i = 0..nCurrSw − 1, j = 0..nCurrSh − 1
The reconstructed luma picture sample recSamples is derived as follows:
recSamples[ xCurr + i ][ yCurr + j ] = Clip1( predMapSamples[ i ][ j ]+ resSamples[ i ][ j ] ] )	(1233)
	with i = 0..nCurrSw − 1, j = 0..nCurrSh − 1


However, in VTM-8, the  inter predictors are clipped after LMCS forward mapping. The software behavior is described as below: 
–		Otherwise (CuPredMode[ 0 ][ xCurr ][ yCurr ] is equal to MODE_INTER and ciip_flag[ xCurr ][ yCurr ] is equal to 0), the following applies:
idxY =  predSamples[ i ][ j ] >> Log2( OrgCW )
predMapSamples[ i ][ j ] =  '''''Clip1('''''LmcsPivot[ idxY ] 
	 + ( ScaleCoeff[ idxY ] * ( predSamples[ i ][ j ] − InputPivot[ idxY ] ) + 
	  ( 1 << 10 ) ) >> 11''''')'''''
	with i = 0..nCurrSw − 1, j = 0..nCurrSh − 1


"	defect	closed	minor		spec	VVC D8 vB	worksforme		vzakharc yuwenhe jvet@…
