<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 31, 2016 at 11:03 PM, chen <span dir="ltr"><<a href="mailto:chenm003@163.com" target="_blank">chenm003@163.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="line-height:1.7;color:#000000;font-size:14px;font-family:arial"><div># HG changeset patch</div><div># User Min Chen <<a href="mailto:min.chen@multicorewareinc.com" target="_blank">min.chen@multicorewareinc.com</a><wbr>></div><div># Date 1477935084 18000</div><div># Node ID 9be03f08789954f772a50f26485a9c<wbr>96ca745497</div><div># Parent  <wbr>b08109b3701e9b86010c5a5ed0ad7b<wbr>3d6a051911</div><div>[slices] fix multi-slices output non-determination bug</div><div>---</div><div> source/common/common.h          |    2 +-</div><div> source/encoder/analysis.cpp     |    8 +-</div><div> source/encoder/frameencoder.<wbr>cpp |   15 ++---</div><div> source/encoder/motion.cpp       |  116 +++++++++++++++++++++++++++---<wbr>--------</div><div> source/encoder/sao.cpp          |    7 ++</div><div> source/encoder/search.cpp       |    3 +</div><div> 6 files changed, 104 insertions(+), 47 deletions(-)</div><div><br></div><div>diff -r b08109b3701e -r 9be03f087899 source/common/common.h</div><div>--- a/source/common/common.h<span class="m_-7124650680227569151Apple-tab-span" style="white-space:pre-wrap">    </span>Fri Oct 28 10:28:15 2016 +0800</div><div>+++ b/source/common/common.h<span class="m_-7124650680227569151Apple-tab-span" style="white-space:pre-wrap">        </span>Mon Oct 31 12:31:24 2016 -0500</div><div>@@ -176,7 +176,7 @@</div><div> </div><div> #define X265_MIN(a, b) ((a) < (b) ? (a) : (b))</div><div> #define X265_MAX(a, b) ((a) > (b) ? (a) : (b))</div><div>-#define COPY1_IF_LT(x, y) if ((y) < (x)) (x) = (y);</div><div>+#define COPY1_IF_LT(x, y) {if ((y) < (x)) (x) = (y);}</div><div> #define COPY2_IF_LT(x, y, a, b) \</div><div>     if ((y) < (x)) \</div><div>     { \</div><div>diff -r b08109b3701e -r 9be03f087899 source/encoder/analysis.cpp</div><div>--- a/source/encoder/analysis.cpp<span class="m_-7124650680227569151Apple-tab-span" style="white-space:pre-wrap"> </span>Fri Oct 28 10:28:15 2016 +0800</div><div>+++ b/source/encoder/analysis.cpp<span class="m_-7124650680227569151Apple-tab-span" style="white-space:pre-wrap">   </span>Mon Oct 31 12:31:24 2016 -0500</div><div>@@ -1942,12 +1942,12 @@</div><div>             if (m_param->maxSlices > 1)</div><div>             {</div><div>                 // NOTE: First row in slice can't negative</div><div>-                if ((candMvField[i][0].mv.y < m_sliceMinY) | (candMvField[i][1].mv.y < m_sliceMinY))</div><div>+                if (X265_MIN(candMvField[i][0].<wbr>mv.y, candMvField[i][1].mv.y) < m_sliceMinY)</div><div>                     continue;</div><div> </div><div>                 // Last row in slice can't reference beyond bound since it is another slice area</div><div>                 // TODO: we may beyond bound in future since these area have a chance to finish because we use parallel slices. Necessary prepare research on load balance</div><div>-                if ((candMvField[i][0].mv.y > m_sliceMaxY) | (candMvField[i][1].mv.y > m_sliceMaxY))</div><div>+                if (X265_MAX(candMvField[i][0].<wbr>mv.y, candMvField[i][1].mv.y) > m_sliceMaxY)</div><div>                     continue;</div><div>             }</div><div> </div><div>@@ -2072,12 +2072,12 @@</div><div>             if (m_param->maxSlices > 1)</div><div>             {</div><div>                 // NOTE: First row in slice can't negative</div><div>-                if ((candMvField[i][0].mv.y < m_sliceMinY) | (candMvField[i][1].mv.y < m_sliceMinY))</div><div>+                if (X265_MIN(candMvField[i][0].<wbr>mv.y, candMvField[i][1].mv.y) < m_sliceMinY)</div><div>                     continue;</div><div> </div><div>                 // Last row in slice can't reference beyond bound since it is another slice area</div><div>                 // TODO: we may beyond bound in future since these area have a chance to finish because we use parallel slices. Necessary prepare research on load balance</div><div>-                if ((candMvField[i][0].mv.y > m_sliceMaxY) | (candMvField[i][1].mv.y > m_sliceMaxY))</div><div>+                if (X265_MAX(candMvField[i][0].<wbr>mv.y, candMvField[i][1].mv.y) > m_sliceMaxY)</div><div>                     continue;</div><div>             }</div><div> </div><div>diff -r b08109b3701e -r 9be03f087899 source/encoder/frameencoder.<wbr>cpp</div><div>--- a/source/encoder/frameencoder.<wbr>cpp<span class="m_-7124650680227569151Apple-tab-span" style="white-space:pre-wrap">    </span>Fri Oct 28 10:28:15 2016 +0800</div><div>+++ b/source/encoder/frameencoder.<wbr>cpp<span class="m_-7124650680227569151Apple-tab-span" style="white-space:pre-wrap">    </span>Mon Oct 31 12:31:24 2016 -0500</div><div>@@ -123,7 +123,7 @@</div><div>     int range  = m_param->searchRange;       /* fpel search */</div><div>     range += !!(m_param->searchMethod < 2);  /* diamond/hex range check lag */</div><div>     range += NTAPS_LUMA / 2;                 /* subpel filter half-length */</div><div>-    range += 2 + MotionEstimate::<wbr>hpelIterationCount(m_param-><wbr>subpelRefine) / 2; /* subpel refine steps */</div><div>+    range += 2 + (MotionEstimate::<wbr>hpelIterationCount(m_param-><wbr>subpelRefine) + 1) / 2; /* subpel refine steps */</div><div>     m_refLagRows = /*(m_param->maxSlices > 1 ? 1 : 0) +*/ 1 + ((range + g_maxCUSize - 1) / g_maxCUSize);</div><div> </div><div>     // NOTE: 2 times of numRows because both Encoder and Filter in same queue</div><div>@@ -654,8 +654,7 @@</div><div>                 const uint32_t sliceEndRow = m_sliceBaseRow[sliceId + 1] - 1;</div><div>                 const uint32_t row = sliceStartRow + rowInSlice;</div><div> </div><div>-                if (row >= m_numRows)</div><div>-                    break;</div><div>+                X265_CHECK(row < m_numRows, "slices row fault was detected");</div><div> </div><div>                 if (row > sliceEndRow)</div><div>                     continue;</div><div>@@ -674,7 +673,7 @@</div><div>                             refpic->m_reconRowFlag[<wbr>rowIdx].waitForChange(0);</div><div> </div><div>                         if ((bUseWeightP || bUseWeightB) && m_mref[l][ref].isWeighted)</div><div>-                            m_mref[l][ref].applyWeight(<wbr>row + m_refLagRows, m_numRows, sliceEndRow + 1, sliceId);</div><div>+                            m_mref[l][ref].applyWeight(<wbr>rowIdx, m_numRows, sliceEndRow, sliceId);</div><div>                     }</div><div>                 }</div><div> </div><div>@@ -714,7 +713,7 @@</div><div>                             refpic->m_reconRowFlag[<wbr>rowIdx].waitForChange(0);</div><div> </div><div>                         if ((bUseWeightP || bUseWeightB) && m_mref[l][ref].isWeighted)</div><div>-                            m_mref[list][ref].<wbr>applyWeight(i + m_refLagRows, m_numRows, m_numRows, 0);</div><div>+                            m_mref[list][ref].<wbr>applyWeight(rowIdx, m_numRows, m_numRows, 0);</div><div>                     }</div><div>                 }</div><div> </div><div>@@ -1187,8 +1186,8 @@</div><div>     // TODO: specially case handle on first and last row</div><div> </div><div>     // Initialize restrict on MV range in slices</div><div>-    tld.analysis.m_sliceMinY = -(int16_t)(rowInSlice * g_maxCUSize * 4) + 2 * 4;</div><div>-    tld.analysis.m_sliceMaxY = (int16_t)((endRowInSlicePlus1 - 1 - row) * (g_maxCUSize * 4) - 3 * 4);</div><div>+    tld.analysis.m_sliceMinY = -(int16_t)(rowInSlice * g_maxCUSize * 4) + 3 * 4;</div><div>+    tld.analysis.m_sliceMaxY = (int16_t)((endRowInSlicePlus1 - 1 - row) * (g_maxCUSize * 4) - 4 * 4);</div><div> </div><div>     // Handle single row slice</div><div>     if (tld.analysis.m_sliceMaxY < tld.analysis.m_sliceMinY)</div><div>@@ -1502,7 +1501,7 @@</div><div> </div><div>         ScopedLock self(curRow.lock);</div><div>         if ((m_bAllRowsStop && intRow > m_vbvResetTriggerRow) ||</div><div>-            (!bFirstRowInSlice && ((curRow.completed < numCols - 1) || (m_rows[row - 1].completed < numCols)) && m_rows[row - 1].completed < m_rows[row].completed + 2))</div><div>+            (!bFirstRowInSlice && ((curRow.completed < numCols - 1) || (m_rows[row - 1].completed < numCols)) && m_rows[row - 1].completed < curRow.completed + 2))</div><div>         {</div><div>             curRow.active = false;</div><div>             curRow.busy = false;</div><div>diff -r b08109b3701e -r 9be03f087899 source/encoder/motion.cpp</div><div>--- a/source/encoder/motion.cpp<span class="m_-7124650680227569151Apple-tab-span" style="white-space:pre-wrap">     </span>Fri Oct 28 10:28:15 2016 +0800</div><div>+++ b/source/encoder/motion.cpp<span class="m_-7124650680227569151Apple-tab-span" style="white-space:pre-wrap">     </span>Mon Oct 31 12:31:24 2016 -0500</div><div>@@ -278,10 +278,14 @@</div><div>         costs[1] += mvcost((omv + MV(m1x, m1y)) << 2); \</div><div>         costs[2] += mvcost((omv + MV(m2x, m2y)) << 2); \</div><div>         costs[3] += mvcost((omv + MV(m3x, m3y)) << 2); \</div><div>-        COPY2_IF_LT(bcost, costs[0], bmv, omv + MV(m0x, m0y)); \</div><div>-        COPY2_IF_LT(bcost, costs[1], bmv, omv + MV(m1x, m1y)); \</div><div>-        COPY2_IF_LT(bcost, costs[2], bmv, omv + MV(m2x, m2y)); \</div><div>-        COPY2_IF_LT(bcost, costs[3], bmv, omv + MV(m3x, m3y)); \</div><div>+        if ((g_maxSlices == 1) | ((omv.y + m0y >= mvmin.y) & (omv.y + m0y <= mvmax.y))) \</div><div>+            COPY2_IF_LT(bcost, costs[0], bmv, omv + MV(m0x, m0y)); \</div><div>+        if ((g_maxSlices == 1) | ((omv.y + m1y >= mvmin.y) & (omv.y + m1y <= mvmax.y))) \</div><div>+            COPY2_IF_LT(bcost, costs[1], bmv, omv + MV(m1x, m1y)); \</div><div>+        if ((g_maxSlices == 1) | ((omv.y + m2y >= mvmin.y) & (omv.y + m2y <= mvmax.y))) \</div><div>+            COPY2_IF_LT(bcost, costs[2], bmv, omv + MV(m2x, m2y)); \</div><div>+        if ((g_maxSlices == 1) | ((omv.y + m3y >= mvmin.y) & (omv.y + m3y <= mvmax.y))) \</div><div>+            COPY2_IF_LT(bcost, costs[3], bmv, omv + MV(m3x, m3y)); \</div></div></blockquote><div><br></div><div>Why do you need the `(g_maxSlices == 1)  || ` in all the if conditions above? Isn't it safer to do this check for all cases, and not just for multiple slices-per-frame?</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="line-height:1.7;color:#000000;font-size:14px;font-family:arial"><div>     }</div><div> </div><div> #define COST_MV_X4_DIR(m0x, m0y, m1x, m1y, m2x, m2y, m3x, m3y, costs) \</div><div>@@ -659,8 +663,10 @@</div><div>         do</div><div>         {</div><div>             COST_MV_X4_DIR(0, -1, 0, 1, -1, 0, 1, 0, costs);</div><div>-            COPY1_IF_LT(bcost, (costs[0] << 4) + 1);</div><div>-            COPY1_IF_LT(bcost, (costs[1] << 4) + 3);</div><div>+            if ((g_maxSlices == 1) | ((bmv.y - 1 >= mvmin.y) & (bmv.y - 1 <= mvmax.y)))</div><div>+                COPY1_IF_LT(bcost, (costs[0] << 4) + 1);</div><div>+            if ((g_maxSlices == 1) | ((bmv.y + 1 >= mvmin.y) & (bmv.y + 1 <= mvmax.y)))</div><div>+                COPY1_IF_LT(bcost, (costs[1] << 4) + 3);</div><div>             COPY1_IF_LT(bcost, (costs[2] << 4) + 4);</div><div>             COPY1_IF_LT(bcost, (costs[3] << 4) + 12);</div><div>             if (!(bcost & 15))</div><div>@@ -698,36 +704,57 @@</div><div>       /* equivalent to the above, but eliminates duplicate candidates */</div><div>         COST_MV_X3_DIR(-2, 0, -1, 2,  1, 2, costs);</div><div>         bcost <<= 3;</div><div>-        COPY1_IF_LT(bcost, (costs[0] << 3) + 2);</div><div>-        COPY1_IF_LT(bcost, (costs[1] << 3) + 3);</div><div>-        COPY1_IF_LT(bcost, (costs[2] << 3) + 4);</div><div>+        if ((g_maxSlices == 1) | ((bmv.y >= mvmin.y) & (bmv.y <= mvmax.y)))</div><div>+            COPY1_IF_LT(bcost, (costs[0] << 3) + 2);</div><div>+        if ((g_maxSlices == 1) | ((bmv.y + 2 >= mvmin.y) & (bmv.y + 2 <= mvmax.y)))</div><div>+        {</div><div>+            COPY1_IF_LT(bcost, (costs[1] << 3) + 3);</div><div>+            COPY1_IF_LT(bcost, (costs[2] << 3) + 4);</div><div>+        }</div><div>+</div><div>         COST_MV_X3_DIR(2, 0,  1, -2, -1, -2, costs);</div><div>-        COPY1_IF_LT(bcost, (costs[0] << 3) + 5);</div><div>-        COPY1_IF_LT(bcost, (costs[1] << 3) + 6);</div><div>-        COPY1_IF_LT(bcost, (costs[2] << 3) + 7);</div><div>+        if ((g_maxSlices == 1) | ((bmv.y >= mvmin.y) & (bmv.y <= mvmax.y)))</div><div>+            COPY1_IF_LT(bcost, (costs[0] << 3) + 5);</div><div>+        if ((g_maxSlices == 1) | ((bmv.y - 2 >= mvmin.y) & (bmv.y - 2 <= mvmax.y)))</div><div>+        {</div><div>+            COPY1_IF_LT(bcost, (costs[1] << 3) + 6);</div><div>+            COPY1_IF_LT(bcost, (costs[2] << 3) + 7);</div><div>+        }</div><div> </div><div>         if (bcost & 7)</div><div>         {</div><div>             int dir = (bcost & 7) - 2;</div><div>-            bmv += hex2[dir + 1];</div><div> </div><div>-            /* half hexagon, not overlapping the previous iteration */</div><div>-            for (int i = (merange >> 1) - 1; i > 0 && bmv.checkRange(mvmin, mvmax); i--)</div><div>+            if ((g_maxSlices == 1) | ((bmv.y + hex2[dir + 1].y >= mvmin.y) & (bmv.y + hex2[dir + 1].y <= mvmax.y)))</div><div>             {</div><div>-                COST_MV_X3_DIR(hex2[dir + 0].x, hex2[dir + 0].y,</div><div>-                               hex2[dir + 1].x, hex2[dir + 1].y,</div><div>-                               hex2[dir + 2].x, hex2[dir + 2].y,</div><div>-                               costs);</div><div>-                bcost &= ~7;</div><div>-                COPY1_IF_LT(bcost, (costs[0] << 3) + 1);</div><div>-                COPY1_IF_LT(bcost, (costs[1] << 3) + 2);</div><div>-                COPY1_IF_LT(bcost, (costs[2] << 3) + 3);</div><div>-                if (!(bcost & 7))</div><div>-                    break;</div><div>-                dir += (bcost & 7) - 2;</div><div>-                dir = mod6m1[dir + 1];</div><div>                 bmv += hex2[dir + 1];</div><div>-            }</div><div>+</div><div>+                /* half hexagon, not overlapping the previous iteration */</div><div>+                for (int i = (merange >> 1) - 1; i > 0 && bmv.checkRange(mvmin, mvmax); i--)</div><div>+                {</div><div>+                    COST_MV_X3_DIR(hex2[dir + 0].x, hex2[dir + 0].y,</div><div>+                        hex2[dir + 1].x, hex2[dir + 1].y,</div><div>+                        hex2[dir + 2].x, hex2[dir + 2].y,</div><div>+                        costs);</div><div>+                    bcost &= ~7;</div><div>+</div><div>+                    if ((g_maxSlices == 1) | ((bmv.y + hex2[dir + 0].y >= mvmin.y) & (bmv.y + hex2[dir + 0].y <= mvmax.y)))</div><div>+                        COPY1_IF_LT(bcost, (costs[0] << 3) + 1);</div><div>+</div><div>+                    if ((g_maxSlices == 1) | ((bmv.y + hex2[dir + 1].y >= mvmin.y) & (bmv.y + hex2[dir + 1].y <= mvmax.y)))</div><div>+                        COPY1_IF_LT(bcost, (costs[1] << 3) + 2);</div><div>+</div><div>+                    if ((g_maxSlices == 1) | ((bmv.y + hex2[dir + 2].y >= mvmin.y) & (bmv.y + hex2[dir + 2].y <= mvmax.y)))</div><div>+                        COPY1_IF_LT(bcost, (costs[2] << 3) + 3);</div><div>+</div><div>+                    if (!(bcost & 7))</div><div>+                        break;</div><div>+</div><div>+                    dir += (bcost & 7) - 2;</div><div>+                    dir = mod6m1[dir + 1];</div><div>+                    bmv += hex2[dir + 1];</div><div>+                }</div><div>+            } // if ((g_maxSlices == 1) | ((bmv.y + hex2[dir + 1].y >= mvmin.y) & (bmv.y + hex2[dir + 1].y <= mvmax.y)))</div><div>         }</div><div>         bcost >>= 3;</div><div> #endif // if 0</div><div>@@ -735,15 +762,21 @@</div><div>         /* square refine */</div><div>         int dir = 0;</div><div>         COST_MV_X4_DIR(0, -1,  0, 1, -1, 0, 1, 0, costs);</div><div>-        COPY2_IF_LT(bcost, costs[0], dir, 1);</div><div>-        COPY2_IF_LT(bcost, costs[1], dir, 2);</div><div>+        if ((g_maxSlices == 1) | ((bmv.y - 1 >= mvmin.y) & (bmv.y - 1 <= mvmax.y)))</div><div>+            COPY2_IF_LT(bcost, costs[0], dir, 1);</div><div>+        if ((g_maxSlices == 1) | ((bmv.y + 1 >= mvmin.y) & (bmv.y + 1 <= mvmax.y)))</div><div>+            COPY2_IF_LT(bcost, costs[1], dir, 2);</div><div>         COPY2_IF_LT(bcost, costs[2], dir, 3);</div><div>         COPY2_IF_LT(bcost, costs[3], dir, 4);</div><div>         COST_MV_X4_DIR(-1, -1, -1, 1, 1, -1, 1, 1, costs);</div><div>-        COPY2_IF_LT(bcost, costs[0], dir, 5);</div><div>-        COPY2_IF_LT(bcost, costs[1], dir, 6);</div><div>-        COPY2_IF_LT(bcost, costs[2], dir, 7);</div><div>-        COPY2_IF_LT(bcost, costs[3], dir, 8);</div><div>+        if ((g_maxSlices == 1) | ((bmv.y - 1 >= mvmin.y) & (bmv.y - 1 <= mvmax.y)))</div><div>+            COPY2_IF_LT(bcost, costs[0], dir, 5);</div><div>+        if ((g_maxSlices == 1) | ((bmv.y + 1 >= mvmin.y) & (bmv.y + 1 <= mvmax.y)))</div><div>+            COPY2_IF_LT(bcost, costs[1], dir, 6);</div><div>+        if ((g_maxSlices == 1) | ((bmv.y - 1 >= mvmin.y) & (bmv.y - 1 <= mvmax.y)))</div><div>+            COPY2_IF_LT(bcost, costs[2], dir, 7);</div><div>+        if ((g_maxSlices == 1) | ((bmv.y + 1 >= mvmin.y) & (bmv.y + 1 <= mvmax.y)))</div><div>+            COPY2_IF_LT(bcost, costs[3], dir, 8);</div><div>         bmv += square1[dir];</div><div>         break;</div><div>     }</div><div>@@ -756,6 +789,7 @@</div><div>         /* refine predictors */</div><div>         omv = bmv;</div><div>         ucost1 = bcost;</div><div>+        X265_CHECK((g_maxSlices == 1) | ((pmv.y >= mvmin.y) & (pmv.y <= mvmax.y)), "pmv outside of search range!");</div><div>         DIA1_ITER(pmv.x, pmv.y);</div><div>         if (pmv.notZero())</div><div>             DIA1_ITER(0, 0);</div><div>@@ -1099,6 +1133,7 @@</div><div>     if ((g_maxSlices > 1) & ((bmv.y < qmvmin.y) | (bmv.y > qmvmax.y)))</div><div>     {</div><div>         bmv.y = x265_min(x265_max(bmv.y, qmvmin.y), qmvmax.y);</div><div>+        bcost = subpelCompare(ref, bmv, satd) + mvcost(bmv);</div><div>     }</div><div> </div><div>     if (!bcost)</div><div>@@ -1113,6 +1148,11 @@</div><div>         for (int i = 1; i <= wl.hpel_dirs; i++)</div><div>         {</div><div>             MV qmv = bmv + square1[i] * 2;</div><div>+</div><div>+            /* skip invalid range */</div><div>+            if ((g_maxSlices > 1) & ((qmv.y < qmvmin.y) | (qmv.y > qmvmax.y)))</div><div>+                continue;</div><div>+</div><div>             int cost = ref->lowresQPelCost(fenc, blockOffset, qmv, sad) + mvcost(qmv);</div><div>             COPY2_IF_LT(bcost, cost, bdir, i);</div><div>         }</div><div>@@ -1124,6 +1164,11 @@</div><div>         for (int i = 1; i <= wl.qpel_dirs; i++)</div><div>         {</div><div>             MV qmv = bmv + square1[i];</div><div>+</div><div>+            /* skip invalid range */</div><div>+            if ((g_maxSlices > 1) & ((qmv.y < qmvmin.y) | (qmv.y > qmvmax.y)))</div><div>+                continue;</div><div>+</div><div>             int cost = ref->lowresQPelCost(fenc, blockOffset, qmv, satd) + mvcost(qmv);</div><div>             COPY2_IF_LT(bcost, cost, bdir, i);</div><div>         }</div><div>@@ -1189,6 +1234,9 @@</div><div>         }</div><div>     }</div><div> </div><div>+    // check mv range for slice bound</div><div>+    X265_CHECK((g_maxSlices == 1) | ((bmv.y >= qmvmin.y) & (bmv.y <= qmvmax.y)), "mv beyond range!");</div><div>+</div><div>     x265_emms();</div><div>     outQMv = bmv;</div><div>     return bcost;</div><div>diff -r b08109b3701e -r 9be03f087899 source/encoder/sao.cpp</div><div>--- a/source/encoder/sao.cpp<span class="m_-7124650680227569151Apple-tab-span" style="white-space:pre-wrap">        </span>Fri Oct 28 10:28:15 2016 +0800</div><div>+++ b/source/encoder/sao.cpp<span class="m_-7124650680227569151Apple-tab-span" style="white-space:pre-wrap">        </span>Mon Oct 31 12:31:24 2016 -0500</div><div>@@ -1206,12 +1206,19 @@</div><div> void SAO::rdoSaoUnitRowEnd(const SAOParam* saoParam, int numctus)</div><div> {</div><div>     if (!saoParam->bSaoFlag[0])</div><div>+    {</div><div>         m_depthSaoRate[0 * SAO_DEPTHRATE_SIZE + m_refDepth] = 1.0;</div><div>+    }</div><div>     else</div><div>+    {</div><div>+        assert(m_numNoSao[0] <= numctus);</div><div>         m_depthSaoRate[0 * SAO_DEPTHRATE_SIZE + m_refDepth] = m_numNoSao[0] / ((double)numctus);</div><div>+    }</div><div> </div><div>     if (!saoParam->bSaoFlag[1])</div><div>+    {</div><div>         m_depthSaoRate[1 * SAO_DEPTHRATE_SIZE + m_refDepth] = 1.0;</div><div>+    }</div><div>     else</div><div>         m_depthSaoRate[1 * SAO_DEPTHRATE_SIZE + m_refDepth] = m_numNoSao[1] / ((double)numctus);</div><div> }</div><div>diff -r b08109b3701e -r 9be03f087899 source/encoder/search.cpp</div><div>--- a/source/encoder/search.cpp<span class="m_-7124650680227569151Apple-tab-span" style="white-space:pre-wrap"> </span>Fri Oct 28 10:28:15 2016 +0800</div><div>+++ b/source/encoder/search.cpp<span class="m_-7124650680227569151Apple-tab-span" style="white-space:pre-wrap">     </span>Mon Oct 31 12:31:24 2016 -0500</div><div>@@ -2545,6 +2545,9 @@</div><div>     /* conditional clipping for frame parallelism */</div><div>     mvmin.y = X265_MIN(mvmin.y, (int16_t)m_refLagPixels);</div><div>     mvmax.y = X265_MIN(mvmax.y, (int16_t)m_refLagPixels);</div><div>+</div><div>+    /* conditional clipping for negative mv range */</div><div>+    mvmax.y = X265_MAX(mvmax.y, mvmin.y);</div><div> }</div><div> </div><div> /* Note: this function overwrites the RD cost variables of interMode, but leaves the sa8d cost unharmed */</div><div><br></div></div><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>
<br></blockquote></div><br></div></div>