FFmpeg
vc1.c
Go to the documentation of this file.
1 /*
2  * VC-1 and WMV3 decoder common code
3  * Copyright (c) 2011 Mashiat Sarker Shakkhar
4  * Copyright (c) 2006-2007 Konstantin Shishkov
5  * Partly based on vc9.c (c) 2005 Anonymous, Alex Beregszaszi, Michael Niedermayer
6  *
7  * This file is part of FFmpeg.
8  *
9  * FFmpeg is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * FFmpeg is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with FFmpeg; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22  */
23 
24 /**
25  * @file
26  * VC-1 and WMV3 decoder common code
27  */
28 
29 #include "avcodec.h"
30 #include "decode.h"
31 #include "mpegvideo.h"
32 #include "vc1.h"
33 #include "vc1data.h"
34 #include "wmv2data.h"
35 #include "unary.h"
36 
37 /***********************************************************************/
38 /**
39  * @name VC-1 Bitplane decoding
40  * @see 8.7, p56
41  * @{
42  */
43 
44 /** Decode rows by checking if they are skipped
45  * @param plane Buffer to store decoded bits
46  * @param[in] width Width of this buffer
47  * @param[in] height Height of this buffer
48  * @param[in] stride of this buffer
49  */
50 static void decode_rowskip(uint8_t* plane, int width, int height, int stride,
51  GetBitContext *gb)
52 {
53  int x, y;
54 
55  for (y = 0; y < height; y++) {
56  if (!get_bits1(gb)) //rowskip
57  memset(plane, 0, width);
58  else
59  for (x = 0; x < width; x++)
60  plane[x] = get_bits1(gb);
61  plane += stride;
62  }
63 }
64 
65 /** Decode columns by checking if they are skipped
66  * @param plane Buffer to store decoded bits
67  * @param[in] width Width of this buffer
68  * @param[in] height Height of this buffer
69  * @param[in] stride of this buffer
70  * @todo FIXME: Optimize
71  */
72 static void decode_colskip(uint8_t* plane, int width, int height, int stride,
73  GetBitContext *gb)
74 {
75  int x, y;
76 
77  for (x = 0; x < width; x++) {
78  if (!get_bits1(gb)) //colskip
79  for (y = 0; y < height; y++)
80  plane[y*stride] = 0;
81  else
82  for (y = 0; y < height; y++)
83  plane[y*stride] = get_bits1(gb);
84  plane ++;
85  }
86 }
87 
88 /** Decode a bitplane's bits
89  * @param data bitplane where to store the decode bits
90  * @param[out] raw_flag pointer to the flag indicating that this bitplane is not coded explicitly
91  * @param v VC-1 context for bit reading and logging
92  * @return Status
93  * @todo FIXME: Optimize
94  */
95 static int bitplane_decoding(uint8_t* data, int *raw_flag, VC1Context *v)
96 {
97  GetBitContext *gb = &v->s.gb;
98 
99  int imode, x, y, code, offset;
100  uint8_t invert, *planep = data;
101  int width, height, stride;
102 
103  width = v->s.mb_width;
104  height = v->s.mb_height >> v->field_mode;
105  stride = v->s.mb_stride;
106  invert = get_bits1(gb);
108 
109  *raw_flag = 0;
110  switch (imode) {
111  case IMODE_RAW:
112  //Data is actually read in the MB layer (same for all tests == "raw")
113  *raw_flag = 1; //invert ignored
114  return invert;
115  case IMODE_DIFF2:
116  case IMODE_NORM2:
117  if ((height * width) & 1) {
118  *planep++ = get_bits1(gb);
119  y = offset = 1;
120  if (offset == width) {
121  offset = 0;
122  planep += stride - width;
123  }
124  }
125  else
126  y = offset = 0;
127  // decode bitplane as one long line
128  for (; y < height * width; y += 2) {
130  *planep++ = code & 1;
131  offset++;
132  if (offset == width) {
133  offset = 0;
134  planep += stride - width;
135  }
136  *planep++ = code >> 1;
137  offset++;
138  if (offset == width) {
139  offset = 0;
140  planep += stride - width;
141  }
142  }
143  break;
144  case IMODE_DIFF6:
145  case IMODE_NORM6:
146  if (!(height % 3) && (width % 3)) { // use 2x3 decoding
147  for (y = 0; y < height; y += 3) {
148  for (x = width & 1; x < width; x += 2) {
150  if (code < 0) {
151  av_log(v->s.avctx, AV_LOG_DEBUG, "invalid NORM-6 VLC\n");
152  return -1;
153  }
154  planep[x + 0] = (code >> 0) & 1;
155  planep[x + 1] = (code >> 1) & 1;
156  planep[x + 0 + stride] = (code >> 2) & 1;
157  planep[x + 1 + stride] = (code >> 3) & 1;
158  planep[x + 0 + stride * 2] = (code >> 4) & 1;
159  planep[x + 1 + stride * 2] = (code >> 5) & 1;
160  }
161  planep += stride * 3;
162  }
163  if (width & 1)
164  decode_colskip(data, 1, height, stride, &v->s.gb);
165  } else { // 3x2
166  planep += (height & 1) * stride;
167  for (y = height & 1; y < height; y += 2) {
168  for (x = width % 3; x < width; x += 3) {
170  if (code < 0) {
171  av_log(v->s.avctx, AV_LOG_DEBUG, "invalid NORM-6 VLC\n");
172  return -1;
173  }
174  planep[x + 0] = (code >> 0) & 1;
175  planep[x + 1] = (code >> 1) & 1;
176  planep[x + 2] = (code >> 2) & 1;
177  planep[x + 0 + stride] = (code >> 3) & 1;
178  planep[x + 1 + stride] = (code >> 4) & 1;
179  planep[x + 2 + stride] = (code >> 5) & 1;
180  }
181  planep += stride * 2;
182  }
183  x = width % 3;
184  if (x)
185  decode_colskip(data, x, height, stride, &v->s.gb);
186  if (height & 1)
187  decode_rowskip(data + x, width - x, 1, stride, &v->s.gb);
188  }
189  break;
190  case IMODE_ROWSKIP:
192  break;
193  case IMODE_COLSKIP:
195  break;
196  default:
197  break;
198  }
199 
200  /* Applying diff operator */
201  if (imode == IMODE_DIFF2 || imode == IMODE_DIFF6) {
202  planep = data;
203  planep[0] ^= invert;
204  for (x = 1; x < width; x++)
205  planep[x] ^= planep[x-1];
206  for (y = 1; y < height; y++) {
207  planep += stride;
208  planep[0] ^= planep[-stride];
209  for (x = 1; x < width; x++) {
210  if (planep[x-1] != planep[x-stride]) planep[x] ^= invert;
211  else planep[x] ^= planep[x-1];
212  }
213  }
214  } else if (invert) {
215  planep = data;
216  for (x = 0; x < stride * height; x++)
217  planep[x] = !planep[x]; //FIXME stride
218  }
219  return (imode << 1) + invert;
220 }
221 
222 /** @} */ //Bitplane group
223 
224 /***********************************************************************/
225 /** VOP Dquant decoding
226  * @param v VC-1 Context
227  */
229 {
230  GetBitContext *gb = &v->s.gb;
231  int pqdiff;
232 
233  //variable size
234  if (v->dquant != 2) {
235  v->dquantfrm = get_bits1(gb);
236  if (!v->dquantfrm)
237  return 0;
238 
239  v->dqprofile = get_bits(gb, 2);
240  switch (v->dqprofile) {
243  v->dqsbedge = get_bits(gb, 2);
244  break;
245  case DQPROFILE_ALL_MBS:
246  v->dqbilevel = get_bits1(gb);
247  if (!v->dqbilevel) {
248  v->halfpq = 0;
249  return 0;
250  }
251  default:
252  break; //Forbidden ?
253  }
254  }
255 
256  pqdiff = get_bits(gb, 3);
257  if (pqdiff == 7)
258  v->altpq = get_bits(gb, 5);
259  else
260  v->altpq = v->pq + pqdiff + 1;
261 
262  return 0;
263 }
264 
266 
267 /**
268  * Decode Simple/Main Profiles sequence header
269  * @see Figure 7-8, p16-17
270  * @param avctx Codec context
271  * @param gb GetBit context initialized from Codec context extra_data
272  * @return Status
273  */
275 {
276  av_log(avctx, AV_LOG_DEBUG, "Header: %0X\n", show_bits_long(gb, 32));
277  v->profile = get_bits(gb, 2);
278  if (v->profile == PROFILE_COMPLEX) {
279  av_log(avctx, AV_LOG_WARNING, "WMV3 Complex Profile is not fully supported\n");
280  }
281 
282  if (v->profile == PROFILE_ADVANCED) {
285  return decode_sequence_header_adv(v, gb);
286  } else {
287  v->chromaformat = 1;
290  v->res_y411 = get_bits1(gb);
291  v->res_sprite = get_bits1(gb);
292  if (v->res_y411) {
293  av_log(avctx, AV_LOG_ERROR,
294  "Old interlaced mode is not supported\n");
295  return -1;
296  }
297  }
298 
299  // (fps-2)/4 (->30)
300  v->frmrtq_postproc = get_bits(gb, 3); //common
301  // (bitrate-32kbps)/64kbps
302  v->bitrtq_postproc = get_bits(gb, 5); //common
303  v->s.loop_filter = get_bits1(gb); //common
304  if (v->s.loop_filter == 1 && v->profile == PROFILE_SIMPLE) {
305  av_log(avctx, AV_LOG_ERROR,
306  "LOOPFILTER shall not be enabled in Simple Profile\n");
307  }
309  v->s.loop_filter = 0;
310 
311  v->res_x8 = get_bits1(gb); //reserved
312  v->multires = get_bits1(gb);
313  v->res_fasttx = get_bits1(gb);
314 
315  v->fastuvmc = get_bits1(gb); //common
316  if (!v->profile && !v->fastuvmc) {
317  av_log(avctx, AV_LOG_ERROR,
318  "FASTUVMC unavailable in Simple Profile\n");
319  return -1;
320  }
321  v->extended_mv = get_bits1(gb); //common
322  if (!v->profile && v->extended_mv) {
323  av_log(avctx, AV_LOG_ERROR,
324  "Extended MVs unavailable in Simple Profile\n");
325  return -1;
326  }
327  v->dquant = get_bits(gb, 2); //common
328  v->vstransform = get_bits1(gb); //common
329 
330  v->res_transtab = get_bits1(gb);
331  if (v->res_transtab) {
332  av_log(avctx, AV_LOG_ERROR,
333  "1 for reserved RES_TRANSTAB is forbidden\n");
334  return -1;
335  }
336 
337  v->overlap = get_bits1(gb); //common
338 
339  v->resync_marker = get_bits1(gb);
340  v->rangered = get_bits1(gb);
341  if (v->rangered && v->profile == PROFILE_SIMPLE) {
342  av_log(avctx, AV_LOG_INFO,
343  "RANGERED should be set to 0 in Simple Profile\n");
344  }
345 
346  v->s.max_b_frames = avctx->max_b_frames = get_bits(gb, 3); //common
347  v->quantizer_mode = get_bits(gb, 2); //common
348 
349  v->finterpflag = get_bits1(gb); //common
350 
351  if (v->res_sprite) {
352  int w = get_bits(gb, 11);
353  int h = get_bits(gb, 11);
354  int ret = ff_set_dimensions(v->s.avctx, w, h);
355  if (ret < 0) {
356  av_log(avctx, AV_LOG_ERROR, "Failed to set dimensions %d %d\n", w, h);
357  return ret;
358  }
359  skip_bits(gb, 5); //frame rate
360  v->res_x8 = get_bits1(gb);
361  if (get_bits1(gb)) { // something to do with DC VLC selection
362  av_log(avctx, AV_LOG_ERROR, "Unsupported sprite feature\n");
363  return -1;
364  }
365  skip_bits(gb, 3); //slice code
366  v->res_rtm_flag = 0;
367  } else {
368  v->res_rtm_flag = get_bits1(gb); //reserved
369  }
370  //TODO: figure out what they mean (always 0x402F)
371  if (!v->res_fasttx)
372  skip_bits(gb, 16);
373  av_log(avctx, AV_LOG_DEBUG,
374  "Profile %i:\nfrmrtq_postproc=%i, bitrtq_postproc=%i\n"
375  "LoopFilter=%i, MultiRes=%i, FastUVMC=%i, Extended MV=%i\n"
376  "Rangered=%i, VSTransform=%i, Overlap=%i, SyncMarker=%i\n"
377  "DQuant=%i, Quantizer mode=%i, Max B-frames=%i\n",
379  v->s.loop_filter, v->multires, v->fastuvmc, v->extended_mv,
380  v->rangered, v->vstransform, v->overlap, v->resync_marker,
381  v->dquant, v->quantizer_mode, avctx->max_b_frames);
382  return 0;
383 }
384 
386 {
387  v->res_rtm_flag = 1;
388  v->level = get_bits(gb, 3);
389  if (v->level >= 5) {
390  av_log(v->s.avctx, AV_LOG_ERROR, "Reserved LEVEL %i\n",v->level);
391  }
392  v->chromaformat = get_bits(gb, 2);
393  if (v->chromaformat != 1) {
395  "Only 4:2:0 chroma format supported\n");
396  return -1;
397  }
398 
399  // (fps-2)/4 (->30)
400  v->frmrtq_postproc = get_bits(gb, 3); //common
401  // (bitrate-32kbps)/64kbps
402  v->bitrtq_postproc = get_bits(gb, 5); //common
403  v->postprocflag = get_bits1(gb); //common
404 
405  v->max_coded_width = (get_bits(gb, 12) + 1) << 1;
406  v->max_coded_height = (get_bits(gb, 12) + 1) << 1;
407  v->broadcast = get_bits1(gb);
408  v->interlace = get_bits1(gb);
409  v->tfcntrflag = get_bits1(gb);
410  v->finterpflag = get_bits1(gb);
411  skip_bits1(gb); // reserved
412 
414  "Advanced Profile level %i:\nfrmrtq_postproc=%i, bitrtq_postproc=%i\n"
415  "LoopFilter=%i, ChromaFormat=%i, Pulldown=%i, Interlace: %i\n"
416  "TFCTRflag=%i, FINTERPflag=%i\n",
419  v->tfcntrflag, v->finterpflag);
420 
421  v->psf = get_bits1(gb);
422  if (v->psf) { //PsF, 6.1.13
423  av_log(v->s.avctx, AV_LOG_ERROR, "Progressive Segmented Frame mode: not supported (yet)\n");
424  return -1;
425  }
426  v->s.max_b_frames = v->s.avctx->max_b_frames = 7;
427  if (get_bits1(gb)) { //Display Info - decoding is not affected by it
428  int w, h, ar = 0;
429  av_log(v->s.avctx, AV_LOG_DEBUG, "Display extended info:\n");
430  w = get_bits(gb, 14) + 1;
431  h = get_bits(gb, 14) + 1;
432  av_log(v->s.avctx, AV_LOG_DEBUG, "Display dimensions: %ix%i\n", w, h);
433  if (get_bits1(gb))
434  ar = get_bits(gb, 4);
435  if (ar && ar < 14) {
437  } else if (ar == 15) {
438  w = get_bits(gb, 8) + 1;
439  h = get_bits(gb, 8) + 1;
441  } else {
442  if (v->s.avctx->width > v->max_coded_width ||
443  v->s.avctx->height > v->max_coded_height) {
444  avpriv_request_sample(v->s.avctx, "Huge resolution");
445  } else
448  v->s.avctx->height * w,
449  v->s.avctx->width * h,
450  1 << 30);
451  }
453  av_log(v->s.avctx, AV_LOG_DEBUG, "Aspect: %i:%i\n",
456 
457  if (get_bits1(gb)) { //framerate stuff
458  if (get_bits1(gb)) {
459  v->s.avctx->framerate.den = 32;
460  v->s.avctx->framerate.num = get_bits(gb, 16) + 1;
461  } else {
462  int nr, dr;
463  nr = get_bits(gb, 8);
464  dr = get_bits(gb, 4);
465  if (nr > 0 && nr < 8 && dr > 0 && dr < 3) {
466  v->s.avctx->framerate.den = ff_vc1_fps_dr[dr - 1];
467  v->s.avctx->framerate.num = ff_vc1_fps_nr[nr - 1] * 1000;
468  }
469  }
470  if (v->broadcast) { // Pulldown may be present
471  v->s.avctx->ticks_per_frame = 2;
472  }
473  }
474 
475  if (get_bits1(gb)) {
476  v->color_prim = get_bits(gb, 8);
477  v->transfer_char = get_bits(gb, 8);
478  v->matrix_coef = get_bits(gb, 8);
479  }
480  }
481 
482  v->hrd_param_flag = get_bits1(gb);
483  if (v->hrd_param_flag) {
484  int i;
485  v->hrd_num_leaky_buckets = get_bits(gb, 5);
486  skip_bits(gb, 4); //bitrate exponent
487  skip_bits(gb, 4); //buffer size exponent
488  for (i = 0; i < v->hrd_num_leaky_buckets; i++) {
489  skip_bits(gb, 16); //hrd_rate[n]
490  skip_bits(gb, 16); //hrd_buffer[n]
491  }
492  }
493  return 0;
494 }
495 
497 {
498  int i;
499  int w,h;
500  int ret;
501 
502  av_log(avctx, AV_LOG_DEBUG, "Entry point: %08X\n", show_bits_long(gb, 32));
503  v->broken_link = get_bits1(gb);
504  v->closed_entry = get_bits1(gb);
505  v->panscanflag = get_bits1(gb);
506  v->refdist_flag = get_bits1(gb);
507  v->s.loop_filter = get_bits1(gb);
509  v->s.loop_filter = 0;
510  v->fastuvmc = get_bits1(gb);
511  v->extended_mv = get_bits1(gb);
512  v->dquant = get_bits(gb, 2);
513  v->vstransform = get_bits1(gb);
514  v->overlap = get_bits1(gb);
515  v->quantizer_mode = get_bits(gb, 2);
516 
517  if (v->hrd_param_flag) {
518  for (i = 0; i < v->hrd_num_leaky_buckets; i++) {
519  skip_bits(gb, 8); //hrd_full[n]
520  }
521  }
522 
523  if(get_bits1(gb)){
524  w = (get_bits(gb, 12)+1)<<1;
525  h = (get_bits(gb, 12)+1)<<1;
526  } else {
527  w = v->max_coded_width;
528  h = v->max_coded_height;
529  }
530  if ((ret = ff_set_dimensions(avctx, w, h)) < 0) {
531  av_log(avctx, AV_LOG_ERROR, "Failed to set dimensions %d %d\n", w, h);
532  return ret;
533  }
534 
535  if (v->extended_mv)
536  v->extended_dmv = get_bits1(gb);
537  if ((v->range_mapy_flag = get_bits1(gb))) {
538  av_log(avctx, AV_LOG_ERROR, "Luma scaling is not supported, expect wrong picture\n");
539  v->range_mapy = get_bits(gb, 3);
540  }
541  if ((v->range_mapuv_flag = get_bits1(gb))) {
542  av_log(avctx, AV_LOG_ERROR, "Chroma scaling is not supported, expect wrong picture\n");
543  v->range_mapuv = get_bits(gb, 3);
544  }
545 
546  av_log(avctx, AV_LOG_DEBUG, "Entry point info:\n"
547  "BrokenLink=%i, ClosedEntry=%i, PanscanFlag=%i\n"
548  "RefDist=%i, Postproc=%i, FastUVMC=%i, ExtMV=%i\n"
549  "DQuant=%i, VSTransform=%i, Overlap=%i, Qmode=%i\n",
552 
553  return 0;
554 }
555 
556 /* fill lookup tables for intensity compensation */
557 #define INIT_LUT(lumscale, lumshift, luty, lutuv, chain) do { \
558  int scale, shift, i; \
559  if (!lumscale) { \
560  scale = -64; \
561  shift = (255 - lumshift * 2) * 64; \
562  if (lumshift > 31) \
563  shift += 128 << 6; \
564  } else { \
565  scale = lumscale + 32; \
566  if (lumshift > 31) \
567  shift = (lumshift - 64) * 64; \
568  else \
569  shift = lumshift << 6; \
570  } \
571  for (i = 0; i < 256; i++) { \
572  int iy = chain ? luty[i] : i; \
573  int iu = chain ? lutuv[i] : i; \
574  luty[i] = av_clip_uint8((scale * iy + shift + 32) >> 6); \
575  lutuv[i] = av_clip_uint8((scale * (iu - 128) + 128*64 + 32) >> 6);\
576  } \
577  } while(0)
578 
579 static void rotate_luts(VC1Context *v)
580 {
581 #define ROTATE(DEF, L, N, C, A) do { \
582  if (v->s.pict_type == AV_PICTURE_TYPE_BI || v->s.pict_type == AV_PICTURE_TYPE_B) { \
583  C = A; \
584  } else { \
585  DEF; \
586  memcpy(&tmp, L , sizeof(tmp)); \
587  memcpy(L , N , sizeof(tmp)); \
588  memcpy(N , &tmp, sizeof(tmp)); \
589  C = N; \
590  } \
591  } while(0)
592 
593  ROTATE(int tmp, &v->last_use_ic, &v->next_use_ic, v->curr_use_ic, &v->aux_use_ic);
594  ROTATE(uint8_t tmp[2][256], v->last_luty, v->next_luty, v->curr_luty, v->aux_luty);
595  ROTATE(uint8_t tmp[2][256], v->last_lutuv, v->next_lutuv, v->curr_lutuv, v->aux_lutuv);
596 
597  INIT_LUT(32, 0, v->curr_luty[0], v->curr_lutuv[0], 0);
598  INIT_LUT(32, 0, v->curr_luty[1], v->curr_lutuv[1], 0);
599  *v->curr_use_ic = 0;
600 }
601 
603  int bfraction_lut_index = get_bits(gb, 3);
604 
605  if (bfraction_lut_index == 7)
606  bfraction_lut_index = 7 + get_bits(gb, 4);
607 
608  if (bfraction_lut_index == 21) {
609  av_log(v->s.avctx, AV_LOG_ERROR, "bfraction invalid\n");
610  return AVERROR_INVALIDDATA;
611  }
612  v->bfraction_lut_index = bfraction_lut_index;
614  return 0;
615 }
616 
618 {
619  int pqindex, lowquant, status;
620 
621  v->field_mode = 0;
622  v->fcm = PROGRESSIVE;
623  if (v->finterpflag)
624  v->interpfrm = get_bits1(gb);
625  if (v->s.avctx->codec_id == AV_CODEC_ID_MSS2)
626  v->respic =
627  v->rangered =
628  v->multires = get_bits(gb, 2) == 1;
629  else
630  skip_bits(gb, 2); //framecnt unused
631  v->rangeredfrm = 0;
632  if (v->rangered)
633  v->rangeredfrm = get_bits1(gb);
634  if (get_bits1(gb)) {
636  } else {
637  if (v->s.avctx->max_b_frames && !get_bits1(gb)) {
639  } else
641  }
642 
643  v->bi_type = 0;
644  if (v->s.pict_type == AV_PICTURE_TYPE_B) {
645  if (read_bfraction(v, gb) < 0)
646  return AVERROR_INVALIDDATA;
647  if (v->bfraction == 0) {
649  }
650  }
652  skip_bits(gb, 7); // skip buffer fullness
653 
654  if (v->parse_only)
655  return 0;
656 
657  /* calculate RND */
659  v->rnd = 1;
660  if (v->s.pict_type == AV_PICTURE_TYPE_P)
661  v->rnd ^= 1;
662 
663  if (get_bits_left(gb) < 5)
664  return AVERROR_INVALIDDATA;
665  /* Quantizer stuff */
666  pqindex = get_bits(gb, 5);
667  if (!pqindex)
668  return -1;
670  v->pq = ff_vc1_pquant_table[0][pqindex];
671  else
672  v->pq = ff_vc1_pquant_table[1][pqindex];
673  v->pqindex = pqindex;
674  if (pqindex < 9)
675  v->halfpq = get_bits1(gb);
676  else
677  v->halfpq = 0;
678  switch (v->quantizer_mode) {
680  v->pquantizer = pqindex < 9;
681  break;
682  case QUANT_NON_UNIFORM:
683  v->pquantizer = 0;
684  break;
686  v->pquantizer = get_bits1(gb);
687  break;
688  default:
689  v->pquantizer = 1;
690  break;
691  }
692  v->dquantfrm = 0;
693  if (v->extended_mv == 1)
694  v->mvrange = get_unary(gb, 0, 3);
695  v->k_x = v->mvrange + 9 + (v->mvrange >> 1); //k_x can be 9 10 12 13
696  v->k_y = v->mvrange + 8; //k_y can be 8 9 10 11
697  v->range_x = 1 << (v->k_x - 1);
698  v->range_y = 1 << (v->k_y - 1);
699  if (v->multires && v->s.pict_type != AV_PICTURE_TYPE_B)
700  v->respic = get_bits(gb, 2);
701 
702  if (v->res_x8 && (v->s.pict_type == AV_PICTURE_TYPE_I || v->s.pict_type == AV_PICTURE_TYPE_BI)) {
703  v->x8_type = get_bits1(gb);
704  } else
705  v->x8_type = 0;
706  ff_dlog(v->s.avctx, "%c Frame: QP=[%i]%i (+%i/2) %i\n",
707  (v->s.pict_type == AV_PICTURE_TYPE_P) ? 'P' : ((v->s.pict_type == AV_PICTURE_TYPE_I) ? 'I' : 'B'),
708  pqindex, v->pq, v->halfpq, v->rangeredfrm);
709 
710  if (v->first_pic_header_flag)
711  rotate_luts(v);
712 
713  switch (v->s.pict_type) {
714  case AV_PICTURE_TYPE_P:
715  v->tt_index = (v->pq > 4) + (v->pq > 12);
716 
717  lowquant = (v->pq > 12) ? 0 : 1;
718  v->mv_mode = ff_vc1_mv_pmode_table[lowquant][get_unary(gb, 1, 4)];
719  if (v->mv_mode == MV_PMODE_INTENSITY_COMP) {
720  v->mv_mode2 = ff_vc1_mv_pmode_table2[lowquant][get_unary(gb, 1, 3)];
721  v->lumscale = get_bits(gb, 6);
722  v->lumshift = get_bits(gb, 6);
723  v->last_use_ic = 1;
724  /* fill lookup tables for intensity compensation */
725  INIT_LUT(v->lumscale, v->lumshift, v->last_luty[0], v->last_lutuv[0], 1);
726  INIT_LUT(v->lumscale, v->lumshift, v->last_luty[1], v->last_lutuv[1], 1);
727  }
728  v->qs_last = v->s.quarter_sample;
729  if (v->mv_mode == MV_PMODE_INTENSITY_COMP) {
733  } else {
736  v->s.mspel = (v->mv_mode != MV_PMODE_1MV_HPEL_BILIN);
737  }
738 
739  if ((v->mv_mode == MV_PMODE_INTENSITY_COMP &&
740  v->mv_mode2 == MV_PMODE_MIXED_MV) ||
741  v->mv_mode == MV_PMODE_MIXED_MV) {
743  if (status < 0)
744  return -1;
745  av_log(v->s.avctx, AV_LOG_DEBUG, "MB MV Type plane encoding: "
746  "Imode: %i, Invert: %i\n", status>>1, status&1);
747  } else {
748  v->mv_type_is_raw = 0;
749  memset(v->mv_type_mb_plane, 0, v->s.mb_stride * v->s.mb_height);
750  }
752  if (status < 0)
753  return -1;
754  av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: "
755  "Imode: %i, Invert: %i\n", status>>1, status&1);
756 
757  if (get_bits_left(gb) < 4)
758  return AVERROR_INVALIDDATA;
759 
760  /* Hopefully this is correct for P-frames */
761  v->s.mv_table_index = get_bits(gb, 2); //but using ff_vc1_ tables
762  v->cbptab = get_bits(gb, 2);
764 
765  if (v->dquant) {
766  av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n");
768  }
769 
770  if (v->vstransform) {
771  v->ttmbf = get_bits1(gb);
772  if (v->ttmbf) {
773  v->ttfrm = ff_vc1_ttfrm_to_tt[get_bits(gb, 2)];
774  } else
775  v->ttfrm = 0; //FIXME Is that so ?
776  } else {
777  v->ttmbf = 1;
778  v->ttfrm = TT_8X8;
779  }
780  break;
781  case AV_PICTURE_TYPE_B:
782  v->tt_index = (v->pq > 4) + (v->pq > 12);
783 
785  v->qs_last = v->s.quarter_sample;
786  v->s.quarter_sample = (v->mv_mode == MV_PMODE_1MV);
787  v->s.mspel = v->s.quarter_sample;
788 
790  if (status < 0)
791  return -1;
792  av_log(v->s.avctx, AV_LOG_DEBUG, "MB Direct Type plane encoding: "
793  "Imode: %i, Invert: %i\n", status>>1, status&1);
795  if (status < 0)
796  return -1;
797  av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: "
798  "Imode: %i, Invert: %i\n", status>>1, status&1);
799 
800  v->s.mv_table_index = get_bits(gb, 2);
801  v->cbptab = get_bits(gb, 2);
803 
804  if (v->dquant) {
805  av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n");
807  }
808 
809  if (v->vstransform) {
810  v->ttmbf = get_bits1(gb);
811  if (v->ttmbf) {
812  v->ttfrm = ff_vc1_ttfrm_to_tt[get_bits(gb, 2)];
813  } else
814  v->ttfrm = 0;
815  } else {
816  v->ttmbf = 1;
817  v->ttfrm = TT_8X8;
818  }
819  break;
820  }
821 
822  if (!v->x8_type) {
823  /* AC Syntax */
824  v->c_ac_table_index = decode012(gb);
826  v->y_ac_table_index = decode012(gb);
827  }
828  /* DC Syntax */
829  v->s.dc_table_index = get_bits1(gb);
830  }
831 
832  if (v->s.pict_type == AV_PICTURE_TYPE_BI) {
834  v->bi_type = 1;
835  }
836  return 0;
837 }
838 
840 {
841  int pqindex, lowquant;
842  int status;
843  int field_mode, fcm;
844 
845  v->numref = 0;
846  v->p_frame_skipped = 0;
847  if (v->second_field) {
848  if (v->fcm != ILACE_FIELD || v->field_mode!=1)
849  return -1;
850  if (v->fptype & 4)
852  else
855  if (!v->pic_header_flag)
856  goto parse_common_info;
857  }
858 
859  field_mode = 0;
860  if (v->interlace) {
861  fcm = decode012(gb);
862  if (fcm) {
863  if (fcm == ILACE_FIELD)
864  field_mode = 1;
865  }
866  } else {
867  fcm = PROGRESSIVE;
868  }
869  if (!v->first_pic_header_flag && v->field_mode != field_mode)
870  return AVERROR_INVALIDDATA;
871  v->field_mode = field_mode;
872  v->fcm = fcm;
873 
874  av_assert0( v->s.mb_height == v->s.height + 15 >> 4
875  || v->s.mb_height == FFALIGN(v->s.height + 15 >> 4, 2));
876  if (v->field_mode) {
877  v->s.mb_height = FFALIGN(v->s.height + 15 >> 4, 2);
878  v->fptype = get_bits(gb, 3);
879  if (v->fptype & 4) // B-picture
881  else
883  } else {
884  v->s.mb_height = v->s.height + 15 >> 4;
885  switch (get_unary(gb, 0, 4)) {
886  case 0:
888  break;
889  case 1:
891  break;
892  case 2:
894  break;
895  case 3:
897  break;
898  case 4:
899  v->s.pict_type = AV_PICTURE_TYPE_P; // skipped pic
900  v->p_frame_skipped = 1;
901  break;
902  }
903  }
904  if (v->tfcntrflag)
905  skip_bits(gb, 8);
906  if (v->broadcast) {
907  if (!v->interlace || v->psf) {
908  v->rptfrm = get_bits(gb, 2);
909  } else {
910  v->tff = get_bits1(gb);
911  v->rff = get_bits1(gb);
912  }
913  } else {
914  v->tff = 1;
915  }
916  if (v->panscanflag) {
917  avpriv_report_missing_feature(v->s.avctx, "Pan-scan");
918  //...
919  }
920  if (v->p_frame_skipped) {
921  return 0;
922  }
923  v->rnd = get_bits1(gb);
924  if (v->interlace)
925  v->uvsamp = get_bits1(gb);
926  if (v->field_mode) {
927  if (!v->refdist_flag)
928  v->refdist = 0;
929  else if ((v->s.pict_type != AV_PICTURE_TYPE_B) && (v->s.pict_type != AV_PICTURE_TYPE_BI)) {
930  v->refdist = get_bits(gb, 2);
931  if (v->refdist == 3)
932  v->refdist += get_unary(gb, 0, 14);
933  if (v->refdist > 16)
934  return AVERROR_INVALIDDATA;
935  }
936  if ((v->s.pict_type == AV_PICTURE_TYPE_B) || (v->s.pict_type == AV_PICTURE_TYPE_BI)) {
937  if (read_bfraction(v, gb) < 0)
938  return AVERROR_INVALIDDATA;
939  v->frfd = (v->bfraction * v->refdist) >> 8;
940  v->brfd = v->refdist - v->frfd - 1;
941  if (v->brfd < 0)
942  v->brfd = 0;
943  }
944  goto parse_common_info;
945  }
946  if (v->fcm == PROGRESSIVE) {
947  if (v->finterpflag)
948  v->interpfrm = get_bits1(gb);
949  if (v->s.pict_type == AV_PICTURE_TYPE_B) {
950  if (read_bfraction(v, gb) < 0)
951  return AVERROR_INVALIDDATA;
952  if (v->bfraction == 0) {
953  v->s.pict_type = AV_PICTURE_TYPE_BI; /* XXX: should not happen here */
954  }
955  }
956  }
957 
958  parse_common_info:
959  if (v->field_mode)
960  v->cur_field_type = !(v->tff ^ v->second_field);
961  pqindex = get_bits(gb, 5);
962  if (!pqindex)
963  return -1;
965  v->pq = ff_vc1_pquant_table[0][pqindex];
966  else
967  v->pq = ff_vc1_pquant_table[1][pqindex];
968  v->pqindex = pqindex;
969  if (pqindex < 9)
970  v->halfpq = get_bits1(gb);
971  else
972  v->halfpq = 0;
973  switch (v->quantizer_mode) {
975  v->pquantizer = pqindex < 9;
976  break;
977  case QUANT_NON_UNIFORM:
978  v->pquantizer = 0;
979  break;
981  v->pquantizer = get_bits1(gb);
982  break;
983  default:
984  v->pquantizer = 1;
985  break;
986  }
987  v->dquantfrm = 0;
988  if (v->postprocflag)
989  v->postproc = get_bits(gb, 2);
990 
991  if (v->parse_only)
992  return 0;
993 
994  if (v->first_pic_header_flag)
995  rotate_luts(v);
996 
997  switch (v->s.pict_type) {
998  case AV_PICTURE_TYPE_I:
999  case AV_PICTURE_TYPE_BI:
1000  if (v->fcm == ILACE_FRAME) { //interlace frame picture
1002  if (status < 0)
1003  return -1;
1004  av_log(v->s.avctx, AV_LOG_DEBUG, "FIELDTX plane encoding: "
1005  "Imode: %i, Invert: %i\n", status>>1, status&1);
1006  } else
1007  v->fieldtx_is_raw = 0;
1009  if (status < 0)
1010  return -1;
1011  av_log(v->s.avctx, AV_LOG_DEBUG, "ACPRED plane encoding: "
1012  "Imode: %i, Invert: %i\n", status>>1, status&1);
1013  v->condover = CONDOVER_NONE;
1014  if (v->overlap && v->pq <= 8) {
1015  v->condover = decode012(gb);
1016  if (v->condover == CONDOVER_SELECT) {
1018  if (status < 0)
1019  return -1;
1020  av_log(v->s.avctx, AV_LOG_DEBUG, "CONDOVER plane encoding: "
1021  "Imode: %i, Invert: %i\n", status>>1, status&1);
1022  }
1023  }
1024  break;
1025  case AV_PICTURE_TYPE_P:
1026  if (v->field_mode) {
1027  v->numref = get_bits1(gb);
1028  if (!v->numref) {
1029  v->reffield = get_bits1(gb);
1030  v->ref_field_type[0] = v->reffield ^ !v->cur_field_type;
1031  }
1032  }
1033  if (v->extended_mv)
1034  v->mvrange = get_unary(gb, 0, 3);
1035  else
1036  v->mvrange = 0;
1037  if (v->interlace) {
1038  if (v->extended_dmv)
1039  v->dmvrange = get_unary(gb, 0, 3);
1040  else
1041  v->dmvrange = 0;
1042  if (v->fcm == ILACE_FRAME) { // interlaced frame picture
1043  v->fourmvswitch = get_bits1(gb);
1044  v->intcomp = get_bits1(gb);
1045  if (v->intcomp) {
1046  v->lumscale = get_bits(gb, 6);
1047  v->lumshift = get_bits(gb, 6);
1048  INIT_LUT(v->lumscale, v->lumshift, v->last_luty[0], v->last_lutuv[0], 1);
1049  INIT_LUT(v->lumscale, v->lumshift, v->last_luty[1], v->last_lutuv[1], 1);
1050  v->last_use_ic = 1;
1051  }
1053  if (status < 0)
1054  return -1;
1055  av_log(v->s.avctx, AV_LOG_DEBUG, "SKIPMB plane encoding: "
1056  "Imode: %i, Invert: %i\n", status>>1, status&1);
1057  v->mbmodetab = get_bits(gb, 2);
1058  if (v->fourmvswitch)
1060  else
1062  v->imvtab = get_bits(gb, 2);
1064  // interlaced p-picture cbpcy range is [1, 63]
1065  v->icbptab = get_bits(gb, 3);
1067  v->twomvbptab = get_bits(gb, 2);
1069  if (v->fourmvswitch) {
1070  v->fourmvbptab = get_bits(gb, 2);
1072  }
1073  }
1074  }
1075  v->k_x = v->mvrange + 9 + (v->mvrange >> 1); //k_x can be 9 10 12 13
1076  v->k_y = v->mvrange + 8; //k_y can be 8 9 10 11
1077  v->range_x = 1 << (v->k_x - 1);
1078  v->range_y = 1 << (v->k_y - 1);
1079 
1080  v->tt_index = (v->pq > 4) + (v->pq > 12);
1081  if (v->fcm != ILACE_FRAME) {
1082  int mvmode;
1083  mvmode = get_unary(gb, 1, 4);
1084  lowquant = (v->pq > 12) ? 0 : 1;
1085  v->mv_mode = ff_vc1_mv_pmode_table[lowquant][mvmode];
1086  if (v->mv_mode == MV_PMODE_INTENSITY_COMP) {
1087  int mvmode2;
1088  mvmode2 = get_unary(gb, 1, 3);
1089  v->mv_mode2 = ff_vc1_mv_pmode_table2[lowquant][mvmode2];
1090  if (v->field_mode) {
1091  v->intcompfield = decode210(gb) ^ 3;
1092  } else
1093  v->intcompfield = 3;
1094 
1095  v->lumscale2 = v->lumscale = 32;
1096  v->lumshift2 = v->lumshift = 0;
1097  if (v->intcompfield & 1) {
1098  v->lumscale = get_bits(gb, 6);
1099  v->lumshift = get_bits(gb, 6);
1100  }
1101  if ((v->intcompfield & 2) && v->field_mode) {
1102  v->lumscale2 = get_bits(gb, 6);
1103  v->lumshift2 = get_bits(gb, 6);
1104  } else if(!v->field_mode) {
1105  v->lumscale2 = v->lumscale;
1106  v->lumshift2 = v->lumshift;
1107  }
1108  if (v->field_mode && v->second_field) {
1109  if (v->cur_field_type) {
1110  INIT_LUT(v->lumscale , v->lumshift , v->curr_luty[v->cur_field_type^1], v->curr_lutuv[v->cur_field_type^1], 0);
1112  } else {
1115  }
1116  v->next_use_ic = *v->curr_use_ic = 1;
1117  } else {
1118  INIT_LUT(v->lumscale , v->lumshift , v->last_luty[0], v->last_lutuv[0], 1);
1119  INIT_LUT(v->lumscale2, v->lumshift2, v->last_luty[1], v->last_lutuv[1], 1);
1120  }
1121  v->last_use_ic = 1;
1122  }
1123  v->qs_last = v->s.quarter_sample;
1124  if (v->mv_mode == MV_PMODE_INTENSITY_COMP) {
1127  v->s.mspel = (v->mv_mode2 != MV_PMODE_1MV_HPEL_BILIN);
1128  } else {
1129  v->s.quarter_sample = (v->mv_mode != MV_PMODE_1MV_HPEL &&
1131  v->s.mspel = (v->mv_mode != MV_PMODE_1MV_HPEL_BILIN);
1132  }
1133  }
1134  if (v->fcm == PROGRESSIVE) { // progressive
1135  if ((v->mv_mode == MV_PMODE_INTENSITY_COMP &&
1137  || v->mv_mode == MV_PMODE_MIXED_MV) {
1139  if (status < 0)
1140  return -1;
1141  av_log(v->s.avctx, AV_LOG_DEBUG, "MB MV Type plane encoding: "
1142  "Imode: %i, Invert: %i\n", status>>1, status&1);
1143  } else {
1144  v->mv_type_is_raw = 0;
1145  memset(v->mv_type_mb_plane, 0, v->s.mb_stride * v->s.mb_height);
1146  }
1148  if (status < 0)
1149  return -1;
1150  av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: "
1151  "Imode: %i, Invert: %i\n", status>>1, status&1);
1152 
1153  /* Hopefully this is correct for P-frames */
1154  v->s.mv_table_index = get_bits(gb, 2); //but using ff_vc1_ tables
1155  v->cbptab = get_bits(gb, 2);
1157  } else if (v->fcm == ILACE_FRAME) { // frame interlaced
1158  v->qs_last = v->s.quarter_sample;
1159  v->s.quarter_sample = 1;
1160  v->s.mspel = 1;
1161  } else { // field interlaced
1162  v->mbmodetab = get_bits(gb, 3);
1163  v->imvtab = get_bits(gb, 2 + v->numref);
1164  if (!v->numref)
1166  else
1168  v->icbptab = get_bits(gb, 3);
1170  if ((v->mv_mode == MV_PMODE_INTENSITY_COMP &&
1172  v->fourmvbptab = get_bits(gb, 2);
1175  } else {
1177  }
1178  }
1179  if (v->dquant) {
1180  av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n");
1182  }
1183 
1184  if (v->vstransform) {
1185  v->ttmbf = get_bits1(gb);
1186  if (v->ttmbf) {
1187  v->ttfrm = ff_vc1_ttfrm_to_tt[get_bits(gb, 2)];
1188  } else
1189  v->ttfrm = 0; //FIXME Is that so ?
1190  } else {
1191  v->ttmbf = 1;
1192  v->ttfrm = TT_8X8;
1193  }
1194  break;
1195  case AV_PICTURE_TYPE_B:
1196  if (v->fcm == ILACE_FRAME) {
1197  if (read_bfraction(v, gb) < 0)
1198  return AVERROR_INVALIDDATA;
1199  if (v->bfraction == 0) {
1200  return -1;
1201  }
1202  }
1203  if (v->extended_mv)
1204  v->mvrange = get_unary(gb, 0, 3);
1205  else
1206  v->mvrange = 0;
1207  v->k_x = v->mvrange + 9 + (v->mvrange >> 1); //k_x can be 9 10 12 13
1208  v->k_y = v->mvrange + 8; //k_y can be 8 9 10 11
1209  v->range_x = 1 << (v->k_x - 1);
1210  v->range_y = 1 << (v->k_y - 1);
1211 
1212  v->tt_index = (v->pq > 4) + (v->pq > 12);
1213 
1214  if (v->field_mode) {
1215  int mvmode;
1216  av_log(v->s.avctx, AV_LOG_DEBUG, "B Fields\n");
1217  if (v->extended_dmv)
1218  v->dmvrange = get_unary(gb, 0, 3);
1219  mvmode = get_unary(gb, 1, 3);
1220  lowquant = (v->pq > 12) ? 0 : 1;
1221  v->mv_mode = ff_vc1_mv_pmode_table2[lowquant][mvmode];
1222  v->qs_last = v->s.quarter_sample;
1224  v->s.mspel = (v->mv_mode != MV_PMODE_1MV_HPEL_BILIN);
1226  if (status < 0)
1227  return -1;
1228  av_log(v->s.avctx, AV_LOG_DEBUG, "MB Forward Type plane encoding: "
1229  "Imode: %i, Invert: %i\n", status>>1, status&1);
1230  v->mbmodetab = get_bits(gb, 3);
1231  if (v->mv_mode == MV_PMODE_MIXED_MV)
1233  else
1235  v->imvtab = get_bits(gb, 3);
1237  v->icbptab = get_bits(gb, 3);
1239  if (v->mv_mode == MV_PMODE_MIXED_MV) {
1240  v->fourmvbptab = get_bits(gb, 2);
1242  }
1243  v->numref = 1; // interlaced field B pictures are always 2-ref
1244  } else if (v->fcm == ILACE_FRAME) {
1245  if (v->extended_dmv)
1246  v->dmvrange = get_unary(gb, 0, 3);
1247  if (get_bits1(gb)) /* intcomp - present but shall always be 0 */
1248  av_log(v->s.avctx, AV_LOG_WARNING, "Intensity compensation set for B picture\n");
1249  v->intcomp = 0;
1250  v->mv_mode = MV_PMODE_1MV;
1251  v->fourmvswitch = 0;
1252  v->qs_last = v->s.quarter_sample;
1253  v->s.quarter_sample = 1;
1254  v->s.mspel = 1;
1256  if (status < 0)
1257  return -1;
1258  av_log(v->s.avctx, AV_LOG_DEBUG, "MB Direct Type plane encoding: "
1259  "Imode: %i, Invert: %i\n", status>>1, status&1);
1261  if (status < 0)
1262  return -1;
1263  av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: "
1264  "Imode: %i, Invert: %i\n", status>>1, status&1);
1265  v->mbmodetab = get_bits(gb, 2);
1267  v->imvtab = get_bits(gb, 2);
1269  // interlaced p/b-picture cbpcy range is [1, 63]
1270  v->icbptab = get_bits(gb, 3);
1272  v->twomvbptab = get_bits(gb, 2);
1274  v->fourmvbptab = get_bits(gb, 2);
1276  } else {
1278  v->qs_last = v->s.quarter_sample;
1279  v->s.quarter_sample = (v->mv_mode == MV_PMODE_1MV);
1280  v->s.mspel = v->s.quarter_sample;
1282  if (status < 0)
1283  return -1;
1284  av_log(v->s.avctx, AV_LOG_DEBUG, "MB Direct Type plane encoding: "
1285  "Imode: %i, Invert: %i\n", status>>1, status&1);
1287  if (status < 0)
1288  return -1;
1289  av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: "
1290  "Imode: %i, Invert: %i\n", status>>1, status&1);
1291  v->s.mv_table_index = get_bits(gb, 2);
1292  v->cbptab = get_bits(gb, 2);
1294  }
1295 
1296  if (v->dquant) {
1297  av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n");
1299  }
1300 
1301  if (v->vstransform) {
1302  v->ttmbf = get_bits1(gb);
1303  if (v->ttmbf) {
1304  v->ttfrm = ff_vc1_ttfrm_to_tt[get_bits(gb, 2)];
1305  } else
1306  v->ttfrm = 0;
1307  } else {
1308  v->ttmbf = 1;
1309  v->ttfrm = TT_8X8;
1310  }
1311  break;
1312  }
1313 
1314 
1315  /* AC Syntax */
1316  v->c_ac_table_index = decode012(gb);
1318  v->y_ac_table_index = decode012(gb);
1319  }
1320  else if (v->fcm != PROGRESSIVE && !v->s.quarter_sample) {
1321  v->range_x <<= 1;
1322  v->range_y <<= 1;
1323  }
1324 
1325  /* DC Syntax */
1326  v->s.dc_table_index = get_bits1(gb);
1328  && v->dquant) {
1329  av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n");
1331  }
1332 
1333  v->bi_type = (v->s.pict_type == AV_PICTURE_TYPE_BI);
1334  if (v->bi_type)
1336 
1337  return 0;
1338 }
rotate_luts
static void rotate_luts(VC1Context *v)
Definition: vc1.c:579
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:186
VC1Context::lumscale2
uint8_t lumscale2
for interlaced field P picture
Definition: vc1.h:335
IMODE_RAW
@ IMODE_RAW
Definition: vc1.h:159
status
they must not be accessed directly The fifo field contains the frames that are queued in the input for processing by the filter The status_in and status_out fields contains the queued status(EOF or error) of the link
VC1Context::next_luty
uint8_t next_luty[2][256]
Definition: vc1.h:293
ff_vc1_2ref_mvdata_vlc
VLC ff_vc1_2ref_mvdata_vlc[8]
Definition: vc1data.c:122
VC1Context::mbmodetab
int mbmodetab
Definition: vc1.h:367
show_bits_long
static unsigned int show_bits_long(GetBitContext *s, int n)
Show 0-32 bits.
Definition: get_bits.h:474
get_bits_left
static int get_bits_left(GetBitContext *gb)
Definition: get_bits.h:664
VC1Context
The VC1 Context.
Definition: vc1.h:173
PROGRESSIVE
@ PROGRESSIVE
in the bitstream is reported as 00b
Definition: vc1.h:149
VC1Context::condover
uint8_t condover
Definition: vc1.h:324
DQPROFILE_DOUBLE_EDGES
@ DQPROFILE_DOUBLE_EDGES
Definition: vc1.h:49
MpegEncContext::gb
GetBitContext gb
Definition: mpegvideo.h:426
VC1Context::intcomp
int intcomp
Definition: vc1.h:334
VC1Context::overlap
int overlap
overlapped transforms in use
Definition: vc1.h:224
VC1Context::dqprofile
uint8_t dqprofile
Definition: vc1.h:244
VC1Context::interlace
int interlace
Progressive/interlaced (RPTFTM syntax element)
Definition: vc1.h:199
VC1Context::altpq
uint8_t altpq
Current/alternate frame quantizer scale.
Definition: vc1.h:236
VC1Context::curr_luty
uint8_t(* curr_luty)[256]
Definition: vc1.h:294
vc1.h
MpegEncContext::max_b_frames
int max_b_frames
max number of B-frames for encoding
Definition: mpegvideo.h:105
ILACE_FRAME
@ ILACE_FRAME
in the bitstream is reported as 10b
Definition: vc1.h:150
decode210
static int BS_FUNC() decode210(BSCTX *bc)
Return decoded truncated unary code for the values 2, 1, 0.
Definition: bitstream_template.h:447
VC1Context::interpfrm
uint8_t interpfrm
Definition: vc1.h:302
ff_vc1_intfr_non4mv_mbmode_vlc
VLC ff_vc1_intfr_non4mv_mbmode_vlc[4]
Definition: vc1data.c:118
MV_PMODE_1MV_HPEL_BILIN
@ MV_PMODE_1MV_HPEL_BILIN
Definition: vc1.h:79
tmp
static uint8_t tmp[11]
Definition: aes_ctr.c:28
w
uint8_t w
Definition: llviddspenc.c:38
MpegEncContext::mb_width
int mb_width
Definition: mpegvideo.h:119
VC1Context::reffield
int reffield
if numref = 0 (1 reference) then reffield decides which
Definition: vc1.h:355
data
const char data[16]
Definition: mxf.c:146
MpegEncContext::mv_table_index
int mv_table_index
Definition: mpegvideo.h:410
VC1Context::fastuvmc
int fastuvmc
Rounding of qpel vector to hpel ? (not in Simple)
Definition: vc1.h:220
VC1Context::mv_type_mb_plane
uint8_t * mv_type_mb_plane
bitplane for mv_type == (4MV)
Definition: vc1.h:284
MV_PMODE_INTENSITY_COMP
@ MV_PMODE_INTENSITY_COMP
Definition: vc1.h:83
VC1Context::zz_8x4
const uint8_t * zz_8x4
Zigzag scan table for TT_8x4 coding mode.
Definition: vc1.h:239
mpegvideo.h
MpegEncContext::avctx
struct AVCodecContext * avctx
Definition: mpegvideo.h:85
VC1Context::imvtab
int imvtab
Definition: vc1.h:369
VC1Context::dmvrange
uint8_t dmvrange
Frame decoding info for interlaced picture.
Definition: vc1.h:332
VC1Context::closed_entry
uint8_t closed_entry
Closed entry point flag (CLOSED_ENTRY syntax element)
Definition: vc1.h:393
VC1Context::twomvbptab
int twomvbptab
Definition: vc1.h:370
ff_vc1_pixel_aspect
const AVRational ff_vc1_pixel_aspect[16]
Definition: vc1data.c:154
MpegEncContext::height
int height
picture size. must be a multiple of 16
Definition: mpegvideo.h:90
ff_set_dimensions
int ff_set_dimensions(AVCodecContext *s, int width, int height)
Check that the provided frame dimensions are valid and set them on the codec context.
Definition: utils.c:91
PROFILE_SIMPLE
@ PROFILE_SIMPLE
Definition: vc1_common.h:49
QUANT_NON_UNIFORM
@ QUANT_NON_UNIFORM
Non-uniform quant used for all frames.
Definition: vc1.h:40
VC1Context::last_use_ic
int last_use_ic
Definition: vc1.h:295
VC1Context::rptfrm
uint8_t rptfrm
Definition: vc1.h:310
ff_vc1_mv_pmode_table
const uint8_t ff_vc1_mv_pmode_table[2][5]
MV P mode - the 5th element is only used for mode 1.
Definition: vc1data.c:43
ff_vc1_parse_frame_header
int ff_vc1_parse_frame_header(VC1Context *v, GetBitContext *gb)
Definition: vc1.c:617
decode_colskip
static void decode_colskip(uint8_t *plane, int width, int height, int stride, GetBitContext *gb)
Decode columns by checking if they are skipped.
Definition: vc1.c:72
VC1Context::fieldtx_is_raw
int fieldtx_is_raw
Definition: vc1.h:344
PROFILE_COMPLEX
@ PROFILE_COMPLEX
TODO: WMV9 specific.
Definition: vc1_common.h:51
skip_bits
static void skip_bits(GetBitContext *s, int n)
Definition: get_bits.h:371
AVCodecContext::framerate
AVRational framerate
Definition: avcodec.h:1750
VC1Context::last_lutuv
uint8_t last_lutuv[2][256]
lookup tables used for intensity compensation
Definition: vc1.h:291
get_bits
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Definition: get_bits.h:325
ff_vc1_adv_progressive_4x8_zz
const uint8_t ff_vc1_adv_progressive_4x8_zz[32]
Definition: vc1data.c:196
ff_vc1_cbpcy_p_vlc
VLC ff_vc1_cbpcy_p_vlc[4]
Definition: vc1data.c:111
MpegEncContext::mb_height
int mb_height
number of MBs horizontally & vertically
Definition: mpegvideo.h:119
MpegEncContext::pict_type
int pict_type
AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, ...
Definition: mpegvideo.h:202
ILACE_FIELD
@ ILACE_FIELD
in the bitstream is reported as 11b
Definition: vc1.h:151
VC1Context::multires
int multires
frame-level RESPIC syntax element present
Definition: vc1.h:184
GetBitContext
Definition: get_bits.h:107
VC1Context::res_x8
int res_x8
reserved
Definition: vc1.h:183
VC1Context::first_pic_header_flag
int first_pic_header_flag
Definition: vc1.h:365
IMODE_DIFF2
@ IMODE_DIFF2
Definition: vc1.h:161
VC1Context::numref
int numref
number of past field pictures used as reference
Definition: vc1.h:353
ff_vc1_decode_sequence_header
int ff_vc1_decode_sequence_header(AVCodecContext *avctx, VC1Context *v, GetBitContext *gb)
Decode Simple/Main Profiles sequence header.
Definition: vc1.c:274
ff_vc1_4mv_block_pattern_vlc
VLC ff_vc1_4mv_block_pattern_vlc[4]
Definition: vc1data.c:113
av_reduce
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
Definition: rational.c:35
AVRational::num
int num
Numerator.
Definition: rational.h:59
decode_sequence_header_adv
static int decode_sequence_header_adv(VC1Context *v, GetBitContext *gb)
Definition: vc1.c:385
VC1Context::c_ac_table_index
int c_ac_table_index
AC coding set indexes.
Definition: vc1.h:252
VC1Context::k_y
int k_y
Number of bits for MVs (depends on MV range)
Definition: vc1.h:234
VC1Context::dquant
int dquant
How qscale varies with MBs, 2 bits (not in Simple)
Definition: vc1.h:222
CONDOVER_NONE
@ CONDOVER_NONE
Definition: vc1.h:137
VC1Context::refdist
int refdist
distance of the current picture from reference
Definition: vc1.h:352
ROTATE
#define ROTATE(DEF, L, N, C, A)
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
ff_vc1_norm6_vlc
VLC ff_vc1_norm6_vlc
Definition: vc1data.c:107
width
#define width
VC1Context::res_sprite
int res_sprite
Simple/Main Profile sequence header.
Definition: vc1.h:181
VC1Context::res_fasttx
int res_fasttx
reserved, always 1
Definition: vc1.h:185
VC1Context::range_mapuv_flag
uint8_t range_mapuv_flag
Definition: vc1.h:326
VC1Context::postprocflag
int postprocflag
Per-frame processing suggestion flag present.
Definition: vc1.h:197
IMODE_NORM2
@ IMODE_NORM2
Definition: vc1.h:160
VC1Context::imv_vlc
VLC * imv_vlc
Definition: vc1.h:338
AVCodecContext::ticks_per_frame
int ticks_per_frame
For some codecs, the time base is closer to the field rate than the frame rate.
Definition: avcodec.h:557
IMODE_DIFF6
@ IMODE_DIFF6
Definition: vc1.h:163
DQPROFILE_SINGLE_EDGE
@ DQPROFILE_SINGLE_EDGE
Definition: vc1.h:50
VC1Context::over_flags_plane
uint8_t * over_flags_plane
Overflags bitplane.
Definition: vc1.h:322
wmv2data.h
av_assert0
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:37
PROFILE_ADVANCED
@ PROFILE_ADVANCED
Definition: vc1_common.h:52
VC1Context::rangered
int rangered
RANGEREDFRM (range reduction) syntax element present at frame level.
Definition: vc1.h:187
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:201
QUANT_FRAME_IMPLICIT
@ QUANT_FRAME_IMPLICIT
Implicitly specified at frame level.
Definition: vc1.h:38
MpegEncContext::loop_filter
int loop_filter
Definition: mpegvideo.h:368
decode.h
VC1Context::hrd_param_flag
int hrd_param_flag
Presence of Hypothetical Reference Decoder parameters.
Definition: vc1.h:207
VC1Context::tt_index
int tt_index
Index for Transform Type tables (to decode TTMB)
Definition: vc1.h:283
VC1Context::last_luty
uint8_t last_luty[2][256]
Definition: vc1.h:291
VC1Context::rnd
int rnd
rounding control
Definition: vc1.h:296
AVCodecContext::codec_id
enum AVCodecID codec_id
Definition: avcodec.h:436
VC1Context::frfd
int frfd
Definition: vc1.h:364
MpegEncContext::mb_stride
int mb_stride
mb_width+1 used for some arrays to allow simple addressing of left & top MBs without sig11
Definition: mpegvideo.h:120
VC1Context::mv_mode
uint8_t mv_mode
Frame decoding info for all profiles.
Definition: vc1.h:231
VC1Context::dqsbedge
uint8_t dqsbedge
Definition: vc1.h:245
VC1Context::pq
uint8_t pq
Definition: vc1.h:236
vop_dquant_decoding
static int vop_dquant_decoding(VC1Context *v)
VOP Dquant decoding.
Definition: vc1.c:228
AVDISCARD_ALL
@ AVDISCARD_ALL
discard all
Definition: defs.h:76
VC1Context::forward_mb_plane
uint8_t * forward_mb_plane
bitplane for "forward" MBs
Definition: vc1.h:286
VC1Context::pqindex
int pqindex
raw pqindex used in coding set selection
Definition: vc1.h:260
VC1Context::skip_is_raw
int skip_is_raw
skip mb plane is not coded
Definition: vc1.h:290
VC1Context::range_mapy_flag
uint8_t range_mapy_flag
Definition: vc1.h:325
VC1Context::direct_mb_plane
uint8_t * direct_mb_plane
bitplane for "direct" MBs
Definition: vc1.h:285
VC1Context::lumscale
uint8_t lumscale
Luma compensation parameters.
Definition: vc1.h:267
VC1Context::field_mode
int field_mode
1 for interlaced field pictures
Definition: vc1.h:349
VC1Context::panscanflag
int panscanflag
NUMPANSCANWIN, TOPLEFT{X,Y}, BOTRIGHT{X,Y} present.
Definition: vc1.h:201
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
VC1Context::qs_last
int qs_last
if qpel has been used in the previous (tr.) picture
Definition: vc1.h:362
VC1Context::mvrange
uint8_t mvrange
Ranges:
Definition: vc1.h:280
ff_vc1_icbpcy_vlc
VLC ff_vc1_icbpcy_vlc[8]
Definition: vc1data.c:112
VC1Context::range_mapuv
uint8_t range_mapuv
Definition: vc1.h:328
AV_PICTURE_TYPE_I
@ AV_PICTURE_TYPE_I
Intra.
Definition: avutil.h:274
get_bits1
static unsigned int get_bits1(GetBitContext *s)
Definition: get_bits.h:378
VC1Context::fmb_is_raw
int fmb_is_raw
forward mb plane is raw
Definition: vc1.h:289
ff_set_sar
int ff_set_sar(AVCodecContext *avctx, AVRational sar)
Check that the provided sample aspect ratio is valid and set it on the codec context.
Definition: utils.c:106
ff_vc1_norm2_vlc
VLC ff_vc1_norm2_vlc
Definition: vc1data.c:106
VC1Context::twomvbp_vlc
VLC * twomvbp_vlc
Definition: vc1.h:339
VC1Context::resync_marker
int resync_marker
could this stream contain resync markers
Definition: vc1.h:398
VC1Context::cbptab
int cbptab
Definition: vc1.h:297
VC1Context::curr_lutuv
uint8_t((* curr_lutuv)[256]
Definition: vc1.h:294
get_vlc2
static av_always_inline int get_vlc2(GetBitContext *s, const VLCElem *table, int bits, int max_depth)
Parse a vlc code.
Definition: get_bits.h:631
VC1Context::halfpq
uint8_t halfpq
Uniform quant over image and qp+.5.
Definition: vc1.h:271
DQPROFILE_ALL_MBS
@ DQPROFILE_ALL_MBS
Definition: vc1.h:51
VC1Context::ttmbf
uint8_t ttmbf
Transform type flag.
Definition: vc1.h:256
get_unary
static int get_unary(GetBitContext *gb, int stop, int len)
Get unary code of limited length.
Definition: unary.h:46
VC1Context::refdist_flag
int refdist_flag
REFDIST syntax element present in II, IP, PI or PP field picture headers.
Definition: vc1.h:202
VC1Context::fieldtx_plane
uint8_t * fieldtx_plane
Definition: vc1.h:343
VC1Context::intcompfield
int intcompfield
which of the two fields to be intensity compensated
Definition: vc1.h:357
ff_dlog
#define ff_dlog(a,...)
Definition: tableprint_vlc.h:28
VC1Context::mv_mode2
uint8_t mv_mode2
Secondary MV coding mode (B-frames)
Definition: vc1.h:232
AVFrame::pict_type
enum AVPictureType pict_type
Picture type of the frame.
Definition: frame.h:427
VC1Context::ttfrm
int ttfrm
Transform type info present at frame level.
Definition: vc1.h:255
ff_wmv2_scantableB
const uint8_t ff_wmv2_scantableB[64]
Definition: wmv2data.c:30
VC1Context::bfraction
int16_t bfraction
Relative position % anchors=> how to scale MVs.
Definition: vc1.h:270
VC1Context::parse_only
int parse_only
Context is used within parser.
Definition: vc1.h:397
MV_PMODE_MIXED_MV
@ MV_PMODE_MIXED_MV
Definition: vc1.h:82
avpriv_report_missing_feature
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
ff_vc1_ttfrm_to_tt
const int ff_vc1_ttfrm_to_tt[4]
Definition: vc1data.c:40
ff_vc1_imode_vlc
VLC ff_vc1_imode_vlc
Definition: vc1data.c:105
VC1Context::fourmvswitch
int fourmvswitch
Definition: vc1.h:333
VC1Context::rangeredfrm
uint8_t rangeredfrm
Frame decoding info for S/M profiles only.
Definition: vc1.h:301
VC1Context::chromaformat
int chromaformat
2 bits, 2=4:2:0, only defined
Definition: vc1.h:196
ff_wmv2_scantableA
const uint8_t ff_wmv2_scantableA[64]
Definition: wmv2data.c:23
VC1Context::res_transtab
int res_transtab
reserved, always 0
Definition: vc1.h:186
VC1Context::next_use_ic
int next_use_ic
Definition: vc1.h:295
MpegEncContext::mbskip_table
uint8_t * mbskip_table
used to avoid copy if macroblock skipped (for black regions for example) and used for B-frame encodin...
Definition: mpegvideo.h:187
VC1Context::respic
uint8_t respic
Frame-level flag for resized images.
Definition: vc1.h:272
VC1Context::mbmode_vlc
VLC * mbmode_vlc
Definition: vc1.h:337
MpegEncContext::quarter_sample
int quarter_sample
1->qpel, 0->half pel ME/MC
Definition: mpegvideo.h:386
MV_PMODE_1MV_HPEL
@ MV_PMODE_1MV_HPEL
Definition: vc1.h:81
height
#define height
vc1data.h
offset
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
Definition: writing_filters.txt:86
VC1Context::broken_link
uint8_t broken_link
Broken link flag (BROKEN_LINK syntax element)
Definition: vc1.h:392
skip_bits1
static void skip_bits1(GetBitContext *s)
Definition: get_bits.h:403
VC1Context::tfcntrflag
int tfcntrflag
TFCNTR present.
Definition: vc1.h:200
AVCodecContext::skip_loop_filter
enum AVDiscard skip_loop_filter
Skip loop filtering for selected frames.
Definition: avcodec.h:1699
VC1Context::fptype
int fptype
Definition: vc1.h:350
unary.h
VC1_IMODE_VLC_BITS
#define VC1_IMODE_VLC_BITS
Definition: vc1data.h:58
AV_LOG_INFO
#define AV_LOG_INFO
Standard information.
Definition: log.h:191
AV_CODEC_ID_MSS2
@ AV_CODEC_ID_MSS2
Definition: codec_id.h:219
VC1Context::cur_field_type
int cur_field_type
0: top, 1: bottom
Definition: vc1.h:359
ff_vc1_fps_dr
const int ff_vc1_fps_dr[2]
Definition: vc1data.c:88
QUANT_FRAME_EXPLICIT
@ QUANT_FRAME_EXPLICIT
Explicitly specified at frame level.
Definition: vc1.h:39
MpegEncContext::current_picture_ptr
Picture * current_picture_ptr
pointer to the current picture
Definition: mpegvideo.h:174
VC1Context::k_x
int k_x
Number of bits for MVs (depends on MV range)
Definition: vc1.h:233
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:269
code
and forward the test the status of outputs and forward it to the corresponding return FFERROR_NOT_READY If the filters stores internally one or a few frame for some it can consider them to be part of the FIFO and delay acknowledging a status change accordingly Example code
Definition: filter_design.txt:178
invert
static void invert(float *h, int n)
Definition: asrc_sinc.c:198
VC1Context::range_x
int range_x
Definition: vc1.h:235
VC1Context::frmrtq_postproc
int frmrtq_postproc
3 bits,
Definition: vc1.h:217
decode012
static int BS_FUNC() decode012(BSCTX *bc)
Return decoded truncated unary code for the values 0, 1, 2.
Definition: bitstream_template.h:436
ff_vc1_decode_entry_point
int ff_vc1_decode_entry_point(AVCodecContext *avctx, VC1Context *v, GetBitContext *gb)
Definition: vc1.c:496
ff_vc1_parse_frame_header_adv
int ff_vc1_parse_frame_header_adv(VC1Context *v, GetBitContext *gb)
Definition: vc1.c:839
VC1Context::s
MpegEncContext s
Definition: vc1.h:174
VC1Context::max_coded_height
int max_coded_height
Definition: vc1.h:219
VC1Context::extended_mv
int extended_mv
Ext MV in P/B (not in Simple)
Definition: vc1.h:221
VC1Context::hrd_num_leaky_buckets
int hrd_num_leaky_buckets
Definition: vc1.h:317
VC1Context::zz_4x8
const uint8_t * zz_4x8
Zigzag scan table for TT_4x8 coding mode.
Definition: vc1.h:240
MpegEncContext::dc_table_index
int dc_table_index
Definition: mpegvideo.h:413
VC1Context::pic_header_flag
int pic_header_flag
Definition: vc1.h:366
VC1_NORM6_VLC_BITS
#define VC1_NORM6_VLC_BITS
Definition: vc1data.h:62
AVCodecContext::height
int height
Definition: avcodec.h:598
VC1Context::res_y411
int res_y411
reserved, old interlaced mode
Definition: vc1.h:182
avcodec.h
ff_vc1_2mv_block_pattern_vlc
VLC ff_vc1_2mv_block_pattern_vlc[4]
Definition: vc1data.c:114
stride
#define stride
Definition: h264pred_template.c:537
VC1Context::second_field
int second_field
Definition: vc1.h:351
ret
ret
Definition: filter_design.txt:187
VC1Context::y_ac_table_index
int y_ac_table_index
Luma index from AC2FRM element.
Definition: vc1.h:253
VC1Context::ref_field_type
int ref_field_type[2]
forward and backward reference field type (top or bottom)
Definition: vc1.h:360
ff_vc1_if_mmv_mbmode_vlc
VLC ff_vc1_if_mmv_mbmode_vlc[8]
Definition: vc1data.c:119
VC1Context::aux_luty
uint8_t aux_luty[2][256]
Definition: vc1.h:292
VC1Context::color_prim
int color_prim
8 bits, chroma coordinates of the color primaries
Definition: vc1.h:204
VC1Context::overflg_is_raw
int overflg_is_raw
Definition: vc1.h:323
MpegEncContext::mspel
int mspel
Definition: mpegvideo.h:423
VC1Context::pquantizer
uint8_t pquantizer
Uniform (over sequence) quantizer in use.
Definition: vc1.h:281
AVCodecContext
main external API structure.
Definition: avcodec.h:426
VC1Context::p_frame_skipped
int p_frame_skipped
Definition: vc1.h:382
ff_vc1_adv_progressive_8x4_zz
const uint8_t ff_vc1_adv_progressive_8x4_zz[32]
Definition: vc1data.c:189
read_bfraction
static int read_bfraction(VC1Context *v, GetBitContext *gb)
Definition: vc1.c:602
decode_rowskip
static void decode_rowskip(uint8_t *plane, int width, int height, int stride, GetBitContext *gb)
Decode rows by checking if they are skipped.
Definition: vc1.c:50
VC1Context::cbpcy_vlc
VLC * cbpcy_vlc
CBPCY VLC table.
Definition: vc1.h:282
VC1Context::bfraction_lut_index
uint8_t bfraction_lut_index
Index for BFRACTION value (see Table 40, reproduced into ff_vc1_bfraction_lut[])
Definition: vc1.h:391
AV_PICTURE_TYPE_B
@ AV_PICTURE_TYPE_B
Bi-dir predicted.
Definition: avutil.h:276
AVRational::den
int den
Denominator.
Definition: rational.h:60
Picture::f
struct AVFrame * f
Definition: mpegpicture.h:47
VC1Context::tff
uint8_t tff
Definition: vc1.h:310
VC1Context::x8_type
int x8_type
Definition: vc1.h:384
VC1Context::brfd
int brfd
reference frame distance (forward or backward)
Definition: vc1.h:364
VC1_NORM2_VLC_BITS
#define VC1_NORM2_VLC_BITS
Definition: vc1data.h:60
VC1Context::res_rtm_flag
int res_rtm_flag
reserved, set to 1
Definition: vc1.h:189
VC1Context::fourmvbptab
int fourmvbptab
Definition: vc1.h:371
VC1Context::profile
int profile
Sequence header data for all Profiles TODO: choose between ints, uint8_ts and monobit flags.
Definition: vc1.h:216
VC1Context::vstransform
int vstransform
variable-size [48]x[48] transform type + info
Definition: vc1.h:223
VLC::table
VLCElem * table
Definition: vlc.h:33
VC1Context::lumshift2
uint8_t lumshift2
Definition: vc1.h:336
VC1Context::matrix_coef
int matrix_coef
8 bits, Color primaries->YCbCr transform matrix
Definition: vc1.h:206
VC1Context::bi_type
int bi_type
Definition: vc1.h:383
VC1Context::range_y
int range_y
MV range.
Definition: vc1.h:235
VC1Context::dqbilevel
uint8_t dqbilevel
Definition: vc1.h:246
VC1Context::next_lutuv
uint8_t next_lutuv[2][256]
lookup tables used for intensity compensation
Definition: vc1.h:293
VC1Context::fcm
enum FrameCodingMode fcm
Frame decoding info for Advanced profile.
Definition: vc1.h:307
AV_PICTURE_TYPE_P
@ AV_PICTURE_TYPE_P
Predicted.
Definition: avutil.h:275
VC1Context::mv_type_is_raw
int mv_type_is_raw
mv type mb plane is not coded
Definition: vc1.h:287
VC1Context::psf
int psf
Progressive Segmented Frame.
Definition: vc1.h:209
IMODE_COLSKIP
@ IMODE_COLSKIP
Definition: vc1.h:165
AVCodecContext::max_b_frames
int max_b_frames
maximum number of B-frames between non-B-frames Note: The output will be delayed by max_b_frames+1 re...
Definition: avcodec.h:697
VC1Context::curr_use_ic
int * curr_use_ic
Definition: vc1.h:295
avpriv_request_sample
#define avpriv_request_sample(...)
Definition: tableprint_vlc.h:36
VC1Context::lumshift
uint8_t lumshift
Definition: vc1.h:268
ff_vc1_mv_pmode_table2
const uint8_t ff_vc1_mv_pmode_table2[2][4]
Definition: vc1data.c:47
VC1Context::broadcast
int broadcast
TFF/RFF present.
Definition: vc1.h:198
FFALIGN
#define FFALIGN(x, a)
Definition: macros.h:78
VC1Context::dmb_is_raw
int dmb_is_raw
direct mb plane is raw
Definition: vc1.h:288
ff_vc1_intfr_4mv_mbmode_vlc
VLC ff_vc1_intfr_4mv_mbmode_vlc[4]
Definition: vc1data.c:117
VC1Context::level
int level
Advanced Profile.
Definition: vc1.h:195
IMODE_ROWSKIP
@ IMODE_ROWSKIP
Definition: vc1.h:164
VC1Context::acpred_plane
uint8_t * acpred_plane
AC prediction flags bitplane.
Definition: vc1.h:320
TT_8X8
@ TT_8X8
Definition: vc1.h:112
AV_PICTURE_TYPE_BI
@ AV_PICTURE_TYPE_BI
BI type.
Definition: avutil.h:280
VC1Context::fourmvbp_vlc
VLC * fourmvbp_vlc
Definition: vc1.h:340
VC1Context::acpred_is_raw
int acpred_is_raw
Definition: vc1.h:321
ff_vc1_if_1mv_mbmode_vlc
VLC ff_vc1_if_1mv_mbmode_vlc[8]
Definition: vc1data.c:120
AVCodecContext::width
int width
picture width / height.
Definition: avcodec.h:598
VC1Context::finterpflag
int finterpflag
INTERPFRM present.
Definition: vc1.h:226
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
VC1Context::transfer_char
int transfer_char
8 bits, Opto-electronic transfer characteristics
Definition: vc1.h:205
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
VC1Context::icbptab
int icbptab
Definition: vc1.h:368
VC1Context::dquantfrm
uint8_t dquantfrm
pquant parameters
Definition: vc1.h:243
h
h
Definition: vp9dsp_template.c:2038
IMODE_NORM6
@ IMODE_NORM6
Definition: vc1.h:162
bitplane_decoding
static int bitplane_decoding(uint8_t *data, int *raw_flag, VC1Context *v)
Decode a bitplane's bits.
Definition: vc1.c:95
VC1Context::quantizer_mode
int quantizer_mode
2 bits, quantizer mode used for sequence, see QUANT_*
Definition: vc1.h:225
VC1Context::aux_use_ic
int aux_use_ic
Definition: vc1.h:295
ff_vc1_1ref_mvdata_vlc
VLC ff_vc1_1ref_mvdata_vlc[4]
Definition: vc1data.c:121
CONDOVER_SELECT
@ CONDOVER_SELECT
Definition: vc1.h:139
ff_vc1_bfraction_lut
const int16_t ff_vc1_bfraction_lut[23]
Definition: vc1data.c:142
MV_PMODE_1MV
@ MV_PMODE_1MV
Definition: vc1.h:80
VC1Context::postproc
uint8_t postproc
Definition: vc1.h:316
ff_vc1_fps_nr
const int ff_vc1_fps_nr[7]
Definition: vc1data.c:87
VC1Context::range_mapy
uint8_t range_mapy
Definition: vc1.h:327
VC1Context::uvsamp
uint8_t uvsamp
Definition: vc1.h:315
INIT_LUT
#define INIT_LUT(lumscale, lumshift, luty, lutuv, chain)
Definition: vc1.c:557
VC1Context::max_coded_width
int max_coded_width
Definition: vc1.h:219
VC1Context::extended_dmv
int extended_dmv
Additional extended dmv range at P/B-frame-level.
Definition: vc1.h:203
AVCodecContext::sample_aspect_ratio
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel.
Definition: avcodec.h:795
VC1Context::rff
uint8_t rff
Definition: vc1.h:310
VC1Context::aux_lutuv
uint8_t aux_lutuv[2][256]
lookup tables used for intensity compensation
Definition: vc1.h:292
ff_vc1_pquant_table
const uint8_t ff_vc1_pquant_table[3][32]
Definition: vc1data.c:89
VC1Context::bitrtq_postproc
int bitrtq_postproc
5 bits, quantized framerate-based postprocessing strength
Definition: vc1.h:218