diff options
author | Bobby Bingham <uhmmmm@gmail.com> | 2009-04-13 18:07:02 +0000 |
---|---|---|
committer | Bobby Bingham <uhmmmm@gmail.com> | 2009-04-13 18:07:02 +0000 |
commit | 0aed5e9fb895a31c43ff6ab4edfecb5be372f704 (patch) | |
tree | 5bcdc7d24293fb7fd836f72d228c90ca61f9a704 | |
parent | fb53b4a035c3682f5a8ab4241bde797ced539945 (diff) | |
download | ffmpeg-0aed5e9fb895a31c43ff6ab4edfecb5be372f704.tar.gz |
Skip loop iterations which are no-ops due to data1[-lag..-1] being zero.
Originally committed as revision 18498 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavcodec/flacenc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c index 3c73277036..e8e5674bce 100644 --- a/libavcodec/flacenc.c +++ b/libavcodec/flacenc.c @@ -594,7 +594,7 @@ void ff_flac_compute_autocorr(const int32_t *data, int len, int lag, for(j=0; j<lag; j+=2){ double sum0 = 1.0, sum1 = 1.0; - for(i=0; i<len; i++){ + for(i=j; i<len; i++){ sum0 += data1[i] * data1[i-j]; sum1 += data1[i] * data1[i-j-1]; } @@ -604,7 +604,7 @@ void ff_flac_compute_autocorr(const int32_t *data, int len, int lag, if(j==lag){ double sum = 1.0; - for(i=0; i<len; i+=2){ + for(i=j-1; i<len; i+=2){ sum += data1[i ] * data1[i-j ] + data1[i+1] * data1[i-j+1]; } |