<div style="line-height:1.7;color:#000000;font-size:14px;font-family:arial"><div style="color: rgb(0, 0, 0); line-height: 1.7; font-family: arial; font-size: 14px;"><div><br></div><pre><br>At 2015-11-19 18:03:09,<a href="mailto:ashok@multicorewareinc.com">ashok@multicorewareinc.com</a> wrote:
># HG changeset patch
># User Ashok Kumar Mishra<<a href="mailto:ashok@multicorewareinc.com">ashok@multicorewareinc.com</a>>
># Date 1446119115 -19800
>#      Thu Oct 29 17:15:15 2015 +0530
># Node ID 4a273947c8d54b4de3c05e0e04c9c915f554e6e5
># Parent  f722fb55404bb80b26a55ba0a0a1b98d8f20b362
>SAO: initialize bottom and right line numbers to be skipped for SAO statistics calculation only once
>
>diff -r f722fb55404b -r 4a273947c8d5 source/encoder/frameencoder.cpp
>--- a/source/encoder/frameencoder.cpp  Wed Nov 18 12:28:03 2015 +0530
>+++ b/source/encoder/frameencoder.cpp  Thu Oct 29 17:15:15 2015 +0530
>@@ -1091,7 +1091,7 @@

>         /* SAO parameter estimation using non-deblocked pixels for CTU bottom and right boundary areas */
>         if (m_param->bEnableSAO && m_param->bSaoNonDeblocked)
>-            m_frameFilter.m_sao.calcSaoStatsCu_BeforeDblk(m_frame, col, row);
>+            m_frameFilter.m_sao.calcPreDeblockSaoStatsCu(m_frame, col, row);

>         if (m_param->bEnableWavefront && curRow.completed >= 2 && row < m_numRows - 1 &&
>             (!m_bAllRowsStop || intRow + 1 < m_vbvResetTriggerRow))
>diff -r f722fb55404b -r 4a273947c8d5 source/encoder/sao.cpp
>--- a/source/encoder/sao.cpp   Wed Nov 18 12:28:03 2015 +0530
>+++ b/source/encoder/sao.cpp   Thu Oct 29 17:15:15 2015 +0530
>@@ -138,6 +138,68 @@
>     CHECKED_MALLOC(m_countPreDblk, PerPlane, numCtu);
>     CHECKED_MALLOC(m_offsetOrgPreDblk, PerPlane, numCtu);

>+    for (int typeIdc = 0; typeIdc < MAX_NUM_SAO_TYPE; typeIdc++)
>+    {
>+        m_skipLinesR[TEXT_LUMA][typeIdc] = 5;
>+        m_skipLinesR[TEXT_CHROMA_U][typeIdc] = m_skipLinesR[TEXT_CHROMA_V][typeIdc] = 3;
>+
>+        m_skipLinesB[TEXT_LUMA ][typeIdc] = 4;
>+        m_skipLinesB[TEXT_CHROMA_U][typeIdc] = m_skipLinesB[TEXT_CHROMA_V][typeIdc] = 2;
>+
>+        if (!m_param->bSaoNonDeblocked)
>+        {
>+            for (int typeIdc = 0; typeIdc < MAX_NUM_SAO_TYPE; typeIdc++)
>+            {
>+                m_skipLinesR[TEXT_LUMA][typeIdc] = 5;
>+                m_skipLinesR[TEXT_CHROMA_U][typeIdc] = m_skipLinesR[TEXT_CHROMA_V][typeIdc] = 3;
>+
>+                m_skipLinesB[TEXT_LUMA ][typeIdc] = 4;
>+                m_skipLinesB[TEXT_CHROMA_U][typeIdc] = m_skipLinesB[TEXT_CHROMA_V][typeIdc] = 2;
>+            }
>+        }
>+        else
>+        {
>+            for (int typeIdc = 0; typeIdc < MAX_NUM_SAO_TYPE; typeIdc++)
>+            {
>+                switch (typeIdc)
>+                {
>+                case SAO_EO_0:
>+                    m_skipLinesR[TEXT_LUMA ][typeIdc] = 5;
>+                    m_skipLinesR[TEXT_CHROMA_U][typeIdc] = m_skipLinesR[TEXT_CHROMA_V][typeIdc] = 3;
>+
>+                    m_skipLinesB[TEXT_LUMA ][typeIdc] = 3;
>+                    m_skipLinesB[TEXT_CHROMA_U][typeIdc] = m_skipLinesB[TEXT_CHROMA_V][typeIdc] = 1;
>+                    break;
>+                case SAO_EO_1:
>+                    m_skipLinesR[TEXT_LUMA][typeIdc] = 4;
>+                    m_skipLinesR[TEXT_CHROMA_U][typeIdc] = m_skipLinesR[TEXT_CHROMA_V][typeIdc] = 2;
>+
>+                    m_skipLinesB[TEXT_LUMA][typeIdc] = 4;
>+                    m_skipLinesB[TEXT_CHROMA_U][typeIdc] = m_skipLinesB[TEXT_CHROMA_V][typeIdc] = 2;
>+                    break;
>+                case SAO_EO_2:
>+                case SAO_EO_3:
>+                    m_skipLinesR[TEXT_LUMA][typeIdc] = 5;
>+                    m_skipLinesR[TEXT_CHROMA_U][typeIdc] = m_skipLinesR[TEXT_CHROMA_V][typeIdc] = 3;
>+
>+                    m_skipLinesB[TEXT_LUMA][typeIdc] = 4;
>+                    m_skipLinesB[TEXT_CHROMA_U][typeIdc] = m_skipLinesB[TEXT_CHROMA_V][typeIdc] = 2;
>+                    break;
>+                case SAO_BO:
>+                    m_skipLinesR[TEXT_LUMA][typeIdc] = 4;
>+                    m_skipLinesR[TEXT_CHROMA_U][typeIdc] = m_skipLinesR[TEXT_CHROMA_V][typeIdc] = 2;
>+
>+                    m_skipLinesB[TEXT_LUMA][typeIdc] = 3;
>+                    m_skipLinesB[TEXT_CHROMA_U][typeIdc] = m_skipLinesB[TEXT_CHROMA_V][typeIdc] = 1;
>+                    break;
>+                default:
>+                    X265_CHECK(0, "Not a supported type");
>+                    break;
>+                }
>+            }
>+        }
>+    }
>+
this idea from HM, it more clear but more memory operators and compiler difficult to optimize code, e.g. MOV+CMP+CMOV replace by series address calculate and memory loading operator</pre><pre><br></pre></div></div>