# HG changeset patch
# User Min Chen <[email protected]>
# Date 1479149577 21600
# Node ID a4376f9b27749620c9beee1c401dbed34a570751
# Parent  a378efc939e37f13ec1673fda055b1c3d0632e68
fix logic bug in weight module (the latest row was not weighted)
---
 source/encoder/reference.cpp |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)


diff -r a378efc939e3 -r a4376f9b2774 source/encoder/reference.cpp
--- a/source/encoder/reference.cppSun Nov 06 23:24:16 2016 +0100
+++ b/source/encoder/reference.cppMon Nov 14 12:52:57 2016 -0600
@@ -128,11 +128,12 @@
     intptr_t stride = reconPic->m_stride;
     int width   = reconPic->m_picWidth;
     int height  = (finishedRows - numWeightedRows) * g_maxCUSize;
-    if ((finishedRows == maxNumRows) && (reconPic->m_picHeight % g_maxCUSize))
+    /* the last row may be partial height */
+    if (finishedRows == maxNumRows - 1)
     {
-        /* the last row may be partial height */
-        height -= g_maxCUSize;
-        height += reconPic->m_picHeight % g_maxCUSize;
+        const int leftRows = (reconPic->m_picHeight & (g_maxCUSize - 1));
+
+        height += leftRows ? leftRows : g_maxCUSize;
     }
     int cuHeight = g_maxCUSize;
 
@@ -172,7 +173,7 @@
         }
 
         // Extending Bottom
-        if (finishedRows == maxNumRows)
+        if (finishedRows == maxNumRows - 1)
         {
             int picHeight = reconPic->m_picHeight;
             if (c) picHeight >>= reconPic->m_vChromaShift;

_______________________________________________
x265-devel mailing list
[email protected]
https://mailman.videolan.org/listinfo/x265-devel

Reply via email to