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

📄 umc_vc1_dec_mb_ppic.cpp

📁 audio-video-codecs.rar语音编解码器
💻 CPP
📖 第 1 页 / 共 2 页
字号:

    // MQDIFF, ABSMQ (7.1.3.4)

    if (picLayerHeader->m_PQuant_mode >= VC1_ALTPQUANT_MB_LEVEL)
        GetMQUANT(pContext);

    // if macroblock have predicted => ACPRED (7.1.3.2)
    {
        Ipp8u c[6] = {0};
        Ipp8u a[6] = {0};
        Ipp32s count = 0;
        Ipp32u width = pContext->m_seqLayerHeader->widthMB;

        pContext->m_pSingleMB->ACPRED =0;

        if (VC1_IS_NO_LEFT_MB(LeftTopRightPositionFlag))
        {
            c[0] = (Ipp8u)((pCurrMB - 1)->m_pBlocks[1].blkType & VC1_BLK_INTRA);
            c[2] = (Ipp8u)((pCurrMB - 1)->m_pBlocks[3].blkType & VC1_BLK_INTRA);
            c[4] = (Ipp8u)((pCurrMB - 1)->m_pBlocks[4].blkType & VC1_BLK_INTRA);
            c[5] = (Ipp8u)((pCurrMB - 1)->m_pBlocks[5].blkType & VC1_BLK_INTRA);
        }
        if (VC1_IS_NO_TOP_MB(LeftTopRightPositionFlag))
        {
            a[0] = (Ipp8u)((pCurrMB - width)->m_pBlocks[2].blkType & VC1_BLK_INTRA);
            a[1] = (Ipp8u)((pCurrMB - width)->m_pBlocks[3].blkType & VC1_BLK_INTRA);
            a[4] = (Ipp8u)((pCurrMB - width)->m_pBlocks[4].blkType & VC1_BLK_INTRA);
            a[5] = (Ipp8u)((pCurrMB - width)->m_pBlocks[5].blkType & VC1_BLK_INTRA);
        }
        c[1] = (Ipp8u)(pCurrMB->m_pBlocks[0].blkType & VC1_BLK_INTRA);
        c[3] = (Ipp8u)(pCurrMB->m_pBlocks[2].blkType & VC1_BLK_INTRA);
        a[2] = (Ipp8u)(pCurrMB->m_pBlocks[0].blkType & VC1_BLK_INTRA);
        a[3] = (Ipp8u)(pCurrMB->m_pBlocks[1].blkType & VC1_BLK_INTRA);

        for (i=0;i<VC1_NUM_OF_BLOCKS;i++)
        {
            count+=((pCurrMB->m_pBlocks[i].blkType & VC1_BLK_INTRA)&&((c[i])||(a[i])));
        }

        if (count)
            VC1_GET_BITS(1,pContext->m_pSingleMB->ACPRED);
    }

    return VC1_OK;
}

//Progressive-coded P picture MB
VC1Status MBLayer_ProgressivePpicture(VC1Context* pContext)
{
    Ipp32s SKIPMBBIT;
    Ipp32u blk_num;
    VC1Status vc1Res=VC1_OK;

    VC1MB* pCurrMB = pContext->m_pCurrMB;
    VC1PictureLayerHeader* picLayerHeader = pContext->m_picLayerHeader;
    VC1SingletonMB* sMB = pContext->m_pSingleMB;

    if (picLayerHeader->PQUANT>=9)
        pCurrMB->Overlap = (Ipp8u)pContext->m_seqLayerHeader->OVERLAP;
    else
        pCurrMB->Overlap =0;

#ifdef VC1_DEBUG_ON
    VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_POSITION,
                                        VM_STRING("\t\t\tX: %d, Y: %d\n"),
                                        sMB->m_currMBXpos, sMB->m_currMBYpos);
#endif
    Set_MQuant(pContext);

    pCurrMB->LeftTopRightPositionFlag = CalculateLeftTopRightPositionFlag(sMB);

    memset(pContext->m_pBlock, 0, sizeof(Ipp16s)*8*8*VC1_NUM_OF_BLOCKS);

    //Y
    pCurrMB->currYPitch = sMB->currYPitch;
    pCurrMB->currYPlane = sMB->currYPlane + pCurrMB->currYPitch * sMB->m_currMBYpos*VC1_PIXEL_IN_LUMA
        + sMB->m_currMBXpos*VC1_PIXEL_IN_LUMA;

    //U
    pCurrMB->currUPitch = sMB->currUPitch;
    pCurrMB->currUPlane = sMB->currUPlane + pCurrMB->currUPitch * sMB->m_currMBYpos*VC1_PIXEL_IN_CHROMA
        + sMB->m_currMBXpos*VC1_PIXEL_IN_CHROMA;
    //V
    pCurrMB->currVPitch = sMB->currVPitch;
    pCurrMB->currVPlane = sMB->currVPlane + pCurrMB->currVPitch * sMB->m_currMBYpos*VC1_PIXEL_IN_CHROMA
        + sMB->m_currMBXpos*VC1_PIXEL_IN_CHROMA;

    pCurrMB->mbType = VC1_MB_1MV_INTER | VC1_MB_FORWARD;

    if(picLayerHeader->MVMODE == VC1_MVMODE_MIXED_MV)
    {
        Ipp32s MVMODEBIT;
        //is a 1-bit field present in P frame macroblocks
        //if the frame level field MVTYPEMB (see section 3.2.1.21)
        //indicates that the raw mode is used. If MVMODEBIT = 0
        //then the macroblock is coded in 1MV mode and if
        //MVMODEBIT = 1 then the macroblock is coded in 4MV mode.
        if (VC1_IS_BITPLANE_RAW_MODE(&picLayerHeader->MVTYPEMB))
        {
            VC1_GET_BITS(1, MVMODEBIT);
        }
        else
            MVMODEBIT = picLayerHeader->MVTYPEMB.m_databits[sMB->widthMB * sMB->m_currMBYpos +
                                                                            sMB->m_currMBXpos];

        if(MVMODEBIT == 1)
            pCurrMB->mbType = VC1_MB_4MV_INTER | VC1_MB_FORWARD;
    }

    if(VC1_IS_BITPLANE_RAW_MODE((&picLayerHeader->SKIPMB)))
    {
        //If SKIPMBBIT = 1 then the macroblock is skipped.
        VC1_GET_BITS(1, SKIPMBBIT);
    }
    else
        SKIPMBBIT = picLayerHeader->SKIPMB.m_databits[sMB->widthMB * sMB->m_currMBYpos +
                                                                        sMB->m_currMBXpos];

    if(SKIPMBBIT == 1)
    {

        STATISTICS_START_TIME(m_timeStatistics->motion_vector_decoding_StartTime);

        MBLayer_ProgressivePskipped(pContext);

        STATISTICS_END_TIME(m_timeStatistics->motion_vector_decoding_StartTime,
            m_timeStatistics->motion_vector_decoding_EndTime,
            m_timeStatistics->motion_vector_decoding_TotalTime);

        CalculateIntraFlag(pContext);

        //VM_Debug::GetInstance().vm_debug_frame(-1,VC1_QUANT, VM_STRING("MB Quant = %d\n"), pContext->m_pCurrMB->MQUANT);
        // VM_Debug::GetInstance().vm_debug_frame(-1,VC1_QUANT, VM_STRING("HalfQ = %d\n"), pContext->m_pCurrMB->HALFQP);
    }
    else
    {
        if((VC1_GET_MBTYPE(pCurrMB->mbType))==VC1_MB_1MV_INTER)//1 MV mode
        {
            STATISTICS_START_TIME(m_timeStatistics->motion_vector_decoding_StartTime);

            MBLayer_ProgressivePpicture1MV(pContext);

            STATISTICS_END_TIME(m_timeStatistics->motion_vector_decoding_StartTime,
                m_timeStatistics->motion_vector_decoding_EndTime,
                m_timeStatistics->motion_vector_decoding_TotalTime);
        }
        else //(4 MV Mode)
        {
            STATISTICS_START_TIME(m_timeStatistics->motion_vector_decoding_StartTime);
            //3.2.2.3
            //CBPCY is a variable-length field present in both I picture and P
            //picture macroblock layers. Section 4.1.2.1 describes the CBPCY field
            //in I picture macroblocks and section 4.4.5.2 describes the CBPCY field
            //in P picture macroblocks.
            //CBPCY decoding
            MBLayer_ProgressivePpicture4MV(pContext);

            STATISTICS_END_TIME(m_timeStatistics->motion_vector_decoding_StartTime,
                m_timeStatistics->motion_vector_decoding_EndTime,
                m_timeStatistics->motion_vector_decoding_TotalTime);
        }
        //end 4mv mode

        if(pCurrMB->m_cbpBits && pContext->m_seqLayerHeader->VSTRANSFORM == 1)
            if(picLayerHeader->TTMBF == 0 &&  !(pCurrMB->mbType & VC1_BLK_INTRA) )
            {
                GetTTMB(pContext);
            }
            else
            {
                if(pCurrMB->mbType != VC1_MB_INTRA)
                {
                    for(blk_num = 0; blk_num < VC1_NUM_OF_BLOCKS; blk_num++)
                        if(!(pCurrMB->m_pBlocks[blk_num].blkType & VC1_BLK_INTRA))
                            pCurrMB->m_pBlocks[blk_num].blkType = (Ipp8u)picLayerHeader->TTFRM;
                }
            }

            CalculateIntraFlag(pContext);

            // VM_Debug::GetInstance().vm_debug_frame(-1,VC1_QUANT, VM_STRING("MB Quant = %d\n"), pContext->m_pCurrMB->MQUANT);
            // VM_Debug::GetInstance().vm_debug_frame(-1,VC1_QUANT, VM_STRING("HalfQ = %d\n"), pContext->m_pCurrMB->HALFQP);

            Ipp32u IntraFlag = pCurrMB->IntraFlag;

            if(IntraFlag)
                PDCPredictionTable[pContext->m_seqLayerHeader->DQUANT](pContext);

            sMB->ZigzagTable = ZigZagTables_PB_luma[sMB->ACPRED];

            for(blk_num = 0; blk_num < VC1_NUM_OF_LUMA; blk_num++)
            {
                if(IntraFlag&1)
                    vc1Res = BLKLayer_Intra_Luma(pContext, blk_num, 128,sMB->ACPRED);
                else
                    vc1Res = BLKLayer_Inter_Luma(pContext, blk_num);

               if(vc1Res != VC1_OK)
                {
                    VM_ASSERT(0);
                    break;
                }
                IntraFlag >>= 1;
             }

            sMB->ZigzagTable = ZigZagTables_PB_chroma[sMB->ACPRED];

            if(IntraFlag & 1)
                for(blk_num; blk_num < VC1_NUM_OF_BLOCKS; blk_num++)
                {
                    //all MB intra
                    vc1Res = BLKLayer_Intra_Chroma(pContext, blk_num, 128, sMB->ACPRED);
                    if(vc1Res != VC1_OK)
                    {
                        VM_ASSERT(0);
                        break;
                    }
                }
            else
                for(blk_num; blk_num < VC1_NUM_OF_BLOCKS; blk_num++)
                {
                    //all MB inter
                    vc1Res = BLKLayer_Inter_Chroma(pContext, blk_num);
                    if(vc1Res != VC1_OK)
                    {
                        VM_ASSERT(0);
                        break;
                    }
                }

    }//skipmb

    // VM_Debug::GetInstance().vm_debug_frame(-1,VC1_POSITION,VM_STRING("Macroblock Type: %d\n"), pContext->m_pCurrMB->mbType);
    AssignCodedBlockPattern(pCurrMB,sMB);

    return vc1Res;
}

#endif //UMC_ENABLE_VC1_VIDEO_DECODER

⌨️ 快捷键说明

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