[FFmpeg-devel] [PATCH] vaapi_vp9: Do not set bit_depth on old versions

Mark Thompson sw at jkqxz.net
Thu Dec 8 17:51:38 EET 2016


Fixes ticket #6003.
---
On 08/12/16 15:16, Carl Eugen Hoyos wrote:
> 2016-12-05 21:32 GMT+01:00 Mathieu Velten <matmaul at gmail.com>:
>> ---
>>  libavcodec/vaapi_vp9.c |  1 +
>>  libavcodec/vp9.c       | 10 +++++++++-
>>  2 files changed, 10 insertions(+), 1 deletion(-)
> 
> (This is missing a review here but I guess it's just me
> who can't work with gmail.)
> 
> May I suggest to revert this?
> 
>> +    pp->bit_depth = h->h.bpp;
> 
> Google doesn't easily find a version of va_dec_vp9.h
> with _VADecPictureParameterBufferVP9->bit_depth.

Urgh: libva 1.6.0 to 1.6.2 don't have this field.

Hacky fix enclosing, only compile tested.

A configure test for this might be better, because we could then check it sensibly in the generic code and bail out earlier?  (Which would permit software decode, this will attempt hardware decode and fail.)


 libavcodec/vaapi_vp9.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/libavcodec/vaapi_vp9.c b/libavcodec/vaapi_vp9.c
index 9b3e81a..5bc413d 100644
--- a/libavcodec/vaapi_vp9.c
+++ b/libavcodec/vaapi_vp9.c
@@ -38,7 +38,10 @@ static void fill_picture_parameters(AVCodecContext                 *avctx,
     pp->first_partition_size = h->h.compressed_header_size;
 
     pp->profile = h->h.profile;
+
+#if VA_CHECK_VERSION(0, 39, 0)
     pp->bit_depth = h->h.bpp;
+#endif
 
     pp->filter_level = h->h.filter.level;
     pp->sharpness_level = h->h.filter.sharpness;
@@ -97,6 +100,14 @@ static int vaapi_vp9_start_frame(AVCodecContext          *avctx,
     FFVAContext * const vactx = ff_vaapi_get_context(avctx);
     VADecPictureParameterBufferVP9 *pic_param;
 
+#if !VA_CHECK_VERSION(0, 39, 0)
+    if (h->h.profile >= 2) {
+        av_log(avctx, AV_LOG_ERROR, "VP9 profile %d is not supported "
+               "with this libva version.\n", h->h.profile);
+        return AVERROR
+    }
+#endif
+
     vactx->slice_param_size = sizeof(VASliceParameterBufferVP9);
 
     pic_param = ff_vaapi_alloc_pic_param(vactx, sizeof(VADecPictureParameterBufferVP9));
-- 
2.7.4



More information about the ffmpeg-devel mailing list