[Ffmpeg-devel] Re: WMA decoder improvement

Patrice Bensoussan patrice.bensoussan
Thu Apr 5 22:48:14 CEST 2007


 >Ian Braithwaite skrev:
 >> Hi,
 >>
 >>

Hi,

 >> Here's a little improvement to wma decoding.
 >>
 >> I've compared the decoded output against that produced by the  
wmadmo dll
 >> used with mplayer.
 >>
 >> Testing on "...samples/A-codecs/WMA/Bangles 01 - Walk Like An  
 >Egyptian.wma",
 >> it reduces the difference between MS and ffmpeg from
 >>   max +-4142, rms 21.0  to  max +-575, rms 1.3.
 >>
 >> On a 30s clip I use for testing ("g_64k.wma", can't remember now  
where it >came
 >> from:-/) the improvement is from
 >>   max +-1361, rms = 9.3  to  max +-1, rms = 0.04 (!!)
 >>
 >>
 >> Here's what it does.
 >> Exponents can be reused from one block to the next.
 >> In wma, block sizes vary, for example between 128,256,512,1024  
and 2048 >samples.
 >> Currently, when reusing exponents in blocks with a different  
block size,
 >> the exponent block is down or up sampled to the new size.
 >> So a block of exponents can be resized from 512 -> 256 samples,  
and then
 >> resized back again from 256 -> 512 samples,
 >> discarding and duplicating every other sample, respectively.
 >>
 >> The patch keeps the original exponent blocks, and resizes (on the  
fly) to
 >> each new block size.
 >>
 >>
 >>  wma.h    |    1
 >>  wmadec.c |   79 +++++++++++++++++ 
+-------------------------------------->-------
 >> 2 files changed, 24 insertions(+), 56 deletions(-)
 >>
 >
 >Make test and make fulltest regressions passed thus applied.
 >
 >>
 >> There seem to be quite a few variants of wma, so I can't be sure  
that
 >> this is the right thing to do in all cases.
 >>
 >> Also, to compare against the MS codec, I had to prevent the first  
two
 >> blocks from being output.
 >> There's a little patch for that too, but I'm pretty sure it doesn't
 >> do the right thing in all cases.
 >> I've attached it in case anyone wants to reproduce my measurements.
 >>
 >>
 >> Regards,
 >> Ian
 >>
 >>  
------------------------------------------------------------------------
 >
 >
 >MvH
 >Benjamin Larsson

This patch completely breaks the decoding of sample files I have.  
Moreover it generate a lot of warnings at runtime related to double  
free() calls.
See ffmpeg output below:

[patriceb at patrice-bensoussans-ibook-g4 ~/tmp/WMA/ffmpeg/ppc]$ ./ 
ffmpeg -i ~/tmp/WMA/songs/blacksmith.wma ~/Desktop/test.mp3
FFmpeg version SVN-r8627, Copyright (c) 2000-2007 Fabrice Bellard, et  
al.
   configuration: --cc=gcc-3.3 --enable-pthreads --disable-network -- 
disable-vhook --enable-small --enable-libmp3lame --enable-libfaac -- 
disable-decoder=cook --extra-ldflags=-L/Users/patriceb/tmp/WMA/opt/ 
lib --extra-cflags=-I/Users/patriceb/tmp/WMA/opt/include --enable-gpl  
--enable-x264 --enable-liba52 --enable-libfaad
   libavutil version: 49.4.0
   libavcodec version: 51.40.2
   libavformat version: 51.11.0
   built on Apr  5 2007 21:33:38, gcc: 3.3 20030304 (Apple Computer,  
Inc. build 1819)
Input #0, asf, from '/Users/patriceb/tmp/WMA/songs/blacksmith.wma':
   Duration: 00:00:34.2, start: 2.600000, bitrate: 164 kb/s
   Stream #0.0: Audio: wmav2, 44100 Hz, stereo, 160 kb/s
Output #0, mp3, to '/Users/patriceb/Desktop/test.mp3':
   Stream #0.0: Audio: mp3, 44100 Hz, stereo, 64 kb/s
Stream mapping:
   Stream #0.0 -> #0.0
Press [q] to stop encoding
size=     266kB time=34.1 bitrate=  64.0kbits/s
video:0kB audio:266kB global headers:0kB muxing overhead 0.000000%
ffmpeg(23258) malloc: ***  Deallocation of a pointer not malloced:  
0x4380d54d; This could be a double free(), or free() called with the  
middle of an allocated block; Try setting environment variable  
MallocHelp to see tools to help debug
ffmpeg(23258) malloc: ***  Deallocation of a pointer not malloced:  
0x437d337d; This could be a double free(), or free() called with the  
middle of an allocated block; Try setting environment variable  
MallocHelp to see tools to help debug
ffmpeg(23258) malloc: ***  Deallocation of a pointer not malloced:  
0xa; This could be a double free(), or free() called with the middle  
of an allocated block; Try setting environment variable MallocHelp to  
see tools to help debug
ffmpeg(23258) malloc: ***  Deallocation of a pointer not malloced:  
0x1c4bf4; This could be a double free(), or free() called with the  
middle of an allocated block; Try setting environment variable  
MallocHelp to see tools to help debug
ffmpeg(23258) malloc: ***  Deallocation of a pointer not malloced:  
0x1b9ad8; This could be a double free(), or free() called with the  
middle of an allocated block; Try setting environment variable  
MallocHelp to see tools to help debug
ffmpeg(23258) malloc: ***  Deallocation of a pointer not malloced:  
0x9; This could be a double free(), or free() called with the middle  
of an allocated block; Try setting environment variable MallocHelp to  
see tools to help debug
ffmpeg(23258) malloc: ***  Deallocation of a pointer not malloced:  
0x1c4bf4; This could be a double free(), or free() called with the  
middle of an allocated block; Try setting environment variable  
MallocHelp to see tools to help debug
ffmpeg(23258) malloc: ***  Deallocation of a pointer not malloced:  
0x1b9ad8; This could be a double free(), or free() called with the  
middle of an allocated block; Try setting environment variable  
MallocHelp to see tools to help debug
ffmpeg(23258) malloc: ***  Deallocation of a pointer not malloced:  
0x8; This could be a double free(), or free() called with the middle  
of an allocated block; Try setting environment variable MallocHelp to  
see tools to help debug
ffmpeg(23258) malloc: ***  Deallocation of a pointer not malloced:  
0x1c4bf4; This could be a double free(), or free() called with the  
middle of an allocated block; Try setting environment variable  
MallocHelp to see tools to help debug
ffmpeg(23258) malloc: ***  Deallocation of a pointer not malloced:  
0x1b9ad8; This could be a double free(), or free() called with the  
middle of an allocated block; Try setting environment variable  
MallocHelp to see tools to help debug
ffmpeg(23258) malloc: ***  Deallocation of a pointer not malloced:  
0x7; This could be a double free(), or free() called with the middle  
of an allocated block; Try setting environment variable MallocHelp to  
see tools to help debug
ffmpeg(23258) malloc: ***  Deallocation of a pointer not malloced:  
0x1c4bf4; This could be a double free(), or free() called with the  
middle of an allocated block; Try setting environment variable  
MallocHelp to see tools to help debug
ffmpeg(23258) malloc: ***  Deallocation of a pointer not malloced:  
0x1b9ad8; This could be a double free(), or free() called with the  
middle of an allocated block; Try setting environment variable  
MallocHelp to see tools to help debug
ffmpeg(23258) malloc: ***  Deallocation of a pointer not malloced:  
0x6; This could be a double free(), or free() called with the middle  
of an allocated block; Try setting environment variable MallocHelp to  
see tools to help debug
ffmpeg(23258) malloc: ***  Deallocation of a pointer not malloced:  
0x1c4bf4; This could be a double free(), or free() called with the  
middle of an allocated block; Try setting environment variable  
MallocHelp to see tools to help debug
ffmpeg(23258) malloc: ***  Deallocation of a pointer not malloced:  
0x1b9ad8; This could be a double free(), or free() called with the  
middle of an allocated block; Try setting environment variable  
MallocHelp to see tools to help debug

Patch should be reverted IMHO until it gets fixed. Converted mp3 file  
is not audible.

Regards,
Patrice





More information about the ffmpeg-devel mailing list