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

📄 umc_vc1_choose_table.cpp

📁 audio-video-codecs.rar语音编解码器
💻 CPP
📖 第 1 页 / 共 2 页
字号:
/* /////////////////////////////////////////////////////////////////////////////
//
//                  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) 2004-2007 Intel Corporation. All Rights Reserved.
//
//
//          VC-1(VC1) decoder, choose table functions
//
*/
#include "umc_defs.h"

#if defined (UMC_ENABLE_VC1_VIDEO_DECODER)

#include "umc_vc1_dec_seq.h"
#include "ipps.h"
#include "umc_vc1_dec_run_level_tbl.h"
#include "umc_vc1_common_mvdiff_tbl.h"
#include "umc_vc1_common_interlace_mv_tables.h"
#include "umc_vc1_common_defs.h"
#include "ippdefs.h"

#include "umc_vc1_dec_debug.h"

void ChooseDCTable(VC1Context* pContext, Ipp32s transDCtableIndex)
{
    Ipp32s *lumaTable_lut[]  ={pContext->m_vlcTbl->m_pLowMotionLumaDCDiff,
                               pContext->m_vlcTbl->m_pHighMotionLumaDCDiff};
    Ipp32s *chromaTable_lut[]={pContext->m_vlcTbl->m_pLowMotionChromaDCDiff,
                               pContext->m_vlcTbl->m_pHighMotionChromaDCDiff};

    pContext->m_picLayerHeader->m_pCurrLumaDCDiff   = lumaTable_lut[transDCtableIndex];
    pContext->m_picLayerHeader->m_pCurrChromaDCDiff = chromaTable_lut[transDCtableIndex];
}

void ChooseACTable(VC1PictureLayerHeader* picLayerHeader,
                   Ipp32s transACtableIndex1,
                   Ipp32s transACtableIndex2)
{
    const static IppiACDecodeSet_VC1* IntraACDecodeSet_lut[]=
    {
                    &HighRateIntraACDecodeSet,    &HighMotionIntraACDecodeSet,
                    &MidRateIntraACDecodeSet,     &LowMotionIntraACDecodeSet,
                    &HighMotionIntraACDecodeSet,  &MidRateIntraACDecodeSet};

    const static IppiACDecodeSet_VC1* IntrerACDecodeSet_lut[]=
    {
                    &HighRateInterACDecodeSet,     &HighMotionInterACDecodeSet,
                    &MidRateInterACDecodeSet,      &LowMotionInterACDecodeSet,
                    &HighMotionInterACDecodeSet,   &MidRateInterACDecodeSet
    };

    if(picLayerHeader->PQINDEX <= 8)
    {
        picLayerHeader->m_pCurrIntraACDecSet = IntraACDecodeSet_lut[transACtableIndex2];
        picLayerHeader->m_pCurrInterACDecSet = IntrerACDecodeSet_lut[transACtableIndex1];
#ifdef VC1_DEBUG_ON
        switch(transACtableIndex2)
        {
        case 0:
            VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_TABLES,
                                                    VM_STRING("HighRateIntra\n"));
            break;
        case 1:
            VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_TABLES,
                                                    VM_STRING("HighMotionIntra\n"));
            break;
        case 2:
            VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_TABLES,
                                                    VM_STRING("MidRateIntra\n"));
            break;
        case 3:
            VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_TABLES,
                                                    VM_STRING("LowMotionIntra\n"));
            break;
        case 4:
            VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_TABLES,
                                                    VM_STRING("HighMotionIntra\n"));
            break;
        case 5:
            VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_TABLES,
                                                    VM_STRING("MidRateIntra\n"));
            break;
        };
        switch(transACtableIndex1)
        {
        case 0:
            VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_TABLES,
                                                    VM_STRING("HighRateInter\n"));
            break;
        case 1:
            VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_TABLES,
                                                    VM_STRING("HighMotionInter\n"));
            break;
        case 2:
            VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_TABLES,
                                                    VM_STRING("MidRateInter\n"));
            break;
        case 3:
            VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_TABLES,
                                                    VM_STRING("LowMotionInter\n"));
            break;
        case 4:
            VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_TABLES,
                                                    VM_STRING("HighMotionInter\n"));
            break;
        case 5:
            VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_TABLES,
                                                    VM_STRING("MidRateInter\n"));
            break;
        };
#endif
    }
    else
    {
        picLayerHeader->m_pCurrIntraACDecSet = IntraACDecodeSet_lut[transACtableIndex2+3];
        picLayerHeader->m_pCurrInterACDecSet = IntrerACDecodeSet_lut[transACtableIndex1+3];
#ifdef VC1_DEBUG_ON
        switch(transACtableIndex2)
        {
        case 0:
            VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_TABLES,
                                                    VM_STRING("HighRateIntra\n"));
            break;
        case 1:
            VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_TABLES,
                                                    VM_STRING("HighMotionIntra\n"));
            break;
        case 2:
            VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_TABLES,
                                                    VM_STRING("MidRateIntra\n"));
            break;
        case 3:
            VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_TABLES,
                                                    VM_STRING("LowMotionIntra\n"));
            break;
        case 4:
            VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_TABLES,
                                                    VM_STRING("HighMotionIntra\n"));
            break;
        case 5:
            VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_TABLES,
                                                    VM_STRING("MidRateIntra\n"));
            break;
        };
        switch(transACtableIndex1)
        {
        case 0:
            VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_TABLES,
                                                    VM_STRING("HighRateInter\n"));
            break;
        case 1:
            VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_TABLES,
                                                    VM_STRING("HighMotionInter\n"));
            break;
        case 2:
            VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_TABLES,
                                                    VM_STRING("MidRateInter\n"));
            break;
        case 3:
            VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_TABLES,
                                                    VM_STRING("LowMotionInter\n"));
            break;
        case 4:
            VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_TABLES,
                                                    VM_STRING("HighMotionInter\n"));
            break;
        case 5:
            VM_Debug::GetInstance(VC1DebugRoutine).vm_debug_frame(-1,VC1_TABLES,
                                                    VM_STRING("MidRateInter\n"));
            break;
        };
#endif
    }
}


void ChooseTTMB_TTBLK_SBP(VC1Context* pContext)
{
    VC1PictureLayerHeader* picLayerHeader = pContext->m_picLayerHeader;
    VC1VLCTables* VLCTables = pContext->m_vlcTbl;

    if( picLayerHeader->PQUANT < 5)
    {
        picLayerHeader->m_pCurrTTMBtbl = VLCTables->TTMB_PB_TABLES[2];
        picLayerHeader->m_pCurrTTBLKtbl = VLCTables->TTBLK_PB_TABLES[2];
        picLayerHeader->m_pCurrSBPtbl = VLCTables->SBP_PB_TABLES[0];
    }
    else if(picLayerHeader->PQUANT < 13)
    {
        picLayerHeader->m_pCurrTTMBtbl = VLCTables->TTMB_PB_TABLES[1];
        picLayerHeader->m_pCurrTTBLKtbl =VLCTables->TTBLK_PB_TABLES[1];
        picLayerHeader->m_pCurrSBPtbl = VLCTables->SBP_PB_TABLES[1];
    }
    else
    {
        picLayerHeader->m_pCurrTTMBtbl = VLCTables->TTMB_PB_TABLES[0];
        picLayerHeader->m_pCurrTTBLKtbl = VLCTables->TTBLK_PB_TABLES[0];
        picLayerHeader->m_pCurrSBPtbl = VLCTables->SBP_PB_TABLES[2];
    }
}
void ExpandRows(Ipp8u* StartPtr,
                 Ipp32s width,
                 Ipp32s height,
                 Ipp32s pitch,
                 Ipp32s padSize,
                 Ipp8u  isFirstOrLastRow) // 0 - NoFirst/NoLast, 0x01 - First, 0x10 - Last
{
    Ipp32s i, m;
    Ipp8u *p, *p1, *pc;
    IppiSize roiSize;
    Ipp32s AddPad = 0;
    roiSize.height = padSize;


    if (2 & isFirstOrLastRow)
    {

        //Area (1)
        p = StartPtr + pitch * (height - 1);
        pc = p + pitch;

        roiSize.height = padSize;
        roiSize.width = width;
        ippiCopy_8u_C1R(p, 0, pc, pitch, roiSize);
        AddPad = padSize;
    }

    //Area (2)
    p = StartPtr;
    p1 = StartPtr + width;
    m = height + AddPad;

    for(i = 0; i < m; i++)
    {
        ippsSet_8u(p[0], p-padSize, padSize);
        ippsSet_8u(p1[-1], p1, padSize);
        p  += pitch;
        p1 += pitch;
    }

    if (1 & isFirstOrLastRow)
    {

        //Area (3)
        p = StartPtr - padSize;
        pc = p - pitch;
        m = width + 2*padSize;
        roiSize.width = m;
        ippiCopy_8u_C1R(p, 0, pc, -pitch, roiSize);
    }

}


void ExpandMBRowSM(VC1Context* pContext, Ipp32s StartMBPos, Ipp32s HeightMB)
{
    Ipp8u FirstLastMask = 0;

⌨️ 快捷键说明

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