Index: trunk/source/Lib/TLibEncoder/SEIwrite.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/SEIwrite.cpp	(revision 2)
+++ trunk/source/Lib/TLibEncoder/SEIwrite.cpp	(revision 5)
@@ -1,2 +1,35 @@
+/* The copyright in this software is being made available under the BSD
+ * License, included below. This software may be subject to other third party
+ * and contributor rights, including patent rights, and no such rights are
+ * granted under this license.
+ *
+ * Copyright (c) 2010-2011, ISO/IEC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  * Neither the name of the ISO/IEC nor the names of its contributors may
+ *    be used to endorse or promote products derived from this software without
+ *    specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 
 
Index: trunk/source/Lib/TLibEncoder/SEIwrite.h
===================================================================
--- trunk/source/Lib/TLibEncoder/SEIwrite.h	(revision 2)
+++ trunk/source/Lib/TLibEncoder/SEIwrite.h	(revision 5)
@@ -1,2 +1,35 @@
+/* The copyright in this software is being made available under the BSD
+ * License, included below. This software may be subject to other third party
+ * and contributor rights, including patent rights, and no such rights are
+ * granted under this license.
+ *
+ * Copyright (c) 2010-2011, ISO/IEC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  * Neither the name of the ISO/IEC nor the names of its contributors may
+ *    be used to endorse or promote products derived from this software without
+ *    specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 
 
Index: trunk/source/Lib/TLibEncoder/TEncAdaptiveLoopFilter.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncAdaptiveLoopFilter.cpp	(revision 2)
+++ trunk/source/Lib/TLibEncoder/TEncAdaptiveLoopFilter.cpp	(revision 5)
@@ -1,2 +1,35 @@
+/* The copyright in this software is being made available under the BSD
+ * License, included below. This software may be subject to other third party
+ * and contributor rights, including patent rights, and no such rights are
+ * granted under this license.
+ *
+ * Copyright (c) 2010-2011, ISO/IEC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  * Neither the name of the ISO/IEC nor the names of its contributors may
+ *    be used to endorse or promote products derived from this software without
+ *    specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 
 
Index: trunk/source/Lib/TLibEncoder/TEncAdaptiveLoopFilter.h
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncAdaptiveLoopFilter.h	(revision 2)
+++ trunk/source/Lib/TLibEncoder/TEncAdaptiveLoopFilter.h	(revision 5)
@@ -1,2 +1,35 @@
+/* The copyright in this software is being made available under the BSD
+ * License, included below. This software may be subject to other third party
+ * and contributor rights, including patent rights, and no such rights are
+ * granted under this license.
+ *
+ * Copyright (c) 2010-2011, ISO/IEC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  * Neither the name of the ISO/IEC nor the names of its contributors may
+ *    be used to endorse or promote products derived from this software without
+ *    specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 
 
Index: trunk/source/Lib/TLibEncoder/TEncAnalyze.h
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncAnalyze.h	(revision 2)
+++ trunk/source/Lib/TLibEncoder/TEncAnalyze.h	(revision 5)
@@ -1,2 +1,35 @@
+/* The copyright in this software is being made available under the BSD
+ * License, included below. This software may be subject to other third party
+ * and contributor rights, including patent rights, and no such rights are
+ * granted under this license.
+ *
+ * Copyright (c) 2010-2011, ISO/IEC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  * Neither the name of the ISO/IEC nor the names of its contributors may
+ *    be used to endorse or promote products derived from this software without
+ *    specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 
 
Index: trunk/source/Lib/TLibEncoder/TEncBinCoder.h
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncBinCoder.h	(revision 2)
+++ trunk/source/Lib/TLibEncoder/TEncBinCoder.h	(revision 5)
@@ -1,2 +1,35 @@
+/* The copyright in this software is being made available under the BSD
+ * License, included below. This software may be subject to other third party
+ * and contributor rights, including patent rights, and no such rights are
+ * granted under this license.
+ *
+ * Copyright (c) 2010-2011, ISO/IEC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  * Neither the name of the ISO/IEC nor the names of its contributors may
+ *    be used to endorse or promote products derived from this software without
+ *    specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 
 
Index: trunk/source/Lib/TLibEncoder/TEncBinCoderCABAC.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncBinCoderCABAC.cpp	(revision 2)
+++ trunk/source/Lib/TLibEncoder/TEncBinCoderCABAC.cpp	(revision 5)
@@ -1,2 +1,35 @@
+/* The copyright in this software is being made available under the BSD
+ * License, included below. This software may be subject to other third party
+ * and contributor rights, including patent rights, and no such rights are
+ * granted under this license.
+ *
+ * Copyright (c) 2010-2011, ISO/IEC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  * Neither the name of the ISO/IEC nor the names of its contributors may
+ *    be used to endorse or promote products derived from this software without
+ *    specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 
 
Index: trunk/source/Lib/TLibEncoder/TEncBinCoderCABAC.h
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncBinCoderCABAC.h	(revision 2)
+++ trunk/source/Lib/TLibEncoder/TEncBinCoderCABAC.h	(revision 5)
@@ -1,2 +1,35 @@
+/* The copyright in this software is being made available under the BSD
+ * License, included below. This software may be subject to other third party
+ * and contributor rights, including patent rights, and no such rights are
+ * granted under this license.
+ *
+ * Copyright (c) 2010-2011, ISO/IEC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  * Neither the name of the ISO/IEC nor the names of its contributors may
+ *    be used to endorse or promote products derived from this software without
+ *    specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 
 
Index: trunk/source/Lib/TLibEncoder/TEncCavlc.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 2)
+++ trunk/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 5)
@@ -1,2 +1,35 @@
+/* The copyright in this software is being made available under the BSD
+ * License, included below. This software may be subject to other third party
+ * and contributor rights, including patent rights, and no such rights are
+ * granted under this license.
+ *
+ * Copyright (c) 2010-2011, ISO/IEC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  * Neither the name of the ISO/IEC nor the names of its contributors may
+ *    be used to endorse or promote products derived from this software without
+ *    specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 
 
@@ -258,5 +291,5 @@
   xWriteFlag  ( (pcSPS->getUseALF ()) ? 1 : 0 );
   xWriteFlag  ( (pcSPS->getUseDQP ()) ? 1 : 0 );
-#if !SB_NO_LowDelayCoding
+#if !HHI_NO_LowDelayCoding
   xWriteFlag  ( (pcSPS->getUseLDC ()) ? 1 : 0 );
 #endif
@@ -302,8 +335,10 @@
       xWriteUvlc( pcSPS->getViewId() );
       xWriteSvlc( pcSPS->getViewOrderIdx() );
-#if HHI_DMM_INTRA
-      xWriteFlag( pcSPS->getUseDepthModelModes() ? 1 : 0 );
-#endif
+#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
+      xWriteFlag( pcSPS->getUseDMM() ? 1 : 0 );
+#endif
+#if HHI_MPI
       xWriteFlag( pcSPS->getUseMVI() ? 1 : 0 );
+#endif
     }
     else
@@ -324,4 +359,5 @@
         }
       }
+#if DEPTH_MAP_GENERATION
       xWriteUvlc( pcSPS->getPredDepthMapGeneration() );
       if( pcSPS->getPredDepthMapGeneration() )
@@ -333,7 +369,12 @@
           xWriteSvlc( pcSPS->getPdmOffset       ()[ uiId ] );
         }
+#if HHI_INTER_VIEW_MOTION_PRED
         xWriteUvlc  ( pcSPS->getMultiviewMvPredMode() );
+#endif
+#if HHI_INTER_VIEW_RESIDUAL_PRED
         xWriteFlag  ( pcSPS->getMultiviewResPredMode() );
-      }
+#endif
+      }
+#endif
     }
   }
@@ -686,4 +727,5 @@
 
 
+#if HHI_INTER_VIEW_MOTION_PRED || HHI_MPI
 Void 
 TEncCavlc::codeMergeIndexMV( TComDataCU* pcCU, UInt uiAbsPartIdx )
@@ -691,7 +733,7 @@
   UInt uiNumCand  = 0;
   UInt uiMergeIdx = pcCU->getMergeIndex( uiAbsPartIdx );
-#if MW_MVI_SIGNALLING_MODE == 1
+#if HHI_MPI
   const Bool bMVIAvailable = pcCU->getSlice()->getSPS()->getUseMVI() && pcCU->getSlice()->getSliceType() != I_SLICE;
-  const UInt uiMviMergePos = bMVIAvailable ? MVI_MERGE_POS : MRG_MAX_NUM_CANDS;
+  const UInt uiMviMergePos = bMVIAvailable ? HHI_MPI_MERGE_POS : MRG_MAX_NUM_CANDS;
   if( bMVIAvailable )
   {
@@ -699,6 +741,6 @@
     const Bool bUseMVI = pcCU->getTextureModeDepth( uiAbsPartIdx ) != -1;
     if( bUseMVI )
-      uiMergeIdx = MVI_MERGE_POS;
-    else if( uiMergeIdx >= MVI_MERGE_POS )
+      uiMergeIdx = HHI_MPI_MERGE_POS;
+    else if( uiMergeIdx >= HHI_MPI_MERGE_POS )
       uiMergeIdx++;
   }
@@ -754,5 +796,5 @@
   }
 }
-
+#endif
 
 
@@ -764,7 +806,10 @@
 Void TEncCavlc::codeMergeIndex    ( TComDataCU* pcCU, UInt uiAbsPartIdx )
 {
-#if MW_MVI_SIGNALLING_MODE == 1
+#if HHI_INTER_VIEW_MOTION_PRED || HHI_MPI
+#if HHI_INTER_VIEW_MOTION_PRED && HHI_MPI
   if( ( pcCU->getSlice()->getSPS()->getViewId() > 0 && ( pcCU->getSlice()->getSPS()->getMultiviewMvPredMode() & PDM_USE_FOR_MERGE ) == PDM_USE_FOR_MERGE ) ||
       ( pcCU->getSlice()->getSPS()->getUseMVI() && pcCU->getSlice()->getSliceType() != I_SLICE && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N ) )
+#elif HHI_MPI
+  if( pcCU->getSlice()->getSPS()->getUseMVI() && pcCU->getSlice()->getSliceType() != I_SLICE && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N )
 #else
   if( pcCU->getSlice()->getSPS()->getViewId() > 0 && ( pcCU->getSlice()->getSPS()->getMultiviewMvPredMode() & PDM_USE_FOR_MERGE ) == PDM_USE_FOR_MERGE )
@@ -774,4 +819,5 @@
     return;
   }
+#endif
 
   Bool bLeftInvolved = false;
@@ -833,4 +879,5 @@
 
 
+#if HHI_INTER_VIEW_RESIDUAL_PRED
 Void 
 TEncCavlc::codeResPredFlag( TComDataCU* pcCU, UInt uiAbsPartIdx )
@@ -839,5 +886,5 @@
   xWriteFlag( uiSymbol );
 }
-
+#endif
 
 Void TEncCavlc::codeAlfCtrlFlag( TComDataCU* pcCU, UInt uiAbsPartIdx )
@@ -940,15 +987,4 @@
 #endif
 }
-
-#if MW_MVI_SIGNALLING_MODE == 0
-Void TEncCavlc::codeMvInheritanceFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
-{
-  const Int iTextureModeDepth = pcCU->getTextureModeDepth( uiAbsPartIdx );
-  if( iTextureModeDepth != -1 && uiDepth > iTextureModeDepth )
-    return;
-  UInt uiSymbol = iTextureModeDepth == uiDepth ? 1 : 0;
-  xWriteFlag( uiSymbol );
-}
-#endif
 
 Void TEncCavlc::codeSplitFlag   ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
Index: trunk/source/Lib/TLibEncoder/TEncCavlc.h
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncCavlc.h	(revision 2)
+++ trunk/source/Lib/TLibEncoder/TEncCavlc.h	(revision 5)
@@ -1,2 +1,35 @@
+/* The copyright in this software is being made available under the BSD
+ * License, included below. This software may be subject to other third party
+ * and contributor rights, including patent rights, and no such rights are
+ * granted under this license.
+ *
+ * Copyright (c) 2010-2011, ISO/IEC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  * Neither the name of the ISO/IEC nor the names of its contributors may
+ *    be used to endorse or promote products derived from this software without
+ *    specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 
 
@@ -193,11 +226,12 @@
 #endif
   Void codeSkipFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx );
-#if MW_MVI_SIGNALLING_MODE == 0
-  Void codeMvInheritanceFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
-#endif
   Void codeMergeFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx );
   Void codeMergeIndex    ( TComDataCU* pcCU, UInt uiAbsPartIdx );
+#if HHI_INTER_VIEW_MOTION_PRED || HHI_MPI
   Void codeMergeIndexMV  ( TComDataCU* pcCU, UInt uiAbsPartIdx );
+#endif
+#if HHI_INTER_VIEW_RESIDUAL_PRED
   Void codeResPredFlag   ( TComDataCU* pcCU, UInt uiAbsPartIdx );
+#endif
   Void codeAlfCtrlFlag   ( TComDataCU* pcCU, UInt uiAbsPartIdx );
 #if TSB_ALF_HEADER
Index: trunk/source/Lib/TLibEncoder/TEncCfg.h
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncCfg.h	(revision 2)
+++ trunk/source/Lib/TLibEncoder/TEncCfg.h	(revision 5)
@@ -1,2 +1,35 @@
+/* The copyright in this software is being made available under the BSD
+ * License, included below. This software may be subject to other third party
+ * and contributor rights, including patent rights, and no such rights are
+ * granted under this license.
+ *
+ * Copyright (c) 2010-2011, ISO/IEC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  * Neither the name of the ISO/IEC nor the names of its contributors may
+ *    be used to endorse or promote products derived from this software without
+ *    specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 
 /** \file     TEncCfg.h
@@ -41,5 +74,4 @@
   Int       m_iRateGOPSize;
 
-  // SB
   std::string     m_cInputFormatString ;
 
@@ -75,13 +107,13 @@
   Int       m_iMaxDeltaQP;                      //  Max. absolute delta QP (1:default)
 
-//GT VSO
+#if HHI_VSO
   //====== View Synthesis Optimization ======
   Bool      m_bForceLambdaScale;
-#if RDO_DIST_INT
+#if HHI_VSO_DIST_INT
   Bool      m_bAllowNegDist;
 #endif
   Double    m_dLambdaScaleVSO;
   UInt      m_uiVSOMode;
-//GT VSO end
+#endif
 
   //====== Tool list ========
@@ -98,5 +130,5 @@
 #endif
   Bool      m_bUseRDOQ;
-#if !SB_NO_LowDelayCoding
+#if !HHI_NO_LowDelayCoding
   Bool      m_bUseLDC;
 #endif
@@ -104,9 +136,7 @@
   Bool      m_bUseFastEnc;
 
-//GT VSO
+#if HHI_VSO
   Bool      m_bUseVSO;
-//GT VSO end
-
-  Bool      m_bOmitUnusedBlocks;
+#endif  
   Bool      m_bUseMRG; // SOPH:
 #if LM_CHROMA
@@ -126,8 +156,10 @@
   Bool      m_bUseConstrainedIntraPred;
 #endif
-#if HHI_DMM_INTRA
-  Bool m_bUseDepthModelModes;
-#endif
+#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
+  Bool m_bUseDMM;
+#endif
+#if HHI_MPI
   Bool m_bUseMVI;
+#endif
 
   //====== Slice ========
@@ -160,19 +192,25 @@
   Int**       m_aaiCodedOffset;
 
+#if DEPTH_MAP_GENERATION
   UInt        m_uiPredDepthMapGeneration;
-  UInt        m_uiMultiviewMvPredMode;
   UInt        m_uiPdmPrecision;
   Int**       m_aaiPdmScaleNomDelta;
   Int**       m_aaiPdmOffset;
+#endif
+#if HHI_INTER_VIEW_MOTION_PRED
+  UInt        m_uiMultiviewMvPredMode;
   UInt        m_uiMultiviewMvRegMode;
   Double      m_dMultiviewMvRegLambdaScale;
+#endif
+#if HHI_INTER_VIEW_RESIDUAL_PRED
   UInt        m_uiMultiviewResPredMode;
+#endif
 
   PicOrderCnt m_iQpChangeFrame;
   Int         m_iQpChangeOffsetVideo;
   Int         m_iQpChangeOffsetDepth;
-#if SB_INTERVIEW_SKIP
+#if HHI_INTERVIEW_SKIP
   UInt        m_uiInterViewSkip;
-#if SB_INTERVIEW_SKIP_LAMBDA_SCALE
+#if HHI_INTERVIEW_SKIP_LAMBDA_SCALE
   Double      m_dInterViewSkipLambdaScale;
 #endif
@@ -205,17 +243,23 @@
   Void      setCodedOffset                  ( Int** p )      { m_aaiCodedOffset         = p; }
 
+#if DEPTH_MAP_GENERATION
   Void      setPredDepthMapGeneration       ( UInt  u )      { m_uiPredDepthMapGeneration   = u; }
-  Void      setMultiviewMvPredMode          ( UInt  u )      { m_uiMultiviewMvPredMode      = u; }
   Void      setPdmPrecision                 ( UInt  u )      { m_uiPdmPrecision             = u; }
   Void      setPdmScaleNomDelta             ( Int** p )      { m_aaiPdmScaleNomDelta        = p; }
   Void      setPdmOffset                    ( Int** p )      { m_aaiPdmOffset               = p; }
+#endif
+#if HHI_INTER_VIEW_MOTION_PRED
+  Void      setMultiviewMvPredMode          ( UInt  u )      { m_uiMultiviewMvPredMode      = u; }
   Void      setMultiviewMvRegMode           ( UInt  u )      { m_uiMultiviewMvRegMode       = u; }
   Void      setMultiviewMvRegLambdaScale    ( Double d)      { m_dMultiviewMvRegLambdaScale = d; }
+#endif
+#if HHI_INTER_VIEW_RESIDUAL_PRED
   Void      setMultiviewResPredMode         ( UInt  u )      { m_uiMultiviewResPredMode     = u; }
-
-#if SB_INTERVIEW_SKIP
+#endif
+
+#if HHI_INTERVIEW_SKIP
   Void      setInterViewSkip            ( UInt  u )       { m_uiInterViewSkip         = u; }
-  Bool      getInterViewSkip            ( )       { return bool(m_uiInterViewSkip) ;}
-#if SB_INTERVIEW_SKIP_LAMBDA_SCALE
+  Bool      getInterViewSkip            ( )       { return (m_uiInterViewSkip?true:false) ;}
+#if HHI_INTERVIEW_SKIP_LAMBDA_SCALE
   Void      setInterViewSkipLambdaScale ( UInt  u )       { m_dInterViewSkipLambdaScale = u; }
   Double      getInterViewSkipLambdaScale ()                { return m_dInterViewSkipLambdaScale; }
@@ -254,13 +298,13 @@
   Void      setMaxDeltaQP                   ( Int   i )      { m_iMaxDeltaQP = i; }
 
-//GT VSO
+#if HHI_VSO
  //==== VSO  ==========
   Void      setVSOMode                      ( UInt  ui )    { m_uiVSOMode   = ui; }
   Void      setForceLambdaScaleVSO          ( Bool  b )     { m_bForceLambdaScale = b; };
   Void      setLambdaScaleVSO               ( Double d )    { m_dLambdaScaleVSO   = d; };
-#if RDO_DIST_INT
+#if HHI_VSO_DIST_INT
   Void      setAllowNegDist                 ( Bool b  )     { m_bAllowNegDist     = b; };
 #endif
-//GT VSO end
+#endif
 
   //====== Sequence ========
@@ -306,17 +350,18 @@
   Int       getMaxDeltaQP                   ()      { return  m_iMaxDeltaQP; }
 
+#if HHI_INTER_VIEW_MOTION_PRED
   UInt      getMultiviewMvRegMode           ()      { return  m_uiMultiviewMvRegMode; }
   Double    getMultiviewMvRegLambdaScale    ()      { return  m_dMultiviewMvRegLambdaScale; }
-
-//GT VSO
+#endif
+
+#if HHI_VSO
   //==== VSO  ==========
   UInt      getVSOMode                      ()      { return m_uiVSOMode; }
   Bool      getForceLambdaScaleVSO          ()      { return m_bForceLambdaScale; }
   Double    getLambdaScaleVSO               ()      { return m_dLambdaScaleVSO;   }
-#if RDO_DIST_INT
+#if HHI_VSO_DIST_INT
   Bool      getAllowNegDist                 ()      { return m_bAllowNegDist;     }
 #endif
-
-//GT VSO end
+#endif
 
   //==== Tool list ========
@@ -330,12 +375,12 @@
 #endif
   Void      setUseRDOQ                      ( Bool  b )     { m_bUseRDOQ    = b; }
-#if !SB_NO_LowDelayCoding
+#if !HHI_NO_LowDelayCoding
   Void      setUseLDC                       ( Bool  b )     { m_bUseLDC     = b; }
 #endif
   Void      setUsePAD                       ( Bool  b )     { m_bUsePAD     = b; }
   Void      setUseFastEnc                   ( Bool  b )     { m_bUseFastEnc = b; }
-  //GT VSO
+#if HHI_VSO
   Void      setUseVSO                       ( Bool  b )     { m_bUseVSO     = b; }
-  //GT VSO end
+#endif
   Void      setUseMRG                       ( Bool  b )     { m_bUseMRG     = b; } // SOPH:
 #if CONSTRAINED_INTRA_PRED
@@ -344,6 +389,4 @@
   Void      setdQPs                         ( Int*  p )     { m_aidQP       = p; }
   Void      setDeltaQpRD                    ( UInt  u )     {m_uiDeltaQpRD  = u; }
-
-  Void      setOmitUnusedBlocks             ( Bool b )       { m_bOmitUnusedBlocks = b; }
 
   Bool      getUseSBACRD                    ()      { return m_bUseSBACRD;  }
@@ -360,5 +403,5 @@
 #endif
   Bool      getUseRDOQ                      ()      { return m_bUseRDOQ;    }
-#if !SB_NO_LowDelayCoding
+#if !HHI_NO_LowDelayCoding
   Bool      getUseLDC                       ()      { return m_bUseLDC;     }
 #endif
@@ -366,17 +409,15 @@
   Bool      getUseFastEnc                   ()      { return m_bUseFastEnc; }
 
-//GT VSO
+#if HHI_VSO
   Bool      getUseVSO                       ()      { return m_bUseVSO;     }
-//GT VSO end
+#endif
   Bool      getUseMRG                       ()      { return m_bUseMRG;     } // SOPH:
 #if CONSTRAINED_INTRA_PRED
   Bool      getUseConstrainedIntraPred      ()      { return m_bUseConstrainedIntraPred; }
 #endif
-#if HHI_DMM_INTRA
-  Void setUseDepthModelModes( Bool b) { m_bUseDepthModelModes = b;    }
-  Bool getUseDepthModelModes()        { return m_bUseDepthModelModes; }
-#endif
-
-  Bool getOmitUnusedBlocks             ()      { return m_bOmitUnusedBlocks; }
+#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
+  Void setUseDMM( Bool b) { m_bUseDMM = b;    }
+  Bool getUseDMM()        { return m_bUseDMM; }
+#endif
 
 #if LM_CHROMA
@@ -413,5 +454,7 @@
   Bool      getUseSAO                  ()              {return m_bUseSAO;}
 #endif
+#if HHI_MPI
   Void      setUseMVI                  (Bool bVal)     {m_bUseMVI = bVal;}
+#endif
 
   void setPictureDigestEnabled(bool b) { m_pictureDigestEnabled = b; }
Index: trunk/source/Lib/TLibEncoder/TEncCu.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncCu.cpp	(revision 2)
+++ trunk/source/Lib/TLibEncoder/TEncCu.cpp	(revision 5)
@@ -1,2 +1,34 @@
+/* The copyright in this software is being made available under the BSD
+ * License, included below. This software may be subject to other third party
+ * and contributor rights, including patent rights, and no such rights are
+ * granted under this license.
+ *
+ * Copyright (c) 2010-2011, ISO/IEC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  * Neither the name of the ISO/IEC nor the names of its contributors may
+ *    be used to endorse or promote products derived from this software without
+ *    specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
 
 
@@ -36,5 +68,5 @@
   m_ppcResPredTmp  = new TComYuv*[m_uhTotalDepth-1];
 
-#if MW_MVI_SIGNALLING_MODE == 1
+#if HHI_MPI
   m_puhDepthSaved  = new UChar[1ll<<( ( m_uhTotalDepth - 1 )<<1 )];
   m_puhWidthSaved  = new UChar[1ll<<( ( m_uhTotalDepth - 1 )<<1 )];
@@ -77,5 +109,5 @@
   Int i;
 
-#if MW_MVI_SIGNALLING_MODE == 1
+#if HHI_MPI
   delete[] m_puhDepthSaved;  m_puhDepthSaved  = NULL;
   delete[] m_puhWidthSaved;  m_puhWidthSaved  = NULL;
@@ -245,5 +277,5 @@
 
 
-//GT VSO
+#if HHI_VSO
       if ( m_pcRdCost->getUseLambdaScaleVSO() )
       {
@@ -251,8 +283,9 @@
       }
       else
+#endif
       {
         m_ppcBestCU[0]->getTotalCost()  = m_pcRdCost->calcRdCost( m_ppcBestCU[0]->getTotalBits(), m_ppcBestCU[0]->getTotalDistortion() );
       }
-//GT VSO end
+
       fBestCost = m_ppcBestCU[0]->getTotalCost();
 
@@ -276,5 +309,5 @@
         m_ppcBestCU[0]->getTotalBits() += m_pcEntropyCoder->getNumberOfWrittenBits(); // dQP bits
 
-        //GT VSO
+#if HHI_VSO
         if (m_pcRdCost->getUseLambdaScaleVSO())
         {
@@ -282,8 +315,8 @@
         }
         else
+#endif
         {
           m_ppcBestCU[0]->getTotalCost()  = m_pcRdCost->calcRdCost( m_ppcBestCU[0]->getTotalBits(), m_ppcBestCU[0]->getTotalDistortion() );
         }
-        //GT VSO end
 
         if ( fBestCost > m_ppcBestCU[0]->getTotalCost() )
@@ -309,5 +342,5 @@
       m_ppcBestCU[0]->getTotalBits() += m_pcEntropyCoder->getNumberOfWrittenBits(); // dQP bits
 
-      //GT VSO
+#if HHI_VSO
       if (m_pcRdCost->getUseLambdaScaleVSO())
       {
@@ -315,8 +348,8 @@
       }
       else
+#endif
       {
         m_ppcBestCU[0]->getTotalCost()  = m_pcRdCost->calcRdCost( m_ppcBestCU[0]->getTotalBits(), m_ppcBestCU[0]->getTotalDistortion() );
       }
-     //GT VSO end
     }
   }
@@ -415,5 +448,5 @@
   UInt uiBPelY   = uiTPelY + rpcBestCU->getHeight(0) - 1;
 
-#if ( SB_INTERVIEW_SKIP)
+#if ( HHI_INTERVIEW_SKIP)
   Bool bFullyRenderedSec = true ;
   if( m_pcEncCfg->getInterViewSkip() )
@@ -445,5 +478,5 @@
     bFullyRenderedSec = false ;
   }
-#if SB_INTERVIEW_SKIP_LAMBDA_SCALE
+#if HHI_INTERVIEW_SKIP_LAMBDA_SCALE
   if( bFullyRenderedSec )
   {
@@ -463,4 +496,5 @@
     if( rpcBestCU->getSlice()->getSliceType() != I_SLICE )
     {
+#if HHI_INTER_VIEW_RESIDUAL_PRED
       // check availability of residual prediction
       Bool  bResPredAvailable   = false;
@@ -476,4 +510,5 @@
       {
         Bool bResPredFlag  = ( uiResPrdId > 0 );
+#endif
 
       // SKIP
@@ -483,9 +518,13 @@
       {
 #if !HHI_MRG_SKIP
+#if HHI_INTER_VIEW_RESIDUAL_PRED
         rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
+#endif
         xCheckRDCostAMVPSkip ( rpcBestCU, rpcTempCU );        rpcTempCU->initEstData();
 #endif
+#if HHI_INTER_VIEW_RESIDUAL_PRED
         rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
-#if SB_INTERVIEW_SKIP
+#endif
+#if HHI_INTERVIEW_SKIP
         xCheckRDCostMerge2Nx2N( rpcBestCU, rpcTempCU, bFullyRenderedSec );            rpcTempCU->initEstData();
 #else
@@ -495,5 +534,7 @@
       else
       {
+#if HHI_INTER_VIEW_RESIDUAL_PRED
         rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
+#endif
         xCheckRDCostAMVPSkip ( rpcBestCU, rpcTempCU );        rpcTempCU->initEstData();
       }
@@ -514,6 +555,8 @@
       {
 #if HHI_DISABLE_INTER_NxN_SPLIT
+#if HHI_INTER_VIEW_RESIDUAL_PRED
         rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
-#if SB_INTERVIEW_SKIP
+#endif
+#if HHI_INTERVIEW_SKIP
         xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N, bFullyRenderedSec );  rpcTempCU->initEstData();
 #else
@@ -522,6 +565,8 @@
         if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth )
         {
+#if HHI_INTER_VIEW_RESIDUAL_PRED
           rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
-#if SB_INTERVIEW_SKIP
+#endif
+#if HHI_INTERVIEW_SKIP
           xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N, bFullyRenderedSec );  rpcTempCU->initEstData();
 #else
@@ -530,12 +575,16 @@
         }
 #else
+#if HHI_INTER_VIEW_RESIDUAL_PRED
         rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
-#if SB_INTERVIEW_SKIP
+#endif
+#if HHI_INTERVIEW_SKIP
         xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N, bFullyRenderedSec );  rpcTempCU->initEstData();
 #else
         xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N );  rpcTempCU->initEstData();
 #endif
+#if HHI_INTER_VIEW_RESIDUAL_PRED
         rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
-#if SB_INTERVIEW_SKIP
+#endif
+#if HHI_INTERVIEW_SKIP
         xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_NxN, bFullyRenderedSec   );  rpcTempCU->initEstData();
 #else
@@ -549,12 +598,16 @@
 #endif
       { // 2NxN, Nx2N
+#if HHI_INTER_VIEW_RESIDUAL_PRED
         rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
-#if SB_INTERVIEW_SKIP
+#endif
+#if HHI_INTERVIEW_SKIP
         xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_Nx2N, bFullyRenderedSec  );  rpcTempCU->initEstData();
 #else
         xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_Nx2N  );  rpcTempCU->initEstData();
 #endif
+#if HHI_INTER_VIEW_RESIDUAL_PRED
         rpcTempCU->setResPredIndicator( bResPredAvailable, bResPredFlag );
-#if SB_INTERVIEW_SKIP
+#endif
+#if HHI_INTERVIEW_SKIP
         xCheckRDCostInter      ( rpcBestCU, rpcTempCU, SIZE_2NxN, bFullyRenderedSec  );  rpcTempCU->initEstData();
 #else
@@ -563,5 +616,7 @@
       }
 
+#if HHI_INTER_VIEW_RESIDUAL_PRED
     } // uiResPrdId
+#endif
     }
 
@@ -570,5 +625,5 @@
     {
       // speedup for inter frames
-#if SB_INTERVIEW_SKIP
+#if HHI_INTERVIEW_SKIP
       if( ( rpcBestCU->getSlice()->getSliceType() == I_SLICE ||
                rpcBestCU->getCbf( 0, TEXT_LUMA     ) != 0   ||
@@ -596,12 +651,8 @@
 
     m_pcEntropyCoder->resetBits();
-#if MW_MVI_SIGNALLING_MODE == 0
-    if( rpcBestCU->getSlice()->getSPS()->getUseMVI() && rpcBestCU->getSlice()->getSliceType() != I_SLICE )
-      m_pcEntropyCoder->encodeMvInheritanceFlag( rpcBestCU, 0, uiDepth, true );
-#endif
     m_pcEntropyCoder->encodeSplitFlag( rpcBestCU, 0, uiDepth, true );
     rpcBestCU->getTotalBits() += m_pcEntropyCoder->getNumberOfWrittenBits(); // split bits
 
-    //GT VSO
+#if HHI_VSO
     if (m_pcRdCost->getUseLambdaScaleVSO())
     {
@@ -609,6 +660,7 @@
     }
     else
-    {
-#if SB_INTERVIEW_SKIP
+#endif
+    {
+#if HHI_INTERVIEW_SKIP
   if(  m_pcEncCfg->getInterViewSkip())
       {
@@ -631,5 +683,5 @@
       rpcBestCU->getTotalCost()  = m_pcRdCost->calcRdCost( rpcBestCU->getTotalBits(), rpcBestCU->getTotalDistortion() );
     }
-    //GT VSO end
+    
 
     // accumulate statistics for early skip
@@ -643,10 +695,5 @@
       }
     }
-#if MW_MVI_SIGNALLING_MODE == 0
-    if( rpcBestCU->getSlice()->getSPS()->getUseMVI() && rpcBestCU->getSlice()->getSliceType() != I_SLICE )
-    {
-      xCheckRDCostMvInheritance( rpcBestCU, rpcTempCU, uiDepth, false );  rpcTempCU->initEstData();
-    }
-#elif MW_MVI_SIGNALLING_MODE == 1
+#if HHI_MPI
     if( rpcBestCU->getSlice()->getSPS()->getUseMVI() && rpcBestCU->getSlice()->getSliceType() != I_SLICE )
     {
@@ -666,4 +713,5 @@
   if( bTrySplit && uiDepth < g_uiMaxCUDepth - g_uiAddCUDepth )
   {
+#if HHI_VSO
     // reset Model
     if( m_pcRdCost->getUseRenModel() )
@@ -675,4 +723,5 @@
       m_pcRdCost->setRenModelData( m_ppcBestCU[uiDepth], 0, piSrc, uiSrcStride, uiWidth, uiHeight );
     }
+#endif
 
     UChar       uhNextDepth         = uiDepth+1;
@@ -701,4 +750,5 @@
         xCompressCU( pcSubBestPartCU, pcSubTempPartCU, uhNextDepth );
 
+#if HHI_VSO
         if( m_pcRdCost->getUseRenModel() )
         {
@@ -709,4 +759,5 @@
           m_pcRdCost->setRenModelData( pcSubBestPartCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );
         }
+#endif
         rpcTempCU->copyPartFrom( pcSubBestPartCU, uiPartUnitIdx, uhNextDepth );         // Keep best part data to current temporary data.
         xCopyYuv2Tmp( pcSubBestPartCU->getTotalNumPart()*uiPartUnitIdx, uhNextDepth );
@@ -718,13 +769,9 @@
       m_pcEntropyCoder->resetBits();
       m_pcEntropyCoder->encodeSplitFlag( rpcTempCU, 0, uiDepth, true );
-#if MW_MVI_SIGNALLING_MODE == 0
-      if( rpcBestCU->getSlice()->getSPS()->getUseMVI() && rpcBestCU->getSlice()->getSliceType() != I_SLICE )
-        m_pcEntropyCoder->encodeMvInheritanceFlag( rpcTempCU, 0, uiDepth, true );
-#endif
 
       rpcTempCU->getTotalBits() += m_pcEntropyCoder->getNumberOfWrittenBits(); // split bits
     }
 
-#if SB_INTERVIEW_SKIP_LAMBDA_SCALE
+#if HHI_INTERVIEW_SKIP_LAMBDA_SCALE
     if( bFullyRenderedSec )
     {
@@ -736,5 +783,5 @@
     }
 #endif
-//GT VSO
+#if HHI_VSO
     if ( m_pcRdCost->getUseLambdaScaleVSO())
     {
@@ -742,8 +789,8 @@
     }
     else
+#endif
     {
       rpcTempCU->getTotalCost()  = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );
     }
-//GT VSO end
 
     if( m_bUseSBACRD )
@@ -753,4 +800,5 @@
     xCheckBestMode( rpcBestCU, rpcTempCU, uiDepth );                                          // RD compare current larger prediction
 
+#if HHI_VSO
     if( m_pcRdCost->getUseRenModel() )
     {
@@ -761,4 +809,5 @@
       m_pcRdCost->setRenModelData( rpcBestCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );
     }
+#endif
   }                                                                                  // with sub partitioned prediction.
 
@@ -793,13 +842,9 @@
   UInt uiBPelY   = uiTPelY + (g_uiMaxCUHeight>>uiDepth) - 1;
 
-#if MW_MVI_SIGNALLING_MODE == 0
-  if( pcCU->getSlice()->getSPS()->getUseMVI() && pcCU->getSlice()->getSliceType() != I_SLICE )
-  {
-    m_pcEntropyCoder->encodeMvInheritanceFlag( pcCU, uiAbsPartIdx, uiDepth );
-  }
-#endif
   if( ( uiRPelX < pcCU->getSlice()->getSPS()->getWidth() ) && ( uiBPelY < pcCU->getSlice()->getSPS()->getHeight() ) )
   {
+#if HHI_MPI
     if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == -1 || uiDepth < pcCU->getTextureModeDepth( uiAbsPartIdx ) )
+#endif
       m_pcEntropyCoder->encodeSplitFlag( pcCU, uiAbsPartIdx, uiDepth );
   }
@@ -809,5 +854,5 @@
   }
 
-#if MW_MVI_SIGNALLING_MODE == 1
+#if HHI_MPI
   if( uiDepth == pcCU->getTextureModeDepth( uiAbsPartIdx ) )
   {
@@ -870,5 +915,9 @@
 #endif
 
+#if HHI_MPI
   if( !pcCU->getSlice()->isIntra() && pcCU->getTextureModeDepth( uiAbsPartIdx ) == -1 )
+#else
+  if( !pcCU->getSlice()->isIntra() )
+#endif
   {
     m_pcEntropyCoder->encodeSkipFlag( pcCU, uiAbsPartIdx );
@@ -889,9 +938,13 @@
     }
 #endif
+#if HHI_INTER_VIEW_RESIDUAL_PRED
     m_pcEntropyCoder->encodeResPredFlag( pcCU, uiAbsPartIdx, 0 );
+#endif
     return;
   }
+#if HHI_MPI
   if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == -1 )
   {
+#endif
     m_pcEntropyCoder->encodePredMode( pcCU, uiAbsPartIdx );
 
@@ -901,9 +954,13 @@
     m_pcEntropyCoder->encodePredInfo( pcCU, uiAbsPartIdx );
 
+#if HHI_INTER_VIEW_RESIDUAL_PRED
     if( !pcCU->isIntra( uiAbsPartIdx ) )
     {
       m_pcEntropyCoder->encodeResPredFlag( pcCU, uiAbsPartIdx, 0 );
     }
-  }
+#endif
+#if HHI_MPI
+  }
+#endif
 
   // Encode Coefficients
@@ -915,4 +972,5 @@
   UChar uhDepth = rpcTempCU->getDepth( 0 );
 
+#if HHI_VSO
   if( m_pcRdCost->getUseRenModel() )
   {
@@ -923,4 +981,5 @@
     m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );
   }
+#endif
 
   rpcTempCU->setPredModeSubParts( MODE_SKIP,   0, uhDepth );
@@ -950,5 +1009,5 @@
  * \returns Void
  */
-#if SB_INTERVIEW_SKIP
+#if HHI_INTERVIEW_SKIP
 Void TEncCu::xCheckRDCostMerge2Nx2N( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, Bool bSkipRes )
 #else
@@ -961,6 +1020,8 @@
   UInt uiNeighbourCandIdx[MRG_MAX_NUM_CANDS]; //MVs with same idx => same cand
 
+#if HHI_INTER_VIEW_RESIDUAL_PRED
   Bool  bResPrdAvail  = rpcTempCU->getResPredAvail( 0 );
   Bool  bResPrdFlag   = rpcTempCU->getResPredFlag ( 0 );
+#endif
 
   for( UInt ui = 0; ui < MRG_MAX_NUM_CANDS; ++ui )
@@ -971,4 +1032,5 @@
   UChar uhDepth = rpcTempCU->getDepth( 0 );
 
+#if HHI_VSO
   if( m_pcRdCost->getUseRenModel() )
   {
@@ -979,4 +1041,5 @@
     m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );
   }
+#endif
 
   rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); // interprets depth relative to LCU level
@@ -990,5 +1053,5 @@
 #if HHI_MRG_SKIP
       TComYuv* pcPredYuvTemp = NULL;
-#if SB_INTERVIEW_SKIP
+#if HHI_INTERVIEW_SKIP
       for( UInt uiNoResidual = (bSkipRes ? 1:0); uiNoResidual < 2; ++uiNoResidual )
 #else
@@ -1015,10 +1078,12 @@
       rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand].getMv(), cMvFieldNeighbours[1 + 2*uiMergeCand].getRefIdx(), SIZE_2Nx2N, 0, 0, 0 ); // interprets depth relative to rpcTempCU level
 
+#if HHI_INTER_VIEW_RESIDUAL_PRED
       rpcTempCU->setResPredAvailSubParts( bResPrdAvail, 0, 0, uhDepth );
       rpcTempCU->setResPredFlagSubParts ( bResPrdFlag,  0, 0, uhDepth );
+#endif
 
 #if HHI_MRG_SKIP
       // do MC
-#if SB_INTERVIEW_SKIP
+#if HHI_INTERVIEW_SKIP
       if ( (uiNoResidual == 0) || bSkipRes ){
 #else
@@ -1036,5 +1101,5 @@
         }
       }
-
+#if HHI_VSO
       if( m_pcRdCost->getUseRenModel() )
       { //Reset
@@ -1045,4 +1110,5 @@
         m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );
       }
+#endif
 
       // estimate residual and encode everything
@@ -1082,5 +1148,5 @@
 }
 
-#if SB_INTERVIEW_SKIP
+#if HHI_INTERVIEW_SKIP
 Void TEncCu::xCheckRDCostInter( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize, Bool bSkipRes)
 #else
@@ -1090,4 +1156,5 @@
   UChar uhDepth = rpcTempCU->getDepth( 0 );
 
+#if HHI_VSO
   if( m_pcRdCost->getUseRenModel() )
   {
@@ -1098,28 +1165,37 @@
     m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );
   }
+#endif
 
   rpcTempCU->setDepthSubParts( uhDepth, 0 );
 
+#if HHI_INTER_VIEW_RESIDUAL_PRED
   Bool  bResPrdAvail  = rpcTempCU->getResPredAvail( 0 );
   Bool  bResPrdFlag   = rpcTempCU->getResPredFlag ( 0 );
+#endif
   rpcTempCU->setPartSizeSubParts    ( SIZE_2Nx2N,   0,    uhDepth );
+#if HHI_INTER_VIEW_RESIDUAL_PRED
   rpcTempCU->setResPredAvailSubParts( bResPrdAvail, 0, 0, uhDepth );
   rpcTempCU->setResPredFlagSubParts ( bResPrdFlag,  0, 0, uhDepth );
+#endif
   rpcTempCU->setPartSizeSubParts    ( ePartSize,    0,    uhDepth );
   rpcTempCU->setPredModeSubParts    ( MODE_INTER,   0,    uhDepth );
 
+#if HHI_INTER_VIEW_RESIDUAL_PRED
   if( rpcTempCU->getResPredFlag( 0 ) )
   { // subtract residual prediction from original in motion search
     m_ppcOrigYuv[uhDepth]->add( m_ppcResPredTmp [uhDepth], rpcTempCU->getWidth( 0 ), rpcTempCU->getHeight( 0 ), true );
   }
-  #if SB_INTERVIEW_SKIP
+#endif
+#if HHI_INTERVIEW_SKIP
   m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth], bSkipRes );
 #else
   m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth] );
 #endif
+#if HHI_INTER_VIEW_RESIDUAL_PRED
   if( rpcTempCU->getResPredFlag( 0 ) )
   { // add residual prediction to original again
     m_ppcOrigYuv[uhDepth]->add( m_ppcResPredTmp [uhDepth], rpcTempCU->getWidth( 0 ), rpcTempCU->getHeight( 0 ) );
   }
+#endif
 
 #if PART_MRG
@@ -1129,10 +1205,11 @@
   }
 #endif
-#if SB_INTERVIEW_SKIP
+#if HHI_INTERVIEW_SKIP
   m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcResiYuvBest[uhDepth], m_ppcRecoYuvTemp[uhDepth], m_ppcResPredTmp [uhDepth],bSkipRes );
 #else
   m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcResiYuvBest[uhDepth], m_ppcRecoYuvTemp[uhDepth], m_ppcResPredTmp [uhDepth], false );
 #endif
-//GT VSO
+
+#if HHI_VSO
   if( m_pcRdCost->getUseLambdaScaleVSO() )
   {
@@ -1140,8 +1217,8 @@
   }
   else
+#endif
   {
     rpcTempCU->getTotalCost()  = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );
   }
-//GT VSO end
 
   xCheckBestMode( rpcBestCU, rpcTempCU, uhDepth );
@@ -1152,5 +1229,5 @@
   UInt uiDepth = rpcTempCU->getDepth( 0 );
 
-  // reset Model
+#if HHI_VSO
   if( m_pcRdCost->getUseRenModel() )
   {
@@ -1161,4 +1238,5 @@
     m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );
   }
+#endif
 
   rpcTempCU->setPartSizeSubParts( eSize, 0, uiDepth );
@@ -1191,5 +1269,5 @@
 
   rpcTempCU->getTotalBits() = m_pcEntropyCoder->getNumberOfWrittenBits();
-//GT VSO
+#if HHI_VSO
   if( m_pcRdCost->getUseLambdaScaleVSO())
   {
@@ -1197,8 +1275,8 @@
   }
   else
+#endif
   {
     rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );
   }
-//GT VSO end
 
   xCheckBestMode( rpcBestCU, rpcTempCU, uiDepth );
@@ -1239,6 +1317,8 @@
   UChar uhDepth = rpcTempCU->getDepth(0);
 
+#if HHI_INTER_VIEW_RESIDUAL_PRED
   Bool  bResPrdAvail  = rpcTempCU->getResPredAvail( 0 );
   Bool  bResPrdFlag   = rpcTempCU->getResPredFlag ( 0 );
+#endif
 
   AMVPInfo cAMVPInfo0;
@@ -1278,6 +1358,8 @@
       rpcTempCU->setPredModeSubParts( MODE_SKIP, 0, uhDepth );
       rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N,  0, uhDepth );
+#if HHI_INTER_VIEW_RESIDUAL_PRED
       rpcTempCU->setResPredAvailSubParts( bResPrdAvail, 0, 0, uhDepth );
       rpcTempCU->setResPredFlagSubParts ( bResPrdFlag,  0, 0, uhDepth );
+#endif
 
       if (rpcTempCU->getSlice()->isInterB())
@@ -1317,11 +1399,6 @@
 }
 
-#if MW_MVI_SIGNALLING_MODE == 0
-Void TEncCu::xCheckRDCostMvInheritance( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, UChar uhTextureModeDepth, Bool bRecursiveCall )
-#elif MW_MVI_SIGNALLING_MODE == 1
+#if HHI_MPI
 Void TEncCu::xCheckRDCostMvInheritance( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, UChar uhTextureModeDepth, Bool bSkipResidual, Bool bRecursiveCall )
-#else
-#error
-#endif
 {
   assert( rpcTempCU->getSlice()->getSPS()->isDepth() );
@@ -1342,4 +1419,5 @@
   }
 
+#if HHI_VSO
   if( m_pcRdCost->getUseRenModel() && !bRecursiveCall)
   {
@@ -1350,4 +1428,5 @@
     m_pcRdCost->setRenModelData( m_ppcTempCU[uhDepth], 0, piSrc, uiSrcStride, uiWidth, uiHeight );
   }
+#endif
 
   Bool bSplit = uhDepth < pcTextureCU->getDepth( rpcTempCU->getZorderIdxInCU() );
@@ -1377,9 +1456,5 @@
         }
 
-#if MW_MVI_SIGNALLING_MODE == 0
-        xCheckRDCostMvInheritance( pcSubBestPartCU, pcSubTempPartCU, uhTextureModeDepth, true );
-#elif MW_MVI_SIGNALLING_MODE == 1
         xCheckRDCostMvInheritance( pcSubBestPartCU, pcSubTempPartCU, uhTextureModeDepth, bSkipResidual, true );
-#endif
 
         rpcTempCU->copyPartFrom( pcSubBestPartCU, uiPartUnitIdx, uhNextDepth );         // Keep best part data to current temporary data.
@@ -1408,21 +1483,10 @@
       assert( rpcTempCU->getPredictionMode( ui ) != MODE_NONE );
     }
-#if MW_MVI_SIGNALLING_MODE == 0
-    if( rpcTempCU->getPredictionMode( 0 ) == MODE_SKIP )
-    {
-      rpcTempCU->setPredModeSubParts( MODE_INTER, 0, uhDepth );
-    }
-#elif MW_MVI_SIGNALLING_MODE == 1
     rpcTempCU->setPredModeSubParts( bSkipResidual ? MODE_SKIP : MODE_INTER, 0, uhDepth );
-#endif
     m_pcPredSearch->motionCompensation( rpcTempCU, m_ppcPredYuvTemp[uhDepth] );
 
     // get Original YUV data from picture
     m_ppcOrigYuv[uhDepth]->copyFromPicYuv( rpcBestCU->getPic()->getPicYuvOrg(), rpcBestCU->getAddr(), rpcBestCU->getZorderIdxInCU() );
-#if MW_MVI_SIGNALLING_MODE == 0
-    m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcResiYuvBest[uhDepth], m_ppcRecoYuvTemp[uhDepth], m_ppcResPredTmp [uhDepth], false );
-#elif MW_MVI_SIGNALLING_MODE == 1
     m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcResiYuvBest[uhDepth], m_ppcRecoYuvTemp[uhDepth], m_ppcResPredTmp [uhDepth], bSkipResidual );
-#endif
 
     if( uhDepth == uhTextureModeDepth )
@@ -1431,5 +1495,6 @@
     }
   }
-  //GT VSO
+
+#if HHI_VSO
   if( m_pcRdCost->getUseLambdaScaleVSO() )
   {
@@ -1437,11 +1502,12 @@
   }
   else
+#endif
   {
     rpcTempCU->getTotalCost()  = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );
   }
-  //GT VSO end
 
   xCheckBestMode( rpcBestCU, rpcTempCU, uhDepth );
 
+#if HHI_VSO
   if( !bSplit && bRecursiveCall && m_pcRdCost->getUseRenModel() )
   {
@@ -1452,4 +1518,5 @@
     m_pcRdCost->setRenModelData( rpcBestCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );
   }
+#endif
 }
 
@@ -1458,7 +1525,4 @@
   const UChar uhDepth = pcCU->getTextureModeDepth( 0 );
   m_pcEntropyCoder->resetBits();
-#if MW_MVI_SIGNALLING_MODE == 0
-  m_pcEntropyCoder->encodeMvInheritanceFlag( pcCU, 0, uhDepth, true );
-#elif MW_MVI_SIGNALLING_MODE == 1
   xSaveDepthWidthHeight( pcCU );
   pcCU->setSizeSubParts( g_uiMaxCUWidth>>uhDepth, g_uiMaxCUHeight>>uhDepth, 0, uhDepth );
@@ -1527,10 +1591,8 @@
   }
   xRestoreDepthWidthHeight( pcCU );
-#endif
 
   pcCU->getTotalBits() += m_pcEntropyCoder->getNumberOfWrittenBits();
 }
 
-#if MW_MVI_SIGNALLING_MODE == 1
 Void TEncCu::xSaveDepthWidthHeight( TComDataCU* pcCU )
 {
Index: trunk/source/Lib/TLibEncoder/TEncCu.h
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncCu.h	(revision 2)
+++ trunk/source/Lib/TLibEncoder/TEncCu.h	(revision 5)
@@ -1,2 +1,35 @@
+/* The copyright in this software is being made available under the BSD
+ * License, included below. This software may be subject to other third party
+ * and contributor rights, including patent rights, and no such rights are
+ * granted under this license.
+ *
+ * Copyright (c) 2010-2011, ISO/IEC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  * Neither the name of the ISO/IEC nor the names of its contributors may
+ *    be used to endorse or promote products derived from this software without
+ *    specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 
 
@@ -68,5 +101,5 @@
   Bool                    m_bUseSBACRD;
   
-#if MW_MVI_SIGNALLING_MODE == 1
+#if HHI_MPI
   UChar *m_puhDepthSaved;
   UChar *m_puhWidthSaved;
@@ -99,5 +132,5 @@
   Void  xCheckRDCostAMVPSkip( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU                      );
   
-#if SB_INTERVIEW_SKIP
+#if HHI_INTERVIEW_SKIP
   Void xCheckRDCostMerge2Nx2N( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, Bool bFullyRendered ) ;
 #else
@@ -106,5 +139,5 @@
   
   Void  xCheckRDCostSkip    ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, Bool bBSkipRes      );
-#if SB_INTERVIEW_SKIP
+#if HHI_INTERVIEW_SKIP
   Void xCheckRDCostInter( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize, Bool bFullyRendered ) ;
 #else
@@ -118,7 +151,5 @@
   Void  xCopyYuv2Tmp        ( UInt uhPartUnitIdx, UInt uiDepth );
   Void  xAddMVISignallingBits( TComDataCU* pcCU );
-#if MW_MVI_SIGNALLING_MODE == 0
-  Void  xCheckRDCostMvInheritance( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, UChar uhTextureModeDepth, Bool bRecursiveCall );
-#elif MW_MVI_SIGNALLING_MODE == 1
+#if HHI_MPI
   Void  xCheckRDCostMvInheritance( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, UChar uhTextureModeDepth, Bool bSkipResidual, Bool bRecursiveCall );
   Void  xSaveDepthWidthHeight( TComDataCU* pcCU );
Index: trunk/source/Lib/TLibEncoder/TEncEntropy.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncEntropy.cpp	(revision 2)
+++ trunk/source/Lib/TLibEncoder/TEncEntropy.cpp	(revision 5)
@@ -1,2 +1,35 @@
+/* The copyright in this software is being made available under the BSD
+ * License, included below. This software may be subject to other third party
+ * and contributor rights, including patent rights, and no such rights are
+ * granted under this license.
+ *
+ * Copyright (c) 2010-2011, ISO/IEC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  * Neither the name of the ISO/IEC nor the names of its contributors may
+ *    be used to endorse or promote products derived from this software without
+ *    specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 
 
@@ -408,5 +441,5 @@
     }
   }
-#if MW_MVI_SIGNALLING_MODE == 1
+#if HHI_MPI
   if( pcCU->getSlice()->getSPS()->getUseMVI() && pcCU->getSlice()->getSliceType() != I_SLICE && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N )
     uiNumCand++;
@@ -419,4 +452,5 @@
 
 
+#if HHI_INTER_VIEW_RESIDUAL_PRED
 Void 
 TEncEntropy::encodeResPredFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiPUIdx, Bool bRD )
@@ -437,4 +471,5 @@
   m_pcEntropyCoderIf->codeResPredFlag( pcCU, uiAbsPartIdx );
 }
+#endif
 
 
@@ -517,13 +552,4 @@
   m_pcEntropyCoderIf->codeSplitFlag( pcCU, uiAbsPartIdx, uiDepth );
 }
-
-#if MW_MVI_SIGNALLING_MODE == 0
-Void TEncEntropy::encodeMvInheritanceFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, Bool bRD )
-{
-  if( bRD )
-    uiAbsPartIdx = 0;
-  m_pcEntropyCoderIf->codeMvInheritanceFlag( pcCU, uiAbsPartIdx, uiDepth );
-}
-#endif
 
 /** encode partition size
@@ -1568,5 +1594,5 @@
     {
 #if  HHI_MRG_SKIP
-#if MW_MVI_SIGNALLING_MODE == 1
+#if HHI_MPI
       if( !(pcCU->getMergeFlag( uiAbsPartIdx ) && pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N &&
             ( pcCU->getTextureModeDepth( uiAbsPartIdx ) == -1 || uiDepth == pcCU->getTextureModeDepth( uiAbsPartIdx ) ) ) )
Index: trunk/source/Lib/TLibEncoder/TEncEntropy.h
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncEntropy.h	(revision 2)
+++ trunk/source/Lib/TLibEncoder/TEncEntropy.h	(revision 5)
@@ -1,2 +1,35 @@
+/* The copyright in this software is being made available under the BSD
+ * License, included below. This software may be subject to other third party
+ * and contributor rights, including patent rights, and no such rights are
+ * granted under this license.
+ *
+ * Copyright (c) 2010-2011, ISO/IEC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  * Neither the name of the ISO/IEC nor the names of its contributors may
+ *    be used to endorse or promote products derived from this software without
+ *    specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 
 
@@ -57,10 +90,9 @@
   
   virtual Void codeSkipFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
-#if MW_MVI_SIGNALLING_MODE == 0
-  virtual Void codeMvInheritanceFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
-#endif
   virtual Void codeMergeFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
   virtual Void codeMergeIndex    ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
+#if HHI_INTER_VIEW_RESIDUAL_PRED
   virtual Void codeResPredFlag   ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
+#endif
   virtual Void codeSplitFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
   
@@ -138,7 +170,4 @@
   Void encodeSplitFlag         ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, Bool bRD = false );
   Void encodeSkipFlag          ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
-#if MW_MVI_SIGNALLING_MODE == 0
-  Void encodeMvInheritanceFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, Bool bRD = false );
-#endif
   Void encodePUWise       ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
   Void encodeInterDirPU   ( TComDataCU* pcSubCU, UInt uiAbsPartIdx  );
@@ -152,5 +181,7 @@
   Void encodeMergeIndex   ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiPUIdx );
 #endif
+#if HHI_INTER_VIEW_RESIDUAL_PRED
   Void encodeResPredFlag  ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiPUIdx, Bool bRD = false );
+#endif
   Void encodeAlfCtrlFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
 #if TSB_ALF_HEADER
Index: trunk/source/Lib/TLibEncoder/TEncFormattedStringParser.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncFormattedStringParser.cpp	(revision 2)
+++ trunk/source/Lib/TLibEncoder/TEncFormattedStringParser.cpp	(revision 5)
@@ -1,2 +1,35 @@
+/* The copyright in this software is being made available under the BSD
+ * License, included below. This software may be subject to other third party
+ * and contributor rights, including patent rights, and no such rights are
+ * granted under this license.
+ *
+ * Copyright (c) 2010-2011, ISO/IEC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  * Neither the name of the ISO/IEC nor the names of its contributors may
+ *    be used to endorse or promote products derived from this software without
+ *    specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 
 #include "TEncFormattedStringParser.h"
Index: trunk/source/Lib/TLibEncoder/TEncFormattedStringParser.h
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncFormattedStringParser.h	(revision 2)
+++ trunk/source/Lib/TLibEncoder/TEncFormattedStringParser.h	(revision 5)
@@ -1,2 +1,35 @@
+/* The copyright in this software is being made available under the BSD
+ * License, included below. This software may be subject to other third party
+ * and contributor rights, including patent rights, and no such rights are
+ * granted under this license.
+ *
+ * Copyright (c) 2010-2011, ISO/IEC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  * Neither the name of the ISO/IEC nor the names of its contributors may
+ *    be used to endorse or promote products derived from this software without
+ *    specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 #if !defined(AFX_TEncFormattedStringParser_H__268768B8_4D1D_484A_904E_586985833BAC__INCLUDED_)
 #define AFX_TEncFormattedStringParser_H__268768B8_4D1D_484A_904E_586985833BAC__INCLUDED_
Index: trunk/source/Lib/TLibEncoder/TEncGOP.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 2)
+++ trunk/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 5)
@@ -1,2 +1,35 @@
+/* The copyright in this software is being made available under the BSD
+ * License, included below. This software may be subject to other third party
+ * and contributor rights, including patent rights, and no such rights are
+ * granted under this license.
+ *
+ * Copyright (c) 2010-2011, ISO/IEC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  * Neither the name of the ISO/IEC nor the names of its contributors may
+ *    be used to endorse or promote products derived from this software without
+ *    specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 
 
@@ -13,5 +46,4 @@
 #include <time.h>
 
-// SB
 #include "../../App/TAppEncoder/TAppEncTop.h"
 
@@ -25,12 +57,16 @@
   m_pcSliceEncoder      = NULL;
   m_pcListPic           = NULL;
-  
+
   m_pcEntropyCoder      = NULL;
   m_pcCavlcCoder        = NULL;
   m_pcSbacCoder         = NULL;
   m_pcBinCABAC          = NULL;
+#if DEPTH_MAP_GENERATION
   m_pcDepthMapGenerator = NULL;
+#endif
+#if HHI_INTER_VIEW_RESIDUAL_PRED
   m_pcResidualGenerator = NULL;
-  
+#endif
+
 #if DCM_DECODING_REFRESH
   m_bRefreshPending     = 0;
@@ -69,5 +105,5 @@
   m_pcSliceEncoder       = pcTEncTop->getSliceEncoder();
   m_pcListPic            = pcTEncTop->getListPic();
-  
+
   m_pcEntropyCoder       = pcTEncTop->getEntropyCoder();
   m_pcCavlcCoder         = pcTEncTop->getCavlcCoder();
@@ -76,7 +112,11 @@
   m_pcLoopFilter         = pcTEncTop->getLoopFilter();
   m_pcBitCounter         = pcTEncTop->getBitCounter();
+#if DEPTH_MAP_GENERATION
   m_pcDepthMapGenerator  = pcTEncTop->getDepthMapGenerator();
+#endif
+#if HHI_INTER_VIEW_RESIDUAL_PRED
   m_pcResidualGenerator  = pcTEncTop->getResidualGenerator();
-  
+#endif
+
   // Adaptive Loop filter
   m_pcAdaptiveLoopFilter = pcTEncTop->getAdaptiveLoopFilter();
@@ -97,5 +137,5 @@
 {
   TComSlice*      pcSlice;
-  
+
       //-- For time output for each slice
       long iBeforeTime = clock();
@@ -104,5 +144,5 @@
       pcBitstreamOut->resetBits();
       pcBitstreamOut->rewindStreamPacket();
-      
+
       //  Slice data initialization
       pcPic->clearSliceBuffer();
@@ -112,5 +152,5 @@
       m_pcSliceEncoder->initEncSlice ( pcPic, pcSlice );
       pcSlice->setSliceIdx(0);
-      
+
       //  Set SPS
       pcSlice->setSPS( m_pcEncTop->getSPS() );
@@ -120,5 +160,5 @@
   // set mutliview parameters
       pcSlice->initMultiviewSlice( pcPic->getCodedScale(), pcPic->getCodedOffset() );
-      
+
 #if DCM_DECODING_REFRESH
       // Set the nal unit type
@@ -129,5 +169,5 @@
 
       //pcSlice->setNalUnitType(getNalUnitType(uiPOCCurr));
-      // Do decoding refresh marking if any 
+      // Do decoding refresh marking if any
       pcSlice->decodingRefreshMarking(m_uiPOCCDR, m_bRefreshPending, rcListPic);
 #endif
@@ -140,21 +180,23 @@
 
   pcSlice->setRefPicListFromGOPSTring( rcListPic, apcSpatRefPics );
+
+#if HHI_VSO
   m_pcEncTop->getEncTop()->setMVDPic(pcPic->getViewIdx(), pcSlice->getPOC(), pcPic->getMVDReferenceInfo() );
 
-//GT VSO
-  Bool bUseVSO = m_pcEncTop->getUseVSO(); 
+
+  Bool bUseVSO = m_pcEncTop->getUseVSO();
   m_pcRdCost->setUseVSO( bUseVSO );
 
   if ( bUseVSO )
-  { 
+  {
     Int iVSOMode = m_pcEncTop->getVSOMode();
-    m_pcRdCost->setVSOMode( iVSOMode  );    
-#if RDO_DIST_INT
-    m_pcRdCost->setAllowNegDist( m_pcEncTop->getAllowNegDist() ); 
+    m_pcRdCost->setVSOMode( iVSOMode  );
+#if HHI_VSO_DIST_INT
+    m_pcRdCost->setAllowNegDist( m_pcEncTop->getAllowNegDist() );
 #endif
 
     if ( iVSOMode == 4 )
     {
-      m_pcEncTop->getEncTop()->setupRenModel( pcSlice->getPOC(), pcPic->getViewIdx(), m_pcEncTop->isDepthCoder() ? 1 : 0 ); 
+      m_pcEncTop->getEncTop()->setupRenModel( pcSlice->getPOC(), pcPic->getViewIdx(), m_pcEncTop->isDepthCoder() ? 1 : 0 );
     }
     else
@@ -163,11 +205,13 @@
   }
   }
-//GT VSO end
-
-  if ( m_pcEncTop->getOmitUnusedBlocks() )
-  {
-    m_pcEncTop->getEncTop()->getUsedPelsMap( pcPic->getViewIdx(), pcPic->getPOC(), pcPic->getUsedPelsMap() ); 
-  }
-      
+#endif
+
+#if HHI_INTERVIEW_SKIP
+  if ( m_pcEncTop->getInterViewSkip() )
+  {
+    m_pcEncTop->getEncTop()->getUsedPelsMap( pcPic->getViewIdx(), pcPic->getPOC(), pcPic->getUsedPelsMap() );
+  }
+#endif
+
       pcSlice->setNoBackPredFlag( false );
 #if DCM_COMB_LIST
@@ -183,5 +227,5 @@
           for ( i=0; i < pcSlice->getNumRefIdx(RefPicList( 1 ) ); i++ )
           {
-            if ( pcSlice->getRefPOC(RefPicList(1), i) != pcSlice->getRefPOC(RefPicList(0), i) ) 
+            if ( pcSlice->getRefPOC(RefPicList(1), i) != pcSlice->getRefPOC(RefPicList(0), i) )
             {
               pcSlice->setNoBackPredFlag( false );
@@ -199,5 +243,5 @@
       pcSlice->generateCombinedList();
 #endif
-      
+
       /////////////////////////////////////////////////////////////////////////////////////////////////// Compress a slice
       //  Slice compression
@@ -237,9 +281,15 @@
       m_uiStoredStartCUAddrForEncodingEntropySlice[uiStartCUAddrEntropySliceIdx++]  = uiNextCUAddr;
 
+#if DEPTH_MAP_GENERATION
       // init view component and predict virtual depth map
       m_pcDepthMapGenerator->initViewComponent( pcPic );
       m_pcDepthMapGenerator->predictDepthMap  ( pcPic );
+#if HHI_INTER_VIEW_MOTION_PRED
       m_pcDepthMapGenerator->covertOrgDepthMap( pcPic );
+#endif
+#if HHI_INTER_VIEW_RESIDUAL_PRED
       m_pcResidualGenerator->initViewComponent( pcPic );
+#endif
+#endif
 
       while(uiNextCUAddr<pcPic->getPicSym()->getNumberOfCUsInFrame()) // determine slice boundaries
@@ -262,8 +312,8 @@
             m_uiStoredStartCUAddrForEncodingEntropySlice[uiStartCUAddrEntropySliceIdx++]  = uiStartCUAddrSlice;
           }
-          
+
           if (uiStartCUAddrSlice < pcPic->getPicSym()->getNumberOfCUsInFrame())
           {
-            pcPic->allocateNewSlice();          
+            pcPic->allocateNewSlice();
             pcPic->setCurrSliceIdx                  ( uiStartCUAddrSliceIdx-1 );
             m_pcSliceEncoder->setSliceIdx           ( uiStartCUAddrSliceIdx-1 );
@@ -286,5 +336,5 @@
           uiStartCUAddrSlice                                                            = pcSlice->getSliceCurEndCUAddr();
           uiStartCUAddrEntropySlice                                                     = pcSlice->getEntropySliceCurEndCUAddr();
-        }        
+        }
 
         uiNextCUAddr = (uiStartCUAddrSlice > uiStartCUAddrEntropySlice) ? uiStartCUAddrSlice : uiStartCUAddrEntropySlice;
@@ -292,5 +342,5 @@
       m_uiStoredStartCUAddrForEncodingSlice[uiStartCUAddrSliceIdx++]                = pcSlice->getSliceCurEndCUAddr();
       m_uiStoredStartCUAddrForEncodingEntropySlice[uiStartCUAddrEntropySliceIdx++]  = pcSlice->getSliceCurEndCUAddr();
-      
+
       pcSlice = pcPic->getSlice(0);
 #if MTK_SAO  // PRE_DF
@@ -298,9 +348,12 @@
 #endif
 
+#if HHI_INTER_VIEW_RESIDUAL_PRED
       // set residual picture
       m_pcResidualGenerator->setRecResidualPic( pcPic );
-
+#endif
+#if DEPTH_MAP_GENERATION
       // update virtual depth map
       m_pcDepthMapGenerator->updateDepthMap( pcPic );
+#endif
 
       //-- Loop filter
@@ -329,6 +382,6 @@
             for(UInt i=0; i< uiNumSlices ; i++)
             {
-              (*m_pcAdaptiveLoopFilter)[i].create(pcPic, i, 
-                                                  m_uiStoredStartCUAddrForEncodingSlice[i], 
+              (*m_pcAdaptiveLoopFilter)[i].create(pcPic, i,
+                                                  m_uiStoredStartCUAddrForEncodingSlice[i],
                                                   m_uiStoredStartCUAddrForEncodingSlice[i+1]-1
                                                   );
@@ -359,5 +412,5 @@
         // generate start code
         bs_SPS_PPS_SEI.write( 1, 32);
-        
+
         m_pcEntropyCoder->encodePPS( pcSlice->getPPS() );
         bs_SPS_PPS_SEI.write( 1, 1 );
@@ -367,15 +420,15 @@
         rbSeqFirst = false;
       }
-      
+
       /* use the main bitstream buffer for storing the marshalled picture */
       m_pcEntropyCoder->setBitstream(pcBitstreamOut);
 
       uiStartCUAddrSliceIdx = 0;
-      uiStartCUAddrSlice    = 0; 
+      uiStartCUAddrSlice    = 0;
       pcBitstreamOut->allocateMemoryForSliceLocations( pcPic->getPicSym()->getNumberOfCUsInFrame() ); // Assuming number of slices <= number of LCU. Needs to be changed for sub-LCU slice coding.
       pcBitstreamOut->setSliceCount( 0 );                                      // intialize number of slices to zero, used while converting RBSP to NALU
 
       uiStartCUAddrEntropySliceIdx = 0;
-      uiStartCUAddrEntropySlice    = 0; 
+      uiStartCUAddrEntropySlice    = 0;
       uiNextCUAddr                 = 0;
       pcSlice = pcPic->getSlice(uiStartCUAddrSliceIdx);
@@ -401,5 +454,5 @@
           uiStartCUAddrSliceIdx++;
           uiStartCUAddrEntropySliceIdx++;
-        } 
+        }
         else if (uiNextCUAddr == m_uiStoredStartCUAddrForEncodingEntropySlice[uiStartCUAddrEntropySliceIdx])
         {
@@ -422,12 +475,6 @@
 
       // write SliceHeader
-#if SB_DEBUG
-      g_bEncoding = true ;
-#endif
       m_pcEntropyCoder->encodeSliceHeader ( pcSlice                 );
-#if SB_DEBUG
-      g_bEncoding = false ;
-#endif
-      
+
       // is it needed?
       if ( pcSlice->getSymbolMode() )
@@ -437,5 +484,5 @@
         m_pcEntropyCoder->resetEntropy    ();
       }
-      
+
         if (uiNextCUAddr==0)  // Compute ALF params and write only for first slice header
         {
@@ -452,5 +499,5 @@
 #endif
             m_pcAdaptiveLoopFilter->allocALFParam(&cAlfParam);
-            
+
             // set entropy coder for RD
             if ( pcSlice->getSymbolMode() )
@@ -464,5 +511,5 @@
             m_pcEntropyCoder->resetEntropy    ();
             m_pcEntropyCoder->setBitstream    ( m_pcBitCounter );
-            
+
             m_pcAdaptiveLoopFilter->startALFEnc(pcPic, m_pcEntropyCoder );
 #if MTK_SAO  // PostDF
@@ -478,5 +525,5 @@
 #endif
             UInt uiMaxAlfCtrlDepth;
-            
+
             UInt64 uiDist, uiBits;
 #if MTK_SAO
@@ -489,10 +536,7 @@
 #endif
             m_pcAdaptiveLoopFilter->endALFEnc();
-            
+
             // set entropy coder for writing
             m_pcSbacCoder->init( (TEncBinIf*)m_pcBinCABAC );
-#if SB_DEBUG
-            g_bEncoding = true;
-#endif           
             if ( pcSlice->getSymbolMode() )
             {
@@ -527,5 +571,5 @@
 #endif
             m_pcEntropyCoder->encodeAlfParam(&cAlfParam);
-            
+
 #if TSB_ALF_HEADER
             if(cAlfParam.cu_control_flag)
@@ -534,25 +578,18 @@
             }
 #endif
-            g_bEncoding = false;
             m_pcAdaptiveLoopFilter->freeALFParam(&cAlfParam);
           }
         }
-        
+
         // File writing
-#if SB_DEBUG
-        g_bEncoding = true ;
-#endif
         m_pcSliceEncoder->encodeSlice( pcPic, pcBitstreamOut );
-#if SB_DEBUG
-        g_bEncoding = false ;
-#endif
-        
+
         //  End of bitstream & byte align
         pcBitstreamOut->write( 1, 1 );
         pcBitstreamOut->writeAlignZero();
-        
+
         UInt uiBoundingAddrSlice, uiBoundingAddrEntropySlice;
-        uiBoundingAddrSlice        = m_uiStoredStartCUAddrForEncodingSlice[uiStartCUAddrSliceIdx];          
-        uiBoundingAddrEntropySlice = m_uiStoredStartCUAddrForEncodingEntropySlice[uiStartCUAddrEntropySliceIdx];          
+        uiBoundingAddrSlice        = m_uiStoredStartCUAddrForEncodingSlice[uiStartCUAddrSliceIdx];
+        uiBoundingAddrEntropySlice = m_uiStoredStartCUAddrForEncodingEntropySlice[uiStartCUAddrEntropySliceIdx];
         uiNextCUAddr               = min(uiBoundingAddrSlice, uiBoundingAddrEntropySlice);
         if (uiNextCUAddr < pcPic->getPicSym()->getNumberOfCUsInFrame())   // if more slices to be encoded insert start code
@@ -564,6 +601,6 @@
         }
       } // end iteration over slices
-      
-      
+
+
 #if MTK_NONCROSS_INLOOP_FILTER
       if(pcSlice->getSPS()->getUseALF())
@@ -572,35 +609,19 @@
           m_pcAdaptiveLoopFilter->destroySlice();
       }
-#endif 
-      
-      
+#endif
+
+
       pcBitstreamOut->flushBuffer();
       pcBitstreamOut->convertRBSPToPayload(0);
-      
+
 /*#if AMVP_BUFFERCOMPRESS
       pcPic->compressMotion(); // moved to end of access unit
 #endif */
       pcBitstreamOut->freeMemoryAllocatedForSliceLocations();
-      
+
       //-- For time output for each slice
       Double dEncTime = (double)(clock()-iBeforeTime) / CLOCKS_PER_SEC;
-      
+
       xCalculateAddPSNR( pcPic, pcPic->getPicYuvRec(), pcBitstreamOut->getNumberOfWrittenBits(), dEncTime );
-
-#if GERHARD_RM_DEBUG_MM
-      if (m_pcRdCost->getUseRenModel() )
-      {      
-        TRenModel*  pcMMCheckModel = m_pcEncTop->getEncTop()->getMMCheckModel(); 
-        TRenModel*  pcRenModel     = m_pcEncTop->getEncTop()->getRenModel    (); 
-        TComPicYuv* pcPicYuvRec    = pcPic->getPicYuvRec();         
-        pcMMCheckModel->setData(0,0, pcPicYuvRec->getWidth(), pcPicYuvRec->getHeight(), pcPicYuvRec->getStride(), pcPicYuvRec->getLumaAddr()); 
-        Bool bEqual = pcRenModel->compare( pcMMCheckModel ); 
-
-        if ( !bEqual )
-        {
-          std::cout << "Mismatch in Renderer Model !" << std::endl; 
-        }      
-      }
-#endif
 
 #if FIXED_ROUNDING_FRAME_MEMORY
@@ -643,11 +664,9 @@
       pcBitstreamOut->insertAt(bs_SPS_PPS_SEI, 0);
 
-#if SB_MEM_FIX
       bs_SPS_PPS_SEI.destroy();
-#endif
       pcPic->getPicYuvRec()->copyToPic(pcPicYuvRecOut);
-      
+
       pcPic->setReconMark   ( true );
-      
+
 }
 
@@ -656,12 +675,12 @@
   TComSlice* pcSlice = pcPic->getSlice(pcPic->getCurrSliceIdx());
   Bool bCalcDist = false;
-  
+
   m_pcLoopFilter->setCfg(pcSlice->getLoopFilterDisable(), m_pcCfg->getLoopFilterAlphaC0Offget(), m_pcCfg->getLoopFilterBetaOffget());
   m_pcLoopFilter->loopFilterPic( pcPic );
-  
+
   m_pcEntropyCoder->setEntropyCoder ( m_pcEncTop->getRDGoOnSbacCoder(), pcSlice );
   m_pcEntropyCoder->resetEntropy    ();
   m_pcEntropyCoder->setBitstream    ( m_pcBitCounter );
-  
+
   // Adaptive Loop filter
   if( pcSlice->getSPS()->getUseALF() )
@@ -672,7 +691,7 @@
 #endif
     m_pcAdaptiveLoopFilter->allocALFParam(&cAlfParam);
-    
+
     m_pcAdaptiveLoopFilter->startALFEnc(pcPic, m_pcEntropyCoder);
-    
+
     UInt uiMaxAlfCtrlDepth;
     m_pcAdaptiveLoopFilter->ALFProcess(&cAlfParam, pcSlice->getLambda(), ruiDist, ruiBits, uiMaxAlfCtrlDepth );
@@ -680,8 +699,8 @@
     m_pcAdaptiveLoopFilter->freeALFParam(&cAlfParam);
   }
-  
+
   m_pcEntropyCoder->resetEntropy    ();
   ruiBits += m_pcEntropyCoder->getNumberOfWrittenBits();
-  
+
   if (!bCalcDist)
     ruiDist = xFindDistortionFrame(pcPic->getPicYuvOrg(), pcPic->getPicYuvRec());
@@ -704,11 +723,11 @@
 #endif
   Int   iTemp;
-  
+
   Int   iStride = pcPic0->getStride();
   Int   iWidth  = pcPic0->getWidth();
   Int   iHeight = pcPic0->getHeight();
-  
+
   UInt64  uiTotalDiff = 0;
-  
+
   for( y = 0; y < iHeight; y++ )
   {
@@ -724,12 +743,12 @@
     pSrc1 += iStride;
   }
-  
+
   iHeight >>= 1;
   iWidth  >>= 1;
   iStride >>= 1;
-  
+
   pSrc0  = pcPic0->getCbAddr();
   pSrc1  = pcPic1->getCbAddr();
-  
+
   for( y = 0; y < iHeight; y++ )
   {
@@ -745,8 +764,8 @@
     pSrc1 += iStride;
   }
-  
+
   pSrc0  = pcPic0->getCrAddr();
   pSrc1  = pcPic1->getCrAddr();
-  
+
   for( y = 0; y < iHeight; y++ )
   {
@@ -762,5 +781,5 @@
     pSrc1 += iStride;
   }
-  
+
   return uiTotalDiff;
 }
@@ -772,22 +791,22 @@
   UInt64 uiSSDU  = 0;
   UInt64 uiSSDV  = 0;
-  
+
   Double  dYPSNR  = 0.0;
   Double  dUPSNR  = 0.0;
   Double  dVPSNR  = 0.0;
-  
+
   //===== calculate PSNR =====
   Pel*  pOrg    = pcPic ->getPicYuvOrg()->getLumaAddr();
   Pel*  pRec    = pcPicD->getLumaAddr();
   Int   iStride = pcPicD->getStride();
-  
+
   Int   iWidth;
   Int   iHeight;
-  
+
   iWidth  = pcPicD->getWidth () - m_pcEncTop->getPad(0);
   iHeight = pcPicD->getHeight() - m_pcEncTop->getPad(1);
-  
+
   Int   iSize   = iWidth*iHeight;
-  
+
   UInt   maxval = 255 * (1<<(g_uiBitDepth + g_uiBitIncrement -8));
   Double fRefValueY = (double) maxval * maxval * iSize;
@@ -804,11 +823,11 @@
     pRec += iStride;
   }
-  
-
+
+#if HHI_VSO
   if ( m_pcRdCost->getUseRenModel() )
   {
-    TRenModel*  pcRenModel = m_pcEncTop->getEncTop()->getRenModel();        
-    Int64 iDistVSOY, iDistVSOU, iDistVSOV; 
-    pcRenModel->getTotalSSE( iDistVSOY, iDistVSOU, iDistVSOV ); 
+    TRenModel*  pcRenModel = m_pcEncTop->getEncTop()->getRenModel();
+    Int64 iDistVSOY, iDistVSOU, iDistVSOV;
+    pcRenModel->getTotalSSE( iDistVSOY, iDistVSOU, iDistVSOV );
     dYPSNR = ( iDistVSOY ? 10.0 * log10( fRefValueY / (Double) iDistVSOY ) : 99.99 );
     dUPSNR = ( iDistVSOU ? 10.0 * log10( fRefValueC / (Double) iDistVSOU ) : 99.99 );
@@ -816,5 +835,6 @@
   }
   else
-  {   
+#endif
+  {
   iHeight >>= 1;
   iWidth  >>= 1;
@@ -822,5 +842,5 @@
   pOrg  = pcPic ->getPicYuvOrg()->getCbAddr();
   pRec  = pcPicD->getCbAddr();
-  
+
   for( y = 0; y < iHeight; y++ )
   {
@@ -833,8 +853,8 @@
     pRec += iStride;
   }
-  
+
   pOrg  = pcPic ->getPicYuvOrg()->getCrAddr();
   pRec  = pcPicD->getCrAddr();
-  
+
   for( y = 0; y < iHeight; y++ )
   {
@@ -851,8 +871,7 @@
   dVPSNR            = ( uiSSDV ? 10.0 * log10( fRefValueC / (Double)uiSSDV ) : 99.99 );
   }
-  
   // fix: total bits should consider slice size bits (32bit)
   uibits += 32;
-  
+
 #if RVM_VCEGAM10
   m_vRVM_RP.push_back( uibits );
@@ -906,5 +925,5 @@
   printf( "[Y %6.4lf dB    U %6.4lf dB    V %6.4lf dB]  ", dYPSNR, dUPSNR, dVPSNR );
   printf ("[ET %5.0f ] ", dEncTime );
-  
+
   for (Int iRefList = 0; iRefList < 2; iRefList++)
   {
@@ -972,5 +991,5 @@
 {
   Double dRVM = 0;
-  
+
   //if( m_pcCfg->getGOPSize() == 1 && m_pcCfg->getIntraPeriod() != 1 && m_pcCfg->getFrameToBeEncoded() > RVM_VCEGAM10_M * 2 )
   {
@@ -980,5 +999,5 @@
     vRL.resize( N );
     vB.resize( N );
-    
+
     Int i;
     Double dRavg = 0 , dBavg = 0;
@@ -994,8 +1013,8 @@
       dBavg += vB[i];
     }
-    
+
     dRavg /= ( N - 2 * RVM_VCEGAM10_M );
     dBavg /= ( N - 2 * RVM_VCEGAM10_M );
-    
+
     double dSigamB = 0;
     for( i = RVM_VCEGAM10_M + 1 ; i < N - RVM_VCEGAM10_M + 1 ; i++ )
@@ -1005,10 +1024,10 @@
     }
     dSigamB = sqrt( dSigamB / ( N - 2 * RVM_VCEGAM10_M ) );
-    
+
     double f = sqrt( 12.0 * ( RVM_VCEGAM10_M - 1 ) / ( RVM_VCEGAM10_M + 1 ) );
-    
+
     dRVM = dSigamB / dRavg * f;
   }
-  
+
   return( dRVM );
 }
Index: trunk/source/Lib/TLibEncoder/TEncGOP.h
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncGOP.h	(revision 2)
+++ trunk/source/Lib/TLibEncoder/TEncGOP.h	(revision 5)
@@ -1,2 +1,35 @@
+/* The copyright in this software is being made available under the BSD
+ * License, included below. This software may be subject to other third party
+ * and contributor rights, including patent rights, and no such rights are
+ * granted under this license.
+ *
+ * Copyright (c) 2010-2011, ISO/IEC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  * Neither the name of the ISO/IEC nor the names of its contributors may
+ *    be used to endorse or promote products derived from this software without
+ *    specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 
 
@@ -57,6 +90,10 @@
   TEncBinCABAC*           m_pcBinCABAC;
   TComLoopFilter*         m_pcLoopFilter;
+#if DEPTH_MAP_GENERATION
   TComDepthMapGenerator*  m_pcDepthMapGenerator;
+#endif
+#if HHI_INTER_VIEW_RESIDUAL_PRED
   TComResidualGenerator*  m_pcResidualGenerator;
+#endif
   
   // Adaptive Loop filter
Index: trunk/source/Lib/TLibEncoder/TEncSbac.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncSbac.cpp	(revision 2)
+++ trunk/source/Lib/TLibEncoder/TEncSbac.cpp	(revision 5)
@@ -1,2 +1,35 @@
+/* The copyright in this software is being made available under the BSD
+ * License, included below. This software may be subject to other third party
+ * and contributor rights, including patent rights, and no such rights are
+ * granted under this license.
+ *
+ * Copyright (c) 2010-2011, ISO/IEC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  * Neither the name of the ISO/IEC nor the names of its contributors may
+ *    be used to endorse or promote products derived from this software without
+ *    specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 
 
@@ -26,7 +59,4 @@
 , m_uiMaxAlfCtrlDepth         ( 0 )
 , m_cCUSplitFlagSCModel       ( 1,             1,               NUM_SPLIT_FLAG_CTX            )
-#if MW_MVI_SIGNALLING_MODE == 0
-, m_cCUMvInheritanceFlagSCModel(1,             1,               NUM_MVI_FLAG_CTX              )
-#endif
 , m_cCUSkipFlagSCModel        ( 1,             1,               NUM_SKIP_FLAG_CTX             )
 , m_cCUMergeFlagExtSCModel    ( 1,             1,               NUM_MERGE_FLAG_EXT_CTX        )
@@ -72,5 +102,5 @@
 #endif
 , m_cViewIdxSCModel           ( 1,             1,               NUM_VIEW_IDX_CTX              )
-#if HHI_DMM_INTRA
+#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
 , m_cIntraDMMSCModel          ( 1,             1,               NUM_DMM_CTX                   )
 , m_cIntraWedgeSCModel        ( 1,             1,               NUM_WEDGE_CTX                 )
@@ -94,7 +124,4 @@
   
   m_cCUSplitFlagSCModel.initBuffer       ( eSliceType, iQp, (Short*)INIT_SPLIT_FLAG );
-#if MW_MVI_SIGNALLING_MODE == 0
-  m_cCUMvInheritanceFlagSCModel.initBuffer( eSliceType, iQp, (Short*)INIT_MVI_FLAG );
-#endif
   
   m_cCUSkipFlagSCModel.initBuffer        ( eSliceType, iQp, (Short*)INIT_SKIP_FLAG );
@@ -137,5 +164,5 @@
 #endif
   m_cViewIdxSCModel.initBuffer           ( eSliceType, iQp, (Short*)INIT_VIEW_IDX );
-#if HHI_DMM_INTRA
+#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
   m_cIntraDMMSCModel.initBuffer          ( eSliceType, iQp, (Short*)INIT_INTRA_DMM );
   m_cIntraWedgeSCModel.initBuffer        ( eSliceType, iQp, (Short*)INIT_INTRA_WEDGELET );
@@ -307,5 +334,5 @@
   return;
 }
-#if HHI_DMM_INTRA
+#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
 Void TEncSbac::xWriteExGolombLevel( UInt uiSymbol, ContextModel& rcSCModel  )
 {
@@ -388,7 +415,4 @@
   
   this->m_cCUSplitFlagSCModel      .copyFrom( &pSrc->m_cCUSplitFlagSCModel       );
-#if MW_MVI_SIGNALLING_MODE == 0
-  this->m_cCUMvInheritanceFlagSCModel.copyFrom( &pSrc->m_cCUMvInheritanceFlagSCModel );
-#endif
   this->m_cCUSkipFlagSCModel       .copyFrom( &pSrc->m_cCUSkipFlagSCModel        );
   this->m_cCUMergeFlagExtSCModel  .copyFrom( &pSrc->m_cCUMergeFlagExtSCModel);
@@ -421,5 +445,5 @@
   this->m_cMVPIdxSCModel           .copyFrom( &pSrc->m_cMVPIdxSCModel            );
   this->m_cViewIdxSCModel          .copyFrom( &pSrc->m_cViewIdxSCModel           );
-#if HHI_DMM_INTRA
+#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
   this->m_cIntraDMMSCModel         .copyFrom( &pSrc->m_cIntraDMMSCModel          );
   this->m_cIntraWedgeSCModel       .copyFrom( &pSrc->m_cIntraWedgeSCModel        );
@@ -636,4 +660,5 @@
 
 
+#if HHI_INTER_VIEW_MOTION_PRED || HHI_MPI
 Void TEncSbac::codeMergeIndexMV( TComDataCU* pcCU, UInt uiAbsPartIdx )
 {
@@ -641,11 +666,11 @@
   Bool  abAvailable[ MRG_MAX_NUM_CANDS ];
   UInt  uiNumCand = 0;
-#if MW_MVI_SIGNALLING_MODE == 1
+#if HHI_MPI
   const Bool bMVIAvailable = pcCU->getSlice()->getSPS()->getUseMVI() && pcCU->getSlice()->getSliceType() != I_SLICE;
-  const UInt uiMviMergePos = bMVIAvailable ? MVI_MERGE_POS : MRG_MAX_NUM_CANDS;
+  const UInt uiMviMergePos = bMVIAvailable ? HHI_MPI_MERGE_POS : MRG_MAX_NUM_CANDS;
 #endif
   for( UInt uiIdx = 0; uiIdx < MRG_MAX_NUM_CANDS; uiIdx++ )
   {
-#if MW_MVI_SIGNALLING_MODE == 1
+#if HHI_MPI
     if( uiIdx == uiMviMergePos )
     {
@@ -693,5 +718,5 @@
   //--- determine unary index ---
   UInt  uiMergeIdx  = pcCU->getMergeIndex( uiAbsPartIdx );
-#if MW_MVI_SIGNALLING_MODE == 1
+#if HHI_MPI
   if( bMVIAvailable )
   {
@@ -699,7 +724,7 @@
     if( bUseMVI )
     {
-      uiMergeIdx = MVI_MERGE_POS;
-    }
-    else if( uiMergeIdx >= MVI_MERGE_POS )
+      uiMergeIdx = HHI_MPI_MERGE_POS;
+    }
+    else if( uiMergeIdx >= HHI_MPI_MERGE_POS )
     {
       uiMergeIdx++;
@@ -748,5 +773,5 @@
   DTRACE_CABAC_T( "\n" );
 }
-
+#endif
 
 
@@ -758,7 +783,10 @@
 Void TEncSbac::codeMergeIndex( TComDataCU* pcCU, UInt uiAbsPartIdx )
 {
-#if MW_MVI_SIGNALLING_MODE == 1
+#if HHI_INTER_VIEW_MOTION_PRED || HHI_MPI
+#if HHI_INTER_VIEW_MOTION_PRED && HHI_MPI
   if( ( pcCU->getSlice()->getSPS()->getViewId() > 0 && ( pcCU->getSlice()->getSPS()->getMultiviewMvPredMode() & PDM_USE_FOR_MERGE ) == PDM_USE_FOR_MERGE ) ||
       ( pcCU->getSlice()->getSPS()->getUseMVI() && pcCU->getSlice()->getSliceType() != I_SLICE && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N ) )
+#elif HHI_MPI
+  if( pcCU->getSlice()->getSPS()->getUseMVI() && pcCU->getSlice()->getSliceType() != I_SLICE && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N )
 #else
   if( pcCU->getSlice()->getSPS()->getViewId() > 0 && ( pcCU->getSlice()->getSPS()->getMultiviewMvPredMode() & PDM_USE_FOR_MERGE ) == PDM_USE_FOR_MERGE )
@@ -768,4 +796,5 @@
     return;
   }
+#endif
 
   Bool bLeftInvolved = false;
@@ -884,4 +913,5 @@
 
 
+#if HHI_INTER_VIEW_RESIDUAL_PRED
 Void 
 TEncSbac::codeResPredFlag( TComDataCU* pcCU, UInt uiAbsPartIdx )
@@ -891,4 +921,5 @@
   m_pcBinIf->encodeBin( uiSymbol, m_cResPredFlagSCModel.get( 0, 0, uiCtx ) );
 }
+#endif
 
 
@@ -907,19 +938,4 @@
   return;
 }
-
-#if MW_MVI_SIGNALLING_MODE == 0
-Void TEncSbac::codeMvInheritanceFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
-{
-  const Int iTextureModeDepth = pcCU->getTextureModeDepth( uiAbsPartIdx );
-  if( iTextureModeDepth != -1 && uiDepth > iTextureModeDepth )
-    return;
-
-  UInt uiCtx    = pcCU->getCtxMvInheritanceFlag( uiAbsPartIdx, uiDepth );
-  UInt uiSymbol = iTextureModeDepth == uiDepth ? 1 : 0;
-
-  assert( uiCtx < 3 );
-  m_pcBinIf->encodeBin( uiSymbol, m_cCUMvInheritanceFlagSCModel.get( 0, 0, uiCtx ) );
-}
-#endif
 
 Void TEncSbac::codeTransformSubdivFlag( UInt uiSymbol, UInt uiCtx )
@@ -935,5 +951,5 @@
 }
 
-#if HHI_DMM_INTRA
+#if HHI_DMM_WEDGE_INTRA
 Void TEncSbac::xCodeWedgeFullInfo( TComDataCU* pcCU, UInt uiAbsPartIdx )
 {
@@ -1031,5 +1047,6 @@
   }
 }
-
+#endif
+#if HHI_DMM_PRED_TEX
 Void TEncSbac::xCodeWedgePredTexDeltaInfo( TComDataCU* pcCU, UInt uiAbsPartIdx )
 {
@@ -1076,6 +1093,6 @@
   UInt uiDir = pcCU->getLumaIntraDir( uiAbsPartIdx );
 
-#if HHI_DMM_INTRA
-  if ( pcCU->getSlice()->getSPS()->isDepth() && pcCU->getSlice()->getSPS()->getUseDepthModelModes() && pcCU->getWidth( uiAbsPartIdx ) < 64 )
+#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
+  if ( pcCU->getSlice()->getSPS()->isDepth() && pcCU->getSlice()->getSPS()->getUseDMM() && pcCU->getWidth( uiAbsPartIdx ) < 64 )
   {
     m_pcBinIf->encodeBin( uiDir > MAX_MODE_ID_INTRA_DIR, m_cIntraDMMSCModel.get(0, 0, 0) );
@@ -1086,37 +1103,30 @@
     UInt uiDMMode = uiDir - (MAX_MODE_ID_INTRA_DIR+1);
 
-    if( !pcCU->getTextureModeAllowance( uiAbsPartIdx ) )
-    {
+#if HHI_DMM_WEDGE_INTRA && HHI_DMM_PRED_TEX
+    m_pcBinIf->encodeBin( (uiDMMode & 0x01),      m_cIntraDMMSCModel.get(0, 0, 1) );
+    m_pcBinIf->encodeBin( (uiDMMode & 0x02) >> 1, m_cIntraDMMSCModel.get(0, 0, 1) );
+
       if ( pcCU->getPartitionSize( uiAbsPartIdx ) != SIZE_NxN && pcCU->getWidth( uiAbsPartIdx ) > 4 )
       {
-        if( uiDMMode > 1 )
-        {
-          uiDMMode -= 4;
+      m_pcBinIf->encodeBin( (uiDMMode & 0x04) >> 2, m_cIntraDMMSCModel.get(0, 0, 1) );
         }
+#else
                                   m_pcBinIf->encodeBin( (uiDMMode & 0x01),      m_cIntraDMMSCModel.get(0, 0, 1) );
-    if( DMM_INTRA_MODE_BITS > 1 ) m_pcBinIf->encodeBin( (uiDMMode & 0x02) >> 1, m_cIntraDMMSCModel.get(0, 0, 1) );
-      }
-      else
-    {
-        m_pcBinIf->encodeBin( (uiDMMode & 0x01),      m_cIntraDMMSCModel.get(0, 0, 1) );
-    }
-    }
-    else
-    {
-                                  m_pcBinIf->encodeBin( (uiDMMode & 0x01),      m_cIntraDMMSCModel.get(0, 0, 1) );
-    if( DMM_INTRA_MODE_BITS > 1 ) m_pcBinIf->encodeBin( (uiDMMode & 0x02) >> 1, m_cIntraDMMSCModel.get(0, 0, 1) );
 
     if ( pcCU->getPartitionSize( uiAbsPartIdx ) != SIZE_NxN && pcCU->getWidth( uiAbsPartIdx ) > 4 )
     {
-      if( DMM_INTRA_MODE_BITS > 2 ) m_pcBinIf->encodeBin( (uiDMMode & 0x04) >> 2, m_cIntraDMMSCModel.get(0, 0, 1) );
-    }
-  }
-
+      m_pcBinIf->encodeBin( (uiDMMode & 0x02) >> 1, m_cIntraDMMSCModel.get(0, 0, 1) );
+    }
+#endif
+#if HHI_DMM_WEDGE_INTRA
     if( uiDir == DMM_WEDGE_FULL_IDX )          { xCodeWedgeFullInfo          ( pcCU, uiAbsPartIdx ); }
     if( uiDir == DMM_WEDGE_FULL_D_IDX )        { xCodeWedgeFullDeltaInfo     ( pcCU, uiAbsPartIdx ); }
     if( uiDir == DMM_WEDGE_PREDDIR_IDX )       { xCodeWedgePredDirInfo       ( pcCU, uiAbsPartIdx ); }
     if( uiDir == DMM_WEDGE_PREDDIR_D_IDX )     { xCodeWedgePredDirDeltaInfo  ( pcCU, uiAbsPartIdx ); }
+#endif
+#if HHI_DMM_PRED_TEX
     if( uiDir == DMM_WEDGE_PREDTEX_D_IDX )     { xCodeWedgePredTexDeltaInfo  ( pcCU, uiAbsPartIdx ); }
     if( uiDir == DMM_CONTOUR_PREDTEX_D_IDX )   { xCodeContourPredTexDeltaInfo( pcCU, uiAbsPartIdx ); }
+#endif
   }
   else
@@ -1204,6 +1214,6 @@
 {
   UInt uiDir = pcCU->getLumaIntraDir( uiAbsPartIdx );
-#if HHI_DMM_INTRA
-  if ( pcCU->getSlice()->getSPS()->isDepth() && pcCU->getSlice()->getSPS()->getUseDepthModelModes() && pcCU->getWidth( uiAbsPartIdx ) < 64 )
+#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
+  if ( pcCU->getSlice()->getSPS()->isDepth() && pcCU->getSlice()->getSPS()->getUseDMM() && pcCU->getWidth( uiAbsPartIdx ) < 64 )
   {
     m_pcBinIf->encodeBin( uiDir > MAX_MODE_ID_INTRA_DIR, m_cIntraDMMSCModel.get(0, 0, 0) );
@@ -1214,37 +1224,30 @@
     UInt uiDMMode = uiDir - (MAX_MODE_ID_INTRA_DIR+1);
 
-    if( !pcCU->getTextureModeAllowance( uiAbsPartIdx ) )
-    {
+#if HHI_DMM_WEDGE_INTRA && HHI_DMM_PRED_TEX
+    m_pcBinIf->encodeBin( (uiDMMode & 0x01),      m_cIntraDMMSCModel.get(0, 0, 1) );
+    m_pcBinIf->encodeBin( (uiDMMode & 0x02) >> 1, m_cIntraDMMSCModel.get(0, 0, 1) );
+
       if ( pcCU->getPartitionSize( uiAbsPartIdx ) != SIZE_NxN && pcCU->getWidth( uiAbsPartIdx ) > 4 )
       {
-        if( uiDMMode > 1 )
-        {
-          uiDMMode -= 4;
+      m_pcBinIf->encodeBin( (uiDMMode & 0x04) >> 2, m_cIntraDMMSCModel.get(0, 0, 1) );
         }
+#else
         m_pcBinIf->encodeBin( (uiDMMode & 0x01),      m_cIntraDMMSCModel.get(0, 0, 1) );
-        if( DMM_INTRA_MODE_BITS > 1 ) m_pcBinIf->encodeBin( (uiDMMode & 0x02) >> 1, m_cIntraDMMSCModel.get(0, 0, 1) );
-      }
-      else
-      {
-        m_pcBinIf->encodeBin( (uiDMMode & 0x01),      m_cIntraDMMSCModel.get(0, 0, 1) );
-      }
-    }
-    else
-    {
-      m_pcBinIf->encodeBin( (uiDMMode & 0x01),      m_cIntraDMMSCModel.get(0, 0, 1) );
-      if( DMM_INTRA_MODE_BITS > 1 ) m_pcBinIf->encodeBin( (uiDMMode & 0x02) >> 1, m_cIntraDMMSCModel.get(0, 0, 1) );
 
       if ( pcCU->getPartitionSize( uiAbsPartIdx ) != SIZE_NxN && pcCU->getWidth( uiAbsPartIdx ) > 4 )
       {
-        if( DMM_INTRA_MODE_BITS > 2 ) m_pcBinIf->encodeBin( (uiDMMode & 0x04) >> 2, m_cIntraDMMSCModel.get(0, 0, 1) );
-      }
-    }
-
+      m_pcBinIf->encodeBin( (uiDMMode & 0x02) >> 1, m_cIntraDMMSCModel.get(0, 0, 1) );
+      }
+#endif
+#if HHI_DMM_WEDGE_INTRA
     if( uiDir == DMM_WEDGE_FULL_IDX )          { xCodeWedgeFullInfo          ( pcCU, uiAbsPartIdx ); }
     if( uiDir == DMM_WEDGE_FULL_D_IDX )        { xCodeWedgeFullDeltaInfo     ( pcCU, uiAbsPartIdx ); }
     if( uiDir == DMM_WEDGE_PREDDIR_IDX )       { xCodeWedgePredDirInfo       ( pcCU, uiAbsPartIdx ); }
     if( uiDir == DMM_WEDGE_PREDDIR_D_IDX )     { xCodeWedgePredDirDeltaInfo  ( pcCU, uiAbsPartIdx ); }
+#endif
+#if HHI_DMM_PRED_TEX
     if( uiDir == DMM_WEDGE_PREDTEX_D_IDX )     { xCodeWedgePredTexDeltaInfo  ( pcCU, uiAbsPartIdx ); }
     if( uiDir == DMM_CONTOUR_PREDTEX_D_IDX )   { xCodeContourPredTexDeltaInfo( pcCU, uiAbsPartIdx ); }
+#endif
   }
   else
Index: trunk/source/Lib/TLibEncoder/TEncSbac.h
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncSbac.h	(revision 2)
+++ trunk/source/Lib/TLibEncoder/TEncSbac.h	(revision 5)
@@ -1,2 +1,35 @@
+/* The copyright in this software is being made available under the BSD
+ * License, included below. This software may be subject to other third party
+ * and contributor rights, including patent rights, and no such rights are
+ * granted under this license.
+ *
+ * Copyright (c) 2010-2011, ISO/IEC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  * Neither the name of the ISO/IEC nor the names of its contributors may
+ *    be used to endorse or promote products derived from this software without
+ *    specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 
 
@@ -85,5 +118,5 @@
 #if E253
   Void  xWriteGoRiceExGolomb ( UInt uiSymbol, UInt &ruiGoRiceParam );
-#if HHI_DMM_INTRA
+#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
   Void  xWriteExGolombLevel  ( UInt uiSymbol, ContextModel& rcSCModel  );
 #endif
@@ -103,9 +136,12 @@
   Void  xCopyFrom            ( TEncSbac* pSrc );
   
-#if HHI_DMM_INTRA
+#if HHI_DMM_WEDGE_INTRA
   Void  xCodeWedgeFullInfo   ( TComDataCU* pcCU, UInt uiAbsPartIdx );
   Void  xCodeWedgeFullDeltaInfo     ( TComDataCU* pcCU, UInt uiAbsPartIdx );
+
   Void  xCodeWedgePredDirInfo       ( TComDataCU* pcCU, UInt uiAbsPartIdx );
   Void  xCodeWedgePredDirDeltaInfo  ( TComDataCU* pcCU, UInt uiAbsPartIdx );
+#endif
+#if HHI_DMM_PRED_TEX
   Void  xCodeWedgePredTexDeltaInfo  ( TComDataCU* pcCU, UInt uiAbsPartIdx );
   Void  xCodeContourPredTexDeltaInfo( TComDataCU* pcCU, UInt uiAbsPartIdx );
@@ -130,10 +166,11 @@
   Void codeMergeFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx );
   Void codeMergeIndex    ( TComDataCU* pcCU, UInt uiAbsPartIdx );
+#if HHI_INTER_VIEW_MOTION_PRED || HHI_MPI
   Void codeMergeIndexMV  ( TComDataCU* pcCU, UInt uiAbsPartIdx );
+#endif
+#if HHI_INTER_VIEW_RESIDUAL_PRED
   Void codeResPredFlag   ( TComDataCU* pcCU, UInt uiAbsPartIdx );
+#endif
   Void codeSplitFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
-#if MW_MVI_SIGNALLING_MODE == 0
-  Void codeMvInheritanceFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
-#endif
   Void codeMVPIdx        ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefList );
   
@@ -182,7 +219,4 @@
   UInt                 m_uiLastQp;
   ContextModel3DBuffer m_cCUSplitFlagSCModel;
-#if MW_MVI_SIGNALLING_MODE == 0
-  ContextModel3DBuffer m_cCUMvInheritanceFlagSCModel;
-#endif
   ContextModel3DBuffer m_cCUSkipFlagSCModel;
   ContextModel3DBuffer m_cCUMergeFlagExtSCModel;
@@ -227,5 +261,5 @@
 #endif
   ContextModel3DBuffer m_cViewIdxSCModel;
-#if HHI_DMM_INTRA
+#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
   ContextModel3DBuffer m_cIntraDMMSCModel;
   ContextModel3DBuffer m_cIntraWedgeSCModel;
Index: trunk/source/Lib/TLibEncoder/TEncSearch.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 2)
+++ trunk/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 5)
@@ -1,2 +1,35 @@
+/* The copyright in this software is being made available under the BSD
+ * License, included below. This software may be subject to other third party
+ * and contributor rights, including patent rights, and no such rights are
+ * granted under this license.
+ *
+ * Copyright (c) 2010-2011, ISO/IEC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  * Neither the name of the ISO/IEC nor the names of its contributors may
+ *    be used to endorse or promote products derived from this software without
+ *    specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 
 /** \file     TEncSearch.cpp
@@ -911,10 +944,11 @@
                             Bool         bLuma,
                             Bool         bChroma,
-                            Bool         bRealCoeff /* just for test */ )
+                            Bool         bRealCoeff /* just for test */
+                            )
 {
   m_pcEntropyCoder->resetBits();
   xEncIntraHeader ( pcCU, uiTrDepth, uiAbsPartIdx, bLuma, bChroma );
   xEncSubdivCbfQT ( pcCU, uiTrDepth, uiAbsPartIdx, bLuma, bChroma );
-
+  
   if( bLuma )
   {
@@ -940,8 +974,4 @@
                                 TComYuv*    pcResiYuv,
                                 Dist&       ruiDist
-#if DMM_RES_CHECK_INTRA
-                                ,
-                                Bool        bCheckNoRes
-#endif
                                 )
 {
@@ -973,5 +1003,5 @@
   pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, uiTrDepth, m_piYuvExt, m_iYuvExtStride, m_iYuvExtHeight, bAboveAvail, bLeftAvail );
 
-#if HHI_DMM_INTRA
+#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
   if( uiLumaPredMode > MAX_MODE_ID_INTRA_DIR )
   {
@@ -984,31 +1014,4 @@
     predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, pcCU, bAboveAvail, bLeftAvail );
   }
-
-#if DMM_RES_CHECK_INTRA
-  if ( bCheckNoRes )
-  {
-    //prediction signal is already filled in this case
-    //===== update distortion =====
-    //GT VSO
-    if ( m_pcRdCost->getUseVSO() )
-    {
-      ruiDist += m_pcRdCost->getDistVS  ( pcCU, uiAbsPartIdx, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, false, 0 );
-
-#if GERHARD_VQM_XCHECK
-      UInt uiDist1 = m_pcRdCost->getDistVS  ( pcCU, uiAbsPartIdx, piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight, false, 0 );
-      UInt uiDist2 = m_pcRdCost->getDistPart( piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight );
-      assert(uiDist1 == uiDist2);
-#endif
-    }
-    else
-    {
-      ruiDist += m_pcRdCost->getDistPart( piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight );
-    }
-    //GT VSO end
-
-    pcCU->setCbfSubParts( 0, TEXT_LUMA, uiAbsPartIdx, uiFullDepth );
-    return;
-  }
-#endif
 
   //===== get residual signal =====
@@ -1088,92 +1091,15 @@
 
   //===== update distortion =====
-  //GT VSO
+#if HHI_VSO
   if ( m_pcRdCost->getUseVSO() )
   {
     ruiDist += m_pcRdCost->getDistVS  ( pcCU, uiAbsPartIdx, piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight, false, 0 );
-
-  #if GERHARD_VQM_XCHECK
-    UInt uiDist1 = m_pcRdCost->getDistVS  ( pcCU, uiAbsPartIdx, piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight, false, 0 );
-    UInt uiDist2 = m_pcRdCost->getDistPart( piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight );
-    assert(uiDist1 == uiDist2);
-  #endif
   }
   else
+#endif
   {
     ruiDist += m_pcRdCost->getDistPart( piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight );
   }
-  //GT VSO end
 }
-
-#if DMM_RES_CHECK_INTRA
-Void
-TEncSearch::xSetIntraNoResi( TComDataCU* pcCU,
-                             UInt        uiTrDepth,
-                             UInt        uiAbsPartIdx,
-                             TComYuv*    pcPredYuv,
-                             TComYuv*    pcResiYuv,
-                             Bool        bNoRes
-                            )
-{
-  UInt    uiFullDepth       = pcCU     ->getDepth   ( 0 )  + uiTrDepth;
-  UInt    uiWidth           = pcCU     ->getWidth   ( 0 ) >> uiTrDepth;
-  UInt    uiHeight          = pcCU     ->getHeight  ( 0 ) >> uiTrDepth;
-  UInt    uiStride          = pcPredYuv->getStride  ();
-  Pel*    piPred            = pcPredYuv->getLumaAddr( uiAbsPartIdx );
-  Pel*    piResi            = pcResiYuv->getLumaAddr( uiAbsPartIdx );
-  Pel*    piReco            = pcPredYuv->getLumaAddr( uiAbsPartIdx );
-
-  UInt    uiLog2TrSize      = g_aucConvertToBit[ pcCU->getSlice()->getSPS()->getMaxCUWidth() >> uiFullDepth ] + 2;
-  UInt    uiQTLayer         = pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() - uiLog2TrSize;
-  UInt    uiNumCoeffPerInc  = pcCU->getSlice()->getSPS()->getMaxCUWidth() * pcCU->getSlice()->getSPS()->getMaxCUHeight() >> ( pcCU->getSlice()->getSPS()->getMaxCUDepth() << 1 );
-  TCoeff* pcCoeff           = m_ppcQTTempCoeffY[ uiQTLayer ] + uiNumCoeffPerInc * uiAbsPartIdx;
-  Pel*    piRecQt           = m_pcQTTempTComYuv[ uiQTLayer ].getLumaAddr( uiAbsPartIdx );
-  UInt    uiRecQtStride     = m_pcQTTempTComYuv[ uiQTLayer ].getStride  ();
-
-  UInt    uiZOrder          = pcCU->getZorderIdxInCU() + uiAbsPartIdx;
-  Pel*    piRecIPred        = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder );
-  UInt    uiRecIPredStride  = pcCU->getPic()->getPicYuvRec()->getStride  ();
-
-  if ( bNoRes )
-  {
-    pcCU->setCbfSubParts( 0, TEXT_LUMA, uiAbsPartIdx, uiFullDepth );
-
-    Pel* pResi = piResi;
-    memset( pcCoeff, 0, sizeof( TCoeff ) * uiWidth * uiHeight );
-    for( UInt uiY = 0; uiY < uiHeight; uiY++ )
-    {
-      memset( pResi, 0, sizeof( Pel ) * uiWidth );
-      pResi += uiStride;
-    }
-  }
-  else
-  {
-    pcCU->setCbfSubParts( 1 << uiTrDepth, TEXT_LUMA, uiAbsPartIdx, uiFullDepth );
-  }
-
-  //===== reconstruction =====
-  {
-    Pel* pPred      = piPred;
-    Pel* pResi      = piResi;
-    Pel* pReco      = piReco;
-    Pel* pRecQt     = piRecQt;
-    Pel* pRecIPred  = piRecIPred;
-    for( UInt uiY = 0; uiY < uiHeight; uiY++ )
-    {
-      for( UInt uiX = 0; uiX < uiWidth; uiX++ )
-      {
-        pReco    [ uiX ] = Clip( pPred[ uiX ] + pResi[uiX] );
-        pRecQt   [ uiX ] = pReco[ uiX ];
-        pRecIPred[ uiX ] = pReco[ uiX ];
-      }
-      pPred     += uiStride;
-      pResi     += uiStride;
-      pReco     += uiStride;
-      pRecQt    += uiRecQtStride;
-      pRecIPred += uiRecIPredStride;
-    }
-  }
-}
-#endif
 
 Void
@@ -1362,5 +1288,5 @@
   }
 #endif
-#if HHI_DMM_INTRA
+#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
   if( pcCU->getLumaIntraDir( uiAbsPartIdx ) > MAX_MODE_ID_INTRA_DIR )
   {
@@ -1378,15 +1304,9 @@
   {
     //----- store original entropy coding status -----
-#if DMM_RES_CHECK_INTRA
-    if( m_bUseSBACRD && ( bCheckSplit || pcCU->getSlice()->getSPS()->isDepth() ) )
+    if( m_bUseSBACRD && bCheckSplit )
     {
       m_pcRDGoOnSbacCoder->store( m_pppcRDSbacCoder[ uiFullDepth ][ CI_QT_TRAFO_ROOT ] );
     }
-#else
-    if( m_bUseSBACRD && bCheckSplit )
-    {
-      m_pcRDGoOnSbacCoder->store( m_pppcRDSbacCoder[ uiFullDepth ][ CI_QT_TRAFO_ROOT ] );
-    }
-#endif
+
     //----- code luma block with given intra prediction mode and store Cbf-----
     dSingleCost   = 0.0;
@@ -1409,5 +1329,6 @@
     //----- determine rate and r-d cost -----
     UInt uiSingleBits = xGetIntraBitsQT( pcCU, uiTrDepth, uiAbsPartIdx, true, !bLumaOnly, false );
-//GT VSO
+
+#if HHI_VSO
     if ( m_pcRdCost->getUseLambdaScaleVSO())
     {
@@ -1418,42 +1339,6 @@
       dSingleCost = m_pcRdCost->calcRdCost( uiSingleBits, uiSingleDistY + uiSingleDistC );
     }
-//GT VSO end
-
-#if DMM_RES_CHECK_INTRA
-    if ( pcCU->getSlice()->getSPS()->isDepth() && pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiTrDepth ) == 1 && pcCU->getLumaIntraDir( uiAbsPartIdx ) > MAX_MODE_ID_INTRA_DIR )
-    {
-      m_pcRDGoOnSbacCoder->load ( m_pppcRDSbacCoder[ uiFullDepth ][ CI_QT_TRAFO_ROOT ] );
-
-      Double dSingleCostNoRes = MAX_DOUBLE;
-      Dist uiSingleDistYNoRes = 0;
-      //save cbf and coeffs
-      xIntraCodingLumaBlk( pcCU, uiTrDepth, uiAbsPartIdx, pcOrgYuv, pcPredYuv, pcResiYuv, uiSingleDistYNoRes, true );
-
-      //----- determine rate and r-d cost -----
-      UInt uiSingleBitsNoRes = xGetIntraBitsQT( pcCU, uiTrDepth, uiAbsPartIdx, true, !bLumaOnly, false );
-      //GT VSO
-      if ( m_pcRdCost->getUseLambdaScaleVSO())
-      {
-        dSingleCostNoRes = m_pcRdCost->calcRdCostVSO( uiSingleBitsNoRes, uiSingleDistYNoRes + uiSingleDistC );
-      }
-      else
-      {
-        dSingleCostNoRes = m_pcRdCost->calcRdCost( uiSingleBitsNoRes, uiSingleDistYNoRes + uiSingleDistC );
-      }
-      //GT VSO end
-
-      if ( dSingleCostNoRes < dSingleCost )
-      {
-        xSetIntraNoResi( pcCU, uiTrDepth, uiAbsPartIdx, pcPredYuv, pcResiYuv, true );
-        dSingleCost = dSingleCostNoRes;
-        uiSingleCbfY = pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiTrDepth );
-
-      }
-      else
-      {
-        xSetIntraNoResi( pcCU, uiTrDepth, uiAbsPartIdx, pcPredYuv, pcResiYuv, false );
-        uiSingleCbfY = pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiTrDepth );
-      }
-    }
+#else
+    dSingleCost = m_pcRdCost->calcRdCost( uiSingleBits, uiSingleDistY + uiSingleDistC );
 #endif
   }
@@ -1520,5 +1405,5 @@
     //----- determine rate and r-d cost -----
     UInt uiSplitBits = xGetIntraBitsQT( pcCU, uiTrDepth, uiAbsPartIdx, true, !bLumaOnly, false );
-//GT VSO
+#if HHI_VSO
     if( m_pcRdCost->getUseLambdaScaleVSO() )
     {
@@ -1529,5 +1414,7 @@
       dSplitCost       = m_pcRdCost->calcRdCost( uiSplitBits, uiSplitDistY + uiSplitDistC );
     }
-//GT VSO end
+#else
+    dSplitCost       = m_pcRdCost->calcRdCost( uiSplitBits, uiSplitDistY + uiSplitDistC );
+#endif
 
     //===== compare and set best =====
@@ -1601,4 +1488,5 @@
   }
 
+#if HHI_VSO
   if ( m_pcRdCost->getUseRenModel() && bCheckFull )
   {
@@ -1611,4 +1499,5 @@
     m_pcRdCost->setRenModelData( pcCU, uiAbsPartIdx, piSrc, (Int) uiSrcStride, (Int) uiWidth, (Int) uiHeight );
   }
+#endif
 
   ruiDistY += uiSingleDistY;
@@ -1858,7 +1747,7 @@
     uiMaxMode += 1;
 #endif
-#if HHI_DMM_INTRA
+#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
     Bool bTestDmm = false;
-    if ( m_pcEncCfg->isDepthCoder() && m_pcEncCfg->getUseDepthModelModes() )
+    if ( m_pcEncCfg->isDepthCoder() && m_pcEncCfg->getUseDMM() )
       bTestDmm = true;
 #endif
@@ -1900,14 +1789,9 @@
       // use hadamard transform here
       Dist uiSad;
-//GT VSO
+#if HHI_VSO
       if ( m_pcRdCost->getUseVSO() )
       {
         Bool bSad = !m_pcRdCost->getUseRenModel();
         uiSad = m_pcRdCost->getDistVS(pcCU, uiPartOffset, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, bSad, 0 );
-#if GERHARD_VQM_XCHECK
-        UInt uiDist1 = m_pcRdCost->getDistVS  ( pcCU, uiPartOffset, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, false, 0 );
-        UInt uiDist2 = m_pcRdCost->getDistPart( piOrg, uiStride, piPred, uiStride, uiWidth, uiHeight );
-        assert(uiDist1 == uiDist2);
-#endif
       }
       else
@@ -1915,13 +1799,16 @@
         uiSad = (Dist) m_pcRdCost->calcHAD( piOrg, uiStride, piPred, uiStride, uiWidth, uiHeight );
       }
-//GT VSO end
+#else
+        uiSad = (Dist) m_pcRdCost->calcHAD( piOrg, uiStride, piPred, uiStride, uiWidth, uiHeight );
+#endif
 
       UInt   iModeBits = xModeBitsIntra( pcCU, uiMode, uiPU, uiPartOffset, uiDepth, uiInitTrDepth );
-//GT VSO
+
       Double dLambda;
-
+#if HHI_VSO
       if ( m_pcRdCost->getUseLambdaScaleVSO() )
       {
         dLambda = m_pcRdCost->getUseRenModel() ? m_pcRdCost->getLambdaVSO() : m_pcRdCost->getSqrtLambdaVSO();
+        //GT: Sad is SSE for VSO4
       }
       else
@@ -1929,10 +1816,12 @@
         dLambda = m_pcRdCost->getSqrtLambda();
       }
-
-      //GT: Sad is SSE for VSO4
+#else
+      dLambda = m_pcRdCost->getSqrtLambda();
+#endif
+
       Double cost = (Double)uiSad + (Double)iModeBits *  dLambda;
-//GT VSO end
+
       CandNum += xUpdateCandList( uiMode, cost, uiFastCandNum, CandModeList, CandCostList );
-#if HHI_DMM_INTRA
+#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
       if ( bTestDmm ) bTestDmm = uiSad ? true : false;
 #endif
@@ -2004,119 +1893,72 @@
     }
 
-#if HHI_DMM_INTRA
-    if( m_pcEncCfg->isDepthCoder() && uiWidth >= 4 && uiWidth < 64 && m_pcEncCfg->getUseDepthModelModes() && bTestDmm )
-    {
-#if DMM_NO_TEXTURE_MODES
-      pcCU->setTextureModeAllowanceSubParts( false, uiPartOffset, uiDepth + uiInitTrDepth );
-#else
-      UInt uiPartAddr = 0;
-      Int  iBlockWidth, iBlockHeight;
-
-      pcCU->getPartIndexAndSize( uiPU, uiPartAddr, iBlockWidth, iBlockHeight );
-
-      TComPicYuv* pcPicYuvRef = pcCU->getSlice()->getTexturePic()->getPicYuvRec();
-      Int         iRefStride = pcPicYuvRef->getStride();
-      Pel*        piRefY     = pcPicYuvRef->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr );
-
-      TComYuv cTempYuv; cTempYuv.create( pcCU->getWidth(0), pcCU->getHeight(0) ); cTempYuv.clear();
-      UInt uiTempStride = cTempYuv.getStride();
-      Pel* piTempY      = cTempYuv.getLumaAddr( uiPU, uiWidth );
-
-      for ( Int y = 0; y < uiHeight; y++ )
-      {
-        ::memcpy(piTempY, piRefY, sizeof(Pel)*uiWidth);
-        piTempY += uiTempStride;
-        piRefY += iRefStride;
-      }
-
-      UInt64 uiDCSAD = cTempYuv.getLumaDistDCSAD( uiPartAddr, uiWidth );
+#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
+    if( m_pcEncCfg->isDepthCoder() && uiWidth >= 4 && uiWidth < 64 && m_pcEncCfg->getUseDMM() && bTestDmm && uiWidth == uiHeight )
+    {
+#if HHI_DMM_WEDGE_INTRA
+      UInt uiTabIdx  = 0;
+      Int  iDeltaDC1 = 0;
+      Int  iDeltaDC2 = 0;
+      findWedgeFullMinDist( pcCU, uiPartOffset, piOrg, piPred, uiStride, uiWidth, uiHeight, uiTabIdx, iDeltaDC1, iDeltaDC2, bAboveAvail, bLeftAvail, WedgeDist_SAD );
+      pcCU->setWedgeFullTabIdxSubParts  ( uiTabIdx,  uiPartOffset, uiDepth + uiInitTrDepth );
+      pcCU->setWedgeFullDeltaDC1SubParts( iDeltaDC1, uiPartOffset, uiDepth + uiInitTrDepth );
+      pcCU->setWedgeFullDeltaDC2SubParts( iDeltaDC2, uiPartOffset, uiDepth + uiInitTrDepth );
+
+      uiRdModeList[ uiNewMaxMode++ ] = DMM_WEDGE_FULL_IDX;
+      uiRdModeList[ uiNewMaxMode++ ] = DMM_WEDGE_FULL_D_IDX;
+
+      if ( uiWidth > 4 )
+      {
+        Int  iWedgeDeltaEnd = 0;
+
+        iDeltaDC1 = 0;
+        iDeltaDC2 = 0;
+
+        findWedgePredDirMinDist( pcCU, uiPartOffset, piOrg, piPred, uiStride, uiWidth, uiHeight, uiTabIdx, iWedgeDeltaEnd, iDeltaDC1, iDeltaDC2, bAboveAvail, bLeftAvail, WedgeDist_SAD );
+        pcCU->setWedgePredDirTabIdxSubParts  ( uiTabIdx,       uiPartOffset, uiDepth + uiInitTrDepth );
+        pcCU->setWedgePredDirDeltaEndSubParts( iWedgeDeltaEnd, uiPartOffset, uiDepth + uiInitTrDepth );
+        pcCU->setWedgePredDirDeltaDC1SubParts( iDeltaDC1,      uiPartOffset, uiDepth + uiInitTrDepth );
+        pcCU->setWedgePredDirDeltaDC2SubParts( iDeltaDC2,      uiPartOffset, uiDepth + uiInitTrDepth );
+
+        uiRdModeList[ uiNewMaxMode++ ] = DMM_WEDGE_PREDDIR_IDX;
+        uiRdModeList[ uiNewMaxMode++ ] = DMM_WEDGE_PREDDIR_D_IDX;
+      }
+#endif
+#if HHI_DMM_PRED_TEX
+      TComYuv cTempYuv; cTempYuv.create( uiWidth, uiHeight ); cTempYuv.clear();
+      Pel* piTempY      = cTempYuv.getLumaAddr();
+
+      fillTexturePicTempBlock( pcCU, uiPartOffset, piTempY, uiWidth, uiHeight );
+
+      piTempY = cTempYuv.getLumaAddr();
+
+      UInt uiTexTabIdx  = 0;
+      Int  iTexDeltaDC1 = 0;
+      Int  iTexDeltaDC2 = 0;
+      findWedgeTexMinDist( pcCU, uiPartOffset, piOrg, piPred, uiStride, uiWidth, uiHeight, uiTexTabIdx, iTexDeltaDC1, iTexDeltaDC2, bAboveAvail, bLeftAvail, WedgeDist_SAD, piTempY ); 
+      pcCU->setWedgePredTexTabIdxSubParts  ( uiTexTabIdx,  uiPartOffset, uiDepth + uiInitTrDepth );
+      pcCU->setWedgePredTexDeltaDC1SubParts( iTexDeltaDC1, uiPartOffset, uiDepth + uiInitTrDepth );
+      pcCU->setWedgePredTexDeltaDC2SubParts( iTexDeltaDC2, uiPartOffset, uiDepth + uiInitTrDepth );
+
+      uiRdModeList[ uiNewMaxMode++ ] = DMM_WEDGE_PREDTEX_IDX;
+      uiRdModeList[ uiNewMaxMode++ ] = DMM_WEDGE_PREDTEX_D_IDX;
+
+      if ( uiWidth > 4 )
+      {
+        piTempY = cTempYuv.getLumaAddr();
+
+        iTexDeltaDC1 = 0;
+        iTexDeltaDC2 = 0;
+
+        findContourPredTex( pcCU, uiPartOffset, piOrg, piPred, uiStride, uiWidth, uiHeight, iTexDeltaDC1, iTexDeltaDC2, bAboveAvail, bLeftAvail, piTempY );
+        pcCU->setContourPredTexDeltaDC1SubParts( iTexDeltaDC1, uiPartOffset, uiDepth + uiInitTrDepth );
+        pcCU->setContourPredTexDeltaDC2SubParts( iTexDeltaDC2, uiPartOffset, uiDepth + uiInitTrDepth );
+
+        uiRdModeList[ uiNewMaxMode++ ] = DMM_CONTOUR_PREDTEX_IDX;
+        uiRdModeList[ uiNewMaxMode++ ] = DMM_CONTOUR_PREDTEX_D_IDX;
+      }
 
       cTempYuv.destroy();
-
-      if ( uiDCSAD < (UInt)(pcCU->getQP(0))/2 )
-      {
-        pcCU->setTextureModeAllowanceSubParts( false, uiPartOffset, uiDepth + uiInitTrDepth );
-      }
-      else
-      {
-        pcCU->setTextureModeAllowanceSubParts( true, uiPartOffset, uiDepth + uiInitTrDepth );
-      }
-#endif
-      UChar uhNumAdd = 0;
-      if ( uiWidth > 4 )
-      {
-        uhNumAdd = 8;
-      }
-      else
-      {
-        uhNumAdd = 4;
-      }
-      Bool bWedgePredFull  = false;
-      Bool bWedgePredDir   = false;
-      Bool bWedgePredTex   = false;
-      Bool bContourPredTex = false;
-
-      for ( Int i = 0; i < uhNumAdd; i++ )
-      {
-        UInt uiDMMid = g_aucAdditionalIntraModeList[i];
-
-        if( !predIntraLumaDMMAvailable( uiDMMid, bAboveAvail, bLeftAvail, uiWidth, uiHeight, pcCU, uiPartOffset ) )
-          continue;
-
-        if( uiDMMid >= DMM_WEDGE_PREDTEX_IDX && uiDMMid <= DMM_CONTOUR_PREDTEX_D_IDX && pcCU->getTextureModeAllowance( uiPartOffset ) == false )
-        {
-          continue;
-        }
-        if( !bWedgePredFull && (uiDMMid == DMM_WEDGE_FULL_IDX || uiDMMid == DMM_WEDGE_FULL_D_IDX) )
-        {
-          UInt uiTabIdx  = 0;
-          Int  iDeltaDC1 = 0;
-          Int  iDeltaDC2 = 0;
-          findWedgeFullMinDist( pcCU, uiPU, piOrg, piPred, uiStride, uiWidth, uiHeight, uiTabIdx, iDeltaDC1, iDeltaDC2, bAboveAvail, bLeftAvail, WedgeDist_SAD );
-          pcCU->setWedgeFullTabIdxSubParts  ( uiTabIdx,  uiPartOffset, uiDepth + uiInitTrDepth );
-          pcCU->setWedgeFullDeltaDC1SubParts( iDeltaDC1, uiPartOffset, uiDepth + uiInitTrDepth );
-          pcCU->setWedgeFullDeltaDC2SubParts( iDeltaDC2, uiPartOffset, uiDepth + uiInitTrDepth );
-          bWedgePredFull = true;
-        }
-
-        if( !bWedgePredDir && (uiDMMid == DMM_WEDGE_PREDDIR_IDX || uiDMMid == DMM_WEDGE_PREDDIR_D_IDX) )
-        {
-          UInt uiTabIdx       = 0;
-          Int  iWedgeDeltaEnd = 0;
-          Int  iDeltaDC1      = 0;
-          Int  iDeltaDC2      = 0;
-          findWedgePredDirMinDist( pcCU, uiPU, piOrg, piPred, uiStride, uiWidth, uiHeight, uiTabIdx, iWedgeDeltaEnd, iDeltaDC1, iDeltaDC2, bAboveAvail, bLeftAvail, WedgeDist_SAD );
-          pcCU->setWedgePredDirTabIdxSubParts  ( uiTabIdx,       uiPartOffset, uiDepth + uiInitTrDepth );
-          pcCU->setWedgePredDirDeltaEndSubParts( iWedgeDeltaEnd, uiPartOffset, uiDepth + uiInitTrDepth );
-          pcCU->setWedgePredDirDeltaDC1SubParts( iDeltaDC1,      uiPartOffset, uiDepth + uiInitTrDepth );
-          pcCU->setWedgePredDirDeltaDC2SubParts( iDeltaDC2,      uiPartOffset, uiDepth + uiInitTrDepth );
-          bWedgePredDir = true;
-        }
-
-        if( !bWedgePredTex && (uiDMMid == DMM_WEDGE_PREDTEX_IDX || uiDMMid == DMM_WEDGE_PREDTEX_D_IDX) )
-        {
-          UInt uiTabIdx  = 0;
-          Int  iDeltaDC1 = 0;
-          Int  iDeltaDC2 = 0;
-          findWedgeTexMinDist( pcCU, uiPU, piOrg, piPred, uiStride, uiWidth, uiHeight, uiTabIdx, iDeltaDC1, iDeltaDC2, bAboveAvail, bLeftAvail, WedgeDist_SAD );
-          pcCU->setWedgePredTexTabIdxSubParts  ( uiTabIdx,  uiPartOffset, uiDepth + uiInitTrDepth );
-          pcCU->setWedgePredTexDeltaDC1SubParts( iDeltaDC1, uiPartOffset, uiDepth + uiInitTrDepth );
-          pcCU->setWedgePredTexDeltaDC2SubParts( iDeltaDC2, uiPartOffset, uiDepth + uiInitTrDepth );
-          bWedgePredTex = true;
-        }
-
-        if( !bContourPredTex && (uiDMMid == DMM_CONTOUR_PREDTEX_IDX || uiDMMid == DMM_CONTOUR_PREDTEX_D_IDX) )
-        {
-          Int  iDeltaDC1 = 0;
-          Int  iDeltaDC2 = 0;
-          findContourPredTex( pcCU, uiPU, piOrg, piPred, uiStride, uiWidth, uiHeight, iDeltaDC1, iDeltaDC2, bAboveAvail, bLeftAvail );
-          pcCU->setContourPredTexDeltaDC1SubParts( iDeltaDC1, uiPartOffset, uiDepth + uiInitTrDepth );
-          pcCU->setContourPredTexDeltaDC2SubParts( iDeltaDC2, uiPartOffset, uiDepth + uiInitTrDepth );
-          bContourPredTex = true;
-        }
-
-        uiRdModeList[ uiNewMaxMode ] = uiDMMid;
-        uiNewMaxMode++;
-      }
+#endif
     }
 #endif
@@ -2137,5 +1979,5 @@
 
 #if (!REFERENCE_SAMPLE_PADDING)
-#if HHI_DMM_INTRA
+#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
       if ( !predIntraLumaDirAvailable( uiOrgMode, uiWidthBit, bAboveAvail, bLeftAvail, uiWidth, uiHeight, pcCU, uiPartOffset ) )
         continue;
@@ -2145,6 +1987,6 @@
 #endif
 #else
-#if HHI_DMM_INTRA
-      if( m_pcEncCfg->isDepthCoder() && !predIntraLumaDMMAvailable( uiOrgMode, bAboveAvail, bLeftAvail, uiWidth, uiHeight, pcCU, uiPartOffset ) )
+#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
+      if( m_pcEncCfg->isDepthCoder() && !predIntraLumaDMMAvailable( uiOrgMode, uiWidth, uiHeight ) )
         continue;
 #endif
@@ -2166,8 +2008,10 @@
 
       // reset Model
+#if HHI_VSO
       if( m_pcRdCost->getUseRenModel() )
       {
         m_pcRdCost->setRenModelData( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight );
       }
+#endif
 
 #if HHI_RQT_INTRA_SPEEDUP
@@ -2223,5 +2067,5 @@
 
 #if (!REFERENCE_SAMPLE_PADDING)
-#if HHI_DMM_INTRA
+#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
       if ( !predIntraLumaDirAvailable( uiOrgMode, uiWidthBit, bAboveAvail, bLeftAvail, uiWidth, uiHeight, pcCU, uiPartOffset ) )
         continue;
@@ -2231,6 +2075,6 @@
 #endif
 #else
-#if HHI_DMM_INTRA
-      if( m_pcEncCfg->isDepthCoder() && !predIntraLumaDMMAvailable( uiOrgMode, bAboveAvail, bLeftAvail, uiWidth, uiHeight, pcCU, uiPartOffset ) )
+#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
+      if( m_pcEncCfg->isDepthCoder() && !predIntraLumaDMMAvailable( uiOrgMode, uiWidth, uiHeight ) )
         continue;
 #endif
@@ -2250,4 +2094,5 @@
       Double dPUCost   = 0.0;
 
+#if HHI_VSO
       // reset Model
       if( m_pcRdCost->getUseRenModel() )
@@ -2255,4 +2100,5 @@
         m_pcRdCost->setRenModelData( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight );
       }
+#endif
 
       xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, false, dPUCost );
@@ -2317,4 +2163,5 @@
       }
 
+#if HHI_VSO
       // set model
       if( m_pcRdCost->getUseRenModel() )
@@ -2323,4 +2170,5 @@
         m_pcRdCost->setRenModelData( pcCU, uiPartOffset, piSrc, uiSrcStride, uiCompWidth, uiCompHeight);
       }
+#endif
 
       if( !bLumaOnly && !bSkipChroma )
@@ -2483,5 +2331,5 @@
     }
 #endif
-#if HHI_DMM_INTRA
+#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
 #if ADD_PLANAR_MODE
     if ( uiModeList[uiMode] == 4 && pcCU->getLumaIntraDir(0) > MAX_MODE_ID_INTRA_DIR )
@@ -2545,5 +2393,5 @@
 
 #if (!REFERENCE_SAMPLE_PADDING)
-#if HHI_DMM_INTRA
+#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
 Bool TEncSearch::predIntraLumaDirAvailable( UInt uiMode, UInt uiWidthBit, Bool bAboveAvail, Bool bLeftAvail, UInt uiWidth, UInt uiHeight, TComDataCU* pcCU, UInt uiAbsPartIdx   )
 #else
@@ -2552,8 +2400,8 @@
 {
   Bool bDirAvailable;
-#if HHI_DMM_INTRA
+#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
   if( uiMode > MAX_MODE_ID_INTRA_DIR )
   {
-    return predIntraLumaDMMAvailable( uiMode, bAboveAvail, bLeftAvail, uiWidth, uiHeight, pcCU, uiAbsPartIdx );
+    return predIntraLumaDMMAvailable( uiMode, bAboveAvail, bLeftAvail, uiWidth, uiHeight );
   }
   else
@@ -2572,183 +2420,6 @@
 #endif
 
-#if HHI_DMM_INTRA
-Void TEncSearch::xSearchWedgeFullMinDist( TComDataCU* pcCU, UInt uiAbsPtIdx, WedgeList* pacWedgeList, Pel* piRef, UInt uiRefStride, UInt uiWidth, UInt uiHeight, UInt& ruiTabIdx )
-{
-  ruiTabIdx = 0;
-
-  // local pred buffer
-  TComYuv cPredYuv;
-  cPredYuv.create( uiWidth, uiHeight );
-  cPredYuv.clear();
-
-  UInt uiPredStride = cPredYuv.getStride();
-  Pel* piPred       = cPredYuv.getLumaAddr();
-
-  Int  iDC1 = 0;
-  Int  iDC2 = 0;
-  // regular wedge search
-  Dist uiBestDist   = RDO_DIST_MAX;
-  UInt uiBestTabIdx = 0;
-
-  for( UInt uiIdx = 0; uiIdx < pacWedgeList->size(); uiIdx++ )
-  {
-    calcWedgeDCs       ( &(pacWedgeList->at(uiIdx)), piRef,  uiRefStride,  iDC1, iDC2 );
-    assignWedgeDCs2Pred( &(pacWedgeList->at(uiIdx)), piPred, uiPredStride, iDC1, iDC2 );
-
-    Dist uiActDist = RDO_DIST_MAX;
-    if( m_pcRdCost->getUseVSO() )
-    {
-      uiActDist = m_pcRdCost->getDistVS( pcCU, 0, piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, false, 0 );
-    }
-    else
-    {
-      uiActDist = m_pcRdCost->getDistPart( piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, DF_SAD );
-    }
-
-    if( uiActDist < uiBestDist || uiBestDist == RDO_DIST_MAX )
-    {
-      uiBestDist   = uiActDist;
-      uiBestTabIdx = uiIdx;
-    }
-  }
-  ruiTabIdx = uiBestTabIdx;
-
-  cPredYuv.destroy();
-  return;
-}
-
-Void TEncSearch::xSearchWedgePredDirMinDist( TComDataCU* pcCU, UInt uiAbsPtIdx, WedgeList* pacWedgeList, Pel* piRef, UInt uiRefStride, UInt uiWidth, UInt uiHeight, UInt& ruiTabIdx, Int& riWedgeDeltaEnd )
-{
-  ruiTabIdx       = 0;
-  riWedgeDeltaEnd = 0;
-
-  // local pred buffer
-  TComYuv cPredYuv;
-  cPredYuv.create( uiWidth, uiHeight );
-  cPredYuv.clear();
-
-  UInt uiPredStride = cPredYuv.getStride();
-  Pel* piPred       = cPredYuv.getLumaAddr();
-
-  Int  iDC1 = 0;
-  Int  iDC2 = 0;
-
-  // regular wedge search
-  Dist uiBestDist    = RDO_DIST_MAX;
-  UInt uiBestTabIdx  = 0;
-  Int  iBestDeltaEnd = 0;
-
-  UInt uiIdx = 0;
-  for( Int iTestDeltaEnd = -DMM_WEDGE_PREDDIR_DELTAEND_MAX; iTestDeltaEnd <= DMM_WEDGE_PREDDIR_DELTAEND_MAX; iTestDeltaEnd++ )
-  {
-    uiIdx = getBestContinueWedge( pcCU, uiAbsPtIdx, uiWidth, uiHeight, iTestDeltaEnd );
-    calcWedgeDCs       ( &(pacWedgeList->at(uiIdx)), piRef,  uiRefStride,  iDC1, iDC2 );
-    assignWedgeDCs2Pred( &(pacWedgeList->at(uiIdx)), piPred, uiPredStride, iDC1, iDC2 );
-
-    Dist uiActDist = RDO_DIST_MAX;
-    if( m_pcRdCost->getUseVSO() )
-    {
-      uiActDist = m_pcRdCost->getDistVS( pcCU, 0, piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, false, 0 );
-    }
-    else
-    {
-      uiActDist = m_pcRdCost->getDistPart( piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, DF_SAD );
-    }
-
-    if( uiActDist < uiBestDist || uiBestDist == RDO_DIST_MAX )
-    {
-      uiBestDist    = uiActDist;
-      uiBestTabIdx  = uiIdx;
-      iBestDeltaEnd = iTestDeltaEnd;
-    }
-    else if( uiIdx == uiBestTabIdx && abs(iTestDeltaEnd) < abs(iBestDeltaEnd) )
-    {
-      iBestDeltaEnd = iTestDeltaEnd;
-    }
-  }
-
-  ruiTabIdx       = uiBestTabIdx;
-  riWedgeDeltaEnd = iBestDeltaEnd;
-
-  cPredYuv.destroy();
-  return;
-}
-
-Bool TEncSearch::predIntraLumaDMMAvailable( UInt uiMode, Bool bAboveAvail, Bool bLeftAvail, UInt uiWidth, UInt uiHeight, TComDataCU* pcCU, UInt uiAbsPartIdx )
-{
-  if( uiMode <= MAX_MODE_ID_INTRA_DIR ) return true;
-
-  Bool bDMMAvailable = m_pcEncCfg->getUseDepthModelModes();
-
-  if( uiMode == DMM_WEDGE_FULL_IDX        ||
-      uiMode == DMM_WEDGE_FULL_D_IDX      ||
-      uiMode == DMM_WEDGE_PREDTEX_IDX     ||
-      uiMode == DMM_WEDGE_PREDTEX_D_IDX   ||
-      uiMode == DMM_CONTOUR_PREDTEX_IDX   ||
-      uiMode == DMM_CONTOUR_PREDTEX_D_IDX ||
-      uiMode == DMM_WEDGE_PREDDIR_IDX     ||
-      uiMode == DMM_WEDGE_PREDDIR_D_IDX     )
-  {
-    if( (uiWidth != uiHeight) || (uiWidth < DMM_WEDGEMODEL_MIN_SIZE) || (uiWidth > DMM_WEDGEMODEL_MAX_SIZE) )
-    {
-      bDMMAvailable = false;
-    }
-  }
-
-  return bDMMAvailable;
-}
-
+#if HHI_DMM_WEDGE_INTRA
 Void TEncSearch::findWedgeFullMinDist( TComDataCU*  pcCU,
-                                       UInt         uiAbsPtIdx,
-                                       Pel*         piOrig,
-                                       Pel*         piPredic,
-                                       UInt         uiStride,
-                                       UInt         uiWidth,
-                                       UInt         uiHeight,
-                                       UInt&        ruiTabIdx,
-                                       Int&         riDeltaDC1,
-                                       Int&         riDeltaDC2,
-                                       Bool         bAbove,
-                                       Bool         bLeft,
-                                       WedgeDist    eWedgeDist
-                                     )
-{
-  assert( uiWidth >= DMM_WEDGEMODEL_MIN_SIZE && uiWidth <= DMM_WEDGEMODEL_MAX_SIZE );
-
-  WedgeList* pacWedgeList = &g_aacWedgeLists[(g_aucConvertToBit[uiWidth])];
-  xSearchWedgeFullMinDist( pcCU, uiAbsPtIdx, pacWedgeList, piOrig, uiStride, uiWidth, uiHeight, ruiTabIdx );
-
-  TComWedgelet* pcBestWedgelet = &(pacWedgeList->at(ruiTabIdx));
-  xGetWedgeDeltaDCsMinDist( pcBestWedgelet, pcCU, uiAbsPtIdx, piOrig, piPredic, uiStride, uiWidth, uiHeight, riDeltaDC1, riDeltaDC2, bAbove, bLeft );
-}
-
-Void TEncSearch::findWedgePredDirMinDist( TComDataCU*  pcCU,
-                                          UInt         uiAbsPtIdx,
-                                          Pel*         piOrig,
-                                          Pel*         piPredic,
-                                          UInt         uiStride,
-                                          UInt         uiWidth,
-                                          UInt         uiHeight,
-                                          UInt&        ruiTabIdx,
-                                          Int&         riWedgeDeltaEnd,
-                                          Int&         riDeltaDC1,
-                                          Int&         riDeltaDC2,
-                                          Bool         bAbove,
-                                          Bool         bLeft,
-                                          WedgeDist    eWedgeDist )
-{
-  assert( uiWidth >= DMM_WEDGEMODEL_MIN_SIZE && uiWidth <= DMM_WEDGEMODEL_MAX_SIZE );
-  WedgeList* pacWedgeList = &g_aacWedgeLists[(g_aucConvertToBit[uiWidth])];
-
-  ruiTabIdx       = 0;
-  riWedgeDeltaEnd = 0;
-
-  xSearchWedgePredDirMinDist( pcCU, uiAbsPtIdx, pacWedgeList, piOrig, uiStride, uiWidth, uiHeight, ruiTabIdx, riWedgeDeltaEnd );
-
-  TComWedgelet* pcBestWedgelet = &(pacWedgeList->at(ruiTabIdx));
-  xGetWedgeDeltaDCsMinDist( pcBestWedgelet, pcCU, uiAbsPtIdx, piOrig, piPredic, uiStride, uiWidth, uiHeight, riDeltaDC1, riDeltaDC2, bAbove, bLeft );
-}
-
-Void TEncSearch::findWedgeTexMinDist( TComDataCU*  pcCU,
                                       UInt         uiAbsPtIdx,
                                       Pel*         piOrig,
@@ -2763,10 +2434,174 @@
                                       Bool         bLeft,
                                       WedgeDist    eWedgeDist
-                                    )
-  {
+                                      )
+{
+  assert( uiWidth >= DMM_WEDGEMODEL_MIN_SIZE && uiWidth <= DMM_WEDGEMODEL_MAX_SIZE );
+
+  WedgeList* pacWedgeList = &g_aacWedgeLists[(g_aucConvertToBit[uiWidth])];
+  xSearchWedgeFullMinDist( pcCU, uiAbsPtIdx, pacWedgeList, piOrig, uiStride, uiWidth, uiHeight, ruiTabIdx );
+
+  TComWedgelet* pcBestWedgelet = &(pacWedgeList->at(ruiTabIdx));
+  xGetWedgeDeltaDCsMinDist( pcBestWedgelet, pcCU, uiAbsPtIdx, piOrig, piPredic, uiStride, uiWidth, uiHeight, riDeltaDC1, riDeltaDC2, bAbove, bLeft );
+}
+
+Void TEncSearch::xSearchWedgeFullMinDist( TComDataCU* pcCU, UInt uiAbsPtIdx, WedgeList* pacWedgeList, Pel* piRef, UInt uiRefStride, UInt uiWidth, UInt uiHeight, UInt& ruiTabIdx )
+{
+  ruiTabIdx = 0;
+
+  // local pred buffer
+  TComYuv cPredYuv;
+  cPredYuv.create( uiWidth, uiHeight );
+  cPredYuv.clear();
+
+  UInt uiPredStride = cPredYuv.getStride();
+  Pel* piPred       = cPredYuv.getLumaAddr();
+
+  Int  iDC1 = 0;
+  Int  iDC2 = 0;
+  // regular wedge search
+  Dist uiBestDist   = RDO_DIST_MAX;
+  UInt uiBestTabIdx = 0;
+
+  for( UInt uiIdx = 0; uiIdx < pacWedgeList->size(); uiIdx++ )
+  {
+    calcWedgeDCs       ( &(pacWedgeList->at(uiIdx)), piRef,  uiRefStride,  iDC1, iDC2 );
+    assignWedgeDCs2Pred( &(pacWedgeList->at(uiIdx)), piPred, uiPredStride, iDC1, iDC2 );
+
+    Dist uiActDist = RDO_DIST_MAX;
+#if HHI_VSO
+    if( m_pcRdCost->getUseVSO() )
+    {
+      uiActDist = m_pcRdCost->getDistVS( pcCU, 0, piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, false, 0 );
+    }
+    else
+    {
+      uiActDist = m_pcRdCost->getDistPart( piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, DF_SAD );
+    }
+#else
+    uiActDist = m_pcRdCost->getDistPart( piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, DF_SAD );
+#endif
+
+    if( uiActDist < uiBestDist || uiBestDist == RDO_DIST_MAX )
+    {
+      uiBestDist   = uiActDist;
+      uiBestTabIdx = uiIdx;
+    }
+  }
+  ruiTabIdx = uiBestTabIdx;
+
+  cPredYuv.destroy();
+  return;
+}
+
+Void TEncSearch::findWedgePredDirMinDist( TComDataCU*  pcCU,
+                                         UInt         uiAbsPtIdx,
+                                         Pel*         piOrig,
+                                         Pel*         piPredic,
+                                         UInt         uiStride,
+                                         UInt         uiWidth,
+                                         UInt         uiHeight,
+                                         UInt&        ruiTabIdx,
+                                         Int&         riWedgeDeltaEnd,
+                                         Int&         riDeltaDC1,
+                                         Int&         riDeltaDC2,
+                                         Bool         bAbove,
+                                         Bool         bLeft,
+                                         WedgeDist    eWedgeDist )
+{
   assert( uiWidth >= DMM_WEDGEMODEL_MIN_SIZE && uiWidth <= DMM_WEDGEMODEL_MAX_SIZE );
   WedgeList* pacWedgeList = &g_aacWedgeLists[(g_aucConvertToBit[uiWidth])];
 
-  ruiTabIdx = getBestWedgeFromText( pcCU, uiAbsPtIdx, uiWidth, uiHeight );
+  ruiTabIdx       = 0;
+  riWedgeDeltaEnd = 0;
+
+  xSearchWedgePredDirMinDist( pcCU, uiAbsPtIdx, pacWedgeList, piOrig, uiStride, uiWidth, uiHeight, ruiTabIdx, riWedgeDeltaEnd );
+
+  TComWedgelet* pcBestWedgelet = &(pacWedgeList->at(ruiTabIdx));
+  xGetWedgeDeltaDCsMinDist( pcBestWedgelet, pcCU, uiAbsPtIdx, piOrig, piPredic, uiStride, uiWidth, uiHeight, riDeltaDC1, riDeltaDC2, bAbove, bLeft );
+}
+
+Void TEncSearch::xSearchWedgePredDirMinDist( TComDataCU* pcCU, UInt uiAbsPtIdx, WedgeList* pacWedgeList, Pel* piRef, UInt uiRefStride, UInt uiWidth, UInt uiHeight, UInt& ruiTabIdx, Int& riWedgeDeltaEnd )
+{
+  ruiTabIdx       = 0;
+  riWedgeDeltaEnd = 0;
+
+  // local pred buffer
+  TComYuv cPredYuv;
+  cPredYuv.create( uiWidth, uiHeight );
+  cPredYuv.clear();
+
+  UInt uiPredStride = cPredYuv.getStride();
+  Pel* piPred       = cPredYuv.getLumaAddr();
+
+  Int  iDC1 = 0;
+  Int  iDC2 = 0;
+
+  // regular wedge search
+  Dist uiBestDist    = RDO_DIST_MAX;
+  UInt uiBestTabIdx  = 0;
+  Int  iBestDeltaEnd = 0;
+
+  UInt uiIdx = 0;
+  for( Int iTestDeltaEnd = -DMM_WEDGE_PREDDIR_DELTAEND_MAX; iTestDeltaEnd <= DMM_WEDGE_PREDDIR_DELTAEND_MAX; iTestDeltaEnd++ )
+  {
+    uiIdx = getBestContinueWedge( pcCU, uiAbsPtIdx, uiWidth, uiHeight, iTestDeltaEnd );
+    calcWedgeDCs       ( &(pacWedgeList->at(uiIdx)), piRef,  uiRefStride,  iDC1, iDC2 );
+    assignWedgeDCs2Pred( &(pacWedgeList->at(uiIdx)), piPred, uiPredStride, iDC1, iDC2 );
+
+    Dist uiActDist = RDO_DIST_MAX;
+#if HHI_VSO
+    if( m_pcRdCost->getUseVSO() )
+    {
+      uiActDist = m_pcRdCost->getDistVS( pcCU, 0, piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, false, 0 );
+    }
+    else
+    {
+      uiActDist = m_pcRdCost->getDistPart( piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, DF_SAD );
+    }
+#else
+    uiActDist = m_pcRdCost->getDistPart( piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, DF_SAD );
+#endif
+
+    if( uiActDist < uiBestDist || uiBestDist == RDO_DIST_MAX )
+    {
+      uiBestDist    = uiActDist;
+      uiBestTabIdx  = uiIdx;
+      iBestDeltaEnd = iTestDeltaEnd;
+    }
+    else if( uiIdx == uiBestTabIdx && abs(iTestDeltaEnd) < abs(iBestDeltaEnd) )
+    {
+      iBestDeltaEnd = iTestDeltaEnd;
+    }
+  }
+
+  ruiTabIdx       = uiBestTabIdx;
+  riWedgeDeltaEnd = iBestDeltaEnd;
+
+  cPredYuv.destroy();
+  return;
+}
+#endif
+
+#if HHI_DMM_PRED_TEX
+Void TEncSearch::findWedgeTexMinDist( TComDataCU*  pcCU, 
+                                      UInt         uiAbsPtIdx, 
+                                      Pel*         piOrig, 
+                                      Pel*         piPredic, 
+                                      UInt         uiStride, 
+                                      UInt         uiWidth, 
+                                      UInt         uiHeight, 
+                                      UInt&        ruiTabIdx, 
+                                      Int&         riDeltaDC1, 
+                                      Int&         riDeltaDC2, 
+                                      Bool         bAbove, 
+                                      Bool         bLeft, 
+                                      WedgeDist    eWedgeDist,
+                                      Pel*         piTextureRef
+                                    )
+  {
+  assert( uiWidth >= DMM_WEDGEMODEL_MIN_SIZE && uiWidth <= DMM_WEDGEMODEL_MAX_SIZE );
+  WedgeList* pacWedgeList = &g_aacWedgeLists[(g_aucConvertToBit[uiWidth])];
+
+  ruiTabIdx = getBestWedgeFromText( pcCU, uiAbsPtIdx, uiWidth, uiHeight, eWedgeDist, piTextureRef );
 
   TComWedgelet* pcBestWedgelet = &(pacWedgeList->at(ruiTabIdx));
@@ -2784,9 +2619,10 @@
                                      Int&         riDeltaDC2,
                                      Bool         bAbove,
-                                     Bool         bLeft )
+                                     Bool         bLeft,
+                                     Pel*         piTextureRef )
 {
   // get contour pattern
   TComWedgelet* pcContourWedge = new TComWedgelet( uiWidth, uiHeight );
-  getBestContourFromText( pcCU, uiAbsPtIdx, uiWidth, uiHeight, pcContourWedge );
+  getBestContourFromText( pcCU, uiAbsPtIdx, uiWidth, uiHeight, pcContourWedge, piTextureRef );
 
   xGetWedgeDeltaDCsMinDist( pcContourWedge, pcCU, uiAbsPtIdx, piOrig, piPredic, uiStride, uiWidth, uiHeight, riDeltaDC1, riDeltaDC2, bAbove, bLeft );
@@ -2795,5 +2631,6 @@
   delete pcContourWedge;
 }
-
+#endif
+#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
 Void TEncSearch::xGetWedgeDeltaDCsMinDist( TComWedgelet* pcWedgelet,
                                            TComDataCU*   pcCU,
@@ -2824,4 +2661,5 @@
   riDeltaDC2 = iDC2 - iPredDC2;
 
+#if HHI_VSO
   if( m_pcRdCost->getUseVSO() )
   {
@@ -2875,7 +2713,43 @@
     riDeltaDC2 = iFullDeltaDC2;
   }
+#endif
 
   xDeltaDCQuantScaleDown( pcCU, riDeltaDC1 );
   xDeltaDCQuantScaleDown( pcCU, riDeltaDC2 );
+}
+
+Bool TEncSearch::predIntraLumaDMMAvailable( UInt uiMode, UInt uiWidth, UInt uiHeight )
+{
+  if( uiMode <= MAX_MODE_ID_INTRA_DIR ) return true;
+
+  Bool bDMMAvailable = m_pcEncCfg->getUseDMM();
+
+#if HHI_DMM_WEDGE_INTRA
+  if( uiMode == DMM_WEDGE_FULL_IDX        ||
+      uiMode == DMM_WEDGE_FULL_D_IDX      ||
+      uiMode == DMM_WEDGE_PREDDIR_IDX     ||
+      uiMode == DMM_WEDGE_PREDDIR_D_IDX )
+  {
+    if( (uiWidth != uiHeight) || (uiWidth < DMM_WEDGEMODEL_MIN_SIZE) || (uiWidth > DMM_WEDGEMODEL_MAX_SIZE) || ( ( uiMode == DMM_WEDGE_PREDDIR_IDX || uiMode == DMM_WEDGE_PREDDIR_D_IDX ) && uiWidth == 4 ) )
+    {
+      bDMMAvailable = false;
+    }
+  }
+#endif
+#if HHI_DMM_PRED_TEX
+  if( uiMode == DMM_WEDGE_PREDTEX_IDX     ||
+      uiMode == DMM_WEDGE_PREDTEX_D_IDX   ||
+      uiMode == DMM_CONTOUR_PREDTEX_IDX   ||
+      uiMode == DMM_CONTOUR_PREDTEX_D_IDX )
+  {
+    if( (uiWidth != uiHeight) || (uiWidth < DMM_WEDGEMODEL_MIN_SIZE) || (uiWidth > DMM_WEDGEMODEL_MAX_SIZE) || ( ( uiMode == DMM_CONTOUR_PREDTEX_IDX || uiMode == DMM_CONTOUR_PREDTEX_D_IDX ) && uiWidth == 4 ) )
+    {
+      bDMMAvailable = false;
+    }
+  }
+
+#endif
+
+  return bDMMAvailable;
 }
 
@@ -4033,21 +3907,16 @@
   uiCost = ruiDist + m_pcRdCost->getCost( m_auiMVPIdxCost[iMVPIdx][iMVPNum] );
 #else
-//GT VSO
+#if HHI_VSO
   if ( false /*m_pcRdCost->getUseVSO()*/ ) // GT: currently disabled
   {
-  #if GERHARD_VQM_XCHECK
-    UInt uiCost1 = m_pcRdCost->getDistVS  ( pcCU, uiPartAddr,  pcTemplateCand->getLumaAddr(uiPartAddr), pcTemplateCand->getStride(), pcOrgYuv->getLumaAddr(uiPartAddr), pcOrgYuv->getStride(), iSizeX, iSizeY, true, 0);
-    UInt uiCost2 = m_pcRdCost->getDistPart( pcTemplateCand->getLumaAddr(uiPartAddr), pcTemplateCand->getStride(), pcOrgYuv->getLumaAddr(uiPartAddr), pcOrgYuv->getStride(), iSizeX, iSizeY, DF_SAD );
-    assert(uiCost1 == uiCost2);
-  #endif
     uiCost = m_pcRdCost->getDistVS  ( pcCU, uiPartAddr,  pcTemplateCand->getLumaAddr(uiPartAddr), pcTemplateCand->getStride(), pcOrgYuv->getLumaAddr(uiPartAddr), pcOrgYuv->getStride(), iSizeX, iSizeY, true, 0);
     uiCost = (UInt) m_pcRdCost->calcRdCostVSO( m_auiMVPIdxCost[iMVPIdx][iMVPNum], uiCost, false, DF_SAD );
   }
   else
+#endif
   {
     uiCost = m_pcRdCost->getDistPart( pcTemplateCand->getLumaAddr(uiPartAddr), pcTemplateCand->getStride(), pcOrgYuv->getLumaAddr(uiPartAddr), pcOrgYuv->getStride(), iSizeX, iSizeY, DF_SAD );
     uiCost = (UInt) m_pcRdCost->calcRdCost( m_auiMVPIdxCost[iMVPIdx][iMVPNum], uiCost, false, DF_SAD );
   }
-//GT VSO end
 #endif
   return uiCost;
@@ -4123,5 +3992,5 @@
 
   m_pcRdCost->setPredictor  ( *pcMvPred );
-#if MW_DEPTH_MAP_INTERP_FILTER == 2 && MW_FULL_PEL_DEPTH_MAP_MV_SIGNALLING
+#if HHI_FULL_PEL_DEPTH_MAP_MV_ACC
   if( pcCU->getSlice()->getSPS()->isDepth() )
     m_pcRdCost->setCostScale  ( 0 );
@@ -4130,8 +3999,9 @@
   m_pcRdCost->setCostScale  ( 2 );
 
+#if HHI_INTER_VIEW_MOTION_PRED
   { // init inter-view regularization
     TComMv  cOrgDepthMapMv;
     Bool    bMultiviewReg = pcCU->getIViewOrgDepthMvPred( iPartIdx, eRefPicList, iRefIdxPred, cOrgDepthMapMv );
-#if MW_DEPTH_MAP_INTERP_FILTER == 2 && MW_FULL_PEL_DEPTH_MAP_MV_SIGNALLING
+#if HHI_FULL_PEL_DEPTH_MAP_MV_ACC
     if( bMultiviewReg && pcCU->getSlice()->getSPS()->isDepth() )
     {
@@ -4146,4 +4016,5 @@
     }
   }
+#endif
 
   //  Do integer search
@@ -4179,5 +4050,5 @@
 
   m_pcRdCost->getMotionCost( 1, 0 );
-#if MW_DEPTH_MAP_INTERP_FILTER == 2 && MW_FULL_PEL_DEPTH_MAP_MV_SIGNALLING
+#if HHI_FULL_PEL_DEPTH_MAP_MV_ACC
   if( ! pcCU->getSlice()->getSPS()->isDepth() )
   {
@@ -4203,10 +4074,10 @@
   rcMv += (cMvHalf <<= 1);
   rcMv +=  cMvQter;
-#if MW_DEPTH_MAP_INTERP_FILTER == 2 && MW_FULL_PEL_DEPTH_MAP_MV_SIGNALLING
+#if HHI_FULL_PEL_DEPTH_MAP_MV_ACC
   }
 #endif
 
   UInt uiMvBits = m_pcRdCost->getBits( rcMv.getHor(), rcMv.getVer() );
-#if MW_DEPTH_MAP_INTERP_FILTER == 2 && MW_FULL_PEL_DEPTH_MAP_MV_SIGNALLING
+#if HHI_FULL_PEL_DEPTH_MAP_MV_ACC
   if( pcCU->getSlice()->getSPS()->isDepth() )
     ruiCost += m_pcRdCost->getCost( uiMvBits );
@@ -4221,5 +4092,5 @@
 {
   Int  iMvShift = 2;
-#if MW_DEPTH_MAP_INTERP_FILTER == 2 && MW_FULL_PEL_DEPTH_MAP_MV_SIGNALLING
+#if HHI_FULL_PEL_DEPTH_MAP_MV_ACC
   if( pcCU->getSlice()->getSPS()->isDepth() )
     iMvShift = 0;
@@ -4394,5 +4265,5 @@
   UInt uiSearchRange = m_iSearchRange;
   pcCU->clipMv( rcMv );
-#if MW_DEPTH_MAP_INTERP_FILTER == 2 && MW_FULL_PEL_DEPTH_MAP_MV_SIGNALLING
+#if HHI_FULL_PEL_DEPTH_MAP_MV_ACC
   if( ! pcCU->getSlice()->getSPS()->isDepth() )
 #endif
@@ -4414,5 +4285,5 @@
       TComMv cMv = m_acMvPredictors[index];
       pcCU->clipMv( cMv );
-#if MW_DEPTH_MAP_INTERP_FILTER == 2 && MW_FULL_PEL_DEPTH_MAP_MV_SIGNALLING
+#if HHI_FULL_PEL_DEPTH_MAP_MV_ACC
       if( ! pcCU->getSlice()->getSPS()->isDepth() )
 #endif
@@ -4726,4 +4597,5 @@
     pcYuvPred->copyToPartYuv( rpcYuvRec, 0 );
 
+#if HHI_INTER_VIEW_RESIDUAL_PRED
     // add residual prediction
     if( pcCU->getResPredFlag( 0 ) )
@@ -4732,16 +4604,13 @@
       rpcYuvRec->clip( uiWidth, uiHeight );
     }
-
-    //GT VSO
+#endif
+
+#if HHI_VSO    
     if ( m_pcRdCost->getUseVSO() )
     {
-  #if GERHARD_VQM_XCHECK
-      UInt uiDistortion1 = m_pcRdCost->getDistPart( rpcYuvRec->getLumaAddr(), rpcYuvRec->getStride(),  pcYuvOrg->getLumaAddr(), pcYuvOrg->getStride(),  uiWidth,      uiHeight );
-      UInt uiDistortion2 = m_pcRdCost->getDistVS( pcCU, 0, rpcYuvRec->getLumaAddr(), rpcYuvRec->getStride(),  pcYuvOrg->getLumaAddr(), pcYuvOrg->getStride(),  uiWidth,      uiHeight     , false, 0 );
-      assert( uiDistortion1 == uiDistortion2 );
-  #endif
       uiDistortion = m_pcRdCost->getDistVS( pcCU, 0, rpcYuvRec->getLumaAddr(), rpcYuvRec->getStride(),  pcYuvOrg->getLumaAddr(), pcYuvOrg->getStride(),  uiWidth,      uiHeight     , false, 0 );
     }
     else
+#endif
     {
       uiDistortion = m_pcRdCost->getDistPart( rpcYuvRec->getLumaAddr(), rpcYuvRec->getStride(),  pcYuvOrg->getLumaAddr(), pcYuvOrg->getStride(),  uiWidth,      uiHeight      )
@@ -4749,5 +4618,5 @@
       + m_pcRdCost->getDistPart( rpcYuvRec->getCrAddr(),   rpcYuvRec->getCStride(), pcYuvOrg->getCrAddr(),   pcYuvOrg->getCStride(), uiWidth >> 1, uiHeight >> 1 );
     }
-    //GT VSO end
+    
 
     if( m_bUseSBACRD )
@@ -4755,5 +4624,5 @@
 
     m_pcEntropyCoder->resetBits();
-#if MW_MVI_SIGNALLING_MODE == 1
+#if HHI_MPI
     if( pcCU->getTextureModeDepth( 0 ) == -1 )
     {
@@ -4772,6 +4641,8 @@
     }
 #endif
+#if HHI_INTER_VIEW_RESIDUAL_PRED
     m_pcEntropyCoder->encodeResPredFlag( pcCU, 0, 0, true );
-#if MW_MVI_SIGNALLING_MODE == 1
+#endif
+#if HHI_MPI
     }
 #endif
@@ -4780,5 +4651,6 @@
     pcCU->getTotalBits()       = uiBits;
     pcCU->getTotalDistortion() = uiDistortion;
-    //GT VSO
+
+#if HHI_VSO
     if ( m_pcRdCost->getUseLambdaScaleVSO() )
     {
@@ -4786,8 +4658,8 @@
     }
     else
+#endif
     {
       pcCU->getTotalCost() = m_pcRdCost->calcRdCost( uiBits, uiDistortion );
     }
-    //GT VSO end
 
     if( m_bUseSBACRD )
@@ -4797,4 +4669,5 @@
     pcCU->setTrIdxSubParts( 0, 0, pcCU->getDepth(0) );
 
+#if HHI_VSO
     // set Model
     if( m_pcRdCost->getUseRenModel() )
@@ -4804,4 +4677,5 @@
       m_pcRdCost->setRenModelData( pcCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );
     }
+#endif
 
     return;
@@ -4828,4 +4702,5 @@
   pcYuvPred->copyToPartYuv( rpcYuvRec, 0 );
 
+#if HHI_INTER_VIEW_RESIDUAL_PRED
   // add residual prediction
   if( pcCU->getResPredFlag( 0 ) )
@@ -4833,5 +4708,6 @@
     rpcYuvRec->add( rpcYuvResPrd, uiWidth, uiHeight );
   }
-  #if SB_INTERVIEW_SKIP
+#endif
+#if HHI_INTERVIEW_SKIP
   if( bSkipRes)
   {
@@ -4858,19 +4734,23 @@
 
     Dist uiZeroDistortion = 0;
-//GT VSO
+#if HHI_VSO
     if ( m_pcRdCost->getUseVSO() )
     {
       m_cYuvRecTemp.create( pcYuvPred->getWidth(), pcYuvPred->getHeight()  );
     }
+#endif
 
     xEstimateResidualQT( pcCU, 0, 0, pcYuvOrg, rpcYuvRec, rpcYuvResi,  pcCU->getDepth(0), dCost, uiBits, uiDistortion, &uiZeroDistortion );
 
+#if HHI_VSO
     if ( m_pcRdCost->getUseVSO() )
     {
       m_cYuvRecTemp.destroy();
     }
-//GT VSO end
+#endif
+
 
     double dZeroCost;
+#if HHI_VSO
     if( m_pcRdCost->getUseLambdaScaleVSO() )
     {
@@ -4878,4 +4758,5 @@
     }
     else
+#endif
     {
       dZeroCost = m_pcRdCost->calcRdCost( 0, uiZeroDistortion );
@@ -4926,4 +4807,5 @@
 
     Double dExactCost;
+#if HHI_VSO
     if( m_pcRdCost->getUseLambdaScaleVSO() )
     {
@@ -4931,4 +4813,5 @@
     }
     else
+#endif
     {
       dExactCost = m_pcRdCost->calcRdCost( uiBits, uiDistortion );
@@ -4970,4 +4853,5 @@
     }
 
+#if HHI_VSO
     // reset Model
     if( m_pcRdCost->getUseRenModel() )
@@ -4977,4 +4861,5 @@
       m_pcRdCost->setRenModelData( pcCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );
     }
+#endif
   }
 
@@ -5002,15 +4887,11 @@
   // update with clipped distortion and cost (qp estimation loop uses unclipped values)
 
-  //GT VSO
+#if HHI_VSO
   if ( m_pcRdCost->getUseVSO() )
   {
-  #if GERHARD_VQM_XCHECK
-    UInt uiDistortionBest1 = m_pcRdCost->getDistVS  ( pcCU, 0, rpcYuvRec->getLumaAddr(), rpcYuvRec->getStride(),  pcYuvOrg->getLumaAddr(), pcYuvOrg->getStride(),  uiWidth,      uiHeight, false, 0    );
-    UInt uiDistortionBest2 = m_pcRdCost->getDistPart( rpcYuvRec->getLumaAddr(), rpcYuvRec->getStride(),  pcYuvOrg->getLumaAddr(), pcYuvOrg->getStride(),  uiWidth,      uiHeight      );
-    assert( uiDistortionBest1 == uiDistortionBest2 );
-  #endif
     uiDistortionBest = m_pcRdCost->getDistVS  ( pcCU, 0, rpcYuvRec->getLumaAddr(), rpcYuvRec->getStride(),  pcYuvOrg->getLumaAddr(), pcYuvOrg->getStride(),  uiWidth,      uiHeight, false, 0    );
   }
   else
+#endif
   {
     uiDistortionBest = m_pcRdCost->getDistPart( rpcYuvRec->getLumaAddr(), rpcYuvRec->getStride(),  pcYuvOrg->getLumaAddr(), pcYuvOrg->getStride(),  uiWidth,      uiHeight      )
@@ -5018,7 +4899,6 @@
     + m_pcRdCost->getDistPart( rpcYuvRec->getCrAddr(),   rpcYuvRec->getCStride(), pcYuvOrg->getCrAddr(),   pcYuvOrg->getCStride(), uiWidth >> 1, uiHeight >> 1 );
   }
-//GT VSO end
-
-//GT VSO
+
+#if HHI_VSO
   if ( m_pcRdCost->getUseLambdaScaleVSO() )
   {
@@ -5026,8 +4906,8 @@
   }
   else
+#endif
   {
     dCostBest = m_pcRdCost->calcRdCost( uiBitsBest, uiDistortionBest );
   }
-//GT VSO end
 
   pcCU->getTotalBits()       = uiBitsBest;
@@ -5044,4 +4924,5 @@
 
   // set Model
+#if HHI_VSO
   if( m_pcRdCost->getUseRenModel() )
   {
@@ -5050,4 +4931,5 @@
     m_pcRdCost->setRenModelData( pcCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );
   }
+#endif
 }
 
@@ -5167,15 +5049,11 @@
     ::memset( m_pTempPel, 0, sizeof( Pel ) * uiNumSamplesLuma ); // not necessary needed for inside of recursion (only at the beginning)
 
+#if HHI_VSO
     if ( m_pcRdCost->getUseVSO() )
     {
       uiDistY = m_pcRdCost->getDistVS  ( pcCU, uiAbsPartIdx, pcPred->getLumaAddr( uiAbsPartIdx ), pcPred->getStride(), pcOrg->getLumaAddr( uiAbsPartIdx), pcOrg->getStride(), 1<< uiLog2TrSize, 1<< uiLog2TrSize, false, 0 ); // initialized with zero residual distortion
-
-  #if GERHARD_VQM_XCHECK
-      UInt uiDist1 = m_pcRdCost->getDistPart( pcOrg->getLumaAddr( uiAbsPartIdx), pcOrg->getStride(), pcPred->getLumaAddr( uiAbsPartIdx ), pcPred->getStride(), 1<< uiLog2TrSize, 1<< uiLog2TrSize ); // initialized with zero residual distortion
-      UInt uiDist2  = m_pcRdCost->getDistPart( m_pTempPel, 1<< uiLog2TrSize, pcResi->getLumaAddr( uiAbsPartIdx ), pcResi->getStride(), 1<< uiLog2TrSize, 1<< uiLog2TrSize ); // initialized with zero residual distortion
-      assert( uiDist1 == uiDist2 );
-  #endif
     }
     else
+#endif
     {
 #if IBDI_DISTORTION
@@ -5185,5 +5063,5 @@
 #endif
     }
-//GT VSO end
+
 
     if ( puiZeroDist )
@@ -5203,5 +5081,5 @@
       Dist uiNonzeroDistY;
 
-      //GT VSO
+#if HHI_VSO      
       if ( m_pcRdCost->getUseVSO() )
       {
@@ -5209,25 +5087,16 @@
         uiNonzeroDistY = m_pcRdCost->getDistVS( pcCU, uiAbsPartIdx, m_cYuvRecTemp.getLumaAddr(uiAbsPartIdx), m_cYuvRecTemp.getStride(),
                                                 pcOrg->getLumaAddr( uiAbsPartIdx ), pcOrg->getStride(), 1<< uiLog2TrSize,   1<< uiLog2TrSize, false, 0 );
-
-  #if GERHARD_VQM_XCHECK
-        UInt uiDist1 = m_pcRdCost->getDistPart( m_cYuvRecTemp.getLumaAddr(uiAbsPartIdx), m_cYuvRecTemp.getStride(),
-                                                pcOrg->getLumaAddr( uiAbsPartIdx ), pcOrg->getStride(), 1<< uiLog2TrSize,    1<< uiLog2TrSize );
-
-        UInt uiDist2 = m_pcRdCost->getDistPart( m_pcQTTempTComYuv[uiQTTempAccessLayer].getLumaAddr( uiAbsPartIdx ), m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(),
-                                                pcResi->getLumaAddr( uiAbsPartIdx ), pcResi->getStride(), 1<< uiLog2TrSize,    1<< uiLog2TrSize );
-        assert( uiDist1 == uiDist2);
-  #endif
       }
       else
+#endif
       {
         uiNonzeroDistY = m_pcRdCost->getDistPart( m_pcQTTempTComYuv[uiQTTempAccessLayer].getLumaAddr( uiAbsPartIdx ), m_pcQTTempTComYuv[uiQTTempAccessLayer].getStride(),
                                                   pcResi->getLumaAddr( uiAbsPartIdx ), pcResi->getStride(), 1<< uiLog2TrSize,    1<< uiLog2TrSize );
       }
-      //GT VSO end
 
       Double dSingleCostY;
       Double dNullCostY;
 
-      //GT VSO
+#if HHI_VSO      
       if ( m_pcRdCost->getUseLambdaScaleVSO())
       {
@@ -5236,9 +5105,9 @@
       }
       else
+#endif
       {
         dSingleCostY = m_pcRdCost->calcRdCost( uiSingleBitsY, uiNonzeroDistY );
         dNullCostY   = m_pcRdCost->calcRdCost( 0, uiDistY );
       }
-      //GT VSO end
 
 
@@ -5406,5 +5275,5 @@
 
     uiSingleDist = uiDistY + uiDistU + uiDistV;
-//GT VSO
+#if HHI_VSO
     if ( m_pcRdCost->getUseLambdaScaleVSO())
     {
@@ -5412,8 +5281,8 @@
     }
     else
+#endif
     {
       dSingleCost = m_pcRdCost->calcRdCost( uiSingleBits, uiSingleDist );
     }
-//GT VSO end
   }
 
@@ -5467,5 +5336,5 @@
     uiSubdivBits = m_pcEntropyCoder->getNumberOfWrittenBits();
 
-//GT VSO
+#if HHI_VSO
     if ( m_pcRdCost->getUseLambdaScaleVSO())
     {
@@ -5473,8 +5342,8 @@
     }
     else
+#endif
     {
       dSubdivCost  = m_pcRdCost->calcRdCost( uiSubdivBits, uiSubdivDist );
     }
-//GT VSO end
 
     if( uiYCbf || uiUCbf || uiVCbf || !bCheckFull )
@@ -5495,4 +5364,5 @@
   }
 
+#if HHI_VSO
   if ( m_pcRdCost->getUseRenModel() )
   {
@@ -5515,6 +5385,8 @@
       uiSrcStride = pcPred->getStride  ();
     }
+
     m_pcRdCost->setRenModelData( pcCU, uiAbsPartIdx, piSrc, (Int) uiSrcStride, (Int) uiWidth, (Int) uiHeight );
   }
+#endif
 
   rdCost += dSingleCost;
@@ -5762,7 +5634,5 @@
   if ( pcCU->isSkipped( 0 ) )
   {
-#if MW_MVI_SIGNALLING_MODE == 0
-    assert( pcCU->getTextureModeDepth( 0 ) == -1 );
-#elif MW_MVI_SIGNALLING_MODE == 1
+#if HHI_MPI
     if( pcCU->getTextureModeDepth( 0 ) != -1 )
     {
@@ -5787,5 +5657,7 @@
     }
 #endif
+#if HHI_INTER_VIEW_RESIDUAL_PRED
     m_pcEntropyCoder->encodeResPredFlag( pcCU, 0, 0, true );
+#endif
     ruiBits += m_pcEntropyCoder->getNumberOfWrittenBits();
   }
@@ -5793,18 +5665,14 @@
   {
     m_pcEntropyCoder->resetBits();
-#if MW_MVI_SIGNALLING_MODE == 1
+#if HHI_MPI
     if( pcCU->getTextureModeDepth( 0 ) == -1 )
     {
 #endif
-    m_pcEntropyCoder->encodeSkipFlag ( pcCU, 0, true );
+      m_pcEntropyCoder->encodeSkipFlag ( pcCU, 0, true );
 #if HHI_MRG_SKIP
-    if (pcCU->getPredictionMode(0) == MODE_SKIP)
-    {
-      pcCU->setPredModeSubParts( MODE_INTER, 0, pcCU->getDepth(0) );
-    }
-#endif
-#if MW_MVI_SIGNALLING_MODE == 0
-    if( pcCU->getTextureModeDepth( 0 ) == -1 )
-    {
+      if (pcCU->getPredictionMode(0) == MODE_SKIP)
+      {
+        pcCU->setPredModeSubParts( MODE_INTER, 0, pcCU->getDepth(0) );
+      }
 #endif
       m_pcEntropyCoder->encodePredMode( pcCU, 0, true );
@@ -5812,6 +5680,10 @@
       m_pcEntropyCoder->encodePredInfo( pcCU, 0, true );
 
+#if HHI_INTER_VIEW_RESIDUAL_PRED
       m_pcEntropyCoder->encodeResPredFlag( pcCU, 0, 0, true );
-    }
+#endif
+#if HHI_MPI
+    }
+#endif
     m_pcEntropyCoder->encodeCoeff   ( pcCU, 0, pcCU->getDepth(0), pcCU->getWidth(0), pcCU->getHeight(0) );
 
Index: trunk/source/Lib/TLibEncoder/TEncSearch.h
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncSearch.h	(revision 2)
+++ trunk/source/Lib/TLibEncoder/TEncSearch.h	(revision 5)
@@ -1,2 +1,35 @@
+/* The copyright in this software is being made available under the BSD
+ * License, included below. This software may be subject to other third party
+ * and contributor rights, including patent rights, and no such rights are
+ * granted under this license.
+ *
+ * Copyright (c) 2010-2011, ISO/IEC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  * Neither the name of the ISO/IEC nor the names of its contributors may
+ *    be used to endorse or promote products derived from this software without
+ *    specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 
 
@@ -71,7 +104,7 @@
   
 
-//GT VSO
+#if HHI_VSO
   TComYuv         m_cYuvRecTemp; 
-//GT VSO end
+#endif
   
   // AMVP cost computation
@@ -104,5 +137,5 @@
   
 #if (!REFERENCE_SAMPLE_PADDING)
-#if HHI_DMM_INTRA
+#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
   Bool predIntraLumaDirAvailable( UInt uiMode, UInt uiWidthBit, Bool bAboveAvail, Bool bLeftAvail, UInt uiWidth, UInt uiHeight, TComDataCU* pcCU, UInt uiAbsPartIdx );
 #else
@@ -111,8 +144,9 @@
 #endif
 
-#if HHI_DMM_INTRA
+#if HHI_DMM_WEDGE_INTRA
   Void xSearchWedgeFullMinDist   ( TComDataCU* pcCU, UInt uiAbsPtIdx, WedgeList* pacWedgeList, Pel* piRef, UInt uiRefStride, UInt uiWidth, UInt uiHeight, UInt& ruiTabIdx );
   Void xSearchWedgePredDirMinDist( TComDataCU* pcCU, UInt uiAbsPtIdx, WedgeList* pacWedgeList, Pel* piRef, UInt uiRefStride, UInt uiWidth, UInt uiHeight, UInt& ruiTabIdx, Int& riWedgeDeltaEnd );
-
+#endif
+#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
   Void xGetWedgeDeltaDCsMinDist  ( TComWedgelet* pcWedgelet, 
                                    TComDataCU*   pcCU, 
@@ -170,12 +204,10 @@
                                   Dist        uiPreCalcDistC );
   
-#if HHI_DMM_INTRA
+#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
   Bool predIntraLumaDMMAvailable( UInt         uiMode, 
-                                  Bool         bAboveAvail, 
-                                  Bool         bLeftAvail, 
                                   UInt         uiWidth, 
-                                  UInt         uiHeight, 
-                                  TComDataCU*  pcCU, 
-                                  UInt         uiAbsPartIdx );
+                                  UInt         uiHeight );
+#endif
+#if HHI_DMM_WEDGE_INTRA
   Void findWedgeFullMinDist     ( TComDataCU*  pcCU, 
                                   UInt         uiAbsPtIdx,
@@ -205,4 +237,6 @@
                                   Bool         bLeft,
                                   WedgeDist    eWedgeDist );
+#endif
+#if HHI_DMM_PRED_TEX
   Void findWedgeTexMinDist      ( TComDataCU*  pcCU, 
                                   UInt         uiAbsPtIdx,
@@ -217,5 +251,7 @@
                                   Bool         bAbove,
                                   Bool         bLeft,
-                                  WedgeDist    eWedgeDist );
+                                  WedgeDist    eWedgeDist,
+                                  Pel*         piTextureRef = NULL );
+
   Void findContourPredTex       ( TComDataCU*  pcCU, 
                                   UInt         uiAbsPtIdx,
@@ -228,6 +264,6 @@
                                   Int&         riDeltaDC2,
                                   Bool         bAbove,
-                                  Bool         bLeft );
-
+                                  Bool         bLeft,
+                                  Pel*         piTextureRef = NULL );
 #endif
   
@@ -286,5 +322,6 @@
                                     Bool         bLuma,
                                     Bool         bChroma,
-                                    Bool         bRealCoeff );
+                                    Bool         bRealCoeff
+                                  );
   
   Void  xIntraCodingLumaBlk       ( TComDataCU*  pcCU,
@@ -295,19 +332,5 @@
                                     TComYuv*     pcResiYuv, 
                                     Dist&        ruiDist
-#if DMM_RES_CHECK_INTRA
-                                    ,
-                                    Bool         bCheckNoRes = false
-#endif
                                    );
-
-#if DMM_RES_CHECK_INTRA
-  Void  xSetIntraNoResi           ( TComDataCU* pcCU,
-                                    UInt        uiTrDepth,
-                                    UInt        uiAbsPartIdx,
-                                    TComYuv*    pcPredYuv, 
-                                    TComYuv*    pcResiYuv,
-                                    Bool        bNoRes
-                                   );
-#endif
 
   Void  xIntraCodingChromaBlk     ( TComDataCU*  pcCU,
Index: trunk/source/Lib/TLibEncoder/TEncSeqStructure.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncSeqStructure.cpp	(revision 2)
+++ trunk/source/Lib/TLibEncoder/TEncSeqStructure.cpp	(revision 5)
@@ -1,2 +1,35 @@
+/* The copyright in this software is being made available under the BSD
+ * License, included below. This software may be subject to other third party
+ * and contributor rights, including patent rights, and no such rights are
+ * granted under this license.
+ *
+ * Copyright (c) 2010-2011, ISO/IEC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  * Neither the name of the ISO/IEC nor the names of its contributors may
+ *    be used to endorse or promote products derived from this software without
+ *    specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 
 
Index: trunk/source/Lib/TLibEncoder/TEncSeqStructure.h
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncSeqStructure.h	(revision 2)
+++ trunk/source/Lib/TLibEncoder/TEncSeqStructure.h	(revision 5)
@@ -1,2 +1,35 @@
+/* The copyright in this software is being made available under the BSD
+ * License, included below. This software may be subject to other third party
+ * and contributor rights, including patent rights, and no such rights are
+ * granted under this license.
+ *
+ * Copyright (c) 2010-2011, ISO/IEC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  * Neither the name of the ISO/IEC nor the names of its contributors may
+ *    be used to endorse or promote products derived from this software without
+ *    specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 
 
@@ -8,5 +41,4 @@
 #include <vector>
 
-//SB
 #include <map>
 
Index: trunk/source/Lib/TLibEncoder/TEncSlice.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncSlice.cpp	(revision 2)
+++ trunk/source/Lib/TLibEncoder/TEncSlice.cpp	(revision 5)
@@ -1,2 +1,35 @@
+/* The copyright in this software is being made available under the BSD
+ * License, included below. This software may be subject to other third party
+ * and contributor rights, including patent rights, and no such rights are
+ * granted under this license.
+ *
+ * Copyright (c) 2010-2011, ISO/IEC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  * Neither the name of the ISO/IEC nor the names of its contributors may
+ *    be used to endorse or promote products derived from this software without
+ *    specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 
 
@@ -16,5 +49,5 @@
   m_apcPicYuvPred = NULL;
   m_apcPicYuvResi = NULL;
-  
+
   m_pdRdPicLambda = NULL;
   m_pdRdPicQp     = NULL;
@@ -34,5 +67,5 @@
     m_apcPicYuvPred->create( iWidth, iHeight, iMaxCUWidth, iMaxCUHeight, uhTotalDepth );
   }
-  
+
   // create residual picture
   if( m_apcPicYuvResi == NULL )
@@ -52,5 +85,5 @@
     m_apcPicYuvPred  = NULL;
   }
-  
+
   // destroy residual picture
   if ( m_apcPicYuvResi )
@@ -60,5 +93,5 @@
     m_apcPicYuvResi  = NULL;
   }
-  
+
   // free lambda and QP arrays
   if ( m_pdRdPicLambda ) { xFree( m_pdRdPicLambda ); m_pdRdPicLambda = NULL; }
@@ -71,10 +104,9 @@
   m_pcCfg             = pcEncTop;
   m_pcListPic         = pcEncTop->getListPic();
-  
-  //SB
+
   m_pcPicEncoder      = pcEncTop->getPicEncoder();
   m_pcCuEncoder       = pcEncTop->getCuEncoder();
   m_pcPredSearch      = pcEncTop->getPredSearch();
-  
+
   m_pcEntropyCoder    = pcEncTop->getEntropyCoder();
   m_pcCavlcCoder      = pcEncTop->getCavlcCoder();
@@ -82,10 +114,10 @@
   m_pcBinCABAC        = pcEncTop->getBinCABAC();
   m_pcTrQuant         = pcEncTop->getTrQuant();
-  
+
   m_pcBitCounter      = pcEncTop->getBitCounter();
   m_pcRdCost          = pcEncTop->getRdCost();
   m_pppcRDSbacCoder   = pcEncTop->getRDSbacCoder();
   m_pcRDGoOnSbacCoder = pcEncTop->getRDGoOnSbacCoder();
-  
+
   // create lambda and QP arrays
   m_pdRdPicLambda     = (Double*)xMalloc( Double, m_pcCfg->getDeltaQpRD() * 2 + 1 );
@@ -111,5 +143,5 @@
   Double dQP;
   Double dLambda;
-  
+
   rpcSlice = pcPic->getSlice(0);
   rpcSlice->setSliceBits(0);
@@ -117,15 +149,15 @@
   rpcSlice->initSlice();
   rpcSlice->setPOC( pcPic->getPOC() );
-  
+
   // slice type
   SliceType eSliceType  = pcPic->getSliceType()  ;
   rpcSlice->setSliceType    ( eSliceType );
-  
+
   // ------------------------------------------------------------------------------------------------------------------
   // Non-referenced frame marking
   // ------------------------------------------------------------------------------------------------------------------
-  
+
   rpcSlice->setReferenced(pcPic->getReferenced()) ;
-  
+
   // ------------------------------------------------------------------------------------------------------------------
   // QP setting
@@ -133,9 +165,9 @@
 
   Double dOrigQP = double(pcPic->getQP());
-  
+
   // ------------------------------------------------------------------------------------------------------------------
   // Lambda computation
   // ------------------------------------------------------------------------------------------------------------------
-  
+
   Int iQP;
 
@@ -149,5 +181,5 @@
     // compute QP value
     dQP = dOrigQP + ((iDQpIdx+1)>>1)*(iDQpIdx%2 ? -1 : 1);
-    
+
     // compute lambda value
     Int    NumberBFrames = ( m_pcCfg->getRateGOPSize() - 1 );
@@ -206,28 +238,30 @@
     // if hadamard is used in ME process
     if ( !m_pcCfg->getUseHADME() ) dLambda *= 0.95;
-    
+
     iQP = Max( MIN_QP, Min( MAX_QP, (Int)floor( dQP + 0.5 ) ) );
-    
+
     m_pdRdPicLambda[iDQpIdx] = dLambda;
     m_pdRdPicQp    [iDQpIdx] = dQP;
     m_piRdPicQp    [iDQpIdx] = iQP;
   }
-  
+
   // obtain dQP = 0 case
   dLambda = m_pdRdPicLambda[0];
   dQP     = m_pdRdPicQp    [0];
   iQP     = m_piRdPicQp    [0];
-  
+
   // store lambda
-//GT VSO
-  m_pcRdCost->setUseLambdaScaleVSO  ( (m_pcCfg->getUseVSO() ||  m_pcCfg->getForceLambdaScaleVSO()) && m_pcCfg->isDepthCoder()  );   
-  m_pcRdCost->setLambdaVSO( dLambda * m_pcCfg->getLambdaScaleVSO() ); 
-//GT VSO end
+#if HHI_VSO
+  m_pcRdCost->setUseLambdaScaleVSO  ( (m_pcCfg->getUseVSO() ||  m_pcCfg->getForceLambdaScaleVSO()) && m_pcCfg->isDepthCoder()  );
+  m_pcRdCost->setLambdaVSO( dLambda * m_pcCfg->getLambdaScaleVSO() );
+#endif
 
   m_pcRdCost ->setLambda      ( dLambda );
   m_pcTrQuant->setLambda      ( dLambda );
   rpcSlice   ->setLambda      ( dLambda );
+#if HHI_INTER_VIEW_MOTION_PRED
   m_pcRdCost ->setLambdaMVReg ( dLambda * m_pcCfg->getMultiviewMvRegLambdaScale() );
-  
+#endif
+
 //#if HB_LAMBDA_FOR_LDC
 //  // restore original slice type
@@ -237,16 +271,16 @@
 //  }
 //  eSliceType = (iPOCLast == 0 || uiPOCCurr % m_pcCfg->getIntraPeriod() == 0 || m_pcGOPEncoder->getGOPSize() == 0) ? I_SLICE : eSliceType;
-//  
+//
 //  rpcSlice->setSliceType        ( eSliceType );
 //#endif
-  
+
   rpcSlice->setSliceQp          ( iQP );
   rpcSlice->setSliceQpDelta     ( 0 );
   rpcSlice->setNumRefIdx        ( REF_PIC_LIST_0, eSliceType == I_SLICE ? 0 : pcPic->getNumRefs(REF_PIC_LIST_0) ) ;
   rpcSlice->setNumRefIdx        ( REF_PIC_LIST_1, eSliceType == I_SLICE ? 0 : pcPic->getNumRefs(REF_PIC_LIST_1) ) ;
-  
+
   rpcSlice->setSymbolMode       ( m_pcCfg->getSymbolMode());
   rpcSlice->setLoopFilterDisable( m_pcCfg->getLoopFilterDisable() );
-  
+
   rpcSlice->setDepth            ( 0 );
   rpcSlice->setViewIdx          ( pcPic->getViewIdx() );
@@ -256,5 +290,5 @@
   assert( m_apcPicYuvPred );
   assert( m_apcPicYuvResi );
-  
+
   pcPic->setPicYuvPred( m_apcPicYuvPred );
   pcPic->setPicYuvResi( m_apcPicYuvResi );
@@ -277,5 +311,5 @@
   Int iMaxSR = m_pcCfg->getSearchRange();
   Int iNumPredDir = pcSlice->isInterP() ? 1 : 2;
-  
+
   for (Int iDir = 0; iDir <= iNumPredDir; iDir++)
   {
@@ -299,5 +333,5 @@
   // if deltaQP RD is not used, simply return
   if ( m_pcCfg->getDeltaQpRD() == 0 ) return;
-  
+
   TComSlice* pcSlice        = rpcPic->getSlice(getSliceIdx());
   Double     dPicRdCostBest = MAX_DOUBLE;
@@ -306,5 +340,5 @@
   UInt64     uiPicBitsBest;
   UInt       uiQpIdxBest = 0;
-  
+
   Double dFrameLambda;
 #if FULL_NBIT
@@ -313,5 +347,5 @@
   Int    SHIFT_QP = 12;
 #endif
-  
+
   // set frame lambda
   if (m_pcCfg->getGOPSize() > 1)
@@ -324,6 +358,8 @@
   }
   m_pcRdCost      ->setFrameLambda(dFrameLambda);
-  m_pcRdCost      ->setFrameLambdaVSO( dFrameLambda * m_pcCfg->getLambdaScaleVSO() ); 
-  
+#if HHI_VSO
+  m_pcRdCost      ->setFrameLambdaVSO( dFrameLambda * m_pcCfg->getLambdaScaleVSO() );
+#endif
+
   // for each QP candidate
   for ( UInt uiQpIdx = 0; uiQpIdx < 2 * m_pcCfg->getDeltaQpRD() + 1; uiQpIdx++ )
@@ -333,18 +369,20 @@
     m_pcTrQuant   ->setLambda              ( m_pdRdPicLambda[uiQpIdx] );
     pcSlice       ->setLambda              ( m_pdRdPicLambda[uiQpIdx] );
+#if HHI_INTER_VIEW_MOTION_PRED
     m_pcRdCost    ->setLambdaMVReg         ( m_pdRdPicLambda[uiQpIdx] * m_pcCfg->getMultiviewMvRegLambdaScale() );
-    
+#endif
+
     // try compress
     compressSlice   ( rpcPic );
-    
+
     Double dPicRdCost;
     UInt64 uiPicDist        = m_uiPicDist;
     UInt64 uiALFBits        = 0;
-    
+
     m_pcPicEncoder->preLoopFilterPicAll( rpcPic, uiPicDist, uiALFBits );
-    
+
     // compute RD cost and choose the best
     dPicRdCost = m_pcRdCost->calcRdCost64( m_uiPicTotalBits + uiALFBits, uiPicDist, true, DF_SSE_FRAME);
-    
+
     if ( dPicRdCost < dPicRdCostBest )
     {
@@ -352,10 +390,10 @@
       dPicRdCostBest = dPicRdCost;
       dSumCURdCostBest = m_dPicRdCost;
-      
+
       uiPicBitsBest = m_uiPicTotalBits + uiALFBits;
       uiPicDistBest = uiPicDist;
     }
   }
-  
+
   // set best values
   pcSlice       ->setSliceQp             ( m_piRdPicQp    [uiQpIdxBest] );
@@ -363,5 +401,7 @@
   m_pcTrQuant   ->setLambda              ( m_pdRdPicLambda[uiQpIdxBest] );
   pcSlice       ->setLambda              ( m_pdRdPicLambda[uiQpIdxBest] );
+#if HHI_INTER_VIEW_MOTION_PRED
   m_pcRdCost    ->setLambdaMVReg         ( m_pdRdPicLambda[uiQpIdxBest] * m_pcCfg->getMultiviewMvRegLambdaScale() );
+#endif
 }
 
@@ -377,5 +417,5 @@
   TComSlice* pcSlice            = rpcPic->getSlice(getSliceIdx());
   xDetermineStartAndBoundingCUAddr ( uiStartCUAddr, uiBoundingCUAddr, rpcPic, false );
-  
+
 #ifdef WEIGHT_PRED
   //------------------------------------------------------------------------------
@@ -411,5 +451,5 @@
   m_dPicRdCost      = 0;
   m_uiPicDist       = 0;
-  
+
   // set entropy coder
   if( m_pcCfg->getUseSBACRD() )
@@ -430,9 +470,9 @@
     m_pcEntropyCoder->setBitstream    ( m_pcBitCounter );
   }
-  
+
   // initialize ALF parameters
   m_pcEntropyCoder->setAlfCtrl(false);
   m_pcEntropyCoder->setMaxAlfCtrlDepth(0); //unnecessary
-  
+
   // for every CU in slice
   for(  uiCUAddr = uiStartCUAddr; uiCUAddr < uiBoundingCUAddr; uiCUAddr++  )
@@ -443,5 +483,5 @@
     TComDataCU*& pcCU = rpcPic->getCU( uiCUAddr );
     pcCU->initCU( rpcPic, uiCUAddr );
-    
+
     // if RD based on SBAC is used
     if( m_pcCfg->getUseSBACRD() )
@@ -450,13 +490,13 @@
       m_pcEntropyCoder->setEntropyCoder ( m_pcRDGoOnSbacCoder, pcSlice );
       m_pcEntropyCoder->setBitstream    ( m_pcBitCounter );
-      
+
       // run CU encoder
       m_pcCuEncoder->compressCU( pcCU );
-      
+
       // restore entropy coder to an initial stage
       m_pcEntropyCoder->setEntropyCoder ( m_pppcRDSbacCoder[0][CI_CURR_BEST], pcSlice );
       m_pcEntropyCoder->setBitstream    ( m_pcBitCounter );
       pppcRDSbacCoder->setBinCountingEnableFlag( true );
-      
+
       m_pcCuEncoder->encodeCU( pcCU );
 
@@ -474,5 +514,5 @@
         break;
       }
-      
+
       UInt uiBinsCoded = pppcRDSbacCoder->getBinsCoded();
       if (m_pcCfg->getEntropySliceMode()==SHARP_MULTIPLE_CONSTRAINT_BASED_ENTROPY_SLICE && uiBinsCoded > m_pcCfg->getEntropySliceArgument())
@@ -494,5 +534,5 @@
       m_pcCavlcCoder ->setAdaptFlag(true);
       m_pcCuEncoder->encodeCU( pcCU );
-      
+
       uiBitsCoded += m_pcBitCounter->getNumberOfWrittenBits();
       if (m_pcCfg->getSliceMode()==AD_HOC_SLICES_FIXED_NUMBER_OF_BYTES_IN_SLICE && ( ( pcSlice->getSliceBits() + uiBitsCoded ) >> 3 ) > m_pcCfg->getSliceArgument())
@@ -521,5 +561,5 @@
       m_pcCavlcCoder ->setAdaptFlag(false);
     }
-    
+
     m_uiPicTotalBits += pcCU->getTotalBits();
     m_dPicRdCost     += pcCU->getTotalCost();
@@ -556,5 +596,5 @@
     m_pcEntropyCoder->resetEntropy();
   }
-  
+
   // set bitstream
   m_pcEntropyCoder->setBitstream( rpcBitstream );
@@ -588,5 +628,5 @@
 #if ENC_DEC_TRACE
     g_bJustDoIt = g_bEncDecTraceDisable;
-#endif    
+#endif
   }
 }
@@ -603,5 +643,5 @@
   UInt uiNumberOfCUsInFrame = rpcPic->getNumCUsInFrame();
   uiBoundingCUAddrSlice     = uiNumberOfCUsInFrame;
-  if (bEncodeSlice) 
+  if (bEncodeSlice)
   {
     UInt uiCUAddrIncrement;
@@ -620,5 +660,5 @@
       uiBoundingCUAddrSlice    = uiNumberOfCUsInFrame;
       break;
-    } 
+    }
     pcSlice->setSliceCurEndCUAddr( uiBoundingCUAddrSlice );
   }
@@ -636,5 +676,5 @@
       uiBoundingCUAddrSlice    = uiNumberOfCUsInFrame;
       break;
-    } 
+    }
     pcSlice->setSliceCurEndCUAddr( uiBoundingCUAddrSlice );
   }
@@ -644,5 +684,5 @@
   uiStartCUAddrEntropySlice    = pcSlice->getEntropySliceCurStartCUAddr();
   uiBoundingCUAddrEntropySlice = uiNumberOfCUsInFrame;
-  if (bEncodeSlice) 
+  if (bEncodeSlice)
   {
     UInt uiCUAddrIncrement;
@@ -661,5 +701,5 @@
       uiBoundingCUAddrEntropySlice    = uiNumberOfCUsInFrame;
       break;
-    } 
+    }
     pcSlice->setEntropySliceCurEndCUAddr( uiBoundingCUAddrEntropySlice );
   }
@@ -677,5 +717,5 @@
       uiBoundingCUAddrEntropySlice    = uiNumberOfCUsInFrame;
       break;
-    } 
+    }
     pcSlice->setEntropySliceCurEndCUAddr( uiBoundingCUAddrEntropySlice );
   }
Index: trunk/source/Lib/TLibEncoder/TEncSlice.h
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncSlice.h	(revision 2)
+++ trunk/source/Lib/TLibEncoder/TEncSlice.h	(revision 5)
@@ -1,2 +1,35 @@
+/* The copyright in this software is being made available under the BSD
+ * License, included below. This software may be subject to other third party
+ * and contributor rights, including patent rights, and no such rights are
+ * granted under this license.
+ *
+ * Copyright (c) 2010-2011, ISO/IEC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  * Neither the name of the ISO/IEC nor the names of its contributors may
+ *    be used to endorse or promote products derived from this software without
+ *    specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 
 
Index: trunk/source/Lib/TLibEncoder/TEncTop.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncTop.cpp	(revision 2)
+++ trunk/source/Lib/TLibEncoder/TEncTop.cpp	(revision 5)
@@ -1,2 +1,35 @@
+/* The copyright in this software is being made available under the BSD
+ * License, included below. This software may be subject to other third party
+ * and contributor rights, including patent rights, and no such rights are
+ * granted under this license.
+ *
+ * Copyright (c) 2010-2011, ISO/IEC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  * Neither the name of the ISO/IEC nor the names of its contributors may
+ *    be used to endorse or promote products derived from this software without
+ *    specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 
 
@@ -58,6 +91,10 @@
   m_cAdaptiveLoopFilter.create( getSourceWidth(), getSourceHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
   m_cLoopFilter.        create( g_uiMaxCUDepth );
+#if DEPTH_MAP_GENERATION
   m_cDepthMapGenerator. create( false, getSourceWidth(), getSourceHeight(), g_uiMaxCUDepth, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiBitDepth + g_uiBitIncrement );
+#endif
+#if HHI_INTER_VIEW_RESIDUAL_PRED
   m_cResidualGenerator. create( false, getSourceWidth(), getSourceHeight(), g_uiMaxCUDepth, g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiBitDepth + g_uiBitIncrement );
+#endif
 
 #if MQT_BA_RA && MQT_ALF_NPASS
@@ -89,6 +126,6 @@
   }
 
-#if HHI_DMM_INTRA
-  if( g_aacWedgeLists.empty() && m_bUseDepthModelModes && m_bIsDepth )
+#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
+  if( g_aacWedgeLists.empty() && m_bUseDMM && m_bIsDepth )
   {
     initWedgeLists();
@@ -119,6 +156,10 @@
   m_cAdaptiveLoopFilter.destroy();
   m_cLoopFilter.        destroy();
+#if DEPTH_MAP_GENERATION
   m_cDepthMapGenerator. destroy();
+#endif
+#if HHI_INTER_VIEW_RESIDUAL_PRED
   m_cResidualGenerator. destroy();
+#endif
 
   // SBAC RD
@@ -172,6 +213,10 @@
 
   m_pcTAppEncTop = pcTAppEncTop;
+#if DEPTH_MAP_GENERATION
   m_cDepthMapGenerator.init( (TComPrediction*)this->getPredSearch(), m_pcTAppEncTop->getSPSAccess(), m_pcTAppEncTop->getAUPicAccess() );
+#endif
+#if HHI_INTER_VIEW_RESIDUAL_PRED
   m_cResidualGenerator.init( &m_cTrQuant, &m_cDepthMapGenerator );
+#endif
 
   // initialize transform & quantization class
@@ -254,4 +299,5 @@
       pcPic          = cIter->second ;
 
+#if DEPTH_MAP_GENERATION
       // add extra pic buffers
       Bool  bNeedPrdDepthMapBuf = ( m_uiPredDepthMapGeneration > 0 );
@@ -260,4 +306,5 @@
         pcPic->addPrdDepthMapBuffer();
       }
+#endif
 
       // needed? dont think so
@@ -323,4 +370,5 @@
     xGetNewPicBuffer( pcPicCurr ); //GT: assigns next POC to input pic and stores it in m_cListPic
     pcPicYuvOrg->copyToPic( pcPicCurr->getPicYuvOrg() );
+#if HHI_INTER_VIEW_MOTION_PRED
     if( m_uiMultiviewMvRegMode )
     {
@@ -334,4 +382,5 @@
       AOT( pcPicCurr->getOrgDepthMap() );
     }
+#endif
     m_acInputPicMap.insert( std::make_pair(pcPicCurr->getPOC(), pcPicCurr)); //GT: input pic to m_acInputPicMap
     assert( m_acOutputPicMap.find( pcPicCurr->getPOC() ) == m_acOutputPicMap.end() );
@@ -367,7 +416,13 @@
   {
     pcPic->removeOriginalBuffer   ();
+#if HHI_INTER_VIEW_MOTION_PRED
     pcPic->removeOrgDepthMapBuffer();
+#endif
+#if HHI_INTER_VIEW_RESIDUAL_PRED
     pcPic->removeResidualBuffer   ();
+#endif
+#if HHI_INTERVIEW_SKIP
     pcPic->removeUsedPelsMapBuffer();
+#endif
   }
 }
@@ -434,12 +489,17 @@
 
   rpcPic->addOriginalBuffer();
+#if HHI_INTER_VIEW_MOTION_PRED
   if( m_uiMultiviewMvRegMode )
   {
     rpcPic->addOrgDepthMapBuffer();
   }
-  if( m_bOmitUnusedBlocks )
+#endif
+
+#if HHI_INTERVIEW_SKIP
+  if( getInterViewSkip() )
   {
     rpcPic->addUsedPelsMapBuffer();
   }
+#endif
 
   rpcPic->setCurrSliceIdx( 0 ); // MW
@@ -470,5 +530,5 @@
 
   m_cSPS.setUseDQP        ( m_iMaxDeltaQP != 0  );
-#if !SB_NO_LowDelayCoding
+#if !HHI_NO_LowDelayCoding
   m_cSPS.setUseLDC        ( m_bUseLDC           );
 #endif
@@ -486,6 +546,10 @@
   {
     m_cSPS.initMultiviewSPSDepth    ( m_uiViewId, m_iViewOrderIdx );
+#if DEPTH_MAP_GENERATION
     m_cSPS.setPredDepthMapGeneration( m_uiViewId, true );
+#endif
+#if HHI_INTER_VIEW_RESIDUAL_PRED
     m_cSPS.setMultiviewResPredMode  ( 0 );
+#endif
   }
   else
@@ -494,11 +558,23 @@
     if( m_uiViewId )
     {
+#if DEPTH_MAP_GENERATION
+#if HHI_INTER_VIEW_MOTION_PRED
       m_cSPS.setPredDepthMapGeneration( m_uiViewId, false, m_uiPredDepthMapGeneration, m_uiMultiviewMvPredMode, m_uiPdmPrecision, m_aaiPdmScaleNomDelta, m_aaiPdmOffset );
+#else
+      m_cSPS.setPredDepthMapGeneration( m_uiViewId, false, m_uiPredDepthMapGeneration, 0, m_uiPdmPrecision, m_aaiPdmScaleNomDelta, m_aaiPdmOffset );
+#endif
+#endif
+#if HHI_INTER_VIEW_RESIDUAL_PRED
       m_cSPS.setMultiviewResPredMode  ( m_uiMultiviewResPredMode );
+#endif
     }
     else
     {
+#if DEPTH_MAP_GENERATION
       m_cSPS.setPredDepthMapGeneration( m_uiViewId, false );
+#endif
+#if HHI_INTER_VIEW_RESIDUAL_PRED
       m_cSPS.setMultiviewResPredMode  ( 0 );
+#endif
     }
   }
@@ -537,8 +613,10 @@
   m_cSPS.setUseSAO             ( m_bUseSAO         );
 #endif
-#if HHI_DMM_INTRA
-  m_cSPS.setUseDepthModelModes( m_bUseDepthModelModes );
-#endif
+#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
+  m_cSPS.setUseDMM( m_bUseDMM );
+#endif
+#if HHI_MPI
   m_cSPS.setUseMVI( m_bUseMVI );
+#endif
 
   m_cSPS.setCodedPictureBufferSize( m_uiCodedPictureStoreSize );
Index: trunk/source/Lib/TLibEncoder/TEncTop.h
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncTop.h	(revision 2)
+++ trunk/source/Lib/TLibEncoder/TEncTop.h	(revision 5)
@@ -1,2 +1,35 @@
+/* The copyright in this software is being made available under the BSD
+ * License, included below. This software may be subject to other third party
+ * and contributor rights, including patent rights, and no such rights are
+ * granted under this license.
+ *
+ * Copyright (c) 2010-2011, ISO/IEC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  * Neither the name of the ISO/IEC nor the names of its contributors may
+ *    be used to endorse or promote products derived from this software without
+ *    specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 
 /** \file     TEncTop.h
@@ -27,5 +60,4 @@
 #include "TEncAdaptiveLoopFilter.h"
 
-//SB
 #include "TEncSeqStructure.h"
 #include <map>
@@ -71,10 +103,13 @@
 
   // processing unit
-  // SB
   TEncPic                 m_cPicEncoder;                  ///< Pic encoder
   TEncSlice               m_cSliceEncoder;                ///< slice encoder
   TEncCu                  m_cCuEncoder;                   ///< CU encoder
+#if DEPTH_MAP_GENERATION
   TComDepthMapGenerator   m_cDepthMapGenerator;           ///< depth map generator
+#endif
+#if HHI_INTER_VIEW_RESIDUAL_PRED
   TComResidualGenerator   m_cResidualGenerator;           ///< generator for residual pictures
+#endif
 
   // SPS
@@ -151,6 +186,10 @@
   TEncSbac***             getRDSbacCoder        () { return  m_pppcRDSbacCoder;       }
   TEncSbac*               getRDGoOnSbacCoder    () { return  &m_cRDGoOnSbacCoder;     }
+#if DEPTH_MAP_GENERATION
   TComDepthMapGenerator*  getDepthMapGenerator  () { return  &m_cDepthMapGenerator;   }
+#endif
+#if HHI_INTER_VIEW_RESIDUAL_PRED
   TComResidualGenerator*  getResidualGenerator  () { return  &m_cResidualGenerator;   }
+#endif
 
   TComSPS*                getSPS                () { return  &m_cSPS;                 }
@@ -164,5 +203,4 @@
   Void                    printOutSummary       ( UInt uiNumAllPicCoded );
 
-  //SB
   TEncAnalyze             m_cAnalyzeAll;
   TEncAnalyze             m_cAnalyzeI;
@@ -179,8 +217,6 @@
   Void encode    ( bool bEos, std::map<PicOrderCnt, TComPicYuv*>& rcMapPicYuvRecOut, TComBitstream* pcBitstreamOut, Bool& bNewPicNeeded );
   Void receivePic( bool bEos, TComPicYuv* pcPicYuvOrg, TComPicYuv* pcPicYuvRec, TComPicYuv* pcOrgPdmDepth = 0 );
-
 };
 
-
 #endif // __TENCTOP__
 
Index: trunk/source/Lib/TLibEncoder/WeightPredAnalysis.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/WeightPredAnalysis.cpp	(revision 2)
+++ trunk/source/Lib/TLibEncoder/WeightPredAnalysis.cpp	(revision 5)
@@ -1,2 +1,35 @@
+/* The copyright in this software is being made available under the BSD
+ * License, included below. This software may be subject to other third party
+ * and contributor rights, including patent rights, and no such rights are
+ * granted under this license.
+ *
+ * Copyright (c) 2010-2011, ISO/IEC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  * Neither the name of the ISO/IEC nor the names of its contributors may
+ *    be used to endorse or promote products derived from this software without
+ *    specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 
 
Index: trunk/source/Lib/TLibEncoder/WeightPredAnalysis.h
===================================================================
--- trunk/source/Lib/TLibEncoder/WeightPredAnalysis.h	(revision 2)
+++ trunk/source/Lib/TLibEncoder/WeightPredAnalysis.h	(revision 5)
@@ -1,2 +1,35 @@
+/* The copyright in this software is being made available under the BSD
+ * License, included below. This software may be subject to other third party
+ * and contributor rights, including patent rights, and no such rights are
+ * granted under this license.
+ *
+ * Copyright (c) 2010-2011, ISO/IEC
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  * Neither the name of the ISO/IEC nor the names of its contributors may
+ *    be used to endorse or promote products derived from this software without
+ *    specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 
 
