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

📄 umc_h264_dec_deblocking_mbaff.cpp

📁 这是在PCA下的基于IPP库示例代码例子,在网上下了IPP的库之后,设置相关参数就可以编译该代码.
💻 CPP
📖 第 1 页 / 共 5 页
字号:
    pParams->DeblockingFlag[HORIZONTAL_DEBLOCKING] = 1;    // fill "complex deblocking" strength    if (pParams->UseComplexVerticalDeblocking)    {        SetEdgeStrength(pParams->StrengthComplex + 0, 4);        SetEdgeStrength(pParams->StrengthComplex + 4, 4);    }    // calculate strengths    if (pParams->ExternalEdgeFlag[VERTICAL_DEBLOCKING])    {        // deblocking with strong deblocking of external edge        SetEdgeStrength(pParams->Strength[VERTICAL_DEBLOCKING] + 0, 4);    }    SetEdgeStrength(pParams->Strength[VERTICAL_DEBLOCKING] + 4, 3);    SetEdgeStrength(pParams->Strength[VERTICAL_DEBLOCKING] + 8, 3);    SetEdgeStrength(pParams->Strength[VERTICAL_DEBLOCKING] + 12, 3);    if (pParams->ExternalEdgeFlag[HORIZONTAL_DEBLOCKING])    {        if ((pGetMBFieldDecodingFlag(m_pCurrentFrame->m_mbinfo.mbs + pParams->nMBAddr)) ||            (pParams->ExtraHorizontalEdge))        {            // deblocking field macroblock with external edge            SetEdgeStrength(pParams->Strength[HORIZONTAL_DEBLOCKING] + 0, 3);        }        else        {            // deblocking with strong deblocking of external edge            SetEdgeStrength(pParams->Strength[HORIZONTAL_DEBLOCKING] + 0, 4);        }    }    SetEdgeStrength(pParams->Strength[HORIZONTAL_DEBLOCKING] + 4, 3);    SetEdgeStrength(pParams->Strength[HORIZONTAL_DEBLOCKING] + 8, 3);    SetEdgeStrength(pParams->Strength[HORIZONTAL_DEBLOCKING] + 12, 3);    if (pParams->ExtraHorizontalEdge)    {        // set extra edge strength        SetEdgeStrength(pParams->StrengthExtra + 0, 3);        SetEdgeStrength(pParams->StrengthExtra + 4, 0);        SetEdgeStrength(pParams->StrengthExtra + 8, 0);        SetEdgeStrength(pParams->StrengthExtra + 12, 0);    }} // void H264VideoDecoder::PrepareDeblockingParametersISliceMBAFF(DeblockingParametersMBAFF *pParams)void H264VideoDecoder::PrepareDeblockingParametersPSliceMBAFF(DeblockingParametersMBAFF *pParams){    Ipp32u mbtype = (m_pCurrentFrame->m_mbinfo.mbs + pParams->nMBAddr)->mbtype;    Ipp32u nAboveMBFieldCoded;    // when this macroblock is intra coded    if (IS_INTRA_MBTYPE(mbtype))    {        PrepareDeblockingParametersISliceMBAFF(pParams);        return;    }    nAboveMBFieldCoded = pGetMBFieldDecodingFlag(m_pCurrentFrame->m_mbinfo.mbs + pParams->nNeighbour[HORIZONTAL_DEBLOCKING]);    // when there are no special cases    if ((0 == nAboveMBFieldCoded) &&        (0 == pParams->MBFieldCoded) &&        (0 == pParams->UseComplexVerticalDeblocking))    {        // prepare whole macroblock parameters        PrepareDeblockingParametersPSlice(pParams);        return;    }    // when current macroblock is frame coded    if (0 == pParams->MBFieldCoded)    {        // prepare "complex vertical deblocking" parameters        if (pParams->UseComplexVerticalDeblocking)            PrepareDeblockingParametersPSlice4MBAFFComplexFrameExternalEdge(pParams);        // fill vertical edges parameters        PrepareDeblockingParametersPSlice4(VERTICAL_DEBLOCKING, pParams);        // fill extra edge parameters        if (pParams->ExtraHorizontalEdge)        {            // set correct above neighbour            pParams->nNeighbour[HORIZONTAL_DEBLOCKING] += mb_width;            // obtain parameters            PrepareDeblockingParametersPSlice4MBAFFMixedExternalEdge(pParams);            // restore above neighbour            pParams->nNeighbour[HORIZONTAL_DEBLOCKING] -= mb_width;            // copy parameters to right place            CopyEdgeStrength(pParams->StrengthExtra, pParams->Strength[HORIZONTAL_DEBLOCKING]);            // fill horizontal edges parameters            PrepareDeblockingParametersPSlice4MBAFFMixedExternalEdge(pParams);            pParams->ExternalEdgeFlag[HORIZONTAL_DEBLOCKING] = 0;            PrepareDeblockingParametersPSlice4(HORIZONTAL_DEBLOCKING, pParams);            pParams->ExternalEdgeFlag[HORIZONTAL_DEBLOCKING] = 1;        }        else            PrepareDeblockingParametersPSlice4(HORIZONTAL_DEBLOCKING, pParams);    }    // when current macroblock is field coded    else    {        // prepare "complex vertical deblocking" parameters        if (pParams->UseComplexVerticalDeblocking)            PrepareDeblockingParametersPSlice4MBAFFComplexFieldExternalEdge(pParams);        // fill vertical edges parameters        PrepareDeblockingParametersPSlice4MBAFFField(VERTICAL_DEBLOCKING, pParams);        // when above macroblock is frame coded        if (nAboveMBFieldCoded != pParams->MBFieldCoded)        {            PrepareDeblockingParametersPSlice4MBAFFMixedExternalEdge(pParams);            pParams->ExternalEdgeFlag[HORIZONTAL_DEBLOCKING] = 0;            PrepareDeblockingParametersPSlice4MBAFFField(HORIZONTAL_DEBLOCKING, pParams);            pParams->ExternalEdgeFlag[HORIZONTAL_DEBLOCKING] = 1;        }        else            PrepareDeblockingParametersPSlice4MBAFFField(HORIZONTAL_DEBLOCKING, pParams);    }} // void H264VideoDecoder::PrepareDeblockingParametersPSliceMBAFF(DeblockingParametersMBAFF *pParams)void H264VideoDecoder::PrepareDeblockingParametersBSliceMBAFF(DeblockingParametersMBAFF *pParams){    Ipp32u mbtype = (m_pCurrentFrame->m_mbinfo.mbs + pParams->nMBAddr)->mbtype;    Ipp32u nAboveMBFieldCoded;    // when this macroblock is intra coded    if (IS_INTRA_MBTYPE(mbtype))    {        PrepareDeblockingParametersISliceMBAFF(pParams);        return;    }    nAboveMBFieldCoded = pGetMBFieldDecodingFlag(m_pCurrentFrame->m_mbinfo.mbs + pParams->nNeighbour[HORIZONTAL_DEBLOCKING]);    // when there are no special cases    if ((0 == nAboveMBFieldCoded) &&        (0 == pParams->MBFieldCoded) &&        (0 == pParams->UseComplexVerticalDeblocking))    {        // prepare whole macroblock parameters        PrepareDeblockingParametersBSlice(pParams);        return;    }    // when current macroblock is frame coded    if (0 == pParams->MBFieldCoded)    {        // prepare "complex vertical deblocking" parameters        if (pParams->UseComplexVerticalDeblocking)            PrepareDeblockingParametersPSlice4MBAFFComplexFrameExternalEdge(pParams);        // fill vertical edges parameters        PrepareDeblockingParametersBSlice4(VERTICAL_DEBLOCKING, pParams);        // fill extra edge parameters        if (pParams->ExtraHorizontalEdge)        {            // set correct above neighbour            pParams->nNeighbour[HORIZONTAL_DEBLOCKING] += mb_width;            // obtain parameters            PrepareDeblockingParametersPSlice4MBAFFMixedExternalEdge(pParams);            // restore above neighbour            pParams->nNeighbour[HORIZONTAL_DEBLOCKING] -= mb_width;            // copy parameters to right place            CopyEdgeStrength(pParams->StrengthExtra, pParams->Strength[HORIZONTAL_DEBLOCKING]);            // fill horizontal edges parameters            PrepareDeblockingParametersPSlice4MBAFFMixedExternalEdge(pParams);            pParams->ExternalEdgeFlag[HORIZONTAL_DEBLOCKING] = 0;            PrepareDeblockingParametersBSlice4(HORIZONTAL_DEBLOCKING, pParams);            pParams->ExternalEdgeFlag[HORIZONTAL_DEBLOCKING] = 1;        }        else            PrepareDeblockingParametersBSlice4(HORIZONTAL_DEBLOCKING, pParams);    }    // when current macroblock is field coded    else    {        // prepare "complex vertical deblocking" parameters        if (pParams->UseComplexVerticalDeblocking)            PrepareDeblockingParametersPSlice4MBAFFComplexFieldExternalEdge(pParams);        // fill vertical edges parameters        PrepareDeblockingParametersBSlice4MBAFFField(VERTICAL_DEBLOCKING, pParams);        // when above macroblock is frame coded        if ((nAboveMBFieldCoded != pParams->MBFieldCoded) &&            (pParams->ExternalEdgeFlag[HORIZONTAL_DEBLOCKING]))        {            PrepareDeblockingParametersPSlice4MBAFFMixedExternalEdge(pParams);            pParams->ExternalEdgeFlag[HORIZONTAL_DEBLOCKING] = 0;            PrepareDeblockingParametersBSlice4MBAFFField(HORIZONTAL_DEBLOCKING, pParams);            pParams->ExternalEdgeFlag[HORIZONTAL_DEBLOCKING] = 1;        }        else            PrepareDeblockingParametersBSlice4MBAFFField(HORIZONTAL_DEBLOCKING, pParams);    }} // void H264VideoDecoder::PrepareDeblockingParametersBSliceMBAFF(DeblockingParametersMBAFF *pParams)void H264VideoDecoder::PrepareDeblockingParametersPSlice4MBAFFMixedExternalEdge(DeblockingParameters *pParams){    Ipp32u MBAddr = pParams->nMBAddr;    Ipp32u cbp4x4 = (m_mbinfo.mbs + MBAddr)->cbp4x4;    Ipp8u *pStrength = pParams->Strength[HORIZONTAL_DEBLOCKING];    Ipp32u nNeighbour;    //    // external edge    //    // mixed edge is always deblocked    {        Ipp32u *pDeblockingFlag = &(pParams->DeblockingFlag[HORIZONTAL_DEBLOCKING]);        *pDeblockingFlag = 1;    }    // select neighbour addres    nNeighbour = pParams->nNeighbour[HORIZONTAL_DEBLOCKING];    // when neighbour macroblock isn't intra    if (!IS_INTRA_MBTYPE((m_pCurrentFrame->m_mbinfo.mbs + nNeighbour)->mbtype))    {        H264DecoderMacroblockLocalInfo *pNeighbour;        Ipp32u idx;        // select neighbour        pNeighbour = m_mbinfo.mbs + nNeighbour;        // cicle on blocks        for (idx = 0;idx < 4;idx += 1)        {            Ipp32u blkQ, blkP;            blkQ = EXTERNAL_BLOCK_MASK[HORIZONTAL_DEBLOCKING][CURRENT_BLOCK][idx];            blkP = EXTERNAL_BLOCK_MASK[HORIZONTAL_DEBLOCKING][NEIGHBOUR_BLOCK][idx];            // when one of couple of blocks has coeffs            if ((cbp4x4 & blkQ) ||                (pNeighbour->cbp4x4 & blkP))                pStrength[idx] = 2;            // when blocks nave no coeffs            // we set strength is 1 in mixed mode            else                pStrength[idx] = 1;        }    }    // external edge required in strong filtering    else        SetEdgeStrength(pStrength + 0, 3);} // void H264VideoDecoder::PrepareDeblockingParametersPSlice4MBAFFMixedExternalEdge(DeblockingParameters *pParams)void H264VideoDecoder::PrepareDeblockingParametersPSlice4MBAFFComplexFrameExternalEdge(DeblockingParametersMBAFF *pParams){    Ipp32u MBAddr = pParams->nMBAddr;    Ipp32u cbp4x4 = (m_mbinfo.mbs + MBAddr)->cbp4x4;    Ipp8u *pStrength = pParams->StrengthComplex;    Ipp32u i, nNeighbourBlockInc;    // mixed edge is always deblocked    {        Ipp32u *pDeblockingFlag = &(pParams->DeblockingFlag[VERTICAL_DEBLOCKING]);        *pDeblockingFlag = 1;    }    // calculate neighbour block addition    nNeighbourBlockInc = (pGetMBBottomFlag(m_pCurrentFrame->m_mbinfo.mbs + pParams->nMBAddr)) ? (2) : (0);    // we fill parameters using 2 passes    for (i = 0;i < 2;i += 1)    {        Ipp32u nNeighbour;        // select neighbour addres        nNeighbour = pParams->nLeft[i];        // when neighbour macroblock isn't intra        if (!IS_INTRA_MBTYPE((m_pCurrentFrame->m_mbinfo.mbs + nNeighbour)->mbtype))        {            H264DecoderMacroblockLocalInfo *pNeighbour;            Ipp32u idx;            // select neighbour            pNeighbour = m_mbinfo.mbs + nNeighbour;            // cicle on blocks            for (idx = 0;idx < 4;idx += 1)            {                Ipp32u blkQ, blkP;                blkQ = EXTERNAL_BLOCK_MASK[VERTICAL_DEBLOCKING][CURRENT_BLOCK][idx];                blkP = EXTERNAL_BLOCK_MASK[VERTICAL_DEBLOCKING][NEIGHBOUR_BLOCK][idx / 2 + nNeighbourBlockInc];                // when one of couple of blocks has coeffs                if ((cbp4x4 & blkQ) ||                    (pNeighbour->cbp4x4 & blkP))                    pStrength[idx] = 2;                // when blocks have no coeffs                // set strength is 1                else                    pStrength[idx] = 1;            }        }

⌨️ 快捷键说明

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