Changeset 837 in 3DVCSoftware for branches/HTM-10.0rc1-dev0/source/Lib/TLibCommon/TComTrQuant.cpp
- Timestamp:
- 8 Feb 2014, 00:23:11 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-10.0rc1-dev0/source/Lib/TLibCommon/TComTrQuant.cpp
r608 r837 4 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-2013, ITU/ISO/IEC6 * Copyright (c) 2010-2014, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 1068 1068 UInt uiLog2TrSize = g_aucConvertToBit[ iWidth ] + 2; 1069 1069 Int scalingListType = (pcCU->isIntra(uiAbsPartIdx) ? 0 : 3) + g_eTTable[(Int)eTType]; 1070 assert(scalingListType < 6);1070 assert(scalingListType < SCALING_LIST_NUM); 1071 1071 Int *piQuantCoeff = 0; 1072 1072 piQuantCoeff = getQuantCoeff(scalingListType,m_cQP.m_iRem,uiLog2TrSize-2); … … 1307 1307 Pel* pResi = rpcResidual + uiAddr; 1308 1308 Int scalingListType = (pcCU->isIntra(uiAbsPartIdx) ? 0 : 3) + g_eTTable[(Int)eTxt]; 1309 assert(scalingListType < 6);1309 assert(scalingListType < SCALING_LIST_NUM); 1310 1310 invtransformNxN( pcCU->getCUTransquantBypass(uiAbsPartIdx), eTxt, REG_DCT, pResi, uiStride, rpcCoeff, uiWidth, uiHeight, scalingListType, pcCU->getTransformSkip(uiAbsPartIdx, eTxt) ); 1311 1311 } … … 1508 1508 const UInt uiMaxNumCoeff = uiWidth * uiHeight; 1509 1509 Int scalingListType = (pcCU->isIntra(uiAbsPartIdx) ? 0 : 3) + g_eTTable[(Int)eTType]; 1510 assert(scalingListType < 6);1510 assert(scalingListType < SCALING_LIST_NUM); 1511 1511 1512 1512 Int iQBits = QUANT_SHIFT + m_cQP.m_iPer + iTransformShift; // Right shift of non-RDOQ quantizer; level = (coeff*uiQ + offset)>>q_bits … … 1927 1927 Int64 costUp = rdFactor * ( - deltaU[uiBlkPos] ) + rateIncUp[uiBlkPos] ; 1928 1928 Int64 costDown = rdFactor * ( deltaU[uiBlkPos] ) + rateIncDown[uiBlkPos] 1929 - ( abs(piDstCoeff[uiBlkPos])==1?((1<<15)+sigRateDelta[uiBlkPos]):0);1929 - ((abs(piDstCoeff[uiBlkPos]) == 1) ? sigRateDelta[uiBlkPos] : 0); 1930 1930 1931 1931 if(lastCG==1 && lastNZPosInCG==n && abs(piDstCoeff[uiBlkPos])==1) … … 2146 2146 { 2147 2147 Double dErr = Double( lLevelDouble - ( uiAbsLevel << iQBits ) ); 2148 Double dCurrCost = dErr * dErr * dTemp + xGetIC RateCost( uiAbsLevel, ui16CtxNumOne, ui16CtxNumAbs, ui16AbsGoRice, c1Idx, c2Idx);2148 Double dCurrCost = dErr * dErr * dTemp + xGetICost(xGetICRate( uiAbsLevel, ui16CtxNumOne, ui16CtxNumAbs, ui16AbsGoRice, c1Idx, c2Idx )); 2149 2149 dCurrCost += dCurrCostSig; 2150 2150 … … 2167 2167 * \returns cost of given absolute transform level 2168 2168 */ 2169 __inline Double TComTrQuant::xGetICRateCost( UInt uiAbsLevel,2169 __inline Int TComTrQuant::xGetICRate ( UInt uiAbsLevel, 2170 2170 UShort ui16CtxNumOne, 2171 2171 UShort ui16CtxNumAbs, … … 2175 2175 ) const 2176 2176 { 2177 Double iRate = xGetIEPRate();2177 Int iRate = Int(xGetIEPRate()); 2178 2178 UInt baseLevel = (c1Idx < C1FLAG_NUMBER)? (2 + (c2Idx < C2FLAG_NUMBER)) : 1; 2179 2179 … … 2219 2219 else 2220 2220 { 2221 assert (0); 2222 } 2223 return xGetICost( iRate ); 2224 } 2225 2226 __inline Int TComTrQuant::xGetICRate ( UInt uiAbsLevel, 2227 UShort ui16CtxNumOne, 2228 UShort ui16CtxNumAbs, 2229 UShort ui16AbsGoRice 2230 , UInt c1Idx, 2231 UInt c2Idx 2232 ) const 2233 { 2234 Int iRate = 0; 2235 UInt baseLevel = (c1Idx < C1FLAG_NUMBER)? (2 + (c2Idx < C2FLAG_NUMBER)) : 1; 2236 2237 if ( uiAbsLevel >= baseLevel ) 2238 { 2239 UInt uiSymbol = uiAbsLevel - baseLevel; 2240 UInt uiMaxVlc = g_auiGoRiceRange[ ui16AbsGoRice ]; 2241 Bool bExpGolomb = ( uiSymbol > uiMaxVlc ); 2242 2243 if( bExpGolomb ) 2244 { 2245 uiAbsLevel = uiSymbol - uiMaxVlc; 2246 Int iEGS = 1; for( UInt uiMax = 2; uiAbsLevel >= uiMax; uiMax <<= 1, iEGS += 2 ); 2247 iRate += iEGS << 15; 2248 uiSymbol = min<UInt>( uiSymbol, ( uiMaxVlc + 1 ) ); 2249 } 2250 2251 UShort ui16PrefLen = UShort( uiSymbol >> ui16AbsGoRice ) + 1; 2252 UShort ui16NumBins = min<UInt>( ui16PrefLen, g_auiGoRicePrefixLen[ ui16AbsGoRice ] ) + ui16AbsGoRice; 2253 2254 iRate += ui16NumBins << 15; 2255 2256 if (c1Idx < C1FLAG_NUMBER) 2257 { 2258 iRate += m_pcEstBitsSbac->m_greaterOneBits[ ui16CtxNumOne ][ 1 ]; 2259 2260 if (c2Idx < C2FLAG_NUMBER) 2261 { 2262 iRate += m_pcEstBitsSbac->m_levelAbsBits[ ui16CtxNumAbs ][ 1 ]; 2263 } 2264 } 2265 } 2266 else 2267 if( uiAbsLevel == 0 ) 2268 { 2269 return 0; 2270 } 2271 else if( uiAbsLevel == 1 ) 2272 { 2273 iRate += m_pcEstBitsSbac->m_greaterOneBits[ ui16CtxNumOne ][ 0 ]; 2274 } 2275 else if( uiAbsLevel == 2 ) 2276 { 2277 iRate += m_pcEstBitsSbac->m_greaterOneBits[ ui16CtxNumOne ][ 1 ]; 2278 iRate += m_pcEstBitsSbac->m_levelAbsBits[ ui16CtxNumAbs ][ 0 ]; 2279 } 2280 else 2281 { 2282 assert(0); 2221 iRate = 0; 2283 2222 } 2284 2223 return iRate;
Note: See TracChangeset for help on using the changeset viewer.