[FFmpeg-devel] [PATCH 05/10] avfilter/avf_showcqt: use hypot()

Muhammad Faiz mfcc64 at gmail.com
Tue Dec 1 05:15:34 CET 2015


On Sun, Nov 22, 2015 at 9:05 AM, Ganesh Ajjanagadde
<gajjanagadde at gmail.com> wrote:
> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
> ---
>  libavfilter/avf_showcqt.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavfilter/avf_showcqt.c b/libavfilter/avf_showcqt.c
> index d6e2928..cd90c88 100644
> --- a/libavfilter/avf_showcqt.c
> +++ b/libavfilter/avf_showcqt.c
> @@ -170,7 +170,7 @@ static double a_weighting(void *p, double f)
>  static double b_weighting(void *p, double f)
>  {
>      double ret = 12200.0*12200.0 * (f*f*f);
> -    ret /= (f*f + 20.6*20.6) * (f*f + 12200.0*12200.0) * sqrt(f*f + 158.5*158.5);
> +    ret /= (f*f + 20.6*20.6) * (f*f + 12200.0*12200.0) * hypot(f, 158.5);
>      return ret;
>  }
>

I prefer sqrt in this code, because extra precision and range is not required.

Thank's.


More information about the ffmpeg-devel mailing list