[Ffmpeg-devel] Cook stereo (MONO_COOK2) bug and patch

Ian Braithwaite ian
Thu Jan 25 10:59:05 CET 2007


Hi


On Sun, January 21, 2007 17:50, Michael Niedermayer wrote:

> i was more thinking of something like:
>
> int shift= (uint32_t)inbuffer & 3;
> uint32_t *buf =  inbuffer - shift;
> uint32_t *obuf= outbuffer;
> uint32_t c= be2me_32((0x37c511f2>>(shift*8)) |
> (0x37c511f2<<(32-(shift*8))));
> bytes += 3+shift;
> for(i=0; i<bytes; i++)
>     obuf[i] = c^buf[i];
>
> return shift;
>
> and check that the outbuffer is allocated large enough for this ...

OK, thanks for spelling it out.
Done.


> the remainder of patch 1 looks ok

Great.


>> +    /* Swap current and previous gains */
>> +    tmp = gain_ptr[0];
>> +    gain_ptr[0] = gain_ptr[1];
>> +    gain_ptr[1] = tmp;
>
> FFSWAP()

Done.


>> +    /* Clip and convert floats to 16 bits.
>> +     */
>> +    for (j = 0; j < q->samples_per_frame; j++) {
>> +        value = lrintf(q->mono_mdct_output[j]);
>> +        if (value < -32768) value = -32768;
>> +        else if (value > 32767) value = 32767;
>
> clip()

Done.


> also note that Benjamin Larsson is maintainer of cook* so his oppinion is
> what matters (especially for patch 2 which looks nice but i didnt check
> that it is correct, as benjamin can probably do this quicker then me ...)

Sure.


Cheers,
Ian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch1
Type: application/octet-stream
Size: 6196 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070125/91a4ef44/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch2
Type: application/octet-stream
Size: 11271 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070125/91a4ef44/attachment-0001.obj>



More information about the ffmpeg-devel mailing list