Index: /branches/HTM-DEV-0.3-dev2/source/App/TAppDecoder/TAppDecTop.cpp
===================================================================
--- /branches/HTM-DEV-0.3-dev2/source/App/TAppDecoder/TAppDecTop.cpp	(revision 520)
+++ /branches/HTM-DEV-0.3-dev2/source/App/TAppDecoder/TAppDecTop.cpp	(revision 521)
@@ -267,6 +267,16 @@
           bitstreamFile.seekg(location-streamoff(3));
           bytestream.reset();
-#if H_MV
 #if ENC_DEC_TRACE
+#if H_MV_ENC_DEC_TRAC
+          const Bool resetCounter = false; 
+          if ( resetCounter )
+          {
+            g_nSymbolCounter  = symCount; // Only reset counter SH becomes traced twice
+          }
+          else
+          {
+            g_disableHLSTrace = true;     // Trancing of second parsing of SH is not carried out
+          }          
+#else
           g_nSymbolCounter = symCount;
 #endif
Index: /branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComRom.cpp
===================================================================
--- /branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComRom.cpp	(revision 520)
+++ /branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComRom.cpp	(revision 521)
@@ -324,4 +324,11 @@
 Bool   g_bJustDoIt = false;
 UInt64 g_nSymbolCounter = 0;
+#if H_MV_ENC_DEC_TRAC
+Bool g_traceCU = true; 
+Bool g_tracePU = true; 
+Bool g_traceTU = true; 
+Bool g_disableHLSTrace = false; 
+UInt64 g_stopAtCounter   = 10803; 
+#endif
 #endif
 // ====================================================================================================================
@@ -518,3 +525,32 @@
 Int  g_eTTable[4] = {0,3,1,2};
 
+#if H_MV_ENC_DEC_TRAC
+#if ENC_DEC_TRACE
+Void writeToTraceFile( Char* symbolName, Int val, Bool doIt )
+{
+  if ( ( ( g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END )|| g_bJustDoIt ) && doIt  ) 
+  {
+    if ( g_stopAtCounter == g_nSymbolCounter )
+    {
+      std::cout << "Break point here." << std::endl; 
+    }
+    fprintf( g_hTrace, "%8lld  ", g_nSymbolCounter++ );
+    fprintf( g_hTrace, "%-50s       : %d\n", symbolName, val );     
+    fflush ( g_hTrace );
+    g_nSymbolCounter++; 
+  }
+}
+
+Void writeToTraceFile( Char* symbolName, Bool doIt )
+{
+  if ( ( ( g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END )|| g_bJustDoIt ) && doIt  ) 
+  {
+    fprintf( g_hTrace, "%s", symbolName );    
+    fflush ( g_hTrace );
+    g_nSymbolCounter++; 
+  }
+}
+
+#endif
+#endif
 //! \}
Index: /branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComRom.h
===================================================================
--- /branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComRom.h	(revision 520)
+++ /branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComRom.h	(revision 521)
@@ -40,4 +40,5 @@
 
 #include "CommonDef.h"
+#include "TypeDef.h"
 
 #include<stdio.h>
@@ -184,4 +185,22 @@
 #define DTRACE_CABAC_N        if ( ( g_nSymbolCounter >= COUNTER_START && g_nSymbolCounter <= COUNTER_END )|| g_bJustDoIt ) fprintf( g_hTrace, "\n"    );
 
+#if H_MV_ENC_DEC_TRAC
+ extern Bool   g_traceCU; 
+ extern Bool   g_tracePU; 
+ extern Bool   g_traceTU; 
+ extern Bool   g_disableHLSTrace; 
+ extern UInt64 g_stopAtCounter; 
+
+#define DTRACE_CU(x,y)             writeToTraceFile( x,y, g_traceCU );
+#define DTRACE_PU(x,y)             writeToTraceFile( x,y, g_tracePU );
+#define DTRACE_TU(x,y)             writeToTraceFile( x,y, g_traceTU );
+#define DTRACE_CU_S(x)             writeToTraceFile( x,   g_traceCU );
+#define DTRACE_PU_S(x)             writeToTraceFile( x,   g_tracePU );
+#define DTRACE_TU_S(x)             writeToTraceFile( x,   g_traceTU );
+
+
+ Void           writeToTraceFile( Char* symbolName, Int val, Bool doIt );
+ Void           writeToTraceFile( Char* symbolName, Bool doIt );
+#endif
 #else
 
@@ -194,4 +213,14 @@
 #define DTRACE_CABAC_N
 
+#if H_MV_ENC_DEC_TRAC
+#define DTRACE_CU(x,y)             
+#define DTRACE_PU(x,y)             
+#define DTRACE_TU(x,y)             
+
+#define DTRACE_CU_S(x)             
+#define DTRACE_PU_S(x)             
+#define DTRACE_TU_S(x)             
+
+#endif
 #endif
 
Index: /branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComSlice.cpp
===================================================================
--- /branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComSlice.cpp	(revision 520)
+++ /branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComSlice.cpp	(revision 521)
@@ -654,5 +654,5 @@
 }
 
-#if H_MV
+#if H_MV && !H_MV_FIX1071
 // Temporary fix for FIX1071 should be removed later
 Int TComSlice::getNumRpsCurrTempList( TComReferencePictureSet* rps /* = 0 */)
@@ -661,5 +661,4 @@
 #endif
 {
-
   Int numRpsCurrTempList = 0;
 
@@ -668,5 +667,5 @@
     return 0;
   }
-#if H_MV
+#if H_MV && !H_MV_FIX1071
 // Temporary fix for FIX1071 should be removed later
   if (rps == NULL)
@@ -1302,5 +1301,9 @@
 /** Function for constructing an explicit Reference Picture Set out of the available pictures in a referenced Reference Picture Set
 */
+#if FIX1071 && H_MV_FIX1071
+Void TComSlice::createExplicitReferencePictureSetFromReference( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool isRAP)
+#else
 Void TComSlice::createExplicitReferencePictureSetFromReference( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet)
+#endif
 {
   TComPic* rpcPic;
@@ -1327,5 +1330,9 @@
         // and should be added to the explicit Reference Picture Set
         pcRPS->setDeltaPOC(k, pReferencePictureSet->getDeltaPOC(i));
+#if FIX1071 && H_MV_FIX1071
+        pcRPS->setUsed(k, pReferencePictureSet->getUsed(i) && (!isRAP));
+#else
         pcRPS->setUsed(k, pReferencePictureSet->getUsed(i));
+#endif
         if(pcRPS->getDeltaPOC(k) < 0)
         {
Index: /branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- /branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComSlice.h	(revision 520)
+++ /branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TComSlice.h	(revision 521)
@@ -1619,5 +1619,5 @@
   Bool      getCheckLDC     ()                                  { return m_bCheckLDC; }
   Bool      getMvdL1ZeroFlag ()                                  { return m_bLMvdL1Zero;    }
-#if H_MV  // This is a temporary fix of the temporary fix L0177 
+#if H_MV && !H_MV_FIX1071  // This is a temporary fix of the temporary fix L0177 
   Int       getNumRpsCurrTempList( TComReferencePictureSet* rps = NULL );
 #else
@@ -1736,5 +1736,9 @@
   Bool isStepwiseTemporalLayerSwitchingPointCandidate( TComList<TComPic*>& rcListPic );
   Int       checkThatAllRefPicsAreAvailable( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool printErrors, Int pocRandomAccess = 0);
+#if FIX1071 && H_MV_FIX1071
+  Void      createExplicitReferencePictureSetFromReference( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet, Bool isRAP);
+#else
   Void      createExplicitReferencePictureSetFromReference( TComList<TComPic*>& rcListPic, TComReferencePictureSet *pReferencePictureSet);
+#endif
 
   Void setMaxNumMergeCand               (UInt val )         { m_maxNumMergeCand = val;                    }
Index: /branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- /branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TypeDef.h	(revision 520)
+++ /branches/HTM-DEV-0.3-dev2/source/Lib/TLibCommon/TypeDef.h	(revision 521)
@@ -69,4 +69,8 @@
 ///////////////////////////////////   MAJOR DEFINES   ///////////////////////////////////  
 /////////////////////////////////////////////////////////////////////////////////////////
+#if H_MV
+#define H_MV_FIX1071                      1  //< Fix on Fix1071, same as in HTM 11
+#define H_MV_ENC_DEC_TRAC                 0  //< CU/PU level tracking
+#endif
 
 #if H_3D
@@ -129,6 +133,7 @@
                                               // Sony_M23639
 #define H_3D_GEN                          1   // Some general changes can be removed after merge 
-#define H_3D_CLEANUPS                     1
-#define H_3D_FIX                          1   // Temporary for minor fixes
+#define H_3D_CLEANUPS                     1   // Temporary for minor fixes can be removed after merge 
+#define H_3D_FIX                          1   // Temporary for minor fixes can be removed after merge 
+#define H_3D_VSO_FIX_BORDRE_EXTENSION     1   // Temporary for minor fixes can be removed after merge 
 #endif 
 
Index: /branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/SyntaxElementParser.cpp
===================================================================
--- /branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/SyntaxElementParser.cpp	(revision 520)
+++ /branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/SyntaxElementParser.cpp	(revision 521)
@@ -49,4 +49,10 @@
 {
   xReadCode (length, rValue);
+#if H_MV_ENC_DEC_TRAC
+  if ( g_disableHLSTrace )
+  {
+    return; 
+  }
+#endif
   fprintf( g_hTrace, "%8lld  ", g_nSymbolCounter++ );
   if (length < 10)
@@ -64,4 +70,10 @@
 {
   xReadUvlc (rValue);
+#if H_MV_ENC_DEC_TRAC
+  if ( g_disableHLSTrace )
+  {
+    return; 
+  }
+#endif
   fprintf( g_hTrace, "%8lld  ", g_nSymbolCounter++ );
   fprintf( g_hTrace, "%-50s ue(v) : %d\n", pSymbolName, rValue ); 
@@ -72,4 +84,10 @@
 {
   xReadSvlc(rValue);
+#if H_MV_ENC_DEC_TRAC
+  if ( g_disableHLSTrace )
+  {
+    return; 
+  }
+#endif
   fprintf( g_hTrace, "%8lld  ", g_nSymbolCounter++ );
   fprintf( g_hTrace, "%-50s se(v) : %d\n", pSymbolName, rValue ); 
@@ -80,4 +98,10 @@
 {
   xReadFlag(rValue);
+#if H_MV_ENC_DEC_TRAC
+  if ( g_disableHLSTrace )
+  {
+    return; 
+  }
+#endif
   fprintf( g_hTrace, "%8lld  ", g_nSymbolCounter++ );
   fprintf( g_hTrace, "%-50s u(1)  : %d\n", pSymbolName, rValue ); 
Index: /branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecBinCoderCABAC.cpp
===================================================================
--- /branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecBinCoderCABAC.cpp	(revision 520)
+++ /branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecBinCoderCABAC.cpp	(revision 521)
@@ -37,4 +37,5 @@
 
 #include "TDecBinCoderCABAC.h"
+#include "../TLibCommon/TComRom.h"
 
 //! \ingroup TLibDecoder
@@ -260,4 +261,7 @@
   UInt uiBit = 0;
   m_pcTComBitstream->read( iNum, uiBit );
+#if H_MV_ENC_DEC_TRAC          
+  DTRACE_CU("Number of pcm_alignment_zero_bit", iNum)
+#endif
 }
 
Index: /branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecCAVLC.cpp
===================================================================
--- /branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 520)
+++ /branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 521)
@@ -47,14 +47,37 @@
 Void  xTraceSPSHeader (TComSPS *pSPS)
 {
+#if H_MV_ENC_DEC_TRAC
+  if ( g_disableHLSTrace )
+  {
+    return; 
+  }
+  // To avoid mismatches
+  fprintf( g_hTrace, "=========== Sequence Parameter Set ===========\n" );
+#else
   fprintf( g_hTrace, "=========== Sequence Parameter Set ID: %d ===========\n", pSPS->getSPSId() );
+#endif
 }
 
 Void  xTracePPSHeader (TComPPS *pPPS)
 {
+#if H_MV_ENC_DEC_TRAC
+  if ( g_disableHLSTrace )
+  {
+    return; 
+  }
+  fprintf( g_hTrace, "=========== Picture Parameter Set ===========\n" );
+#else
   fprintf( g_hTrace, "=========== Picture Parameter Set ID: %d ===========\n", pPPS->getPPSId() );
+#endif
 }
 
 Void  xTraceSliceHeader (TComSlice *pSlice)
 {
+#if H_MV_ENC_DEC_TRAC
+  if ( g_disableHLSTrace )
+  {
+    return; 
+  }
+#endif
   fprintf( g_hTrace, "=========== Slice ===========\n");
 }
Index: /branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecCu.cpp
===================================================================
--- /branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecCu.cpp	(revision 520)
+++ /branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecCu.cpp	(revision 521)
@@ -204,5 +204,11 @@
   UInt uiTPelY   = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ];
   UInt uiBPelY   = uiTPelY + (g_uiMaxCUHeight>>uiDepth) - 1;
-  
+#if H_MV_ENC_DEC_TRAC
+  DTRACE_CU_S("=========== coding_quadtree ===========\n")
+  DTRACE_CU("x0", uiLPelX)
+  DTRACE_CU("x1", uiTPelY)
+  DTRACE_CU("log2CbSize", g_uiMaxCUWidth>>uiDepth)
+  DTRACE_CU("cqtDepth"  , uiDepth)
+#endif
   TComSlice * pcSlice = pcCU->getPic()->getSlice(pcCU->getPic()->getCurrSliceIdx());
   Bool bStartInCU = pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts>pcSlice->getSliceSegmentCurStartCUAddr()&&pcCU->getSCUAddr()+uiAbsPartIdx<pcSlice->getSliceSegmentCurStartCUAddr();
@@ -264,4 +270,8 @@
   }
   
+#if H_MV_ENC_DEC_TRAC
+  DTRACE_CU_S("=========== coding_unit ===========\n")
+#endif
+
   if( (g_uiMaxCUWidth>>uiDepth) >= pcCU->getSlice()->getPPS()->getMinCuDQPSize() && pcCU->getSlice()->getPPS()->getUseDQP())
   {
@@ -330,4 +340,9 @@
   if( pcCU->isSkipped(uiAbsPartIdx) )
   {
+#if H_MV_ENC_DEC_TRAC
+    DTRACE_PU_S("=========== prediction_unit ===========\n")
+    DTRACE_PU("x0", uiLPelX)
+    DTRACE_PU("x1", uiTPelY)
+#endif
     m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0 );
     m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_1 );
Index: /branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecEntropy.cpp
===================================================================
--- /branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecEntropy.cpp	(revision 520)
+++ /branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecEntropy.cpp	(revision 521)
@@ -215,4 +215,10 @@
   for ( UInt uiPartIdx = 0, uiSubPartIdx = uiAbsPartIdx; uiPartIdx < uiNumPU; uiPartIdx++, uiSubPartIdx += uiPUOffset )
   {
+#if H_MV_ENC_DEC_TRAC
+    DTRACE_PU_S("=========== prediction_unit ===========\n")
+    // ToDo: 
+    //DTRACE_PU("x0", uiLPelX)
+    //DTRACE_PU("x1", uiTPelY)
+#endif
     decodeMergeFlag( pcCU, uiSubPartIdx, uiDepth, uiPartIdx );
     if ( pcCU->getMergeFlag( uiSubPartIdx ) )
@@ -364,4 +370,16 @@
   {
     m_pcEntropyDecoderIf->parseMVPIdx( iMVPIdx );
+#if H_MV_ENC_DEC_TRAC
+#if ENC_DEC_TRACE
+    if ( eRefList == REF_PIC_LIST_0 )
+    {
+      DTRACE_PU("mvp_l0_flag", iMVPIdx)
+    }
+    else
+    {
+      DTRACE_PU("mvp_l1_flag", iMVPIdx)
+    }
+#endif
+#endif
   }
   pcSubCU->fillMvpCand(uiPartIdx, uiPartAddr, eRefList, iRefIdx, pAMVPInfo);
@@ -484,4 +502,5 @@
     pcCU->setTrIdxSubParts( uiTrDepth, uiAbsPartIdx, uiDepth );
     
+#if !H_MV_ENC_DEC_TRAC
     {
       DTRACE_CABAC_VL( g_nSymbolCounter++ );
@@ -494,4 +513,5 @@
       DTRACE_CABAC_T( "\n" );
     }
+#endif
     
     pcCU->setCbfSubParts ( 0, TEXT_LUMA, uiAbsPartIdx, uiDepth );
Index: /branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecSbac.cpp
===================================================================
--- /branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecSbac.cpp	(revision 520)
+++ /branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecSbac.cpp	(revision 521)
@@ -331,4 +331,7 @@
     m_pcTDecBinIf->decodeBinTrm(uiSymbol);
 
+#if H_MV_ENC_DEC_TRAC
+      DTRACE_CU("pcm_flag", uiSymbol)
+#endif
     if (uiSymbol)
     {
@@ -412,4 +415,7 @@
   UInt uiSymbol;
   m_pcTDecBinIf->decodeBin( uiSymbol, m_CUTransquantBypassFlagSCModel.get( 0, 0, 0 ) );
+#if H_MV_ENC_DEC_TRAC
+  DTRACE_CU("cu_transquant_bypass_flag", uiSymbol); 
+#endif
   pcCU->setCUTransquantBypassSubParts(uiSymbol ? true : false, uiAbsPartIdx, uiDepth);
 }
@@ -431,4 +437,5 @@
   UInt uiCtxSkip = pcCU->getCtxSkipFlag( uiAbsPartIdx );
   m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUSkipFlagSCModel.get( 0, 0, uiCtxSkip ) );
+#if !H_MV_ENC_DEC_TRAC
   DTRACE_CABAC_VL( g_nSymbolCounter++ );
   DTRACE_CABAC_T( "\tSkipFlag" );
@@ -438,4 +445,5 @@
   DTRACE_CABAC_V( uiSymbol );
   DTRACE_CABAC_T( "\n");
+#endif
   
   if( uiSymbol )
@@ -447,4 +455,7 @@
     pcCU->setMergeFlagSubParts( true , uiAbsPartIdx, 0, uiDepth );
   }
+#if H_MV_ENC_DEC_TRAC
+  DTRACE_CU("cu_skip_flag", uiSymbol); 
+#endif
 }
 
@@ -460,6 +471,10 @@
   UInt uiSymbol;
   m_pcTDecBinIf->decodeBin( uiSymbol, *m_cCUMergeFlagExtSCModel.get( 0 ) );
+#if H_MV_ENC_DEC_TRAC
+  DTRACE_PU("merge_flag", uiSymbol)
+#endif
   pcCU->setMergeFlagSubParts( uiSymbol ? true : false, uiAbsPartIdx, uiPUIdx, uiDepth );
 
+#if !H_MV_ENC_DEC_TRAC
   DTRACE_CABAC_VL( g_nSymbolCounter++ );
   DTRACE_CABAC_T( "\tMergeFlag: " );
@@ -470,4 +485,5 @@
   DTRACE_CABAC_V( uiAbsPartIdx );
   DTRACE_CABAC_T( "\n" );
+#endif
 }
 
@@ -494,7 +510,11 @@
       }
     }
+#if H_MV_ENC_DEC_TRAC
+    DTRACE_PU("merge_idx", uiUnaryIdx)
+#endif
   }
   ruiMergeIndex = uiUnaryIdx;
 
+#if !H_MV_ENC_DEC_TRAC
   DTRACE_CABAC_VL( g_nSymbolCounter++ )
   DTRACE_CABAC_T( "\tparseMergeIndex()" )
@@ -502,4 +522,5 @@
   DTRACE_CABAC_V( ruiMergeIndex )
   DTRACE_CABAC_T( "\n" )
+#endif
 }
 
@@ -521,6 +542,10 @@
   UInt uiSymbol;
   m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUSplitFlagSCModel.get( 0, 0, pcCU->getCtxSplitFlag( uiAbsPartIdx, uiDepth ) ) );
+#if H_MV_ENC_DEC_TRAC
+  DTRACE_CU("split_cu_flag", uiSymbol); 
+#else
   DTRACE_CABAC_VL( g_nSymbolCounter++ )
   DTRACE_CABAC_T( "\tSplitFlag\n" )
+#endif
   pcCU->setDepthSubParts( uiDepth + uiSymbol, uiAbsPartIdx );
   
@@ -545,4 +570,7 @@
     {
       m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUPartSizeSCModel.get( 0, 0, 0) );
+#if H_MV_ENC_DEC_TRAC          
+      DTRACE_CU("part_mode", uiSymbol)
+#endif        
     }
     eMode = uiSymbol ? SIZE_2Nx2N : SIZE_NxN;
@@ -598,4 +626,7 @@
       }
     }
+#if H_MV_ENC_DEC_TRAC          
+    DTRACE_CU("part_mode", eMode )
+#endif        
   }
   pcCU->setPartSizeSubParts( eMode, uiAbsPartIdx, uiDepth );
@@ -621,4 +652,7 @@
   m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUPredModeSCModel.get( 0, 0, 0 ) );
   iPredMode += uiSymbol;
+#if H_MV_ENC_DEC_TRAC          
+  DTRACE_CU("pred_mode_flag", uiSymbol)
+#endif        
   pcCU->setPredModeSubParts( (PredMode)iPredMode, uiAbsPartIdx, uiDepth );
 }
@@ -639,4 +673,7 @@
     m_pcTDecBinIf->decodeBin( symbol, m_cCUIntraPredSCModel.get( 0, 0, 0) );
     mpmPred[j] = symbol;
+#if H_MV_ENC_DEC_TRAC          
+    DTRACE_CU("prev_intra_luma_pred_flag", symbol)
+#endif
   }
   for (j=0;j<partNum;j++)
@@ -652,4 +689,7 @@
         symbol++;
       }
+#if H_MV_ENC_DEC_TRAC          
+      DTRACE_CU("mpm_idx", symbol)
+#endif
       intraPredMode = preds[symbol];
     }
@@ -659,5 +699,7 @@
       m_pcTDecBinIf->decodeBinsEP( symbol, 5 );
       intraPredMode = symbol;
-        
+#if H_MV_ENC_DEC_TRAC          
+      DTRACE_CU("rem_intra_luma_pred_mode", symbol)
+#endif        
       //postponed sorting of MPMs (only in remaining branch)
       if (preds[0] > preds[1])
@@ -690,4 +732,7 @@
   if( uiSymbol == 0 )
   {
+#if H_MV_ENC_DEC_TRAC          
+    DTRACE_CU("intra_chroma_pred_mode", uiSymbol )
+#endif        
     uiSymbol = DM_CHROMA_IDX;
   } 
@@ -697,4 +742,7 @@
       UInt uiIPredMode;
       m_pcTDecBinIf->decodeBinsEP( uiIPredMode, 2 );
+#if H_MV_ENC_DEC_TRAC          
+      DTRACE_CU("intra_chroma_pred_mode", uiIPredMode )
+#endif        
       UInt uiAllowedChromaDir[ NUM_CHROMA_MODE ];
       pcCU->getAllowedChromaDir( uiAbsPartIdx, uiAllowedChromaDir );
@@ -729,4 +777,8 @@
   uiSymbol++;
   ruiInterDir = uiSymbol;
+#if H_MV_ENC_DEC_TRAC
+    DTRACE_PU("inter_pred_idc", ruiInterDir - 1 )    
+#endif
+
   return;
 }
@@ -764,4 +816,16 @@
   }
 
+#if H_MV_ENC_DEC_TRAC
+#if ENC_DEC_TRACE
+  if ( eRefList == REF_PIC_LIST_0 )
+  {
+    DTRACE_PU("ref_idx_l0", uiSymbol)
+  }
+  else
+  {
+    DTRACE_PU("ref_idx_l1", uiSymbol)
+  }
+#endif
+#endif
   return;
 }
@@ -835,4 +899,5 @@
 {
   m_pcTDecBinIf->decodeBin( ruiSubdivFlag, m_cCUTransSubdivFlagSCModel.get( 0, 0, uiLog2TransformBlockSize ) );
+#if !H_MV_ENC_DEC_TRAC
   DTRACE_CABAC_VL( g_nSymbolCounter++ )
   DTRACE_CABAC_T( "\tparseTransformSubdivFlag()" )
@@ -842,4 +907,5 @@
   DTRACE_CABAC_V( uiLog2TransformBlockSize )
   DTRACE_CABAC_T( "\n" )
+#endif
 }
 
@@ -849,4 +915,5 @@
   const UInt uiCtx = 0;
   m_pcTDecBinIf->decodeBin( uiSymbol , m_cCUQtRootCbfSCModel.get( 0, 0, uiCtx ) );
+#if !H_MV_ENC_DEC_TRAC
   DTRACE_CABAC_VL( g_nSymbolCounter++ )
   DTRACE_CABAC_T( "\tparseQtRootCbf()" )
@@ -858,4 +925,7 @@
   DTRACE_CABAC_V( uiAbsPartIdx )
   DTRACE_CABAC_T( "\n" )
+#else
+  DTRACE_CU( "rqt_root_cbf", uiSymbol )
+#endif
   
   uiQtRootCbf = uiSymbol;
@@ -904,5 +974,5 @@
   const UInt uiCtx = pcCU->getCtxQtCbf( eType, uiTrDepth );
   m_pcTDecBinIf->decodeBin( uiSymbol , m_cCUQtCbfSCModel.get( 0, eType ? TEXT_CHROMA: eType, uiCtx ) );
-  
+#if !H_MV_ENC_DEC_TRAC  
   DTRACE_CABAC_VL( g_nSymbolCounter++ )
   DTRACE_CABAC_T( "\tparseQtCbf()" )
@@ -916,4 +986,5 @@
   DTRACE_CABAC_V( uiAbsPartIdx )
   DTRACE_CABAC_T( "\n" )
+#endif
   
   pcCU->setCbfSubParts( uiSymbol << uiTrDepth, eType, uiAbsPartIdx, uiDepth );
@@ -941,4 +1012,5 @@
     }
   }
+#if !H_MV_ENC_DEC_TRAC
   DTRACE_CABAC_VL( g_nSymbolCounter++ )
   DTRACE_CABAC_T("\tparseTransformSkip()");
@@ -952,4 +1024,5 @@
   DTRACE_CABAC_V( uiAbsPartIdx )
   DTRACE_CABAC_T( "\n" )
+#endif
 
   pcCU->setTransformSkipSubParts( useTransformSkip, eTType, uiAbsPartIdx, uiDepth);
@@ -1027,4 +1100,5 @@
 Void TDecSbac::parseCoeffNxN( TComDataCU* pcCU, TCoeff* pcCoef, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt uiDepth, TextType eTType )
 {
+#if !H_MV_ENC_DEC_TRAC
   DTRACE_CABAC_VL( g_nSymbolCounter++ )
   DTRACE_CABAC_T( "\tparseCoeffNxN()\teType=" )
@@ -1051,4 +1125,5 @@
   DTRACE_CABAC_V(  pcCU->getPredictionMode( uiAbsPartIdx ) )
   DTRACE_CABAC_T( "\n" )
+#endif
   
   if( uiWidth > pcCU->getSlice()->getSPS()->getMaxTrSize() )
@@ -1588,4 +1663,7 @@
     uiW += ( 1 == uiCode ? 1 : 0 );
   }
+#if H_MV_ENC_DEC_TRAC
+  DTRACE_CU("iv_res_pred_weight_idx", uiW )
+#endif
   pcCU->setARPWSubParts( ( UChar )( uiW ) , uiAbsPartIdx, uiDepth );  
 }
@@ -1604,4 +1682,5 @@
   UInt uiCtxIC = pcCU->getCtxICFlag( uiAbsPartIdx );
   m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUICFlagSCModel.get( 0, 0, uiCtxIC ) );
+#if !H_MV_ENC_DEC_TRAC 
   DTRACE_CABAC_VL( g_nSymbolCounter++ );
   DTRACE_CABAC_T( "\tICFlag" );
@@ -1611,4 +1690,7 @@
   DTRACE_CABAC_V( uiSymbol );
   DTRACE_CABAC_T( "\n");
+#else
+  DTRACE_CU("ic_flag", uiSymbol)
+#endif
   
   pcCU->setICFlagSubParts( uiSymbol ? true : false , uiAbsPartIdx, 0, uiDepth );
Index: /branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecSlice.cpp
===================================================================
--- /branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecSlice.cpp	(revision 520)
+++ /branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecSlice.cpp	(revision 521)
@@ -123,4 +123,8 @@
   DTRACE_CABAC_T( "\tPOC: " );
   DTRACE_CABAC_V( rpcPic->getPOC() );
+#if H_MV_ENC_DEC_TRAC
+  DTRACE_CABAC_T( " Layer: " );
+  DTRACE_CABAC_V( rpcPic->getLayerId() );
+#endif
   DTRACE_CABAC_T( "\n" );
 
Index: /branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecTop.cpp
===================================================================
--- /branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecTop.cpp	(revision 520)
+++ /branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecTop.cpp	(revision 521)
@@ -718,4 +718,10 @@
     return false; 
   }
+#if ENC_DEC_TRACE
+#if H_MV_ENC_DEC_TRAC
+  // parse remainder of SH
+   g_disableHLSTrace = false; 
+#endif
+#endif
 #endif
   // actual decoding starts here
Index: /branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncCavlc.cpp
===================================================================
--- /branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 520)
+++ /branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 521)
@@ -39,4 +39,5 @@
 #include "TEncCavlc.h"
 #include "SEIwrite.h"
+#include "../TLibCommon/TypeDef.h"
 
 //! \ingroup TLibEncoder
@@ -47,10 +48,18 @@
 Void  xTraceSPSHeader (TComSPS *pSPS)
 {
+#if H_MV_ENC_DEC_TRAC
+  fprintf( g_hTrace, "=========== Sequence Parameter Set ===========\n" );
+#else
   fprintf( g_hTrace, "=========== Sequence Parameter Set ID: %d ===========\n", pSPS->getSPSId() );
+#endif
 }
 
 Void  xTracePPSHeader (TComPPS *pPPS)
 {
+#if H_MV_ENC_DEC_TRAC
+  fprintf( g_hTrace, "=========== Picture Parameter Set ===========\n" );
+#else
   fprintf( g_hTrace, "=========== Picture Parameter Set ID: %d ===========\n", pPPS->getPPSId() );
+#endif
 }
 
@@ -838,5 +847,5 @@
     //   colour_plane_id                                      u(2)
 
-#if H_MV
+#if H_MV && !H_MV_FIX1071
     // Temporary fix for FIX1071 should be removed later
     TComReferencePictureSet* rps = pcSlice->getRPS();
@@ -846,9 +855,20 @@
       Int picOrderCntLSB = (pcSlice->getPOC()-pcSlice->getLastIDR()+(1<<pcSlice->getSPS()->getBitsForPOC()))%(1<<pcSlice->getSPS()->getBitsForPOC());
       WRITE_CODE( picOrderCntLSB, pcSlice->getSPS()->getBitsForPOC(), "pic_order_cnt_lsb");
-#if !H_MV
-      // Temporary fix for FIX1071 should be removed later
+#if !H_MV || H_MV_FIX1071
       TComReferencePictureSet* rps = pcSlice->getRPS();
 #endif      
-#if FIX1071
+#if FIX1071 && H_MV_FIX1071
+      // check for bitstream restriction stating that:
+      // If the current picture is a BLA or CRA picture, the value of NumPocTotalCurr shall be equal to 0.
+      // Ideally this process should not be repeated for each slice in a picture
+      if (pcSlice->isIRAP())
+      {
+          for (Int picIdx = 0; picIdx < rps->getNumberOfPictures(); picIdx++)
+          {
+          assert (!rps->getUsed(picIdx));
+          }
+        }
+#endif
+#if FIX1071 && !H_MV_FIX1071
       // Deal with bitstream restriction stating that:
       // – If the current picture is a BLA or CRA picture, the value of NumPocTotalCurr shall be equal to 0.
@@ -872,5 +892,4 @@
         }
       }
-
       if(pcSlice->getRPSidx() < 0 || useAltRps)
 #else
@@ -1009,5 +1028,5 @@
       pcSlice->setNumRefIdx(REF_PIC_LIST_1, 0);
     }
-#if H_MV
+#if H_MV && !H_MV_FIX1071
     // Temporary fix for FIX1071 should be removed later
     if( pcSlice->getPPS()->getListsModificationPresentFlag() && pcSlice->getNumRpsCurrTempList( rps ) > 1)
Index: /branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncCu.cpp
===================================================================
--- /branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncCu.cpp	(revision 520)
+++ /branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncCu.cpp	(revision 521)
@@ -1223,4 +1223,12 @@
   UInt uiBPelY   = uiTPelY + (g_uiMaxCUHeight>>uiDepth) - 1;
   
+#if H_MV_ENC_DEC_TRAC
+  DTRACE_CU_S("=========== coding_quadtree ===========\n")
+  DTRACE_CU("x0", uiLPelX)
+  DTRACE_CU("x1", uiTPelY)
+  DTRACE_CU("log2CbSize", g_uiMaxCUWidth>>uiDepth)
+  DTRACE_CU("cqtDepth"  , uiDepth)
+#endif
+
   TComSlice * pcSlice = pcCU->getPic()->getSlice(pcCU->getPic()->getCurrSliceIdx());
   // If slice start is within this cu...
@@ -1257,4 +1265,8 @@
   }
   
+#if H_MV_ENC_DEC_TRAC
+  DTRACE_CU_S("=========== coding_unit ===========\n")
+#endif
+
   if( (g_uiMaxCUWidth>>uiDepth) >= pcCU->getSlice()->getPPS()->getMinCuDQPSize() && pcCU->getSlice()->getPPS()->getUseDQP())
   {
@@ -1272,4 +1284,9 @@
   if( pcCU->isSkipped( uiAbsPartIdx ) )
   {
+#if H_MV_ENC_DEC_TRAC
+    DTRACE_PU_S("=========== prediction_unit ===========\n")
+    DTRACE_PU("x0", uiLPelX)
+    DTRACE_PU("x1", uiTPelY)
+#endif
     m_pcEntropyCoder->encodeMergeIndex( pcCU, uiAbsPartIdx );
 #if H_3D_IC
Index: /branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncEntropy.cpp
===================================================================
--- /branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncEntropy.cpp	(revision 520)
+++ /branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncEntropy.cpp	(revision 521)
@@ -368,4 +368,5 @@
   else
   {
+#if !H_MV_ENC_DEC_TRAC
     {
       DTRACE_CABAC_VL( g_nSymbolCounter++ );
@@ -378,4 +379,5 @@
       DTRACE_CABAC_T( "\n" );
     }
+#endif
     
     if( pcCU->getPredictionMode(uiAbsPartIdx) != MODE_INTRA && uiDepth == pcCU->getDepth( uiAbsPartIdx ) && !pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, 0 ) && !pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, 0 ) )
@@ -495,4 +497,10 @@
   for ( UInt uiPartIdx = 0, uiSubPartIdx = uiAbsPartIdx; uiPartIdx < uiNumPU; uiPartIdx++, uiSubPartIdx += uiPUOffset )
   {
+#if H_MV_ENC_DEC_TRAC
+    DTRACE_PU_S("=========== prediction_unit ===========\n")
+       //Todo: 
+      //DTRACE_PU("x0", uiLPelX)
+      //DTRACE_PU("x1", uiTPelY)
+#endif
     encodeMergeFlag( pcCU, uiSubPartIdx );
     if ( pcCU->getMergeFlag( uiSubPartIdx ) )
Index: /branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncGOP.cpp
===================================================================
--- /branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 520)
+++ /branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncGOP.cpp	(revision 521)
@@ -595,8 +595,15 @@
     pcSlice->getRPS()->setNumberOfLongtermPictures(0);
 
+#if FIX1071 && H_MV_FIX1071
+    if ((pcSlice->checkThatAllRefPicsAreAvailable(rcListPic, pcSlice->getRPS(), false) != 0) || (pcSlice->isIRAP()))
+    {
+      pcSlice->createExplicitReferencePictureSetFromReference(rcListPic, pcSlice->getRPS(), pcSlice->isIRAP());
+    }
+#else
     if(pcSlice->checkThatAllRefPicsAreAvailable(rcListPic, pcSlice->getRPS(), false) != 0)
     {
       pcSlice->createExplicitReferencePictureSetFromReference(rcListPic, pcSlice->getRPS());
     }
+#endif
     pcSlice->applyReferencePictureSet(rcListPic, pcSlice->getRPS());
 
Index: /branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncSbac.cpp
===================================================================
--- /branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncSbac.cpp	(revision 520)
+++ /branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncSbac.cpp	(revision 521)
@@ -439,4 +439,16 @@
 
   xWriteUnaryMaxSymbol(iSymbol, m_cMVPIdxSCModel.get(0), 1, iNum-1);
+#if H_MV_ENC_DEC_TRAC
+#if ENC_DEC_TRACE
+  if ( eRefList == REF_PIC_LIST_0 )
+  {
+    DTRACE_PU("mvp_l0_flag", iSymbol)
+  }
+  else
+  {
+    DTRACE_PU("mvp_l1_flag", iSymbol)
+  }
+#endif
+#endif
 }
 
@@ -449,8 +461,14 @@
     {
       m_pcBinIf->encodeBin( eSize == SIZE_2Nx2N? 1 : 0, m_cCUPartSizeSCModel.get( 0, 0, 0 ) );
+#if H_MV_ENC_DEC_TRAC
+      DTRACE_CU("part_mode", eSize == SIZE_2Nx2N? 1 : 0)
+#endif        
     }
     return;
   }
   
+#if H_MV_ENC_DEC_TRAC          
+  DTRACE_CU("part_mode", eSize )
+#endif        
   switch(eSize)
   {
@@ -531,4 +549,7 @@
   Int iPredMode = pcCU->getPredictionMode( uiAbsPartIdx );
   m_pcBinIf->encodeBin( iPredMode == MODE_INTER ? 0 : 1, m_cCUPredModeSCModel.get( 0, 0, 0 ) );
+#if H_MV_ENC_DEC_TRAC
+  DTRACE_CU("pred_mode_flag", iPredMode == MODE_INTER ? 0 : 1); 
+#endif
 }
 
@@ -537,4 +558,7 @@
   UInt uiSymbol = pcCU->getCUTransquantBypass(uiAbsPartIdx);
   m_pcBinIf->encodeBin( uiSymbol, m_CUTransquantBypassFlagSCModel.get( 0, 0, 0 ) );
+#if H_MV_ENC_DEC_TRAC
+  DTRACE_CU("cu_transquant_bypass_flag", uiSymbol); 
+#endif
 }
 
@@ -550,4 +574,5 @@
   UInt uiCtxSkip = pcCU->getCtxSkipFlag( uiAbsPartIdx ) ;
   m_pcBinIf->encodeBin( uiSymbol, m_cCUSkipFlagSCModel.get( 0, 0, uiCtxSkip ) );
+#if !H_MV_ENC_DEC_TRAC
   DTRACE_CABAC_VL( g_nSymbolCounter++ );
   DTRACE_CABAC_T( "\tSkipFlag" );
@@ -557,4 +582,7 @@
   DTRACE_CABAC_V( uiSymbol );
   DTRACE_CABAC_T( "\n");
+#else
+  DTRACE_CU("cu_skip_flag", uiSymbol); 
+#endif
 }
 
@@ -569,4 +597,7 @@
   m_pcBinIf->encodeBin( uiSymbol, *m_cCUMergeFlagExtSCModel.get( 0 ) );
 
+#if H_MV_ENC_DEC_TRAC
+  DTRACE_PU("merge_flag", uiSymbol); 
+#else
   DTRACE_CABAC_VL( g_nSymbolCounter++ );
   DTRACE_CABAC_T( "\tMergeFlag: " );
@@ -577,4 +608,5 @@
   DTRACE_CABAC_V( uiAbsPartIdx );
   DTRACE_CABAC_T( "\n" );
+#endif
 }
 
@@ -606,5 +638,9 @@
       }
     }
-  }
+#if H_MV_ENC_DEC_TRAC
+    DTRACE_PU("merge_idx", uiUnaryIdx); 
+#endif
+  }
+#if !H_MV_ENC_DEC_TRAC
   DTRACE_CABAC_VL( g_nSymbolCounter++ );
   DTRACE_CABAC_T( "\tparseMergeIndex()" );
@@ -612,4 +648,5 @@
   DTRACE_CABAC_V( pcCU->getMergeIndex( uiAbsPartIdx ) );
   DTRACE_CABAC_T( "\n" );
+#endif
 }
 
@@ -628,4 +665,7 @@
      m_pcBinIf->encodeBin( ( iW == iMaxW ) ? 1 : 0, m_cCUPUARPWSCModel.get( 0, 0, 3 ) );
   }
+#if H_MV_ENC_DEC_TRAC
+  DTRACE_CU("iv_res_pred_weight_idx", iW); 
+#endif
 }
 #endif
@@ -643,4 +683,5 @@
   UInt uiCtxIC  = pcCU->getCtxICFlag( uiAbsPartIdx ) ;
   m_pcBinIf->encodeBin( uiSymbol, m_cCUICFlagSCModel.get( 0, 0, uiCtxIC ) );
+#if !H_MV_ENC_DEC_TRAC
   DTRACE_CABAC_VL( g_nSymbolCounter++ );
   DTRACE_CABAC_T( "\tICFlag" );
@@ -650,4 +691,7 @@
   DTRACE_CABAC_V( uiSymbol );
   DTRACE_CABAC_T( "\n");
+#else
+  DTRACE_CU("ic_flag", uiSymbol ); 
+#endif
 }
 #endif
@@ -664,6 +708,10 @@
   assert( uiCtx < 3 );
   m_pcBinIf->encodeBin( uiCurrSplitFlag, m_cCUSplitFlagSCModel.get( 0, 0, uiCtx ) );
+#if !H_MV_ENC_DEC_TRAC
   DTRACE_CABAC_VL( g_nSymbolCounter++ )
   DTRACE_CABAC_T( "\tSplitFlag\n" )
+#else
+  DTRACE_CU("split_cu_flag", uiCurrSplitFlag ); 
+#endif
   return;
 }
@@ -672,4 +720,5 @@
 {
   m_pcBinIf->encodeBin( uiSymbol, m_cCUTransSubdivFlagSCModel.get( 0, 0, uiCtx ) );
+#if !H_MV_ENC_DEC_TRAC
   DTRACE_CABAC_VL( g_nSymbolCounter++ )
   DTRACE_CABAC_T( "\tparseTransformSubdivFlag()" )
@@ -679,4 +728,5 @@
   DTRACE_CABAC_V( uiCtx )
   DTRACE_CABAC_T( "\n" )
+#endif
 }
 
@@ -701,4 +751,7 @@
     }
     m_pcBinIf->encodeBin((predIdx[j] != -1)? 1 : 0, m_cCUIntraPredSCModel.get( 0, 0, 0 ) );
+#if H_MV_ENC_DEC_TRAC
+    DTRACE_CU("prev_intra_luma_pred_flag", (predIdx[j] != -1)? 1 : 0); 
+#endif
   }  
   for (j=0;j<partNum;j++)
@@ -711,4 +764,7 @@
         m_pcBinIf->encodeBinEP( predIdx[j]-1 );
       }
+#if H_MV_ENC_DEC_TRAC
+      DTRACE_CU("mpm_idx", predIdx[j] ); 
+#endif
     }
     else
@@ -731,4 +787,7 @@
       }
       m_pcBinIf->encodeBinsEP( dir[j], 5 );
+#if H_MV_ENC_DEC_TRAC
+      DTRACE_CU("rem_intra_luma_pred_mode", dir[j] ); 
+#endif
     }
   }
@@ -743,4 +802,7 @@
   {
     m_pcBinIf->encodeBin( 0, m_cCUChromaPredSCModel.get( 0, 0, 0 ) );
+#if H_MV_ENC_DEC_TRAC
+    DTRACE_CU("intra_chroma_pred_mode", 0 ); 
+#endif
   }
   else
@@ -760,4 +822,8 @@
 
     m_pcBinIf->encodeBinsEP( uiIntraDirChroma, 2 );
+#if H_MV_ENC_DEC_TRAC
+    DTRACE_CU("intra_chroma_pred_mode", uiIntraDirChroma ); 
+#endif
+
   }
   return;
@@ -777,4 +843,8 @@
     m_pcBinIf->encodeBin( uiInterDir, *( pCtx + 4 ) );
   }
+#if H_MV_ENC_DEC_TRAC
+  DTRACE_PU("inter_pred_idc", uiInterDir ); 
+#endif
+
   return;
 }
@@ -809,4 +879,17 @@
       }
     }
+#if H_MV_ENC_DEC_TRAC
+#if ENC_DEC_TRACE
+    iRefFrame = pcCU->getCUMvField( eRefList )->getRefIdx( uiAbsPartIdx ); 
+    if ( eRefList == REF_PIC_LIST_0 )
+    {
+      DTRACE_PU("ref_idx_l0", iRefFrame)
+    }
+    else
+    {
+      DTRACE_PU("ref_idx_l1", iRefFrame)
+    }
+#endif
+#endif
   }
   return;
@@ -896,4 +979,5 @@
   UInt uiCtx = pcCU->getCtxQtCbf( eType, uiTrDepth );
   m_pcBinIf->encodeBin( uiCbf , m_cCUQtCbfSCModel.get( 0, eType ? TEXT_CHROMA : eType, uiCtx ) );
+#if !H_MV_ENC_DEC_TRAC
   DTRACE_CABAC_VL( g_nSymbolCounter++ )
   DTRACE_CABAC_T( "\tparseQtCbf()" )
@@ -907,4 +991,5 @@
   DTRACE_CABAC_V( uiAbsPartIdx )
   DTRACE_CABAC_T( "\n" )
+#endif
 }
 
@@ -922,4 +1007,5 @@
   UInt useTransformSkip = pcCU->getTransformSkip( uiAbsPartIdx,eTType);
   m_pcBinIf->encodeBin( useTransformSkip, m_cTransformSkipSCModel.get( 0, eTType? TEXT_CHROMA: TEXT_LUMA, 0 ) );
+#if !H_MV_ENC_DEC_TRAC
   DTRACE_CABAC_VL( g_nSymbolCounter++ )
   DTRACE_CABAC_T("\tparseTransformSkip()");
@@ -933,4 +1019,5 @@
   DTRACE_CABAC_V( uiAbsPartIdx )
   DTRACE_CABAC_T( "\n" )
+#endif
 }
 
@@ -947,5 +1034,7 @@
 
   m_pcBinIf->encodeBinTrm (uiIPCM);
-
+#if H_MV_ENC_DEC_TRAC          
+  DTRACE_CU("pcm_flag", uiIPCM)
+#endif
   if (writePCMSampleFlag)
   {
@@ -1017,4 +1106,5 @@
   UInt uiCtx = 0;
   m_pcBinIf->encodeBin( uiCbf , m_cCUQtRootCbfSCModel.get( 0, 0, uiCtx ) );
+#if !H_MV_ENC_DEC_TRAC
   DTRACE_CABAC_VL( g_nSymbolCounter++ )
   DTRACE_CABAC_T( "\tparseQtRootCbf()" )
@@ -1026,4 +1116,7 @@
   DTRACE_CABAC_V( uiAbsPartIdx )
   DTRACE_CABAC_T( "\n" )
+#else
+  DTRACE_CU( "rqt_root_cbf", uiCbf )
+#endif
 }
 
@@ -1116,4 +1209,5 @@
 Void TEncSbac::codeCoeffNxN( TComDataCU* pcCU, TCoeff* pcCoef, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt uiDepth, TextType eTType )
 {
+#if !H_MV_ENC_DEC_TRAC
   DTRACE_CABAC_VL( g_nSymbolCounter++ )
   DTRACE_CABAC_T( "\tparseCoeffNxN()\teType=" )
@@ -1140,5 +1234,5 @@
   DTRACE_CABAC_V(  pcCU->getPredictionMode( uiAbsPartIdx ) )
   DTRACE_CABAC_T( "\n" )
-
+#endif
   if( uiWidth > m_pcSlice->getSPS()->getMaxTrSize() )
   {
Index: /branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncSlice.cpp
===================================================================
--- /branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncSlice.cpp	(revision 520)
+++ /branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncSlice.cpp	(revision 521)
@@ -1332,4 +1332,8 @@
   DTRACE_CABAC_T( "\tPOC: " );
   DTRACE_CABAC_V( rpcPic->getPOC() );
+#if H_MV_ENC_DEC_TRAC
+  DTRACE_CABAC_T( " Layer: " );
+  DTRACE_CABAC_V( rpcPic->getLayerId() );
+#endif
   DTRACE_CABAC_T( "\n" );
 #if ENC_DEC_TRACE
Index: /branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncTop.cpp
===================================================================
--- /branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncTop.cpp	(revision 520)
+++ /branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncTop.cpp	(revision 521)
@@ -507,4 +507,7 @@
   // mark it should be extended
   rpcPic->getPicYuvRec()->setBorderExtension(false);
+#if H_3D_VSO_FIX_BORDRE_EXTENSION
+  rpcPic->getPicYuvOrg()->setBorderExtension(false);
+#endif
 }
 
