[x265] [PATCH 3 of 5] compute global ssim /psnr if their respective knobs are turned ON
Steve Borho
steve at borho.org
Mon Sep 30 21:47:09 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 1380343364 -19800
> # Sat Sep 28 10:12:44 2013 +0530
> # Node ID 1d27b6c649ab4580b1fef5ff8b65bb3e1ffa83b6
> # Parent f8684226fc3aa8b94f698381b628412bfa63b6cc
> compute global ssim /psnr if their respective knobs are turned ON
>
> diff -r f8684226fc3a -r 1d27b6c649ab source/Lib/TLibEncoder/TEncTop.cpp
> --- a/source/Lib/TLibEncoder/TEncTop.cpp Sat Sep 28 10:01:18 2013
> +0530
> +++ b/source/Lib/TLibEncoder/TEncTop.cpp Sat Sep 28 10:12:44 2013
> +0530
> @@ -70,6 +70,7 @@
> m_frameEncoder = NULL;
> m_rateControl = NULL;
> m_dpb = NULL;
> + m_globalSsim = 0;
>
> #if ENC_DEC_TRACE
> g_hTrace = fopen("TraceEnc.txt", "wb");
> @@ -493,7 +494,7 @@
> int width = recon->getWidth() - getPad(0);
> int height = recon->getHeight() - getPad(1);
> int size = width * height;
> -
> + double ssim = 0;
> UInt64 ssdY = computeSSD(orig->getLumaAddr(), recon->getLumaAddr(),
> stride, width, height);
>
> height >>= 1;
> @@ -585,6 +586,13 @@
> m_analyzeB.addResult(psnrY, psnrU, psnrV, (double)bits);
> }
>
> + if (param.bEnableSsim)
> + {
> + ssim += pic->getSlice()->m_ssim / pic->getSlice()->m_ssimCnt;
> + m_globalSsim += ssim;
> + }
> +
> +
> if (param.logLevel >= X265_LOG_DEBUG)
> {
> char c = (slice->isIntra() ? 'I' : slice->isInterP() ? 'P' : 'B');
> @@ -599,7 +607,11 @@
> slice->getSliceQp(),
> bits);
>
> - fprintf(stderr, " [Y:%6.2lf U:%6.2lf V:%6.2lf]", psnrY, psnrU,
> psnrV);
> + if(param.bEnablePsnr)
> + fprintf(stderr, " [Y:%6.2lf U:%6.2lf V:%6.2lf]", psnrY,
> psnrU, psnrV);
>
white-space
> +
> + if(param.bEnableSsim)
> + fprintf(stderr, " SSIM Y:%.5f ",ssim);
>
> if (!slice->isIntra())
> {
> diff -r f8684226fc3a -r 1d27b6c649ab source/encoder/encoder.cpp
> --- a/source/encoder/encoder.cpp Sat Sep 28 10:01:18 2013 +0530
> +++ b/source/encoder/encoder.cpp Sat Sep 28 10:12:44 2013 +0530
> @@ -429,13 +429,16 @@
> EXTERN_CYCLE_COUNTER(ME);
>
> extern "C"
> -void x265_encoder_close(x265_t *encoder, double *outPsnr)
> +void x265_encoder_close(x265_t *encoder, double *outPsnr, double *outSsim)
> {
> double globalPsnr = encoder->printSummary();
>
> if (outPsnr)
> *outPsnr = globalPsnr;
>
> + if (outSsim)
> + *outSsim = encoder->getSSIM();
> +
> REPORT_CYCLE_COUNTER(ME);
>
> encoder->destroy();
> diff -r f8684226fc3a -r 1d27b6c649ab source/x265.h
> --- a/source/x265.h Sat Sep 28 10:01:18 2013 +0530
> +++ b/source/x265.h Sat Sep 28 10:12:44 2013 +0530
> @@ -346,7 +346,7 @@
>
> /* x265_encoder_close:
> * close an encoder handler. Optionally return the global PSNR
> value (6 * psnrY + psnrU + psnrV) / 8 */
> -void x265_encoder_close(x265_t *, double *globalPsnr);
> +void x265_encoder_close(x265_t *, double *globalPsnr, double
> *globalSsim);
>
Previous comments apply. It would be better to make a new function to
query stats. Ideally the stats would be returned via a structure defined
in x265.h
--
Steve Borho
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20130930/4e5fceff/attachment.html>
More information about the x265-devel
mailing list