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

📄 umc_vc1_dec_mb_ppic_adv.cpp

📁 audio-video-codecs.rar语音编解码器
💻 CPP
📖 第 1 页 / 共 4 页
字号:
        }
        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);
    }
    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);

            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) )
            {
                //The TTMB field is a variable length field present in P and B
                //picture macroblocks if the picture layer field TTMBF = 1.
                //As shown in tables Table 20, Table 21 and Table 22, the TTMB
                //field specifies the transform type, the signal level and
                //the subblock pattern. If the signal type specifies
                //macroblock mode the transform type decoded from the TTMB
                //field is used to decode all coded blocks in the macroblock.
                //If the signal type signals block mode then the transform
                //type decoded from the TTMB field is used to decode the first
                //coded block in the macroblock. The transform type of the
                //remaining blocks is coded at the block level. If the
                //transform type is 8x4 or 4x8 then the subblock pattern
                //indicates the subblock pattern of the first block.
                //The table used to decode the TTMB field depends on the
                //value of PQUANT. For PQUANT less than or equal to 4,
                //Table 20 is used. For PQUANT greater than 4 and less than
                //or equal to 12, Table 21 is used. For PQUANT greater than
                //12, Table 22 is used.
                //The subblock pattern indicates which of 8x4 or 4x8 subblocks
                //have at least one non-zero coefficient.
                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);
        if(pCurrMB->IntraFlag)
            PDCPredictionTable[pContext->m_seqLayerHeader->DQUANT](pContext);

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

        for(blk_num = 0; blk_num < VC1_NUM_OF_LUMA; blk_num++)
        {
            //all MB intra in I picture
            if(pCurrMB->m_pBlocks[blk_num].blkType & VC1_BLK_INTER)
            {
                vc1Res = BLKLayer_Inter_Luma_Adv(pContext, blk_num);
                if(vc1Res != VC1_OK)
                {
                    VM_ASSERT(0);
                    break;
                }
            }
            else
            {
                vc1Res = BLKLayer_Intra_Luma_Adv(pContext, blk_num, sMB->ACPRED);
                if(vc1Res != VC1_OK)
                {
                    VM_ASSERT(0);
                    break;
                }
            }
        }

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

        if(pCurrMB->m_pBlocks[blk_num].blkType & VC1_BLK_INTER)
            for(blk_num; blk_num < VC1_NUM_OF_BLOCKS; blk_num++)
            {
                //all MB inter
                vc1Res = BLKLayer_Inter_Chroma_Adv(pContext, blk_num);
                if(vc1Res != VC1_OK)
                {
                    VM_ASSERT(0);
                    break;
                }
            }
        else
            for(blk_num; blk_num < VC1_NUM_OF_BLOCKS; blk_num++)
            {
                //all MB intra
                vc1Res = BLKLayer_Intra_Chroma_Adv(pContext, blk_num,sMB->ACPRED);
                if(vc1Res != VC1_OK)
                {
                    VM_ASSERT(0);
                    break;
                }
            }

    }
    AssignCodedBlockPattern(pCurrMB,sMB);

    return vc1Res;
}

VC1Status MBLayer_Frame_InterlacedPpicture(VC1Context* pContext)
{
    VC1Status vc1Res=VC1_OK;
    VC1MB* pCurrMB = pContext->m_pCurrMB;
    VC1SingletonMB* sMB = pContext->m_pSingleMB;
    VC1PictureLayerHeader* picLayerHeader = pContext->m_picLayerHeader;

    Ipp32s SKIPMBBIT;
    Ipp32s tempValue;
    Ipp32s blk_num;
    Ipp32u ACPRED = 0;
    //for smoothing
    pCurrMB->Overlap = (Ipp8u)pContext->m_seqLayerHeader->OVERLAP;
    if(picLayerHeader->PQUANT < 9)
           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
    //QUANT
    Set_MQuant(pContext);

    pCurrMB->LeftTopRightPositionFlag = CalculateLeftTopRightPositionFlag(sMB);

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

    //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;

    //check SKIPMB mode
    {
        if(VC1_IS_BITPLANE_RAW_MODE(&picLayerHeader->SKIPMB))
        {
            VC1_GET_BITS(1, SKIPMBBIT);
        }
        else
        {
            SKIPMBBIT = picLayerHeader->SKIPMB.m_databits
                [sMB->widthMB * sMB->m_currMBYpos +  sMB->m_currMBXpos];
        }
    }

    if(SKIPMBBIT == 1)
    {
        //standard 10.7.3.3.
        MBLayer_InterlacePskipped(pContext);
        CalculateIntraFlag(pContext);
    }
    else
    {
        Ipp32s ret;
        ret = ippiDecodeHuffmanOne_1u32s (
            &pContext->m_bitstream.pBitstream,
            &pContext->m_bitstream.bitOffset,
            &sMB->MBMODEIndex,
            picLayerHeader->m_pMBMode
            );
        VM_ASSERT(ret == ippStsNoErr);

        pCurrMB->mbType = VC1_MB_Mode_PBPic_MBtype_Table[sMB->MBMODEIndex];

        //INTRA
        if(pCurrMB->mbType == VC1_MB_INTRA)
        {
            //check fieldtx coding mode
            {
                Ipp32s FIELDTX;
                if(VC1_IS_BITPLANE_RAW_MODE(&picLayerHeader->FIELDTX))
                {
                    VC1_GET_BITS(1, FIELDTX);
                }
                else
                {
                    FIELDTX = picLayerHeader->FIELDTX.m_databits
                        [sMB->widthMB * sMB->m_currMBYpos + sMB->m_currMBXpos];
                }
                pCurrMB->FIELDTX = FIELDTX;
            }

            VC1_GET_BITS(1, tempValue);  //CBPRESENT
            for(blk_num = 0; blk_num < VC1_NUM_OF_BLOCKS; blk_num++)
            {
                pCurrMB->m_pBlocks[blk_num].blkType = VC1_BLK_INTRA;
            }


            if(tempValue == 1)       //CBPRESENT
            {
                //CBPCY decoding
                Ipp32s ret;
                ret = ippiDecodeHuffmanOne_1u32s(&pContext->m_bitstream.pBitstream,
                    &pContext->m_bitstream.bitOffset,
                    &pCurrMB->m_cbpBits,
                    picLayerHeader->m_pCurrCBPCYtbl);

                VM_ASSERT(ret == ippStsNoErr);
            }
            else
            {
                pCurrMB->m_cbpBits = 0;
            }

            VC1_GET_BITS(1, ACPRED);

            if (picLayerHeader->m_DQuantFRM)
                Set_Alt_MQUANT(pContext);


            CalculateIntraFlag(pContext);

            PDCPredictionTable[pContext->m_seqLayerHeader->DQUANT](pContext);
            sMB->ZigzagTable = AdvZigZagTables_PBInterlace_luma[ACPRED];

            for(blk_num = 0; blk_num < VC1_NUM_OF_LUMA; blk_num++)
            {
                vc1Res = BLKLayer_Intra_Luma_Adv(pContext, blk_num,ACPRED);
                if(vc1Res != VC1_OK)
                {
                    VM_ASSERT(0);
                    break;
                }
            }
            sMB->ZigzagTable = AdvZigZagTables_PBInterlace_chroma[ACPRED];
            for(blk_num; blk_num < VC1_NUM_OF_BLOCKS; blk_num++)
            {
                //all MB intra
                vc1Res = BLKLayer_Intra_Chroma_Adv(pContext, blk_num,ACPRED);
                if(vc1Res != VC1_OK)
                {
                    VM_ASSERT(0);
                    break;
                }
            }
        }
        else
        {
            //inter block
            pCurrMB->mbType |= VC1_MB_FORWARD;

            pCurrMB->FIELDTX = VC1_MB_Mode_PBPic_FIELDTX_Table[sMB->MBMODEIndex];

            if(VC1_MB_Mode_PBPic_Transform_Table[sMB->MBMODEIndex] != VC1_NO_CBP_TRANSFORM)
            {
                //CBPCY decoding
                Ipp32s ret;
                ret = ippiDecodeHuffmanOne_1u32s(&pContext->m_bitstream.pBitstream,
                    &pContext->m_bitstream.bitOffset,
                    &pCurrMB->m_cbpBits,
                    picLayerHeader->m_pCurrCBPCYtbl);

                VM_ASSERT(ret == ippStsNoErr);
            }
            else
                pCurrMB->m_cbpBits = 0;


            switch (VC1_GET_MBTYPE(pCurrMB->mbType))
            {
            case VC1_MB_2MV_INTER:
                {
                    Ipp32s ret;
                    ret = ippiDecodeHuffmanOne_1u32s(&pContext->m_bitstream.pBitstream,
                        &pContext->m_bitstream.bitOffset,
                        &pCurrMB->MVBP,
                        picLayerHeader->m_pMV2BP);

⌨️ 快捷键说明

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