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

Michael Niedermayer michaelni
Mon Nov 9 14:45:38 CET 2009


On Sun, Nov 08, 2009 at 10:51:53PM -0500, Justin Ruggles wrote:
> Michael Niedermayer wrote:
> 
> > On Sun, Nov 08, 2009 at 03:29:47PM -0500, Justin Ruggles wrote:
> >> 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?
> > 
> > i think your LL addition fixes a rounding bug
> 
> well, here is a patch with just the LL addition and all the resulting
> regression test changes.
> 
> -Justin
> 

>  rotozoom.regression.ref |  120 ++++++++++++++++++++++++------------------------
>  tiny_psnr.c             |    2 
>  vsynth.regression.ref   |  120 ++++++++++++++++++++++++------------------------
>  3 files changed, 121 insertions(+), 121 deletions(-)
> 783b1807fb88e335cc55467eadb6eb9acae0545b  tiny_psnr_rounding.patch

ok

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091109/e26f24f3/attachment.pgp>



More information about the ffmpeg-devel mailing list