<div style="line-height:1.7;color:#000000;font-size:14px;font-family:arial"><div>Yes, the 'E*' depends on two of point and compare gradient between them, so we can pass two of pointer into asm code.</div><div><br>Who work on it?</div><div></div><div id="divNeteaseMailCard"></div><div><br></div>At 2015-10-07 17:08:47,"Ashok Kumar Mishra" <ashok@multicorewareinc.com> wrote:<br> <blockquote id="isReplyContent" style="margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-left-color: rgb(204, 204, 204); border-left-width: 1px; border-left-style: solid;"><div dir="ltr">Min, Now we have done the first improvement in SAO. The second one I believe we can write only two functions, <div>one for BO statistics and one for EO statistics using some data manipulation. So that we have<div>only two primitives for BO and EO. No need to write separate functions for each EO. Though it may not give</div><div>significant performance but the code will be in very good shape.</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 7, 2015 at 4:25 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: 0px 0px 0px 0.8ex; padding-left: 1ex; border-left-color: rgb(204, 204, 204); border-left-width: 1px; border-left-style: solid;"># HG changeset patch<br>
# User Min Chen <<a href="mailto:chenm003@163.com">chenm003@163.com</a>><br>
# Date 1444167726 18000<br>
# Node ID 36a54b2cf7c4c96067bafb67077651d30d83e8e9<br>
# Parent  8fdd1b8fd4529b6966ab787f6c624f6056f77593<br>
improve sao diff[] by primivites.sub_ps<br>
---<br>
 source/encoder/sao.cpp |   23 +++++++++++++++++------<br>
 source/encoder/sao.h   |    1 +<br>
 2 files changed, 18 insertions(+), 6 deletions(-)<br>
<br>
diff -r 8fdd1b8fd452 -r 36a54b2cf7c4 source/encoder/sao.cpp<br>
--- a/source/encoder/sao.cpp    Tue Oct 06 16:42:02 2015 -0500<br>
+++ b/source/encoder/sao.cpp    Tue Oct 06 16:42:06 2015 -0500<br>
@@ -106,6 +106,7 @@<br>
 bool SAO::create(x265_param* param)<br>
 {<br>
     m_param = param;<br>
+    m_chromaFormat = param->internalCsp;<br>
     m_hChromaShift = CHROMA_H_SHIFT(param->internalCsp);<br>
     m_vChromaShift = CHROMA_V_SHIFT(param->internalCsp);<br>
<br>
@@ -715,14 +716,24 @@<br>
     ALIGN_VAR_32(int16_t, diff[MAX_CU_SIZE * MAX_CU_SIZE]);<br>
<br>
     // Calculate (fenc - frec) and put into diff[]<br>
-    // WARNING: *) May read beyond bound on video than width or height is NOT multiple of cuSize<br>
-    //          *) MUST BE handle ColorSpace other than 420 yourself!<br>
-    //<a href="http://primitives.cu" target="_blank" rel="noreferrer">primitives.cu</a>[g_maxLog2CUSize - 2 - (plane != 0)].sub_ps(diff, MAX_CU_SIZE, fenc0, rec0, stride, stride);<br>
-    for(int y = 0; y < ctuHeight; y++)<br>
+    if ((lpelx + ctuWidth <  picWidth) & (tpely + ctuHeight < picHeight))<br>
     {<br>
-        for(int x = 0; x < ctuWidth; x++)<br>
+        // WARNING: *) May read beyond bound on video than ctuWidth or ctuHeight is NOT multiple of cuSize<br>
+        X265_CHECK((ctuWidth == ctuHeight) || (m_chromaFormat != X265_CSP_I420), "video size check failure\n");<br>
+        if (plane)<br>
+            primitives.chroma[m_chromaFormat].cu[g_maxLog2CUSize - 2].sub_ps(diff, MAX_CU_SIZE, fenc0, rec0, stride, stride);<br>
+        else<br>
+           <a href="http://primitives.cu" target="_blank" rel="noreferrer">primitives.cu</a>[g_maxLog2CUSize - 2].sub_ps(diff, MAX_CU_SIZE, fenc0, rec0, stride, stride);<br>
+    }<br>
+    else<br>
+    {<br>
+        // path for non-square area (most in edge)<br>
+        for(int y = 0; y < ctuHeight; y++)<br>
         {<br>
-            diff[y * MAX_CU_SIZE + x] = (fenc0[y * stride + x] - rec0[y * stride + x]);<br>
+            for(int x = 0; x < ctuWidth; x++)<br>
+            {<br>
+                diff[y * MAX_CU_SIZE + x] = (fenc0[y * stride + x] - rec0[y * stride + x]);<br>
+            }<br>
         }<br>
     }<br>
<br>
diff -r 8fdd1b8fd452 -r 36a54b2cf7c4 source/encoder/sao.h<br>
--- a/source/encoder/sao.h      Tue Oct 06 16:42:02 2015 -0500<br>
+++ b/source/encoder/sao.h      Tue Oct 06 16:42:06 2015 -0500<br>
@@ -83,6 +83,7 @@<br>
     int8_t      m_offsetBo[SAO_NUM_BO_CLASSES];<br>
     int8_t      m_offsetEo[NUM_EDGETYPE];<br>
<br>
+    int         m_chromaFormat;<br>
     int         m_numCuInWidth;<br>
     int         m_numCuInHeight;<br>
     int         m_hChromaShift;<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" rel="noreferrer">https://mailman.videolan.org/listinfo/x265-devel</a><br>
</blockquote></div><br></div>
</blockquote></div>