Browse Source

avfilter/avf_showfreqs: avoid wasteful pow

pow is a ridiculous function for computing a simple Gaussian.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
tags/n3.0
Ganesh Ajjanagadde 10 years ago
parent
commit
e5d771c84d
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      libavfilter/avf_showfreqs.c

+ 2
- 1
libavfilter/avf_showfreqs.c View File

@@ -227,8 +227,9 @@ static void generate_window_func(float *lut, int N, int win_func, float *overlap
*overlap = 0.75;
break;
case WFUNC_GAUSS:
#define SQR(x) ((x)*(x))
for (n = 0; n < N; n++)
lut[n] = pow(M_E,-0.5*pow((n-(N-1)/2)/(0.4*(N-1)/2.f),2));
lut[n] = exp(-0.5 * SQR((n-(N-1)/2)/(0.4*(N-1)/2.f)));
*overlap = 0.75;
break;
default:


Loading…
Cancel
Save