comparison mpegvideo.h @ 706:e65798d228ea libavcodec

idct permutation cleanup, idct can be selected per context now fixing some threadunsafe code
author michaelni
date Sun, 29 Sep 2002 22:44:22 +0000
parents 3525da287ee2
children c0a914cc90c0
comparison
equal deleted inserted replaced
705:107a56aa74f5 706:e65798d228ea
96 int qscale; 96 int qscale;
97 int force_type; 97 int force_type;
98 int picture_number; 98 int picture_number;
99 int picture_in_gop_number; 99 int picture_in_gop_number;
100 } ReorderBuffer; 100 } ReorderBuffer;
101
102 typedef struct ScanTable{
103 UINT8 permutated[64];
104 UINT8 raster_end[64];
105 } ScanTable;
101 106
102 typedef struct MpegEncContext { 107 typedef struct MpegEncContext {
103 struct AVCodecContext *avctx; 108 struct AVCodecContext *avctx;
104 /* the following parameters must be initialized before encoding */ 109 /* the following parameters must be initialized before encoding */
105 int width, height; /* picture size. must be a multiple of 16 */ 110 int width, height; /* picture size. must be a multiple of 16 */
284 UINT16 __align8 q_intra_matrix16[32][64]; 289 UINT16 __align8 q_intra_matrix16[32][64];
285 UINT16 __align8 q_inter_matrix16[32][64]; 290 UINT16 __align8 q_inter_matrix16[32][64];
286 UINT16 __align8 q_intra_matrix16_bias[32][64]; 291 UINT16 __align8 q_intra_matrix16_bias[32][64];
287 UINT16 __align8 q_inter_matrix16_bias[32][64]; 292 UINT16 __align8 q_inter_matrix16_bias[32][64];
288 int block_last_index[6]; /* last non zero coefficient in block */ 293 int block_last_index[6]; /* last non zero coefficient in block */
294 /* scantables */
295 ScanTable intra_scantable;
296 ScanTable intra_h_scantable;
297 ScanTable intra_v_scantable;
298 ScanTable inter_scantable; // if inter == intra then intra should be used to reduce tha cache usage
299 UINT8 idct_permutation[64];
289 300
290 void *opaque; /* private data for the user */ 301 void *opaque; /* private data for the user */
291 302
292 /* bit rate control */ 303 /* bit rate control */
293 int I_frame_bits; //FIXME used in mpeg12 ... 304 int I_frame_bits; //FIXME used in mpeg12 ...
419 int flipflop_rounding; 430 int flipflop_rounding;
420 int msmpeg4_version; /* 0=not msmpeg4, 1=mp41, 2=mp42, 3=mp43/divx3 4=wmv1/7 5=wmv2/8*/ 431 int msmpeg4_version; /* 0=not msmpeg4, 1=mp41, 2=mp42, 3=mp43/divx3 4=wmv1/7 5=wmv2/8*/
421 int per_mb_rl_table; 432 int per_mb_rl_table;
422 int esc3_level_length; 433 int esc3_level_length;
423 int esc3_run_length; 434 int esc3_run_length;
424 UINT8 *inter_scantable;
425 UINT8 *intra_scantable;
426 UINT8 *intra_v_scantable;
427 UINT8 *intra_h_scantable;
428 /* [mb_intra][isChroma][level][run][last] */ 435 /* [mb_intra][isChroma][level][run][last] */
429 int (*ac_stats)[2][MAX_LEVEL+1][MAX_RUN+1][2]; 436 int (*ac_stats)[2][MAX_LEVEL+1][MAX_RUN+1][2];
430 int inter_intra_pred; 437 int inter_intra_pred;
431 438
432 /* decompression specific */ 439 /* decompression specific */
475 void (*dct_unquantize_h263)(struct MpegEncContext *s, 482 void (*dct_unquantize_h263)(struct MpegEncContext *s,
476 DCTELEM *block, int n, int qscale); 483 DCTELEM *block, int n, int qscale);
477 void (*dct_unquantize)(struct MpegEncContext *s, // unquantizer to use (mpeg4 can use both) 484 void (*dct_unquantize)(struct MpegEncContext *s, // unquantizer to use (mpeg4 can use both)
478 DCTELEM *block, int n, int qscale); 485 DCTELEM *block, int n, int qscale);
479 int (*dct_quantize)(struct MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow); 486 int (*dct_quantize)(struct MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow);
480 void (*fdct)(DCTELEM *block); 487 void (*fdct)(DCTELEM *block/* align 16*/);
488 void (*idct_put)(UINT8 *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/);
489 void (*idct_add)(UINT8 *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/);
481 } MpegEncContext; 490 } MpegEncContext;
482 491
483 int MPV_common_init(MpegEncContext *s); 492 int MPV_common_init(MpegEncContext *s);
484 void MPV_common_end(MpegEncContext *s); 493 void MPV_common_end(MpegEncContext *s);
485 void MPV_decode_mb(MpegEncContext *s, DCTELEM block[6][64]); 494 void MPV_decode_mb(MpegEncContext *s, DCTELEM block[6][64]);
496 #endif 505 #endif
497 extern void (*draw_edges)(UINT8 *buf, int wrap, int width, int height, int w); 506 extern void (*draw_edges)(UINT8 *buf, int wrap, int width, int height, int w);
498 void ff_conceal_past_errors(MpegEncContext *s, int conceal_all); 507 void ff_conceal_past_errors(MpegEncContext *s, int conceal_all);
499 void ff_copy_bits(PutBitContext *pb, UINT8 *src, int length); 508 void ff_copy_bits(PutBitContext *pb, UINT8 *src, int length);
500 void ff_clean_intra_table_entries(MpegEncContext *s); 509 void ff_clean_intra_table_entries(MpegEncContext *s);
510 void ff_init_scantable(MpegEncContext *s, ScanTable *st, const UINT8 *src_scantable);
501 511
502 extern int ff_bit_exact; 512 extern int ff_bit_exact;
503 513
504 /* motion_est.c */ 514 /* motion_est.c */
505 void ff_estimate_p_frame_motion(MpegEncContext * s, 515 void ff_estimate_p_frame_motion(MpegEncContext * s,
509 int ff_get_best_fcode(MpegEncContext * s, int16_t (*mv_table)[2], int type); 519 int ff_get_best_fcode(MpegEncContext * s, int16_t (*mv_table)[2], int type);
510 void ff_fix_long_p_mvs(MpegEncContext * s); 520 void ff_fix_long_p_mvs(MpegEncContext * s);
511 void ff_fix_long_b_mvs(MpegEncContext * s, int16_t (*mv_table)[2], int f_code, int type); 521 void ff_fix_long_b_mvs(MpegEncContext * s, int16_t (*mv_table)[2], int f_code, int type);
512 522
513 /* mpeg12.c */ 523 /* mpeg12.c */
514 extern INT16 ff_mpeg1_default_intra_matrix[64]; 524 extern const INT16 ff_mpeg1_default_intra_matrix[64];
515 extern INT16 ff_mpeg1_default_non_intra_matrix[64]; 525 extern const INT16 ff_mpeg1_default_non_intra_matrix[64];
516 extern UINT8 ff_mpeg1_dc_scale_table[128]; 526 extern UINT8 ff_mpeg1_dc_scale_table[128];
517 527
518 void mpeg1_encode_picture_header(MpegEncContext *s, int picture_number); 528 void mpeg1_encode_picture_header(MpegEncContext *s, int picture_number);
519 void mpeg1_encode_mb(MpegEncContext *s, 529 void mpeg1_encode_mb(MpegEncContext *s,
520 DCTELEM block[6][64], 530 DCTELEM block[6][64],
549 return index + level - 1; 559 return index + level - 1;
550 } 560 }
551 561
552 extern UINT8 ff_mpeg4_y_dc_scale_table[32]; 562 extern UINT8 ff_mpeg4_y_dc_scale_table[32];
553 extern UINT8 ff_mpeg4_c_dc_scale_table[32]; 563 extern UINT8 ff_mpeg4_c_dc_scale_table[32];
554 extern INT16 ff_mpeg4_default_intra_matrix[64]; 564 extern const INT16 ff_mpeg4_default_intra_matrix[64];
555 extern INT16 ff_mpeg4_default_non_intra_matrix[64]; 565 extern const INT16 ff_mpeg4_default_non_intra_matrix[64];
556 566
557 void h263_encode_mb(MpegEncContext *s, 567 void h263_encode_mb(MpegEncContext *s,
558 DCTELEM block[6][64], 568 DCTELEM block[6][64],
559 int motion_x, int motion_y); 569 int motion_x, int motion_y);
560 void mpeg4_encode_mb(MpegEncContext *s, 570 void mpeg4_encode_mb(MpegEncContext *s,