📄 global.h
字号:
/*
***********************************************************************
* COPYRIGHT AND WARRANTY INFORMATION
*
* Copyright 2003, Advanced Audio Video Coding Standard, Part II
*
* DISCLAIMER OF WARRANTY
*
* These software programs are available to the users without any
* license fee or royalty on an "as is" basis. The AVS disclaims
* any and all warranties, whether express, implied, or statutory,
* including any implied warranties of merchantability or of fitness
* for a particular purpose. In no event shall the contributors or
* the AVS be liable for any incidental, punitive, or consequential
* damages of any kind whatsoever arising from the use of this program.
*
* This disclaimer of warranty extends to the user of this program
* and user's customers, employees, agents, transferees, successors,
* and assigns.
*
* The AVS does not represent or warrant that the program furnished
* hereunder are free of infringement of any third-party patents.
* Commercial implementations of AVS, including shareware, may be
* subject to royalty fees to patent holders. Information regarding
* the AVS patent policy is available from the AVS Web site at
* http://www.avs.org.cn
*
* THIS IS NOT A GRANT OF PATENT RIGHTS - SEE THE AVS PATENT POLICY.
************************************************************************
*/
/*
*************************************************************************************
* File name: global.h
* Function: global definitions for for AVS decoder.
*
*************************************************************************************
*/
#ifndef _GLOBAL_H_
#define _GLOBAL_H_
#include <stdio.h> //!< for FILE
#include "defines.h"
#ifdef WIN32
#define snprintf _snprintf
#endif
//digipro_1
#define TQ_16 0
typedef enum {
FIELD,
FRAME
} PictureStrufcture; //cjw 20051219 //!< New enum for field processing
//! Boolean Type
typedef enum {
FALSE,
TRUE
} Boolean;
typedef unsigned char byte; //!< 8 bit unsigned
typedef int int32;
typedef unsigned int u_int32;
// global picture format dependend buffers, mem allocation in decod.c ******************
int **refFrArr; //!< Array for reference frames of each block
byte **imgY; //!< array for the decoded luma component
byte ***imgUV; //!< array for the chroma component
// B pictures
byte **imgY_prev;
byte ***imgUV_prev;
byte **imgY_ref; //!< reference frame find snr
byte ***imgUV_ref;
// B pictures
int Bframe_ctr;
byte prevP_tr, nextP_tr, P_interval;
int frame_no;
int **refFrArr_frm;
byte **imgY_frm;
byte ***imgUV_frm;
int **refFrArr_top;
int **refFrArr_bot;
byte **imgY_top;
byte **imgY_bot;
byte ***imgUV_top;
byte ***imgUV_bot;
int *parity_fld;
byte **mref_frm[2]; //!< 1/1 pix luma for direct interpolation
byte **mcef_frm[2][2]; //!< pix chroma
byte **mref_fld[4]; //!< 1/1 pix luma for direct interpolation
byte **mcef_fld[4][2];
byte nextP_tr_frm, nextP_tr_fld;
#define ET_SIZE 300 //!< size of error text buffer
char errortext[ET_SIZE]; //!< buffer for error message for exit with error()
/***********************************************************************
* T y p e d e f i n i t i o n s f o r T M L
***********************************************************************
*/
//! definition of AVS syntax elements
typedef enum {
SE_HEADER,
SE_PTYPE,
SE_MBTYPE,
SE_REFFRAME,
SE_INTRAPREDMODE,
SE_MVD,
SE_CBP_INTRA,
SE_LUM_DC_INTRA,
SE_CHR_DC_INTRA,
SE_LUM_AC_INTRA,
SE_CHR_AC_INTRA,
SE_CBP_INTER,
SE_LUM_DC_INTER,
SE_CHR_DC_INTER,
SE_LUM_AC_INTER,
SE_CHR_AC_INTER,
SE_DELTA_QUANT_INTER,
SE_DELTA_QUANT_INTRA,
SE_BFRAME,
SE_EOS,
SE_MAX_ELEMENTS //!< number of maximum syntax elements, this MUST be the last one!
} SE_type; // substituting the definitions in element.h
typedef enum {
INTER_MB,
INTRA_MB_4x4,
INTRA_MB_16x16
} IntraInterDecision;
typedef enum {
BITS_TOTAL_MB,
BITS_HEADER_MB,
BITS_INTER_MB,
BITS_CBP_MB,
BITS_COEFF_Y_MB,
BITS_COEFF_UV_MB,
MAX_BITCOUNTER_MB
} BitCountType;
typedef enum {
P_IMG = 0,
B_IMG,
I_IMG,
} PictureType;
/*Lou 1016 Start*/
typedef enum{
NS_BLOCK,
VS_BLOCK
}SmbMode;
/*Lou 1016 End*/
/***********************************************************************
* N e w D a t a t y p e s f o r T M L
***********************************************************************
*/
struct img_par;
struct inp_par;
struct stat_par;
//! Syntaxelement
typedef struct syntaxelement
{
int type; //!< type of syntax element for data part.
int value1; //!< numerical value of syntax element
int value2; //!< for blocked symbols, e.g. run/level
int len; //!< length of code
int inf; //!< info part of UVLC code
unsigned int bitpattern; //!< UVLC bitpattern
int context; //!< CABAC context
int k; //!< CABAC context for coeff_count,uv
int golomb_grad; //!< Needed if type is a golomb element
int golomb_maxlevels; //!< If this is zero, do not use the golomb coding
#if TRACE
#define TRACESTRING_SIZE 100 //!< size of trace string
char tracestring[TRACESTRING_SIZE]; //!< trace string
#endif
//! for mapping of UVLC to syntaxElement
void (*mapping)(int len, int info, int *value1, int *value2);
} SyntaxElement;
//! Macroblock
typedef struct macroblock
{
int qp;
int slice_nr;
int delta_quant; //!< for rate control
struct macroblock *mb_available[3][3]; /*!< pointer to neighboring MBs in a 3x3 window of current MB, which is located at [1][1]
NULL pointer identifies neighboring MBs which are unavailable */
// some storage of macroblock syntax elements for global access
int mb_type;
int mvd[2][BLOCK_MULTIPLE][BLOCK_MULTIPLE][2]; //!< indices correspond to [forw,backw][block_y][block_x][x,y]
int cbp, cbp_blk ;
unsigned long cbp_bits;
int b8mode[4];
int b8pdir[4];
int mb_type_2;
int c_ipred_mode_2; //!< chroma intra prediction mode
int dct_mode;
int c_ipred_mode; //!< chroma intra prediction mode
int lf_disable;
int lf_alpha_c0_offset;
int lf_beta_offset;
} Macroblock;
//! Bitstream
typedef struct
{
// CABAC Decoding
int read_len; //!< actual position in the codebuffer, CABAC only
int code_len; //!< overall codebuffer length, CABAC only
// UVLC Decoding
int frame_bitoffset; //!< actual position in the codebuffer, bit-oriented, UVLC only
int bitstream_length; //!< over codebuffer lnegth, byte oriented, UVLC only
// ErrorConcealment
byte *streamBuffer; //!< actual codebuffer for read bytes
} Bitstream;
//****************************** ~DM ***********************************
// image parameters
typedef struct img_par
{
int number; //<! frame number
int current_mb_nr; // bitstream order
int max_mb_nr;
int current_slice_nr;
int **intra_block;
int tr; //<! temporal reference, 8 bit, wrapps at 255
int qp; //<! quant for the current frame
int type; //<! image type INTER/INTRA
int width;
int height;
int width_cr; //<! width chroma
int height_cr; //<! height chroma
int mb_y;
int mb_x;
int block_y;
int pix_y;
int pix_x;
int pix_c_y;
int block_x;
int pix_c_x;
//int allrefzero;
int ***mv; //<! [92][72][3] // delete by xfwang 2004.7.29
int mpr[16][16]; //<! predicted block
int m7[16][16]; //<! final 4x4 block. Extended to 16x16 for ABT
int m8[2][8][8]; //<! final 4x4 block. Extended to 16x16 for AVS
int cof[4][6][4][4]; //<! correction coefficients from predicted
int cofu[4];
int **ipredmode; //<! prediction type [90][74]
int quad[256];
int cod_counter; //<! Current count of number of skipped macroblocks in a row
int ***dfMV; //<! [92][72][3];
int ***dbMV; //<! [92][72][3];
int **fw_refFrArr; //<! [72][88];
int **bw_refFrArr; //<! [72][88];
int ***mv_frm;
int **fw_refFrArr_frm; //<! [72][88];
int **bw_refFrArr_frm; //<! [72][88];
int imgtr_next_P;
int imgtr_last_P;
int tr_frm;
int tr_fld;
int imgtr_last_prev_P;//Lou 1016
// B pictures
int ***fw_mv; //<! [92][72][3];
int ***bw_mv; //<! [92][72][3];
int subblock_x;
int subblock_y;
int buf_cycle;
int direct_type;
int ***mv_top;
int ***mv_bot;
int **fw_refFrArr_top; //<! [72][88];
int **bw_refFrArr_top; //<! [72][88];
int **fw_refFrArr_bot; //<! [72][88];
int **bw_refFrArr_bot; //<! [72][88];
int **ipredmode_top;
int **ipredmode_bot;
int ***fw_mv_top;
int ***fw_mv_bot;
int ***bw_mv_top;
int ***bw_mv_bot;
int ***dfMV_top; //<! [92][72][3];
int ***dbMV_top; //<! [92][72][3];
int ***dfMV_bot; //<! [92][72][3];
int ***dbMV_bot; //<! [92][72][3];
int toppoc; //poc for this top field // POC200301
int bottompoc; //poc of bottom field of frame
int framepoc; //poc of this frame // POC200301
unsigned int frame_num; //frame_num for this frame
unsigned int pic_distance;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -