Merge commit 'c9ccbc7333eddd025ebbde5cc4f27d68a950c623'
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 29 Apr 2015 11:48:02 +0000 (13:48 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 29 Apr 2015 11:48:45 +0000 (13:48 +0200)
* commit 'c9ccbc7333eddd025ebbde5cc4f27d68a950c623':
  h264: update the current bit depth/chroma type in init_slice_header()

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

@@@ -1099,31 -1003,19 +1099,33 @@@ static int h264_slice_header_init(H264C
      ret = ff_h264_alloc_tables(h);
      if (ret < 0) {
          av_log(h->avctx, AV_LOG_ERROR, "Could not allocate memory\n");
 -        return ret;
 +        goto fail;
 +    }
 +
 +    if (h->avctx->codec &&
 +        h->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU &&
 +        (h->sps.bit_depth_luma != 8 || h->sps.chroma_format_idc > 1)) {
 +        av_log(h->avctx, AV_LOG_ERROR,
 +                "VDPAU decoding does not support video colorspace.\n");
 +        ret = AVERROR_INVALIDDATA;
 +        goto fail;
      }
  
 -    if (h->sps.bit_depth_luma < 8 || h->sps.bit_depth_luma > 10) {
 +    if (h->sps.bit_depth_luma < 8 || h->sps.bit_depth_luma > 14 ||
 +        h->sps.bit_depth_luma == 11 || h->sps.bit_depth_luma == 13
 +    ) {
          av_log(h->avctx, AV_LOG_ERROR, "Unsupported bit depth %d\n",
                 h->sps.bit_depth_luma);
 -        return AVERROR_INVALIDDATA;
 +        ret = AVERROR_INVALIDDATA;
 +        goto fail;
      }
  
 +    h->cur_bit_depth_luma         =
      h->avctx->bits_per_raw_sample = h->sps.bit_depth_luma;
 +    h->cur_chroma_format_idc      = h->sps.chroma_format_idc;
      h->pixel_shift                = h->sps.bit_depth_luma > 8;
+     h->chroma_format_idc          = h->sps.chroma_format_idc;
+     h->bit_depth_luma             = h->sps.bit_depth_luma;
  
      ff_h264dsp_init(&h->h264dsp, h->sps.bit_depth_luma,
                      h->sps.chroma_format_idc);
@@@ -1317,19 -1159,9 +1319,16 @@@ int ff_h264_decode_slice_header(H264Con
  
          h->sps = *h->sps_buffers[h->pps.sps_id];
  
 +        if (h->mb_width  != h->sps.mb_width ||
 +            h->mb_height != h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag) ||
 +            h->cur_bit_depth_luma    != h->sps.bit_depth_luma ||
 +            h->cur_chroma_format_idc != h->sps.chroma_format_idc
 +        )
 +            needs_reinit = 1;
 +
          if (h->bit_depth_luma    != h->sps.bit_depth_luma ||
-             h->chroma_format_idc != h->sps.chroma_format_idc) {
-             h->bit_depth_luma    = h->sps.bit_depth_luma;
-             h->chroma_format_idc = h->sps.chroma_format_idc;
+             h->chroma_format_idc != h->sps.chroma_format_idc)
              needs_reinit         = 1;
-         }
  
          if (h->flags & CODEC_FLAG_LOW_DELAY ||
              (h->sps.bitstream_restriction_flag &&