summaryrefslogtreecommitdiff
path: root/libavcodec/av1dec.c
diff options
context:
space:
mode:
authorFei Wang <fei.w.wang@intel.com>2020-10-29 14:54:25 +0800
committerMark Thompson <sw@jkqxz.net>2020-11-02 22:57:23 +0000
commit3308bbf7761a2723f784fcd6bb921dcbadc18c6e (patch)
tree2df5b35e92adb94eae25d82fa0c1b70798be39e2 /libavcodec/av1dec.c
parentdbd4254a614012ca36d75800eb9a7525742a6144 (diff)
avcodec: add av1 VAAPI decoder
Example cmdline: ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -v verbose \ -c:v av1 -i input.ivf -pix_fmt yuv420p -vsync passthrough -f md5 \ -y out.md5 Signed-off-by: Fei Wang <fei.w.wang@intel.com>
Diffstat (limited to 'libavcodec/av1dec.c')
-rw-r--r--libavcodec/av1dec.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c
index 9566f7aa7d..56712279aa 100644
--- a/libavcodec/av1dec.c
+++ b/libavcodec/av1dec.c
@@ -215,7 +215,7 @@ static int get_pixel_format(AVCodecContext *avctx)
uint8_t bit_depth;
int ret;
enum AVPixelFormat pix_fmt = AV_PIX_FMT_NONE;
-#define HWACCEL_MAX (0)
+#define HWACCEL_MAX (CONFIG_AV1_VAAPI_HWACCEL)
enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmtp = pix_fmts;
if (seq->seq_profile == 2 && seq->color_config.high_bitdepth)
@@ -276,6 +276,19 @@ static int get_pixel_format(AVCodecContext *avctx)
return -1;
s->pix_fmt = pix_fmt;
+ switch (s->pix_fmt) {
+ case AV_PIX_FMT_YUV420P:
+#if CONFIG_AV1_VAAPI_HWACCEL
+ *fmtp++ = AV_PIX_FMT_VAAPI;
+#endif
+ break;
+ case AV_PIX_FMT_YUV420P10:
+#if CONFIG_AV1_VAAPI_HWACCEL
+ *fmtp++ = AV_PIX_FMT_VAAPI;
+#endif
+ break;
+ }
+
*fmtp++ = s->pix_fmt;
*fmtp = AV_PIX_FMT_NONE;
@@ -840,6 +853,9 @@ AVCodec ff_av1_decoder = {
.flush = av1_decode_flush,
.profiles = NULL_IF_CONFIG_SMALL(ff_av1_profiles),
.hw_configs = (const AVCodecHWConfigInternal * []) {
+#if CONFIG_AV1_VAAPI_HWACCEL
+ HWACCEL_VAAPI(av1),
+#endif
NULL
},
};