www.pudn.com > wm2.5.zip > types.h
/*
***********************************************************************
* COPYRIGHT AND WARRANTY INFORMATION
*
* Copyright 2004, Advanced Audio Video Coding Standard, Part II
*
* DISCLAIMER OF WARRANTY
*
* These software programs are available to the users without any
* license fee or royalty on an "as is" basis. The AVS 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 contributors or
* the AVS be liable for any incidental, punitive, or consequential
* damages of any kind whatsoever arising from the use of this program.
*
* This disclaimer of warranty extends to the user of this program
* and user's customers, employees, agents, transferees, successors,
* and assigns.
*
* The AVS does not represent or warrant that the program furnished
* hereunder are free of infringement of any third-party patents.
* Commercial implementations of AVS, including shareware, may be
* subject to royalty fees to patent holders. Information regarding
* the AVS patent policy is available from the AVS Web site at
* http://www.avs.org.cn
*
* THIS IS NOT A GRANT OF PATENT RIGHTS - SEE THE AVS PATENT POLICY.
************************************************************************
*/
#include "define.h"
#include "stdio.h"
#ifndef _TYPE_H_
#define _TYPE_H_
//////////////////////////////data type defines////////////////////////////////////////////
typedef unsigned char Byte;
typedef unsigned UInt;
///////////////////////////////struct defines/////////////////////////////
typedef struct{
short mv_num ; //motion vector number for the macrobock, from Inter prediction
short mvd[4][4][2] ; // [blk_x][blk_y][x/y] motion vector difference for every 4x4 block from Inter prediction //qwang 2004-3-21
short refIndex[4] ; // zhangnan
short mb_type ; // from Inter prediction, no mbtype for Intra MB
short abt_block_size_flag; // qhg for abt : 0: 4x4 1:8x8
short subblk_type[4] ; //[blk] qwang 2004-3-22
short dquant ; //delta quantization parameter from high level coding
short sema ; //sync signal, from high level coding
short cbp ; //from Inter/Intra prediction
short cbp_4x4[6] ; // dongjie
//Intra pred
short chroma_ipred_mode ; //chroma Intra prediction mode from Intra prediction
short luma_ipred_mode[4][4] ; //qwang 2004-3-6
short luma_pred_mode_flag[4][4] ; //qwang 2004-3-6
short pred_residual[6][4][4][4] ; //qwang 2004-3-6
//int all_zero_ref;//WJP FOR ZERO_REF
unsigned int cbp_blk ;
int lf_alpha_c0_offset ;
int lf_beta_offset ;
int I_MODE; //WJP FOR I_DIRECT
}MacroblockHeader;
typedef struct{
Byte org_luma[16][16] ; // org_luma[y][x];
Byte org_chroma[2][8][8]; // org_chroma[uv][y][x];
int mb_x ;
int mb_y ;
int lambda;
int best_mode;
int best_mode_subblk[4]; //qwang 2004-3-21
int best_mode_subblk_ref[2][4]; //qwang 2004-3-21
short qp_mb;
//Intra
Byte pred_sample_c[6][8][8]; //zhangnan
Byte pred_sample[6][4][4][4]; //qwang 2004-3-6
Byte pred_curr[2][8][8]; // pred_curr[x][y] for transform column by column
short recon_residual[6][4][4][4]; //qwang 2004-3-7
//Inter
short up_row_mv [IMG_WIDTH/4][2]; //qwang 2004-3-20
short left_mv[4][2]; //qwang 2004-3-20
short up_row_ref[IMG_WIDTH/16];
short left_ref;
short mvb[4][4][2] ; //qwang 2004-3-20
short pred_mv[4][4][2] ; //qwang 2004-3-20
short mvb_ref[4][4][2] ; //zhangnan 2004-3-20
short pred_mv_ref[4][4][2] ; //zhangnan 2004-3-20
short mvb_ref_mb[4][4][2] ; //zhangnan 2004-3-20
short pred_mv_ref_mb[4][4][2] ; //zhangnan 2004-3-20
short mvb_tmp[4][4][2] ; //zhangnan 2004-3-20
short pred_mv_tmp[4][4][2] ; //zhangnan 2004-3-20
short ref_idx ; //reference index from Inter prediction
short is_Intra ; //Intra_MB or Inter_MB
//FME:Fast-Motion Estimation
Byte Integer_pixel_buffer[2][80][80]; //48 48
Byte Sub_pixel_buffer [2][70 ][70 ]; //24 24
int Diamond_status [65][65 ]; //33 33
int Spiral_index [6400][2];
int BigHexagon_index[16][2];
int Hexagon_index [ 6][2];
int Diamond_index [ 4][2];
double lamda_mode;
double lamda_motion;
double skip_cost;
int slice_nr;//WJP FOR SLICE
}MacroblockData;
typedef struct{
int img_height ; // input parameter
int img_width ; // input parameter
short fixed_picture_qp ; // input parameter
short time_code_flag ; // input parameter
short picture_distance ; // input parameter
short picture_code_type ;
short qp0 ; // input parameter , I picture QP
short qpN ; // input parameter, PB picture QP
short skipnum ; // input parameter, skip num zhangnan 2004-04
short refnum ; // input parameter, reference num zhangnan 2004-04
short p_pic_type ; //zhangnan
short picture_reference_flag; //zhangnan 2004-04-16
int pic_num ; //zhangnan 2004-04-16
short total_mb_number ;
int cod_counter ;
int img_size ;
int img_Y_size ;
int img_UV_size ;
int nb_references ; //zhangnan 2004-04-16
int block_y ;
int block_x ;
int mb_y ;
int mb_x ;
int mb_data ;
int pix_y ;
int pix_x ;
int pix_c_x ;
int pix_c_y ;
int block_c_x ;
int block_c_y ;
int***** all_mv; //!< replaces local all_mv
int current_mb_nr ;
int current_slice_nr ;//WJP FOR SLICE
int disable_loop_filter_slice_flag;//WJP FOR SLICE_DEBLOCK 050321
MacroblockHeader * mb_headerdata;
MacroblockData * mb_data_forlf;
int number; //LX 0409
int framerate;
int type;
int qp;
int NumberofHeaderBits; //LX 0409
int NumberofTextureBits; //LX 0409
int NumberofMBTextureBits; //LX 0409
int NumberofMBHeaderBits; //LX 0409
int NumberofCodedBFrame;
int NumberofCodedPFrame;
int NumberofGOP;
int TotalQpforPPicture;
int NumberofPPicture;
int FieldControl;
int FieldFrame;
int Frame_Total_Number_MB;
int IFLAG;
int NumberofCodedMacroBlocks;
int write_macroblock;
int bot_MB;
int write_macroblock_frame;
int DeblockCall;
int last_pic_bottom_field;
int last_has_mmco_5;
int pre_frame_num; //LX 0409
int half_pixel_mv_enable_flag;
int half_pixel_mv_flag;
//cbzhu 041221
int frame_num;
// int picture_distance;
int picture_distance_gap_minus1;
int alpha_ci_offset;
int cp_offset;
int loopfilter_qp_offset;
}Image;
//////////////////////////////////Sequence Header Info////////////////////////////////////////
//! Bitstream
typedef struct
{
int byte_pos; //!< current position in bitstream;
int bits_to_go; //!< current bitcounter
Byte byte_buf; //!< current buffer for last written byte
Byte *streamBuffer; //!< actual buffer for written bytes
FILE *f;
} Bitstream;
typedef struct
{
int no_frames; //!< number of frames to be encoded
int qp0; //!< QP of first frame
int qpN; //!< QP of remaining frames
int num_reference_frames; //!< number of reference frames to be used
int img_width; //!< image width (must be a multiple of 16 pels)
int img_height; //!< image height (must be a multiple of 16 pels)
char infile[100]; //!< YUV 4:2:0 input format
char outfile[100]; //!< H.26L compressed output bitstream
char ReconFile[100]; //!< Reconstructed Pictures
int intra_period; //!< Random Access period though intra
int jumpd; //!< number of frames to skip in input sequence (e.g 2 takes frame 0,3,6,9...)
int rdopt;
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
generally around the predicted vector. Max vector is 2xmcrange. For 8x8
and 4x4 block sizes the search range is 1/2 of that for 16x16 blocks. */
int spframe;
int slice; //WJP FOR SLICE
int slice_parameter; //WJP FOR SLICE
int ABT; //0: ABT disable, 1: ABT able.
int ABT_RDO; //if use RDO when decides the size of the transform (0:no, 1:yes)
int PictureRate; //Frame Rate. LX 0409
int RCEnable; //0: RateCtl disable, 1: RateCtl able. LX 0409
int bit_rate; //Bit Rate. LX 0409
int SeinitialQP; //Sequence Initial QP. LX 0409
int channel_type; //0: CBR , 1: VBR. LX 0409
int HalfPixelMVEnable; //if half pixel mv is enabled (0:off, 1:on)
//cbzhu 041219
unsigned profile_idc;
unsigned level_idc;
//cbzhu 12-15
#ifdef _ISOLATED_REGION_
int IREGEnable;
int IREGRate; //evolution rate(mbs/pic)
int LfMode; //0 : disable totally 1: enable loopfilter only disable along diff region boundaries
#endif // _ISOLATED_REGION_
} InputParameters;
typedef struct {
char *TokenName;
void *Place;
int Type;
} Mapping;
//cbzhu 041219 ---- start
typedef struct{
unsigned picture_coding_type;
int picture_distance;
int pic_parameter_set_id;
int picture_distance_gap_minus1;
int frame_num;
int picture_qp;
int alpha_ci_offset;
int cp_offset;
int loopfilter_qp_offset;
int sliding_window_size_minus1;
}pic_header;
typedef struct{
unsigned profile_idc;
unsigned level_idc;
unsigned seq_parameter_set_id;
int num_ref_frames;
int horizontal_size_minus1;
int vertical_size_minus1;
int aspect_ratio;
int frame_cropping_flag;
unsigned frame_cropping_left_offset;
unsigned frame_crop_right_offset;
unsigned frame_crop_top_offset;
unsigned frame_crop_bottom_offset;
int delta_time_picture_distance_1;
int hrd_parameters_present_flag;
}seq_parameter_set;
typedef struct{
unsigned pic_parameter_set_id;
unsigned seq_parameter_set_id;
int fixed_picture_qp_flag;
int picture_reference_flag;
int sliding_window_size_flag;
int skip_mode_flag;
int loop_filter_disable_flag;
int loop_filter_parameter_flag;
int constrained_intra_pred_flag;
int half_pixel_mv_flag;
}pic_parameter_set;
// -----end
InputParameters input;
extern Mapping Map[];
#endif //_TYPE_H_