Index: branches/HTM-13.1-dev0/source/Lib/TLibCommon/TComPrediction.cpp
===================================================================
--- branches/HTM-13.1-dev0/source/Lib/TLibCommon/TComPrediction.cpp	(revision 1172)
+++ branches/HTM-13.1-dev0/source/Lib/TLibCommon/TComPrediction.cpp	(revision 1173)
@@ -781,5 +781,5 @@
   // segmentation of texture block --> mask IDs
   Pel*  pDepthBlockStart      = pDepthPels;
-  
+
   // first compute average of depth block for thresholding
   Int iSumDepth = 0;
@@ -790,5 +790,5 @@
   uiMaxDepth = pDepthPels[ 0 ];
   iSumDepth  = pDepthPels[ 0 ];
-    UInt t=0;
+  UInt t=0;
   Int iPictureWidth = pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getPicYuvRec()->getWidth();
   Int iPictureHeight = pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getPicYuvRec()->getHeight();  
@@ -796,56 +796,56 @@
   if( pcCU->getSlice()->getDepthRefinementFlag(  ) )
   {
-      cDv.setVer(0);
+    cDv.setVer(0);
   }
   Int iBlkX = ( pcCU->getAddr() % pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getFrameWidthInCU() ) * g_uiMaxCUWidth  + g_auiRasterToPelX[ g_auiZscanToRaster[ pcCU->getZorderIdxInCU() ] ]+ ((cDv.getHor()+2)>>2);
   Int iBlkY = ( pcCU->getAddr() / pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getFrameWidthInCU() ) * g_uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ pcCU->getZorderIdxInCU() ] ]+ ((cDv.getVer()+2)>>2);
-if (iBlkX>(Int)(iPictureWidth - uiWidth))
-{
-  iSumDepth += pDepthPels[ iPictureWidth - iBlkX - 1 ];
-  uiMinDepth = std::min( uiMinDepth, (Int)pDepthPels[ iPictureWidth - iBlkX - 1 ]);
-  uiMaxDepth = std::max( uiMaxDepth, (Int)pDepthPels[ iPictureWidth - iBlkX - 1 ]);
-}
-else
-{
-  iSumDepth += pDepthPels[ uiWidth - 1 ];
-  uiMinDepth = std::min( uiMinDepth, (Int)pDepthPels[ uiWidth - 1 ]);
-  uiMaxDepth = std::max( uiMaxDepth, (Int)pDepthPels[ uiWidth - 1 ]);
-}
-if (iBlkY>(Int)(iPictureHeight - uiHeight))
-{
-  iSumDepth += pDepthPels[ uiDepthStride * (iPictureHeight - iBlkY - 1) ];
-  uiMinDepth = std::min( uiMinDepth, (Int)pDepthPels[ uiDepthStride * (iPictureHeight - iBlkY - 1) ]);
-  uiMaxDepth = std::max( uiMaxDepth, (Int)pDepthPels[ uiDepthStride * (iPictureHeight - iBlkY - 1) ]);
-}
-else
-{
-  iSumDepth += pDepthPels[ uiDepthStride * (uiHeight - 1) ];
-  uiMinDepth = std::min( uiMinDepth, (Int)pDepthPels[ uiDepthStride * (uiHeight - 1) ]);
-  uiMaxDepth = std::max( uiMaxDepth, (Int)pDepthPels[ uiDepthStride * (uiHeight - 1) ]);
-}
-if (iBlkY>(Int)(iPictureHeight - uiHeight) && iBlkX>(Int)(iPictureWidth - uiWidth))
-{
-  iSumDepth += pDepthPels[ uiDepthStride * (iPictureHeight - iBlkY - 1) + iPictureWidth - iBlkX - 1 ];
-  uiMinDepth = std::min( uiMinDepth, (Int)pDepthPels[ uiDepthStride * (iPictureHeight - iBlkY - 1) + iPictureWidth - iBlkX - 1 ]);
-  uiMaxDepth = std::max( uiMaxDepth, (Int)pDepthPels[ uiDepthStride * (iPictureHeight - iBlkY - 1) + iPictureWidth - iBlkX - 1 ]);
-}
-else if (iBlkY>(Int)(iPictureHeight - uiHeight))
-{
-  iSumDepth += pDepthPels[ uiDepthStride * (iPictureHeight - iBlkY - 1) + uiWidth - 1 ];
-  uiMinDepth = std::min( uiMinDepth, (Int)pDepthPels[ uiDepthStride * (iPictureHeight - iBlkY - 1) + uiWidth - 1 ]);
-  uiMaxDepth = std::max( uiMaxDepth, (Int)pDepthPels[ uiDepthStride * (iPictureHeight - iBlkY - 1) + uiWidth - 1 ]);
-}
-else if (iBlkX>(Int)(iPictureWidth - uiWidth))
-{
-  iSumDepth += pDepthPels[ uiDepthStride * (uiHeight - 1) + iPictureWidth - iBlkX - 1 ];
-  uiMinDepth = std::min( uiMinDepth, (Int)pDepthPels[ uiDepthStride * (uiHeight - 1) + iPictureWidth - iBlkX - 1 ]);
-  uiMaxDepth = std::max( uiMaxDepth, (Int)pDepthPels[ uiDepthStride * (uiHeight - 1) + iPictureWidth - iBlkX - 1 ]);
-}
-else
-{
-  iSumDepth += pDepthPels[ uiDepthStride * (uiHeight - 1) + uiWidth - 1 ];
-  uiMinDepth = std::min( uiMinDepth, (Int)pDepthPels[ uiDepthStride * (uiHeight - 1) + uiWidth - 1 ]);
-  uiMaxDepth = std::max( uiMaxDepth, (Int)pDepthPels[ uiDepthStride * (uiHeight - 1) + uiWidth - 1 ]);
-}
+  if (iBlkX>(Int)(iPictureWidth - uiWidth))
+  {
+    iSumDepth += pDepthPels[ iPictureWidth - iBlkX - 1 ];
+    uiMinDepth = std::min( uiMinDepth, (Int)pDepthPels[ iPictureWidth - iBlkX - 1 ]);
+    uiMaxDepth = std::max( uiMaxDepth, (Int)pDepthPels[ iPictureWidth - iBlkX - 1 ]);
+  }
+  else
+  {
+    iSumDepth += pDepthPels[ uiWidth - 1 ];
+    uiMinDepth = std::min( uiMinDepth, (Int)pDepthPels[ uiWidth - 1 ]);
+    uiMaxDepth = std::max( uiMaxDepth, (Int)pDepthPels[ uiWidth - 1 ]);
+  }
+  if (iBlkY>(Int)(iPictureHeight - uiHeight))
+  {
+    iSumDepth += pDepthPels[ uiDepthStride * (iPictureHeight - iBlkY - 1) ];
+    uiMinDepth = std::min( uiMinDepth, (Int)pDepthPels[ uiDepthStride * (iPictureHeight - iBlkY - 1) ]);
+    uiMaxDepth = std::max( uiMaxDepth, (Int)pDepthPels[ uiDepthStride * (iPictureHeight - iBlkY - 1) ]);
+  }
+  else
+  {
+    iSumDepth += pDepthPels[ uiDepthStride * (uiHeight - 1) ];
+    uiMinDepth = std::min( uiMinDepth, (Int)pDepthPels[ uiDepthStride * (uiHeight - 1) ]);
+    uiMaxDepth = std::max( uiMaxDepth, (Int)pDepthPels[ uiDepthStride * (uiHeight - 1) ]);
+  }
+  if (iBlkY>(Int)(iPictureHeight - uiHeight) && iBlkX>(Int)(iPictureWidth - uiWidth))
+  {
+    iSumDepth += pDepthPels[ uiDepthStride * (iPictureHeight - iBlkY - 1) + iPictureWidth - iBlkX - 1 ];
+    uiMinDepth = std::min( uiMinDepth, (Int)pDepthPels[ uiDepthStride * (iPictureHeight - iBlkY - 1) + iPictureWidth - iBlkX - 1 ]);
+    uiMaxDepth = std::max( uiMaxDepth, (Int)pDepthPels[ uiDepthStride * (iPictureHeight - iBlkY - 1) + iPictureWidth - iBlkX - 1 ]);
+  }
+  else if (iBlkY>(Int)(iPictureHeight - uiHeight))
+  {
+    iSumDepth += pDepthPels[ uiDepthStride * (iPictureHeight - iBlkY - 1) + uiWidth - 1 ];
+    uiMinDepth = std::min( uiMinDepth, (Int)pDepthPels[ uiDepthStride * (iPictureHeight - iBlkY - 1) + uiWidth - 1 ]);
+    uiMaxDepth = std::max( uiMaxDepth, (Int)pDepthPels[ uiDepthStride * (iPictureHeight - iBlkY - 1) + uiWidth - 1 ]);
+  }
+  else if (iBlkX>(Int)(iPictureWidth - uiWidth))
+  {
+    iSumDepth += pDepthPels[ uiDepthStride * (uiHeight - 1) + iPictureWidth - iBlkX - 1 ];
+    uiMinDepth = std::min( uiMinDepth, (Int)pDepthPels[ uiDepthStride * (uiHeight - 1) + iPictureWidth - iBlkX - 1 ]);
+    uiMaxDepth = std::max( uiMaxDepth, (Int)pDepthPels[ uiDepthStride * (uiHeight - 1) + iPictureWidth - iBlkX - 1 ]);
+  }
+  else
+  {
+    iSumDepth += pDepthPels[ uiDepthStride * (uiHeight - 1) + uiWidth - 1 ];
+    uiMinDepth = std::min( uiMinDepth, (Int)pDepthPels[ uiDepthStride * (uiHeight - 1) + uiWidth - 1 ]);
+    uiMaxDepth = std::max( uiMaxDepth, (Int)pDepthPels[ uiDepthStride * (uiHeight - 1) + uiWidth - 1 ]);
+  }
 #else
   iSumDepth  = pDepthPels[ 0 ];
@@ -864,5 +864,5 @@
   uiMaxDepth = std::max( uiMaxDepth, (Int)pDepthPels[ uiDepthStride * (uiHeight - 1) + uiWidth - 1 ]);
 #endif
-  
+
   // don't generate mask for blocks with small depth range (encoder decision)
   if( uiMaxDepth - uiMinDepth < 10 )
@@ -870,13 +870,13 @@
     return false;
   }
-  
+
   AOF(uiWidth==uiHeight);
   Int iMean = iSumDepth >> 2;
-  
+
   // start again for segmentation
   pDepthPels = pDepthBlockStart;
-  
+
   Bool bInvertMask = pDepthPels[0]>iMean; // top-left segment needs to be mapped to partIdx 0
-  
+
   // generate mask
   UInt uiSumPix[2] = {0,0};
@@ -894,33 +894,33 @@
       {
         depthPel = pDepthPels[x];
-         t=x;
+        t=x;
       }
 #else
       Int depthPel = pDepthPels[x];
 #endif
-      
+
       // decide which segment this pixel belongs to
       Int ucSegment = (Int)(depthPel>iMean);
-      
+
       if( bInvertMask )
       {
         ucSegment = 1-ucSegment;
       }
-      
+
       // count pixels for each segment
       uiSumPix[ucSegment]++;
-      
+
       // set mask value
       pMask[x] = (Bool)ucSegment;
     }
-    
+
     // next row
 #if HS_DBBP_CLEAN_K0048
     if (!(iBlkY+y+1>iPictureHeight))
 #endif
-    pDepthPels += uiDepthStride;
+      pDepthPels += uiDepthStride;
     pMask += MAX_CU_SIZE;
   }
-  
+
   // don't generate valid mask for tiny segments (encoder decision)
   // each segment needs to cover at least 1/8th of block
@@ -930,5 +930,5 @@
     return false;
   }
-  
+
   // all good
   return true;
Index: branches/HTM-13.1-dev0/source/Lib/TLibCommon/TComRom.cpp
===================================================================
--- branches/HTM-13.1-dev0/source/Lib/TLibCommon/TComRom.cpp	(revision 1172)
+++ branches/HTM-13.1-dev0/source/Lib/TLibCommon/TComRom.cpp	(revision 1173)
@@ -391,14 +391,15 @@
 Bool g_tracePU = false; 
 Bool g_traceTU = false; 
-Bool g_disableNumbering = true; 
+Bool g_disableNumbering = false; 
 Bool g_disableHLSTrace = false; 
-UInt64 g_stopAtCounter       = 0; 
+UInt64 g_stopAtCounter       = 937234; 
 Bool g_traceCopyBack         = false; 
 Bool g_decTraceDispDer       = false; 
 Bool g_decTraceMvFromMerge   = false; 
 Bool g_decTracePicOutput     = false; 
-Bool g_stopAtPos             = false; 
-Bool g_outputPos             = false; 
-Bool g_traceCameraParameters = true; 
+Bool g_stopAtPos             = true; 
+Bool g_outputPos             = true;   
+Bool g_traceCameraParameters = false; 
+Bool g_encNumberOfWrittenBits     = true; 
 #endif
 #endif
@@ -607,5 +608,5 @@
     if ( stopAtCU )        // Stop at CU with specific size
     {    
-      stopFlag = ( cuPelX  == 0 ) && ( cuPelY  == 0 ) && ( cuWidth == 16 ) && ( cuHeight == 16 ); 
+      stopFlag = ( cuPelX  == 0 ) && ( cuPelY  == 0 ) && ( cuWidth == 8 ) && ( cuHeight == 8 ); 
     }
     else
Index: branches/HTM-13.1-dev0/source/Lib/TLibCommon/TComRom.h
===================================================================
--- branches/HTM-13.1-dev0/source/Lib/TLibCommon/TComRom.h	(revision 1172)
+++ branches/HTM-13.1-dev0/source/Lib/TLibCommon/TComRom.h	(revision 1173)
@@ -230,5 +230,5 @@
 
 #ifndef ENC_DEC_TRACE
-#define ENC_DEC_TRACE   0 
+#define ENC_DEC_TRACE   0  
 #endif
 
@@ -266,4 +266,5 @@
  extern Bool   g_outputPos;             // Output position
  extern Bool   g_traceCameraParameters; // Trace camera parameters
+ extern Bool   g_encNumberOfWrittenBits;// Trace number of written bits
 
 #define DTRACE_CU(x,y)             writeToTraceFile( x,y, g_traceCU );
Index: branches/HTM-13.1-dev0/source/Lib/TLibCommon/TComSlice.h
===================================================================
--- branches/HTM-13.1-dev0/source/Lib/TLibCommon/TComSlice.h	(revision 1172)
+++ branches/HTM-13.1-dev0/source/Lib/TLibCommon/TComSlice.h	(revision 1173)
@@ -1200,4 +1200,5 @@
 #endif
 #endif
+
 #if HHI_INTER_COMP_PRED_K0052
 #if HHI_CAM_PARA_K0052
@@ -1216,5 +1217,5 @@
     assert( 0 );   
     return -1; 
-  }; 
+  };
 
 #if HHI_CAM_PARA_K0052
@@ -1404,4 +1405,5 @@
 #else
   UInt getCamParPrecision    ()  { return m_uiCamParPrecision; }
+
   Bool getCamParPresent      ( Int viewIndex )  { return m_bCamParPresent[viewIndex]; }
   Void setCamParPresent      ( Int viewIndex, Bool val )  { m_bCamParPresent[viewIndex] = val; }
@@ -3037,5 +3039,5 @@
 
     for( Int i = 0; i <= numCurCmpLIds - 1; i++ )
-    {
+    {      
       m_inCmpRefViewIdcs.push_back( getVPS()->getViewOrderIdx( curCmpLIds[ i ] ));
 #if HHI_CAM_PARA_K0052
Index: branches/HTM-13.1-dev0/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- branches/HTM-13.1-dev0/source/Lib/TLibCommon/TypeDef.h	(revision 1172)
+++ branches/HTM-13.1-dev0/source/Lib/TLibCommon/TypeDef.h	(revision 1173)
@@ -335,4 +335,5 @@
 #define HHI_RES_PRED_K0052                     1
 #define HHI_CAM_PARA_K0052                     1
+#define HHI_MOVE_SYN_K0052                     1
 #define H_3D_ANNEX_SELECTION_FIX               1
 #endif
Index: branches/HTM-13.1-dev0/source/Lib/TLibDecoder/TDecCu.cpp
===================================================================
--- branches/HTM-13.1-dev0/source/Lib/TLibDecoder/TDecCu.cpp	(revision 1172)
+++ branches/HTM-13.1-dev0/source/Lib/TLibDecoder/TDecCu.cpp	(revision 1173)
@@ -559,7 +559,9 @@
   m_pcEntropyDecoder->decodePartSize( pcCU, uiAbsPartIdx, uiDepth );
 
+#if !HHI_MOVE_SYN_K0052
 #if H_3D_DIM_SDC
   m_pcEntropyDecoder->decodeSDCFlag( pcCU, uiAbsPartIdx, uiDepth );
 #endif
+#endif
   if (pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N )
   {
@@ -568,4 +570,9 @@
     if(pcCU->getIPCMFlag(uiAbsPartIdx))
     {
+#if HHI_MOVE_SYN_K0052
+#if H_3D_DIM_SDC
+      m_pcEntropyDecoder->decodeSDCFlag( pcCU, uiAbsPartIdx, uiDepth );
+#endif
+#endif
       xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast );
 #if H_3D_IV_MERGE
@@ -581,4 +588,5 @@
   // prediction mode ( Intra : direction mode, Inter : Mv, reference idx )
   m_pcEntropyDecoder->decodePredInfo( pcCU, uiAbsPartIdx, uiDepth, m_ppcCU[uiDepth]);
+
   // Coefficient decoding
   Bool bCodeDQP = getdQPFlag();
Index: branches/HTM-13.1-dev0/source/Lib/TLibDecoder/TDecEntropy.cpp
===================================================================
--- branches/HTM-13.1-dev0/source/Lib/TLibDecoder/TDecEntropy.cpp	(revision 1172)
+++ branches/HTM-13.1-dev0/source/Lib/TLibDecoder/TDecEntropy.cpp	(revision 1173)
@@ -161,5 +161,5 @@
 {
   m_pcEntropyDecoderIf->parsePartSize( pcCU, uiAbsPartIdx, uiDepth );
-  
+#if !HHI_MOVE_SYN_K0052  
 #if H_3D_DBBP
 if( pcCU->getSlice()->getDepthBasedBlkPartFlag() && (pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2NxN || pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_Nx2N) && pcCU->getWidth(uiAbsPartIdx) > 8 && pcCU->getSlice()->getDefaultRefViewIdxAvailableFlag() )
@@ -168,4 +168,5 @@
   }
 #endif
+#endif
 }
 
@@ -175,7 +176,14 @@
   {
     decodeIntraDirModeLuma  ( pcCU, uiAbsPartIdx, uiDepth );
+#if HHI_MOVE_SYN_K0052
+    decodeSDCFlag   ( pcCU, uiAbsPartIdx, uiDepth );    
+#endif
 #if H_3D_DIM_SDC
 #if H_3D_DISABLE_CHROMA
+#if !HHI_MOVE_SYN_K0052
     if(!pcCU->getSDCFlag(uiAbsPartIdx) && !pcCU->getSlice()->getIsDepth() )
+#else
+    if(!pcCU->getSlice()->getIsDepth() )
+#endif
 #else
     if(!pcCU->getSDCFlag(uiAbsPartIdx))
@@ -257,4 +265,5 @@
   pcSubCU->copyDVInfoFrom( pcCU, uiAbsPartIdx);
 #endif
+#if HHI_MOVE_SYN_K0052
   for ( UInt uiPartIdx = 0, uiSubPartIdx = uiAbsPartIdx; uiPartIdx < uiNumPU; uiPartIdx++, uiSubPartIdx += uiPUOffset )
   {
@@ -265,15 +274,43 @@
     //DTRACE_PU("x1", uiTPelY)
 #endif
+
+    ////// Parse PUs syntax
     decodeMergeFlag( pcCU, uiSubPartIdx, uiDepth, uiPartIdx );
     if ( pcCU->getMergeFlag( uiSubPartIdx ) )
     {
-      decodeMergeIndex( pcCU, uiPartIdx, uiSubPartIdx, uiDepth );
+      decodeMergeIndex( pcCU, uiPartIdx, uiSubPartIdx, uiDepth );      
+    }
+    else
+    {
+      decodeInterDirPU( pcCU, uiSubPartIdx, uiDepth, uiPartIdx );
+      for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )
+      {        
+        if ( pcCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 )
+        {
+          decodeRefFrmIdxPU( pcCU,    uiSubPartIdx,              uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) );
+          decodeMvdPU      ( pcCU,    uiSubPartIdx,              uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) );
+          decodeMVPIdxPU   ( pcSubCU, uiSubPartIdx-uiAbsPartIdx, uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) );
+        }
+      }
+    }
+  }
+
+  ////// Parse CUs extension syntax
+  decodeDBBPFlag( pcCU, uiAbsPartIdx, uiDepth ); 
+  decodeSDCFlag ( pcCU, uiAbsPartIdx, uiDepth ); 
+
+#if H_3D_ARP
+  decodeARPW  ( pcCU, uiAbsPartIdx, uiDepth );
+#endif
+#if H_3D_IC
+  decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
+#endif
+
+  ////// Decode motion vectors
+  for ( UInt uiPartIdx = 0, uiSubPartIdx = uiAbsPartIdx; uiPartIdx < uiNumPU; uiPartIdx++, uiSubPartIdx += uiPUOffset )
+  {
+    if ( pcCU->getMergeFlag( uiSubPartIdx ) )
+    {
       UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);
-#if H_3D_ARP
-      decodeARPW  ( pcCU, uiAbsPartIdx, uiDepth );
-#endif
-#if H_3D_IC
-      decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
-#endif
 #if H_3D_DBBP
       if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && ePartSize != SIZE_2Nx2N && pcSubCU->getWidth( 0 ) <= 8 && pcCU->getDBBPFlag(uiAbsPartIdx) == false )
@@ -408,4 +445,172 @@
     else
     {
+      for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )
+      {        
+        if ( pcCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 )
+        {
+          decodeMvsAMVP   ( pcSubCU, uiSubPartIdx-uiAbsPartIdx, uiDepth, uiPartIdx, RefPicList( uiRefListIdx ) );
+        }
+      }
+    }
+
+    if ( (pcCU->getInterDir(uiSubPartIdx) == 3) && pcSubCU->isBipredRestriction(uiPartIdx) )
+    {
+      pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMv( TComMv(0,0), ePartSize, uiSubPartIdx, uiDepth, uiPartIdx);
+      pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllRefIdx( -1, ePartSize, uiSubPartIdx, uiDepth, uiPartIdx);
+      pcCU->setInterDirSubParts( 1, uiSubPartIdx, uiPartIdx, uiDepth);
+    }
+  }
+#else
+  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 ) )
+    {
+      decodeMergeIndex( pcCU, uiPartIdx, uiSubPartIdx, uiDepth );
+      UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);
+#if H_3D_ARP
+      decodeARPW  ( pcCU, uiAbsPartIdx, uiDepth );
+#endif
+#if H_3D_IC
+      decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
+#endif
+#if H_3D_DBBP
+      if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && ePartSize != SIZE_2Nx2N && pcSubCU->getWidth( 0 ) <= 8 && pcCU->getDBBPFlag(uiAbsPartIdx) == false )
+#else
+      if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && ePartSize != SIZE_2Nx2N && pcSubCU->getWidth( 0 ) <= 8 ) 
+#endif
+      {
+        pcSubCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth );
+        if ( !isMerged )
+        {
+#if H_3D_VSP
+          Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
+          memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
+#if H_3D_SPIVMP
+          memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);
+#endif
+          pcSubCU->initAvailableFlags();
+          pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand);
+          pcSubCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours
+#if H_3D_SPIVMP
+            , pcMvFieldSP, puhInterDirSP
+#endif
+            , numValidMergeCand );
+          pcSubCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours, vspFlag
+#if H_3D_SPIVMP
+            , bSPIVMPFlag
+#endif
+            , numValidMergeCand );
+          pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
+
+#else
+#if H_3D
+          pcSubCU->initAvailableFlags();
+          pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand);
+          pcSubCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
+
+#else
+          pcSubCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
+#endif
+#endif
+          isMerged = true;
+        }
+        pcSubCU->setPartSizeSubParts( ePartSize, 0, uiDepth );
+      }
+      else
+      {
+        uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);
+#if H_3D_VSP
+        Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
+        memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
+#if H_3D_SPIVMP
+        memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM);
+#endif
+        pcSubCU->initAvailableFlags();
+        pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
+        pcSubCU->xGetInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours
+#if H_3D_SPIVMP
+          , pcMvFieldSP, puhInterDirSP
+#endif
+          ,numValidMergeCand, uiMergeIndex );
+        pcSubCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours, vspFlag
+#if H_3D_SPIVMP
+          , bSPIVMPFlag
+#endif
+          ,numValidMergeCand );
+        pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
+#else
+#if H_3D
+        pcSubCU->initAvailableFlags();
+        pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
+        pcSubCU->xGetInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
+#else
+        pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
+#endif
+#endif
+      }
+      pcCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );
+
+      TComMv cTmpMv( 0, 0 );
+      for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )
+      {        
+        if ( pcCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 )
+        {
+          pcCU->setMVPIdxSubParts( 0, RefPicList( uiRefListIdx ), uiSubPartIdx, uiPartIdx, uiDepth);
+          pcCU->setMVPNumSubParts( 0, RefPicList( uiRefListIdx ), uiSubPartIdx, uiPartIdx, uiDepth);
+          pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvd( cTmpMv, ePartSize, uiSubPartIdx, uiDepth, uiPartIdx );
+          pcCU->getCUMvField( RefPicList( uiRefListIdx ) )->setAllMvField( cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ], ePartSize, uiSubPartIdx, uiDepth, uiPartIdx );
+#if H_3D_VSP
+#if H_3D_DBBP
+          if( pcCU->getVSPFlag( uiSubPartIdx ) != 0 && !pcCU->getDBBPFlag( uiAbsPartIdx ) )
+#else
+          if( pcCU->getVSPFlag( uiSubPartIdx ) != 0 )
+#endif
+          {
+            if ( uhInterDirNeighbours[ uiMergeIndex ] & (1<<uiRefListIdx) )
+            {
+              UInt dummy;
+              Int vspSize;
+              Int width, height;
+              pcCU->getPartIndexAndSize( uiPartIdx, dummy, width, height, uiSubPartIdx, pcCU->getTotalNumPart()==256 );
+              pcCU->setMvFieldPUForVSP( pcCU, uiSubPartIdx, width, height, RefPicList( uiRefListIdx ), cMvFieldNeighbours[ 2*uiMergeIndex + uiRefListIdx ].getRefIdx(), vspSize );
+              pcCU->setVSPFlag( uiSubPartIdx, vspSize );
+            }
+          }
+#endif
+        }
+      }
+#if H_3D_SPIVMP
+      pcCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMergeIndex], uiSubPartIdx, uiPartIdx, uiDepth );  
+      if (bSPIVMPFlag[uiMergeIndex] != 0)
+      {
+        Int iWidth, iHeight;
+        UInt uiIdx;
+        pcCU->getPartIndexAndSize( uiPartIdx, uiIdx, iWidth, iHeight, uiSubPartIdx, true );
+
+        UInt uiSPAddr;
+
+        Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight;
+
+        pcCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight);
+
+        for (Int iPartitionIdx = 0; iPartitionIdx < iNumSP; iPartitionIdx++)
+        {
+          pcCU->getSPAbsPartIdx(uiSubPartIdx, iSPWidth, iSPHeight, iPartitionIdx, iNumSPInOneLine, uiSPAddr);
+          pcCU->setInterDirSP(puhInterDirSP[iPartitionIdx], uiSPAddr, iSPWidth, iSPHeight);
+          pcCU->getCUMvField( REF_PIC_LIST_0 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx], iSPWidth, iSPHeight);
+          pcCU->getCUMvField( REF_PIC_LIST_1 )->setMvFieldSP(pcCU, uiSPAddr, pcMvFieldSP[2*iPartitionIdx + 1], iSPWidth, iSPHeight);
+        }
+      }
+#endif
+    }
+    else
+    {
       decodeInterDirPU( pcCU, uiSubPartIdx, uiDepth, uiPartIdx );
       for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )
@@ -432,4 +637,5 @@
     }
   }
+#endif
 #if H_3D_SPIVMP
   delete[] pcMvFieldSP;
@@ -500,17 +706,8 @@
 }
 
+#if HHI_MOVE_SYN_K0052
 Void TDecEntropy::decodeMVPIdxPU( TComDataCU* pcSubCU, UInt uiPartAddr, UInt uiDepth, UInt uiPartIdx, RefPicList eRefList )
 {
   Int iMVPIdx = -1;
-
-  TComMv cZeroMv( 0, 0 );
-  TComMv cMv     = cZeroMv;
-  Int    iRefIdx = -1;
-
-  TComCUMvField* pcSubCUMvField = pcSubCU->getCUMvField( eRefList );
-  AMVPInfo* pAMVPInfo = pcSubCUMvField->getAMVPInfo();
-
-  iRefIdx = pcSubCUMvField->getRefIdx(uiPartAddr);
-  cMv = cZeroMv;
 
   if ( (pcSubCU->getInterDir(uiPartAddr) & ( 1 << eRefList )) )
@@ -530,4 +727,62 @@
 #endif
   }
+  pcSubCU->setMVPIdxSubParts( iMVPIdx, eRefList, uiPartAddr, uiPartIdx, uiDepth );
+}
+
+Void TDecEntropy::decodeMvsAMVP( TComDataCU* pcSubCU, UInt uiPartAddr, UInt uiDepth, UInt uiPartIdx, RefPicList eRefList )
+{
+  TComMv cZeroMv( 0, 0 );
+  TComMv cMv     = cZeroMv;
+  Int    iRefIdx = -1;
+
+  TComCUMvField* pcSubCUMvField = pcSubCU->getCUMvField( eRefList );
+  AMVPInfo* pAMVPInfo = pcSubCUMvField->getAMVPInfo();
+
+  iRefIdx = pcSubCUMvField->getRefIdx(uiPartAddr);
+  cMv = cZeroMv;
+
+  pcSubCU->fillMvpCand(uiPartIdx, uiPartAddr, eRefList, iRefIdx, pAMVPInfo);
+  pcSubCU->setMVPNumSubParts(pAMVPInfo->iN, eRefList, uiPartAddr, uiPartIdx, uiDepth);
+  if ( iRefIdx >= 0 )
+  {
+    m_pcPrediction->getMvPredAMVP( pcSubCU, uiPartIdx, uiPartAddr, eRefList, cMv);
+    cMv += pcSubCUMvField->getMvd( uiPartAddr );
+  }
+
+  PartSize ePartSize = pcSubCU->getPartitionSize( uiPartAddr );
+  pcSubCU->getCUMvField( eRefList )->setAllMv(cMv, ePartSize, uiPartAddr, 0, uiPartIdx);
+}
+
+#else
+Void TDecEntropy::decodeMVPIdxPU( TComDataCU* pcSubCU, UInt uiPartAddr, UInt uiDepth, UInt uiPartIdx, RefPicList eRefList )
+{
+  Int iMVPIdx = -1;
+
+  TComMv cZeroMv( 0, 0 );
+  TComMv cMv     = cZeroMv;
+  Int    iRefIdx = -1;
+
+  TComCUMvField* pcSubCUMvField = pcSubCU->getCUMvField( eRefList );
+  AMVPInfo* pAMVPInfo = pcSubCUMvField->getAMVPInfo();
+
+  iRefIdx = pcSubCUMvField->getRefIdx(uiPartAddr);
+  cMv = cZeroMv;
+
+  if ( (pcSubCU->getInterDir(uiPartAddr) & ( 1 << eRefList )) )
+  {
+    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);
   pcSubCU->setMVPNumSubParts(pAMVPInfo->iN, eRefList, uiPartAddr, uiPartIdx, uiDepth);
@@ -542,5 +797,5 @@
   pcSubCU->getCUMvField( eRefList )->setAllMv(cMv, ePartSize, uiPartAddr, 0, uiPartIdx);
 }
-
+#endif
 Void TDecEntropy::xDecodeTransform( TComDataCU* pcCU, UInt offsetLuma, UInt offsetChroma, UInt uiAbsPartIdx, UInt uiDepth, UInt width, UInt height, UInt uiTrIdx, Bool& bCodeDQP, Int quadtreeTULog2MinSizeInCU)
 {
@@ -876,4 +1131,11 @@
 {
   pcCU->setSDCFlagSubParts( false, uiAbsPartIdx, uiDepth );
+#if HHI_MOVE_SYN_K0052
+  if ( pcCU->isSkipped( uiAbsPartIdx ) )
+  {
+    return; 
+  }
+#endif
+
 
   if( ( !pcCU->isIntra( uiAbsPartIdx ) && !pcCU->getSlice()->getInterSdcFlag() ) || 
@@ -895,5 +1157,12 @@
 Void TDecEntropy::decodeDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
 {
-  m_pcEntropyDecoderIf->parseDBBPFlag( pcCU, uiAbsPartIdx, uiDepth );
+#if HHI_MOVE_SYN_K0052
+  if( pcCU->getSlice()->getDepthBasedBlkPartFlag() && (pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2NxN || pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_Nx2N) && pcCU->getWidth(uiAbsPartIdx) > 8 && pcCU->getSlice()->getDefaultRefViewIdxAvailableFlag() )
+  {
+#endif
+    m_pcEntropyDecoderIf->parseDBBPFlag( pcCU, uiAbsPartIdx, uiDepth );
+#if HHI_MOVE_SYN_K0052
+  }
+#endif
 }
 #endif
Index: branches/HTM-13.1-dev0/source/Lib/TLibDecoder/TDecEntropy.h
===================================================================
--- branches/HTM-13.1-dev0/source/Lib/TLibDecoder/TDecEntropy.h	(revision 1172)
+++ branches/HTM-13.1-dev0/source/Lib/TLibDecoder/TDecEntropy.h	(revision 1173)
@@ -152,5 +152,7 @@
   Void decodeMvdPU        ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPartIdx, RefPicList eRefList );
   Void decodeMVPIdxPU     ( TComDataCU* pcSubCU, UInt uiPartAddr, UInt uiDepth, UInt uiPartIdx, RefPicList eRefList );
-  
+#if HHI_MOVE_SYN_K0052
+  Void decodeMvsAMVP       ( TComDataCU* pcSubCU, UInt uiPartAddr, UInt uiDepth, UInt uiPartIdx, RefPicList eRefList );
+#endif  
   Void    setEntropyDecoder           ( TDecEntropyIf* p );
   Void    setBitstream                ( TComInputBitstream* p ) { m_pcEntropyDecoderIf->setBitstream(p);                    }
Index: branches/HTM-13.1-dev0/source/Lib/TLibDecoder/TDecSbac.cpp
===================================================================
--- branches/HTM-13.1-dev0/source/Lib/TLibDecoder/TDecSbac.cpp	(revision 1172)
+++ branches/HTM-13.1-dev0/source/Lib/TLibDecoder/TDecSbac.cpp	(revision 1173)
@@ -2191,5 +2191,5 @@
 
   m_pcTDecBinIf->decodeBin( uiSymbol, m_cSDCFlagSCModel.get( 0, 0, uiCtxSDCFlag ) );
-
+  DTRACE_CU("dc_only_flag", uiSymbol)
   if( uiSymbol )
   {
Index: branches/HTM-13.1-dev0/source/Lib/TLibEncoder/TEncCu.cpp
===================================================================
--- branches/HTM-13.1-dev0/source/Lib/TLibEncoder/TEncCu.cpp	(revision 1172)
+++ branches/HTM-13.1-dev0/source/Lib/TLibEncoder/TEncCu.cpp	(revision 1173)
@@ -1622,13 +1622,19 @@
   m_pcEntropyCoder->encodePartSize( pcCU, uiAbsPartIdx, uiDepth );
   
+#if !HHI_MOVE_SYN_K0052
 #if H_3D_DIM_SDC
   m_pcEntropyCoder->encodeSDCFlag( pcCU, uiAbsPartIdx, false );
 #endif
+#endif
   if (pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N )
   {
     m_pcEntropyCoder->encodeIPCMInfo( pcCU, uiAbsPartIdx );
-
     if(pcCU->getIPCMFlag(uiAbsPartIdx))
     {
+#if HHI_MOVE_SYN_K0052
+#if H_3D_DIM_SDC
+      m_pcEntropyCoder->encodeSDCFlag( pcCU, uiAbsPartIdx, false );
+#endif  
+#endif
       // Encode slice finish
       finishCU(pcCU,uiAbsPartIdx,uiDepth);
@@ -1639,5 +1645,10 @@
   // prediction Info ( Intra : direction mode, Inter : Mv, reference idx )
   m_pcEntropyCoder->encodePredInfo( pcCU, uiAbsPartIdx );
-
+#if HHI_MOVE_SYN_K0052
+  m_pcEntropyCoder->encodeDBBPFlag( pcCU, uiAbsPartIdx );
+#if H_3D_DIM_SDC
+  m_pcEntropyCoder->encodeSDCFlag( pcCU, uiAbsPartIdx, false );
+#endif  
+#endif
 #if H_3D_ARP
   m_pcEntropyCoder->encodeARPW( pcCU , uiAbsPartIdx );
@@ -2832,9 +2843,16 @@
   m_pcEntropyCoder->encodePredMode( rpcTempCU, 0,          true );
   m_pcEntropyCoder->encodePartSize( rpcTempCU, 0, uiDepth, true );
+#if !HHI_MOVE_SYN_K0052
 #if H_3D_DIM_SDC
   m_pcEntropyCoder->encodeSDCFlag( rpcTempCU, 0, true );
 #endif
+#endif
   m_pcEntropyCoder->encodePredInfo( rpcTempCU, 0,          true );
   m_pcEntropyCoder->encodeIPCMInfo(rpcTempCU, 0, true );
+#if HHI_MOVE_SYN_K0052
+#if H_3D_DIM_SDC
+  m_pcEntropyCoder->encodeSDCFlag( rpcTempCU, 0, true );
+#endif
+#endif
 
   // Encode Coefficients
@@ -2908,9 +2926,15 @@
   m_pcEntropyCoder->encodePredMode ( rpcTempCU, 0,          true );
   m_pcEntropyCoder->encodePartSize ( rpcTempCU, 0, uiDepth, true );
+#if !HHI_MOVE_SYN_K0052
 #if H_3D_DIM_SDC
   m_pcEntropyCoder->encodeSDCFlag( rpcTempCU, 0, true );
 #endif
+#endif
   m_pcEntropyCoder->encodeIPCMInfo ( rpcTempCU, 0, true );
-
+#if HHI_MOVE_SYN_K0052
+#if H_3D_DIM_SDC
+  m_pcEntropyCoder->encodeSDCFlag( rpcTempCU, 0, true );
+#endif
+#endif
   m_pcRDGoOnSbacCoder->store(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]);
 
Index: branches/HTM-13.1-dev0/source/Lib/TLibEncoder/TEncEntropy.cpp
===================================================================
--- branches/HTM-13.1-dev0/source/Lib/TLibEncoder/TEncEntropy.cpp	(revision 1172)
+++ branches/HTM-13.1-dev0/source/Lib/TLibEncoder/TEncEntropy.cpp	(revision 1173)
@@ -271,4 +271,5 @@
   m_pcEntropyCoderIf->codePartSize( pcCU, uiAbsPartIdx, uiDepth );
   
+#if !HHI_MOVE_SYN_K0052
 #if H_3D_DBBP
   if( pcCU->getSlice()->getDepthBasedBlkPartFlag() && (pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2NxN || pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_Nx2N) && pcCU->getWidth(uiAbsPartIdx) > 8 && pcCU->getSlice()->getDefaultRefViewIdxAvailableFlag() )
@@ -276,4 +277,5 @@
     encodeDBBPFlag(pcCU, uiAbsPartIdx, bRD);
   }
+#endif
 #endif
 }
@@ -861,9 +863,20 @@
 Void TEncEntropy::encodeDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD )
 {
-  if( bRD )
-  {
-    uiAbsPartIdx = 0;
-  }
-  m_pcEntropyCoderIf->codeDBBPFlag( pcCU, uiAbsPartIdx );
+#if HHI_MOVE_SYN_K0052
+  if( pcCU->getSlice()->getDepthBasedBlkPartFlag() && 
+    ( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2NxN || 
+      pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_Nx2N) && 
+      pcCU->getWidth(uiAbsPartIdx) > 8 && 
+      pcCU->getSlice()->getDefaultRefViewIdxAvailableFlag() )
+  {
+#endif
+    if( bRD )
+    {
+      uiAbsPartIdx = 0;
+    }
+    m_pcEntropyCoderIf->codeDBBPFlag( pcCU, uiAbsPartIdx );
+#if HHI_MOVE_SYN_K0052
+  }
+#endif
 }
 #endif
Index: branches/HTM-13.1-dev0/source/Lib/TLibEncoder/TEncEntropy.h
===================================================================
--- branches/HTM-13.1-dev0/source/Lib/TLibEncoder/TEncEntropy.h	(revision 1172)
+++ branches/HTM-13.1-dev0/source/Lib/TLibEncoder/TEncEntropy.h	(revision 1173)
@@ -151,5 +151,14 @@
   Void    resetBits                 ()                        { m_pcEntropyCoderIf->resetBits();      }
   Void    resetCoeffCost            ()                        { m_pcEntropyCoderIf->resetCoeffCost(); }
-  UInt    getNumberOfWrittenBits    ()                        { return m_pcEntropyCoderIf->getNumberOfWrittenBits(); }
+  UInt    getNumberOfWrittenBits    ()
+  {
+#if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC
+    Bool oldJustDoIt = g_bJustDoIt;
+    g_bJustDoIt = true; 
+    writeToTraceFile( "NumberOfWrittenBits", m_pcEntropyCoderIf->getNumberOfWrittenBits(), g_encNumberOfWrittenBits );
+    g_bJustDoIt = oldJustDoIt; 
+#endif
+    return m_pcEntropyCoderIf->getNumberOfWrittenBits(); 
+  }
   UInt    getCoeffCost              ()                        { return  m_pcEntropyCoderIf->getCoeffCost(); }
   Void    resetEntropy              ()                        { m_pcEntropyCoderIf->resetEntropy();  }
Index: branches/HTM-13.1-dev0/source/Lib/TLibEncoder/TEncSbac.cpp
===================================================================
--- branches/HTM-13.1-dev0/source/Lib/TLibEncoder/TEncSbac.cpp	(revision 1172)
+++ branches/HTM-13.1-dev0/source/Lib/TLibEncoder/TEncSbac.cpp	(revision 1173)
@@ -2367,5 +2367,5 @@
   UInt uiSymbol = pcCU->getSDCFlag( uiAbsPartIdx ) ? 1 : 0;
   UInt uiCtxSDCFlag = pcCU->getCtxSDCFlag( uiAbsPartIdx );
-
+  DTRACE_CU("dc_only_flag", uiSymbol)
   m_pcBinIf->encodeBin( uiSymbol, m_cSDCFlagSCModel.get( 0, 0, uiCtxSDCFlag ) );
 }
Index: branches/HTM-13.1-dev0/source/Lib/TLibEncoder/TEncSearch.cpp
===================================================================
--- branches/HTM-13.1-dev0/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 1172)
+++ branches/HTM-13.1-dev0/source/Lib/TLibEncoder/TEncSearch.cpp	(revision 1173)
@@ -924,5 +924,5 @@
 #endif
 #endif
-        m_pcEntropyCoder->encodePredMode( pcCU, 0, true );
+          m_pcEntropyCoder->encodePredMode( pcCU, 0, true );
       }
 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033
@@ -948,23 +948,29 @@
 #endif
 #endif
-      m_pcEntropyCoder  ->encodePartSize( pcCU, 0, pcCU->getDepth(0), true );
-
+        m_pcEntropyCoder  ->encodePartSize( pcCU, 0, pcCU->getDepth(0), true );
+
+#if !HHI_MOVE_SYN_K0052
 #if H_3D_DIM_SDC
-      m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true );
-#endif
-      if (pcCU->isIntra(0) && pcCU->getPartitionSize(0) == SIZE_2Nx2N )
-      {
-        m_pcEntropyCoder->encodeIPCMInfo( pcCU, 0, true );
-
-        if ( pcCU->getIPCMFlag (0))
-        {
-          return;
-        }
-      }
+        m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true );
+#endif
+#endif
+        if (pcCU->isIntra(0) && pcCU->getPartitionSize(0) == SIZE_2Nx2N )
+        {
+          m_pcEntropyCoder->encodeIPCMInfo( pcCU, 0, true );
+          if ( pcCU->getIPCMFlag (0))
+          {
+#if HHI_MOVE_SYN_K0052
+#if H_3D_DIM_SDC
+            m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true );
+#endif
+#endif
+            return;
+          }
+        }
 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033
       }
 #else
 #if H_3D_SINGLE_DEPTH
-    }
+      }
 #endif
 #endif
@@ -975,52 +981,70 @@
 #else
 #if H_3D_SINGLE_DEPTH
-      if(!pcCU->getSingleDepthFlag(uiAbsPartIdx))
-      {
-#endif
-#endif
-    // luma prediction mode
-    if( pcCU->getPartitionSize(0) == SIZE_2Nx2N )
-    {
-      if( uiAbsPartIdx == 0 )
-      {
-        m_pcEntropyCoder->encodeIntraDirModeLuma ( pcCU, 0 );
+    if(!pcCU->getSingleDepthFlag(uiAbsPartIdx))
+    {
+#endif
+#endif
+      // luma prediction mode
+      if( pcCU->getPartitionSize(0) == SIZE_2Nx2N )
+      {
+        if( uiAbsPartIdx == 0 )
+        {
+          m_pcEntropyCoder->encodeIntraDirModeLuma ( pcCU, 0 );
 #if H_3D_DIM_SDC
-        if( pcCU->getSlice()->getIsDepth() && ( !pcCU->getSDCFlag( 0 ) ) && getDimType( pcCU->getLumaIntraDir( 0 ) ) < DIM_NUM_TYPE ) 
-        {
-          m_pcEntropyCoder->encodeDeltaDC( pcCU, 0 );
-        }
-#endif
-      }
-    }
-    else
-    {
-      UInt uiQNumParts = pcCU->getTotalNumPart() >> 2;
-      if( uiTrDepth == 0 )
-      {
-        assert( uiAbsPartIdx == 0 );
-        for( UInt uiPart = 0; uiPart < 4; uiPart++ )
-        {
-          m_pcEntropyCoder->encodeIntraDirModeLuma ( pcCU, uiPart * uiQNumParts );
+#if HHI_MOVE_SYN_K0052
 #if H_3D_DIM_SDC
-          if( pcCU->getSlice()->getIsDepth() && ( !pcCU->getSDCFlag( uiPart * uiQNumParts ) ) && getDimType( pcCU->getLumaIntraDir( uiPart * uiQNumParts ) ) < DIM_NUM_TYPE ) 
+          m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true );
+#endif
+#endif
+          if( pcCU->getSlice()->getIsDepth() && ( !pcCU->getSDCFlag( 0 ) ) && getDimType( pcCU->getLumaIntraDir( 0 ) ) < DIM_NUM_TYPE ) 
           {
-            m_pcEntropyCoder->encodeDeltaDC( pcCU, uiPart * uiQNumParts );
+            m_pcEntropyCoder->encodeDeltaDC( pcCU, 0 );
           }
 #endif
         }
       }
-      else if( ( uiAbsPartIdx % uiQNumParts ) == 0 )
-      {
-        m_pcEntropyCoder->encodeIntraDirModeLuma ( pcCU, uiAbsPartIdx );
+      else
+      {
+        UInt uiQNumParts = pcCU->getTotalNumPart() >> 2;
+        if( uiTrDepth == 0 )
+        {
+          assert( uiAbsPartIdx == 0 );
+          for( UInt uiPart = 0; uiPart < 4; uiPart++ )
+          {
+            m_pcEntropyCoder->encodeIntraDirModeLuma ( pcCU, uiPart * uiQNumParts );
+
+#if HHI_MOVE_SYN_K0052
+          }
+          m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true );
+          for( UInt uiPart = 0; uiPart < 4; uiPart++ )
+          {
+#endif
 #if H_3D_DIM_SDC
-        if( pcCU->getSlice()->getIsDepth() && ( !pcCU->getSDCFlag( uiAbsPartIdx ) ) && getDimType( pcCU->getLumaIntraDir( uiAbsPartIdx ) ) < DIM_NUM_TYPE ) 
-        {
-          m_pcEntropyCoder->encodeDeltaDC( pcCU, uiAbsPartIdx );
-      }
-#endif
-    }
-  }
+            if( pcCU->getSlice()->getIsDepth() && ( !pcCU->getSDCFlag( uiPart * uiQNumParts ) ) && getDimType( pcCU->getLumaIntraDir( uiPart * uiQNumParts ) ) < DIM_NUM_TYPE ) 
+            {
+              m_pcEntropyCoder->encodeDeltaDC( pcCU, uiPart * uiQNumParts );
+            }
+#endif
+          }
+        }
+        else if( ( uiAbsPartIdx % uiQNumParts ) == 0 )
+        {
+          m_pcEntropyCoder->encodeIntraDirModeLuma ( pcCU, uiAbsPartIdx );
+#if H_3D_DIM_SDC
+#if HHI_MOVE_SYN_K0052
+          if( uiAbsPartIdx == 0 )  
+          {
+            m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true );
+          }
+#endif
+          if( pcCU->getSlice()->getIsDepth() && ( !pcCU->getSDCFlag( uiAbsPartIdx ) ) && getDimType( pcCU->getLumaIntraDir( uiAbsPartIdx ) ) < DIM_NUM_TYPE ) 
+          {
+            m_pcEntropyCoder->encodeDeltaDC( pcCU, uiAbsPartIdx );
+          }
+#endif
+        }
+      }
 #if SEC_DEPTH_INTRA_SKIP_MODE_K0033
- }
+    }
 #else
 #if H_3D_SINGLE_DEPTH
@@ -2294,8 +2318,14 @@
 
   m_pcEntropyCoder->encodePartSize( pcCU, 0, pcCU->getDepth( 0 ), true );
+#if !HHI_MOVE_SYN_K0052
   m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true );
+#endif
 
   // encode pred direction + DC residual data
   m_pcEntropyCoder->encodePredInfo( pcCU, 0, true );
+#if HHI_MOVE_SYN_K0052
+  m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true );
+#endif
+
   Bool bDummy = false;
   m_pcEntropyCoder->encodeCoeff( pcCU, 0, pcCU->getDepth( 0 ), uiWidth, uiHeight, bDummy );
@@ -7490,13 +7520,23 @@
     m_pcEntropyCoder->encodePredMode( pcCU, 0, true );
     m_pcEntropyCoder->encodePartSize( pcCU, 0, pcCU->getDepth(0), true );
+#if !HHI_MOVE_SYN_K0052
 #if H_3D_DIM_SDC
     m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true );
 #endif
+#endif 
     m_pcEntropyCoder->encodePredInfo( pcCU, 0, true );
+#if HHI_MOVE_SYN_K0052
+#if H_3D_DIM_SDC
+    m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true );
+#endif
+#endif
 #if H_3D_ARP
-    m_pcEntropyCoder->encodeARPW( pcCU , 0 );
+    m_pcEntropyCoder->encodeARPW( pcCU , 0  );
 #endif
 #if H_3D_IC
     m_pcEntropyCoder->encodeICFlag( pcCU, 0, true );
+#endif
+#if HHI_MOVE_SYN_K0052
+    m_pcEntropyCoder->encodeDBBPFlag( pcCU, 0, true );
 #endif
     Bool bDummy = false;
