On 9 March 2016 at 03:16, Ganesh Ajjanagadde <gajja...@gmail.com> wrote:
> 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 > > Big shame that len-1 is -1 mod 4; 0 mod 4 would have yielded a further 2x > through > additional symmetry. Of course, one could approximate with the 0 mod 4 > variant, > error would essentially be ~ 1/len in the worst case. > > Signed-off-by: Ganesh Ajjanagadde <gajja...@gmail.com> > --- > libavcodec/lpc.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/libavcodec/lpc.c b/libavcodec/lpc.c > index 3839119..052aeaa 100644 > --- a/libavcodec/lpc.c > +++ b/libavcodec/lpc.c > @@ -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); > -- > LGTM, doesn't add too much complexity and it does give a slight speedup. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel