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 #if FF_API_TICKS_PER_FRAME
423  if (v->broadcast) { // Pulldown may be present
424  v->s.avctx->ticks_per_frame = 2;
425  }
427 #endif
428 
429  v->psf = get_bits1(gb);
430  if (v->psf) { //PsF, 6.1.13
431  av_log(v->s.avctx, AV_LOG_ERROR, "Progressive Segmented Frame mode: not supported (yet)\n");
432  return -1;
433  }
434  v->s.max_b_frames = v->s.avctx->max_b_frames = 7;
435  if (get_bits1(gb)) { //Display Info - decoding is not affected by it
436  int w, h, ar = 0;
437  av_log(v->s.avctx, AV_LOG_DEBUG, "Display extended info:\n");
438  w = get_bits(gb, 14) + 1;
439  h = get_bits(gb, 14) + 1;
440  av_log(v->s.avctx, AV_LOG_DEBUG, "Display dimensions: %ix%i\n", w, h);
441  if (get_bits1(gb))
442  ar = get_bits(gb, 4);
443  if (ar && ar < 14) {
445  } else if (ar == 15) {
446  w = get_bits(gb, 8) + 1;
447  h = get_bits(gb, 8) + 1;
449  } else {
450  if (v->s.avctx->width > v->max_coded_width ||
451  v->s.avctx->height > v->max_coded_height) {
452  avpriv_request_sample(v->s.avctx, "Huge resolution");
453  } else
456  v->s.avctx->height * w,
457  v->s.avctx->width * h,
458  1 << 30);
459  }
461  av_log(v->s.avctx, AV_LOG_DEBUG, "Aspect: %i:%i\n",
464 
465  if (get_bits1(gb)) { //framerate stuff
466  if (get_bits1(gb)) {
467  v->s.avctx->framerate.den = 32;
468  v->s.avctx->framerate.num = get_bits(gb, 16) + 1;
469  } else {
470  int nr, dr;
471  nr = get_bits(gb, 8);
472  dr = get_bits(gb, 4);
473  if (nr > 0 && nr < 8 && dr > 0 && dr < 3) {
474  v->s.avctx->framerate.den = ff_vc1_fps_dr[dr - 1];
475  v->s.avctx->framerate.num = ff_vc1_fps_nr[nr - 1] * 1000;
476  }
477  }
478  }
479 
480  if (get_bits1(gb)) {
481  v->color_prim = get_bits(gb, 8);
482  v->transfer_char = get_bits(gb, 8);
483  v->matrix_coef = get_bits(gb, 8);
484  }
485  }
486 
487  v->hrd_param_flag = get_bits1(gb);
488  if (v->hrd_param_flag) {
489  int i;
490  v->hrd_num_leaky_buckets = get_bits(gb, 5);
491  skip_bits(gb, 4); //bitrate exponent
492  skip_bits(gb, 4); //buffer size exponent
493  for (i = 0; i < v->hrd_num_leaky_buckets; i++) {
494  skip_bits(gb, 16); //hrd_rate[n]
495  skip_bits(gb, 16); //hrd_buffer[n]
496  }
497  }
498  return 0;
499 }
500 
502 {
503  int i;
504  int w,h;
505  int ret;
506 
507  av_log(avctx, AV_LOG_DEBUG, "Entry point: %08X\n", show_bits_long(gb, 32));
508  v->broken_link = get_bits1(gb);
509  v->closed_entry = get_bits1(gb);
510  v->panscanflag = get_bits1(gb);
511  v->refdist_flag = get_bits1(gb);
512  v->s.loop_filter = get_bits1(gb);
514  v->s.loop_filter = 0;
515  v->fastuvmc = get_bits1(gb);
516  v->extended_mv = get_bits1(gb);
517  v->dquant = get_bits(gb, 2);
518  v->vstransform = get_bits1(gb);
519  v->overlap = get_bits1(gb);
520  v->quantizer_mode = get_bits(gb, 2);
521 
522  if (v->hrd_param_flag) {
523  for (i = 0; i < v->hrd_num_leaky_buckets; i++) {
524  skip_bits(gb, 8); //hrd_full[n]
525  }
526  }
527 
528  if(get_bits1(gb)){
529  w = (get_bits(gb, 12)+1)<<1;
530  h = (get_bits(gb, 12)+1)<<1;
531  } else {
532  w = v->max_coded_width;
533  h = v->max_coded_height;
534  }
535  if ((ret = ff_set_dimensions(avctx, w, h)) < 0) {
536  av_log(avctx, AV_LOG_ERROR, "Failed to set dimensions %d %d\n", w, h);
537  return ret;
538  }
539 
540  if (v->extended_mv)
541  v->extended_dmv = get_bits1(gb);
542  if ((v->range_mapy_flag = get_bits1(gb))) {
543  av_log(avctx, AV_LOG_ERROR, "Luma scaling is not supported, expect wrong picture\n");
544  v->range_mapy = get_bits(gb, 3);
545  }
546  if ((v->range_mapuv_flag = get_bits1(gb))) {
547  av_log(avctx, AV_LOG_ERROR, "Chroma scaling is not supported, expect wrong picture\n");
548  v->range_mapuv = get_bits(gb, 3);
549  }
550 
551  av_log(avctx, AV_LOG_DEBUG, "Entry point info:\n"
552  "BrokenLink=%i, ClosedEntry=%i, PanscanFlag=%i\n"
553  "RefDist=%i, Postproc=%i, FastUVMC=%i, ExtMV=%i\n"
554  "DQuant=%i, VSTransform=%i, Overlap=%i, Qmode=%i\n",
557 
558  return 0;
559 }
560 
561 /* fill lookup tables for intensity compensation */
562 #define INIT_LUT(lumscale, lumshift, luty, lutuv, chain) do { \
563  int scale, shift, i; \
564  if (!lumscale) { \
565  scale = -64; \
566  shift = (255 - lumshift * 2) * 64; \
567  if (lumshift > 31) \
568  shift += 128 << 6; \
569  } else { \
570  scale = lumscale + 32; \
571  if (lumshift > 31) \
572  shift = (lumshift - 64) * 64; \
573  else \
574  shift = lumshift << 6; \
575  } \
576  for (i = 0; i < 256; i++) { \
577  int iy = chain ? luty[i] : i; \
578  int iu = chain ? lutuv[i] : i; \
579  luty[i] = av_clip_uint8((scale * iy + shift + 32) >> 6); \
580  lutuv[i] = av_clip_uint8((scale * (iu - 128) + 128*64 + 32) >> 6);\
581  } \
582  } while(0)
583 
584 static void rotate_luts(VC1Context *v)
585 {
586 #define ROTATE(DEF, L, N, C, A) do { \
587  if (v->s.pict_type == AV_PICTURE_TYPE_BI || v->s.pict_type == AV_PICTURE_TYPE_B) { \
588  C = A; \
589  } else { \
590  DEF; \
591  memcpy(&tmp, L , sizeof(tmp)); \
592  memcpy(L , N , sizeof(tmp)); \
593  memcpy(N , &tmp, sizeof(tmp)); \
594  C = N; \
595  } \
596  } while(0)
597 
598  ROTATE(int tmp, &v->last_use_ic, &v->next_use_ic, v->curr_use_ic, &v->aux_use_ic);
599  ROTATE(uint8_t tmp[2][256], v->last_luty, v->next_luty, v->curr_luty, v->aux_luty);
600  ROTATE(uint8_t tmp[2][256], v->last_lutuv, v->next_lutuv, v->curr_lutuv, v->aux_lutuv);
601 
602  INIT_LUT(32, 0, v->curr_luty[0], v->curr_lutuv[0], 0);
603  INIT_LUT(32, 0, v->curr_luty[1], v->curr_lutuv[1], 0);
604  *v->curr_use_ic = 0;
605 }
606 
608  int bfraction_lut_index = get_bits(gb, 3);
609 
610  if (bfraction_lut_index == 7)
611  bfraction_lut_index = 7 + get_bits(gb, 4);
612 
613  if (bfraction_lut_index == 21) {
614  av_log(v->s.avctx, AV_LOG_ERROR, "bfraction invalid\n");
615  return AVERROR_INVALIDDATA;
616  }
617  v->bfraction_lut_index = bfraction_lut_index;
619  return 0;
620 }
621 
623 {
624  int pqindex, lowquant, status;
625 
626  v->field_mode = 0;
627  v->fcm = PROGRESSIVE;
628  if (v->finterpflag)
629  v->interpfrm = get_bits1(gb);
630  if (v->s.avctx->codec_id == AV_CODEC_ID_MSS2)
631  v->respic =
632  v->rangered =
633  v->multires = get_bits(gb, 2) == 1;
634  else
635  skip_bits(gb, 2); //framecnt unused
636  v->rangeredfrm = 0;
637  if (v->rangered)
638  v->rangeredfrm = get_bits1(gb);
639  if (get_bits1(gb)) {
641  } else {
642  if (v->s.avctx->max_b_frames && !get_bits1(gb)) {
644  } else
646  }
647 
648  v->bi_type = 0;
649  if (v->s.pict_type == AV_PICTURE_TYPE_B) {
650  if (read_bfraction(v, gb) < 0)
651  return AVERROR_INVALIDDATA;
652  if (v->bfraction == 0) {
654  }
655  }
657  skip_bits(gb, 7); // skip buffer fullness
658 
659  if (v->parse_only)
660  return 0;
661 
662  /* calculate RND */
664  v->rnd = 1;
665  if (v->s.pict_type == AV_PICTURE_TYPE_P)
666  v->rnd ^= 1;
667 
668  if (get_bits_left(gb) < 5)
669  return AVERROR_INVALIDDATA;
670  /* Quantizer stuff */
671  pqindex = get_bits(gb, 5);
672  if (!pqindex)
673  return -1;
675  v->pq = ff_vc1_pquant_table[0][pqindex];
676  else
677  v->pq = ff_vc1_pquant_table[1][pqindex];
678  v->pqindex = pqindex;
679  if (pqindex < 9)
680  v->halfpq = get_bits1(gb);
681  else
682  v->halfpq = 0;
683  switch (v->quantizer_mode) {
685  v->pquantizer = pqindex < 9;
686  break;
687  case QUANT_NON_UNIFORM:
688  v->pquantizer = 0;
689  break;
691  v->pquantizer = get_bits1(gb);
692  break;
693  default:
694  v->pquantizer = 1;
695  break;
696  }
697  v->dquantfrm = 0;
698  if (v->extended_mv == 1)
699  v->mvrange = get_unary(gb, 0, 3);
700  v->k_x = v->mvrange + 9 + (v->mvrange >> 1); //k_x can be 9 10 12 13
701  v->k_y = v->mvrange + 8; //k_y can be 8 9 10 11
702  v->range_x = 1 << (v->k_x - 1);
703  v->range_y = 1 << (v->k_y - 1);
704  if (v->multires && v->s.pict_type != AV_PICTURE_TYPE_B)
705  v->respic = get_bits(gb, 2);
706 
707  if (v->res_x8 && (v->s.pict_type == AV_PICTURE_TYPE_I || v->s.pict_type == AV_PICTURE_TYPE_BI)) {
708  v->x8_type = get_bits1(gb);
709  } else
710  v->x8_type = 0;
711  ff_dlog(v->s.avctx, "%c Frame: QP=[%i]%i (+%i/2) %i\n",
712  (v->s.pict_type == AV_PICTURE_TYPE_P) ? 'P' : ((v->s.pict_type == AV_PICTURE_TYPE_I) ? 'I' : 'B'),
713  pqindex, v->pq, v->halfpq, v->rangeredfrm);
714 
715  if (v->first_pic_header_flag)
716  rotate_luts(v);
717 
718  switch (v->s.pict_type) {
719  case AV_PICTURE_TYPE_P:
720  v->tt_index = (v->pq > 4) + (v->pq > 12);
721 
722  lowquant = (v->pq > 12) ? 0 : 1;
723  v->mv_mode = ff_vc1_mv_pmode_table[lowquant][get_unary(gb, 1, 4)];
724  if (v->mv_mode == MV_PMODE_INTENSITY_COMP) {
725  v->mv_mode2 = ff_vc1_mv_pmode_table2[lowquant][get_unary(gb, 1, 3)];
726  v->lumscale = get_bits(gb, 6);
727  v->lumshift = get_bits(gb, 6);
728  v->last_use_ic = 1;
729  /* fill lookup tables for intensity compensation */
730  INIT_LUT(v->lumscale, v->lumshift, v->last_luty[0], v->last_lutuv[0], 1);
731  INIT_LUT(v->lumscale, v->lumshift, v->last_luty[1], v->last_lutuv[1], 1);
732  }
733  v->qs_last = v->s.quarter_sample;
734  if (v->mv_mode == MV_PMODE_INTENSITY_COMP) {
738  } else {
741  v->s.mspel = (v->mv_mode != MV_PMODE_1MV_HPEL_BILIN);
742  }
743 
744  if ((v->mv_mode == MV_PMODE_INTENSITY_COMP &&
745  v->mv_mode2 == MV_PMODE_MIXED_MV) ||
746  v->mv_mode == MV_PMODE_MIXED_MV) {
748  if (status < 0)
749  return -1;
750  av_log(v->s.avctx, AV_LOG_DEBUG, "MB MV Type plane encoding: "
751  "Imode: %i, Invert: %i\n", status>>1, status&1);
752  } else {
753  v->mv_type_is_raw = 0;
754  memset(v->mv_type_mb_plane, 0, v->s.mb_stride * v->s.mb_height);
755  }
757  if (status < 0)
758  return -1;
759  av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: "
760  "Imode: %i, Invert: %i\n", status>>1, status&1);
761 
762  if (get_bits_left(gb) < 4)
763  return AVERROR_INVALIDDATA;
764 
765  /* Hopefully this is correct for P-frames */
766  v->s.mv_table_index = get_bits(gb, 2); //but using ff_vc1_ tables
767  v->cbptab = get_bits(gb, 2);
769 
770  if (v->dquant) {
771  av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n");
773  }
774 
775  if (v->vstransform) {
776  v->ttmbf = get_bits1(gb);
777  if (v->ttmbf) {
778  v->ttfrm = ff_vc1_ttfrm_to_tt[get_bits(gb, 2)];
779  } else
780  v->ttfrm = 0; //FIXME Is that so ?
781  } else {
782  v->ttmbf = 1;
783  v->ttfrm = TT_8X8;
784  }
785  break;
786  case AV_PICTURE_TYPE_B:
787  v->tt_index = (v->pq > 4) + (v->pq > 12);
788 
790  v->qs_last = v->s.quarter_sample;
791  v->s.quarter_sample = (v->mv_mode == MV_PMODE_1MV);
792  v->s.mspel = v->s.quarter_sample;
793 
795  if (status < 0)
796  return -1;
797  av_log(v->s.avctx, AV_LOG_DEBUG, "MB Direct Type plane encoding: "
798  "Imode: %i, Invert: %i\n", status>>1, status&1);
800  if (status < 0)
801  return -1;
802  av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: "
803  "Imode: %i, Invert: %i\n", status>>1, status&1);
804 
805  v->s.mv_table_index = get_bits(gb, 2);
806  v->cbptab = get_bits(gb, 2);
808 
809  if (v->dquant) {
810  av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n");
812  }
813 
814  if (v->vstransform) {
815  v->ttmbf = get_bits1(gb);
816  if (v->ttmbf) {
817  v->ttfrm = ff_vc1_ttfrm_to_tt[get_bits(gb, 2)];
818  } else
819  v->ttfrm = 0;
820  } else {
821  v->ttmbf = 1;
822  v->ttfrm = TT_8X8;
823  }
824  break;
825  }
826 
827  if (!v->x8_type) {
828  /* AC Syntax */
829  v->c_ac_table_index = decode012(gb);
831  v->y_ac_table_index = decode012(gb);
832  }
833  /* DC Syntax */
834  v->s.dc_table_index = get_bits1(gb);
835  }
836 
837  if (v->s.pict_type == AV_PICTURE_TYPE_BI) {
839  v->bi_type = 1;
840  }
841  return 0;
842 }
843 
845 {
846  int pqindex, lowquant;
847  int status;
848  int field_mode, fcm;
849 
850  v->numref = 0;
851  v->p_frame_skipped = 0;
852  if (v->second_field) {
853  if (v->fcm != ILACE_FIELD || v->field_mode!=1)
854  return -1;
855  if (v->fptype & 4)
857  else
860  if (!v->pic_header_flag)
861  goto parse_common_info;
862  }
863 
864  field_mode = 0;
865  if (v->interlace) {
866  fcm = decode012(gb);
867  if (fcm) {
868  if (fcm == ILACE_FIELD)
869  field_mode = 1;
870  }
871  } else {
872  fcm = PROGRESSIVE;
873  }
874  if (!v->first_pic_header_flag && v->field_mode != field_mode)
875  return AVERROR_INVALIDDATA;
876  v->field_mode = field_mode;
877  v->fcm = fcm;
878 
879  av_assert0( v->s.mb_height == v->s.height + 15 >> 4
880  || v->s.mb_height == FFALIGN(v->s.height + 15 >> 4, 2));
881  if (v->field_mode) {
882  v->s.mb_height = FFALIGN(v->s.height + 15 >> 4, 2);
883  v->fptype = get_bits(gb, 3);
884  if (v->fptype & 4) // B-picture
886  else
888  } else {
889  v->s.mb_height = v->s.height + 15 >> 4;
890  switch (get_unary(gb, 0, 4)) {
891  case 0:
893  break;
894  case 1:
896  break;
897  case 2:
899  break;
900  case 3:
902  break;
903  case 4:
904  v->s.pict_type = AV_PICTURE_TYPE_P; // skipped pic
905  v->p_frame_skipped = 1;
906  break;
907  }
908  }
909  if (v->tfcntrflag)
910  skip_bits(gb, 8);
911  if (v->broadcast) {
912  if (!v->interlace || v->psf) {
913  v->rptfrm = get_bits(gb, 2);
914  } else {
915  v->tff = get_bits1(gb);
916  v->rff = get_bits1(gb);
917  }
918  } else {
919  v->tff = 1;
920  }
921  if (v->panscanflag) {
922  avpriv_report_missing_feature(v->s.avctx, "Pan-scan");
923  //...
924  }
925  if (v->p_frame_skipped) {
926  return 0;
927  }
928  v->rnd = get_bits1(gb);
929  if (v->interlace)
930  v->uvsamp = get_bits1(gb);
931  if (v->field_mode) {
932  if (!v->refdist_flag)
933  v->refdist = 0;
934  else if ((v->s.pict_type != AV_PICTURE_TYPE_B) && (v->s.pict_type != AV_PICTURE_TYPE_BI)) {
935  v->refdist = get_bits(gb, 2);
936  if (v->refdist == 3)
937  v->refdist += get_unary(gb, 0, 14);
938  if (v->refdist > 16)
939  return AVERROR_INVALIDDATA;
940  }
941  if ((v->s.pict_type == AV_PICTURE_TYPE_B) || (v->s.pict_type == AV_PICTURE_TYPE_BI)) {
942  if (read_bfraction(v, gb) < 0)
943  return AVERROR_INVALIDDATA;
944  v->frfd = (v->bfraction * v->refdist) >> 8;
945  v->brfd = v->refdist - v->frfd - 1;
946  if (v->brfd < 0)
947  v->brfd = 0;
948  }
949  goto parse_common_info;
950  }
951  if (v->fcm == PROGRESSIVE) {
952  if (v->finterpflag)
953  v->interpfrm = get_bits1(gb);
954  if (v->s.pict_type == AV_PICTURE_TYPE_B) {
955  if (read_bfraction(v, gb) < 0)
956  return AVERROR_INVALIDDATA;
957  if (v->bfraction == 0) {
958  v->s.pict_type = AV_PICTURE_TYPE_BI; /* XXX: should not happen here */
959  }
960  }
961  }
962 
963  parse_common_info:
964  if (v->field_mode)
965  v->cur_field_type = !(v->tff ^ v->second_field);
966  pqindex = get_bits(gb, 5);
967  if (!pqindex)
968  return -1;
970  v->pq = ff_vc1_pquant_table[0][pqindex];
971  else
972  v->pq = ff_vc1_pquant_table[1][pqindex];
973  v->pqindex = pqindex;
974  if (pqindex < 9)
975  v->halfpq = get_bits1(gb);
976  else
977  v->halfpq = 0;
978  switch (v->quantizer_mode) {
980  v->pquantizer = pqindex < 9;
981  break;
982  case QUANT_NON_UNIFORM:
983  v->pquantizer = 0;
984  break;
986  v->pquantizer = get_bits1(gb);
987  break;
988  default:
989  v->pquantizer = 1;
990  break;
991  }
992  v->dquantfrm = 0;
993  if (v->postprocflag)
994  v->postproc = get_bits(gb, 2);
995 
996  if (v->parse_only)
997  return 0;
998 
999  if (v->first_pic_header_flag)
1000  rotate_luts(v);
1001 
1002  switch (v->s.pict_type) {
1003  case AV_PICTURE_TYPE_I:
1004  case AV_PICTURE_TYPE_BI:
1005  if (v->fcm == ILACE_FRAME) { //interlace frame picture
1007  if (status < 0)
1008  return -1;
1009  av_log(v->s.avctx, AV_LOG_DEBUG, "FIELDTX plane encoding: "
1010  "Imode: %i, Invert: %i\n", status>>1, status&1);
1011  } else
1012  v->fieldtx_is_raw = 0;
1014  if (status < 0)
1015  return -1;
1016  av_log(v->s.avctx, AV_LOG_DEBUG, "ACPRED plane encoding: "
1017  "Imode: %i, Invert: %i\n", status>>1, status&1);
1018  v->condover = CONDOVER_NONE;
1019  if (v->overlap && v->pq <= 8) {
1020  v->condover = decode012(gb);
1021  if (v->condover == CONDOVER_SELECT) {
1023  if (status < 0)
1024  return -1;
1025  av_log(v->s.avctx, AV_LOG_DEBUG, "CONDOVER plane encoding: "
1026  "Imode: %i, Invert: %i\n", status>>1, status&1);
1027  }
1028  }
1029  break;
1030  case AV_PICTURE_TYPE_P:
1031  if (v->field_mode) {
1032  v->numref = get_bits1(gb);
1033  if (!v->numref) {
1034  v->reffield = get_bits1(gb);
1035  v->ref_field_type[0] = v->reffield ^ !v->cur_field_type;
1036  }
1037  }
1038  if (v->extended_mv)
1039  v->mvrange = get_unary(gb, 0, 3);
1040  else
1041  v->mvrange = 0;
1042  if (v->interlace) {
1043  if (v->extended_dmv)
1044  v->dmvrange = get_unary(gb, 0, 3);
1045  else
1046  v->dmvrange = 0;
1047  if (v->fcm == ILACE_FRAME) { // interlaced frame picture
1048  v->fourmvswitch = get_bits1(gb);
1049  v->intcomp = get_bits1(gb);
1050  if (v->intcomp) {
1051  v->lumscale = get_bits(gb, 6);
1052  v->lumshift = get_bits(gb, 6);
1053  INIT_LUT(v->lumscale, v->lumshift, v->last_luty[0], v->last_lutuv[0], 1);
1054  INIT_LUT(v->lumscale, v->lumshift, v->last_luty[1], v->last_lutuv[1], 1);
1055  v->last_use_ic = 1;
1056  }
1058  if (status < 0)
1059  return -1;
1060  av_log(v->s.avctx, AV_LOG_DEBUG, "SKIPMB plane encoding: "
1061  "Imode: %i, Invert: %i\n", status>>1, status&1);
1062  v->mbmodetab = get_bits(gb, 2);
1063  if (v->fourmvswitch)
1065  else
1067  v->imvtab = get_bits(gb, 2);
1069  // interlaced p-picture cbpcy range is [1, 63]
1070  v->icbptab = get_bits(gb, 3);
1072  v->twomvbptab = get_bits(gb, 2);
1074  if (v->fourmvswitch) {
1075  v->fourmvbptab = get_bits(gb, 2);
1077  }
1078  }
1079  }
1080  v->k_x = v->mvrange + 9 + (v->mvrange >> 1); //k_x can be 9 10 12 13
1081  v->k_y = v->mvrange + 8; //k_y can be 8 9 10 11
1082  v->range_x = 1 << (v->k_x - 1);
1083  v->range_y = 1 << (v->k_y - 1);
1084 
1085  v->tt_index = (v->pq > 4) + (v->pq > 12);
1086  if (v->fcm != ILACE_FRAME) {
1087  int mvmode;
1088  mvmode = get_unary(gb, 1, 4);
1089  lowquant = (v->pq > 12) ? 0 : 1;
1090  v->mv_mode = ff_vc1_mv_pmode_table[lowquant][mvmode];
1091  if (v->mv_mode == MV_PMODE_INTENSITY_COMP) {
1092  int mvmode2;
1093  mvmode2 = get_unary(gb, 1, 3);
1094  v->mv_mode2 = ff_vc1_mv_pmode_table2[lowquant][mvmode2];
1095  if (v->field_mode) {
1096  v->intcompfield = decode210(gb) ^ 3;
1097  } else
1098  v->intcompfield = 3;
1099 
1100  v->lumscale2 = v->lumscale = 32;
1101  v->lumshift2 = v->lumshift = 0;
1102  if (v->intcompfield & 1) {
1103  v->lumscale = get_bits(gb, 6);
1104  v->lumshift = get_bits(gb, 6);
1105  }
1106  if ((v->intcompfield & 2) && v->field_mode) {
1107  v->lumscale2 = get_bits(gb, 6);
1108  v->lumshift2 = get_bits(gb, 6);
1109  } else if(!v->field_mode) {
1110  v->lumscale2 = v->lumscale;
1111  v->lumshift2 = v->lumshift;
1112  }
1113  if (v->field_mode && v->second_field) {
1114  if (v->cur_field_type) {
1115  INIT_LUT(v->lumscale , v->lumshift , v->curr_luty[v->cur_field_type^1], v->curr_lutuv[v->cur_field_type^1], 0);
1117  } else {
1120  }
1121  v->next_use_ic = *v->curr_use_ic = 1;
1122  } else {
1123  INIT_LUT(v->lumscale , v->lumshift , v->last_luty[0], v->last_lutuv[0], 1);
1124  INIT_LUT(v->lumscale2, v->lumshift2, v->last_luty[1], v->last_lutuv[1], 1);
1125  }
1126  v->last_use_ic = 1;
1127  }
1128  v->qs_last = v->s.quarter_sample;
1129  if (v->mv_mode == MV_PMODE_INTENSITY_COMP) {
1132  v->s.mspel = (v->mv_mode2 != MV_PMODE_1MV_HPEL_BILIN);
1133  } else {
1134  v->s.quarter_sample = (v->mv_mode != MV_PMODE_1MV_HPEL &&
1136  v->s.mspel = (v->mv_mode != MV_PMODE_1MV_HPEL_BILIN);
1137  }
1138  }
1139  if (v->fcm == PROGRESSIVE) { // progressive
1140  if ((v->mv_mode == MV_PMODE_INTENSITY_COMP &&
1142  || v->mv_mode == MV_PMODE_MIXED_MV) {
1144  if (status < 0)
1145  return -1;
1146  av_log(v->s.avctx, AV_LOG_DEBUG, "MB MV Type plane encoding: "
1147  "Imode: %i, Invert: %i\n", status>>1, status&1);
1148  } else {
1149  v->mv_type_is_raw = 0;
1150  memset(v->mv_type_mb_plane, 0, v->s.mb_stride * v->s.mb_height);
1151  }
1153  if (status < 0)
1154  return -1;
1155  av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: "
1156  "Imode: %i, Invert: %i\n", status>>1, status&1);
1157 
1158  /* Hopefully this is correct for P-frames */
1159  v->s.mv_table_index = get_bits(gb, 2); //but using ff_vc1_ tables
1160  v->cbptab = get_bits(gb, 2);
1162  } else if (v->fcm == ILACE_FRAME) { // frame interlaced
1163  v->qs_last = v->s.quarter_sample;
1164  v->s.quarter_sample = 1;
1165  v->s.mspel = 1;
1166  } else { // field interlaced
1167  v->mbmodetab = get_bits(gb, 3);
1168  v->imvtab = get_bits(gb, 2 + v->numref);
1169  if (!v->numref)
1171  else
1173  v->icbptab = get_bits(gb, 3);
1175  if ((v->mv_mode == MV_PMODE_INTENSITY_COMP &&
1177  v->fourmvbptab = get_bits(gb, 2);
1180  } else {
1182  }
1183  }
1184  if (v->dquant) {
1185  av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n");
1187  }
1188 
1189  if (v->vstransform) {
1190  v->ttmbf = get_bits1(gb);
1191  if (v->ttmbf) {
1192  v->ttfrm = ff_vc1_ttfrm_to_tt[get_bits(gb, 2)];
1193  } else
1194  v->ttfrm = 0; //FIXME Is that so ?
1195  } else {
1196  v->ttmbf = 1;
1197  v->ttfrm = TT_8X8;
1198  }
1199  break;
1200  case AV_PICTURE_TYPE_B:
1201  if (v->fcm == ILACE_FRAME) {
1202  if (read_bfraction(v, gb) < 0)
1203  return AVERROR_INVALIDDATA;
1204  if (v->bfraction == 0) {
1205  return -1;
1206  }
1207  }
1208  if (v->extended_mv)
1209  v->mvrange = get_unary(gb, 0, 3);
1210  else
1211  v->mvrange = 0;
1212  v->k_x = v->mvrange + 9 + (v->mvrange >> 1); //k_x can be 9 10 12 13
1213  v->k_y = v->mvrange + 8; //k_y can be 8 9 10 11
1214  v->range_x = 1 << (v->k_x - 1);
1215  v->range_y = 1 << (v->k_y - 1);
1216 
1217  v->tt_index = (v->pq > 4) + (v->pq > 12);
1218 
1219  if (v->field_mode) {
1220  int mvmode;
1221  av_log(v->s.avctx, AV_LOG_DEBUG, "B Fields\n");
1222  if (v->extended_dmv)
1223  v->dmvrange = get_unary(gb, 0, 3);
1224  mvmode = get_unary(gb, 1, 3);
1225  lowquant = (v->pq > 12) ? 0 : 1;
1226  v->mv_mode = ff_vc1_mv_pmode_table2[lowquant][mvmode];
1227  v->qs_last = v->s.quarter_sample;
1229  v->s.mspel = (v->mv_mode != MV_PMODE_1MV_HPEL_BILIN);
1231  if (status < 0)
1232  return -1;
1233  av_log(v->s.avctx, AV_LOG_DEBUG, "MB Forward Type plane encoding: "
1234  "Imode: %i, Invert: %i\n", status>>1, status&1);
1235  v->mbmodetab = get_bits(gb, 3);
1236  if (v->mv_mode == MV_PMODE_MIXED_MV)
1238  else
1240  v->imvtab = get_bits(gb, 3);
1242  v->icbptab = get_bits(gb, 3);
1244  if (v->mv_mode == MV_PMODE_MIXED_MV) {
1245  v->fourmvbptab = get_bits(gb, 2);
1247  }
1248  v->numref = 1; // interlaced field B pictures are always 2-ref
1249  } else if (v->fcm == ILACE_FRAME) {
1250  if (v->extended_dmv)
1251  v->dmvrange = get_unary(gb, 0, 3);
1252  if (get_bits1(gb)) /* intcomp - present but shall always be 0 */
1253  av_log(v->s.avctx, AV_LOG_WARNING, "Intensity compensation set for B picture\n");
1254  v->intcomp = 0;
1255  v->mv_mode = MV_PMODE_1MV;
1256  v->fourmvswitch = 0;
1257  v->qs_last = v->s.quarter_sample;
1258  v->s.quarter_sample = 1;
1259  v->s.mspel = 1;
1261  if (status < 0)
1262  return -1;
1263  av_log(v->s.avctx, AV_LOG_DEBUG, "MB Direct Type plane encoding: "
1264  "Imode: %i, Invert: %i\n", status>>1, status&1);
1266  if (status < 0)
1267  return -1;
1268  av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: "
1269  "Imode: %i, Invert: %i\n", status>>1, status&1);
1270  v->mbmodetab = get_bits(gb, 2);
1272  v->imvtab = get_bits(gb, 2);
1274  // interlaced p/b-picture cbpcy range is [1, 63]
1275  v->icbptab = get_bits(gb, 3);
1277  v->twomvbptab = get_bits(gb, 2);
1279  v->fourmvbptab = get_bits(gb, 2);
1281  } else {
1283  v->qs_last = v->s.quarter_sample;
1284  v->s.quarter_sample = (v->mv_mode == MV_PMODE_1MV);
1285  v->s.mspel = v->s.quarter_sample;
1287  if (status < 0)
1288  return -1;
1289  av_log(v->s.avctx, AV_LOG_DEBUG, "MB Direct Type plane encoding: "
1290  "Imode: %i, Invert: %i\n", status>>1, status&1);
1292  if (status < 0)
1293  return -1;
1294  av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: "
1295  "Imode: %i, Invert: %i\n", status>>1, status&1);
1296  v->s.mv_table_index = get_bits(gb, 2);
1297  v->cbptab = get_bits(gb, 2);
1299  }
1300 
1301  if (v->dquant) {
1302  av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n");
1304  }
1305 
1306  if (v->vstransform) {
1307  v->ttmbf = get_bits1(gb);
1308  if (v->ttmbf) {
1309  v->ttfrm = ff_vc1_ttfrm_to_tt[get_bits(gb, 2)];
1310  } else
1311  v->ttfrm = 0;
1312  } else {
1313  v->ttmbf = 1;
1314  v->ttfrm = TT_8X8;
1315  }
1316  break;
1317  }
1318 
1319 
1320  /* AC Syntax */
1321  v->c_ac_table_index = decode012(gb);
1323  v->y_ac_table_index = decode012(gb);
1324  }
1325  else if (v->fcm != PROGRESSIVE && !v->s.quarter_sample) {
1326  v->range_x <<= 1;
1327  v->range_y <<= 1;
1328  }
1329 
1330  /* DC Syntax */
1331  v->s.dc_table_index = get_bits1(gb);
1333  && v->dquant) {
1334  av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n");
1336  }
1337 
1338  v->bi_type = (v->s.pict_type == AV_PICTURE_TYPE_BI);
1339  if (v->bi_type)
1341 
1342  return 0;
1343 }
rotate_luts
static void rotate_luts(VC1Context *v)
Definition: vc1.c:584
FF_ENABLE_DEPRECATION_WARNINGS
#define FF_ENABLE_DEPRECATION_WARNINGS
Definition: internal.h:73
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
VC1Context::next_luty
uint8_t next_luty[2][256]
Definition: vc1.h:293
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:495
get_bits_left
static int get_bits_left(GetBitContext *gb)
Definition: get_bits.h:695
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:425
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
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:118
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:148
MpegEncContext::mv_table_index
int mv_table_index
Definition: mpegvideo.h:409
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:94
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:622
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:381
AVCodecContext::framerate
AVRational framerate
Definition: avcodec.h:560
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:335
ff_vc1_adv_progressive_4x8_zz
const uint8_t ff_vc1_adv_progressive_4x8_zz[32]
Definition: vc1data.c:196
MpegEncContext::mb_height
int mb_height
number of MBs horizontally & vertically
Definition: mpegvideo.h:118
MpegEncContext::pict_type
int pict_type
AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, ...
Definition: mpegvideo.h:201
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
ff_vc1_if_1mv_mbmode_vlc
const VLCElem * ff_vc1_if_1mv_mbmode_vlc[8]
Definition: vc1data.c:120
GetBitContext
Definition: get_bits.h:108
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_norm6_vlc
VLCElem ff_vc1_norm6_vlc[556]
Definition: vc1data.c:107
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::imv_vlc
const VLCElem * imv_vlc
Definition: vc1.h:338
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
VC1Context::twomvbp_vlc
const VLCElem * twomvbp_vlc
Definition: vc1.h:339
ff_vc1_2mv_block_pattern_vlc
const VLCElem * ff_vc1_2mv_block_pattern_vlc[4]
Definition: vc1data.c:114
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
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:40
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:367
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:455
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:119
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:219
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
ff_vc1_cbpcy_p_vlc
const VLCElem * ff_vc1_cbpcy_p_vlc[4]
Definition: vc1data.c:111
ff_vc1_if_mmv_mbmode_vlc
const VLCElem * ff_vc1_if_mmv_mbmode_vlc[8]
Definition: vc1data.c:119
VC1Context::direct_mb_plane
uint8_t * direct_mb_plane
bitplane for "direct" MBs
Definition: vc1.h:285
ff_vc1_2ref_mvdata_vlc
const VLCElem * ff_vc1_2ref_mvdata_vlc[8]
Definition: vc1data.c:122
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
VC1Context::range_mapuv
uint8_t range_mapuv
Definition: vc1.h:328
AV_PICTURE_TYPE_I
@ AV_PICTURE_TYPE_I
Intra.
Definition: avutil.h:279
get_bits1
static unsigned int get_bits1(GetBitContext *s)
Definition: get_bits.h:388
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:109
VC1Context::mbmode_vlc
const VLCElem * mbmode_vlc
Definition: vc1.h:337
VC1Context::resync_marker
int resync_marker
could this stream contain resync markers
Definition: vc1.h:398
VC1Context::cbpcy_vlc
const VLCElem * cbpcy_vlc
CBPCY VLC table.
Definition: vc1.h:282
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:652
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
ff_vc1_icbpcy_vlc
const VLCElem * ff_vc1_icbpcy_vlc[8]
Definition: vc1data.c:112
AVFrame::pict_type
enum AVPictureType pict_type
Picture type of the frame.
Definition: frame.h:446
VC1Context::ttfrm
int ttfrm
Transform type info present at frame level.
Definition: vc1.h:255
ff_vc1_1ref_mvdata_vlc
const VLCElem * ff_vc1_1ref_mvdata_vlc[4]
Definition: vc1data.c:121
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_intfr_4mv_mbmode_vlc
const VLCElem * ff_vc1_intfr_4mv_mbmode_vlc[4]
Definition: vc1data.c:117
ff_vc1_ttfrm_to_tt
const int ff_vc1_ttfrm_to_tt[4]
Definition: vc1data.c:40
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:186
VC1Context::respic
uint8_t respic
Frame-level flag for resized images.
Definition: vc1.h:272
MpegEncContext::quarter_sample
int quarter_sample
1->qpel, 0->half pel ME/MC
Definition: mpegvideo.h:385
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:413
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:1805
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:173
VC1Context::k_x
int k_x
Number of bits for MVs (depends on MV range)
Definition: vc1.h:233
ff_vc1_intfr_non4mv_mbmode_vlc
const VLCElem * ff_vc1_intfr_non4mv_mbmode_vlc[4]
Definition: vc1data.c:118
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:255
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:184
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:501
ff_vc1_parse_frame_header_adv
int ff_vc1_parse_frame_header_adv(VC1Context *v, GetBitContext *gb)
Definition: vc1.c:844
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:412
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:618
VC1Context::res_y411
int res_y411
reserved, old interlaced mode
Definition: vc1.h:182
avcodec.h
stride
#define stride
Definition: h264pred_template.c:537
VC1Context::fourmvbp_vlc
const VLCElem * fourmvbp_vlc
Definition: vc1.h:340
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
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:422
VC1Context::pquantizer
uint8_t pquantizer
Uniform (over sequence) quantizer in use.
Definition: vc1.h:281
AVCodecContext
main external API structure.
Definition: avcodec.h:445
ff_vc1_imode_vlc
VLCElem ff_vc1_imode_vlc[1<< VC1_IMODE_VLC_BITS]
Definition: vc1data.c:105
VC1Context::p_frame_skipped
int p_frame_skipped
Definition: vc1.h:382
status
ov_status_e status
Definition: dnn_backend_openvino.c:120
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:607
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::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:281
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
AVCodecContext::ticks_per_frame
attribute_deprecated int ticks_per_frame
For some codecs, the time base is closer to the field rate than the frame rate.
Definition: avcodec.h:576
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
FF_DISABLE_DEPRECATION_WARNINGS
#define FF_DISABLE_DEPRECATION_WARNINGS
Definition: internal.h:72
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:280
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:795
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_norm2_vlc
VLCElem ff_vc1_norm2_vlc[1<< VC1_NORM2_VLC_BITS]
Definition: vc1data.c:106
ff_vc1_4mv_block_pattern_vlc
const VLCElem * ff_vc1_4mv_block_pattern_vlc[4]
Definition: vc1data.c:113
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
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:285
VC1Context::acpred_is_raw
int acpred_is_raw
Definition: vc1.h:321
AVCodecContext::width
int width
picture width / height.
Definition: avcodec.h:618
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
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:562
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:642
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