Ticket #595: 14-bit_offset_issue_WP_IF.patch

File 14-bit_offset_issue_WP_IF.patch, 2.5 KB (added by pandrivon, 9 years ago)

Straitghtforward patch for offset issue (14-bit) in IF and WP

  • source/Lib/TLibCommon/TComInterpolationFilter.cpp

     
    124124  else
    125125  {
    126126    Int shift = IF_INTERNAL_PREC - ( g_uiBitDepth + g_uiBitIncrement );
    127     Short offset = IF_INTERNAL_OFFS + (1 << (shift - 1));
     127    Short offset = IF_INTERNAL_OFFS;
     128    offset += shift?(1 << (shift - 1)):0;
    128129    Short maxVal = g_uiIBDI_MAX;
    129130    Short minVal = 0;
    130131    for (row = 0; row < height; row++)
  • source/Lib/TLibCommon/TComWeightPrediction.cpp

     
    7979  Int offset  = wp0[0].offset;
    8080  Int shiftNum = IF_INTERNAL_PREC - ( g_uiBitDepth + g_uiBitIncrement );
    8181  Int shift   = wp0[0].shift + shiftNum;
    82   Int round   = (1<<(shift-1)) * bRound;
     82  Int round   = shift?(1<<(shift-1)) * bRound:0;
    8383  Int w1      = wp1[0].w;
    8484
    8585  UInt  iSrc0Stride = pcYuvSrc0->getStride();
     
    105105  w0      = wp0[1].w;
    106106  offset  = wp0[1].offset;
    107107  shift   = wp0[1].shift + shiftNum;
    108   round   = (1<<(shift-1));
     108  round   = shift?(1<<(shift-1)):0;
    109109  w1      = wp1[1].w;
    110110
    111111  iSrc0Stride = pcYuvSrc0->getCStride();
     
    132132  w0      = wp0[2].w;
    133133  offset  = wp0[2].offset;
    134134  shift   = wp0[2].shift + shiftNum;
    135   round   = (1<<(shift-1));
     135  round   = shift?(1<<(shift-1)):0;
    136136  w1      = wp1[2].w;
    137137
    138138  for ( y = iHeight-1; y >= 0; y-- )
     
    175175  Int offset  = wp0[0].offset;
    176176  Int shiftNum = IF_INTERNAL_PREC - ( g_uiBitDepth + g_uiBitIncrement );
    177177  Int shift   = wp0[0].shift + shiftNum;
    178   Int round   = (1<<(shift-1));
     178  Int round   = shift?(1<<(shift-1)):0;
    179179  UInt  iSrc0Stride = pcYuvSrc0->getStride();
    180180  UInt  iDstStride  = rpcYuvDst->getStride();
    181181 
     
    197197  w0      = wp0[1].w;
    198198  offset  = wp0[1].offset;
    199199  shift   = wp0[1].shift + shiftNum;
    200   round   = (1<<(shift-1));
     200  round   = shift?(1<<(shift-1)):0;
    201201
    202202  iSrc0Stride = pcYuvSrc0->getCStride();
    203203  iDstStride  = rpcYuvDst->getCStride();
     
    221221  w0      = wp0[2].w;
    222222  offset  = wp0[2].offset;
    223223  shift   = wp0[2].shift + shiftNum;
    224   round   = (1<<(shift-1));
     224  round   = shift?(1<<(shift-1)):0;
    225225
    226226  for ( y = iHeight-1; y >= 0; y-- )
    227227  {