[x265] [PATCH] Use correct width/height for chroma in ssd calculation

shazeb at multicorewareinc.com shazeb at multicorewareinc.com
Mon Dec 9 13:32:37 CET 2013


# HG changeset patch
# User Shazeb Nawaz Khan <shazeb at multicorewareinc.com>
# Date 1386592329 -19800
#      Mon Dec 09 18:02:09 2013 +0530
# Node ID a6035409caba484831443ab197fa7c94620b5cb7
# Parent  55d99b6651f2bcc866d14bc4ca4a01cbe2501252
Use correct width/height for chroma in ssd calculation

diff -r 55d99b6651f2 -r a6035409caba source/encoder/ratecontrol.cpp
--- a/source/encoder/ratecontrol.cpp	Mon Dec 09 16:08:24 2013 +0530
+++ b/source/encoder/ratecontrol.cpp	Mon Dec 09 18:02:09 2013 +0530
@@ -117,6 +117,8 @@
         }
     }
 
+    int width[3]  = { maxCol, maxCol >> 1, maxCol >> 1 };
+    int height[3] = { maxRow, maxRow >> 1, maxRow >> 1 };
     if (cfg->param.bEnableWeightedPred)
     {
         for (int i = 0; i < 3; i++)
@@ -124,7 +126,7 @@
             uint64_t sum, ssd;
             sum = pic->m_lowres.wp_sum[i];
             ssd = pic->m_lowres.wp_ssd[i];
-            pic->m_lowres.wp_ssd[i] = ssd - (sum * sum + (block_x * block_y) / 2) / (block_x * block_y);
+            pic->m_lowres.wp_ssd[i] = ssd - (sum * sum + (width[i] * height[i]) / 2) / (width[i] * height[i]);
         }
     }
 }


More information about the x265-devel mailing list