Aurelien Jacobs <[EMAIL PROTECTED]> added the comment:
manfred wrote:
>
> manfred <[EMAIL PROTECTED]> added the comment:
>
> The attached patch should fix the problem, maybe it could be more
> efficent, but it should show the way (sorry, can't add as file, I
> allways get a error message):
>
> 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,22 @@
> for(i = 0; i < s->nb_block_sizes; i++) {
> int n;
> n = 1 << (s->frame_len_bits - i);
> - ff_sine_window_init(ff_sine_windows[i], n);
> - s->windows[i] = ff_sine_windows[i];
> + if( n <= 128 ) {
> + ff_sine_window_init(ff_sine_windows[0], n);
> + s->windows[i] = ff_sine_windows[0];
> + } else if( n <= 256 ) {
> + ff_sine_window_init(ff_sine_windows[1], n);
> + s->windows[i] = ff_sine_windows[1];
> + } else if( n <= 512 ) {
> + ff_sine_window_init(ff_sine_windows[2], n);
> + s->windows[i] = ff_sine_windows[2];
> + } else if( n <= 1024 ) {
> + ff_sine_window_init(ff_sine_windows[3], n);
> + s->windows[i] = ff_sine_windows[3];
> + } else {
> + ff_sine_window_init(ff_sine_windows[4], n);
> + s->windows[i] = ff_sine_windows[4];
> + }
> }
>
> s->reset_block_lengths = 1;
I don't know if your patch is correct or not. But if it is,
then it can easily be simplified:
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(n>>8, 4);
+ ff_sine_window_init(ff_sine_windows[n2], n);
+ s->windows[i] = ff_sine_windows[n2];
}
s->reset_block_lengths = 1;
And note the the FFMIN() is not needed if n is granted to be less
than 2048 (but I have not verified this).
Aurel
______________________________________________________
FFmpeg issue tracker <[EMAIL PROTECTED]>
<https://roundup.mplayerhq.hu/roundup/ffmpeg/issue586>
______________________________________________________