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

📄 umc_vc1_enc_block_template.h

📁 audio-video-codecs.rar语音编解码器
💻 H
📖 第 1 页 / 共 3 页
字号:
/* /////////////////////////////////////////////////////////////////////////////
//
//                  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) 2007 Intel Corporation. All Rights Reserved.
//
//
//          VC-1 (VC1) encoder, block functionality templates
//
*/
#include "umc_defs.h"

#if defined (UMC_ENABLE_VC1_VIDEO_ENCODER)

#ifndef _ENCODER_VC1_BLOCK_T_H_
#define _ENCODER_VC1_BLOCK_T_H_

#include "umc_vc1_enc_bitstream.h"
#include "ippvc.h"
#include "umc_vc1_enc_def.h"
#include "umc_structures.h"

namespace UMC_VC1_ENCODER
{
//template <class T>  UMC::Status   WriteBlockACIntra         (T*                     pCodedBlock,
//                                                            Ipp16s*                 pBlock,
//                                                            Ipp32u                  blockStep,
//                                                            const Ipp8u*            pScanMatrix,
//                                                            const sACTablesSet*     pACTablesSet,
//                                                            sACEscInfo*             pACEscInfo)
//   {    UMC::Status     err          = UMC::UMC_OK;
//        Ipp32s          i            = 0;
//
//        Ipp8u           nPairs       = 0;
//        Ipp16s          levels[65];
//        Ipp8u           runs[65];
//
//        const Ipp8u     *pTableDR    = pACTablesSet->pTableDR;
//        const Ipp8u     *pTableDL    = pACTablesSet->pTableDL;
//        const Ipp8u     *pTableInd   = pACTablesSet->pTableInd;
//        const Ipp32u    *pEncTable   = pACTablesSet->pEncTable;
//
//
//        runs[0] = 0;
//        //prepare runs, levels arrays
//        for (i = 1; i<64; i++)
//        {
//            Ipp32s  pos    = pScanMatrix[i];
//            Ipp16s  value = *((Ipp16s*)((Ipp8u*)pBlock + blockStep*(pos>>3)) + (pos&0x07));
//            if (!value)
//            {
//                runs[nPairs]++;
//            }
//            else
//            {
//                levels[nPairs++] = value;
//                runs[nPairs]   = 0;
//            }
//        }
//        // put codes into bitstream
//        i = 0;
//        for (Ipp32s not_last = 1; not_last>=0; not_last--)
//        {
//            for (; i < nPairs - not_last; i++)
//            {
//                bool    sign = false;
//                Ipp8u   run  = runs  [i];
//                Ipp16s  lev  = levels[i];
//
//                Ipp8u mode = GetMode( run, lev, pTableDR, pTableDL, sign);
//
//                switch (mode)
//                {
//                    case 3:
//                        err = pCodedBlock->PutBits(pEncTable[0], pEncTable[1]); //ESCAPE
//                        VC1_ENC_CHECK (err)
//                        err = pCodedBlock->PutBits(0,2);                       //mode
//                        VC1_ENC_CHECK (err)
//                        err = pCodedBlock->PutBits(!not_last,1);               //last
//                        VC1_ENC_CHECK (err)
//                        if ((!pACEscInfo->levelSize) && (!pACEscInfo->runSize))
//                        {
//                            pACEscInfo->runSize = 6;
//                            pACEscInfo->levelSize = (pACEscInfo->pLSizeTable[2*11 +1]==0)? 8:11;
//                            pACEscInfo->levelSize = (pACEscInfo->pLSizeTable[2*pACEscInfo->levelSize + 1]<=0) ?
//                                                            2 : pACEscInfo->levelSize;
//                            err = pCodedBlock->PutBits(pACEscInfo->pLSizeTable[2*pACEscInfo->levelSize],
//                                                       pACEscInfo->pLSizeTable[2*pACEscInfo->levelSize +1]);
//                            VC1_ENC_CHECK (err)
//                            err = pCodedBlock->PutBits(pACEscInfo->runSize - 3, 2);
//                            VC1_ENC_CHECK (err)
//                        }
//                        err = pCodedBlock->PutBits(run,pACEscInfo->runSize);
//                        VC1_ENC_CHECK (err)
//                        err = pCodedBlock->PutBits(sign, 1);
//                        VC1_ENC_CHECK (err)
//                        if (lev>((1<<pACEscInfo->levelSize)-1))
//                        {
//                            lev =(1<<pACEscInfo->levelSize)-1;
//                            levels[i] = lev;
//                        }
//                        err = pCodedBlock->PutBits(lev,pACEscInfo->levelSize);
//                        VC1_ENC_CHECK (err)
//                        break;
//                    case 2:
//                    case 1:
//                        err = pCodedBlock->PutBits(pEncTable[0], pEncTable[1]); //ESCAPE
//                        VC1_ENC_CHECK (err)
//                        err = pCodedBlock->PutBits(1,mode);                     //mode
//                        VC1_ENC_CHECK (err)
//                    case 0:
//                        Ipp16s index = pTableInd[run] + lev;
//                        err = pCodedBlock->PutBits(pEncTable[2*index], pEncTable[2*index + 1]);
//                        VC1_ENC_CHECK (err)
//                        err = pCodedBlock->PutBits(sign, 1);
//                        VC1_ENC_CHECK (err)
//
//                        break;
//
//                }
//             }
//
//            pTableDR    = pACTablesSet->pTableDRLast;
//            pTableDL    = pACTablesSet->pTableDLLast;
//            pTableInd   = pACTablesSet->pTableIndLast;
//
//        }
//        return UMC::UMC_OK;
//   }

//   template <class T>  UMC::Status   WriteBlockInter8x8type(T*                      pCodedBlock,
//                                                            Ipp16s*                 pBlock,
//                                                            Ipp32u                  blockStep,
//                                                            const Ipp8u*            pScanMatrix,
//                                                            const sACTablesSet*     pACTablesSet,
//                                                            sACEscInfo*             pACEscInfo,
//                                                            Ipp32u                  pattern)
//   {    UMC::Status     err          = UMC::UMC_OK;
//        Ipp32s          i            = 0;
//
//        Ipp8u           nPairs       = 0;
//        Ipp16s          levels[65];
//        Ipp8u           runs[65];
//
//        const Ipp8u     *pTableDR    = pACTablesSet->pTableDR;
//        const Ipp8u     *pTableDL    = pACTablesSet->pTableDL;
//        const Ipp8u     *pTableInd   = pACTablesSet->pTableInd;
//        const Ipp32u    *pEncTable   = pACTablesSet->pEncTable;
//
//
//        runs[0] = 0;
//        //prepare runs, levels arrays
//        for (i = 0; i<64; i++)
//        {
//            Ipp32s  pos    = pScanMatrix[i];
//            Ipp16s  value = *((Ipp16s*)((Ipp8u*)pBlock + blockStep*(pos>>3)) + (pos&0x07));
//            if (!value)
//            {
//                runs[nPairs]++;
//            }
//            else
//            {
//                levels[nPairs++] = value;
//                runs[nPairs]   = 0;
//            }
//        }
//        // put codes into bitstream
//        i = 0;
//        for (Ipp32s not_last = 1; not_last>=0; not_last--)
//        {
//            for (; i < nPairs - not_last; i++)
//            {
//                bool    sign = false;
//                Ipp8u   run  = runs  [i];
//                Ipp16s  lev  = levels[i];
//
//                Ipp8u mode = GetMode( run, lev, pTableDR, pTableDL, sign);
//
//                switch (mode)
//                {
//                    case 3:
//                        err = pCodedBlock->PutBits(pEncTable[0], pEncTable[1]); //ESCAPE
//                        VC1_ENC_CHECK (err)
//                        err = pCodedBlock->PutBits(0,2);                       //mode
//                        VC1_ENC_CHECK (err)
//                        err = pCodedBlock->PutBits(!not_last,1);               //last
//                        VC1_ENC_CHECK (err)
//                        if ((!pACEscInfo->levelSize) && (!pACEscInfo->runSize))
//                        {
//                            pACEscInfo->runSize = 6;
//                            pACEscInfo->levelSize = (pACEscInfo->pLSizeTable[2*11 +1]==0)? 8:11;
//                            pACEscInfo->levelSize = (pACEscInfo->pLSizeTable[2*pACEscInfo->levelSize + 1]<=0) ?
//                                                            2 : pACEscInfo->levelSize;
//                            err = pCodedBlock->PutBits(pACEscInfo->pLSizeTable[2*pACEscInfo->levelSize],
//                                                       pACEscInfo->pLSizeTable[2*pACEscInfo->levelSize +1]);
//                            VC1_ENC_CHECK (err)
//                            err = pCodedBlock->PutBits(pACEscInfo->runSize - 3, 2);
//                            VC1_ENC_CHECK (err)
//                        }
//                        err = pCodedBlock->PutBits(run,pACEscInfo->runSize);
//                        VC1_ENC_CHECK (err)
//                        err = pCodedBlock->PutBits(sign, 1);
//                        VC1_ENC_CHECK (err)
//                        if (lev>((1<<pACEscInfo->levelSize)-1))
//                        {
//                            lev =(1<<pACEscInfo->levelSize)-1;
//                            levels[i] = lev;
//                        }
//                        err = pCodedBlock->PutBits(lev,pACEscInfo->levelSize);
//                        VC1_ENC_CHECK (err)
//                        break;
//                    case 2:
//                    case 1:
//                        err = pCodedBlock->PutBits(pEncTable[0], pEncTable[1]); //ESCAPE
//                        VC1_ENC_CHECK (err)
//                        err = pCodedBlock->PutBits(1,mode);                     //mode
//                        VC1_ENC_CHECK (err)
//                    case 0:
//                        Ipp16s index = pTableInd[run] + lev;
//                        err = pCodedBlock->PutBits(pEncTable[2*index], pEncTable[2*index + 1]);
//                        VC1_ENC_CHECK (err)
//                        err = pCodedBlock->PutBits(sign, 1);
//                        VC1_ENC_CHECK (err)
//                        break;
//
//                }
//             }
//
//            pTableDR    = pACTablesSet->pTableDRLast;
//            pTableDL    = pACTablesSet->pTableDLLast;
//            pTableInd   = pACTablesSet->pTableIndLast;
//
//        }
//        return UMC::UMC_OK;
//   }
//
//   template <class T>  UMC::Status   WriteBlockInter8x4type(T*                      pCodedBlock,
//                                                            Ipp16s*                 pBlock,
//                                                            Ipp32u                  blockStep,

⌨️ 快捷键说明

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