---
Changes from v4:
* Modify the configure file/coding style/system memory input surface
align issue/resource release issue when exception happens/memory mode
logic and
some potential problem in the code as Anton's review.
---
---
Changes from v3:
* Modify the configure file as Maxym's review.
---
---
Changes from v2:
* Add "SKIPHEADERS" and modify some comments/typo/coding style as Luca's
review .
---
---
Changes from v1:
* Replace "enum QSVMemMode" with MFX_MEMTYPE_* type which already have
been defined in MSDK header file as per Maxym's review .
* Add some comments about the overlay usage.
---
From 873222a2fa0c0686e0611bc769707947fe243d27 Mon Sep 17 00:00:00 2001
From: "Huang, Zhengxu"
Date: Tue, 25 Jul 2017 21:55:50 +0800
Subject: [PATCH] libavfilter/overlay_qsv: Add QSV overlay vpp filter
Add intel QSV overlay filter. Now it supports two input. And it also supports
the second input scale(implicit) during composition compared to the sw overlay.
Code has been separated into common interface part and qsv overlay implement
part.
The common part mainly creates the qsv session and manages the surface which are
nearly the same for all qsv filters. So the qsvvpp.c/qsvvpp.h API can be used by
other QSV vpp filters to reduce code redundancy.
Usage:
-hwaccel qsv -c:v mpeg2_qsv -r 25 -i in.m2v -hwaccel qsv -c:v h264_qsv -i
in.h264 -filter_complex
"overlay_qsv=eof_action=repeat:x=(W-w)/2:y=(H-h)/2" -b 2M -maxrate 3M -c:v
h264_qsv -y out.h264
two input should have different size otherwise one will be completely covered
or you need scale the
second input as follow:
-hwaccel qsv -c:v mpeg2_qsv -r 25 -i in.m2v -hwaccel qsv -c:v h264_qsv -i
in.h264 -filter_complex
"overlay_qsv=w=720:h=576:x=(W-w)/2:y=(H-h)/2" -b 2M -maxrate 3M -c:v h264_qsv
-y out.h264
Signed-off-by: ChaoX A Liu
Signed-off-by: Zhengxu Huang
Signed-off-by: Andrew Zhang
Change-Id: I5c381febb0af6e2f9622c54ba00490ab99d48297
---
Changelog| 1 +
configure| 4 +
libavfilter/Makefile | 6 +
libavfilter/allfilters.c | 1 +
libavfilter/qsvvpp.c | 737 +++
libavfilter/qsvvpp.h | 64
libavfilter/vf_overlay_qsv.c | 492 +
7 files changed, 1305 insertions(+)
create mode 100644 libavfilter/qsvvpp.c
create mode 100644 libavfilter/qsvvpp.h
create mode 100644 libavfilter/vf_overlay_qsv.c
diff --git a/Changelog b/Changelog
index 92a7249..51c3f85 100644
--- a/Changelog
+++ b/Changelog
@@ -19,6 +19,7 @@ version :
- Cinepak encoder
- Intel QSV-accelerated MJPEG encoding
- NVIDIA CUVID-accelerated H.264 and HEVC decoding
+- Intel QSV-accelerated overlay filter
version 12:
diff --git a/configure b/configure
index 4510100..e550833 100755
--- a/configure
+++ b/configure
@@ -1786,6 +1786,7 @@ CONFIG_EXTRA="
qsv
qsvdec
qsvenc
+qsvvpp
rangecoder
riffdec
riffenc
@@ -2269,6 +2270,7 @@ omx_rpi_select="omx"
qsv_deps="libmfx"
qsvdec_select="qsv"
qsvenc_select="qsv"
+qsvvpp_select="qsv"
vaapi_encode_deps="vaapi"
hwupload_cuda_filter_deps="cuda"
@@ -2528,6 +2530,8 @@ hqdn3d_filter_deps="gpl"
interlace_filter_deps="gpl"
movie_filter_deps="avcodec avformat"
ocv_filter_deps="libopencv"
+overlay_qsv_filter_deps="libmfx"
+overlay_qsv_filter_select="qsvvpp"
resample_filter_deps="avresample"
scale_filter_deps="swscale"
scale_qsv_filter_deps="libmfx"
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 348ad92..1f25180 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -20,6 +20,9 @@ OBJS = allfilters.o
\
OBJS-$(HAVE_THREADS) += pthread.o
+# subsystems
+OBJS-$(CONFIG_QSVVPP)+= qsvvpp.o
+
# audio filters
OBJS-$(CONFIG_AFORMAT_FILTER)+= af_aformat.o
OBJS-$(CONFIG_AMIX_FILTER) += af_amix.o
@@ -75,6 +78,7 @@ OBJS-$(CONFIG_NOFORMAT_FILTER) += vf_format.o
OBJS-$(CONFIG_NULL_FILTER) += vf_null.o
OBJS-$(CONFIG_OCV_FILTER)+= vf_libopencv.o
OBJS-$(CONFIG_OVERLAY_FILTER)+= vf_overlay.o
+OBJS-$(CONFIG_OVERLAY_QSV_FILTER)+= vf_overlay_qsv.o
OBJS-$(CONFIG_PAD_FILTER)+= vf_pad.o
OBJS-$(CONFIG_PIXDESCTEST_FILTER)+= vf_pixdesctest.o
OBJS-$(CONFIG_SCALE_FILTER) += vf_scale.o
@@ -104,5 +108,7 @@ OBJS-$(CONFIG_NULLSRC_FILTER)+=
vsrc_nullsrc.o
OBJS-$(CONFIG_RGBTESTSRC_FILTER) += vsrc_testsrc.o
OBJS-$(CONFIG_TESTSRC_FILTER)+= vsrc_testsrc.o
+SKIPHEADERS-$(CONFIG_QSVVPP) += qsvvpp.h
+
TOOLS = graph2dot
TESTPROGS = filtfmts
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index 3f09f46..dc59ccd