Index: branches/HTM-4.0-Orange/source/Lib/TLibCommon/TComPic.h
===================================================================
--- branches/HTM-4.0-Orange/source/Lib/TLibCommon/TComPic.h	(revision 117)
+++ branches/HTM-4.0-Orange/source/Lib/TLibCommon/TComPic.h	(revision 122)
@@ -113,4 +113,9 @@
   Int**                 m_aaiCodedOffset;
 
+#if OL_DEPTHLIMIT_A0044
+  UInt*                 m_texPartInfo;
+  UInt                  m_uiTexPartIndex;
+#endif
+
 public:
   TComPic();
@@ -243,4 +248,13 @@
   Void          removeResidualBuffer    ();
 #endif
+
+#if OL_DEPTHLIMIT_A0044
+  UInt        accessPartInfo        ( UInt count )   { return m_texPartInfo[m_uiTexPartIndex + count]; };
+  Void        incrementTexPartIndex (            )   { m_uiTexPartIndex += 2;    };
+  UInt        getTexPartIndex       ()               { return m_uiTexPartIndex;  };
+  Void        setTexPartIndex       ( UInt idx   )   { m_uiTexPartIndex = idx; };
+  Void        setPartInfo           ( UInt* texPart) { m_texPartInfo    = texPart;  };
+#endif
+
   Bool          getValidSlice                                  (Int sliceID)  {return m_pbValidSlice[sliceID];}
   Int           getSliceGranularityForNDBFilter                ()             {return m_sliceGranularityForNDBFilter;}
Index: branches/HTM-4.0-Orange/source/Lib/TLibEncoder/TEncCu.cpp
===================================================================
--- branches/HTM-4.0-Orange/source/Lib/TLibEncoder/TEncCu.cpp	(revision 117)
+++ branches/HTM-4.0-Orange/source/Lib/TLibEncoder/TEncCu.cpp	(revision 122)
@@ -455,32 +455,28 @@
   TComPic *pcTexture;
   TComDataCU * pcTextureCU;
-
-  static UInt* texPartInfo;
-  static UInt  uiTexPartIndex;
-  static Bool  depthMapDetect =  false;
-
+  Bool  depthMapDetect =  false;
   UInt         uiPrevTexPartIndex = 0;
 #if OL_DO_NOT_LIMIT_INTRA_SLICES_PART
-  static Bool bIntraSliceDetect = false;
+  Bool bIntraSliceDetect = false;
 #endif
   Bool bTry2NxN = false;
   Bool bTryNx2N = false;
-  if(uiDepth == 0)
-  {
-    pcTexture = rpcBestCU->getSlice()->getTexturePic();
-    if(pcTexture != NULL) //depth map being encoded
-    {
+  pcTexture = rpcBestCU->getSlice()->getTexturePic();
+  if(pcTexture != NULL) //depth map being encoded
+  {
+    depthMapDetect = true;
 #if OL_DO_NOT_LIMIT_INTRA_SLICES_PART
-      bIntraSliceDetect = (rpcBestCU->getSlice()->getSliceType()==I_SLICE);
-#endif
+    bIntraSliceDetect = (rpcBestCU->getSlice()->getSliceType()==I_SLICE);
+#endif
+    if(uiDepth == 0)
+    {
       pcTextureCU = pcTexture->getCU( rpcBestCU->getAddr() );
-      texPartInfo = pcTextureCU -> readPartInfo();
-      uiTexPartIndex = 0;
-      depthMapDetect = true;
-    }
-    else
-    {
-      depthMapDetect = false;
-    }
+      pcTexture->setPartInfo(pcTextureCU->readPartInfo());
+      pcTexture->setTexPartIndex(0); //pcTextureCU->setTexPartIndex(0); //uiTexPartIndex = 0;
+    }
+  }
+  else
+  {
+    depthMapDetect = false;
   }
 #endif
@@ -635,14 +631,14 @@
 #endif
       {
-        assert(uiDepth == (UInt)texPartInfo[uiTexPartIndex+1]);
-        if((UInt)texPartInfo[uiTexPartIndex] == 1) //NxN modes
+        assert(uiDepth == pcTexture->accessPartInfo(1));
+        if(pcTexture->accessPartInfo(0) == 1) //NxN modes
         {
           bTrySplit = true;
           bTryNx2N = true;
           bTry2NxN = true;
-          uiPrevTexPartIndex = uiTexPartIndex; 
-          uiTexPartIndex += 2;
+          uiPrevTexPartIndex = pcTexture->getTexPartIndex(); 
+          pcTexture->incrementTexPartIndex(); 
         }
-        else if((UInt)texPartInfo[uiTexPartIndex] == 0) //2Nx2N modes
+        else if(pcTexture->accessPartInfo(0) == 0) //2Nx2N modes
         {
           UInt uiTexdepth;
@@ -651,20 +647,20 @@
 
           //scan ahead till next depth
-          uiTexdepth = (UInt)texPartInfo[uiTexPartIndex+1];
-          uiPrevTexPartIndex = uiTexPartIndex;
-          uiTexPartIndex+=2;
-          temp_uiTexPartIndex = uiTexPartIndex; //store in case to rewind
-
-          while(uiTexdepth != (UInt)texPartInfo[uiTexPartIndex+1] && uiTexdepth != 0)
+          uiTexdepth = pcTexture->accessPartInfo(1);
+          uiPrevTexPartIndex = pcTexture->getTexPartIndex(); 
+          pcTexture->incrementTexPartIndex();
+          temp_uiTexPartIndex = pcTexture->getTexPartIndex(); //store in case to rewind
+
+          while(uiTexdepth != pcTexture->accessPartInfo(1) && uiTexdepth != 0)
           {
-            if((UInt)texPartInfo[uiTexPartIndex+1] < uiTexdepth)
+            if(pcTexture->accessPartInfo(1) < uiTexdepth)
             {
               break;
             }
-            uiTexPartIndex+=2;
-
-            if((UInt)texPartInfo[uiTexPartIndex+1] == OL_END_CU)
+            pcTexture->incrementTexPartIndex(); //uiTexPartIndex+=2;
+
+            if(pcTexture->accessPartInfo(1) == OL_END_CU)
             {
-              uiTexPartIndex = temp_uiTexPartIndex;
+              pcTexture->setTexPartIndex(temp_uiTexPartIndex); 
               uiTexdepth++;
               if(uiTexdepth >= g_uiMaxCUDepth)
@@ -675,5 +671,5 @@
           }
         }
-        else if((UInt)texPartInfo[uiTexPartIndex] == OL_END_CU)
+        else if(pcTexture->accessPartInfo(0) == OL_END_CU)
         {
           bTrySplit = false;
@@ -681,19 +677,19 @@
           bTry2NxN = false;
         }
-        else if((UInt)texPartInfo[uiTexPartIndex] == 2) //2NxN case
+        else if(pcTexture->accessPartInfo(0) == 2) //2NxN case
         {
           bTrySplit = false;
           bTryNx2N = false;
           bTry2NxN = true;
-          uiPrevTexPartIndex = uiTexPartIndex; 
-          uiTexPartIndex += 2;
+          uiPrevTexPartIndex = pcTexture->getTexPartIndex();  
+          pcTexture->incrementTexPartIndex(); ;
         }
-        else if((UInt)texPartInfo[uiTexPartIndex] == 3) //Nx2N case
+        else if(pcTexture->accessPartInfo(0) == 3) //Nx2N case
         {
           bTrySplit = false;
           bTryNx2N = true;
           bTry2NxN = false;
-          uiPrevTexPartIndex = uiTexPartIndex; 
-          uiTexPartIndex += 2;
+          uiPrevTexPartIndex = pcTexture->getTexPartIndex();  
+          pcTexture->incrementTexPartIndex(); ;
         }
       }
@@ -861,5 +857,4 @@
 #endif
                 {
-                  assert(uiDepth == (UInt)texPartInfo[uiPrevTexPartIndex+1]);
                   if (bTrySplit)
                   {
@@ -902,5 +897,4 @@
 #endif
             {
-              assert(uiDepth == (UInt)texPartInfo[uiPrevTexPartIndex+1]);
               if (bTryNx2N)
               {
@@ -953,5 +947,4 @@
 #endif
             {
-              assert(uiDepth == (UInt)texPartInfo[uiPrevTexPartIndex+1]);
               if (bTry2NxN)
               {
@@ -1023,5 +1016,4 @@
 #endif
               {
-                assert(uiDepth == (UInt)texPartInfo[uiPrevTexPartIndex+1]);
                 if (bTry2NxN)
                 {
@@ -1109,5 +1101,4 @@
 #endif
               {
-                assert(uiDepth == (UInt)texPartInfo[uiPrevTexPartIndex+1]);
                 if (bTry2NxN)
                 {
@@ -1198,5 +1189,4 @@
 #endif
               {
-                assert(uiDepth == (UInt)texPartInfo[uiPrevTexPartIndex+1]);
                 if (bTryNx2N)
                 {
@@ -1276,5 +1266,4 @@
 #endif
               {
-                assert(uiDepth == (UInt)texPartInfo[uiPrevTexPartIndex+1]);
                 if (bTryNx2N)
                 {
@@ -1423,5 +1412,4 @@
 #endif
             {
-              assert(uiDepth == (UInt)texPartInfo[uiPrevTexPartIndex+1]);
               if (bTrySplit)
               {
