changeset 6338:47a97ef90720 libavcodec

optimize apply_welch_window()
author michael
date Sat, 09 Feb 2008 03:42:48 +0000
parents ac94f0de338e
children 0ea2b97aa9f6
files flacenc.c
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/flacenc.c	Wed Feb 06 12:37:37 2008 +0000
+++ b/flacenc.c	Sat Feb 09 03:42:48 2008 +0000
@@ -595,11 +595,14 @@
 
     n2 = (len >> 1);
     c = 2.0 / (len - 1.0);
+
+    w_data+=n2;
+      data+=n2;
     for(i=0; i<n2; i++) {
-        w = c - i - 1.0;
+        w = c - n2 + i;
         w = 1.0 - (w * w);
-        w_data[i] = data[i] * w;
-        w_data[len-1-i] = data[len-1-i] * w;
+        w_data[-i-1] = data[-i-1] * w;
+        w_data[+i  ] = data[+i  ] * w;
     }
 }