⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 umc_h264_dec_reconstruct_mb_fld.cpp

📁 这是在PCA下的基于IPP库示例代码例子,在网上下了IPP的库之后,设置相关参数就可以编译该代码.
💻 CPP
📖 第 1 页 / 共 3 页
字号:
                            VM_ASSERT(RefIndexL1 >= 0 && RefIndexL1 <                                (Ipp8s)m_CurSliceHeader.num_ref_idx_l1_active);                            RefFieldTop = GetReferenceField(pFields1,RefIndexL1);                            pRefYPlane = pRefPicList1[RefIndexL1]->m_pYPlane;                            pRefVPlane = pRefPicList1[RefIndexL1]->m_pVPlane;                            pRefUPlane = pRefPicList1[RefIndexL1]->m_pUPlane;                            ref_pic_struct = pRefPicList1[RefIndexL1]->m_PictureStructureForDec;                            VM_ASSERT(pRefYPlane);                            VM_ASSERT(pRefVPlane);                            VM_ASSERT(pRefUPlane);                            if(RefFieldTop)                            {                                Ipp32u pitch_2 = pitch >> 1;                                pRefYPlane += pitch_2;                                pRefUPlane += pitch_2;                                pRefVPlane += pitch_2;                            }                            pMV = pMVBwd;                        }                        else                        {                            pRefIndex = pRefIndexL0 + (xpos>>2) + (ypos>>2)*4;                            RefIndexL0 = *pRefIndex;                            VM_ASSERT(RefIndexL0 >= 0 && RefIndexL0 <                                (Ipp8s)m_CurSliceHeader.num_ref_idx_l0_active);                            RefFieldTop = GetReferenceField(pFields0,RefIndexL0);                            pRefYPlane = pRefPicList0[RefIndexL0]->m_pYPlane;                            pRefVPlane = pRefPicList0[RefIndexL0]->m_pVPlane;                            pRefUPlane = pRefPicList0[RefIndexL0]->m_pUPlane;                            ref_pic_struct = pRefPicList0[RefIndexL0]->m_PictureStructureForDec;                            VM_ASSERT(pRefYPlane);                            VM_ASSERT(pRefVPlane);                            VM_ASSERT(pRefUPlane);                            if(RefFieldTop)                            {                                Ipp32u pitch_2 = pitch >> 1;                                pRefYPlane += pitch_2;                                pRefUPlane += pitch_2;                                pRefVPlane += pitch_2;                            }                            pMV = pMVFwd;                        }                        // set pointers for this subblock                        pMV_sb = pMV + (xpos>>2) + (ypos>>2)*4;                        mvx = pMV_sb->mvx;                        mvy = pMV_sb->mvy;                        offsetToBlock = xpos + ypos*pitch;                        pDstY_sb = pDstY + offsetToBlock;                        pRefY_sb = pRefYPlane + offsetToBlock;                        pDstV_sb = pDstV + (offsetToBlock>>1);                        pRefV_sb = pRefVPlane + (offsetToBlock>>1);                        pDstU_sb = pDstU + (offsetToBlock>>1);                        pRefU_sb = pRefUPlane + (offsetToBlock>>1);                        if (i > 0)                        {                            // advance Dst ptrs to next MB position, used as temp store                            // for backward prediction. This is always OK because the Dst                            // buffer is padded at the edges.                            pDstY_sb += 16;                            pDstV_sb += 8;                            pDstU_sb += 8;                        }                        xh = mvx & (INTERP_FACTOR-1);                        yh = mvy & (INTERP_FACTOR-1);                        Ipp8u pred_method=SelectPredictionMethod(                            mbYOffset+ypos,                            mvy,                            sbheight,                            height/2);                        // See comment above about clipping & xh,yh.                        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);                            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                            // 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                }    // for xpos            }    // for ypos        }    // for block    }    // 8x8}    // ReconstructMacroblock_FLD}//namespace UMC

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -