[FFmpeg-devel] [PATCH v1] avfilter/vf_vaguedenoiser: use fabsf() instead of FFABS()

Carl Eugen Hoyos ceffmpeg at gmail.com
Wed Nov 6 21:10:53 EET 2019


Am Mi., 6. Nov. 2019 um 12:04 Uhr schrieb Limin Wang <lance.lmwang at gmail.com>:
>
> On Wed, Nov 06, 2019 at 11:11:08AM +0100, Carl Eugen Hoyos wrote:
> > Am Mi., 6. Nov. 2019 um 10:31 Uhr schrieb <lance.lmwang at gmail.com>:
> > >
> > > From: Limin Wang <lance.lmwang at gmail.com>
> > >
> > > Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
> > > ---
> > >  libavfilter/vf_vaguedenoiser.c | 6 +++---
> > >  1 file changed, 3 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/libavfilter/vf_vaguedenoiser.c b/libavfilter/vf_vaguedenoiser.c
> > > index a68f7626e6..75a58c363b 100644
> > > --- a/libavfilter/vf_vaguedenoiser.c
> > > +++ b/libavfilter/vf_vaguedenoiser.c
> > > @@ -335,7 +335,7 @@ static void hard_thresholding(float *block, const int width, const int height,
> > >
> > >      for (y = 0; y < height; y++) {
> > >          for (x = 0; x < width; x++) {
> > > -            if (FFABS(block[x]) <= threshold)
> > > +            if (fabsf(block[x]) <= threshold)
> > >                  block[x] *= frac;
> > >          }
> > >          block += stride;
> > > @@ -359,7 +359,7 @@ static void soft_thresholding(float *block, const int width, const int height, c
> > >      for (y = 0; y < height; y++) {
> > >          const int x0 = (y < h) ? w : 0;
> > >          for (x = x0; x < width; x++) {
> > > -            const float temp = FFABS(block[x]);
> > > +            const float temp = fabsf(block[x]);
> > >              if (temp <= threshold)
> > >                  block[x] *= frac;
> > >              else
> > > @@ -380,7 +380,7 @@ static void qian_thresholding(float *block, const int width, const int height,
> > >
> > >      for (y = 0; y < height; y++) {
> > >          for (x = 0; x < width; x++) {
> > > -            const float temp = FFABS(block[x]);
> > > +            const float temp = fabsf(block[x]);
> > >              if (temp <= threshold) {
> > >                  block[x] *= frac;
> > >              } else {
> >
> > Please add a sentence to the commit message that explains why this
> > change is a good idea.
>
> block is float type, so I think it's better to use fabsf, isn't right?

Looking at the definition of FFABS(), I don't think this is correct.

Carl Eugen


More information about the ffmpeg-devel mailing list