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  for (int mb_x = 0; mb_x < h->c.mb_width; mb_x++)
347  mb_type[mb_y * h->c.mb_stride + mb_x] =
349  }
350  }
351  break;
352  case SKIP_TYPE_COL:
353  for (int mb_x = 0; mb_x < h->c.mb_width; mb_x++) {
354  if (get_bits_left(&h->gb) < 1)
355  return AVERROR_INVALIDDATA;
356  if (get_bits1(&h->gb)) {
357  for (int mb_y = 0; mb_y < h->c.mb_height; mb_y++)
358  mb_type[mb_y * h->c.mb_stride + mb_x] =
360  } else {
361  for (int mb_y = 0; mb_y < h->c.mb_height; mb_y++)
362  mb_type[mb_y * h->c.mb_stride + mb_x] =
364  }
365  }
366  break;
367  }
368 
369  for (int mb_y = 0; mb_y < h->c.mb_height; mb_y++)
370  for (int mb_x = 0; mb_x < h->c.mb_width; mb_x++)
371  coded_mb_count += !IS_SKIP(mb_type[mb_y * h->c.mb_stride + mb_x]);
372 
373  if (coded_mb_count > get_bits_left(&h->gb))
374  return AVERROR_INVALIDDATA;
375 
376  return 0;
377 }
378 
380 {
381  H263DecContext *const h = &w->ms.h;
382  GetBitContext gb;
383  int fps;
384  int code;
385 
386  if (avctx->extradata_size < 4)
387  return AVERROR_INVALIDDATA;
388 
389  init_get_bits(&gb, avctx->extradata, 32);
390 
391  fps = get_bits(&gb, 5);
392  w->ms.bit_rate = get_bits(&gb, 11) * 1024;
393  w->mspel_bit = get_bits1(&gb);
394  h->loop_filter = get_bits1(&gb);
395  w->abt_flag = get_bits1(&gb);
396  w->j_type_bit = get_bits1(&gb);
397  w->top_left_mv_flag = get_bits1(&gb);
398  w->per_mb_rl_bit = get_bits1(&gb);
399  code = get_bits(&gb, 3);
400 
401  if (code == 0)
402  return AVERROR_INVALIDDATA;
403 
404  h->slice_height = h->c.mb_height / code;
405 
406  if (avctx->debug & FF_DEBUG_PICT_INFO)
407  av_log(avctx, AV_LOG_DEBUG,
408  "fps:%d, br:%d, qpbit:%d, abt_flag:%d, j_type_bit:%d, "
409  "tl_mv_flag:%d, mbrl_bit:%d, code:%d, loop_filter:%d, "
410  "slices:%d\n",
411  fps, w->ms.bit_rate, w->mspel_bit, w->abt_flag, w->j_type_bit,
412  w->top_left_mv_flag, w->per_mb_rl_bit, code, h->loop_filter,
413  code);
414  return 0;
415 }
416 
418 {
419  int code;
420 
421  h->c.pict_type = get_bits1(&h->gb) + 1;
422  if (h->c.pict_type == AV_PICTURE_TYPE_I) {
423  code = get_bits(&h->gb, 7);
424  av_log(h->c.avctx, AV_LOG_DEBUG, "I7:%X/\n", code);
425  }
426  h->c.chroma_qscale = h->c.qscale = get_bits(&h->gb, 5);
427  if (h->c.qscale <= 0)
428  return AVERROR_INVALIDDATA;
429 
430  if (h->c.pict_type != AV_PICTURE_TYPE_I && show_bits(&h->gb, 1)) {
431  GetBitContext gb = h->gb;
432  int skip_type = get_bits(&gb, 2);
433  int run = skip_type == SKIP_TYPE_COL ? h->c.mb_width : h->c.mb_height;
434 
435  while (run > 0) {
436  int block = FFMIN(run, 25);
437  if (get_bits(&gb, block) + 1 != 1<<block)
438  break;
439  run -= block;
440  }
441  if (!run)
442  return FRAME_SKIPPED;
443  }
444 
445  return 0;
446 }
447 
449 {
450  WMV2DecContext *const w = (WMV2DecContext *)h;
451 
452  if (h->c.pict_type == AV_PICTURE_TYPE_I) {
453  /* Is filling with zeroes really the right thing to do? */
454  memset(h->c.cur_pic.mb_type, 0,
455  sizeof(*h->c.cur_pic.mb_type) * h->c.mb_height * h->c.mb_stride);
456  if (w->j_type_bit)
457  w->j_type = get_bits1(&h->gb);
458  else
459  w->j_type = 0; // FIXME check
460 
461  if (!w->j_type) {
462  if (w->per_mb_rl_bit)
463  w->ms.per_mb_rl_table = get_bits1(&h->gb);
464  else
465  w->ms.per_mb_rl_table = 0;
466 
467  if (!w->ms.per_mb_rl_table) {
468  w->ms.rl_chroma_table_index = decode012(&h->gb);
469  w->ms.rl_table_index = decode012(&h->gb);
470  }
471 
472  w->ms.dc_table_index = get_bits1(&h->gb);
473 
474  // at minimum one bit per macroblock is required at least in a valid frame,
475  // we discard frames much smaller than this. Frames smaller than 1/8 of the
476  // smallest "black/skip" frame generally contain not much recoverable content
477  // while at the same time they have the highest computational requirements
478  // per byte
479  if (get_bits_left(&h->gb) * 8LL < (h->c.width+15)/16 * ((h->c.height+15)/16))
480  return AVERROR_INVALIDDATA;
481  }
482  h->c.inter_intra_pred = 0;
483  h->c.no_rounding = 1;
484  if (h->c.avctx->debug & FF_DEBUG_PICT_INFO) {
485  av_log(h->c.avctx, AV_LOG_DEBUG,
486  "qscale:%d rlc:%d rl:%d dc:%d mbrl:%d j_type:%d \n",
487  h->c.qscale, w->ms.rl_chroma_table_index, w->ms.rl_table_index,
488  w->ms.dc_table_index, w->ms.per_mb_rl_table, w->j_type);
489  }
490  } else {
491  int cbp_index;
492  int ret;
493  w->j_type = 0;
494 
495  ret = parse_mb_skip(w);
496  if (ret < 0)
497  return ret;
498  cbp_index = decode012(&h->gb);
499  w->cbp_table_index = wmv2_get_cbp_table_index(h->c.qscale, cbp_index);
500 
501  if (w->mspel_bit)
502  h->c.mspel = get_bits1(&h->gb);
503  else
504  h->c.mspel = 0; // FIXME check
505 
506  if (w->abt_flag) {
507  w->per_mb_abt = get_bits1(&h->gb) ^ 1;
508  if (!w->per_mb_abt)
509  w->abt_type = decode012(&h->gb);
510  }
511 
512  if (w->per_mb_rl_bit)
513  w->ms.per_mb_rl_table = get_bits1(&h->gb);
514  else
515  w->ms.per_mb_rl_table = 0;
516 
517  if (!w->ms.per_mb_rl_table) {
518  w->ms.rl_table_index = decode012(&h->gb);
519  w->ms.rl_chroma_table_index = w->ms.rl_table_index;
520  }
521 
522  if (get_bits_left(&h->gb) < 2)
523  return AVERROR_INVALIDDATA;
524 
525  w->ms.dc_table_index = get_bits1(&h->gb);
526  w->ms.mv_table_index = get_bits1(&h->gb);
527 
528  h->c.inter_intra_pred = 0; // (h->c.width * h->c.height < 320 * 240 && w->ms.bit_rate <= II_BITRATE);
529  h->c.no_rounding ^= 1;
530 
531  if (h->c.avctx->debug & FF_DEBUG_PICT_INFO) {
532  av_log(h->c.avctx, AV_LOG_DEBUG,
533  "rl:%d rlc:%d dc:%d mv:%d mbrl:%d qp:%d mspel:%d "
534  "per_mb_abt:%d abt_type:%d cbp:%d ii:%d\n",
535  w->ms.rl_table_index, w->ms.rl_chroma_table_index,
536  w->ms.dc_table_index, w->ms.mv_table_index,
537  w->ms.per_mb_rl_table, h->c.qscale, h->c.mspel,
538  w->per_mb_abt, w->abt_type, w->cbp_table_index,
539  h->c.inter_intra_pred);
540  }
541  }
542  w->ms.esc3_level_length = 0;
543  w->ms.esc3_run_length = 0;
544 
545  if (w->j_type) {
546  ff_intrax8_decode_picture(&w->x8, h->c.cur_pic.ptr,
547  &h->gb, &h->c.mb_x, &h->c.mb_y,
548  2 * h->c.qscale, (h->c.qscale - 1) | 1,
549  h->loop_filter, h->c.low_delay);
550 
551  ff_er_add_slice(&h->c.er, 0, 0,
552  (h->c.mb_x >> 1) - 1, (h->c.mb_y >> 1) - 1,
553  ER_MB_END);
554  return 1;
555  }
556 
557  return 0;
558 }
559 
560 static inline void wmv2_decode_motion(WMV2DecContext *w, int *mx_ptr, int *my_ptr)
561 {
562  H263DecContext *const h = &w->ms.h;
563 
564  ff_msmpeg4_decode_motion(&w->ms, mx_ptr, my_ptr);
565 
566  if ((((*mx_ptr) | (*my_ptr)) & 1) && h->c.mspel)
567  w->hshift = get_bits1(&h->gb);
568  else
569  w->hshift = 0;
570 }
571 
572 static int16_t *wmv2_pred_motion(WMV2DecContext *w, int *px, int *py)
573 {
574  H263DecContext *const h = &w->ms.h;
575  int diff, type;
576 
577  int wrap = h->c.b8_stride;
578  int xy = h->c.block_index[0];
579 
580  int16_t *mot_val = h->c.cur_pic.motion_val[0][xy];
581 
582  const int16_t *A = h->c.cur_pic.motion_val[0][xy - 1];
583  const int16_t *B = h->c.cur_pic.motion_val[0][xy - wrap];
584  const int16_t *C = h->c.cur_pic.motion_val[0][xy + 2 - wrap];
585 
586  if (h->c.mb_x && !h->c.first_slice_line && !h->c.mspel && w->top_left_mv_flag)
587  diff = FFMAX(FFABS(A[0] - B[0]), FFABS(A[1] - B[1]));
588  else
589  diff = 0;
590 
591  if (diff >= 8)
592  type = get_bits1(&h->gb);
593  else
594  type = 2;
595 
596  if (type == 0) {
597  *px = A[0];
598  *py = A[1];
599  } else if (type == 1) {
600  *px = B[0];
601  *py = B[1];
602  } else {
603  /* special case for first (slice) line */
604  if (h->c.first_slice_line) {
605  *px = A[0];
606  *py = A[1];
607  } else {
608  *px = mid_pred(A[0], B[0], C[0]);
609  *py = mid_pred(A[1], B[1], C[1]);
610  }
611  }
612 
613  return mot_val;
614 }
615 
616 static inline int wmv2_decode_inter_block(WMV2DecContext *w, int16_t *block,
617  int n, int cbp)
618 {
619  H263DecContext *const h = &w->ms.h;
620  static const int sub_cbp_table[3] = { 2, 3, 1 };
621  int sub_cbp, ret;
622 
623  if (!cbp) {
624  h->c.block_last_index[n] = -1;
625  return 0;
626  }
627 
628  if (w->per_block_abt)
629  w->abt_type = decode012(&h->gb);
630  w->abt_type_table[n] = w->abt_type;
631 
632  if (w->abt_type) {
633  const uint8_t *scantable = w->abt_type == 1 ? ff_wmv2_scantableA : ff_wmv2_scantableB;
634 
635  sub_cbp = sub_cbp_table[decode012(&h->gb)];
636 
637  if (sub_cbp & 1) {
638  ret = ff_msmpeg4_decode_block(&w->ms, block, n, 1, scantable);
639  if (ret < 0)
640  return ret;
641  }
642 
643  if (sub_cbp & 2) {
644  ret = ff_msmpeg4_decode_block(&w->ms, w->abt_block2[n], n, 1, scantable);
645  if (ret < 0)
646  return ret;
647  }
648 
649  h->c.block_last_index[n] = 63;
650 
651  return 0;
652  } else {
653  return ff_msmpeg4_decode_block(&w->ms, block, n, 1,
654  h->c.inter_scantable.permutated);
655  }
656 }
657 
658 static int wmv2_decode_mb(H263DecContext *const h)
659 {
660  /* The following is only allowed because this decoder
661  * does not use slice threading. */
662  WMV2DecContext *const w = (WMV2DecContext *) h;
663  MSMP4DecContext *const ms = &w->ms;
664  int cbp, code, i, ret;
665  uint8_t *coded_val;
666 
667  if (w->j_type)
668  return 0;
669 
670  if (h->c.pict_type == AV_PICTURE_TYPE_P) {
671  if (IS_SKIP(h->c.cur_pic.mb_type[h->c.mb_y * h->c.mb_stride + h->c.mb_x])) {
672  /* skip mb */
673  h->c.mb_intra = 0;
674  for (i = 0; i < 6; i++)
675  h->c.block_last_index[i] = -1;
676  h->c.mv_dir = MV_DIR_FORWARD;
677  h->c.mv_type = MV_TYPE_16X16;
678  h->c.mv[0][0][0] = 0;
679  h->c.mv[0][0][1] = 0;
680  h->c.mb_skipped = 1;
681  w->hshift = 0;
682  return 0;
683  }
684  if (get_bits_left(&h->gb) <= 0)
685  return AVERROR_INVALIDDATA;
686 
687  code = get_vlc2(&h->gb, ff_mb_non_intra_vlc[w->cbp_table_index],
689  h->c.mb_intra = (~code & 0x40) >> 6;
690 
691  cbp = code & 0x3f;
692  } else {
693  h->c.mb_intra = 1;
694  if (get_bits_left(&h->gb) <= 0)
695  return AVERROR_INVALIDDATA;
698  /* predict coded block pattern */
699  cbp = 0;
700  for (i = 0; i < 6; i++) {
701  int val = ((code >> (5 - i)) & 1);
702  if (i < 4) {
703  int pred = ff_msmpeg4_coded_block_pred(&h->c, i, &coded_val);
704  val = val ^ pred;
705  *coded_val = val;
706  }
707  cbp |= val << (5 - i);
708  }
709  }
710 
711  if (!h->c.mb_intra) {
712  int mx, my;
713  wmv2_pred_motion(w, &mx, &my);
714 
715  if (cbp) {
716  h->c.bdsp.clear_blocks(h->block[0]);
717  if (ms->per_mb_rl_table) {
718  ms->rl_table_index = decode012(&h->gb);
720  }
721 
722  if (w->abt_flag && w->per_mb_abt) {
723  w->per_block_abt = get_bits1(&h->gb);
724  if (!w->per_block_abt)
725  w->abt_type = decode012(&h->gb);
726  } else
727  w->per_block_abt = 0;
728  }
729 
730  wmv2_decode_motion(w, &mx, &my);
731 
732  h->c.mv_dir = MV_DIR_FORWARD;
733  h->c.mv_type = MV_TYPE_16X16;
734  h->c.mv[0][0][0] = mx;
735  h->c.mv[0][0][1] = my;
736 
737  for (i = 0; i < 6; i++) {
738  if ((ret = wmv2_decode_inter_block(w, h->block[i], i, (cbp >> (5 - i)) & 1)) < 0) {
739  av_log(h->c.avctx, AV_LOG_ERROR,
740  "\nerror while decoding inter block: %d x %d (%d)\n",
741  h->c.mb_x, h->c.mb_y, i);
742  return ret;
743  }
744  }
745  } else {
746  if (h->c.pict_type == AV_PICTURE_TYPE_P)
747  ff_dlog(h->c.avctx, "%d%d ", h->c.inter_intra_pred, cbp);
748  ff_dlog(h->c.avctx, "I at %d %d %d %06X\n", h->c.mb_x, h->c.mb_y,
749  ((cbp & 3) ? 1 : 0) + ((cbp & 0x3C) ? 2 : 0),
750  show_bits(&h->gb, 24));
751  h->c.ac_pred = get_bits1(&h->gb);
752  if (h->c.inter_intra_pred) {
753  h->c.h263_aic_dir = get_vlc2(&h->gb, ff_inter_intra_vlc,
755  ff_dlog(h->c.avctx, "%d%d %d %d/",
756  h->c.ac_pred, h->c.h263_aic_dir, h->c.mb_x, h->c.mb_y);
757  }
758  if (ms->per_mb_rl_table && cbp) {
759  ms->rl_table_index = decode012(&h->gb);
761  }
762 
763  h->c.bdsp.clear_blocks(h->block[0]);
764  for (i = 0; i < 6; i++) {
765  ret = ff_msmpeg4_decode_block(ms, h->block[i], i, (cbp >> (5 - i)) & 1, NULL);
766  if (ret < 0) {
767  av_log(h->c.avctx, AV_LOG_ERROR,
768  "\nerror while decoding intra block: %d x %d (%d)\n",
769  h->c.mb_x, h->c.mb_y, i);
770  return ret;
771  }
772  }
773  }
774 
775  return 0;
776 }
777 
779 {
780  WMV2DecContext *const w = avctx->priv_data;
781  H263DecContext *const h = &w->ms.h;
782  MpegEncContext *const s = &h->c;
783  int ret;
784 
786 
787  if ((ret = ff_msmpeg4_decode_init(avctx)) < 0)
788  return ret;
789 
790  h->decode_header = wmv2_decode_picture_header;
791  h->decode_mb = wmv2_decode_mb;
792 
793  decode_ext_header(avctx, w);
794 
795  return ff_intrax8_common_init(avctx, &w->x8, h->block[0],
796  s->mb_width, s->mb_height);
797 }
798 
800 {
801  WMV2DecContext *const w = avctx->priv_data;
802 
803  ff_intrax8_common_end(&w->x8);
804  return ff_mpv_decode_close(avctx);
805 }
806 
808  .p.name = "wmv2",
809  CODEC_LONG_NAME("Windows Media Video 8"),
810  .p.type = AVMEDIA_TYPE_VIDEO,
811  .p.id = AV_CODEC_ID_WMV2,
812  .priv_data_size = sizeof(WMV2DecContext),
817  .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
818 };
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:658
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:694
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:616
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:448
ff_wmv2_decoder
const FFCodec ff_wmv2_decoder
Definition: wmv2dec.c:807
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:572
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:828
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:799
ff_crop_tab
#define ff_crop_tab
Definition: motionpixels_tablegen.c:26
FF_DEBUG_PICT_INFO
#define FF_DEBUG_PICT_INFO
Definition: avcodec.h:1383
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:417
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:379
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:108
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:651
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
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:560
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
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
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:778
src0
const pixel *const src0
Definition: h264pred_template.c:419
AVCodecContext::debug
int debug
debug
Definition: avcodec.h:1382
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