[x265] [PATCH] Resolve some patching issues for previous patch (deadlock)

Min Chen chenm003 at 163.com
Tue Sep 17 15:11:14 CEST 2013


# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1379423463 -28800
# Node ID c5c645aa14bfdbf482186730c59a000fdae10e07
# Parent  0d33ff236f68bc2238138a7213301b2efc0e6426
Resolve some patching issues for previous patch (deadlock).

diff -r 0d33ff236f68 -r c5c645aa14bf source/common/wavefront.cpp
--- a/source/common/wavefront.cpp	Mon Sep 16 21:06:49 2013 +0800
+++ b/source/common/wavefront.cpp	Tue Sep 17 21:11:03 2013 +0800
@@ -118,16 +118,11 @@
         while (m_queuedBitmap[w])
         {
             uint64_t oldval = m_queuedBitmap[w];
-            if (oldval == 0) // race condition
+            uint64_t mask = m_queuedBitmap[w] & m_enableBitmap[w];
+            if (mask == 0) // race condition
                 break;
 
-            CTZ64(id, oldval);
-
-            // NOTE: if the lowest row is unavailable, so we don't check higher row
-            if (!(m_enableBitmap[w] & (1LL << id)))
-            {
-                return false;
-            }
+            CTZ64(id, mask);
 
             uint64_t newval = oldval & ~(1LL << id);
             if (ATOMIC_CAS(&m_queuedBitmap[w], oldval, newval) == oldval)
diff -r 0d33ff236f68 -r c5c645aa14bf source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp	Mon Sep 16 21:06:49 2013 +0800
+++ b/source/encoder/frameencoder.cpp	Tue Sep 17 21:11:03 2013 +0800
@@ -952,7 +952,7 @@
                 m_rows[row + 1].m_completed + 2 <= m_rows[row].m_completed)
             {
                 m_rows[row + 1].m_active = true;
-                WaveFront::enqueueRow(row + 1);
+                enqueueRowEncoder(row + 1);
             }
         }
 
@@ -968,13 +968,16 @@
     // Run row-wise loop filters
     if (row >= m_filterRowDelay)
     {
-        m_frameFilter.processRow(row - m_filterRowDelay);
+        enableRowFilter(row - m_filterRowDelay);
+
+        // NOTE: Active Filter to first row (row 0)
+        if (row == m_filterRowDelay)
+            enqueueRowFilter(0);
     }
     if (row == m_numRows - 1)
     {
         for(int i = m_numRows - m_filterRowDelay; i < m_numRows; i++)
-            m_frameFilter.processRow(i);
-        m_completionEvent.trigger();
+            enableRowFilter(i);
     }
 }
 
diff -r 0d33ff236f68 -r c5c645aa14bf source/encoder/frameencoder.h
--- a/source/encoder/frameencoder.h	Mon Sep 16 21:06:49 2013 +0800
+++ b/source/encoder/frameencoder.h	Tue Sep 17 21:11:03 2013 +0800
@@ -107,7 +107,7 @@
 
             // NOTE: Active next row
             if (realRow != m_numRows - 1)
-                enableRowFilter(realRow + 1);
+                enqueueRowFilter(realRow + 1);
             else
                 m_completionEvent.trigger();
         }



More information about the x265-devel mailing list