<div dir="ltr"><div>Kavitha, <br><br></div>Can you please pull this neat optimization of Min's into picyuv::copyFromPicture?<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Aug 13, 2015 at 8:52 AM, Min Chen <span dir="ltr"><<a href="mailto:chenm003@163.com" target="_blank">chenm003@163.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 Min Chen <<a href="mailto:chenm003@163.com">chenm003@163.com</a>><br>
# Date 1439423217 25200<br>
# Node ID 09846d1566428a73d70d2fcf2d50324c0dfbbb7f<br>
# Parent  f627a263bb5c1dcf274ab281a02670449ae891fc<br>
improve ctuLumaLevel logic by Sad and CMOV<br>
---<br>
 source/encoder/frameencoder.cpp |    7 ++++---<br>
 1 files changed, 4 insertions(+), 3 deletions(-)<br>
<br>
diff -r f627a263bb5c -r 09846d156642 source/encoder/frameencoder.cpp<br>
--- a/source/encoder/frameencoder.cpp   Wed Aug 12 16:35:27 2015 -0700<br>
+++ b/source/encoder/frameencoder.cpp   Wed Aug 12 16:46:57 2015 -0700<br>
@@ -992,13 +992,14 @@<br>
         }<br>
<br>
         /* calculate maximum and average luma levels */<br>
-        uint32_t ctuLumaLevel = 0;<br>
+        static const pixel dummy_zero[MAX_CU_SIZE] = {0};<br>
+        uint32_t ctuLumaLevel = primitives.pu[best.fencYuv->m_part].sad(best.fencYuv->m_buf[0], best.fencYuv->m_size, dummy_zero, 0);<br>
         uint32_t ctuNoOfPixels = best.fencYuv->m_size * best.fencYuv->m_size;<br>
         for (uint32_t i = 0; i < ctuNoOfPixels; i++)<br>
         {<br>
             pixel p = best.fencYuv->m_buf[0][i];<br>
-            ctuLumaLevel += p;<br>
-            curRow.rowStats.maxLumaLevel = X265_MAX(p, curRow.rowStats.maxLumaLevel);<br>
+            if (p > curRow.rowStats.maxLumaLevel)<br>
+                curRow.rowStats.maxLumaLevel = p;<br>
         }<br>
         curRow.rowStats.lumaLevel += (double)(ctuLumaLevel) / ctuNoOfPixels;<br>
<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" rel="noreferrer" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
</blockquote></div><br></div>