summaryrefslogtreecommitdiff
path: root/libavcodec/flacenc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2008-02-09 03:42:48 +0000
committerMichael Niedermayer <michaelni@gmx.at>2008-02-09 03:42:48 +0000
commitfa4ed8c10af49ca22ead46ee6fa4e51c8327a7ff (patch)
tree6ecd8d0321c6c906f619afa5d7e5511d29b43240 /libavcodec/flacenc.c
parentead6ebdd4433b026e7a4ffd0ca20a4ba3c864ca7 (diff)
optimize apply_welch_window()
Originally committed as revision 11881 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/flacenc.c')
-rw-r--r--libavcodec/flacenc.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c
index 59192a1e3e..4f273b7e04 100644
--- a/libavcodec/flacenc.c
+++ b/libavcodec/flacenc.c
@@ -595,11 +595,14 @@ static void apply_welch_window(const int32_t *data, int len, double *w_data)
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;
}
}