Index: branches/SHM-dev/source/Lib/TLibCommon/TComDataCU.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibCommon/TComDataCU.cpp	(revision 1417)
+++ branches/SHM-dev/source/Lib/TLibCommon/TComDataCU.cpp	(revision 1418)
@@ -102,4 +102,8 @@
 
   m_bDecSubCu          = false;
+
+#if FAST_INTRA_SHVC
+  ::memset( m_reducedSetIntraModes, 0, sizeof(m_reducedSetIntraModes) );
+#endif
 }
 
@@ -3368,12 +3372,12 @@
   {
     return( NUM_INTRA_MODE-1 );
-  }
-
-  // compute set of enabled modes g_reducedSetIntraModes[...]
+  }   
+
+  // compute set of enabled modes m_reducedSetIntraModes[...]
   Int authorizedMode[NUM_INTRA_MODE-1]={1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1};
   Int nbModes;
   for (nbModes=0; nbModes<3; nbModes++)  // add 3 MPMs 1st
   {
-    g_reducedSetIntraModes[nbModes] = uiIntraDirPred[nbModes];
+    m_reducedSetIntraModes[nbModes] = uiIntraDirPred[nbModes];
     authorizedMode[ uiIntraDirPred[nbModes] ] = 0;
   }
@@ -3382,5 +3386,5 @@
   if ( authorizedMode[iColBaseDir] )  //possibly add BL mode
   {
-    g_reducedSetIntraModes[nbModes++] = iColBaseDir;
+    m_reducedSetIntraModes[nbModes++] = iColBaseDir;
     authorizedMode[ iColBaseDir ] = 0;
   }
@@ -3389,26 +3393,38 @@
   if ( iRefMode > 1 )    //add neighboring modes of refMode
   {
-    UInt Left  = iRefMode;
-    UInt Right = iRefMode;
+    UInt left  = iRefMode;
+    UInt right = iRefMode;
     while ( nbModes < NB_REMAIN_MODES+3 )
     {
-      Left = ((Left + 29) % 32) + 2;
-      Right = ((Right - 1 ) % 32) + 2;
-      if ( authorizedMode[Left] )   g_reducedSetIntraModes[nbModes++] = Left;
-      if ( authorizedMode[Right] )  g_reducedSetIntraModes[nbModes++] = Right;
+      left = ((left + 29) % 32) + 2;
+      right = ((right - 1 ) % 32) + 2;
+      if( authorizedMode[left] )
+      {
+        m_reducedSetIntraModes[nbModes++] = left;
+      }
+      if( authorizedMode[right] )
+      {
+        m_reducedSetIntraModes[nbModes++] = right;
+      }
     }
   }
   else      //add pre-defined modes
   {
+    const UChar predefSetIntraModes[NUM_INTRA_MODE-1] = {26,10,18,34,2,22,14,30,6,24,12,28,8,20,16,32,4,17,19,15,21,13,23,11,25,9,27,7,29,5,31,3,33,0,2};
+
     Int  idx = 0;
-    while ( nbModes < NB_REMAIN_MODES+3 )
-    {
-      UInt mode = g_predefSetIntraModes[idx++];
-      if ( authorizedMode[mode] )   g_reducedSetIntraModes[nbModes++] = mode;
+    while( nbModes < NB_REMAIN_MODES+3 )
+    {
+      UInt mode = predefSetIntraModes[idx++];
+      if( authorizedMode[mode] )
+      {
+        m_reducedSetIntraModes[nbModes++] = mode;
+      }
     }
   }
 
   fullSetOfModes = 0;
-  return ( nbModes );
+
+  return nbModes;
 }
 #endif
Index: branches/SHM-dev/source/Lib/TLibCommon/TComDataCU.h
===================================================================
--- branches/SHM-dev/source/Lib/TLibCommon/TComDataCU.h	(revision 1417)
+++ branches/SHM-dev/source/Lib/TLibCommon/TComDataCU.h	(revision 1418)
@@ -89,4 +89,7 @@
 #if SVC_EXTENSION
   UInt          m_layerId;          ///< layer id
+#if FAST_INTRA_SHVC
+  UChar         m_reducedSetIntraModes[NUM_INTRA_MODE-1];
+#endif
 #endif
 
@@ -474,12 +477,12 @@
  
 #if SVC_EXTENSION
-  Void          setLayerId (UInt layerId) { m_layerId = layerId; }
-  UInt          getLayerId ()               { return m_layerId; }
-  UInt          getLayerIdx ()              { return m_pcSlice->getVPS()->getLayerIdxInVps(m_layerId); }
+  Void          setLayerId (UInt layerId)       { m_layerId = layerId; }
+  UInt          getLayerId ()                   { return m_layerId; }
+  UInt          getLayerIdx ()                  { return m_pcSlice->getVPS()->getLayerIdxInVps(m_layerId); }
 #if N0383_IL_CONSTRAINED_TILE_SETS_SEI
   Bool          isInterLayerReference(UChar uhInterDir, TComMvField& cMvFieldL0, TComMvField& cMvFieldL1);
 #endif
 #if FAST_INTRA_SHVC
-  Int           reduceSetOfIntraModes              (  UInt   uiAbsPartIdx, Int* uiIntraDirPred, Int &fullSetOfModes );
+  Int           reduceSetOfIntraModes(  UInt   uiAbsPartIdx, Int* uiIntraDirPred, Int &fullSetOfModes );
 #endif
 #if REF_IDX_ME_ZEROMV
@@ -490,4 +493,7 @@
   TComDataCU*   getBaseColCU( UInt refLayerIdc, UInt pelX, UInt pelY, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase, Bool motionMapping = false );
   Void          scaleBaseMV( UInt refLayerIdc, TComMvField& rcMvFieldEnhance, TComMvField& rcMvFieldBase );
+#if FAST_INTRA_SHVC
+  UChar         getReducedSetIntraModes(UChar idx)     { assert( idx < NUM_INTRA_MODE-1 ); return m_reducedSetIntraModes[idx]; }
+#endif
 #endif
 };
Index: branches/SHM-dev/source/Lib/TLibCommon/TComRom.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibCommon/TComRom.cpp	(revision 1417)
+++ branches/SHM-dev/source/Lib/TLibCommon/TComRom.cpp	(revision 1418)
@@ -726,8 +726,4 @@
 
 #if SVC_EXTENSION
-#if FAST_INTRA_SHVC
-UInt g_reducedSetIntraModes[NUM_INTRA_MODE-1] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; 
-UInt g_predefSetIntraModes[NUM_INTRA_MODE-1] = {26,10,18,34,2,22,14,30,6,24,12,28,8,20,16,32,4,17,19,15,21,13,23,11,25,9,27,7,29,5,31,3,33,0,2};
-#endif
 Int g_mvScalingFactor  [MAX_LAYERS][2] = {{0,0}, {0,0}};
 Int g_posScalingFactor [MAX_LAYERS][2] = {{0,0}, {0,0}};
Index: branches/SHM-dev/source/Lib/TLibCommon/TComRom.h
===================================================================
--- branches/SHM-dev/source/Lib/TLibCommon/TComRom.h	(revision 1417)
+++ branches/SHM-dev/source/Lib/TLibCommon/TComRom.h	(revision 1418)
@@ -172,8 +172,4 @@
 
 #if SVC_EXTENSION
-#if FAST_INTRA_SHVC
-extern UInt g_reducedSetIntraModes[NUM_INTRA_MODE-1];
-extern UInt g_predefSetIntraModes[NUM_INTRA_MODE-1];
-#endif
 extern Int g_mvScalingFactor  [MAX_LAYERS][2];
 extern Int g_posScalingFactor [MAX_LAYERS][2];
Index: branches/SHM-dev/source/Lib/TLibEncoder/TEncSearch.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 1417)
+++ branches/SHM-dev/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 1418)
@@ -2290,5 +2290,5 @@
           for( Int i=0; i < numModesForFullRD; i++ )
           {
-            uiRdModeList[ i ] = g_reducedSetIntraModes[ i ];
+            uiRdModeList[ i ] = pcCU->getReducedSetIntraModes(i);
           }
         }
@@ -2327,5 +2327,5 @@
             break;
           }
-          uiMode = ( iMode==0 ) ? g_reducedSetIntraModes[modeIdx] : uiMode; //(iMode=0) indicates reduced set of modes
+          uiMode = ( iMode==0 ) ? pcCU->getReducedSetIntraModes(modeIdx) : uiMode; //(iMode=0) indicates reduced set of modes
         }
 #endif
