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 "mpegutils.h"
41 #include "mpegvideo.h"
47 static enum AVPixelFormat h263_get_format(AVCodecContext *avctx)
49 if (avctx->codec->id == AV_CODEC_ID_MSS2)
50 return AV_PIX_FMT_YUV420P;
52 if (CONFIG_GRAY && (avctx->flags & AV_CODEC_FLAG_GRAY)) {
53 if (avctx->color_range == AVCOL_RANGE_UNSPECIFIED)
54 avctx->color_range = AVCOL_RANGE_MPEG;
55 return AV_PIX_FMT_GRAY8;
58 return avctx->pix_fmt = ff_get_format(avctx, avctx->codec->pix_fmts);
61 av_cold int ff_h263_decode_init(AVCodecContext *avctx)
63 MpegEncContext *s = avctx->priv_data;
66 s->out_format = FMT_H263;
69 ff_mpv_decode_defaults(s);
70 ff_mpv_decode_init(s, avctx);
72 s->quant_precision = 5;
73 s->decode_mb = ff_h263_decode_mb;
75 s->unrestricted_mv = 1;
77 /* select sub codec */
78 switch (avctx->codec->id) {
79 case AV_CODEC_ID_H263:
80 case AV_CODEC_ID_H263P:
81 s->unrestricted_mv = 0;
82 avctx->chroma_sample_location = AVCHROMA_LOC_CENTER;
84 case AV_CODEC_ID_MPEG4:
86 case AV_CODEC_ID_MSMPEG4V1:
88 s->msmpeg4_version = 1;
90 case AV_CODEC_ID_MSMPEG4V2:
92 s->msmpeg4_version = 2;
94 case AV_CODEC_ID_MSMPEG4V3:
96 s->msmpeg4_version = 3;
98 case AV_CODEC_ID_WMV1:
100 s->msmpeg4_version = 4;
102 case AV_CODEC_ID_WMV2:
104 s->msmpeg4_version = 5;
106 case AV_CODEC_ID_VC1:
107 case AV_CODEC_ID_WMV3:
108 case AV_CODEC_ID_VC1IMAGE:
109 case AV_CODEC_ID_WMV3IMAGE:
110 case AV_CODEC_ID_MSS2:
112 s->msmpeg4_version = 6;
113 avctx->chroma_sample_location = AVCHROMA_LOC_LEFT;
115 case AV_CODEC_ID_H263I:
117 case AV_CODEC_ID_FLV1:
121 av_log(avctx, AV_LOG_ERROR, "Unsupported codec %d\n",
123 return AVERROR(ENOSYS);
125 s->codec_id = avctx->codec->id;
127 if (avctx->codec_tag == AV_RL32("L263") || avctx->codec_tag == AV_RL32("S263"))
128 if (avctx->extradata_size == 56 && avctx->extradata[0] == 1)
131 /* for H.263, we allocate the images after having read the header */
132 if (avctx->codec->id != AV_CODEC_ID_H263 &&
133 avctx->codec->id != AV_CODEC_ID_H263P &&
134 avctx->codec->id != AV_CODEC_ID_MPEG4) {
135 avctx->pix_fmt = h263_get_format(avctx);
137 if ((ret = ff_mpv_common_init(s)) < 0)
141 ff_h263dsp_init(&s->h263dsp);
142 ff_qpeldsp_init(&s->qdsp);
143 ff_h263_decode_init_vlc();
148 av_cold int ff_h263_decode_end(AVCodecContext *avctx)
150 MpegEncContext *s = avctx->priv_data;
152 ff_mpv_common_end(s);
157 * Return the number of bytes consumed for building the current frame.
159 static int get_consumed_bytes(MpegEncContext *s, int buf_size)
161 int pos = (get_bits_count(&s->gb) + 7) >> 3;
163 if (s->divx_packed || s->avctx->hwaccel) {
164 /* We would have to scan through the whole buf to handle the weird
167 } else if (s->avctx->flags & AV_CODEC_FLAG_TRUNCATED) {
168 pos -= s->parse_context.last_index;
169 // padding is not really read so this might be -1
174 // avoid infinite loops (maybe not needed...)
178 if (pos + 10 > buf_size)
185 static int decode_slice(MpegEncContext *s)
187 const int part_mask = s->partitioned_frame
188 ? (ER_AC_END | ER_AC_ERROR) : 0x7F;
189 const int mb_size = 16 >> s->avctx->lowres;
192 s->last_resync_gb = s->gb;
193 s->first_slice_line = 1;
194 s->resync_mb_x = s->mb_x;
195 s->resync_mb_y = s->mb_y;
197 ff_set_qscale(s, s->qscale);
199 if (s->avctx->hwaccel) {
200 const uint8_t *start = s->gb.buffer + get_bits_count(&s->gb) / 8;
201 ret = s->avctx->hwaccel->decode_slice(s->avctx, start, s->gb.buffer_end - start);
202 // ensure we exit decode loop
203 s->mb_y = s->mb_height;
207 if (s->partitioned_frame) {
208 const int qscale = s->qscale;
210 if (CONFIG_MPEG4_DECODER && s->codec_id == AV_CODEC_ID_MPEG4)
211 if ((ret = ff_mpeg4_decode_partitions(s->avctx->priv_data)) < 0)
214 /* restore variables which were modified */
215 s->first_slice_line = 1;
216 s->mb_x = s->resync_mb_x;
217 s->mb_y = s->resync_mb_y;
218 ff_set_qscale(s, qscale);
221 for (; s->mb_y < s->mb_height; s->mb_y++) {
222 /* per-row end of slice checks */
223 if (s->msmpeg4_version) {
224 if (s->resync_mb_y + s->slice_height == s->mb_y) {
225 ff_er_add_slice(&s->er, s->resync_mb_x, s->resync_mb_y,
226 s->mb_x - 1, s->mb_y, ER_MB_END);
232 if (s->msmpeg4_version == 1) {
238 ff_init_block_index(s);
239 for (; s->mb_x < s->mb_width; s->mb_x++) {
242 ff_update_block_index(s);
244 if (s->resync_mb_x == s->mb_x && s->resync_mb_y + 1 == s->mb_y)
245 s->first_slice_line = 0;
249 s->mv_dir = MV_DIR_FORWARD;
250 s->mv_type = MV_TYPE_16X16;
251 ff_dlog(s, "%d %06X\n",
252 get_bits_count(&s->gb), show_bits(&s->gb, 24));
254 ff_tlog(NULL, "Decoding MB at %dx%d\n", s->mb_x, s->mb_y);
255 ret = s->decode_mb(s, s->block);
257 if (s->pict_type != AV_PICTURE_TYPE_B)
258 ff_h263_update_motion_val(s);
261 const int xy = s->mb_x + s->mb_y * s->mb_stride;
262 if (ret == SLICE_END) {
263 ff_mpv_reconstruct_mb(s, s->block);
265 ff_h263_loop_filter(s);
267 ff_er_add_slice(&s->er, s->resync_mb_x, s->resync_mb_y,
268 s->mb_x, s->mb_y, ER_MB_END & part_mask);
270 s->padding_bug_score--;
272 if (++s->mb_x >= s->mb_width) {
274 ff_mpeg_draw_horiz_band(s, s->mb_y * mb_size, mb_size);
275 ff_mpv_report_decode_progress(s);
279 } else if (ret == SLICE_NOEND) {
280 av_log(s->avctx, AV_LOG_ERROR,
281 "Slice mismatch at MB: %d\n", xy);
282 ff_er_add_slice(&s->er, s->resync_mb_x, s->resync_mb_y,
283 s->mb_x + 1, s->mb_y,
284 ER_MB_END & part_mask);
285 return AVERROR_INVALIDDATA;
287 av_log(s->avctx, AV_LOG_ERROR, "Error at MB: %d\n", xy);
288 ff_er_add_slice(&s->er, s->resync_mb_x, s->resync_mb_y,
289 s->mb_x, s->mb_y, ER_MB_ERROR & part_mask);
291 if (s->avctx->err_recognition & AV_EF_IGNORE_ERR)
293 return AVERROR_INVALIDDATA;
296 ff_mpv_reconstruct_mb(s, s->block);
298 ff_h263_loop_filter(s);
301 ff_mpeg_draw_horiz_band(s, s->mb_y * mb_size, mb_size);
302 ff_mpv_report_decode_progress(s);
307 av_assert1(s->mb_x == 0 && s->mb_y == s->mb_height);
309 if (s->codec_id == AV_CODEC_ID_MPEG4 &&
310 (s->workaround_bugs & FF_BUG_AUTODETECT) &&
311 get_bits_left(&s->gb) >= 48 &&
312 show_bits(&s->gb, 24) == 0x4010 &&
313 !s->data_partitioning)
314 s->padding_bug_score += 32;
316 /* try to detect the padding bug */
317 if (s->codec_id == AV_CODEC_ID_MPEG4 &&
318 (s->workaround_bugs & FF_BUG_AUTODETECT) &&
319 get_bits_left(&s->gb) >= 0 &&
320 get_bits_left(&s->gb) < 137 &&
321 !s->data_partitioning) {
322 const int bits_count = get_bits_count(&s->gb);
323 const int bits_left = s->gb.size_in_bits - bits_count;
325 if (bits_left == 0) {
326 s->padding_bug_score += 16;
327 } else if (bits_left != 1) {
328 int v = show_bits(&s->gb, 8);
329 v |= 0x7F >> (7 - (bits_count & 7));
331 if (v == 0x7F && bits_left <= 8)
332 s->padding_bug_score--;
333 else if (v == 0x7F && ((get_bits_count(&s->gb) + 8) & 8) &&
335 s->padding_bug_score += 4;
337 s->padding_bug_score++;
341 if (s->codec_id == AV_CODEC_ID_H263 &&
342 (s->workaround_bugs & FF_BUG_AUTODETECT) &&
343 get_bits_left(&s->gb) >= 8 &&
344 get_bits_left(&s->gb) < 300 &&
345 s->pict_type == AV_PICTURE_TYPE_I &&
346 show_bits(&s->gb, 8) == 0 &&
347 !s->data_partitioning) {
349 s->padding_bug_score += 32;
352 if (s->codec_id == AV_CODEC_ID_H263 &&
353 (s->workaround_bugs & FF_BUG_AUTODETECT) &&
354 get_bits_left(&s->gb) >= 64 &&
355 AV_RB64(s->gb.buffer_end - 8) == 0xCDCDCDCDFC7F0000) {
357 s->padding_bug_score += 32;
360 if (s->workaround_bugs & FF_BUG_AUTODETECT) {
362 (s->padding_bug_score > -2 && !s->data_partitioning))
363 s->workaround_bugs |= FF_BUG_NO_PADDING;
365 s->workaround_bugs &= ~FF_BUG_NO_PADDING;
368 // handle formats which don't have unique end markers
369 if (s->msmpeg4_version || (s->workaround_bugs & FF_BUG_NO_PADDING)) { // FIXME perhaps solve this more cleanly
370 int left = get_bits_left(&s->gb);
373 /* no markers in M$ crap */
374 if (s->msmpeg4_version && s->pict_type == AV_PICTURE_TYPE_I)
377 /* buggy padding but the frame should still end approximately at
378 * the bitstream end */
379 if ((s->workaround_bugs & FF_BUG_NO_PADDING) &&
380 (s->avctx->err_recognition & (AV_EF_BUFFER|AV_EF_AGGRESSIVE)))
382 else if ((s->workaround_bugs & FF_BUG_NO_PADDING))
383 max_extra += 256 * 256 * 256 * 64;
385 if (left > max_extra)
386 av_log(s->avctx, AV_LOG_ERROR,
387 "discarding %d junk bits at end, next would be %X\n",
388 left, show_bits(&s->gb, 24));
390 av_log(s->avctx, AV_LOG_ERROR, "overreading %d bits\n", -left);
392 ff_er_add_slice(&s->er, s->resync_mb_x, s->resync_mb_y,
393 s->mb_x - 1, s->mb_y, ER_MB_END);
398 av_log(s->avctx, AV_LOG_ERROR,
399 "slice end not reached but screenspace end (%d left %06X, score= %d)\n",
400 get_bits_left(&s->gb), show_bits(&s->gb, 24), s->padding_bug_score);
402 ff_er_add_slice(&s->er, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y,
403 ER_MB_END & part_mask);
405 return AVERROR_INVALIDDATA;
408 int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
411 const uint8_t *buf = avpkt->data;
412 int buf_size = avpkt->size;
413 MpegEncContext *s = avctx->priv_data;
416 AVFrame *pict = data;
418 /* no supplementary picture */
420 /* special case for last picture */
421 if (s->low_delay == 0 && s->next_picture_ptr) {
422 if ((ret = av_frame_ref(pict, s->next_picture_ptr->f)) < 0)
424 s->next_picture_ptr = NULL;
432 if (s->avctx->flags & AV_CODEC_FLAG_TRUNCATED) {
435 if (CONFIG_MPEG4_DECODER && s->codec_id == AV_CODEC_ID_MPEG4) {
436 next = ff_mpeg4_find_frame_end(&s->parse_context, buf, buf_size);
437 } else if (CONFIG_H263_DECODER && s->codec_id == AV_CODEC_ID_H263) {
438 next = ff_h263_find_frame_end(&s->parse_context, buf, buf_size);
439 } else if (CONFIG_H263P_DECODER && s->codec_id == AV_CODEC_ID_H263P) {
440 next = ff_h263_find_frame_end(&s->parse_context, buf, buf_size);
442 av_log(s->avctx, AV_LOG_ERROR,
443 "this codec does not support truncated bitstreams\n");
444 return AVERROR(ENOSYS);
447 if (ff_combine_frame(&s->parse_context, next, (const uint8_t **)&buf,
453 if (s->divx_packed && s->bitstream_buffer_size) {
455 for(i=0; i < buf_size-3; i++) {
456 if (buf[i]==0 && buf[i+1]==0 && buf[i+2]==1) {
457 if (buf[i+3]==0xB0) {
458 av_log(s->avctx, AV_LOG_WARNING, "Discarding excessive bitstream in packed xvid\n");
459 s->bitstream_buffer_size = 0;
466 if (s->bitstream_buffer_size && (s->divx_packed || buf_size <= MAX_NVOP_SIZE)) // divx 5.01+/xvid frame reorder
467 ret = init_get_bits8(&s->gb, s->bitstream_buffer,
468 s->bitstream_buffer_size);
470 ret = init_get_bits8(&s->gb, buf, buf_size);
472 s->bitstream_buffer_size = 0;
476 if (!s->context_initialized)
477 // we need the idct permutation for reading a custom matrix
481 if (CONFIG_WMV2_DECODER && s->msmpeg4_version == 5) {
482 ret = ff_wmv2_decode_picture_header(s);
483 } else if (CONFIG_MSMPEG4_DECODER && s->msmpeg4_version) {
484 ret = ff_msmpeg4_decode_picture_header(s);
485 } else if (CONFIG_MPEG4_DECODER && avctx->codec_id == AV_CODEC_ID_MPEG4) {
486 if (s->avctx->extradata_size && s->picture_number == 0) {
489 if (init_get_bits8(&gb, s->avctx->extradata, s->avctx->extradata_size) >= 0 )
490 ff_mpeg4_decode_picture_header(avctx->priv_data, &gb);
492 ret = ff_mpeg4_decode_picture_header(avctx->priv_data, &s->gb);
493 } else if (CONFIG_H263I_DECODER && s->codec_id == AV_CODEC_ID_H263I) {
494 ret = ff_intel_h263_decode_picture_header(s);
495 } else if (CONFIG_FLV_DECODER && s->h263_flv) {
496 ret = ff_flv_decode_picture_header(s);
498 ret = ff_h263_decode_picture_header(s);
501 if (ret < 0 || ret == FRAME_SKIPPED) {
502 if ( s->width != avctx->coded_width
503 || s->height != avctx->coded_height) {
504 av_log(s->avctx, AV_LOG_WARNING, "Reverting picture dimensions change due to header decoding failure\n");
505 s->width = avctx->coded_width;
506 s->height= avctx->coded_height;
509 if (ret == FRAME_SKIPPED)
510 return get_consumed_bytes(s, buf_size);
512 /* skip if the header was thrashed */
514 av_log(s->avctx, AV_LOG_ERROR, "header damaged\n");
518 if (!s->context_initialized) {
519 avctx->pix_fmt = h263_get_format(avctx);
520 if ((ret = ff_mpv_common_init(s)) < 0)
524 if (!s->current_picture_ptr || s->current_picture_ptr->f->data[0]) {
525 int i = ff_find_unused_picture(s->avctx, s->picture, 0);
528 s->current_picture_ptr = &s->picture[i];
531 avctx->has_b_frames = !s->low_delay;
533 if (CONFIG_MPEG4_DECODER && avctx->codec_id == AV_CODEC_ID_MPEG4) {
534 if (ff_mpeg4_workaround_bugs(avctx) == 1)
538 /* After H.263 & MPEG-4 header decode we have the height, width,
539 * and other parameters. So then we could init the picture.
540 * FIXME: By the way H.263 decoder is evolving it should have
541 * an H263EncContext */
542 if (s->width != avctx->coded_width ||
543 s->height != avctx->coded_height ||
545 /* H.263 could change picture size any time */
546 s->context_reinit = 0;
548 ret = ff_set_dimensions(avctx, s->width, s->height);
552 ff_set_sar(avctx, avctx->sample_aspect_ratio);
554 if ((ret = ff_mpv_common_frame_size_change(s)))
557 if (avctx->pix_fmt != h263_get_format(avctx)) {
558 av_log(avctx, AV_LOG_ERROR, "format change not supported\n");
559 avctx->pix_fmt = AV_PIX_FMT_NONE;
560 return AVERROR_UNKNOWN;
564 if (s->codec_id == AV_CODEC_ID_H263 ||
565 s->codec_id == AV_CODEC_ID_H263P ||
566 s->codec_id == AV_CODEC_ID_H263I)
567 s->gob_index = H263_GOB_HEIGHT(s->height);
569 // for skipping the frame
570 s->current_picture.f->pict_type = s->pict_type;
571 s->current_picture.f->key_frame = s->pict_type == AV_PICTURE_TYPE_I;
573 /* skip B-frames if we don't have reference frames */
574 if (!s->last_picture_ptr &&
575 (s->pict_type == AV_PICTURE_TYPE_B || s->droppable))
576 return get_consumed_bytes(s, buf_size);
577 if ((avctx->skip_frame >= AVDISCARD_NONREF &&
578 s->pict_type == AV_PICTURE_TYPE_B) ||
579 (avctx->skip_frame >= AVDISCARD_NONKEY &&
580 s->pict_type != AV_PICTURE_TYPE_I) ||
581 avctx->skip_frame >= AVDISCARD_ALL)
582 return get_consumed_bytes(s, buf_size);
584 if (s->next_p_frame_damaged) {
585 if (s->pict_type == AV_PICTURE_TYPE_B)
586 return get_consumed_bytes(s, buf_size);
588 s->next_p_frame_damaged = 0;
591 if ((!s->no_rounding) || s->pict_type == AV_PICTURE_TYPE_B) {
592 s->me.qpel_put = s->qdsp.put_qpel_pixels_tab;
593 s->me.qpel_avg = s->qdsp.avg_qpel_pixels_tab;
595 s->me.qpel_put = s->qdsp.put_no_rnd_qpel_pixels_tab;
596 s->me.qpel_avg = s->qdsp.avg_qpel_pixels_tab;
599 if ((ret = ff_mpv_frame_start(s, avctx)) < 0)
603 ff_thread_finish_setup(avctx);
605 if (avctx->hwaccel) {
606 ret = avctx->hwaccel->start_frame(avctx, s->gb.buffer,
607 s->gb.buffer_end - s->gb.buffer);
612 ff_mpeg_er_frame_start(s);
614 /* the second part of the wmv2 header contains the MB skip bits which
615 * are stored in current_picture->mb_type which is not available before
616 * ff_mpv_frame_start() */
617 if (CONFIG_WMV2_DECODER && s->msmpeg4_version == 5) {
618 ret = ff_wmv2_decode_secondary_picture_header(s);
625 /* decode each macroblock */
629 slice_ret = decode_slice(s);
630 while (s->mb_y < s->mb_height) {
631 if (s->msmpeg4_version) {
632 if (s->slice_height == 0 || s->mb_x != 0 ||
633 (s->mb_y % s->slice_height) != 0 || get_bits_left(&s->gb) < 0)
636 int prev_x = s->mb_x, prev_y = s->mb_y;
637 if (ff_h263_resync(s) < 0)
639 if (prev_y * s->mb_width + prev_x < s->mb_y * s->mb_width + s->mb_x)
640 s->er.error_occurred = 1;
643 if (s->msmpeg4_version < 4 && s->h263_pred)
644 ff_mpeg4_clean_buffers(s);
646 if (decode_slice(s) < 0)
647 slice_ret = AVERROR_INVALIDDATA;
650 if (s->msmpeg4_version && s->msmpeg4_version < 4 &&
651 s->pict_type == AV_PICTURE_TYPE_I)
652 if (!CONFIG_MSMPEG4_DECODER ||
653 ff_msmpeg4_decode_ext_header(s, buf_size) < 0)
654 s->er.error_status_table[s->mb_num - 1] = ER_MB_ERROR;
656 av_assert1(s->bitstream_buffer_size == 0);
658 ff_er_frame_end(&s->er);
660 if (avctx->hwaccel) {
661 ret = avctx->hwaccel->end_frame(avctx);
668 if (CONFIG_MPEG4_DECODER && avctx->codec_id == AV_CODEC_ID_MPEG4)
669 ff_mpeg4_frame_end(avctx, buf, buf_size);
671 if (!s->divx_packed && avctx->hwaccel)
672 ff_thread_finish_setup(avctx);
674 av_assert1(s->current_picture.f->pict_type == s->current_picture_ptr->f->pict_type);
675 av_assert1(s->current_picture.f->pict_type == s->pict_type);
676 if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) {
677 if ((ret = av_frame_ref(pict, s->current_picture_ptr->f)) < 0)
679 ff_print_debug_info(s, s->current_picture_ptr, pict);
680 ff_mpv_export_qp_table(s, pict, s->current_picture_ptr, FF_QSCALE_TYPE_MPEG1);
681 } else if (s->last_picture_ptr) {
682 if ((ret = av_frame_ref(pict, s->last_picture_ptr->f)) < 0)
684 ff_print_debug_info(s, s->last_picture_ptr, pict);
685 ff_mpv_export_qp_table(s, pict, s->last_picture_ptr, FF_QSCALE_TYPE_MPEG1);
688 if (s->last_picture_ptr || s->low_delay) {
689 if ( pict->format == AV_PIX_FMT_YUV420P
690 && (s->codec_tag == AV_RL32("GEOV") || s->codec_tag == AV_RL32("GEOX"))) {
692 av_frame_make_writable(pict);
693 for (p=0; p<3; p++) {
694 int w = AV_CEIL_RSHIFT(pict-> width, !!p);
695 int h = AV_CEIL_RSHIFT(pict->height, !!p);
696 int linesize = pict->linesize[p];
697 for (y=0; y<(h>>1); y++)
700 pict->data[p][x + y*linesize],
701 pict->data[p][x + (h-1-y)*linesize]);
707 if (slice_ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE))
710 return get_consumed_bytes(s, buf_size);
713 const enum AVPixelFormat ff_h263_hwaccel_pixfmt_list_420[] = {
714 #if CONFIG_H263_VAAPI_HWACCEL || CONFIG_MPEG4_VAAPI_HWACCEL
717 #if CONFIG_MPEG4_VDPAU_HWACCEL
720 #if CONFIG_H263_VIDEOTOOLBOX_HWACCEL || CONFIG_MPEG4_VIDEOTOOLBOX_HWACCEL
721 AV_PIX_FMT_VIDEOTOOLBOX,
727 AVCodec ff_h263_decoder = {
729 .long_name = NULL_IF_CONFIG_SMALL("H.263 / H.263-1996, H.263+ / H.263-1998 / H.263 version 2"),
730 .type = AVMEDIA_TYPE_VIDEO,
731 .id = AV_CODEC_ID_H263,
732 .priv_data_size = sizeof(MpegEncContext),
733 .init = ff_h263_decode_init,
734 .close = ff_h263_decode_end,
735 .decode = ff_h263_decode_frame,
736 .capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 |
737 AV_CODEC_CAP_TRUNCATED | AV_CODEC_CAP_DELAY,
738 .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM,
739 .flush = ff_mpeg_flush,
741 .pix_fmts = ff_h263_hwaccel_pixfmt_list_420,
744 AVCodec ff_h263p_decoder = {
746 .long_name = NULL_IF_CONFIG_SMALL("H.263 / H.263-1996, H.263+ / H.263-1998 / H.263 version 2"),
747 .type = AVMEDIA_TYPE_VIDEO,
748 .id = AV_CODEC_ID_H263P,
749 .priv_data_size = sizeof(MpegEncContext),
750 .init = ff_h263_decode_init,
751 .close = ff_h263_decode_end,
752 .decode = ff_h263_decode_frame,
753 .capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 |
754 AV_CODEC_CAP_TRUNCATED | AV_CODEC_CAP_DELAY,
755 .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM,
756 .flush = ff_mpeg_flush,
758 .pix_fmts = ff_h263_hwaccel_pixfmt_list_420,