diff mbox series

[FFmpeg-devel,1/8] avfilter/af_replaygain: use fabsf() instead of fabs()

Message ID 1634216942-20329-1-git-send-email-lance.lmwang@gmail.com
State New
Headers show
Series [FFmpeg-devel,1/8] avfilter/af_replaygain: use fabsf() instead of fabs() | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Lance Wang Oct. 14, 2021, 1:08 p.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavfilter/af_replaygain.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

James Almer Oct. 16, 2021, 1:06 p.m. UTC | #1
On 10/14/2021 10:08 AM, lance.lmwang@gmail.com wrote:
> From: Limin Wang <lance.lmwang@gmail.com>
> 
> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> ---
>   libavfilter/af_replaygain.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/libavfilter/af_replaygain.c b/libavfilter/af_replaygain.c
> index 4bf2763..da5c196 100644
> --- a/libavfilter/af_replaygain.c
> +++ b/libavfilter/af_replaygain.c
> @@ -428,7 +428,7 @@ static void butter_filter_stereo_samples(ReplayGainContext *s,
>       // (slowing us down).
>   
>       for (j = -4; j < 0; ++j)
> -        if (fabs(hist_a[i + j]) > 1e-10 || fabs(hist_b[i + j]) > 1e-10)
> +        if (fabsf(hist_a[i + j]) > 1e-10 || fabsf(hist_b[i + j]) > 1e-10)

Shouldn't the constants also be made into floats? Otherwise the compiler 
will probably do a conversion to double.

>               break;
>   
>       if (!j) {
> @@ -477,7 +477,7 @@ static void yule_filter_stereo_samples(ReplayGainContext *s, const float *src,
>       // (slowing us down).
>   
>       for (j = -20; j < 0; ++j)
> -        if (fabs(hist_a[i + j]) > 1e-10 || fabs(hist_b[i + j]) > 1e-10)
> +        if (fabsf(hist_a[i + j]) > 1e-10 || fabsf(hist_b[i + j]) > 1e-10)
>               break;
>   
>       if (!j) {
>
Lance Wang Oct. 17, 2021, 8:50 a.m. UTC | #2
On Sat, Oct 16, 2021 at 10:06:35AM -0300, James Almer wrote:
> On 10/14/2021 10:08 AM, lance.lmwang@gmail.com wrote:
> > From: Limin Wang <lance.lmwang@gmail.com>
> > 
> > Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> > ---
> >   libavfilter/af_replaygain.c | 4 ++--
> >   1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/libavfilter/af_replaygain.c b/libavfilter/af_replaygain.c
> > index 4bf2763..da5c196 100644
> > --- a/libavfilter/af_replaygain.c
> > +++ b/libavfilter/af_replaygain.c
> > @@ -428,7 +428,7 @@ static void butter_filter_stereo_samples(ReplayGainContext *s,
> >       // (slowing us down).
> >       for (j = -4; j < 0; ++j)
> > -        if (fabs(hist_a[i + j]) > 1e-10 || fabs(hist_b[i + j]) > 1e-10)
> > +        if (fabsf(hist_a[i + j]) > 1e-10 || fabsf(hist_b[i + j]) > 1e-10)
> 
> Shouldn't the constants also be made into floats? Otherwise the compiler
> will probably do a conversion to double.

Yes, will change the 1e-10 to 1e-10f also.

> 
> >               break;
> >       if (!j) {
> > @@ -477,7 +477,7 @@ static void yule_filter_stereo_samples(ReplayGainContext *s, const float *src,
> >       // (slowing us down).
> >       for (j = -20; j < 0; ++j)
> > -        if (fabs(hist_a[i + j]) > 1e-10 || fabs(hist_b[i + j]) > 1e-10)
> > +        if (fabsf(hist_a[i + j]) > 1e-10 || fabsf(hist_b[i + j]) > 1e-10)
> >               break;
> >       if (!j) {
> > 
> 
> _______________________________________________
> 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".
diff mbox series

Patch

diff --git a/libavfilter/af_replaygain.c b/libavfilter/af_replaygain.c
index 4bf2763..da5c196 100644
--- a/libavfilter/af_replaygain.c
+++ b/libavfilter/af_replaygain.c
@@ -428,7 +428,7 @@  static void butter_filter_stereo_samples(ReplayGainContext *s,
     // (slowing us down).
 
     for (j = -4; j < 0; ++j)
-        if (fabs(hist_a[i + j]) > 1e-10 || fabs(hist_b[i + j]) > 1e-10)
+        if (fabsf(hist_a[i + j]) > 1e-10 || fabsf(hist_b[i + j]) > 1e-10)
             break;
 
     if (!j) {
@@ -477,7 +477,7 @@  static void yule_filter_stereo_samples(ReplayGainContext *s, const float *src,
     // (slowing us down).
 
     for (j = -20; j < 0; ++j)
-        if (fabs(hist_a[i + j]) > 1e-10 || fabs(hist_b[i + j]) > 1e-10)
+        if (fabsf(hist_a[i + j]) > 1e-10 || fabsf(hist_b[i + j]) > 1e-10)
             break;
 
     if (!j) {