Re: [FFmpeg-devel] [PATCH] avfilter/vf_yaepblur: add yaepblur filter

2019-12-07 Thread Tao Zhang
Paul B Mahol  于2019年12月7日周六 下午11:21写道:
>
> On 12/7/19, Tao Zhang  wrote:
> > I'm sorry for the late reply.
> >
> > Paul B Mahol  于2019年12月7日周六 上午2:48写道:
> >>
> >> On 12/5/19, Paul B Mahol  wrote:
> >> > On 12/5/19, Tao Zhang  wrote:
> >> >> Hello everyone,
> >> >> Can I assume this patch is ok if no comments or objections?
> >> >
> >> > Yes, give some time for it to be applied.
> >> > I'm busy with other stuff right now. So this patch LGTM (Note to
> >> > committer to bump minor of libavfiter upon pushing).
> >>
> >> I do not get anywhere near output of this filter with either
> >> avgblur/gblur/boxblur?
> >>
> >> How should output of this filter look like?
> > Assume keeping planes and radius unchanged,
> > 1) the output is near avgblur/boxblur when sigma close to INT_MAX
> > 2) the output is near raw input when sigma close to one, so why not
> > zero? just keep code simple, I need to gurantee the
> > denominator larger than zero
> > 3) the output is local adaptive that means blur stronger on flat area
> > while blur weaker on edge otherwise.
>
> Is there plan to make it faster with SIMD?
Yes, I will work on this.
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] avfilter/vf_yaepblur: add yaepblur filter

2019-12-07 Thread Paul B Mahol
On 12/7/19, Tao Zhang  wrote:
> I'm sorry for the late reply.
>
> Paul B Mahol  于2019年12月7日周六 上午2:48写道:
>>
>> On 12/5/19, Paul B Mahol  wrote:
>> > On 12/5/19, Tao Zhang  wrote:
>> >> Hello everyone,
>> >> Can I assume this patch is ok if no comments or objections?
>> >
>> > Yes, give some time for it to be applied.
>> > I'm busy with other stuff right now. So this patch LGTM (Note to
>> > committer to bump minor of libavfiter upon pushing).
>>
>> I do not get anywhere near output of this filter with either
>> avgblur/gblur/boxblur?
>>
>> How should output of this filter look like?
> Assume keeping planes and radius unchanged,
> 1) the output is near avgblur/boxblur when sigma close to INT_MAX
> 2) the output is near raw input when sigma close to one, so why not
> zero? just keep code simple, I need to gurantee the
> denominator larger than zero
> 3) the output is local adaptive that means blur stronger on flat area
> while blur weaker on edge otherwise.

Is there plan to make it faster with SIMD?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] avfilter/vf_yaepblur: add yaepblur filter

2019-12-07 Thread Tao Zhang
I'm sorry for the late reply.

Paul B Mahol  于2019年12月7日周六 上午2:48写道:
>
> On 12/5/19, Paul B Mahol  wrote:
> > On 12/5/19, Tao Zhang  wrote:
> >> Hello everyone,
> >> Can I assume this patch is ok if no comments or objections?
> >
> > Yes, give some time for it to be applied.
> > I'm busy with other stuff right now. So this patch LGTM (Note to
> > committer to bump minor of libavfiter upon pushing).
>
> I do not get anywhere near output of this filter with either
> avgblur/gblur/boxblur?
>
> How should output of this filter look like?
Assume keeping planes and radius unchanged,
1) the output is near avgblur/boxblur when sigma close to INT_MAX
2) the output is near raw input when sigma close to one, so why not
zero? just keep code simple, I need to gurantee the
denominator larger than zero
3) the output is local adaptive that means blur stronger on flat area
while blur weaker on edge otherwise.
>
> >
> >>
> >> Tao Zhang  于2019年12月3日周二 下午5:26写道:
> >>>
> >>> ping:)
> >>>
> >>> leozhang  于2019年11月25日周一 下午5:53写道:
> >>> >
> >>> > Signed-off-by: leozhang 
> >>> > ---
> >>> > This filter blur the input while preserving edges, with slice threads
> >>> > speed up.
> >>> > My test speed is about 100fps on 1080p video with 16 threads, on my
> >>> > test
> >>> > machine whose cpu is E5-2660 v4 2.0GHz using 16 threads.
> >>> > I gauss that i7-9700K 3.6GHz can run faster more.
> >>> > The test command is
> >>> > ffmpeg -s 1920x1080 -r 30 -i your_test_file.yuv -filter_threads 16 -vf
> >>> > yaepblur -f null -
> >>> >
> >>> >  doc/filters.texi  |  22 +++
> >>> >  libavfilter/Makefile  |   1 +
> >>> >  libavfilter/allfilters.c  |   1 +
> >>> >  libavfilter/vf_yaepblur.c | 349
> >>> > ++
> >>> >  4 files changed, 373 insertions(+)
> >>> >  create mode 100644 libavfilter/vf_yaepblur.c
> >>> >
> >>> > diff --git a/doc/filters.texi b/doc/filters.texi
> >>> > index c04421b..61e93d5 100644
> >>> > --- a/doc/filters.texi
> >>> > +++ b/doc/filters.texi
> >>> > @@ -19775,6 +19775,28 @@ Only deinterlace frames marked as interlaced.
> >>> >  The default value is @code{all}.
> >>> >  @end table
> >>> >
> >>> > +@section yaepblur
> >>> > +
> >>> > +Apply blur filter while preserving edges ("yaepblur" means "yet
> >>> > another
> >>> > edge preserving blur filter").
> >>> > +The algorithm is described in
> >>> > +"J. S. Lee, Digital image enhancement and noise filtering by use of
> >>> > local statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2,
> >>> > 1980."
> >>> > +
> >>> > +It accepts the following parameters:
> >>> > +
> >>> > +@table @option
> >>> > +@item radius, r
> >>> > +Set the window radius. Default value is 3.
> >>> > +
> >>> > +@item planes, p
> >>> > +Set which planes to filter. Default is only the first plane.
> >>> > +
> >>> > +@item sigma, s
> >>> > +Set blur strength. Default value is 128.
> >>> > +@end table
> >>> > +
> >>> > +@subsection Commands
> >>> > +This filter supports same @ref{commands} as options.
> >>> > +
> >>> >  @section zoompan
> >>> >
> >>> >  Apply Zoom & Pan effect.
> >>> > diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> >>> > index 6838d5c..b490a44 100644
> >>> > --- a/libavfilter/Makefile
> >>> > +++ b/libavfilter/Makefile
> >>> > @@ -442,6 +442,7 @@ OBJS-$(CONFIG_XSTACK_FILTER) +=
> >>> > vf_stack.o framesync.o
> >>> >  OBJS-$(CONFIG_YADIF_FILTER)  += vf_yadif.o
> >>> > yadif_common.o
> >>> >  OBJS-$(CONFIG_YADIF_CUDA_FILTER) += vf_yadif_cuda.o
> >>> > vf_yadif_cuda.ptx.o \
> >>> >  yadif_common.o
> >>> > +OBJS-$(CONFIG_YAEPBLUR_FILTER)   += vf_yaepblur.o
> >>> >  OBJS-$(CONFIG_ZMQ_FILTER)+= f_zmq.o
> >>> >  OBJS-$(CONFIG_ZOOMPAN_FILTER)+= vf_zoompan.o
> >>> >  OBJS-$(CONFIG_ZSCALE_FILTER) += vf_zscale.o
> >>> > diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
> >>> > index 7c1e19e..8f41186 100644
> >>> > --- a/libavfilter/allfilters.c
> >>> > +++ b/libavfilter/allfilters.c
> >>> > @@ -420,6 +420,7 @@ extern AVFilter ff_vf_xmedian;
> >>> >  extern AVFilter ff_vf_xstack;
> >>> >  extern AVFilter ff_vf_yadif;
> >>> >  extern AVFilter ff_vf_yadif_cuda;
> >>> > +extern AVFilter ff_vf_yaepblur;
> >>> >  extern AVFilter ff_vf_zmq;
> >>> >  extern AVFilter ff_vf_zoompan;
> >>> >  extern AVFilter ff_vf_zscale;
> >>> > diff --git a/libavfilter/vf_yaepblur.c b/libavfilter/vf_yaepblur.c
> >>> > new file mode 100644
> >>> > index 000..ef6fbc9
> >>> > --- /dev/null
> >>> > +++ b/libavfilter/vf_yaepblur.c
> >>> > @@ -0,0 +1,349 @@
> >>> > +/*
> >>> > + * Copyright (C) 2019 Leo Zhang 
> >>> > +
> >>> > + * This file is part of FFmpeg.
> >>> > + *
> >>> > + * FFmpeg 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
> >>> > + 

Re: [FFmpeg-devel] [PATCH] avfilter/vf_yaepblur: add yaepblur filter

2019-12-06 Thread Paul B Mahol
On 12/5/19, Paul B Mahol  wrote:
> On 12/5/19, Tao Zhang  wrote:
>> Hello everyone,
>> Can I assume this patch is ok if no comments or objections?
>
> Yes, give some time for it to be applied.
> I'm busy with other stuff right now. So this patch LGTM (Note to
> committer to bump minor of libavfiter upon pushing).

I do not get anywhere near output of this filter with either
avgblur/gblur/boxblur?

How should output of this filter look like?

>
>>
>> Tao Zhang  于2019年12月3日周二 下午5:26写道:
>>>
>>> ping:)
>>>
>>> leozhang  于2019年11月25日周一 下午5:53写道:
>>> >
>>> > Signed-off-by: leozhang 
>>> > ---
>>> > This filter blur the input while preserving edges, with slice threads
>>> > speed up.
>>> > My test speed is about 100fps on 1080p video with 16 threads, on my
>>> > test
>>> > machine whose cpu is E5-2660 v4 2.0GHz using 16 threads.
>>> > I gauss that i7-9700K 3.6GHz can run faster more.
>>> > The test command is
>>> > ffmpeg -s 1920x1080 -r 30 -i your_test_file.yuv -filter_threads 16 -vf
>>> > yaepblur -f null -
>>> >
>>> >  doc/filters.texi  |  22 +++
>>> >  libavfilter/Makefile  |   1 +
>>> >  libavfilter/allfilters.c  |   1 +
>>> >  libavfilter/vf_yaepblur.c | 349
>>> > ++
>>> >  4 files changed, 373 insertions(+)
>>> >  create mode 100644 libavfilter/vf_yaepblur.c
>>> >
>>> > diff --git a/doc/filters.texi b/doc/filters.texi
>>> > index c04421b..61e93d5 100644
>>> > --- a/doc/filters.texi
>>> > +++ b/doc/filters.texi
>>> > @@ -19775,6 +19775,28 @@ Only deinterlace frames marked as interlaced.
>>> >  The default value is @code{all}.
>>> >  @end table
>>> >
>>> > +@section yaepblur
>>> > +
>>> > +Apply blur filter while preserving edges ("yaepblur" means "yet
>>> > another
>>> > edge preserving blur filter").
>>> > +The algorithm is described in
>>> > +"J. S. Lee, Digital image enhancement and noise filtering by use of
>>> > local statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2,
>>> > 1980."
>>> > +
>>> > +It accepts the following parameters:
>>> > +
>>> > +@table @option
>>> > +@item radius, r
>>> > +Set the window radius. Default value is 3.
>>> > +
>>> > +@item planes, p
>>> > +Set which planes to filter. Default is only the first plane.
>>> > +
>>> > +@item sigma, s
>>> > +Set blur strength. Default value is 128.
>>> > +@end table
>>> > +
>>> > +@subsection Commands
>>> > +This filter supports same @ref{commands} as options.
>>> > +
>>> >  @section zoompan
>>> >
>>> >  Apply Zoom & Pan effect.
>>> > diff --git a/libavfilter/Makefile b/libavfilter/Makefile
>>> > index 6838d5c..b490a44 100644
>>> > --- a/libavfilter/Makefile
>>> > +++ b/libavfilter/Makefile
>>> > @@ -442,6 +442,7 @@ OBJS-$(CONFIG_XSTACK_FILTER) +=
>>> > vf_stack.o framesync.o
>>> >  OBJS-$(CONFIG_YADIF_FILTER)  += vf_yadif.o
>>> > yadif_common.o
>>> >  OBJS-$(CONFIG_YADIF_CUDA_FILTER) += vf_yadif_cuda.o
>>> > vf_yadif_cuda.ptx.o \
>>> >  yadif_common.o
>>> > +OBJS-$(CONFIG_YAEPBLUR_FILTER)   += vf_yaepblur.o
>>> >  OBJS-$(CONFIG_ZMQ_FILTER)+= f_zmq.o
>>> >  OBJS-$(CONFIG_ZOOMPAN_FILTER)+= vf_zoompan.o
>>> >  OBJS-$(CONFIG_ZSCALE_FILTER) += vf_zscale.o
>>> > diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
>>> > index 7c1e19e..8f41186 100644
>>> > --- a/libavfilter/allfilters.c
>>> > +++ b/libavfilter/allfilters.c
>>> > @@ -420,6 +420,7 @@ extern AVFilter ff_vf_xmedian;
>>> >  extern AVFilter ff_vf_xstack;
>>> >  extern AVFilter ff_vf_yadif;
>>> >  extern AVFilter ff_vf_yadif_cuda;
>>> > +extern AVFilter ff_vf_yaepblur;
>>> >  extern AVFilter ff_vf_zmq;
>>> >  extern AVFilter ff_vf_zoompan;
>>> >  extern AVFilter ff_vf_zscale;
>>> > diff --git a/libavfilter/vf_yaepblur.c b/libavfilter/vf_yaepblur.c
>>> > new file mode 100644
>>> > index 000..ef6fbc9
>>> > --- /dev/null
>>> > +++ b/libavfilter/vf_yaepblur.c
>>> > @@ -0,0 +1,349 @@
>>> > +/*
>>> > + * Copyright (C) 2019 Leo Zhang 
>>> > +
>>> > + * This file is part of FFmpeg.
>>> > + *
>>> > + * FFmpeg 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.
>>> > + *
>>> > + * FFmpeg 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 FFmpeg; if not, write to the Free Software
>>> > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
>>> > 02110-1301 USA
>>> > + */
>>> > +
>>> > +/**
>>> > + * @file
>>> > + * yaep(yet another 

Re: [FFmpeg-devel] [PATCH] avfilter/vf_yaepblur: add yaepblur filter

2019-12-06 Thread Michael Niedermayer
On Thu, Dec 05, 2019 at 11:39:48AM +0100, Paul B Mahol wrote:
> On 12/5/19, Tao Zhang  wrote:
> > Hello everyone,
> > Can I assume this patch is ok if no comments or objections?
> 
> Yes, give some time for it to be applied.
> I'm busy with other stuff right now. So this patch LGTM (Note to
> committer to bump minor of libavfiter upon pushing).

will apply

thx

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Modern terrorism, a quick summary: Need oil, start war with country that
has oil, kill hundread thousand in war. Let country fall into chaos,
be surprised about raise of fundamantalists. Drop more bombs, kill more
people, be surprised about them taking revenge and drop even more bombs
and strip your own citizens of their rights and freedoms. to be continued


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] avfilter/vf_yaepblur: add yaepblur filter

2019-12-05 Thread Paul B Mahol
On 12/5/19, Tao Zhang  wrote:
> Hello everyone,
> Can I assume this patch is ok if no comments or objections?

Yes, give some time for it to be applied.
I'm busy with other stuff right now. So this patch LGTM (Note to
committer to bump minor of libavfiter upon pushing).

>
> Tao Zhang  于2019年12月3日周二 下午5:26写道:
>>
>> ping:)
>>
>> leozhang  于2019年11月25日周一 下午5:53写道:
>> >
>> > Signed-off-by: leozhang 
>> > ---
>> > This filter blur the input while preserving edges, with slice threads
>> > speed up.
>> > My test speed is about 100fps on 1080p video with 16 threads, on my test
>> > machine whose cpu is E5-2660 v4 2.0GHz using 16 threads.
>> > I gauss that i7-9700K 3.6GHz can run faster more.
>> > The test command is
>> > ffmpeg -s 1920x1080 -r 30 -i your_test_file.yuv -filter_threads 16 -vf
>> > yaepblur -f null -
>> >
>> >  doc/filters.texi  |  22 +++
>> >  libavfilter/Makefile  |   1 +
>> >  libavfilter/allfilters.c  |   1 +
>> >  libavfilter/vf_yaepblur.c | 349
>> > ++
>> >  4 files changed, 373 insertions(+)
>> >  create mode 100644 libavfilter/vf_yaepblur.c
>> >
>> > diff --git a/doc/filters.texi b/doc/filters.texi
>> > index c04421b..61e93d5 100644
>> > --- a/doc/filters.texi
>> > +++ b/doc/filters.texi
>> > @@ -19775,6 +19775,28 @@ Only deinterlace frames marked as interlaced.
>> >  The default value is @code{all}.
>> >  @end table
>> >
>> > +@section yaepblur
>> > +
>> > +Apply blur filter while preserving edges ("yaepblur" means "yet another
>> > edge preserving blur filter").
>> > +The algorithm is described in
>> > +"J. S. Lee, Digital image enhancement and noise filtering by use of
>> > local statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2, 1980."
>> > +
>> > +It accepts the following parameters:
>> > +
>> > +@table @option
>> > +@item radius, r
>> > +Set the window radius. Default value is 3.
>> > +
>> > +@item planes, p
>> > +Set which planes to filter. Default is only the first plane.
>> > +
>> > +@item sigma, s
>> > +Set blur strength. Default value is 128.
>> > +@end table
>> > +
>> > +@subsection Commands
>> > +This filter supports same @ref{commands} as options.
>> > +
>> >  @section zoompan
>> >
>> >  Apply Zoom & Pan effect.
>> > diff --git a/libavfilter/Makefile b/libavfilter/Makefile
>> > index 6838d5c..b490a44 100644
>> > --- a/libavfilter/Makefile
>> > +++ b/libavfilter/Makefile
>> > @@ -442,6 +442,7 @@ OBJS-$(CONFIG_XSTACK_FILTER) +=
>> > vf_stack.o framesync.o
>> >  OBJS-$(CONFIG_YADIF_FILTER)  += vf_yadif.o
>> > yadif_common.o
>> >  OBJS-$(CONFIG_YADIF_CUDA_FILTER) += vf_yadif_cuda.o
>> > vf_yadif_cuda.ptx.o \
>> >  yadif_common.o
>> > +OBJS-$(CONFIG_YAEPBLUR_FILTER)   += vf_yaepblur.o
>> >  OBJS-$(CONFIG_ZMQ_FILTER)+= f_zmq.o
>> >  OBJS-$(CONFIG_ZOOMPAN_FILTER)+= vf_zoompan.o
>> >  OBJS-$(CONFIG_ZSCALE_FILTER) += vf_zscale.o
>> > diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
>> > index 7c1e19e..8f41186 100644
>> > --- a/libavfilter/allfilters.c
>> > +++ b/libavfilter/allfilters.c
>> > @@ -420,6 +420,7 @@ extern AVFilter ff_vf_xmedian;
>> >  extern AVFilter ff_vf_xstack;
>> >  extern AVFilter ff_vf_yadif;
>> >  extern AVFilter ff_vf_yadif_cuda;
>> > +extern AVFilter ff_vf_yaepblur;
>> >  extern AVFilter ff_vf_zmq;
>> >  extern AVFilter ff_vf_zoompan;
>> >  extern AVFilter ff_vf_zscale;
>> > diff --git a/libavfilter/vf_yaepblur.c b/libavfilter/vf_yaepblur.c
>> > new file mode 100644
>> > index 000..ef6fbc9
>> > --- /dev/null
>> > +++ b/libavfilter/vf_yaepblur.c
>> > @@ -0,0 +1,349 @@
>> > +/*
>> > + * Copyright (C) 2019 Leo Zhang 
>> > +
>> > + * This file is part of FFmpeg.
>> > + *
>> > + * FFmpeg 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.
>> > + *
>> > + * FFmpeg 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 FFmpeg; if not, write to the Free Software
>> > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
>> > 02110-1301 USA
>> > + */
>> > +
>> > +/**
>> > + * @file
>> > + * yaep(yet another edge preserving) blur filter
>> > + *
>> > + * This implementation is based on an algorithm described in
>> > + * "J. S. Lee, Digital image enhancement and noise filtering by use of
>> > local statistics, IEEE Trans. Pattern
>> > + * Anal. Mach. Intell. PAMI-2, 1980."
>> > + */
>> > +
>> > +#include 

Re: [FFmpeg-devel] [PATCH] avfilter/vf_yaepblur: add yaepblur filter

2019-12-05 Thread Tao Zhang
Hello everyone,
Can I assume this patch is ok if no comments or objections?

Tao Zhang  于2019年12月3日周二 下午5:26写道:
>
> ping:)
>
> leozhang  于2019年11月25日周一 下午5:53写道:
> >
> > Signed-off-by: leozhang 
> > ---
> > This filter blur the input while preserving edges, with slice threads speed 
> > up.
> > My test speed is about 100fps on 1080p video with 16 threads, on my test 
> > machine whose cpu is E5-2660 v4 2.0GHz using 16 threads.
> > I gauss that i7-9700K 3.6GHz can run faster more.
> > The test command is
> > ffmpeg -s 1920x1080 -r 30 -i your_test_file.yuv -filter_threads 16 -vf 
> > yaepblur -f null -
> >
> >  doc/filters.texi  |  22 +++
> >  libavfilter/Makefile  |   1 +
> >  libavfilter/allfilters.c  |   1 +
> >  libavfilter/vf_yaepblur.c | 349 
> > ++
> >  4 files changed, 373 insertions(+)
> >  create mode 100644 libavfilter/vf_yaepblur.c
> >
> > diff --git a/doc/filters.texi b/doc/filters.texi
> > index c04421b..61e93d5 100644
> > --- a/doc/filters.texi
> > +++ b/doc/filters.texi
> > @@ -19775,6 +19775,28 @@ Only deinterlace frames marked as interlaced.
> >  The default value is @code{all}.
> >  @end table
> >
> > +@section yaepblur
> > +
> > +Apply blur filter while preserving edges ("yaepblur" means "yet another 
> > edge preserving blur filter").
> > +The algorithm is described in
> > +"J. S. Lee, Digital image enhancement and noise filtering by use of local 
> > statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2, 1980."
> > +
> > +It accepts the following parameters:
> > +
> > +@table @option
> > +@item radius, r
> > +Set the window radius. Default value is 3.
> > +
> > +@item planes, p
> > +Set which planes to filter. Default is only the first plane.
> > +
> > +@item sigma, s
> > +Set blur strength. Default value is 128.
> > +@end table
> > +
> > +@subsection Commands
> > +This filter supports same @ref{commands} as options.
> > +
> >  @section zoompan
> >
> >  Apply Zoom & Pan effect.
> > diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> > index 6838d5c..b490a44 100644
> > --- a/libavfilter/Makefile
> > +++ b/libavfilter/Makefile
> > @@ -442,6 +442,7 @@ OBJS-$(CONFIG_XSTACK_FILTER) += 
> > vf_stack.o framesync.o
> >  OBJS-$(CONFIG_YADIF_FILTER)  += vf_yadif.o yadif_common.o
> >  OBJS-$(CONFIG_YADIF_CUDA_FILTER) += vf_yadif_cuda.o 
> > vf_yadif_cuda.ptx.o \
> >  yadif_common.o
> > +OBJS-$(CONFIG_YAEPBLUR_FILTER)   += vf_yaepblur.o
> >  OBJS-$(CONFIG_ZMQ_FILTER)+= f_zmq.o
> >  OBJS-$(CONFIG_ZOOMPAN_FILTER)+= vf_zoompan.o
> >  OBJS-$(CONFIG_ZSCALE_FILTER) += vf_zscale.o
> > diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
> > index 7c1e19e..8f41186 100644
> > --- a/libavfilter/allfilters.c
> > +++ b/libavfilter/allfilters.c
> > @@ -420,6 +420,7 @@ extern AVFilter ff_vf_xmedian;
> >  extern AVFilter ff_vf_xstack;
> >  extern AVFilter ff_vf_yadif;
> >  extern AVFilter ff_vf_yadif_cuda;
> > +extern AVFilter ff_vf_yaepblur;
> >  extern AVFilter ff_vf_zmq;
> >  extern AVFilter ff_vf_zoompan;
> >  extern AVFilter ff_vf_zscale;
> > diff --git a/libavfilter/vf_yaepblur.c b/libavfilter/vf_yaepblur.c
> > new file mode 100644
> > index 000..ef6fbc9
> > --- /dev/null
> > +++ b/libavfilter/vf_yaepblur.c
> > @@ -0,0 +1,349 @@
> > +/*
> > + * Copyright (C) 2019 Leo Zhang 
> > +
> > + * This file is part of FFmpeg.
> > + *
> > + * FFmpeg 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.
> > + *
> > + * FFmpeg 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 FFmpeg; if not, write to the Free Software
> > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
> > 02110-1301 USA
> > + */
> > +
> > +/**
> > + * @file
> > + * yaep(yet another edge preserving) blur filter
> > + *
> > + * This implementation is based on an algorithm described in
> > + * "J. S. Lee, Digital image enhancement and noise filtering by use of 
> > local statistics, IEEE Trans. Pattern
> > + * Anal. Mach. Intell. PAMI-2, 1980."
> > + */
> > +
> > +#include "libavutil/opt.h"
> > +#include "libavutil/imgutils.h"
> > +#include "avfilter.h"
> > +#include "internal.h"
> > +
> > +typedef struct YAEPContext {
> > +const AVClass *class;
> > +
> > +int planes;
> > +int radius;
> > +int sigma;
> > +
> > +int nb_planes;
> > +int planewidth[4];
> > +int 

Re: [FFmpeg-devel] [PATCH] avfilter/vf_yaepblur: add yaepblur filter

2019-12-03 Thread Tao Zhang
ping:)

leozhang  于2019年11月25日周一 下午5:53写道:
>
> Signed-off-by: leozhang 
> ---
> This filter blur the input while preserving edges, with slice threads speed 
> up.
> My test speed is about 100fps on 1080p video with 16 threads, on my test 
> machine whose cpu is E5-2660 v4 2.0GHz using 16 threads.
> I gauss that i7-9700K 3.6GHz can run faster more.
> The test command is
> ffmpeg -s 1920x1080 -r 30 -i your_test_file.yuv -filter_threads 16 -vf 
> yaepblur -f null -
>
>  doc/filters.texi  |  22 +++
>  libavfilter/Makefile  |   1 +
>  libavfilter/allfilters.c  |   1 +
>  libavfilter/vf_yaepblur.c | 349 
> ++
>  4 files changed, 373 insertions(+)
>  create mode 100644 libavfilter/vf_yaepblur.c
>
> diff --git a/doc/filters.texi b/doc/filters.texi
> index c04421b..61e93d5 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -19775,6 +19775,28 @@ Only deinterlace frames marked as interlaced.
>  The default value is @code{all}.
>  @end table
>
> +@section yaepblur
> +
> +Apply blur filter while preserving edges ("yaepblur" means "yet another edge 
> preserving blur filter").
> +The algorithm is described in
> +"J. S. Lee, Digital image enhancement and noise filtering by use of local 
> statistics, IEEE Trans. Pattern Anal. Mach. Intell. PAMI-2, 1980."
> +
> +It accepts the following parameters:
> +
> +@table @option
> +@item radius, r
> +Set the window radius. Default value is 3.
> +
> +@item planes, p
> +Set which planes to filter. Default is only the first plane.
> +
> +@item sigma, s
> +Set blur strength. Default value is 128.
> +@end table
> +
> +@subsection Commands
> +This filter supports same @ref{commands} as options.
> +
>  @section zoompan
>
>  Apply Zoom & Pan effect.
> diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> index 6838d5c..b490a44 100644
> --- a/libavfilter/Makefile
> +++ b/libavfilter/Makefile
> @@ -442,6 +442,7 @@ OBJS-$(CONFIG_XSTACK_FILTER) += 
> vf_stack.o framesync.o
>  OBJS-$(CONFIG_YADIF_FILTER)  += vf_yadif.o yadif_common.o
>  OBJS-$(CONFIG_YADIF_CUDA_FILTER) += vf_yadif_cuda.o 
> vf_yadif_cuda.ptx.o \
>  yadif_common.o
> +OBJS-$(CONFIG_YAEPBLUR_FILTER)   += vf_yaepblur.o
>  OBJS-$(CONFIG_ZMQ_FILTER)+= f_zmq.o
>  OBJS-$(CONFIG_ZOOMPAN_FILTER)+= vf_zoompan.o
>  OBJS-$(CONFIG_ZSCALE_FILTER) += vf_zscale.o
> diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
> index 7c1e19e..8f41186 100644
> --- a/libavfilter/allfilters.c
> +++ b/libavfilter/allfilters.c
> @@ -420,6 +420,7 @@ extern AVFilter ff_vf_xmedian;
>  extern AVFilter ff_vf_xstack;
>  extern AVFilter ff_vf_yadif;
>  extern AVFilter ff_vf_yadif_cuda;
> +extern AVFilter ff_vf_yaepblur;
>  extern AVFilter ff_vf_zmq;
>  extern AVFilter ff_vf_zoompan;
>  extern AVFilter ff_vf_zscale;
> diff --git a/libavfilter/vf_yaepblur.c b/libavfilter/vf_yaepblur.c
> new file mode 100644
> index 000..ef6fbc9
> --- /dev/null
> +++ b/libavfilter/vf_yaepblur.c
> @@ -0,0 +1,349 @@
> +/*
> + * Copyright (C) 2019 Leo Zhang 
> +
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg 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.
> + *
> + * FFmpeg 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 FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
> USA
> + */
> +
> +/**
> + * @file
> + * yaep(yet another edge preserving) blur filter
> + *
> + * This implementation is based on an algorithm described in
> + * "J. S. Lee, Digital image enhancement and noise filtering by use of local 
> statistics, IEEE Trans. Pattern
> + * Anal. Mach. Intell. PAMI-2, 1980."
> + */
> +
> +#include "libavutil/opt.h"
> +#include "libavutil/imgutils.h"
> +#include "avfilter.h"
> +#include "internal.h"
> +
> +typedef struct YAEPContext {
> +const AVClass *class;
> +
> +int planes;
> +int radius;
> +int sigma;
> +
> +int nb_planes;
> +int planewidth[4];
> +int planeheight[4];
> +int depth;
> +
> +uint64_t *sat;///< summed area table
> +uint64_t *square_sat; ///< square summed area table
> +int sat_linesize;
> +
> +int (*pre_calculate_row)(AVFilterContext *ctx, void *arg, int jobnr, int 
> nb_jobs);
> +int (*filter_slice )(AVFilterContext *ctx, void *arg, int jobnr, int 
> nb_jobs);
> +} YAEPContext;
> +
>