<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Nov 3, 2013 at 9:11 PM, <span dir="ltr"><<a href="mailto:santhoshini@multicorewareinc.com" target="_blank">santhoshini@multicorewareinc.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"># HG changeset patch<br>
# User Santhoshini Sekar <<a href="mailto:santhoshini@multicorewareinc.com">santhoshini@multicorewareinc.com</a>><br>
# Date 1383209712 -19800<br>
# Thu Oct 31 14:25:12 2013 +0530<br>
# Node ID 8bed3004d0b92ce257f68569a7d3c7532e141d9e<br>
# Parent ec6b4d35f11053b06d0e1ea46df798ff89a4c127<br>
collect global stats of psnr and ssim<br>
<br>
diff -r ec6b4d35f110 -r 8bed3004d0b9 source/Lib/TLibCommon/TComPic.cpp<br>
--- a/source/Lib/TLibCommon/TComPic.cpp Thu Oct 31 00:09:49 2013 -0500<br>
+++ b/source/Lib/TLibCommon/TComPic.cpp Thu Oct 31 14:25:12 2013 +0530<br>
@@ -65,6 +65,8 @@<br>
m_SSDY = 0;<br>
m_SSDU = 0;<br>
m_SSDV = 0;<br>
+ m_ssim = 0;<br>
+ m_ssimCnt = 0;<br>
m_frameTime = 0.0;<br>
m_elapsedCompressTime = 0.0;<br>
}<br>
diff -r ec6b4d35f110 -r 8bed3004d0b9 source/Lib/TLibCommon/TComPic.h<br>
--- a/source/Lib/TLibCommon/TComPic.h Thu Oct 31 00:09:49 2013 -0500<br>
+++ b/source/Lib/TLibCommon/TComPic.h Thu Oct 31 14:25:12 2013 +0530<br>
@@ -93,9 +93,13 @@<br>
double m_elapsedCompressTime;<br>
double m_frameTime;<br>
MD5Context m_state[3];<br>
- uint32_t m_crc[3];<br>
- uint32_t m_checksum[3];<br>
-<br>
+ uint32_t m_crc[3];<br>
+ uint32_t m_checksum[3];<br>
+<br>
+ /* SSIM values per frame */<br>
+ double m_ssim;<br>
+ int m_ssimCnt;<br>
+<br>
TComPic();<br>
virtual ~TComPic();<br>
<br>
diff -r ec6b4d35f110 -r 8bed3004d0b9 source/Lib/TLibCommon/TComSlice.cpp<br>
--- a/source/Lib/TLibCommon/TComSlice.cpp Thu Oct 31 00:09:49 2013 -0500<br>
+++ b/source/Lib/TLibCommon/TComSlice.cpp Thu Oct 31 14:25:12 2013 +0530<br>
@@ -120,8 +120,6 @@<br>
m_cabacInitFlag = false;<br>
m_numEntryPointOffsets = 0;<br>
m_enableTMVPFlag = true;<br>
- m_ssim = 0;<br>
- m_ssimCnt = 0;<br>
m_numWPRefs = 0;<br>
}<br>
<br>
diff -r ec6b4d35f110 -r 8bed3004d0b9 source/Lib/TLibCommon/TComSlice.h<br>
--- a/source/Lib/TLibCommon/TComSlice.h Thu Oct 31 00:09:49 2013 -0500<br>
+++ b/source/Lib/TLibCommon/TComSlice.h Thu Oct 31 14:25:12 2013 +0530<br>
@@ -1341,10 +1341,6 @@<br>
wpScalingParam m_weightPredTable[2][MAX_NUM_REF][3]; // [REF_PIC_LIST_0 or REF_PIC_LIST_1][refIdx][0:Y, 1:U, 2:V]<br>
int m_numWPRefs; // number of references for which unidirectional weighted prediction is used<br>
<br>
- /* SSIM values per frame */<br>
- double m_ssim;<br>
- int m_ssimCnt;<br>
-<br>
TComSlice();<br>
virtual ~TComSlice();<br>
void initSlice();<br></blockquote><div><br></div><div>when a file is deleted you must remove it from its cmake list</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
diff -r ec6b4d35f110 -r 8bed3004d0b9 source/Lib/TLibEncoder/TEncAnalyze.h<br>
--- a/source/Lib/TLibEncoder/TEncAnalyze.h Thu Oct 31 00:09:49 2013 -0500<br>
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000<br>
@@ -1,157 +0,0 @@<br>
-/* The copyright in this software is being made available under the BSD<br>
- * License, included below. This software may be subject to other third party<br>
- * and contributor rights, including patent rights, and no such rights are<br>
- * granted under this license.<br>
- *<br>
- * Copyright (c) 2010-2013, ITU/ISO/IEC<br>
- * All rights reserved.<br>
- *<br>
- * Redistribution and use in source and binary forms, with or without<br>
- * modification, are permitted provided that the following conditions are met:<br>
- *<br>
- * * Redistributions of source code must retain the above copyright notice,<br>
- * this list of conditions and the following disclaimer.<br>
- * * Redistributions in binary form must reproduce the above copyright notice,<br>
- * this list of conditions and the following disclaimer in the documentation<br>
- * and/or other materials provided with the distribution.<br>
- * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may<br>
- * be used to endorse or promote products derived from this software without<br>
- * specific prior written permission.<br>
- *<br>
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"<br>
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE<br>
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE<br>
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS<br>
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR<br>
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF<br>
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS<br>
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN<br>
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)<br>
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF<br>
- * THE POSSIBILITY OF SUCH DAMAGE.<br>
- */<br>
-<br>
-/** \file TEncAnalyze.h<br>
- \brief encoder analyzer class (header)<br>
-*/<br>
-<br>
-#ifndef X265_TENCANALYZE_H<br>
-#define X265_TENCANALYZE_H<br>
-<br>
-#include "TLibCommon/CommonDef.h"<br>
-<br>
-#include <stdio.h><br>
-#include <memory.h><br>
-#include <assert.h><br>
-<br>
-namespace x265 {<br>
-// private namespace<br>
-<br>
-/// encoder analyzer class<br>
-class TEncAnalyze<br>
-{<br>
-private:<br>
-<br>
- double m_psnrSumY;<br>
- double m_psnrSumU;<br>
- double m_psnrSumV;<br>
- double m_accBits;<br>
- uint32_t m_numPics;<br>
-<br>
-public:<br>
-<br>
- TEncAnalyze() { m_psnrSumY = m_psnrSumU = m_psnrSumV = m_accBits = m_numPics = 0; }<br>
-<br>
- void addResult(double psnrY, double psnrU, double psnrV, double bits)<br>
- {<br>
- m_psnrSumY += psnrY;<br>
- m_psnrSumU += psnrU;<br>
- m_psnrSumV += psnrV;<br>
- m_accBits += bits;<br>
- m_numPics++;<br>
- }<br>
-<br>
- double getPsnrY() { return m_psnrSumY; }<br>
-<br>
- double getPsnrU() { return m_psnrSumU; }<br>
-<br>
- double getPsnrV() { return m_psnrSumV; }<br>
-<br>
- double getBits() { return m_accBits; }<br>
-<br>
- uint32_t getNumPic() { return m_numPics; }<br>
-<br>
- void clear() { m_psnrSumY = m_psnrSumU = m_psnrSumV = m_accBits = m_numPics = 0; }<br>
-<br>
- void printOut(char delim, double fps)<br>
- {<br>
- double scale = fps / 1000 / (double)m_numPics;<br>
-<br>
- if (m_numPics == 0)<br>
- return;<br>
-<br>
- if (delim == 'a')<br>
- fprintf(stderr, "x265 [info]: global: ");<br>
- else<br>
- fprintf(stderr, "x265 [info]: frame %c:%-6d ", delim - 32, m_numPics);<br>
- fprintf(stderr, "kb/s: %-8.2lf PSNR Mean: Y:%.3lf U:%.3lf V:%.3lf\n",<br>
- getBits() * scale,<br>
- getPsnrY() / (double)getNumPic(),<br>
- getPsnrU() / (double)getNumPic(),<br>
- getPsnrV() / (double)getNumPic());<br>
- }<br>
-<br>
- void printSummaryOut(double fps)<br>
- {<br>
- FILE* fp = fopen("summaryTotal.txt", "at");<br>
-<br>
- if (fp)<br>
- {<br>
- double scale = fps / 1000 / (double)m_numPics;<br>
-<br>
- fprintf(fp, "%f\t %f\t %f\t %f\n", getBits() * scale,<br>
- getPsnrY() / (double)getNumPic(),<br>
- getPsnrU() / (double)getNumPic(),<br>
- getPsnrV() / (double)getNumPic());<br>
-<br>
- fclose(fp);<br>
- }<br>
- }<br>
-<br>
- void printSummary(char ch, double fps)<br>
- {<br>
- FILE* fp = NULL;<br>
-<br>
- switch (ch)<br>
- {<br>
- case 'I':<br>
- fp = fopen("summary_I.txt", "at");<br>
- break;<br>
- case 'P':<br>
- fp = fopen("summary_P.txt", "at");<br>
- break;<br>
- case 'B':<br>
- fp = fopen("summary_B.txt", "at");<br>
- break;<br>
- default:<br>
- assert(0);<br>
- return;<br>
- }<br>
-<br>
- if (fp)<br>
- {<br>
- double scale = fps / 1000 / (double)m_numPics;<br>
-<br>
- fprintf(fp, "%f\t %f\t %f\t %f\n",<br>
- getBits() * scale,<br>
- getPsnrY() / (double)getNumPic(),<br>
- getPsnrU() / (double)getNumPic(),<br>
- getPsnrV() / (double)getNumPic());<br>
-<br>
- fclose(fp);<br>
- }<br>
- }<br>
-};<br>
-}<br>
-<br>
-#endif // ifndef X265_TENCANALYZE_H<br>
diff -r ec6b4d35f110 -r 8bed3004d0b9 source/encoder/encoder.cpp<br>
--- a/source/encoder/encoder.cpp Thu Oct 31 00:09:49 2013 -0500<br>
+++ b/source/encoder/encoder.cpp Thu Oct 31 14:25:12 2013 +0530<br>
@@ -57,7 +57,6 @@<br>
m_frameEncoder = NULL;<br>
m_rateControl = NULL;<br>
m_dpb = NULL;<br>
- m_globalSsim = 0;<br>
m_nals = NULL;<br>
m_packetData = NULL;<br>
m_outputCount = 0;<br>
@@ -315,20 +314,98 @@<br>
return ret;<br>
}<br>
<br>
+void EncStats::addPsnr(double psnrY, double psnrU, double psnrV)<br>
+{<br>
+ m_psnrSumY += psnrY;<br>
+ m_psnrSumU += psnrU;<br>
+ m_psnrSumV += psnrV;<br>
+}<br>
+<br>
+void EncStats::addBits(double bits)<br>
+{<br>
+ m_accBits += bits;<br>
+ m_numPics++;<br>
+}<br>
+<br>
+void EncStats::addSsim(double ssim)<br>
+{<br>
+ m_globalSsim += ssim;<br>
+}<br>
+<br>
void Encoder::printSummary()<br>
{<br>
double fps = (double)param.frameRate;<br>
<br>
if (param.logLevel >= X265_LOG_INFO)<br>
{<br>
- m_analyzeI.printOut('i', fps);<br>
- m_analyzeP.printOut('p', fps);<br>
- m_analyzeB.printOut('b', fps);<br>
- m_analyzeAll.printOut('a', fps);<br></blockquote><div><br></div><div>this is a gob of code repeated three times. This should be a helper method </div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
+ double scale = fps / 1000 / (double)m_analyzeI.m_numPics;<br>
+<br>
+ fprintf(stderr, "\n x265 [info]: frame %c:%-6d ", 'i' - 32, m_analyzeI.m_numPics);<br></blockquote><div><br></div><div>why is there a leading line feed and space? The 'i'-32 is just making a capital I</div>
<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
+ fprintf(stderr, "kb/s: %-8.2lf", m_analyzeI.m_accBits * scale);<br>
+ if (param.bEnablePsnr)<br>
+ {<br>
+ fprintf(stderr, " PSNR Mean: Y:%.3lf U:%.3lf V:%.3lf",<br>
+ m_analyzeI.m_psnrSumY / (double)m_analyzeI.m_numPics,<br>
+ m_analyzeI.m_psnrSumU / (double)m_analyzeI.m_numPics,<br>
+ m_analyzeI.m_psnrSumV / (double)m_analyzeI.m_numPics);<br>
+ }<br>
+ if (param.bEnableSsim)<br>
+ {<br>
+ fprintf(stderr, " SSIM Mean: %.3lf \n",<br>
+ m_analyzeI.m_globalSsim / (double)m_analyzeI.m_numPics);<br>
+ }<br>
+ scale = fps / 1000 / (double)m_analyzeP.m_numPics;<br></blockquote><div><br></div><div>why is there only a trailing line fee if SSIM is enabled?</div><div><br></div><div>This should be boiled down to something like:</div>
<div><br></div><div>if (m_analyzeI.m_numPics)</div><div> fprintf(stderr, "\x265 [info]: frame I: %s\n", m_analyzeP.statsString());</div><div>if (m_analyzeP.m_numPics)</div><div> fprintf(stderr, "\x265 [info]: frame P: %s\n", m_analyzeP.statsString());</div>
<div><div>if (m_analyzeP.m_numPics)</div><div> fprintf(stderr, "\x265 [info]: frame B: %s\n", m_analyzeB.statsString());</div></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
+<br>
+ fprintf(stderr, "\n x265 [info]: frame %c:%-6d ", 'p' - 32, m_analyzeP.m_numPics);<br>
+ fprintf(stderr, "kb/s: %-8.2lf", m_analyzeP.m_accBits * scale);<br>
+ if (param.bEnablePsnr)<br>
+ {<br>
+ fprintf(stderr, " PSNR Mean: Y:%.3lf U:%.3lf V:%.3lf",<br>
+ m_analyzeP.m_psnrSumY / (double)m_analyzeP.m_numPics,<br>
+ m_analyzeP.m_psnrSumU / (double)m_analyzeP.m_numPics,<br>
+ m_analyzeP.m_psnrSumV / (double)m_analyzeP.m_numPics);<br>
+ }<br>
+ if (param.bEnableSsim)<br>
+ {<br>
+ fprintf(stderr, " SSIM Mean: %.3lf \n",<br>
+ m_analyzeP.m_globalSsim / (double)m_analyzeP.m_numPics);<br>
+ }<br>
+ scale = fps / 1000 / (double)m_analyzeB.m_numPics;<br>
+<br>
+ fprintf(stderr, "\n x265 [info]: frame %c:%-6d ", 'b' - 32, m_analyzeB.m_numPics);<br>
+ fprintf(stderr, "kb/s: %-8.2lf", m_analyzeB.m_accBits * scale);<br>
+ if (param.bEnablePsnr)<br>
+ {<br>
+ fprintf(stderr, " PSNR Mean: Y:%.3lf U:%.3lf V:%.3lf",<br>
+ m_analyzeB.m_psnrSumY / (double)m_analyzeB.m_numPics,<br>
+ m_analyzeB.m_psnrSumU / (double)m_analyzeB.m_numPics,<br>
+ m_analyzeB.m_psnrSumV / (double)m_analyzeB.m_numPics);<br>
+ }<br>
+ if (param.bEnableSsim)<br>
+ {<br>
+ fprintf(stderr, " SSIM Mean: %.3lf \n",<br>
+ m_analyzeB.m_globalSsim / (double)m_analyzeB.m_numPics);<br>
+ }<br>
+ scale = fps / 1000 / (double)m_analyzeAll.m_numPics;<br>
+<br>
+ fprintf(stderr, "\n x265 [info]: global: ");<br>
+ fprintf(stderr, "kb/s: %-8.2lf", m_analyzeAll.m_accBits * scale);<br>
+ if (param.bEnablePsnr)<br>
+ {<br>
+ fprintf(stderr, " PSNR Mean: Y:%.3lf U:%.3lf V:%.3lf",<br>
+ m_analyzeAll.m_psnrSumY / (double)m_analyzeAll.m_numPics,<br>
+ m_analyzeAll.m_psnrSumU / (double)m_analyzeAll.m_numPics,<br>
+ m_analyzeAll.m_psnrSumV / (double)m_analyzeAll.m_numPics);<br>
+ }<br>
+ if (param.bEnableSsim)<br>
+ {<br>
+ fprintf(stderr, " SSIM Mean: %.3lf \n",<br>
+ m_analyzeAll.m_globalSsim / (double)m_analyzeAll.m_numPics);<br>
+ }<br>
}<br>
if (param.bEnableWeightedPred)<br>
{<br>
- int numPFrames = m_analyzeP.getNumPic();<br>
+ int numPFrames = m_analyzeP.m_numPics;<br>
x265_log(¶m, X265_LOG_INFO, "%d of %d (%.2f%%) P frames weighted\n",<br>
m_numWPFrames, numPFrames, (float) 100.0 * m_numWPFrames / numPFrames);<br>
}<br>
@@ -336,16 +413,16 @@<br>
<br>
void Encoder::fetchStats(x265_stats *stats)<br>
{<br>
- stats->globalPsnrY = m_analyzeAll.getPsnrY();<br>
- stats->globalPsnrU = m_analyzeAll.getPsnrU();<br>
- stats->globalPsnrV = m_analyzeAll.getPsnrV();<br>
- stats->encodedPictureCount = m_analyzeAll.getNumPic();<br>
+ stats->globalPsnrY = m_analyzeAll.m_psnrSumY;<br>
+ stats->globalPsnrU = m_analyzeAll.m_psnrSumU;<br>
+ stats->globalPsnrV = m_analyzeAll.m_psnrSumV;<br>
+ stats->encodedPictureCount = m_analyzeAll.m_numPics;<br>
stats->totalWPFrames = m_numWPFrames;<br>
- stats->accBits = m_analyzeAll.getBits();<br>
+ stats->accBits = m_analyzeAll.m_accBits;<br>
stats->elapsedEncodeTime = (double)(x265_mdate() - m_encodeStartTime) / 1000000;<br>
if (stats->encodedPictureCount > 0)<br>
{<br>
- stats->globalSsim = m_globalSsim / stats->encodedPictureCount;<br>
+ stats->globalSsim = m_analyzeAll.m_globalSsim / stats->encodedPictureCount;<br>
stats->globalPsnr = (stats->globalPsnrY * 6 + stats->globalPsnrU + stats->globalPsnrV) / (8 * stats->encodedPictureCount);<br>
stats->elapsedVideoTime = (double)stats->encodedPictureCount / param.frameRate;<br>
stats->bitrate = (0.001f * stats->accBits) / stats->elapsedVideoTime;<br>
@@ -527,27 +604,60 @@<br>
<br>
uint32_t bits = numRBSPBytes * 8;<br>
<br>
- //===== add PSNR =====<br>
- m_analyzeAll.addResult(psnrY, psnrU, psnrV, (double)bits);<br>
- TComSlice* slice = pic->getSlice();<br>
- if (slice->isIntra())<br>
- {<br>
- m_analyzeI.addResult(psnrY, psnrU, psnrV, (double)bits);<br>
- }<br>
- if (slice->isInterP())<br>
- {<br>
- m_analyzeP.addResult(psnrY, psnrU, psnrV, (double)bits);<br>
- }<br>
- if (slice->isInterB())<br>
- {<br>
- m_analyzeB.addResult(psnrY, psnrU, psnrV, (double)bits);<br>
- }<br>
- double ssim = 0.0;<br>
- if (param.bEnableSsim && pic->getSlice()->m_ssimCnt > 0)<br>
- {<br>
- ssim = pic->getSlice()->m_ssim / pic->getSlice()->m_ssimCnt;<br>
- m_globalSsim += ssim;<br>
- }<br>
+ TComSlice* slice = pic->getSlice();<br>
+<br>
+ //===== add Bits and number of pics =====<br></blockquote><div><br></div><div>why is Bits capitalized?</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
+ m_analyzeAll.addBits((double)bits);<br>
+ if (slice->isIntra())<br>
+ {<br>
+ m_analyzeI.addBits((double)bits); </blockquote><div><br></div><div>this logic should be combined so that within this if it does:</div><div><br></div><div>if (param.bEnablePsnr) m_analyzeI.addPsnr(psnrY, psnrU, psnrV);<br>
</div><div>if (param.bEnableSsim) m_analyzeI.addSsim(ssim);</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
+ }<br>
+ if (slice->isInterP())<br></blockquote><div>else if </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
+ {<br>
+ m_analyzeP.addBits((double)bits);<br>
+ }<br>
+ if (slice->isInterB())<br></blockquote><div>else if </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
+ {<br>
+ m_analyzeB.addBits((double)bits);<br>
+ }<br>
+ //===== add PSNR =====<br>
+ if (param.bEnablePsnr)<br>
+ {<br>
+ m_analyzeAll.addPsnr(psnrY, psnrU, psnrV);<br>
+<br>
+ if (slice->isIntra())<br>
+ {<br>
+ m_analyzeI.addPsnr(psnrY, psnrU, psnrV);<br>
+ }<br>
+ if (slice->isInterP())<br>
+ {<br>
+ m_analyzeP.addPsnr(psnrY, psnrU, psnrV);<br>
+ }<br>
+ if (slice->isInterB())<br>
+ {<br>
+ m_analyzeB.addPsnr(psnrY, psnrU, psnrV);<br>
+ }<br>
+ }<br>
+ //===== add SSIM =====<br>
+ double ssim = 0.0;<br>
+ if (param.bEnableSsim && pic->m_ssimCnt > 0)<br>
+ {<br>
+ ssim = pic->m_ssim / pic->m_ssimCnt;<br>
+ m_analyzeAll.addSsim(ssim);<br>
+<br>
+ if (slice->isIntra())<br>
+ {<br>
+ m_analyzeI.addSsim(ssim);<br>
+ }<br>
+ if (slice->isInterP())<br>
+ {<br>
+ m_analyzeP.addSsim(ssim);<br>
+ }<br>
+ if (slice->isInterB())<br>
+ {<br>
+ m_analyzeB.addSsim(ssim);<br>
+ }<br>
+ }<br>
<br>
// if debug log level is enabled, per frame logging is performed<br>
if (param.logLevel >= X265_LOG_DEBUG)<br>
diff -r ec6b4d35f110 -r 8bed3004d0b9 source/encoder/encoder.h<br>
--- a/source/encoder/encoder.h Thu Oct 31 00:09:49 2013 -0500<br>
+++ b/source/encoder/encoder.h Thu Oct 31 14:25:12 2013 +0530<br>
@@ -27,12 +27,33 @@<br>
#include "x265.h"<br>
<br>
#include "TLibEncoder/TEncCfg.h"<br>
-#include "TLibEncoder/TEncAnalyze.h"<br>
<br>
#include "piclist.h"<br>
<br>
struct x265_encoder {};<br>
<br>
+struct EncStats<br>
+{<br>
+ double m_psnrSumY;<br>
+ double m_psnrSumU;<br>
+ double m_psnrSumV;<br>
+ double m_accBits;<br>
+ double m_globalSsim;<br>
+ uint32_t m_numPics;<br>
+<br>
+ EncStats()<br>
+ {<br>
+ m_psnrSumY = m_psnrSumU = m_psnrSumV = m_accBits = m_numPics = 0;<br>
+ m_globalSsim = 0;<br>
+ }<br>
+<br>
+ void addPsnr(double psnrY, double psnrU, double psnrV);<br>
+<br>
+ void addBits(double bits);<br>
+<br>
+ void addSsim(double ssim);<br>
+};<br>
+<br>
namespace x265 {<br>
// private namespace<br>
<br>
@@ -61,11 +82,10 @@<br>
int m_curEncoder;<br>
<br>
/* Collect statistics globally */<br>
- TEncAnalyze m_analyzeAll;<br>
- TEncAnalyze m_analyzeI;<br>
- TEncAnalyze m_analyzeP;<br>
- TEncAnalyze m_analyzeB;<br>
- double m_globalSsim;<br>
+ EncStats m_analyzeAll;<br>
+ EncStats m_analyzeI;<br>
+ EncStats m_analyzeP;<br>
+ EncStats m_analyzeB;<br>
FILE* m_csvfpt;<br>
int64_t m_encodeStartTime;<br>
<br>
diff -r ec6b4d35f110 -r 8bed3004d0b9 source/encoder/framefilter.cpp<br>
--- a/source/encoder/framefilter.cpp Thu Oct 31 00:09:49 2013 -0500<br>
+++ b/source/encoder/framefilter.cpp Thu Oct 31 14:25:12 2013 +0530<br>
@@ -317,9 +317,9 @@<br>
/* SSIM is done for each row in blocks of 4x4 . The First blocks are offset by 2 pixels to the right<br>
* to avoid alignment of ssim blocks with DCT blocks. */<br>
minPixY += bStart ? 2 : -6;<br>
- m_pic->getSlice()->m_ssim += calculateSSIM(rec + 2 + minPixY * stride1, stride1, org + 2 + minPixY * stride2, stride2,<br>
+ m_pic->m_ssim += calculateSSIM(rec + 2 + minPixY * stride1, stride1, org + 2 + minPixY * stride2, stride2,<br>
m_cfg->param.sourceWidth - 2, maxPixY - minPixY, m_ssimBuf, &ssim_cnt);<br>
- m_pic->getSlice()->m_ssimCnt += ssim_cnt;<br>
+ m_pic->m_ssimCnt += ssim_cnt;<br>
}<br>
if (m_cfg->param.decodedPictureHashSEI == 1)<br>
{<br>
_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Steve Borho
</div></div>