现在好像关于JEM的博客还很少,正好自己学习JEM,就把自己学习到的一点东西记录下来。省的学了就忘,先给自己定个目标,一天至少一篇吧。今天学习了色度帧内预测,先记录一下。estIntraPredChromaQT函数的主要功能是进行色度分量的帧内预测,在11种备选的预测模式中根据RD cost选择cost最小的一种模式作为最优预测模式。11种备选模式中,前6种是属于CCLM预测,用重建的亮度分量预测色度分量,后面5种是和HEVC中的色度预测模式一致。
Void
TEncSearch::estIntraPredChromaQT(TComDataCU* pcCU,
TComYuv* pcOrgYuv,
TComYuv* pcPredYuv,
TComYuv* pcResiYuv,
TComYuv* pcRecoYuv,
#if COM16_C806_LARGE_CTU
Pel* resiLuma[NUMBER_OF_STORED_RESIDUAL_TYPES]
#else
Pel resiLuma[NUMBER_OF_STORED_RESIDUAL_TYPES][MAX_CU_SIZE * MAX_CU_SIZE]
#endif
DEBUG_STRING_FN_DECLARE(sDebug))
{
#if JVET_C0024_QTBT
const UInt uiInitTrDepth = 0;
UInt uiWIdx = g_aucConvertToBit[pcCU->getWidth(0)];
UInt uiHIdx = g_aucConvertToBit[pcCU->getHeight(0)];
#else
const UInt uiInitTrDepth = pcCU->getPartitionSize(0) != SIZE_2Nx2N && enable4ChromaPUsInIntraNxNCU(pcOrgYuv->getChromaFormat()) ? 1 : 0;
#endif
TComTURecurse tuRecurseCU(pcCU, 0);
TComTURecurse tuRecurseWithPU(tuRecurseCU, false, (uiInitTrDepth==0)?TComTU::DONT_SPLIT : TComTU::QUAD_SPLIT);
#if !JVET_C0024_QTBT
const UInt uiQNumParts = tuRecurseWithPU.GetAbsPartIdxNumParts();
#endif
const UInt uiDepthCU=tuRecurseWithPU.getCUDepth();
const UInt numberValidComponents = pcCU->getPic()->getNumberValidComponents();
do while大循环/
do
{
#if JVET_E0077_LM_MF
UInt auiSATDModeList[LM_FILTER_NUM];
UInt auiSATDSortedcost[LM_FILTER_NUM];
const UInt csx = getComponentScaleX(COMPONENT_Cb, pcCU->getSlice()->getSPS()->getChromaFormatIdc());
const UInt csy = getComponentScaleY(COMPONENT_Cb, pcCU->getSlice()->getSPS()->getChromaFormatIdc());
Int iBlockSize = (pcCU->getHeight(0) >> csy) + (pcCU->getWidth(0) >> csx);
#endif
UInt uiBestMode = 0;
Distortion uiBestDist = 0;
Double dBestCost = MAX_DOUBLE;
//----- init mode list -----
if (tuRecurseWithPU.ProcessChannelSection(CHANNEL_TYPE_CHROMA))
{
#if JVET_E0062_MULTI_DMS
UInt uiModeList[NUM_CHROMA_MODE];
#else
UInt uiModeList[FAST_UDI_MAX_RDMODE_NUM];
#endif
#if !JVET_C0024_QTBT
const UInt uiQPartNum = uiQNumParts;
#endif
const UInt uiPartOffset = tuRecurseWithPU.GetAbsPartIdxTU();
{
UInt uiMinMode = 0;
UInt uiMaxMode = NUM_CHROMA_MODE;//11;
//----- check chroma modes -----
#if JVET_E0077_ENHANCED_LM
uiMaxMode =
#endif//前6种67,68,69,70,71,72应该是CCLM的6种预测模式,后5种和HEVC里的一样;
pcCU->getAllowedChromaDir( uiPartOffset, uiModeList );//获得可用的色度预测模式,uiModeList里有11种候选模式;
#if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST
if (DebugOptionList::ForceChromaMode.isSet())
{
uiMinMode=DebugOptionList::ForceChromaMode.getInt();
if (uiModeList[uiMinMode]==34)
{
uiMinMode=4; // if the fixed mode has been renumbered because DM_CHROMA covers it, use DM_CHROMA.
}
uiMaxMode=uiMinMode+1;
}
#endif
#if JVET_C0024_QTBT
assert(uiPartOffset==0);
UInt uiShort, uiLong;
UInt uiStr;
if (pcCU->getHeight(0) > pcCU->getWidth(0))
{
uiShort = pcCU->getWidth(0);
uiLong = pcCU->getHeight(0);
uiStr = pcCU->getPic()->getNumPartInCtuWidth();
}
else
{
uiShort = pcCU->getHeight(0);