ldecod.c File Reference

H.264/AVC reference decoder project main(). More...

#include "contributors.h"
#include <sys/stat.h>
#include "global.h"
#include "annexb.h"
#include "image.h"
#include "memalloc.h"
#include "mc_prediction.h"
#include "mbuffer.h"
#include "leaky_bucket.h"
#include "fmo.h"
#include "output.h"
#include "cabac.h"
#include "parset.h"
#include "sei.h"
#include "erc_api.h"
#include "quant.h"
#include "block.h"
#include "nalu.h"
#include "img_io.h"

Include dependency graph for ldecod.c:

Go to the source code of this file.

Defines

#define LOGFILE   "log.dec"
#define DATADECFILE   "dataDec.txt"
#define TRACEFILE   "trace_dec.txt"
#define OUTSTRING_SIZE   255

Functions

static void init_conf (ImageParameters *p_Img, InputParameters *p_Inp, char *config_filename)
static void Report (ImageParameters *p_Img)
static void init (ImageParameters *p_Img)
static void malloc_slice (InputParameters *p_Inp, ImageParameters *p_Img)
static void free_slice (Slice *currSlice)
void error (char *text, int code)
void JMDecHelpExit (void)
void Configure (ImageParameters *p_Img, InputParameters *p_Inp, int ac, char *av[])
static void alloc_img (ImageParameters **p_Img)
static void alloc_params (InputParameters **p_Inp)
static void alloc_decoder (DecoderParams **p_Dec)
static void free_img (ImageParameters *p_Img)
int main (int argc, char **argv)
void init_frext (ImageParameters *p_Img)
static void conf_read_check (int val, int expected)
DataPartitionAllocPartition (int n)
void FreePartition (DataPartition *dp, int n)
int init_global_buffers (ImageParameters *p_Img)
void free_global_buffers (ImageParameters *p_Img)
void report_stats_on_error (void)

Variables

DecoderParams * p_Dec


Detailed Description

H.264/AVC reference decoder project main().

ldecod.c

Author:
Main contributors (see contributors.h for copyright, address and affiliation details)

Definition in file ldecod.c.


Function Documentation

static void alloc_decoder ( DecoderParams **  p_Dec  )  [static]

Allocate the Decoder Structure.

Output:
Decoder Parameters

Definition at line 350 of file ldecod.c.

References alloc_img(), alloc_params(), and no_mem_exit().

Referenced by main().

Here is the call graph for this function:

static void alloc_img ( ImageParameters **  p_Img  )  [static]

Allocate the Image structure.

Output:
Image Parameters ImageParameters *p_Img

Definition at line 302 of file ldecod.c.

References no_mem_exit().

Referenced by alloc_decoder().

Here is the call graph for this function:

static void alloc_params ( InputParameters **  p_Inp  )  [static]

Allocate the Input structure.

Output:
Input Parameters InputParameters *p_Img

Definition at line 336 of file ldecod.c.

References no_mem_exit().

Referenced by alloc_decoder().

Here is the call graph for this function:

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 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:

static void conf_read_check ( int  val,
int  expected 
) [inline, static]

exit with error message if reading from config file failed

Definition at line 592 of file ldecod.c.

References error().

Referenced by init_conf().

Here is the call graph for this function:

void Configure ( ImageParameters *  p_Img,
InputParameters *  p_Inp,
int  ac,
char *  av[] 
)

set default bitstream name

set default output file name

set default reference file name

Input file

Output File

Reference File

Poc Scale

indicate UV writing for 4:0:0

Definition at line 136 of file ldecod.c.

References error(), errortext, ET_SIZE, init_conf(), JMDecHelpExit(), and PAR_OF_ANNEXB.

Referenced by main().

Here is the call graph for this function:

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

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:

static void free_img ( ImageParameters *  p_Img  )  [static]

Free the Image structure.

Input:
Image Parameters ImageParameters *p_Img

Definition at line 370 of file ldecod.c.

Referenced by main().

static void free_slice ( Slice currSlice  )  [static]

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

Input:
Input Parameters InputParameters *p_Inp, ImageParameters *p_Img

Definition at line 1025 of file ldecod.c.

References delete_contexts_MotionInfo(), delete_contexts_TextureInfo(), free_mem3Dint(), free_mem3Dpel(), free_mem4Dint(), 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 951 of file ldecod.c.

References Bitstream::streamBuffer.

Referenced by free_slice().

static void init ( ImageParameters *  p_Img  )  [static]

Initilize some arrays.

Parameters:
p_Img image parameters

Definition at line 479 of file ldecod.c.

Referenced by main().

static void init_conf ( ImageParameters *  p_Img,
InputParameters *  p_Inp,
char *  config_filename 
) [static]

Read parameters from configuration file.

Input:
Name of configuration filename
Output
none

Definition at line 612 of file ldecod.c.

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

Referenced by Configure().

Here is the call graph for this function:

void init_frext ( ImageParameters *  p_Img  ) 

Initialize FREXT variables.

Parameters:
p_Img image parameters

Definition at line 539 of file ldecod.c.

References YUV400, YUV420, YUV422, and YUV444.

Referenced by activate_sps().

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:
Input Parameters InputParameters *p_Inp, Image Parameters ImageParameters *p_Img
Output:
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 JMDecHelpExit ( void   ) 

print help message and exit

Definition at line 107 of file ldecod.c.

Referenced by Configure().

int main ( int  argc,
char **  argv 
)

static void malloc_slice ( InputParameters *  p_Inp,
ImageParameters *  p_Img 
) [static]

Allocates the slice structure along with its dependent data structures.

Input:
Input Parameters InputParameters *p_Inp, ImageParameters *p_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 977 of file ldecod.c.

References AllocPartition(), create_contexts_MotionInfo(), create_contexts_TextureInfo(), error(), errortext, ET_SIZE, get_mem3Dint(), get_mem3Dpel(), get_mem4Dint(), MAX_REFERENCE_PICTURES, slice::mot_ctx, slice::partArr, and slice::tex_ctx.

Referenced by main().

Here is the call graph for this function:

static void Report ( ImageParameters *  p_Img  )  [static]

Reports the gathered information to appropriate outputs.

Input:
InputParameters *p_Inp, ImageParameters *p_Img, struct snr_par *stat
Output:
None

Definition at line 732 of file ldecod.c.

References error(), errortext, and ET_SIZE.

Referenced by main().

Here is the call graph for this function:


Documentation generated with DoxyGen