FFmpeg
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  int coded_mb_count = 0;
37  MpegEncContext *const s = &w->s;
38  uint32_t *const mb_type = s->current_picture_ptr->mb_type;
39 
40  w->skip_type = get_bits(&s->gb, 2);
41  switch (w->skip_type) {
42  case SKIP_TYPE_NONE:
43  for (mb_y = 0; mb_y < s->mb_height; mb_y++)
44  for (mb_x = 0; mb_x < s->mb_width; mb_x++)
45  mb_type[mb_y * s->mb_stride + mb_x] =
47  break;
48  case SKIP_TYPE_MPEG:
49  if (get_bits_left(&s->gb) < s->mb_height * s->mb_width)
50  return AVERROR_INVALIDDATA;
51  for (mb_y = 0; mb_y < s->mb_height; mb_y++)
52  for (mb_x = 0; mb_x < s->mb_width; mb_x++)
53  mb_type[mb_y * s->mb_stride + mb_x] =
55  break;
56  case SKIP_TYPE_ROW:
57  for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
58  if (get_bits_left(&s->gb) < 1)
59  return AVERROR_INVALIDDATA;
60  if (get_bits1(&s->gb)) {
61  for (mb_x = 0; mb_x < s->mb_width; mb_x++)
62  mb_type[mb_y * s->mb_stride + mb_x] =
64  } else {
65  for (mb_x = 0; mb_x < s->mb_width; mb_x++)
66  mb_type[mb_y * s->mb_stride + mb_x] =
68  }
69  }
70  break;
71  case SKIP_TYPE_COL:
72  for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
73  if (get_bits_left(&s->gb) < 1)
74  return AVERROR_INVALIDDATA;
75  if (get_bits1(&s->gb)) {
76  for (mb_y = 0; mb_y < s->mb_height; mb_y++)
77  mb_type[mb_y * s->mb_stride + mb_x] =
79  } else {
80  for (mb_y = 0; mb_y < s->mb_height; mb_y++)
81  mb_type[mb_y * s->mb_stride + mb_x] =
83  }
84  }
85  break;
86  }
87 
88  for (mb_y = 0; mb_y < s->mb_height; mb_y++)
89  for (mb_x = 0; mb_x < s->mb_width; mb_x++)
90  coded_mb_count += !IS_SKIP(mb_type[mb_y * s->mb_stride + mb_x]);
91 
92  if (coded_mb_count > get_bits_left(&s->gb))
93  return AVERROR_INVALIDDATA;
94 
95  return 0;
96 }
97 
99 {
100  MpegEncContext *const s = &w->s;
101  GetBitContext gb;
102  int fps;
103  int code;
104 
105  if (s->avctx->extradata_size < 4)
106  return AVERROR_INVALIDDATA;
107 
108  init_get_bits(&gb, s->avctx->extradata, 32);
109 
110  fps = get_bits(&gb, 5);
111  s->bit_rate = get_bits(&gb, 11) * 1024;
112  w->mspel_bit = get_bits1(&gb);
113  s->loop_filter = get_bits1(&gb);
114  w->abt_flag = get_bits1(&gb);
115  w->j_type_bit = get_bits1(&gb);
116  w->top_left_mv_flag = get_bits1(&gb);
117  w->per_mb_rl_bit = get_bits1(&gb);
118  code = get_bits(&gb, 3);
119 
120  if (code == 0)
121  return AVERROR_INVALIDDATA;
122 
123  s->slice_height = s->mb_height / code;
124 
125  if (s->avctx->debug & FF_DEBUG_PICT_INFO)
126  av_log(s->avctx, AV_LOG_DEBUG,
127  "fps:%d, br:%"PRId64", qpbit:%d, abt_flag:%d, j_type_bit:%d, "
128  "tl_mv_flag:%d, mbrl_bit:%d, code:%d, loop_filter:%d, "
129  "slices:%d\n",
130  fps, s->bit_rate, w->mspel_bit, w->abt_flag, w->j_type_bit,
131  w->top_left_mv_flag, w->per_mb_rl_bit, code, s->loop_filter,
132  code);
133  return 0;
134 }
135 
137 {
138  Wmv2Context *const w = (Wmv2Context *) s;
139  int code;
140 
141  if (s->picture_number == 0)
143 
144  s->pict_type = get_bits1(&s->gb) + 1;
145  if (s->pict_type == AV_PICTURE_TYPE_I) {
146  code = get_bits(&s->gb, 7);
147  av_log(s->avctx, AV_LOG_DEBUG, "I7:%X/\n", code);
148  }
149  s->chroma_qscale = s->qscale = get_bits(&s->gb, 5);
150  if (s->qscale <= 0)
151  return AVERROR_INVALIDDATA;
152 
153  if (s->pict_type != AV_PICTURE_TYPE_I && show_bits(&s->gb, 1)) {
154  GetBitContext gb = s->gb;
155  int skip_type = get_bits(&gb, 2);
156  int run = skip_type == SKIP_TYPE_COL ? s->mb_width : s->mb_height;
157 
158  while (run > 0) {
159  int block = FFMIN(run, 25);
160  if (get_bits(&gb, block) + 1 != 1<<block)
161  break;
162  run -= block;
163  }
164  if (!run)
165  return FRAME_SKIPPED;
166  }
167 
168  return 0;
169 }
170 
172 {
173  Wmv2Context *const w = (Wmv2Context *) s;
174 
175  if (s->pict_type == AV_PICTURE_TYPE_I) {
176  if (w->j_type_bit)
177  w->j_type = get_bits1(&s->gb);
178  else
179  w->j_type = 0; // FIXME check
180 
181  if (!w->j_type) {
182  if (w->per_mb_rl_bit)
183  s->per_mb_rl_table = get_bits1(&s->gb);
184  else
185  s->per_mb_rl_table = 0;
186 
187  if (!s->per_mb_rl_table) {
188  s->rl_chroma_table_index = decode012(&s->gb);
189  s->rl_table_index = decode012(&s->gb);
190  }
191 
192  s->dc_table_index = get_bits1(&s->gb);
193 
194  // at minimum one bit per macroblock is required at least in a valid frame,
195  // we discard frames much smaller than this. Frames smaller than 1/8 of the
196  // smallest "black/skip" frame generally contain not much recoverable content
197  // while at the same time they have the highest computational requirements
198  // per byte
199  if (get_bits_left(&s->gb) * 8LL < (s->width+15)/16 * ((s->height+15)/16))
200  return AVERROR_INVALIDDATA;
201  }
202  s->inter_intra_pred = 0;
203  s->no_rounding = 1;
204  if (s->avctx->debug & FF_DEBUG_PICT_INFO) {
205  av_log(s->avctx, AV_LOG_DEBUG,
206  "qscale:%d rlc:%d rl:%d dc:%d mbrl:%d j_type:%d \n",
207  s->qscale, s->rl_chroma_table_index, s->rl_table_index,
208  s->dc_table_index, s->per_mb_rl_table, w->j_type);
209  }
210  } else {
211  int cbp_index;
212  int ret;
213  w->j_type = 0;
214 
215  ret = parse_mb_skip(w);
216  if (ret < 0)
217  return ret;
218  cbp_index = decode012(&s->gb);
219  w->cbp_table_index = wmv2_get_cbp_table_index(s, cbp_index);
220 
221  if (w->mspel_bit)
222  s->mspel = get_bits1(&s->gb);
223  else
224  s->mspel = 0; // FIXME check
225 
226  if (w->abt_flag) {
227  w->per_mb_abt = get_bits1(&s->gb) ^ 1;
228  if (!w->per_mb_abt)
229  w->abt_type = decode012(&s->gb);
230  }
231 
232  if (w->per_mb_rl_bit)
233  s->per_mb_rl_table = get_bits1(&s->gb);
234  else
235  s->per_mb_rl_table = 0;
236 
237  if (!s->per_mb_rl_table) {
238  s->rl_table_index = decode012(&s->gb);
239  s->rl_chroma_table_index = s->rl_table_index;
240  }
241 
242  if (get_bits_left(&s->gb) < 2)
243  return AVERROR_INVALIDDATA;
244 
245  s->dc_table_index = get_bits1(&s->gb);
246  s->mv_table_index = get_bits1(&s->gb);
247 
248  s->inter_intra_pred = 0; // (s->width * s->height < 320 * 240 && s->bit_rate <= II_BITRATE);
249  s->no_rounding ^= 1;
250 
251  if (s->avctx->debug & FF_DEBUG_PICT_INFO) {
252  av_log(s->avctx, AV_LOG_DEBUG,
253  "rl:%d rlc:%d dc:%d mv:%d mbrl:%d qp:%d mspel:%d "
254  "per_mb_abt:%d abt_type:%d cbp:%d ii:%d\n",
255  s->rl_table_index, s->rl_chroma_table_index,
256  s->dc_table_index, s->mv_table_index,
257  s->per_mb_rl_table, s->qscale, s->mspel,
258  w->per_mb_abt, w->abt_type, w->cbp_table_index,
259  s->inter_intra_pred);
260  }
261  }
262  s->esc3_level_length = 0;
263  s->esc3_run_length = 0;
264  s->picture_number++; // FIXME ?
265 
266  if (w->j_type) {
267  ff_intrax8_decode_picture(&w->x8, &s->current_picture,
268  &s->gb, &s->mb_x, &s->mb_y,
269  2 * s->qscale, (s->qscale - 1) | 1,
270  s->loop_filter, s->low_delay);
271 
272  ff_er_add_slice(&w->s.er, 0, 0,
273  (w->s.mb_x >> 1) - 1, (w->s.mb_y >> 1) - 1,
274  ER_MB_END);
275  return 1;
276  }
277 
278  return 0;
279 }
280 
281 static inline int wmv2_decode_motion(Wmv2Context *w, int *mx_ptr, int *my_ptr)
282 {
283  MpegEncContext *const s = &w->s;
284  int ret;
285 
286  ret = ff_msmpeg4_decode_motion(s, mx_ptr, my_ptr);
287 
288  if (ret < 0)
289  return ret;
290 
291  if ((((*mx_ptr) | (*my_ptr)) & 1) && s->mspel)
292  w->hshift = get_bits1(&s->gb);
293  else
294  w->hshift = 0;
295 
296  return 0;
297 }
298 
299 static int16_t *wmv2_pred_motion(Wmv2Context *w, int *px, int *py)
300 {
301  MpegEncContext *const s = &w->s;
302  int xy, wrap, diff, type;
303  int16_t *A, *B, *C, *mot_val;
304 
305  wrap = s->b8_stride;
306  xy = s->block_index[0];
307 
308  mot_val = s->current_picture.motion_val[0][xy];
309 
310  A = s->current_picture.motion_val[0][xy - 1];
311  B = s->current_picture.motion_val[0][xy - wrap];
312  C = s->current_picture.motion_val[0][xy + 2 - wrap];
313 
314  if (s->mb_x && !s->first_slice_line && !s->mspel && w->top_left_mv_flag)
315  diff = FFMAX(FFABS(A[0] - B[0]), FFABS(A[1] - B[1]));
316  else
317  diff = 0;
318 
319  if (diff >= 8)
320  type = get_bits1(&s->gb);
321  else
322  type = 2;
323 
324  if (type == 0) {
325  *px = A[0];
326  *py = A[1];
327  } else if (type == 1) {
328  *px = B[0];
329  *py = B[1];
330  } else {
331  /* special case for first (slice) line */
332  if (s->first_slice_line) {
333  *px = A[0];
334  *py = A[1];
335  } else {
336  *px = mid_pred(A[0], B[0], C[0]);
337  *py = mid_pred(A[1], B[1], C[1]);
338  }
339  }
340 
341  return mot_val;
342 }
343 
344 static inline int wmv2_decode_inter_block(Wmv2Context *w, int16_t *block,
345  int n, int cbp)
346 {
347  MpegEncContext *const s = &w->s;
348  static const int sub_cbp_table[3] = { 2, 3, 1 };
349  int sub_cbp, ret;
350 
351  if (!cbp) {
352  s->block_last_index[n] = -1;
353  return 0;
354  }
355 
356  if (w->per_block_abt)
357  w->abt_type = decode012(&s->gb);
358  w->abt_type_table[n] = w->abt_type;
359 
360  if (w->abt_type) {
361 // const uint8_t *scantable = w->abt_scantable[w->abt_type - 1].permutated;
362  const uint8_t *scantable = w->abt_scantable[w->abt_type - 1].scantable;
363 // const uint8_t *scantable = w->abt_type - 1 ? w->abt_scantable[1].permutated : w->abt_scantable[0].scantable;
364 
365  sub_cbp = sub_cbp_table[decode012(&s->gb)];
366 
367  if (sub_cbp & 1)
368  if ((ret = ff_msmpeg4_decode_block(s, block, n, 1, scantable)) < 0)
369  return ret;
370 
371  if (sub_cbp & 2)
372  if ((ret = ff_msmpeg4_decode_block(s, w->abt_block2[n], n, 1, scantable)) < 0)
373  return ret;
374 
375  s->block_last_index[n] = 63;
376 
377  return 0;
378  } else {
379  return ff_msmpeg4_decode_block(s, block, n, 1,
380  s->inter_scantable.permutated);
381  }
382 }
383 
385 {
386  Wmv2Context *const w = (Wmv2Context *) s;
387  int cbp, code, i, ret;
388  uint8_t *coded_val;
389 
390  if (w->j_type)
391  return 0;
392 
393  if (s->pict_type == AV_PICTURE_TYPE_P) {
394  if (IS_SKIP(s->current_picture.mb_type[s->mb_y * s->mb_stride + s->mb_x])) {
395  /* skip mb */
396  s->mb_intra = 0;
397  for (i = 0; i < 6; i++)
398  s->block_last_index[i] = -1;
399  s->mv_dir = MV_DIR_FORWARD;
400  s->mv_type = MV_TYPE_16X16;
401  s->mv[0][0][0] = 0;
402  s->mv[0][0][1] = 0;
403  s->mb_skipped = 1;
404  w->hshift = 0;
405  return 0;
406  }
407  if (get_bits_left(&s->gb) <= 0)
408  return AVERROR_INVALIDDATA;
409 
410  code = get_vlc2(&s->gb, ff_mb_non_intra_vlc[w->cbp_table_index].table,
412  if (code < 0)
413  return AVERROR_INVALIDDATA;
414  s->mb_intra = (~code & 0x40) >> 6;
415 
416  cbp = code & 0x3f;
417  } else {
418  s->mb_intra = 1;
419  if (get_bits_left(&s->gb) <= 0)
420  return AVERROR_INVALIDDATA;
422  if (code < 0) {
423  av_log(s->avctx, AV_LOG_ERROR,
424  "II-cbp illegal at %d %d\n", s->mb_x, s->mb_y);
425  return AVERROR_INVALIDDATA;
426  }
427  /* predict coded block pattern */
428  cbp = 0;
429  for (i = 0; i < 6; i++) {
430  int val = ((code >> (5 - i)) & 1);
431  if (i < 4) {
432  int pred = ff_msmpeg4_coded_block_pred(s, i, &coded_val);
433  val = val ^ pred;
434  *coded_val = val;
435  }
436  cbp |= val << (5 - i);
437  }
438  }
439 
440  if (!s->mb_intra) {
441  int mx, my;
442  wmv2_pred_motion(w, &mx, &my);
443 
444  if (cbp) {
445  s->bdsp.clear_blocks(s->block[0]);
446  if (s->per_mb_rl_table) {
447  s->rl_table_index = decode012(&s->gb);
448  s->rl_chroma_table_index = s->rl_table_index;
449  }
450 
451  if (w->abt_flag && w->per_mb_abt) {
452  w->per_block_abt = get_bits1(&s->gb);
453  if (!w->per_block_abt)
454  w->abt_type = decode012(&s->gb);
455  } else
456  w->per_block_abt = 0;
457  }
458 
459  if ((ret = wmv2_decode_motion(w, &mx, &my)) < 0)
460  return ret;
461 
462  s->mv_dir = MV_DIR_FORWARD;
463  s->mv_type = MV_TYPE_16X16;
464  s->mv[0][0][0] = mx;
465  s->mv[0][0][1] = my;
466 
467  for (i = 0; i < 6; i++) {
468  if ((ret = wmv2_decode_inter_block(w, block[i], i, (cbp >> (5 - i)) & 1)) < 0) {
469  av_log(s->avctx, AV_LOG_ERROR,
470  "\nerror while decoding inter block: %d x %d (%d)\n",
471  s->mb_x, s->mb_y, i);
472  return ret;
473  }
474  }
475  } else {
476  if (s->pict_type == AV_PICTURE_TYPE_P)
477  ff_dlog(s->avctx, "%d%d ", s->inter_intra_pred, cbp);
478  ff_dlog(s->avctx, "I at %d %d %d %06X\n", s->mb_x, s->mb_y,
479  ((cbp & 3) ? 1 : 0) + ((cbp & 0x3C) ? 2 : 0),
480  show_bits(&s->gb, 24));
481  s->ac_pred = get_bits1(&s->gb);
482  if (s->inter_intra_pred) {
483  s->h263_aic_dir = get_vlc2(&s->gb, ff_inter_intra_vlc.table,
485  ff_dlog(s->avctx, "%d%d %d %d/",
486  s->ac_pred, s->h263_aic_dir, s->mb_x, s->mb_y);
487  }
488  if (s->per_mb_rl_table && cbp) {
489  s->rl_table_index = decode012(&s->gb);
490  s->rl_chroma_table_index = s->rl_table_index;
491  }
492 
493  s->bdsp.clear_blocks(s->block[0]);
494  for (i = 0; i < 6; i++) {
495  if ((ret = ff_msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL)) < 0) {
496  av_log(s->avctx, AV_LOG_ERROR,
497  "\nerror while decoding intra block: %d x %d (%d)\n",
498  s->mb_x, s->mb_y, i);
499  return ret;
500  }
501  }
502  }
503 
504  return 0;
505 }
506 
508 {
509  Wmv2Context *const w = avctx->priv_data;
510  int ret;
511 
512  if ((ret = ff_msmpeg4_decode_init(avctx)) < 0)
513  return ret;
514 
516 
517  return ff_intrax8_common_init(avctx, &w->x8, &w->s.idsp,
518  w->s.block, w->s.block_last_index,
519  w->s.mb_width, w->s.mb_height);
520 }
521 
523 {
524  Wmv2Context *w = avctx->priv_data;
525 
526  ff_intrax8_common_end(&w->x8);
527  return ff_h263_decode_end(avctx);
528 }
529 
531  .name = "wmv2",
532  .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 8"),
533  .type = AVMEDIA_TYPE_VIDEO,
534  .id = AV_CODEC_ID_WMV2,
535  .priv_data_size = sizeof(Wmv2Context),
537  .close = wmv2_decode_end,
540  .pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P,
541  AV_PIX_FMT_NONE },
542 };
wmv2_decode_inter_block
static int wmv2_decode_inter_block(Wmv2Context *w, int16_t *block, int n, int cbp)
Definition: wmv2dec.c:344
AVCodec
AVCodec.
Definition: avcodec.h:3481
MB_TYPE_L0
#define MB_TYPE_L0
Definition: mpegutils.h:67
MV_TYPE_16X16
#define MV_TYPE_16X16
1 vector for the whole mb
Definition: mpegvideo.h:266
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
ff_msmpeg4_decode_init
int ff_msmpeg4_decode_init(AVCodecContext *avctx)
Definition: msmpeg4dec.c:301
init
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
get_bits_left
static int get_bits_left(GetBitContext *gb)
Definition: get_bits.h:849
n
int n
Definition: avisynth_c.h:760
ff_msmpeg4_decode_block
int ff_msmpeg4_decode_block(MpegEncContext *s, int16_t *block, int n, int coded, const uint8_t *scan_table)
Definition: msmpeg4dec.c:656
w
uint8_t w
Definition: llviddspenc.c:38
internal.h
ff_wmv2_common_init
av_cold void ff_wmv2_common_init(Wmv2Context *w)
Definition: wmv2.c:31
MB_TYPE_16x16
#define MB_TYPE_16x16
Definition: mpegutils.h:54
get_vlc2
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:797
ff_er_add_slice
void ff_er_add_slice(ERContext *s, int startx, int starty, int endx, int endy, int status)
Add a slice.
Definition: error_resilience.c:830
mpegvideo.h
mpegutils.h
init_get_bits
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
Definition: get_bits.h:659
wmv2_decode_end
static av_cold int wmv2_decode_end(AVCodecContext *avctx)
Definition: wmv2dec.c:522
FF_DEBUG_PICT_INFO
#define FF_DEBUG_PICT_INFO
Definition: avcodec.h:2651
A
#define A(x)
Definition: vp56_arith.h:28
ff_wmv2_decode_secondary_picture_header
int ff_wmv2_decode_secondary_picture_header(MpegEncContext *s)
Definition: wmv2dec.c:171
get_bits
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Definition: get_bits.h:379
wrap
#define wrap(func)
Definition: neontest.h:65
ff_intrax8_decode_picture
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
GetBitContext
Definition: get_bits.h:61
decode_ext_header
static int decode_ext_header(Wmv2Context *w)
Definition: wmv2dec.c:98
type
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 type
Definition: writing_filters.txt:86
wmv2_decode_motion
static int wmv2_decode_motion(Wmv2Context *w, int *mx_ptr, int *my_ptr)
Definition: wmv2dec.c:281
C
s EdgeDetect Foobar g libavfilter vf_edgedetect c libavfilter vf_foobar c edit libavfilter and add an entry for foobar following the pattern of the other filters edit libavfilter allfilters and add an entry for foobar following the pattern of the other filters configure make j< whatever > ffmpeg ffmpeg i you should get a foobar png with Lena edge detected That s your new playground is ready Some little details about what s going which in turn will define variables for the build system and the C
Definition: writing_filters.txt:58
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
av_cold
#define av_cold
Definition: attributes.h:84
SKIP_TYPE_COL
#define SKIP_TYPE_COL
Definition: wmv2.h:32
MB_NON_INTRA_VLC_BITS
#define MB_NON_INTRA_VLC_BITS
Definition: msmpeg4.h:34
ff_intrax8_common_init
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
ff_wmv2_decode_picture_header
int ff_wmv2_decode_picture_header(MpegEncContext *s)
Definition: wmv2dec.c:136
wmv2_get_cbp_table_index
static av_always_inline int wmv2_get_cbp_table_index(MpegEncContext *s, int cbp_index)
Definition: wmv2.h:74
msmpeg4data.h
decode
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
Definition: decode_audio.c:42
s
#define s(width, name)
Definition: cbs_vp9.c:257
AV_CODEC_ID_WMV2
@ AV_CODEC_ID_WMV2
Definition: avcodec.h:236
pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:275
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:197
parse_mb_skip
static int parse_mb_skip(Wmv2Context *w)
Definition: wmv2dec.c:33
IS_SKIP
#define IS_SKIP(a)
Definition: mpegutils.h:81
SKIP_TYPE_NONE
#define SKIP_TYPE_NONE
Definition: wmv2.h:29
decode012
static int decode012(GetBitContext *gb)
Definition: get_bits.h:831
AV_PIX_FMT_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:66
FFABS
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
Definition: common.h:72
if
if(ret)
Definition: filter_design.txt:179
FRAME_SKIPPED
#define FRAME_SKIPPED
Return value for header parsers if frame is not coded.
Definition: mpegutils.h:34
ff_msmpeg4_decode_motion
int ff_msmpeg4_decode_motion(MpegEncContext *s, int *mx_ptr, int *my_ptr)
Definition: msmpeg4dec.c:843
NULL
#define NULL
Definition: coverity.c:32
run
uint8_t run
Definition: svq3.c:206
ff_intrax8_common_end
av_cold void ff_intrax8_common_end(IntraX8Context *w)
Destroy IntraX8 frame structure.
Definition: intrax8.c:768
SKIP_TYPE_MPEG
#define SKIP_TYPE_MPEG
Definition: wmv2.h:30
AV_PICTURE_TYPE_I
@ AV_PICTURE_TYPE_I
Intra.
Definition: avutil.h:274
get_bits1
static unsigned int get_bits1(GetBitContext *s)
Definition: get_bits.h:498
mathops.h
wmv2.h
intrax8.h
ff_dlog
#define ff_dlog(a,...)
Definition: tableprint_vlc.h:29
AV_CODEC_CAP_DR1
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Definition: avcodec.h:981
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:188
FFMAX
#define FFMAX(a, b)
Definition: common.h:94
ff_wmv2_decoder
AVCodec ff_wmv2_decoder
Definition: wmv2dec.c:530
MB_TYPE_SKIP
#define MB_TYPE_SKIP
Definition: mpegutils.h:62
val
const char const char void * val
Definition: avisynth_c.h:863
FFMIN
#define FFMIN(a, b)
Definition: common.h:96
SKIP_TYPE_ROW
#define SKIP_TYPE_ROW
Definition: wmv2.h:31
wmv2_pred_motion
static int16_t * wmv2_pred_motion(Wmv2Context *w, int *px, int *py)
Definition: wmv2dec.c:299
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:259
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
show_bits
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
Definition: get_bits.h:446
ff_h263_decode_end
int ff_h263_decode_end(AVCodecContext *avctx)
Definition: h263dec.c:155
uint8_t
uint8_t
Definition: audio_convert.c:194
AVCodec::name
const char * name
Name of the codec implementation.
Definition: avcodec.h:3488
ff_inter_intra_vlc
VLC ff_inter_intra_vlc
Definition: msmpeg4dec.c:70
avcodec.h
msmpeg4.h
mid_pred
#define mid_pred
Definition: mathops.h:97
ret
ret
Definition: filter_design.txt:187
pred
static const float pred[4]
Definition: siprdata.h:259
B
#define B
Definition: huffyuvdsp.h:32
AVCodecContext
main external API structure.
Definition: avcodec.h:1565
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
wmv2_decode_init
static av_cold int wmv2_decode_init(AVCodecContext *avctx)
Definition: wmv2dec.c:507
AV_PICTURE_TYPE_P
@ AV_PICTURE_TYPE_P
Predicted.
Definition: avutil.h:275
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
MB_INTRA_VLC_BITS
#define MB_INTRA_VLC_BITS
Definition: msmpeg4.h:35
ER_MB_END
#define ER_MB_END
Definition: error_resilience.h:39
ff_h263_decode_frame
int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: h263dec.c:421
diff
static av_always_inline int diff(const uint32_t a, const uint32_t b)
Definition: vf_palettegen.c:136
MV_DIR_FORWARD
#define MV_DIR_FORWARD
Definition: mpegvideo.h:262
Wmv2Context
Definition: wmv2.h:35
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:1592
ff_wmv2_decode_mb
int ff_wmv2_decode_mb(MpegEncContext *s, int16_t block[6][64])
Definition: wmv2dec.c:384
AV_CODEC_CAP_DRAW_HORIZ_BAND
#define AV_CODEC_CAP_DRAW_HORIZ_BAND
Decoder can use draw_horiz_band callback.
Definition: avcodec.h:975
block
The exact code depends on how similar the blocks are and how related they are to the block
Definition: filter_design.txt:207
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:28
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:59
ff_mb_non_intra_vlc
VLC ff_mb_non_intra_vlc[4]
Definition: msmpeg4dec.c:64
ff_msmp4_mb_i_vlc
VLC ff_msmp4_mb_i_vlc
Definition: msmpeg4data.c:38
MpegEncContext
MpegEncContext.
Definition: mpegvideo.h:81
VLC::table
VLC_TYPE(* table)[2]
code, bits
Definition: vlc.h:28
ff_msmpeg4_coded_block_pred
int ff_msmpeg4_coded_block_pred(MpegEncContext *s, int n, uint8_t **coded_block_ptr)
Definition: msmpeg4.c:153
INTER_INTRA_VLC_BITS
#define INTER_INTRA_VLC_BITS
Definition: msmpeg4.h:33
h263.h