[FFmpeg-devel] [PATCH] wmapro decoder

Vitor Sessak vitor1001
Mon Jun 22 23:37:18 CEST 2009

Sascha Sommer wrote:
> Hi,
> On Sonntag, 21. Juni 2009, Vitor Sessak wrote:
>> Sascha Sommer wrote:
>>> Hi Vitor,
>>> thanks for your comments.
>>>>> The code still outputs shorts. Float produced clicks all around the
>>>>> place. I'm not sure yet if the problem is in my code or in ffmpeg.
>>>> It looks like it works for me, see attached.
>>> So your code does not produce clicks at second 16-18 for you with the
>>> sample file you mentioned below? It does for me when I'm using ffmpeg to
>>> produce a 16-bit wav file and play that back with MPlayer.
>> That's due to the lack of clipping. The attached patch is bit-exact for
>> wav output for me for the sample
>> http://samples.mplayerhq.hu/A-codecs/WMA9/wmapro/Beethovens%20nionde%20symf
>> oni%20(Scherzo)-2.wma .
>> Note that outputting floats can make the "Output buffer too small" error 
>> twice as bad, since the decoder will need an output buffer twice the size.
> The patch is similar to the one you submitted the first time, isn't it? 

Yes, the only change is an additional call to av_clipf().

> Shouldn't it add clipping for audioconvert.c ?

That is a hard question. For formats that already output data in the 
right range (see below), this clipping is slow and useless.

> The problem here is that float audio ranges from -1.0 to 1.0 and the converter 
> multiplies with 1<<15 so the audio will be from -32768 to 32768. The later 
> value written as int16 becomes -32768. This causes the annoying clicks.
> That means we need to clip the float values in the wmapro decoder and we need 
> to clip the integer values in audioconvert.c

There is no need to clip twice. Clipping the floats from -1. to 
32767./32768 does the trick as I did in my patch (rescaling everything 
by 32767./32768 should also work).


More information about the ffmpeg-devel mailing list