[x265] [PATCH] avoid allocating memory when aq-motion is disabled

ashok at multicorewareinc.com ashok at multicorewareinc.com
Tue Mar 13 09:11:17 CET 2018


# HG changeset patch
# User Ashok Kumar Mishra <ashok at multicorewareinc.com>
# Date 1520928613 -19800
#      Tue Mar 13 13:40:13 2018 +0530
# Node ID e40494afede308b18fb539f43b37d0ea3254b924
# Parent  7af1f634a849ba223bf016d1f4bb2d043457e1d2
avoid allocating memory when aq-motion is disabled

diff -r 7af1f634a849 -r e40494afede3 source/common/lowres.cpp
--- a/source/common/lowres.cpp	Sun Mar 11 20:01:49 2018 +0100
+++ b/source/common/lowres.cpp	Tue Mar 13 13:40:13 2018 +0530
@@ -55,14 +55,15 @@
     size_t padoffset = lumaStride * origPic->m_lumaMarginY + origPic->m_lumaMarginX;
     if (bAQEnabled)
     {
-        CHECKED_MALLOC_ZERO(qpAqOffset, double, cuCountFullRes);
-        CHECKED_MALLOC_ZERO(qpAqMotionOffset, double, cuCountFullRes);
+        CHECKED_MALLOC_ZERO(qpAqOffset, double, cuCountFullRes);        
         CHECKED_MALLOC_ZERO(invQscaleFactor, int, cuCountFullRes);
         CHECKED_MALLOC_ZERO(qpCuTreeOffset, double, cuCountFullRes);
         if (qgSize == 8)
             CHECKED_MALLOC_ZERO(invQscaleFactor8x8, int, cuCount);
     }
 
+	if (origPic->m_param->bAQMotion)
+		CHECKED_MALLOC_ZERO(qpAqMotionOffset, double, cuCountFullRes);
     if (origPic->m_param->bDynamicRefine)
         CHECKED_MALLOC_ZERO(blockVariance, uint32_t, cuCountFullRes);
     CHECKED_MALLOC(propagateCost, uint16_t, cuCount);
@@ -127,13 +128,13 @@
         X265_FREE(lowresMvCosts[0][i]);
         X265_FREE(lowresMvCosts[1][i]);
     }
-    X265_FREE(qpAqOffset);
-    X265_FREE(qpAqMotionOffset);
+    X265_FREE(qpAqOffset);    
     X265_FREE(invQscaleFactor);
     X265_FREE(qpCuTreeOffset);
     X265_FREE(propagateCost);
-    X265_FREE(blockVariance);
-    X265_FREE(invQscaleFactor8x8);
+	X265_FREE(invQscaleFactor8x8);
+	X265_FREE(qpAqMotionOffset);
+    X265_FREE(blockVariance);    
 }
 
 // (re) initialize lowres state


More information about the x265-devel mailing list