HEVC代码追踪(十):量化->xCheckIntraPCM

简介: <p><br></p> <p></p><pre name="code" class="cpp">/** Check R-D costs for a CU with PCM mode. * \param rpcBestCU pointer to best mode CU data structure * \param rpcTempCU pointer to testing mod


/** Check R-D costs for a CU with PCM mode. 
 * \param rpcBestCU pointer to best mode CU data structure
 * \param rpcTempCU pointer to testing mode CU data structure
 * \returns Void
 * 
 * \note Current PCM implementation encodes sample values in a lossless way. The distortion of PCM mode CUs are zero. PCM mode is selected if the best mode yields bits greater than that of PCM mode.
 */
Void TEncCu::xCheckIntraPCM( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU )
{
  UInt uiDepth = rpcTempCU->getDepth( 0 );

  rpcTempCU->setSkipFlagSubParts( false, 0, uiDepth );

  rpcTempCU->setIPCMFlag(0, true);
  rpcTempCU->setIPCMFlagSubParts (true, 0, rpcTempCU->getDepth(0));
  rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth );
  rpcTempCU->setPredModeSubParts( MODE_INTRA, 0, uiDepth );
  rpcTempCU->setTrIdxSubParts ( 0, 0, uiDepth );

  m_pcPredSearch->IPCMSearch( rpcTempCU, m_ppcOrigYuv[uiDepth], m_ppcPredYuvTemp[uiDepth], m_ppcResiYuvTemp[uiDepth], m_ppcRecoYuvTemp[uiDepth]);

  m_pcRDGoOnSbacCoder->load(m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST]);

  m_pcEntropyCoder->resetBits();
  if ( rpcTempCU->getSlice()->getPPS()->getTransquantBypassEnableFlag())
  {
    m_pcEntropyCoder->encodeCUTransquantBypassFlag( rpcTempCU, 0,          true );
  }
  m_pcEntropyCoder->encodeSkipFlag ( rpcTempCU, 0,          true );
  m_pcEntropyCoder->encodePredMode ( rpcTempCU, 0,          true );
  m_pcEntropyCoder->encodePartSize ( rpcTempCU, 0, uiDepth, true );
  m_pcEntropyCoder->encodeIPCMInfo ( rpcTempCU, 0, true );

  m_pcRDGoOnSbacCoder->store(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]);

  rpcTempCU->getTotalBits() = m_pcEntropyCoder->getNumberOfWrittenBits();
  rpcTempCU->getTotalBins() = ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded();
  rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );

  xCheckDQP( rpcTempCU );
  xCheckBestMode( rpcBestCU, rpcTempCU, uiDepth );
}





目录
相关文章
HEVC代码追踪(八):帧内-&gt;xCheckRDCostIntra
<p><br></p> <p></p> <pre name="code" class="cpp">Void TEncCu::xCheckRDCostIntra( TComDataCU*&amp; rpcBestCU, TComDataCU*&amp; rpcTempCU, PartSize eSize ) { UInt uiDepth = rpcTempCU-&gt;getDepth
2733 0
HEVC代码追踪(九):帧间-&gt;xCheckRDCostInter
<p><br></p> <p></p> <pre name="code" class="cpp">#if AMP_MRG Void TEncCu::xCheckRDCostInter( TComDataCU*&amp; rpcBestCU, TComDataCU*&amp; rpcTempCU, PartSize ePartSize, Bool bUseMRG) #else Void T
2247 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代码追踪(十一。二):运动估计/补偿之predInterSearch
<p><br></p> <p></p> <pre name="code" class="cpp">/** search of the best candidate for inter prediction * \param pcCU * \param pcOrgYuv * \param rpcPredYuv * \param rpcResiYuv * \param rpcRec
1678 0
HEVC代码追踪(十一。三):运动估计/补偿之xMotionEstimation
<p><br></p> <p></p> <pre name="code" class="cpp">//!&lt; 运动估计(基本思想就是用TZSearch算法先进行整像素搜索,确定一个局部的最佳值,然后以这个最佳点为中心再进行精度更高的分像素搜索。) Void TEncSearch::xMotionEstimation( TComDataCU* pcCU,
2217 0
HEVC代码追踪(十一。七):运动估计/补偿之xTZ8PointDiamondSearch
<p>xTZSearch调用了2个最为主要的函数:xTZ8PointDiamondSearch和xTZ2PointSearch,值得一提的是,HM中还提供了另外一个搜索函数xTZ8PointSquareSearch,但由于实际并没有使用这个函数,且它其实跟钻石搜索只是搜索点的选择略有不同,分析起来基本上也是一样的。</p> <p><br></p> <p></p> <pre code_s
1201 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代码追踪(十一。九):运动估计/补偿之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
HEVC代码追踪(十一。六):运动估计/补偿之xTZSearchHelp
<p><br></p> <p></p> <pre name="code" class="cpp">/* 分析xTZSearch这个函数,xTZSearchHelp是当中最为重要的子函数之一。它实现最基本的功能:根据输入的搜索点坐标, 参考图像首地址,原始图像首地址,以及当前PU大小等相关信息,计算出SAD,并与之前保存的最佳值进行比较,更新到 目前为止的最佳值相关参数,如uiBestSa
1855 0
HEVC代码追踪(十一。一):运动估计/补偿之xCheckRDCostInter
<p><br></p> <p></p> <pre code_snippet_id="539245" snippet_file_name="blog_20141202_1_7049848" name="code" class="cpp">#if AMP_MRG Void TEncCu::xCheckRDCostInter( TComDataCU*&amp; rpcBestCU, TComD
1639 0