<div dir="ltr">Thanks, much cleaner. Queued.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Aug 6, 2015 at 10:32 AM,  <span dir="ltr"><<a href="mailto:kavitha@multicorewareinc.com" target="_blank">kavitha@multicorewareinc.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"># HG changeset patch<br>
# User Kavitha Sampath <<a href="mailto:kavitha@multicorewareinc.com">kavitha@multicorewareinc.com</a>><br>
# Date 1438837146 -19800<br>
#      Thu Aug 06 10:29:06 2015 +0530<br>
# Node ID 9fcc0e6bdc54758478e37e988e640fb52303d28b<br>
# Parent  377a996a8d74110f838ff2e3cef1c42781d6d730<br>
stats: use input source pictures to calculate avgerage and max luma level<br>
<br>
diff -r 377a996a8d74 -r 9fcc0e6bdc54 source/encoder/frameencoder.cpp<br>
--- a/source/encoder/frameencoder.cpp   Wed Aug 05 15:09:14 2015 +0530<br>
+++ b/source/encoder/frameencoder.cpp   Thu Aug 06 10:29:06 2015 +0530<br>
@@ -988,16 +988,17 @@<br>
             for (int n = 0; n < INTRA_MODES; n++)<br>
                 curRow.rowStats.cuIntraDistribution[depth][n] += frameLog.cuIntraDistribution[depth][n];<br>
         }<br>
-        uint64_t ctuLumaLevel = 0;<br>
-        uint64_t ctuNoOfPixels = 0;<br>
-        for (uint32_t i = 0; i < (best.reconYuv.m_size * best.reconYuv.m_size); i++)<br>
+<br>
+        /* calculate maximum and average luma levels */<br>
+        uint32_t ctuLumaLevel = 0;<br>
+        uint32_t ctuNoOfPixels = best.fencYuv->m_size * best.fencYuv->m_size;<br>
+        for (uint32_t i = 0; i < ctuNoOfPixels; i++)<br>
         {<br>
-            ctuLumaLevel += *(best.reconYuv.m_buf[0] + i);<br>
-            ctuNoOfPixels++;<br>
-            if ((*(best.reconYuv.m_buf[0] + i)) > curRow.rowStats.maxLumaLevel)<br>
-                curRow.rowStats.maxLumaLevel = *(best.reconYuv.m_buf[0] + i);<br>
+            pixel p = best.fencYuv->m_buf[0][i];<br>
+            ctuLumaLevel += p;<br>
+            curRow.rowStats.maxLumaLevel = X265_MAX(p, curRow.rowStats.maxLumaLevel);<br>
         }<br>
-        curRow.rowStats.lumaLevel += (double)(ctuLumaLevel / ctuNoOfPixels);<br>
+        curRow.rowStats.lumaLevel += (double)(ctuLumaLevel) / ctuNoOfPixels;<br>
<br>
         curEncData.m_cuStat[cuAddr].totalBits = best.totalBits;<br>
         x265_emms();<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" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
</blockquote></div><br></div>