global.h File Reference

global definitions for H.264 decoder. More...

#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <assert.h>
#include <time.h>
#include <sys/timeb.h>
#include "win32.h"
#include "defines.h"
#include "ifunctions.h"
#include "parsetcommon.h"

Include dependency graph for global.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  DecodingEnvironment
 struct to characterize the state of the arithmetic coding engine More...
struct  BiContextType
 struct for context management More...
struct  MotionInfoContexts
struct  TextureInfoContexts
struct  DecRefPicMarking_s
struct  macroblock
 Macroblock. More...
struct  syntaxelement
 Syntaxelement. More...
struct  Bitstream
 Bitstream. More...
struct  datapartition
 DataPartition. More...
struct  Slice
 Slice. More...
struct  img_par
struct  snr_par
struct  inp_par
struct  pix_pos
struct  old_slice_par

Defines

#define ET_SIZE   300
#define NUM_MB_TYPE_CTX   11
#define NUM_B8_TYPE_CTX   9
#define NUM_MV_RES_CTX   10
#define NUM_REF_NO_CTX   6
#define NUM_DELTA_QP_CTX   4
#define NUM_MB_AFF_CTX   4
#define NUM_TRANSFORM_SIZE_CTX   3
#define NUM_IPR_CTX   2
#define NUM_CIPR_CTX   4
#define NUM_CBP_CTX   4
#define NUM_BCBP_CTX   4
#define NUM_MAP_CTX   15
#define NUM_LAST_CTX   15
#define NUM_ONE_CTX   5
#define NUM_ABS_CTX   5

Typedefs

typedef DecodingEnvironment * DecodingEnvironmentPtr
typedef BiContextType * BiContextTypePtr
typedef struct DecRefPicMarking_s DecRefPicMarking_t
typedef struct macroblock Macroblock
typedef struct syntaxelement SyntaxElement
typedef struct datapartition DataPartition
typedef struct img_par ImageParameters
typedef struct pix_pos PixelPos
typedef struct old_slice_par OldSliceParams

Enumerations

enum  ColorFormat {
  YUV_UNKNOWN = -1, YUV400 = 0, YUV420 = 1, YUV422 = 2,
  YUV444 = 3
}
enum  PAR_DP_TYPE { PAR_DP_1, PAR_DP_3 }
enum  PAR_OF_TYPE { PAR_OF_ANNEXB, PAR_OF_RTP }
enum  SE_type {
  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
}
enum  IntraInterDecision { INTER_MB, INTRA_MB_4x4, INTRA_MB_16x16 }
enum  BitCountType {
  BITS_HEADER = 0, BITS_TOTAL_MB = 1, BITS_MB_MODE = 2, BITS_INTER_MB = 3,
  BITS_CBP_MB = 4, BITS_COEFF_Y_MB = 5, BITS_COEFF_CB_MB = 6, BITS_COEFF_CR_MB = 7,
  BITS_DELTA_QUANT_MB = 8, BITS_STUFFING = 9, MAX_BITCOUNTER_MB = 10
}
enum  SliceMode { NO_SLICES, FIXED_MB, FIXED_RATE, CALL_BACK }
enum  SymbolMode { UVLC, CABAC }
enum  Lists { LIST_0 = 0, LIST_1 = 1, BI_PRED = 2 }
enum  PictureStructure { FRAME, TOP_FIELD, BOTTOM_FIELD }
enum  ColorPlane {
  PLANE_Y = 0, PLANE_U = 1, PLANE_V = 2, PLANE_G = 0,
  PLANE_B = 1, PLANE_R = 2
}
enum  SliceType {
  P_SLICE = 0, B_SLICE, I_SLICE, SP_SLICE,
  SI_SLICE
}
enum  Component_Type { IS_LUMA = 0, IS_CHROMA = 1 }
enum  Color_Component { LumaComp = 0, CrComp = 1, CbComp = 2 }

Functions

void init_conf (struct inp_par *inp, char *config_filename)
void report (struct inp_par *inp, ImageParameters *img, struct snr_par *snr)
void init (ImageParameters *img)
void malloc_slice (struct inp_par *inp, ImageParameters *img)
void free_slice (ImageParameters *img)
void reset_ec_flags (void)
void error (char *text, int code)
int init_global_buffers (void)
void free_global_buffers (void)
int RBSPtoSODB (byte *streamBuffer, int last_byte_pos)
int EBSPtoRBSP (byte *streamBuffer, int end_bytepos, int begin_bytepos)
void FreePartition (DataPartition *dp, int n)
DataPartition * AllocPartition (int n)
void tracebits (const char *trace_str, int len, int info, int value1)
void tracebits2 (const char *trace_str, int len, int info)
unsigned CeilLog2 (unsigned uiVal)
unsigned CeilLog2_sf (unsigned uiVal)
void change_plane_JV (int nplane)
void make_frame_picture_JV (void)

Variables

pic_parameter_set_rbsp_t * active_pps
seq_parameter_set_rbsp_t * active_sps
imgpel ** imgY_ref
imgpel *** imgUV_ref
int ** PicPos
int ReMapRef [20]
int Bframe_ctr
int frame_no
int g_nFrame
int TopFieldForSkip_Y [16][16]
int TopFieldForSkip_UV [2][16][16]
char errortext [ET_SIZE]
ImageParameters * img
struct snr_par * snr
int64 tot_time
struct inp_par * params
OldSliceParams old_slice
int p_out
int p_ref
FILE * p_log
unsigned int previous_frame_num
int ref_flag [17]
int Is_primary_correct
int Is_redundant_correct
int redundant_slice_ref_idx
int(* nal_startcode_follows )(Slice *, int)
int ipmode_DPCM


Detailed Description

global definitions for H.264 decoder.

global.h

Author:
Copyright (C) 1999 Telenor Satellite Services,Norway Ericsson Radio Systems, Sweden
Inge Lille-Langoy <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

Definition in file global.h.


Define Documentation

#define ET_SIZE   300


Typedef Documentation

typedef struct datapartition DataPartition

DataPartition.

Buffer structure for decoded referenc picture marking commands

typedef struct macroblock Macroblock

Macroblock.

typedef struct syntaxelement SyntaxElement

Syntaxelement.


Enumeration Type Documentation

Color formats.

Enumerator:
YUV_UNKNOWN  Unknown color format.
YUV400  Monochrome.
YUV420  4:2:0
YUV422  4:2:2
YUV444  4:4:4

Definition at line 70 of file global.h.

Data Partitioning Modes.

Enumerator:
PAR_DP_1  no data partitioning is supported
PAR_DP_3  data partitioning with 3 partitions

Definition at line 79 of file global.h.

Output File Types.

Enumerator:
PAR_OF_ANNEXB  Current TML description.
PAR_OF_RTP  RTP Packet Output format.

Definition at line 87 of file global.h.

enum SE_type

definition of H.264 syntax elements

Enumerator:
SE_MAX_ELEMENTS  number of maximum syntax elements, this MUST be the last one!

Definition at line 95 of file global.h.


Function Documentation

DataPartition* AllocPartition ( int  n  ) 

Allocates a stand-alone partition structure. Structure should be freed by FreePartition(); data structures.

Input:
n: number of partitions in the array
return
pointer to DataPartition Structure, zero-initialized

Definition at line 818 of file ldecod.c.

References datapartition::bitstream, error(), errortext, ET_SIZE, MAX_CODED_FRAME_SIZE, and Bitstream::streamBuffer.

Referenced by malloc_slice().

Here is the call graph for this function:

unsigned CeilLog2 ( unsigned  uiVal  ) 

calculate Ceil(Log2(uiVal))

Definition at line 42 of file header.c.

Referenced by interpret_motion_constrained_slice_group_set_info(), and RestOfSliceHeader().

void change_plane_JV ( int  nplane  ) 

change target plane for 4:4:4 Independent mode

Definition at line 4722 of file macroblock.c.

References dec_picture_JV.

Referenced by decode_one_slice(), and exit_picture().

int EBSPtoRBSP ( byte *  streamBuffer,
int  end_bytepos,
int  begin_bytepos 
)

Converts Encapsulated Byte Sequence Packets to RBSP.

Parameters:
streamBuffer pointer to data stream
end_bytepos size of data stream
begin_bytepos Position after beginning

Definition at line 92 of file nal.c.

Referenced by NALUtoRBSP().

void error ( char *  text,
int  code 
)

Error handling procedure. Print error message to stderr and exit with supplied code.

Parameters:
text Error message
code Exit code

Definition at line 29 of file filehandle.c.

References flush_dpb().

Referenced by adaptive_memory_management(), AllocPartition(), arideco_delete_decoding_environment(), buf2img(), check_num_ref(), conf_read_check(), Configure(), decode_one_component(), decode_poc(), FmoGenerateMapUnitToSliceGroupMap(), free_mem2D(), free_mem2Ddouble(), free_mem2Dint(), free_mem2Dint64(), free_mem2Dodouble(), free_mem2Doint(), free_mem2Dpel(), free_mem2Dshort(), free_mem3D(), free_mem3Ddouble(), free_mem3Dint(), free_mem3Dint64(), free_mem3Dodouble(), free_mem3Doint(), free_mem3Dpel(), free_mem3Dshort(), free_mem4D(), free_mem4Dint(), free_mem4Dpel(), free_mem4Dshort(), free_mem5Dint(), free_mem5Dpel(), free_mem5Dshort(), free_mem6Dshort(), free_mem7Dshort(), free_offset_mem2Dshort(), get_smallest_poc(), getDpbSize(), img2buf_endian(), init_conf(), init_dpb(), init_picture(), initBitsFile(), interpret_picture_timing_info(), intra16x16_hor_pred(), intra16x16_plane_pred(), intra16x16_vert_pred(), intrapred_chroma(), malloc_slice(), mm_assign_long_term_frame_idx(), no_mem_exit(), OpenAnnexBFile(), OpenRTPFile(), output_one_frame_from_dpb(), predict_nnz(), read_ipred_modes(), read_new_slice(), read_next_nalu(), readCoeff4x4_CAVLC(), readMotionInfoFromNAL(), remove_frame_from_dpb(), reorder_ref_pic_list(), report(), RestOfSliceHeader(), start_macroblock(), store_picture_in_dpb(), and write_out_picture().

Here is the call graph for this function:

void free_global_buffers ( void   ) 

Free allocated memory of frame size related global buffers buffers are defined in global.h, allocated memory is allocated in int init_global_buffers().

Input:
Input Parameters struct inp_par *inp, Image Parameters ImageParameters *img
Output:
none

Definition at line 1039 of file ldecod.c.

References free_mem2D(), free_mem2Dint(), free_mem2Dpel(), free_mem3Dint(), free_mem3Dpel(), free_mem4D(), free_mem4Dint(), img, and imgY_ref.

Referenced by init_global_buffers(), and main().

Here is the call graph for this function:

void free_slice ( ImageParameters *  img  ) 

Memory frees of the Slice structure and of its dependent data structures.

Input:
Input Parameters struct inp_par *inp, ImageParameters *img

Definition at line 930 of file ldecod.c.

References delete_contexts_MotionInfo(), delete_contexts_TextureInfo(), FreePartition(), Slice::mot_ctx, Slice::partArr, and Slice::tex_ctx.

Referenced by main().

Here is the call graph for this function:

void FreePartition ( DataPartition *  dp,
int  n 
)

Frees a partition structure (array).

Input:
Partition to be freed, size of partition Array (Number of Partitions)
return
None
Note:
n must be the same as for the corresponding call of AllocPartition

Definition at line 869 of file ldecod.c.

References datapartition::bitstream, and Bitstream::streamBuffer.

Referenced by free_slice().

void init ( ImageParameters *  img  ) 

Initilize some arrays.

Parameters:
img  image parameters

Definition at line 429 of file ldecod.c.

References imgY_ref, and params.

Referenced by main().

void init_conf ( struct inp_par *  inp,
char *  config_filename 
)

Read parameters from configuration file.

Input:
Name of configuration filename
Output
none

Definition at line 533 of file ldecod.c.

References conf_read_check(), error(), errortext, ET_SIZE, img, PAR_OF_ANNEXB, and PAR_OF_RTP.

Referenced by Configure().

Here is the call graph for this function:

int init_global_buffers ( void   ) 

Dynamic memory allocation of frame size related global buffers buffers are defined in global.h, allocated memory must be freed in void free_global_buffers().

Input:
Input Parameters struct inp_par *inp, Image Parameters ImageParameters *img
Output:
Number of allocated bytes

Helper array to access macroblock positions. We add 1 to also consider last MB.

Definition at line 961 of file ldecod.c.

References free_global_buffers(), get_mem2D(), get_mem2Dint(), get_mem2Dpel(), get_mem3Dint(), get_mem3Dpel(), get_mem4D(), get_mem4Dint(), img, imgY_ref, MAX_REFERENCE_PICTURES, no_mem_exit(), and YUV400.

Here is the call graph for this function:

void make_frame_picture_JV ( void   ) 

make frame picture from each plane data for 4:4:4 Independent mode

Definition at line 4737 of file macroblock.c.

References dec_picture_JV, free_storable_picture(), storable_picture::imgUV, storable_picture::imgY, storable_picture::JVmotion, and storable_picture::motion.

Referenced by exit_picture().

Here is the call graph for this function:

void malloc_slice ( struct inp_par *  inp,
ImageParameters *  img 
)

Allocates the slice structure along with its dependent data structures.

Input:
Input Parameters struct inp_par *inp, ImageParameters *img

you don't know whether we do CABAC hre, hence initialize CABAC anyway

assume data partitioning (worst case) for the following mallocs()

Definition at line 895 of file ldecod.c.

References AllocPartition(), create_contexts_MotionInfo(), create_contexts_TextureInfo(), error(), errortext, ET_SIZE, Slice::max_part_nr, Slice::mot_ctx, Slice::partArr, and Slice::tex_ctx.

Referenced by main().

Here is the call graph for this function:

int RBSPtoSODB ( byte *  streamBuffer,
int  last_byte_pos 
)

Converts RBSP to string of data bits.

Parameters:
streamBuffer pointer to buffer containing data
last_byte_pos position of the last byte containing data.
Returns:
last_byte_pos position of the last byte pos. If the last-byte was entirely a stuffing byte, it is removed, and the last_byte_pos is updated.

Definition at line 41 of file nal.c.

Referenced by read_new_slice().

void report ( struct inp_par *  inp,
ImageParameters *  img,
struct snr_par *  snr 
)

Reports the gathered information to appropriate outputs.

Input:
struct inp_par *inp, ImageParameters *img, struct snr_par *stat
Output:
None

Definition at line 653 of file ldecod.c.

References error(), errortext, ET_SIZE, p_log, and params.

Referenced by main().

Here is the call graph for this function:

void reset_ec_flags ( void   ) 

resets EC_Flags called at the start of each slice

Definition at line 154 of file errorconcealment.c.

References ec_flag, NO_EC, and SE_MAX_ELEMENTS.


Variable Documentation

char errortext[ET_SIZE]

ImageParameters* img

imgpel** imgY_ref

reference frame find snr

Definition at line 46 of file global.h.

Referenced by find_snr(), free_global_buffers(), init(), and init_global_buffers().

if primary frame is correct, 0: incorrect

Definition at line 726 of file global.h.

Referenced by decode_one_frame(), Error_tracking(), and read_new_slice().

if redundant frame is correct, 0:incorrect

Definition at line 727 of file global.h.

Referenced by decode_one_frame(), Error_tracking(), and read_new_slice().

FILE* p_log

SNR file.

Definition at line 716 of file global.h.

Referenced by report().

int p_out

file descriptor to output YUV file

Definition at line 713 of file global.h.

Referenced by Configure(), interpret_spare_pic(), main(), output_one_frame_from_dpb(), and store_picture_in_dpb().

int p_ref

pointer to input original reference YUV file file

Definition at line 714 of file global.h.

Referenced by Configure(), direct_output(), exit_picture(), insert_picture_in_dpb(), and main().

struct inp_par* params

unsigned int previous_frame_num

frame number of previous slice

Definition at line 723 of file global.h.

Referenced by decode_one_frame().

reference index of redundant slice

Definition at line 728 of file global.h.

Referenced by Error_tracking(), and ref_pic_list_reordering().

int ref_flag[17]

0: i-th previous frame is incorrect non-zero: i-th previous frame is correct

Definition at line 724 of file global.h.

Referenced by conceal_lost_frames(), decode_one_frame(), Error_tracking(), and main().

struct snr_par* snr

statistics

Definition at line 88 of file ldecod.c.

Referenced by direct_output(), exit_picture(), insert_picture_in_dpb(), and main().


Documentation generated with DoxyGen