---
libavcodec/h264_slice.c | 6 +++---
libavcodec/vdpau_h264.c | 18 +++++++++++++++++-
2 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index f20e017..d9e296a 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -970,6 +970,9 @@ static enum AVPixelFormat get_pixel_format(H264Context *h)
*(fmt++) = AV_PIX_FMT_YUV420P10;
break;
case 8:
+#if CONFIG_H264_VDPAU_HWACCEL
+ *(fmt++) = AV_PIX_FMT_VDPAU;
+#endif
if (CHROMA444(h)) {
if (h->avctx->colorspace == AVCOL_SPC_RGB)
*(fmt++) = AV_PIX_FMT_GBRP;
@@ -993,9 +996,6 @@ static enum AVPixelFormat get_pixel_format(H264Context *h)
*(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;
else if (h->avctx->color_range == AVCOL_RANGE_JPEG)
diff --git a/libavcodec/vdpau_h264.c b/libavcodec/vdpau_h264.c
index 5ed1fff..2e41910 100644
--- a/libavcodec/vdpau_h264.c
+++ b/libavcodec/vdpau_h264.c
@@ -205,8 +205,24 @@ static int vdpau_h264_end_frame(AVCodecContext *avctx)
static int vdpau_h264_init(AVCodecContext *avctx)
{
+ const H264Context *h = avctx->priv_data;
VdpDecoderProfile profile;
uint32_t level = avctx->level;
+ VdpChromaType type;
+
+ switch (h->sps.chroma_format_idc) {
+ case 1:
+ type = VDP_CHROMA_TYPE_420;
+ break;
+ case 2:
+ type = VDP_CHROMA_TYPE_422;
+ break;
+ case 3:
+ type = VDP_CHROMA_TYPE_444;
+ break;
+ default:
+ return AVERROR(ENOTSUP);
+ }
switch (avctx->profile & ~FF_PROFILE_H264_INTRA) {
case FF_PROFILE_H264_BASELINE:
@@ -235,7 +251,7 @@ static int vdpau_h264_init(AVCodecContext *avctx)
if ((avctx->profile & FF_PROFILE_H264_INTRA) && avctx->level == 11)
level = VDP_DECODER_LEVEL_H264_1b;
- return ff_vdpau_common_init(avctx, profile, level);
+ return ff_vdpau_common_init(avctx, profile, level, type);
}
AVHWAccel ff_h264_vdpau_hwaccel = {
--
1.9.1
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel