www.pudn.com > rm52f.rar > 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//!< 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; //