[x265] [PATCH] fix threading conflict in low resolution video (Issue #260)

Min Chen chenm003 at 163.com
Fri Apr 8 01:26:19 CEST 2016


# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1460071560 18000
# Node ID 1253c2bdb4030bbb3d84422b6068b5f4942571e9
# Parent  5b01678f6fb4e89e23cd41295592a9aa5d51d4ba
fix threading conflict in low resolution video (Issue #260)

The threading conflict because video resolution too low, it made threading approach finish in same time.
The root cause in our sync logic, we relase all of filter sync-lock in latest column processed, I give more details in below.

Time 0:
  Row0 - request assign work threading
  Row1 - request assign work threading

Time 1:
  Row0 - assign threading failure, and will continue in FrameFilter::processRow().
  Row1 - got a threading (since all of current row cu encode finished, the allowCol will setting to latest column, it means no restrict on sync logic)

Time 2:
  Row1 - threading process beyond Row0 bound  --> Crash here

diff -r 5b01678f6fb4 -r 1253c2bdb403 source/encoder/framefilter.cpp
--- a/source/encoder/framefilter.cpp	Sat Apr 02 19:08:49 2016 +0100
+++ b/source/encoder/framefilter.cpp	Thu Apr 07 18:26:00 2016 -0500
@@ -320,11 +320,14 @@
     const uint32_t* ctuGeomMap = m_frameFilter->m_frameEncoder->m_ctuGeomMap;
     PicYuv* reconPic = m_encData->m_reconPic;
     const int colStart = m_lastCol.get();
+    const int numCols = m_frameFilter->m_numCols;
     // TODO: Waiting previous row finish or simple clip on it?
-    const int colEnd = m_allowedCol.get();
-    const int numCols = m_frameFilter->m_numCols;
+    int colEnd = m_allowedCol.get();
 
     // Avoid threading conflict
+    if (m_prevRow && colEnd > m_prevRow->m_lastDeblocked.get())
+        colEnd = m_prevRow->m_lastDeblocked.get();
+
     if (colStart >= colEnd)
         return;
 



More information about the x265-devel mailing list