Ignore:
Timestamp:
8 Feb 2014, 00:23:11 (11 years ago)
Author:
tech
Message:

Merged HM 13.0. (No yet checked).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-10.0rc1-dev0/source/Lib/TLibCommon/TComTrQuant.cpp

    r608 r837  
    44 * granted under this license. 
    55 *
    6  * Copyright (c) 2010-2013, ITU/ISO/IEC
     6* Copyright (c) 2010-2014, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
     
    10681068    UInt uiLog2TrSize = g_aucConvertToBit[ iWidth ] + 2;
    10691069    Int scalingListType = (pcCU->isIntra(uiAbsPartIdx) ? 0 : 3) + g_eTTable[(Int)eTType];
    1070     assert(scalingListType < 6);
     1070    assert(scalingListType < SCALING_LIST_NUM);
    10711071    Int *piQuantCoeff = 0;
    10721072    piQuantCoeff = getQuantCoeff(scalingListType,m_cQP.m_iRem,uiLog2TrSize-2);
     
    13071307    Pel* pResi = rpcResidual + uiAddr;
    13081308    Int scalingListType = (pcCU->isIntra(uiAbsPartIdx) ? 0 : 3) + g_eTTable[(Int)eTxt];
    1309     assert(scalingListType < 6);
     1309    assert(scalingListType < SCALING_LIST_NUM);
    13101310    invtransformNxN( pcCU->getCUTransquantBypass(uiAbsPartIdx), eTxt, REG_DCT, pResi, uiStride, rpcCoeff, uiWidth, uiHeight, scalingListType, pcCU->getTransformSkip(uiAbsPartIdx, eTxt) );
    13111311  }
     
    15081508  const UInt uiMaxNumCoeff       = uiWidth * uiHeight;
    15091509  Int scalingListType = (pcCU->isIntra(uiAbsPartIdx) ? 0 : 3) + g_eTTable[(Int)eTType];
    1510   assert(scalingListType < 6);
     1510  assert(scalingListType < SCALING_LIST_NUM);
    15111511 
    15121512  Int iQBits = QUANT_SHIFT + m_cQP.m_iPer + iTransformShift;                   // Right shift of non-RDOQ quantizer;  level = (coeff*uiQ + offset)>>q_bits
     
    19271927              Int64 costUp   = rdFactor * ( - deltaU[uiBlkPos] ) + rateIncUp[uiBlkPos] ;
    19281928              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);
    19301930             
    19311931              if(lastCG==1 && lastNZPosInCG==n && abs(piDstCoeff[uiBlkPos])==1)
     
    21462146  {
    21472147    Double dErr         = Double( lLevelDouble  - ( uiAbsLevel << iQBits ) );
    2148     Double dCurrCost    = dErr * dErr * dTemp + xGetICRateCost( uiAbsLevel, ui16CtxNumOne, ui16CtxNumAbs, ui16AbsGoRice, c1Idx, c2Idx );
     2148    Double dCurrCost    = dErr * dErr * dTemp + xGetICost(xGetICRate( uiAbsLevel, ui16CtxNumOne, ui16CtxNumAbs, ui16AbsGoRice, c1Idx, c2Idx ));
    21492149    dCurrCost          += dCurrCostSig;
    21502150
     
    21672167 * \returns cost of given absolute transform level
    21682168 */
    2169 __inline Double TComTrQuant::xGetICRateCost  ( UInt                            uiAbsLevel,
     2169__inline Int TComTrQuant::xGetICRate  ( UInt                            uiAbsLevel,
    21702170                                               UShort                          ui16CtxNumOne,
    21712171                                               UShort                          ui16CtxNumAbs,
     
    21752175                                               ) const
    21762176{
    2177   Double iRate = xGetIEPRate();
     2177  Int iRate = Int(xGetIEPRate());
    21782178  UInt baseLevel  =  (c1Idx < C1FLAG_NUMBER)? (2 + (c2Idx < C2FLAG_NUMBER)) : 1;
    21792179
     
    22192219  else
    22202220  {
    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;
    22832222  }
    22842223  return iRate;
Note: See TracChangeset for help on using the changeset viewer.