aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHaihao Xiang <haihao.xiang@intel.com>2020-09-16 15:07:54 +0800
committerZhong Li <zhongli_dev@126.com>2020-09-26 23:42:39 +0800
commitcc25ae5d8ad2cef2dc8a21b828e89e5077b9dae3 (patch)
tree9c368e6a2456b0c0c0700cfd316870390edc0f3d
parentf8f23a7af7dd5ec7a3ca0c9fc9c302847ef8a21b (diff)
downloadffmpeg-cc25ae5d8ad2cef2dc8a21b828e89e5077b9dae3.tar.gz
lavc/qsvdec: Add QSV AV1 decoder
AV1 decoder is supported on Tiger Lake+ platforms since libmfx 1.34 Signed-off-by: Haihao Xiang <haihao.xiang@intel.com> Signed-off-by: Zhong Li <zhongli_dev@126.com>
-rw-r--r--Changelog1
-rwxr-xr-xconfigure1
-rw-r--r--libavcodec/allcodecs.c1
-rw-r--r--libavcodec/qsv.c4
-rw-r--r--libavcodec/qsvdec_other.c31
5 files changed, 37 insertions, 1 deletions
diff --git a/Changelog b/Changelog
index 316da6d145..93beec3720 100644
--- a/Changelog
+++ b/Changelog
@@ -28,6 +28,7 @@ version <next>:
- DAT demuxer
- aax demuxer
- IPU decoder, parser and demuxer
+- Intel QSV-accelerated AV1 decoding
version 4.3:
diff --git a/configure b/configure
index 39fabb4ad5..b8de64ccae 100755
--- a/configure
+++ b/configure
@@ -3140,6 +3140,7 @@ vp9_qsv_encoder_deps="libmfx MFX_CODEC_VP9"
vp9_qsv_encoder_select="qsvenc"
vp9_v4l2m2m_decoder_deps="v4l2_m2m vp9_v4l2_m2m"
wmv3_crystalhd_decoder_select="crystalhd"
+av1_qsv_decoder_select="qsvdec"
# parsers
aac_parser_select="adts_header"
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 17c88d6290..26fe90eafb 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -821,6 +821,7 @@ extern AVCodec ff_vp9_mediacodec_decoder;
extern AVCodec ff_vp9_qsv_decoder;
extern AVCodec ff_vp9_vaapi_encoder;
extern AVCodec ff_vp9_qsv_encoder;
+extern AVCodec ff_av1_qsv_decoder;
// The iterate API is not usable with ossfuzz due to the excessive size of binaries created
#if CONFIG_OSSFUZZ
diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
index 17720070f1..7816d2f93c 100644
--- a/libavcodec/qsv.c
+++ b/libavcodec/qsv.c
@@ -64,6 +64,10 @@ int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id)
case AV_CODEC_ID_VP9:
return MFX_CODEC_VP9;
#endif
+#if QSV_VERSION_ATLEAST(1, 34)
+ case AV_CODEC_ID_AV1:
+ return MFX_CODEC_AV1;
+#endif
default:
break;
diff --git a/libavcodec/qsvdec_other.c b/libavcodec/qsvdec_other.c
index b4df76739c..2775e07955 100644
--- a/libavcodec/qsvdec_other.c
+++ b/libavcodec/qsvdec_other.c
@@ -1,5 +1,5 @@
/*
- * Intel MediaSDK QSV based MPEG-2, VC-1, VP8, MJPEG and VP9 decoders
+ * Intel MediaSDK QSV based MPEG-2, VC-1, VP8, MJPEG, VP9 and AV1 decoders
*
* copyright (c) 2015 Anton Khirnov
*
@@ -327,3 +327,32 @@ AVCodec ff_vp9_qsv_decoder = {
.wrapper_name = "qsv",
};
#endif
+
+#if CONFIG_AV1_QSV_DECODER
+static const AVClass av1_qsv_class = {
+ .class_name = "av1_qsv",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
+AVCodec ff_av1_qsv_decoder = {
+ .name = "av1_qsv",
+ .long_name = NULL_IF_CONFIG_SMALL("AV1 video (Intel Quick Sync Video acceleration)"),
+ .priv_data_size = sizeof(QSVOtherContext),
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_AV1,
+ .init = qsv_decode_init,
+ .decode = qsv_decode_frame,
+ .flush = qsv_decode_flush,
+ .close = qsv_decode_close,
+ .capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_DR1 | AV_CODEC_CAP_AVOID_PROBING | AV_CODEC_CAP_HYBRID,
+ .priv_class = &av1_qsv_class,
+ .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_NV12,
+ AV_PIX_FMT_P010,
+ AV_PIX_FMT_QSV,
+ AV_PIX_FMT_NONE },
+ .hw_configs = ff_qsv_hw_configs,
+ .wrapper_name = "qsv",
+};
+#endif