[x265] [PATCH] fix hash mistake in --sao-lcu-opt=0 mode

Min Chen chenm003 at 163.com
Wed Sep 25 08:30:41 CEST 2013


# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1380090001 -28800
# Node ID 2d1646a4fc2a7aee4fba79c5c587ca396c50cbe0
# Parent  57efca19f5b8d8b5bdc22a0bb9fbfc6169724266
fix hash mistake in --sao-lcu-opt=0 mode

diff -r 57efca19f5b8 -r 2d1646a4fc2a source/common/common.cpp
--- a/source/common/common.cpp	Wed Sep 25 13:29:12 2013 +0800
+++ b/source/common/common.cpp	Wed Sep 25 14:20:01 2013 +0800
@@ -251,8 +251,6 @@
           "Keyframe interval must be 0 (auto) 1 (intra-only) or greater than 1");
     CHECK(param->frameNumThreads <= 0,
           "frameNumThreads (--frame-threads) must be 1 or higher");
-    CHECK(!param->saoLcuBasedOptimization && param->frameNumThreads > 1,
-          "picture-based SAO is not compatible with frame parallelism");
     CHECK(param->cbQpOffset < -12, "Min. Chroma Cb QP Offset is -12");
     CHECK(param->cbQpOffset >  12, "Max. Chroma Cb QP Offset is  12");
     CHECK(param->crQpOffset < -12, "Min. Chroma Cr QP Offset is -12");
diff -r 57efca19f5b8 -r 2d1646a4fc2a source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Wed Sep 25 13:29:12 2013 +0800
+++ b/source/encoder/encoder.cpp	Wed Sep 25 14:20:01 2013 +0800
@@ -193,7 +193,12 @@
 
     setThreadPool(ThreadPool::allocThreadPool(_param->poolNumThreads));
     int actual = ThreadPool::getThreadPool()->getThreadCount();
-    if (actual > 1)
+
+    if (!_param->saoLcuBasedOptimization && _param->frameNumThreads > 1)
+    {
+        x265_log(_param, X265_LOG_INFO, "Warning: picture-based SAO with frame parallelism\n");
+    }
+    else if (actual > 1)
     {
         x265_log(_param, X265_LOG_INFO, "WPP streams / pool / frames  : %d / %d / %d\n",
                  (_param->sourceHeight + _param->maxCUSize - 1) / _param->maxCUSize, actual, _param->frameNumThreads);
diff -r 57efca19f5b8 -r 2d1646a4fc2a source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp	Wed Sep 25 13:29:12 2013 +0800
+++ b/source/encoder/frameencoder.cpp	Wed Sep 25 14:20:01 2013 +0800
@@ -529,6 +529,12 @@
             getSAO()->SAOProcess(saoParam);
             getSAO()->endSaoEnc();
             PCMLFDisableProcess(m_pic);
+
+            // Extend border after really SAO
+            for(int row = 0; row < m_numRows; row++)
+            {
+                m_frameFilter.processRowPost(row);
+            }
         }
 
         slice->setSaoEnabledFlag((saoParam->bSaoFlag[0] == 1) ? true : false);
diff -r 57efca19f5b8 -r 2d1646a4fc2a source/encoder/framefilter.cpp
--- a/source/encoder/framefilter.cpp	Wed Sep 25 13:29:12 2013 +0800
+++ b/source/encoder/framefilter.cpp	Wed Sep 25 14:20:01 2013 +0800
@@ -173,6 +173,10 @@
 
     // this row of CTUs has been encoded
 
+    // NOTE: in --sao-lcu-opt=0 mode, we do it later
+    if (m_cfg->param.bEnableSAO && !m_sao.getSaoLcuBasedOptimization())
+        return;
+
     if (row > 0)
     {
         processRowPost(row - 1);
@@ -180,7 +184,7 @@
 
     if (row == m_numRows - 1)
     {
-        if (m_cfg->param.bEnableSAO)
+        if (m_cfg->param.bEnableSAO && m_sao.getSaoLcuBasedOptimization())
         {
             m_sao.rdoSaoUnitRowEnd(saoParam, m_pic->getNumCUsInFrame());
 



More information about the x265-devel mailing list