Mercurial > libavcodec.hg
comparison mpegvideo.h @ 277:5cb2978e701f libavcodec
new motion estimation (epzs) not complete yet but allready pretty good :)
unlimited mv search range
minor bugfix in the mpeg4 header parser
reset picture in gop counter if scene change is detected
author | michaelni |
---|---|
date | Fri, 22 Mar 2002 02:21:17 +0000 |
parents | 09ae29b27ed9 |
children | 1fc96b02142e |
comparison
equal
deleted
inserted
replaced
276:1e2f9ef286d4 | 277:5cb2978e701f |
---|---|
31 | 31 |
32 #define MPEG_BUF_SIZE (16 * 1024) | 32 #define MPEG_BUF_SIZE (16 * 1024) |
33 | 33 |
34 #define QMAT_SHIFT_MMX 19 | 34 #define QMAT_SHIFT_MMX 19 |
35 #define QMAT_SHIFT 25 | 35 #define QMAT_SHIFT 25 |
36 | |
37 #define MAX_FCODE 7 | |
38 #define MAX_MV 2048 | |
36 | 39 |
37 typedef struct Predictor{ | 40 typedef struct Predictor{ |
38 double coeff; | 41 double coeff; |
39 double count; | 42 double count; |
40 double decay; | 43 double decay; |
69 | 72 |
70 /* sequence parameters */ | 73 /* sequence parameters */ |
71 int context_initialized; | 74 int context_initialized; |
72 int picture_number; | 75 int picture_number; |
73 int fake_picture_number; /* picture number at the bitstream frame rate */ | 76 int fake_picture_number; /* picture number at the bitstream frame rate */ |
74 int gop_picture_number; /* index of the first picture of a GOP */ | 77 int gop_picture_number; /* index of the first picture of a GOP based on fake_pic_num & mpeg1 specific */ |
78 int picture_in_gop_number; /* 0-> first pic in gop, ... */ | |
75 int mb_width, mb_height; | 79 int mb_width, mb_height; |
76 int mb_num; /* number of MBs of a picture */ | 80 int mb_num; /* number of MBs of a picture */ |
77 int linesize; /* line size, in bytes, may be different from width */ | 81 int linesize; /* line size, in bytes, may be different from width */ |
78 UINT8 *new_picture[3]; /* picture to be compressed */ | 82 UINT8 *new_picture[3]; /* picture to be compressed */ |
79 UINT8 *last_picture[3]; /* previous picture */ | 83 UINT8 *last_picture[3]; /* previous picture */ |
112 #define MV_DIR_BACKWARD 1 | 116 #define MV_DIR_BACKWARD 1 |
113 #define MV_DIR_FORWARD 2 | 117 #define MV_DIR_FORWARD 2 |
114 #define MV_DIRECT 4 // bidirectional mode where the difference equals the MV of the last P/S/I-Frame (mpeg4) | 118 #define MV_DIRECT 4 // bidirectional mode where the difference equals the MV of the last P/S/I-Frame (mpeg4) |
115 int mv_type; | 119 int mv_type; |
116 #define MV_TYPE_16X16 0 /* 1 vector for the whole mb */ | 120 #define MV_TYPE_16X16 0 /* 1 vector for the whole mb */ |
117 #define MV_TYPE_8X8 1 /* 4 vectors (h263) */ | 121 #define MV_TYPE_8X8 1 /* 4 vectors (h263, mpeg4 4MV) */ |
118 #define MV_TYPE_16X8 2 /* 2 vectors, one per 16x8 block */ | 122 #define MV_TYPE_16X8 2 /* 2 vectors, one per 16x8 block */ |
119 #define MV_TYPE_FIELD 3 /* 2 vectors, one per field */ | 123 #define MV_TYPE_FIELD 3 /* 2 vectors, one per field */ |
120 #define MV_TYPE_DMV 4 /* 2 vectors, special mpeg2 Dual Prime Vectors */ | 124 #define MV_TYPE_DMV 4 /* 2 vectors, special mpeg2 Dual Prime Vectors */ |
121 /* motion vectors for a macroblock | 125 /* motion vectors for a macroblock |
122 first coordinate : 0 = forward 1 = backward | 126 first coordinate : 0 = forward 1 = backward |
124 third " : 0 = x, 1 = y | 128 third " : 0 = x, 1 = y |
125 */ | 129 */ |
126 int mv[2][4][2]; | 130 int mv[2][4][2]; |
127 int field_select[2][2]; | 131 int field_select[2][2]; |
128 int last_mv[2][2][2]; | 132 int last_mv[2][2][2]; |
133 UINT16 (*mv_penalty)[MAX_MV*2+1]; /* amount of bits needed to encode a MV, used for ME */ | |
134 UINT8 *fcode_tab; /* smallest fcode needed for each MV */ | |
129 | 135 |
130 int has_b_frames; | 136 int has_b_frames; |
131 int no_rounding; /* apply no rounding to motion estimation (MPEG4) */ | 137 int no_rounding; /* apply no rounding to motion estimation (MPEG4) */ |
132 | 138 |
133 /* macroblock layer */ | 139 /* macroblock layer */ |
348 INT16 *h263_pred_motion(MpegEncContext * s, int block, | 354 INT16 *h263_pred_motion(MpegEncContext * s, int block, |
349 int *px, int *py); | 355 int *px, int *py); |
350 void mpeg4_pred_ac(MpegEncContext * s, INT16 *block, int n, | 356 void mpeg4_pred_ac(MpegEncContext * s, INT16 *block, int n, |
351 int dir); | 357 int dir); |
352 void mpeg4_encode_picture_header(MpegEncContext *s, int picture_number); | 358 void mpeg4_encode_picture_header(MpegEncContext *s, int picture_number); |
353 void h263_encode_init_vlc(MpegEncContext *s); | 359 void h263_encode_init(MpegEncContext *s); |
354 | 360 |
355 void h263_decode_init_vlc(MpegEncContext *s); | 361 void h263_decode_init_vlc(MpegEncContext *s); |
356 int h263_decode_picture_header(MpegEncContext *s); | 362 int h263_decode_picture_header(MpegEncContext *s); |
357 int h263_decode_gob_header(MpegEncContext *s); | 363 int h263_decode_gob_header(MpegEncContext *s); |
358 int mpeg4_decode_picture_header(MpegEncContext * s); | 364 int mpeg4_decode_picture_header(MpegEncContext * s); |