Index: branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/SyntaxElementParser.cpp
===================================================================
--- branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/SyntaxElementParser.cpp	(revision 510)
+++ 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 510)
+++ 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 510)
+++ 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 510)
+++ 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 510)
+++ 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 510)
+++ 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 510)
+++ 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 510)
+++ 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
