Mercurial > mplayer.hg
changeset 25075:c18499a044ce
Change to a 64 bit accumulation variable instead of shifting.
Changing the way the loop is done is necessary to reduce register pressure.
About 20% speedup even on 32 bit x86.
author | reimar |
---|---|
date | Sun, 18 Nov 2007 18:52:51 +0000 |
parents | bbdd0202c238 |
children | dfd3c5702d32 |
files | libaf/af_scaletempo.c |
diffstat | 1 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/libaf/af_scaletempo.c Sun Nov 18 18:33:45 2007 +0000 +++ b/libaf/af_scaletempo.c Sun Nov 18 18:52:51 2007 +0000 @@ -69,7 +69,6 @@ void* buf_pre_corr; void* table_window; int (*best_overlap_offset)(struct af_scaletempo_s* s); - short shift_corr; // command line float scale_nominal; float ms_stride; @@ -153,7 +152,7 @@ { int32_t *pw, *ppc; int16_t *po, *search_start; - int32_t best_corr = INT_MIN; + int64_t best_corr = INT64_MIN; int best_off = 0; int off; long i; @@ -168,12 +167,14 @@ search_start = (int16_t*)s->buf_queue + s->num_channels; for (off=0; off<s->frames_search; off++) { - int32_t corr = 0; + int64_t corr = 0; int16_t* ps = search_start; ppc = s->buf_pre_corr; + ppc += s->samples_overlap - s->num_channels; + ps += s->samples_overlap - s->num_channels; i = -(s->samples_overlap - s->num_channels); do { - corr += ( *ppc++ * *ps++ ) >> s->shift_corr; + corr += ppc[i] * ps[i]; } while (++i < 0); if (corr > best_corr) { best_corr = corr; @@ -380,7 +381,6 @@ *pw++ = v; } } - s->shift_corr = av_log2( 2*(s->samples_overlap - nch) - 1 ); s->best_overlap_offset = best_overlap_offset_s16; } else { float* pw;