Index: branches/SHM-dev/source/Lib/TLibCommon/TComDataCU.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibCommon/TComDataCU.cpp	(revision 1500)
+++ branches/SHM-dev/source/Lib/TLibCommon/TComDataCU.cpp	(revision 1502)
@@ -411,12 +411,6 @@
   const TComSPS &sps=*(getSlice()->getSPS());
 
-#if SVC_EXTENSION
-  TComSlice * pcSlice = m_pcPic->getSlice(m_pcPic->getCurrSliceIdx());
-  const UInt picWidth = pcSlice->getPicWidthInLumaSamples();
-  const UInt picHeight = pcSlice->getPicHeightInLumaSamples();
-#else
   const UInt picWidth = sps.getPicWidthInLumaSamples();
   const UInt picHeight = sps.getPicHeightInLumaSamples();
-#endif
   const UInt granularityWidth = sps.getMaxCUWidth();
 
@@ -1154,9 +1148,5 @@
   UInt uiAbsZorderCUIdxLB = g_auiZscanToRaster[ m_absZIdxInCtu ] + ((m_puhHeight[0] / m_pcPic->getMinCUHeight()) - 1)*numPartInCtuWidth;
 
-#if SVC_EXTENSION
-  if( ( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxLB] + (m_pcPic->getPicSym()->getMinCUHeight() * uiPartUnitOffset)) >= m_pcSlice->getPicHeightInLumaSamples())
-#else
   if( ( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxLB] + (m_pcPic->getPicSym()->getMinCUHeight() * uiPartUnitOffset)) >= m_pcSlice->getSPS()->getPicHeightInLumaSamples())
-#endif
   {
     uiBLPartUnitIdx = MAX_UINT;
@@ -1202,9 +1192,5 @@
   const UInt numPartInCtuWidth = m_pcPic->getNumPartInCtuWidth();
 
-#if SVC_EXTENSION
-  if( ( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxRT] + (m_pcPic->getPicSym()->getMinCUHeight() * uiPartUnitOffset)) >= m_pcSlice->getPicWidthInLumaSamples() )
-#else
   if( ( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxRT] + (m_pcPic->getPicSym()->getMinCUHeight() * uiPartUnitOffset)) >= m_pcSlice->getSPS()->getPicWidthInLumaSamples() )
-#endif
   {
     uiARPartUnitIdx = MAX_UINT;
@@ -2394,11 +2380,6 @@
     Int ctuRsAddr = -1;
 
-#if SVC_EXTENSION
-    if (   ( ( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth () ) < m_pcSlice->getPicWidthInLumaSamples() )  // image boundary check
-        && ( ( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) < m_pcSlice->getPicHeightInLumaSamples() ) )
-#else
     if (   ( ( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelX() + g_auiRasterToPelX[uiAbsPartIdxTmp] + m_pcPic->getMinCUWidth () ) < m_pcSlice->getSPS()->getPicWidthInLumaSamples () )  // image boundary check
         && ( ( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelY() + g_auiRasterToPelY[uiAbsPartIdxTmp] + m_pcPic->getMinCUHeight() ) < m_pcSlice->getSPS()->getPicHeightInLumaSamples() ) )
-#endif    
     {
       if ( ( uiAbsPartIdxTmp % numPartInCtuWidth < numPartInCtuWidth - 1 ) &&           // is not at the last column of CTU
@@ -2731,11 +2712,6 @@
     Int ctuRsAddr = -1;
 
-#if SVC_EXTENSION
-    if (  ( ( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelX() + g_auiRasterToPelX[absPartIdx] + m_pcPic->getMinCUWidth () ) < m_pcSlice->getPicWidthInLumaSamples())   // image boundary check
-       && ( ( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelY() + g_auiRasterToPelY[absPartIdx] + m_pcPic->getMinCUHeight() ) < m_pcSlice->getPicHeightInLumaSamples() ) )    
-#else
     if (  ( ( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelX() + g_auiRasterToPelX[absPartIdx] + m_pcPic->getMinCUWidth () ) < m_pcSlice->getSPS()->getPicWidthInLumaSamples () )  // image boundary check
        && ( ( m_pcPic->getCtu(m_ctuRsAddr)->getCUPelY() + g_auiRasterToPelY[absPartIdx] + m_pcPic->getMinCUHeight() ) < m_pcSlice->getSPS()->getPicHeightInLumaSamples() ) )
-#endif    
     {
       if ( ( absPartIdx % numPartInCtuWidth < numPartInCtuWidth - 1 ) &&  // is not at the last column of CTU
@@ -2804,16 +2780,8 @@
   Int  iMvShift = 2;
   Int iOffset = 8;
-#if SVC_EXTENSION
-  Int iHorMax = ( m_pcSlice->getPicWidthInLumaSamples() + iOffset - (Int)m_uiCUPelX - 1 ) << iMvShift;
-#else
   Int iHorMax = ( sps.getPicWidthInLumaSamples() + iOffset - (Int)m_uiCUPelX - 1 ) << iMvShift;
-#endif
   Int iHorMin = (      -(Int)sps.getMaxCUWidth() - iOffset - (Int)m_uiCUPelX + 1 ) << iMvShift;
 
-#if SVC_EXTENSION
-  Int iVerMax = ( m_pcSlice->getPicHeightInLumaSamples() + iOffset - (Int)m_uiCUPelY - 1 ) << iMvShift;
-#else
   Int iVerMax = ( sps.getPicHeightInLumaSamples() + iOffset - (Int)m_uiCUPelY - 1 ) << iMvShift;
-#endif
   Int iVerMin = (      -(Int)sps.getMaxCUHeight() - iOffset - (Int)m_uiCUPelY + 1 ) << iMvShift;
 
Index: branches/SHM-dev/source/Lib/TLibCommon/TComLoopFilter.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibCommon/TComLoopFilter.cpp	(revision 1500)
+++ branches/SHM-dev/source/Lib/TLibCommon/TComLoopFilter.cpp	(revision 1502)
@@ -185,9 +185,5 @@
       UInt uiLPelX   = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsZorderIdx] ];
       UInt uiTPelY   = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsZorderIdx] ];
-#if SVC_EXTENSION
-      if( ( uiLPelX < pcCU->getSlice()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcCU->getSlice()->getPicHeightInLumaSamples() ) )
-#else
       if( ( uiLPelX < sps.getPicWidthInLumaSamples() ) && ( uiTPelY < sps.getPicHeightInLumaSamples() ) )
-#endif
       {
         xDeblockCU( pcCU, uiAbsZorderIdx, uiDepth+1, edgeDir );
@@ -566,11 +562,5 @@
   const TComSPS    &sps                           = *(pcCU->getSlice()->getSPS());
   const Bool        ppsTransquantBypassEnableFlag = pcCU->getSlice()->getPPS()->getTransquantBypassEnableFlag();
-
-#if SVC_EXTENSION
-  const Int bitDepthLuma                          = pcCU->getSlice()->getBitDepth(CHANNEL_TYPE_LUMA);
-#else
   const Int         bitDepthLuma                  = sps.getBitDepth(CHANNEL_TYPE_LUMA);
-#endif
-
   const Bool        lfCrossSliceBoundaryFlag      = pcCU->getSlice()->getLFCrossSliceBoundaryFlag();
 
@@ -691,9 +681,5 @@
         Pel        *piSrcCr        = pcPicYuvRec->getAddr( COMPONENT_Cr, pcCU->getCtuRsAddr(), uiAbsZorderIdx );
   const TComSPS    &sps            = *(pcCU->getSlice()->getSPS());
-#if SVC_EXTENSION
-  const Int         bitDepthChroma = pcCU->getSlice()->getBitDepth(CHANNEL_TYPE_CHROMA);
-#else  
   const Int         bitDepthChroma = sps.getBitDepth(CHANNEL_TYPE_CHROMA);
-#endif
 
   const UInt  uiPelsInPartChromaH = sps.getMaxCUWidth() >> (sps.getMaxTotalCUDepth()+pcPicYuvRec->getComponentScaleX(COMPONENT_Cb));
@@ -757,9 +743,5 @@
   }
 
-#if SVC_EXTENSION
-  const Int iBitdepthScale = 1 << (pcCU->getSlice()->getBitDepth(CHANNEL_TYPE_CHROMA)-8);
-#else
   const Int iBitdepthScale = 1 << (pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_CHROMA)-8);
-#endif
 
   for ( UInt iIdx = 0; iIdx < uiNumParts; iIdx++ )
Index: branches/SHM-dev/source/Lib/TLibCommon/TComPattern.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibCommon/TComPattern.cpp	(revision 1500)
+++ branches/SHM-dev/source/Lib/TLibCommon/TComPattern.cpp	(revision 1502)
@@ -132,9 +132,5 @@
   const Int  iAboveUnits      = iTUWidthInUnits  << 1;
   const Int  iLeftUnits       = iTUHeightInUnits << 1;
-#if SVC_EXTENSION
-  const Int  bitDepthForChannel = pcCU->getSlice()->getBitDepth(chType);
-#else
   const Int  bitDepthForChannel = sps.getBitDepth(chType);
-#endif
 
   assert(iTUHeightInUnits > 0 && iTUWidthInUnits > 0);
Index: branches/SHM-dev/source/Lib/TLibCommon/TComPic.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibCommon/TComPic.cpp	(revision 1500)
+++ branches/SHM-dev/source/Lib/TLibCommon/TComPic.cpp	(revision 1502)
@@ -79,12 +79,11 @@
 Void TComPic::create( const TComVPS &vps, const TComSPS &sps, const TComPPS &pps, const Bool bIsVirtual, const UInt layerId )
 {
-  const ChromaFormat chromaFormatIDC = vps.getChromaFormatIdc(&sps, layerId);
-  const Int          iWidth          = vps.getPicWidthInLumaSamples(&sps, layerId);
-  const Int          iHeight         = vps.getPicHeightInLumaSamples(&sps, layerId);
+  const ChromaFormat chromaFormatIDC = sps.getChromaFormatIdc();
+  const Int          iWidth          = sps.getPicWidthInLumaSamples();
+  const Int          iHeight         = sps.getPicHeightInLumaSamples();
   const UInt         uiMaxCuWidth    = sps.getMaxCUWidth();
   const UInt         uiMaxCuHeight   = sps.getMaxCUHeight();
   const UInt         uiMaxDepth      = sps.getMaxTotalCUDepth();
-  
-  const Window& conformanceWindow = vps.getConformanceWindow( &sps, layerId );
+  const Window& conformanceWindow    = sps.getConformanceWindow();
 
   m_layerId = layerId;
Index: branches/SHM-dev/source/Lib/TLibCommon/TComPic.h
===================================================================
--- branches/SHM-dev/source/Lib/TLibCommon/TComPic.h	(revision 1500)
+++ branches/SHM-dev/source/Lib/TLibCommon/TComPic.h	(revision 1502)
@@ -161,9 +161,5 @@
   Void          clearSliceBuffer()           {m_picSym.clearSliceBuffer();         }
 
-#if SVC_EXTENSION
-  const Window& getConformanceWindow() const { return m_picSym.getSlice(0)->getConformanceWindow(); }
-#else
   const Window& getConformanceWindow() const { return m_picSym.getSPS().getConformanceWindow(); }
-#endif
   Window        getDefDisplayWindow() const  { return m_picSym.getSPS().getVuiParametersPresentFlag() ? m_picSym.getSPS().getVuiParameters()->getDefaultDisplayWindow() : Window(); }
 
Index: branches/SHM-dev/source/Lib/TLibCommon/TComPicSym.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibCommon/TComPicSym.cpp	(revision 1500)
+++ branches/SHM-dev/source/Lib/TLibCommon/TComPicSym.cpp	(revision 1502)
@@ -84,23 +84,16 @@
 Void TComPicSym::create  ( const TComVPS& vps, const TComSPS &sps, const TComPPS &pps, UInt uiMaxDepth, const UInt layerId )
 {
+  m_vps = vps;
+#else
+Void TComPicSym::create  ( const TComSPS &sps, const TComPPS &pps, UInt uiMaxDepth )
+{
+#endif
   UInt i;
   m_sps = sps;
   m_pps = pps;
-  m_vps = vps;
-  
-  const ChromaFormat chromaFormatIDC = vps.getChromaFormatIdc(&sps, layerId);
-  const Int iPicWidth  = vps.getPicWidthInLumaSamples(&sps, layerId);
-  const Int iPicHeight = vps.getPicHeightInLumaSamples(&sps, layerId);
-#else
-Void TComPicSym::create  ( const TComSPS &sps, const TComPPS &pps, UInt uiMaxDepth )
-{
-  UInt i;
-  m_sps = sps;
-  m_pps = pps;
 
   const ChromaFormat chromaFormatIDC = sps.getChromaFormatIdc();
   const Int iPicWidth      = sps.getPicWidthInLumaSamples();
   const Int iPicHeight     = sps.getPicHeightInLumaSamples();
-#endif
 
   const UInt uiMaxCuWidth  = sps.getMaxCUWidth();
Index: branches/SHM-dev/source/Lib/TLibCommon/TComPicSym.h
===================================================================
--- branches/SHM-dev/source/Lib/TLibCommon/TComPicSym.h	(revision 1500)
+++ branches/SHM-dev/source/Lib/TLibCommon/TComPicSym.h	(revision 1502)
@@ -198,4 +198,5 @@
   Bool         getSkippedTileSetFlag( Int i )                        { return *(m_pbSkippedTileSetFlag + i); }
 #endif
+  Void         inferSpsForNonHEVCBL()                                { m_sps.inferSPS(0, &m_vps); }
 #endif //SVC_EXTENSION
 
Index: branches/SHM-dev/source/Lib/TLibCommon/TComPrediction.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibCommon/TComPrediction.cpp	(revision 1500)
+++ branches/SHM-dev/source/Lib/TLibCommon/TComPrediction.cpp	(revision 1502)
@@ -460,9 +460,5 @@
       const Int channelsBitDepthForPrediction = rTu.getCU()->getSlice()->getSPS()->getStreamBitDepth(channelType);
 #else
-#if SVC_EXTENSION
-      const Int channelsBitDepthForPrediction = rTu.getCU()->getSlice()->getBitDepth(channelType);
-#else
       const Int channelsBitDepthForPrediction = rTu.getCU()->getSlice()->getSPS()->getBitDepth(channelType);
-#endif
 #endif
       xPredIntraAng( channelsBitDepthForPrediction, ptrSrc+sw+1, sw, pDst, uiStride, iWidth, iHeight, channelType, uiDirMode, enableEdgeFilters );
@@ -605,9 +601,5 @@
   {
     const ComponentID compID=ComponentID(comp);
-#if SVC_EXTENSION
-    xPredInterBlk  (compID,  pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, pcYuvPred, bi, pcCU->getSlice()->getBitDepth(toChannelType(compID)) );
-#else
     xPredInterBlk  (compID,  pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, pcYuvPred, bi, pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID)) );
-#endif
   }
 }
@@ -659,9 +651,5 @@
   else
   {
-#if SVC_EXTENSION
-    xWeightedAverage( &m_acYuvPred[REF_PIC_LIST_0], &m_acYuvPred[REF_PIC_LIST_1], iRefIdx[REF_PIC_LIST_0], iRefIdx[REF_PIC_LIST_1], uiPartAddr, iWidth, iHeight, pcYuvPred, pcCU->getSlice()->getBitDepths() );
-#else
     xWeightedAverage( &m_acYuvPred[REF_PIC_LIST_0], &m_acYuvPred[REF_PIC_LIST_1], iRefIdx[REF_PIC_LIST_0], iRefIdx[REF_PIC_LIST_1], uiPartAddr, iWidth, iHeight, pcYuvPred, pcCU->getSlice()->getSPS()->getBitDepths() );
-#endif
   }
 }
Index: branches/SHM-dev/source/Lib/TLibCommon/TComSampleAdaptiveOffset.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibCommon/TComSampleAdaptiveOffset.cpp	(revision 1500)
+++ branches/SHM-dev/source/Lib/TLibCommon/TComSampleAdaptiveOffset.cpp	(revision 1502)
@@ -599,9 +599,5 @@
       Pel* resBlk     = resYuv->getAddr(component) + blkYPos*resStride + blkXPos;
 
-#if SVC_EXTENSION
-      offsetBlock( pPic->getSlice(0)->getBitDepth(toChannelType(component)), ctbOffset.typeIdc, ctbOffset.offset
-#else
       offsetBlock( pPic->getPicSym()->getSPS().getBitDepth(toChannelType(component)), ctbOffset.typeIdc, ctbOffset.offset
-#endif
                   , srcBlk, resBlk, srcStride, resStride, blkWidth, blkHeight
                   , isLeftAvail, isRightAvail
@@ -688,9 +684,5 @@
       UInt uiLPelX   = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsZorderIdx] ];
       UInt uiTPelY   = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsZorderIdx] ];
-#if SVC_EXTENSION
-      if( ( uiLPelX < pcCU->getSlice()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcCU->getSlice()->getPicHeightInLumaSamples() ) )
-#else
       if( ( uiLPelX < pcCU->getSlice()->getSPS()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples() ) )
-#endif
       {
         xPCMCURestoration( pcCU, uiAbsZorderIdx, uiDepth+1 );
@@ -739,9 +731,5 @@
   else
   {
-#if SVC_EXTENSION
-    uiPcmLeftShiftBit = pcCU->getSlice()->getBitDepth(toChannelType(compID)) - pcCU->getSlice()->getSPS()->getPCMBitDepth(toChannelType(compID));
-#else
     uiPcmLeftShiftBit = sps.getBitDepth(toChannelType(compID)) - sps.getPCMBitDepth(toChannelType(compID));
-#endif
   }
 
Index: branches/SHM-dev/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibCommon/TComSlice.cpp	(revision 1500)
+++ branches/SHM-dev/source/Lib/TLibCommon/TComSlice.cpp	(revision 1502)
@@ -506,5 +506,5 @@
                             );
 
-        Bool sameBitDepths = ( getBitDepth(CHANNEL_TYPE_LUMA) == ilpPic[refLayerIdc]->getSlice(0)->getBitDepth(CHANNEL_TYPE_LUMA) ) && ( getBitDepth(CHANNEL_TYPE_CHROMA) == ilpPic[refLayerIdc]->getSlice(0)->getBitDepth(CHANNEL_TYPE_CHROMA) );
+        Bool sameBitDepths = ( m_pcSPS->getBitDepth(CHANNEL_TYPE_LUMA) == ilpPic[refLayerIdc]->getSlice(0)->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) ) && ( m_pcSPS->getBitDepth(CHANNEL_TYPE_CHROMA) == ilpPic[refLayerIdc]->getSlice(0)->getSPS()->getBitDepth(CHANNEL_TYPE_CHROMA) );
 
         // motion resampling constraint
@@ -1824,9 +1824,5 @@
         }
 
-#if SVC_EXTENSION
-        const Int offsetScalingFactor = bUseHighPrecisionPredictionWeighting ? 1 : (1 << (getBitDepth(toChannelType(ComponentID(yuv)))-8));
-#else
         const Int offsetScalingFactor = bUseHighPrecisionPredictionWeighting ? 1 : (1 << (sps->getBitDepth(toChannelType(ComponentID(yuv)))-8));
-#endif
 
         pwp->w      = pwp->iWeight;
@@ -3280,245 +3276,4 @@
 }
 
-UInt TComSlice::getPicWidthInLumaSamples()
-{
-  UInt retVal, layerId = getLayerId();
-
-  if ( layerId == 0 || m_pcSPS->getV1CompatibleSPSFlag() == 1 )
-  {
-    if( layerId == 0 && m_pcVPS->getNonHEVCBaseLayerFlag() )
-    {
-      retVal = m_pcVPS->getVpsRepFormat(layerId)->getPicWidthVpsInLumaSamples();
-    }
-    else
-    {
-      retVal = m_pcSPS->getPicWidthInLumaSamples();
-    }
-  }
-  else
-  {
-    retVal = m_pcVPS->getVpsRepFormat(m_pcSPS->getUpdateRepFormatFlag() ? m_pcSPS->getUpdateRepFormatIndex() : m_pcVPS->getVpsRepFormatIdx(m_pcVPS->getLayerIdxInVps(layerId)))->getPicWidthVpsInLumaSamples();
-  }
-
-  return retVal;
-}
-
-UInt TComVPS::getPicWidthInLumaSamples( const TComSPS* sps, const UInt layerId ) const
-{
-  UInt retVal;
-
-  if ( layerId == 0 || sps->getV1CompatibleSPSFlag() == 1 )
-  {
-    if( layerId == 0 && m_nonHEVCBaseLayerFlag )
-    {
-      retVal = m_vpsRepFormat[layerId].getPicWidthVpsInLumaSamples();
-    }
-    else
-    {
-      retVal = sps->getPicWidthInLumaSamples();
-    }
-  }
-  else
-  {
-    retVal = m_vpsRepFormat[sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : m_vpsRepFormatIdx[m_layerIdxInVps[layerId]]].getPicWidthVpsInLumaSamples();
-  }
-
-  return retVal;
-}
-
-UInt TComSlice::getPicHeightInLumaSamples()
-{
-  UInt retVal, layerId = getLayerId();
-
-  if ( layerId == 0 || m_pcSPS->getV1CompatibleSPSFlag() == 1 )
-  {
-    if( layerId == 0 && m_pcVPS->getNonHEVCBaseLayerFlag() )
-    {
-      retVal = m_pcVPS->getVpsRepFormat(layerId)->getPicHeightVpsInLumaSamples();
-    }
-    else
-    {
-      retVal = m_pcSPS->getPicHeightInLumaSamples();
-    }
-  }
-  else
-  {
-    retVal = m_pcVPS->getVpsRepFormat(m_pcSPS->getUpdateRepFormatFlag() ? m_pcSPS->getUpdateRepFormatIndex() : m_pcVPS->getVpsRepFormatIdx(m_pcVPS->getLayerIdxInVps(layerId)))->getPicHeightVpsInLumaSamples();
-  }
-
-  return retVal;
-}
-
-UInt TComVPS::getPicHeightInLumaSamples( const TComSPS* sps, const UInt layerId ) const
-{
-  UInt retVal;
-
-  if ( layerId == 0 || sps->getV1CompatibleSPSFlag() == 1 )
-  {
-    if( layerId == 0 && m_nonHEVCBaseLayerFlag )
-    {
-      retVal = m_vpsRepFormat[layerId].getPicHeightVpsInLumaSamples();
-    }
-    else
-    {
-      retVal = sps->getPicHeightInLumaSamples();
-    }
-  }
-  else
-  {
-    retVal = m_vpsRepFormat[sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : m_vpsRepFormatIdx[m_layerIdxInVps[layerId]]].getPicHeightVpsInLumaSamples();
-  }
-
-  return retVal;
-}
-
-ChromaFormat TComSlice::getChromaFormatIdc()
-{
-  ChromaFormat retVal;
-  UInt layerId = getLayerId();
-
-  if( layerId == 0 || m_pcSPS->getV1CompatibleSPSFlag() == 1 )
-  {
-    if( layerId == 0 && m_pcVPS->getNonHEVCBaseLayerFlag() )
-    {
-      retVal = m_pcVPS->getVpsRepFormat(layerId)->getChromaFormatVpsIdc();
-    }
-    else
-    {
-      retVal = m_pcSPS->getChromaFormatIdc();
-    }
-  }
-  else
-  {
-    retVal = m_pcVPS->getVpsRepFormat(m_pcSPS->getUpdateRepFormatFlag() ? m_pcSPS->getUpdateRepFormatIndex() : m_pcVPS->getVpsRepFormatIdx(m_pcVPS->getLayerIdxInVps(layerId)))->getChromaFormatVpsIdc();
-  }
-
-  return retVal;
-}
-
-ChromaFormat TComVPS::getChromaFormatIdc( const TComSPS* sps, const UInt layerId ) const
-{
-  ChromaFormat retVal;
-
-  if( layerId == 0 || sps->getV1CompatibleSPSFlag() == 1 )
-  {
-    if( layerId == 0 && m_nonHEVCBaseLayerFlag )
-    {
-      retVal = m_vpsRepFormat[layerId].getChromaFormatVpsIdc();
-    }
-    else
-    {
-      retVal = sps->getChromaFormatIdc();
-    }
-  }
-  else
-  {
-    retVal = m_vpsRepFormat[sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : m_vpsRepFormatIdx[m_layerIdxInVps[layerId]]].getChromaFormatVpsIdc();
-  }
-
-  return retVal;
-}
-
-BitDepths& TComSlice::getBitDepths()
-{
-  static BitDepths bitDepths;
-
-  bitDepths.recon[CHANNEL_TYPE_LUMA] = getBitDepth(CHANNEL_TYPE_LUMA);
-  bitDepths.recon[CHANNEL_TYPE_CHROMA] = getBitDepth(CHANNEL_TYPE_CHROMA);
-
-  return bitDepths;
-}
-
-UInt TComSlice::getBitDepth(ChannelType type) const
-{
-  UInt retVal, layerId = getLayerId();
-
-  if( layerId == 0 || m_pcSPS->getV1CompatibleSPSFlag() == 1 )
-  {
-    if( layerId == 0 && m_pcVPS->getNonHEVCBaseLayerFlag() )
-    {
-      retVal = m_pcVPS->getVpsRepFormat(layerId)->getBitDepthVps(type);
-    }
-    else
-    {
-      retVal = m_pcSPS->getBitDepth(type);
-    }
-  }
-  else
-  {
-    retVal = m_pcVPS->getVpsRepFormat(m_pcSPS->getUpdateRepFormatFlag() ? m_pcSPS->getUpdateRepFormatIndex() : m_pcVPS->getVpsRepFormatIdx(m_pcVPS->getLayerIdxInVps(layerId)))->getBitDepthVps(type);
-  }
-
-  return retVal;
-}
-
-UInt TComVPS::getBitDepth( ChannelType type, const TComSPS* sps, const UInt layerId ) const
-{
-  UInt retVal;
-
-  if( layerId == 0 || sps->getV1CompatibleSPSFlag() == 1 )
-  {
-    if( layerId == 0 && m_nonHEVCBaseLayerFlag )
-    {
-      retVal = m_vpsRepFormat[layerId].getBitDepthVps(type);
-    }
-    else
-    {
-      retVal = sps->getBitDepth(type);
-    }
-  }
-  else
-  {
-    retVal = m_vpsRepFormat[sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : m_vpsRepFormatIdx[m_layerIdxInVps[layerId]]].getBitDepthVps(type);
-  }
-
-  return retVal;
-}
-
-const BitDepths& TComVPS::getBitDepths( const TComSPS* sps, const UInt layerId ) const
-{
-  static BitDepths bitDepths;
-  bitDepths.recon[CHANNEL_TYPE_LUMA]   = getBitDepth(CHANNEL_TYPE_LUMA, sps, layerId);
-  bitDepths.recon[CHANNEL_TYPE_CHROMA] = getBitDepth(CHANNEL_TYPE_CHROMA, sps, layerId);
-  return bitDepths;
-}
-
-const Window& TComSlice::getConformanceWindow() const
-{
-  if ( m_layerId == 0 || m_pcSPS->getV1CompatibleSPSFlag() == 1 )
-  {
-    if( m_layerId == 0 && m_pcVPS->getNonHEVCBaseLayerFlag() )
-    {
-      return m_pcVPS->getVpsRepFormat(m_layerId)->getConformanceWindowVps();
-    }
-    else
-    {
-      return m_pcSPS->getConformanceWindow();
-    }
-  }
-  else
-  {
-    return m_pcVPS->getVpsRepFormat(m_pcSPS->getUpdateRepFormatFlag() ? m_pcSPS->getUpdateRepFormatIndex() : m_pcVPS->getVpsRepFormatIdx(m_pcVPS->getLayerIdxInVps(m_layerId)))->getConformanceWindowVps();
-  }
-}
-
-const Window& TComVPS::getConformanceWindow( const TComSPS* sps, const UInt layerId ) const
-{
-  if ( layerId == 0 || sps->getV1CompatibleSPSFlag() == 1 )
-  {
-    if( layerId == 0 && m_nonHEVCBaseLayerFlag )
-    {
-      return m_vpsRepFormat[layerId].getConformanceWindowVps();
-    }
-    else
-    {
-      return sps->getConformanceWindow();
-    }
-  }
-  else
-  {
-    return m_vpsRepFormat[sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : m_vpsRepFormatIdx[m_layerIdxInVps[layerId]]].getConformanceWindowVps();
-  }
-}
-
 RepFormat::RepFormat()
 #if AUXILIARY_PICTURES
@@ -3856,4 +3611,36 @@
   return numPocBeforeCurr;
 }
+
+Void TComSPS::inferSPS( const UInt layerId, TComVPS* vps )
+{
+  RepFormat* repFormat = NULL;
+
+  if( layerId == 0 || m_bV1CompatibleSPSFlag == 1 )
+  {
+    if( layerId == 0 && vps->getNonHEVCBaseLayerFlag() )
+    {
+      repFormat = vps->getVpsRepFormat(layerId);
+    }
+  }
+  else
+  {
+    repFormat = vps->getVpsRepFormat(m_updateRepFormatFlag ? m_updateRepFormatIndex : vps->getVpsRepFormatIdx(vps->getLayerIdxInVps(layerId)));
+  }
+
+  if( repFormat )
+  {
+    m_chromaFormatIdc = repFormat->getChromaFormatVpsIdc();
+    m_picWidthInLumaSamples = repFormat->getPicWidthVpsInLumaSamples();
+    m_picHeightInLumaSamples = repFormat->getPicHeightVpsInLumaSamples();
+
+    m_bitDepths.recon[CHANNEL_TYPE_LUMA] = repFormat->getBitDepthVps(CHANNEL_TYPE_LUMA);
+    m_bitDepths.recon[CHANNEL_TYPE_CHROMA] = repFormat->getBitDepthVps(CHANNEL_TYPE_CHROMA);
+
+    m_qpBDOffset[CHANNEL_TYPE_LUMA] = (m_bitDepths.recon[CHANNEL_TYPE_LUMA] - 8) * 6;
+    m_qpBDOffset[CHANNEL_TYPE_CHROMA] = (m_bitDepths.recon[CHANNEL_TYPE_CHROMA] - 8) * 6;
+
+    m_conformanceWindow = repFormat->getConformanceWindowVps();
+  }
+}
 #endif //SVC_EXTENSION
 
Index: branches/SHM-dev/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- branches/SHM-dev/source/Lib/TLibCommon/TComSlice.h	(revision 1500)
+++ branches/SHM-dev/source/Lib/TLibCommon/TComSlice.h	(revision 1502)
@@ -1130,11 +1130,4 @@
   Void              checkNecessaryLayerFlagCondition();
   Void              calculateMaxSLInLayerSets();
-
-  ChromaFormat      getChromaFormatIdc( const TComSPS* sps, const UInt layerId ) const;
-  UInt              getPicHeightInLumaSamples( const TComSPS* sps, const UInt layerId ) const;
-  UInt              getPicWidthInLumaSamples( const TComSPS* sps, const UInt layerId ) const;
-  UInt              getBitDepth( ChannelType type, const TComSPS* sps, const UInt layerId ) const;
-  const BitDepths&  getBitDepths( const TComSPS* sps, const UInt layerId ) const;
-  const Window&     getConformanceWindow( const TComSPS* sps, const UInt layerId ) const;
 #endif //SVC_EXTENSION
 };
@@ -1604,4 +1597,6 @@
   Void                   setInferScalingListFlag( Bool flag )                                            { m_inferScalingListFlag = flag;                                       }
   Void                   setScalingListRefLayerId( UInt layerId )                                        { m_scalingListRefLayerId = layerId;                                   }
+
+  Void                   inferSPS( const UInt layerId, TComVPS* vps );
 #endif //SVC_EXTENSION
 };
@@ -2399,18 +2394,6 @@
   Bool                        getCrossLayerBLAFlag  ()                               { return m_bCrossLayerBLAFlag;                                  }
   Void                        setCrossLayerBLAFlag  (Bool b)                         { m_bCrossLayerBLAFlag = b;                                     }
-
   Int                         getNumNegativeRpsCurrTempList();
-
-  UInt                        getPicWidthInLumaSamples();
-  UInt                        getPicHeightInLumaSamples();
-  ChromaFormat                getChromaFormatIdc();
-  UInt                        getBitDepth(ChannelType type) const;
-  BitDepths&                  getBitDepths();
-  Int                         getQpBDOffset(ChannelType type) const                  { return (getBitDepth(type) - 8) * 6;                           }
-
-  const Window&               getConformanceWindow() const;
-
   Void                        setILRPic(TComPic **pcIlpPic);
-
   Int                         getPocResetIdc()                                       { return m_pocResetIdc;                                         }
   Void                        setPocResetIdc(Int b)                                  { m_pocResetIdc = b;                                            }
Index: branches/SHM-dev/source/Lib/TLibCommon/TComTU.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibCommon/TComTU.cpp	(revision 1500)
+++ branches/SHM-dev/source/Lib/TLibCommon/TComTU.cpp	(revision 1502)
@@ -47,9 +47,5 @@
 
 TComTU::TComTU(TComDataCU *pcCU, const UInt absPartIdxCU, const UInt cuDepth, const UInt initTrDepthRelCU)
-#if SCALABLE_REXT
-  : mChromaFormat(pcCU->getSlice()->getChromaFormatIdc()),
-#else
   : mChromaFormat(pcCU->getSlice()->getSPS()->getChromaFormatIdc()),
-#endif
     mbProcessLastOfLevel(true), // does not matter. the top level is not 4 quadrants.
     mCuDepth(cuDepth),
Index: branches/SHM-dev/source/Lib/TLibCommon/TComTrQuant.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibCommon/TComTrQuant.cpp	(revision 1500)
+++ branches/SHM-dev/source/Lib/TLibCommon/TComTrQuant.cpp	(revision 1502)
@@ -114,9 +114,5 @@
   *this = QpParam(cu.getQP( 0 ),
                   toChannelType(compID),
-#if SVC_EXTENSION
-                  cu.getSlice()->getQpBDOffset(toChannelType(compID)),
-#else
                   cu.getSlice()->getSPS()->getQpBDOffset(toChannelType(compID)),
-#endif
                   chromaQpOffset,
                   cu.getPic()->getChromaFormat());
@@ -1143,9 +1139,5 @@
   TComDataCU* pcCU          = rTu.getCU();
   const UInt uiAbsPartIdx   = rTu.GetAbsPartIdxTU();
-#if SVC_EXTENSION
-  const Int channelBitDepth = pcCU->getSlice()->getBitDepth(toChannelType(compID));
-#else
   const Int channelBitDepth = pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID));
-#endif
 
   TCoeff* piCoef    = pSrc;
@@ -1345,9 +1337,5 @@
   const Int                  channelBitDepth    = pcCU->getSlice()->getSPS()->getStreamBitDepth(toChannelType(compID));
 #else
-#if SVC_EXTENSION
-  const Int                  channelBitDepth    = pcCU->getSlice()->getBitDepth(toChannelType(compID));
-#else
   const Int                  channelBitDepth    = pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID));
-#endif
 #endif
 
@@ -1529,9 +1517,5 @@
       else
       {
-#if SVC_EXTENSION
-        const Int channelBitDepth=pcCU->getSlice()->getBitDepth(toChannelType(compID));
-#else
         const Int channelBitDepth=pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID));
-#endif
         xT( channelBitDepth, rTu.useDST(compID), pcResidual, uiStride, m_plTempCoeff, uiWidth, uiHeight, pcCU->getSlice()->getSPS()->getMaxLog2TrDynamicRange(toChannelType(compID)) );
       }
@@ -1667,9 +1651,5 @@
       const Int channelBitDepth = pcCU->getSlice()->getSPS()->getStreamBitDepth(toChannelType(compID));
 #else
-#if SVC_EXTENSION
-      const Int channelBitDepth = pcCU->getSlice()->getBitDepth(toChannelType(compID));
-#else
       const Int channelBitDepth = pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID));
-#endif
 #endif
       xIT( channelBitDepth, rTu.useDST(compID), m_plTempCoeff, pcResidual, uiStride, uiWidth, uiHeight, pcCU->getSlice()->getSPS()->getMaxLog2TrDynamicRange(toChannelType(compID)) );
@@ -2045,9 +2025,5 @@
   const Int height          = rect.height;
   const Int maxLog2TrDynamicRange = rTu.getCU()->getSlice()->getSPS()->getMaxLog2TrDynamicRange(toChannelType(component));
-#if SVC_EXTENSION
-  const Int channelBitDepth = rTu.getCU()->getSlice()->getBitDepth(toChannelType(component));
-#else
   const Int channelBitDepth = rTu.getCU()->getSlice()->getSPS()->getBitDepth(toChannelType(component));
-#endif
 
   Int iTransformShift = getTransformShift(channelBitDepth, rTu.GetEquivalentLog2TrSize(component), maxLog2TrDynamicRange);
@@ -2101,9 +2077,5 @@
   const Int channelBitDepth = rTu.getCU()->getSlice()->getSPS()->getStreamBitDepth(toChannelType(component));
 #else
-#if SVC_EXTENSION
-  const Int channelBitDepth = rTu.getCU()->getSlice()->getBitDepth(toChannelType(component));
-#else
   const Int channelBitDepth = rTu.getCU()->getSlice()->getSPS()->getBitDepth(toChannelType(component));
-#endif
 #endif
 
@@ -2175,9 +2147,5 @@
   const Bool             extendedPrecision = pcCU->getSlice()->getSPS()->getSpsRangeExtension().getExtendedPrecisionProcessingFlag();
   const Int              maxLog2TrDynamicRange = pcCU->getSlice()->getSPS()->getMaxLog2TrDynamicRange(toChannelType(compID));
-#if SVC_EXTENSION
-  const Int              channelBitDepth = rTu.getCU()->getSlice()->getBitDepth(channelType);
-#else
   const Int              channelBitDepth = rTu.getCU()->getSlice()->getSPS()->getBitDepth(channelType);
-#endif
 
   /* for 422 chroma blocks, the effective scaling applied during transformation is not a power of 2, hence it cannot be
@@ -3364,9 +3332,5 @@
   const UInt           uiHeight                       = rect.height;
   const Int            maxLog2TrDynamicRange          = pcCU->getSlice()->getSPS()->getMaxLog2TrDynamicRange(toChannelType(compID));
-#if SVC_EXTENSION
-  const Int            channelBitDepth                = pcCU->getSlice()->getBitDepth(toChannelType(compID));
-#else
   const Int            channelBitDepth                = pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID));
-#endif
   const Int            iTransformShift                = getTransformShift(channelBitDepth, rTu.GetEquivalentLog2TrSize(compID), maxLog2TrDynamicRange);
   const Int            scalingListType                = getScalingListType(pcCU->getPredictionMode(uiAbsPartIdx), compID);
@@ -3431,9 +3395,5 @@
   const Int            channelBitDepth    = pcCU->getSlice()->getSPS()->getStreamBitDepth(toChannelType(compID));
 #else
-#if SVC_EXTENSION
-  const Int            channelBitDepth    = pcCU->getSlice()->getBitDepth(toChannelType(compID));
-#else
   const Int            channelBitDepth    = pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID));
-#endif
 #endif
   const Int            iTransformShift    = getTransformShift(channelBitDepth, rTu.GetEquivalentLog2TrSize(compID), maxLog2TrDynamicRange);
Index: branches/SHM-dev/source/Lib/TLibCommon/TComUpsampleFilter.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibCommon/TComUpsampleFilter.cpp	(revision 1500)
+++ branches/SHM-dev/source/Lib/TLibCommon/TComUpsampleFilter.cpp	(revision 1502)
@@ -64,6 +64,6 @@
   const Window &windowRL = currSlice->getPPS()->getRefLayerWindowForLayer(refLayerId);
 
-  Int bitDepthLuma = currSlice->getBitDepth(CHANNEL_TYPE_LUMA);
-  Int bitDepthChroma = currSlice->getBitDepth(CHANNEL_TYPE_CHROMA);
+  Int bitDepthLuma = currSlice->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA);
+  Int bitDepthChroma = currSlice->getSPS()->getBitDepth(CHANNEL_TYPE_CHROMA);
 
   //========== Y component upsampling ===========
@@ -76,7 +76,15 @@
   Int strideEL  = pcUsPic->getStride(COMPONENT_Y);
 
-  ChromaFormat chromaFormatIdc = currSlice->getBaseColPic(refLayerIdc)->getSlice(0)->getChromaFormatIdc();
+  ChromaFormat chromaFormatIdc = currSlice->getBaseColPic(refLayerIdc)->getSlice(0)->getSPS()->getChromaFormatIdc();
+#if SCALABLE_REXT
+  Int chromaHorScalingEL = TComSPS::getWinUnitX( currSlice->getSPS()->getChromaFormatIdc() );
+  Int chromaVerScalingEL = TComSPS::getWinUnitY( currSlice->getSPS()->getChromaFormatIdc() );
+
+  Int chromaHorScalingBL = TComSPS::getWinUnitX( chromaFormatIdc );
+  Int chromaVerScalingBL = TComSPS::getWinUnitY( chromaFormatIdc );
+#else
   Int xScal = TComSPS::getWinUnitX( chromaFormatIdc );
   Int yScal = TComSPS::getWinUnitY( chromaFormatIdc );
+#endif
 
   const ResamplingPhase &resamplingPhase = currSlice->getPPS()->getResamplingPhase( refLayerId );
@@ -151,7 +159,11 @@
 
 #if SCALABLE_REXT
-  if(chromaFormatIdc != 0)
+  if( chromaFormatIdc != CHROMA_400 )
   {
-#endif
+    widthEL  /= chromaHorScalingEL;
+    heightEL /= chromaVerScalingEL;
+    widthBL  /= chromaHorScalingBL;
+    heightBL /= chromaVerScalingBL;
+#else
     widthEL  >>= 1;
     heightEL >>= 1;
@@ -159,4 +171,5 @@
     widthBL  >>= 1;
     heightBL >>= 1;
+#endif
 
     strideBL = pcBasePic->getStride( COMPONENT_Cb );
@@ -166,6 +179,11 @@
     piSrcV = piSrcBufV;
 
+#if SCALABLE_REXT
+    piDstU = piDstBufU + ( scalEL.getWindowLeftOffset() / chromaHorScalingEL ) + ( scalEL.getWindowTopOffset() / chromaVerScalingEL ) * strideEL;
+    piDstV = piDstBufV + ( scalEL.getWindowLeftOffset() / chromaHorScalingEL ) + ( scalEL.getWindowTopOffset() / chromaVerScalingEL ) * strideEL;
+#else
     piDstU = piDstBufU + ( scalEL.getWindowLeftOffset() >> 1 ) + ( scalEL.getWindowTopOffset() >> 1 ) * strideEL;
     piDstV = piDstBufV + ( scalEL.getWindowLeftOffset() >> 1 ) + ( scalEL.getWindowTopOffset() >> 1 ) * strideEL;
+#endif
 
     shift = bitDepthChroma - refBitDepthChroma;
@@ -309,17 +327,28 @@
 
 #if SCALABLE_REXT
-  if(chromaFormatIdc != 0)
+  if( chromaFormatIdc != CHROMA_400 )
   {
-#endif
+    widthEL  /= chromaHorScalingEL;
+    heightEL /= chromaVerScalingEL;
+    widthBL  /= chromaHorScalingBL;
+    heightBL /= chromaVerScalingBL;
+#else
     widthEL  >>= 1;
     heightEL >>= 1;
     widthBL  >>= 1;
     heightBL >>= 1;
+#endif
 
     strideBL  = pcBasePic->getStride( COMPONENT_Cb );
     strideEL  = pcUsPic->getStride( COMPONENT_Cb );
 
+#if SCALABLE_REXT
+    Int srlLOffsetC = scalEL.getWindowLeftOffset() / chromaHorScalingEL;
+    Int srlTOffsetC = scalEL.getWindowTopOffset() / chromaVerScalingEL;
+#else
     Int srlLOffsetC = scalEL.getWindowLeftOffset() >> 1;
     Int srlTOffsetC = scalEL.getWindowTopOffset() >> 1;
+#endif
+
     rlClipL = -(NTAPS_US_CHROMA>>1);
     rlClipR = widthBL -1 + (NTAPS_US_CHROMA>>1);
@@ -331,10 +360,23 @@
     addX = ( ( resamplingPhase.phaseHorChroma * scaleX + 8 ) >> 4 ) -  (1 << ( shiftX - 5 ));
     addY = ( ( phaseVerChroma * scaleY + 8 ) >> 4 ) -  (1 << ( shiftX - 5 ));
+
+#if SCALABLE_REXT
+    Int refOffsetXC = (windowRL.getWindowLeftOffset() / chromaHorScalingBL) << 4;
+    Int refOffsetYC = (windowRL.getWindowTopOffset()  / chromaVerScalingBL) << 4;
+#else
     Int refOffsetXC = (windowRL.getWindowLeftOffset() / xScal) << 4;
     Int refOffsetYC = (windowRL.getWindowTopOffset()  / yScal) << 4;
+#endif
 
     shiftXM4 = shiftX - 4;
     shiftYM4 = shiftY - 4;
 
+#if SCALABLE_REXT
+    widthEL   = pcUsPic->getWidth (COMPONENT_Y) / chromaHorScalingEL;
+    heightEL  = pcUsPic->getHeight(COMPONENT_Y) / chromaVerScalingEL;
+
+    widthBL   = pcBasePic->getWidth (COMPONENT_Y) / chromaHorScalingBL;
+    heightBL  = min<Int>( pcBasePic->getHeight(COMPONENT_Y) / chromaVerScalingBL, heightEL );
+#else
     widthEL   = pcUsPic->getWidth (COMPONENT_Y) >> 1;
     heightEL  = pcUsPic->getHeight(COMPONENT_Y) >> 1;
@@ -342,4 +384,5 @@
     widthBL   = pcBasePic->getWidth (COMPONENT_Y) >> 1;
     heightBL  = min<Int>( pcBasePic->getHeight(COMPONENT_Y) >> 1, heightEL );
+#endif
 
     // shift1 should be calculated using BL bit-depth
@@ -382,7 +425,15 @@
     //========== vertical upsampling ===========
     pcTempPic->setBorderExtension(false);
+#if SCALABLE_REXT
+    pcTempPic->setHeight(heightBL * chromaVerScalingBL);
+#else
     pcTempPic->setHeight(heightBL << 1);
+#endif
     pcTempPic->extendPicBorder   (); // extend the border.
+#if SCALABLE_REXT
+    pcTempPic->setHeight(heightEL * chromaVerScalingEL);
+#else
     pcTempPic->setHeight(heightEL << 1);
+#endif
 
     nShift = 20 - bitDepthChroma;
@@ -390,5 +441,9 @@
     iOffset = 1 << (nShift - 1);
 
+#if SCALABLE_REXT
+    for( j = 0; j < pcTempPic->getHeight(COMPONENT_Y) / chromaVerScalingEL; j++ )
+#else
     for( j = 0; j < pcTempPic->getHeight(COMPONENT_Y) >> 1; j++ )
+#endif
     {
       Int y = j;
@@ -408,5 +463,9 @@
       piDstV = piDstV0;
 
+#if SCALABLE_REXT
+      for( i = pcTempPic->getWidth(COMPONENT_Y) / chromaHorScalingEL; i > 0; i-- )
+#else
       for( i = pcTempPic->getWidth(COMPONENT_Y) >> 1; i > 0; i-- )
+#endif
       {
         *piDstU = ClipBD( (sumChromaVer(piSrcU, coeff, strideEL) + iOffset) >> (nShift), bitDepthChroma );
Index: branches/SHM-dev/source/Lib/TLibCommon/TComWeightPrediction.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibCommon/TComWeightPrediction.cpp	(revision 1500)
+++ branches/SHM-dev/source/Lib/TLibCommon/TComWeightPrediction.cpp	(revision 1502)
@@ -290,9 +290,5 @@
     for ( Int yuv=0 ; yuv<numValidComponent ; yuv++ )
     {
-#if SVC_EXTENSION
-      const Int bitDepth            = pcSlice->getBitDepth(toChannelType(ComponentID(yuv)));
-#else
       const Int bitDepth            = pcSlice->getSPS()->getBitDepth(toChannelType(ComponentID(yuv)));
-#endif
       const Int offsetScalingFactor = bUseHighPrecisionPredictionWeighting ? 1 : (1 << (bitDepth-8));
 
@@ -315,9 +311,5 @@
     for ( Int yuv=0 ; yuv<numValidComponent ; yuv++ )
     {
-#if SVC_EXTENSION
-      const Int bitDepth            = pcSlice->getBitDepth(toChannelType(ComponentID(yuv)));
-#else
       const Int bitDepth            = pcSlice->getSPS()->getBitDepth(toChannelType(ComponentID(yuv)));
-#endif
       const Int offsetScalingFactor = bUseHighPrecisionPredictionWeighting ? 1 : (1 << (bitDepth-8));
 
@@ -351,25 +343,13 @@
   if( iRefIdx0 >= 0 && iRefIdx1 >= 0 )
   {
-#if SVC_EXTENSION
-    addWeightBi(pcYuvSrc0, pcYuvSrc1, pcCU->getSlice()->getBitDepths(), uiPartIdx, iWidth, iHeight, pwp0, pwp1, rpcYuvDst );
-#else
     addWeightBi(pcYuvSrc0, pcYuvSrc1, pcCU->getSlice()->getSPS()->getBitDepths(), uiPartIdx, iWidth, iHeight, pwp0, pwp1, rpcYuvDst );
-#endif
   }
   else if ( iRefIdx0 >= 0 && iRefIdx1 <  0 )
   {
-#if SVC_EXTENSION
-    addWeightUni( pcYuvSrc0, pcCU->getSlice()->getBitDepths(), uiPartIdx, iWidth, iHeight, pwp0, rpcYuvDst );
-#else
     addWeightUni( pcYuvSrc0, pcCU->getSlice()->getSPS()->getBitDepths(), uiPartIdx, iWidth, iHeight, pwp0, rpcYuvDst );
-#endif
   }
   else if ( iRefIdx0 <  0 && iRefIdx1 >= 0 )
   {
-#if SVC_EXTENSION
-    addWeightUni( pcYuvSrc1, pcCU->getSlice()->getBitDepths(), uiPartIdx, iWidth, iHeight, pwp1, rpcYuvDst );
-#else
     addWeightUni( pcYuvSrc1, pcCU->getSlice()->getSPS()->getBitDepths(), uiPartIdx, iWidth, iHeight, pwp1, rpcYuvDst );
-#endif
   }
   else
@@ -407,8 +387,4 @@
     getWpScaling(pcCU, -1, iRefIdx, pwpTmp, pwp);
   }
-#if SVC_EXTENSION
-  addWeightUni( pcYuvSrc, pcCU->getSlice()->getBitDepths(), uiPartAddr, iWidth, iHeight, pwp, pcYuvPred );
-#else
   addWeightUni( pcYuvSrc, pcCU->getSlice()->getSPS()->getBitDepths(), uiPartAddr, iWidth, iHeight, pwp, pcYuvPred );
-#endif
-}
+}
Index: branches/SHM-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 1500)
+++ branches/SHM-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 1502)
@@ -1225,9 +1225,5 @@
 #endif
 
-#if SCALABLE_REXT
-  const ChromaFormat chFmt = pcSlice->getChromaFormatIdc();
-#else
   const ChromaFormat chFmt = sps->getChromaFormatIdc();
-#endif
   const UInt numValidComp=getNumberValidComponents(chFmt);
   const Bool bChroma=(chFmt!=CHROMA_400);
@@ -1241,9 +1237,5 @@
     pcSlice->setDependentSliceSegmentFlag(false);
   }
-#if SVC_EXTENSION
-  Int numCTUs = ((pcSlice->getPicWidthInLumaSamples()+sps->getMaxCUWidth()-1)/sps->getMaxCUWidth())*((pcSlice->getPicHeightInLumaSamples()+sps->getMaxCUHeight()-1)/sps->getMaxCUHeight());
-#else
   Int numCTUs = ((sps->getPicWidthInLumaSamples()+sps->getMaxCUWidth()-1)/sps->getMaxCUWidth())*((sps->getPicHeightInLumaSamples()+sps->getMaxCUHeight()-1)/sps->getMaxCUHeight());
-#endif  
   UInt sliceSegmentAddress = 0;
   Int bitsSliceSegmentAddress = 0;
@@ -1832,9 +1824,5 @@
     pcSlice->setSliceQp (26 + pps->getPicInitQPMinus26() + iCode);
 
-#if SVC_EXTENSION
-    assert( pcSlice->getSliceQp() >= -pcSlice->getQpBDOffset(CHANNEL_TYPE_LUMA) );
-#else    
     assert( pcSlice->getSliceQp() >= -sps->getQpBDOffset(CHANNEL_TYPE_LUMA) );
-#endif
     assert( pcSlice->getSliceQp() <=  51 );
 
@@ -2365,9 +2353,5 @@
 #endif
 
-#if SVC_EXTENSION
-  Int qpBdOffsetY = pcCU->getSlice()->getQpBDOffset(CHANNEL_TYPE_LUMA);
-#else
   Int qpBdOffsetY = pcCU->getSlice()->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA);
-#endif
   const Int qp = (((Int) pcCU->getRefQP( uiAbsPartIdx ) + iDQp + 52 + 2*qpBdOffsetY )%(52+ qpBdOffsetY)) -  qpBdOffsetY;
 
@@ -2429,9 +2413,5 @@
 {
         WPScalingParam *wp;
-#if SCALABLE_REXT
-  const ChromaFormat    chFmt        = pcSlice->getChromaFormatIdc();
-#else
   const ChromaFormat    chFmt        = sps->getChromaFormatIdc();
-#endif
   const Int             numValidComp = Int(getNumberValidComponents(chFmt));
   const Bool            bChroma      = (chFmt!=CHROMA_400);
@@ -2496,9 +2476,5 @@
         wp[COMPONENT_Y].iWeight = (iDeltaWeight + (1<<wp[COMPONENT_Y].uiLog2WeightDenom));
         READ_SVLC( wp[COMPONENT_Y].iOffset, iNumRef==0?"luma_offset_l0[i]":"luma_offset_l1[i]" );
-#if SVC_EXTENSION
-        Int range=sps->getSpsRangeExtension().getHighPrecisionOffsetsEnabledFlag() ? (1<<pcSlice->getBitDepth(CHANNEL_TYPE_LUMA))/2 : 128;        
-#else
         Int range=sps->getSpsRangeExtension().getHighPrecisionOffsetsEnabledFlag() ? (1<<sps->getBitDepth(CHANNEL_TYPE_LUMA))/2 : 128;
-#endif
         assert( wp[0].iOffset >= -range );
         assert( wp[0].iOffset <   range );
@@ -2513,9 +2489,5 @@
         if ( wp[COMPONENT_Cb].bPresentFlag )
         {
-#if SVC_EXTENSION
-          Int range=sps->getSpsRangeExtension().getHighPrecisionOffsetsEnabledFlag() ? (1<<pcSlice->getBitDepth(CHANNEL_TYPE_CHROMA))/2 : 128;
-#else
           Int range=sps->getSpsRangeExtension().getHighPrecisionOffsetsEnabledFlag() ? (1<<sps->getBitDepth(CHANNEL_TYPE_CHROMA))/2 : 128;
-#endif
           for ( Int j=1 ; j<numValidComp ; j++ )
           {
Index: branches/SHM-dev/source/Lib/TLibDecoder/TDecCu.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibDecoder/TDecCu.cpp	(revision 1500)
+++ branches/SHM-dev/source/Lib/TLibDecoder/TDecCu.cpp	(revision 1502)
@@ -219,11 +219,5 @@
   UInt uiBPelY   = uiTPelY + (maxCuHeight>>uiDepth) - 1;
 
-#if SVC_EXTENSION
-  TComSlice * pcSlice = pcPic->getSlice(pcPic->getCurrSliceIdx());
-
-  if( ( uiRPelX < pcSlice->getPicWidthInLumaSamples() ) && ( uiBPelY < pcSlice->getPicHeightInLumaSamples() ) )
-#else
   if( ( uiRPelX < sps.getPicWidthInLumaSamples() ) && ( uiBPelY < sps.getPicHeightInLumaSamples() ) )
-#endif
   {
     m_pcEntropyDecoder->decodeSplitFlag( pcCU, uiAbsPartIdx, uiDepth );
@@ -252,9 +246,5 @@
       uiTPelY   = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiIdx] ];
 
-#if SVC_EXTENSION
-      if ( !isLastCtuOfSliceSegment && ( uiLPelX < pcCU->getSlice()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcCU->getSlice()->getPicHeightInLumaSamples() ) )
-#else
       if ( !isLastCtuOfSliceSegment && ( uiLPelX < sps.getPicWidthInLumaSamples() ) && ( uiTPelY < sps.getPicHeightInLumaSamples() ) )
-#endif
       {
         xDecodeCU( pcCU, uiIdx, uiDepth+1, isLastCtuOfSliceSegment );
@@ -404,9 +394,5 @@
   UInt uiBPelY   = uiTPelY + (sps.getMaxCUHeight()>>uiDepth) - 1;
 
-#if SVC_EXTENSION
-  if( ( uiRPelX >= pcSlice->getPicWidthInLumaSamples() ) || ( uiBPelY >= pcSlice->getPicHeightInLumaSamples() ) )
-#else
   if( ( uiRPelX >= sps.getPicWidthInLumaSamples() ) || ( uiBPelY >= sps.getPicHeightInLumaSamples() ) )
-#endif
   {
     bBoundary = true;
@@ -423,9 +409,5 @@
       uiTPelY = pCtu->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiIdx] ];
 
-#if SVC_EXTENSION
-      if( ( uiLPelX < pcSlice->getPicWidthInLumaSamples() ) && ( uiTPelY < pcSlice->getPicHeightInLumaSamples() ) )
-#else
       if( ( uiLPelX < sps.getPicWidthInLumaSamples() ) && ( uiTPelY < sps.getPicHeightInLumaSamples() ) )
-#endif
       {
         xDecompressCU(pCtu, uiIdx, uiNextDepth );
@@ -501,9 +483,5 @@
   if  ( pcCU->getQtRootCbf( 0) )
   {
-#if SVC_EXTENSION
-    m_ppcYuvReco[uiDepth]->addClip( m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth], 0, pcCU->getWidth( 0 ), pcCU->getSlice()->getBitDepths() );
-#else
     m_ppcYuvReco[uiDepth]->addClip( m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth], 0, pcCU->getWidth( 0 ), pcCU->getSlice()->getSPS()->getBitDepths() );
-#endif
   }
   else
@@ -647,9 +625,5 @@
 #endif
 
-#if SVC_EXTENSION
-  const Int clipbd = pcCU->getSlice()->getBitDepth(toChannelType(compID));
-#else
   const Int clipbd = sps.getBitDepth(toChannelType(compID));
-#endif
 #if O0043_BEST_EFFORT_DECODING
   const Int bitDepthDelta = sps.getStreamBitDepth(toChannelType(compID)) - clipbd;
@@ -834,10 +808,6 @@
         Pel* piPicReco         = pcCU->getPic()->getPicYuvRec()->getAddr(compID, pcCU->getCtuRsAddr(), pcCU->getZorderIdxInCtu()+uiPartIdx);
   const UInt uiPicStride       = pcCU->getPic()->getPicYuvRec()->getStride(compID);
-#if SVC_EXTENSION
-  const UInt uiPcmLeftShiftBit = pcCU->getSlice()->getBitDepth(toChannelType(compID)) - pcCU->getSlice()->getSPS()->getPCMBitDepth(toChannelType(compID));
-#else
   const TComSPS &sps           = *(pcCU->getSlice()->getSPS());
   const UInt uiPcmLeftShiftBit = sps.getBitDepth(toChannelType(compID)) - sps.getPCMBitDepth(toChannelType(compID));
-#endif
 
   for(UInt uiY = 0; uiY < uiHeight; uiY++ )
Index: branches/SHM-dev/source/Lib/TLibDecoder/TDecGop.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibDecoder/TDecGop.cpp	(revision 1500)
+++ branches/SHM-dev/source/Lib/TLibDecoder/TDecGop.cpp	(revision 1502)
@@ -239,9 +239,5 @@
       printf ("Warning: Got multiple decoded picture hash SEI messages. Using first.");
     }
-#if SVC_EXTENSION
-    calcAndPrintHashStatus(*(pcPic->getPicYuvRec()), hash, pcSlice->getBitDepths(), m_numberOfChecksumErrorsDetected);
-#else
     calcAndPrintHashStatus(*(pcPic->getPicYuvRec()), hash, pcSlice->getSPS()->getBitDepths(), m_numberOfChecksumErrorsDetected);
-#endif
   }
 #if CONFORMANCE_BITSTREAM_MODE
Index: branches/SHM-dev/source/Lib/TLibDecoder/TDecSbac.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibDecoder/TDecSbac.cpp	(revision 1500)
+++ branches/SHM-dev/source/Lib/TLibDecoder/TDecSbac.cpp	(revision 1502)
@@ -951,9 +951,5 @@
   {
     UInt uiSign;
-#if SVC_EXTENSION
-    Int qpBdOffsetY = pcCU->getSlice()->getQpBDOffset(CHANNEL_TYPE_LUMA);
-#else
     Int qpBdOffsetY = pcCU->getSlice()->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA);
-#endif
     m_pcTDecBinIf->decodeBinEP(uiSign RExt__DECODER_DEBUG_BIT_STATISTICS_PASS_OPT_ARG(STATS__CABAC_BITS__DELTA_QP_EP));
     iDQp = uiDQp;
Index: branches/SHM-dev/source/Lib/TLibDecoder/TDecSlice.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibDecoder/TDecSlice.cpp	(revision 1500)
+++ branches/SHM-dev/source/Lib/TLibDecoder/TDecSlice.cpp	(revision 1502)
@@ -201,9 +201,5 @@
           aboveMergeAvail = pcPic->getSAOMergeAvailability(ctuRsAddr, ctuRsAddr-frameWidthInCtus);
         }
-#if SVC_EXTENSION
-        pcSbacDecoder->parseSAOBlkParam( saoblkParam, sliceEnabled, leftMergeAvail, aboveMergeAvail, pcSlice->getBitDepths());
-#else
         pcSbacDecoder->parseSAOBlkParam( saoblkParam, sliceEnabled, leftMergeAvail, aboveMergeAvail, pcSlice->getSPS()->getBitDepths());
-#endif
       }
     }
Index: branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.cpp	(revision 1500)
+++ branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.cpp	(revision 1502)
@@ -524,4 +524,6 @@
         // it is needed where the VPS is accessed through the slice
         pBLPic->getSlice(0)->setVPS( vps );
+        pBLPic->getPicSym()->inferSpsForNonHEVCBL();
+        pBLPic->getSlice(0)->setSPS( &pBLPic->getPicSym()->getSPS() );
       }
     }
@@ -596,4 +598,6 @@
       assert( vps->getVpsRepFormat( sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : vps->getVpsRepFormatIdx(layerIdx))->getBitDepthVpsChroma()         <= vps->getVpsRepFormat( vps->getVpsRepFormatIdx(layerIdx))->getBitDepthVpsChroma());
     }
+
+    updateSPS->inferSPS( m_layerId, vps );
 #endif //SVC_EXTENSION
 
@@ -627,15 +631,7 @@
 
     // Initialise the various objects for the new set of settings
-#if SVC_EXTENSION
-    m_cSAO.create( pSlice->getPicWidthInLumaSamples(), pSlice->getPicHeightInLumaSamples(), pSlice->getChromaFormatIdc(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxTotalCUDepth(), pps->getPpsRangeExtension().getLog2SaoOffsetScale(CHANNEL_TYPE_LUMA), pps->getPpsRangeExtension().getLog2SaoOffsetScale(CHANNEL_TYPE_CHROMA) );
-#else
     m_cSAO.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), sps->getChromaFormatIdc(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxTotalCUDepth(), pps->getPpsRangeExtension().getLog2SaoOffsetScale(CHANNEL_TYPE_LUMA), pps->getPpsRangeExtension().getLog2SaoOffsetScale(CHANNEL_TYPE_CHROMA) );
-#endif
     m_cLoopFilter.create( sps->getMaxTotalCUDepth() );
-#if SCALABLE_REXT
-    m_cPrediction.initTempBuff(pSlice->getChromaFormatIdc());
-#else
     m_cPrediction.initTempBuff(sps->getChromaFormatIdc());
-#endif
 
 
@@ -692,9 +688,8 @@
 
     // Recursive structure
-#if SVC_EXTENSION
-    m_cCuDecoder.create ( sps->getMaxTotalCUDepth(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), pSlice->getChromaFormatIdc() );
+    m_cCuDecoder.create ( sps->getMaxTotalCUDepth(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getChromaFormatIdc() );
+#if SVC_EXTENSION
     m_cCuDecoder.init   ( m_ppcTDecTop, &m_cEntropyDecoder, &m_cTrQuant, &m_cPrediction, m_layerId );
 #else
-    m_cCuDecoder.create ( sps->getMaxTotalCUDepth(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getChromaFormatIdc() );
     m_cCuDecoder.init   ( &m_cEntropyDecoder, &m_cTrQuant, &m_cPrediction );
 #endif
@@ -1399,5 +1394,5 @@
       if( pFile->good() )
       {
-        Bool is16bit  = pBLPic->getSlice(0)->getBitDepth(CHANNEL_TYPE_LUMA) > 8 || pBLPic->getSlice(0)->getBitDepth(CHANNEL_TYPE_CHROMA) > 8;
+        Bool is16bit  = pBLPic->getSlice(0)->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) > 8 || pBLPic->getSlice(0)->getSPS()->getBitDepth(CHANNEL_TYPE_CHROMA) > 8;
         UInt uiWidth  = pBLPic->getPicYuvRec()->getWidth(COMPONENT_Y);
         UInt uiHeight = pBLPic->getPicYuvRec()->getHeight(COMPONENT_Y);
@@ -1701,8 +1696,8 @@
         if( pcSlice->getPPS()->getCGSFlag() && m_c3DAsymLUTPPS.isRefLayer( pcSlice->getVPS()->getRefLayerId(m_layerId, refLayerIdc) ) )
         {
-          assert( pcSlice->getBaseColPic( refLayerIdc )->getSlice( 0 )->getBitDepth(CHANNEL_TYPE_LUMA) == m_c3DAsymLUTPPS.getInputBitDepthY() );
-          assert( pcSlice->getBaseColPic( refLayerIdc )->getSlice( 0 )->getBitDepth(CHANNEL_TYPE_CHROMA) == m_c3DAsymLUTPPS.getInputBitDepthC() );
-          assert( pcSlice->getBitDepth(CHANNEL_TYPE_LUMA) >= m_c3DAsymLUTPPS.getOutputBitDepthY() );
-          assert( pcSlice->getBitDepth(CHANNEL_TYPE_LUMA) >= m_c3DAsymLUTPPS.getOutputBitDepthC() );
+          assert( pcSlice->getBaseColPic( refLayerIdc )->getSlice( 0 )->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) == m_c3DAsymLUTPPS.getInputBitDepthY() );
+          assert( pcSlice->getBaseColPic( refLayerIdc )->getSlice( 0 )->getSPS()->getBitDepth(CHANNEL_TYPE_CHROMA) == m_c3DAsymLUTPPS.getInputBitDepthC() );
+          assert( pcSlice->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) >= m_c3DAsymLUTPPS.getOutputBitDepthY() );
+          assert( pcSlice->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) >= m_c3DAsymLUTPPS.getOutputBitDepthC() );
 
           if( !m_pColorMappedPic )
@@ -1721,5 +1716,5 @@
           if( pcSlice->getVPS()->isSamplePredictionType( pcSlice->getVPS()->getLayerIdxInVps(m_layerId), pcSlice->getVPS()->getLayerIdxInVps(refLayerId) ) )
           {
-            m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, m_pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, m_pcPic->getPicYuvRec(), pcSlice->getBaseColPic( refLayerIdc )->getSlice( 0 )->getBitDepth(CHANNEL_TYPE_LUMA), pcSlice->getBaseColPic( refLayerIdc )->getSlice( 0 )->getBitDepth(CHANNEL_TYPE_CHROMA));
+            m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, m_pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, m_pcPic->getPicYuvRec(), pcSlice->getBaseColPic( refLayerIdc )->getSlice( 0 )->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA), pcSlice->getBaseColPic( refLayerIdc )->getSlice( 0 )->getSPS()->getBitDepth(CHANNEL_TYPE_CHROMA));
           }
         }
@@ -1896,9 +1891,5 @@
         pcSlice->getSPS()->getMaxLog2TrDynamicRange(CHANNEL_TYPE_CHROMA)
     };
-#if SVC_EXTENSION
-    m_cTrQuant.setFlatScalingList(maxLog2TrDynamicRange, pcSlice->getBitDepths());
-#else
     m_cTrQuant.setFlatScalingList(maxLog2TrDynamicRange, pcSlice->getSPS()->getBitDepths());
-#endif
     m_cTrQuant.setUseScalingList(false);
   }
@@ -2459,5 +2450,5 @@
     {
       m_pColorMappedPic = new TComPicYuv;
-      m_pColorMappedPic->create( pcSlice->getPicWidthInLumaSamples(), pcSlice->getPicHeightInLumaSamples(), pcSlice->getChromaFormatIdc()/*CHROMA_420*/, pcSlice->getSPS()->getMaxCUWidth(), pcSlice->getSPS()->getMaxCUHeight(), pcSlice->getSPS()->getMaxTotalCUDepth(), true, NULL );
+      m_pColorMappedPic->create( pcSlice->getSPS()->getPicWidthInLumaSamples(), pcSlice->getSPS()->getPicHeightInLumaSamples(), pcSlice->getSPS()->getChromaFormatIdc(), pcSlice->getSPS()->getMaxCUWidth(), pcSlice->getSPS()->getMaxCUHeight(), pcSlice->getSPS()->getMaxTotalCUDepth(), true, NULL );
     }
   }
@@ -2614,12 +2605,12 @@
     TComPicYuv* pcPicYuvRecBase = (*(pcTDecTopBase->getListPic()->begin()))->getPicYuvRec();
 
-    const Int bitDepthLuma = vps.getBitDepth(CHANNEL_TYPE_LUMA, &sps, m_layerId);
-    const Int bitDepthChroma = vps.getBitDepth(CHANNEL_TYPE_CHROMA, &sps, m_layerId);
-    const Int refBitDepthLuma = (*(pcTDecTopBase->getListPic()->begin()))->getSlice(0)->getBitDepth(CHANNEL_TYPE_LUMA);
-    const Int refBitDepthChroma = (*(pcTDecTopBase->getListPic()->begin()))->getSlice(0)->getBitDepth(CHANNEL_TYPE_CHROMA);
+    const Int bitDepthLuma = sps.getBitDepth(CHANNEL_TYPE_LUMA);
+    const Int bitDepthChroma = sps.getBitDepth(CHANNEL_TYPE_CHROMA);
+    const Int refBitDepthLuma = (*(pcTDecTopBase->getListPic()->begin()))->getSlice(0)->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA);
+    const Int refBitDepthChroma = (*(pcTDecTopBase->getListPic()->begin()))->getSlice(0)->getSPS()->getBitDepth(CHANNEL_TYPE_CHROMA);
     
     Bool sameBitDepths = ( bitDepthLuma == refBitDepthLuma ) && ( bitDepthChroma == refBitDepthChroma );
 
-    if( pcPicYuvRecBase->getWidth(COMPONENT_Y) == vps.getPicWidthInLumaSamples(&sps, m_layerId) && pcPicYuvRecBase->getHeight(COMPONENT_Y) == vps.getPicHeightInLumaSamples(&sps, m_layerId) && equalOffsets && zeroPhase )
+    if( pcPicYuvRecBase->getWidth(COMPONENT_Y) == sps.getPicWidthInLumaSamples() && pcPicYuvRecBase->getHeight(COMPONENT_Y) == sps.getPicHeightInLumaSamples() && equalOffsets && zeroPhase )
     {
       pic->setEqualPictureSizeAndOffsetFlag( i, true );
Index: branches/SHM-dev/source/Lib/TLibEncoder/TEncCavlc.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 1500)
+++ branches/SHM-dev/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 1502)
@@ -1632,9 +1632,5 @@
   Int iDQp  = pcCU->getQP( uiAbsPartIdx ) - pcCU->getRefQP( uiAbsPartIdx );
 
-#if SVC_EXTENSION
-  Int qpBdOffsetY =  pcCU->getSlice()->getQpBDOffset(CHANNEL_TYPE_LUMA);
-#else
   Int qpBdOffsetY =  pcCU->getSlice()->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA);
-#endif
   iDQp = (iDQp + 78 + qpBdOffsetY + (qpBdOffsetY/2)) % (52 + qpBdOffsetY) - 26 - (qpBdOffsetY/2);
 
@@ -1733,9 +1729,5 @@
               WRITE_SVLC( iDeltaWeight, iNumRef==0?"delta_chroma_weight_l0[i]":"delta_chroma_weight_l1[i]" );
 
-#if SVC_EXTENSION
-              Int range=pcSlice->getSPS()->getSpsRangeExtension().getHighPrecisionOffsetsEnabledFlag() ? (1<<pcSlice->getBitDepth(CHANNEL_TYPE_CHROMA))/2 : 128;
-#else
               Int range=pcSlice->getSPS()->getSpsRangeExtension().getHighPrecisionOffsetsEnabledFlag() ? (1<<pcSlice->getSPS()->getBitDepth(CHANNEL_TYPE_CHROMA))/2 : 128;
-#endif
               Int pred = ( range - ( ( range*wp[j].iWeight)>>(wp[j].uiLog2WeightDenom) ) );
               Int iDeltaChroma = (wp[j].iOffset - pred);
Index: branches/SHM-dev/source/Lib/TLibEncoder/TEncCu.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibEncoder/TEncCu.cpp	(revision 1500)
+++ branches/SHM-dev/source/Lib/TLibEncoder/TEncCu.cpp	(revision 1502)
@@ -397,11 +397,6 @@
   {
     Int idQP = m_pcEncCfg->getMaxDeltaQP();
-#if SVC_EXTENSION
-    iMinQP = Clip3( -rpcTempCU->getSlice()->getQpBDOffset(CHANNEL_TYPE_LUMA), MAX_QP, iBaseQP-idQP );
-    iMaxQP = Clip3( -rpcTempCU->getSlice()->getQpBDOffset(CHANNEL_TYPE_LUMA), MAX_QP, iBaseQP+idQP );
-#else
     iMinQP = Clip3( -sps.getQpBDOffset(CHANNEL_TYPE_LUMA), MAX_QP, iBaseQP-idQP );
     iMaxQP = Clip3( -sps.getQpBDOffset(CHANNEL_TYPE_LUMA), MAX_QP, iBaseQP+idQP );
-#endif
   }
   else
@@ -432,9 +427,5 @@
 
   TComSlice * pcSlice = rpcTempCU->getPic()->getSlice(rpcTempCU->getPic()->getCurrSliceIdx());
-#if SVC_EXTENSION
-  const Bool bBoundary = !( uiRPelX < rpcBestCU->getSlice()->getPicWidthInLumaSamples() && uiBPelY < rpcBestCU->getSlice()->getPicHeightInLumaSamples() );
-#else
   const Bool bBoundary = !( uiRPelX < sps.getPicWidthInLumaSamples() && uiBPelY < sps.getPicHeightInLumaSamples() );
-#endif
 
   if ( !bBoundary )
@@ -735,9 +726,5 @@
           && rpcTempCU->getWidth(0) >= (1<<sps.getPCMLog2MinSize()) )
         {
-#if SVC_EXTENSION
-          UInt uiRawBits = getTotalBits(rpcBestCU->getWidth(0), rpcBestCU->getHeight(0), rpcBestCU->getPic()->getChromaFormat(), pcPic->getSlice(0)->getBitDepths().recon);
-#else
           UInt uiRawBits = getTotalBits(rpcBestCU->getWidth(0), rpcBestCU->getHeight(0), rpcBestCU->getPic()->getChromaFormat(), sps.getBitDepths().recon);
-#endif
           UInt uiBestBits = rpcBestCU->getTotalBits();
           if((uiBestBits > uiRawBits) || (rpcBestCU->getTotalCost() > m_pcRdCost->calcRdCost(uiRawBits, 0)))
@@ -794,11 +781,6 @@
   {
     Int idQP = m_pcEncCfg->getMaxDeltaQP();
-#if SVC_EXTENSION
-    iMinQP = Clip3( -rpcTempCU->getSlice()->getQpBDOffset(CHANNEL_TYPE_LUMA), MAX_QP, iBaseQP-idQP );
-    iMaxQP = Clip3( -rpcTempCU->getSlice()->getQpBDOffset(CHANNEL_TYPE_LUMA), MAX_QP, iBaseQP+idQP );
-#else
     iMinQP = Clip3( -sps.getQpBDOffset(CHANNEL_TYPE_LUMA), MAX_QP, iBaseQP-idQP );
     iMaxQP = Clip3( -sps.getQpBDOffset(CHANNEL_TYPE_LUMA), MAX_QP, iBaseQP+idQP );
-#endif    
   }
   else if( uiDepth < pps.getMaxCuDQPDepth() )
@@ -846,9 +828,5 @@
         pcSubTempPartCU->initSubCU( rpcTempCU, uiPartUnitIdx, uhNextDepth, iQP );           // clear sub partition datas or init.
 
-#if SVC_EXTENSION
-        if( ( pcSubBestPartCU->getCUPelX() < pcSlice->getPicWidthInLumaSamples() ) && ( pcSubBestPartCU->getCUPelY() < pcSlice->getPicHeightInLumaSamples() ) )
-#else
         if( ( pcSubBestPartCU->getCUPelX() < sps.getPicWidthInLumaSamples() ) && ( pcSubBestPartCU->getCUPelY() < sps.getPicHeightInLumaSamples() ) )
-#endif
         {
           if ( 0 == uiPartUnitIdx) //initialize RD with previous depth buffer
@@ -1026,9 +1004,5 @@
     iQpOffset = Int(floor( dQpOffset + 0.49999 ));
   }
-#if SVC_EXTENSION
-  return Clip3(-pcCU->getSlice()->getQpBDOffset(CHANNEL_TYPE_LUMA), MAX_QP, iBaseQp+iQpOffset );
-#else
   return Clip3(-pcCU->getSlice()->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA), MAX_QP, iBaseQp+iQpOffset );
-#endif
 }
 
@@ -1062,9 +1036,5 @@
 #endif
 
-#if SVC_EXTENSION
-  if( ( uiRPelX < pcSlice->getPicWidthInLumaSamples() ) && ( uiBPelY < pcSlice->getPicHeightInLumaSamples() ) )
-#else
   if( ( uiRPelX < sps.getPicWidthInLumaSamples() ) && ( uiBPelY < sps.getPicHeightInLumaSamples() ) )
-#endif
   {
     m_pcEntropyCoder->encodeSplitFlag( pcCU, uiAbsPartIdx, uiDepth );
@@ -1093,9 +1063,5 @@
       uiTPelY   = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ];
 
-#if SVC_EXTENSION
-      if( ( uiLPelX < pcSlice->getPicWidthInLumaSamples() ) && ( uiTPelY < pcSlice->getPicHeightInLumaSamples() ) )
-#else
       if( ( uiLPelX < sps.getPicWidthInLumaSamples() ) && ( uiTPelY < sps.getPicHeightInLumaSamples() ) )
-#endif
       {
         xEncodeCU( pcCU, uiAbsPartIdx, uiDepth+1 );
Index: branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 1500)
+++ branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 1502)
@@ -184,22 +184,19 @@
   {
     UInt prevLayerIdx = 0;
-    UInt prevLayerId  = 0;
-
-    if (pcTEncTop->getNumActiveRefLayers() > 0)
+
+    if( pcTEncTop->getNumActiveRefLayers() > 0 )
     {
       prevLayerIdx = pcTEncTop->getPredLayerIdx( pcTEncTop->getNumActiveRefLayers() - 1);
-      prevLayerId  = pcTEncTop->getRefLayerId(prevLayerIdx);      
-    }
-
-    const TComVPS *vps = pcTEncTop->getVPS();
+    }
+
     const TComSPS *sps = pcTEncTop->getSPS();
 
-    const Int bitDepthLuma = vps->getBitDepth(CHANNEL_TYPE_LUMA, sps, pcTEncTop->getLayerId());
-    const Int bitDepthChroma = vps->getBitDepth(CHANNEL_TYPE_CHROMA, sps, pcTEncTop->getLayerId());
-    const Int prevBitDepthLuma = vps->getBitDepth(CHANNEL_TYPE_LUMA, m_ppcTEncTop[prevLayerIdx]->getSPS(), prevLayerId);
-    const Int prevBitDepthChroma = vps->getBitDepth(CHANNEL_TYPE_CHROMA, m_ppcTEncTop[prevLayerIdx]->getSPS(), prevLayerId);
+    const Int bitDepthLuma = sps->getBitDepth(CHANNEL_TYPE_LUMA);
+    const Int bitDepthChroma = sps->getBitDepth(CHANNEL_TYPE_CHROMA);
+    const Int prevBitDepthLuma = m_ppcTEncTop[prevLayerIdx]->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA);
+    const Int prevBitDepthChroma = m_ppcTEncTop[prevLayerIdx]->getSPS()->getBitDepth(CHANNEL_TYPE_CHROMA);
 
     m_Enc3DAsymLUTPicUpdate.create( m_pcCfg->getCGSMaxOctantDepth() , prevBitDepthLuma, prevBitDepthChroma, bitDepthLuma, bitDepthChroma , m_pcCfg->getCGSMaxYPartNumLog2() );
-    m_Enc3DAsymLUTPPS.create( m_pcCfg->getCGSMaxOctantDepth(), prevBitDepthLuma, prevBitDepthChroma, bitDepthLuma, bitDepthChroma , m_pcCfg->getCGSMaxYPartNumLog2() );
+    m_Enc3DAsymLUTPPS.create( m_pcCfg->getCGSMaxOctantDepth(), prevBitDepthLuma, prevBitDepthChroma, bitDepthLuma, bitDepthChroma, m_pcCfg->getCGSMaxYPartNumLog2() );
 
     if(!m_pColorMappedPic)
@@ -1071,21 +1068,12 @@
 cabac_zero_word_padding(TComSlice *const pcSlice, TComPic *const pcPic, const std::size_t binCountsInNalUnits, const std::size_t numBytesInVclNalUnits, std::ostringstream &nalUnitData, const Bool cabacZeroWordPaddingEnabled)
 {
-#if !SVC_EXTENSION
   const TComSPS &sps=*(pcSlice->getSPS());
-#endif
   const Int log2subWidthCxsubHeightC = (pcPic->getComponentScaleX(COMPONENT_Cb)+pcPic->getComponentScaleY(COMPONENT_Cb));
   const Int minCuWidth  = pcPic->getMinCUWidth();
   const Int minCuHeight = pcPic->getMinCUHeight();
-#if SVC_EXTENSION
-  const Int paddedWidth = ((pcSlice->getPicWidthInLumaSamples()  + minCuWidth  - 1) / minCuWidth) * minCuWidth;
-  const Int paddedHeight= ((pcSlice->getPicHeightInLumaSamples() + minCuHeight - 1) / minCuHeight) * minCuHeight;
-  const Int rawBits = paddedWidth * paddedHeight *
-                         (pcSlice->getBitDepth(CHANNEL_TYPE_LUMA) + 2*(pcSlice->getBitDepth(CHANNEL_TYPE_CHROMA)>>log2subWidthCxsubHeightC));
-#else
   const Int paddedWidth = ((sps.getPicWidthInLumaSamples()  + minCuWidth  - 1) / minCuWidth) * minCuWidth;
   const Int paddedHeight= ((sps.getPicHeightInLumaSamples() + minCuHeight - 1) / minCuHeight) * minCuHeight;
   const Int rawBits = paddedWidth * paddedHeight *
                          (sps.getBitDepth(CHANNEL_TYPE_LUMA) + 2*(sps.getBitDepth(CHANNEL_TYPE_CHROMA)>>log2subWidthCxsubHeightC));
-#endif
   const std::size_t threshold = (32/3)*numBytesInVclNalUnits + (rawBits/32);
   if (binCountsInNalUnits >= threshold)
@@ -1667,5 +1655,5 @@
           {
             //downsampling
-            xDownScalePic(pcPic->getPicYuvOrg(), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvOrg(), pcSlice->getBitDepths(), pcPic->getPosScalingFactor(refLayerIdc, 0));
+            xDownScalePic(pcPic->getPicYuvOrg(), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvOrg(), pcSlice->getSPS()->getBitDepths(), pcPic->getPosScalingFactor(refLayerIdc, 0));
             
             m_Enc3DAsymLUTPPS.setDsOrigPic(pcSlice->getBaseColPic(refLayerIdc)->getPicYuvOrg());
@@ -1698,5 +1686,5 @@
           if( pcSlice->getVPS()->isSamplePredictionType( pcSlice->getVPS()->getLayerIdxInVps(m_layerId), pcSlice->getVPS()->getLayerIdxInVps(refLayerId) ) )
           {
-            m_pcPredSearch->upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), pcSlice->getBaseColPic(refLayerIdc)->getSlice(0)->getBitDepth(CHANNEL_TYPE_LUMA), pcSlice->getBaseColPic(refLayerIdc)->getSlice(0)->getBitDepth(CHANNEL_TYPE_CHROMA) );
+            m_pcPredSearch->upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pBaseColRec, pcPic->getPicYuvRec(), pcSlice->getBaseColPic(refLayerIdc)->getSlice(0)->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA), pcSlice->getBaseColPic(refLayerIdc)->getSlice(0)->getSPS()->getBitDepth(CHANNEL_TYPE_CHROMA) );
           }
         }
@@ -2383,9 +2371,5 @@
       }
 
-#if SVC_EXTENSION
-      sliceQP = Clip3( -pcSlice->getQpBDOffset(CHANNEL_TYPE_LUMA), MAX_QP, sliceQP );
-#else
       sliceQP = Clip3( -pcSlice->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA), MAX_QP, sliceQP );
-#endif
       m_pcRateCtrl->getRCPic()->setPicEstQP( sliceQP );
 
@@ -2700,9 +2684,5 @@
     {
       SEIDecodedPictureHash *decodedPictureHashSei = new SEIDecodedPictureHash();
-#if SVC_EXTENSION
-      m_seiEncoder.initDecodedPictureHashSEI(decodedPictureHashSei, pcPic, digestStr, pcSlice->getBitDepths());
-#else
       m_seiEncoder.initDecodedPictureHashSEI(decodedPictureHashSei, pcPic, digestStr, pcSlice->getSPS()->getBitDepths());
-#endif
       trailingSeiMessages.push_back(decodedPictureHashSei);
     }
@@ -2882,9 +2862,5 @@
   if (!bCalcDist)
   {
-#if SVC_EXTENSION
-    ruiDist = xFindDistortionFrame(pcPic->getPicYuvOrg(), pcPic->getPicYuvRec(), pcPic->getSlice(0)->getBitDepths());
-#else
     ruiDist = xFindDistortionFrame(pcPic->getPicYuvOrg(), pcPic->getPicYuvRec(), pcPic->getPicSym()->getSPS().getBitDepths());
-#endif
   }
 }
@@ -3098,9 +3074,5 @@
       pRec += iRecStride;
     }
-#if SVC_EXTENSION
-    const Int maxval = 255 << (pcPic->getSlice(0)->getBitDepth(toChannelType(ch)) - 8);
-#else
     const Int maxval = 255 << (pcPic->getPicSym()->getSPS().getBitDepth(toChannelType(ch)) - 8);
-#endif
     const Double fRefValue = (Double) maxval * maxval * iSize;
     dPSNR[ch]         = ( uiSSDtemp ? 10.0 * log10( fRefValue / (Double)uiSSDtemp ) : 999.99 );
@@ -3254,7 +3226,5 @@
                                            const InputColourSpaceConversion conversion, const Bool printFrameMSE )
 {
-#if !SVC_EXTENSION
   const TComSPS &sps=pcPicOrgFirstField->getPicSym()->getSPS();
-#endif
   Double  dPSNR[MAX_NUM_COMPONENT];
   TComPic    *apcPicOrgFields[2]={pcPicOrgFirstField, pcPicOrgSecondField};
@@ -3317,9 +3287,5 @@
       }
     }
-#if SVC_EXTENSION
-    const Int maxval = 255 << (pcPicOrgFirstField->getSlice(0)->getBitDepth(toChannelType(ch)) - 8);
-#else
     const Int maxval = 255 << (sps.getBitDepth(toChannelType(ch)) - 8);
-#endif
     const Double fRefValue = (Double) maxval * maxval * iSize*2;
     dPSNR[ch]         = ( uiSSDtemp ? 10.0 * log10( fRefValue / (Double)uiSSDtemp ) : 999.99 );
@@ -3601,9 +3567,5 @@
 
   Int qp = pcPic->getSlice(0)->getSliceQp();
-#if SVC_EXTENSION
-  const Int bitDepthLuma=pcPic->getSlice(0)->getBitDepth(CHANNEL_TYPE_LUMA);
-#else
   const Int bitDepthLuma=pcPic->getSlice(0)->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA);
-#endif
   Int bitdepthScale = 1 << (bitDepthLuma-8);
   Int beta = TComLoopFilter::getBeta( qp ) * bitdepthScale;
@@ -4096,5 +4058,5 @@
 }
 
-Void TEncGOP::xDownScalePic( TComPicYuv* pcYuvSrc, TComPicYuv* pcYuvDest, BitDepths& bitDepth, const Int posScalingFactorX)
+Void TEncGOP::xDownScalePic( TComPicYuv* pcYuvSrc, TComPicYuv* pcYuvDest, const BitDepths& bitDepth, const Int posScalingFactorX)
 {
   pcYuvSrc->setBorderExtension(false);
@@ -4158,5 +4120,5 @@
 #endif
 #endif
-Void TEncGOP::xFilterImg( Pel *src, Int iSrcStride, Pel *dst, Int iDstStride, Int height, Int width, BitDepths& bitDepth, ComponentID comp )
+Void TEncGOP::xFilterImg( Pel *src, Int iSrcStride, Pel *dst, Int iDstStride, Int height, Int width, const BitDepths& bitDepth, ComponentID comp )
 {
   Int height2, width2;
Index: branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.h
===================================================================
--- branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.h	(revision 1500)
+++ branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.h	(revision 1502)
@@ -277,9 +277,9 @@
 #if CGS_3D_ASYMLUT
   Void xDetermine3DAsymLUT( TComSlice * pSlice , TComPic * pCurPic , UInt refLayerIdc , TEncCfg * pCfg , Bool bSignalPPS );
-  Void xDownScalePic( TComPicYuv* pcYuvSrc, TComPicYuv* pcYuvDest, BitDepths& bitDepth, const Int posScalingFactorX);
+  Void xDownScalePic( TComPicYuv* pcYuvSrc, TComPicYuv* pcYuvDest, const BitDepths& bitDepth, const Int posScalingFactorX);
   Void xDownScaleComponent2x2( const Pel* pSrc, Pel* pDest, const Int iSrcStride, const Int iDestStride, const Int iSrcWidth, const Int iSrcHeight, const Int inputBitDepth, const Int outputBitDepth );
   inline Short xClip( Short x, Int bitdepth );
   Void xInitDs( const Int iWidth, const Int iHeight, const Bool allIntra, const Int posScalingFactorX);
-  Void xFilterImg( Pel *src, Int iSrcStride, Pel *dst, Int iDstStride, Int height, Int width, BitDepths& bitDepth, ComponentID comp );
+  Void xFilterImg( Pel *src, Int iSrcStride, Pel *dst, Int iDstStride, Int height, Int width, const BitDepths& bitDepth, ComponentID comp );
 
   Int  xCreate2DArray(Int ***array2D, Int dim0, Int dim1, Int iPadY, Int iPadX);
Index: branches/SHM-dev/source/Lib/TLibEncoder/TEncPic.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibEncoder/TEncPic.cpp	(revision 1500)
+++ branches/SHM-dev/source/Lib/TLibEncoder/TEncPic.cpp	(revision 1502)
@@ -128,15 +128,11 @@
 {
   TComPic::create( vps, sps, pps, bIsVirtual, layerId );
-
-  const Int iWidth  = vps.getPicWidthInLumaSamples(&sps, layerId);
-  const Int iHeight = vps.getPicHeightInLumaSamples(&sps, layerId);
 #else
 Void TEncPic::create( const TComSPS &sps, const TComPPS &pps, UInt uiMaxAdaptiveQPDepth, Bool bIsVirtual )
 {
   TComPic::create( sps, pps, bIsVirtual );
+#endif
   const Int  iWidth      = sps.getPicWidthInLumaSamples();
   const Int  iHeight     = sps.getPicHeightInLumaSamples();
-#endif
-
   const UInt uiMaxWidth  = sps.getMaxCUWidth();
   const UInt uiMaxHeight = sps.getMaxCUHeight();
Index: branches/SHM-dev/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp	(revision 1500)
+++ branches/SHM-dev/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp	(revision 1502)
@@ -320,9 +320,5 @@
       Pel* orgBlk     = orgYuv->getAddr(component) + ((yPos >> componentScaleY) * orgStride) + (xPos >> componentScaleX);
 
-#if SVC_EXTENSION
-      getBlkStats(component, pPic->getSlice(0)->getBitDepth(toChannelType(component)), blkStats[ctuRsAddr][component]
-#else
       getBlkStats(component, pPic->getPicSym()->getSPS().getBitDepth(toChannelType(component)), blkStats[ctuRsAddr][component]
-#endif
                 , srcBlk, orgBlk, srcStride, orgStride, (width  >> componentScaleX), (height >> componentScaleY)
                 , isLeftAvail,  isRightAvail, isAboveAvail, isBelowAvail, isAboveLeftAvail, isAboveRightAvail
@@ -813,19 +809,10 @@
       case SAO_MODE_NEW:
         {
-#if SVC_EXTENSION
-          deriveModeNewRDO(pic->getSlice(0)->getBitDepths(), ctuRsAddr, mergeList, sliceEnabled, blkStats, modeParam, modeCost, m_pppcRDSbacCoder, SAO_CABACSTATE_BLK_CUR);
-#else
           deriveModeNewRDO(pic->getPicSym()->getSPS().getBitDepths(), ctuRsAddr, mergeList, sliceEnabled, blkStats, modeParam, modeCost, m_pppcRDSbacCoder, SAO_CABACSTATE_BLK_CUR);
-#endif
-
         }
         break;
       case SAO_MODE_MERGE:
         {
-#if SVC_EXTENSION
-          deriveModeMergeRDO(pic->getSlice(0)->getBitDepths(), ctuRsAddr, mergeList, sliceEnabled, blkStats , modeParam, modeCost, m_pppcRDSbacCoder, SAO_CABACSTATE_BLK_CUR);
-#else
           deriveModeMergeRDO(pic->getPicSym()->getSPS().getBitDepths(), ctuRsAddr, mergeList, sliceEnabled, blkStats , modeParam, modeCost, m_pppcRDSbacCoder, SAO_CABACSTATE_BLK_CUR);
-#endif
         }
         break;
Index: branches/SHM-dev/source/Lib/TLibEncoder/TEncSbac.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibEncoder/TEncSbac.cpp	(revision 1500)
+++ branches/SHM-dev/source/Lib/TLibEncoder/TEncSbac.cpp	(revision 1502)
@@ -883,11 +883,6 @@
 Void TEncSbac::codeDeltaQP( TComDataCU* pcCU, UInt uiAbsPartIdx )
 {
-  Int iDQp  = pcCU->getQP( uiAbsPartIdx ) - pcCU->getRefQP( uiAbsPartIdx );
-  
-#if SVC_EXTENSION  
-  Int qpBdOffsetY =  pcCU->getSlice()->getQpBDOffset(CHANNEL_TYPE_LUMA);
-#else
+  Int iDQp  = pcCU->getQP( uiAbsPartIdx ) - pcCU->getRefQP( uiAbsPartIdx );  
   Int qpBdOffsetY =  pcCU->getSlice()->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA);
-#endif
   iDQp = (iDQp + 78 + qpBdOffsetY + (qpBdOffsetY/2)) % (52 + qpBdOffsetY) - 26 - (qpBdOffsetY/2);
 
Index: branches/SHM-dev/source/Lib/TLibEncoder/TEncSearch.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 1500)
+++ branches/SHM-dev/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 1502)
@@ -1129,10 +1129,5 @@
   const ChromaFormat   chFmt            = pcOrgYuv->getChromaFormat();
   const ChannelType    chType           = toChannelType(compID);
-#if SVC_EXTENSION
-  const Int            bitDepth         = pcCU->getSlice()->getBitDepth(chType);
-#else
   const Int            bitDepth         = sps.getBitDepth(chType);
-#endif
-
   const UInt           uiWidth          = rect.width;
   const UInt           uiHeight         = rect.height;
@@ -2294,9 +2289,5 @@
       DistParam distParam;
       const Bool bUseHadamard=pcCU->getCUTransquantBypass(0) == 0;
-#if SVC_EXTENSION
-      m_pcRdCost->setDistParam(distParam, pcCU->getSlice()->getBitDepth(CHANNEL_TYPE_LUMA), piOrg, uiStride, piPred, uiStride, puRect.width, puRect.height, bUseHadamard);
-#else
       m_pcRdCost->setDistParam(distParam, sps.getBitDepth(CHANNEL_TYPE_LUMA), piOrg, uiStride, piPred, uiStride, puRect.width, puRect.height, bUseHadamard);
-#endif
       distParam.bApplyWeight = false;
       for( Int modeIdx = 0; modeIdx < numModesAvailable; modeIdx++ )
@@ -2774,9 +2765,5 @@
   const UInt uiReconStride   = pcCU->getPic()->getPicYuvRec()->getStride(compID);
   const UInt uiPCMBitDepth   = pcCU->getSlice()->getSPS()->getPCMBitDepth(toChannelType(compID));
-#if SVC_EXTENSION
-  const Int  channelBitDepth = pcCU->getSlice()->getBitDepth(toChannelType(compID));
-#else
   const Int  channelBitDepth = pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID));
-#endif
   Pel* pRecoPic = pcCU->getPic()->getPicYuvRec()->getAddr(compID, pcCU->getCtuRsAddr(), pcCU->getZorderIdxInCtu()+uiAbsPartIdx);
 
@@ -2866,9 +2853,5 @@
 
 
-#if SVC_EXTENSION
-  m_pcRdCost->setDistParam( cDistParam, pcCU->getSlice()->getBitDepth(CHANNEL_TYPE_LUMA),
-#else
   m_pcRdCost->setDistParam( cDistParam, pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA),
-#endif
                             pcYuvOrg->getAddr( COMPONENT_Y, uiAbsPartIdx ), pcYuvOrg->getStride(COMPONENT_Y),
                             m_tmpYuvPred .getAddr( COMPONENT_Y, uiAbsPartIdx ), m_tmpYuvPred.getStride(COMPONENT_Y),
@@ -3813,17 +3796,9 @@
 #endif
   {
-#if SVC_EXTENSION
-    xPredInterBlk( COMPONENT_Y, pcCU, pcPicYuvRef, uiPartAddr, &cMvCand, iSizeX, iSizeY, pcTemplateCand, true, pcCU->getSlice()->getBitDepth(CHANNEL_TYPE_LUMA) );
-#else
     xPredInterBlk( COMPONENT_Y, pcCU, pcPicYuvRef, uiPartAddr, &cMvCand, iSizeX, iSizeY, pcTemplateCand, true, pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) );
-#endif
   }
   else
   {
-#if SVC_EXTENSION
-    xPredInterBlk( COMPONENT_Y, pcCU, pcPicYuvRef, uiPartAddr, &cMvCand, iSizeX, iSizeY, pcTemplateCand, false, pcCU->getSlice()->getBitDepth(CHANNEL_TYPE_LUMA) );
-#else
     xPredInterBlk( COMPONENT_Y, pcCU, pcPicYuvRef, uiPartAddr, &cMvCand, iSizeX, iSizeY, pcTemplateCand, false, pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) );
-#endif
   }
 
@@ -3840,9 +3815,5 @@
   // calc distortion
 
-#if SVC_EXTENSION
-  uiCost = m_pcRdCost->getDistPart( pcCU->getSlice()->getBitDepth(CHANNEL_TYPE_LUMA), pcTemplateCand->getAddr(COMPONENT_Y, uiPartAddr), pcTemplateCand->getStride(COMPONENT_Y), pcOrgYuv->getAddr(COMPONENT_Y, uiPartAddr), pcOrgYuv->getStride(COMPONENT_Y), iSizeX, iSizeY, COMPONENT_Y, DF_SAD );
-#else
   uiCost = m_pcRdCost->getDistPart( pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA), pcTemplateCand->getAddr(COMPONENT_Y, uiPartAddr), pcTemplateCand->getStride(COMPONENT_Y), pcOrgYuv->getAddr(COMPONENT_Y, uiPartAddr), pcOrgYuv->getStride(COMPONENT_Y), iSizeX, iSizeY, COMPONENT_Y, DF_SAD );
-#endif
   uiCost = (UInt) m_pcRdCost->calcRdCost( m_auiMVPIdxCost[iMVPIdx][iMVPNum], uiCost, DF_SAD );
   return uiCost;
@@ -3891,9 +3862,5 @@
                              iRoiHeight,
                              pcYuv->getStride(COMPONENT_Y),
-#if SVC_EXTENSION
-                             pcCU->getSlice()->getBitDepth(CHANNEL_TYPE_LUMA) );
-#else
                              pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) );
-#endif
 
   Pel*        piRefY      = pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxPred )->getPicYuvRec()->getAddr( COMPONENT_Y, pcCU->getCtuRsAddr(), pcCU->getZorderIdxInCtu() + uiPartAddr );
@@ -4633,7 +4600,5 @@
   const UInt cuHeightPixels     = pcCU->getHeight( 0 );
   const Int  numValidComponents = pcCU->getPic()->getNumberValidComponents();
-#if !SVC_EXTENSION
   const TComSPS &sps=*(pcCU->getSlice()->getSPS());
-#endif
 
   // The pcCU is not marked as skip-mode at this point, and its m_pcTrCoeff, m_pcArlCoeff, m_puhCbf, m_puhTrIdx will all be 0.
@@ -4654,9 +4619,5 @@
       const UInt csx=pcYuvOrg->getComponentScaleX(compID);
       const UInt csy=pcYuvOrg->getComponentScaleY(compID);
-#if SVC_EXTENSION
-      distortion += m_pcRdCost->getDistPart( pcCU->getSlice()->getBitDepth(toChannelType(compID)), pcYuvRec->getAddr(compID), pcYuvRec->getStride(compID), pcYuvOrg->getAddr(compID),
-#else
       distortion += m_pcRdCost->getDistPart( sps.getBitDepth(toChannelType(compID)), pcYuvRec->getAddr(compID), pcYuvRec->getStride(compID), pcYuvOrg->getAddr(compID),
-#endif
                                                pcYuvOrg->getStride(compID), cuWidthPixels >> csx, cuHeightPixels >> csy, compID);
     }
@@ -4758,9 +4719,5 @@
   m_pcRDGoOnSbacCoder->store( m_pppcRDSbacCoder[ pcCU->getDepth( 0 ) ][ CI_TEMP_BEST ] );
 
-#if SVC_EXTENSION
-  pcYuvRec->addClip ( pcYuvPred, pcYuvResiBest, 0, cuWidthPixels, pcCU->getSlice()->getBitDepths() );
-#else
   pcYuvRec->addClip ( pcYuvPred, pcYuvResiBest, 0, cuWidthPixels, sps.getBitDepths() );
-#endif
 
   // update with clipped distortion and cost (previously unclipped reconstruction values were used)
@@ -4770,9 +4727,5 @@
   {
     const ComponentID compID=ComponentID(comp);
-#if SVC_EXTENSION
-    finalDistortion += m_pcRdCost->getDistPart( pcCU->getSlice()->getBitDepth(toChannelType(compID)), pcYuvRec->getAddr(compID ), pcYuvRec->getStride(compID ), pcYuvOrg->getAddr(compID ), pcYuvOrg->getStride(compID), cuWidthPixels >> pcYuvOrg->getComponentScaleX(compID), cuHeightPixels >> pcYuvOrg->getComponentScaleY(compID), compID);
-#else
     finalDistortion += m_pcRdCost->getDistPart( sps.getBitDepth(toChannelType(compID)), pcYuvRec->getAddr(compID ), pcYuvRec->getStride(compID ), pcYuvOrg->getAddr(compID ), pcYuvOrg->getStride(compID), cuWidthPixels >> pcYuvOrg->getComponentScaleX(compID), cuHeightPixels >> pcYuvOrg->getComponentScaleY(compID), compID);
-#endif
   }
 
@@ -4864,9 +4817,5 @@
       checkTransformSkip[i]=false;
       const ComponentID compID=ComponentID(i);
-#if SVC_EXTENSION
-      const Int channelBitDepth=pcCU->getSlice()->getBitDepth(toChannelType(compID));
-#else
       const Int channelBitDepth=pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID));
-#endif
       pcCoeffCurr[compID]    = m_ppcQTTempCoeff[compID][uiQTTempAccessLayer] + rTu.getCoefficientOffset(compID);
 #if ADAPTIVE_QP_SELECTION
Index: branches/SHM-dev/source/Lib/TLibEncoder/TEncSlice.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibEncoder/TEncSlice.cpp	(revision 1500)
+++ branches/SHM-dev/source/Lib/TLibEncoder/TEncSlice.cpp	(revision 1502)
@@ -173,9 +173,5 @@
 
   // store lambda
-#if SVC_EXTENSION
-  m_pcRdCost ->setLambda( dLambda, slice->getBitDepths() );
-#else
   m_pcRdCost ->setLambda( dLambda, slice->getSPS()->getBitDepths() );
-#endif
 
   // for RDO
@@ -193,5 +189,5 @@
     {
       dLambdas[0] = dLambda * 1.1;
-      m_pcRdCost->setLambda( dLambdas[0], slice->getBitDepths() );
+      m_pcRdCost->setLambda( dLambdas[0], slice->getSPS()->getBitDepths() );
 
       m_pcRdCost->setDistortionWeight(compID, tmpWeight * 1.15);
@@ -337,9 +333,5 @@
   if(eSliceType!=I_SLICE)
   {
-#if SVC_EXTENSION
-    if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getQpBDOffset(CHANNEL_TYPE_LUMA) ) && (rpcSlice->getPPS()->getTransquantBypassEnableFlag())))
-#else
     if (!(( m_pcCfg->getMaxDeltaQP() == 0 ) && (dQP == -rpcSlice->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA) ) && (rpcSlice->getPPS()->getTransquantBypassEnableFlag())))
-#endif
     {
       dQP += m_pcCfg->getGOPEntry(iGOPid).m_QPOffset;
@@ -378,9 +370,5 @@
 
 #if FULL_NBIT
-#if SVC_EXTENSION
-    Int    bitdepth_luma_qp_scale = 6 * (rpcSlice->getBitDepth(CHANNEL_TYPE_LUMA) - 8);
-#else
     Int    bitdepth_luma_qp_scale = 6 * (rpcSlice->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) - 8);
-#endif
 #else
     Int    bitdepth_luma_qp_scale = 0;
@@ -423,9 +411,5 @@
     }
 
-#if SVC_EXTENSION
-    iQP = max( -rpcSlice->getQpBDOffset(CHANNEL_TYPE_LUMA), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );
-#else
     iQP = max( -rpcSlice->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );
-#endif
 
     m_pdRdPicLambda[iDQpIdx] = dLambda;
@@ -489,9 +473,5 @@
   {
     dQP = xGetQPValueAccordingToLambda( dLambda );
-#if SVC_EXTENSION
-    iQP = max( -rpcSlice->getQpBDOffset(CHANNEL_TYPE_LUMA), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );
-#else
     iQP = max( -rpcSlice->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA), min( MAX_QP, (Int) floor( dQP + 0.5 ) ) );
-#endif
   }
 
@@ -669,9 +649,5 @@
   Double dFrameLambda;
 #if FULL_NBIT
-#if SVC_EXTENSION
-  Int    SHIFT_QP = 12 + 6 * (pcSlice->getBitDepth(CHANNEL_TYPE_LUMA) - 8);
-#else
   Int    SHIFT_QP = 12 + 6 * (pcSlice->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) - 8);
-#endif
 #else
   Int    SHIFT_QP = 12;
@@ -732,9 +708,5 @@
   TComSlice * const pcSlice           = pcPic->getSlice(getSliceIdx());
   const TComSPS    &sps               = *(pcSlice->getSPS());
-#if SVC_EXTENSION
-  const Int         shift             = pcSlice->getBitDepth(CHANNEL_TYPE_LUMA)-8;
-#else
   const Int         shift             = sps.getBitDepth(CHANNEL_TYPE_LUMA)-8;
-#endif
   const Int         offset            = (shift>0)?(1<<(shift-1)):0;
 
@@ -752,11 +724,6 @@
     pCtu->initCtu( pcPic, ctuRsAddr );
 
-#if SVC_EXTENSION
-    Int height  = min( sps.getMaxCUHeight(),pcSlice->getPicHeightInLumaSamples() - ctuRsAddr / pcPic->getFrameWidthInCtus() * sps.getMaxCUHeight() );
-    Int width   = min( sps.getMaxCUWidth(),pcSlice->getPicWidthInLumaSamples() - ctuRsAddr % pcPic->getFrameWidthInCtus() * sps.getMaxCUWidth() );
-#else
     Int height  = min( sps.getMaxCUHeight(),sps.getPicHeightInLumaSamples() - ctuRsAddr / pcPic->getFrameWidthInCtus() * sps.getMaxCUHeight() );
     Int width   = min( sps.getMaxCUWidth(), sps.getPicWidthInLumaSamples()  - ctuRsAddr % pcPic->getFrameWidthInCtus() * sps.getMaxCUWidth() );
-#endif
 
     Int iSumHad = m_pcCuEncoder->updateCtuDataISlice(pCtu, width, height);
@@ -938,13 +905,7 @@
         }
 
-#if SVC_EXTENSION
-        estQP     = Clip3( -pcSlice->getQpBDOffset(CHANNEL_TYPE_LUMA), MAX_QP, estQP );
-
-        m_pcRdCost->setLambda(estLambda, pcSlice->getBitDepths());
-#else
         estQP     = Clip3( -pcSlice->getSPS()->getQpBDOffset(CHANNEL_TYPE_LUMA), MAX_QP, estQP );
 
         m_pcRdCost->setLambda(estLambda, pcSlice->getSPS()->getBitDepths());
-#endif        
 
 #if RDOQ_CHROMA_LAMBDA
@@ -1040,9 +1001,5 @@
         actualQP = pCtu->getQP( 0 );
       }
-#if SVC_EXTENSION
-      m_pcRdCost->setLambda(oldLambda, pcSlice->getBitDepths());
-#else
       m_pcRdCost->setLambda(oldLambda, pcSlice->getSPS()->getBitDepths());
-#endif
       m_pcRateCtrl->getRCPic()->updateAfterCTU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda,
                                                 pCtu->getSlice()->getSliceType() == I_SLICE ? 0 : m_pcCfg->getLCULevelRC() );
@@ -1201,9 +1158,5 @@
         }
 
-#if SVC_EXTENSION
-        m_pcEntropyCoder->encodeSAOBlkParam(saoblkParam, pcPic->getPicSym()->getSlice(0)->getBitDepths(), sliceEnabled, leftMergeAvail, aboveMergeAvail);
-#else
         m_pcEntropyCoder->encodeSAOBlkParam(saoblkParam, pcPic->getPicSym()->getSPS().getBitDepths(), sliceEnabled, leftMergeAvail, aboveMergeAvail);
-#endif
       }
     }
Index: branches/SHM-dev/source/Lib/TLibEncoder/TEncTop.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibEncoder/TEncTop.cpp	(revision 1500)
+++ branches/SHM-dev/source/Lib/TLibEncoder/TEncTop.cpp	(revision 1502)
@@ -288,9 +288,5 @@
   if(getUseScalingListId() == SCALING_LIST_OFF)
   {
-#if SVC_EXTENSION
-    getTrQuant()->setFlatScalingList( maxLog2TrDynamicRange, m_cVPS.getBitDepths(&m_cSPS, m_layerId) );
-#else
     getTrQuant()->setFlatScalingList(maxLog2TrDynamicRange, m_cSPS.getBitDepths());
-#endif
     getTrQuant()->setUseScalingList(false);
     m_cSPS.setScalingListPresentFlag(false);
@@ -311,5 +307,5 @@
 
       // infer the scaling list from the reference layer
-      getTrQuant()->setScalingList( &m_ppcTEncTop[m_cVPS.getLayerIdxInVps(refLayerId)]->getSPS()->getScalingList(), maxLog2TrDynamicRange, m_cVPS.getBitDepths(&m_cSPS, m_layerId) );
+      getTrQuant()->setScalingList( &m_ppcTEncTop[m_cVPS.getLayerIdxInVps(refLayerId)]->getSPS()->getScalingList(), maxLog2TrDynamicRange, m_ppcTEncTop[m_cVPS.getLayerIdxInVps(refLayerId)]->getSPS()->getBitDepths() );
     }
     else
@@ -320,9 +316,5 @@
     m_cPPS.setScalingListPresentFlag(false);
 
-#if SVC_EXTENSION
-    getTrQuant()->setScalingList(&(m_cSPS.getScalingList()), maxLog2TrDynamicRange, m_cVPS.getBitDepths(&m_cSPS, m_layerId));
-#else
     getTrQuant()->setScalingList(&(m_cSPS.getScalingList()), maxLog2TrDynamicRange, m_cSPS.getBitDepths());
-#endif
 #if SVC_EXTENSION
     }
@@ -344,5 +336,5 @@
 
       // infer the scaling list from the reference layer
-      getTrQuant()->setScalingList( &m_ppcTEncTop[m_cVPS.getLayerIdxInVps(refLayerId)]->getSPS()->getScalingList(), maxLog2TrDynamicRange, m_cVPS.getBitDepths(&m_cSPS, m_layerId) );
+      getTrQuant()->setScalingList( &m_ppcTEncTop[m_cVPS.getLayerIdxInVps(refLayerId)]->getSPS()->getScalingList(), maxLog2TrDynamicRange, m_ppcTEncTop[m_cVPS.getLayerIdxInVps(refLayerId)]->getSPS()->getBitDepths() );
     }
     else
@@ -731,10 +723,8 @@
           TEncTop *pcEncTopBase = (TEncTop *)getRefLayerEnc( i );
 
-          UInt refLayerId = m_cVPS.getRefLayerId(m_layerId, i);
-
-          const Int bitDepthLuma = m_cVPS.getBitDepth(CHANNEL_TYPE_LUMA, &m_cSPS, m_layerId);
-          const Int bitDepthChroma = m_cVPS.getBitDepth(CHANNEL_TYPE_CHROMA, &m_cSPS, m_layerId);
-          const Int refBitDepthLuma = m_cVPS.getBitDepth(CHANNEL_TYPE_LUMA, pcEncTopBase->getSPS(), refLayerId);
-          const Int refBitDepthChroma = m_cVPS.getBitDepth(CHANNEL_TYPE_CHROMA, pcEncTopBase->getSPS(), refLayerId);
+          const Int bitDepthLuma = m_cSPS.getBitDepth(CHANNEL_TYPE_LUMA);
+          const Int bitDepthChroma = m_cSPS.getBitDepth(CHANNEL_TYPE_CHROMA);
+          const Int refBitDepthLuma = pcEncTopBase->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA);
+          const Int refBitDepthChroma = pcEncTopBase->getSPS()->getBitDepth(CHANNEL_TYPE_CHROMA);
 
           Bool sameBitDepths = ( bitDepthLuma == refBitDepthLuma ) && ( bitDepthChroma == refBitDepthChroma );
@@ -781,10 +771,8 @@
           TEncTop *pcEncTopBase = (TEncTop *)getRefLayerEnc( i );
 
-          UInt refLayerId = m_cVPS.getRefLayerId(m_layerId, i);
-
-          const Int bitDepthLuma = m_cVPS.getBitDepth(CHANNEL_TYPE_LUMA, &m_cSPS, m_layerId);
-          const Int bitDepthChroma = m_cVPS.getBitDepth(CHANNEL_TYPE_CHROMA, &m_cSPS, m_layerId);
-          const Int refBitDepthLuma = m_cVPS.getBitDepth(CHANNEL_TYPE_LUMA, pcEncTopBase->getSPS(), refLayerId);
-          const Int refBitDepthChroma = m_cVPS.getBitDepth(CHANNEL_TYPE_CHROMA, pcEncTopBase->getSPS(), refLayerId);
+          const Int bitDepthLuma = m_cSPS.getBitDepth(CHANNEL_TYPE_LUMA);
+          const Int bitDepthChroma = m_cSPS.getBitDepth(CHANNEL_TYPE_CHROMA);
+          const Int refBitDepthLuma = m_cSPS.getBitDepth(CHANNEL_TYPE_LUMA);
+          const Int refBitDepthChroma = m_cSPS.getBitDepth(CHANNEL_TYPE_CHROMA);
 
           Bool sameBitDepths = ( bitDepthLuma == refBitDepthLuma ) && ( bitDepthChroma == refBitDepthChroma );
@@ -1034,4 +1022,8 @@
   m_cSPS.getSpsRangeExtension().setPersistentRiceAdaptationEnabledFlag(m_persistentRiceAdaptationEnabledFlag);
   m_cSPS.getSpsRangeExtension().setCabacBypassAlignmentEnabledFlag(m_cabacBypassAlignmentEnabledFlag);
+
+#if SVC_EXTENSION
+  m_cSPS.inferSPS( m_layerId, &m_cVPS );
+#endif
 }
 
Index: branches/SHM-dev/source/Lib/TLibEncoder/WeightPredAnalysis.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibEncoder/WeightPredAnalysis.cpp	(revision 1500)
+++ branches/SHM-dev/source/Lib/TLibEncoder/WeightPredAnalysis.cpp	(revision 1502)
@@ -432,9 +432,5 @@
       {
         const ComponentID compID        = ComponentID(comp);
-#if SVC_EXTENSION
-        const Int         bitDepth      = slice->getBitDepth(toChannelType(compID));
-#else
         const Int         bitDepth      = slice->getSPS()->getBitDepth(toChannelType(compID));
-#endif
         const Int         range         = bUseHighPrecisionWeighting ? (1<<bitDepth)/2 : 128;
         const Int         realLog2Denom = log2Denom + (bUseHighPrecisionWeighting ? RExt__PREDICTION_WEIGHTING_ANALYSIS_DC_PRECISION : (bitDepth - 8));
@@ -453,6 +449,6 @@
           refAC = ( refAC * currWeightACDCParam[comp].numSamples ) / refWeightACDCParam[comp].numSamples;
 
-          const Int bitDepthLuma = slice->getBitDepth(CHANNEL_TYPE_LUMA);
-          const Int refBitDepthLuma  = slice->getRefPic(eRefPicList, refIdxTemp)->getSlice(0)->getBitDepth(CHANNEL_TYPE_LUMA);
+          const Int bitDepthLuma = slice->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA);
+          const Int refBitDepthLuma  = slice->getRefPic(eRefPicList, refIdxTemp)->getSlice(0)->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA);
           const Int delta = bitDepthLuma - refBitDepthLuma;
 
@@ -557,9 +553,5 @@
         const Int          width      = pPic->getWidth(compID);
         const Int          height     = pPic->getHeight(compID);
-#if SVC_EXTENSION
-        const Int          bitDepth   = slice->getBitDepth(toChannelType(compID));
-#else
         const Int          bitDepth   = slice->getSPS()->getBitDepth(toChannelType(compID));
-#endif
               WPScalingParam &wp      = m_wp[refList][refIdxTemp][compID];
               Int          weight     = wp.iWeight;
@@ -679,9 +671,5 @@
         const Int          width     = pPic->getWidth(compID);
         const Int          height    = pPic->getHeight(compID);
-#if SVC_EXTENSION
-        const Int          bitDepth   = slice->getBitDepth(toChannelType(compID));
-#else
         const Int          bitDepth   = slice->getSPS()->getBitDepth(toChannelType(compID));
-#endif
 
         // calculate SAD costs with/without wp for luma
