📄 umc_h264_dec_reconstruct_mb_fld.cpp
字号:
// when 3,3 filter is selected. Now clip mvx and mvy // rather than xint and yint to avoid clipping again for // chroma. Ipp8u pred_method=SelectPredictionMethod( mbYOffset+ypos, mvy, sbheight, height/2); mvx = MIN(mvx, (width - ((Ipp32s)mbXOffset + xpos + sbwidth - 1 - D_MV_CLIP_LIMIT))*INTERP_FACTOR); mvx = MAX(mvx, -((Ipp32s)(mbXOffset + xpos + D_MV_CLIP_LIMIT)*INTERP_FACTOR)); mvy = MIN(mvy, (height/2 - ((Ipp32s)mbYOffset + ypos + sbheight - 1 - D_MV_CLIP_LIMIT))*INTERP_FACTOR); mvy = MAX(mvy, -((Ipp32s)(mbYOffset + ypos + D_MV_CLIP_LIMIT)*INTERP_FACTOR)); mvyc = mvy; if(!m_pCurrentFrame->m_bottom_field_flag[m_field_index] && RefFieldTop) { mvyc = mvy - 2; } else { if(m_pCurrentFrame->m_bottom_field_flag[m_field_index] && !RefFieldTop) { mvyc = mvy + 2; } } xint = mvx >> INTERP_SHIFT; yint = mvy >> INTERP_SHIFT; switch(pred_method) { case ALLOK: pRef = pRefY_sb + offsetY + xint + yint * pitch; ippiInterpolateLuma_H264_8u_C1R(pRef, pitch, pDstY_sb, pitch, xh, yh, roi); break; case PREDICTION_FROM_TOP: pRef = pRefY_sb + offsetY + xint + yint * pitch; InterpolateLumaTop(pRef, pitch, pDstY_sb, pitch, xh, yh, - ((Ipp32s)mbYOffset+ypos+yint),roi); break; case PREDICTION_FROM_BOTTOM: pRef = pRefY_sb + offsetY + xint + yint * pitch; InterpolateLumaBottom(pRef, pitch, pDstY_sb, pitch, xh, yh, ((Ipp32s)mbYOffset+ypos+yint+roi.height)-height/2,roi); break; default:VM_ASSERT(0); break; } // optional prediction weighting if (bUnidirWeightSB && pPredWeight[uBlockDir][*pRefIndex].luma_weight_flag != 0) { UniDirWeightBlock(pDstY_sb, pitch, sbwidth, sbheight, luma_log2_weight_denom, pPredWeight[uBlockDir][*pRefIndex].luma_weight, pPredWeight[uBlockDir][*pRefIndex].luma_offset); } if (color_format==1) { pred_method=SelectPredictionMethod( mbYOffset+ypos, mvyc, sbheight, height/2); // chroma (1/8 pixel MV) xh = mvx & (INTERP_FACTOR*2-1); yh = mvyc & (INTERP_FACTOR*2-1); xint = mvx >> (INTERP_SHIFT+1); yint = mvyc >> (INTERP_SHIFT+1); switch(pred_method) { case ALLOK: pRef = pRefV_sb + (offsetY>>1) + xint + yint * pitch; ippiInterpolateChroma_H264_8u_C1R(pRef, pitch, pDstV_sb, pitch, xh, yh, roi_cr); pRef = pRefU_sb + (offsetY>>1) + xint + yint * pitch; ippiInterpolateChroma_H264_8u_C1R(pRef, pitch, pDstU_sb, pitch, xh, yh, roi_cr); break; case PREDICTION_FROM_TOP: pRef = pRefV_sb + (offsetY>>1) + xint + yint * pitch; InterpolateChromaTop(pRef, pitch, pDstV_sb, pitch, xh, yh, - (((Ipp32s)mbYOffset+ypos)/2+yint), roi_cr); pRef = pRefU_sb + (offsetY>>1) + xint + yint * pitch; InterpolateChromaTop(pRef, pitch, pDstU_sb, pitch, xh, yh, - (((Ipp32s)mbYOffset+ypos)/2+yint), roi_cr); break; case PREDICTION_FROM_BOTTOM: pRef = pRefV_sb + (offsetY>>1) + xint + yint * pitch; InterpolateChromaBottom(pRef, pitch, pDstV_sb, pitch, xh, yh, (((Ipp32s)mbYOffset+ypos)/2+yint+roi_cr.height)-height/4,roi_cr); pRef = pRefU_sb + (offsetY>>1) + xint + yint * pitch; InterpolateChromaBottom(pRef, pitch, pDstU_sb, pitch, xh, yh, (((Ipp32s)mbYOffset+ypos)/2+yint+roi_cr.height)-height/4,roi_cr); break; default:VM_ASSERT(0); break; } // optional prediction weighting if (bUnidirWeightSB && pPredWeight[uBlockDir][*pRefIndex].chroma_weight_flag != 0) { UniDirWeightBlock(pDstV_sb, pitch, sbwidth>>1, sbheight>>1, chroma_log2_weight_denom, pPredWeight[uBlockDir][*pRefIndex].chroma_weight[1], pPredWeight[uBlockDir][*pRefIndex].chroma_offset[1]); UniDirWeightBlock(pDstU_sb, pitch, sbwidth>>1, sbheight>>1, chroma_log2_weight_denom, pPredWeight[uBlockDir][*pRefIndex].chroma_weight[0], pPredWeight[uBlockDir][*pRefIndex].chroma_offset[0]); } } } // loopCnt if (loopCnt > 1) { if (!bBidirWeightMB) { // combine bidir predictions into one, no weighting // luma ippiInterpolateBlock_H264_8u_P2P1R(pDstY_sb-16, pDstY_sb, pDstY_sb-16, roi.width, roi.height, pitch); if (color_format==1) { ippiInterpolateBlock_H264_8u_P2P1R(pDstV_sb-8, pDstV_sb, pDstV_sb-8, roi_cr.width, roi_cr.height, pitch); ippiInterpolateBlock_H264_8u_P2P1R(pDstU_sb-8, pDstU_sb, pDstU_sb-8, roi_cr.width, roi_cr.height, pitch); } } else { // combine bidir predictions into one with weighting if (weighted_bipred_idc == 1) { // combine bidir predictions into one, explicit weighting // luma BiDirWeightBlock(pDstY_sb-16, pDstY_sb, pDstY_sb-16, pitch, sbwidth, sbheight, luma_log2_weight_denom, pPredWeight[0][RefIndexL0].luma_weight, pPredWeight[0][RefIndexL0].luma_offset, pPredWeight[1][RefIndexL1].luma_weight, pPredWeight[1][RefIndexL1].luma_offset); if (color_format==1) { // chroma BiDirWeightBlock(pDstV_sb-8, pDstV_sb, pDstV_sb-8, pitch, sbwidth>>1, sbheight>>1, chroma_log2_weight_denom, pPredWeight[0][RefIndexL0].chroma_weight[1], pPredWeight[0][RefIndexL0].chroma_offset[1], pPredWeight[1][RefIndexL1].chroma_weight[1], pPredWeight[1][RefIndexL1].chroma_offset[1]); BiDirWeightBlock(pDstU_sb-8, pDstU_sb, pDstU_sb-8, pitch, sbwidth>>1, sbheight>>1, chroma_log2_weight_denom, pPredWeight[0][RefIndexL0].chroma_weight[0], pPredWeight[0][RefIndexL0].chroma_offset[0], pPredWeight[1][RefIndexL1].chroma_weight[0], pPredWeight[1][RefIndexL1].chroma_offset[0]); } } else if (weighted_bipred_idc == 2) { // combine bidir predictions into one, implicit weighting iDistScaleFactor = pDistScaleFactors[RefIndexL0]>>2; // luma BiDirWeightBlockImplicit(pDstY_sb-16, pDstY_sb, pDstY_sb-16, pitch, pitch, sbwidth, sbheight, 64 - iDistScaleFactor, iDistScaleFactor); if (color_format==1) { // chroma BiDirWeightBlockImplicit(pDstV_sb-8, pDstV_sb, pDstV_sb-8, pitch, pitch, sbwidth>>1, sbheight>>1, 64 - iDistScaleFactor, iDistScaleFactor); BiDirWeightBlockImplicit(pDstU_sb-8, pDstU_sb, pDstU_sb-8, pitch, pitch, sbwidth>>1, sbheight>>1, 64 - iDistScaleFactor, iDistScaleFactor); } } else VM_ASSERT(0); } // weighted } // LoopCnt > 1 block++; } // xpos } // ypos } // not 8x8 else { // MBTYPE_INTER_8x8: // 4 8x8 subblocks, each of which can be a different mode. for (block=0; block<4; block++) { /*if (bIsDirect || (psbdir[block] == D_DIR_DIRECT)) { // For a DIRECT (temporal) block, get the subblock partitioning from the // colocated MB in the reference frame. When direct 8x8 inference // is ON, the smallest subpartition is 8x8. blocktype = bUseDirect8x8Inference ? SBTYPE_8x8 : psbtype_ref[block]; } else*/ { blocktype = psbtype[block]; } switch (blocktype) { case SBTYPE_8x8: sbwidth = sbheight = 8; roi.width = 8; roi.height = 8; roi_cr.width = 4; roi_cr.height = 4; break; case SBTYPE_8x4: sbwidth = 8; sbheight = 4; roi.width = 8; roi.height = 4; roi_cr.width = 4; roi_cr.height = 2; break; case SBTYPE_4x8: sbwidth = 4; sbheight = 8; roi.width = 4; roi.height = 8; roi_cr.width = 2; roi_cr.height = 4; break; case SBTYPE_4x4: case SBTYPE_DIRECT: // for spatial mode DIRECT sbwidth = sbheight = 4; roi.width = 4; roi.height = 4; roi_cr.width = 2; roi_cr.height = 2; break; default: VM_ASSERT(0); break; } // switch sbtype for (ypos=yoff8[block]; ypos<yoff8[block]+8; ypos+=sbheight) { for (xpos=xoff8[block]; xpos<xoff8[block]+8; xpos+=sbwidth) { if ((psbdir[block] == D_DIR_BIDIR) || //bIsDirect || (psbdir[block] == D_DIR_DIRECT) || (psbdir[block] == D_DIR_DIRECT_SPATIAL_BIDIR)) { uBlockDir = D_DIR_BIDIR; loopCnt = 2; bUnidirWeightSB = false; } else { loopCnt = 1; if ((psbdir[block] == D_DIR_BWD) || (psbdir[block] == D_DIR_DIRECT_SPATIAL_BWD)) uBlockDir = D_DIR_BWD; else uBlockDir = D_DIR_FWD; bUnidirWeightSB = bUnidirWeightMB; } for (i=0; i<loopCnt; i++) { if ((uBlockDir == D_DIR_BWD) || (i > 0)) { pRefIndex = pRefIndexL1 + (xpos>>2) + (ypos>>2)*4; RefIndexL1 = *pRefIndex;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -