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

📄 global.h

📁 Mobile IP VCEG的信道模拟程序
💻 H
📖 第 1 页 / 共 2 页
字号:
/************************************************************************
*
*  global.h for H.26L decoder.
*  Copyright (C) 1999  Telenor Satellite Services, Norway
*                      Ericsson Radio Systems, Sweden
*
*  Contacts:
*  Inge Lille-Lang鴜               <inge.lille-langoy@telenor.com>
*
*
*  Telenor Satellite Services
*  P.O.Box 6914 St.Olavs plass
*  N-0130 Oslo, Norway
*
*  Rickard Sjoberg                 <rickard.sjoberg@era.ericsson.se>
*
*  Ericsson Radio Systems
*  KI/ERA/T/VV
*  164 80 Stockholm, Sweden
************************************************************************/
#ifndef _GLOBAL_H_
#define _GLOBAL_H_

#include <stdio.h>                              /* for FILE */
#include "defines.h"

typedef unsigned char   byte;                   /*  8 bit unsigned */


/* GH: 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 **imgY_pf;                                 /* Post filter luma image                   */
byte ***imgUV;                                  /* array for the chroma component           */
byte ***imgUV_pf;                               /* Post filter luma image                   */

byte ***mref;                                   /* 1/1 pix luma for direct interpolation	*/
byte ****mcef;		    	                    /* pix chroma								*/

byte **loopb;                                   /* Array for loop filter strength luma      */
byte **loopc;                                   /* Array for loop filter strength chroma    */

// B pictures
byte **imgY_prev;
byte ***imgUV_prev;
// byte **mref_P;                                  /* 1/4 pix luma for next P picture*/
// byte ***mcef_P;                                 /* pix chroma for next P picture*/

byte **mref_P_small;                            /* 1/4 pix luma for next P picture*/

byte **imgY_ref;                                /* reference frame find snr */
byte ***imgUV_ref;

byte **imgY_tmp;                                /* temp luma image loop_filter*/
byte ***imgUV_tmp;                              /* temp chroma image loop_filter*/

//B pictures
int  Bframe_ctr;
byte prevP_tr, nextP_tr, P_interval;
int  frame_no;

char errortext[300];

/***********************************************************************
 * T y p e    d e f i n i t i o n s    f o r    T M L  
 ***********************************************************************
 */

//typedef unsigned char byte;

/* Introduced by TOM */
/* Data Partitioning Modes */
typedef enum
{
	PAR_DP_1    /* no data partitioning is supported    */
} PAR_DP_TYPE;


/* Output File Types */
typedef enum
{
	PAR_OF_26L   /* Current TML description             */
} PAR_OF_TYPE;
/* End Introduced by TOM */


typedef enum {
	FALSE,
	TRUE
} Boolean;

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_BFRAME,
	SE_EOS,					
	SE_MAX_ELEMENTS	/* number of maximum syntax elements */
} 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 {
	SINGLE_SCAN,
	DOUBLE_SCAN
} ScanMode;

typedef enum {
	NO_SLICES,
	FIXED_MB,
	FIXED_RATE,
	CALLBACK
} SliceMode;

typedef enum {
	UVLC,
	CABAC
} SymbolMode;


/***********************************************************************
 * D a t a    t y p e s   f o r  C A B A C  
 ***********************************************************************
 */
typedef struct 
{
    unsigned int    Dlow, Dhigh;
    unsigned int    Dvalue;
    unsigned int    Dbuffer;
    int             Dbits_to_go;
    byte            *Dcodestrm;
    int             *Dcodestrm_len; 
} DecodingEnvironment;                 /* struct to characterize the state of the arithmetic coding engine */

typedef DecodingEnvironment *DecodingEnvironmentPtr;

typedef struct 
{
    unsigned int	cum_freq[2];            /* cumulated frequency counts */
    Boolean			in_use;                 /* flag for context in use */
	unsigned int	max_cum_freq;		    /* maximum frequency count */ 
} BiContextType;							/* struct for context management */

typedef BiContextType *BiContextTypePtr;


/**********************************************************************
 * C O N T E X T S   F O R   T M L   S Y N T A X   E L E M E N T S
 **********************************************************************
 */

#define NUM_MB_TYPE_CTX  10
#define NUM_MV_RES_CTX   10
#define NUM_REF_NO_CTX   6

typedef struct
{
	BiContextTypePtr mb_type_contexts[2];
	BiContextTypePtr mv_res_contexts[2];
	BiContextTypePtr ref_no_contexts;
} MotionInfoContexts;

#define NUM_IPR_CTX    2
#define NUM_CBP_CTX    4
#define NUM_TRANS_TYPE 9
#define NUM_LEVEL_CTX  4
#define NUM_RUN_CTX    2

typedef struct 
{
	BiContextTypePtr ipr_contexts[6]; 
	BiContextTypePtr cbp_contexts[2][3]; 
	BiContextTypePtr level_context[NUM_TRANS_TYPE];
	BiContextTypePtr run_context[NUM_TRANS_TYPE];
} TextureInfoContexts;

/************************ end of data type definition for CABAC ********************/

/***********************************************************************
 * 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;

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 */
#if TRACE
	char					tracestring[100];	/* trace string	*/
#endif
    /* for mapping of UVLC to syntaxElement */
	void    (*mapping)(int len, int info, int *value1, int *value2); 
    /* used for CABAC: refers to actual coding method of each individual syntax element type */				
    void	(*reading)(struct syntaxelement *, struct inp_par *, struct img_par *, DecodingEnvironmentPtr);	
}	SyntaxElement; 

typedef struct macroblock
{
	int						slice_nr;			/* slice number to which the MB belongs */
	int						qp;					/* for future use */
	int						intraOrInter;
	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						mb_imode;
	int						ref_frame;
    int                     predframe_no;
	int						mvd[2][BLOCK_MULTIPLE][BLOCK_MULTIPLE][2];			/* indices correspond to [forw,backw][block_y][block_x][x,y] */
	int						intra_pred_modes[BLOCK_MULTIPLE*BLOCK_MULTIPLE];
	int						cbp;
} Macroblock;


typedef struct 
{
    /* CABAC Decoding */
    int             read_len;                   // actual position in the codebuffer
    int             code_len;                   // overall codebuffer length
	byte			*streamBuffer;			    // actual codebuffer for read bytes
    /* UVLC Decoding */
	int				frame_bitoffset;
	int				bitstram_length;
} Bitstream;


typedef struct datapartition 
{

⌨️ 快捷键说明

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