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 "types.h"
#include "io_image.h"
#include "frame.h"
#include "distortion.h"
#include "io_video.h"

Include dependency graph for global.h:

Go to the source code of this file.

Data Structures

struct  pix_pos
struct  DecodingEnvironment
 struct to characterize the state of the arithmetic coding engine More...
struct  motion_params
 definition of motion parameters More...
struct  BiContextType
 struct for context management More...
struct  MotionInfoContexts
struct  TextureInfoContexts
struct  DecRefPicMarking_s
 Buffer structure for decoded reference picture marking commands. More...
struct  pic_motion_params2
 definition of pic motion parameters More...
struct  MotionVector
 Motion Vector structure. More...
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  old_slice_par
struct  decoder_params


#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_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


typedef struct pix_pos PixelPos
typedef DecodingEnvironmentDecodingEnvironmentPtr
typedef struct motion_params MotionParams
typedef BiContextTypeBiContextTypePtr
typedef struct DecRefPicMarking_s DecRefPicMarking_t
typedef struct pic_motion_params2 PicMotionParams2
typedef struct macroblock Macroblock
typedef struct syntaxelement SyntaxElement
typedef struct datapartition DataPartition
typedef struct slice Slice
typedef struct img_par ImageParameters
typedef struct snr_par SNRParameters
typedef struct inp_par InputParameters
typedef struct old_slice_par OldSliceParams
typedef struct decoder_params DecoderParams


enum  Color_Component { LumaComp = 0, CrComp = 1, CbComp = 2 }


void error (char *text, int code)
int init_global_buffers (ImageParameters *p_Img)
void free_global_buffers (ImageParameters *p_Img)
int RBSPtoSODB (byte *streamBuffer, int last_byte_pos)
int EBSPtoRBSP (byte *streamBuffer, int end_bytepos, int begin_bytepos)
void FreePartition (DataPartition *dp, int n)
DataPartitionAllocPartition (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 (ImageParameters *p_Img, int nplane)
void make_frame_picture_JV (ImageParameters *p_Img)


int ** PicPos
char errortext [ET_SIZE]
DecoderParams * p_Dec

Detailed Description

global definitions for H.264 decoder.


Copyright (C) 1999 Telenor Satellite Services,Norway Ericsson Radio Systems, Sweden
Inge Lille-Langoy <>

Telenor Satellite Services Keysers gt.13 tel.: +47 23 13 86 98 N-0130 Oslo,Norway fax.: +47 22 77 79 80

Rickard Sjoberg <>

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


Buffer structure for decoded reference picture marking commands.

typedef struct macroblock Macroblock


typedef struct motion_params MotionParams

definition of motion parameters

definition of pic motion parameters

typedef struct slice Slice


typedef struct syntaxelement SyntaxElement


Function Documentation

DataPartition* AllocPartition ( int  n  ) 

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

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

Definition at line 900 of file ldecod.c.

References 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 39 of file header.c.

Referenced by interpret_motion_constrained_slice_group_set_info(), and RestOfSliceHeader().

void change_plane_JV ( ImageParameters *  p_Img,
int  nplane 

change target plane for 4:4:4 Independent mode

Definition at line 5610 of file macroblock.c.

References slice::Co_located_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.

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

Definition at line 85 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.

text Error message
code Exit code

Definition at line 93 of file ldecod.c.

References flush_dpb().

Referenced by adaptive_memory_management(), AllocPartition(), arideco_delete_decoding_environment(), buf2img_basic(), buf2img_bitshift(), buf2img_endian(), buffer2img(), check_num_ref(), conf_read_check(), Configure(), decode_one_component_b_slice(), decode_poc(), FmoGenerateMapUnitToSliceGroupMap(), free_mem1Dpel(), free_mem2D(), free_mem2Ddist(), free_mem2Ddouble(), free_mem2Dint(), free_mem2Dint64(), free_mem2Dlm(), free_mem2Dmp(), free_mem2Dmv(), free_mem2Dodouble(), free_mem2Doint(), free_mem2Dolm(), free_mem2Dpel(), free_mem2Dquant(), free_mem2Dshort(), free_mem2Duint16(), free_mem3D(), free_mem3Ddouble(), free_mem3Dint(), free_mem3Dint64(), free_mem3Dmp(), free_mem3Dmv(), free_mem3Dodouble(), free_mem3Doint(), free_mem3Dpel(), free_mem3Dquant(), free_mem3Dshort(), free_mem3Duint16(), free_mem4D(), free_mem4Dint(), free_mem4Dmv(), free_mem4Dpel(), free_mem4Dquant(), free_mem4Dshort(), free_mem4Duint16(), free_mem5Dint(), free_mem5Dmv(), free_mem5Dpel(), free_mem5Dquant(), 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(), OpenFiles(), OpenRTPFile(), output_one_frame_from_dpb(), predict_nnz(), read_ipred_modes(), read_motion_info_from_NAL_b_slice(), read_new_slice(), read_next_nalu(), readCoeff4x4_CAVLC(), ReadFrameConcatenated(), ReadFrameSeparate(), ReadTIFFIFDEntry(), 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 ( ImageParameters *  p_Img  ) 

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 Parameters InputParameters *p_Inp, Image Parameters ImageParameters *p_Img

Definition at line 1142 of file ldecod.c.

References free_mem2D(), free_mem2Dint(), free_mem2Dpel(), free_mem3Dpel(), and free_mem4D().

Referenced by init_global_buffers(), and main().

Here is the call graph for this function:

void FreePartition ( DataPartition dp,
int  n 

Frees a partition structure (array).

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

Definition at line 951 of file ldecod.c.

References Bitstream::streamBuffer.

Referenced by free_slice().

int init_global_buffers ( ImageParameters *  p_Img  ) 

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 Parameters InputParameters *p_Inp, Image Parameters ImageParameters *p_Img
Number of allocated bytes

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

Definition at line 1066 of file ldecod.c.

References free_global_buffers(), get_mem2D(), get_mem2Dint(), get_mem2Dpel(), get_mem3Dpel(), get_mem4D(), init_qp_process(), no_mem_exit(), and YUV400.

Referenced by activate_sps().

Here is the call graph for this function:

void make_frame_picture_JV ( ImageParameters *  p_Img  ) 

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

Definition at line 5626 of file macroblock.c.

References free_storable_picture().

Referenced by exit_picture().

Here is the call graph for this function:

int RBSPtoSODB ( byte streamBuffer,
int  last_byte_pos 

Converts RBSP to string of data bits.

streamBuffer pointer to buffer containing data
last_byte_pos position of the last byte containing data.
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 34 of file nal.c.

Referenced by read_new_slice().

Variable Documentation

char errortext[ET_SIZE]

Documentation generated with DoxyGen