Re: [libav-devel] [PATCH 2/2] libavfilter/vf_vpp: Add common filters of the qsv vpp

2017-08-03 Thread Huang, Zhengxu

On 2017/8/4 5:32, Maxym Dmytrychenko wrote:


ok, it seems that ./configure related deps change are missing.

as you did for overlay:

_filter_deps=

_filter_select=


yes, this is a very serious bug. Thank you. I will fix this and send out 
the V2.




On Tue, Aug 1, 2017 at 7:58 AM, Huang, Zhengxu 
> wrote:




On 2017/8/1 3:22, Maxym Dmytrychenko wrote:

LGTM, seems to be working just fine


Performance will be significantly reduced

if there are performance numbers showing this statement - would be good to
share it.

The performance comparison between the cascade mode and union mode
is blew:


As the Libav now only has scale_qsv /interlace_qsv two qsv filters
and the deinterlace module still has some bug.
So we use our common filter module to simulate. Though the code is
different but the result is nearly the same(once we
make the validation on our patches that
framerate/denoise/deinterlace/detail/scale filter module are
independent).

There are only three filters in the test case but the performance
has significantly reduced. The more filters in the cascade system
the more drop on the performance compared with the union mode.

On Mon, Jul 31, 2017 at 1:43 PM, Luca Barbato 
  wrote:


On 31/07/2017 03:27, Huang, Zhengxu wrote:
Looks good after a first read, I still need to try it.

Thank you a lot :)

lu

___
libav-devel mailing list
libav-devel@libav.org 
https://lists.libav.org/mailman/listinfo/libav-devel


___
libav-devel mailing list
libav-devel@libav.org 
https://lists.libav.org/mailman/listinfo/libav-devel






___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH 2/2] libavfilter/vf_vpp: Add common filters of the qsv vpp

2017-08-03 Thread Maxym Dmytrychenko
ok, it seems that ./configure related deps change are missing.

as you did for overlay:

_filter_deps=

_filter_select=



On Tue, Aug 1, 2017 at 7:58 AM, Huang, Zhengxu 
wrote:

>
>
> On 2017/8/1 3:22, Maxym Dmytrychenko wrote:
>
> LGTM, seems to be working just fine
>
>
> Performance will be significantly reduced
>
> if there are performance numbers showing this statement - would be good to
> share it.
>
> The performance comparison between the cascade mode and union mode is blew:
>
>
> As the Libav now only has scale_qsv /interlace_qsv two qsv filters and the
> deinterlace module still has some bug.
> So we use our common filter module to simulate. Though the code is
> different but the result is nearly the same(once we
> make the validation on our patches that 
> framerate/denoise/deinterlace/detail/scale
> filter module are independent).
>
> There are only three filters in the test case but the performance has
> significantly reduced. The more filters in the cascade system
> the more drop on the performance compared with the union mode.
>
>
> On Mon, Jul 31, 2017 at 1:43 PM, Luca Barbato  
>  wrote:
>
>
> On 31/07/2017 03:27, Huang, Zhengxu wrote:
>
>
>  Looks good after a first read, I still need to try it.
>
> Thank you a lot :)
>
> lu
>
> ___
> libav-devel mailing 
> listlibav-devel@libav.orghttps://lists.libav.org/mailman/listinfo/libav-devel
>
> ___
> libav-devel mailing 
> listlibav-devel@libav.orghttps://lists.libav.org/mailman/listinfo/libav-devel
>
>
>
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH 2/2] libavfilter/vf_vpp: Add common filters of the qsv vpp

2017-07-31 Thread Huang, Zhengxu



On 2017/8/1 3:22, Maxym Dmytrychenko wrote:

LGTM, seems to be working just fine


Performance will be significantly reduced

if there are performance numbers showing this statement - would be good to
share it.

The performance comparison between the cascade mode and union mode is blew:


As the Libav now only has scale_qsv /interlace_qsv two qsv filters and 
the deinterlace module still has some bug.
So we use our common filter module to simulate. Though the code is 
different but the result is nearly the same(once we
make the validation on our patches that 
framerate/denoise/deinterlace/detail/scale filter module are independent).


There are only three filters in the test case but the performance has 
significantly reduced. The more filters in the cascade system

the more drop on the performance compared with the union mode.


On Mon, Jul 31, 2017 at 1:43 PM, Luca Barbato  wrote:


On 31/07/2017 03:27, Huang, Zhengxu wrote:




Looks good after a first read, I still need to try it.

Thank you a lot :)

lu

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel


___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH 2/2] libavfilter/vf_vpp: Add common filters of the qsv vpp

2017-07-31 Thread Luca Barbato
On 31/07/2017 03:27, Huang, Zhengxu wrote:
> 
> 
> 

Looks good after a first read, I still need to try it.

Thank you a lot :)

lu

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [PATCH 2/2] libavfilter/vf_vpp: Add common filters of the qsv vpp

2017-07-30 Thread Huang, Zhengxu


From 0530b935473b1ea32a7d889e9579adab2c3f049e Mon Sep 17 00:00:00 2001
From: "Huang, Zhengxu" 
Date: Wed, 26 Jul 2017 04:50:06 +0800
Subject: [PATCH 2/2] libavfilter/vf_vpp: Add common filters of the qsv vpp

Add common filters of the qsv vpp features including scale denosie deinterlace
frc crop and procAmp.

Performance will be significantly reduced in the test if using cascade mode just
like qsv framerate + qsv scale + qsv deinterlace + qsv denoise in separated way
no matter in system or video memmory cases. And the code is so redundant because
so much the same just as session and surface's creation and management. So we 
add
a common qsv filter.

Usage:
-hwaccel qsv -c:v h264_qsv -r 25 -i in -vf 
vpp_qsv=w=iw/2:h=400:deinterlace=1:framerate=60:detail=50:denoise=50
-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: I130392ce722138c209ab658c5f03f0009b6e8024
---
 libavfilter/Makefile |   1 +
 libavfilter/allfilters.c |   1 +
 libavfilter/vf_vpp_qsv.c | 405 +++
 3 files changed, 407 insertions(+)
 create mode 100644 libavfilter/vf_vpp_qsv.c

diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index 2edb6c7..30badc0 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -94,6 +94,7 @@ OBJS-$(CONFIG_TRANSPOSE_FILTER)  += vf_transpose.o
 OBJS-$(CONFIG_TRIM_FILTER)   += trim.o
 OBJS-$(CONFIG_UNSHARP_FILTER)+= vf_unsharp.o
 OBJS-$(CONFIG_VFLIP_FILTER)  += vf_vflip.o
+OBJS-$(CONFIG_VPP_QSV_FILTER)+= qsvvpp.o vf_vpp_qsv.o
 OBJS-$(CONFIG_YADIF_FILTER)  += vf_yadif.o
 
 OBJS-$(CONFIG_NULLSINK_FILTER)   += vsink_nullsink.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index dc59ccd..2b3a672 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -117,6 +117,7 @@ void avfilter_register_all(void)
 REGISTER_FILTER(TRIM,   trim,   vf);
 REGISTER_FILTER(UNSHARP,unsharp,vf);
 REGISTER_FILTER(VFLIP,  vflip,  vf);
+REGISTER_FILTER(VPP_QSV,vpp_qsv,vf);
 REGISTER_FILTER(YADIF,  yadif,  vf);
 
 REGISTER_FILTER(COLOR,  color,  vsrc);
diff --git a/libavfilter/vf_vpp_qsv.c b/libavfilter/vf_vpp_qsv.c
new file mode 100644
index 000..4e14245
--- /dev/null
+++ b/libavfilter/vf_vpp_qsv.c
@@ -0,0 +1,405 @@
+/*
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include 
+#include "internal.h"
+#include "formats.h"
+#include "libavutil/eval.h"
+#include "avfilter.h"
+#include "libavutil/avassert.h"
+#include "libavutil/opt.h"
+#include "libavcodec/avcodec.h"
+#include "libavformat/avformat.h"
+#include "libavutil/pixdesc.h"
+#include "qsvvpp.h"
+
+#define OFFSET(x) offsetof(VPPContext, x)
+#define FLAGS AV_OPT_FLAG_VIDEO_PARAM
+
+/* number of video enhancement filters */
+#define ENH_FILTERS_COUNT (5)
+
+typedef struct VPPContext{
+const AVClass *class;
+
+FFQSVVPPContext *qsv;
+
+/* Video Enhancement Algorithms */
+mfxExtVPPDeinterlacing  deinterlace_conf;
+mfxExtVPPFrameRateConversion frc_conf;
+mfxExtVPPDenoise denoise_conf;
+mfxExtVPPDetail detail_conf;
+mfxExtVPPProcAmp procamp_conf;
+
+int out_width;
+int out_height;
+
+AVRational framerate;   ///< target framerate
+/**
+ * destination picture structure
+ * -1 = unkown
+ * 0 = interlaced top field first
+ * 1 = progressive
+ * 2 = interlaced bottom field first
+ */
+int dpic;
+int use_frc;///< use framerate conversion
+int deinterlace;///< deinterlace mode : 0=off, 1=bob, 
2=advanced
+int denoise;///< Enable Denoise algorithm. Level is the 
optional value from the interval [0; 100]
+int detail; ///< Enable Detail Enhancement algorithm.
+///< Level is the optional value from the 
interval [0; 100]
+int use_crop;   ///< 1 = use crop; 0=none
+int crop_w;
+int