Ticket #1026: fix1026.patch
File fix1026.patch, 1.8 KB (added by wangj, 12 years ago) |
---|
-
./source/Lib/TLibCommon/TComTrQuant.cpp
1985 1985 } 1986 1986 } 1987 1987 1988 if(pi QCoef[minPos] == 32767 || piQCoef[minPos] == -32768)1988 if(piDstCoeff[minPos] == 32767 || piDstCoeff[minPos] == -32768) 1989 1989 { 1990 1990 finalChange = -1; 1991 1991 } … … 2246 2246 UInt baseLevel = (c1Idx < C1FLAG_NUMBER)? (2 + (c2Idx < C2FLAG_NUMBER)) : 1; 2247 2247 2248 2248 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)) 2255 2253 { 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; 2260 2266 } 2261 2262 UShort ui16PrefLen = UShort( uiSymbol >> ui16AbsGoRice ) + 1;2263 UShort ui16NumBins = min<UInt>( ui16PrefLen, g_auiGoRicePrefixLen[ ui16AbsGoRice ] ) + ui16AbsGoRice;2264 2265 iRate += ui16NumBins << 15;2266 2267 2267 if (c1Idx < C1FLAG_NUMBER) 2268 2268 { 2269 2269 iRate += m_pcEstBitsSbac->m_greaterOneBits[ ui16CtxNumOne ][ 1 ];