108
/** MBMODE for interlaced frame P-picture */
112
MV_PMODE_INTFR_2MV_FIELD,
114
MV_PMODE_INTFR_4MV_FIELD,
116
MV_PMODE_INTFR_INTRA,
108
120
/** @name MV types for B frames */
111
123
BMV_TYPE_BACKWARD,
112
124
BMV_TYPE_FORWARD,
113
BMV_TYPE_INTERPOLATED
125
BMV_TYPE_INTERPOLATED,
165
* FCM Frame Coding Mode
166
* @note some content might be marked interlaced
167
* but have fcm set to 0 as well (e.g. HD-DVD)
169
enum FrameCodingMode {
170
PROGRESSIVE = 0, ///< in the bitstream is reported as 00b
171
ILACE_FRAME, ///< in the bitstream is reported as 10b
172
ILACE_FIELD ///< in the bitstream is reported as 11b
152
175
/** The VC1 Context
153
176
* @todo Change size wherever another size is more efficient
212
235
/** Frame decoding info for all profiles */
214
uint8_t mv_mode; ///< MV coding monde
215
uint8_t mv_mode2; ///< Secondary MV coding mode (B frames)
216
int k_x; ///< Number of bits for MVs (depends on MV range)
217
int k_y; ///< Number of bits for MVs (depends on MV range)
218
int range_x, range_y; ///< MV range
219
uint8_t pq, altpq; ///< Current/alternate frame quantizer scale
220
uint8_t zz_8x8[4][64];///< Zigzag table for TT_8x8, permuted for IDCT
237
uint8_t mv_mode; ///< MV coding monde
238
uint8_t mv_mode2; ///< Secondary MV coding mode (B frames)
239
int k_x; ///< Number of bits for MVs (depends on MV range)
240
int k_y; ///< Number of bits for MVs (depends on MV range)
241
int range_x, range_y; ///< MV range
242
uint8_t pq, altpq; ///< Current/alternate frame quantizer scale
243
uint8_t zz_8x8[4][64]; ///< Zigzag table for TT_8x8, permuted for IDCT
221
244
int left_blk_sh, top_blk_sh; ///< Either 3 or 0, positions of l/t in blk[]
222
const uint8_t* zz_8x4;///< Zigzag scan table for TT_8x4 coding mode
223
const uint8_t* zz_4x8;///< Zigzag scan table for TT_4x8 coding mode
245
const uint8_t* zz_8x4; ///< Zigzag scan table for TT_8x4 coding mode
246
const uint8_t* zz_4x8; ///< Zigzag scan table for TT_4x8 coding mode
224
247
/** pquant parameters */
226
249
uint8_t dquantfrm;
232
255
* @see 8.1.1.10, p(1)10
235
int c_ac_table_index; ///< Chroma index from ACFRM element
236
int y_ac_table_index; ///< Luma index from AC2FRM element
258
int c_ac_table_index; ///< Chroma index from ACFRM element
259
int y_ac_table_index; ///< Luma index from AC2FRM element
238
int ttfrm; ///< Transform type info present at frame level
239
uint8_t ttmbf; ///< Transform type flag
261
int ttfrm; ///< Transform type info present at frame level
262
uint8_t ttmbf; ///< Transform type flag
240
263
int *ttblk_base, *ttblk; ///< Transform type at the block level
241
int codingset; ///< index of current table set from 11.8 to use for luma block decoding
242
int codingset2; ///< index of current table set from 11.8 to use for chroma block decoding
243
int pqindex; ///< raw pqindex used in coding set selection
264
int codingset; ///< index of current table set from 11.8 to use for luma block decoding
265
int codingset2; ///< index of current table set from 11.8 to use for chroma block decoding
266
int pqindex; ///< raw pqindex used in coding set selection
244
267
int a_avail, c_avail;
245
268
uint8_t *mb_type_base, *mb_type[3];
260
283
* -# 2 -> [-512, 511.f] x [-128, 127.f]
261
284
* -# 3 -> [-1024, 1023.f] x [-256, 255.f]
264
uint8_t pquantizer; ///< Uniform (over sequence) quantizer in use
265
VLC *cbpcy_vlc; ///< CBPCY VLC table
266
int tt_index; ///< Index for Transform Type tables
267
uint8_t* mv_type_mb_plane; ///< bitplane for mv_type == (4MV)
268
uint8_t* direct_mb_plane; ///< bitplane for "direct" MBs
269
int mv_type_is_raw; ///< mv type mb plane is not coded
270
int dmb_is_raw; ///< direct mb plane is raw
271
int skip_is_raw; ///< skip mb plane is not coded
272
uint8_t luty[256], lutuv[256]; // lookup tables used for intensity compensation
273
int use_ic; ///< use intensity compensation in B-frames
274
int rnd; ///< rounding control
286
uint8_t mvrange; ///< Extended MV range flag
287
uint8_t pquantizer; ///< Uniform (over sequence) quantizer in use
288
VLC *cbpcy_vlc; ///< CBPCY VLC table
289
int tt_index; ///< Index for Transform Type tables (to decode TTMB)
290
uint8_t* mv_type_mb_plane; ///< bitplane for mv_type == (4MV)
291
uint8_t* direct_mb_plane; ///< bitplane for "direct" MBs
292
uint8_t* forward_mb_plane; ///< bitplane for "forward" MBs
293
int mv_type_is_raw; ///< mv type mb plane is not coded
294
int dmb_is_raw; ///< direct mb plane is raw
295
int fmb_is_raw; ///< forward mb plane is raw
296
int skip_is_raw; ///< skip mb plane is not coded
297
uint8_t luty[256], lutuv[256]; ///< lookup tables used for intensity compensation
298
int use_ic; ///< use intensity compensation in B-frames
299
int rnd; ///< rounding control
276
301
/** Frame decoding info for S/M profiles only */
278
uint8_t rangeredfrm; ///< out_sample = CLIP((in_sample-128)*2+128)
303
uint8_t rangeredfrm; ///< out_sample = CLIP((in_sample-128)*2+128)
279
304
uint8_t interpfrm;
282
307
/** Frame decoding info for Advanced profile */
284
uint8_t fcm; ///< 0->Progressive, 2->Frame-Interlace, 3->Field-Interlace
309
enum FrameCodingMode fcm;
285
310
uint8_t numpanscanwin;
287
312
uint8_t rptfrm, tff, rff;
307
332
uint8_t range_mapuv;
335
/** Frame decoding info for interlaced picture */
336
uint8_t dmvrange; ///< Extended differential MV range flag
339
uint8_t lumscale2; ///< for interlaced field P picture
341
uint8_t luty2[256], lutuv2[256]; // lookup tables used for intensity compensation
348
uint8_t* fieldtx_plane;
351
uint8_t *blk_mv_type_base, *blk_mv_type; ///< 0: frame MV, 1: field MV (interlaced frame)
352
uint8_t *mv_f_base, *mv_f[2]; ///< 0: MV obtained from same field, 1: opposite field
353
uint8_t *mv_f_last_base, *mv_f_last[2];
354
uint8_t *mv_f_next_base, *mv_f_next[2];
355
int field_mode; ///< 1 for interlaced field pictures
358
int refdist; ///< distance of the current picture from reference
359
int numref; ///< number of past field pictures used as reference
360
// 0 corresponds to 1 and 1 corresponds to 2 references
361
int reffield; ///< if numref = 0 (1 reference) then reffield decides which
362
// field to use among the two fields from previous frame
363
int intcompfield; ///< which of the two fields to be intensity compensated
364
// 0: both fields, 1: bottom field, 2: top field
365
int cur_field_type; ///< 0: top, 1: bottom
366
int ref_field_type[2]; ///< forward and backward reference field type (top or bottom)
367
int blocks_off, mb_off;
368
int qs_last; ///< if qpel has been used in the previous (tr.) picture
370
int frfd, brfd; ///< reference frame distance (forward or backward)
310
373
/** Frame decoding info for sprite modes */
377
AVFrame sprite_output_frame;
378
int output_width, output_height, sprite_width, sprite_height;
379
uint8_t* sr_rows[2][2]; ///< Sprite resizer line cache
316
382
int p_frame_skipped;
322
388
uint32_t *cbp_base, *cbp;
323
389
uint8_t *is_intra_base, *is_intra;
324
390
int16_t (*luma_mv_base)[2], (*luma_mv)[2];
325
uint8_t bfraction_lut_index;///< Index for BFRACTION value (see Table 40, reproduced into ff_vc1_bfraction_lut[])
326
uint8_t broken_link; ///< Broken link flag (BROKEN_LINK syntax element)
327
uint8_t closed_entry; ///< Closed entry point flag (CLOSED_ENTRY syntax element)
391
uint8_t bfraction_lut_index; ///< Index for BFRACTION value (see Table 40, reproduced into ff_vc1_bfraction_lut[])
392
uint8_t broken_link; ///< Broken link flag (BROKEN_LINK syntax element)
393
uint8_t closed_entry; ///< Closed entry point flag (CLOSED_ENTRY syntax element)
329
int parse_only; ///< Context is used within parser
395
int parse_only; ///< Context is used within parser
331
397
int warn_interlaced;
352
419
int dsize = 0, i;
355
for(dsize = 0; dsize < size; dsize++) *dst++ = *src++;
422
for (dsize = 0; dsize < size; dsize++)
358
for(i = 0; i < size; i++, src++) {
359
if(src[0] == 3 && i >= 2 && !src[-1] && !src[-2] && i < size-1 && src[1] < 4) {
426
for (i = 0; i < size; i++, src++) {
427
if (src[0] == 3 && i >= 2 && !src[-1] && !src[-2] && i < size-1 && src[1] < 4) {
360
428
dst[dsize++] = src[1];