Merge remote-tracking branch 'qatar/release/9' into release/1.1
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 8 Oct 2013 00:11:31 +0000 (02:11 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 8 Oct 2013 00:11:31 +0000 (02:11 +0200)
* qatar/release/9:
  Prepare for 9.10 RELEASE
  h263dec: Remove a hack that can cause infinite loops
  mpegvideo: Initialize chroma_*_shift and codec_tag even if the size is 0
  vc1dec: Don't decode slices when the latest slice header failed to decode

Conflicts:
RELEASE
libavcodec/h263dec.c
libavcodec/mpegvideo.c
libavcodec/vc1dec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavcodec/h263dec.c
libavcodec/mpegvideo.c
libavcodec/vc1dec.c

Simple merge
@@@ -888,33 -915,43 +888,35 @@@ av_cold int ff_MPV_common_init(MpegEncC
      s->flags2 = s->avctx->flags2;
  
      /* set chroma shifts */
-     avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &s->chroma_x_shift, &s->chroma_y_shift);
 -    av_pix_fmt_get_chroma_sub_sample(s->avctx->pix_fmt,
 -                                     &s->chroma_x_shift,
 -                                     &s->chroma_y_shift);
++    avcodec_get_chroma_sub_sample(s->avctx->pix_fmt,
++                                  &s->chroma_x_shift,
++                                  &s->chroma_y_shift);
  
      /* convert fourcc to upper case */
 -    s->codec_tag          = avpriv_toupper4(s->avctx->codec_tag);
 +    s->codec_tag        = avpriv_toupper4(s->avctx->codec_tag);
 +    s->stream_codec_tag = avpriv_toupper4(s->avctx->stream_codec_tag);
  
 -    s->stream_codec_tag   = avpriv_toupper4(s->avctx->stream_codec_tag);
 +    s->avctx->coded_frame = &s->current_picture.f;
  
 -    if (s->width && s->height) {
 -        s->avctx->coded_frame = &s->current_picture.f;
 +    if (s->encoding) {
 +        if (s->msmpeg4_version) {
 +            FF_ALLOCZ_OR_GOTO(s->avctx, s->ac_stats,
 +                                2 * 2 * (MAX_LEVEL + 1) *
 +                                (MAX_RUN + 1) * 2 * sizeof(int), fail);
 +        }
 +        FF_ALLOCZ_OR_GOTO(s->avctx, s->avctx->stats_out, 256, fail);
  
 -        if (s->encoding) {
 -            if (s->msmpeg4_version) {
 -                FF_ALLOCZ_OR_GOTO(s->avctx, s->ac_stats,
 -                                  2 * 2 * (MAX_LEVEL + 1) *
 -                                  (MAX_RUN + 1) * 2 * sizeof(int), fail);
 -            }
 -            FF_ALLOCZ_OR_GOTO(s->avctx, s->avctx->stats_out, 256, fail);
 -
 -            FF_ALLOCZ_OR_GOTO(s->avctx, s->q_intra_matrix,
 -                              64 * 32   * sizeof(int), fail);
 -            FF_ALLOCZ_OR_GOTO(s->avctx, s->q_inter_matrix,
 -                              64 * 32   * sizeof(int), fail);
 -            FF_ALLOCZ_OR_GOTO(s->avctx, s->q_intra_matrix16,
 -                              64 * 32 * 2 * sizeof(uint16_t), fail);
 -            FF_ALLOCZ_OR_GOTO(s->avctx, s->q_inter_matrix16,
 -                              64 * 32 * 2 * sizeof(uint16_t), fail);
 -            FF_ALLOCZ_OR_GOTO(s->avctx, s->input_picture,
 -                              MAX_PICTURE_COUNT * sizeof(Picture *), fail);
 -            FF_ALLOCZ_OR_GOTO(s->avctx, s->reordered_input_picture,
 -                              MAX_PICTURE_COUNT * sizeof(Picture *), fail);
 -
 -            if (s->avctx->noise_reduction) {
 -                FF_ALLOCZ_OR_GOTO(s->avctx, s->dct_offset,
 -                                  2 * 64 * sizeof(uint16_t), fail);
 -            }
 +        FF_ALLOCZ_OR_GOTO(s->avctx, s->q_intra_matrix,          64 * 32   * sizeof(int), fail)
 +        FF_ALLOCZ_OR_GOTO(s->avctx, s->q_chroma_intra_matrix,   64 * 32   * sizeof(int), fail)
 +        FF_ALLOCZ_OR_GOTO(s->avctx, s->q_inter_matrix,          64 * 32   * sizeof(int), fail)
 +        FF_ALLOCZ_OR_GOTO(s->avctx, s->q_intra_matrix16,        64 * 32 * 2 * sizeof(uint16_t), fail)
 +        FF_ALLOCZ_OR_GOTO(s->avctx, s->q_chroma_intra_matrix16, 64 * 32 * 2 * sizeof(uint16_t), fail)
 +        FF_ALLOCZ_OR_GOTO(s->avctx, s->q_inter_matrix16,        64 * 32 * 2 * sizeof(uint16_t), fail)
 +        FF_ALLOCZ_OR_GOTO(s->avctx, s->input_picture,           MAX_PICTURE_COUNT * sizeof(Picture *), fail)
 +        FF_ALLOCZ_OR_GOTO(s->avctx, s->reordered_input_picture, MAX_PICTURE_COUNT * sizeof(Picture *), fail)
 +
 +        if (s->avctx->noise_reduction) {
 +            FF_ALLOCZ_OR_GOTO(s->avctx, s->dct_offset, 2 * 64 * sizeof(uint16_t), fail);
          }
      }
  
@@@ -5629,45 -5584,14 +5629,46 @@@ static int vc1_decode_frame(AVCodecCont
          &&s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
          ff_vdpau_vc1_decode_picture(s, buf_start, (buf + buf_size) - buf_start);
      else if (avctx->hwaccel) {
 -        if (avctx->hwaccel->start_frame(avctx, buf, buf_size) < 0)
 -            goto err;
 -        if (avctx->hwaccel->decode_slice(avctx, buf_start, (buf + buf_size) - buf_start) < 0)
 -            goto err;
 -        if (avctx->hwaccel->end_frame(avctx) < 0)
 -            goto err;
 +        if (v->field_mode && buf_start_second_field) {
 +            // decode first field
 +            s->picture_structure = PICT_BOTTOM_FIELD - v->tff;
 +            if (avctx->hwaccel->start_frame(avctx, buf_start, buf_start_second_field - buf_start) < 0)
 +                goto err;
 +            if (avctx->hwaccel->decode_slice(avctx, buf_start, buf_start_second_field - buf_start) < 0)
 +                goto err;
 +            if (avctx->hwaccel->end_frame(avctx) < 0)
 +                goto err;
 +
 +            // decode second field
 +            s->gb = slices[n_slices1 + 1].gb;
 +            s->picture_structure = PICT_TOP_FIELD + v->tff;
 +            v->second_field = 1;
 +            v->pic_header_flag = 0;
 +            if (ff_vc1_parse_frame_header_adv(v, &s->gb) < 0) {
 +                av_log(avctx, AV_LOG_ERROR, "parsing header for second field failed");
 +                goto err;
 +            }
 +            v->s.current_picture_ptr->f.pict_type = v->s.pict_type;
 +
 +            if (avctx->hwaccel->start_frame(avctx, buf_start_second_field, (buf + buf_size) - buf_start_second_field) < 0)
 +                goto err;
 +            if (avctx->hwaccel->decode_slice(avctx, buf_start_second_field, (buf + buf_size) - buf_start_second_field) < 0)
 +                goto err;
 +            if (avctx->hwaccel->end_frame(avctx) < 0)
 +                goto err;
 +        } else {
 +            s->picture_structure = PICT_FRAME;
 +            if (avctx->hwaccel->start_frame(avctx, buf_start, (buf + buf_size) - buf_start) < 0)
 +                goto err;
 +            if (avctx->hwaccel->decode_slice(avctx, buf_start, (buf + buf_size) - buf_start) < 0)
 +                goto err;
 +            if (avctx->hwaccel->end_frame(avctx) < 0)
 +                goto err;
 +        }
      } else {
+         int header_ret = 0;
 +        if (v->fcm == ILACE_FRAME && s->pict_type == AV_PICTURE_TYPE_B)
 +            goto err; // This codepath is still incomplete thus it is disabled
  
          ff_er_frame_start(s);