📄 umc_h264_reconstruct_templates.h
字号:
pParams->m_iSrcPitchChroma[1],
pParams->m_iDstPitchChroma,
pParams->chroma_log2_weight_denom,
pParams->m_pSegDec->m_pPredWeight[D_DIR_FWD][pParams->m_iRefIndex[D_DIR_FWD]].chroma_weight[0],
pParams->m_pSegDec->m_pPredWeight[D_DIR_FWD][pParams->m_iRefIndex[D_DIR_FWD]].chroma_offset[0],
pParams->m_pSegDec->m_pPredWeight[D_DIR_BWD][pParams->m_iRefIndex[D_DIR_BWD]].chroma_weight[0],
pParams->m_pSegDec->m_pPredWeight[D_DIR_BWD][pParams->m_iRefIndex[D_DIR_BWD]].chroma_offset[0],
pParams->roi_chroma,
pParams->bit_depth_chroma);
}
} // void BiDirWeightMacroblock(ReconstructParams *pParams)
inline
void BiDirWeightMacroblockImplicit(ReconstructParams *pParams, Ipp32s iBlockNumber)
{
FactorArrayValue iDistScaleFactor;
if (is_field && pParams->is_mbaff)
{
Ipp32s curfield = pParams->is_bottom_mb;
Ipp32s ref0field = curfield ^ ((pParams->m_pRefIndex[D_DIR_FWD][iBlockNumber]) & 1);
Ipp32s ref1field = curfield ^ ((pParams->m_pRefIndex[D_DIR_BWD][iBlockNumber]) & 1);
const FactorArrayValue *pDistScaleFactors = pParams->m_pSegDec->m_pSlice->GetDistScaleFactorAFF()->values[pParams->m_iRefIndex[D_DIR_BWD]][curfield][ref0field][ref1field];
iDistScaleFactor = pDistScaleFactors[pParams->m_iRefIndex[D_DIR_FWD]] >> 2;
}
else
{
iDistScaleFactor = pParams->m_pSegDec->m_pSlice->GetDistScaleFactor()->values[pParams->m_iRefIndex[D_DIR_BWD]][pParams->m_iRefIndex[D_DIR_FWD]] >> 2;
}
// combine bidir predictions into one,
// implicit weighting
BiDirWeightBlockImplicit(pParams->m_pSrcY[0],
pParams->m_pSrcY[1],
pParams->m_pDstY,
pParams->m_iSrcPitchLuma[0],
pParams->m_iSrcPitchLuma[1],
pParams->m_iDstPitchLuma,
64 - iDistScaleFactor,
iDistScaleFactor,
pParams->roi,
pParams->bit_depth_luma);
if (color_format)
{
BiDirWeightBlockImplicit(pParams->m_pSrcV[0],
pParams->m_pSrcV[1],
pParams->m_pDstV,
pParams->m_iSrcPitchChroma[0],
pParams->m_iSrcPitchChroma[1],
pParams->m_iDstPitchChroma,
64 - iDistScaleFactor,
iDistScaleFactor,
pParams->roi_chroma,
pParams->bit_depth_chroma);
BiDirWeightBlockImplicit(pParams->m_pSrcU[0],
pParams->m_pSrcU[1],
pParams->m_pDstU,
pParams->m_iSrcPitchChroma[0],
pParams->m_iSrcPitchChroma[1],
pParams->m_iDstPitchChroma,
64 - iDistScaleFactor,
iDistScaleFactor,
pParams->roi_chroma,
pParams->bit_depth_chroma);
}
} // void BiDirWeightMacroblockImplicit(ReconstructParams *pParams)
inline
void UniDirWeightLuma(ReconstructParams *pParams, Ipp32s iDir)
{
UniDirWeightBlock(pParams->m_pDstY,
pParams->m_iDstPitchLuma,
pParams->luma_log2_weight_denom,
pParams->m_pSegDec->m_pPredWeight[iDir][pParams->m_iRefIndex[iDir]].luma_weight,
pParams->m_pSegDec->m_pPredWeight[iDir][pParams->m_iRefIndex[iDir]].luma_offset,
pParams->roi,
pParams->bit_depth_luma);
} // void UniDirWeightLuma(ReconstructParams *params, Ipp32s iDir)
inline
void UniDirWeightChroma(ReconstructParams *pParams, Ipp32s iDir)
{
UniDirWeightBlock(pParams->m_pDstV,
pParams->m_iDstPitchChroma,
pParams->chroma_log2_weight_denom,
pParams->m_pSegDec->m_pPredWeight[iDir][pParams->m_iRefIndex[iDir]].chroma_weight[1],
pParams->m_pSegDec->m_pPredWeight[iDir][pParams->m_iRefIndex[iDir]].chroma_offset[1],
pParams->roi_chroma,
pParams->bit_depth_chroma);
UniDirWeightBlock(pParams->m_pDstU,
pParams->m_iDstPitchChroma,
pParams->chroma_log2_weight_denom,
pParams->m_pSegDec->m_pPredWeight[iDir][pParams->m_iRefIndex[iDir]].chroma_weight[0],
pParams->m_pSegDec->m_pPredWeight[iDir][pParams->m_iRefIndex[iDir]].chroma_offset[0],
pParams->roi_chroma,
pParams->bit_depth_chroma);
} // void UniDirWeightLuma(ReconstructParams *params, Ipp32s iDir)
void CompensateBiDirBlock(ReconstructParams ¶ms,
PlanePtrY pDstY,
PlanePtrUV pDstU,
PlanePtrUV pDstV,
Ipp32s iPitchLuma,
Ipp32s iPitchChroma,
Ipp32s iBlockNumber)
{
// set the destination
params.m_pDstY = ((PlanePtrY) params.m_pSegDec->m_pPredictionBuffer) +
params.m_iIntraMBLumaOffsetTmp;
params.m_iDstPitchLuma = 16;
// do forward prediction
CompensateMotionLumaBlock(¶ms, D_DIR_FWD, iBlockNumber, BI_DIR, params.m_pDstY);
if (color_format)
{
params.m_pDstU = (PlanePtrUV) ((((PlanePtrY) params.m_pSegDec->m_pPredictionBuffer) + 16 * 16) +
params.m_iIntraMBChromaOffsetTmp);
params.m_pDstV = (PlanePtrUV) params.m_pSegDec->m_pPredictionBuffer + 2*16 * 16 +
params.m_iIntraMBChromaOffsetTmp;
params.m_iDstPitchChroma = 16;
// do forward prediction
CompensateMotionChromaBlock(¶ms, D_DIR_FWD, iBlockNumber, BI_DIR, params.m_pDstU);
}
// set the destination
params.m_pDstY = pDstY + params.m_iIntraMBLumaOffset;
params.m_iDstPitchLuma = iPitchLuma;
// do backward prediction
CompensateMotionLumaBlock(¶ms, D_DIR_BWD, iBlockNumber, BI_DIR, params.m_pDstY);
if (color_format)
{
params.m_pDstU = pDstU + params.m_iIntraMBChromaOffset;
params.m_pDstV = pDstV + params.m_iIntraMBChromaOffset;
params.m_iDstPitchChroma = iPitchChroma;
// do backward prediction
CompensateMotionChromaBlock(¶ms, D_DIR_BWD, iBlockNumber, BI_DIR, params.m_pDstU);
}
// do waighting
if ((is_weight) &&
(params.m_bBidirWeightMB))
{
if (1 == params.weighted_bipred_idc)
BiDirWeightMacroblock(¶ms);
else if (2 == params.weighted_bipred_idc)
BiDirWeightMacroblockImplicit(¶ms, iBlockNumber);
else
VM_ASSERT(0);
}
else
{
InterpolateMacroblock(¶ms);
}
} // void CompensateBiDirBlock(ReconstructParams ¶ms,
void CompensateUniDirBlock(ReconstructParams ¶ms,
PlanePtrY pDstY,
PlanePtrUV pDstU,
PlanePtrUV pDstV,
Ipp32s iPitchLuma,
Ipp32s iPitchChroma,
Ipp32s iDir,
Ipp32s iBlockNumber)
{
// set the destination
params.m_pDstY = pDstY + params.m_iIntraMBLumaOffset;
params.m_iDstPitchLuma = iPitchLuma;
// do forward prediction
CompensateMotionLumaBlock(¶ms, iDir, iBlockNumber, UNI_DIR, params.m_pDstY);
if (color_format)
{
params.m_pDstU = pDstU + params.m_iIntraMBChromaOffset;
params.m_pDstV = pDstV + params.m_iIntraMBChromaOffset;
params.m_iDstPitchChroma = iPitchChroma;
// do forward prediction
CompensateMotionChromaBlock(¶ms, iDir, iBlockNumber, UNI_DIR, params.m_pDstU);
}
// optional prediction weighting
if ((is_weight) &&
(params.m_bUnidirWeightMB))
{
const PredWeightTable *pTab = params.m_pSegDec->m_pPredWeight[iDir] + params.m_iRefIndex[iDir];
if (pTab->luma_weight_flag)
UniDirWeightLuma(¶ms, iDir);
if ((color_format) &&
(pTab->chroma_weight_flag))
UniDirWeightChroma(¶ms, iDir);
}
} // void CompensateUniDirBlock(ReconstructParams ¶ms,
void CompensateBlock8x8(PlanePtrY pDstY,
PlanePtrUV pDstU,
PlanePtrUV pDstV,
Ipp32s iPitchLuma,
Ipp32s iPitchChroma,
ReconstructParams ¶ms,
Ipp32s iSubBlockType,
Ipp32s iSubBlockDir,
Ipp32s iSubBlockNumber)
{
switch (iSubBlockType)
{
case SBTYPE_8x8:
{
params.roi.width = 8;
params.roi.height = 8;
params.roi_chroma.width = 8 >> ((Ipp32s) (3 > color_format));
params.roi_chroma.height = 8 >> ((Ipp32s) (2 > color_format));
params.m_iIntraMBLumaOffset = 0;
params.m_iIntraMBChromaOffset = 0;
if ((D_DIR_BIDIR == iSubBlockDir) ||
(D_DIR_DIRECT == iSubBlockDir) ||
(D_DIR_DIRECT_SPATIAL_BIDIR == iSubBlockDir))
{
params.m_iIntraMBLumaOffsetTmp = 0;
params.m_iIntraMBChromaOffsetTmp = 0;
CompensateBiDirBlock(params, pDstY, pDstU, pDstV, iPitchLuma, iPitchChroma,
iSubBlockNumber);
}
else
{
Ipp32s iDir = ((D_DIR_BWD == iSubBlockDir) || (D_DIR_DIRECT_SPATIAL_BWD == iSubBlockDir)) ?
(D_DIR_BWD) :
(D_DIR_FWD);
CompensateUniDirBlock(params, pDstY, pDstU, pDstV, iPitchLuma, iPitchChroma, iDir,
iSubBlockNumber);
}
}
break;
case SBTYPE_8x4:
{
params.roi.width = 8;
params.roi.height = 4;
params.roi_chroma.width = 8 >> ((Ipp32s) (3 > color_format));
params.roi_chroma.height = 4 >> ((Ipp32s) (2 > color_format));
params.m_iIntraMBLumaOffset = 0;
params.m_iIntraMBChromaOffset = 0;
if ((D_DIR_BIDIR == iSubBlockDir) ||
(D_DIR_DIRECT == iSubBlockDir) ||
(D_DIR_DIRECT_SPATIAL_BIDIR == iSubBlockDir))
{
params.m_iIntraMBLumaOffsetTmp = 0;
params.m_iIntraMBChromaOffsetTmp = 0;
CompensateBiDirBlock(params, pDstY, pDstU, pDstV, iPitchLuma, iPitchChroma,
iSubBlockNumber);
// set sub-block offset for second half of MB
params.m_iLumaYPos += 4;
params.m_iChromaYPos += 4 >> ((Ipp32s) (2 > color_format));
params.m_iIntraMBLumaOffset = 4 * iPitchLuma;
params.m_iIntraMBChromaOffset = (4 >> ((Ipp32s) (2 > color_format))) * iPitchChroma;
params.m_iIntraMBLumaOffsetTmp = 4 * 16;
params.m_iIntraMBChromaOffsetTmp = (4 >> ((Ipp32s) (2 > color_format))) * 16;
CompensateBiDirBlock(params, pDstY, pDstU, pDstV, iPitchLuma, iPitchChroma,
iSubBlockNumber + 4);
}
else
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -