OSDN Git Service

Merge commit 'bfd26b7ce6efea594f2b99441d900419df3af638'
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 6 Jan 2014 15:28:55 +0000 (16:28 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 6 Jan 2014 15:28:55 +0000 (16:28 +0100)
* commit 'bfd26b7ce6efea594f2b99441d900419df3af638':
  h264: reject mismatching luma/chroma bit depths during sps parsing

Conflicts:
libavcodec/h264_ps.c

See: bdeb61ccc67911cfc5e20c7cfb1312d0501ca90a
Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavcodec/h264.c
libavcodec/h264_ps.c

@@@ -3115,23 -3053,9 +3115,17 @@@ static int h264_set_parameter_from_sps(
      if (h->avctx->has_b_frames < 2)
          h->avctx->has_b_frames = !h->low_delay;
  
-     if (h->sps.bit_depth_luma != h->sps.bit_depth_chroma) {
-         avpriv_request_sample(h->avctx,
-                               "Different chroma and luma bit depth");
-         return AVERROR_PATCHWELCOME;
-     }
      if (h->avctx->bits_per_raw_sample != h->sps.bit_depth_luma ||
          h->cur_chroma_format_idc      != h->sps.chroma_format_idc) {
 -        if (h->sps.bit_depth_luma >= 8 && h->sps.bit_depth_luma <= 10) {
 +        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");
 +            return AVERROR_INVALIDDATA;
 +        }
 +        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) {
              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;
@@@ -376,11 -341,11 +376,16 @@@ int ff_h264_decode_seq_parameter_set(H2
          }
          sps->bit_depth_luma   = get_ue_golomb(&h->gb) + 8;
          sps->bit_depth_chroma = get_ue_golomb(&h->gb) + 8;
-         if (sps->bit_depth_luma > 14U || sps->bit_depth_chroma > 14U || sps->bit_depth_luma != sps->bit_depth_chroma) {
+         if (sps->bit_depth_chroma != sps->bit_depth_luma) {
+             avpriv_request_sample(h->avctx,
+                                   "Different chroma and luma bit depth");
+             goto fail;
+         }
++        if (sps->bit_depth_luma > 14U || sps->bit_depth_chroma > 14U) {
 +            av_log(h->avctx, AV_LOG_ERROR, "illegal bit depth value (%d, %d)\n",
 +                   sps->bit_depth_luma, sps->bit_depth_chroma);
 +            goto fail;
 +        }
          sps->transform_bypass = get_bits1(&h->gb);
          decode_scaling_matrices(h, sps, NULL, 1,
                                  sps->scaling_matrix4, sps->scaling_matrix8);