Opened 5 years ago
Closed 5 years ago
#777 closed defect (fixed)
Mismatch on the shift value in BCW
Reported by: | wangyang.cs | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | spec | Version: | VVC D7 vE |
Keywords: | shift, BCW | Cc: | ksuehring, bbross, XiangLi, fbossen, jvet@…, jvet@… |
Description
In JVET-P2001-vE, the prediction samples for BCW are derived as follows:
8.5.6.6.2 Default weighted sample prediction process
…
Variables shift1, shift2, offset1, offset2, and offset3 are derived as follows:
-The variable shift1 is set equal to Max( 2, 14 − bitDepth ) and the variable shift2 is set equal to Max( 3, 15 − bitDepth ).
-The variable offset1 is set equal to 1 << ( shift1 − 1 ).
-The variable offset2 is set equal to 1 << ( shift2 − 1 ).
-The variable offset3 is set equal to 1 << ( shift2 + 2 ).
…
-Otherwise (bcwIdx is not equal to 0 and ciip_flag[ xCb ][ yCb ] is equal to 0), the following applies:
-The variable w1 is set equal to bcwWLut[ bcwIdx ] with bcwWLut[ k ] = { 4, 5, 3, 10, −2 }.
-The variable w0 is set equal to ( 8 − w1 ).
-The prediction sample values are derived as follows.
pbSamples[ x ][ y ] = Clip3( 0, ( 1 << bitDepth ) − 1, (1009)
( w0*predSamplesL0[ x ][ y ] + w1*predSamplesL1[ x ][ y ] + offset3 ) >> (shift2+3) )
In spec, the shift value for BCW is Max( 6, 18 − bitDepth ) (i.e., shift2+3).
However, in VTM7.0, the shift value for BCW is Max( 5, 17 − bitDepth ).
In void AreaBuf<Pel>::addWeightedAvg()
...
const int8_t log2WeightBase = g_GbiLog2WeightBase;
...
const int clipbd = clpRng.bd;
const int shiftNum = std::max<int>(2, (IF_INTERNAL_PREC - clipbd)) + log2WeightBase;
const int offset = (1 << (shiftNum - 1)) + (IF_INTERNAL_OFFS << log2WeightBase);
…
Suggested fix is to align the shift value for BCW in spec with VTM.
The modified draft is described as follows:
8.5.6.6.2 Default weighted sample prediction process
…
Variables shift1, shift2, offset1, offset2, and offset3 are derived as follows:
-The variable shift1 is set equal to Max( 2, 14 − bitDepth ) and the variable shift2 is set equal to Max( 3, 15 − bitDepth ).
-The variable offset1 is set equal to 1 << ( shift1 − 1 ).
-The variable offset2 is set equal to 1 << ( shift2 − 1 ).
-The variable offset3 is set equal to 1 << ( shift21 + 2 ).
…
-Otherwise (bcwIdx is not equal to 0 and ciip_flag[ xCb ][ yCb ] is equal to 0), the following applies:
-The variable w1 is set equal to bcwWLut[ bcwIdx ] with bcwWLut[ k ] = { 4, 5, 3, 10, −2 }.
-The variable w0 is set equal to ( 8 − w1 ).
-The prediction sample values are derived as follows.
pbSamples[ x ][ y ] = Clip3( 0, ( 1 << bitDepth ) − 1, (1009)
( w0*predSamplesL0[ x ][ y ] + w1*predSamplesL1[ x ][ y ] + offset3 ) >> (shift21+3) )
Change history (1)
comment:1 Changed 5 years ago by jlchen
- Resolution set to fixed
- Status changed from new to closed
Thanks for reporting, will be fixed in Draft 8 vB.