Index: branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComDataCU.cpp
===================================================================
--- branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComDataCU.cpp	(revision 531)
+++ branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComDataCU.cpp	(revision 532)
@@ -4381,15 +4381,15 @@
   {
 #if H_3D_TMVP
-     Int iCurrViewId    = m_pcSlice->getViewIndex (); 
-     Int iCurrRefViewId = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getViewIndex (); 
-     Int iColViewId     = pColCU->getSlice()->getViewIndex(); 
-     Int iColRefViewId  = pColCU->getSlice()->getRefPic( eColRefPicList, pColCU->getCUMvField(eColRefPicList)->getRefIdx(uiAbsPartAddr))->getViewIndex(); 
-     iScale = xGetDistScaleFactor( iCurrViewId, iCurrRefViewId, iColViewId, iColRefViewId );
-     if ( iScale != 4096 )
-     {
-        rcMv = cColMv.scaleMv( iScale );
-     }
-     else
-     {
+    Int iCurrViewId    = m_pcSlice->getViewIndex (); 
+    Int iCurrRefViewId = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getViewIndex (); 
+    Int iColViewId     = pColCU->getSlice()->getViewIndex(); 
+    Int iColRefViewId  = pColCU->getSlice()->getRefPic( eColRefPicList, pColCU->getCUMvField(eColRefPicList)->getRefIdx(uiAbsPartAddr))->getViewIndex(); 
+    iScale = xGetDistScaleFactor( iCurrViewId, iCurrRefViewId, iColViewId, iColRefViewId );
+    if ( iScale != 4096 && m_pcSlice->getVPS()->getIvMvScalingFlag() ) 
+    {
+      rcMv = cColMv.scaleMv( iScale );
+    }
+    else
+    {
 #endif
        rcMv = cColMv;
Index: branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComPrediction.cpp
===================================================================
--- branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComPrediction.cpp	(revision 531)
+++ branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComPrediction.cpp	(revision 532)
@@ -2104,5 +2104,5 @@
 UInt TComPrediction::xPredWedgeFromTex( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt intraTabIdx )
 {
-  TComPic*      pcPicTex = pcCU->getSlice()->getPicLists()->getPic( pcCU->getSlice()->getViewIndex(), false, pcCU->getSlice()->getPOC() );
+  TComPic*      pcPicTex = pcCU->getSlice()->getTexturePic();
   assert( pcPicTex != NULL );
   TComDataCU*   pcColTexCU = pcPicTex->getCU(pcCU->getAddr());
@@ -2147,5 +2147,5 @@
 Void TComPrediction::xCopyTextureLumaBlock( TComDataCU* pcCU, UInt uiAbsPartIdx, Pel* piDestBlockY, UInt uiWidth, UInt uiHeight )
 {
-  TComPicYuv* pcPicYuvRef = pcCU->getSlice()->getPicLists()->getPic( pcCU->getSlice()->getViewIndex(), false, pcCU->getSlice()->getPOC() )->getPicYuvRec();
+  TComPicYuv* pcPicYuvRef = pcCU->getSlice()->getTexturePic()->getPicYuvRec();
   assert( pcPicYuvRef != NULL );
   Int         iRefStride = pcPicYuvRef->getStride();
Index: branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComSlice.cpp	(revision 531)
+++ branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComSlice.cpp	(revision 532)
@@ -73,7 +73,4 @@
 , m_pcPPS                         ( NULL )
 , m_pcPic                         ( NULL )
-#if H_3D
-, m_picLists                      ( NULL )
-#endif
 , m_colFromL0Flag                 ( 1 )
 , m_colRefIdx                     ( 0 )
@@ -973,7 +970,4 @@
 
   m_pcPic                = pSrc->m_pcPic;
-#if H_3D
-  m_picLists             = pSrc->m_picLists;
-#endif
   m_colFromL0Flag        = pSrc->m_colFromL0Flag;
   m_colRefIdx            = pSrc->m_colRefIdx;
@@ -1566,4 +1560,5 @@
     }
 #endif
+    m_ivMvScalingFlag = true; 
 #endif
 
@@ -1584,5 +1579,6 @@
   }
 #if H_3D_GEN
-  for( Int i = 0; i < MAX_NUM_LAYERS; i++ )  {
+  for( Int i = 0; i < MAX_NUM_LAYERS; i++ )
+  {
 #if H_3D_IV_MERGE
     m_ivMvPredFlag         [ i ] = false;
@@ -1594,5 +1590,5 @@
     m_depthRefinementFlag  [ i ] = false;
 #endif
-  }
+  }  
 #endif
 #endif
@@ -1604,4 +1600,21 @@
   if( m_hrdOpSetIdx      != NULL )     delete[] m_hrdOpSetIdx;
   if( m_cprmsPresentFlag != NULL )     delete[] m_cprmsPresentFlag;
+#if H_3D_DIM_DLT
+  for( Int i = 0; i < MAX_NUM_LAYERS; i++ )
+  {
+    if ( m_iDepthValue2Idx[i] != 0 ) 
+    {
+       xFree( m_iDepthValue2Idx[i] );
+       m_iDepthValue2Idx[i] = 0; 
+    }
+
+    if ( m_iIdx2DepthValue[i] != 0 ) 
+    {
+      xFree( m_iIdx2DepthValue[i] );
+      m_iIdx2DepthValue[i] = 0; 
+
+    }
+  }
+#endif
 }
 
Index: branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComSlice.h	(revision 531)
+++ branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComSlice.h	(revision 532)
@@ -546,4 +546,7 @@
   Int*        m_iIdx2DepthValue          [MAX_NUM_LAYERS   ];
 #endif
+#if H_3D_TMVP
+  Bool        m_ivMvScalingFlag; 
+#endif
 
 #endif
@@ -696,6 +699,9 @@
 #endif
 
-#endif
-
+#if H_3D_TMVP
+  Bool    getIvMvScalingFlag   (  )                       { return m_ivMvScalingFlag; }
+  Void    setIvMvScalingFlag   ( Bool b )                 { m_ivMvScalingFlag = b;    }  
+#endif
+#endif
 
   Void    setVpsProfilePresentFlag( Int layerSet, Bool val )               { m_vpsProfilePresentFlag[layerSet] = val;  }
@@ -1478,7 +1484,4 @@
   TComPPS*    m_pcPPS;
   TComPic*    m_pcPic;
-#if H_3D
-  TComPicLists* m_picLists;
-#endif
 #if ADAPTIVE_QP_SELECTION
   TComTrQuant* m_pcTrQuant;
@@ -1616,7 +1619,4 @@
   Int       getNumRefIdx        ( RefPicList e )                { return  m_aiNumRefIdx[e];             }
   TComPic*  getPic              ()                              { return  m_pcPic;                      }
-#if H_3D
-  TComPicLists* getPicLists     ()                              { return m_picLists; }
-#endif
   TComPic*  getRefPic           ( RefPicList e, Int iRefIdx)    { return  m_apcRefPicList[e][iRefIdx];  }
   Int       getRefPOC           ( RefPicList e, Int iRefIdx)    { return  m_aiRefPOCList[e][iRefIdx];   }
@@ -1693,7 +1693,4 @@
   Void      setNumRefIdx        ( RefPicList e, Int i )         { m_aiNumRefIdx[e]    = i;      }
   Void      setPic              ( TComPic* p )                  { m_pcPic             = p;      }
-#if H_3D
-  Void      setPicLists         ( TComPicLists* p )             { m_picLists          = p;      }
-#endif
   Void      setDepth            ( Int iDepth )                  { m_iDepth            = iDepth; }
   
Index: branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TypeDef.h	(revision 531)
+++ branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TypeDef.h	(revision 532)
@@ -71,5 +71,6 @@
 #if H_MV
 #define H_MV_FIX1071                      1  //< Fix on Fix1071, same as in HTM 11
-#define H_MV_ENC_DEC_TRAC                 0  //< CU/PU level tracking
+#define H_MV_FIX_VPS_POINTER              1  //< Changed m_vps in TEncCfg to pointer to avoid mismatches between layers and avoid erroneous shallow copy. 
+#define H_MV_ENC_DEC_TRAC                 1  //< CU/PU level tracking
 #endif
 
Index: branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecCAVLC.cpp
===================================================================
--- branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 531)
+++ branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 532)
@@ -981,13 +981,37 @@
       for( Int i = 0; i <= pcVPS->getMaxLayers() - 1; i++ )
       {
-        if( pcVPS->getDepthId( i ) )
-        {
-          READ_FLAG( uiCode, "vps_depth_modes_flag[i]" );             pcVPS->setVpsDepthModesFlag( i, uiCode == 1 ? true : false );
-          
+
+#if H_3D_ARP
+        pcVPS->setUseAdvRP  ( i, 0 );
+        pcVPS->setARPStepNum( i, 1 );
+#endif  
+        if ( i != 0 )
+        {
+          if( !( pcVPS->getDepthId( i ) == 1 ) )
+          {
+#if H_3D_IV_MERGE
+                READ_FLAG( uiCode, "iv_mv_pred_flag[i]");          pcVPS->setIvMvPredFlag         ( i, uiCode == 1 ? true : false );
+#endif
+#if H_3D_ARP
+                READ_FLAG( uiCode, "iv_res_pred_flag[i]"  );  pcVPS->setUseAdvRP  ( i, uiCode ); pcVPS->setARPStepNum( i, uiCode ? H_3D_ARP_WFNR : 1 );
+
+#endif
+#if H_3D_NBDV_REF
+                READ_FLAG( uiCode, "depth_refinement_flag[i]");    pcVPS->setDepthRefinementFlag  ( i, uiCode == 1 ? true : false );
+#endif
+#if H_3D_VSP
+                READ_FLAG( uiCode, "view_synthesis_pred_flag[i]"); pcVPS->setViewSynthesisPredFlag( i, uiCode == 1 ? true : false );
+#endif
+          }
+          else
+          {
+
+            READ_FLAG( uiCode, "vps_depth_modes_flag[i]" );             pcVPS->setVpsDepthModesFlag( i, uiCode == 1 ? true : false );
+            //          READ_FLAG( uiCode, "lim_qt_pred_flag[i]");                  pcVPS->setLimQtPreFlag     ( i, uiCode == 1 ? true : false ); 
 #if H_3D_DIM_DLT
-          if( pcVPS->getVpsDepthModesFlag( i ) )
-          {
-            READ_FLAG( uiCode, "use_dlt_flag[i]" );
-            pcVPS->setUseDLTFlag( i, uiCode == 1 ? true : false );
+            if( pcVPS->getVpsDepthModesFlag( i ) )
+            {
+              READ_FLAG( uiCode, "dlt_flag[i]" );                       pcVPS->setUseDLTFlag( i, uiCode == 1 ? true : false );
+            }
             if( pcVPS->getUseDLTFlag( i ) )
             {
@@ -995,6 +1019,6 @@
               UInt uiNumDepthValues;
               // parse number of values in DLT
-              READ_UVLC(uiNumDepthValues, "num_dlt_depth_values[i]");
-              
+              READ_UVLC(uiNumDepthValues, "num_depth_values_in_dlt[i]");
+
               // parse actual DLT values
               Int* aiIdx2DepthValue = (Int*) calloc(uiNumDepthValues, sizeof(Int));
@@ -1004,43 +1028,15 @@
                 aiIdx2DepthValue[d] = (Int)uiCode;
               }
-              
+
               pcVPS->setDepthLUTs(i, aiIdx2DepthValue, uiNumDepthValues);
-              
+
               // clean memory
               free(aiIdx2DepthValue);
             }
+#endif
           }
-#endif
-        }
-      }
-
-#if H_3D_GEN
-      for( Int layer = 0; layer <= pcVPS->getMaxLayers() - 1; layer++ )
-      {
-#if H_3D_ARP
-        pcVPS->setUseAdvRP  ( layer, 0 );
-        pcVPS->setARPStepNum( layer, 1 );
-#endif  
-        if (layer != 0)
-        {
-          if ( !( pcVPS->getDepthId( layer ) == 1 ) )
-          {
-#if H_3D_IV_MERGE
-            READ_FLAG( uiCode, "iv_mv_pred_flag[i]");          pcVPS->setIvMvPredFlag         ( layer, uiCode == 1 ? true : false );
-#endif
-#if H_3D_ARP
-            READ_FLAG( uiCode, "advanced_residual_pred_flag"  );  pcVPS->setUseAdvRP  ( layer, uiCode ); pcVPS->setARPStepNum( layer, uiCode ? H_3D_ARP_WFNR : 1 );
-
-#endif
-#if H_3D_NBDV_REF
-            READ_FLAG( uiCode, "depth_refinement_flag[i]");    pcVPS->setDepthRefinementFlag  ( layer, uiCode == 1 ? true : false );
-#endif
-#if H_3D_VSP
-            READ_FLAG( uiCode, "view_synthesis_pred_flag[i]"); pcVPS->setViewSynthesisPredFlag( layer, uiCode == 1 ? true : false );
-#endif
-          }          
-        }        
-      }
-#endif
+        }
+      }
+      READ_FLAG( uiCode, "iv_mv_scaling_flag");                       pcVPS->setIvMvScalingFlag( uiCode == 1 ? true : false ); 
 #else
       while ( xMoreRbspData() )
Index: branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecTop.cpp
===================================================================
--- branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecTop.cpp	(revision 531)
+++ branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecTop.cpp	(revision 532)
@@ -917,7 +917,4 @@
 
 #endif
-#if H_3D
-    pcSlice->setPicLists( m_ivPicLists );
-#endif
 
 #if H_3D_GEN
Index: branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncCavlc.cpp
===================================================================
--- branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 531)
+++ branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 532)
@@ -762,5 +762,5 @@
 #endif
 #if H_3D_ARP
-        WRITE_FLAG( pcVPS->getUseAdvRP             ( i ) ? 1 : 0,  "advanced_residual_pred_flag"  );
+        WRITE_FLAG( pcVPS->getUseAdvRP             ( i ) ? 1 : 0,  "iv_res_pred_flag[i]"  );
 #endif
 #if H_3D_NBDV_REF
@@ -771,27 +771,29 @@
 #endif
       }          
-    }        
-    if( pcVPS->getDepthId( i ) )
-    {
-      WRITE_FLAG( pcVPS->getVpsDepthModesFlag( i ),          "vps_depth_modes_flag[i]" );
-      
+      else
+      {
+        WRITE_FLAG( pcVPS->getVpsDepthModesFlag( i ) ? 1 : 0 ,          "vps_depth_modes_flag[i]" );
+        //WRITE_FLAG( pcVPS->getLimQtPredFlag    ( i ) ? 1 : 0 ,          "lim_qt_pred_flag[i]"     ); 
 #if H_3D_DIM_DLT
-      if( pcVPS->getVpsDepthModesFlag( i ) )
-      {
-        WRITE_FLAG( pcVPS->getUseDLTFlag( i ) ? 1 : 0, "use_dlt_flag[i]" );
+        if( pcVPS->getVpsDepthModesFlag( i ) )
+        {
+          WRITE_FLAG( pcVPS->getUseDLTFlag( i ) ? 1 : 0, "dlt_flag[i]" );
+        }
         if( pcVPS->getUseDLTFlag( i ) )
         {
           // code mapping
-          WRITE_UVLC(pcVPS->getNumDepthValues(i), "num_dlt_depth_values[i]");
+          WRITE_UVLC(pcVPS->getNumDepthValues(i), "num_depth_values_in_dlt[i]");
           for(Int d=0; d<pcVPS->getNumDepthValues(i); d++)
           {
             WRITE_UVLC( pcVPS->idx2DepthValue(i, d), "dlt_depth_value[i][d]" );
           }
-        }
-      }
-#endif
-    }
-
-  }  
+        }        
+#endif
+      }
+    }  
+  }
+#if H_3D_TMVP
+  WRITE_FLAG( pcVPS->getIvMvScalingFlag( ) ? 1 : 0 ,          "iv_mv_scaling_flag" );
+#endif
 #else
   WRITE_FLAG( 0,                                             "vps_extension2_flag" );
Index: branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncCfg.h
===================================================================
--- branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncCfg.h	(revision 531)
+++ branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncCfg.h	(revision 532)
@@ -322,5 +322,9 @@
   Bool      m_TransquantBypassEnableFlag;                     ///< transquant_bypass_enable_flag setting in PPS.
   Bool      m_CUTransquantBypassFlagValue;                    ///< if transquant_bypass_enable_flag, the fixed value to use for the per-CU cu_transquant_bypass_flag.
+#if H_MV_FIX_VPS_POINTER
+  TComVPS*  m_cVPS;                                           ///< pointer to VPS, same for all layers
+#else
   TComVPS                    m_cVPS;
+#endif
   Bool      m_recalculateQPAccordingToLambda;                 ///< recalculate QP value according to the lambda value
   Int       m_activeParameterSetsSEIEnabled;                  ///< enable active parameter set SEI message 
@@ -833,6 +837,11 @@
   Bool      getCUTransquantBypassFlagValue()          { return m_CUTransquantBypassFlagValue; }
   Void      setCUTransquantBypassFlagValue(Bool flag) { m_CUTransquantBypassFlagValue = flag; }
+#if H_MV_FIX_VPS_POINTER
+  Void      setVPS           ( TComVPS *p ) { m_cVPS = p;    }
+  TComVPS*  getVPS           ()             { return m_cVPS; }
+#else
   Void setVPS(TComVPS *p) { m_cVPS = *p; }
   TComVPS *getVPS() { return &m_cVPS; }
+#endif
   Void      setUseRecalculateQPAccordingToLambda ( Bool b ) { m_recalculateQPAccordingToLambda = b;    }
   Bool      getUseRecalculateQPAccordingToLambda ()         { return m_recalculateQPAccordingToLambda; }
Index: branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncGOP.cpp
===================================================================
--- branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 531)
+++ branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 532)
@@ -706,7 +706,4 @@
 #if H_3D
     pcSlice->setIvPicLists( m_ivPicLists );         
-#if H_3D
-    pcSlice->setPicLists( m_ivPicLists );
-#endif
 #if H_3D_IV_MERGE    
     assert( !m_pcEncTop->getIsDepth() || ( pcSlice->getTexturePic() != 0 ) );
Index: branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncSearch.cpp
===================================================================
--- branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 531)
+++ branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 532)
@@ -7277,5 +7277,5 @@
   Pel refDC1 = 0; Pel refDC2 = 0;
 
-  TComPic*      pcPicTex = pcCU->getSlice()->getPicLists()->getPic( pcCU->getSlice()->getViewIndex(), false, pcCU->getSlice()->getPOC() );
+  TComPic*      pcPicTex = pcCU->getSlice()->getTexturePic();
   assert( pcPicTex != NULL );
   TComDataCU* pcColTexCU = pcPicTex->getCU(pcCU->getAddr());
Index: branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncTop.cpp
===================================================================
--- branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncTop.cpp	(revision 531)
+++ branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncTop.cpp	(revision 532)
@@ -290,7 +290,16 @@
   
   /* set the VPS profile information */
+#if H_MV_FIX_VPS_POINTER
+  // This seems to be incorrect, but irrelevant for the MV-HEVC
+  *(m_cVPS->getPTL()) = *m_cSPS.getPTL();
+#if L0043_TIMING_INFO
+  m_cVPS->getTimingInfo()->setTimingInfoPresentFlag       ( false );
+#endif
+#else
   *m_cVPS.getPTL() = *m_cSPS.getPTL();
+
 #if L0043_TIMING_INFO
   m_cVPS.getTimingInfo()->setTimingInfoPresentFlag       ( false );
+#endif
 #endif
   // initialize PPS
@@ -668,5 +677,9 @@
 {
 #if H_MV
+#if H_MV_FIX_VPS_POINTER
+  if( getVPS()->getNumDirectRefLayers( getLayerIdInVps() ) > 0 )
+#else
   if( m_cVPS.getNumDirectRefLayers( getLayerIdInVps() ) > 0 )
+#endif
   {
     m_cPPS.setListsModificationPresentFlag( true );
