Index: /branches/SHM-dev/source/Lib/TLibCommon/TComDataCU.cpp
===================================================================
--- /branches/SHM-dev/source/Lib/TLibCommon/TComDataCU.cpp	(revision 1295)
+++ /branches/SHM-dev/source/Lib/TLibCommon/TComDataCU.cpp	(revision 1296)
@@ -44,8 +44,4 @@
 //! \{
 
-#if ADAPTIVE_QP_SELECTION
-  TCoeff * TComDataCU::m_pcGlbArlCoeff[MAX_NUM_COMPONENT] = { NULL, NULL, NULL };
-#endif
-
 // ====================================================================================================================
 // Constructor / destructor / create / destroy
@@ -114,5 +110,5 @@
 Void TComDataCU::create( ChromaFormat chromaFormatIDC, UInt uiNumPartition, UInt uiWidth, UInt uiHeight, Bool bDecSubCu, Int unitSize
 #if ADAPTIVE_QP_SELECTION
-                        , Bool bGlobalRMARLBuffer
+                        , TCoeff *pParentARLBuffer
 #endif
                         )
@@ -172,24 +168,14 @@
 
 #if ADAPTIVE_QP_SELECTION
-      if( bGlobalRMARLBuffer )
-      {
-#if LAYER_CTB
-        if (m_pcGlbArlCoeff[compID] == NULL)
-        {
-          m_pcGlbArlCoeff[compID] = (TCoeff*)xMalloc(TCoeff, MAX_CU_SIZE * MAX_CU_SIZE);
-        }
-#else
-        if (m_pcGlbArlCoeff[compID] == NULL)
-        {
-          m_pcGlbArlCoeff[compID] = (TCoeff*)xMalloc(TCoeff, totalSize);
-        }
-#endif
-
-        m_pcArlCoeff[compID] = m_pcGlbArlCoeff[compID];
+      if( pParentARLBuffer != 0 )
+      {
+        m_pcArlCoeff[compID] = pParentARLBuffer;
         m_ArlCoeffIsAliasedAllocation = true;
+        pParentARLBuffer += totalSize;
       }
       else
       {
         m_pcArlCoeff[compID] = (TCoeff*)xMalloc(TCoeff, totalSize);
+        m_ArlCoeffIsAliasedAllocation = false;
       }
 #endif
@@ -342,10 +328,4 @@
           m_pcArlCoeff[comp] = NULL;
         }
-      }
-
-      if ( m_pcGlbArlCoeff[comp] )
-      {
-        xFree(m_pcGlbArlCoeff[comp]);
-        m_pcGlbArlCoeff[comp] = NULL;
       }
 #endif
Index: /branches/SHM-dev/source/Lib/TLibCommon/TComDataCU.h
===================================================================
--- /branches/SHM-dev/source/Lib/TLibCommon/TComDataCU.h	(revision 1295)
+++ /branches/SHM-dev/source/Lib/TLibCommon/TComDataCU.h	(revision 1296)
@@ -110,5 +110,4 @@
 #if ADAPTIVE_QP_SELECTION
   TCoeff*        m_pcArlCoeff[MAX_NUM_COMPONENT];  // ARL coefficient buffer (0->Y, 1->Cb, 2->Cr)
-  static TCoeff* m_pcGlbArlCoeff[MAX_NUM_COMPONENT]; // global ARL buffer  // TODO: Remove this static member variable.
   Bool           m_ArlCoeffIsAliasedAllocation;  ///< ARL coefficient buffer is an alias of the global buffer and must not be free()'d
 #endif
@@ -185,5 +184,5 @@
   Void          create                ( ChromaFormat chromaFormatIDC, UInt uiNumPartition, UInt uiWidth, UInt uiHeight, Bool bDecSubCu, Int unitSize
 #if ADAPTIVE_QP_SELECTION
-    , Bool bGlobalRMARLBuffer = false
+    , TCoeff *pParentARLBuffer = 0
 #endif
     );
Index: /branches/SHM-dev/source/Lib/TLibCommon/TComPicSym.cpp
===================================================================
--- /branches/SHM-dev/source/Lib/TLibCommon/TComPicSym.cpp	(revision 1295)
+++ /branches/SHM-dev/source/Lib/TLibCommon/TComPicSym.cpp	(revision 1296)
@@ -65,4 +65,5 @@
 ,m_ctuRsToTsAddrMap(NULL)
 ,m_saoBlkParams(NULL)
+,m_pParentARLBuffer(NULL)
 #if SVC_EXTENSION
 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI
@@ -118,4 +119,11 @@
   allocateNewSlice();
 
+#if ADAPTIVE_QP_SELECTION
+  if (m_pParentARLBuffer == NULL)
+  {
+     m_pParentARLBuffer = new TCoeff[uiMaxCuWidth*uiMaxCuHeight*MAX_NUM_COMPONENT];
+  }
+#endif
+
   for ( i=0; i<m_numCtusInFrame ; i++ )
   {
@@ -123,5 +131,5 @@
     m_pictureCtuArray[i]->create( chromaFormatIDC, m_numPartitionsInCtu, uiMaxCuWidth, uiMaxCuHeight, false, uiMaxCuWidth >> m_uhTotalDepth
 #if ADAPTIVE_QP_SELECTION
-      , true
+      , m_pParentARLBuffer
 #endif
       );
@@ -186,4 +194,7 @@
     delete[] m_saoBlkParams; m_saoBlkParams = NULL;
   }
+
+  delete [] m_pParentARLBuffer;
+  m_pParentARLBuffer = NULL;
 }
 
Index: /branches/SHM-dev/source/Lib/TLibCommon/TComPicSym.h
===================================================================
--- /branches/SHM-dev/source/Lib/TLibCommon/TComPicSym.h	(revision 1295)
+++ /branches/SHM-dev/source/Lib/TLibCommon/TComPicSym.h	(revision 1296)
@@ -107,4 +107,7 @@
 
   SAOBlkParam  *m_saoBlkParams;
+#if ADAPTIVE_QP_SELECTION
+  TCoeff*       m_pParentARLBuffer;
+#endif
   TComSPS       m_sps;
   TComPPS       m_pps;
