Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 1/2] lsws,lavfi: use sws_get_gaussian_vec
@ 2023-08-26 13:21 Stefano Sabatini
  2023-08-26 13:21 ` [FFmpeg-devel] [PATCH 2/2] doc/filters/smartblur: amend definition of luma_radius and chroma_radius Stefano Sabatini
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Stefano Sabatini @ 2023-08-26 13:21 UTC (permalink / raw)
  To: FFmpeg development discussions and patches; +Cc: Stefano Sabatini

Use in place of deprecated sws_getGaussianVec.
---
 libavfilter/vf_sab.c       | 17 +++++++++++++----
 libavfilter/vf_smartblur.c |  8 ++++----
 libswscale/utils.c         | 32 ++++++++++++++------------------
 3 files changed, 31 insertions(+), 26 deletions(-)

diff --git a/libavfilter/vf_sab.c b/libavfilter/vf_sab.c
index 5e0687c9a2..b2e42a55af 100644
--- a/libavfilter/vf_sab.c
+++ b/libavfilter/vf_sab.c
@@ -143,7 +143,7 @@ static int open_filter_param(FilterParam *f, int width, int height, unsigned int
 {
     SwsVector *vec;
     SwsFilter sws_f;
-    int i, x, y;
+    int ret, i, x, y;
     int linesize = FFALIGN(width, 8);
 
     f->pre_filter_buf = av_malloc(linesize * height);
@@ -151,7 +151,10 @@ static int open_filter_param(FilterParam *f, int width, int height, unsigned int
         return AVERROR(ENOMEM);
 
     f->pre_filter_linesize = linesize;
-    vec = sws_getGaussianVec(f->pre_filter_radius, f->quality);
+    ret = sws_get_gaussian_vec(&vec, f->pre_filter_radius, f->quality);
+    if (ret < 0)
+        return ret;
+
     sws_f.lumH = sws_f.lumV = vec;
     sws_f.chrH = sws_f.chrV = NULL;
     f->pre_filter_context = sws_getContext(width, height, AV_PIX_FMT_GRAY8,
@@ -159,7 +162,10 @@ static int open_filter_param(FilterParam *f, int width, int height, unsigned int
                                            sws_flags, &sws_f, NULL, NULL);
     sws_freeVec(vec);
 
-    vec = sws_getGaussianVec(f->strength, 5.0);
+    ret = sws_get_gaussian_vec(&vec, f->strength, 5.0);
+    if (ret < 0)
+        return ret;
+
     for (i = 0; i < COLOR_DIFF_COEFF_SIZE; i++) {
         double d;
         int index = i-COLOR_DIFF_COEFF_SIZE/2 + vec->length/2;
@@ -171,7 +177,10 @@ static int open_filter_param(FilterParam *f, int width, int height, unsigned int
     }
     sws_freeVec(vec);
 
-    vec = sws_getGaussianVec(f->radius, f->quality);
+    ret = sws_get_gaussian_vec(&vec, f->radius, f->quality);
+    if (ret < 0)
+        return ret;
+
     f->dist_width    = vec->length;
     f->dist_linesize = FFALIGN(vec->length, 8);
     f->dist_coeff    = av_malloc_array(f->dist_width, f->dist_linesize * sizeof(*f->dist_coeff));
diff --git a/libavfilter/vf_smartblur.c b/libavfilter/vf_smartblur.c
index 85d8d502e1..8a4e7bf1d3 100644
--- a/libavfilter/vf_smartblur.c
+++ b/libavfilter/vf_smartblur.c
@@ -126,11 +126,11 @@ static int alloc_sws_context(FilterParam *f, int width, int height, unsigned int
 {
     SwsVector *vec;
     SwsFilter sws_filter;
+    int ret;
 
-    vec = sws_getGaussianVec(f->radius, f->quality);
-
-    if (!vec)
-        return AVERROR(EINVAL);
+    ret = sws_get_gaussian_vec(&vec, f->radius, f->quality);
+    if (ret < 0)
+        return ret;
 
     sws_scaleVec(vec, f->strength);
     vec->coeff[vec->length / 2] += 1.0 - f->strength;
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 96034af1e0..a315f37c6d 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -2365,24 +2365,20 @@ SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur,
     if (!filter)
         return NULL;
 
-    if (lumaGBlur != 0.0) {
-        filter->lumH = sws_getGaussianVec(lumaGBlur, 3.0);
-        filter->lumV = sws_getGaussianVec(lumaGBlur, 3.0);
-    } else {
-        filter->lumH = sws_getIdentityVec();
-        filter->lumV = sws_getIdentityVec();
-    }
-
-    if (chromaGBlur != 0.0) {
-        filter->chrH = sws_getGaussianVec(chromaGBlur, 3.0);
-        filter->chrV = sws_getGaussianVec(chromaGBlur, 3.0);
-    } else {
-        filter->chrH = sws_getIdentityVec();
-        filter->chrV = sws_getIdentityVec();
-    }
-
-    if (!filter->lumH || !filter->lumV || !filter->chrH || !filter->chrV)
-        goto fail;
+#define SET_FILTER_VECTOR(name_, standard_deviation_, quality_)         \
+    if (standard_deviation_ != 0.0) {                                   \
+        sws_get_gaussian_vec(&filter->name_,                            \
+                             standard_deviation_, quality_);            \
+    } else {                                                            \
+        filter->name_ = sws_getIdentityVec();                           \
+    }                                                                   \
+    if (!filter->name_)                                                 \
+        goto fail;                                                      \
+
+    SET_FILTER_VECTOR(lumH, lumaGBlur, 3.0);
+    SET_FILTER_VECTOR(lumV, lumaGBlur, 3.0);
+    SET_FILTER_VECTOR(chrH, chromaGBlur, 3.0);
+    SET_FILTER_VECTOR(chrV, chromaGBlur, 3.0);
 
     if (chromaSharpen != 0.0) {
         SwsVector *id = sws_getIdentityVec();
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [FFmpeg-devel] [PATCH 2/2] doc/filters/smartblur: amend definition of luma_radius and chroma_radius
  2023-08-26 13:21 [FFmpeg-devel] [PATCH 1/2] lsws,lavfi: use sws_get_gaussian_vec Stefano Sabatini
@ 2023-08-26 13:21 ` Stefano Sabatini
  2023-08-26 15:13 ` [FFmpeg-devel] [PATCH 1/2] lsws, lavfi: use sws_get_gaussian_vec Andreas Rheinhardt
  2023-08-26 18:02 ` Michael Niedermayer
  2 siblings, 0 replies; 5+ messages in thread
From: Stefano Sabatini @ 2023-08-26 13:21 UTC (permalink / raw)
  To: FFmpeg development discussions and patches; +Cc: Stefano Sabatini

Correctly define the option values as a standard deviation rather than a variance.

Address trac issue:
http://trac.ffmpeg.org/ticket/9068
---
 doc/filters.texi | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 90e6c433c4..01291c235a 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -22178,9 +22178,10 @@ It accepts the following options:
 
 @table @option
 @item luma_radius, lr
-Set the luma radius. The option value must be a float number in
-the range [0.1,5.0] that specifies the variance of the gaussian filter
-used to blur the image (slower if larger). Default value is 1.0.
+Set the luma radius. The option value must be a float number in the
+range [0.1,5.0] that specifies the standard deviation of the gaussian
+filter used to blur the image (slower if larger). Default value is
+1.0.
 
 @item luma_strength, ls
 Set the luma strength. The option value must be a float number
@@ -22196,9 +22197,10 @@ a value included in [0,30] will filter flat areas and a value included
 in [-30,0] will filter edges. Default value is 0.
 
 @item chroma_radius, cr
-Set the chroma radius. The option value must be a float number in
-the range [0.1,5.0] that specifies the variance of the gaussian filter
-used to blur the image (slower if larger). Default value is @option{luma_radius}.
+Set the chroma radius. The option value must be a float number in the
+range [0.1,5.0] that specifies the standard deviation of the gaussian
+filter used to blur the image (slower if larger). Default value is
+@option{luma_radius}.
 
 @item chroma_strength, cs
 Set the chroma strength. The option value must be a float number
-- 
2.34.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/2] lsws, lavfi: use sws_get_gaussian_vec
  2023-08-26 13:21 [FFmpeg-devel] [PATCH 1/2] lsws,lavfi: use sws_get_gaussian_vec Stefano Sabatini
  2023-08-26 13:21 ` [FFmpeg-devel] [PATCH 2/2] doc/filters/smartblur: amend definition of luma_radius and chroma_radius Stefano Sabatini
@ 2023-08-26 15:13 ` Andreas Rheinhardt
  2023-08-31 15:34   ` Stefano Sabatini
  2023-08-26 18:02 ` Michael Niedermayer
  2 siblings, 1 reply; 5+ messages in thread
From: Andreas Rheinhardt @ 2023-08-26 15:13 UTC (permalink / raw)
  To: ffmpeg-devel

Stefano Sabatini:
> Use in place of deprecated sws_getGaussianVec.

This patchset should have been sent as a reply to the patch actually
adding sws_get_gaussian_vec.

> ---
>  libavfilter/vf_sab.c       | 17 +++++++++++++----
>  libavfilter/vf_smartblur.c |  8 ++++----
>  libswscale/utils.c         | 32 ++++++++++++++------------------
>  3 files changed, 31 insertions(+), 26 deletions(-)
> 
> diff --git a/libavfilter/vf_sab.c b/libavfilter/vf_sab.c
> index 5e0687c9a2..b2e42a55af 100644
> --- a/libavfilter/vf_sab.c
> +++ b/libavfilter/vf_sab.c
> @@ -143,7 +143,7 @@ static int open_filter_param(FilterParam *f, int width, int height, unsigned int
>  {
>      SwsVector *vec;
>      SwsFilter sws_f;
> -    int i, x, y;
> +    int ret, i, x, y;
>      int linesize = FFALIGN(width, 8);
>  
>      f->pre_filter_buf = av_malloc(linesize * height);
> @@ -151,7 +151,10 @@ static int open_filter_param(FilterParam *f, int width, int height, unsigned int
>          return AVERROR(ENOMEM);
>  
>      f->pre_filter_linesize = linesize;
> -    vec = sws_getGaussianVec(f->pre_filter_radius, f->quality);
> +    ret = sws_get_gaussian_vec(&vec, f->pre_filter_radius, f->quality);
> +    if (ret < 0)
> +        return ret;
> +
>      sws_f.lumH = sws_f.lumV = vec;
>      sws_f.chrH = sws_f.chrV = NULL;
>      f->pre_filter_context = sws_getContext(width, height, AV_PIX_FMT_GRAY8,
> @@ -159,7 +162,10 @@ static int open_filter_param(FilterParam *f, int width, int height, unsigned int
>                                             sws_flags, &sws_f, NULL, NULL);
>      sws_freeVec(vec);
>  
> -    vec = sws_getGaussianVec(f->strength, 5.0);
> +    ret = sws_get_gaussian_vec(&vec, f->strength, 5.0);
> +    if (ret < 0)
> +        return ret;
> +
>      for (i = 0; i < COLOR_DIFF_COEFF_SIZE; i++) {
>          double d;
>          int index = i-COLOR_DIFF_COEFF_SIZE/2 + vec->length/2;
> @@ -171,7 +177,10 @@ static int open_filter_param(FilterParam *f, int width, int height, unsigned int
>      }
>      sws_freeVec(vec);
>  
> -    vec = sws_getGaussianVec(f->radius, f->quality);
> +    ret = sws_get_gaussian_vec(&vec, f->radius, f->quality);
> +    if (ret < 0)
> +        return ret;
> +
>      f->dist_width    = vec->length;
>      f->dist_linesize = FFALIGN(vec->length, 8);
>      f->dist_coeff    = av_malloc_array(f->dist_width, f->dist_linesize * sizeof(*f->dist_coeff));
> diff --git a/libavfilter/vf_smartblur.c b/libavfilter/vf_smartblur.c
> index 85d8d502e1..8a4e7bf1d3 100644
> --- a/libavfilter/vf_smartblur.c
> +++ b/libavfilter/vf_smartblur.c
> @@ -126,11 +126,11 @@ static int alloc_sws_context(FilterParam *f, int width, int height, unsigned int
>  {
>      SwsVector *vec;
>      SwsFilter sws_filter;
> +    int ret;
>  
> -    vec = sws_getGaussianVec(f->radius, f->quality);
> -
> -    if (!vec)
> -        return AVERROR(EINVAL);
> +    ret = sws_get_gaussian_vec(&vec, f->radius, f->quality);
> +    if (ret < 0)
> +        return ret;
>  
>      sws_scaleVec(vec, f->strength);
>      vec->coeff[vec->length / 2] += 1.0 - f->strength;
> diff --git a/libswscale/utils.c b/libswscale/utils.c
> index 96034af1e0..a315f37c6d 100644
> --- a/libswscale/utils.c
> +++ b/libswscale/utils.c
> @@ -2365,24 +2365,20 @@ SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur,
>      if (!filter)
>          return NULL;
>  
> -    if (lumaGBlur != 0.0) {
> -        filter->lumH = sws_getGaussianVec(lumaGBlur, 3.0);
> -        filter->lumV = sws_getGaussianVec(lumaGBlur, 3.0);
> -    } else {
> -        filter->lumH = sws_getIdentityVec();
> -        filter->lumV = sws_getIdentityVec();
> -    }
> -
> -    if (chromaGBlur != 0.0) {
> -        filter->chrH = sws_getGaussianVec(chromaGBlur, 3.0);
> -        filter->chrV = sws_getGaussianVec(chromaGBlur, 3.0);
> -    } else {
> -        filter->chrH = sws_getIdentityVec();
> -        filter->chrV = sws_getIdentityVec();
> -    }
> -
> -    if (!filter->lumH || !filter->lumV || !filter->chrH || !filter->chrV)
> -        goto fail;
> +#define SET_FILTER_VECTOR(name_, standard_deviation_, quality_)         \
> +    if (standard_deviation_ != 0.0) {                                   \
> +        sws_get_gaussian_vec(&filter->name_,                            \
> +                             standard_deviation_, quality_);            \
> +    } else {                                                            \
> +        filter->name_ = sws_getIdentityVec();                           \
> +    }                                                                   \
> +    if (!filter->name_)                                                 \
> +        goto fail;                                                      \
> +
> +    SET_FILTER_VECTOR(lumH, lumaGBlur, 3.0);
> +    SET_FILTER_VECTOR(lumV, lumaGBlur, 3.0);
> +    SET_FILTER_VECTOR(chrH, chromaGBlur, 3.0);
> +    SET_FILTER_VECTOR(chrV, chromaGBlur, 3.0);

This will check lumaGBlur/chromaGBlur twice.

>  
>      if (chromaSharpen != 0.0) {
>          SwsVector *id = sws_getIdentityVec();

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/2] lsws, lavfi: use sws_get_gaussian_vec
  2023-08-26 13:21 [FFmpeg-devel] [PATCH 1/2] lsws,lavfi: use sws_get_gaussian_vec Stefano Sabatini
  2023-08-26 13:21 ` [FFmpeg-devel] [PATCH 2/2] doc/filters/smartblur: amend definition of luma_radius and chroma_radius Stefano Sabatini
  2023-08-26 15:13 ` [FFmpeg-devel] [PATCH 1/2] lsws, lavfi: use sws_get_gaussian_vec Andreas Rheinhardt
@ 2023-08-26 18:02 ` Michael Niedermayer
  2 siblings, 0 replies; 5+ messages in thread
From: Michael Niedermayer @ 2023-08-26 18:02 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


[-- Attachment #1.1: Type: text/plain, Size: 2458 bytes --]

Hi Stefano

On Sat, Aug 26, 2023 at 03:21:44PM +0200, Stefano Sabatini wrote:
> Use in place of deprecated sws_getGaussianVec.
> ---
>  libavfilter/vf_sab.c       | 17 +++++++++++++----
>  libavfilter/vf_smartblur.c |  8 ++++----
>  libswscale/utils.c         | 32 ++++++++++++++------------------
>  3 files changed, 31 insertions(+), 26 deletions(-)
> 

[...]
> @@ -2365,24 +2365,20 @@ SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur,
>      if (!filter)
>          return NULL;
>  
> -    if (lumaGBlur != 0.0) {
> -        filter->lumH = sws_getGaussianVec(lumaGBlur, 3.0);
> -        filter->lumV = sws_getGaussianVec(lumaGBlur, 3.0);
> -    } else {
> -        filter->lumH = sws_getIdentityVec();
> -        filter->lumV = sws_getIdentityVec();
> -    }
> -
> -    if (chromaGBlur != 0.0) {
> -        filter->chrH = sws_getGaussianVec(chromaGBlur, 3.0);
> -        filter->chrV = sws_getGaussianVec(chromaGBlur, 3.0);
> -    } else {
> -        filter->chrH = sws_getIdentityVec();
> -        filter->chrV = sws_getIdentityVec();
> -    }
> -
> -    if (!filter->lumH || !filter->lumV || !filter->chrH || !filter->chrV)
> -        goto fail;
> +#define SET_FILTER_VECTOR(name_, standard_deviation_, quality_)         \
> +    if (standard_deviation_ != 0.0) {                                   \
> +        sws_get_gaussian_vec(&filter->name_,                            \
> +                             standard_deviation_, quality_);            \
> +    } else {                                                            \
> +        filter->name_ = sws_getIdentityVec();                           \
> +    }                                                                   \
> +    if (!filter->name_)                                                 \
> +        goto fail;                                                      \
> +
> +    SET_FILTER_VECTOR(lumH, lumaGBlur, 3.0);
> +    SET_FILTER_VECTOR(lumV, lumaGBlur, 3.0);
> +    SET_FILTER_VECTOR(chrH, chromaGBlur, 3.0);
> +    SET_FILTER_VECTOR(chrV, chromaGBlur, 3.0);

Doesnt the old code look cleaner/simpler ?

The macro makes this a bit harder to read

thx

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

Take away the freedom of one citizen and you will be jailed, take away
the freedom of all citizens and you will be congratulated by your peers
in Parliament.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/2] lsws, lavfi: use sws_get_gaussian_vec
  2023-08-26 15:13 ` [FFmpeg-devel] [PATCH 1/2] lsws, lavfi: use sws_get_gaussian_vec Andreas Rheinhardt
@ 2023-08-31 15:34   ` Stefano Sabatini
  0 siblings, 0 replies; 5+ messages in thread
From: Stefano Sabatini @ 2023-08-31 15:34 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

[-- Attachment #1: Type: text/plain, Size: 1608 bytes --]

On date Saturday 2023-08-26 17:13:19 +0200, Andreas Rheinhardt wrote:
> Stefano Sabatini:
> > Use in place of deprecated sws_getGaussianVec.
> 

> This patchset should have been sent as a reply to the patch actually
> adding sws_get_gaussian_vec.

Noted.

> > ---
> >  libavfilter/vf_sab.c       | 17 +++++++++++++----
> >  libavfilter/vf_smartblur.c |  8 ++++----
> >  libswscale/utils.c         | 32 ++++++++++++++------------------
> >  3 files changed, 31 insertions(+), 26 deletions(-)
> > 
[...]
> > -    if (!filter->lumH || !filter->lumV || !filter->chrH || !filter->chrV)
> > -        goto fail;
> > +#define SET_FILTER_VECTOR(name_, standard_deviation_, quality_)         \
> > +    if (standard_deviation_ != 0.0) {                                   \
> > +        sws_get_gaussian_vec(&filter->name_,                            \
> > +                             standard_deviation_, quality_);            \
> > +    } else {                                                            \
> > +        filter->name_ = sws_getIdentityVec();                           \
> > +    }                                                                   \
> > +    if (!filter->name_)                                                 \
> > +        goto fail;                                                      \
> > +
> > +    SET_FILTER_VECTOR(lumH, lumaGBlur, 3.0);
> > +    SET_FILTER_VECTOR(lumV, lumaGBlur, 3.0);
> > +    SET_FILTER_VECTOR(chrH, chromaGBlur, 3.0);
> > +    SET_FILTER_VECTOR(chrV, chromaGBlur, 3.0);
> 
> This will check lumaGBlur/chromaGBlur twice.

Dropped the macro and updated.

[-- Attachment #2: 0002-lsws-lavfi-use-sws_get_gaussian_vec.patch --]
[-- Type: text/x-diff, Size: 4080 bytes --]

From 77eeaffc7d3f9e8cd2778f7c686f97d3a5f69ac1 Mon Sep 17 00:00:00 2001
From: Stefano Sabatini <stefasab@gmail.com>
Date: Sat, 26 Aug 2023 15:08:55 +0200
Subject: [PATCH 2/4] lsws,lavfi: use sws_get_gaussian_vec

Use in place of deprecated sws_getGaussianVec.
---
 libavfilter/vf_sab.c       | 17 +++++++++++++----
 libavfilter/vf_smartblur.c |  8 ++++----
 libswscale/utils.c         |  8 ++++----
 3 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/libavfilter/vf_sab.c b/libavfilter/vf_sab.c
index 5e0687c9a2..6ae00d3eeb 100644
--- a/libavfilter/vf_sab.c
+++ b/libavfilter/vf_sab.c
@@ -143,7 +143,7 @@ static int open_filter_param(FilterParam *f, int width, int height, unsigned int
 {
     SwsVector *vec;
     SwsFilter sws_f;
-    int i, x, y;
+    int ret, i, x, y;
     int linesize = FFALIGN(width, 8);
 
     f->pre_filter_buf = av_malloc(linesize * height);
@@ -151,7 +151,10 @@ static int open_filter_param(FilterParam *f, int width, int height, unsigned int
         return AVERROR(ENOMEM);
 
     f->pre_filter_linesize = linesize;
-    vec = sws_getGaussianVec(f->pre_filter_radius, f->quality);
+    ret = sws_get_gaussian_vec(&vec, NULL, f->pre_filter_radius, f->quality);
+    if (ret < 0)
+        return ret;
+
     sws_f.lumH = sws_f.lumV = vec;
     sws_f.chrH = sws_f.chrV = NULL;
     f->pre_filter_context = sws_getContext(width, height, AV_PIX_FMT_GRAY8,
@@ -159,7 +162,10 @@ static int open_filter_param(FilterParam *f, int width, int height, unsigned int
                                            sws_flags, &sws_f, NULL, NULL);
     sws_freeVec(vec);
 
-    vec = sws_getGaussianVec(f->strength, 5.0);
+    ret = sws_get_gaussian_vec(&vec, NULL, f->strength, 5.0);
+    if (ret < 0)
+        return ret;
+
     for (i = 0; i < COLOR_DIFF_COEFF_SIZE; i++) {
         double d;
         int index = i-COLOR_DIFF_COEFF_SIZE/2 + vec->length/2;
@@ -171,7 +177,10 @@ static int open_filter_param(FilterParam *f, int width, int height, unsigned int
     }
     sws_freeVec(vec);
 
-    vec = sws_getGaussianVec(f->radius, f->quality);
+    ret = sws_get_gaussian_vec(&vec, NULL, f->radius, f->quality);
+    if (ret < 0)
+        return ret;
+
     f->dist_width    = vec->length;
     f->dist_linesize = FFALIGN(vec->length, 8);
     f->dist_coeff    = av_malloc_array(f->dist_width, f->dist_linesize * sizeof(*f->dist_coeff));
diff --git a/libavfilter/vf_smartblur.c b/libavfilter/vf_smartblur.c
index 85d8d502e1..13a4225990 100644
--- a/libavfilter/vf_smartblur.c
+++ b/libavfilter/vf_smartblur.c
@@ -126,11 +126,11 @@ static int alloc_sws_context(FilterParam *f, int width, int height, unsigned int
 {
     SwsVector *vec;
     SwsFilter sws_filter;
+    int ret;
 
-    vec = sws_getGaussianVec(f->radius, f->quality);
-
-    if (!vec)
-        return AVERROR(EINVAL);
+    ret = sws_get_gaussian_vec(&vec, NULL, f->radius, f->quality);
+    if (ret < 0)
+        return ret;
 
     sws_scaleVec(vec, f->strength);
     vec->coeff[vec->length / 2] += 1.0 - f->strength;
diff --git a/libswscale/utils.c b/libswscale/utils.c
index e56df87d9f..5bdaf50392 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -2367,16 +2367,16 @@ SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur,
         return NULL;
 
     if (lumaGBlur != 0.0) {
-        filter->lumH = sws_getGaussianVec(lumaGBlur, 3.0);
-        filter->lumV = sws_getGaussianVec(lumaGBlur, 3.0);
+        sws_get_gaussian_vec(&filter->lumH, NULL, lumaGBlur, 3.0);
+        sws_get_gaussian_vec(&filter->lumV, NULL, lumaGBlur, 3.0);
     } else {
         filter->lumH = sws_getIdentityVec();
         filter->lumV = sws_getIdentityVec();
     }
 
     if (chromaGBlur != 0.0) {
-        filter->chrH = sws_getGaussianVec(chromaGBlur, 3.0);
-        filter->chrV = sws_getGaussianVec(chromaGBlur, 3.0);
+        sws_get_gaussian_vec(&filter->chrV, NULL, chromaGBlur, 3.0);
+        sws_get_gaussian_vec(&filter->chrV, NULL, chromaGBlur, 3.0);
     } else {
         filter->chrH = sws_getIdentityVec();
         filter->chrV = sws_getIdentityVec();
-- 
2.34.1


[-- Attachment #3: Type: text/plain, Size: 251 bytes --]

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-08-31 15:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-26 13:21 [FFmpeg-devel] [PATCH 1/2] lsws,lavfi: use sws_get_gaussian_vec Stefano Sabatini
2023-08-26 13:21 ` [FFmpeg-devel] [PATCH 2/2] doc/filters/smartblur: amend definition of luma_radius and chroma_radius Stefano Sabatini
2023-08-26 15:13 ` [FFmpeg-devel] [PATCH 1/2] lsws, lavfi: use sws_get_gaussian_vec Andreas Rheinhardt
2023-08-31 15:34   ` Stefano Sabatini
2023-08-26 18:02 ` Michael Niedermayer

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git