[FFmpeg-devel] ADPCM task (was Re: files in incoming)
Stefan Gehrer
stefan.gehrer
Fri Jan 30 07:41:42 CET 2009
Michael Niedermayer wrote:
> On Thu, Jan 29, 2009 at 08:40:53PM +0100, Stefan Gehrer wrote:
>> 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
>
>
>
>> Index: libavcodec/adpcm.c
>> ===================================================================
>> --- libavcodec/adpcm.c (revision 16828)
>> +++ libavcodec/adpcm.c (working copy)
>> @@ -1300,9 +1300,10 @@
>> }
>>
>> for (channel=0; channel<avctx->channels; channel++) {
>> - srcC = src + (big_endian ? bytestream_get_be32(&src)
>> - : bytestream_get_le32(&src))
>> - + (avctx->channels-channel-1) * 4;
>> + uint32_t offset = (big_endian ? bytestream_get_be32(&src)
>> + : bytestream_get_le32(&src));
>> +
>> + srcC = src + offset + (avctx->channels-channel-1) * 4;
>
> the offset variable seems unneeded besides this looks ok
applied without extra variable, the pointer sanity check is still tbd.
Stefan
More information about the ffmpeg-devel
mailing list