Ticket #1026: fix1026.patch

File fix1026.patch, 1.8 KB (added by wangj, 11 years ago)
  • ./source/Lib/TLibCommon/TComTrQuant.cpp

     
    19851985            }
    19861986          }
    19871987         
    1988           if(piQCoef[minPos] == 32767 || piQCoef[minPos] == -32768)
     1988          if(piDstCoeff[minPos] == 32767 || piDstCoeff[minPos] == -32768)
    19891989          {
    19901990            finalChange = -1;
    19911991          }
     
    22462246  UInt baseLevel  =  (c1Idx < C1FLAG_NUMBER)? (2 + (c2Idx < C2FLAG_NUMBER)) : 1;
    22472247
    22482248  if ( uiAbsLevel >= baseLevel )
    2249   {
    2250     UInt uiSymbol     = uiAbsLevel - baseLevel;
    2251     UInt uiMaxVlc     = g_auiGoRiceRange[ ui16AbsGoRice ];
    2252     Bool bExpGolomb   = ( uiSymbol > uiMaxVlc );
    2253 
    2254     if( bExpGolomb )
     2249  {   
     2250    UInt symbol     = uiAbsLevel - baseLevel;
     2251    UInt length;
     2252    if (symbol < (COEF_REMAIN_BIN_REDUCTION << ui16AbsGoRice))
    22552253    {
    2256       uiAbsLevel  = uiSymbol - uiMaxVlc;
    2257       Int iEGS    = 1;  for( UInt uiMax = 2; uiAbsLevel >= uiMax; uiMax <<= 1, iEGS += 2 );
    2258       iRate      += iEGS << 15;
    2259       uiSymbol    = min<UInt>( uiSymbol, ( uiMaxVlc + 1 ) );
     2254      length = symbol>>ui16AbsGoRice;
     2255      iRate += (length+1+ui16AbsGoRice)<< 15;
     2256    }
     2257    else
     2258    {
     2259      length = ui16AbsGoRice;
     2260      symbol  = symbol - ( COEF_REMAIN_BIN_REDUCTION << ui16AbsGoRice);
     2261      while (symbol >= (1<<length))
     2262      {
     2263        symbol -=  (1<<(length++));   
     2264      }
     2265      iRate += (COEF_REMAIN_BIN_REDUCTION+length+1-ui16AbsGoRice+length)<< 15;
    22602266    }
    2261 
    2262     UShort ui16PrefLen = UShort( uiSymbol >> ui16AbsGoRice ) + 1;
    2263     UShort ui16NumBins = min<UInt>( ui16PrefLen, g_auiGoRicePrefixLen[ ui16AbsGoRice ] ) + ui16AbsGoRice;
    2264 
    2265     iRate += ui16NumBins << 15;
    2266 
    22672267    if (c1Idx < C1FLAG_NUMBER)
    22682268    {
    22692269      iRate += m_pcEstBitsSbac->m_greaterOneBits[ ui16CtxNumOne ][ 1 ];