HM TEncCu相关说明

来源:互联网 发布:语玩刷金币软件下载 编辑:程序博客网 时间:2024/05/29 04:43

class TComYuv的注释是:general YUV buffer class。该注释不清楚,其实TComYuv就是用于存放一个CU的相关数据。例如,在class TEncCu中的各个depth的CU的数据:

/// CU encoder classclass TEncCu{private:  TComDataCU**            m_ppcBestCU;      ///< Best CUs in each depth  TComDataCU**            m_ppcTempCU;      ///< Temporary CUs in each depth  UChar                   m_uhTotalDepth;  TComYuv**               m_ppcPredYuvBest; ///< Best Prediction Yuv for each depth  TComYuv**               m_ppcResiYuvBest; ///< Best Residual Yuv for each depth  TComYuv**               m_ppcRecoYuvBest; ///< Best Reconstruction Yuv for each depth  TComYuv**               m_ppcPredYuvTemp; ///< Temporary Prediction Yuv for each depth  TComYuv**               m_ppcResiYuvTemp; ///< Temporary Residual Yuv for each depth  TComYuv**               m_ppcRecoYuvTemp; ///< Temporary Reconstruction Yuv for each depth  TComYuv**               m_ppcOrigYuv;     ///< Original Yuv for each depth  ...}

而TComPicYuv的注释就很清楚:picture YUV buffer class,用于存放一幅图像的数据。
以下讨论TEncCu::xcompressCU中的代码。
将子CU的最好划分pcSubBestPartCU(m_ppcBestCU[uhNextDepth])的数据复制给上一层CU的临时划分rpcTempCU:
rpcTempCU->copyPartFrom( pcSubBestPartCU, uiPartUnitIdx, uhNextDepth ); // Keep best part data to current temporary data.
xCopyYuv2Tmp( pcSubBestPartCU->getTotalNumPart()*uiPartUnitIdx, uhNextDepth );
将当前深度的CU的信息给图像中的CU且把数据复制过去:
rpcBestCU->copyToPic(uiDepth); // Copy Best data to Picture for next partition prediction.
xCopyYuv2Pic( rpcBestCU->getPic(), rpcBestCU->getCtuRsAddr(), rpcBestCU->getZorderIdxInCtu(), uiDepth, uiDepth ); // Copy Yuv data to picture Yuv
当前深度的CU:rpcBestCU与CU:rpcTempCU的率失真性能比较:
xCheckBestMode( rpcBestCU, rpcTempCU, uiDepth DEBUG_STRING_PASS_INTO(sDebug) DEBUG_STRING_PASS_INTO(sTempDebug) DEBUG_STRING_PASS_INTO(false) ); // RD compare current larger prediction with sub partitioned prediction.
下一层划分为四个子CU,这四个子CU均用pcSubTempPartCU表示,且在使用前均会在initSubCU函数中m_dTotalCost= MAX_DOUBLE,反复利用同一个变量m_ppcTempCU[uhNextDepth]进行遍历,所以一层只需要一个rpcTempCU。
数据流是这样的:
当前层在不划分的遍历时通过xCheckBestMode将m_ppcTempCU[uiDepth]赋值给m_ppcBestCU[uiDepth],CU递归调用下一层的的m_ppcTempCU[uhNextDepth]也在遍历时通过xCheckBestMode赋值给m_ppcBestCU[uhNextDepth],四个下一层的m_ppcBestCU[uhNextDepth]把数据上交给m_ppcBestCU[uiDepth],rpcTempCU[i]再与m_ppcBestCU[uiDepth]在xCheckBestMode中进行比较。
Void TComDataCU::copyToPic( UChar uhDepth )用于将m_ppcBestCU[0]拷贝到图像的CTU中,也就是TEncCu::compressCtu的参数pCtu。

0 0
原创粉丝点击