Src_HM/source/Lib/TLibEncoder/TEncSearch.cpp
/**  Function for PCM mode estimation.
 * \param pcCU
 * \param pcOrgYuv
 * \param rpcPredYuv
 * \param rpcResiYuv
 * \param rpcRecoYuv
 * \returns Void
 */
Function for PCM mode estimation.
Function for PCM mode estimation .
Void TEncSearch::IPCMSearch( TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv*& rpcPredYuv, TComYuv*& rpcResiYuv, TComYuv*& rpcRecoYuv )
{
  UInt   uiDepth        = pcCU->getDepth(0);
  UInt   uiWidth        = pcCU->getWidth(0);
  UInt   uiHeight       = pcCU->getHeight(0);
  UInt   uiStride       = rpcPredYuv->getStride();
  UInt   uiStrideC      = rpcPredYuv->getCStride();
  UInt   uiWidthC       = uiWidth  >> 1;
  UInt   uiHeightC      = uiHeight >> 1;
  UInt   uiDistortion = 0;
  UInt   uiBits;
  Double dCost;
  Pel*    pOrig;
  Pel*    pResi;
  Pel*    pReco;
  Pel*    pPred;
  Pel*    pPCM;
  UInt uiAbsPartIdx = 0;
  UInt uiMinCoeffSize = pcCU->getPic()->getMinCUWidth()*pcCU->getPic()->getMinCUHeight();
  UInt uiLumaOffset   = uiMinCoeffSize*uiAbsPartIdx;
  UInt uiChromaOffset = uiLumaOffset>>2;
  pOrig    = pcOrgYuv->getLumaAddr(0, uiWidth);
  pResi    = rpcResiYuv->getLumaAddr(0, uiWidth);
  pPred    = rpcPredYuv->getLumaAddr(0, uiWidth);
  pReco    = rpcRecoYuv->getLumaAddr(0, uiWidth);
  pPCM     = pcCU->getPCMSampleY() + uiLumaOffset;
  xEncPCM ( pcCU, 0, pOrig, pPCM, pPred, pResi, pReco, uiStride, uiWidth, uiHeight, TEXT_LUMA );
  pOrig    = pcOrgYuv->getCbAddr();
  pResi    = rpcResiYuv->getCbAddr();
  pPred    = rpcPredYuv->getCbAddr();
  pReco    = rpcRecoYuv->getCbAddr();
  pPCM     = pcCU->getPCMSampleCb() + uiChromaOffset;
  xEncPCM ( pcCU, 0, pOrig, pPCM, pPred, pResi, pReco, uiStrideC, uiWidthC, uiHeightC, TEXT_CHROMA_U );
  pOrig    = pcOrgYuv->getCrAddr();
  pResi    = rpcResiYuv->getCrAddr();
  pPred    = rpcPredYuv->getCrAddr();
  pReco    = rpcRecoYuv->getCrAddr();
  pPCM     = pcCU->getPCMSampleCr() + uiChromaOffset;
  xEncPCM ( pcCU, 0, pOrig, pPCM, pPred, pResi, pReco, uiStrideC, uiWidthC, uiHeightC, TEXT_CHROMA_V );
  m_pcEntropyCoder->resetBits();
  xEncIntraHeader ( pcCU, uiDepth, uiAbsPartIdx, true, false);
  uiBits = m_pcEntropyCoder->getNumberOfWrittenBits();
  dCost = m_pcRdCost->calcRdCost( uiBits, uiDistortion );
  m_pcRDGoOnSbacCoder->load(m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST]);
  pcCU->getTotalBits()       = uiBits;
  pcCU->getTotalCost()       = dCost;
  pcCU->getTotalDistortion() = uiDistortion;
  pcCU->copyToPic(uiDepth, 0, 0);
}
Void TEncSearch :: IPCMSearch ( TComDataCU * pcCU , TComYuv * pcOrgYuv , TComYuv * & rpcPredYuv , TComYuv * & rpcResiYuv , TComYuv * & rpcRecoYuv ) { UInt uiDepth = pcCU -> getDepth ( 0 ) ; UInt uiWidth = pcCU -> getWidth ( 0 ) ; UInt uiHeight = pcCU -> getHeight ( 0 ) ; UInt uiStride = rpcPredYuv -> getStride ( ) ; UInt uiStrideC = rpcPredYuv -> getCStride ( ) ; UInt uiWidthC = uiWidth >> 1 ; UInt uiHeightC = uiHeight >> 1 ; UInt uiDistortion = 0 ; UInt uiBits ; Double dCost ; Pel * pOrig ; Pel * pResi ; Pel * pReco ; Pel * pPred ; Pel * pPCM ; UInt uiAbsPartIdx = 0 ; UInt uiMinCoeffSize = pcCU -> getPic ( ) -> getMinCUWidth ( ) * pcCU -> getPic ( ) -> getMinCUHeight ( ) ; UInt uiLumaOffset = uiMinCoeffSize * uiAbsPartIdx ; UInt uiChromaOffset = uiLumaOffset >> 2 ; pOrig = pcOrgYuv -> getLumaAddr ( 0 , uiWidth ) ; pResi = rpcResiYuv -> getLumaAddr ( 0 , uiWidth ) ; pPred = rpcPredYuv -> getLumaAddr ( 0 , uiWidth ) ; pReco = rpcRecoYuv -> getLumaAddr ( 0 , uiWidth ) ; pPCM = pcCU -> getPCMSampleY ( ) + uiLumaOffset ; xEncPCM ( pcCU , 0 , pOrig , pPCM , pPred , pResi , pReco , uiStride , uiWidth , uiHeight , TEXT_LUMA ) ; pOrig = pcOrgYuv -> getCbAddr ( ) ; pResi = rpcResiYuv -> getCbAddr ( ) ; pPred = rpcPredYuv -> getCbAddr ( ) ; pReco = rpcRecoYuv -> getCbAddr ( ) ; pPCM = pcCU -> getPCMSampleCb ( ) + uiChromaOffset ; xEncPCM ( pcCU , 0 , pOrig , pPCM , pPred , pResi , pReco , uiStrideC , uiWidthC , uiHeightC , TEXT_CHROMA_U ) ; pOrig = pcOrgYuv -> getCrAddr ( ) ; pResi = rpcResiYuv -> getCrAddr ( ) ; pPred = rpcPredYuv -> getCrAddr ( ) ; pReco = rpcRecoYuv -> getCrAddr ( ) ; pPCM = pcCU -> getPCMSampleCr ( ) + uiChromaOffset ; xEncPCM ( pcCU , 0 , pOrig , pPCM , pPred , pResi , pReco , uiStrideC , uiWidthC , uiHeightC , TEXT_CHROMA_V ) ; m_pcEntropyCoder -> resetBits ( ) ; xEncIntraHeader ( pcCU , uiDepth , uiAbsPartIdx , true , false ) ; uiBits = m_pcEntropyCoder -> getNumberOfWrittenBits ( ) ; dCost = m_pcRdCost -> calcRdCost ( uiBits , uiDistortion ) ; m_pcRDGoOnSbacCoder -> load ( m_pppcRDSbacCoder [ uiDepth ] [ CI_CURR_BEST ] ) ; pcCU -> getTotalBits ( ) = uiBits ; pcCU -> getTotalCost ( ) = dCost ; pcCU -> getTotalDistortion ( ) = uiDistortion ; pcCU -> copyToPic ( uiDepth , 0 , 0 ) ; }
Function for PCM mode estimation.
Function for PCM mode estimation .
// Luminance // Chroma U // Chroma V