Changeset 595 in SHVCSoftware for trunk/source/Lib/TLibEncoder/TEncCu.cpp


Ignore:
Timestamp:
2 Feb 2014, 06:01:53 (11 years ago)
Author:
seregin
Message:

merge with SHM-5.0-dev branch

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/source

  • trunk/source/Lib/TLibEncoder/TEncCu.cpp

    r588 r595  
    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 *
     
    223223  m_pcRDGoOnSbacCoder = pcEncTop->getRDGoOnSbacCoder();
    224224 
    225   m_bUseSBACRD        = pcEncTop->getUseSBACRD();
    226225  m_pcRateCtrl        = pcEncTop->getRateCtrl();
    227226}
     
    394393  Int iMaxQP;
    395394  Bool isAddLowestQP = false;
    396 #if REPN_FORMAT_IN_VPS
    397   Int lowestQP = -rpcTempCU->getSlice()->getQpBDOffsetY();
    398 #else
    399   Int lowestQP = -rpcTempCU->getSlice()->getSPS()->getQpBDOffsetY();
    400 #endif
    401395
    402396  if( (g_uiMaxCUWidth>>uiDepth) >= rpcTempCU->getSlice()->getPPS()->getMinCuDQPSize() )
     
    409403    iMinQP = Clip3( -rpcTempCU->getSlice()->getSPS()->getQpBDOffsetY(), MAX_QP, iBaseQP-idQP );
    410404    iMaxQP = Clip3( -rpcTempCU->getSlice()->getSPS()->getQpBDOffsetY(), MAX_QP, iBaseQP+idQP );
    411 #endif
    412     if ( (rpcTempCU->getSlice()->getSPS()->getUseLossless()) && (lowestQP < iMinQP) && rpcTempCU->getSlice()->getPPS()->getUseDQP() )
    413     {
    414       isAddLowestQP = true;
    415       iMinQP = iMinQP - 1;
    416     }
     405#endif   
    417406  }
    418407  else
     
    426415    iMinQP = m_pcRateCtrl->getRCQP();
    427416    iMaxQP = m_pcRateCtrl->getRCQP();
     417  }
     418
     419  // transquant-bypass (TQB) processing loop variable initialisation ---
     420
     421  const Int lowestQP = iMinQP; // For TQB, use this QP which is the lowest non TQB QP tested (rather than QP'=0) - that way delta QPs are smaller, and TQB can be tested at all CU levels.
     422
     423  if ( (rpcTempCU->getSlice()->getPPS()->getTransquantBypassEnableFlag()) )
     424  {
     425    isAddLowestQP = true; // mark that the first iteration is to cost TQB mode.
     426    iMinQP = iMinQP - 1;  // increase loop variable range by 1, to allow testing of TQB mode along with other QPs
     427    if ( m_pcEncCfg->getCUTransquantBypassFlagForceValue() )
     428    {
     429      iMaxQP = iMinQP;
     430    }
    428431  }
    429432
     
    443446    if (m_pcEncCfg->getSkipPictureAtArcSwitch() && m_pcEncCfg->getAdaptiveResolutionChange() > 0 && pcSlice->getLayerId() == 1 && pcSlice->getPOC() == m_pcEncCfg->getAdaptiveResolutionChange())
    444447    {
    445       rpcTempCU->initEstData( uiDepth, iBaseQP );
     448      Int iQP = iBaseQP;
     449      const Bool bIsLosslessMode = isAddLowestQP && (iQP == iMinQP);
     450
     451      if( bIsLosslessMode )
     452      {
     453        iQP = lowestQP;
     454      }
     455
     456      rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    446457     
    447458      xCheckRDCostMerge2Nx2N( rpcBestCU, rpcTempCU, &earlyDetectionSkipMode, true );
     
    466477    for (Int iQP=iMinQP; iQP<=iMaxQP; iQP++)
    467478    {
    468       if (isAddLowestQP && (iQP == iMinQP))
     479      const Bool bIsLosslessMode = isAddLowestQP && (iQP == iMinQP);
     480
     481      if (bIsLosslessMode)
    469482      {
    470483        iQP = lowestQP;
    471484      }
    472485
    473       rpcTempCU->initEstData( uiDepth, iQP );
     486      rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    474487
    475488      // do inter modes, SKIP and 2Nx2N
     
    483496        if(m_pcEncCfg->getUseEarlySkipDetection())
    484497        {
    485           xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N );  rpcTempCU->initEstData( uiDepth, iQP );//by Competition for inter_2Nx2N
     498          xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N );
     499          rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );//by Competition for inter_2Nx2N
    486500        }
    487501        // SKIP
    488502        xCheckRDCostMerge2Nx2N( rpcBestCU, rpcTempCU, &earlyDetectionSkipMode );//by Merge for inter_2Nx2N
    489         rpcTempCU->initEstData( uiDepth, iQP );
     503        rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    490504       
    491505#if (ENCODER_FAST_MODE == 2)
     
    496510        {
    497511          // 2Nx2N, NxN
    498           xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N );  rpcTempCU->initEstData( uiDepth, iQP );
     512          xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N );
     513          rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    499514          if(m_pcEncCfg->getUseCbfFastMode())
    500515          {
     
    507522      }
    508523
    509       if (isAddLowestQP && (iQP == lowestQP))
     524      if (bIsLosslessMode)
    510525      {
    511526        iQP = iMinQP;
     
    517532      for (Int iQP=iMinQP; iQP<=iMaxQP; iQP++)
    518533      {
    519         if (isAddLowestQP && (iQP == iMinQP))
     534        const Bool bIsLosslessMode = isAddLowestQP && (iQP == iMinQP);
     535
     536        if (bIsLosslessMode)
    520537        {
    521538          iQP = lowestQP;
    522539        }
    523         rpcTempCU->initEstData( uiDepth, iQP );
     540        rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    524541
    525542        // do inter modes, NxN, 2NxN, and Nx2N
     
    536553            {
    537554              xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_NxN   );
    538               rpcTempCU->initEstData( uiDepth, iQP );
     555              rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    539556            }
    540557          }
     
    544561          {
    545562            xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_Nx2N  );
    546             rpcTempCU->initEstData( uiDepth, iQP );
     563            rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    547564            if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_Nx2N )
    548565            {
     
    553570          {
    554571            xCheckRDCostInter      ( rpcBestCU, rpcTempCU, SIZE_2NxN  );
    555             rpcTempCU->initEstData( uiDepth, iQP );
     572            rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    556573            if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_2NxN)
    557574            {
     
    581598              {
    582599                xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU );
    583                 rpcTempCU->initEstData( uiDepth, iQP );
     600                rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    584601                if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_2NxnU )
    585602                {
     
    590607              {
    591608                xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD );
    592                 rpcTempCU->initEstData( uiDepth, iQP );
     609                rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    593610                if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_2NxnD )
    594611                {
     
    603620              {
    604621                xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU, true );
    605                 rpcTempCU->initEstData( uiDepth, iQP );
     622                rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    606623                if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_2NxnU )
    607624                {
     
    612629              {
    613630                xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD, true );
    614                 rpcTempCU->initEstData( uiDepth, iQP );
     631                rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    615632                if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_2NxnD )
    616633                {
     
    627644              {
    628645                xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N );
    629                 rpcTempCU->initEstData( uiDepth, iQP );
     646                rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    630647                if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_nLx2N )
    631648                {
     
    636653              {
    637654                xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N );
    638                 rpcTempCU->initEstData( uiDepth, iQP );
     655                rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    639656              }
    640657            }
     
    645662              {
    646663                xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N, true );
    647                 rpcTempCU->initEstData( uiDepth, iQP );
     664                rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    648665                if(m_pcEncCfg->getUseCbfFastMode() && rpcBestCU->getPartitionSize(0) == SIZE_nLx2N )
    649666                {
     
    654671              {
    655672                xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N, true );
    656                 rpcTempCU->initEstData( uiDepth, iQP );
     673                rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    657674              }
    658675            }
     
    661678#else
    662679            xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnU );
    663             rpcTempCU->initEstData( uiDepth, iQP );
     680            rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    664681            xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2NxnD );
    665             rpcTempCU->initEstData( uiDepth, iQP );
     682            rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    666683            xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nLx2N );
    667             rpcTempCU->initEstData( uiDepth, iQP );
     684            rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    668685
    669686            xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_nRx2N );
    670             rpcTempCU->initEstData( uiDepth, iQP );
     687            rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    671688
    672689#endif
     
    691708          {
    692709            xCheckRDCostIntra( rpcBestCU, rpcTempCU, SIZE_2Nx2N );
    693             rpcTempCU->initEstData( uiDepth, iQP );
     710          rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    694711            if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth )
    695712            {
     
    697714              {
    698715                xCheckRDCostIntra( rpcBestCU, rpcTempCU, SIZE_NxN   );
    699                 rpcTempCU->initEstData( uiDepth, iQP );
     716              rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    700717              }
    701718            }
     
    712729          {
    713730            xCheckIntraPCM (rpcBestCU, rpcTempCU);
    714             rpcTempCU->initEstData( uiDepth, iQP );
     731            rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    715732          }
    716733        }
     
    725742        { 
    726743           xCheckRDCostILRUni( rpcBestCU, rpcTempCU, pcSlice->getInterLayerPredLayerIdc(refLayer));
    727            rpcTempCU->initEstData( uiDepth, iQP );
     744           rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    728745        }
    729746      }
    730747#endif
    731748
    732         if (isAddLowestQP && (iQP == lowestQP))
     749        if (bIsLosslessMode)
    733750        {
    734751          iQP = iMinQP;
     
    740757    m_pcEntropyCoder->encodeSplitFlag( rpcBestCU, 0, uiDepth, true );
    741758    rpcBestCU->getTotalBits() += m_pcEntropyCoder->getNumberOfWrittenBits(); // split bits
    742     if(m_pcEncCfg->getUseSBACRD())
    743     {
    744759      rpcBestCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded();
    745     }
    746760    rpcBestCU->getTotalCost()  = m_pcRdCost->calcRdCost( rpcBestCU->getTotalBits(), rpcBestCU->getTotalDistortion() );
    747761
     
    778792    iMinQP = Clip3( -rpcTempCU->getSlice()->getSPS()->getQpBDOffsetY(), MAX_QP, iBaseQP-idQP );
    779793    iMaxQP = Clip3( -rpcTempCU->getSlice()->getSPS()->getQpBDOffsetY(), MAX_QP, iBaseQP+idQP );
    780 #endif
    781     if ( (rpcTempCU->getSlice()->getSPS()->getUseLossless()) && (lowestQP < iMinQP) && rpcTempCU->getSlice()->getPPS()->getUseDQP() )
    782     {
    783       isAddLowestQP = true;
    784       iMinQP = iMinQP - 1;     
    785     }
     794#endif   
    786795  }
    787796  else if( (g_uiMaxCUWidth>>uiDepth) > rpcTempCU->getSlice()->getPPS()->getMinCuDQPSize() )
     
    810819    iMaxQP = m_pcRateCtrl->getRCQP();
    811820  }
     821
     822  if ( m_pcEncCfg->getCUTransquantBypassFlagForceValue() )
     823    {
     824    iMaxQP = iMinQP; // If all blocks are forced into using transquant bypass, do not loop here.
     825    }
     826
    812827  for (Int iQP=iMinQP; iQP<=iMaxQP; iQP++)
    813828  {
    814     if (isAddLowestQP && (iQP == iMinQP))
    815     {
    816       iQP = lowestQP;
    817     }
    818     rpcTempCU->initEstData( uiDepth, iQP );
     829    const Bool bIsLosslessMode = false; // False at this level. Next level down may set it to true.
     830    rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    819831
    820832    // further split
     
    837849#endif
    838850        {
    839           if( m_bUseSBACRD )
     851          if ( 0 == uiPartUnitIdx) //initialize RD with previous depth buffer
    840852          {
    841             if ( 0 == uiPartUnitIdx) //initialize RD with previous depth buffer
    842             {
    843               m_pppcRDSbacCoder[uhNextDepth][CI_CURR_BEST]->load(m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST]);
    844             }
    845             else
    846             {
    847               m_pppcRDSbacCoder[uhNextDepth][CI_CURR_BEST]->load(m_pppcRDSbacCoder[uhNextDepth][CI_NEXT_BEST]);
    848             }
     853            m_pppcRDSbacCoder[uhNextDepth][CI_CURR_BEST]->load(m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST]);
     854          }
     855          else
     856          {
     857            m_pppcRDSbacCoder[uhNextDepth][CI_CURR_BEST]->load(m_pppcRDSbacCoder[uhNextDepth][CI_NEXT_BEST]);
    849858          }
    850859
     
    878887
    879888        rpcTempCU->getTotalBits() += m_pcEntropyCoder->getNumberOfWrittenBits(); // split bits
    880         if(m_pcEncCfg->getUseSBACRD())
    881         {
    882           rpcTempCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded();
    883         }
     889        rpcTempCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded();
    884890      }
    885891      rpcTempCU->getTotalCost()  = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );
     
    913919          m_pcEntropyCoder->encodeQP( rpcTempCU, uiTargetPartIdx, false );
    914920          rpcTempCU->getTotalBits() += m_pcEntropyCoder->getNumberOfWrittenBits(); // dQP bits
    915           if(m_pcEncCfg->getUseSBACRD())
    916           {
    917             rpcTempCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded();
    918           }
     921          rpcTempCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded();
    919922          rpcTempCU->getTotalCost()  = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );
    920923#endif
     
    930933      }
    931934
    932       if( m_bUseSBACRD )
    933       {
    934         m_pppcRDSbacCoder[uhNextDepth][CI_NEXT_BEST]->store(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]);
    935       }
     935      m_pppcRDSbacCoder[uhNextDepth][CI_NEXT_BEST]->store(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]);
     936
    936937      Bool isEndOfSlice        = rpcBestCU->getSlice()->getSliceMode()==FIXED_NUMBER_OF_BYTES
    937938                                 && (rpcBestCU->getTotalBits()>rpcBestCU->getSlice()->getSliceArgument()<<3);
     
    944945      xCheckBestMode( rpcBestCU, rpcTempCU, uiDepth);                                  // RD compare current larger prediction
    945946    }                                                                                  // with sub partitioned prediction.
    946     if (isAddLowestQP && (iQP == lowestQP))
    947     {
    948       iQP = iMinQP;
    949     }
    950947  }
    951948
     
    13341331  UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS];
    13351332  Int numValidMergeCand = 0;
     1333  const Bool bTransquantBypassFlag = rpcTempCU->getCUTransquantBypass(0);
    13361334
    13371335  for( UInt ui = 0; ui < rpcTempCU->getSlice()->getMaxNumMergeCand(); ++ui )
     
    13411339  UChar uhDepth = rpcTempCU->getDepth( 0 );
    13421340  rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); // interprets depth relative to LCU level
    1343   rpcTempCU->setCUTransquantBypassSubParts( m_pcEncCfg->getCUTransquantBypassFlagValue(), 0, uhDepth );
    13441341  rpcTempCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand );
    13451342
     
    13851382          // set MC parameters
    13861383          rpcTempCU->setPredModeSubParts( MODE_INTER, 0, uhDepth ); // interprets depth relative to LCU level
    1387           rpcTempCU->setCUTransquantBypassSubParts( m_pcEncCfg->getCUTransquantBypassFlagValue(),     0, uhDepth );
     1384          rpcTempCU->setCUTransquantBypassSubParts( bTransquantBypassFlag,     0, uhDepth );
    13881385          rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); // interprets depth relative to LCU level
    13891386          rpcTempCU->setMergeFlagSubParts( true, 0, 0, uhDepth ); // interprets depth relative to LCU level
     
    14151412          xCheckDQP( rpcTempCU );
    14161413          xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth);
    1417           rpcTempCU->initEstData( uhDepth, orgQP );
     1414          rpcTempCU->initEstData( uhDepth, orgQP, bTransquantBypassFlag );
    14181415         
    14191416          if( m_pcEncCfg->getUseFastDecisionForMerge() && !bestIsSkip )
     
    14781475  rpcTempCU->setPartSizeSubParts  ( ePartSize,  0, uhDepth );
    14791476  rpcTempCU->setPredModeSubParts  ( MODE_INTER, 0, uhDepth );
    1480   rpcTempCU->setCUTransquantBypassSubParts  ( m_pcEncCfg->getCUTransquantBypassFlagValue(),      0, uhDepth );
    14811477 
    14821478#if AMP_MRG
     
    15091505  rpcTempCU->setPartSizeSubParts( eSize, 0, uiDepth );
    15101506  rpcTempCU->setPredModeSubParts( MODE_INTRA, 0, uiDepth );
    1511   rpcTempCU->setCUTransquantBypassSubParts( m_pcEncCfg->getCUTransquantBypassFlagValue(), 0, uiDepth );
    15121507 
    15131508  Bool bSeparateLumaChroma = true; // choose estimation mode
     
    15391534  setdQPFlag( bCodeDQP );
    15401535 
    1541   if( m_bUseSBACRD ) m_pcRDGoOnSbacCoder->store(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]);
     1536  m_pcRDGoOnSbacCoder->store(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]);
    15421537 
    15431538  rpcTempCU->getTotalBits() = m_pcEntropyCoder->getNumberOfWrittenBits();
    1544   if(m_pcEncCfg->getUseSBACRD())
    1545   {
    1546     rpcTempCU->getTotalBins() = ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded();
    1547   }
     1539  rpcTempCU->getTotalBins() = ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded();
    15481540  rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );
    15491541 
     
    15701562  rpcTempCU->setPredModeSubParts( MODE_INTRA, 0, uiDepth );
    15711563  rpcTempCU->setTrIdxSubParts ( 0, 0, uiDepth );
    1572   rpcTempCU->setCUTransquantBypassSubParts( m_pcEncCfg->getCUTransquantBypassFlagValue(), 0, uiDepth );
    15731564
    15741565  m_pcPredSearch->IPCMSearch( rpcTempCU, m_ppcOrigYuv[uiDepth], m_ppcPredYuvTemp[uiDepth], m_ppcResiYuvTemp[uiDepth], m_ppcRecoYuvTemp[uiDepth]);
    15751566
    1576   if( m_bUseSBACRD ) m_pcRDGoOnSbacCoder->load(m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST]);
     1567  m_pcRDGoOnSbacCoder->load(m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST]);
    15771568
    15781569  m_pcEntropyCoder->resetBits();
     
    15861577  m_pcEntropyCoder->encodeIPCMInfo ( rpcTempCU, 0, true );
    15871578
    1588   if( m_bUseSBACRD ) m_pcRDGoOnSbacCoder->store(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]);
     1579  m_pcRDGoOnSbacCoder->store(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]);
    15891580
    15901581  rpcTempCU->getTotalBits() = m_pcEntropyCoder->getNumberOfWrittenBits();
    1591   if(m_pcEncCfg->getUseSBACRD())
    1592   {
    1593     rpcTempCU->getTotalBins() = ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded();
    1594   }
     1582  rpcTempCU->getTotalBins() = ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded();
    15951583  rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );
    15961584
     
    16271615    pcCU  = NULL;
    16281616
    1629     if( m_bUseSBACRD )  // store temp best CI for next CU coding
    1630       m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]->store(m_pppcRDSbacCoder[uiDepth][CI_NEXT_BEST]);
     1617    // store temp best CI for next CU coding
     1618    m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]->store(m_pppcRDSbacCoder[uiDepth][CI_NEXT_BEST]);
    16311619  }
    16321620}
     
    16441632      m_pcEntropyCoder->encodeQP( pcCU, 0, false );
    16451633      pcCU->getTotalBits() += m_pcEntropyCoder->getNumberOfWrittenBits(); // dQP bits
    1646       if(m_pcEncCfg->getUseSBACRD())
    1647       {
    1648         pcCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded();
    1649       }
     1634      pcCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded();
    16501635      pcCU->getTotalCost() = m_pcRdCost->calcRdCost( pcCU->getTotalBits(), pcCU->getTotalDistortion() );
    16511636#endif
     
    17951780}
    17961781
     1782/** Collect ARL statistics from one LCU
     1783 * \param pcCU
     1784 */
     1785Void TEncCu::xLcuCollectARLStats(TComDataCU* rpcCU )
     1786{
     1787  Double cSum[ LEVEL_RANGE + 1 ];     //: the sum of DCT coefficients corresponding to datatype and quantization output
     1788  UInt numSamples[ LEVEL_RANGE + 1 ]; //: the number of coefficients corresponding to datatype and quantization output
     1789
     1790  TCoeff* pCoeffY = rpcCU->getCoeffY();
     1791  Int* pArlCoeffY = rpcCU->getArlCoeffY();
     1792
     1793  UInt uiMinCUWidth = g_uiMaxCUWidth >> g_uiMaxCUDepth;
     1794  UInt uiMinNumCoeffInCU = 1 << uiMinCUWidth;
     1795
     1796  memset( cSum, 0, sizeof( Double )*(LEVEL_RANGE+1) );
     1797  memset( numSamples, 0, sizeof( UInt )*(LEVEL_RANGE+1) );
     1798
     1799  // Collect stats to cSum[][] and numSamples[][]
     1800  for(Int i = 0; i < rpcCU->getTotalNumPart(); i ++ )
     1801  {
     1802    UInt uiTrIdx = rpcCU->getTransformIdx(i);
     1803
     1804    if(rpcCU->getPredictionMode(i) == MODE_INTER)
     1805    if( rpcCU->getCbf( i, TEXT_LUMA, uiTrIdx ) )
     1806    {
     1807      xTuCollectARLStats(pCoeffY, pArlCoeffY, uiMinNumCoeffInCU, cSum, numSamples);
     1808    }//Note that only InterY is processed. QP rounding is based on InterY data only.
     1809   
     1810    pCoeffY  += uiMinNumCoeffInCU;
     1811    pArlCoeffY  += uiMinNumCoeffInCU;
     1812  }
     1813
     1814  for(Int u=1; u<LEVEL_RANGE;u++)
     1815  {
     1816    m_pcTrQuant->getSliceSumC()[u] += cSum[ u ] ;
     1817    m_pcTrQuant->getSliceNSamples()[u] += numSamples[ u ] ;
     1818  }
     1819  m_pcTrQuant->getSliceSumC()[LEVEL_RANGE] += cSum[ LEVEL_RANGE ] ;
     1820  m_pcTrQuant->getSliceNSamples()[LEVEL_RANGE] += numSamples[ LEVEL_RANGE ] ;
     1821}
     1822#endif
     1823
     1824#if SVC_EXTENSION
    17971825#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
    17981826Bool TEncCu::xCheckTileSetConstraint( TComDataCU*& rpcCU )
     
    18611889#endif
    18621890
    1863 /** Collect ARL statistics from one LCU
    1864  * \param pcCU
    1865  */
    1866 Void TEncCu::xLcuCollectARLStats(TComDataCU* rpcCU )
    1867 {
    1868   Double cSum[ LEVEL_RANGE + 1 ];     //: the sum of DCT coefficients corresponding to datatype and quantization output
    1869   UInt numSamples[ LEVEL_RANGE + 1 ]; //: the number of coefficients corresponding to datatype and quantization output
    1870 
    1871   TCoeff* pCoeffY = rpcCU->getCoeffY();
    1872   Int* pArlCoeffY = rpcCU->getArlCoeffY();
    1873 
    1874   UInt uiMinCUWidth = g_uiMaxCUWidth >> g_uiMaxCUDepth;
    1875   UInt uiMinNumCoeffInCU = 1 << uiMinCUWidth;
    1876 
    1877   memset( cSum, 0, sizeof( Double )*(LEVEL_RANGE+1) );
    1878   memset( numSamples, 0, sizeof( UInt )*(LEVEL_RANGE+1) );
    1879 
    1880   // Collect stats to cSum[][] and numSamples[][]
    1881   for(Int i = 0; i < rpcCU->getTotalNumPart(); i ++ )
    1882   {
    1883     UInt uiTrIdx = rpcCU->getTransformIdx(i);
    1884 
    1885     if(rpcCU->getPredictionMode(i) == MODE_INTER)
    1886     if( rpcCU->getCbf( i, TEXT_LUMA, uiTrIdx ) )
    1887     {
    1888       xTuCollectARLStats(pCoeffY, pArlCoeffY, uiMinNumCoeffInCU, cSum, numSamples);
    1889     }//Note that only InterY is processed. QP rounding is based on InterY data only.
    1890    
    1891     pCoeffY  += uiMinNumCoeffInCU;
    1892     pArlCoeffY  += uiMinNumCoeffInCU;
    1893   }
    1894 
    1895   for(Int u=1; u<LEVEL_RANGE;u++)
    1896   {
    1897     m_pcTrQuant->getSliceSumC()[u] += cSum[ u ] ;
    1898     m_pcTrQuant->getSliceNSamples()[u] += numSamples[ u ] ;
    1899   }
    1900   m_pcTrQuant->getSliceSumC()[LEVEL_RANGE] += cSum[ LEVEL_RANGE ] ;
    1901   m_pcTrQuant->getSliceNSamples()[LEVEL_RANGE] += numSamples[ LEVEL_RANGE ] ;
    1902 }
    1903 #endif
    1904 
    19051891#if (ENCODER_FAST_MODE)
    19061892Void TEncCu::xCheckRDCostILRUni(TComDataCU *&rpcBestCU, TComDataCU *&rpcTempCU, UInt refLayerId)
     
    19131899  rpcTempCU->setPartSizeSubParts  ( SIZE_2Nx2N,  0, uhDepth );  //2Nx2N
    19141900  rpcTempCU->setPredModeSubParts  ( MODE_INTER, 0, uhDepth );
    1915   rpcTempCU->setCUTransquantBypassSubParts  ( m_pcEncCfg->getCUTransquantBypassFlagValue(), 0, uhDepth );
     1901  rpcTempCU->setCUTransquantBypassSubParts  ( m_pcEncCfg->getCUTransquantBypassFlagForceValue(), 0, uhDepth );
    19161902  Bool exitILR = m_pcPredSearch->predInterSearchILRUni( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth], refLayerId );
    19171903  if(!exitILR)
     
    19261912}
    19271913#endif
     1914#endif //SVC_EXTENSION
    19281915//! \}
Note: See TracChangeset for help on using the changeset viewer.