global.h File Reference

global definitions for H.264 encoder. More...

#include "win32.h"
#include "defines.h"
#include "parsetcommon.h"
#include "ifunctions.h"
#include "frame.h"
#include "io_video.h"
#include "io_image.h"
#include "nalucommon.h"
#include "params.h"
#include "distortion.h"
#include "lagrangian.h"
#include "quant_params.h"
#include "rc_types.h"

Include dependency graph for global.h:

Go to the source code of this file.

Data Structures

struct  image_structure
struct  info_8x8
 block 8x8 temporary RD info More...
struct  search_window
struct  bit_counter
 bit counter for a macroblock. Note that it seems safe to change all to unsigned short for 16x16 MBs. May be an issue if MB > 32x32 More...
struct  EncodingEnvironment
 struct to characterize the state of the arithmetic coding engine More...
struct  BiContextType
 struct for context management More...
struct  MotionInfoContexts
struct  TextureInfoContexts
struct  pix_pos
 Pixel position for checking neighbors. More...
struct  MotionVector
 Motion Vector structure. More...
struct  pic_motion_params
 definition of pic motion parameters More...
struct  GOP_DATA
struct  DecRefPicMarking_s
 Buffer structure for decoded reference picture marking commands. More...
struct  me_block
struct  syntaxelement
 Syntax Element. More...
struct  macroblock
 Macroblock. More...
struct  Bitstream
 Bitstream. More...
struct  datapartition
 DataPartition. More...
struct  rd_data
struct  slice
 Slice. More...
struct  distortion_metric
 DistortionParams. More...
struct  distortion_params
struct  picture
struct  block_8x8_info
 block 8x8 temporary RD info More...
struct  img_par
 ImageParameters. More...
struct  pic_motion_params2
 definition of pic motion parameters More...
struct  RD_8x8DATA
struct  RD_PARAMS
struct  encoder_params
struct  SubImageContainer

Typedefs

typedef struct inp_par_enc InputParameters
typedef struct image_structure ImageStructure
typedef struct info_8x8 Info8x8
typedef struct search_window SearchWindow
typedef struct bit_counter BitCounter
typedef EncodingEnvironmentEncodingEnvironmentPtr
typedef BiContextTypeBiContextTypePtr
typedef struct pix_pos PixelPos
typedef struct pic_motion_params PicMotionParams
typedef struct DecRefPicMarking_s DecRefPicMarking_t
typedef struct me_block MEBlock
typedef struct syntaxelement SyntaxElement
typedef struct macroblock Macroblock
typedef struct datapartition DataPartition
typedef struct rd_data RD_DATA
typedef struct slice Slice
typedef struct distortion_metric DistMetric
typedef struct distortion_params DistortionParams
typedef struct picture Picture
typedef struct block_8x8_info Block8x8Info
typedef struct img_par ImageParameters
typedef struct pic_motion_params2 PicMotionParams2
typedef struct quant_params QuantParameters
typedef struct quant_methods QuantMethods
typedef struct scaling_list ScaleParameters
typedef struct rdo_structure RDOPTStructure
typedef struct encoder_params EncoderParams

Functions

void intrapred_16x16 (Macroblock *currMB, ColorPlane pl)
void copyblock_sp (Macroblock *currMB, ColorPlane pl, int pos_mb1, int pos_mb2)
int dct_chroma_sp (Macroblock *currMB, int uv, int i11)
int dct_chroma_sp2 (Macroblock *currMB, int uv, int i11)
int GetDirectCostMB (Macroblock *currMB)
int GetDirectCost8x8 (Macroblock *currMB, int, int *)
int picture_coding_decision (ImageParameters *p_Img, InputParameters *p_Inp, Picture *picture1, Picture *picture2, int qp)
void no_mem_exit (char *where)
int get_mem_ACcoeff_new (int ******cofAC, int chroma)
int get_mem_ACcoeff (ImageParameters *p_Img, int *****)
int get_mem_DCcoeff (int ****)
void free_mem_ACcoeff (int ****)
void free_mem_ACcoeff_new (int *****cofAC)
void free_mem_DCcoeff (int ***)
void error (char *text, int code)
void set_mbaff_parameters (Macroblock *currMB)
int CalculateFrameNumber (ImageParameters *p_Img, InputParameters *p_Inp)
int is_bipred_enabled (InputParameters *p_Inp, int mode)
void update_qp (Macroblock *currMB)
void select_plane (ImageParameters *p_Img, ColorPlane color_plane)
void select_dct (Macroblock *currMB)
void set_slice_type (ImageParameters *p_Img, InputParameters *p_Inp, int slice_type)
void free_encoder_memory (ImageParameters *p_Img, InputParameters *p_Inp)
void output_SP_coefficients (ImageParameters *p_Img, InputParameters *p_Inp)
void read_SP_coefficients (ImageParameters *p_Img, InputParameters *p_Inp)
void Init_redundant_frame (ImageParameters *p_Img, InputParameters *p_Inp)
void Set_redundant_frame (ImageParameters *p_Img, InputParameters *p_Inp)
void encode_one_redundant_frame (ImageParameters *p_Img, InputParameters *p_Inp)
void change_plane_JV (ImageParameters *p_Img, int nplane)
void make_frame_picture_JV (ImageParameters *p_Img, InputParameters *p_Inp)

Variables

EncoderParams * p_Enc
short ** PicPos
char errortext [ET_SIZE]


Detailed Description

global definitions for H.264 encoder.

global.h

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

Definition in file global.h.


Typedef Documentation

typedef struct bit_counter BitCounter

bit counter for a macroblock. Note that it seems safe to change all to unsigned short for 16x16 MBs. May be an issue if MB > 32x32

typedef struct block_8x8_info Block8x8Info

block 8x8 temporary RD info

typedef struct datapartition DataPartition

DataPartition.

Buffer structure for decoded reference picture marking commands.

typedef struct distortion_metric DistMetric

DistortionParams.

typedef struct img_par ImageParameters

ImageParameters.

typedef struct info_8x8 Info8x8

block 8x8 temporary RD info

definition of pic motion parameters

definition of pic motion parameters

typedef struct pix_pos PixelPos

Pixel position for checking neighbors.

typedef struct rd_data RD_DATA

For MB level field/frame coding tools temporary structure to store MB data for field/frame coding

typedef struct slice Slice

Slice.

typedef struct syntaxelement SyntaxElement

Syntax Element.


Function Documentation

int CalculateFrameNumber ( ImageParameters p_Img,
InputParameters p_Inp 
)

Calculates the absolute frame number in the source file out of various variables in p_Img-> and p_Inp->.

Returns:
frame number in the file to be read
side effects
global variable frame_no updated -- dunno, for what this one is necessary

Definition at line 1911 of file image.c.

References GOP_DATA::display_no, inp_par_enc::EnableIDRGOP, img_par::frame_interval, inp_par_enc::frame_skip, img_par::gop_number, inp_par_enc::idr_period, inp_par_enc::intra_delay, inp_par_enc::no_frames, img_par::number, inp_par_enc::NumberBFrames, img_par::rewind_frame, img_par::start_frame_no, and img_par::start_tr_gop.

Referenced by prepare_first_layer(), and prepare_second_layer().

void change_plane_JV ( ImageParameters p_Img,
int  nplane 
)

Change color plane for 4:4:4 Independent Mode.

Input:
plane number

Definition at line 4868 of file macroblock.c.

References img_par::colour_plane_id, img_par::enc_frame_picture_JV, img_par::imgData, img_par::mb_data, img_par::mb_data_JV, and img_par::pCurImg.

Referenced by encode_one_slice(), and encode_one_slice_MBAFF().

void copyblock_sp ( Macroblock currMB,
ColorPlane  pl,
int  block_x,
int  block_y 
)

The routine performs transform,quantization,inverse transform, adds the diff. to the prediction and writes the result to the decoded luma frame. Includes the RD constrained quantization also.

Input:
block_x,block_y: Block position inside a macro block (0,4,8,12).
Output:
nonzero: 0 if no levels are nonzero. 1 if there are nonzero levels.
coeff_cost: Counter for nonzero coefficients, used to discard expensive levels.

Definition at line 2205 of file block.c.

References img_par::max_imgpel_value, slice::mb_ores, slice::mb_pred, slice::mb_rres, storable_picture::p_curr_img, macroblock::p_slice, macroblock::pix_x, macroblock::pix_y, and slice::tblk16x16.

Referenced by luma_residual_coding(), luma_residual_coding_16x16(), luma_residual_coding_8x8(), luma_residual_coding_p444(), luma_residual_coding_p444_16x16(), and luma_residual_coding_p444_8x8().

int dct_chroma_sp ( Macroblock currMB,
int  uv,
int  cr_cbp 
)

Transform,quantization,inverse transform for chroma. The main reason why this is done in a separate routine is the additional 2x2 transform of DC-coeffs. This routine is called once for each of the chroma components.

Input:
uv : Make difference between the U and V chroma component cr_cbp: chroma coded block pattern
Output:
cr_cbp: Updated chroma coded block pattern.

Definition at line 1691 of file block.c.

References _CHROMA_COEFF_COST_, img_par::AdaptiveRounding, macroblock::ar_mode, img_par::ARCofAdj4x4, macroblock::cbp_blk, COEFF_COST4x4, slice::cofAC, slice::cofDC, copy_image_data(), FIELD_SCAN, hor_offset, storable_picture::imgUV, img_par::max_pel_value_comp, slice::mb_ores, slice::mb_pred, slice::mb_rres, macroblock::mb_type, macroblock::p_slice, macroblock::pix_c_x, macroblock::pix_c_y, macroblock::qpc, SCAN_YUV422, SNGL_SCAN, slice::tblk4x4, YUV420, and YUV422.

Referenced by chroma_residual_coding().

Here is the call graph for this function:

int dct_chroma_sp2 ( Macroblock currMB,
int  uv,
int  cr_cbp 
)

Eric Setton Encoding of the chroma of a secondary SP / SI frame. For an SI frame the predicted block should only come from spatial pred. The original image signal is the error coefficients of a primary SP in the raw data stream the difference with the primary SP are :

  • the prediction signal is transformed and quantized (qpsp) but not dequantized
  • the resulting error coefficients are not quantized before being sent to the VLC.

Input:
uv : Make difference between the U and V chroma component cr_cbp: chroma coded block pattern
Output:
cr_cbp: Updated chroma coded block pattern.

Definition at line 2404 of file block.c.

References macroblock::cbp_blk, COEFF_COST4x4, slice::cofAC, slice::cofDC, FIELD_SCAN, storable_picture::imgUV, img_par::max_imgpel_value, MAX_VALUE, slice::mb_pred, slice::mb_rres, macroblock::p_slice, macroblock::pix_c_x, macroblock::pix_c_y, macroblock::qpc, SNGL_SCAN, and slice::tblk16x16.

Referenced by chroma_residual_coding().

void encode_one_redundant_frame ( ImageParameters p_Img,
InputParameters p_Inp 
)

encode one redundant frame.

Definition at line 1859 of file lencod.c.

References img_par::currentPicture, encode_one_frame(), and set_slice_type().

Referenced by encode_sequence().

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 37 of file filehandle.c.

References flush_dpb().

Referenced by adaptive_memory_management(), arienco_delete_encoding_environment(), bslice_16x16_termination_control(), buf2img_basic(), buf2img_bitshift(), buf2img_endian(), check_num_ref(), Configure(), dec_ref_pic_marking(), encode_one_frame(), encode_one_slice(), encode_one_slice_MBAFF(), end_macroblock(), 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(), GenerateSequenceParameterSet(), get_picture_type(), get_smallest_poc(), getDpbSize(), getMaxBR(), getMaxCPB(), getMaxFs(), getMaxMBPS(), getMinCR(), img2buf(), init_dpb(), Init_redundant_frame(), init_slice(), interpret_gop_structure(), LevelCheck(), mm_assign_long_term_frame_idx(), no_mem_exit(), OpenFiles(), output_one_frame_from_dpb(), output_SP_coefficients(), ParseContent(), ParseMatrix(), ParseQOffsetMatrix(), PatchInp(), predict_nnz(), ProfileCheck(), read_slice_group_info(), ReadCharField(), ReadFrameConcatenated(), ReadFrameData(), ReadFrameSeparate(), ReadIntField(), ReadTextField(), ReadTIFFIFDEntry(), remove_frame_from_dpb(), reorder_ref_pic_list(), report_frame_statistic(), report_log_mode(), report_stats(), RestoreMVBlock8x8(), start_sequence(), store_picture_in_dpb(), StoreMVBlock8x8(), terminate_sequence(), TestEncoderParams(), updateMADModel(), updateRCModel(), write_out_picture(), writeCoeff4x4_CAVLC_444(), and writeCoeff4x4_CAVLC_normal().

Here is the call graph for this function:

void free_encoder_memory ( ImageParameters p_Img,
InputParameters p_Inp 
)

void free_mem_ACcoeff ( int ****   ) 

Free memory of AC coefficients.

Definition at line 1641 of file lencod.c.

References free_mem4Dint().

Referenced by clear_rdopt(), and free_slice().

Here is the call graph for this function:

void free_mem_ACcoeff_new ( int *****  cofAC  ) 

Free memory of AC coefficients.

Definition at line 1652 of file lencod.c.

References free_mem5Dint().

Referenced by clear_rdopt().

Here is the call graph for this function:

void free_mem_DCcoeff ( int ***   ) 

Free memory of DC coefficients.

Definition at line 1663 of file lencod.c.

References free_mem3Dint().

Referenced by clear_rdopt(), and free_slice().

Here is the call graph for this function:

int get_mem_ACcoeff ( ImageParameters p_Img,
int *****   
)

Allocate memory for AC coefficients.

Definition at line 1601 of file lencod.c.

References get_mem4Dint().

Referenced by init_rdopt(), and init_slice().

Here is the call graph for this function:

int get_mem_ACcoeff_new ( int ******  cofAC,
int  chroma 
)

Allocate memory for AC coefficients.

Definition at line 1616 of file lencod.c.

References get_mem5Dint().

Referenced by init_rdopt().

Here is the call graph for this function:

int get_mem_DCcoeff ( int ****   ) 

Allocate memory for DC coefficients.

Definition at line 1628 of file lencod.c.

References get_mem3Dint().

Referenced by init_rdopt(), and init_slice().

Here is the call graph for this function:

int GetDirectCost8x8 ( Macroblock currMB,
int  ,
int *   
)

Get cost for direct mode for an 8x8 block.

Definition at line 1389 of file mv_search.c.

References slice::direct_pdir, slice::direct_ref_idx, luma_prediction(), slice::mb_pred, macroblock::opix_y, macroblock::p_Img, macroblock::p_slice, img_par::pCurImg, and macroblock::pix_x.

Referenced by GetDirectCostMB(), and submacroblock_mode_decision_low().

Here is the call graph for this function:

int GetDirectCostMB ( Macroblock currMB  ) 

Get cost for direct mode for an macroblock.

Definition at line 1458 of file mv_search.c.

References GetDirectCost8x8(), macroblock::p_slice, and slice::slice_type.

Referenced by encode_one_macroblock_low().

Here is the call graph for this function:

void Init_redundant_frame ( ImageParameters p_Img,
InputParameters p_Inp 
)

initialize key frames and corresponding redundant frames.

Definition at line 1746 of file lencod.c.

References error(), inp_par_enc::num_ref_frames, inp_par_enc::NumberBFrames, inp_par_enc::NumRedundantHierarchy, inp_par_enc::PicInterlace, and inp_par_enc::PrimaryGOPLength.

Referenced by encode_sequence().

Here is the call graph for this function:

void intrapred_16x16 ( Macroblock currMB,
ColorPlane  pl 
)

16x16 based luma prediction

Input:
Image parameters
Output:
none

< pixel position p(0,-1)

< pixel positions p(-1, -1..15)

Definition at line 205 of file block.c.

References img_par::dc_pred_value, img_par::max_imgpel_value, slice::mpr_16x16, storable_picture::p_curr_img, macroblock::p_slice, and inp_par_enc::UseConstrainedIntraPred.

Referenced by encode_one_macroblock_low(), Intra16x16_Mode_Decision444(), Intra16x16_Mode_Decision_RDopt(), and Intra16x16_Mode_Decision_SAD().

int is_bipred_enabled ( InputParameters p_Inp,
int  mode 
)

void make_frame_picture_JV ( ImageParameters p_Img,
InputParameters p_Inp 
)

Make one frame picture from 4:4:4 plane.

Definition at line 4881 of file macroblock.c.

References copy_storable_param_JV(), img_par::enc_frame_picture_JV, free_storable_picture(), img_par::height, storable_picture::imgUV, storable_picture::imgY, and img_par::width.

Referenced by frame_picture().

Here is the call graph for this function:

void no_mem_exit ( char *  where  ) 

Exit program if memory allocation failed (using error()).

Parameters:
where string indicating which memory allocation failed

Definition at line 1243 of file memalloc.c.

Referenced by alloc_colocated(), alloc_encoder(), alloc_frame_store(), alloc_img(), alloc_params(), alloc_ref_pic_list_reordering_buffer(), alloc_storable_picture(), allocate_QMatrix(), AllocateFrameMemory(), allocEPZScolocated(), allocEPZSpattern(), AllocNALU(), AllocPPS(), AllocSPS(), arienco_create_encoding_environment(), Configure(), create_coding_state(), create_contexts_MotionInfo(), create_contexts_TextureInfo(), create_hierarchy(), FinalizeSpareMBMap(), GeneratePic_parameter_set_rbsp(), GeneratePictureParameterSet(), GenerateSEImessage_rbsp(), GenerateSeq_parameter_set_rbsp(), get_mem1Dpel(), get_mem2D(), get_mem2Ddist(), get_mem2Ddouble(), get_mem2Dint(), get_mem2Dint64(), get_mem2Dlm(), get_mem2Dmp(), get_mem2Dmv(), get_mem2Dodouble(), get_mem2Doint(), get_mem2Dolm(), get_mem2Dpel(), get_mem2Dquant(), get_mem2Dshort(), get_mem2Duint16(), get_mem3D(), get_mem3Ddouble(), get_mem3Dint(), get_mem3Dint64(), get_mem3Dmp(), get_mem3Dmv(), get_mem3Dodouble(), get_mem3Doint(), get_mem3Dpel(), get_mem3Dquant(), get_mem3Dshort(), get_mem3Duint16(), get_mem4D(), get_mem4Dint(), get_mem4Dmv(), get_mem4Dpel(), get_mem4Dquant(), get_mem4Dshort(), get_mem4Duint16(), get_mem5Dint(), get_mem5Dmv(), get_mem5Dpel(), get_mem5Dquant(), get_mem5Dshort(), get_mem6Dshort(), get_mem7Dshort(), get_offset_mem2Dshort(), GetConfigFileContent(), init_dpb(), init_global_buffers(), init_gop_structure(), init_img(), init_lists(), Init_Motion_Search_Module(), init_mv_block(), init_rdopt(), init_slice(), init_top_bot_planes(), InitializeFastFullIntegerSearch(), InitSparePicture(), InitSubseqInfo(), malloc_picture(), malloc_slice(), poc_based_ref_management_field_pic(), poc_based_ref_management_frame_pic(), RandomIntraInit(), rc_alloc_generic(), rc_alloc_quadratic(), read_slice_group_info(), smpUMHEX_get_mem(), UMHEX_get_mem(), UnifiedOneForthPix(), UnifiedOneForthPix_JV(), wpxInitWPXObject(), write_out_picture(), and WriteRTPNALU().

void output_SP_coefficients ( ImageParameters p_Img,
InputParameters p_Inp 
)

Brief Output SP frames coefficients

Definition at line 2025 of file image.c.

References error(), img_par::height, img_par::height_cr, inp_par_enc::sp_output_filename, img_par::width, and img_par::width_cr.

Referenced by encode_one_frame().

Here is the call graph for this function:

int picture_coding_decision ( ImageParameters p_Img,
InputParameters p_Inp,
Picture *  picture1,
Picture *  picture2,
int  qp 
)

Picture Coding Decision.

Definition at line 44 of file rdpicdecision.c.

References inp_par_enc::NumberBFrames, and rd_pic_decision().

Referenced by rd_picture_coding().

Here is the call graph for this function:

void read_SP_coefficients ( ImageParameters p_Img,
InputParameters p_Inp 
)

void select_plane ( ImageParameters p_Img,
ColorPlane  color_plane 
)

void set_mbaff_parameters ( Macroblock currMB  ) 

void Set_redundant_frame ( ImageParameters p_Img,
InputParameters p_Inp 
)

allocate redundant frames in a primary GOP.

Definition at line 1792 of file lencod.c.

References inp_par_enc::NumRedundantHierarchy, and inp_par_enc::PrimaryGOPLength.

Referenced by encode_sequence().

void set_slice_type ( ImageParameters p_Img,
InputParameters p_Inp,
int  slice_type 
)

void update_qp ( Macroblock currMB  ) 

updates chroma QP according to luma QP and bit depth

Definition at line 271 of file macroblock.c.

References macroblock::p_Img, macroblock::qp, and macroblock::qp_scaled.

Referenced by copy_rdopt_data(), start_macroblock(), and update_qp_cbp().


Variable Documentation

char errortext[ET_SIZE]


Documentation generated with DoxyGen