[x265] [PATCH] Fix: SSIM calculation

ramya at multicorewareinc.com ramya at multicorewareinc.com
Thu Jun 2 14:09:41 CEST 2016


# HG changeset patch
# User Ramya Sriraman <ramya at multicorewareinc.com>
# Date 1464784734 -19800
#      Wed Jun 01 18:08:54 2016 +0530
# Node ID 4c189bdc74e13ed38a9bc1f6868b45ba4bc6b135
# Parent  6d3849d648f0be5a8e334f1d75a2f7cf93c86cb3
Fix: SSIM calculation

diff -r 6d3849d648f0 -r 4c189bdc74e1 source/encoder/framefilter.cpp
--- a/source/encoder/framefilter.cpp	Sun May 29 21:50:25 2016 +0800
+++ b/source/encoder/framefilter.cpp	Wed Jun 01 18:08:54 2016 +0530
@@ -553,10 +553,10 @@
         pixel *fenc = m_frame->m_fencPic->m_picOrg[0];
         intptr_t stride1 = reconPic->m_stride;
         intptr_t stride2 = m_frame->m_fencPic->m_stride;
-        uint32_t bEnd = ((row + 1) == (this->m_numRows - 1));
+        uint32_t bEnd = ((row) == (this->m_numRows - 1));
         uint32_t bStart = (row == 0);
         uint32_t minPixY = row * g_maxCUSize - 4 * !bStart;
-        uint32_t maxPixY = (row + 1) * g_maxCUSize - 4 * !bEnd;
+        uint32_t maxPixY = X265_MIN((row + 1) * g_maxCUSize - 4 * !bEnd, (uint32_t)m_param->sourceHeight);
         uint32_t ssim_cnt;
         x265_emms();
 
@@ -726,7 +726,7 @@
         {
             std::swap(sum0, sum1);
             for (uint32_t x = 0; x < width; x += 2)
-                primitives.ssim_4x4x2_core(&pix1[(4 * x + (z * stride1))], stride1, &pix2[(4 * x + (z * stride2))], stride2, &sum0[x]);
+                primitives.ssim_4x4x2_core(&pix1[4 * (x + (z * stride1))], stride1, &pix2[4 * (x + (z * stride2))], stride2, &sum0[x]);
         }
 
         for (uint32_t x = 0; x < width - 1; x += 4)


More information about the x265-devel mailing list