FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
h263dec.c
Go to the documentation of this file.
1 /*
2  * H.263 decoder
3  * Copyright (c) 2001 Fabrice Bellard
4  * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
5  *
6  * This file is part of FFmpeg.
7  *
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.
12  *
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.
17  *
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
21  */
22 
23 /**
24  * @file
25  * H.263 decoder.
26  */
27 
28 #define UNCHECKED_BITSTREAM_READER 1
29 
30 #include "libavutil/cpu.h"
31 #include "avcodec.h"
32 #include "error_resilience.h"
33 #include "flv.h"
34 #include "h263.h"
35 #include "h263_parser.h"
36 #include "internal.h"
37 #include "mpeg_er.h"
38 #include "mpeg4video.h"
39 #include "mpeg4video_parser.h"
40 #include "mpegvideo.h"
41 #include "msmpeg4.h"
42 #include "qpeldsp.h"
43 #include "vdpau_internal.h"
44 #include "thread.h"
45 
47 {
48  MpegEncContext *s = avctx->priv_data;
49  int ret;
50 
51  s->avctx = avctx;
52  s->out_format = FMT_H263;
53  s->width = avctx->coded_width;
54  s->height = avctx->coded_height;
55  s->workaround_bugs = avctx->workaround_bugs;
56 
57  // set defaults
59  s->quant_precision = 5;
61  s->low_delay = 1;
62  if (avctx->codec->id == AV_CODEC_ID_MSS2)
63  avctx->pix_fmt = AV_PIX_FMT_YUV420P;
64  else
65  avctx->pix_fmt = ff_get_format(avctx, avctx->codec->pix_fmts);
66  s->unrestricted_mv = 1;
67 
68  /* select sub codec */
69  switch (avctx->codec->id) {
70  case AV_CODEC_ID_H263:
71  case AV_CODEC_ID_H263P:
72  s->unrestricted_mv = 0;
74  break;
75  case AV_CODEC_ID_MPEG4:
76  break;
78  s->h263_pred = 1;
79  s->msmpeg4_version = 1;
80  break;
82  s->h263_pred = 1;
83  s->msmpeg4_version = 2;
84  break;
86  s->h263_pred = 1;
87  s->msmpeg4_version = 3;
88  break;
89  case AV_CODEC_ID_WMV1:
90  s->h263_pred = 1;
91  s->msmpeg4_version = 4;
92  break;
93  case AV_CODEC_ID_WMV2:
94  s->h263_pred = 1;
95  s->msmpeg4_version = 5;
96  break;
97  case AV_CODEC_ID_VC1:
98  case AV_CODEC_ID_WMV3:
101  case AV_CODEC_ID_MSS2:
102  s->h263_pred = 1;
103  s->msmpeg4_version = 6;
105  break;
106  case AV_CODEC_ID_H263I:
107  break;
108  case AV_CODEC_ID_FLV1:
109  s->h263_flv = 1;
110  break;
111  default:
112  av_log(avctx, AV_LOG_ERROR, "Unsupported codec %d\n",
113  avctx->codec->id);
114  return AVERROR(ENOSYS);
115  }
116  s->codec_id = avctx->codec->id;
117 
118  if (avctx->stream_codec_tag == AV_RL32("l263") && avctx->extradata_size == 56 && avctx->extradata[0] == 1)
119  s->ehc_mode = 1;
120 
121  /* for h263, we allocate the images after having read the header */
122  if (avctx->codec->id != AV_CODEC_ID_H263 &&
123  avctx->codec->id != AV_CODEC_ID_H263P &&
124  avctx->codec->id != AV_CODEC_ID_MPEG4) {
125  ff_mpv_idct_init(s);
126  if ((ret = ff_mpv_common_init(s)) < 0)
127  return ret;
128  }
129 
131  ff_qpeldsp_init(&s->qdsp);
133 
134  return 0;
135 }
136 
138 {
139  MpegEncContext *s = avctx->priv_data;
140 
142  return 0;
143 }
144 
145 /**
146  * Return the number of bytes consumed for building the current frame.
147  */
148 static int get_consumed_bytes(MpegEncContext *s, int buf_size)
149 {
150  int pos = (get_bits_count(&s->gb) + 7) >> 3;
151 
152  if (s->divx_packed || s->avctx->hwaccel) {
153  /* We would have to scan through the whole buf to handle the weird
154  * reordering ... */
155  return buf_size;
156  } else if (s->flags & CODEC_FLAG_TRUNCATED) {
157  pos -= s->parse_context.last_index;
158  // padding is not really read so this might be -1
159  if (pos < 0)
160  pos = 0;
161  return pos;
162  } else {
163  // avoid infinite loops (maybe not needed...)
164  if (pos == 0)
165  pos = 1;
166  // oops ;)
167  if (pos + 10 > buf_size)
168  pos = buf_size;
169 
170  return pos;
171  }
172 }
173 
175 {
176  const int part_mask = s->partitioned_frame
177  ? (ER_AC_END | ER_AC_ERROR) : 0x7F;
178  const int mb_size = 16 >> s->avctx->lowres;
179  int ret;
180 
181  s->last_resync_gb = s->gb;
182  s->first_slice_line = 1;
183  s->resync_mb_x = s->mb_x;
184  s->resync_mb_y = s->mb_y;
185 
186  ff_set_qscale(s, s->qscale);
187 
188  if (s->avctx->hwaccel) {
189  const uint8_t *start = s->gb.buffer + get_bits_count(&s->gb) / 8;
190  ret = s->avctx->hwaccel->decode_slice(s->avctx, start, s->gb.buffer_end - start);
191  // ensure we exit decode loop
192  s->mb_y = s->mb_height;
193  return ret;
194  }
195 
196  if (s->partitioned_frame) {
197  const int qscale = s->qscale;
198 
199  if (CONFIG_MPEG4_DECODER && s->codec_id == AV_CODEC_ID_MPEG4)
200  if ((ret = ff_mpeg4_decode_partitions(s->avctx->priv_data)) < 0)
201  return ret;
202 
203  /* restore variables which were modified */
204  s->first_slice_line = 1;
205  s->mb_x = s->resync_mb_x;
206  s->mb_y = s->resync_mb_y;
207  ff_set_qscale(s, qscale);
208  }
209 
210  for (; s->mb_y < s->mb_height; s->mb_y++) {
211  /* per-row end of slice checks */
212  if (s->msmpeg4_version) {
213  if (s->resync_mb_y + s->slice_height == s->mb_y) {
215  s->mb_x - 1, s->mb_y, ER_MB_END);
216 
217  return 0;
218  }
219  }
220 
221  if (s->msmpeg4_version == 1) {
222  s->last_dc[0] =
223  s->last_dc[1] =
224  s->last_dc[2] = 128;
225  }
226 
228  for (; s->mb_x < s->mb_width; s->mb_x++) {
229  int ret;
230 
232 
233  if (s->resync_mb_x == s->mb_x && s->resync_mb_y + 1 == s->mb_y)
234  s->first_slice_line = 0;
235 
236  /* DCT & quantize */
237 
238  s->mv_dir = MV_DIR_FORWARD;
239  s->mv_type = MV_TYPE_16X16;
240  av_dlog(s, "%d %d %06X\n",
241  ret, get_bits_count(&s->gb), show_bits(&s->gb, 24));
242 
243  tprintf(NULL, "Decoding MB at %dx%d\n", s->mb_x, s->mb_y);
244  ret = s->decode_mb(s, s->block);
245 
246  if (s->pict_type != AV_PICTURE_TYPE_B)
248 
249  if (ret < 0) {
250  const int xy = s->mb_x + s->mb_y * s->mb_stride;
251  if (ret == SLICE_END) {
252  ff_mpv_decode_mb(s, s->block);
253  if (s->loop_filter)
255 
257  s->mb_x, s->mb_y, ER_MB_END & part_mask);
258 
259  s->padding_bug_score--;
260 
261  if (++s->mb_x >= s->mb_width) {
262  s->mb_x = 0;
263  ff_mpeg_draw_horiz_band(s, s->mb_y * mb_size, mb_size);
265  s->mb_y++;
266  }
267  return 0;
268  } else if (ret == SLICE_NOEND) {
270  "Slice mismatch at MB: %d\n", xy);
272  s->mb_x + 1, s->mb_y,
273  ER_MB_END & part_mask);
274  return AVERROR_INVALIDDATA;
275  }
276  av_log(s->avctx, AV_LOG_ERROR, "Error at MB: %d\n", xy);
278  s->mb_x, s->mb_y, ER_MB_ERROR & part_mask);
279 
281  continue;
282  return AVERROR_INVALIDDATA;
283  }
284 
285  ff_mpv_decode_mb(s, s->block);
286  if (s->loop_filter)
288  }
289 
290  ff_mpeg_draw_horiz_band(s, s->mb_y * mb_size, mb_size);
292 
293  s->mb_x = 0;
294  }
295 
296  av_assert1(s->mb_x == 0 && s->mb_y == s->mb_height);
297 
298  if (s->codec_id == AV_CODEC_ID_MPEG4 &&
300  get_bits_left(&s->gb) >= 48 &&
301  show_bits(&s->gb, 24) == 0x4010 &&
302  !s->data_partitioning)
303  s->padding_bug_score += 32;
304 
305  /* try to detect the padding bug */
306  if (s->codec_id == AV_CODEC_ID_MPEG4 &&
308  get_bits_left(&s->gb) >= 0 &&
309  get_bits_left(&s->gb) < 137 &&
310  !s->data_partitioning) {
311  const int bits_count = get_bits_count(&s->gb);
312  const int bits_left = s->gb.size_in_bits - bits_count;
313 
314  if (bits_left == 0) {
315  s->padding_bug_score += 16;
316  } else if (bits_left != 1) {
317  int v = show_bits(&s->gb, 8);
318  v |= 0x7F >> (7 - (bits_count & 7));
319 
320  if (v == 0x7F && bits_left <= 8)
321  s->padding_bug_score--;
322  else if (v == 0x7F && ((get_bits_count(&s->gb) + 8) & 8) &&
323  bits_left <= 16)
324  s->padding_bug_score += 4;
325  else
326  s->padding_bug_score++;
327  }
328  }
329 
330  if (s->codec_id == AV_CODEC_ID_H263 &&
332  get_bits_left(&s->gb) >= 8 &&
333  get_bits_left(&s->gb) < 300 &&
335  show_bits(&s->gb, 8) == 0 &&
336  !s->data_partitioning) {
337 
338  s->padding_bug_score += 32;
339  }
340 
342  if (s->padding_bug_score > -2 && !s->data_partitioning)
344  else
346  }
347 
348  // handle formats which don't have unique end markers
349  if (s->msmpeg4_version || (s->workaround_bugs & FF_BUG_NO_PADDING)) { // FIXME perhaps solve this more cleanly
350  int left = get_bits_left(&s->gb);
351  int max_extra = 7;
352 
353  /* no markers in M$ crap */
355  max_extra += 17;
356 
357  /* buggy padding but the frame should still end approximately at
358  * the bitstream end */
359  if ((s->workaround_bugs & FF_BUG_NO_PADDING) &&
361  max_extra += 48;
362  else if ((s->workaround_bugs & FF_BUG_NO_PADDING))
363  max_extra += 256 * 256 * 256 * 64;
364 
365  if (left > max_extra)
367  "discarding %d junk bits at end, next would be %X\n",
368  left, show_bits(&s->gb, 24));
369  else if (left < 0)
370  av_log(s->avctx, AV_LOG_ERROR, "overreading %d bits\n", -left);
371  else
373  s->mb_x - 1, s->mb_y, ER_MB_END);
374 
375  return 0;
376  }
377 
379  "slice end not reached but screenspace end (%d left %06X, score= %d)\n",
380  get_bits_left(&s->gb), show_bits(&s->gb, 24), s->padding_bug_score);
381 
382  ff_er_add_slice(&s->er, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y,
383  ER_MB_END & part_mask);
384 
385  return AVERROR_INVALIDDATA;
386 }
387 
388 int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
389  AVPacket *avpkt)
390 {
391  const uint8_t *buf = avpkt->data;
392  int buf_size = avpkt->size;
393  MpegEncContext *s = avctx->priv_data;
394  int ret;
395  int slice_ret = 0;
396  AVFrame *pict = data;
397 
398  s->flags = avctx->flags;
399  s->flags2 = avctx->flags2;
400 
401  /* no supplementary picture */
402  if (buf_size == 0) {
403  /* special case for last picture */
404  if (s->low_delay == 0 && s->next_picture_ptr) {
405  if ((ret = av_frame_ref(pict, s->next_picture_ptr->f)) < 0)
406  return ret;
407  s->next_picture_ptr = NULL;
408 
409  *got_frame = 1;
410  }
411 
412  return 0;
413  }
414 
415  if (s->flags & CODEC_FLAG_TRUNCATED) {
416  int next;
417 
418  if (CONFIG_MPEG4_DECODER && s->codec_id == AV_CODEC_ID_MPEG4) {
419  next = ff_mpeg4_find_frame_end(&s->parse_context, buf, buf_size);
420  } else if (CONFIG_H263_DECODER && s->codec_id == AV_CODEC_ID_H263) {
421  next = ff_h263_find_frame_end(&s->parse_context, buf, buf_size);
422  } else if (CONFIG_H263P_DECODER && s->codec_id == AV_CODEC_ID_H263P) {
423  next = ff_h263_find_frame_end(&s->parse_context, buf, buf_size);
424  } else {
426  "this codec does not support truncated bitstreams\n");
427  return AVERROR(ENOSYS);
428  }
429 
430  if (ff_combine_frame(&s->parse_context, next, (const uint8_t **)&buf,
431  &buf_size) < 0)
432  return buf_size;
433  }
434 
435 retry:
436  if (s->divx_packed && s->bitstream_buffer_size) {
437  int i;
438  for(i=0; i < buf_size-3; i++) {
439  if (buf[i]==0 && buf[i+1]==0 && buf[i+2]==1) {
440  if (buf[i+3]==0xB0) {
441  av_log(s->avctx, AV_LOG_WARNING, "Discarding excessive bitstream in packed xvid\n");
442  s->bitstream_buffer_size = 0;
443  }
444  break;
445  }
446  }
447  }
448 
449  if (s->bitstream_buffer_size && (s->divx_packed || buf_size < 20)) // divx 5.01+/xvid frame reorder
450  ret = init_get_bits8(&s->gb, s->bitstream_buffer,
452  else
453  ret = init_get_bits8(&s->gb, buf, buf_size);
454 
455  s->bitstream_buffer_size = 0;
456  if (ret < 0)
457  return ret;
458 
459  if (!s->context_initialized)
460  // we need the idct permutaton for reading a custom matrix
461  ff_mpv_idct_init(s);
462 
463  /* let's go :-) */
464  if (CONFIG_WMV2_DECODER && s->msmpeg4_version == 5) {
466  } else if (CONFIG_MSMPEG4_DECODER && s->msmpeg4_version) {
468  } else if (CONFIG_MPEG4_DECODER && avctx->codec_id == AV_CODEC_ID_MPEG4) {
469  if (s->avctx->extradata_size && s->picture_number == 0) {
470  GetBitContext gb;
471 
472  if (init_get_bits8(&gb, s->avctx->extradata, s->avctx->extradata_size) >= 0 )
474  }
475  ret = ff_mpeg4_decode_picture_header(avctx->priv_data, &s->gb);
476  } else if (CONFIG_H263I_DECODER && s->codec_id == AV_CODEC_ID_H263I) {
478  } else if (CONFIG_FLV_DECODER && s->h263_flv) {
480  } else {
482  }
483 
484  if (ret < 0 || ret == FRAME_SKIPPED) {
485  if ( s->width != avctx->coded_width
486  || s->height != avctx->coded_height) {
487  av_log(s->avctx, AV_LOG_WARNING, "Reverting picture dimensions change due to header decoding failure\n");
488  s->width = avctx->coded_width;
489  s->height= avctx->coded_height;
490  }
491  }
492  if (ret == FRAME_SKIPPED)
493  return get_consumed_bytes(s, buf_size);
494 
495  /* skip if the header was thrashed */
496  if (ret < 0) {
497  av_log(s->avctx, AV_LOG_ERROR, "header damaged\n");
498  return ret;
499  }
500 
501  if (!s->context_initialized)
502  if ((ret = ff_mpv_common_init(s)) < 0)
503  return ret;
504 
505  if (!s->current_picture_ptr || s->current_picture_ptr->f->data[0]) {
506  int i = ff_find_unused_picture(s, 0);
507  if (i < 0)
508  return i;
509  s->current_picture_ptr = &s->picture[i];
510  }
511 
512  avctx->has_b_frames = !s->low_delay;
513 
514  if (CONFIG_MPEG4_DECODER && avctx->codec_id == AV_CODEC_ID_MPEG4) {
515  if (ff_mpeg4_workaround_bugs(avctx) == 1)
516  goto retry;
517  }
518 
519  /* After H263 & mpeg4 header decode we have the height, width,
520  * and other parameters. So then we could init the picture.
521  * FIXME: By the way H263 decoder is evolving it should have
522  * an H263EncContext */
523  if (s->width != avctx->coded_width ||
524  s->height != avctx->coded_height ||
525  s->context_reinit) {
526  /* H.263 could change picture size any time */
527  s->context_reinit = 0;
528 
529  ret = ff_set_dimensions(avctx, s->width, s->height);
530  if (ret < 0)
531  return ret;
532 
533  ff_set_sar(avctx, avctx->sample_aspect_ratio);
534 
535  if ((ret = ff_mpv_common_frame_size_change(s)))
536  return ret;
537  }
538 
539  if (s->codec_id == AV_CODEC_ID_H263 ||
540  s->codec_id == AV_CODEC_ID_H263P ||
543 
544  // for skipping the frame
547 
548  /* skip B-frames if we don't have reference frames */
549  if (!s->last_picture_ptr &&
550  (s->pict_type == AV_PICTURE_TYPE_B || s->droppable))
551  return get_consumed_bytes(s, buf_size);
552  if ((avctx->skip_frame >= AVDISCARD_NONREF &&
553  s->pict_type == AV_PICTURE_TYPE_B) ||
554  (avctx->skip_frame >= AVDISCARD_NONKEY &&
555  s->pict_type != AV_PICTURE_TYPE_I) ||
556  avctx->skip_frame >= AVDISCARD_ALL)
557  return get_consumed_bytes(s, buf_size);
558 
559  if (s->next_p_frame_damaged) {
560  if (s->pict_type == AV_PICTURE_TYPE_B)
561  return get_consumed_bytes(s, buf_size);
562  else
563  s->next_p_frame_damaged = 0;
564  }
565 
566  if ((!s->no_rounding) || s->pict_type == AV_PICTURE_TYPE_B) {
569  } else {
572  }
573 
574  if ((ret = ff_mpv_frame_start(s, avctx)) < 0)
575  return ret;
576 
577  if (!s->divx_packed && !avctx->hwaccel)
578  ff_thread_finish_setup(avctx);
579 
580  if (CONFIG_MPEG4_VDPAU_DECODER && (s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU)) {
582  goto frame_end;
583  }
584 
585  if (avctx->hwaccel) {
586  ret = avctx->hwaccel->start_frame(avctx, s->gb.buffer,
587  s->gb.buffer_end - s->gb.buffer);
588  if (ret < 0 )
589  return ret;
590  }
591 
593 
594  /* the second part of the wmv2 header contains the MB skip bits which
595  * are stored in current_picture->mb_type which is not available before
596  * ff_mpv_frame_start() */
597  if (CONFIG_WMV2_DECODER && s->msmpeg4_version == 5) {
599  if (ret < 0)
600  return ret;
601  if (ret == 1)
602  goto frame_end;
603  }
604 
605  /* decode each macroblock */
606  s->mb_x = 0;
607  s->mb_y = 0;
608 
609  slice_ret = decode_slice(s);
610  while (s->mb_y < s->mb_height) {
611  if (s->msmpeg4_version) {
612  if (s->slice_height == 0 || s->mb_x != 0 ||
613  (s->mb_y % s->slice_height) != 0 || get_bits_left(&s->gb) < 0)
614  break;
615  } else {
616  int prev_x = s->mb_x, prev_y = s->mb_y;
617  if (ff_h263_resync(s) < 0)
618  break;
619  if (prev_y * s->mb_width + prev_x < s->mb_y * s->mb_width + s->mb_x)
620  s->er.error_occurred = 1;
621  }
622 
623  if (s->msmpeg4_version < 4 && s->h263_pred)
625 
626  if (decode_slice(s) < 0)
627  slice_ret = AVERROR_INVALIDDATA;
628  }
629 
630  if (s->msmpeg4_version && s->msmpeg4_version < 4 &&
632  if (!CONFIG_MSMPEG4_DECODER ||
633  ff_msmpeg4_decode_ext_header(s, buf_size) < 0)
635 
637 frame_end:
638  ff_er_frame_end(&s->er);
639 
640  if (avctx->hwaccel) {
641  ret = avctx->hwaccel->end_frame(avctx);
642  if (ret < 0)
643  return ret;
644  }
645 
646  ff_mpv_frame_end(s);
647 
648  if (CONFIG_MPEG4_DECODER && avctx->codec_id == AV_CODEC_ID_MPEG4)
649  ff_mpeg4_frame_end(avctx, buf, buf_size);
650 
651  if (!s->divx_packed && avctx->hwaccel)
652  ff_thread_finish_setup(avctx);
653 
656  if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) {
657  if ((ret = av_frame_ref(pict, s->current_picture_ptr->f)) < 0)
658  return ret;
661  } else if (s->last_picture_ptr) {
662  if ((ret = av_frame_ref(pict, s->last_picture_ptr->f)) < 0)
663  return ret;
666  }
667 
668  if (s->last_picture_ptr || s->low_delay) {
669  if ( pict->format == AV_PIX_FMT_YUV420P
670  && (s->codec_tag == AV_RL32("GEOV") || s->codec_tag == AV_RL32("GEOX"))) {
671  int x, y, p;
673  for (p=0; p<3; p++) {
674  int w = FF_CEIL_RSHIFT(pict-> width, !!p);
675  int h = FF_CEIL_RSHIFT(pict->height, !!p);
676  int linesize = pict->linesize[p];
677  for (y=0; y<(h>>1); y++)
678  for (x=0; x<w; x++)
679  FFSWAP(int,
680  pict->data[p][x + y*linesize],
681  pict->data[p][x + (h-1-y)*linesize]);
682  }
683  }
684  *got_frame = 1;
685  }
686 
687  if (slice_ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE))
688  return ret;
689  else
690  return get_consumed_bytes(s, buf_size);
691 }
692 
694 #if CONFIG_H263_VAAPI_HWACCEL || CONFIG_MPEG4_VAAPI_HWACCEL
696 #endif
697 #if CONFIG_H263_VDPAU_HWACCEL || CONFIG_MPEG4_VDPAU_HWACCEL
699 #endif
702 };
703 
705  .name = "h263",
706  .long_name = NULL_IF_CONFIG_SMALL("H.263 / H.263-1996, H.263+ / H.263-1998 / H.263 version 2"),
707  .type = AVMEDIA_TYPE_VIDEO,
708  .id = AV_CODEC_ID_H263,
709  .priv_data_size = sizeof(MpegEncContext),
713  .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 |
715  .flush = ff_mpeg_flush,
716  .max_lowres = 3,
718 };
719 
721  .name = "h263p",
722  .long_name = NULL_IF_CONFIG_SMALL("H.263 / H.263-1996, H.263+ / H.263-1998 / H.263 version 2"),
723  .type = AVMEDIA_TYPE_VIDEO,
724  .id = AV_CODEC_ID_H263P,
725  .priv_data_size = sizeof(MpegEncContext),
729  .capabilities = CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 |
731  .flush = ff_mpeg_flush,
732  .max_lowres = 3,
734 };