[x265] [PATCH 2 of 5] added states for storing ssim values per frame and globally at ecoder level
Steve Borho
steve at borho.org
Mon Sep 30 21:43:45 CEST 2013
On Fri, Sep 27, 2013 at 11:52 PM, Aarthi Thirumalai <
aarthi at multicorewareinc.com> wrote:
> # HG changeset patch
> # User Aarthi Thirumalai
> # Date 1380342678 -19800
> # Sat Sep 28 10:01:18 2013 +0530
> # Node ID f8684226fc3aa8b94f698381b628412bfa63b6cc
> # Parent 0fa415d022c56451e6580c5b2bee793498d986c8
> added states for storing ssim values per frame and globally at ecoder
> level.
>
> diff -r 0fa415d022c5 -r f8684226fc3a source/Lib/TLibCommon/TComSlice.cpp
> --- a/source/Lib/TLibCommon/TComSlice.cpp Sat Sep 28 09:54:14 2013
> +0530
> +++ b/source/Lib/TLibCommon/TComSlice.cpp Sat Sep 28 10:01:18 2013
> +0530
> @@ -128,6 +128,8 @@
> m_cabacInitFlag = false;
> m_numEntryPointOffsets = 0;
> m_enableTMVPFlag = true;
> + m_ssim = 0;
> + m_ssimCnt = 0;
> }
>
> bool TComSlice::getRapPicFlag()
> diff -r 0fa415d022c5 -r f8684226fc3a source/Lib/TLibCommon/TComSlice.h
> --- a/source/Lib/TLibCommon/TComSlice.h Sat Sep 28 09:54:14 2013 +0530
> +++ b/source/Lib/TLibCommon/TComSlice.h Sat Sep 28 10:01:18 2013 +0530
> @@ -1438,6 +1438,10 @@
> MotionReference * m_mref[2][MAX_NUM_REF + 1];
> wpScalingParam m_weightPredTable[2][MAX_NUM_REF][3]; //
> [REF_PIC_LIST_0 or REF_PIC_LIST_1][refIdx][0:Y, 1:U, 2:V]
>
> + /* SSIM values per frame */
> + double m_ssim;
> + int m_ssimCnt;
> +
> TComSlice();
> virtual ~TComSlice();
> void initSlice();
> diff -r 0fa415d022c5 -r f8684226fc3a source/Lib/TLibEncoder/TEncTop.h
> --- a/source/Lib/TLibEncoder/TEncTop.h Sat Sep 28 09:54:14 2013 +0530
> +++ b/source/Lib/TLibEncoder/TEncTop.h Sat Sep 28 10:01:18 2013 +0530
> @@ -87,6 +87,7 @@
>
> // quality control
> TComScalingList m_scalingList; ///< quantization matrix
> information
> + double m_globalSsim;
>
> public:
>
> @@ -105,6 +106,8 @@
>
> int getStreamHeaders(NALUnitEBSP **nalunits);
>
> + double getSSIM() { return m_globalSsim/m_analyzeAll.getNumPic(); }
>
getNumPic() could return zero, this function must check for it
> +
> double printSummary();
>
> TComScalingList* getScalingList() { return &m_scalingList; }
> diff -r 0fa415d022c5 -r f8684226fc3a source/x265.cpp
> --- a/source/x265.cpp Sat Sep 28 09:54:14 2013 +0530
> +++ b/source/x265.cpp Sat Sep 28 10:01:18 2013 +0530
> @@ -571,7 +571,8 @@
> fprintf(stderr, "
> \r");
>
> double PSNR = 0.0;
> - x265_encoder_close(encoder, &PSNR);
> + double SSIM = 0.0;
> + x265_encoder_close(encoder, &PSNR , &SSIM);
>
This is an API change but this patch is not changing x265.h
Adding a parameter to an existing (published) function is something we
can't do lightly.
It would be better to add a new function to query encoder statistics and
could be called just before x265_encoder_close().
> cliopt.bitstreamFile.close();
>
> if (b_ctrl_c)
> @@ -580,9 +581,14 @@
> double elapsed = (double)(x265_mdate() - cliopt.i_start) / 1000000;
> double vidtime = (double)inFrameCount / param.frameRate;
> double bitrate = (0.008f * cliopt.totalBytes) / vidtime;
> - printf("\nencoded %d frames in %.2fs (%.2f fps), %.2f kb/s, Global
> PSNR: %.3f\n",
> - outFrameCount, elapsed, outFrameCount / elapsed, bitrate,
> PSNR);
> -
> + printf("\nencoded %d frames in %.2fs (%.2f fps), %.2f kb/s,",
> + outFrameCount, elapsed, outFrameCount / elapsed, bitrate);
> + if(param.bEnablePsnr)
> + printf(" Global PSNR: %.3f\n",
> + PSNR);
> + if(param.bEnableSsim)
> + printf(" Global SSIM: %.3f\n",
> + SSIM);
>
white space if (), the printfs() can be on one line if they fit (which
these do)
> x265_cleanup(); /* Free library singletons */
>
> if (cliopt.csvfp)
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>
--
Steve Borho
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20130930/60812957/attachment-0001.html>
More information about the x265-devel
mailing list