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 {
587  v->curr_use_ic = &v->aux_use_ic;
588  v->curr_luty = v->aux_luty;
589  v->curr_lutuv = v->aux_lutuv;
590  } else {
591 #define ROTATE(DEF, L, N, C) do { \
592  DEF; \
593  memcpy(&tmp, L , sizeof(tmp)); \
594  memcpy(L , N , sizeof(tmp)); \
595  memcpy(N , &tmp, sizeof(tmp)); \
596  C = N; \
597  } while(0)
598 
599  ROTATE(int tmp, &v->last_use_ic, &v->next_use_ic, v->curr_use_ic);
600  ROTATE(uint8_t tmp[2][256], v->last_luty, v->next_luty, v->curr_luty);
601  ROTATE(uint8_t tmp[2][256], v->last_lutuv, v->next_lutuv, v->curr_lutuv);
602  }
603 
604  INIT_LUT(32, 0, v->curr_luty[0], v->curr_lutuv[0], 0);
605  INIT_LUT(32, 0, v->curr_luty[1], v->curr_lutuv[1], 0);
606  *v->curr_use_ic = 0;
607 }
608 
610  int bfraction_lut_index = get_bits(gb, 3);
611 
612  if (bfraction_lut_index == 7)
613  bfraction_lut_index = 7 + get_bits(gb, 4);
614 
615  if (bfraction_lut_index == 21) {
616  av_log(v->s.avctx, AV_LOG_ERROR, "bfraction invalid\n");
617  return AVERROR_INVALIDDATA;
618  }
619  v->bfraction_lut_index = bfraction_lut_index;
621  return 0;
622 }
623 
625 {
626  int pqindex, lowquant, status;
627 
628  v->field_mode = 0;
629  v->fcm = PROGRESSIVE;
630  if (v->finterpflag)
631  v->interpfrm = get_bits1(gb);
632  if (v->s.avctx->codec_id == AV_CODEC_ID_MSS2)
633  v->respic =
634  v->rangered =
635  v->multires = get_bits(gb, 2) == 1;
636  else
637  skip_bits(gb, 2); //framecnt unused
638  v->rangeredfrm = 0;
639  if (v->rangered)
640  v->rangeredfrm = get_bits1(gb);
641  if (get_bits1(gb)) {
643  } else {
644  if (v->s.avctx->max_b_frames && !get_bits1(gb)) {
646  } else
648  }
649 
650  v->bi_type = 0;
651  if (v->s.pict_type == AV_PICTURE_TYPE_B) {
652  if (read_bfraction(v, gb) < 0)
653  return AVERROR_INVALIDDATA;
654  if (v->bfraction == 0) {
656  }
657  }
659  skip_bits(gb, 7); // skip buffer fullness
660 
661  if (v->parse_only)
662  return 0;
663 
664  /* calculate RND */
666  v->rnd = 1;
667  if (v->s.pict_type == AV_PICTURE_TYPE_P)
668  v->rnd ^= 1;
669 
670  if (get_bits_left(gb) < 5)
671  return AVERROR_INVALIDDATA;
672  /* Quantizer stuff */
673  pqindex = get_bits(gb, 5);
674  if (!pqindex)
675  return -1;
677  v->pq = ff_vc1_pquant_table[0][pqindex];
678  else
679  v->pq = ff_vc1_pquant_table[1][pqindex];
680  v->pqindex = pqindex;
681  if (pqindex < 9)
682  v->halfpq = get_bits1(gb);
683  else
684  v->halfpq = 0;
685  switch (v->quantizer_mode) {
687  v->pquantizer = pqindex < 9;
688  break;
689  case QUANT_NON_UNIFORM:
690  v->pquantizer = 0;
691  break;
693  v->pquantizer = get_bits1(gb);
694  break;
695  default:
696  v->pquantizer = 1;
697  break;
698  }
699  v->dquantfrm = 0;
700  if (v->extended_mv == 1)
701  v->mvrange = get_unary(gb, 0, 3);
702  v->k_x = v->mvrange + 9 + (v->mvrange >> 1); //k_x can be 9 10 12 13
703  v->k_y = v->mvrange + 8; //k_y can be 8 9 10 11
704  v->range_x = 1 << (v->k_x - 1);
705  v->range_y = 1 << (v->k_y - 1);
706  if (v->multires && v->s.pict_type != AV_PICTURE_TYPE_B)
707  v->respic = get_bits(gb, 2);
708 
709  if (v->res_x8 && (v->s.pict_type == AV_PICTURE_TYPE_I || v->s.pict_type == AV_PICTURE_TYPE_BI)) {
710  v->x8_type = get_bits1(gb);
711  } else
712  v->x8_type = 0;
713  ff_dlog(v->s.avctx, "%c Frame: QP=[%i]%i (+%i/2) %i\n",
714  (v->s.pict_type == AV_PICTURE_TYPE_P) ? 'P' : ((v->s.pict_type == AV_PICTURE_TYPE_I) ? 'I' : 'B'),
715  pqindex, v->pq, v->halfpq, v->rangeredfrm);
716 
717  if (v->first_pic_header_flag)
718  rotate_luts(v);
719 
720  switch (v->s.pict_type) {
721  case AV_PICTURE_TYPE_P:
722  v->tt_index = (v->pq > 4) + (v->pq > 12);
723 
724  lowquant = (v->pq > 12) ? 0 : 1;
725  v->mv_mode = ff_vc1_mv_pmode_table[lowquant][get_unary(gb, 1, 4)];
726  if (v->mv_mode == MV_PMODE_INTENSITY_COMP) {
727  v->mv_mode2 = ff_vc1_mv_pmode_table2[lowquant][get_unary(gb, 1, 3)];
728  v->lumscale = get_bits(gb, 6);
729  v->lumshift = get_bits(gb, 6);
730  v->last_use_ic = 1;
731  /* fill lookup tables for intensity compensation */
732  INIT_LUT(v->lumscale, v->lumshift, v->last_luty[0], v->last_lutuv[0], 1);
733  INIT_LUT(v->lumscale, v->lumshift, v->last_luty[1], v->last_lutuv[1], 1);
734  }
735  v->qs_last = v->s.quarter_sample;
736  if (v->mv_mode == MV_PMODE_INTENSITY_COMP) {
740  } else {
743  v->s.mspel = (v->mv_mode != MV_PMODE_1MV_HPEL_BILIN);
744  }
745 
746  if ((v->mv_mode == MV_PMODE_INTENSITY_COMP &&
747  v->mv_mode2 == MV_PMODE_MIXED_MV) ||
748  v->mv_mode == MV_PMODE_MIXED_MV) {
750  if (status < 0)
751  return -1;
752  av_log(v->s.avctx, AV_LOG_DEBUG, "MB MV Type plane encoding: "
753  "Imode: %i, Invert: %i\n", status>>1, status&1);
754  } else {
755  v->mv_type_is_raw = 0;
756  memset(v->mv_type_mb_plane, 0, v->s.mb_stride * v->s.mb_height);
757  }
759  if (status < 0)
760  return -1;
761  av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: "
762  "Imode: %i, Invert: %i\n", status>>1, status&1);
763 
764  if (get_bits_left(gb) < 4)
765  return AVERROR_INVALIDDATA;
766 
767  /* Hopefully this is correct for P-frames */
768  v->s.mv_table_index = get_bits(gb, 2); //but using ff_vc1_ tables
769  v->cbptab = get_bits(gb, 2);
771 
772  if (v->dquant) {
773  av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n");
775  }
776 
777  if (v->vstransform) {
778  v->ttmbf = get_bits1(gb);
779  if (v->ttmbf) {
780  v->ttfrm = ff_vc1_ttfrm_to_tt[get_bits(gb, 2)];
781  } else
782  v->ttfrm = 0; //FIXME Is that so ?
783  } else {
784  v->ttmbf = 1;
785  v->ttfrm = TT_8X8;
786  }
787  break;
788  case AV_PICTURE_TYPE_B:
789  v->tt_index = (v->pq > 4) + (v->pq > 12);
790 
792  v->qs_last = v->s.quarter_sample;
793  v->s.quarter_sample = (v->mv_mode == MV_PMODE_1MV);
794  v->s.mspel = v->s.quarter_sample;
795 
797  if (status < 0)
798  return -1;
799  av_log(v->s.avctx, AV_LOG_DEBUG, "MB Direct Type plane encoding: "
800  "Imode: %i, Invert: %i\n", status>>1, status&1);
802  if (status < 0)
803  return -1;
804  av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: "
805  "Imode: %i, Invert: %i\n", status>>1, status&1);
806 
807  v->s.mv_table_index = get_bits(gb, 2);
808  v->cbptab = get_bits(gb, 2);
810 
811  if (v->dquant) {
812  av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n");
814  }
815 
816  if (v->vstransform) {
817  v->ttmbf = get_bits1(gb);
818  if (v->ttmbf) {
819  v->ttfrm = ff_vc1_ttfrm_to_tt[get_bits(gb, 2)];
820  } else
821  v->ttfrm = 0;
822  } else {
823  v->ttmbf = 1;
824  v->ttfrm = TT_8X8;
825  }
826  break;
827  }
828 
829  if (!v->x8_type) {
830  /* AC Syntax */
831  v->c_ac_table_index = decode012(gb);
833  v->y_ac_table_index = decode012(gb);
834  }
835  /* DC Syntax */
836  v->s.dc_table_index = get_bits1(gb);
837  }
838 
839  if (v->s.pict_type == AV_PICTURE_TYPE_BI) {
841  v->bi_type = 1;
842  }
843  return 0;
844 }
845 
847 {
848  int pqindex, lowquant;
849  int status;
850  int field_mode, fcm;
851 
852  v->numref = 0;
853  v->p_frame_skipped = 0;
854  if (v->second_field) {
855  if (v->fcm != ILACE_FIELD || v->field_mode!=1)
856  return -1;
857  if (v->fptype & 4)
859  else
861  v->s.cur_pic.ptr->f->pict_type = v->s.pict_type;
862  if (!v->pic_header_flag)
863  goto parse_common_info;
864  }
865 
866  field_mode = 0;
867  if (v->interlace) {
868  fcm = decode012(gb);
869  if (fcm) {
870  if (fcm == ILACE_FIELD)
871  field_mode = 1;
872  }
873  } else {
874  fcm = PROGRESSIVE;
875  }
876  if (!v->first_pic_header_flag && v->field_mode != field_mode)
877  return AVERROR_INVALIDDATA;
878  v->field_mode = field_mode;
879  v->fcm = fcm;
880 
881  av_assert0( v->s.mb_height == v->s.height + 15 >> 4
882  || v->s.mb_height == FFALIGN(v->s.height + 15 >> 4, 2));
883  if (v->field_mode) {
884  v->s.mb_height = FFALIGN(v->s.height + 15 >> 4, 2);
885  v->fptype = get_bits(gb, 3);
886  if (v->fptype & 4) // B-picture
888  else
890  } else {
891  v->s.mb_height = v->s.height + 15 >> 4;
892  switch (get_unary(gb, 0, 4)) {
893  case 0:
895  break;
896  case 1:
898  break;
899  case 2:
901  break;
902  case 3:
904  break;
905  case 4:
906  v->s.pict_type = AV_PICTURE_TYPE_P; // skipped pic
907  v->p_frame_skipped = 1;
908  break;
909  }
910  }
911  if (v->tfcntrflag)
912  skip_bits(gb, 8);
913  if (v->broadcast) {
914  if (!v->interlace || v->psf) {
915  v->rptfrm = get_bits(gb, 2);
916  } else {
917  v->tff = get_bits1(gb);
918  v->rff = get_bits1(gb);
919  }
920  } else {
921  v->tff = 1;
922  }
923  if (v->panscanflag) {
924  avpriv_report_missing_feature(v->s.avctx, "Pan-scan");
925  //...
926  }
927  if (v->p_frame_skipped) {
928  return 0;
929  }
930  v->rnd = get_bits1(gb);
931  if (v->interlace)
932  v->uvsamp = get_bits1(gb);
933  if (v->field_mode) {
934  if (!v->refdist_flag)
935  v->refdist = 0;
936  else if ((v->s.pict_type != AV_PICTURE_TYPE_B) && (v->s.pict_type != AV_PICTURE_TYPE_BI)) {
937  v->refdist = get_bits(gb, 2);
938  if (v->refdist == 3)
939  v->refdist += get_unary(gb, 0, 14);
940  if (v->refdist > 16)
941  return AVERROR_INVALIDDATA;
942  }
943  if ((v->s.pict_type == AV_PICTURE_TYPE_B) || (v->s.pict_type == AV_PICTURE_TYPE_BI)) {
944  if (read_bfraction(v, gb) < 0)
945  return AVERROR_INVALIDDATA;
946  v->frfd = (v->bfraction * v->refdist) >> 8;
947  v->brfd = v->refdist - v->frfd - 1;
948  if (v->brfd < 0)
949  v->brfd = 0;
950  }
951  goto parse_common_info;
952  }
953  if (v->fcm == PROGRESSIVE) {
954  if (v->finterpflag)
955  v->interpfrm = get_bits1(gb);
956  if (v->s.pict_type == AV_PICTURE_TYPE_B) {
957  if (read_bfraction(v, gb) < 0)
958  return AVERROR_INVALIDDATA;
959  if (v->bfraction == 0) {
960  v->s.pict_type = AV_PICTURE_TYPE_BI; /* XXX: should not happen here */
961  }
962  }
963  }
964 
965  parse_common_info:
966  if (v->field_mode)
967  v->cur_field_type = !(v->tff ^ v->second_field);
968  pqindex = get_bits(gb, 5);
969  if (!pqindex)
970  return -1;
972  v->pq = ff_vc1_pquant_table[0][pqindex];
973  else
974  v->pq = ff_vc1_pquant_table[1][pqindex];
975  v->pqindex = pqindex;
976  if (pqindex < 9)
977  v->halfpq = get_bits1(gb);
978  else
979  v->halfpq = 0;
980  switch (v->quantizer_mode) {
982  v->pquantizer = pqindex < 9;
983  break;
984  case QUANT_NON_UNIFORM:
985  v->pquantizer = 0;
986  break;
988  v->pquantizer = get_bits1(gb);
989  break;
990  default:
991  v->pquantizer = 1;
992  break;
993  }
994  v->dquantfrm = 0;
995  if (v->postprocflag)
996  v->postproc = get_bits(gb, 2);
997 
998  if (v->parse_only)
999  return 0;
1000 
1001  if (v->first_pic_header_flag)
1002  rotate_luts(v);
1003 
1004  switch (v->s.pict_type) {
1005  case AV_PICTURE_TYPE_I:
1006  case AV_PICTURE_TYPE_BI:
1007  if (v->fcm == ILACE_FRAME) { //interlace frame picture
1009  if (status < 0)
1010  return -1;
1011  av_log(v->s.avctx, AV_LOG_DEBUG, "FIELDTX plane encoding: "
1012  "Imode: %i, Invert: %i\n", status>>1, status&1);
1013  } else
1014  v->fieldtx_is_raw = 0;
1016  if (status < 0)
1017  return -1;
1018  av_log(v->s.avctx, AV_LOG_DEBUG, "ACPRED plane encoding: "
1019  "Imode: %i, Invert: %i\n", status>>1, status&1);
1020  v->condover = CONDOVER_NONE;
1021  if (v->overlap && v->pq <= 8) {
1022  v->condover = decode012(gb);
1023  if (v->condover == CONDOVER_SELECT) {
1025  if (status < 0)
1026  return -1;
1027  av_log(v->s.avctx, AV_LOG_DEBUG, "CONDOVER plane encoding: "
1028  "Imode: %i, Invert: %i\n", status>>1, status&1);
1029  }
1030  }
1031  break;
1032  case AV_PICTURE_TYPE_P:
1033  if (v->field_mode) {
1034  v->numref = get_bits1(gb);
1035  if (!v->numref) {
1036  v->reffield = get_bits1(gb);
1037  v->ref_field_type[0] = v->reffield ^ !v->cur_field_type;
1038  }
1039  }
1040  if (v->extended_mv)
1041  v->mvrange = get_unary(gb, 0, 3);
1042  else
1043  v->mvrange = 0;
1044  if (v->interlace) {
1045  if (v->extended_dmv)
1046  v->dmvrange = get_unary(gb, 0, 3);
1047  else
1048  v->dmvrange = 0;
1049  if (v->fcm == ILACE_FRAME) { // interlaced frame picture
1050  v->fourmvswitch = get_bits1(gb);
1051  v->intcomp = get_bits1(gb);
1052  if (v->intcomp) {
1053  v->lumscale = get_bits(gb, 6);
1054  v->lumshift = get_bits(gb, 6);
1055  INIT_LUT(v->lumscale, v->lumshift, v->last_luty[0], v->last_lutuv[0], 1);
1056  INIT_LUT(v->lumscale, v->lumshift, v->last_luty[1], v->last_lutuv[1], 1);
1057  v->last_use_ic = 1;
1058  }
1060  if (status < 0)
1061  return -1;
1062  av_log(v->s.avctx, AV_LOG_DEBUG, "SKIPMB plane encoding: "
1063  "Imode: %i, Invert: %i\n", status>>1, status&1);
1064  v->mbmodetab = get_bits(gb, 2);
1065  if (v->fourmvswitch)
1067  else
1069  v->imvtab = get_bits(gb, 2);
1071  // interlaced p-picture cbpcy range is [1, 63]
1072  v->icbptab = get_bits(gb, 3);
1074  v->twomvbptab = get_bits(gb, 2);
1076  if (v->fourmvswitch) {
1077  v->fourmvbptab = get_bits(gb, 2);
1079  }
1080  }
1081  }
1082  v->k_x = v->mvrange + 9 + (v->mvrange >> 1); //k_x can be 9 10 12 13
1083  v->k_y = v->mvrange + 8; //k_y can be 8 9 10 11
1084  v->range_x = 1 << (v->k_x - 1);
1085  v->range_y = 1 << (v->k_y - 1);
1086 
1087  v->tt_index = (v->pq > 4) + (v->pq > 12);
1088  if (v->fcm != ILACE_FRAME) {
1089  int mvmode;
1090  mvmode = get_unary(gb, 1, 4);
1091  lowquant = (v->pq > 12) ? 0 : 1;
1092  v->mv_mode = ff_vc1_mv_pmode_table[lowquant][mvmode];
1093  if (v->mv_mode == MV_PMODE_INTENSITY_COMP) {
1094  int mvmode2;
1095  mvmode2 = get_unary(gb, 1, 3);
1096  v->mv_mode2 = ff_vc1_mv_pmode_table2[lowquant][mvmode2];
1097  if (v->field_mode) {
1098  v->intcompfield = decode210(gb) ^ 3;
1099  } else
1100  v->intcompfield = 3;
1101 
1102  v->lumscale2 = v->lumscale = 32;
1103  v->lumshift2 = v->lumshift = 0;
1104  if (v->intcompfield & 1) {
1105  v->lumscale = get_bits(gb, 6);
1106  v->lumshift = get_bits(gb, 6);
1107  }
1108  if ((v->intcompfield & 2) && v->field_mode) {
1109  v->lumscale2 = get_bits(gb, 6);
1110  v->lumshift2 = get_bits(gb, 6);
1111  } else if(!v->field_mode) {
1112  v->lumscale2 = v->lumscale;
1113  v->lumshift2 = v->lumshift;
1114  }
1115  if (v->field_mode && v->second_field) {
1116  if (v->cur_field_type) {
1117  INIT_LUT(v->lumscale , v->lumshift , v->curr_luty[v->cur_field_type^1], v->curr_lutuv[v->cur_field_type^1], 0);
1119  } else {
1122  }
1123  v->next_use_ic = *v->curr_use_ic = 1;
1124  } else {
1125  INIT_LUT(v->lumscale , v->lumshift , v->last_luty[0], v->last_lutuv[0], 1);
1126  INIT_LUT(v->lumscale2, v->lumshift2, v->last_luty[1], v->last_lutuv[1], 1);
1127  }
1128  v->last_use_ic = 1;
1129  }
1130  v->qs_last = v->s.quarter_sample;
1131  if (v->mv_mode == MV_PMODE_INTENSITY_COMP) {
1134  v->s.mspel = (v->mv_mode2 != MV_PMODE_1MV_HPEL_BILIN);
1135  } else {
1136  v->s.quarter_sample = (v->mv_mode != MV_PMODE_1MV_HPEL &&
1138  v->s.mspel = (v->mv_mode != MV_PMODE_1MV_HPEL_BILIN);
1139  }
1140  }
1141  if (v->fcm == PROGRESSIVE) { // progressive
1142  if ((v->mv_mode == MV_PMODE_INTENSITY_COMP &&
1144  || v->mv_mode == MV_PMODE_MIXED_MV) {
1146  if (status < 0)
1147  return -1;
1148  av_log(v->s.avctx, AV_LOG_DEBUG, "MB MV Type plane encoding: "
1149  "Imode: %i, Invert: %i\n", status>>1, status&1);
1150  } else {
1151  v->mv_type_is_raw = 0;
1152  memset(v->mv_type_mb_plane, 0, v->s.mb_stride * v->s.mb_height);
1153  }
1155  if (status < 0)
1156  return -1;
1157  av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: "
1158  "Imode: %i, Invert: %i\n", status>>1, status&1);
1159 
1160  /* Hopefully this is correct for P-frames */
1161  v->s.mv_table_index = get_bits(gb, 2); //but using ff_vc1_ tables
1162  v->cbptab = get_bits(gb, 2);
1164  } else if (v->fcm == ILACE_FRAME) { // frame interlaced
1165  v->qs_last = v->s.quarter_sample;
1166  v->s.quarter_sample = 1;
1167  v->s.mspel = 1;
1168  } else { // field interlaced
1169  v->mbmodetab = get_bits(gb, 3);
1170  v->imvtab = get_bits(gb, 2 + v->numref);
1171  if (!v->numref)
1173  else
1175  v->icbptab = get_bits(gb, 3);
1177  if ((v->mv_mode == MV_PMODE_INTENSITY_COMP &&
1179  v->fourmvbptab = get_bits(gb, 2);
1182  } else {
1184  }
1185  }
1186  if (v->dquant) {
1187  av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n");
1189  }
1190 
1191  if (v->vstransform) {
1192  v->ttmbf = get_bits1(gb);
1193  if (v->ttmbf) {
1194  v->ttfrm = ff_vc1_ttfrm_to_tt[get_bits(gb, 2)];
1195  } else
1196  v->ttfrm = 0; //FIXME Is that so ?
1197  } else {
1198  v->ttmbf = 1;
1199  v->ttfrm = TT_8X8;
1200  }
1201  break;
1202  case AV_PICTURE_TYPE_B:
1203  if (v->fcm == ILACE_FRAME) {
1204  if (read_bfraction(v, gb) < 0)
1205  return AVERROR_INVALIDDATA;
1206  if (v->bfraction == 0) {
1207  return -1;
1208  }
1209  }
1210  if (v->extended_mv)
1211  v->mvrange = get_unary(gb, 0, 3);
1212  else
1213  v->mvrange = 0;
1214  v->k_x = v->mvrange + 9 + (v->mvrange >> 1); //k_x can be 9 10 12 13
1215  v->k_y = v->mvrange + 8; //k_y can be 8 9 10 11
1216  v->range_x = 1 << (v->k_x - 1);
1217  v->range_y = 1 << (v->k_y - 1);
1218 
1219  v->tt_index = (v->pq > 4) + (v->pq > 12);
1220 
1221  if (v->field_mode) {
1222  int mvmode;
1223  av_log(v->s.avctx, AV_LOG_DEBUG, "B Fields\n");
1224  if (v->extended_dmv)
1225  v->dmvrange = get_unary(gb, 0, 3);
1226  mvmode = get_unary(gb, 1, 3);
1227  lowquant = (v->pq > 12) ? 0 : 1;
1228  v->mv_mode = ff_vc1_mv_pmode_table2[lowquant][mvmode];
1229  v->qs_last = v->s.quarter_sample;
1231  v->s.mspel = (v->mv_mode != MV_PMODE_1MV_HPEL_BILIN);
1233  if (status < 0)
1234  return -1;
1235  av_log(v->s.avctx, AV_LOG_DEBUG, "MB Forward Type plane encoding: "
1236  "Imode: %i, Invert: %i\n", status>>1, status&1);
1237  v->mbmodetab = get_bits(gb, 3);
1238  if (v->mv_mode == MV_PMODE_MIXED_MV)
1240  else
1242  v->imvtab = get_bits(gb, 3);
1244  v->icbptab = get_bits(gb, 3);
1246  if (v->mv_mode == MV_PMODE_MIXED_MV) {
1247  v->fourmvbptab = get_bits(gb, 2);
1249  }
1250  v->numref = 1; // interlaced field B pictures are always 2-ref
1251  } else if (v->fcm == ILACE_FRAME) {
1252  if (v->extended_dmv)
1253  v->dmvrange = get_unary(gb, 0, 3);
1254  if (get_bits1(gb)) /* intcomp - present but shall always be 0 */
1255  av_log(v->s.avctx, AV_LOG_WARNING, "Intensity compensation set for B picture\n");
1256  v->intcomp = 0;
1257  v->mv_mode = MV_PMODE_1MV;
1258  v->fourmvswitch = 0;
1259  v->qs_last = v->s.quarter_sample;
1260  v->s.quarter_sample = 1;
1261  v->s.mspel = 1;
1263  if (status < 0)
1264  return -1;
1265  av_log(v->s.avctx, AV_LOG_DEBUG, "MB Direct Type plane encoding: "
1266  "Imode: %i, Invert: %i\n", status>>1, status&1);
1268  if (status < 0)
1269  return -1;
1270  av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: "
1271  "Imode: %i, Invert: %i\n", status>>1, status&1);
1272  v->mbmodetab = get_bits(gb, 2);
1274  v->imvtab = get_bits(gb, 2);
1276  // interlaced p/b-picture cbpcy range is [1, 63]
1277  v->icbptab = get_bits(gb, 3);
1279  v->twomvbptab = get_bits(gb, 2);
1281  v->fourmvbptab = get_bits(gb, 2);
1283  } else {
1285  v->qs_last = v->s.quarter_sample;
1286  v->s.quarter_sample = (v->mv_mode == MV_PMODE_1MV);
1287  v->s.mspel = v->s.quarter_sample;
1289  if (status < 0)
1290  return -1;
1291  av_log(v->s.avctx, AV_LOG_DEBUG, "MB Direct Type plane encoding: "
1292  "Imode: %i, Invert: %i\n", status>>1, status&1);
1294  if (status < 0)
1295  return -1;
1296  av_log(v->s.avctx, AV_LOG_DEBUG, "MB Skip plane encoding: "
1297  "Imode: %i, Invert: %i\n", status>>1, status&1);
1298  v->s.mv_table_index = get_bits(gb, 2);
1299  v->cbptab = get_bits(gb, 2);
1301  }
1302 
1303  if (v->dquant) {
1304  av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n");
1306  }
1307 
1308  if (v->vstransform) {
1309  v->ttmbf = get_bits1(gb);
1310  if (v->ttmbf) {
1311  v->ttfrm = ff_vc1_ttfrm_to_tt[get_bits(gb, 2)];
1312  } else
1313  v->ttfrm = 0;
1314  } else {
1315  v->ttmbf = 1;
1316  v->ttfrm = TT_8X8;
1317  }
1318  break;
1319  }
1320 
1321 
1322  /* AC Syntax */
1323  v->c_ac_table_index = decode012(gb);
1325  v->y_ac_table_index = decode012(gb);
1326  }
1327  else if (v->fcm != PROGRESSIVE && !v->s.quarter_sample) {
1328  v->range_x <<= 1;
1329  v->range_y <<= 1;
1330  }
1331 
1332  /* DC Syntax */
1333  v->s.dc_table_index = get_bits1(gb);
1335  && v->dquant) {
1336  av_log(v->s.avctx, AV_LOG_DEBUG, "VOP DQuant info\n");
1338  }
1339 
1340  v->bi_type = (v->s.pict_type == AV_PICTURE_TYPE_BI);
1341  if (v->bi_type)
1343 
1344  return 0;
1345 }
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:215
VC1Context::lumscale2
uint8_t lumscale2
for interlaced field P picture
Definition: vc1.h:336
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:368
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:325
DQPROFILE_DOUBLE_EDGES
@ DQPROFILE_DOUBLE_EDGES
Definition: vc1.h:49
MpegEncContext::gb
GetBitContext gb
Definition: mpegvideo.h:435
VC1Context::intcomp
int intcomp
Definition: vc1.h:335
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:111
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:303
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:124
VC1Context::reffield
int reffield
if numref = 0 (1 reference) then reffield decides which
Definition: vc1.h:356
data
const char data[16]
Definition: mxf.c:149
MpegEncContext::mv_table_index
int mv_table_index
Definition: mpegvideo.h:411
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:91
VC1Context::imvtab
int imvtab
Definition: vc1.h:370
VC1Context::dmvrange
uint8_t dmvrange
Frame decoding info for interlaced picture.
Definition: vc1.h:333
VC1Context::closed_entry
uint8_t closed_entry
Closed entry point flag (CLOSED_ENTRY syntax element)
Definition: vc1.h:394
VC1Context::twomvbptab
int twomvbptab
Definition: vc1.h:371
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:96
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:311
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:624
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:345
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:566
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:124
MpegEncContext::pict_type
int pict_type
AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, ...
Definition: mpegvideo.h:206
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:366
IMODE_DIFF2
@ IMODE_DIFF2
Definition: vc1.h:161
VC1Context::numref
int numref
number of past field pictures used as reference
Definition: vc1.h:354
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:339
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:353
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:209
VC1Context::twomvbp_vlc
const VLCElem * twomvbp_vlc
Definition: vc1.h:340
ff_vc1_2mv_block_pattern_vlc
const VLCElem * ff_vc1_2mv_block_pattern_vlc[4]
Definition: vc1data.c:114
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
MPVWorkPicture::ptr
MPVPicture * ptr
RefStruct reference.
Definition: mpegpicture.h:99
VC1Context::range_mapuv_flag
uint8_t range_mapuv_flag
Definition: vc1.h:327
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:323
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:230
QUANT_FRAME_IMPLICIT
@ QUANT_FRAME_IMPLICIT
Implicitly specified at frame level.
Definition: vc1.h:38
MpegEncContext::loop_filter
int loop_filter
Definition: mpegvideo.h:370
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:297
MpegEncContext::cur_pic
MPVWorkPicture cur_pic
copy of the current picture structure.
Definition: mpegvideo.h:177
AVCodecContext::codec_id
enum AVCodecID codec_id
Definition: avcodec.h:461
VC1Context::frfd
int frfd
Definition: vc1.h:365
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:125
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:221
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:326
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:350
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:363
VC1Context::mvrange
uint8_t mvrange
Ranges:
Definition: vc1.h:280
VC1Context::range_mapuv
uint8_t range_mapuv
Definition: vc1.h:329
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:338
VC1Context::resync_marker
int resync_marker
could this stream contain resync markers
Definition: vc1.h:399
VC1Context::cbpcy_vlc
const VLCElem * cbpcy_vlc
CBPCY VLC table.
Definition: vc1.h:282
VC1Context::cbptab
int cbptab
Definition: vc1.h:298
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:344
VC1Context::intcompfield
int intcompfield
which of the two fields to be intensity compensated
Definition: vc1.h:358
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:491
VC1Context::ttfrm
int ttfrm
Transform type info present at frame level.
Definition: vc1.h:255
height
#define height
Definition: dsp.h:85
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:398
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:334
VC1Context::rangeredfrm
uint8_t rangeredfrm
Frame decoding info for S/M profiles only.
Definition: vc1.h:302
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:191
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:387
MV_PMODE_1MV_HPEL
@ MV_PMODE_1MV_HPEL
Definition: vc1.h:81
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:393
skip_bits1
static void skip_bits1(GetBitContext *s)
Definition: get_bits.h:413
ROTATE
#define ROTATE(DEF, L, N, C)
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:1816
VC1Context::fptype
int fptype
Definition: vc1.h:351
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:220
AV_CODEC_ID_MSS2
@ AV_CODEC_ID_MSS2
Definition: codec_id.h:221
VC1Context::cur_field_type
int cur_field_type
0: top, 1: bottom
Definition: vc1.h:360
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
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:256
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:186
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:846
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:318
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:414
VC1Context::pic_header_flag
int pic_header_flag
Definition: vc1.h:367
VC1_NORM6_VLC_BITS
#define VC1_NORM6_VLC_BITS
Definition: vc1data.h:62
AVCodecContext::height
int height
Definition: avcodec.h:624
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:341
VC1Context::second_field
int second_field
Definition: vc1.h:352
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:361
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:324
MpegEncContext::mspel
int mspel
Definition: mpegvideo.h:432
VC1Context::pquantizer
uint8_t pquantizer
Uniform (over sequence) quantizer in use.
Definition: vc1.h:281
MPVPicture::f
struct AVFrame * f
Definition: mpegpicture.h:59
AVCodecContext
main external API structure.
Definition: avcodec.h:451
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:383
status
ov_status_e status
Definition: dnn_backend_openvino.c:100
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:609
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:392
AV_PICTURE_TYPE_B
@ AV_PICTURE_TYPE_B
Bi-dir predicted.
Definition: avutil.h:281
AVRational::den
int den
Denominator.
Definition: rational.h:60
VC1Context::tff
uint8_t tff
Definition: vc1.h:311
VC1Context::x8_type
int x8_type
Definition: vc1.h:385
VC1Context::brfd
int brfd
reference frame distance (forward or backward)
Definition: vc1.h:365
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:372
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:582
VC1Context::lumshift2
uint8_t lumshift2
Definition: vc1.h:337
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:384
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:308
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:801
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:321
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:322
AVCodecContext::width
int width
picture width / height.
Definition: avcodec.h:624
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:369
VC1Context::dquantfrm
uint8_t dquantfrm
pquant parameters
Definition: vc1.h:243
h
h
Definition: vp9dsp_template.c:2070
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
width
#define width
Definition: dsp.h:85
MV_PMODE_1MV
@ MV_PMODE_1MV
Definition: vc1.h:80
VC1Context::postproc
uint8_t postproc
Definition: vc1.h:317
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:328
VC1Context::uvsamp
uint8_t uvsamp
Definition: vc1.h:316
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:648
VC1Context::rff
uint8_t rff
Definition: vc1.h:311
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