[FFmpeg-devel] ADPCM task (was Re: files in incoming)

Stefan Gehrer stefan.gehrer
Thu Jan 29 20:40:53 CET 2009


Mike Melanson wrote:
> Stefan Gehrer wrote:
>> 2.) incoming/xbox-adpcm-wav/*
>> Peter Ross posted a patch for supporting these in November.
>> Since I just had my first experience with an ADPCM format
>> I thought I could look at that too.
> 
> Working with ADPCM for the first time can be a very moving experience, I 
> know.

I am not sure how to interpret this sentence. I currently
file it under irony :)

> While you're waiting for Peter to re-upload those samples, perhaps 
> you might wish to study adpcm_ea_r2. Check out these 2 files:
> 
> http://samples.mplayerhq.hu/game-formats/ea-mad/THX_logo.mad
> http://samples.mplayerhq.hu/game-formats/ea-mpc/THX_logo.mpc
> 
> and probably other files from those 2 directories. Decode the audio using:
> 
>    ffmpeg -i <file> out.wav
> 
> The problem is that gcc 4.3.2 and gcc 4.4-svn decode the file in a very 
> wrong way. And they each do it differently for each platform; 3 CPUs * 2 
>   compilers => 6 different outputs:
> 
> (using 'ffmpeg -i <file> -f crc -'
> 
>    Linux / x86_64 / gcc 4.3.2
> CRC=0x6c49e01a
> 
>    Linux / x86_64 / gcc svn
> CRC=0x7dbbbe76
> 
>    Linux / x86_32 / gcc 4.3.2
> CRC=0x78e518ec

This is the platform I happen to use and indeed playback was broken.
The attached patch fixes it for me.
The reason is that the + operator does not constitute a sequence point,
thus the side-effects of the bytestream_get_x calls, i.e. incrementing
src, can actually take place before reading src as the left operand.
In case that explanation is correct, you have to thank Mans for
teaching me this particular insight into C programming.

Independent of my patch, I think the pointer srcC should get some
sanity checking at that point?

Stefan
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: adpcmfix.diff
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090129/feb60a33/attachment.asc>



More information about the ffmpeg-devel mailing list