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

📄 umc_h264_dec_reconstruct_mb_aff.cpp

📁 这是在PCA下的基于IPP库示例代码例子,在网上下了IPP的库之后,设置相关参数就可以编译该代码.
💻 CPP
📖 第 1 页 / 共 4 页
字号:
/*////              INTEL CORPORATION PROPRIETARY INFORMATION//  This software is supplied under the terms of a license  agreement or//  nondisclosure agreement with Intel Corporation and may not be copied//  or disclosed except in  accordance  with the terms of that agreement.//        Copyright (c) 2003-2005 Intel Corporation. All Rights Reserved.////*/#include "umc_h264_dec.h"using namespace IppLevel;namespace UMC{    void H264VideoDecoder::ReconstructMacroblockMBAFF(        Ipp8u *pDstY,        Ipp8u *pDstV,        Ipp8u *pDstU,        Ipp32u mbXOffset, // for edge clipping        Ipp32u mbYOffset,        bool bUseDirect8x8Inference,        H264DecoderFrame **pRefPicList0,        H264DecoderFrame **pRefPicList1,        Ipp8u  color_format        )    {        // this variable is used only in debug purposes        Ipp8u   *pRefYPlane;        Ipp8u   *pRefVPlane;        Ipp8u   *pRefUPlane;        Ipp8u   *pRef;        H264DecoderMotionVector *pMV;        Ipp8s   *pRefIndex;        Ipp32u mbtype = m_cur_mb.GlobalMacroblockInfo->mbtype;        Ipp32u blocktype;        Ipp8u *psbtype = m_cur_mb.GlobalMacroblockInfo->sbtype;        Ipp8u *psbdir = m_cur_mb.LocalMacroblockInfo->sbdir;        Ipp32s offsetY;        Ipp32u offsetMV;        Ipp32u offsetToBlock;        Ipp32s pitch;        Ipp32u /*subBlockPitch,*/ block, i, loopCnt;        Ipp32s xint, yint, xh, yh;        Ipp32s mvx, mvy;        Ipp32s width;        Ipp32s height;        Ipp32s xpos, ypos, sbwidth, sbheight;        IppiSize        roi, roi_cr;        // pointers for current subblock        H264DecoderMotionVector *pMV_sb;        Ipp8u *pRefY_sb;        Ipp8u *pDstY_sb;        Ipp8u *pRefV_sb;        Ipp8u *pDstV_sb;        Ipp8u *pRefU_sb;        Ipp8u *pDstU_sb;        //    bool bIsDirect = false;        //const T_Interp4FnxTable *InterpFunc = m_InterpFunc;        //Ipp32s MBRef;        //Ipp8u *psbtype_ref;        Ipp32u uBlockDir;        // one of D_DIR_FWD, D_DIR_BWD, D_DIR_BIDIR        bool bBidirWeightMB = false;    // is bidir weighting in effect for the MB?        bool bUnidirWeightMB = false;    // is explicit L0 weighting in effect for the MB?        bool bUnidirWeightSB = false;    // is explicit L0 weighting in effect for the subblock?        Ipp32u uSliceNum;        // Optional weighting vars        Ipp32u CurrPicParamSetId;        Ipp32u weighted_bipred_idc = 0;        Ipp32u luma_log2_weight_denom;        Ipp32u chroma_log2_weight_denom;        PredWeightTable *pPredWeight[2] = {NULL, NULL};        // [L0,L1]        Ipp32s iDistScaleFactor;        const Ipp32s *pDistScaleFactors;        H264DecoderMotionVector *pMVFwd = NULL;        H264DecoderMotionVector *pMVBwd = NULL;        Ipp8s *pRefIndexL0 = NULL;        Ipp8s *pRefIndexL1 = NULL;        Ipp8s RefIndexL0 = NULL;        Ipp8s RefIndexL1 = NULL;        Ipp8u RefField;        Ipp8u ref_pic_struct;        VM_ASSERT(IS_INTER_MBTYPE(mbtype));        width = m_pCurrentFrame->lumaSize().width;        height = m_pCurrentFrame->lumaSize().height;        pitch = m_pCurrentFrame->pitch();        Ipp8u mb_field_decoding_flag = pGetMBFieldDecodingFlag(m_cur_mb.GlobalMacroblockInfo);        Ipp8u bottom_mb=pGetMBBottomFlag(m_cur_mb.GlobalMacroblockInfo);        if (mb_field_decoding_flag && bottom_mb) mbYOffset-=16;        offsetY = mbXOffset + mbYOffset*pitch;        offsetMV = 0;        uSliceNum = m_cur_mb.GlobalMacroblockInfo->slice_id;        CurrPicParamSetId = m_CurSliceHeader.pic_parameter_set_id;        pMVFwd = m_cur_mb.MVs[0]->MotionVectors;        pRefIndexL0 = m_cur_mb.RefIdxs[0]->RefIdxs;        if (((PREDSLICE == m_CurSliceHeader.slice_type) ||            (S_PREDSLICE == m_CurSliceHeader.slice_type)) &&            (m_PicParamSet[CurrPicParamSetId].weighted_pred_flag != 0))        {            // L0 weighting specified in pic param set. Get weighting params            // for the slice.            pPredWeight[0] = &m_pPredWeight_L0[uSliceNum*MAX_NUM_REF_FRAMES];            luma_log2_weight_denom = m_CurSliceHeader.luma_log2_weight_denom;            chroma_log2_weight_denom = m_CurSliceHeader.chroma_log2_weight_denom;            bUnidirWeightMB = true;        }        // get luma interp func pointer table in cache        if (m_CurSliceHeader.slice_type == BPREDSLICE)        {            VM_ASSERT(pRefPicList1[0]);            //Ipp32s yM=0;            //MBRef = GetColocatedLocation(pRefPicList1[0],0,yM);            pMVBwd = m_cur_mb.MVs[1]->MotionVectors;            pRefIndexL1 = m_cur_mb.RefIdxs[1]->RefIdxs;            //psbtype_ref = pRefPicList1[0]->m_mbinfo.mbs[MBRef].sbtype;            // DIRECT MB have the same subblock partition structure as the            // colocated MB. Take advantage of that to perform motion comp            // for the direct MB using the largest partitions possible.            if (mbtype == MBTYPE_DIRECT || mbtype == MBTYPE_SKIPPED)            {                //if (pRefPicList1[0]->m_mbinfo.mbs[MBRef].mbtype == MBTYPE_INTER_8x8 ||                //  pRefPicList1[0]->m_mbinfo.mbs[MBRef].mbtype == MBTYPE_INTER_8x8_REF0 ||                //IS_INTRA_MBTYPE(mbtype))                //mbtype = pRefPicList1[0]->m_mbinfo.mbs[MBRef].mbtype;                //            bIsDirect = true;                // If the colocated MB is INTRA, all MV are zero                //if (IS_INTRA_MBTYPE(mbtype))                //    mbtype = MBTYPE_SKIPPED;                //else                mbtype = MBTYPE_INTER_8x8;            }            // Bi-dir weighting?            weighted_bipred_idc = m_PicParamSet[CurrPicParamSetId].weighted_bipred_idc;            if (weighted_bipred_idc == 1)            {                // explicit bidir weighting                pPredWeight[0] = &m_pPredWeight_L0[uSliceNum*MAX_NUM_REF_FRAMES];                pPredWeight[1] = &m_pPredWeight_L1[uSliceNum*MAX_NUM_REF_FRAMES];                luma_log2_weight_denom = m_CurSliceHeader.luma_log2_weight_denom;                chroma_log2_weight_denom = m_CurSliceHeader.chroma_log2_weight_denom;                bUnidirWeightMB = true;                bBidirWeightMB = true;            }            if (weighted_bipred_idc == 2)            {                // need revisitiing !!!                if (mb_field_decoding_flag)                    pDistScaleFactors = m_CurSliceInfo.DistScaleFactorAFF[bottom_mb][bottom_mb][bottom_mb];                else                    pDistScaleFactors = m_CurSliceInfo.DistScaleFactor;                bBidirWeightMB = true;            }        }        if (mbtype != MBTYPE_INTER_8x8 && mbtype != MBTYPE_INTER_8x8_REF0)        {            if (mbtype == MBTYPE_INTER_16x8)            {                sbwidth = 16;                sbheight = 8;                roi.width        = 16;                roi.height        = 8;                roi_cr.width    = 8;                roi_cr.height    = 4;            }            else if (mbtype == MBTYPE_INTER_8x16)            {                sbwidth = 8;                sbheight = 16;                roi.width        = 8;                roi.height        = 16;                roi_cr.width    = 4;                roi_cr.height    = 8;            }            else            {                sbwidth = sbheight = 16;                roi.width        = 16;                roi.height        = 16;                roi_cr.width    = 8;                roi_cr.height    = 8;            }            block = 0;            for (ypos=0; ypos<16; ypos+=sbheight)            {                for (xpos=0; xpos<16; xpos+=sbwidth)                {                    if ((mbtype == MBTYPE_BIDIR) ||                        (psbdir[block] == D_DIR_BIDIR) /*|| bIsDirect*/)                    {                        uBlockDir = D_DIR_BIDIR;                        loopCnt = 2;                        bUnidirWeightSB = false;                    }                    else                    {                        loopCnt = 1;                        if ((mbtype == MBTYPE_BACKWARD) ||                            (psbdir[block] == D_DIR_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;                            VM_ASSERT(RefIndexL1 >= 0 && RefIndexL1 <

⌨️ 快捷键说明

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