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
-}
+}
