[x265] [PATCH] SAO: initialize bottom and right line numbers to be skipped for SAO statistics calculation only once

chen chenm003 at 163.com
Thu Nov 19 20:03:40 CET 2015




At 2015-11-19 18:03:09,ashok at multicorewareinc.com wrote:
># HG changeset patch
># User Ashok Kumar Mishra<ashok at multicorewareinc.com>
># 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20151120/fecc2fa6/attachment-0001.html>


More information about the x265-devel mailing list