FFmpeg  4.1.4
wmv2dec.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2002 The FFmpeg Project
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #include "avcodec.h"
22 #include "h263.h"
23 #include "internal.h"
24 #include "intrax8.h"
25 #include "mathops.h"
26 #include "mpegutils.h"
27 #include "mpegvideo.h"
28 #include "msmpeg4.h"
29 #include "msmpeg4data.h"
30 #include "wmv2.h"
31 
32 
34 {
35  int mb_x, mb_y;
36  MpegEncContext *const s = &w->s;
37  uint32_t *const mb_type = s->current_picture_ptr->mb_type;
38 
39  w->skip_type = get_bits(&s->gb, 2);
40  switch (w->skip_type) {
41  case SKIP_TYPE_NONE:
42  for (mb_y = 0; mb_y < s->mb_height; mb_y++)
43  for (mb_x = 0; mb_x < s->mb_width; mb_x++)
44  mb_type[mb_y * s->mb_stride + mb_x] =
46  break;
47  case SKIP_TYPE_MPEG:
48  if (get_bits_left(&s->gb) < s->mb_height * s->mb_width)
49  return AVERROR_INVALIDDATA;
50  for (mb_y = 0; mb_y < s->mb_height; mb_y++)
51  for (mb_x = 0; mb_x < s->mb_width; mb_x++)
52  mb_type[mb_y * s->mb_stride + mb_x] =
54  break;
55  case SKIP_TYPE_ROW:
56  for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
57  if (get_bits_left(&s->gb) < 1)
58  return AVERROR_INVALIDDATA;
59  if (get_bits1(&s->gb)) {
60  for (mb_x = 0; mb_x < s->mb_width; mb_x++)
61  mb_type[mb_y * s->mb_stride + mb_x] =
63  } else {
64  for (mb_x = 0; mb_x < s->mb_width; mb_x++)
65  mb_type[mb_y * s->mb_stride + mb_x] =
67  }
68  }
69  break;
70  case SKIP_TYPE_COL:
71  for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
72  if (get_bits_left(&s->gb) < 1)
73  return AVERROR_INVALIDDATA;
74  if (get_bits1(&s->gb)) {
75  for (mb_y = 0; mb_y < s->mb_height; mb_y++)
76  mb_type[mb_y * s->mb_stride + mb_x] =
78  } else {
79  for (mb_y = 0; mb_y < s->mb_height; mb_y++)
80  mb_type[mb_y * s->mb_stride + mb_x] =
82  }
83  }
84  break;
85  }
86  return 0;
87 }
88 
90 {
91  MpegEncContext *const s = &w->s;
92  GetBitContext gb;
93  int fps;
94  int code;
95 
96  if (s->avctx->extradata_size < 4)
97  return AVERROR_INVALIDDATA;
98 
99  init_get_bits(&gb, s->avctx->extradata, 32);
100 
101  fps = get_bits(&gb, 5);
102  s->bit_rate = get_bits(&gb, 11) * 1024;
103  w->mspel_bit = get_bits1(&gb);
104  s->loop_filter = get_bits1(&gb);
105  w->abt_flag = get_bits1(&gb);
106  w->j_type_bit = get_bits1(&gb);
107  w->top_left_mv_flag = get_bits1(&gb);
108  w->per_mb_rl_bit = get_bits1(&gb);
109  code = get_bits(&gb, 3);
110 
111  if (code == 0)
112  return AVERROR_INVALIDDATA;
113 
114  s->slice_height = s->mb_height / code;
115 
116  if (s->avctx->debug & FF_DEBUG_PICT_INFO)
118  "fps:%d, br:%"PRId64", qpbit:%d, abt_flag:%d, j_type_bit:%d, "
119  "tl_mv_flag:%d, mbrl_bit:%d, code:%d, loop_filter:%d, "
120  "slices:%d\n",
121  fps, s->bit_rate, w->mspel_bit, w->abt_flag, w->j_type_bit,
122  w->top_left_mv_flag, w->per_mb_rl_bit, code, s->loop_filter,
123  code);
124  return 0;
125 }
126 
128 {
129  Wmv2Context *const w = (Wmv2Context *) s;
130  int code;
131 
132  if (s->picture_number == 0)
134 
135  s->pict_type = get_bits1(&s->gb) + 1;
136  if (s->pict_type == AV_PICTURE_TYPE_I) {
137  code = get_bits(&s->gb, 7);
138  av_log(s->avctx, AV_LOG_DEBUG, "I7:%X/\n", code);
139  }
140  s->chroma_qscale = s->qscale = get_bits(&s->gb, 5);
141  if (s->qscale <= 0)
142  return AVERROR_INVALIDDATA;
143 
144  if (s->pict_type != AV_PICTURE_TYPE_I && show_bits(&s->gb, 1)) {
145  GetBitContext gb = s->gb;
146  int skip_type = get_bits(&gb, 2);
147  int run = skip_type == SKIP_TYPE_COL ? s->mb_width : s->mb_height;
148 
149  while (run > 0) {
150  int block = FFMIN(run, 25);
151  if (get_bits(&gb, block) + 1 != 1<<block)
152  break;
153  run -= block;
154  }
155  if (!run)
156  return FRAME_SKIPPED;
157  }
158 
159  return 0;
160 }
161 
163 {
164  Wmv2Context *const w = (Wmv2Context *) s;
165 
166  if (s->pict_type == AV_PICTURE_TYPE_I) {
167  if (w->j_type_bit)
168  w->j_type = get_bits1(&s->gb);
169  else
170  w->j_type = 0; // FIXME check
171 
172  if (!w->j_type) {
173  if (w->per_mb_rl_bit)
174  s->per_mb_rl_table = get_bits1(&s->gb);
175  else
176  s->per_mb_rl_table = 0;
177 
178  if (!s->per_mb_rl_table) {
180  s->rl_table_index = decode012(&s->gb);
181  }
182 
183  s->dc_table_index = get_bits1(&s->gb);
184 
185  // at minimum one bit per macroblock is required at least in a valid frame,
186  // we discard frames much smaller than this. Frames smaller than 1/8 of the
187  // smallest "black/skip" frame generally contain not much recoverable content
188  // while at the same time they have the highest computational requirements
189  // per byte
190  if (get_bits_left(&s->gb) * 8LL < (s->width+15)/16 * ((s->height+15)/16))
191  return AVERROR_INVALIDDATA;
192  }
193  s->inter_intra_pred = 0;
194  s->no_rounding = 1;
195  if (s->avctx->debug & FF_DEBUG_PICT_INFO) {
197  "qscale:%d rlc:%d rl:%d dc:%d mbrl:%d j_type:%d \n",
200  }
201  } else {
202  int cbp_index;
203  int ret;
204  w->j_type = 0;
205 
206  ret = parse_mb_skip(w);
207  if (ret < 0)
208  return ret;
209  cbp_index = decode012(&s->gb);
210  w->cbp_table_index = wmv2_get_cbp_table_index(s, cbp_index);
211 
212  if (w->mspel_bit)
213  s->mspel = get_bits1(&s->gb);
214  else
215  s->mspel = 0; // FIXME check
216 
217  if (w->abt_flag) {
218  w->per_mb_abt = get_bits1(&s->gb) ^ 1;
219  if (!w->per_mb_abt)
220  w->abt_type = decode012(&s->gb);
221  }
222 
223  if (w->per_mb_rl_bit)
224  s->per_mb_rl_table = get_bits1(&s->gb);
225  else
226  s->per_mb_rl_table = 0;
227 
228  if (!s->per_mb_rl_table) {
229  s->rl_table_index = decode012(&s->gb);
231  }
232 
233  s->dc_table_index = get_bits1(&s->gb);
234  s->mv_table_index = get_bits1(&s->gb);
235 
236  s->inter_intra_pred = 0; // (s->width * s->height < 320 * 240 && s->bit_rate <= II_BITRATE);
237  s->no_rounding ^= 1;
238 
239  if (s->avctx->debug & FF_DEBUG_PICT_INFO) {
241  "rl:%d rlc:%d dc:%d mv:%d mbrl:%d qp:%d mspel:%d "
242  "per_mb_abt:%d abt_type:%d cbp:%d ii:%d\n",
245  s->per_mb_rl_table, s->qscale, s->mspel,
247  s->inter_intra_pred);
248  }
249  }
250  s->esc3_level_length = 0;
251  s->esc3_run_length = 0;
252  s->picture_number++; // FIXME ?
253 
254  if (w->j_type) {
256  &s->gb, &s->mb_x, &s->mb_y,
257  2 * s->qscale, (s->qscale - 1) | 1,
258  s->loop_filter, s->low_delay);
259 
260  ff_er_add_slice(&w->s.er, 0, 0,
261  (w->s.mb_x >> 1) - 1, (w->s.mb_y >> 1) - 1,
262  ER_MB_END);
263  return 1;
264  }
265 
266  return 0;
267 }
268 
269 static inline int wmv2_decode_motion(Wmv2Context *w, int *mx_ptr, int *my_ptr)
270 {
271  MpegEncContext *const s = &w->s;
272  int ret;
273 
274  ret = ff_msmpeg4_decode_motion(s, mx_ptr, my_ptr);
275 
276  if (ret < 0)
277  return ret;
278 
279  if ((((*mx_ptr) | (*my_ptr)) & 1) && s->mspel)
280  w->hshift = get_bits1(&s->gb);
281  else
282  w->hshift = 0;
283 
284  return 0;
285 }
286 
287 static int16_t *wmv2_pred_motion(Wmv2Context *w, int *px, int *py)
288 {
289  MpegEncContext *const s = &w->s;
290  int xy, wrap, diff, type;
291  int16_t *A, *B, *C, *mot_val;
292 
293  wrap = s->b8_stride;
294  xy = s->block_index[0];
295 
296  mot_val = s->current_picture.motion_val[0][xy];
297 
298  A = s->current_picture.motion_val[0][xy - 1];
299  B = s->current_picture.motion_val[0][xy - wrap];
300  C = s->current_picture.motion_val[0][xy + 2 - wrap];
301 
302  if (s->mb_x && !s->first_slice_line && !s->mspel && w->top_left_mv_flag)
303  diff = FFMAX(FFABS(A[0] - B[0]), FFABS(A[1] - B[1]));
304  else
305  diff = 0;
306 
307  if (diff >= 8)
308  type = get_bits1(&s->gb);
309  else
310  type = 2;
311 
312  if (type == 0) {
313  *px = A[0];
314  *py = A[1];
315  } else if (type == 1) {
316  *px = B[0];
317  *py = B[1];
318  } else {
319  /* special case for first (slice) line */
320  if (s->first_slice_line) {
321  *px = A[0];
322  *py = A[1];
323  } else {
324  *px = mid_pred(A[0], B[0], C[0]);
325  *py = mid_pred(A[1], B[1], C[1]);
326  }
327  }
328 
329  return mot_val;
330 }
331 
332 static inline int wmv2_decode_inter_block(Wmv2Context *w, int16_t *block,
333  int n, int cbp)
334 {
335  MpegEncContext *const s = &w->s;
336  static const int sub_cbp_table[3] = { 2, 3, 1 };
337  int sub_cbp, ret;
338 
339  if (!cbp) {
340  s->block_last_index[n] = -1;
341  return 0;
342  }
343 
344  if (w->per_block_abt)
345  w->abt_type = decode012(&s->gb);
346  w->abt_type_table[n] = w->abt_type;
347 
348  if (w->abt_type) {
349 // const uint8_t *scantable = w->abt_scantable[w->abt_type - 1].permutated;
350  const uint8_t *scantable = w->abt_scantable[w->abt_type - 1].scantable;
351 // const uint8_t *scantable = w->abt_type - 1 ? w->abt_scantable[1].permutated : w->abt_scantable[0].scantable;
352 
353  sub_cbp = sub_cbp_table[decode012(&s->gb)];
354 
355  if (sub_cbp & 1)
356  if ((ret = ff_msmpeg4_decode_block(s, block, n, 1, scantable)) < 0)
357  return ret;
358 
359  if (sub_cbp & 2)
360  if ((ret = ff_msmpeg4_decode_block(s, w->abt_block2[n], n, 1, scantable)) < 0)
361  return ret;
362 
363  s->block_last_index[n] = 63;
364 
365  return 0;
366  } else {
367  return ff_msmpeg4_decode_block(s, block, n, 1,
369  }
370 }
371 
373 {
374  Wmv2Context *const w = (Wmv2Context *) s;
375  int cbp, code, i, ret;
376  uint8_t *coded_val;
377 
378  if (w->j_type)
379  return 0;
380 
381  if (s->pict_type == AV_PICTURE_TYPE_P) {
382  if (IS_SKIP(s->current_picture.mb_type[s->mb_y * s->mb_stride + s->mb_x])) {
383  /* skip mb */
384  s->mb_intra = 0;
385  for (i = 0; i < 6; i++)
386  s->block_last_index[i] = -1;
387  s->mv_dir = MV_DIR_FORWARD;
388  s->mv_type = MV_TYPE_16X16;
389  s->mv[0][0][0] = 0;
390  s->mv[0][0][1] = 0;
391  s->mb_skipped = 1;
392  w->hshift = 0;
393  return 0;
394  }
395  if (get_bits_left(&s->gb) <= 0)
396  return AVERROR_INVALIDDATA;
397 
400  if (code < 0)
401  return AVERROR_INVALIDDATA;
402  s->mb_intra = (~code & 0x40) >> 6;
403 
404  cbp = code & 0x3f;
405  } else {
406  s->mb_intra = 1;
407  if (get_bits_left(&s->gb) <= 0)
408  return AVERROR_INVALIDDATA;
410  if (code < 0) {
412  "II-cbp illegal at %d %d\n", s->mb_x, s->mb_y);
413  return AVERROR_INVALIDDATA;
414  }
415  /* predict coded block pattern */
416  cbp = 0;
417  for (i = 0; i < 6; i++) {
418  int val = ((code >> (5 - i)) & 1);
419  if (i < 4) {
420  int pred = ff_msmpeg4_coded_block_pred(s, i, &coded_val);
421  val = val ^ pred;
422  *coded_val = val;
423  }
424  cbp |= val << (5 - i);
425  }
426  }
427 
428  if (!s->mb_intra) {
429  int mx, my;
430  wmv2_pred_motion(w, &mx, &my);
431 
432  if (cbp) {
433  s->bdsp.clear_blocks(s->block[0]);
434  if (s->per_mb_rl_table) {
435  s->rl_table_index = decode012(&s->gb);
437  }
438 
439  if (w->abt_flag && w->per_mb_abt) {
440  w->per_block_abt = get_bits1(&s->gb);
441  if (!w->per_block_abt)
442  w->abt_type = decode012(&s->gb);
443  } else
444  w->per_block_abt = 0;
445  }
446 
447  if ((ret = wmv2_decode_motion(w, &mx, &my)) < 0)
448  return ret;
449 
450  s->mv_dir = MV_DIR_FORWARD;
451  s->mv_type = MV_TYPE_16X16;
452  s->mv[0][0][0] = mx;
453  s->mv[0][0][1] = my;
454 
455  for (i = 0; i < 6; i++) {
456  if ((ret = wmv2_decode_inter_block(w, block[i], i, (cbp >> (5 - i)) & 1)) < 0) {
458  "\nerror while decoding inter block: %d x %d (%d)\n",
459  s->mb_x, s->mb_y, i);
460  return ret;
461  }
462  }
463  } else {
464  if (s->pict_type == AV_PICTURE_TYPE_P)
465  ff_dlog(s->avctx, "%d%d ", s->inter_intra_pred, cbp);
466  ff_dlog(s->avctx, "I at %d %d %d %06X\n", s->mb_x, s->mb_y,
467  ((cbp & 3) ? 1 : 0) + ((cbp & 0x3C) ? 2 : 0),
468  show_bits(&s->gb, 24));
469  s->ac_pred = get_bits1(&s->gb);
470  if (s->inter_intra_pred) {
473  ff_dlog(s->avctx, "%d%d %d %d/",
474  s->ac_pred, s->h263_aic_dir, s->mb_x, s->mb_y);
475  }
476  if (s->per_mb_rl_table && cbp) {
477  s->rl_table_index = decode012(&s->gb);
479  }
480 
481  s->bdsp.clear_blocks(s->block[0]);
482  for (i = 0; i < 6; i++) {
483  if ((ret = ff_msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL)) < 0) {
485  "\nerror while decoding intra block: %d x %d (%d)\n",
486  s->mb_x, s->mb_y, i);
487  return ret;
488  }
489  }
490  }
491 
492  return 0;
493 }
494 
496 {
497  Wmv2Context *const w = avctx->priv_data;
498  int ret;
499 
500  if ((ret = ff_msmpeg4_decode_init(avctx)) < 0)
501  return ret;
502 
504 
505  return ff_intrax8_common_init(avctx, &w->x8, &w->s.idsp,
506  w->s.block, w->s.block_last_index,
507  w->s.mb_width, w->s.mb_height);
508 }
509 
511 {
512  Wmv2Context *w = avctx->priv_data;
513 
515  return ff_h263_decode_end(avctx);
516 }
517 
519  .name = "wmv2",
520  .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 8"),
521  .type = AVMEDIA_TYPE_VIDEO,
522  .id = AV_CODEC_ID_WMV2,
523  .priv_data_size = sizeof(Wmv2Context),
525  .close = wmv2_decode_end,
528  .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P,
529  AV_PIX_FMT_NONE },
530 };
static av_cold int wmv2_decode_init(AVCodecContext *avctx)
Definition: wmv2dec.c:495
int inter_intra_pred
Definition: mpegvideo.h:444
int j_type_bit
Definition: wmv2.h:39
IDCTDSPContext idsp
Definition: mpegvideo.h:230
#define NULL
Definition: coverity.c:32
const char const char void * val
Definition: avisynth_c.h:771
int picture_number
Definition: mpegvideo.h:127
#define SKIP_TYPE_COL
Definition: wmv2.h:32
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:59
static av_always_inline int wmv2_get_cbp_table_index(MpegEncContext *s, int cbp_index)
Definition: wmv2.h:74
int esc3_level_length
Definition: mpegvideo.h:440
static av_cold int wmv2_decode_end(AVCodecContext *avctx)
Definition: wmv2dec.c:510
int ff_wmv2_decode_mb(MpegEncContext *s, int16_t block[6][64])
Definition: wmv2dec.c:372
#define C
int ff_wmv2_decode_secondary_picture_header(MpegEncContext *s)
Definition: wmv2dec.c:162
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Definition: get_bits.h:381
#define ER_MB_END
int ff_msmpeg4_decode_init(AVCodecContext *avctx)
Definition: msmpeg4dec.c:301
int16_t abt_block2[6][64]
Definition: wmv2.h:54
static int wmv2_decode_inter_block(Wmv2Context *w, int16_t *block, int n, int cbp)
Definition: wmv2dec.c:332
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
int per_mb_abt
Definition: wmv2.h:44
static int wmv2_decode_motion(Wmv2Context *w, int *mx_ptr, int *my_ptr)
Definition: wmv2dec.c:269
static int decode_ext_header(Wmv2Context *w)
Definition: wmv2dec.c:89
int abt_type_table[6]
Definition: wmv2.h:43
mpegvideo header.
int per_mb_rl_bit
Definition: wmv2.h:49
uint8_t permutated[64]
Definition: idctdsp.h:33
uint8_t run
Definition: svq3.c:206
AVCodec.
Definition: avcodec.h:3424
#define MB_NON_INTRA_VLC_BITS
Definition: msmpeg4.h:34
int qscale
QP.
Definition: mpegvideo.h:204
av_cold int ff_intrax8_common_init(AVCodecContext *avctx, IntraX8Context *w, IDCTDSPContext *idsp, int16_t(*block)[64], int block_last_index[12], int mb_width, int mb_height)
Initialize IntraX8 frame decoder.
Definition: intrax8.c:728
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
Definition: decode_audio.c:42
static int16_t block[64]
Definition: dct.c:115
int esc3_run_length
Definition: mpegvideo.h:441
uint8_t
#define av_cold
Definition: attributes.h:82
#define FF_DEBUG_PICT_INFO
Definition: avcodec.h:2615
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
Definition: avcodec.h:1634
int no_rounding
apply no rounding to motion compensation (MPEG-4, msmpeg4, ...) for B-frames rounding mode is always ...
Definition: mpegvideo.h:284
#define MB_TYPE_16x16
Definition: mpegutils.h:54
Picture current_picture
copy of the current picture structure.
Definition: mpegvideo.h:180
int ff_msmpeg4_decode_motion(MpegEncContext *s, int *mx_ptr, int *my_ptr)
Definition: msmpeg4dec.c:843
MSMPEG4 data tables.
int ff_intrax8_decode_picture(IntraX8Context *w, Picture *pict, GetBitContext *gb, int *mb_x, int *mb_y, int dquant, int quant_offset, int loopfilter, int lowdelay)
Decode single IntraX8 frame.
Definition: intrax8.c:773
#define ff_dlog(a,...)
const uint8_t * scantable
Definition: idctdsp.h:32
int mb_height
number of MBs horizontally & vertically
Definition: mpegvideo.h:129
MpegEncContext s
Definition: wmv2.h:36
#define A(x)
Definition: vp56_arith.h:28
#define av_log(a,...)
static int get_bits_left(GetBitContext *gb)
Definition: get_bits.h:814
int ff_wmv2_decode_picture_header(MpegEncContext *s)
Definition: wmv2dec.c:127
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
void ff_er_add_slice(ERContext *s, int startx, int starty, int endx, int endy, int status)
Add a slice.
int rl_chroma_table_index
Definition: mpegvideo.h:432
int mb_skipped
MUST BE SET only during DECODING.
Definition: mpegvideo.h:195
void(* clear_blocks)(int16_t *blocks)
Definition: blockdsp.h:37
#define B
Definition: huffyuvdsp.h:32
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
ERContext er
Definition: mpegvideo.h:565
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:197
int per_mb_rl_table
Definition: mpegvideo.h:439
#define wrap(func)
Definition: neontest.h:65
const char * name
Name of the codec implementation.
Definition: avcodec.h:3431
#define IS_SKIP(a)
Definition: mpegutils.h:81
int low_delay
no reordering needed / has no B-frames
Definition: mpegvideo.h:406
AVCodec ff_wmv2_decoder
Definition: wmv2dec.c:518
GetBitContext gb
Definition: mpegvideo.h:448
#define FFMAX(a, b)
Definition: common.h:94
int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: h263dec.c:421
#define AV_CODEC_CAP_DRAW_HORIZ_BAND
Decoder can use draw_horiz_band callback.
Definition: avcodec.h:962
#define FFMIN(a, b)
Definition: common.h:96
av_cold void ff_intrax8_common_end(IntraX8Context *w)
Destroy IntraX8 frame structure.
Definition: intrax8.c:768
uint8_t w
Definition: llviddspenc.c:38
static int parse_mb_skip(Wmv2Context *w)
Definition: wmv2dec.c:33
int16_t(*[2] motion_val)[2]
Definition: mpegpicture.h:53
Picture * current_picture_ptr
pointer to the current picture
Definition: mpegvideo.h:184
ScanTable abt_scantable[2]
Definition: wmv2.h:53
int abt_type
Definition: wmv2.h:42
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
Definition: get_bits.h:443
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
Definition: common.h:72
#define s(width, name)
Definition: cbs_vp9.c:257
static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE(*table)[2], int bits, int max_depth)
Parse a vlc code.
Definition: get_bits.h:762
int block_last_index[12]
last non zero coefficient in block
Definition: mpegvideo.h:86
int n
Definition: avisynth_c.h:684
#define FRAME_SKIPPED
Return value for header parsers if frame is not coded.
Definition: mpegutils.h:34
static int16_t * wmv2_pred_motion(Wmv2Context *w, int *px, int *py)
Definition: wmv2dec.c:287
if(ret< 0)
Definition: vf_mcdeint.c:279
int block_index[6]
index to current MB in block based arrays with edges
Definition: mpegvideo.h:293
static const float pred[4]
Definition: siprdata.h:259
#define MV_TYPE_16X16
1 vector for the whole mb
Definition: mpegvideo.h:266
int first_slice_line
used in MPEG-4 too to handle resync markers
Definition: mpegvideo.h:436
int abt_flag
Definition: wmv2.h:41
Libavcodec external API header.
#define SKIP_TYPE_MPEG
Definition: wmv2.h:30
BlockDSPContext bdsp
Definition: mpegvideo.h:226
int cbp_table_index
Definition: wmv2.h:47
int debug
debug
Definition: avcodec.h:2614
main external API structure.
Definition: avcodec.h:1533
int height
picture size. must be a multiple of 16
Definition: mpegvideo.h:100
VLC ff_inter_intra_vlc
Definition: msmpeg4dec.c:70
int skip_type
Definition: wmv2.h:50
int extradata_size
Definition: avcodec.h:1635
static unsigned int get_bits1(GetBitContext *s)
Definition: get_bits.h:487
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
Definition: get_bits.h:615
cl_device_type type
#define MB_INTRA_VLC_BITS
Definition: msmpeg4.h:35
int slice_height
in macroblocks
Definition: mpegvideo.h:435
#define mid_pred
Definition: mathops.h:97
#define MB_TYPE_SKIP
Definition: mpegutils.h:62
#define MV_DIR_FORWARD
Definition: mpegvideo.h:262
int pict_type
AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, ...
Definition: mpegvideo.h:212
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:266
int mv[2][4][2]
motion vectors for a macroblock first coordinate : 0 = forward 1 = backward second " : depend...
Definition: mpegvideo.h:276
int b8_stride
2*mb_width+1 used for some 8x8 block arrays to allow simple addressing
Definition: mpegvideo.h:131
MpegEncContext.
Definition: mpegvideo.h:81
struct AVCodecContext * avctx
Definition: mpegvideo.h:98
#define SKIP_TYPE_NONE
Definition: wmv2.h:29
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:66
common internal api header.
int mb_stride
mb_width+1 used for some arrays to allow simple addressing of left & top MBs without sig11 ...
Definition: mpegvideo.h:130
VLC ff_mb_non_intra_vlc[4]
Definition: msmpeg4dec.c:64
int per_block_abt
Definition: wmv2.h:45
int ff_h263_decode_end(AVCodecContext *avctx)
Definition: h263dec.c:155
void * priv_data
Definition: avcodec.h:1560
int hshift
Definition: wmv2.h:51
static av_always_inline int diff(const uint32_t a, const uint32_t b)
IntraX8Context x8
Definition: wmv2.h:37
av_cold void ff_wmv2_common_init(Wmv2Context *w)
Definition: wmv2.c:31
int16_t(* block)[64]
points to one of the following blocks
Definition: mpegvideo.h:507
static int decode012(GetBitContext *gb)
Definition: get_bits.h:796
VLC_TYPE(* table)[2]
code, bits
Definition: vlc.h:28
int64_t bit_rate
wanted bit rate
Definition: mpegvideo.h:103
int rl_table_index
Definition: mpegvideo.h:431
int chroma_qscale
chroma QP
Definition: mpegvideo.h:205
int ff_msmpeg4_decode_block(MpegEncContext *s, int16_t *block, int n, int coded, const uint8_t *scan_table)
Definition: msmpeg4dec.c:656
int mspel_bit
Definition: wmv2.h:46
#define INTER_INTRA_VLC_BITS
Definition: msmpeg4.h:33
uint32_t * mb_type
types and macros are defined in mpegutils.h
Definition: mpegpicture.h:56
VLC ff_msmp4_mb_i_vlc
Definition: msmpeg4data.c:38
ScanTable inter_scantable
if inter == intra then intra should be used to reduce the cache usage
Definition: mpegvideo.h:90
int ff_msmpeg4_coded_block_pred(MpegEncContext *s, int n, uint8_t **coded_block_ptr)
Definition: msmpeg4.c:153
#define SKIP_TYPE_ROW
Definition: wmv2.h:31
int mv_table_index
Definition: mpegvideo.h:430
int h263_aic_dir
AIC direction: 0 = left, 1 = top.
Definition: mpegvideo.h:376
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Definition: avcodec.h:968
int dc_table_index
Definition: mpegvideo.h:433
#define MB_TYPE_L0
Definition: mpegutils.h:67
Predicted.
Definition: avutil.h:275
int top_left_mv_flag
Definition: wmv2.h:48
int j_type
Definition: wmv2.h:40