Re: [FFmpeg-devel] [PATCH] lavfi: add gblur_opencl filter

2019-05-02 Thread Dylan Fernando
On Thu, May 2, 2019 at 11:27 PM Paul B Mahol  wrote:

> On 5/2/19, Dylan Fernando  wrote:
> > On Tue, 30 Apr 2019 at 11:45 pm, Paul B Mahol  wrote:
> >
> >> On 4/30/19, Dylan Fernando  wrote:
> >> >
> >> > Anyone have any feedback?
> >>
> >> If I'm not mistaken there is already one available.
> >> ___
> >> 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".
> >
> >
> > How do I run the available filter?
>
> Do you ask how to use gblur video filter?
> ___
> 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".

 Sorry, I mean how do I run the opencl gblur filter, if there is one
available
___
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] lavfi: add gblur_opencl filter

2019-05-02 Thread Paul B Mahol
On 5/2/19, Dylan Fernando  wrote:
> On Tue, 30 Apr 2019 at 11:45 pm, Paul B Mahol  wrote:
>
>> On 4/30/19, Dylan Fernando  wrote:
>> >
>> > Anyone have any feedback?
>>
>> If I'm not mistaken there is already one available.
>> ___
>> 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".
>
>
> How do I run the available filter?

Do you ask how to use gblur video filter?
___
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] lavfi: add gblur_opencl filter

2019-05-02 Thread Dylan Fernando
On Tue, 30 Apr 2019 at 11:45 pm, Paul B Mahol  wrote:

> On 4/30/19, Dylan Fernando  wrote:
> >
> > Anyone have any feedback?
>
> If I'm not mistaken there is already one available.
> ___
> 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".


How do I run the available filter?

>
___
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] lavfi: add gblur_opencl filter

2019-05-01 Thread Moritz Barsnick
On Tue, Apr 30, 2019 at 15:45:23 +0200, Paul B Mahol wrote:
> On 4/30/19, Dylan Fernando  wrote:
> >
> > Anyone have any feedback?
>
> If I'm not mistaken there is already one available.

Dylan did post a v2 of this patch (with changes made to those things I
commented on), but unfortunately posted this question in reply to v1.

Moritz
___
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] lavfi: add gblur_opencl filter

2019-04-30 Thread Paul B Mahol
On 4/30/19, Dylan Fernando  wrote:
>
> Anyone have any feedback?

If I'm not mistaken there is already one available.
___
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] lavfi: add gblur_opencl filter

2019-04-30 Thread Dylan Fernando
On Thu, 25 Apr 2019 at 10:42 pm, Dylan Fernando  wrote:

> ---
>  configure |   1 +
>  libavfilter/Makefile  |   2 +
>  libavfilter/allfilters.c  |   1 +
>  libavfilter/opencl/gblur.cl   |  62 +++
>  libavfilter/opencl_source.h   |   1 +
>  libavfilter/vf_gblur_opencl.c | 370
> ++
>  6 files changed, 437 insertions(+)
>  create mode 100644 libavfilter/opencl/gblur.cl
>  create mode 100644 libavfilter/vf_gblur_opencl.c
>
> diff --git a/configure b/configure
> index bbeaf2fadc..8c1d3cdf92 100755
> --- a/configure
> +++ b/configure
> @@ -3451,6 +3451,7 @@ freezedetect_filter_select="scene_sad"
>  frei0r_filter_deps="frei0r libdl"
>  frei0r_src_filter_deps="frei0r libdl"
>  fspp_filter_deps="gpl"
> +gblur_opencl_filter_deps="opencl"
>  geq_filter_deps="gpl"
>  histeq_filter_deps="gpl"
>  hqdn3d_filter_deps="gpl"
> diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> index fef6ec5c55..230315ef39 100644
> --- a/libavfilter/Makefile
> +++ b/libavfilter/Makefile
> @@ -243,6 +243,8 @@ OBJS-$(CONFIG_FREEZEDETECT_FILTER)   +=
> vf_freezedetect.o
>  OBJS-$(CONFIG_FREI0R_FILTER) += vf_frei0r.o
>  OBJS-$(CONFIG_FSPP_FILTER)   += vf_fspp.o
>  OBJS-$(CONFIG_GBLUR_FILTER)  += vf_gblur.o
> +OBJS-$(CONFIG_GBLUR_OPENCL_FILTER)   += vf_gblur_opencl.o
> opencl.o \
> +opencl/gblur.o
>  OBJS-$(CONFIG_GEQ_FILTER)+= vf_geq.o
>  OBJS-$(CONFIG_GRADFUN_FILTER)+= vf_gradfun.o
>  OBJS-$(CONFIG_GRAPHMONITOR_FILTER)   += f_graphmonitor.o
> diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
> index c51ae0f3c7..cb0fc051cc 100644
> --- a/libavfilter/allfilters.c
> +++ b/libavfilter/allfilters.c
> @@ -229,6 +229,7 @@ extern AVFilter ff_vf_freezedetect;
>  extern AVFilter ff_vf_frei0r;
>  extern AVFilter ff_vf_fspp;
>  extern AVFilter ff_vf_gblur;
> +extern AVFilter ff_vf_gblur_opencl;
>  extern AVFilter ff_vf_geq;
>  extern AVFilter ff_vf_gradfun;
>  extern AVFilter ff_vf_graphmonitor;
> diff --git a/libavfilter/opencl/gblur.cl b/libavfilter/opencl/gblur.cl
> new file mode 100644
> index 00..4fece30d4a
> --- /dev/null
> +++ b/libavfilter/opencl/gblur.cl
> @@ -0,0 +1,62 @@
> +/*
> + * Copyright (c) 2018 Dylan Fernando
> + *
> + * 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
> + */
> +
> +
> +__kernel void gblur_conv_horz(__write_only image2d_t dst,
> +  __read_only  image2d_t src,
> +  int coef_matrix_dim,
> +  __constant float *coef_matrix)
> +{
> +const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
> +   CLK_ADDRESS_CLAMP_TO_EDGE   |
> +   CLK_FILTER_NEAREST);
> +
> +const int half_matrix_dim = (coef_matrix_dim / 2);
> +int2 loc = (int2)(get_global_id(0), get_global_id(1));
> +float4 convPix = (float4)(0.0f, 0.0f, 0.0f, 0.0f);
> +
> +for (int conv_j = -half_matrix_dim; conv_j <= half_matrix_dim;
> conv_j++) {
> +float4 px = read_imagef(src, sampler, loc + (int2)(conv_j, 0));
> +convPix += px * coef_matrix[(conv_j + half_matrix_dim)];
> +}
> +
> +write_imagef(dst, loc, convPix);
> +}
> +
> +__kernel void gblur_conv_vert(__write_only image2d_t dst,
> +  __read_only  image2d_t src,
> +  int coef_matrix_dim,
> +  __constant float *coef_matrix)
> +{
> +const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
> +   CLK_ADDRESS_CLAMP_TO_EDGE   |
> +   CLK_FILTER_NEAREST);
> +
> +const int half_matrix_dim = (coef_matrix_dim / 2);
> +int2 loc = (int2)(get_global_id(0), get_global_id(1));
> +float4 convPix = (float4)(0.0f, 0.0f, 0.0f, 0.0f);
> +
> +for (int conv_j = -half_matrix_dim; conv_j <= half_matrix_dim;
> conv_j++) {
> +float4 px = read_imagef(src, sampler, loc + (int2)(0, conv_j));
> +convPix += px * coef_matrix[(conv_j + half_matrix_dim)];
> +}
> +
> +write_imagef(dst, loc, convPix);

Re: [FFmpeg-devel] [PATCH] lavfi: add gblur_opencl filter

2019-04-25 Thread Moritz Barsnick
On Thu, Apr 25, 2019 at 22:41:49 +1000, Dylan Fernando wrote:

> +static const AVOption gblur_opencl_options[] = {
> +{ "sigma",  "set horizontal size",  OFFSET(sigma), AV_OPT_TYPE_FLOAT, 
> {.dbl=0.5},   0.0, 1024, FLAGS },
   ^

Shouldn't this be "set sigma"?

> +{ "planes", "set planes to filter", OFFSET(planes),  AV_OPT_TYPE_INT, 
> {.i64=0xF}, 0,  0xF, FLAGS },
> +{ "sigmaV", "set vertical sigma",   OFFSET(sigmaV), AV_OPT_TYPE_FLOAT, 
> {.dbl=-1},   -1, 1024, FLAGS },
> +{ NULL }

Please also add documentation to doc/filters.texi. You could do this by
reference to the "gblur" filter, but as this filter's options are
slightly different, you will need to copy the relevant sections.

Furthermore, CamelCase variables aren't usually accepted for ffmpeg own
variables, but this mirrors the gblur filter, so - oh well.

> +matrix_horiz = av_malloc(matrix_bytes_horiz);
> +if (!matrix_horiz) {
> +av_freep(_horiz);

If av_malloc() returned 0/NULL, does it ever need to be freed???

> +matrix_vert = av_malloc(matrix_bytes_vert);
> +if (!matrix_vert) {
> +av_freep(_vert);

Ditto

I can't judge on the rest.

Cheers,
Moritz
___
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".