[x265] [PATCH 22 of 24] sao: move common function into new processSaoUnitCu()
Min Chen
chenm003 at 163.com
Tue Dec 8 00:54:59 CET 2015
# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1449511606 21600
# Node ID 188f52d6a9ea87876d09814126e21b4be2df5248
# Parent 64cc11dff87ca95418e8812acdfe69ed3f93006f
sao: move common function into new processSaoUnitCu()
---
source/encoder/framefilter.cpp | 47 +++++++++++++++------------------------
source/encoder/framefilter.h | 5 ++++
2 files changed, 23 insertions(+), 29 deletions(-)
diff -r 64cc11dff87c -r 188f52d6a9ea source/encoder/framefilter.cpp
--- a/source/encoder/framefilter.cpp Mon Dec 07 12:06:43 2015 -0600
+++ b/source/encoder/framefilter.cpp Mon Dec 07 12:06:46 2015 -0600
@@ -152,6 +152,15 @@
X265_CHECK(col * ctuWidth + ctuWidth <= m_sao.m_numCuInWidth * ctuWidth, "m_tmpU buffer beyond bound write detected");
}
+void FrameFilter::ParallelFilter::processSaoUnitCu(SAOParam *saoParam, int col)
+{
+ if (saoParam->bSaoFlag[0])
+ m_sao.processSaoUnitCuLuma(saoParam->ctuParam[0], m_row, col);
+
+ if (saoParam->bSaoFlag[1])
+ m_sao.processSaoUnitCuChroma(saoParam->ctuParam, m_row, col);
+}
+
// NOTE: Single Threading only
void FrameFilter::ParallelFilter::processTasks(int /*workerThreadId*/)
{
@@ -202,11 +211,8 @@
// Process Previous Row SAO CU
if (m_row >= 1 && col >= 3)
{
- if (saoParam->bSaoFlag[0])
- m_prevRow->m_sao.processSaoUnitCuLuma(saoParam->ctuParam[0], m_row - 1, col - 3);
-
- if (saoParam->bSaoFlag[1])
- m_prevRow->m_sao.processSaoUnitCuChroma(saoParam->ctuParam, m_row - 1, col - 3);
+ // Must delay 1 row to avoid thread data race conflict
+ m_prevRow->processSaoUnitCu(saoParam, col - 3);
}
}
@@ -238,30 +244,13 @@
if (numCols >= 1)
m_sao.rdoSaoUnitCu(saoParam, m_rowAddr, numCols - 1, cuAddr);
- // Process Previous Row SAO CU
- if (saoParam->bSaoFlag[0])
- {
- if (m_row >= 1 && numCols >= 3)
- m_prevRow->m_sao.processSaoUnitCuLuma(saoParam->ctuParam[0], m_row - 1, numCols - 3);
-
- if (m_row >= 1 && numCols >= 2)
- m_prevRow->m_sao.processSaoUnitCuLuma(saoParam->ctuParam[0], m_row - 1, numCols - 2);
-
- if (m_row >= 1 && numCols >= 1)
- m_prevRow->m_sao.processSaoUnitCuLuma(saoParam->ctuParam[0], m_row - 1, numCols - 1);
- }
-
- if (saoParam->bSaoFlag[1])
- {
- if (m_row >= 1 && numCols >= 3)
- m_prevRow->m_sao.processSaoUnitCuChroma(saoParam->ctuParam, m_row - 1, numCols - 3);
-
- if (m_row >= 1 && numCols >= 2)
- m_prevRow->m_sao.processSaoUnitCuChroma(saoParam->ctuParam, m_row - 1, numCols - 2);
-
- if (m_row >= 1 && numCols >= 1)
- m_prevRow->m_sao.processSaoUnitCuChroma(saoParam->ctuParam, m_row - 1, numCols - 1);
- }
+ // Process Previous Rows SAO CU
+ if (m_row >= 1 && numCols >= 3)
+ m_prevRow->processSaoUnitCu(saoParam, numCols - 3);
+ if (m_row >= 1 && numCols >= 2)
+ m_prevRow->processSaoUnitCu(saoParam, numCols - 2);
+ if (m_row >= 1 && numCols >= 1)
+ m_prevRow->processSaoUnitCu(saoParam, numCols - 1);
}
m_lastDeblocked.set(numCols - 1);
}
diff -r 64cc11dff87c -r 188f52d6a9ea source/encoder/framefilter.h
--- a/source/encoder/framefilter.h Mon Dec 07 12:06:43 2015 -0600
+++ b/source/encoder/framefilter.h Mon Dec 07 12:06:46 2015 -0600
@@ -88,6 +88,11 @@
{ }
void processTasks(int workerThreadId);
+
+ // Apply SAO on a CU in current row
+ void processSaoUnitCu(SAOParam *saoParam, int col);
+
+ // Copy and Save SAO reference pixels for SAO Rdo decide
void copySaoAboveRef(PicYuv* reconPic, uint32_t cuAddr, int col);
protected:
More information about the x265-devel
mailing list