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/mem_internal.h"
22
23 #include "avcodec.h"
24 #include "codec_internal.h"
25 #include "h263dec.h"
26 #include "intrax8.h"
27 #include "mathops.h"
28 #include "mpegutils.h"
29 #include "mpegvideo.h"
30 #include "msmpeg4.h"
31 #include "msmpeg4data.h"
32 #include "msmpeg4dec.h"
33 #include "simple_idct.h"
34 #include "wmv2.h"
35 #include "wmv2data.h"
36 #include "wmv2dec.h"
37
38 typedef struct WMV2DecContext {
39 MpegEncContext s;
40 WMV2Context common;
41 IntraX8Context x8;
42 int j_type_bit;
43 int j_type;
44 int abt_flag;
45 int abt_type;
46 int abt_type_table[6];
47 int per_mb_abt;
48 int per_block_abt;
49 int mspel_bit;
50 int cbp_table_index;
51 int top_left_mv_flag;
52 int per_mb_rl_bit;
53 int skip_type;
54
55 ScanTable abt_scantable[2];
56 DECLARE_ALIGNED(32, int16_t, abt_block2)[6][64];
57 } WMV2DecContext;
58
wmv2_add_block(WMV2DecContext * w,int16_t * block1,uint8_t * dst,int stride,int n)59 static void wmv2_add_block(WMV2DecContext *w, int16_t *block1,
60 uint8_t *dst, int stride, int n)
61 {
62 MpegEncContext *const s = &w->s;
63
64 if (s->block_last_index[n] >= 0) {
65 switch (w->abt_type_table[n]) {
66 case 0:
67 w->common.wdsp.idct_add(dst, stride, block1);
68 break;
69 case 1:
70 ff_simple_idct84_add(dst, stride, block1);
71 ff_simple_idct84_add(dst + 4 * stride, stride, w->abt_block2[n]);
72 s->bdsp.clear_block(w->abt_block2[n]);
73 break;
74 case 2:
75 ff_simple_idct48_add(dst, stride, block1);
76 ff_simple_idct48_add(dst + 4, stride, w->abt_block2[n]);
77 s->bdsp.clear_block(w->abt_block2[n]);
78 break;
79 default:
80 av_log(s->avctx, AV_LOG_ERROR, "internal error in WMV2 abt\n");
81 }
82 }
83 }
84
ff_wmv2_add_mb(MpegEncContext * s,int16_t block1[6][64],uint8_t * dest_y,uint8_t * dest_cb,uint8_t * dest_cr)85 void ff_wmv2_add_mb(MpegEncContext *s, int16_t block1[6][64],
86 uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr)
87 {
88 WMV2DecContext *const w = (WMV2DecContext *) s;
89
90 wmv2_add_block(w, block1[0], dest_y, s->linesize, 0);
91 wmv2_add_block(w, block1[1], dest_y + 8, s->linesize, 1);
92 wmv2_add_block(w, block1[2], dest_y + 8 * s->linesize, s->linesize, 2);
93 wmv2_add_block(w, block1[3], dest_y + 8 + 8 * s->linesize, s->linesize, 3);
94
95 if (s->avctx->flags & AV_CODEC_FLAG_GRAY)
96 return;
97
98 wmv2_add_block(w, block1[4], dest_cb, s->uvlinesize, 4);
99 wmv2_add_block(w, block1[5], dest_cr, s->uvlinesize, 5);
100 }
101
parse_mb_skip(WMV2DecContext * w)102 static int parse_mb_skip(WMV2DecContext *w)
103 {
104 int mb_x, mb_y;
105 int coded_mb_count = 0;
106 MpegEncContext *const s = &w->s;
107 uint32_t *const mb_type = s->current_picture_ptr->mb_type;
108
109 w->skip_type = get_bits(&s->gb, 2);
110 switch (w->skip_type) {
111 case SKIP_TYPE_NONE:
112 for (mb_y = 0; mb_y < s->mb_height; mb_y++)
113 for (mb_x = 0; mb_x < s->mb_width; mb_x++)
114 mb_type[mb_y * s->mb_stride + mb_x] =
115 MB_TYPE_16x16 | MB_TYPE_L0;
116 break;
117 case SKIP_TYPE_MPEG:
118 if (get_bits_left(&s->gb) < s->mb_height * s->mb_width)
119 return AVERROR_INVALIDDATA;
120 for (mb_y = 0; mb_y < s->mb_height; mb_y++)
121 for (mb_x = 0; mb_x < s->mb_width; mb_x++)
122 mb_type[mb_y * s->mb_stride + mb_x] =
123 (get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_L0;
124 break;
125 case SKIP_TYPE_ROW:
126 for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
127 if (get_bits_left(&s->gb) < 1)
128 return AVERROR_INVALIDDATA;
129 if (get_bits1(&s->gb)) {
130 for (mb_x = 0; mb_x < s->mb_width; mb_x++)
131 mb_type[mb_y * s->mb_stride + mb_x] =
132 MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0;
133 } else {
134 for (mb_x = 0; mb_x < s->mb_width; mb_x++)
135 mb_type[mb_y * s->mb_stride + mb_x] =
136 (get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_L0;
137 }
138 }
139 break;
140 case SKIP_TYPE_COL:
141 for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
142 if (get_bits_left(&s->gb) < 1)
143 return AVERROR_INVALIDDATA;
144 if (get_bits1(&s->gb)) {
145 for (mb_y = 0; mb_y < s->mb_height; mb_y++)
146 mb_type[mb_y * s->mb_stride + mb_x] =
147 MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0;
148 } else {
149 for (mb_y = 0; mb_y < s->mb_height; mb_y++)
150 mb_type[mb_y * s->mb_stride + mb_x] =
151 (get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_L0;
152 }
153 }
154 break;
155 }
156
157 for (mb_y = 0; mb_y < s->mb_height; mb_y++)
158 for (mb_x = 0; mb_x < s->mb_width; mb_x++)
159 coded_mb_count += !IS_SKIP(mb_type[mb_y * s->mb_stride + mb_x]);
160
161 if (coded_mb_count > get_bits_left(&s->gb))
162 return AVERROR_INVALIDDATA;
163
164 return 0;
165 }
166
decode_ext_header(WMV2DecContext * w)167 static int decode_ext_header(WMV2DecContext *w)
168 {
169 MpegEncContext *const s = &w->s;
170 GetBitContext gb;
171 int fps;
172 int code;
173
174 if (s->avctx->extradata_size < 4)
175 return AVERROR_INVALIDDATA;
176
177 init_get_bits(&gb, s->avctx->extradata, 32);
178
179 fps = get_bits(&gb, 5);
180 s->bit_rate = get_bits(&gb, 11) * 1024;
181 w->mspel_bit = get_bits1(&gb);
182 s->loop_filter = get_bits1(&gb);
183 w->abt_flag = get_bits1(&gb);
184 w->j_type_bit = get_bits1(&gb);
185 w->top_left_mv_flag = get_bits1(&gb);
186 w->per_mb_rl_bit = get_bits1(&gb);
187 code = get_bits(&gb, 3);
188
189 if (code == 0)
190 return AVERROR_INVALIDDATA;
191
192 s->slice_height = s->mb_height / code;
193
194 if (s->avctx->debug & FF_DEBUG_PICT_INFO)
195 av_log(s->avctx, AV_LOG_DEBUG,
196 "fps:%d, br:%"PRId64", qpbit:%d, abt_flag:%d, j_type_bit:%d, "
197 "tl_mv_flag:%d, mbrl_bit:%d, code:%d, loop_filter:%d, "
198 "slices:%d\n",
199 fps, s->bit_rate, w->mspel_bit, w->abt_flag, w->j_type_bit,
200 w->top_left_mv_flag, w->per_mb_rl_bit, code, s->loop_filter,
201 code);
202 return 0;
203 }
204
ff_wmv2_decode_picture_header(MpegEncContext * s)205 int ff_wmv2_decode_picture_header(MpegEncContext *s)
206 {
207 WMV2DecContext *const w = (WMV2DecContext *) s;
208 int code;
209
210 if (s->picture_number == 0)
211 decode_ext_header(w);
212
213 s->pict_type = get_bits1(&s->gb) + 1;
214 if (s->pict_type == AV_PICTURE_TYPE_I) {
215 code = get_bits(&s->gb, 7);
216 av_log(s->avctx, AV_LOG_DEBUG, "I7:%X/\n", code);
217 }
218 s->chroma_qscale = s->qscale = get_bits(&s->gb, 5);
219 if (s->qscale <= 0)
220 return AVERROR_INVALIDDATA;
221
222 if (s->pict_type != AV_PICTURE_TYPE_I && show_bits(&s->gb, 1)) {
223 GetBitContext gb = s->gb;
224 int skip_type = get_bits(&gb, 2);
225 int run = skip_type == SKIP_TYPE_COL ? s->mb_width : s->mb_height;
226
227 while (run > 0) {
228 int block = FFMIN(run, 25);
229 if (get_bits(&gb, block) + 1 != 1<<block)
230 break;
231 run -= block;
232 }
233 if (!run)
234 return FRAME_SKIPPED;
235 }
236
237 return 0;
238 }
239
ff_wmv2_decode_secondary_picture_header(MpegEncContext * s)240 int ff_wmv2_decode_secondary_picture_header(MpegEncContext *s)
241 {
242 WMV2DecContext *const w = (WMV2DecContext *) s;
243
244 if (s->pict_type == AV_PICTURE_TYPE_I) {
245 if (w->j_type_bit)
246 w->j_type = get_bits1(&s->gb);
247 else
248 w->j_type = 0; // FIXME check
249
250 if (!w->j_type) {
251 if (w->per_mb_rl_bit)
252 s->per_mb_rl_table = get_bits1(&s->gb);
253 else
254 s->per_mb_rl_table = 0;
255
256 if (!s->per_mb_rl_table) {
257 s->rl_chroma_table_index = decode012(&s->gb);
258 s->rl_table_index = decode012(&s->gb);
259 }
260
261 s->dc_table_index = get_bits1(&s->gb);
262
263 // at minimum one bit per macroblock is required at least in a valid frame,
264 // we discard frames much smaller than this. Frames smaller than 1/8 of the
265 // smallest "black/skip" frame generally contain not much recoverable content
266 // while at the same time they have the highest computational requirements
267 // per byte
268 if (get_bits_left(&s->gb) * 8LL < (s->width+15)/16 * ((s->height+15)/16))
269 return AVERROR_INVALIDDATA;
270 }
271 s->inter_intra_pred = 0;
272 s->no_rounding = 1;
273 if (s->avctx->debug & FF_DEBUG_PICT_INFO) {
274 av_log(s->avctx, AV_LOG_DEBUG,
275 "qscale:%d rlc:%d rl:%d dc:%d mbrl:%d j_type:%d \n",
276 s->qscale, s->rl_chroma_table_index, s->rl_table_index,
277 s->dc_table_index, s->per_mb_rl_table, w->j_type);
278 }
279 } else {
280 int cbp_index;
281 int ret;
282 w->j_type = 0;
283
284 ret = parse_mb_skip(w);
285 if (ret < 0)
286 return ret;
287 cbp_index = decode012(&s->gb);
288 w->cbp_table_index = wmv2_get_cbp_table_index(s, cbp_index);
289
290 if (w->mspel_bit)
291 s->mspel = get_bits1(&s->gb);
292 else
293 s->mspel = 0; // FIXME check
294
295 if (w->abt_flag) {
296 w->per_mb_abt = get_bits1(&s->gb) ^ 1;
297 if (!w->per_mb_abt)
298 w->abt_type = decode012(&s->gb);
299 }
300
301 if (w->per_mb_rl_bit)
302 s->per_mb_rl_table = get_bits1(&s->gb);
303 else
304 s->per_mb_rl_table = 0;
305
306 if (!s->per_mb_rl_table) {
307 s->rl_table_index = decode012(&s->gb);
308 s->rl_chroma_table_index = s->rl_table_index;
309 }
310
311 if (get_bits_left(&s->gb) < 2)
312 return AVERROR_INVALIDDATA;
313
314 s->dc_table_index = get_bits1(&s->gb);
315 s->mv_table_index = get_bits1(&s->gb);
316
317 s->inter_intra_pred = 0; // (s->width * s->height < 320 * 240 && s->bit_rate <= II_BITRATE);
318 s->no_rounding ^= 1;
319
320 if (s->avctx->debug & FF_DEBUG_PICT_INFO) {
321 av_log(s->avctx, AV_LOG_DEBUG,
322 "rl:%d rlc:%d dc:%d mv:%d mbrl:%d qp:%d mspel:%d "
323 "per_mb_abt:%d abt_type:%d cbp:%d ii:%d\n",
324 s->rl_table_index, s->rl_chroma_table_index,
325 s->dc_table_index, s->mv_table_index,
326 s->per_mb_rl_table, s->qscale, s->mspel,
327 w->per_mb_abt, w->abt_type, w->cbp_table_index,
328 s->inter_intra_pred);
329 }
330 }
331 s->esc3_level_length = 0;
332 s->esc3_run_length = 0;
333 s->picture_number++; // FIXME ?
334
335 if (w->j_type) {
336 ff_intrax8_decode_picture(&w->x8, &s->current_picture,
337 &s->gb, &s->mb_x, &s->mb_y,
338 2 * s->qscale, (s->qscale - 1) | 1,
339 s->loop_filter, s->low_delay);
340
341 ff_er_add_slice(&w->s.er, 0, 0,
342 (w->s.mb_x >> 1) - 1, (w->s.mb_y >> 1) - 1,
343 ER_MB_END);
344 return 1;
345 }
346
347 return 0;
348 }
349
wmv2_decode_motion(WMV2DecContext * w,int * mx_ptr,int * my_ptr)350 static inline void wmv2_decode_motion(WMV2DecContext *w, int *mx_ptr, int *my_ptr)
351 {
352 MpegEncContext *const s = &w->s;
353
354 ff_msmpeg4_decode_motion(s, mx_ptr, my_ptr);
355
356 if ((((*mx_ptr) | (*my_ptr)) & 1) && s->mspel)
357 w->common.hshift = get_bits1(&s->gb);
358 else
359 w->common.hshift = 0;
360 }
361
wmv2_pred_motion(WMV2DecContext * w,int * px,int * py)362 static int16_t *wmv2_pred_motion(WMV2DecContext *w, int *px, int *py)
363 {
364 MpegEncContext *const s = &w->s;
365 int xy, wrap, diff, type;
366 int16_t *A, *B, *C, *mot_val;
367
368 wrap = s->b8_stride;
369 xy = s->block_index[0];
370
371 mot_val = s->current_picture.motion_val[0][xy];
372
373 A = s->current_picture.motion_val[0][xy - 1];
374 B = s->current_picture.motion_val[0][xy - wrap];
375 C = s->current_picture.motion_val[0][xy + 2 - wrap];
376
377 if (s->mb_x && !s->first_slice_line && !s->mspel && w->top_left_mv_flag)
378 diff = FFMAX(FFABS(A[0] - B[0]), FFABS(A[1] - B[1]));
379 else
380 diff = 0;
381
382 if (diff >= 8)
383 type = get_bits1(&s->gb);
384 else
385 type = 2;
386
387 if (type == 0) {
388 *px = A[0];
389 *py = A[1];
390 } else if (type == 1) {
391 *px = B[0];
392 *py = B[1];
393 } else {
394 /* special case for first (slice) line */
395 if (s->first_slice_line) {
396 *px = A[0];
397 *py = A[1];
398 } else {
399 *px = mid_pred(A[0], B[0], C[0]);
400 *py = mid_pred(A[1], B[1], C[1]);
401 }
402 }
403
404 return mot_val;
405 }
406
wmv2_decode_inter_block(WMV2DecContext * w,int16_t * block,int n,int cbp)407 static inline int wmv2_decode_inter_block(WMV2DecContext *w, int16_t *block,
408 int n, int cbp)
409 {
410 MpegEncContext *const s = &w->s;
411 static const int sub_cbp_table[3] = { 2, 3, 1 };
412 int sub_cbp, ret;
413
414 if (!cbp) {
415 s->block_last_index[n] = -1;
416 return 0;
417 }
418
419 if (w->per_block_abt)
420 w->abt_type = decode012(&s->gb);
421 w->abt_type_table[n] = w->abt_type;
422
423 if (w->abt_type) {
424 // const uint8_t *scantable = w->abt_scantable[w->abt_type - 1].permutated;
425 const uint8_t *scantable = w->abt_scantable[w->abt_type - 1].scantable;
426 // const uint8_t *scantable = w->abt_type - 1 ? w->abt_scantable[1].permutated : w->abt_scantable[0].scantable;
427
428 sub_cbp = sub_cbp_table[decode012(&s->gb)];
429
430 if (sub_cbp & 1)
431 if ((ret = ff_msmpeg4_decode_block(s, block, n, 1, scantable)) < 0)
432 return ret;
433
434 if (sub_cbp & 2)
435 if ((ret = ff_msmpeg4_decode_block(s, w->abt_block2[n], n, 1, scantable)) < 0)
436 return ret;
437
438 s->block_last_index[n] = 63;
439
440 return 0;
441 } else {
442 return ff_msmpeg4_decode_block(s, block, n, 1,
443 s->inter_scantable.permutated);
444 }
445 }
446
ff_wmv2_decode_mb(MpegEncContext * s,int16_t block[6][64])447 int ff_wmv2_decode_mb(MpegEncContext *s, int16_t block[6][64])
448 {
449 /* The following is only allowed because this encoder
450 * does not use slice threading. */
451 WMV2DecContext *const w = (WMV2DecContext *) s;
452 int cbp, code, i, ret;
453 uint8_t *coded_val;
454
455 if (w->j_type)
456 return 0;
457
458 if (s->pict_type == AV_PICTURE_TYPE_P) {
459 if (IS_SKIP(s->current_picture.mb_type[s->mb_y * s->mb_stride + s->mb_x])) {
460 /* skip mb */
461 s->mb_intra = 0;
462 for (i = 0; i < 6; i++)
463 s->block_last_index[i] = -1;
464 s->mv_dir = MV_DIR_FORWARD;
465 s->mv_type = MV_TYPE_16X16;
466 s->mv[0][0][0] = 0;
467 s->mv[0][0][1] = 0;
468 s->mb_skipped = 1;
469 w->common.hshift = 0;
470 return 0;
471 }
472 if (get_bits_left(&s->gb) <= 0)
473 return AVERROR_INVALIDDATA;
474
475 code = get_vlc2(&s->gb, ff_mb_non_intra_vlc[w->cbp_table_index].table,
476 MB_NON_INTRA_VLC_BITS, 3);
477 s->mb_intra = (~code & 0x40) >> 6;
478
479 cbp = code & 0x3f;
480 } else {
481 s->mb_intra = 1;
482 if (get_bits_left(&s->gb) <= 0)
483 return AVERROR_INVALIDDATA;
484 code = get_vlc2(&s->gb, ff_msmp4_mb_i_vlc.table, MB_INTRA_VLC_BITS, 2);
485 /* predict coded block pattern */
486 cbp = 0;
487 for (i = 0; i < 6; i++) {
488 int val = ((code >> (5 - i)) & 1);
489 if (i < 4) {
490 int pred = ff_msmpeg4_coded_block_pred(s, i, &coded_val);
491 val = val ^ pred;
492 *coded_val = val;
493 }
494 cbp |= val << (5 - i);
495 }
496 }
497
498 if (!s->mb_intra) {
499 int mx, my;
500 wmv2_pred_motion(w, &mx, &my);
501
502 if (cbp) {
503 s->bdsp.clear_blocks(s->block[0]);
504 if (s->per_mb_rl_table) {
505 s->rl_table_index = decode012(&s->gb);
506 s->rl_chroma_table_index = s->rl_table_index;
507 }
508
509 if (w->abt_flag && w->per_mb_abt) {
510 w->per_block_abt = get_bits1(&s->gb);
511 if (!w->per_block_abt)
512 w->abt_type = decode012(&s->gb);
513 } else
514 w->per_block_abt = 0;
515 }
516
517 wmv2_decode_motion(w, &mx, &my);
518
519 s->mv_dir = MV_DIR_FORWARD;
520 s->mv_type = MV_TYPE_16X16;
521 s->mv[0][0][0] = mx;
522 s->mv[0][0][1] = my;
523
524 for (i = 0; i < 6; i++) {
525 if ((ret = wmv2_decode_inter_block(w, block[i], i, (cbp >> (5 - i)) & 1)) < 0) {
526 av_log(s->avctx, AV_LOG_ERROR,
527 "\nerror while decoding inter block: %d x %d (%d)\n",
528 s->mb_x, s->mb_y, i);
529 return ret;
530 }
531 }
532 } else {
533 if (s->pict_type == AV_PICTURE_TYPE_P)
534 ff_dlog(s->avctx, "%d%d ", s->inter_intra_pred, cbp);
535 ff_dlog(s->avctx, "I at %d %d %d %06X\n", s->mb_x, s->mb_y,
536 ((cbp & 3) ? 1 : 0) + ((cbp & 0x3C) ? 2 : 0),
537 show_bits(&s->gb, 24));
538 s->ac_pred = get_bits1(&s->gb);
539 if (s->inter_intra_pred) {
540 s->h263_aic_dir = get_vlc2(&s->gb, ff_inter_intra_vlc.table,
541 INTER_INTRA_VLC_BITS, 1);
542 ff_dlog(s->avctx, "%d%d %d %d/",
543 s->ac_pred, s->h263_aic_dir, s->mb_x, s->mb_y);
544 }
545 if (s->per_mb_rl_table && cbp) {
546 s->rl_table_index = decode012(&s->gb);
547 s->rl_chroma_table_index = s->rl_table_index;
548 }
549
550 s->bdsp.clear_blocks(s->block[0]);
551 for (i = 0; i < 6; i++) {
552 if ((ret = ff_msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL)) < 0) {
553 av_log(s->avctx, AV_LOG_ERROR,
554 "\nerror while decoding intra block: %d x %d (%d)\n",
555 s->mb_x, s->mb_y, i);
556 return ret;
557 }
558 }
559 }
560
561 return 0;
562 }
563
wmv2_decode_init(AVCodecContext * avctx)564 static av_cold int wmv2_decode_init(AVCodecContext *avctx)
565 {
566 WMV2DecContext *const w = avctx->priv_data;
567 MpegEncContext *const s = &w->s;
568 int ret;
569
570 s->private_ctx = &w->common;
571
572 if ((ret = ff_msmpeg4_decode_init(avctx)) < 0)
573 return ret;
574
575 ff_wmv2_common_init(s);
576 ff_init_scantable(s->idsp.idct_permutation, &w->abt_scantable[0],
577 ff_wmv2_scantableA);
578 ff_init_scantable(s->idsp.idct_permutation, &w->abt_scantable[1],
579 ff_wmv2_scantableB);
580
581 return ff_intrax8_common_init(avctx, &w->x8, &w->s.idsp,
582 w->s.block, w->s.block_last_index,
583 w->s.mb_width, w->s.mb_height);
584 }
585
wmv2_decode_end(AVCodecContext * avctx)586 static av_cold int wmv2_decode_end(AVCodecContext *avctx)
587 {
588 WMV2DecContext *const w = avctx->priv_data;
589
590 ff_intrax8_common_end(&w->x8);
591 return ff_h263_decode_end(avctx);
592 }
593
594 const FFCodec ff_wmv2_decoder = {
595 .p.name = "wmv2",
596 .p.long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 8"),
597 .p.type = AVMEDIA_TYPE_VIDEO,
598 .p.id = AV_CODEC_ID_WMV2,
599 .priv_data_size = sizeof(WMV2DecContext),
600 .init = wmv2_decode_init,
601 .close = wmv2_decode_end,
602 FF_CODEC_DECODE_CB(ff_h263_decode_frame),
603 .p.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1,
604 .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
605 .p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P,
606 AV_PIX_FMT_NONE },
607 };
608