Index: branches/SHM-dev/source/Lib/TLibCommon/TComPic.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibCommon/TComPic.cpp	(revision 1486)
+++ branches/SHM-dev/source/Lib/TLibCommon/TComPic.cpp	(revision 1487)
@@ -292,4 +292,31 @@
 Void TComPic::copyUpsampledPictureYuv(TComPicYuv*   pcPicYuvIn, TComPicYuv*   pcPicYuvOut)
 {
+#if SCALABLE_REXT
+  Int upsampledRowWidthLuma = pcPicYuvOut->getStride(COMPONENT_Y); // 2 * pcPicYuvOut->getLumaMargin() + pcPicYuvOut->getWidth(); 
+  copyOnetoOnePicture(
+    pcPicYuvIn->getAddr(COMPONENT_Y),        
+    pcPicYuvOut->getAddr(COMPONENT_Y),      
+    pcPicYuvOut->getWidth(COMPONENT_Y), 
+    pcPicYuvOut->getHeight(COMPONENT_Y),
+    upsampledRowWidthLuma);
+
+  if(pcPicYuvOut->getChromaFormat() != CHROMA_400)
+  {
+    Int upsampledRowWidthChroma = pcPicYuvOut->getStride(COMPONENT_Cb); //2 * pcPicYuvOut->getChromaMargin() + (pcPicYuvOut->getWidth()>>1);
+
+    copyOnetoOnePicture(
+      pcPicYuvIn->getAddr(COMPONENT_Cr),        
+      pcPicYuvOut->getAddr(COMPONENT_Cr),      
+      pcPicYuvOut->getWidth(COMPONENT_Cr), 
+      pcPicYuvOut->getHeight(COMPONENT_Cr),
+      upsampledRowWidthChroma);
+    copyOnetoOnePicture(
+      pcPicYuvIn->getAddr(COMPONENT_Cb),        
+      pcPicYuvOut->getAddr(COMPONENT_Cb),      
+      pcPicYuvOut->getWidth(COMPONENT_Cb), 
+      pcPicYuvOut->getHeight(COMPONENT_Cb),
+      upsampledRowWidthChroma);
+  }
+#else
   Int upsampledRowWidthLuma = pcPicYuvOut->getStride(COMPONENT_Y); // 2 * pcPicYuvOut->getLumaMargin() + pcPicYuvOut->getWidth(); 
   Int upsampledRowWidthCroma = pcPicYuvOut->getStride(COMPONENT_Cb); //2 * pcPicYuvOut->getChromaMargin() + (pcPicYuvOut->getWidth()>>1);
@@ -313,4 +340,5 @@
     pcPicYuvOut->getHeight(COMPONENT_Y)>>1,
     upsampledRowWidthCroma);
+#endif
 }
 
Index: branches/SHM-dev/source/Lib/TLibCommon/TComUpsampleFilter.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibCommon/TComUpsampleFilter.cpp	(revision 1486)
+++ branches/SHM-dev/source/Lib/TLibCommon/TComUpsampleFilter.cpp	(revision 1487)
@@ -85,6 +85,17 @@
   if( !resamplingPhase.phasePresentFlag )
   {
+#if SCALABLE_REXT
+    if(chromaFormatIdc == 3)
+    {
+      phaseVerChroma = 0;
+    }
+    else
+    {
+#endif
     Int refRegionHeight = heightBL - windowRL.getWindowTopOffset() - windowRL.getWindowBottomOffset();
     phaseVerChroma = (4 * heightEL + (refRegionHeight >> 1)) / refRegionHeight - 4;
+#if SCALABLE_REXT
+    }
+#endif
   }
 
@@ -139,4 +150,8 @@
     }
 
+#if SCALABLE_REXT
+  if(chromaFormatIdc != 0)
+  {
+#endif
     widthEL  >>= 1;
     heightEL >>= 1;
@@ -177,4 +192,7 @@
       piDstV += strideEL;
     }
+#if SCALABLE_REXT
+  }
+#endif
   }
   else // general resampling process
@@ -290,4 +308,8 @@
     //========== UV component upsampling ===========
 
+#if SCALABLE_REXT
+  if(chromaFormatIdc != 0)
+  {
+#endif
     widthEL  >>= 1;
     heightEL >>= 1;
@@ -396,4 +418,7 @@
       }
     }
+#if SCALABLE_REXT
+    }
+#endif
   }
     pcUsPic->setBorderExtension(false);
Index: branches/SHM-dev/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- branches/SHM-dev/source/Lib/TLibCommon/TypeDef.h	(revision 1486)
+++ branches/SHM-dev/source/Lib/TLibCommon/TypeDef.h	(revision 1487)
@@ -48,4 +48,7 @@
 
 #if SVC_EXTENSION
+#define SCALABLE_REXT                    1
+#define FORMATIDX_CHECK                  1
+
 #define MAX_LAYERS                       8      ///< max number of layers the codec is supposed to handle
 
@@ -197,5 +200,5 @@
 // This can be enabled by the makefile
 #ifndef RExt__HIGH_BIT_DEPTH_SUPPORT
-#define RExt__HIGH_BIT_DEPTH_SUPPORT                      0 ///< 0 (default) use data type definitions for 8-10 bit video, 1 = use larger data types to allow for up to 16-bit video (originally developed as part of N0188)
+#define RExt__HIGH_BIT_DEPTH_SUPPORT                      1 ///< 0 (default) use data type definitions for 8-10 bit video, 1 = use larger data types to allow for up to 16-bit video (originally developed as part of N0188)
 #endif
 
@@ -644,4 +647,7 @@
     SCALABLEMAIN = 7,
     SCALABLEMAIN10 = 8,
+#if SCALABLE_REXT
+    SCALABLEREXT = 10
+#endif
 #endif
   };
Index: branches/SHM-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 1486)
+++ branches/SHM-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 1487)
@@ -681,5 +681,9 @@
 }
 
+#if SCALABLE_REXT
+Void TDecCavlc::parseSPS(TComSPS* pcSPS, ParameterSetManager* pcParamSetManager)
+#else
 Void TDecCavlc::parseSPS(TComSPS* pcSPS)
+#endif
 {
 #if ENC_DEC_TRACE
@@ -689,5 +693,7 @@
   UInt  uiCode;
   READ_CODE( 4,  uiCode, "sps_video_parameter_set_id");          pcSPS->setVPSId        ( uiCode );
-
+#if SCALABLE_REXT
+  const TComVPS* pTmpVPS = pcParamSetManager->getVPS(pcSPS->getVPSId()); 
+#endif
 #if SVC_EXTENSION
   UInt uiTmp = 0;
@@ -742,4 +748,23 @@
       pcSPS->setUpdateRepFormatIndex(uiCode);
     }
+#if SCALABLE_REXT
+    // If update_rep_format_flag is equal to 0, the variable repFormatIdx is set equal to vps_rep_format_idx[ LayerIdxInVps[ layerIdCurr ] ].
+    else
+    {
+      Int iVPSRepFormatIdx = pTmpVPS->getVpsRepFormatIdx( pTmpVPS->getLayerIdxInVps( pcSPS->getLayerId() ) );
+      pcSPS->setUpdateRepFormatIndex( iVPSRepFormatIdx );
+
+      pcSPS->setChromaFormatIdc(              pTmpVPS->getVpsRepFormat(iVPSRepFormatIdx)->getChromaFormatVpsIdc() );
+      pcSPS->setPicWidthInLumaSamples(        pTmpVPS->getVpsRepFormat(iVPSRepFormatIdx)->getPicWidthVpsInLumaSamples() );
+      pcSPS->setPicHeightInLumaSamples(       pTmpVPS->getVpsRepFormat(iVPSRepFormatIdx)->getPicHeightVpsInLumaSamples() );
+      pcSPS->setBitDepth(CHANNEL_TYPE_LUMA,   pTmpVPS->getVpsRepFormat(iVPSRepFormatIdx)->getBitDepthVpsLuma() );
+      pcSPS->setBitDepth(CHANNEL_TYPE_CHROMA, pTmpVPS->getVpsRepFormat(iVPSRepFormatIdx)->getBitDepthVpsChroma() );
+      Window &conf = pcSPS->getConformanceWindow();
+      conf.setWindowLeftOffset(               pTmpVPS->getVpsRepFormat(iVPSRepFormatIdx)->getConformanceWindowVps().getWindowLeftOffset() );
+      conf.setWindowRightOffset(              pTmpVPS->getVpsRepFormat(iVPSRepFormatIdx)->getConformanceWindowVps().getWindowRightOffset() );
+      conf.setWindowTopOffset(                pTmpVPS->getVpsRepFormat(iVPSRepFormatIdx)->getConformanceWindowVps().getWindowTopOffset() );
+      conf.setWindowBottomOffset(             pTmpVPS->getVpsRepFormat(iVPSRepFormatIdx)->getConformanceWindowVps().getWindowBottomOffset() );
+    }
+#endif
   }
   else
@@ -2166,5 +2191,9 @@
 
   if (ptl->getProfileIdc() == Profile::MAINREXT           || ptl->getProfileCompatibilityFlag(Profile::MAINREXT) ||
-      ptl->getProfileIdc() == Profile::HIGHTHROUGHPUTREXT || ptl->getProfileCompatibilityFlag(Profile::HIGHTHROUGHPUTREXT))
+      ptl->getProfileIdc() == Profile::HIGHTHROUGHPUTREXT || ptl->getProfileCompatibilityFlag(Profile::HIGHTHROUGHPUTREXT
+#if SCALABLE_REXT
+      || ptl->getProfileIdc() == Profile::SCALABLEREXT
+#endif
+      ))
   {
     UInt maxBitDepth=16;
@@ -2979,5 +3008,10 @@
             ProfileTierLevel* ptl = vps->getPTL(vps->getProfileLevelTierIdx(i, j))->getGeneralPTL();
             numIncludedLayers++;
+#if SCALABLE_REXT
+            // if scalable profile is Scalable Main 10 or Scalable Rext, dimension_id = 2
+            const Profile::Name profileName = ( ptl->getProfileIdc() == Profile::SCALABLEMAIN10 || ptl->getProfileIdc() == Profile::SCALABLEREXT ) ? Profile::SCALABLEMAIN : ptl->getProfileIdc();
+#else
             const Profile::Name profileName = ptl->getProfileIdc() == Profile::SCALABLEMAIN10 ? Profile::SCALABLEMAIN : ptl->getProfileIdc();
+#endif
 
             for( Int p = 0; p < profiles.size(); p++ )
Index: branches/SHM-dev/source/Lib/TLibDecoder/TDecCAVLC.h
===================================================================
--- branches/SHM-dev/source/Lib/TLibDecoder/TDecCAVLC.h	(revision 1486)
+++ branches/SHM-dev/source/Lib/TLibDecoder/TDecCAVLC.h	(revision 1487)
@@ -76,5 +76,9 @@
   Void  parseQtRootCbf      ( UInt uiAbsPartIdx, UInt& uiQtRootCbf );
   Void  parseVPS            ( TComVPS* pcVPS );
+#if SCALABLE_REXT
+  Void  parseSPS            ( TComSPS* pcSPS, ParameterSetManager* pcParamSetManager );
+#else
   Void  parseSPS            ( TComSPS* pcSPS );
+#endif
 #if !SVC_EXTENSION
   Void  parsePPS            ( TComPPS* pcPPS );
Index: branches/SHM-dev/source/Lib/TLibDecoder/TDecEntropy.h
===================================================================
--- branches/SHM-dev/source/Lib/TLibDecoder/TDecEntropy.h	(revision 1486)
+++ branches/SHM-dev/source/Lib/TLibDecoder/TDecEntropy.h	(revision 1487)
@@ -70,5 +70,9 @@
 
   virtual Void  parseVPS                  ( TComVPS* pcVPS )     = 0;
+#if SCALABLE_REXT
+  virtual Void  parseSPS                  ( TComSPS* pcSPS, ParameterSetManager* pcParamSetManager )     = 0;
+#else
   virtual Void  parseSPS                  ( TComSPS* pcSPS )     = 0;
+#endif
 #if CGS_3D_ASYMLUT
   virtual Void  parsePPS                  ( TComPPS* pcPPS, TCom3DAsymLUT * pc3DAsymLUT , Int nLayerID )     = 0;
@@ -143,5 +147,9 @@
 
   Void    decodeVPS                   ( TComVPS* pcVPS ) { m_pcEntropyDecoderIf->parseVPS(pcVPS); }
+#if SCALABLE_REXT
+  Void    decodeSPS                   ( TComSPS* pcSPS, ParameterSetManager* pcParamSetManager ) { m_pcEntropyDecoderIf->parseSPS(pcSPS, pcParamSetManager); }
+#else
   Void    decodeSPS                   ( TComSPS* pcSPS ) { m_pcEntropyDecoderIf->parseSPS(pcSPS); }
+#endif
 
 #if CGS_3D_ASYMLUT
Index: branches/SHM-dev/source/Lib/TLibDecoder/TDecSbac.h
===================================================================
--- branches/SHM-dev/source/Lib/TLibDecoder/TDecSbac.h	(revision 1486)
+++ branches/SHM-dev/source/Lib/TLibDecoder/TDecSbac.h	(revision 1487)
@@ -78,5 +78,9 @@
   Void  setBitstream              ( TComInputBitstream* p  ) { m_pcBitstream = p; m_pcTDecBinIf->init( p ); }
   Void  parseVPS                  ( TComVPS* /*pcVPS*/ ) {}
+#if SCALABLE_REXT
+  Void  parseSPS                  (TComSPS*  /*pcSPS*/, ParameterSetManager* /*pcParamSetManager*/ ) {}
+#else
   Void  parseSPS                  ( TComSPS* /*pcSPS*/ ) {}
+#endif
 #if CGS_3D_ASYMLUT
   Void  parsePPS                  ( TComPPS* /*pcPPS*/, TCom3DAsymLUT * /*pc3DAsymLUT*/, Int /*nLayerID*/ ) {}
Index: branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.cpp	(revision 1486)
+++ branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.cpp	(revision 1487)
@@ -1939,5 +1939,9 @@
   sps->setLayerId(m_layerId);
 #endif
+#if SCALABLE_REXT
+  m_cEntropyDecoder.decodeSPS( sps, &m_parameterSetManager );
+#else
   m_cEntropyDecoder.decodeSPS( sps );
+#endif
   m_parameterSetManager.storeSPS(sps, naluData);
 }
Index: branches/SHM-dev/source/Lib/TLibEncoder/TEnc3DAsymLUT.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibEncoder/TEnc3DAsymLUT.cpp	(revision 1486)
+++ branches/SHM-dev/source/Lib/TLibEncoder/TEnc3DAsymLUT.cpp	(revision 1487)
@@ -218,13 +218,25 @@
         if( rCuboidColorInfo.N > 0 )
         {
+#if SCALABLE_REXT
+          dErrorLuma += xCalEstPelDist( rCuboidColorInfo.N , rCuboidColorInfo.Ys , rCuboidColorInfo.Yy , rCuboidColorInfo.Yu , rCuboidColorInfo.Yv , rCuboidColorInfo.ys , rCuboidColorInfo.us , rCuboidColorInfo.vs , rCuboidColorInfo.yy , rCuboidColorInfo.yu , rCuboidColorInfo.yv , rCuboidColorInfo.uu , rCuboidColorInfo.uv , rCuboidColorInfo.vv , rCuboidColorInfo.YY ,
+            rCuboid.P[0].Y , rCuboid.P[1].Y , rCuboid.P[2].Y , rCuboid.P[3].Y );
+#else
           dErrorLuma += xCalEstDist( rCuboidColorInfo.N , rCuboidColorInfo.Ys , rCuboidColorInfo.Yy , rCuboidColorInfo.Yu , rCuboidColorInfo.Yv , rCuboidColorInfo.ys , rCuboidColorInfo.us , rCuboidColorInfo.vs , rCuboidColorInfo.yy , rCuboidColorInfo.yu , rCuboidColorInfo.yv , rCuboidColorInfo.uu , rCuboidColorInfo.uv , rCuboidColorInfo.vv , rCuboidColorInfo.YY ,
             rCuboid.P[0].Y , rCuboid.P[1].Y , rCuboid.P[2].Y , rCuboid.P[3].Y );
+#endif
         }
         if( rCuboidColorInfoC.N > 0 )
         {
+#if SCALABLE_REXT
+          dErrorChroma += xCalEstPelDist( rCuboidColorInfoC.N , rCuboidColorInfoC.Us , rCuboidColorInfoC.Uy , rCuboidColorInfoC.Uu , rCuboidColorInfoC.Uv , rCuboidColorInfoC.ys , rCuboidColorInfoC.us , rCuboidColorInfoC.vs , rCuboidColorInfoC.yy , rCuboidColorInfoC.yu , rCuboidColorInfoC.yv , rCuboidColorInfoC.uu , rCuboidColorInfoC.uv , rCuboidColorInfoC.vv , rCuboidColorInfoC.UU ,
+            rCuboid.P[0].U , rCuboid.P[1].U , rCuboid.P[2].U , rCuboid.P[3].U );
+          dErrorChroma += xCalEstPelDist( rCuboidColorInfoC.N , rCuboidColorInfoC.Vs , rCuboidColorInfoC.Vy , rCuboidColorInfoC.Vu , rCuboidColorInfoC.Vv , rCuboidColorInfoC.ys , rCuboidColorInfoC.us , rCuboidColorInfoC.vs , rCuboidColorInfoC.yy , rCuboidColorInfoC.yu , rCuboidColorInfoC.yv , rCuboidColorInfoC.uu , rCuboidColorInfoC.uv , rCuboidColorInfoC.vv , rCuboidColorInfoC.VV ,
+            rCuboid.P[0].V , rCuboid.P[1].V , rCuboid.P[2].V , rCuboid.P[3].V );
+#else
           dErrorChroma += xCalEstDist( rCuboidColorInfoC.N , rCuboidColorInfoC.Us , rCuboidColorInfoC.Uy , rCuboidColorInfoC.Uu , rCuboidColorInfoC.Uv , rCuboidColorInfoC.ys , rCuboidColorInfoC.us , rCuboidColorInfoC.vs , rCuboidColorInfoC.yy , rCuboidColorInfoC.yu , rCuboidColorInfoC.yv , rCuboidColorInfoC.uu , rCuboidColorInfoC.uv , rCuboidColorInfoC.vv , rCuboidColorInfoC.UU ,
             rCuboid.P[0].U , rCuboid.P[1].U , rCuboid.P[2].U , rCuboid.P[3].U );
           dErrorChroma += xCalEstDist( rCuboidColorInfoC.N , rCuboidColorInfoC.Vs , rCuboidColorInfoC.Vy , rCuboidColorInfoC.Vu , rCuboidColorInfoC.Vv , rCuboidColorInfoC.ys , rCuboidColorInfoC.us , rCuboidColorInfoC.vs , rCuboidColorInfoC.yy , rCuboidColorInfoC.yu , rCuboidColorInfoC.yv , rCuboidColorInfoC.uu , rCuboidColorInfoC.uv , rCuboidColorInfoC.vv , rCuboidColorInfoC.VV ,
             rCuboid.P[0].V , rCuboid.P[1].V , rCuboid.P[2].V , rCuboid.P[3].V );
+#endif
         }
       }
Index: branches/SHM-dev/source/Lib/TLibEncoder/TEnc3DAsymLUT.h
===================================================================
--- branches/SHM-dev/source/Lib/TLibEncoder/TEnc3DAsymLUT.h	(revision 1486)
+++ branches/SHM-dev/source/Lib/TLibEncoder/TEnc3DAsymLUT.h	(revision 1487)
@@ -175,7 +175,13 @@
 
   inline Double xCalEstDist( Double N, Double Ys, Double Yy, Double Yu, Double Yv, Double ys, Double us, Double vs, Double yy, Double yu, Double yv, Double uu, Double uv, Double vv, Double YY, Double a, Double b, Double c, Double d );
-
+#if SCALABLE_REXT
+/* 
+former xCalEstDist(Double, Double, Double, Double, Double, Double, Double, Double, Double, Double, Double, Double, Double, Double, Double, Pel, Pel, Pel, Pel)
+replaced by this fucntion because behaving differently than other xCalEstDist and was conflicting with xCalEstDist when RExt__HIGH_BIT_DEPTH_SUPPORT = 1
+*/
+  inline Double xCalEstPelDist( Double N, Double Ys, Double Yy, Double Yu, Double Yv, Double ys, Double us, Double vs, Double yy, Double yu, Double yv, Double uu, Double uv, Double vv, Double YY, Pel nP0, Pel nP1, Pel nP3, Pel nP7 );
+#else
   inline Double xCalEstDist( Double N, Double Ys, Double Yy, Double Yu, Double Yv, Double ys, Double us, Double vs, Double yy, Double yu, Double yv, Double uu, Double uv, Double vv, Double YY, Pel nP0, Pel nP1, Pel nP3, Pel nP7 );
-
+#endif
 #if R0179_ENC_OPT_3DLUT_SIZE
   Void    xConsolidateData( SLUTSize *pCurLUTSize, SLUTSize *pMaxLUTSize );
@@ -202,5 +208,11 @@
 };
 
-Double TEnc3DAsymLUT::xCalEstDist( Double N, Double Ys, Double Yy, Double Yu, Double Yv, Double ys, Double us, Double vs, Double yy, Double yu, Double yv, Double uu, Double uv, Double vv, Double YY, Pel nP0, Pel nP1, Pel nP3, Pel nP7 )  
+
+#if SCALABLE_REXT
+/* 
+former xCalEstDist(Double, Double, Double, Double, Double, Double, Double, Double, Double, Double, Double, Double, Double, Double, Double, Pel, Pel, Pel, Pel)
+replaced by this fucntion because behaving differently than other xCalEstDist and was conflicting with xCalEstDist when RExt__HIGH_BIT_DEPTH_SUPPORT = 1
+*/
+Double TEnc3DAsymLUT::xCalEstPelDist( Double N, Double Ys, Double Yy, Double Yu, Double Yv, Double ys, Double us, Double vs, Double yy, Double yu, Double yv, Double uu, Double uv, Double vv, Double YY, Pel nP0, Pel nP1, Pel nP3, Pel nP7 )  
 {
   const Int nOne = xGetNormCoeffOne();
@@ -212,6 +224,18 @@
   return( dError );
 };
-
-#endif
-
-#endif
+#else
+Double TEnc3DAsymLUT::xCalEstDist( Double N, Double Ys, Double Yy, Double Yu, Double Yv, Double ys, Double us, Double vs, Double yy, Double yu, Double yv, Double uu, Double uv, Double vv, Double YY, Pel nP0, Pel nP1, Pel nP3, Pel nP7 )  
+{
+  const Int nOne = xGetNormCoeffOne();
+  Double a = 1.0 * nP0 / nOne;
+  Double b = 1.0 * nP1 / nOne;
+  Double c = 1.0 * nP3 / nOne;
+  Double d = nP7;
+  Double dError = N * d * d + 2 * b * c * uv + 2 * a * c * yv + 2 * a * b * yu - 2 * c * Yv - 2 * b * Yu - 2 * a * Yy + 2 * c * d * vs + 2 * b * d * us + 2 * a * d * ys + a * a * yy + c * c * vv + b * b * uu - 2 * d * Ys + YY;
+  return( dError );
+};
+#endif
+
+#endif
+
+#endif
Index: branches/SHM-dev/source/Lib/TLibEncoder/TEncCavlc.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 1486)
+++ branches/SHM-dev/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 1487)
@@ -1412,5 +1412,9 @@
   WRITE_FLAG(ptl->getFrameOnlyConstraintFlag(), PTL_TRACE_TEXT("frame_only_constraint_flag"      ));
 
-  if (ptl->getProfileIdc() == Profile::MAINREXT || ptl->getProfileIdc() == Profile::HIGHTHROUGHPUTREXT )
+  if (ptl->getProfileIdc() == Profile::MAINREXT || ptl->getProfileIdc() == Profile::HIGHTHROUGHPUTREXT 
+#if SCALABLE_REXT
+    || ptl->getProfileIdc() == Profile::SCALABLEREXT
+#endif
+    )
   {
     const UInt         bitDepthConstraint=ptl->getBitDepthConstraint();
Index: branches/SHM-dev/source/Lib/TLibEncoder/TEncSearch.cpp
===================================================================
--- branches/SHM-dev/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 1486)
+++ branches/SHM-dev/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 1487)
@@ -5960,5 +5960,9 @@
                                            TComMv& rcMvHalf,
                                            TComMv& rcMvQter,
-                                           UInt& ruiCost     )                                           
+#if SCALABLE_REXT
+                                           Distortion& ruiCost     )
+#else
+                                           UInt& ruiCost     )
+#endif
 {
   assert(pcMvInt->getHor() == 0 && pcMvInt->getVer() == 0);
@@ -5995,7 +5999,13 @@
   UInt          uiLastMode = 0;
 
+#if SCALABLE_REXT
+  Distortion    uiCost[2]   = { MAX_UINT, MAX_UINT };     //uni, rdCost
+  Distortion    uiCostTemp;
+  Distortion    biPDistTemp = MAX_INT;
+#else
   UInt          uiCost[2]   = { MAX_UINT, MAX_UINT };     //uni, rdCost
   UInt          uiCostTemp;
   UInt          biPDistTemp = MAX_INT;
+#endif
   UInt          uiBitsTemp;
 
Index: branches/SHM-dev/source/Lib/TLibEncoder/TEncSearch.h
===================================================================
--- branches/SHM-dev/source/Lib/TLibEncoder/TEncSearch.h	(revision 1486)
+++ branches/SHM-dev/source/Lib/TLibEncoder/TEncSearch.h	(revision 1487)
@@ -480,5 +480,9 @@
                                    TComMv&       rcMvHalf,
                                    TComMv&       rcMvQter,
+#if SCALABLE_REXT
+                                   Distortion&   ruiCost     );
+#else
                                    UInt&         ruiCost     );
+#endif
 #endif //SVC_EXTENSION  
 
