[x265] cugeom: fix uninitialized reported by valgrind

Satoshi Nakagawa nakagawa424 at oki.com
Mon Oct 27 05:50:54 CET 2014


# HG changeset patch
# User Satoshi Nakagawa <nakagawa424 at oki.com>
# Date 1414385068 -32400
#      Mon Oct 27 13:44:28 2014 +0900
# Node ID c1a8f6edab8f15d97e48ed872e2ae86456153e9b
# Parent  67d73bffd1fdaff3df673fe10b315d26b8464c5f
cugeom: fix uninitialized reported by valgrind

diff -r 67d73bffd1fd -r c1a8f6edab8f source/common/cudata.h
--- a/source/common/cudata.h	Sat Oct 25 22:16:39 2014 -0500
+++ b/source/common/cudata.h	Mon Oct 27 13:44:28 2014 +0900
@@ -76,8 +76,8 @@
         SPLIT           = 1<<4, // CU is currently split in four child CUs.
     };
     
-    // (1 + 4 + 16 + 64) + (1 + 8 + 1 + 8 + 1) = 104.
-    enum { MAX_GEOMS = 104 };
+    // (1 + 4 + 16 + 64) = 85.
+    enum { MAX_GEOMS = 85 };
 
     uint32_t log2CUSize;    // Log of the CU size.
     uint32_t childOffset;   // offset of the first child CU from current CU
diff -r 67d73bffd1fd -r c1a8f6edab8f source/encoder/frameencoder.cpp
--- a/source/encoder/frameencoder.cpp	Sat Oct 25 22:16:39 2014 -0500
+++ b/source/encoder/frameencoder.cpp	Mon Oct 27 13:44:28 2014 +0900
@@ -150,11 +150,12 @@
     if (!m_cuGeoms || !m_ctuGeomMap)
         return false;
 
+    CUGeom cuLocalData[CUGeom::MAX_GEOMS];
+    memset(cuLocalData, 0, sizeof(cuLocalData)); // temporal fix for memcmp
+
     int countGeoms = 0;
     for (uint32_t ctuAddr = 0; ctuAddr < m_numRows * m_numCols; ctuAddr++)
     {
-        CUGeom cuLocalData[CUGeom::MAX_GEOMS];
-        
         /* TODO: detach this logic from TComDataCU */
         encData.m_picCTU[ctuAddr].initCTU(*m_frame, ctuAddr, 0);
         encData.m_picCTU[ctuAddr].calcCTUGeoms(m_param->sourceWidth, m_param->sourceHeight, m_param->maxCUSize, cuLocalData);


More information about the x265-devel mailing list