3 * Copyright (c) 2001 Fabrice Bellard
4 * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
6 * This file is part of FFmpeg.
8 * FFmpeg is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * FFmpeg is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with FFmpeg; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
28 #define UNCHECKED_BITSTREAM_READER 1
30 #include "libavutil/cpu.h"
32 #include "error_resilience.h"
35 #include "h263_parser.h"
38 #include "mpeg4video.h"
39 #include "mpeg4video_parser.h"
40 #include "mpegvideo.h"
43 #include "vdpau_internal.h"
46 static enum AVPixelFormat h263_get_format(AVCodecContext *avctx)
48 if (avctx->codec->id == AV_CODEC_ID_MSS2)
49 return AV_PIX_FMT_YUV420P;
51 return avctx->pix_fmt = ff_get_format(avctx, avctx->codec->pix_fmts);
54 av_cold int ff_h263_decode_init(AVCodecContext *avctx)
56 MpegEncContext *s = avctx->priv_data;
59 s->out_format = FMT_H263;
62 ff_mpv_decode_defaults(s);
63 ff_mpv_decode_init(s, avctx);
65 s->quant_precision = 5;
66 s->decode_mb = ff_h263_decode_mb;
68 s->unrestricted_mv = 1;
70 /* select sub codec */
71 switch (avctx->codec->id) {
72 case AV_CODEC_ID_H263:
73 case AV_CODEC_ID_H263P:
74 s->unrestricted_mv = 0;
75 avctx->chroma_sample_location = AVCHROMA_LOC_CENTER;
77 case AV_CODEC_ID_MPEG4:
79 case AV_CODEC_ID_MSMPEG4V1:
81 s->msmpeg4_version = 1;
83 case AV_CODEC_ID_MSMPEG4V2:
85 s->msmpeg4_version = 2;
87 case AV_CODEC_ID_MSMPEG4V3:
89 s->msmpeg4_version = 3;
91 case AV_CODEC_ID_WMV1:
93 s->msmpeg4_version = 4;
95 case AV_CODEC_ID_WMV2:
97 s->msmpeg4_version = 5;
100 case AV_CODEC_ID_WMV3:
101 case AV_CODEC_ID_VC1IMAGE:
102 case AV_CODEC_ID_WMV3IMAGE:
103 case AV_CODEC_ID_MSS2:
105 s->msmpeg4_version = 6;
106 avctx->chroma_sample_location = AVCHROMA_LOC_LEFT;
108 case AV_CODEC_ID_H263I:
110 case AV_CODEC_ID_FLV1:
114 av_log(avctx, AV_LOG_ERROR, "Unsupported codec %d\n",
116 return AVERROR(ENOSYS);
118 s->codec_id = avctx->codec->id;
120 if (avctx->codec_tag == AV_RL32("L263") || avctx->codec_tag == AV_RL32("S263"))
121 if (avctx->extradata_size == 56 && avctx->extradata[0] == 1)
124 /* for h263, we allocate the images after having read the header */
125 if (avctx->codec->id != AV_CODEC_ID_H263 &&
126 avctx->codec->id != AV_CODEC_ID_H263P &&
127 avctx->codec->id != AV_CODEC_ID_MPEG4) {
128 avctx->pix_fmt = h263_get_format(avctx);
130 if ((ret = ff_mpv_common_init(s)) < 0)
134 ff_h263dsp_init(&s->h263dsp);
135 ff_qpeldsp_init(&s->qdsp);
136 ff_h263_decode_init_vlc();
141 av_cold int ff_h263_decode_end(AVCodecContext *avctx)
143 MpegEncContext *s = avctx->priv_data;
145 ff_mpv_common_end(s);
150 * Return the number of bytes consumed for building the current frame.
152 static int get_consumed_bytes(MpegEncContext *s, int buf_size)
154 int pos = (get_bits_count(&s->gb) + 7) >> 3;
156 if (s->divx_packed || s->avctx->hwaccel) {
157 /* We would have to scan through the whole buf to handle the weird
160 } else if (s->flags & CODEC_FLAG_TRUNCATED) {
161 pos -= s->parse_context.last_index;
162 // padding is not really read so this might be -1
167 // avoid infinite loops (maybe not needed...)
171 if (pos + 10 > buf_size)
178 static int decode_slice(MpegEncContext *s)
180 const int part_mask = s->partitioned_frame
181 ? (ER_AC_END | ER_AC_ERROR) : 0x7F;
182 const int mb_size = 16 >> s->avctx->lowres;
185 s->last_resync_gb = s->gb;
186 s->first_slice_line = 1;
187 s->resync_mb_x = s->mb_x;
188 s->resync_mb_y = s->mb_y;
190 ff_set_qscale(s, s->qscale);
192 if (s->avctx->hwaccel) {
193 const uint8_t *start = s->gb.buffer + get_bits_count(&s->gb) / 8;
194 ret = s->avctx->hwaccel->decode_slice(s->avctx, start, s->gb.buffer_end - start);
195 // ensure we exit decode loop
196 s->mb_y = s->mb_height;
200 if (s->partitioned_frame) {
201 const int qscale = s->qscale;
203 if (CONFIG_MPEG4_DECODER && s->codec_id == AV_CODEC_ID_MPEG4)
204 if ((ret = ff_mpeg4_decode_partitions(s->avctx->priv_data)) < 0)
207 /* restore variables which were modified */
208 s->first_slice_line = 1;
209 s->mb_x = s->resync_mb_x;
210 s->mb_y = s->resync_mb_y;
211 ff_set_qscale(s, qscale);
214 for (; s->mb_y < s->mb_height; s->mb_y++) {
215 /* per-row end of slice checks */
216 if (s->msmpeg4_version) {
217 if (s->resync_mb_y + s->slice_height == s->mb_y) {
218 ff_er_add_slice(&s->er, s->resync_mb_x, s->resync_mb_y,
219 s->mb_x - 1, s->mb_y, ER_MB_END);
225 if (s->msmpeg4_version == 1) {
231 ff_init_block_index(s);
232 for (; s->mb_x < s->mb_width; s->mb_x++) {
235 ff_update_block_index(s);
237 if (s->resync_mb_x == s->mb_x && s->resync_mb_y + 1 == s->mb_y)
238 s->first_slice_line = 0;
242 s->mv_dir = MV_DIR_FORWARD;
243 s->mv_type = MV_TYPE_16X16;
244 ff_dlog(s, "%d %d %06X\n",
245 ret, get_bits_count(&s->gb), show_bits(&s->gb, 24));
247 ff_tlog(NULL, "Decoding MB at %dx%d\n", s->mb_x, s->mb_y);
248 ret = s->decode_mb(s, s->block);
250 if (s->pict_type != AV_PICTURE_TYPE_B)
251 ff_h263_update_motion_val(s);
254 const int xy = s->mb_x + s->mb_y * s->mb_stride;
255 if (ret == SLICE_END) {
256 ff_mpv_decode_mb(s, s->block);
258 ff_h263_loop_filter(s);
260 ff_er_add_slice(&s->er, s->resync_mb_x, s->resync_mb_y,
261 s->mb_x, s->mb_y, ER_MB_END & part_mask);
263 s->padding_bug_score--;
265 if (++s->mb_x >= s->mb_width) {
267 ff_mpeg_draw_horiz_band(s, s->mb_y * mb_size, mb_size);
268 ff_mpv_report_decode_progress(s);
272 } else if (ret == SLICE_NOEND) {
273 av_log(s->avctx, AV_LOG_ERROR,
274 "Slice mismatch at MB: %d\n", xy);
275 ff_er_add_slice(&s->er, s->resync_mb_x, s->resync_mb_y,
276 s->mb_x + 1, s->mb_y,
277 ER_MB_END & part_mask);
278 return AVERROR_INVALIDDATA;
280 av_log(s->avctx, AV_LOG_ERROR, "Error at MB: %d\n", xy);
281 ff_er_add_slice(&s->er, s->resync_mb_x, s->resync_mb_y,
282 s->mb_x, s->mb_y, ER_MB_ERROR & part_mask);
284 if (s->err_recognition & AV_EF_IGNORE_ERR)
286 return AVERROR_INVALIDDATA;
289 ff_mpv_decode_mb(s, s->block);
291 ff_h263_loop_filter(s);
294 ff_mpeg_draw_horiz_band(s, s->mb_y * mb_size, mb_size);
295 ff_mpv_report_decode_progress(s);
300 av_assert1(s->mb_x == 0 && s->mb_y == s->mb_height);
302 if (s->codec_id == AV_CODEC_ID_MPEG4 &&
303 (s->workaround_bugs & FF_BUG_AUTODETECT) &&
304 get_bits_left(&s->gb) >= 48 &&
305 show_bits(&s->gb, 24) == 0x4010 &&
306 !s->data_partitioning)
307 s->padding_bug_score += 32;
309 /* try to detect the padding bug */
310 if (s->codec_id == AV_CODEC_ID_MPEG4 &&
311 (s->workaround_bugs & FF_BUG_AUTODETECT) &&
312 get_bits_left(&s->gb) >= 0 &&
313 get_bits_left(&s->gb) < 137 &&
314 !s->data_partitioning) {
315 const int bits_count = get_bits_count(&s->gb);
316 const int bits_left = s->gb.size_in_bits - bits_count;
318 if (bits_left == 0) {
319 s->padding_bug_score += 16;
320 } else if (bits_left != 1) {
321 int v = show_bits(&s->gb, 8);
322 v |= 0x7F >> (7 - (bits_count & 7));
324 if (v == 0x7F && bits_left <= 8)
325 s->padding_bug_score--;
326 else if (v == 0x7F && ((get_bits_count(&s->gb) + 8) & 8) &&
328 s->padding_bug_score += 4;
330 s->padding_bug_score++;
334 if (s->codec_id == AV_CODEC_ID_H263 &&
335 (s->workaround_bugs & FF_BUG_AUTODETECT) &&
336 get_bits_left(&s->gb) >= 8 &&
337 get_bits_left(&s->gb) < 300 &&
338 s->pict_type == AV_PICTURE_TYPE_I &&
339 show_bits(&s->gb, 8) == 0 &&
340 !s->data_partitioning) {
342 s->padding_bug_score += 32;
345 if (s->codec_id == AV_CODEC_ID_H263 &&
346 (s->workaround_bugs & FF_BUG_AUTODETECT) &&
347 get_bits_left(&s->gb) >= 64 &&
348 AV_RB64(s->gb.buffer_end - 8) == 0xCDCDCDCDFC7F0000) {
350 s->padding_bug_score += 32;
353 if (s->workaround_bugs & FF_BUG_AUTODETECT) {
355 (s->padding_bug_score > -2 && !s->data_partitioning))
356 s->workaround_bugs |= FF_BUG_NO_PADDING;
358 s->workaround_bugs &= ~FF_BUG_NO_PADDING;
361 // handle formats which don't have unique end markers
362 if (s->msmpeg4_version || (s->workaround_bugs & FF_BUG_NO_PADDING)) { // FIXME perhaps solve this more cleanly
363 int left = get_bits_left(&s->gb);
366 /* no markers in M$ crap */
367 if (s->msmpeg4_version && s->pict_type == AV_PICTURE_TYPE_I)
370 /* buggy padding but the frame should still end approximately at
371 * the bitstream end */
372 if ((s->workaround_bugs & FF_BUG_NO_PADDING) &&
373 (s->err_recognition & (AV_EF_BUFFER|AV_EF_AGGRESSIVE)))
375 else if ((s->workaround_bugs & FF_BUG_NO_PADDING))
376 max_extra += 256 * 256 * 256 * 64;
378 if (left > max_extra)
379 av_log(s->avctx, AV_LOG_ERROR,
380 "discarding %d junk bits at end, next would be %X\n",
381 left, show_bits(&s->gb, 24));
383 av_log(s->avctx, AV_LOG_ERROR, "overreading %d bits\n", -left);
385 ff_er_add_slice(&s->er, s->resync_mb_x, s->resync_mb_y,
386 s->mb_x - 1, s->mb_y, ER_MB_END);
391 av_log(s->avctx, AV_LOG_ERROR,
392 "slice end not reached but screenspace end (%d left %06X, score= %d)\n",
393 get_bits_left(&s->gb), show_bits(&s->gb, 24), s->padding_bug_score);
395 ff_er_add_slice(&s->er, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y,
396 ER_MB_END & part_mask);
398 return AVERROR_INVALIDDATA;
401 int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
404 const uint8_t *buf = avpkt->data;
405 int buf_size = avpkt->size;
406 MpegEncContext *s = avctx->priv_data;
409 AVFrame *pict = data;
411 s->flags = avctx->flags;
412 s->flags2 = avctx->flags2;
414 /* no supplementary picture */
416 /* special case for last picture */
417 if (s->low_delay == 0 && s->next_picture_ptr) {
418 if ((ret = av_frame_ref(pict, s->next_picture_ptr->f)) < 0)
420 s->next_picture_ptr = NULL;
428 if (s->flags & CODEC_FLAG_TRUNCATED) {
431 if (CONFIG_MPEG4_DECODER && s->codec_id == AV_CODEC_ID_MPEG4) {
432 next = ff_mpeg4_find_frame_end(&s->parse_context, buf, buf_size);
433 } else if (CONFIG_H263_DECODER && s->codec_id == AV_CODEC_ID_H263) {
434 next = ff_h263_find_frame_end(&s->parse_context, buf, buf_size);
435 } else if (CONFIG_H263P_DECODER && s->codec_id == AV_CODEC_ID_H263P) {
436 next = ff_h263_find_frame_end(&s->parse_context, buf, buf_size);
438 av_log(s->avctx, AV_LOG_ERROR,
439 "this codec does not support truncated bitstreams\n");
440 return AVERROR(ENOSYS);
443 if (ff_combine_frame(&s->parse_context, next, (const uint8_t **)&buf,
449 if (s->divx_packed && s->bitstream_buffer_size) {
451 for(i=0; i < buf_size-3; i++) {
452 if (buf[i]==0 && buf[i+1]==0 && buf[i+2]==1) {
453 if (buf[i+3]==0xB0) {
454 av_log(s->avctx, AV_LOG_WARNING, "Discarding excessive bitstream in packed xvid\n");
455 s->bitstream_buffer_size = 0;
462 if (s->bitstream_buffer_size && (s->divx_packed || buf_size <= MAX_NVOP_SIZE)) // divx 5.01+/xvid frame reorder
463 ret = init_get_bits8(&s->gb, s->bitstream_buffer,
464 s->bitstream_buffer_size);
466 ret = init_get_bits8(&s->gb, buf, buf_size);
468 s->bitstream_buffer_size = 0;
472 if (!s->context_initialized)
473 // we need the idct permutaton for reading a custom matrix
477 if (CONFIG_WMV2_DECODER && s->msmpeg4_version == 5) {
478 ret = ff_wmv2_decode_picture_header(s);
479 } else if (CONFIG_MSMPEG4_DECODER && s->msmpeg4_version) {
480 ret = ff_msmpeg4_decode_picture_header(s);
481 } else if (CONFIG_MPEG4_DECODER && avctx->codec_id == AV_CODEC_ID_MPEG4) {
482 if (s->avctx->extradata_size && s->picture_number == 0) {
485 if (init_get_bits8(&gb, s->avctx->extradata, s->avctx->extradata_size) >= 0 )
486 ff_mpeg4_decode_picture_header(avctx->priv_data, &gb);
488 ret = ff_mpeg4_decode_picture_header(avctx->priv_data, &s->gb);
489 } else if (CONFIG_H263I_DECODER && s->codec_id == AV_CODEC_ID_H263I) {
490 ret = ff_intel_h263_decode_picture_header(s);
491 } else if (CONFIG_FLV_DECODER && s->h263_flv) {
492 ret = ff_flv_decode_picture_header(s);
494 ret = ff_h263_decode_picture_header(s);
497 if (ret < 0 || ret == FRAME_SKIPPED) {
498 if ( s->width != avctx->coded_width
499 || s->height != avctx->coded_height) {
500 av_log(s->avctx, AV_LOG_WARNING, "Reverting picture dimensions change due to header decoding failure\n");
501 s->width = avctx->coded_width;
502 s->height= avctx->coded_height;
505 if (ret == FRAME_SKIPPED)
506 return get_consumed_bytes(s, buf_size);
508 /* skip if the header was thrashed */
510 av_log(s->avctx, AV_LOG_ERROR, "header damaged\n");
514 if (!s->context_initialized) {
515 avctx->pix_fmt = h263_get_format(avctx);
516 if ((ret = ff_mpv_common_init(s)) < 0)
520 if (!s->current_picture_ptr || s->current_picture_ptr->f->data[0]) {
521 int i = ff_find_unused_picture(s, 0);
524 s->current_picture_ptr = &s->picture[i];
527 avctx->has_b_frames = !s->low_delay;
529 if (CONFIG_MPEG4_DECODER && avctx->codec_id == AV_CODEC_ID_MPEG4) {
530 if (ff_mpeg4_workaround_bugs(avctx) == 1)
534 /* After H263 & mpeg4 header decode we have the height, width,
535 * and other parameters. So then we could init the picture.
536 * FIXME: By the way H263 decoder is evolving it should have
537 * an H263EncContext */
538 if (s->width != avctx->coded_width ||
539 s->height != avctx->coded_height ||
541 /* H.263 could change picture size any time */
542 s->context_reinit = 0;
544 ret = ff_set_dimensions(avctx, s->width, s->height);
548 ff_set_sar(avctx, avctx->sample_aspect_ratio);
550 if ((ret = ff_mpv_common_frame_size_change(s)))
553 if (avctx->pix_fmt != h263_get_format(avctx)) {
554 av_log(avctx, AV_LOG_ERROR, "format change not supported\n");
555 avctx->pix_fmt = AV_PIX_FMT_NONE;
556 return AVERROR_UNKNOWN;
560 if (s->codec_id == AV_CODEC_ID_H263 ||
561 s->codec_id == AV_CODEC_ID_H263P ||
562 s->codec_id == AV_CODEC_ID_H263I)
563 s->gob_index = ff_h263_get_gob_height(s);
565 // for skipping the frame
566 s->current_picture.f->pict_type = s->pict_type;
567 s->current_picture.f->key_frame = s->pict_type == AV_PICTURE_TYPE_I;
569 /* skip B-frames if we don't have reference frames */
570 if (!s->last_picture_ptr &&
571 (s->pict_type == AV_PICTURE_TYPE_B || s->droppable))
572 return get_consumed_bytes(s, buf_size);
573 if ((avctx->skip_frame >= AVDISCARD_NONREF &&
574 s->pict_type == AV_PICTURE_TYPE_B) ||
575 (avctx->skip_frame >= AVDISCARD_NONKEY &&
576 s->pict_type != AV_PICTURE_TYPE_I) ||
577 avctx->skip_frame >= AVDISCARD_ALL)
578 return get_consumed_bytes(s, buf_size);
580 if (s->next_p_frame_damaged) {
581 if (s->pict_type == AV_PICTURE_TYPE_B)
582 return get_consumed_bytes(s, buf_size);
584 s->next_p_frame_damaged = 0;
587 if ((!s->no_rounding) || s->pict_type == AV_PICTURE_TYPE_B) {
588 s->me.qpel_put = s->qdsp.put_qpel_pixels_tab;
589 s->me.qpel_avg = s->qdsp.avg_qpel_pixels_tab;
591 s->me.qpel_put = s->qdsp.put_no_rnd_qpel_pixels_tab;
592 s->me.qpel_avg = s->qdsp.avg_qpel_pixels_tab;
595 if ((ret = ff_mpv_frame_start(s, avctx)) < 0)
598 if (!s->divx_packed && !avctx->hwaccel)
599 ff_thread_finish_setup(avctx);
601 if (CONFIG_MPEG4_VDPAU_DECODER && (s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)) {
602 ff_vdpau_mpeg4_decode_picture(avctx->priv_data, s->gb.buffer, s->gb.buffer_end - s->gb.buffer);
606 if (avctx->hwaccel) {
607 ret = avctx->hwaccel->start_frame(avctx, s->gb.buffer,
608 s->gb.buffer_end - s->gb.buffer);
613 ff_mpeg_er_frame_start(s);
615 /* the second part of the wmv2 header contains the MB skip bits which
616 * are stored in current_picture->mb_type which is not available before
617 * ff_mpv_frame_start() */
618 if (CONFIG_WMV2_DECODER && s->msmpeg4_version == 5) {
619 ret = ff_wmv2_decode_secondary_picture_header(s);
626 /* decode each macroblock */
630 slice_ret = decode_slice(s);
631 while (s->mb_y < s->mb_height) {
632 if (s->msmpeg4_version) {
633 if (s->slice_height == 0 || s->mb_x != 0 ||
634 (s->mb_y % s->slice_height) != 0 || get_bits_left(&s->gb) < 0)
637 int prev_x = s->mb_x, prev_y = s->mb_y;
638 if (ff_h263_resync(s) < 0)
640 if (prev_y * s->mb_width + prev_x < s->mb_y * s->mb_width + s->mb_x)
641 s->er.error_occurred = 1;
644 if (s->msmpeg4_version < 4 && s->h263_pred)
645 ff_mpeg4_clean_buffers(s);
647 if (decode_slice(s) < 0)
648 slice_ret = AVERROR_INVALIDDATA;
651 if (s->msmpeg4_version && s->msmpeg4_version < 4 &&
652 s->pict_type == AV_PICTURE_TYPE_I)
653 if (!CONFIG_MSMPEG4_DECODER ||
654 ff_msmpeg4_decode_ext_header(s, buf_size) < 0)
655 s->er.error_status_table[s->mb_num - 1] = ER_MB_ERROR;
657 av_assert1(s->bitstream_buffer_size == 0);
659 ff_er_frame_end(&s->er);
661 if (avctx->hwaccel) {
662 ret = avctx->hwaccel->end_frame(avctx);
669 if (CONFIG_MPEG4_DECODER && avctx->codec_id == AV_CODEC_ID_MPEG4)
670 ff_mpeg4_frame_end(avctx, buf, buf_size);
672 if (!s->divx_packed && avctx->hwaccel)
673 ff_thread_finish_setup(avctx);
675 av_assert1(s->current_picture.f->pict_type == s->current_picture_ptr->f->pict_type);
676 av_assert1(s->current_picture.f->pict_type == s->pict_type);
677 if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) {
678 if ((ret = av_frame_ref(pict, s->current_picture_ptr->f)) < 0)
680 ff_print_debug_info(s, s->current_picture_ptr, pict);
681 ff_mpv_export_qp_table(s, pict, s->current_picture_ptr, FF_QSCALE_TYPE_MPEG1);
682 } else if (s->last_picture_ptr) {
683 if ((ret = av_frame_ref(pict, s->last_picture_ptr->f)) < 0)
685 ff_print_debug_info(s, s->last_picture_ptr, pict);
686 ff_mpv_export_qp_table(s, pict, s->last_picture_ptr, FF_QSCALE_TYPE_MPEG1);
689 if (s->last_picture_ptr || s->low_delay) {
690 if ( pict->format == AV_PIX_FMT_YUV420P
691 && (s->codec_tag == AV_RL32("GEOV") || s->codec_tag == AV_RL32("GEOX"))) {
693 av_frame_make_writable(pict);
694 for (p=0; p<3; p++) {
695 int w = FF_CEIL_RSHIFT(pict-> width, !!p);
696 int h = FF_CEIL_RSHIFT(pict->height, !!p);
697 int linesize = pict->linesize[p];
698 for (y=0; y<(h>>1); y++)
701 pict->data[p][x + y*linesize],
702 pict->data[p][x + (h-1-y)*linesize]);
708 if (slice_ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE))
711 return get_consumed_bytes(s, buf_size);
714 const enum AVPixelFormat ff_h263_hwaccel_pixfmt_list_420[] = {
715 #if CONFIG_H263_VAAPI_HWACCEL || CONFIG_MPEG4_VAAPI_HWACCEL
716 AV_PIX_FMT_VAAPI_VLD,
718 #if CONFIG_H263_VDPAU_HWACCEL || CONFIG_MPEG4_VDPAU_HWACCEL
725 AVCodec ff_h263_decoder = {
727 .long_name = NULL_IF_CONFIG_SMALL("H.263 / H.263-1996, H.263+ / H.263-1998 / H.263 version 2"),
728 .type = AVMEDIA_TYPE_VIDEO,
729 .id = AV_CODEC_ID_H263,
730 .priv_data_size = sizeof(MpegEncContext),
731 .init = ff_h263_decode_init,
732 .close = ff_h263_decode_end,
733 .decode = ff_h263_decode_frame,
734 .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 |
735 CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY,
736 .flush = ff_mpeg_flush,
738 .pix_fmts = ff_h263_hwaccel_pixfmt_list_420,
741 AVCodec ff_h263p_decoder = {
743 .long_name = NULL_IF_CONFIG_SMALL("H.263 / H.263-1996, H.263+ / H.263-1998 / H.263 version 2"),
744 .type = AVMEDIA_TYPE_VIDEO,
745 .id = AV_CODEC_ID_H263P,
746 .priv_data_size = sizeof(MpegEncContext),
747 .init = ff_h263_decode_init,
748 .close = ff_h263_decode_end,
749 .decode = ff_h263_decode_frame,
750 .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 |
751 CODEC_CAP_TRUNCATED | CODEC_CAP_DELAY,
752 .flush = ff_mpeg_flush,
754 .pix_fmts = ff_h263_hwaccel_pixfmt_list_420,