comparison mpegvideo.h @ 1168:5af9aeadbdc3 libavcodec

H264 decoder & demuxer
author michaelni
date Fri, 04 Apr 2003 14:42:28 +0000
parents 0e3c0c4a7b3d
children fea03d2c4946
comparison
equal deleted inserted replaced
1167:35b80080b2db 1168:5af9aeadbdc3
31 31
32 enum OutputFormat { 32 enum OutputFormat {
33 FMT_MPEG1, 33 FMT_MPEG1,
34 FMT_H263, 34 FMT_H263,
35 FMT_MJPEG, 35 FMT_MJPEG,
36 FMT_H264,
36 }; 37 };
37 38
38 #define EDGE_WIDTH 16 39 #define EDGE_WIDTH 16
39 40
40 #define MPEG_BUF_SIZE (16 * 1024) 41 #define MPEG_BUF_SIZE (16 * 1024)
57 58
58 #define I_TYPE FF_I_TYPE ///< Intra 59 #define I_TYPE FF_I_TYPE ///< Intra
59 #define P_TYPE FF_P_TYPE ///< Predicted 60 #define P_TYPE FF_P_TYPE ///< Predicted
60 #define B_TYPE FF_B_TYPE ///< Bi-dir predicted 61 #define B_TYPE FF_B_TYPE ///< Bi-dir predicted
61 #define S_TYPE FF_S_TYPE ///< S(GMC)-VOP MPEG4 62 #define S_TYPE FF_S_TYPE ///< S(GMC)-VOP MPEG4
63 #define SI_TYPE FF_SI_TYPE ///< Switching Intra
64 #define SP_TYPE FF_SP_TYPE ///< Switching Predicted
62 65
63 typedef struct Predictor{ 66 typedef struct Predictor{
64 double coeff; 67 double coeff;
65 double count; 68 double count;
66 double decay; 69 double decay;
124 /** 127 /**
125 * Picture. 128 * Picture.
126 */ 129 */
127 typedef struct Picture{ 130 typedef struct Picture{
128 FF_COMMON_FRAME 131 FF_COMMON_FRAME
132
133 /**
134 * halfpel luma planes.
135 */
136 uint8_t *interpolated[3];
137
138 int16_t (*motion_val[2])[2];
139 int8_t *ref_index[2];
140 uint16_t *mb_type_base;
141 uint16_t *mb_type; ///< mb_type_base + mb_width + 2
142 #define MB_TYPE_INTRA4x4 0x0001
143 #define MB_TYPE_INTRA16x16 0x0002
144 #define MB_TYPE_INTRA_PCM 0x0004
145 #define MB_TYPE_16x16 0x0008
146 #define MB_TYPE_16x8 0x0010
147 #define MB_TYPE_8x16 0x0020
148 #define MB_TYPE_8x8 0x0040
149 #define MB_TYPE_INTERLACED 0x0080
150 #define MB_TYPE_DIRECT2 0x0100 //FIXME
151 #define MB_TYPE_REF0 0x0200
152 #define MB_TYPE_GMC2 0x0400 //FIXME
153 #define MB_TYPE_P0L0 0x1000
154 #define MB_TYPE_P1L0 0x2000
155 #define MB_TYPE_P0L1 0x4000
156 #define MB_TYPE_P1L1 0x8000
157
158 #define IS_INTRA4x4(a) ((a)&MB_TYPE_INTRA4x4)
159 #define IS_INTRA16x16(a) ((a)&MB_TYPE_INTRA16x16)
160 #define IS_INTRA(a) ((a)&3)
161 #define IS_INTER(a) ((a)&(MB_TYPE_16x16|MB_TYPE_16x8|MB_TYPE_8x16|MB_TYPE_8x8))
162 #define IS_INTRA_PCM(a) ((a)&MB_TYPE_INTRA_PCM)
163 #define IS_INTERLACED(a) ((a)&MB_TYPE_INTERLACED)
164 #define IS_DIRECT(a) ((a)&MB_TYPE_DIRECT2)
165 #define IS_16X16(a) ((a)&MB_TYPE_16x16)
166 #define IS_16X8(a) ((a)&MB_TYPE_16x8)
167 #define IS_8X16(a) ((a)&MB_TYPE_8x16)
168 #define IS_8X8(a) ((a)&MB_TYPE_8x8)
169 #define IS_SUB_8X8(a) ((a)&MB_TYPE_16x16) //note reused
170 #define IS_SUB_8X4(a) ((a)&MB_TYPE_16x8) //note reused
171 #define IS_SUB_4X8(a) ((a)&MB_TYPE_8x16) //note reused
172 #define IS_SUB_4X4(a) ((a)&MB_TYPE_8x8) //note reused
173 #define IS_REF0(a) ((a)&MB_TYPE_REF0)
174 #define IS_DIR(a, part, list) ((a) & (MB_TYPE_P0L0<<((part)+2*(list))))
175 #define USES_LIST(a, list) ((a) & ((MB_TYPE_P0L0|MB_TYPE_P1L0)<<(2*(list)))) ///< does this mb use listX, note doesnt work if subMBs
176
177
178 int field_poc[2]; ///< h264 top/bottom POC
179 int poc; ///< h264 frame POC
180 int frame_num; ///< h264 frame_num
181 int pic_id; ///< h264 pic_num or long_term_pic_idx
182 int long_ref; ///< 1->long term reference 0->short term reference
129 183
130 int mb_var_sum; ///< sum of MB variance for current frame 184 int mb_var_sum; ///< sum of MB variance for current frame
131 int mc_mb_var_sum; ///< motion compensated MB variance for current frame 185 int mc_mb_var_sum; ///< motion compensated MB variance for current frame
132 uint16_t *mb_var; ///< Table for MB variances 186 uint16_t *mb_var; ///< Table for MB variances
133 uint16_t *mc_mb_var; ///< Table for motion compensated MB variances 187 uint16_t *mc_mb_var; ///< Table for motion compensated MB variances
265 Picture *next_picture_ptr; ///< pointer to the next picture (for bidir pred) 319 Picture *next_picture_ptr; ///< pointer to the next picture (for bidir pred)
266 Picture *new_picture_ptr; ///< pointer to the source picture for encoding 320 Picture *new_picture_ptr; ///< pointer to the source picture for encoding
267 Picture *current_picture_ptr; ///< pointer to the current picture 321 Picture *current_picture_ptr; ///< pointer to the current picture
268 int last_dc[3]; ///< last DC values for MPEG1 322 int last_dc[3]; ///< last DC values for MPEG1
269 int16_t *dc_val[3]; ///< used for mpeg4 DC prediction, all 3 arrays must be continuous 323 int16_t *dc_val[3]; ///< used for mpeg4 DC prediction, all 3 arrays must be continuous
324 int16_t dc_cache[4*5];
270 int y_dc_scale, c_dc_scale; 325 int y_dc_scale, c_dc_scale;
271 uint8_t *y_dc_scale_table; ///< qscale -> y_dc_scale table 326 uint8_t *y_dc_scale_table; ///< qscale -> y_dc_scale table
272 uint8_t *c_dc_scale_table; ///< qscale -> c_dc_scale table 327 uint8_t *c_dc_scale_table; ///< qscale -> c_dc_scale table
273 uint8_t *coded_block; ///< used for coded block pattern prediction (msmpeg4v3, wmv1) 328 uint8_t *coded_block; ///< used for coded block pattern prediction (msmpeg4v3, wmv1)
274 int16_t (*ac_val[3])[16]; ///< used for for mpeg4 AC prediction, all 3 arrays must be continuous 329 int16_t (*ac_val[3])[16]; ///< used for for mpeg4 AC prediction, all 3 arrays must be continuous
293 int last_non_b_pict_type; ///< used for mpeg4 gmc b-frames & ratecontrol 348 int last_non_b_pict_type; ///< used for mpeg4 gmc b-frames & ratecontrol
294 int frame_rate_index; 349 int frame_rate_index;
295 /* motion compensation */ 350 /* motion compensation */
296 int unrestricted_mv; ///< mv can point outside of the coded picture 351 int unrestricted_mv; ///< mv can point outside of the coded picture
297 int h263_long_vectors; ///< use horrible h263v1 long vector mode 352 int h263_long_vectors; ///< use horrible h263v1 long vector mode
353 int decode; ///< if 0 then decoding will be skiped (for encoding b frames for example)
298 354
299 DSPContext dsp; ///< pointers for accelerated dsp fucntions 355 DSPContext dsp; ///< pointers for accelerated dsp fucntions
300 int f_code; ///< forward MV resolution 356 int f_code; ///< forward MV resolution
301 int b_code; ///< backward MV resolution for B Frames (mpeg4) 357 int b_code; ///< backward MV resolution for B Frames (mpeg4)
302 int16_t (*motion_val)[2]; ///< used for MV prediction (4MV per MB) 358 int16_t (*motion_val)[2]; ///< used for MV prediction (4MV per MB)
468 int scalability; 524 int scalability;
469 int hierachy_type; 525 int hierachy_type;
470 int enhancement_type; 526 int enhancement_type;
471 int new_pred; 527 int new_pred;
472 int reduced_res_vop; 528 int reduced_res_vop;
473 int aspect_ratio_info; 529 int aspect_ratio_info; //FIXME remove
474 int aspected_width; 530 int aspected_width; //FIXME remove
475 int aspected_height; 531 int aspected_height; //FIXME remove
476 int sprite_warping_accuracy; 532 int sprite_warping_accuracy;
477 int low_latency_sprite; 533 int low_latency_sprite;
478 int data_partitioning; ///< data partitioning flag from header 534 int data_partitioning; ///< data partitioning flag from header
479 int partitioned_frame; ///< is current frame partitioned 535 int partitioned_frame; ///< is current frame partitioned
480 int rvlc; ///< reversible vlc 536 int rvlc; ///< reversible vlc
544 600
545 /* Mpeg1 specific */ 601 /* Mpeg1 specific */
546 int fake_picture_number; ///< picture number at the bitstream frame rate 602 int fake_picture_number; ///< picture number at the bitstream frame rate
547 int gop_picture_number; ///< index of the first picture of a GOP based on fake_pic_num & mpeg1 specific 603 int gop_picture_number; ///< index of the first picture of a GOP based on fake_pic_num & mpeg1 specific
548 int last_mv_dir; ///< last mv_dir, used for b frame encoding 604 int last_mv_dir; ///< last mv_dir, used for b frame encoding
605 int broken_link; ///< no_output_of_prior_pics_flag
549 606
550 /* MPEG2 specific - I wish I had not to support this mess. */ 607 /* MPEG2 specific - I wish I had not to support this mess. */
551 int progressive_sequence; 608 int progressive_sequence;
552 int mpeg_f_code[2][2]; 609 int mpeg_f_code[2][2];
553 int picture_structure; 610 int picture_structure;