<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 21, 2017 at 8:16 PM,  <span dir="ltr"><<a href="mailto:ashok@multicorewareinc.com" target="_blank">ashok@multicorewareinc.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"># HG changeset patch<br>
# User Ashok Kumar Mishra <<a href="mailto:ashok@multicorewareinc.com">ashok@multicorewareinc.com</a>><br>
# Date 1505220183 -19800<br>
#      Tue Sep 12 18:13:03 2017 +0530<br>
# Node ID 71f700844b0b2a9120bfd8a2d1f13e<wbr>219aa20677<br>
# Parent  1a7edb6fd9932b09c2b5646c7dcc82<wbr>0a51795827<br>
wavefront: fix for triggering rows for multiple slices when wpp is enabled<br>
It is required to trigger alternative rows in slices for encoding when wpp is enabled.<br></blockquote><div><br></div><div>Nicely done! Looks good. Will push into default</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
diff -r 1a7edb6fd993 -r 71f700844b0b source/common/wavefront.cpp<br>
--- a/source/common/wavefront.cpp       Thu Jun 29 13:13:56 2017 +0530<br>
+++ b/source/common/wavefront.cpp       Tue Sep 12 18:13:03 2017 +0530<br>
@@ -43,11 +43,17 @@<br>
     if (m_externalDependencyBitmap)<br>
         memset((void*)m_<wbr>externalDependencyBitmap, 0, sizeof(uint32_t) * m_numWords);<br>
<br>
+    m_row_to_idx = X265_MALLOC(uint32_t, m_numRows);<br>
+    m_idx_to_row = X265_MALLOC(uint32_t, m_numRows);<br>
+<br>
     return m_internalDependencyBitmap && m_externalDependencyBitmap;<br>
 }<br>
<br>
 WaveFront::~WaveFront()<br>
 {<br>
+    x265_free((void*)m_row_to_idx)<wbr>;<br>
+    x265_free((void*)m_idx_to_row)<wbr>;<br>
+<br>
     x265_free((void*)m_<wbr>internalDependencyBitmap);<br>
     x265_free((void*)m_<wbr>externalDependencyBitmap);<br>
 }<br>
diff -r 1a7edb6fd993 -r 71f700844b0b source/common/wavefront.h<br>
--- a/source/common/wavefront.h Thu Jun 29 13:13:56 2017 +0530<br>
+++ b/source/common/wavefront.h Tue Sep 12 18:13:03 2017 +0530<br>
@@ -52,6 +52,10 @@<br>
<br>
     int m_numRows;<br>
<br>
+protected:<br>
+    uint32_t *m_row_to_idx;<br>
+    uint32_t *m_idx_to_row;<br>
+<br>
 public:<br>
<br>
     WaveFront()<br>
diff -r 1a7edb6fd993 -r 71f700844b0b source/encoder/frameencoder.<wbr>cpp<br>
--- a/source/encoder/frameencoder.<wbr>cpp   Thu Jun 29 13:13:56 2017 +0530<br>
+++ b/source/encoder/frameencoder.<wbr>cpp   Tue Sep 12 18:13:03 2017 +0530<br>
@@ -701,6 +701,24 @@<br>
     {<br>
         m_rows[m_sliceBaseRow[sliceId]<wbr>].active = true;<br>
     }<br>
+    if (m_param->bEnableWavefront)<br>
+    {<br>
+        int i = 0;<br>
+        for (uint32_t rowInSlice = 0; rowInSlice < m_sliceGroupSize; rowInSlice++)<br>
+        {<br>
+            for (uint32_t sliceId = 0; sliceId < m_param->maxSlices; sliceId++)<br>
+            {<br>
+                const uint32_t sliceStartRow = m_sliceBaseRow[sliceId];<br>
+                const uint32_t sliceEndRow = m_sliceBaseRow[sliceId + 1] - 1;<br>
+                const uint32_t row = sliceStartRow + rowInSlice;<br>
+                if (row > sliceEndRow)<br>
+                    continue;<br>
+                m_row_to_idx[row] = i;<br>
+                m_idx_to_row[i] = row;<br>
+                i += 1;<br>
+            }<br>
+        }<br>
+    }<br>
<br>
     if (m_param->bEnableWavefront)<br>
     {<br>
@@ -735,11 +753,11 @@<br>
                     }<br>
                 }<br>
<br>
-                enableRowEncoder(row); /* clear external dependency for this row */<br>
+                enableRowEncoder(m_row_to_idx[<wbr>row]); /* clear external dependency for this row */<br>
                 if (!rowInSlice)<br>
                 {<br>
                     m_row0WaitTime = x265_mdate();<br>
-                    enqueueRowEncoder(row); /* clear internal dependency, start wavefront */<br>
+                    enqueueRowEncoder(m_row_to_<wbr>idx[row]); /* clear internal dependency, start wavefront */<br>
                 }<br>
                 tryWakeOne();<br>
             } // end of loop rowInSlice<br>
@@ -1196,8 +1214,8 @@<br>
     if (ATOMIC_INC(&m_<wbr>activeWorkerCount) == 1 && m_stallStartTime)<br>
         m_totalNoWorkerTime += x265_mdate() - m_stallStartTime;<br>
<br>
-    const uint32_t realRow = row >> 1;<br>
-    const uint32_t typeNum = row & 1;<br>
+    const uint32_t realRow = m_idx_to_row[row >> 1];<br>
+    const uint32_t typeNum = m_idx_to_row[row & 1];<br>
<br>
     if (!typeNum)<br>
         processRowEncoder(realRow, m_tld[threadId]);<br>
@@ -1207,7 +1225,7 @@<br>
<br>
         // NOTE: Active next row<br>
         if (realRow != m_sliceBaseRow[m_rows[realRow]<wbr>.sliceId + 1] - 1)<br>
-            enqueueRowFilter(realRow + 1);<br>
+            enqueueRowFilter(m_row_to_idx[<wbr>realRow + 1]);<br>
     }<br>
<br>
     if (ATOMIC_DEC(&m_<wbr>activeWorkerCount) == 0)<br>
@@ -1649,7 +1667,7 @@<br>
                 m_rows[row + 1].completed + 2 <= curRow.completed)<br>
             {<br>
                 m_rows[row + 1].active = true;<br>
-                enqueueRowEncoder(row + 1);<br>
+                enqueueRowEncoder(m_row_to_<wbr>idx[row + 1]);<br>
                 tryWakeOne(); /* wake up a sleeping thread or set the help wanted flag */<br>
             }<br>
         }<br>
@@ -1736,11 +1754,11 @@<br>
     {<br>
         if (rowInSlice >= m_filterRowDelay)<br>
         {<br>
-            enableRowFilter(row - m_filterRowDelay);<br>
+            enableRowFilter(m_row_to_idx[<wbr>row - m_filterRowDelay]);<br>
<br>
             /* NOTE: Activate filter if first row (row 0) */<br>
             if (rowInSlice == m_filterRowDelay)<br>
-                enqueueRowFilter(row - m_filterRowDelay);<br>
+                enqueueRowFilter(m_row_to_idx[<wbr>row - m_filterRowDelay]);<br>
             tryWakeOne();<br>
         }<br>
<br>
@@ -1748,7 +1766,7 @@<br>
         {<br>
             for (uint32_t i = endRowInSlicePlus1 - m_filterRowDelay; i < endRowInSlicePlus1; i++)<br>
             {<br>
-                enableRowFilter(i);<br>
+                enableRowFilter(m_row_to_idx[<wbr>i]);<br>
             }<br>
             tryWakeOne();<br>
         }<br>
@@ -1756,7 +1774,7 @@<br>
         // handle specially case - single row slice<br>
         if  (bFirstRowInSlice & bLastRowInSlice)<br>
         {<br>
-            enqueueRowFilter(row);<br>
+            enqueueRowFilter(m_row_to_idx[<wbr>row]);<br>
             tryWakeOne();<br>
         }<br>
     }<br>
______________________________<wbr>_________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/<wbr>listinfo/x265-devel</a><br>
</blockquote></div><br></div></div>