changeset 9432:c9fda17dc042 libavcodec

Skip loop iterations which are no-ops due to data1[-lag..-1] being zero.
author koorogi
date Mon, 13 Apr 2009 18:07:02 +0000
parents 932543edc1d2
children 70afd9081b3f
files flacenc.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/flacenc.c	Mon Apr 13 16:59:38 2009 +0000
+++ b/flacenc.c	Mon Apr 13 18:07:02 2009 +0000
@@ -594,7 +594,7 @@
 
     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 @@
 
     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];
         }