diff options
author | Ganesh Ajjanagadde <gajjanagadde@gmail.com> | 2015-12-09 18:02:22 -0500 |
---|---|---|
committer | Ganesh Ajjanagadde <gajjanagadde@gmail.com> | 2015-12-09 20:07:49 -0500 |
commit | e5d771c84deaa70ce9fab5951eee831cbe5e82a9 (patch) | |
tree | c233b23d9a918fc796e4ea12a2d3bf4002e7ae4a /libavfilter/avf_showfreqs.c | |
parent | 124c3759386a98e9f47b3305cb18cee5e1707d73 (diff) | |
download | ffmpeg-e5d771c84deaa70ce9fab5951eee831cbe5e82a9.tar.gz |
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>
Diffstat (limited to 'libavfilter/avf_showfreqs.c')
-rw-r--r-- | libavfilter/avf_showfreqs.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libavfilter/avf_showfreqs.c b/libavfilter/avf_showfreqs.c index a3665ef4bb..3ed0155f01 100644 --- a/libavfilter/avf_showfreqs.c +++ b/libavfilter/avf_showfreqs.c @@ -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: |