[FFmpeg-cvslog] qsv: Add VP8 decoder
Mark Thompson
git at videolan.org
Sat Apr 1 12:23:03 EEST 2017
ffmpeg | branch: master | Mark Thompson <sw at jkqxz.net> | Thu Oct 27 20:33:56 2016 +0100| [e0b164576f7467b7b1127c18175e215dc1df011f] | committer: Mark Thompson
qsv: Add VP8 decoder
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e0b164576f7467b7b1127c18175e215dc1df011f
---
configure | 3 +++
libavcodec/Makefile | 1 +
libavcodec/allcodecs.c | 2 ++
libavcodec/qsv.c | 8 ++++++++
libavcodec/qsvdec_other.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++-
5 files changed, 61 insertions(+), 1 deletion(-)
diff --git a/configure b/configure
index e9615fc..b4e2792 100755
--- a/configure
+++ b/configure
@@ -2189,6 +2189,7 @@ vc1_vaapi_hwaccel_deps="vaapi"
vc1_vaapi_hwaccel_select="vc1_decoder"
vc1_vdpau_hwaccel_deps="vdpau"
vc1_vdpau_hwaccel_select="vc1_decoder"
+vp8_qsv_hwaccel_deps="libmfx"
vp8_vaapi_hwaccel_deps="vaapi VAPictureParameterBufferVP8"
vp8_vaapi_hwaccel_select="vp8_decoder"
wmv3_d3d11va_hwaccel_select="vc1_d3d11va_hwaccel"
@@ -2229,6 +2230,8 @@ mpeg2_qsv_encoder_deps="libmfx"
mpeg2_qsv_encoder_select="qsvenc"
vc1_qsv_decoder_deps="libmfx"
vc1_qsv_decoder_select="qsvdec vc1_qsv_hwaccel vc1_parser"
+vp8_qsv_decoder_deps="libmfx"
+vp8_qsv_decoder_select="qsvdec vp8_qsv_hwaccel vp8_parser"
nvenc_h264_encoder_deps="nvenc"
nvenc_hevc_encoder_deps="nvenc"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 08b510a..f0752a2 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -476,6 +476,7 @@ OBJS-$(CONFIG_VP6_DECODER) += vp6.o vp56.o vp56data.o \
vp6dsp.o vp56rac.o
OBJS-$(CONFIG_VP7_DECODER) += vp8.o vp56rac.o
OBJS-$(CONFIG_VP8_DECODER) += vp8.o vp56rac.o
+OBJS-$(CONFIG_VP8_QSV_DECODER) += qsvdec_other.o
OBJS-$(CONFIG_VP9_DECODER) += vp9.o vp9data.o vp9dsp.o \
vp9block.o vp9prob.o vp9mvs.o vp56rac.o
OBJS-$(CONFIG_VQA_DECODER) += vqavideo.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index a66403a..591fd87 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -95,6 +95,7 @@ void avcodec_register_all(void)
REGISTER_HWACCEL(VC1_VAAPI, vc1_vaapi);
REGISTER_HWACCEL(VC1_VDPAU, vc1_vdpau);
REGISTER_HWACCEL(VC1_MMAL, vc1_mmal);
+ REGISTER_HWACCEL(VP8_QSV, vp8_qsv);
REGISTER_HWACCEL(VP8_VAAPI, vp8_vaapi);
REGISTER_HWACCEL(WMV3_D3D11VA, wmv3_d3d11va);
REGISTER_HWACCEL(WMV3_DXVA2, wmv3_dxva2);
@@ -292,6 +293,7 @@ void avcodec_register_all(void)
REGISTER_DECODER(VP6F, vp6f);
REGISTER_DECODER(VP7, vp7);
REGISTER_DECODER(VP8, vp8);
+ REGISTER_DECODER(VP8_QSV, vp8_qsv);
REGISTER_DECODER(VP9, vp9);
REGISTER_DECODER(VQA, vqa);
REGISTER_DECODER(WEBP, webp);
diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
index f292082..45e9b7a 100644
--- a/libavcodec/qsv.c
+++ b/libavcodec/qsv.c
@@ -34,6 +34,10 @@
#include "avcodec.h"
#include "qsv_internal.h"
+#if QSV_VERSION_ATLEAST(1, 12)
+#include "mfx/mfxvp8.h"
+#endif
+
int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id)
{
switch (codec_id) {
@@ -48,6 +52,10 @@ int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id)
return MFX_CODEC_MPEG2;
case AV_CODEC_ID_VC1:
return MFX_CODEC_VC1;
+#if QSV_VERSION_ATLEAST(1, 12)
+ case AV_CODEC_ID_VP8:
+ return MFX_CODEC_VP8;
+#endif
default:
break;
}
diff --git a/libavcodec/qsvdec_other.c b/libavcodec/qsvdec_other.c
index 53a1bc8..3ea1859 100644
--- a/libavcodec/qsvdec_other.c
+++ b/libavcodec/qsvdec_other.c
@@ -1,5 +1,5 @@
/*
- * Intel MediaSDK QSV based MPEG-2 and VC-1 decoders
+ * Intel MediaSDK QSV based MPEG-2, VC-1 and VP8 decoders
*
* copyright (c) 2015 Anton Khirnov
*
@@ -74,6 +74,17 @@ static av_cold int qsv_decode_init(AVCodecContext *avctx)
QSVOtherContext *s = avctx->priv_data;
int ret;
+#if CONFIG_VP8_QSV_DECODER
+ if (avctx->codec_id == AV_CODEC_ID_VP8) {
+ static const char *uid_vp8dec_hw = "f622394d8d87452f878c51f2fc9b4131";
+
+ av_freep(&s->qsv.load_plugins);
+ s->qsv.load_plugins = av_strdup(uid_vp8dec_hw);
+ if (!s->qsv.load_plugins)
+ return AVERROR(ENOMEM);
+ }
+#endif
+
s->packet_fifo = av_fifo_alloc(sizeof(AVPacket));
if (!s->packet_fifo) {
ret = AVERROR(ENOMEM);
@@ -216,3 +227,38 @@ AVCodec ff_vc1_qsv_decoder = {
AV_PIX_FMT_NONE },
};
#endif
+
+#if CONFIG_VP8_QSV_HWACCEL
+AVHWAccel ff_vp8_qsv_hwaccel = {
+ .name = "vp8_qsv",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_VP8,
+ .pix_fmt = AV_PIX_FMT_QSV,
+};
+#endif
+
+#if CONFIG_VP8_QSV_DECODER
+static const AVClass vp8_qsv_class = {
+ .class_name = "vp8_qsv",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
+AVCodec ff_vp8_qsv_decoder = {
+ .name = "vp8_qsv",
+ .long_name = NULL_IF_CONFIG_SMALL("VP8 video (Intel Quick Sync Video acceleration)"),
+ .priv_data_size = sizeof(QSVOtherContext),
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = AV_CODEC_ID_VP8,
+ .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,
+ .priv_class = &vp8_qsv_class,
+ .pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_NV12,
+ AV_PIX_FMT_QSV,
+ AV_PIX_FMT_NONE },
+};
+#endif
More information about the ffmpeg-cvslog
mailing list