Merge commit 'ebd5320afd42d4315851f3e0ca7f5d4a6300eb68'
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 27 Dec 2014 12:16:46 +0000 (13:16 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 27 Dec 2014 12:17:20 +0000 (13:17 +0100)
* commit 'ebd5320afd42d4315851f3e0ca7f5d4a6300eb68':
  vdpau: add support for 4:2:2 and 4:4:4 chroma sampling

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

index 2f58f1132eb06194cecbc007b73ef92b7b4d14ac..e689044323466fa499dc762bf4c2932e25bcc68c 100644 (file)
@@ -1054,6 +1054,9 @@ static enum AVPixelFormat get_pixel_format(H264Context *h, int force_callback)
             *fmt++ = AV_PIX_FMT_YUV420P14;
         break;
     case 8:
+#if CONFIG_H264_VDPAU_HWACCEL
+        *fmt++ = AV_PIX_FMT_VDPAU;
+#endif
         if (CHROMA444(h)) {
             if (h->avctx->colorspace == AVCOL_SPC_YCGCO)
                 av_log(h->avctx, AV_LOG_WARNING, "Detected unsupported YCgCo colorspace.\n");
@@ -1078,9 +1081,6 @@ static enum AVPixelFormat get_pixel_format(H264Context *h, int force_callback)
 #if CONFIG_H264_VDA_HWACCEL
             *fmt++ = AV_PIX_FMT_VDA_VLD;
             *fmt++ = AV_PIX_FMT_VDA;
-#endif
-#if CONFIG_H264_VDPAU_HWACCEL
-            *fmt++ = AV_PIX_FMT_VDPAU;
 #endif
             if (h->avctx->codec->pix_fmts)
                 choices = h->avctx->codec->pix_fmts;
index 8577c19b531031f89c859c5b48727f720779140a..7578e62a8639be48df786fcd8af0b1a46c69c27a 100644 (file)
@@ -155,6 +155,10 @@ int ff_vdpau_common_init(AVCodecContext *avctx, VdpDecoderProfile profile,
     if (av_vdpau_get_surface_parameters(avctx, &type, &width, &height))
         return AVERROR(ENOSYS);
 
+    if (!(hwctx->flags & AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH) &&
+        type != VDP_CHROMA_TYPE_420)
+        return AVERROR(ENOSYS);
+
     status = vdctx->get_proc_address(vdctx->device,
                                      VDP_FUNC_ID_VIDEO_SURFACE_QUERY_CAPABILITIES,
                                      &func);
@@ -744,7 +748,7 @@ int av_vdpau_bind_context(AVCodecContext *avctx, VdpDevice device,
 {
     VDPAUHWContext *hwctx;
 
-    if (flags & ~AV_HWACCEL_FLAG_IGNORE_LEVEL)
+    if (flags & ~(AV_HWACCEL_FLAG_IGNORE_LEVEL|AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH))
         return AVERROR(EINVAL);
 
     if (av_reallocp(&avctx->hwaccel_context, sizeof(*hwctx)))