Commit 66edd865 authored by Ganesh Ajjanagadde's avatar Ganesh Ajjanagadde

lavc/lpc: exploit even symmetry of window function

Yields 2x improvement in function performance, and boosts aac encoding
speed by ~ 4% overall. Sample benchmark (Haswell+GCC under -march=native):
after:
ffmpeg -i sin.flac -acodec aac -y sin_new.aac  5.22s user 0.03s system 105% cpu 4.970 total

before:
ffmpeg -i sin.flac -acodec aac -y sin_new.aac  5.40s user 0.05s system 105% cpu 5.162 total
Reviewed-by: 's avatarRostislav Pehlivanov <atomnuker@gmail.com>
Signed-off-by: 's avatarGanesh Ajjanagadde <gajjanag@gmail.com>
parent b2ab3398
......@@ -176,9 +176,10 @@ double ff_lpc_calc_ref_coefs_f(LPCContext *s, const float *samples, int len,
const double a = 0.5f, b = 1.0f - a;
/* Apply windowing */
for (i = 0; i < len; i++) {
for (i = 0; i <= len / 2; i++) {
double weight = a - b*cos((2*M_PI*i)/(len - 1));
s->windowed_samples[i] = weight*samples[i];
s->windowed_samples[len-1-i] = weight*samples[len-1-i];
}
s->lpc_compute_autocorr(s->windowed_samples, len, order, autoc);
......
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