HEVC代码追踪(八。二):estIntraPredChromaQT

简介: <p><br></p> <p></p><pre code_snippet_id="537345" snippet_file_name="blog_20141130_1_6232807" name="code" class="cpp">Void TEncSearch::estIntraPredChromaQT( TComDataCU* pcCU,


Void 
TEncSearch::estIntraPredChromaQT( TComDataCU* pcCU, 
                                 TComYuv*    pcOrgYuv, 
                                 TComYuv*    pcPredYuv, 
                                 TComYuv*    pcResiYuv, 
                                 TComYuv*    pcRecoYuv,
                                 UInt        uiPreCalcDistC )
{
  UInt    uiDepth     = pcCU->getDepth(0);
  UInt    uiBestMode  = 0;
  UInt    uiBestDist  = 0;
  Double  dBestCost   = MAX_DOUBLE;
  
  //----- init mode list -----
  UInt  uiMinMode = 0;
  UInt  uiModeList[ NUM_CHROMA_MODE ];
  pcCU->getAllowedChromaDir( 0, uiModeList );
  UInt  uiMaxMode = NUM_CHROMA_MODE;

  //----- check chroma modes -----
  for( UInt uiMode = uiMinMode; uiMode < uiMaxMode; uiMode++ )
  {
    //----- restore context models -----
    m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST] );
    
    //----- chroma coding -----
    UInt    uiDist = 0;
    pcCU->setChromIntraDirSubParts  ( uiModeList[uiMode], 0, uiDepth );
    xRecurIntraChromaCodingQT       ( pcCU,   0, 0, pcOrgYuv, pcPredYuv, pcResiYuv, uiDist );
    if( pcCU->getSlice()->getPPS()->getUseTransformSkip() )
    {
      m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST] );
    }
    UInt    uiBits = xGetIntraBitsQT( pcCU,   0, 0, false, true, false );
    Double  dCost  = m_pcRdCost->calcRdCost( uiBits, uiDist );
    
    //----- compare -----
    if( dCost < dBestCost )
    {
      dBestCost   = dCost;
      uiBestDist  = uiDist;
      uiBestMode  = uiModeList[uiMode];
      UInt  uiQPN = pcCU->getPic()->getNumPartInCU() >> ( uiDepth << 1 );
      xSetIntraResultChromaQT( pcCU, 0, 0, pcRecoYuv );
      ::memcpy( m_puhQTTempCbf[1], pcCU->getCbf( TEXT_CHROMA_U ), uiQPN * sizeof( UChar ) );
      ::memcpy( m_puhQTTempCbf[2], pcCU->getCbf( TEXT_CHROMA_V ), uiQPN * sizeof( UChar ) );
      ::memcpy( m_puhQTTempTransformSkipFlag[1], pcCU->getTransformSkip( TEXT_CHROMA_U ), uiQPN * sizeof( UChar ) );
      ::memcpy( m_puhQTTempTransformSkipFlag[2], pcCU->getTransformSkip( TEXT_CHROMA_V ), uiQPN * sizeof( UChar ) );
    }
  }
  
  //----- set data -----
  UInt  uiQPN = pcCU->getPic()->getNumPartInCU() >> ( uiDepth << 1 );
  ::memcpy( pcCU->getCbf( TEXT_CHROMA_U ), m_puhQTTempCbf[1], uiQPN * sizeof( UChar ) );
  ::memcpy( pcCU->getCbf( TEXT_CHROMA_V ), m_puhQTTempCbf[2], uiQPN * sizeof( UChar ) );
  ::memcpy( pcCU->getTransformSkip( TEXT_CHROMA_U ), m_puhQTTempTransformSkipFlag[1], uiQPN * sizeof( UChar ) );
  ::memcpy( pcCU->getTransformSkip( TEXT_CHROMA_V ), m_puhQTTempTransformSkipFlag[2], uiQPN * sizeof( UChar ) );
  pcCU->setChromIntraDirSubParts( uiBestMode, 0, uiDepth );
  pcCU->getTotalDistortion      () += uiBestDist - uiPreCalcDistC;
  
  //----- restore context models -----
  m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST] );
}



目录
相关文章
HEVC代码追踪(十五):解码之decompressSlice
<p><br></p> <p></p> <pre name="code" class="cpp">Void TDecGop::decompressSlice(TComInputBitstream* pcBitstream, TComPic*&amp; rpcPic) { TComSlice* pcSlice = rpcPic-&gt;getSlice(rpcPic-&gt;getC
1213 0
HEVC代码追踪(十四):解码之xDecodeSlice
<p><br></p> <p></p> <pre name="code" class="cpp">Bool TDecTop::decode(InputNALUnit&amp; nalu, Int&amp; iSkipFrame, Int&amp; iPOCLastDisplay) { // Initialize entropy decoder m_cEntropyDecoder
2498 0
HEVC代码追踪(八。一):estIntraPredQT
<p><br></p> <p></p> <pre code_snippet_id="537334" snippet_file_name="blog_20141130_1_4880297" name="code" class="cpp">Void TEncSearch::estIntraPredQT( TComDataCU* pcCU,
2406 0
|
编解码
HEVC代码追踪(六):compressCU
<p><br></p> <p></p> <pre code_snippet_id="537266" snippet_file_name="blog_20141130_1_961923" name="code" class="cpp">Void TEncCu::compressCU( TComDataCU*&amp; rpcCU ) { // initialize CU data
1463 0
HEVC代码追踪(七):xCompressCu
<p><br></p> <p></p> <pre name="code" class="cpp">// ==================================================================================================================== // Protected member functi
2691 0
HEVC代码追踪(八。三):encodeCoeff
<p><br></p> <p></p> <pre name="code" class="cpp">// texture /** encode coefficients * \param pcCU * \param uiAbsPartIdx * \param uiDepth * \param uiWidth * \param uiHeight */ Void TEncEntro
1887 0
HEVC代码追踪(十一。四):运动估计/补偿之xPatternSearch和xPatternSearchFast
<p><br></p> <p></p> <pre name="code" class="cpp">Void TEncSearch::xPatternSearch( TComPattern* pcPatternKey, Pel* piRefY, Int iRefStride, TComMv* pcMvSrchRngLT, TComMv* pcMvSrchRngRB, TComMv&amp;
1826 0
HEVC代码追踪(十一。五):运动估计/补偿之xTZSearch
<p><br></p> <p></p> <pre name="code" class="cpp">Void TEncSearch::xTZSearch( TComDataCU* pcCU, TComPattern* pcPatternKey, Pel* piRefY, Int iRefStride, TComMv* pcMvSrchRngLT, TComMv* pcMvSrchRngR
1791 0
HEVC代码追踪(十一。八):运动估计/补偿之xTZ8PointSquareSearch
<p><br></p> <p></p> <pre code_snippet_id="539588" snippet_file_name="blog_20141202_1_7201235" name="code" class="cpp">__inline Void TEncSearch::xTZ8PointSquareSearch( TComPattern* pcPatternKey,
1129 0
HEVC代码追踪(十一。九):运动估计/补偿之xTZ2PointSearch
<p><br></p> <p></p> <pre code_snippet_id="539592" snippet_file_name="blog_20141202_1_5458888" name="code" class="cpp">__inline Void TEncSearch::xTZ2PointSearch( TComPattern* pcPatternKey, IntTZSe
1088 0