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

📄 umc_vc1_dec_mb_interpolate_adv.cpp

📁 audio-video-codecs.rar语音编解码器
💻 CPP
📖 第 1 页 / 共 5 页
字号:
    pRefData  = pVPlaneRef;
    pCurrData = pDst2 + dstStep2;

    if (f)
        pRefData += refPitch;
    refPitch  <<= 1;

    interp_params->pSrc = pRefData + ((xMV>>2) + (yMV>>2) * refPitch);
    interp_params->pDst = pCurrData;

    ippiInterpolateQPBilinear_VC1_8u_C1R(interp_params);

    interp_params->srcStep = interp_params->srcStep/2;
    interp_params->dstStep = 8;

    return VC1_OK;
}

static VC1Status InterpolateBlock_InterlacePictureChroma2MV_B(VC1Context* pContext,
                                                              Ipp8u *pDst1, Ipp32s dstStep1,
                                                              Ipp8u *pDst2, Ipp32s dstStep2,
                                                              Ipp32s back1, Ipp32s back2)
{
    VC1MB *pMB = pContext->m_pCurrMB;
    Ipp32s index = (back1)? pContext->m_frmBuff.m_iNextIndex:pContext->m_frmBuff.m_iPrevIndex;

    _IppVCInterpolate_8u*  interp_params = &pContext->interp_params_chroma;

    Ipp8u* pRefData = NULL;
    Ipp8u* pCurrData = NULL;
    Ipp32s refPitch = 0;

    Ipp16s xMV=0,yMV=0;
    Ipp32s f = 0;

    interp_params->roiSize.width = 8;
    interp_params->roiSize.height = 4;

    pRefData  = pContext->m_frmBuff.m_pFrames[index].m_pU;
    refPitch  = pContext->m_frmBuff.m_pFrames[index].m_iUPitch;

    //VM_Debug::GetInstance().vm_debug_frame(-1,VC1_BFRAMES,VM_STRING("interpolation(%d block)MV(%d,%d) back=%d\n"),blk_num,xMV,yMV,back);

    //TOP FIELD
    xMV = pMB->m_pBlocks[0].mv[back1][0];
    yMV = pMB->m_pBlocks[0].mv[back1][1];

    f = CalcMVInterpolateInterlacedChroma2MV(pContext, &xMV, &yMV);

    //BLOCK 4
    pCurrData = pDst1;

    if (f)
       pRefData += refPitch;

    refPitch  <<= 1;

    interp_params->pSrc = pRefData + ((xMV>>2) + (yMV>>2) * refPitch);
    interp_params->srcStep = 2*interp_params->srcStep;
    interp_params->pDst = pCurrData;
    interp_params->dstStep = dstStep1*2;
    interp_params->dx = xMV&3;
    interp_params->dy = yMV&3;

#ifdef VC1_DEBUG_ON
//    VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_PRED,VM_STRING("Before Interpolation interlace chroma%d, %d\n"),X,Y);
#endif
    ippiInterpolateQPBilinear_VC1_8u_C1R(interp_params);

    //BLOCK 5
    pRefData  = pContext->m_frmBuff.m_pFrames[index].m_pV;
    refPitch  = pContext->m_frmBuff.m_pFrames[index].m_iVPitch;

    pCurrData = pDst2;

    if (f)
       pRefData += refPitch;

    refPitch  <<= 1;

    interp_params->pSrc = pRefData + ((xMV>>2) + (yMV>>2) * refPitch);
    interp_params->pDst = pCurrData;
    interp_params->dstStep = dstStep2*2;

    ippiInterpolateQPBilinear_VC1_8u_C1R(interp_params);

    //BOTTOM FIELD
    index = (back2)? pContext->m_frmBuff.m_iNextIndex:pContext->m_frmBuff.m_iPrevIndex;
    pRefData  = pContext->m_frmBuff.m_pFrames[index].m_pU;
    refPitch  = pContext->m_frmBuff.m_pFrames[index].m_iUPitch;

    xMV = pMB->m_pBlocks[0].mv_bottom[back2][0];
    yMV = pMB->m_pBlocks[0].mv_bottom[back2][1];

    f = CalcMVInterpolateInterlacedChroma2MV(pContext, &xMV, &yMV);

    //BLOCK 4
    pCurrData = pDst1 + dstStep1;

    if (f)
        yMV = yMV + 4;
     else
       pRefData += refPitch;

    refPitch  <<= 1;

    interp_params->pSrc = pRefData + ((xMV>>2) + (yMV>>2) * refPitch);
    interp_params->pDst = pCurrData;
    interp_params->dstStep = dstStep1*2;
    interp_params->dx = xMV&3;
    interp_params->dy = yMV&3;

#ifdef VC1_DEBUG_ON
//    VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_PRED,VM_STRING("Before Interpolation interlace chroma%d, %d\n"),X,Y);
#endif

    ippiInterpolateQPBilinear_VC1_8u_C1R(interp_params);

    //BLOCK 5
    pRefData  = pContext->m_frmBuff.m_pFrames[index].m_pV;
    refPitch  = pContext->m_frmBuff.m_pFrames[index].m_iVPitch;

    pCurrData = pDst2 + dstStep2;

    if (!f)
       pRefData += refPitch;

    refPitch  <<= 1;

    interp_params->pSrc = pRefData + ((xMV>>2) + (yMV>>2) * refPitch);
    interp_params->pDst = pCurrData;
    interp_params->dstStep = dstStep2*2;

    ippiInterpolateQPBilinear_VC1_8u_C1R(interp_params);

    interp_params->srcStep = interp_params->srcStep/2;
    interp_params->dstStep = 8;

    return VC1_OK;
}

static Ipp32s CalcMVInterpolateFieldLuma(VC1Context* pContext, Ipp32s polarity,
                                      Ipp16s* xMV, Ipp16s* yMV)
{
    VC1SingletonMB* sMB = pContext->m_pSingleMB;
    VC1PictureLayerHeader* pPicHeader = pContext->m_picLayerHeader;
    Ipp32s X, Y;
    Ipp32s f = 0;

    X = sMB->m_currMBXpos;
    Y = sMB->m_currMBYpos;

    if (pPicHeader->CurrField)
       Y -= pContext->m_pSingleMB->heightMB/2;
    if (!polarity)
    {
        *yMV = *yMV + (pPicHeader->BottomField<<2) - 2;
        f = !pPicHeader->BottomField;
    }
    else
    {
        f = pPicHeader->BottomField;
    }

    CropLumaPullBackField_Adv(pContext, xMV, yMV);

    *xMV = (Ipp16s)((X << 6) + *xMV);
    *yMV = (Ipp16s)((Y << 6) + *yMV);

    return f;
}

static VC1Status InterpolateBlock_InterlaceFieldPictureLuma1MV_P(VC1Context* pContext, Ipp8u *pDst,
                                                               Ipp32s dstStep)
{
    _IppVCInterpolate_8u*  interp_params = &pContext->interp_params_luma;
    VC1MB *pMB = pContext->m_pCurrMB;
    Ipp32s index = pContext->m_frmBuff.m_iPrevIndex;
    VC1PictureLayerHeader* pPicHeader = pContext->m_picLayerHeader;

    Ipp8u* pRefData = NULL;
    Ipp32s refPitch;
    Ipp32s f = 0;

    Ipp16s xMV = pMB->m_pBlocks[0].mv[0][0];
    Ipp16s yMV = pMB->m_pBlocks[0].mv[0][1];

    //VM_Debug::GetInstance().vm_debug_frame(-1,VC1_PRED,VM_STRING("Before Interpolation field xMv, yMv %d, %d\n"),xMV,yMV);

    if ((pPicHeader->CurrField == 1) &&
        (((pPicHeader->NUMREF + pPicHeader->REFFIELD) ==0) ||
         (pPicHeader->NUMREF == 1) && (!pMB->m_pBlocks[0].mv_s_polarity[0])))
    {
        index = pContext->m_frmBuff.m_iCurrIndex;
    }

    pRefData = pContext->m_frmBuff.m_pFrames[index].m_pY;
    refPitch = pContext->m_frmBuff.m_pFrames[index].m_iYPitch;

    //VM_Debug::GetInstance().vm_debug_frame(-1,VC1_PRED,VM_STRING("Before Interpolation field X, Y %d, %d\n"),X,Y);
    //VM_Debug::GetInstance().vm_debug_frame(-1,VC1_PRED,VM_STRING("%block number %d \n"),blk_num );
    //VM_Debug::GetInstance().vm_debug_frame(-1,VC1_BFRAMES,VM_STRING("interpolation(%d block)MV(%d,%d) back=%d\n"),blk_num,xMV,yMV,back);
    //VM_Debug::GetInstance().vm_debug_frame(-1,VC1_PRED,VM_STRING("Before Interpolation field f %d\n"),f);

    f = CalcMVInterpolateFieldLuma(pContext, pMB->m_pBlocks[0].mv_s_polarity[0], &xMV, &yMV);

    if (f)
        pRefData += refPitch;

    refPitch  <<= 1;

    interp_params->pSrc = pRefData;
    interp_params->pDst = pDst;
    interp_params->dstStep = dstStep;

    interp_params->roiSize.width = 16;
    interp_params->roiSize.height = 16;

    interp_params->pSrc += ( (xMV>>2) + (yMV>>2) * refPitch);

    //VM_Debug::GetInstance().vm_debug_frame(-1,VC1_PRED,VM_STRING("Before Interpolation field size %d, %d\n"),
        //interp_params->srcStep, interp_params->dstStep);

#ifdef VC1_DEBUG_ON
//    VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_PRED,VM_STRING("Before Interpolation field luma%d, %d\n"),X,Y);
#endif
 switch(pContext->m_picLayerHeader->MVMODE)
        {
        case VC1_MVMODE_HPELBI_1MV:
#ifdef VC1_DEBUG_ON
            VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_PRED,VM_STRING(" MVMode1MVHalfPelBilinear\n"));
#endif
            interp_params->dx = xMV&2;
            interp_params->dy = yMV&2;

            if((interp_params->dx + interp_params->dy == 0))
            {
                pMB->pInterpolLumaSrc[0]    = interp_params->pSrc;
                pMB->InterpolsrcLumaStep[0] = interp_params->srcStep;
            }
            else
                ippiInterpolateQPBilinear_VC1_8u_C1R(interp_params);
          break;

        case VC1_MVMODE_HPEL_1MV:
#ifdef VC1_DEBUG_ON
            VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_PRED,VM_STRING(" MVMode1MVHalfPel\n"));
#endif
            interp_params->dx = xMV&2;
            interp_params->dy = yMV&2;

            if((interp_params->dx + interp_params->dy == 0))
            {
                pMB->pInterpolLumaSrc[0] = interp_params->pSrc;
                pMB->InterpolsrcLumaStep[0] = interp_params->srcStep;
            }
            else
                _own_ippiInterpolateQPBicubicIC_VC1_8u_C1R(interp_params);
            break;

        case VC1_MVMODE_1MV:
        case VC1_MVMODE_MIXED_MV:
            //VM_Debug::GetInstance().vm_debug_frame(-1,VC1_PRED,VM_STRING(" vc1_MVMode1MV\n"));

            interp_params->dx = xMV&3;
            interp_params->dy = yMV&3;
            if((interp_params->dx + interp_params->dy == 0))
            {
                pMB->pInterpolLumaSrc[0] = interp_params->pSrc;
                pMB->InterpolsrcLumaStep[0] = interp_params->srcStep;
            }
            else
            _own_ippiInterpolateQPBicubicIC_VC1_8u_C1R(interp_params);
             break;
        default:
            VM_ASSERT(0);
        }
    return VC1_OK;
}
static VC1Status InterpolateBlock_InterlaceFieldPictureLuma1MV_B(VC1Context* pContext, Ipp8u *pDst,
                                                               Ipp32s dstStep,       Ipp32s back)
{
    _IppVCInterpolate_8u*  interp_params = &pContext->interp_params_luma;
    VC1MB *pMB = pContext->m_pCurrMB;
    Ipp32s index = (back)? pContext->m_frmBuff.m_iNextIndex:pContext->m_frmBuff.m_iPrevIndex;
    VC1PictureLayerHeader* pPicHeader = pContext->m_picLayerHeader;

    Ipp8u* pRefData = NULL;
    Ipp32s refPitch;
    Ipp32s f = 0;

    Ipp16s xMV = pMB->m_pBlocks[0].mv[back][0];
    Ipp16s yMV = pMB->m_pBlocks[0].mv[back][1];

    //VM_Debug::GetInstance().vm_debug_frame(-1,VC1_PRED,VM_STRING("Before Interpolation field xMv, yMv %d, %d\n"),xMV,yMV);

    if ((pPicHeader->CurrField == 1) &&
        (((pPicHeader->NUMREF + pPicHeader->REFFIELD) ==0) ||
         (pPicHeader->NUMREF == 1) && (!pMB->m_pBlocks[0].mv_s_polarity[back]) && (!back)))
    {
        index = pContext->m_frmBuff.m_iCurrIndex;
    }

    pRefData = pContext->m_frmBuff.m_pFrames[index].m_pY;
    refPitch = pContext->m_frmBuff.m_pFrames[index].m_iYPitch;

    //VM_Debug::GetInstance().vm_debug_frame(-1,VC1_PRED,VM_STRING("Before Interpolation field X, Y %d, %d\n"),X,Y);
    //VM_Debug::GetInstance().vm_debug_frame(-1,VC1_PRED,VM_STRING("%block number %d \n"),blk_num );
    //VM_Debug::GetInstance().vm_debug_frame(-1,VC1_BFRAMES,VM_STRING("interpolation(%d block)MV(%d,%d) back=%d\n"),blk_num,xMV,yMV,back);
    //VM_Debug::GetInstance().vm_debug_frame(-1,VC1_PRED,VM_STRING("Before Interpolation field f %d\n"),f);

    f = CalcMVInterpolateFieldLuma(pContext, pMB->m_pBlocks[0].mv_s_polarity[back], &xMV, &yMV);

    if (f)
        pRefData += refPitch;

    refPitch  <<= 1;

    interp_params->pSrc = pRefData;
    interp_params->pDst = pDst;
    interp_params->dstStep = dstStep;

    interp_params->roiSize.width = 16;
    interp_params->roiSize.height = 16;

    interp_params->pSrc += ( (xMV>>2) + (yMV>>2) * refPitch);

    //VM_Debug::GetInstance().vm_debug_frame(-1,VC1_PRED,VM_STRING("Before Interpolation field size %d, %d\n"),
        //interp_params->srcStep, interp_params->dstStep);

#ifdef VC1_DEBUG_ON
//    VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_PRED,VM_STRING("Before Interpolation field luma%d, %d\n"),X,Y);
#endif
 switch(pContext->m_picLayerHeader->MVMODE)
        {
        case VC1_MVMODE_HPELBI_1MV:
#ifdef VC1_DEBUG_ON
            VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_PRED,VM_STRING(" MVMode1MVHalfPelBilinear\n"));
#endif
            interp_params->dx = xMV&2;
            interp_params->dy = yMV&2;

            if((interp_params->dx + interp_params->dy == 0))
            {
                pMB->pInterpolLumaSrc[back] = interp_params->pSrc;
                pMB->InterpolsrcLumaStep[back] = interp_params->srcStep;
            }
            else
            ippiInterpolateQPBilinear_VC1_8u_C1R(interp_params);
          break;

        case VC1_MVMODE_HPEL_1MV:
#ifdef VC1_DEBUG_ON
            VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_PRED,VM_STRING(" MVMode1MVHalfPel\n"));
#endif
            interp_params->dx = xMV&2;
            interp_params->dy = yMV&2;
            if((interp_params->dx + interp_params->dy == 0))
            {
                pMB->pInterpolLumaSrc[back] = interp_params->pSrc;
                pMB->InterpolsrcLumaStep[back] = interp_params->srcStep;
            }
            else
            _own_ippiInterpolateQPBicubicIC_VC1_8u_C1R(interp_params);
            break;

        case VC1_MVMODE_1MV:
        case VC1_MVMODE_MIXED_MV:
            //VM_Debug::GetInstance().vm_debug_frame(-1,VC1_PRED,VM_STRING(" vc1_MVMode1MV\n"));

            interp_params->dx = xMV&3;
            interp_params->dy = yMV&3;

            if((interp_params->dx + interp_params->dy == 0))
            {

⌨️ 快捷键说明

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