[FFmpeg-devel] [PATCH] make tiny_psnr work with 32-bit audio

Måns Rullgård mans
Sun Nov 8 22:00:28 CET 2009


Justin Ruggles <justin.ruggles at gmail.com> writes:

> Justin Ruggles wrote:
>
>> Hi,
>> 
>> I was trying to do some comparisons with 32-bit audio, but tiny_psnr
>> kept crashing with a float exception.  Then I noticed it does not really
>> support 32-bit integer comparisons.  The attached patch seems to work.
>> 
>> -Justin
>
> Hmmm...  Most of the regression tests fail with this patch because of:
>
> -        psnr= ((2*log16(max<<16) + log16(i) - log16(sse))*284619LL*F +
> (1<<31)) / (1LL<<32);
> +        psnr= ((2*log16(max<<16) + log16(i) - log16(sse))*284619LL*F +
> (1LL<<31)) / (1LL<<32);
>
> Looking at an objdump of tiny_psnr.o, it appears that the compiler is
> treating (1 << 31) as a 32-bit integer (with a negative value), then
> sign extending it to 64-bit.  Is that what is meant to happen?

That is correct operation of the compiler.  I have no idea if that was
what the author of this code intended.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list