Aurelien Jacobs <[EMAIL PROTECTED]> added the comment:

Josh Fleming wrote:

> 
> Josh Fleming <[EMAIL PROTECTED]> added the comment:
> 
> Alright I figured out the difference. manfred's patch is creating windows 
> of doubling size, whereas aurel's patch creates windows in multiples of 
> 256.

Well, I was a bit too fast and didn't checked my patch. This one should
be better.

diff -ur ffmpeg.orig/libavcodec/wma.c ffmpeg/libavcodec/wma.c
--- ffmpeg.orig/libavcodec/wma.c        2008-08-15 15:51:21.000000000 +0200
+++ ffmpeg/libavcodec/wma.c     2008-08-21 23:24:16.000000000 +0200
@@ -302,8 +302,9 @@
     for(i = 0; i < s->nb_block_sizes; i++) {
-        int n;
+        int n, n2;
         n = 1 << (s->frame_len_bits - i);
-        ff_sine_window_init(ff_sine_windows[i], n);
-        s->windows[i] = ff_sine_windows[i];
+        n2 = FFMIN(av_log2(n-1>>6), 4);
+        ff_sine_window_init(ff_sine_windows[n2], n);
+        s->windows[i] = ff_sine_windows[n2];
     }

     s->reset_block_lengths = 1;

Oh, and now that I think about it, this even simpler version
should also work:

diff -ur ffmpeg.orig/libavcodec/wma.c ffmpeg/libavcodec/wma.c
--- ffmpeg.orig/libavcodec/wma.c        2008-08-15 15:51:21.000000000 +0200
+++ ffmpeg/libavcodec/wma.c     2008-08-21 23:24:16.000000000 +0200
@@ -302,8 +302,9 @@
     for(i = 0; i < s->nb_block_sizes; i++) {
-        int n;
+        int n, n2;
         n = 1 << (s->frame_len_bits - i);
-        ff_sine_window_init(ff_sine_windows[i], n);
-        s->windows[i] = ff_sine_windows[i];
+        n2 = av_clip(s->frame_len_bits-i-7, 0, 4);
+        ff_sine_window_init(ff_sine_windows[n2], n);
+        s->windows[i] = ff_sine_windows[n2];
     }

     s->reset_block_lengths = 1;

Aurel

______________________________________________________
FFmpeg issue tracker <[EMAIL PROTECTED]>
<https://roundup.mplayerhq.hu/roundup/ffmpeg/issue586>
______________________________________________________

Reply via email to