[x265] [PATCH] bug fix: print Mean psnr Y,U,V properly

Steve Borho steve at borho.org
Wed Nov 20 18:03:10 CET 2013


On Nov 20, 2013, at 4:39 AM, santhoshini at multicorewareinc.com wrote:

> # HG changeset patch
> # User Santhoshini Sekar <santhoshini at multicorewareinc.com>
> # Date 1384943798 -19800
> #      Wed Nov 20 16:06:38 2013 +0530
> # Node ID 2dec17a0b506c99a1ee8ecb23a582cb308de7724
> # Parent  108ddc9e5c6b15e758ccbf08a0e923cbb7b28b5e
> bug fix: print Mean psnr Y,U,V properly
> 
> diff -r 108ddc9e5c6b -r 2dec17a0b506 source/encoder/encoder.cpp
> --- a/source/encoder/encoder.cpp	Tue Nov 19 23:45:52 2013 -0600
> +++ b/source/encoder/encoder.cpp	Wed Nov 20 16:06:38 2013 +0530
> @@ -336,20 +336,18 @@
> {
>     double fps = (double)param.frameRate;
>     double scale = fps / 1000 / (double)stat.m_numPics;
> -    int len = sprintf(buffer, "%-6d ", stat.m_numPics);
> -
> -    sprintf(buffer + len, "kb/s: %-8.2lf", stat.m_accBits * scale);
> -
> +    sprintf(buffer, "%-6d ", stat.m_numPics);
> +    sprintf(buffer + strlen(buffer), "kb/s: %-8.2lf", stat.m_accBits * scale);

a better fix for this would be to use increments:

int len = sprintf(buffer, "%-6d ", stat.m_numPics);
len += sprintf(buffer + len, "kb/s: %-8.2lf", stat.m_accBits * scale);

>     if (param.bEnablePsnr)
>     {
> -        len = sprintf(buffer + len, " PSNR Mean: Y:%.3lf U:%.3lf V:%.3lf",
> +        sprintf(buffer + strlen(buffer), " PSNR Mean: Y:%.3lf U:%.3lf V:%.3lf",
>                       stat.m_psnrSumY / (double)stat.m_numPics,
>                       stat.m_psnrSumU / (double)stat.m_numPics,
>                       stat.m_psnrSumV / (double)stat.m_numPics);
>     }
>     if (param.bEnableSsim)
>     {
> -        sprintf(buffer + len, " SSIM Mean: %.3lf",
> +        sprintf(buffer + strlen(buffer), " SSIM Mean: %.3lf",
>                 stat.m_globalSsim / (double)stat.m_numPics);
>     }
>     return buffer;
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 842 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20131120/763793b8/attachment-0001.sig>


More information about the x265-devel mailing list