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 "libavutil/avassert.h"
22 #include "libavutil/mem_internal.h"
23 
24 #include "avcodec.h"
25 #include "codec_internal.h"
26 #include "h263dec.h"
27 #include "intrax8.h"
28 #include "mathops.h"
29 #include "mpegutils.h"
30 #include "mpegvideo.h"
31 #include "mpegvideodec.h"
32 #include "msmpeg4.h"
33 #include "msmpeg4_vc1_data.h"
34 #include "msmpeg4dec.h"
35 #include "qpeldsp.h"
36 #include "simple_idct.h"
37 #include "wmv2.h"
38 #include "wmv2data.h"
39 #include "wmv2dec.h"
40 
41 typedef struct WMV2DecContext {
44 
46 
48  int j_type;
49  int abt_flag;
50  int abt_type;
54  int mspel_bit;
58  int hshift;
59 
60  DECLARE_ALIGNED(32, int16_t, abt_block2)[6][64];
62 
63 static void wmv2_mspel8_h_lowpass(uint8_t *dst, const uint8_t *src,
64  int dstStride, int srcStride, int h)
65 {
66  const uint8_t *cm = ff_crop_tab + MAX_NEG_CROP;
67 
68  for (int i = 0; i < h; i++) {
69  dst[0] = cm[(9 * (src[0] + src[1]) - (src[-1] + src[2]) + 8) >> 4];
70  dst[1] = cm[(9 * (src[1] + src[2]) - (src[0] + src[3]) + 8) >> 4];
71  dst[2] = cm[(9 * (src[2] + src[3]) - (src[1] + src[4]) + 8) >> 4];
72  dst[3] = cm[(9 * (src[3] + src[4]) - (src[2] + src[5]) + 8) >> 4];
73  dst[4] = cm[(9 * (src[4] + src[5]) - (src[3] + src[6]) + 8) >> 4];
74  dst[5] = cm[(9 * (src[5] + src[6]) - (src[4] + src[7]) + 8) >> 4];
75  dst[6] = cm[(9 * (src[6] + src[7]) - (src[5] + src[8]) + 8) >> 4];
76  dst[7] = cm[(9 * (src[7] + src[8]) - (src[6] + src[9]) + 8) >> 4];
77  dst += dstStride;
78  src += srcStride;
79  }
80 }
81 
82 static void wmv2_mspel8_v_lowpass(uint8_t *dst, const uint8_t *src,
83  int dstStride, int srcStride, int w)
84 {
85  const uint8_t *cm = ff_crop_tab + MAX_NEG_CROP;
86 
87  for (int i = 0; i < w; i++) {
88  const int src_1 = src[-srcStride];
89  const int src0 = src[0];
90  const int src1 = src[srcStride];
91  const int src2 = src[2 * srcStride];
92  const int src3 = src[3 * srcStride];
93  const int src4 = src[4 * srcStride];
94  const int src5 = src[5 * srcStride];
95  const int src6 = src[6 * srcStride];
96  const int src7 = src[7 * srcStride];
97  const int src8 = src[8 * srcStride];
98  const int src9 = src[9 * srcStride];
99  dst[0 * dstStride] = cm[(9 * (src0 + src1) - (src_1 + src2) + 8) >> 4];
100  dst[1 * dstStride] = cm[(9 * (src1 + src2) - (src0 + src3) + 8) >> 4];
101  dst[2 * dstStride] = cm[(9 * (src2 + src3) - (src1 + src4) + 8) >> 4];
102  dst[3 * dstStride] = cm[(9 * (src3 + src4) - (src2 + src5) + 8) >> 4];
103  dst[4 * dstStride] = cm[(9 * (src4 + src5) - (src3 + src6) + 8) >> 4];
104  dst[5 * dstStride] = cm[(9 * (src5 + src6) - (src4 + src7) + 8) >> 4];
105  dst[6 * dstStride] = cm[(9 * (src6 + src7) - (src5 + src8) + 8) >> 4];
106  dst[7 * dstStride] = cm[(9 * (src7 + src8) - (src6 + src9) + 8) >> 4];
107  src++;
108  dst++;
109  }
110 }
111 
112 static void put_mspel8_mc10_c(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
113 {
114  uint8_t half[64];
115 
118 }
119 
120 static void put_mspel8_mc20_c(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
121 {
123 }
124 
125 static void put_mspel8_mc30_c(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
126 {
127  uint8_t half[64];
128 
130  ff_put_pixels8_l2_8(dst, src + 1, half, stride, stride, 8, 8);
131 }
132 
133 static void put_mspel8_mc02_c(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
134 {
136 }
137 
138 static void put_mspel8_mc12_c(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
139 {
140  uint8_t halfH[88];
141  uint8_t halfV[64];
142  uint8_t halfHV[64];
143 
144  wmv2_mspel8_h_lowpass(halfH, src - stride, 8, stride, 11);
145  wmv2_mspel8_v_lowpass(halfV, src, 8, stride, 8);
146  wmv2_mspel8_v_lowpass(halfHV, halfH + 8, 8, 8, 8);
147  ff_put_pixels8_l2_8(dst, halfV, halfHV, stride, 8, 8, 8);
148 }
149 
150 static void put_mspel8_mc32_c(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
151 {
152  uint8_t halfH[88];
153  uint8_t halfV[64];
154  uint8_t halfHV[64];
155 
156  wmv2_mspel8_h_lowpass(halfH, src - stride, 8, stride, 11);
157  wmv2_mspel8_v_lowpass(halfV, src + 1, 8, stride, 8);
158  wmv2_mspel8_v_lowpass(halfHV, halfH + 8, 8, 8, 8);
159  ff_put_pixels8_l2_8(dst, halfV, halfHV, stride, 8, 8, 8);
160 }
161 
162 static void put_mspel8_mc22_c(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
163 {
164  uint8_t halfH[88];
165 
166  wmv2_mspel8_h_lowpass(halfH, src - stride, 8, stride, 11);
167  wmv2_mspel8_v_lowpass(dst, halfH + 8, stride, 8, 8);
168 }
169 
171 {
172  w->put_mspel_pixels_tab[0] = ff_put_pixels8x8_c;
173  w->put_mspel_pixels_tab[1] = put_mspel8_mc10_c;
174  w->put_mspel_pixels_tab[2] = put_mspel8_mc20_c;
175  w->put_mspel_pixels_tab[3] = put_mspel8_mc30_c;
176  w->put_mspel_pixels_tab[4] = put_mspel8_mc02_c;
177  w->put_mspel_pixels_tab[5] = put_mspel8_mc12_c;
178  w->put_mspel_pixels_tab[6] = put_mspel8_mc22_c;
179  w->put_mspel_pixels_tab[7] = put_mspel8_mc32_c;
180 }
181 
182 void ff_mspel_motion(MPVContext *const s, uint8_t *dest_y,
183  uint8_t *dest_cb, uint8_t *dest_cr,
184  uint8_t *const *ref_picture,
185  const op_pixels_func (*pix_op)[4],
186  int motion_x, int motion_y, int h)
187 {
188  WMV2DecContext *const w = (WMV2DecContext *) s;
189  const uint8_t *ptr;
190  int dxy, mx, my, src_x, src_y, v_edge_pos;
191  ptrdiff_t offset, linesize, uvlinesize;
192  int emu = 0;
193 
194  dxy = ((motion_y & 1) << 1) | (motion_x & 1);
195  dxy = 2 * dxy + w->hshift;
196  src_x = s->mb_x * 16 + (motion_x >> 1);
197  src_y = s->mb_y * 16 + (motion_y >> 1);
198 
199  /* WARNING: do no forget half pels */
200  v_edge_pos = s->v_edge_pos;
201  src_x = av_clip(src_x, -16, s->width);
202  src_y = av_clip(src_y, -16, s->height);
203 
204  if (src_x <= -16 || src_x >= s->width)
205  dxy &= ~3;
206  if (src_y <= -16 || src_y >= s->height)
207  dxy &= ~4;
208 
209  linesize = s->linesize;
210  uvlinesize = s->uvlinesize;
211  ptr = ref_picture[0] + (src_y * linesize) + src_x;
212 
213  if (src_x < 1 || src_y < 1 || src_x + 17 >= s->h_edge_pos ||
214  src_y + h + 1 >= v_edge_pos) {
215  s->vdsp.emulated_edge_mc(s->sc.edge_emu_buffer, ptr - 1 - s->linesize,
216  s->linesize, s->linesize, 19, 19,
217  src_x - 1, src_y - 1,
218  s->h_edge_pos, s->v_edge_pos);
219  ptr = s->sc.edge_emu_buffer + 1 + s->linesize;
220  emu = 1;
221  }
222 
223  w->put_mspel_pixels_tab[dxy](dest_y, ptr, linesize);
224  w->put_mspel_pixels_tab[dxy](dest_y + 8, ptr + 8, linesize);
225  w->put_mspel_pixels_tab[dxy](dest_y + 8 * linesize, ptr + 8 * linesize, linesize);
226  w->put_mspel_pixels_tab[dxy](dest_y + 8 + 8 * linesize, ptr + 8 + 8 * linesize, linesize);
227 
228  if (s->avctx->flags & AV_CODEC_FLAG_GRAY)
229  return;
230 
231  dxy = 0;
232  if ((motion_x & 3) != 0)
233  dxy |= 1;
234  if ((motion_y & 3) != 0)
235  dxy |= 2;
236  mx = motion_x >> 2;
237  my = motion_y >> 2;
238 
239  src_x = s->mb_x * 8 + mx;
240  src_y = s->mb_y * 8 + my;
241  src_x = av_clip(src_x, -8, s->width >> 1);
242  if (src_x == (s->width >> 1))
243  dxy &= ~1;
244  src_y = av_clip(src_y, -8, s->height >> 1);
245  if (src_y == (s->height >> 1))
246  dxy &= ~2;
247  offset = (src_y * uvlinesize) + src_x;
248  ptr = ref_picture[1] + offset;
249  if (emu) {
250  s->vdsp.emulated_edge_mc(s->sc.edge_emu_buffer, ptr,
251  s->uvlinesize, s->uvlinesize,
252  9, 9,
253  src_x, src_y,
254  s->h_edge_pos >> 1, s->v_edge_pos >> 1);
255  ptr = s->sc.edge_emu_buffer;
256  }
257  pix_op[1][dxy](dest_cb, ptr, uvlinesize, h >> 1);
258 
259  ptr = ref_picture[2] + offset;
260  if (emu) {
261  s->vdsp.emulated_edge_mc(s->sc.edge_emu_buffer, ptr,
262  s->uvlinesize, s->uvlinesize,
263  9, 9,
264  src_x, src_y,
265  s->h_edge_pos >> 1, s->v_edge_pos >> 1);
266  ptr = s->sc.edge_emu_buffer;
267  }
268  pix_op[1][dxy](dest_cr, ptr, uvlinesize, h >> 1);
269 }
270 
271 static void wmv2_add_block(WMV2DecContext *w, int16_t blocks1[][64],
272  uint8_t *dst, int stride, int n)
273 {
274  H263DecContext *const h = &w->ms.h;
275 
276  if (h->c.block_last_index[n] >= 0) {
277  int16_t *block1 = blocks1[n];
278  switch (w->abt_type_table[n]) {
279  case 0:
280  h->c.idsp.idct_add(dst, stride, block1);
281  break;
282  case 1:
284  ff_simple_idct84_add(dst + 4 * stride, stride, w->abt_block2[n]);
285  h->c.bdsp.clear_block(w->abt_block2[n]);
286  break;
287  case 2:
289  ff_simple_idct48_add(dst + 4, stride, w->abt_block2[n]);
290  h->c.bdsp.clear_block(w->abt_block2[n]);
291  break;
292  default:
293  av_unreachable("abt_type_table is read via decode012");
294  }
295  }
296 }
297 
298 void ff_wmv2_add_mb(MpegEncContext *s, int16_t block1[6][64],
299  uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr)
300 {
301  WMV2DecContext *const w = (WMV2DecContext *) s;
302 
303  wmv2_add_block(w, block1, dest_y, s->linesize, 0);
304  wmv2_add_block(w, block1, dest_y + 8, s->linesize, 1);
305  wmv2_add_block(w, block1, dest_y + 8 * s->linesize, s->linesize, 2);
306  wmv2_add_block(w, block1, dest_y + 8 + 8 * s->linesize, s->linesize, 3);
307 
308  if (s->avctx->flags & AV_CODEC_FLAG_GRAY)
309  return;
310 
311  wmv2_add_block(w, block1, dest_cb, s->uvlinesize, 4);
312  wmv2_add_block(w, block1, dest_cr, s->uvlinesize, 5);
313 }
314 
316 {
317  H263DecContext *const h = &w->ms.h;
318  int coded_mb_count = 0;
319  uint32_t *const mb_type = h->c.cur_pic.mb_type;
320 
321  int skip_type = get_bits(&h->gb, 2);
322  switch (skip_type) {
323  case SKIP_TYPE_NONE:
324  for (int mb_y = 0; mb_y < h->c.mb_height; mb_y++)
325  for (int mb_x = 0; mb_x < h->c.mb_width; mb_x++)
326  mb_type[mb_y * h->c.mb_stride + mb_x] =
328  break;
329  case SKIP_TYPE_MPEG:
330  if (get_bits_left(&h->gb) < h->c.mb_height * h->c.mb_width)
331  return AVERROR_INVALIDDATA;
332  for (int mb_y = 0; mb_y < h->c.mb_height; mb_y++)
333  for (int mb_x = 0; mb_x < h->c.mb_width; mb_x++)
334  mb_type[mb_y * h->c.mb_stride + mb_x] =
336  break;
337  case SKIP_TYPE_ROW:
338  for (int mb_y = 0; mb_y < h->c.mb_height; mb_y++) {
339  if (get_bits_left(&h->gb) < 1)
340  return AVERROR_INVALIDDATA;
341  if (get_bits1(&h->gb)) {
342  for (int mb_x = 0; mb_x < h->c.mb_width; mb_x++)
343  mb_type[mb_y * h->c.mb_stride + mb_x] =
345  } else {
346  if (get_bits_left(&h->gb) < h->c.mb_width)
347  return AVERROR_INVALIDDATA;
348  for (int mb_x = 0; mb_x < h->c.mb_width; mb_x++)
349  mb_type[mb_y * h->c.mb_stride + mb_x] =
351  }
352  }
353  break;
354  case SKIP_TYPE_COL:
355  for (int mb_x = 0; mb_x < h->c.mb_width; mb_x++) {
356  if (get_bits_left(&h->gb) < 1)
357  return AVERROR_INVALIDDATA;
358  if (get_bits1(&h->gb)) {
359  for (int mb_y = 0; mb_y < h->c.mb_height; mb_y++)
360  mb_type[mb_y * h->c.mb_stride + mb_x] =
362  } else {
363  if (get_bits_left(&h->gb) < h->c.mb_height)
364  return AVERROR_INVALIDDATA;
365  for (int mb_y = 0; mb_y < h->c.mb_height; mb_y++)
366  mb_type[mb_y * h->c.mb_stride + mb_x] =
368  }
369  }
370  break;
371  }
372 
373  for (int mb_y = 0; mb_y < h->c.mb_height; mb_y++)
374  for (int mb_x = 0; mb_x < h->c.mb_width; mb_x++)
375  coded_mb_count += !IS_SKIP(mb_type[mb_y * h->c.mb_stride + mb_x]);
376 
377  if (coded_mb_count > get_bits_left(&h->gb))
378  return AVERROR_INVALIDDATA;
379 
380  return 0;
381 }
382 
384 {
385  H263DecContext *const h = &w->ms.h;
386  GetBitContext gb;
387  int fps;
388  int code;
389 
390  if (avctx->extradata_size < 4)
391  return AVERROR_INVALIDDATA;
392 
393  init_get_bits(&gb, avctx->extradata, 32);
394 
395  fps = get_bits(&gb, 5);
396  w->ms.bit_rate = get_bits(&gb, 11) * 1024;
397  w->mspel_bit = get_bits1(&gb);
398  h->loop_filter = get_bits1(&gb);
399  w->abt_flag = get_bits1(&gb);
400  w->j_type_bit = get_bits1(&gb);
401  w->top_left_mv_flag = get_bits1(&gb);
402  w->per_mb_rl_bit = get_bits1(&gb);
403  code = get_bits(&gb, 3);
404 
405  if (code == 0)
406  return AVERROR_INVALIDDATA;
407 
408  h->slice_height = h->c.mb_height / code;
409 
410  if (avctx->debug & FF_DEBUG_PICT_INFO)
411  av_log(avctx, AV_LOG_DEBUG,
412  "fps:%d, br:%d, qpbit:%d, abt_flag:%d, j_type_bit:%d, "
413  "tl_mv_flag:%d, mbrl_bit:%d, code:%d, loop_filter:%d, "
414  "slices:%d\n",
415  fps, w->ms.bit_rate, w->mspel_bit, w->abt_flag, w->j_type_bit,
416  w->top_left_mv_flag, w->per_mb_rl_bit, code, h->loop_filter,
417  code);
418  return 0;
419 }
420 
422 {
423  int code;
424 
425  h->c.pict_type = get_bits1(&h->gb) + 1;
426  if (h->c.pict_type == AV_PICTURE_TYPE_I) {
427  code = get_bits(&h->gb, 7);
428  av_log(h->c.avctx, AV_LOG_DEBUG, "I7:%X/\n", code);
429  }
430  h->c.chroma_qscale = h->c.qscale = get_bits(&h->gb, 5);
431  if (h->c.qscale <= 0)
432  return AVERROR_INVALIDDATA;
433 
434  if (h->c.pict_type != AV_PICTURE_TYPE_I && show_bits(&h->gb, 1)) {
435  GetBitContext gb = h->gb;
436  int skip_type = get_bits(&gb, 2);
437  int run = skip_type == SKIP_TYPE_COL ? h->c.mb_width : h->c.mb_height;
438 
439  while (run > 0) {
440  int block = FFMIN(run, 25);
441  if (get_bits(&gb, block) + 1 != 1<<block)
442  break;
443  run -= block;
444  }
445  if (!run)
446  return FRAME_SKIPPED;
447  }
448 
449  return 0;
450 }
451 
453 {
454  WMV2DecContext *const w = (WMV2DecContext *)h;
455 
456  if (h->c.pict_type == AV_PICTURE_TYPE_I) {
457  /* Is filling with zeroes really the right thing to do? */
458  memset(h->c.cur_pic.mb_type, 0,
459  sizeof(*h->c.cur_pic.mb_type) * h->c.mb_height * h->c.mb_stride);
460  if (w->j_type_bit)
461  w->j_type = get_bits1(&h->gb);
462  else
463  w->j_type = 0; // FIXME check
464 
465  if (!w->j_type) {
466  if (w->per_mb_rl_bit)
467  w->ms.per_mb_rl_table = get_bits1(&h->gb);
468  else
469  w->ms.per_mb_rl_table = 0;
470 
471  if (!w->ms.per_mb_rl_table) {
472  w->ms.rl_chroma_table_index = decode012(&h->gb);
473  w->ms.rl_table_index = decode012(&h->gb);
474  }
475 
476  w->ms.dc_table_index = get_bits1(&h->gb);
477 
478  // at minimum one bit per macroblock is required at least in a valid frame,
479  // we discard frames much smaller than this. Frames smaller than 1/8 of the
480  // smallest "black/skip" frame generally contain not much recoverable content
481  // while at the same time they have the highest computational requirements
482  // per byte
483  if (get_bits_left(&h->gb) * 8LL < (h->c.width+15)/16 * ((h->c.height+15)/16))
484  return AVERROR_INVALIDDATA;
485  }
486  h->c.inter_intra_pred = 0;
487  h->c.no_rounding = 1;
488  if (h->c.avctx->debug & FF_DEBUG_PICT_INFO) {
489  av_log(h->c.avctx, AV_LOG_DEBUG,
490  "qscale:%d rlc:%d rl:%d dc:%d mbrl:%d j_type:%d \n",
491  h->c.qscale, w->ms.rl_chroma_table_index, w->ms.rl_table_index,
492  w->ms.dc_table_index, w->ms.per_mb_rl_table, w->j_type);
493  }
494  } else {
495  int cbp_index;
496  int ret;
497  w->j_type = 0;
498 
499  ret = parse_mb_skip(w);
500  if (ret < 0)
501  return ret;
502  cbp_index = decode012(&h->gb);
503  w->cbp_table_index = wmv2_get_cbp_table_index(h->c.qscale, cbp_index);
504 
505  if (w->mspel_bit)
506  h->c.mspel = get_bits1(&h->gb);
507  else
508  h->c.mspel = 0; // FIXME check
509 
510  if (w->abt_flag) {
511  w->per_mb_abt = get_bits1(&h->gb) ^ 1;
512  if (!w->per_mb_abt)
513  w->abt_type = decode012(&h->gb);
514  }
515 
516  if (w->per_mb_rl_bit)
517  w->ms.per_mb_rl_table = get_bits1(&h->gb);
518  else
519  w->ms.per_mb_rl_table = 0;
520 
521  if (!w->ms.per_mb_rl_table) {
522  w->ms.rl_table_index = decode012(&h->gb);
523  w->ms.rl_chroma_table_index = w->ms.rl_table_index;
524  }
525 
526  if (get_bits_left(&h->gb) < 2)
527  return AVERROR_INVALIDDATA;
528 
529  w->ms.dc_table_index = get_bits1(&h->gb);
530  w->ms.mv_table_index = get_bits1(&h->gb);
531 
532  h->c.inter_intra_pred = 0; // (h->c.width * h->c.height < 320 * 240 && w->ms.bit_rate <= II_BITRATE);
533  h->c.no_rounding ^= 1;
534 
535  if (h->c.avctx->debug & FF_DEBUG_PICT_INFO) {
536  av_log(h->c.avctx, AV_LOG_DEBUG,
537  "rl:%d rlc:%d dc:%d mv:%d mbrl:%d qp:%d mspel:%d "
538  "per_mb_abt:%d abt_type:%d cbp:%d ii:%d\n",
539  w->ms.rl_table_index, w->ms.rl_chroma_table_index,
540  w->ms.dc_table_index, w->ms.mv_table_index,
541  w->ms.per_mb_rl_table, h->c.qscale, h->c.mspel,
542  w->per_mb_abt, w->abt_type, w->cbp_table_index,
543  h->c.inter_intra_pred);
544  }
545  }
546  w->ms.esc3_level_length = 0;
547  w->ms.esc3_run_length = 0;
548 
549  if (w->j_type) {
550  ff_intrax8_decode_picture(&w->x8, h->c.cur_pic.ptr,
551  &h->gb, &h->c.mb_x, &h->c.mb_y,
552  2 * h->c.qscale, (h->c.qscale - 1) | 1,
553  h->loop_filter, h->c.low_delay);
554 
555  ff_er_add_slice(&h->c.er, 0, 0,
556  (h->c.mb_x >> 1) - 1, (h->c.mb_y >> 1) - 1,
557  ER_MB_END);
558  return 1;
559  }
560 
561  return 0;
562 }
563 
564 static inline void wmv2_decode_motion(WMV2DecContext *w, int *mx_ptr, int *my_ptr)
565 {
566  H263DecContext *const h = &w->ms.h;
567 
568  ff_msmpeg4_decode_motion(&w->ms, mx_ptr, my_ptr);
569 
570  if ((((*mx_ptr) | (*my_ptr)) & 1) && h->c.mspel)
571  w->hshift = get_bits1(&h->gb);
572  else
573  w->hshift = 0;
574 }
575 
576 static int16_t *wmv2_pred_motion(WMV2DecContext *w, int *px, int *py)
577 {
578  H263DecContext *const h = &w->ms.h;
579  int diff, type;
580 
581  int wrap = h->c.b8_stride;
582  int xy = h->c.block_index[0];
583 
584  int16_t *mot_val = h->c.cur_pic.motion_val[0][xy];
585 
586  const int16_t *A = h->c.cur_pic.motion_val[0][xy - 1];
587  const int16_t *B = h->c.cur_pic.motion_val[0][xy - wrap];
588  const int16_t *C = h->c.cur_pic.motion_val[0][xy + 2 - wrap];
589 
590  if (h->c.mb_x && !h->c.first_slice_line && !h->c.mspel && w->top_left_mv_flag)
591  diff = FFMAX(FFABS(A[0] - B[0]), FFABS(A[1] - B[1]));
592  else
593  diff = 0;
594 
595  if (diff >= 8)
596  type = get_bits1(&h->gb);
597  else
598  type = 2;
599 
600  if (type == 0) {
601  *px = A[0];
602  *py = A[1];
603  } else if (type == 1) {
604  *px = B[0];
605  *py = B[1];
606  } else {
607  /* special case for first (slice) line */
608  if (h->c.first_slice_line) {
609  *px = A[0];
610  *py = A[1];
611  } else {
612  *px = mid_pred(A[0], B[0], C[0]);
613  *py = mid_pred(A[1], B[1], C[1]);
614  }
615  }
616 
617  return mot_val;
618 }
619 
620 static inline int wmv2_decode_inter_block(WMV2DecContext *w, int16_t *block,
621  int n, int cbp)
622 {
623  H263DecContext *const h = &w->ms.h;
624  static const int sub_cbp_table[3] = { 2, 3, 1 };
625  int sub_cbp, ret;
626 
627  if (!cbp) {
628  h->c.block_last_index[n] = -1;
629  return 0;
630  }
631 
632  if (w->per_block_abt)
633  w->abt_type = decode012(&h->gb);
634  w->abt_type_table[n] = w->abt_type;
635 
636  if (w->abt_type) {
637  const uint8_t *scantable = w->abt_type == 1 ? ff_wmv2_scantableA : ff_wmv2_scantableB;
638 
639  sub_cbp = sub_cbp_table[decode012(&h->gb)];
640 
641  if (sub_cbp & 1) {
642  ret = ff_msmpeg4_decode_block(&w->ms, block, n, 1, scantable);
643  if (ret < 0)
644  return ret;
645  }
646 
647  if (sub_cbp & 2) {
648  ret = ff_msmpeg4_decode_block(&w->ms, w->abt_block2[n], n, 1, scantable);
649  if (ret < 0)
650  return ret;
651  }
652 
653  h->c.block_last_index[n] = 63;
654 
655  return 0;
656  } else {
657  return ff_msmpeg4_decode_block(&w->ms, block, n, 1,
658  h->c.inter_scantable.permutated);
659  }
660 }
661 
662 static int wmv2_decode_mb(H263DecContext *const h)
663 {
664  /* The following is only allowed because this decoder
665  * does not use slice threading. */
666  WMV2DecContext *const w = (WMV2DecContext *) h;
667  MSMP4DecContext *const ms = &w->ms;
668  int cbp, code, i, ret;
669  uint8_t *coded_val;
670 
671  if (w->j_type)
672  return 0;
673 
674  if (h->c.pict_type == AV_PICTURE_TYPE_P) {
675  if (IS_SKIP(h->c.cur_pic.mb_type[h->c.mb_y * h->c.mb_stride + h->c.mb_x])) {
676  /* skip mb */
677  h->c.mb_intra = 0;
678  for (i = 0; i < 6; i++)
679  h->c.block_last_index[i] = -1;
680  h->c.mv_dir = MV_DIR_FORWARD;
681  h->c.mv_type = MV_TYPE_16X16;
682  h->c.mv[0][0][0] = 0;
683  h->c.mv[0][0][1] = 0;
684  h->c.mb_skipped = 1;
685  w->hshift = 0;
686  return 0;
687  }
688  if (get_bits_left(&h->gb) <= 0)
689  return AVERROR_INVALIDDATA;
690 
691  code = get_vlc2(&h->gb, ff_mb_non_intra_vlc[w->cbp_table_index],
693  h->c.mb_intra = (~code & 0x40) >> 6;
694 
695  cbp = code & 0x3f;
696  } else {
697  h->c.mb_intra = 1;
698  if (get_bits_left(&h->gb) <= 0)
699  return AVERROR_INVALIDDATA;
702  /* predict coded block pattern */
703  cbp = 0;
704  for (i = 0; i < 6; i++) {
705  int val = ((code >> (5 - i)) & 1);
706  if (i < 4) {
707  int pred = ff_msmpeg4_coded_block_pred(&h->c, i, &coded_val);
708  val = val ^ pred;
709  *coded_val = val;
710  }
711  cbp |= val << (5 - i);
712  }
713  }
714 
715  if (!h->c.mb_intra) {
716  int mx, my;
717  wmv2_pred_motion(w, &mx, &my);
718 
719  if (cbp) {
720  h->c.bdsp.clear_blocks(h->block[0]);
721  if (ms->per_mb_rl_table) {
722  ms->rl_table_index = decode012(&h->gb);
724  }
725 
726  if (w->abt_flag && w->per_mb_abt) {
727  w->per_block_abt = get_bits1(&h->gb);
728  if (!w->per_block_abt)
729  w->abt_type = decode012(&h->gb);
730  } else
731  w->per_block_abt = 0;
732  }
733 
734  wmv2_decode_motion(w, &mx, &my);
735 
736  h->c.mv_dir = MV_DIR_FORWARD;
737  h->c.mv_type = MV_TYPE_16X16;
738  h->c.mv[0][0][0] = mx;
739  h->c.mv[0][0][1] = my;
740 
741  for (i = 0; i < 6; i++) {
742  if ((ret = wmv2_decode_inter_block(w, h->block[i], i, (cbp >> (5 - i)) & 1)) < 0) {
743  av_log(h->c.avctx, AV_LOG_ERROR,
744  "\nerror while decoding inter block: %d x %d (%d)\n",
745  h->c.mb_x, h->c.mb_y, i);
746  return ret;
747  }
748  }
749  } else {
750  if (h->c.pict_type == AV_PICTURE_TYPE_P)
751  ff_dlog(h->c.avctx, "%d%d ", h->c.inter_intra_pred, cbp);
752  ff_dlog(h->c.avctx, "I at %d %d %d %06X\n", h->c.mb_x, h->c.mb_y,
753  ((cbp & 3) ? 1 : 0) + ((cbp & 0x3C) ? 2 : 0),
754  show_bits(&h->gb, 24));
755  h->c.ac_pred = get_bits1(&h->gb);
756  if (h->c.inter_intra_pred) {
757  h->c.h263_aic_dir = get_vlc2(&h->gb, ff_inter_intra_vlc,
759  ff_dlog(h->c.avctx, "%d%d %d %d/",
760  h->c.ac_pred, h->c.h263_aic_dir, h->c.mb_x, h->c.mb_y);
761  }
762  if (ms->per_mb_rl_table && cbp) {
763  ms->rl_table_index = decode012(&h->gb);
765  }
766 
767  h->c.bdsp.clear_blocks(h->block[0]);
768  for (i = 0; i < 6; i++) {
769  ret = ff_msmpeg4_decode_block(ms, h->block[i], i, (cbp >> (5 - i)) & 1, NULL);
770  if (ret < 0) {
771  av_log(h->c.avctx, AV_LOG_ERROR,
772  "\nerror while decoding intra block: %d x %d (%d)\n",
773  h->c.mb_x, h->c.mb_y, i);
774  return ret;
775  }
776  }
777  }
778 
779  return 0;
780 }
781 
783 {
784  WMV2DecContext *const w = avctx->priv_data;
785  H263DecContext *const h = &w->ms.h;
786  MpegEncContext *const s = &h->c;
787  int ret;
788 
790 
791  if ((ret = ff_msmpeg4_decode_init(avctx)) < 0)
792  return ret;
793 
794  h->decode_header = wmv2_decode_picture_header;
795  h->decode_mb = wmv2_decode_mb;
796 
797  decode_ext_header(avctx, w);
798 
799  return ff_intrax8_common_init(avctx, &w->x8, h->block[0],
800  s->mb_width, s->mb_height);
801 }
802 
804 {
805  WMV2DecContext *const w = avctx->priv_data;
806 
807  ff_intrax8_common_end(&w->x8);
808  return ff_mpv_decode_close(avctx);
809 }
810 
812  .p.name = "wmv2",
813  CODEC_LONG_NAME("Windows Media Video 8"),
814  .p.type = AVMEDIA_TYPE_VIDEO,
815  .p.id = AV_CODEC_ID_WMV2,
816  .priv_data_size = sizeof(WMV2DecContext),
821  .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
822 };
WMV2DecContext::abt_type_table
int abt_type_table[6]
Definition: wmv2dec.c:51
A
#define A(x)
Definition: vpx_arith.h:28
wmv2_decode_mb
static int wmv2_decode_mb(H263DecContext *const h)
Definition: wmv2dec.c:662
MV_TYPE_16X16
#define MV_TYPE_16X16
1 vector for the whole mb
Definition: mpegvideo.h:172
wmv2_mspel8_h_lowpass
static void wmv2_mspel8_h_lowpass(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int h)
Definition: wmv2dec.c:63
av_clip
#define av_clip
Definition: common.h:100
FF_CODEC_CAP_INIT_CLEANUP
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Definition: codec_internal.h:42
get_bits_left
static int get_bits_left(GetBitContext *gb)
Definition: get_bits.h:688
wmv2_get_cbp_table_index
static av_always_inline int wmv2_get_cbp_table_index(int qscale, int cbp_index)
Definition: wmv2.h:33
wmv2_decode_inter_block
static int wmv2_decode_inter_block(WMV2DecContext *w, int16_t *block, int n, int cbp)
Definition: wmv2dec.c:620
mem_internal.h
ff_intrax8_decode_picture
int ff_intrax8_decode_picture(IntraX8Context *w, MPVPicture *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:718
src1
const pixel * src1
Definition: h264pred_template.c:420
WMV2DecContext::abt_block2
int16_t abt_block2[6][64]
Definition: wmv2dec.c:60
put_mspel8_mc10_c
static void put_mspel8_mc10_c(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: wmv2dec.c:112
WMV2DecContext::put_mspel_pixels_tab
qpel_mc_func put_mspel_pixels_tab[8]
Definition: wmv2dec.c:45
ff_wmv2_decode_secondary_picture_header
int ff_wmv2_decode_secondary_picture_header(H263DecContext *const h)
Definition: wmv2dec.c:452
ff_wmv2_decoder
const FFCodec ff_wmv2_decoder
Definition: wmv2dec.c:811
ff_simple_idct84_add
void ff_simple_idct84_add(uint8_t *dest, ptrdiff_t line_size, int16_t *block)
Definition: simple_idct.c:189
MSMP4_MB_INTRA_VLC_BITS
#define MSMP4_MB_INTRA_VLC_BITS
Definition: msmpeg4_vc1_data.h:36
wmv2_pred_motion
static int16_t * wmv2_pred_motion(WMV2DecContext *w, int *px, int *py)
Definition: wmv2dec.c:576
MB_TYPE_16x16
#define MB_TYPE_16x16
Definition: mpegutils.h:41
WMV2DecContext::mspel_bit
int mspel_bit
Definition: wmv2dec.c:54
WMV2DecContext::cbp_table_index
int cbp_table_index
Definition: wmv2dec.c:55
half
static uint8_t half(int a, int b)
Definition: mobiclip.c:540
FFCodec
Definition: codec_internal.h:127
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:840
mpegvideo.h
ff_wmv2_add_mb
void ff_wmv2_add_mb(MpegEncContext *s, int16_t block1[6][64], uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr)
Definition: wmv2dec.c:298
FFMAX
#define FFMAX(a, b)
Definition: macros.h:47
mpegutils.h
WMV2DecContext::top_left_mv_flag
int top_left_mv_flag
Definition: wmv2dec.c:56
init_get_bits
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
Definition: get_bits.h:517
wmv2_decode_end
static av_cold int wmv2_decode_end(AVCodecContext *avctx)
Definition: wmv2dec.c:803
ff_crop_tab
#define ff_crop_tab
Definition: motionpixels_tablegen.c:26
FF_DEBUG_PICT_INFO
#define FF_DEBUG_PICT_INFO
Definition: avcodec.h:1387
MSMP4DecContext::rl_table_index
int rl_table_index
Definition: msmpeg4dec.h:37
px
#define px
Definition: ops_tmpl_float.c:35
close
static av_cold void close(AVCodecParserContext *s)
Definition: apv_parser.c:197
WMV2DecContext::per_block_abt
int per_block_abt
Definition: wmv2dec.c:53
get_bits
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Definition: get_bits.h:337
mx
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t mx
Definition: dsp.h:57
FFCodec::p
AVCodec p
The public AVCodec.
Definition: codec_internal.h:131
WMV2DecContext::ms
MSMP4DecContext ms
Definition: wmv2dec.c:42
WMV2DecContext
Definition: wmv2dec.c:41
wrap
#define wrap(func)
Definition: neontest.h:65
WMV2DecContext::x8
IntraX8Context x8
Definition: wmv2dec.c:43
put_mspel8_mc22_c
static void put_mspel8_mc22_c(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: wmv2dec.c:162
WMV2DecContext::per_mb_rl_bit
int per_mb_rl_bit
Definition: wmv2dec.c:57
ff_mspel_motion
void ff_mspel_motion(MPVContext *const s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, uint8_t *const *ref_picture, const op_pixels_func(*pix_op)[4], int motion_x, int motion_y, int h)
Definition: wmv2dec.c:182
GetBitContext
Definition: get_bits.h:109
wmv2_decode_picture_header
static int wmv2_decode_picture_header(H263DecContext *const h)
Definition: wmv2dec.c:421
val
static double val(void *priv, double ch)
Definition: aeval.c:77
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
ff_msmpeg4_decode_motion
void ff_msmpeg4_decode_motion(MSMP4DecContext *const ms, int *mx_ptr, int *my_ptr)
Definition: msmpeg4dec.c:802
WMV2DecContext::abt_type
int abt_type
Definition: wmv2dec.c:50
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
avassert.h
mpegvideodec.h
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:210
h263dec.h
av_cold
#define av_cold
Definition: attributes.h:106
SKIP_TYPE_COL
#define SKIP_TYPE_COL
Definition: wmv2.h:31
AVCodecContext::extradata_size
int extradata_size
Definition: avcodec.h:523
FF_CODEC_DECODE_CB
#define FF_CODEC_DECODE_CB(func)
Definition: codec_internal.h:347
s
#define s(width, name)
Definition: cbs_vp9.c:198
ff_intrax8_common_init
av_cold int ff_intrax8_common_init(AVCodecContext *avctx, IntraX8Context *w, int16_t block[64], int mb_width, int mb_height)
Initialize IntraX8 frame decoder.
Definition: intrax8.c:679
WMV2DecContext::per_mb_abt
int per_mb_abt
Definition: wmv2dec.c:52
ff_mb_non_intra_vlc
const VLCElem * ff_mb_non_intra_vlc[4]
Definition: msmpeg4dec.c:69
MSMP4DecContext::per_mb_rl_table
int per_mb_rl_table
Definition: msmpeg4dec.h:41
put_mspel8_mc02_c
static void put_mspel8_mc02_c(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: wmv2dec.c:133
AV_CODEC_ID_WMV2
@ AV_CODEC_ID_WMV2
Definition: codec_id.h:70
decode_ext_header
static av_cold int decode_ext_header(AVCodecContext *avctx, WMV2DecContext *w)
Definition: wmv2dec.c:383
wmv2data.h
ff_simple_idct48_add
void ff_simple_idct48_add(uint8_t *dest, ptrdiff_t line_size, int16_t *block)
Definition: simple_idct.c:204
WMV2DecContext::j_type
int j_type
Definition: wmv2dec.c:48
B
#define B
Definition: huffyuv.h:42
wmv2_add_block
static void wmv2_add_block(WMV2DecContext *w, int16_t blocks1[][64], uint8_t *dst, int stride, int n)
Definition: wmv2dec.c:271
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:231
IS_SKIP
#define IS_SKIP(a)
Definition: mpegutils.h:75
simple_idct.h
SKIP_TYPE_NONE
#define SKIP_TYPE_NONE
Definition: wmv2.h:28
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:332
IntraX8Context
Definition: intrax8.h:29
my
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t my
Definition: dsp.h:57
FFABS
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
Definition: common.h:74
if
if(ret)
Definition: filter_design.txt:179
WMV2DecContext::hshift
int hshift
Definition: wmv2dec.c:58
ff_put_pixels8_l2_8
void ff_put_pixels8_l2_8(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, int src_stride1, int src_stride2, int h)
Definition: qpeldsp.c:731
NULL
#define NULL
Definition: coverity.c:32
run
uint8_t run
Definition: svq3.c:207
parse_mb_skip
static int parse_mb_skip(WMV2DecContext *w)
Definition: wmv2dec.c:315
ff_intrax8_common_end
av_cold void ff_intrax8_common_end(IntraX8Context *w)
Destroy IntraX8 frame structure.
Definition: intrax8.c:713
MSMP4DecContext
Definition: msmpeg4dec.h:32
ff_mpv_decode_close
av_cold int ff_mpv_decode_close(AVCodecContext *avctx)
Definition: mpegvideo_dec.c:166
av_unreachable
#define av_unreachable(msg)
Asserts that are used as compiler optimization hints depending upon ASSERT_LEVEL and NBDEBUG.
Definition: avassert.h:116
SKIP_TYPE_MPEG
#define SKIP_TYPE_MPEG
Definition: wmv2.h:29
AV_PICTURE_TYPE_I
@ AV_PICTURE_TYPE_I
Intra.
Definition: avutil.h:278
get_bits1
static unsigned int get_bits1(GetBitContext *s)
Definition: get_bits.h:391
INTER_INTRA_VLC_BITS
#define INTER_INTRA_VLC_BITS
Definition: msmpeg4dec.h:29
MSMP4DecContext::rl_chroma_table_index
int rl_chroma_table_index
Definition: msmpeg4dec.h:38
mathops.h
ff_h263_decode_frame
int ff_h263_decode_frame(AVCodecContext *avctx, AVFrame *pict, int *got_frame, AVPacket *avpkt)
Definition: h263dec.c:440
put_mspel8_mc20_c
static void put_mspel8_mc20_c(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: wmv2dec.c:120
qpeldsp.h
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:645
op_pixels_func
void(* op_pixels_func)(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h)
Average and put pixel Widths can be 16, 8, 4 or 2.
Definition: hpeldsp.h:39
wmv2.h
qpel_mc_func
void(* qpel_mc_func)(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: qpeldsp.h:65
ff_inter_intra_vlc
VLCElem ff_inter_intra_vlc[8]
Definition: msmpeg4dec.c:74
intrax8.h
ff_dlog
#define ff_dlog(a,...)
Definition: tableprint_vlc.h:28
ff_msmp4_mb_i_vlc
VLCElem ff_msmp4_mb_i_vlc[536]
Definition: msmpeg4_vc1_data.c:35
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:550
AV_CODEC_CAP_DR1
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:52
MB_NON_INTRA_VLC_BITS
#define MB_NON_INTRA_VLC_BITS
Definition: msmpeg4dec.h:30
AV_CODEC_FLAG_GRAY
#define AV_CODEC_FLAG_GRAY
Only decode/encode grayscale.
Definition: avcodec.h:302
put_mspel8_mc32_c
static void put_mspel8_mc32_c(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: wmv2dec.c:150
codec_internal.h
DECLARE_ALIGNED
#define DECLARE_ALIGNED(n, t, v)
Definition: mem_internal.h:104
dst
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition: dsp.h:87
ff_wmv2_scantableB
const uint8_t ff_wmv2_scantableB[64]
Definition: wmv2data.c:30
FRAME_SKIPPED
#define FRAME_SKIPPED
Frame is not coded.
Definition: h263dec.h:90
i
#define i(width, name, range_min, range_max)
Definition: cbs_h264.c:63
put_mspel8_mc30_c
static void put_mspel8_mc30_c(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: wmv2dec.c:125
MB_TYPE_SKIP
#define MB_TYPE_SKIP
Definition: mpegutils.h:61
ff_wmv2_scantableA
const uint8_t ff_wmv2_scantableA[64]
Definition: wmv2data.c:23
wmv2_decode_motion
static void wmv2_decode_motion(WMV2DecContext *w, int *mx_ptr, int *my_ptr)
Definition: wmv2dec.c:564
ff_put_pixels8x8_c
void ff_put_pixels8x8_c(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: qpeldsp.c:704
diff
static av_always_inline int diff(const struct color_info *a, const struct color_info *b, const int trans_thresh)
Definition: vf_paletteuse.c:166
block1
static int16_t block1[64]
Definition: dct.c:126
msmpeg4dec.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
SKIP_TYPE_ROW
#define SKIP_TYPE_ROW
Definition: wmv2.h:30
put_mspel8_mc12_c
static void put_mspel8_mc12_c(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
Definition: wmv2dec.c:138
ff_msmpeg4_decode_block
int ff_msmpeg4_decode_block(MSMP4DecContext *const ms, int16_t *block, int n, int coded, const uint8_t *scan_table)
Definition: msmpeg4dec.c:612
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
AVCodecContext::extradata
uint8_t * extradata
Out-of-band global headers that may be used by some codecs.
Definition: avcodec.h:522
show_bits
static unsigned int show_bits(GetBitContext *s, int n)
Show 1-25 bits.
Definition: get_bits.h:373
decode012
static int BS_FUNC() decode012(BSCTX *bc)
Return decoded truncated unary code for the values 0, 1, 2.
Definition: bitstream_template.h:444
src2
const pixel * src2
Definition: h264pred_template.c:421
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
WMV2DecContext::j_type_bit
int j_type_bit
Definition: wmv2dec.c:47
AVCodec::name
const char * name
Name of the codec implementation.
Definition: codec.h:179
wmv2_mspel_init
static av_cold void wmv2_mspel_init(WMV2DecContext *w)
Definition: wmv2dec.c:170
avcodec.h
wmv2_mspel8_v_lowpass
static void wmv2_mspel8_v_lowpass(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int w)
Definition: wmv2dec.c:82
msmpeg4.h
mid_pred
#define mid_pred
Definition: mathops.h:115
ret
ret
Definition: filter_design.txt:187
wmv2dec.h
pred
static const float pred[4]
Definition: siprdata.h:259
H263DecContext
Definition: h263dec.h:43
AVCodecContext
main external API structure.
Definition: avcodec.h:439
WMV2DecContext::abt_flag
int abt_flag
Definition: wmv2dec.c:49
cm
#define cm
Definition: dvbsubdec.c:40
wmv2_decode_init
static av_cold int wmv2_decode_init(AVCodecContext *avctx)
Definition: wmv2dec.c:782
src0
const pixel *const src0
Definition: h264pred_template.c:419
AVCodecContext::debug
int debug
debug
Definition: avcodec.h:1386
AV_PICTURE_TYPE_P
@ AV_PICTURE_TYPE_P
Predicted.
Definition: avutil.h:279
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:200
msmpeg4_vc1_data.h
ER_MB_END
#define ER_MB_END
Definition: error_resilience.h:37
w
uint8_t w
Definition: llvidencdsp.c:39
MV_DIR_FORWARD
#define MV_DIR_FORWARD
Definition: mpegvideo.h:168
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:466
AV_CODEC_CAP_DRAW_HORIZ_BAND
#define AV_CODEC_CAP_DRAW_HORIZ_BAND
Decoder can use draw_horiz_band callback.
Definition: codec.h:44
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:27
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
h
h
Definition: vp9dsp_template.c:2070
stride
#define stride
Definition: h264pred_template.c:536
MAX_NEG_CROP
#define MAX_NEG_CROP
Definition: mathops.h:31
ff_msmpeg4_decode_init
av_cold int ff_msmpeg4_decode_init(AVCodecContext *avctx)
Definition: msmpeg4dec.c:834
MpegEncContext
MpegEncContext.
Definition: mpegvideo.h:67
MB_TYPE_FORWARD_MV
#define MB_TYPE_FORWARD_MV
Definition: mpegutils.h:49
src
#define src
Definition: vp8dsp.c:248
ff_msmpeg4_coded_block_pred
int ff_msmpeg4_coded_block_pred(MpegEncContext *s, int n, uint8_t **coded_block_ptr)
Definition: msmpeg4.c:164