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

📄 umc_h264_bitstream.h

📁 这是在PCA下的基于IPP库示例代码例子,在网上下了IPP的库之后,设置相关参数就可以编译该代码.
💻 H
📖 第 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) 2003-2005 Intel Corporation. All Rights Reserved.////*/#ifndef __UMC_H264_BITSTREAM_H_#define __UMC_H264_BITSTREAM_H_#include <string.h>#include "ippdefs.h"#include "umc_video_decoder.h"#include "umc_h264_dec_internal_cabac.h"#include "umc_h264_dec_init_tables_cabac.h"#include "umc_h264_dec_defs_dec.h"#include "umc_h264_dec_tables.h"#include "vm_debug.h"#include "ippvc.h"using namespace UMC_H264_DECODER;namespace UMC{#define _h264GetBits(current_data, offset, nbits, data)                    \{                                                                       \    Ipp32u x;                                                           \                                                                        \    VM_ASSERT((nbits) > 0 && (nbits) <= 32);                               \    VM_ASSERT(offset >= 0 && offset <= 31);                                \                                                                        \/*  removeSCEBP(current_data, offset);*/                                \                                                                        \    offset -= (nbits);                                                  \                                                                        \    if(offset >= 0)                                                     \    {                                                                   \        x = current_data[0] >> (offset + 1);                            \    }                                                                   \    else                                                                \    {                                                                   \        offset += 32;                                                   \                                                                        \        x = current_data[1] >> (offset);                                \        x >>= 1;                                                        \        x += current_data[0] << (31 - offset);                          \        current_data++;                                                 \    }                                                                   \                                                                        \    VM_ASSERT(offset >= 0 && offset <= 31);                                \                                                                        \    (data) = x & (((Ipp32u)0x01 << (nbits)) - 1);                       \}#define ippiGetBits1( current_data, offset, data)   _h264GetBits(current_data, offset,  1, data);#define ippiGetBits8( current_data, offset, data)   _h264GetBits(current_data, offset,  8, data);#define ippiGetBits16( current_data, offset, data)  _h264GetBits(current_data, offset,  16, data);#define ippiGetNBits( current_data, offset, nbits, data) _h264GetBits(current_data, offset, nbits, data);#define ippiUngetNBits(current_data, offset, nbits)                     \{                                                                       \    VM_ASSERT(offset >= 0 && offset <= 31);                                \                                                                        \    offset += (nbits);                                                  \    if(offset > 31)                                                     \    {                                                                   \        offset -= 32;                                                   \        current_data--;                                                 \    }                                                                   \                                                                        \    VM_ASSERT(offset >= 0 && offset <= 31);                                \}#define ippiUngetBits32(current_data, offset)                           \    VM_ASSERT(offset >= 0 && offset <= 31);                                \    current_data--;                                                     \#define ippiAlignBSPointerRight(current_data, offset)                   \{                                                                       \    if((offset & 0x07) != 0x07)                                         \    {                                                                   \        offset = (offset | 0x07) - 8;                                   \        if(offset == -1)                                                \        {                                                               \            offset = 31;                                                \            current_data++;                                             \        }                                                               \    }                                                                   \}#define ippiNextBits(current_data, offset, nbits, data)             \{                                                                       \    Ipp32s bp;                                                          \    Ipp32u x;                                                           \                                                                        \    VM_ASSERT((nbits) >= 0 && (nbits) <= 32);                              \    VM_ASSERT(offset >= 0 && offset <= 31);                                \                                                                        \    bp = offset - (nbits);                                              \                                                                        \    if(bp < 0)                                                          \    {                                                                   \        bp += 32;                                                       \        x = current_data[1] >> bp;                                      \        x >>= 1;                                                        \        x += current_data[0] << (31 - bp);                              \    }                                                                   \    else                                                                \    {                                                                   \        x = current_data[0] >> bp;                                      \        x >>= 1;                                                        \    }                                                                   \                                                                        \    (data) = x & (((Ipp32u)0x01 << (nbits)) - 1);                       \}#define CABAC_Load16Bit()                               \{                                                       \    if (16 >= m_ValOffset)                              \    {                                                   \        long lCount = 2;                                \        do                                              \        {                                               \            Ipp32u lTemp;                               \            ippiGetBits8(m_pbs, m_bitOffset, lTemp)     \            if ((2 == m_null_count) && (3 == lTemp))    \            {                                           \                ippiGetBits8(m_pbs, m_bitOffset, lTemp) \                m_null_count = 0;                       \            };                                          \            m_BufValue = (m_BufValue << 8) | lTemp;     \            if(0 == lTemp)                              \                m_null_count++;                         \            else                                        \                m_null_count = 0;                       \        } while (--lCount);                             \        m_ValOffset += 16;                              \    }                                                   \}//  NAL Unit Types#ifndef SHARED_ENCDECBS_STRUCTURES_DEFS#define SHARED_ENCDECBS_STRUCTURES_DEFStypedef enum {        NAL_UT_RESERVED  = 0x00, // Reserved        NAL_UT_SLICE     = 0x01, // Coded Slice - slice_layer_no_partioning_rbsp        NAL_UT_DPA       = 0x02, // Coded Data partition A - dpa_layer_rbsp        NAL_UT_DPB       = 0x03, // Coded Data partition A - dpa_layer_rbsp        NAL_UT_DPC       = 0x04, // Coded Data partition A - dpa_layer_rbsp        NAL_UT_IDR_SLICE = 0x05, // Coded Slice of a IDR Picture - slice_layer_no_partioning_rbsp        NAL_UT_SEI       = 0x06, // Supplemental Enhancement Information - sei_rbsp        NAL_UT_SPS       = 0x07, // Sequence Parameter Set - seq_parameter_set_rbsp        NAL_UT_PPS       = 0x08, // Picture Parameter Set - pic_parameter_set_rbsp        NAL_UT_PD        = 0x09, // Picture Delimiter - pic_delimiter_rbsp        NAL_UT_FD        = 0x0a  // Filler Data - filler_data_rbsp} NAL_Unit_Type;#endif/* SHARED_ENCDECBS_STRUCTURES_DEFS */// NAL unit definitions#define NAL_STORAGE_IDC_BITS    0x60#define NAL_UNITTYPE_BITS       0x1f#define NUM_BLOCK_TYPES        8#define NUM_MB_TYPE_CTX       11#define NUM_BLOCK_TYPE_CTX     9#define NUM_MVD_CTX           10#define NUM_REF_NO_CTX         6#define NUM_DELTA_QAUNT_CTX    4#define NUM_MB_AFF_CTX         4#define NUM_INTRA_PRED_CTX             2#define NUM_CR_INTRA_PRED_CTX          4#define NUM_CBP_CTX                    4#define NUM_BLOCK_CBP_CTX              4#define NUM_SIGN_COEFF_FLAG_CTX       15#define NUM_LAST_SIGN_COEFF_FLAG_CTX  15#define NUM_COEF_ONE_LEVEL_CTX         5#define NUM_COEF_ABS_LEVEL_CTX         5typedef struct CABAC_CONTEXT{    unsigned short pStateIdx;                       // (unsigned short int) probability state index    unsigned short valMPS;                          // (unsigned short int) value of most probable symbol} CABAC_CONTEXT;class H264Bitstream

⌨️ 快捷键说明

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