Commit e5d771c8 authored by Ganesh Ajjanagadde's avatar Ganesh Ajjanagadde

avfilter/avf_showfreqs: avoid wasteful pow

pow is a ridiculous function for computing a simple Gaussian.
Reviewed-by: 's avatarPaul B Mahol <onemda@gmail.com>
Signed-off-by: 's avatarGanesh Ajjanagadde <gajjanagadde@gmail.com>
parent 124c3759
...@@ -227,8 +227,9 @@ static void generate_window_func(float *lut, int N, int win_func, float *overlap ...@@ -227,8 +227,9 @@ static void generate_window_func(float *lut, int N, int win_func, float *overlap
*overlap = 0.75; *overlap = 0.75;
break; break;
case WFUNC_GAUSS: case WFUNC_GAUSS:
#define SQR(x) ((x)*(x))
for (n = 0; n < N; n++) 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; *overlap = 0.75;
break; break;
default: default:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment