Index: branches/SHM-dev/source/Lib/TLibDecoder/TDecGop.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibDecoder/TDecGop.cpp	(revision 1410)
+++ branches/SHM-dev/source/Lib/TLibDecoder/TDecGop.cpp	(revision 1419)
@@ -216,8 +216,8 @@
         UInt refLayerId = pcSlice->getRefPic(RefPicList(iRefList), iRefIndex)->getLayerId();
         UInt refLayerIdc = pcSlice->getReferenceLayerIdc(refLayerId);
-        assert( g_posScalingFactor[refLayerIdc][0] );
-        assert( g_posScalingFactor[refLayerIdc][1] );
-
-        printf( "%d(%d, {%1.2f, %1.2f}x)", pcSlice->getRefPOC(RefPicList(iRefList), iRefIndex), refLayerId, 65536.0/g_posScalingFactor[refLayerIdc][0], 65536.0/g_posScalingFactor[refLayerIdc][1] );
+        assert( pcSlice->getPic()->getPosScalingFactor(refLayerIdc, 0) );
+        assert( pcSlice->getPic()->getPosScalingFactor(refLayerIdc, 1) );
+
+        printf( "%d(%d, {%1.2f, %1.2f}x)", pcSlice->getRefPOC(RefPicList(iRefList), iRefIndex), refLayerId, 65536.0/pcSlice->getPic()->getPosScalingFactor(refLayerIdc, 0), 65536.0/pcSlice->getPic()->getPosScalingFactor(refLayerIdc, 1) );
       }
       else
Index: branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.cpp	(revision 1410)
+++ branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.cpp	(revision 1419)
@@ -1595,4 +1595,8 @@
     if( m_layerId > 0 && m_uiSliceIdx == 0 && ( !pcSlice->getVPS()->getSingleLayerForNonIrapFlag() || pcSlice->isIRAP() ) )
     {
+      // create buffers for scaling factors
+      m_pcPic->createMvScalingFactor(pcSlice->getNumILRRefIdx());
+      m_pcPic->createPosScalingFactor(pcSlice->getNumILRRefIdx());
+
       for( Int i = 0; i < pcSlice->getNumILRRefIdx(); i++ )
       {
@@ -1647,10 +1651,11 @@
              && ( (heightEL != heightBL) || (resamplingPhase.phaseVerLuma == 0 && resamplingPhase.phaseVerChroma == 0) ) );
 
-        g_mvScalingFactor[refLayerIdc][0] = widthEL  == widthBL  ? 4096 : Clip3(-4096, 4095, ((widthEL  << 8) + (widthBL  >> 1)) / widthBL);
-        g_mvScalingFactor[refLayerIdc][1] = heightEL == heightBL ? 4096 : Clip3(-4096, 4095, ((heightEL << 8) + (heightBL >> 1)) / heightBL);
-
-        g_posScalingFactor[refLayerIdc][0] = ((widthBL  << 16) + (widthEL  >> 1)) / widthEL;
-        g_posScalingFactor[refLayerIdc][1] = ((heightBL << 16) + (heightEL >> 1)) / heightEL;
-
+        m_pcPic->setMvScalingFactor( refLayerIdc, 
+                                     widthEL  == widthBL  ? 4096 : Clip3(-4096, 4095, ((widthEL  << 8) + (widthBL  >> 1)) / widthBL), 
+                                     heightEL == heightBL ? 4096 : Clip3(-4096, 4095, ((heightEL << 8) + (heightBL >> 1)) / heightBL) );
+
+        m_pcPic->setPosScalingFactor( refLayerIdc, 
+                                     ((widthBL  << 16) + (widthEL  >> 1)) / widthEL, 
+                                     ((heightBL << 16) + (heightEL >> 1)) / heightEL );
 #if CGS_3D_ASYMLUT 
         TComPicYuv* pBaseColRec = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec();
