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

📄 umc_mpeg2_dec_defs.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) 2003-2007 Intel Corporation. All Rights Reserved.
//
*/

#include "umc_defs.h"
#if defined (UMC_ENABLE_MPEG2_VIDEO_DECODER)

#ifndef __UMC_MPEG2_DEC_DEFS_H__
#define __UMC_MPEG2_DEC_DEFS_H__

#include <ippi.h>
#include <ippvc.h>
#include "umc_structures.h"
#include "umc_memory_allocator.h"
#include "umc_mpeg2_dec_bstream.h"

namespace UMC
{

#define IPPVC_MC_FRAME     0x2
#define IPPVC_MC_FIELD     0x1
#define IPPVC_MC_16X8      0x2
#define IPPVC_MC_DP        0x3

#define IPPVC_DCT_FIELD    0x0
#define IPPVC_DCT_FRAME    0x1

#define IPPVC_MB_INTRA     0x1
#define IPPVC_MB_PATTERN   0x2
#define IPPVC_MB_BACKWARD  0x4
#define IPPVC_MB_FORWARD   0x8
#define IPPVC_MB_QUANT     0x10

//start/end codes
#define PICTURE_START_CODE       0x00000100
#define USER_DATA_START_CODE     0x000001B2
#define SEQUENCE_HEADER_CODE     0x000001B3
#define SEQUENCE_ERROR_CODE      0x000001B4
#define EXTENSION_START_CODE     0x000001B5
#define SEQUENCE_END_CODE        0x000001B7
#define GROUP_START_CODE         0x000001B8

#define SEQUENCE_EXTENSION_ID                  0x00000001
#define SEQUENCE_DISPLAY_EXTENSION_ID          0x00000002
#define QUANT_MATRIX_EXTENSION_ID              0x00000003
#define COPYRIGHT_EXTENSION_ID                 0x00000004
#define SEQUENCE_SCALABLE_EXTENSION_ID         0x00000005
#define PICTURE_DISPLAY_EXTENSION_ID           0x00000007
#define PICTURE_CODING_EXTENSION_ID            0x00000008
#define PICTURE_SPARTIAL_SCALABLE_EXTENSION_ID 0x00000009
#define PICTURE_TEMPORAL_SCALABLE_EXTENSION_ID 0x0000000a

#define DATA_PARTITIONING        0x00000000
#define SPARTIAL_SCALABILITY     0x00000001
#define SNR_SCALABILITY          0x00000002
#define TEMPORAL_SCALABILITY     0x00000003


#define FRAME_PICTURE            3

#define I_FRAME                  1
#define P_FRAME                  2
#define B_FRAME                  3
#define B_FRAME_SECOND           4
#define D_FRAME                  4

#define TOP_FIELD                1
#define BOTTOM_FIELD             2

#define ROW_CHROMA_SHIFT_420 3
#define ROW_CHROMA_SHIFT_422 4
#define COPY_CHROMA_MB_420 ippiCopy8x8_8u_C1R
#define COPY_CHROMA_MB_422 ippiCopy8x16_8u_C1R

extern Ipp16s q_scale[2][32];
///////////////////////

extern Ipp16s reset_dc[4];

extern Ipp16s intra_dc_multi[4];


typedef struct
{
    Ipp8u*           Y_comp_data;
    Ipp8u*           U_comp_data;
    Ipp8u*           V_comp_data;
    FrameType        frame_type; // 1-I, 2-P, 3-B
    Ipp64f           frame_time;
    Ipp64f           duration;
    Ipp32s           va_index;
#ifdef KEEP_HISTORY
    Ipp8u*           frame_history;
#endif
} sVideoFrameBuffer;


typedef struct
{
    Ipp32s           mb_width; //the number of macroblocks in the row of the picture
    Ipp32s           mb_height;//the number of macroblocks in the column of the picture
    Ipp32s           numMB;    //the number of macroblocks in the picture

//sequence extension
    Ipp32u           profile;
    Ipp32u           level;
    Ipp32u           extension_start_code_ID;
    Ipp32u           scalable_mode;
    Ipp32u           progressive_sequence;

    Ipp32s           frame_rate_extension_d;
    Ipp32s           frame_rate_extension_n;
    Ipp64f           delta_frame_time;
    Ipp64f           stream_time;
    Ipp32s           stream_time_temporal_reference; // for current stream_time
    Ipp32s           first_p_occure;
    Ipp32s           first_i_occure;
    Ipp32s           num_of_skipped;
    Ipp32s           bdied;
    Ipp32s           b_curr_number;
    Ipp32s           is_skipped_b;
    Ipp32s           is_decoded;

    // GOP info.
    Ipp32s           closed_gop;    // no ref to previous GOP
    Ipp32s           broken_link;   // ref to absent prev GOP
    Ipp32s           gop_second;    // second of first picture
    Ipp32s           gop_picture;   // starting picture in gop_second

    Ipp32s           frame_count;
} sSequenceHeader;

// for prediction (forward and backward) and current frame;
typedef struct
{
    sVideoFrameBuffer     frame_p_c_n[3];    // previous, current and next frames
    Ipp8u                 *ptr_context_data; // pointer to allocated data
    MemID                 mid_context_data;  // pointer to allocated data
    Ipp32u                Y_comp_height;
    Ipp32u                Y_comp_pitch;
    Ipp32u                U_comp_pitch;
    Ipp32u                V_comp_pitch;
    Ipp32u                pic_size;
    Ipp32s                prev_index; // 0 or 1; 0 initially
    Ipp32s                curr_index; // 0 or 1 or 2;  0 initially
    Ipp32s                next_index; // 0 or 1; 1 initially
    Ipp32s                retrieve;   // index of retrieved frame; -1 initially
    Ipp32s                ind_his_p;
    Ipp32s                ind_his_b;
    Ipp32s                ind_his_free;
    Ipp32s                ind_his_ref;
    Ipp32s                ind_his_curr;
    Ipp32s                field_buffer_index;
    Ipp32s                allocated_mb_width;
    Ipp32s                allocated_mb_height;
    ColorFormat           allocated_cformat;
} sFrameBuffer;


typedef struct
{
    FrameType        picture_coding_type;

    Ipp32s           full_pel_forward_vector;
    Ipp32s           full_pel_backward_vector;

    //extensions
    Ipp32s           f_code[4];
    Ipp32s           r_size[4];
    Ipp32s           low_in_range[4];
    Ipp32s           high_in_range[4];
    Ipp32s           range[4];
    Ipp32u           picture_structure;
    Ipp32u           intra_dc_precision;
    Ipp32u           top_field_first;
    Ipp32u           frame_pred_frame_dct;
    Ipp32u           concealment_motion_vectors;
    Ipp32u           q_scale_type;
    Ipp32u           repeat_first_field;
    Ipp32u           progressive_frame;
    Ipp32s           temporal_reference;

    Ipp32s           curr_reset_dc;
    Ipp32s           intra_vlc_format;
    Ipp32s           alternate_scan;
    Ipp32s           curr_intra_dc_multi;
    Ipp32s           max_slice_vert_pos;

} sPictureHeader;

typedef struct
{
  Ipp32s max_bits;
  Ipp32s bits_table0;
  Ipp32s bits_table1;
  Ipp32u threshold_table0;
  Ipp16s *table0;
  Ipp16s *table1;
} mp2_VLCTable;

typedef struct
{
    Ipp32s *ippTableB5a;
    Ipp32s *ippTableB5b;
} vlcStorageMPEG2;

typedef struct
{
  Ipp8u  *startPtr;
  Ipp8u  *endPtr;
  Ipp32s flag;
} sliceInfo;

typedef struct
{
//Slice
    Ipp32s       slice_vertical_position;
    Ipp16s       dct_dc_past[3]; // y,u,v
    Ipp32s       cur_q_scale;

    Ipp32s       mb_row;
    Ipp32s       mb_col;
    Ipp32s       mb_address_increment;//l

    bool         m_bNewSlice;//l

//Macroblock
    Ipp32u       macroblock_motion_forward;
    Ipp32u       macroblock_motion_backward;
    Ipp32s       prediction_type;

DECLALIGN(16) Ipp16s PMV[8];
DECLALIGN(16) Ipp16s vector[8];

    Ipp32s       row_l, col_l, row_c, col_c;
    Ipp32s       offset_l, offset_c;

    Ipp8u        *blkCurrYUV[3];

//Block
DECLALIGN(16)
    IppiDecodeIntraSpec_MPEG2 decodeIntraSpec;
DECLALIGN(16)
    IppiDecodeInterSpec_MPEG2 decodeInterSpec;
DECLALIGN(16)
    IppiDecodeIntraSpec_MPEG2 decodeIntraSpecChroma;
DECLALIGN(16)
    IppiDecodeInterSpec_MPEG2 decodeInterSpecChroma;

⌨️ 快捷键说明

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