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

📄 global.h

📁 网络MPEG4IP流媒体开发源代码
💻 H
📖 第 1 页 / 共 2 页
字号:
/************************************************************************* COPYRIGHT AND WARRANTY INFORMATION** Copyright 2001, International Telecommunications Union, Geneva** DISCLAIMER OF WARRANTY** These software programs are available to the user without any* license fee or royalty on an "as is" basis. The ITU 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* contributor or the ITU be liable for any incidental, punitive, or* consequential damages of any kind whatsoever arising from the* use of these programs.** This disclaimer of warranty extends to the user of these programs* and user's customers, employees, agents, transferees, successors,* and assigns.** The ITU does not represent or warrant that the programs furnished* hereunder are free of infringement of any third-party patents.* Commercial implementations of ITU-T Recommendations, including* shareware, may be subject to royalty fees to patent holders.* Information regarding the ITU-T patent policy is available from* the ITU Web site at http://www.itu.int.** THIS IS NOT A GRANT OF PATENT RIGHTS - SEE THE ITU-T PATENT POLICY.*************************************************************************//*! ************************************************************************ *  \file *     global.h *  \brief *     global definitions for for H.26L encoder. *  \author *     Copyright (C) 1999  Telenor Satellite Services,Norway *                         Ericsson Radio Systems, Sweden * *     Inge Lille-Lang鴜               <inge.lille-langoy@telenor.com> * *     Telenor Satellite Services *     Keysers gt.13                       tel.:   +47 23 13 86 98 *     N-0130 Oslo,Norway                  fax.:   +47 22 77 79 80 * *     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>#include "defines.h"#ifndef WIN32  #include "minmax.h"#else  #define  snprintf _snprintf#endif/*********************************************************************** * 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;    //!< byte type definition#define pel_t byte//! Data Partitioning Modestypedef enum{  PAR_DP_1,   //!< no data partitioning is supported  PAR_DP_3,   //!< data partitioning with 3 partitions} PAR_DP_TYPE;//! Output File Typestypedef enum{  PAR_OF_26L,    //!< Current TML description  PAR_OF_RTP     //!< RTP packets in outfile} PAR_OF_TYPE;//! Boolean Typetypedef enum {  FALSE,  TRUE} Boolean;//! definition of H.26L syntax elementstypedef 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,  SE_BFRAME,  SE_EOS,  SE_MAX_ELEMENTS  //!< number of maximum syntax elements} SE_type;         // substituting the definitions in elements.htypedef enum {  INTER_MB,  INTRA_MB_4x4,  INTRA_MB_16x16} IntraInterDecision;typedef enum {  BITS_HEADER,  BITS_TOTAL_MB,  BITS_MB_MODE,  BITS_INTER_MB,  BITS_CBP_MB,  BITS_COEFF_Y_MB,  BITS_COEFF_UV_MB,  BITS_DELTA_QUANT_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 *********************************************************************** *///! struct to characterize the state of the arithmetic coding enginetypedef struct{  unsigned int  Elow, Ehigh;  unsigned int  Ebuffer;  unsigned int  Ebits_to_go;  unsigned int  Ebits_to_follow;  byte          *Ecodestrm;  int           *Ecodestrm_len;  // storage in case of recode MB  unsigned int  ElowS, EhighS;  unsigned int  EbufferS;  unsigned int  Ebits_to_goS;  unsigned int  Ebits_to_followS;  byte          *EcodestrmS;  int           *Ecodestrm_lenS;} EncodingEnvironment;typedef EncodingEnvironment *EncodingEnvironmentPtr;//! struct for context managementtypedef 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;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#define NUM_DELTA_QP_CTX 4typedef struct{  BiContextTypePtr mb_type_contexts[2];  BiContextTypePtr mv_res_contexts[2];  BiContextTypePtr ref_no_contexts;  BiContextTypePtr delta_qp_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    2typedef 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 *********************************************************************** *///! Syntaxelementtypedef 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  #define             TRACESTRING_SIZE 100            //!< size of trace string  char                tracestring[TRACESTRING_SIZE];  //!< trace string#endif  //!< for mapping of syntaxElement to UVLC  void    (*mapping)(int value1, int value2, int* len_ptr, int* info_ptr);  //!< used for CABAC: refers to actual coding method of each individual syntax element type  void    (*writing)(struct syntaxelement *, EncodingEnvironmentPtr);} SyntaxElement;//! Macroblocktypedef struct macroblock{  int                 currSEnr;                   //!< number of current syntax element  int                 slice_nr;                   //!< slice number to which the MB belongs  int                 delta_qp;  int                 qp ;  int                 intraOrInter;  int                 bitcounter[MAX_BITCOUNTER_MB];  struct macroblock   *mb_available[3][3];        /*!< pointer to neighboring MBs in a 3x3 window of current MB, which is located at [1][1] \n                                                       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                 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 ;  int                 cbp_blk ;    //!< 1 bit set for every 4x4 block with coefs (not implemented for INTRA)} Macroblock;//! Bitstreamtypedef struct{  int             byte_pos;           //!< current position in bitstream;  int             bits_to_go;         //!< current bitcounter  byte            byte_buf;           //!< current buffer for last written byte  int             stored_byte_pos;    //!< storage for position in bitstream;  int             stored_bits_to_go;  //!< storage for bitcounter  int             header_len;  byte            header_byte_buffer;  byte            stored_byte_buf;    //!< storage for buffer of last written byte  byte            byte_buf_skip;      //!< current buffer for last written byte  int             byte_pos_skip;      //!< storage for position in bitstream;  int             bits_to_go_skip;    //!< storage for bitcounter  byte            *streamBuffer;      //!< actual buffer for written bytes} Bitstream;//! DataPartitiontypedef struct datapartition{  Bitstream           *bitstream;  EncodingEnvironment ee_cabac;  int                 (*writeSyntaxElement)(SyntaxElement *, struct datapartition *);                      /*!< virtual function;                           actual method depends on chosen data partition and                           entropy coding method  */} DataPartition;//! Slicetypedef struct{  int                 picture_id;  int                 slice_nr;     //!< not necessary but o.k.  int                 qp;  int                 picture_type; //!< picture type  int                 start_mb_nr;  int                 dp_mode;      //!< data partioning mode  int                 max_part_nr;  //!< number of different partitions  DataPartition       *partArr;     //!< array of partitions  MotionInfoContexts  *mot_ctx;     //!< pointer to struct of context models for use in CABAC  TextureInfoContexts *tex_ctx;     //!< pointer to struct of context models for use in CABAC  Boolean             (*slice_too_big)(int bits_slice); //!< for use of callback functions} Slice;// GH: global picture format dependend buffers, mem allocation in image.cbyte   **imgY;               //!< Encoded luma imagesbyte  ***imgUV;              //!< Encoded croma imagesbyte   **imgY_org;           //!< Reference luma imagebyte  ***imgUV_org;          //!< Reference croma imagebyte   **imgY_pf;            //!< Post filter luma imagebyte  ***imgUV_pf;           //!< Post filter croma imagebyte  ***mref;               //!< 1/4 pix lumabyte ****mcef;               //!< pix chromaint    **img4Y_tmp;          //!< for quarter pel interpolationbyte   **imgY_tmp;           //!< for loop filterbyte  ***imgUV_tmp;int   ***tmp_mv;             //!< motion vector bufferint    **refFrArr;           //!< Array for reference frames of each block// B pictures// motion vector : forward, backward, directint  ***tmp_fwMV;int  ***tmp_bwMV;int  ***dfMV;int  ***dbMV;int   **fw_refFrArr;int   **bw_refFrArr;byte  **mref_P;              //!< for B-frames: 1/4 pix luma for next P picturebyte ***mcef_P;              //!< for B-frames: pix chroma for next P picturebyte  **nextP_imgY;byte ***nextP_imgUV;pel_t **Refbuf11;            //!< 1/1th pel (full pel) reference frame bufferpel_t  *Refbuf11_P;          //!< 1/1th pel P picture buffer// Buffers for rd optimization with packet losses, Dim. Kontopodisint  **resY;             //!< Residue of Luminancebyte ***decY;            //!< Decoded values at the simulated decodersbyte ****decref;         //!< Reference frames of the simulated decodersbyte ***decY_best;       //!< Decoded frames for the best mode for all decodersbyte **RefBlock;byte **status_map;int intras;       //!< Counts the intra updates in each frame.int  Bframe_ctr, frame_no, nextP_tr;int  tot_time;#define ET_SIZE 300      //!< size of error text bufferchar errortext[ET_SIZE]; //!< buffer for error message for exit with error()//! SNRParameterstypedef struct{  float snr_y;               //!< current Y SNR  float snr_u;               //!< current U SNR  float snr_v;               //!< current V SNR  float snr_y1;              //!< SNR Y(dB) first frame  float snr_u1;              //!< SNR U(dB) first frame  float snr_v1;              //!< SNR V(dB) first frame  float snr_ya;              //!< Average SNR Y(dB) remaining frames  float snr_ua;              //!< Average SNR U(dB) remaining frames  float snr_va;              //!< Average SNR V(dB) remaining frames} SNRParameters;                             //! all input parameterstypedef struct{  int no_frames;                //!< number of frames to be encoded  int qp0;                      //!< QP of first frame  int qpN;                      //!< QP of remaining frames  int jumpd;                    //!< number of frames to skip in input sequence (e.g 2 takes frame 0,3,6,9...)  int mv_res;                   //!< motion vector resolution: 0: 1/4-pel, 1: 1/8-pel  int hadamard;                 /*!< 0: 'normal' SAD in 1/3 pixel search.  1: use 4x4 Haphazard transform and '                                     Sum of absolute transform difference' in 1/3 pixel search                   */  int search_range;             /*!< search range - integer pel search and 16x16 blocks.  The search window is

⌨️ 快捷键说明

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