Index: branches/HTM-14.1-update-dev1/source/Lib/TLibCommon/Debug.cpp
===================================================================
--- branches/HTM-14.1-update-dev1/source/Lib/TLibCommon/Debug.cpp	(revision 1281)
+++ branches/HTM-14.1-update-dev1/source/Lib/TLibCommon/Debug.cpp	(revision 1282)
@@ -154,8 +154,8 @@
 
 #if DEBUG_STRING
-EnvVar DebugOptionList::DebugString_Structure ("DEBUG_STRUCTURE",   "0", "Produce output on chosen structure                        bit0=intra, bit1=inter");
-EnvVar DebugOptionList::DebugString_Pred      ("DEBUG_PRED",        "0", "Produce output on prediction data.                        bit0=intra, bit1=inter");
-EnvVar DebugOptionList::DebugString_Resi      ("DEBUG_RESI",        "0", "Produce output on residual data.                          bit0=intra, bit1=inter");
-EnvVar DebugOptionList::DebugString_Reco      ("DEBUG_RECO",        "0", "Produce output on reconstructed data.                     bit0=intra, bit1=inter");
+EnvVar DebugOptionList::DebugString_Structure ("DEBUG_STRUCTURE",   "3", "Produce output on chosen structure                        bit0=intra, bit1=inter");
+EnvVar DebugOptionList::DebugString_Pred      ("DEBUG_PRED",        "3", "Produce output on prediction data.                        bit0=intra, bit1=inter");
+EnvVar DebugOptionList::DebugString_Resi      ("DEBUG_RESI",        "3", "Produce output on residual data.                          bit0=intra, bit1=inter");
+EnvVar DebugOptionList::DebugString_Reco      ("DEBUG_RECO",        "3", "Produce output on reconstructed data.                     bit0=intra, bit1=inter");
 EnvVar DebugOptionList::DebugString_InvTran   ("DEBUG_INV_QT",      "0", "Produce output on inverse-quantiser and transform stages. bit0=intra, bit1=inter");
 #endif
Index: branches/HTM-14.1-update-dev1/source/Lib/TLibCommon/TComDataCU.cpp
===================================================================
--- branches/HTM-14.1-update-dev1/source/Lib/TLibCommon/TComDataCU.cpp	(revision 1281)
+++ branches/HTM-14.1-update-dev1/source/Lib/TLibCommon/TComDataCU.cpp	(revision 1282)
@@ -3565,5 +3565,12 @@
           continue;
         }
+#if NH_3D_FIX_PRUNING
+        if  (   ivCandDir[0] == m_mergCands[MRG_A1+i].m_uDir                                &&
+            ( ( ivCandDir[0] & 1 ) == 0 || tmpMV[0]==m_mergCands[MRG_A1+i].m_cMvField[0]  ) &&
+            ( ( ivCandDir[0] & 2 ) == 0 || tmpMV[1]==m_mergCands[MRG_A1+i].m_cMvField[1]  ) 
+           )
+#else
         if (ivCandDir[0] == m_mergCands[MRG_A1+i].m_uDir && tmpMV[0]==m_mergCands[MRG_A1+i].m_cMvField[0] && tmpMV[1]==m_mergCands[MRG_A1+i].m_cMvField[1])
+#endif
         {
           m_mergCands[MRG_A1+i].m_bAvailable = false;
@@ -3574,5 +3581,12 @@
     if (bIsDepth)
     {
+#if NH_3D_FIX_PRUNING
+      if  ( m_mergCands[MRG_T].m_bAvailable &&   ivCandDir[0] == m_mergCands[MRG_T].m_uDir  &&
+        ( ( ivCandDir[0] & 1 ) == 0 || tmpMV[0]==m_mergCands[MRG_T].m_cMvField[0]  ) &&
+        ( ( ivCandDir[0] & 2 ) == 0 || tmpMV[1]==m_mergCands[MRG_T].m_cMvField[1]  ) 
+        )
+#else
       if (m_mergCands[MRG_T].m_bAvailable && ivCandDir[0] == m_mergCands[MRG_T].m_uDir && tmpMV[0]==m_mergCands[MRG_T].m_cMvField[0] && tmpMV[1]==m_mergCands[MRG_T].m_cMvField[1])
+#endif
       {
         bRemoveSpa                      = true;
@@ -3670,5 +3684,12 @@
         continue;
       }
+#if NH_3D_FIX_PRUNING
+      if  ( ivCandDir[1] == m_mergCands[MRG_A1+i].m_uDir  &&
+        ( ( ivCandDir[1] & 1 ) == 0 || tmpMV[0]==m_mergCands[MRG_A1+i].m_cMvField[0]  ) &&
+        ( ( ivCandDir[1] & 2 ) == 0 || tmpMV[1]==m_mergCands[MRG_A1+i].m_cMvField[1]  ) 
+        )
+#else
       if (ivCandDir[1] == m_mergCands[MRG_A1+i].m_uDir && tmpMV[0]==m_mergCands[MRG_A1+i].m_cMvField[0] && tmpMV[1]==m_mergCands[MRG_A1+i].m_cMvField[1])
+#endif
       {
         bRemoveSpa                      = true;
Index: branches/HTM-14.1-update-dev1/source/Lib/TLibCommon/TComRom.cpp
===================================================================
--- branches/HTM-14.1-update-dev1/source/Lib/TLibCommon/TComRom.cpp	(revision 1281)
+++ branches/HTM-14.1-update-dev1/source/Lib/TLibCommon/TComRom.cpp	(revision 1282)
@@ -537,5 +537,5 @@
 const Bool g_bEncDecTraceEnable  = true;
 const Bool g_bEncDecTraceDisable = false;
-Bool   g_HLSTraceEnable = true;
+Bool   g_HLSTraceEnable = false;
 Bool   g_bJustDoIt = false;
 UInt64 g_nSymbolCounter = 0;
@@ -686,10 +686,10 @@
   }
   Bool stopFlag = false; 
-  if ( g_stopAtPos && poc == 16 && layerId == 1 )
+  if ( g_stopAtPos && poc == 6 && layerId == 2 )
   {
     Bool stopAtCU = true; 
     if ( stopAtCU )        // Stop at CU with specific size
     {    
-      stopFlag = ( cuPelX  == 0 ) && ( cuPelY  == 0 ) && ( cuWidth == 32 ) && ( cuHeight == 32 ); 
+      stopFlag = ( cuPelX  == 128 ) && ( cuPelY  == 160 ) && ( cuWidth == 32 ) && ( cuHeight == 32 ); 
     }
     else
Index: branches/HTM-14.1-update-dev1/source/Lib/TLibCommon/TComRom.h
===================================================================
--- branches/HTM-14.1-update-dev1/source/Lib/TLibCommon/TComRom.h	(revision 1281)
+++ branches/HTM-14.1-update-dev1/source/Lib/TLibCommon/TComRom.h	(revision 1282)
@@ -196,5 +196,5 @@
  Void           writeToTraceFile( const Char* symbolName, Int val, Bool doIt );
  Void           writeToTraceFile( const Char* symbolName, Bool doIt );
- incSymbolCounter incSymbolCounter();          
+ UInt64         incSymbolCounter();          
  Void           stopAtPos       ( Int poc, Int layerId, Int cuPelX, Int cuPelY, Int cuWidth, Int cuHeight );           
 #endif
Index: branches/HTM-14.1-update-dev1/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- branches/HTM-14.1-update-dev1/source/Lib/TLibCommon/TypeDef.h	(revision 1281)
+++ branches/HTM-14.1-update-dev1/source/Lib/TLibCommon/TypeDef.h	(revision 1282)
@@ -97,4 +97,5 @@
 #define NH_3D_NBDV_REF                    1
 #define NH_3D_MLC                         1
+#define NH_3D_FIX_PRUNING                 1
 #define NH_3D_VSP                         1
 #define NH_3D_IV_MERGE                    1
Index: branches/HTM-14.1-update-dev1/source/Lib/TLibEncoder/TEncCu.cpp
===================================================================
--- branches/HTM-14.1-update-dev1/source/Lib/TLibEncoder/TEncCu.cpp	(revision 1281)
+++ branches/HTM-14.1-update-dev1/source/Lib/TLibEncoder/TEncCu.cpp	(revision 1282)
@@ -716,5 +716,5 @@
             if( rpcTempCU->getSlice()->getDepthBasedBlkPartFlag() && rpcTempCU->getSlice()->getDefaultRefViewIdxAvailableFlag() )
             {
-              xCheckRDCostInterDBBP( rpcBestCU, rpcTempCU, false );
+              xCheckRDCostInterDBBP( rpcBestCU, rpcTempCU DEBUG_STRING_PASS_INTO(sDebug), false );
               rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode  );
 #if NH_3D_VSP  || NH_3D_DBBP
@@ -1916,4 +1916,9 @@
   for( Int nARPW=nARPWMax; nARPW >= 0 ; nARPW-- )
   {
+#if NH_3D
+#if DEBUG_STRING
+    bestStr.clear(); 
+#endif
+#endif
 #if NH_3D_IV_MERGE
     memset( mergeCandBuffer, 0, MRG_MAX_NUM_CANDS_MEM*sizeof(Int) );
@@ -2510,6 +2515,7 @@
 
 #if NH_3D_DBBP
-Void TEncCu::xCheckRDCostInterDBBP( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, Bool bUseMRG )
+Void TEncCu::xCheckRDCostInterDBBP( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU  DEBUG_STRING_FN_DECLARE(sDebug), Bool bUseMRG )
 {
+  DEBUG_STRING_NEW(sTest)
   AOF( !rpcTempCU->getSlice()->getIsDepth() );
   
@@ -2582,5 +2588,5 @@
     rpcTempCU->getDBBPTmpData()->eVirtualPartSize = eVirtualPartSize;
     rpcTempCU->getDBBPTmpData()->uiVirtualPartIndex = uiSegment;
-    m_pcPredSearch->predInterSearch( rpcTempCU, m_ppcOrigYuvDBBP[uhDepth], apPredYuv[uiSegment], m_ppcResiYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], false, bUseMRG );
+    m_pcPredSearch->predInterSearch( rpcTempCU, m_ppcOrigYuvDBBP[uhDepth], apPredYuv[uiSegment], m_ppcResiYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth] DEBUG_STRING_PASS_INTO(sTest), false, bUseMRG );
     m_pcRdCost->setUseMask(false);
     
@@ -2641,8 +2647,8 @@
   Int bitDepthY = rpcTempCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA);
   m_pcPredSearch->combineSegmentsWithMask(apPredYuv, m_ppcPredYuvTemp[uhDepth], pMask, uiWidth, uiHeight, 0, eVirtualPartSize, bitDepthY);
-  m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcResiYuvBest[uhDepth], m_ppcRecoYuvTemp[uhDepth], false );
+  m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcResiYuvBest[uhDepth], m_ppcRecoYuvTemp[uhDepth], false DEBUG_STRING_PASS_INTO(sTest) );
   
   xCheckDQP( rpcTempCU );
-  xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth);
+  xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth  DEBUG_STRING_PASS_INTO(sDebug) DEBUG_STRING_PASS_INTO(sTest) );
 }
 #endif
@@ -2715,5 +2721,5 @@
 
   xCheckDQP( rpcTempCU );
-  xCheckBestMode(rpcBestCU, rpcTempCU, uiDepth);
+  xCheckBestMode(rpcBestCU, rpcTempCU, uiDepth  DEBUG_STRING_PASS_INTO(sDebug) DEBUG_STRING_PASS_INTO(sTest) );
 }
 #endif
Index: branches/HTM-14.1-update-dev1/source/Lib/TLibEncoder/TEncCu.h
===================================================================
--- branches/HTM-14.1-update-dev1/source/Lib/TLibEncoder/TEncCu.h	(revision 1281)
+++ branches/HTM-14.1-update-dev1/source/Lib/TLibEncoder/TEncCu.h	(revision 1282)
@@ -157,5 +157,5 @@
 #if NH_3D_DBBP
   Void  xInvalidateOriginalSegments( TComYuv* pOrigYuv, TComYuv* pOrigYuvTemp, Bool* pMask, UInt uiValidSegment );
-  Void  xCheckRDCostInterDBBP( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, Bool bUseMRG = false );
+  Void  xCheckRDCostInterDBBP( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU  DEBUG_STRING_FN_DECLARE(sDebug),  Bool bUseMRG = false );
 #endif
 #if NH_3D_DIS
