comparison mpegvideo.h @ 1708:dea5b2946999 libavcodec

interlaced motion estimation interlaced mpeg2 encoding P & B frames rate distored interlaced mb decission alternate scantable support 4mv encoding fixes (thats also why the regression tests change) passing height to most dsp functions interlaced mpeg4 encoding (no direct mode MBs yet) various related cleanups disabled old motion estimaton algorithms (log, full, ...) they will either be fixed or removed
author michael
date Tue, 30 Dec 2003 16:07:57 +0000
parents 3ba5c493db6f
children 4e72fb256b25
comparison
equal deleted inserted replaced
1707:027545a2fdbe 1708:dea5b2946999
135 */ 135 */
136 uint8_t *interpolated[3]; 136 uint8_t *interpolated[3];
137 int16_t (*motion_val_base[2])[2]; 137 int16_t (*motion_val_base[2])[2];
138 int8_t *ref_index[2]; 138 int8_t *ref_index[2];
139 uint32_t *mb_type_base; 139 uint32_t *mb_type_base;
140 #define MB_TYPE_INTRA MB_TYPE_INTRA4x4 //default mb_type if theres just one type
140 #define IS_INTRA4x4(a) ((a)&MB_TYPE_INTRA4x4) 141 #define IS_INTRA4x4(a) ((a)&MB_TYPE_INTRA4x4)
141 #define IS_INTRA16x16(a) ((a)&MB_TYPE_INTRA16x16) 142 #define IS_INTRA16x16(a) ((a)&MB_TYPE_INTRA16x16)
142 #define IS_PCM(a) ((a)&MB_TYPE_INTRA_PCM) 143 #define IS_PCM(a) ((a)&MB_TYPE_INTRA_PCM)
143 #define IS_INTRA(a) ((a)&7) 144 #define IS_INTRA(a) ((a)&7)
144 #define IS_INTER(a) ((a)&(MB_TYPE_16x16|MB_TYPE_16x8|MB_TYPE_8x16|MB_TYPE_8x8)) 145 #define IS_INTER(a) ((a)&(MB_TYPE_16x16|MB_TYPE_16x8|MB_TYPE_8x16|MB_TYPE_8x8))
204 int penalty_factor; 205 int penalty_factor;
205 int sub_penalty_factor; 206 int sub_penalty_factor;
206 int mb_penalty_factor; 207 int mb_penalty_factor;
207 int pre_pass; ///< = 1 for the pre pass 208 int pre_pass; ///< = 1 for the pre pass
208 int dia_size; 209 int dia_size;
210 int xmin;
211 int xmax;
212 int ymin;
213 int ymax;
209 uint8_t (*mv_penalty)[MAX_MV*2+1]; ///< amount of bits needed to encode a MV 214 uint8_t (*mv_penalty)[MAX_MV*2+1]; ///< amount of bits needed to encode a MV
210 int (*sub_motion_search)(struct MpegEncContext * s, 215 int (*sub_motion_search)(struct MpegEncContext * s,
211 int *mx_ptr, int *my_ptr, int dmin, 216 int *mx_ptr, int *my_ptr, int dmin,
212 int xmin, int ymin, int xmax, int ymax, 217 int pred_x, int pred_y, uint8_t *src_data[3],
213 int pred_x, int pred_y, Picture *ref_picture, 218 uint8_t *ref_data[6], int stride, int uvstride,
214 int n, int size, uint8_t * const mv_penalty); 219 int size, int h, uint8_t * const mv_penalty);
215 int (*motion_search[7])(struct MpegEncContext * s, int block, 220 int (*motion_search[7])(struct MpegEncContext * s,
216 int *mx_ptr, int *my_ptr, 221 int *mx_ptr, int *my_ptr,
217 int P[10][2], int pred_x, int pred_y, 222 int P[10][2], int pred_x, int pred_y, uint8_t *src_data[3],
218 int xmin, int ymin, int xmax, int ymax, Picture *ref_picture, int16_t (*last_mv)[2], 223 uint8_t *ref_data[6], int stride, int uvstride, int16_t (*last_mv)[2],
219 int ref_mv_scale, uint8_t * const mv_penalty); 224 int ref_mv_scale, uint8_t * const mv_penalty);
220 int (*pre_motion_search)(struct MpegEncContext * s, int block, 225 int (*pre_motion_search)(struct MpegEncContext * s,
221 int *mx_ptr, int *my_ptr, 226 int *mx_ptr, int *my_ptr,
222 int P[10][2], int pred_x, int pred_y, 227 int P[10][2], int pred_x, int pred_y, uint8_t *src_data[3],
223 int xmin, int ymin, int xmax, int ymax, Picture *ref_picture, int16_t (*last_mv)[2], 228 uint8_t *ref_data[6], int stride, int uvstride, int16_t (*last_mv)[2],
224 int ref_mv_scale, uint8_t * const mv_penalty); 229 int ref_mv_scale, uint8_t * const mv_penalty);
225 int (*get_mb_score)(struct MpegEncContext * s, int mx, int my, int pred_x, int pred_y, Picture *ref_picture, 230 int (*get_mb_score)(struct MpegEncContext * s, int mx, int my, int pred_x, int pred_y, uint8_t *src_data[3],
231 uint8_t *ref_data[6], int stride, int uvstride,
226 uint8_t * const mv_penalty); 232 uint8_t * const mv_penalty);
227 }MotionEstContext; 233 }MotionEstContext;
228 234
229 /** 235 /**
230 * MpegEncContext. 236 * MpegEncContext.
349 int16_t (*b_forw_mv_table_base)[2]; 355 int16_t (*b_forw_mv_table_base)[2];
350 int16_t (*b_back_mv_table_base)[2]; 356 int16_t (*b_back_mv_table_base)[2];
351 int16_t (*b_bidir_forw_mv_table_base)[2]; 357 int16_t (*b_bidir_forw_mv_table_base)[2];
352 int16_t (*b_bidir_back_mv_table_base)[2]; 358 int16_t (*b_bidir_back_mv_table_base)[2];
353 int16_t (*b_direct_mv_table_base)[2]; 359 int16_t (*b_direct_mv_table_base)[2];
360 int16_t (*p_field_mv_table_base[2][2])[2];
361 int16_t (*b_field_mv_table_base[2][2][2])[2];
354 int16_t (*p_mv_table)[2]; ///< MV table (1MV per MB) p-frame encoding 362 int16_t (*p_mv_table)[2]; ///< MV table (1MV per MB) p-frame encoding
355 int16_t (*b_forw_mv_table)[2]; ///< MV table (1MV per MB) forward mode b-frame encoding 363 int16_t (*b_forw_mv_table)[2]; ///< MV table (1MV per MB) forward mode b-frame encoding
356 int16_t (*b_back_mv_table)[2]; ///< MV table (1MV per MB) backward mode b-frame encoding 364 int16_t (*b_back_mv_table)[2]; ///< MV table (1MV per MB) backward mode b-frame encoding
357 int16_t (*b_bidir_forw_mv_table)[2]; ///< MV table (1MV per MB) bidir mode b-frame encoding 365 int16_t (*b_bidir_forw_mv_table)[2]; ///< MV table (1MV per MB) bidir mode b-frame encoding
358 int16_t (*b_bidir_back_mv_table)[2]; ///< MV table (1MV per MB) bidir mode b-frame encoding 366 int16_t (*b_bidir_back_mv_table)[2]; ///< MV table (1MV per MB) bidir mode b-frame encoding
359 int16_t (*b_direct_mv_table)[2]; ///< MV table (1MV per MB) direct mode b-frame encoding 367 int16_t (*b_direct_mv_table)[2]; ///< MV table (1MV per MB) direct mode b-frame encoding
368 int16_t (*p_field_mv_table[2][2])[2]; ///< MV table (2MV per MB) interlaced p-frame encoding
369 int16_t (*b_field_mv_table[2][2][2])[2];///< MV table (4MV per MB) interlaced b-frame encoding
370 uint8_t (*p_field_select_table[2]);
371 uint8_t (*b_field_select_table[2][2]);
360 int me_method; ///< ME algorithm 372 int me_method; ///< ME algorithm
361 int scene_change_score; 373 int scene_change_score;
362 int mv_dir; 374 int mv_dir;
363 #define MV_DIR_BACKWARD 1 375 #define MV_DIR_BACKWARD 1
364 #define MV_DIR_FORWARD 2 376 #define MV_DIR_FORWARD 2
389 401
390 /* macroblock layer */ 402 /* macroblock layer */
391 int mb_x, mb_y; 403 int mb_x, mb_y;
392 int mb_skip_run; 404 int mb_skip_run;
393 int mb_intra; 405 int mb_intra;
394 uint8_t *mb_type; ///< Table for MB type FIXME remove and use picture->mb_type 406 uint16_t *mb_type; ///< Table for candidate MB types for encoding
395 #define MB_TYPE_INTRA 0x01 407 #define CANDIDATE_MB_TYPE_INTRA 0x01
396 #define MB_TYPE_INTER 0x02 408 #define CANDIDATE_MB_TYPE_INTER 0x02
397 #define MB_TYPE_INTER4V 0x04 409 #define CANDIDATE_MB_TYPE_INTER4V 0x04
398 #define MB_TYPE_SKIPED 0x08 410 #define CANDIDATE_MB_TYPE_SKIPED 0x08
399 //#define MB_TYPE_GMC 0x10 411 //#define MB_TYPE_GMC 0x10
400 412
401 #define MB_TYPE_DIRECT 0x10 413 #define CANDIDATE_MB_TYPE_DIRECT 0x10
402 #define MB_TYPE_FORWARD 0x20 414 #define CANDIDATE_MB_TYPE_FORWARD 0x20
403 #define MB_TYPE_BACKWARD 0x40 415 #define CANDIDATE_MB_TYPE_BACKWARD 0x40
404 #define MB_TYPE_BIDIR 0x80 416 #define CANDIDATE_MB_TYPE_BIDIR 0x80
417
418 #define CANDIDATE_MB_TYPE_INTER_I 0x100
419 #define CANDIDATE_MB_TYPE_FORWARD_I 0x200
420 #define CANDIDATE_MB_TYPE_BACKWARD_I 0x400
421 #define CANDIDATE_MB_TYPE_BIDIR_I 0x800
405 422
406 int block_index[6]; ///< index to current MB in block based arrays with edges 423 int block_index[6]; ///< index to current MB in block based arrays with edges
407 int block_wrap[6]; 424 int block_wrap[6];
408 uint8_t *dest[3]; 425 uint8_t *dest[3];
409 426
549 PutBitContext pb2; ///< used for data partitioned VOPs 566 PutBitContext pb2; ///< used for data partitioned VOPs
550 #define PB_BUFFER_SIZE 1024*256 567 #define PB_BUFFER_SIZE 1024*256
551 uint8_t *tex_pb_buffer; 568 uint8_t *tex_pb_buffer;
552 uint8_t *pb2_buffer; 569 uint8_t *pb2_buffer;
553 int mpeg_quant; 570 int mpeg_quant;
554 int16_t (*field_mv_table)[2][2]; ///< used for interlaced b frame decoding
555 int8_t (*field_select_table)[2]; ///< wtf, no really another table for interlaced b frames
556 int t_frame; ///< time distance of first I -> B, used for interlaced b frames 571 int t_frame; ///< time distance of first I -> B, used for interlaced b frames
557 int padding_bug_score; ///< used to detect the VERY common padding bug in MPEG4 572 int padding_bug_score; ///< used to detect the VERY common padding bug in MPEG4
558 573
559 /* divx specific, used to workaround (many) bugs in divx5 */ 574 /* divx specific, used to workaround (many) bugs in divx5 */
560 int divx_version; 575 int divx_version;
746 int mb_x, int mb_y); 761 int mb_x, int mb_y);
747 void ff_estimate_b_frame_motion(MpegEncContext * s, 762 void ff_estimate_b_frame_motion(MpegEncContext * s,
748 int mb_x, int mb_y); 763 int mb_x, int mb_y);
749 int ff_get_best_fcode(MpegEncContext * s, int16_t (*mv_table)[2], int type); 764 int ff_get_best_fcode(MpegEncContext * s, int16_t (*mv_table)[2], int type);
750 void ff_fix_long_p_mvs(MpegEncContext * s); 765 void ff_fix_long_p_mvs(MpegEncContext * s);
751 void ff_fix_long_b_mvs(MpegEncContext * s, int16_t (*mv_table)[2], int f_code, int type); 766 void ff_fix_long_mvs(MpegEncContext * s, uint8_t *field_select_table, int field_select,
767 int16_t (*mv_table)[2], int f_code, int type, int truncate);
752 void ff_init_me(MpegEncContext *s); 768 void ff_init_me(MpegEncContext *s);
753 int ff_pre_estimate_p_frame_motion(MpegEncContext * s, int mb_x, int mb_y); 769 int ff_pre_estimate_p_frame_motion(MpegEncContext * s, int mb_x, int mb_y);
754 770
755 771
756 /* mpeg12.c */ 772 /* mpeg12.c */