<div dir="ltr">nice, we need a primitive for maxLumaLevel.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 12, 2015 at 3:54 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 1439331239 25200<br>
# Node ID 66b7f9300b8c392df7f1d597bec0fd099071c1af<br>
# Parent  aeae99c6c24580b510cdaf119bb6921f62c78368<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 aeae99c6c245 -r 66b7f9300b8c source/encoder/frameencoder.cpp<br>
--- a/source/encoder/frameencoder.cpp   Tue Aug 11 15:13:55 2015 -0700<br>
+++ b/source/encoder/frameencoder.cpp   Tue Aug 11 15:13:59 2015 -0700<br>
@@ -991,13 +991,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>