00001
00022 #ifndef _MBUFFER_H_
00023 #define _MBUFFER_H_
00024
00025 #include "global.h"
00026
00027 #define MAX_LIST_SIZE 33
00029 typedef struct pic_motion_params
00030 {
00031 int64 *** ref_pic_id;
00032 int64 *** ref_id;
00033 short **** mv;
00034 char *** ref_idx;
00035 byte * mb_field;
00036 byte ** field_frame;
00037 } PicMotionParams;
00038
00040 typedef struct storable_picture
00041 {
00042 PictureStructure structure;
00043
00044 int poc;
00045 int top_poc;
00046 int bottom_poc;
00047 int frame_poc;
00048 int64 ref_pic_num [MAX_NUM_SLICES][6][MAX_LIST_SIZE];
00049 int64 frm_ref_pic_num [MAX_NUM_SLICES][6][MAX_LIST_SIZE];
00050 int64 top_ref_pic_num [MAX_NUM_SLICES][6][MAX_LIST_SIZE];
00051 int64 bottom_ref_pic_num [MAX_NUM_SLICES][6][MAX_LIST_SIZE];
00052 unsigned frame_num;
00053 unsigned recovery_frame;
00054
00055 int pic_num;
00056 int long_term_pic_num;
00057 int long_term_frame_idx;
00058
00059 byte is_long_term;
00060 int used_for_reference;
00061 int is_output;
00062 int non_existing;
00063
00064 short max_slice_id;
00065
00066 int size_x, size_y, size_x_cr, size_y_cr;
00067 int size_x_m1, size_y_m1, size_x_cr_m1, size_y_cr_m1;
00068 int chroma_vector_adjustment;
00069 int coded_frame;
00070 int MbaffFrameFlag;
00071 unsigned PicWidthInMbs;
00072 unsigned PicSizeInMbs;
00073
00074 imgpel ** imgY;
00075 imgpel *** imgUV;
00076
00077 struct pic_motion_params motion;
00078 struct pic_motion_params JVmotion[MAX_PLANE];
00079
00080 short ** slice_id;
00081
00082 struct storable_picture *top_field;
00083 struct storable_picture *bottom_field;
00084 struct storable_picture *frame;
00085
00086 int slice_type;
00087 int idr_flag;
00088 int no_output_of_prior_pics_flag;
00089 int long_term_reference_flag;
00090 int adaptive_ref_pic_buffering_flag;
00091
00092 int chroma_format_idc;
00093 int frame_mbs_only_flag;
00094 int frame_cropping_flag;
00095 int frame_cropping_rect_left_offset;
00096 int frame_cropping_rect_right_offset;
00097 int frame_cropping_rect_top_offset;
00098 int frame_cropping_rect_bottom_offset;
00099 int qp;
00100 int chroma_qp_offset[2];
00101 int slice_qp_delta;
00102 DecRefPicMarking_t *dec_ref_pic_marking_buffer;
00103
00104
00105 int concealed_pic;
00106
00107
00108 int seiHasTone_mapping;
00109 int tone_mapping_model_id;
00110 int tonemapped_bit_depth;
00111 imgpel* tone_mapping_lut;
00112 } StorablePicture;
00113
00115 typedef struct colocated_params
00116 {
00117 int mb_adaptive_frame_field_flag;
00118 int size_x, size_y;
00119 byte is_long_term;
00120
00121 MotionParams frame;
00122 MotionParams top;
00123 MotionParams bottom;
00124
00125 } ColocatedParams;
00126
00128 typedef struct frame_store
00129 {
00130 int is_used;
00131 int is_reference;
00132 int is_long_term;
00133 int is_orig_reference;
00134
00135 int is_non_existent;
00136
00137 unsigned frame_num;
00138 unsigned recovery_frame;
00139
00140 int frame_num_wrap;
00141 int long_term_frame_idx;
00142 int is_output;
00143 int poc;
00144
00145
00146 int concealment_reference;
00147
00148 StorablePicture *frame;
00149 StorablePicture *top_field;
00150 StorablePicture *bottom_field;
00151
00152 } FrameStore;
00153
00154
00156 typedef struct decoded_picture_buffer
00157 {
00158 ImageParameters *p_Img;
00159 InputParameters *p_Inp;
00160 FrameStore **fs;
00161 FrameStore **fs_ref;
00162 FrameStore **fs_ltref;
00163 unsigned size;
00164 unsigned used_size;
00165 unsigned ref_frames_in_buffer;
00166 unsigned ltref_frames_in_buffer;
00167 int last_output_poc;
00168 int max_long_term_pic_idx;
00169
00170 int init_done;
00171 int num_ref_frames;
00172
00173 FrameStore *last_picture;
00174 } DecodedPictureBuffer;
00175
00176 extern void init_dpb(ImageParameters *p_Img);
00177 extern void free_dpb(ImageParameters *p_Img);
00178 extern FrameStore* alloc_frame_store(void);
00179 extern void free_frame_store(ImageParameters *p_Img, FrameStore* f);
00180 extern StorablePicture* alloc_storable_picture(ImageParameters *p_Img, PictureStructure type, int size_x, int size_y, int size_x_cr, int size_y_cr);
00181 extern void free_storable_picture (ImageParameters *p_Img, StorablePicture* p);
00182 extern void store_picture_in_dpb(ImageParameters *p_Img, StorablePicture* p);
00183 extern void flush_dpb(ImageParameters *p_Img);
00184
00185 extern void dpb_split_field (ImageParameters *p_Img, FrameStore *fs);
00186 extern void dpb_combine_field(ImageParameters *p_Img, FrameStore *fs);
00187 extern void dpb_combine_field_yuv(ImageParameters *p_Img, FrameStore *fs);
00188
00189 extern void init_lists (Slice *currSlice);
00190 extern void reorder_ref_pic_list(ImageParameters *p_Img, StorablePicture **list, char *list_size,
00191 int num_ref_idx_lX_active_minus1, int *reordering_of_pic_nums_idc,
00192 int *abs_diff_pic_num_minus1, int *long_term_pic_idx);
00193
00194 extern void init_mbaff_lists(ImageParameters *p_Img);
00195 extern void alloc_ref_pic_list_reordering_buffer(Slice *currSlice);
00196 extern void free_ref_pic_list_reordering_buffer(Slice *currSlice);
00197
00198 extern void fill_frame_num_gap(ImageParameters *p_Img);
00199
00200 extern ColocatedParams* alloc_colocated(int size_x, int size_y,int mb_adaptive_frame_field_flag);
00201 extern void free_colocated(ColocatedParams* p);
00202 extern void compute_colocated (Slice *currSlice, ColocatedParams* p, StorablePicture **listX[6]);
00203
00204
00205 extern void compute_colocated_JV ( Slice *currSlice, ColocatedParams* p, StorablePicture **listX[6]);
00206 extern void copy_storable_param_JV( ImageParameters *p_Img, PicMotionParams *JVplane, PicMotionParams *motion );
00207
00208 #endif
00209