Index: branches/HTM-5.1-dev0/source/Lib/TLibDecoder/NALread.cpp
===================================================================
--- branches/HTM-5.1-dev0/source/Lib/TLibDecoder/NALread.cpp	(revision 292)
+++ branches/HTM-5.1-dev0/source/Lib/TLibDecoder/NALread.cpp	(revision 294)
@@ -124,11 +124,6 @@
   assert(forbidden_zero_bit == 0);
 
-#if NAL_REF_FLAG
   nalu.m_nalRefFlag  = (bs.read(1) != 0 );
   nalu.m_nalUnitType = (NalUnitType) bs.read(6);
-#else
-  nalu.m_nalRefIDC   = (NalRefIdc) bs.read(2);
-  nalu.m_nalUnitType = (NalUnitType) bs.read(5);
-#endif
 
 #if QC_MVHEVC_B0046
@@ -137,5 +132,4 @@
   nalu.m_temporalId = bs.read(3) - 1;
 #else
-#if H0388
   nalu.m_temporalId = bs.read(3);
  //  unsigned reserved_one_5bits = bs.read(5);
@@ -147,5 +141,4 @@
   nalu.m_isDepth  = bs.read(1);
 #endif
-#if H0566_TLA
   if ( nalu.m_temporalId )
   {
@@ -157,53 +150,4 @@
   }
 #endif
-#else
-  switch (nalu.m_nalUnitType)
-  {
-  case NAL_UNIT_CODED_SLICE:
-  case NAL_UNIT_CODED_SLICE_IDR:
-#if H0566_TLA
-#if !QC_REM_IDV_B0046
-  case NAL_UNIT_CODED_SLICE_IDV:
-#endif
-  case NAL_UNIT_CODED_SLICE_CRA:
-  case NAL_UNIT_CODED_SLICE_TLA:
-#else
-  case NAL_UNIT_CODED_SLICE_CDR:
-#endif
-    {
-      nalu.m_temporalId = bs.read(3);
-#if VIDYO_VPS_INTEGRATION
-      nalu.m_layerId    = bs.read(5) - 1;
-#else
-      nalu.m_OutputFlag = bs.read(1);
-  //    unsigned reserved_one_4bits = bs.read(4);
-  //    assert(reserved_one_4bits == 1);
-      nalu.m_viewId   = bs.read(3)-1;
-      nalu.m_isDepth  = bs.read(1);
-#endif
-
-#if H0566_TLA
-      if (nalu.m_temporalId == 0)
-      {
-#if QC_REM_IDV_B0046
-        assert(nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR);
-#else
-        assert(nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_CRA || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDV );
-#endif
-      }
-      else
-      {
-        assert(nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_TLA);
-      }
-#endif
-    }
-    break;
-  default:
-    nalu.m_temporalId = 0;
-    nalu.m_OutputFlag = true;
-    break;
-  }
-#endif
-#endif
 }
 //! \}
Index: branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecBinCoder.h
===================================================================
--- branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecBinCoder.h	(revision 292)
+++ branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecBinCoder.h	(revision 294)
@@ -54,7 +54,5 @@
   virtual Void  start             ()                                          = 0;
   virtual Void  finish            ()                                          = 0;
-#if OL_FLUSH
   virtual Void  flush            ()                                           = 0;
-#endif
 
   virtual Void  decodeBin         ( UInt& ruiBin, ContextModel& rcCtxModel )  = 0;
@@ -64,7 +62,5 @@
   
   virtual Void  resetBac          ()                                          = 0;
-#if BURST_IPCM
   virtual Void  decodeNumSubseqIPCM( Int& numSubseqIPCM )                  = 0;
-#endif
   virtual Void  decodePCMAlignBits()                                          = 0;
   virtual Void  xReadPCMCode      ( UInt uiLength, UInt& ruiCode)              = 0;
Index: branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecBinCoderCABAC.cpp
===================================================================
--- branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecBinCoderCABAC.cpp	(revision 292)
+++ branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecBinCoderCABAC.cpp	(revision 294)
@@ -65,5 +65,5 @@
 TDecBinCABAC::start()
 {
-#if !OL_FLUSH || OL_FLUSH_ALIGN
+#if OL_FLUSH_ALIGN
   assert( m_pcTComBitstream->getNumBitsUntilByteAligned() == 0 );
 #endif
@@ -72,5 +72,5 @@
   m_bitsNeeded = -8;
   m_uiValue    = m_pcTComBitstream->readByte() << 8;
-#if OL_FLUSH && !OL_FLUSH_ALIGN
+#if !OL_FLUSH_ALIGN
   m_uiLastByte = m_pcTComBitstream->readByte();
   m_uiValue   |= m_uiLastByte;
@@ -85,5 +85,4 @@
 }
 
-#if OL_FLUSH
 Void 
 TDecBinCABAC::flush()
@@ -108,5 +107,4 @@
 #endif // OL_FLUSH_ALIGN
 }
-#endif // OL_FLUSH
 
 /**
@@ -122,5 +120,5 @@
   m_uiValue   = pcTDecBinCABAC->m_uiValue;
   m_bitsNeeded= pcTDecBinCABAC->m_bitsNeeded;
-#if OL_FLUSH && !OL_FLUSH_ALIGN
+#if !OL_FLUSH_ALIGN
   m_uiLastByte= pcTDecBinCABAC->m_uiLastByte;
 #endif
@@ -152,5 +150,5 @@
     {
       m_bitsNeeded = -8;
-#if OL_FLUSH && !OL_FLUSH_ALIGN
+#if !OL_FLUSH_ALIGN
       m_uiLastByte = m_pcTComBitstream->readByte();
       m_uiValue += m_uiLastByte;    
@@ -173,5 +171,5 @@
     if ( m_bitsNeeded >= 0 )
     {
-#if OL_FLUSH && !OL_FLUSH_ALIGN
+#if !OL_FLUSH_ALIGN
       m_uiLastByte = m_pcTComBitstream->readByte();
       m_uiValue += m_uiLastByte << m_bitsNeeded;
@@ -192,5 +190,5 @@
   {
     m_bitsNeeded = -8;
-#if OL_FLUSH && !OL_FLUSH_ALIGN
+#if !OL_FLUSH_ALIGN
     m_uiLastByte = m_pcTComBitstream->readByte();
     m_uiValue += m_uiLastByte;
@@ -215,5 +213,5 @@
   while ( numBins > 8 )
   {
-#if OL_FLUSH && !OL_FLUSH_ALIGN
+#if !OL_FLUSH_ALIGN
     m_uiLastByte = m_pcTComBitstream->readByte();
     m_uiValue = ( m_uiValue << 8 ) + ( m_uiLastByte << ( 8 + m_bitsNeeded ) );
@@ -241,5 +239,5 @@
   if ( m_bitsNeeded >= 0 )
   {
-#if OL_FLUSH && !OL_FLUSH_ALIGN
+#if !OL_FLUSH_ALIGN
     m_uiLastByte = m_pcTComBitstream->readByte();
     m_uiValue += m_uiLastByte << m_bitsNeeded;
@@ -285,5 +283,5 @@
       {
         m_bitsNeeded = -8;
-#if OL_FLUSH && !OL_FLUSH_ALIGN
+#if !OL_FLUSH_ALIGN
         m_uiLastByte = m_pcTComBitstream->readByte();
         m_uiValue += m_uiLastByte;    
@@ -306,5 +304,4 @@
 }
 
-#if BURST_IPCM
 /** Decode subsequent_pcm_num.
  * \param numSubseqIPCM
@@ -323,5 +320,5 @@
     {
       m_bitsNeeded = -8;
-#if OL_FLUSH && !OL_FLUSH_ALIGN
+#if !OL_FLUSH_ALIGN
       m_uiLastByte = m_pcTComBitstream->readByte();
       m_uiValue += m_uiLastByte;
@@ -342,5 +339,4 @@
   numSubseqIPCM --;
 }
-#endif
 
 /** Decode PCM alignment zero bits.
Index: branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecBinCoderCABAC.h
===================================================================
--- branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecBinCoderCABAC.h	(revision 292)
+++ branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecBinCoderCABAC.h	(revision 294)
@@ -56,7 +56,5 @@
   Void  start             ();
   Void  finish            ();
-#if OL_FLUSH
   Void  flush             ();
-#endif
   
   Void  decodeBin         ( UInt& ruiBin, ContextModel& rcCtxModel );
@@ -66,7 +64,5 @@
   
   Void  resetBac          ();
-#if BURST_IPCM
   Void  decodeNumSubseqIPCM( Int& numSubseqIPCM ) ;
-#endif
   Void  decodePCMAlignBits();
   Void  xReadPCMCode      ( UInt uiLength, UInt& ruiCode );
@@ -82,5 +78,5 @@
   UInt                m_uiRange;
   UInt                m_uiValue;
-#if OL_FLUSH && !OL_FLUSH_ALIGN
+#if !OL_FLUSH_ALIGN
   UInt                m_uiLastByte;
 #endif
Index: branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecCAVLC.cpp
===================================================================
--- branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 292)
+++ branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecCAVLC.cpp	(revision 294)
@@ -169,9 +169,5 @@
   assert(m_pcBitstream->getNumBitsLeft() == 8); /* rsbp_trailing_bits */
 }
-#if RPS_IN_SPS
 void TDecCavlc::parseShortTermRefPicSet( TComSPS* sps, TComReferencePictureSet* rps, Int idx )
-#else
-void TDecCavlc::parseShortTermRefPicSet( TComPPS* pcPPS, TComReferencePictureSet* rps, Int idx )
-#endif
 {
   UInt code;
@@ -184,9 +180,5 @@
     Int rIdx =  idx - 1 - code;
     assert (rIdx <= idx && rIdx >= 0);
-#if RPS_IN_SPS
     TComReferencePictureSet*   rpsRef = sps->getRPSList()->getReferencePictureSet(rIdx);
-#else
-    TComReferencePictureSet*   rpsRef = pcPPS->getRPSList()->getReferencePictureSet(rIdx);
-#endif
     Int k = 0, k0 = 0, k1 = 0;
     READ_CODE(1, bit, "delta_rps_sign"); // delta_RPS_sign
@@ -265,26 +257,16 @@
   READ_FLAG(uiCode, "aps_scaling_list_data_present_flag"); aps->setScalingListEnabled( (uiCode==1)?true:false );
   READ_FLAG(uiCode, "aps_deblocking_filter_flag");         aps->setLoopFilterOffsetInAPS( (uiCode==1)?true:false );
-#if !SAO_UNIT_INTERLEAVING
-  READ_FLAG(uiCode, "aps_sample_adaptive_offset_flag");    aps->setSaoEnabled( (uiCode==1)?true:false );
-#endif
-#if !LCU_SYNTAX_ALF
-  READ_FLAG(uiCode, "aps_adaptive_loop_filter_flag");      aps->setAlfEnabled( (uiCode==1)?true:false );
-#endif
   if(aps->getScalingListEnabled())
   {
     parseScalingList( aps->getScalingList() );
   }
-#if DBL_CONTROL
   if(aps->getLoopFilterOffsetInAPS())
   {
     xParseDblParam( aps );    
   }
-#endif
-#if SAO_UNIT_INTERLEAVING
   READ_FLAG(uiCode, "aps_sao_interleaving_flag");      aps->setSaoInterleavingFlag( (uiCode==1)?true:false );
   if(!aps->getSaoInterleavingFlag())
   {
     READ_FLAG(uiCode, "aps_sample_adaptive_offset_flag");      aps->setSaoEnabled( (uiCode==1)?true:false );
-#endif
   if(aps->getSaoEnabled())
   {
@@ -292,15 +274,8 @@
     xParseSaoParam( aps->getSaoParam() );
   }
-#if SAO_UNIT_INTERLEAVING
-  }
-#endif
-#if LCU_SYNTAX_ALF
+  }
   READ_FLAG(uiCode, "aps_adaptive_loop_filter_flag");      aps->setAlfEnabled( (uiCode==1)?true:false );
-#endif
   if(aps->getAlfEnabled())
   {
-#if !LCU_SYNTAX_ALF
-    aps->getAlfParam()->alf_flag = 1;
-#endif
     xParseAlfParam( aps->getAlfParam());
   }
@@ -316,5 +291,4 @@
 }
 
-#if DBL_CONTROL
 Void  TDecCavlc::xParseDblParam       ( TComAPS* aps )
 {
@@ -333,5 +307,4 @@
   }
 }
-#endif
 /** parse SAO parameters
  * \param pSaoParam
@@ -341,5 +314,4 @@
   UInt uiSymbol;
 
-#if SAO_UNIT_INTERLEAVING
   int i,j, compIdx; 
   int numCuInWidth; 
@@ -393,28 +365,5 @@
     }
   }
-#else
-  if (pSaoParam->bSaoFlag[0])
-  {
-    xParseSaoSplitParam (pSaoParam, 0, 0);
-    xParseSaoOffsetParam(pSaoParam, 0, 0);
-    READ_FLAG (uiSymbol, "sao_flag_cb");
-    pSaoParam->bSaoFlag[1] = uiSymbol? true:false;
-    if (pSaoParam->bSaoFlag[1])
-    {
-      xParseSaoSplitParam (pSaoParam, 0, 1);
-      xParseSaoOffsetParam(pSaoParam, 0, 1);
-    }
-
-    READ_FLAG (uiSymbol, "sao_flag_cr");
-    pSaoParam->bSaoFlag[2] = uiSymbol? true:false;
-    if (pSaoParam->bSaoFlag[2])
-    {
-      xParseSaoSplitParam (pSaoParam, 0, 2);
-      xParseSaoOffsetParam(pSaoParam, 0, 2);
-    }
-  }
-#endif
-}
-#if SAO_UNIT_INTERLEAVING
+}
 /** copy SAO parameter
  * \param dst  
@@ -584,88 +533,5 @@
 }
 
-#else
-/** Decode quadtree split flag
- * \param  pSaoParam, iPartIdx
- */
-Void TDecCavlc::xParseSaoSplitParam(SAOParam* pSaoParam, Int iPartIdx, Int iYCbCr)
-{
-  UInt uiSymbol;
-  SAOQTPart*  pSaoPart = NULL;
-  pSaoPart= &(pSaoParam->psSaoPart[iYCbCr][iPartIdx]);
-
-  if(pSaoPart->PartLevel < pSaoParam->iMaxSplitLevel)
-  {
-    READ_FLAG (uiSymbol, "sao_split_flag");
-    pSaoPart->bSplit = uiSymbol? true:false; 
-    if(pSaoPart->bSplit)
-    {
-      for (Int i=0;i<NUM_DOWN_PART;i++)
-      {
-        xParseSaoSplitParam(pSaoParam, pSaoPart->DownPartsIdx[i], iYCbCr);
-      }
-    }
-  }
-  else
-  {
-    pSaoPart->bSplit = false; 
-  }
-}
-
-/** Decode SAO for one partition
- * \param  pSaoParam, iPartIdx
- */
-Void TDecCavlc::xParseSaoOffsetParam(SAOParam* pSaoParam, Int iPartIdx, Int iYCbCr)
-{
-  UInt uiSymbol;
-  Int iSymbol;  
-  SAOQTPart*  pSaoPart = NULL;
-  pSaoPart = &(pSaoParam->psSaoPart[iYCbCr][iPartIdx]);
-
-  static Int iTypeLength[MAX_NUM_SAO_TYPE] = {
-    SAO_EO_LEN,
-    SAO_EO_LEN,
-    SAO_EO_LEN,
-    SAO_EO_LEN,
-    SAO_BO_LEN,
-    SAO_BO_LEN
-  };  
-  if(!pSaoPart->bSplit)
-  {
-    READ_UVLC (uiSymbol, "sao_type_idx");
-    if (uiSymbol)
-    {
-      pSaoPart->iBestType = uiSymbol-1;
-      pSaoPart->bEnableFlag = true;
-    }
-    else
-    {
-      pSaoPart->iBestType = -1;
-      pSaoPart->bEnableFlag = false;
-    }
-
-    if (pSaoPart->bEnableFlag)
-    {
-      pSaoPart->iLength = iTypeLength[pSaoPart->iBestType];
-      for(Int i=0; i< pSaoPart->iLength; i++)
-      {
-        READ_SVLC (iSymbol, "sao_offset");
-        pSaoPart->iOffset[i] = iSymbol;
-      }
-    }
-    return;
-  }
-
-  //split
-  if (pSaoPart->PartLevel < pSaoParam->iMaxSplitLevel)
-  {
-    for(Int i=0;i<NUM_DOWN_PART;i++)
-    {
-      xParseSaoOffsetParam(pSaoParam, pSaoPart->DownPartsIdx[i], iYCbCr);
-    }
-  }
-}
-#endif
-
-#if LCU_SYNTAX_ALF 
+
 Void TDecCavlc::xParseAlfParam(AlfParamSet* pAlfParamSet, Bool bSentInAPS, Int firstLCUAddr, Bool acrossSlice, Int numLCUInWidth, Int numLCUInHeight)
 {
@@ -931,5 +797,4 @@
 }
 
-#endif
 
 Void TDecCavlc::xParseAlfParam(ALFParam* pAlfParam)
@@ -937,11 +802,6 @@
   UInt uiSymbol;
   Int iSymbol;
-#if ALF_SINGLE_FILTER_SHAPE
   Int sqrFiltLengthTab[NUM_ALF_FILTER_SHAPE] = {ALF_FILTER_LEN}; 
-#else
-  Int sqrFiltLengthTab[2] = { 9, 9}; 
-#endif
-
-#if LCU_SYNTAX_ALF
+
   switch(pAlfParam->componentID)
   {
@@ -961,17 +821,7 @@
   case ALF_Y:
     {
-#endif
   pAlfParam->filters_per_group = 0;
   memset (pAlfParam->filterPattern, 0 , sizeof(Int)*NO_VAR_BINS);
-#if !LCU_SYNTAX_ALF
-  READ_FLAG (uiSymbol, "alf_region_adaptation_flag");
-  pAlfParam->alf_pcr_region_flag = uiSymbol;  
-#endif
-#if ALF_SINGLE_FILTER_SHAPE  
   pAlfParam->filter_shape = 0;
-#else
-  READ_UVLC (uiSymbol, "alf_length_luma_minus_5_div2");
-  pAlfParam->filter_shape = uiSymbol;
-#endif
   pAlfParam->num_coeff = sqrFiltLengthTab[pAlfParam->filter_shape];
 
@@ -989,17 +839,5 @@
   {
     pAlfParam->filters_per_group = 1;
-#if LCU_SYNTAX_ALF
-#if ALF_16_BA_GROUPS
     Int numMergeFlags = 16;
-#else
-    Int numMergeFlags = 15;
-#endif
-#else
-#if ALF_16_BA_GROUPS
-    Int numMergeFlags = 16;
-#else
-    Int numMergeFlags = pAlfParam->alf_pcr_region_flag ? 16 : 15;
-#endif
-#endif
     for (Int i=1; i<numMergeFlags; i++) 
     {
@@ -1021,9 +859,5 @@
   }
 
-#if ALF_SINGLE_FILTER_SHAPE
   Int minScanVal = MIN_SCAN_POS_CROSS;
-#else
-  Int minScanVal = (pAlfParam->filter_shape == ALF_STAR5x5) ? 0: MIN_SCAN_POS_CROSS;
-#endif
 
   // Determine maxScanVal
@@ -1036,8 +870,6 @@
 
   // Golomb parameters
-#if LCU_SYNTAX_ALF
   if( pAlfParam->filters_per_group > 1 )
   {
-#endif
   READ_UVLC (uiSymbol, "alf_min_kstart_minus1");
   pAlfParam->minKStart = 1 + uiSymbol;
@@ -1051,7 +883,5 @@
     kMin = pAlfParam->kMinTab[scanPos];
   }
-#if LCU_SYNTAX_ALF
-  }
-#endif
+  }
 
   Int scanPos;
@@ -1061,13 +891,8 @@
     {
       scanPos = pDepthInt[i] - 1;
-#if LCU_SYNTAX_ALF
       Int k = (pAlfParam->filters_per_group == 1) ? kTableTabShapes[ALF_CROSS9x7_SQUARE3x3][i] : pAlfParam->kMinTab[scanPos];
       pAlfParam->coeffmulti[idx][i] = xGolombDecode(k);
-#else
-      pAlfParam->coeffmulti[idx][i] = xGolombDecode(pAlfParam->kMinTab[scanPos]);
-#endif
-    }
-  }
-#if LCU_SYNTAX_ALF
+    }
+  }
     }
     break;
@@ -1079,28 +904,4 @@
     }
   }
-#else
-  // filter parameters for chroma
-  READ_UVLC (uiSymbol, "alf_chroma_idc");
-  pAlfParam->chroma_idc = uiSymbol;
-
-  if(pAlfParam->chroma_idc)
-  {
-
-#if ALF_SINGLE_FILTER_SHAPE 
-    pAlfParam->filter_shape_chroma  = 0;
-#else
-    READ_UVLC (uiSymbol, "alf_length_chroma_minus_5_div2");
-
-    pAlfParam->filter_shape_chroma = uiSymbol;
-#endif
-    pAlfParam->num_coeff_chroma = sqrFiltLengthTab[pAlfParam->filter_shape_chroma];
-    // filter coefficients for chroma
-    for(Int pos=0; pos<pAlfParam->num_coeff_chroma; pos++)
-    {
-      READ_SVLC (iSymbol, "alf_coeff_chroma");
-      pAlfParam->coeff_chroma[pos] = iSymbol;
-    }
-  }
-#endif
 }
 
@@ -1137,9 +938,5 @@
 }
 
-#if TILES_OR_ENTROPY_SYNC_IDC
 Void TDecCavlc::parsePPS(TComPPS* pcPPS, ParameterSetManagerDecoder *parameterSet)
-#else
-Void TDecCavlc::parsePPS(TComPPS* pcPPS)
-#endif
 {
 #if ENC_DEC_TRACE  
@@ -1150,11 +947,7 @@
   Int   iCode;
 
-#if !RPS_IN_SPS
-  TComRPSList* rpsList = pcPPS->getRPSList();
-#endif
   READ_UVLC( uiCode, "pic_parameter_set_id");                      pcPPS->setPPSId (uiCode);
   READ_UVLC( uiCode, "seq_parameter_set_id");                      pcPPS->setSPSId (uiCode);
 
-#if MULTIBITS_DATA_HIDING
   READ_FLAG ( uiCode, "sign_data_hiding_flag" ); pcPPS->setSignHideFlag( uiCode );
   if( pcPPS->getSignHideFlag() )
@@ -1162,23 +955,7 @@
     READ_CODE( 4, uiCode, "sign_hiding_threshold"); pcPPS->setTSIG(uiCode);
   }
-#endif
 
 #if CABAC_INIT_FLAG
   READ_FLAG( uiCode,   "cabac_init_present_flag" );            pcPPS->setCabacInitPresentFlag( uiCode ? true : false );
-#endif
-#if !RPS_IN_SPS
-  // RPS is put before entropy_coding_mode_flag
-  // since entropy_coding_mode_flag will probably be removed from the WD
-  TComReferencePictureSet*      pcRPS;
-
-  READ_UVLC( uiCode, "num_short_term_ref_pic_sets" );
-  rpsList->create(uiCode);
-
-  for(Int i=0; i< rpsList->getNumberOfReferencePictureSets(); i++)
-  {
-    pcRPS = rpsList->getReferencePictureSet(i);
-    parseShortTermRefPicSet(pcPPS,pcRPS,i);
-  }
-  READ_FLAG( uiCode, "long_term_ref_pics_present_flag" );          pcPPS->setLongTermRefsPresent(uiCode);
 #endif
   // entropy_coding_mode_flag
@@ -1187,24 +964,5 @@
   if (pcPPS->getEntropyCodingMode())
   {
-#if !WPP_SIMPLIFICATION
-    READ_UVLC( uiCode, "entropy_coding_synchro" );                 pcPPS->setEntropyCodingSynchro( uiCode );
-    READ_FLAG( uiCode, "cabac_istate_reset" );                     pcPPS->setCabacIstateReset( uiCode ? true : false );
-#endif
-#if !TILES_OR_ENTROPY_SYNC_IDC
-#if !WPP_SIMPLIFICATION
-    if ( pcPPS->getEntropyCodingSynchro() )
-#endif
-    {
-      READ_UVLC( uiCode, "num_substreams_minus1" );                pcPPS->setNumSubstreams(uiCode+1);
-    }
-#endif
-  }
-#if !H0566_TLA
-  READ_UVLC( uiCode, "num_temporal_layer_switching_point_flags" ); pcPPS->setNumTLayerSwitchingFlags( uiCode );
-  for ( UInt i = 0; i < pcPPS->getNumTLayerSwitchingFlags(); i++ )
-  {
-    READ_FLAG( uiCode, "temporal_layer_switching_point_flag" );    pcPPS->setTLayerSwitchingFlag( i, uiCode > 0 ? true : false );
-  }
-#endif
+  }
   
   // num_ref_idx_l0_default_active_minus1
@@ -1241,13 +999,9 @@
 //printf("TDecCavlc::parsePPS():\tm_bUseWeightPred=%d\tm_uiBiPredIdc=%d\n", pcPPS->getUseWP(), pcPPS->getWPBiPredIdc());
 
-#if H0388
   READ_FLAG( uiCode, "output_flag_present_flag" );
   pcPPS->setOutputFlagPresentFlag( uiCode==1 );
-#endif
-
-#if TILES_OR_ENTROPY_SYNC_IDC
+
   if(parameterSet->getPrefetchedSPS(pcPPS->getSPSId())->getTilesOrEntropyCodingSyncIdc()==1)
   {
-#endif
     READ_FLAG ( uiCode, "tile_info_present_flag" );
     pcPPS->setColumnRowInfoPresent(uiCode);
@@ -1290,26 +1044,12 @@
       Int iNumColTilesMinus1 = (pcPPS->getColumnRowInfoPresent() == 1)?(pcPPS->getNumColumnsMinus1()):(pcPPS->getSPS()->getNumColumnsMinus1());
       Int iNumRowTilesMinus1 = (pcPPS->getColumnRowInfoPresent() == 1)?(pcPPS->getNumColumnsMinus1()):(pcPPS->getSPS()->getNumRowsMinus1());
-#if !REMOVE_TILE_DEPENDENCE
-      pcPPS->setTileBoundaryIndependenceIdr( 1 ); //default
-#endif
       pcPPS->setLFCrossTileBoundaryFlag(true); //default
 
       if(iNumColTilesMinus1 !=0 || iNumRowTilesMinus1 !=0)
       {
-#if !REMOVE_TILE_DEPENDENCE
-        READ_FLAG ( uiCode, "tile_boundary_independence_flag" );  
-        pcPPS->setTileBoundaryIndependenceIdr( uiCode );
-
-        if(pcPPS->getTileBoundaryIndependenceIdr() == 1)
-        {
-#endif
           READ_FLAG ( uiCode, "loop_filter_across_tile_flag" );  
           pcPPS->setLFCrossTileBoundaryFlag( (uiCode == 1)?true:false );
-#if !REMOVE_TILE_DEPENDENCE
-        }
-#endif
-      }
-    }
-#if TILES_OR_ENTROPY_SYNC_IDC
+      }
+    }
   }
   else if(parameterSet->getPrefetchedSPS(pcPPS->getSPSId())->getTilesOrEntropyCodingSyncIdc()==2)
@@ -1317,15 +1057,10 @@
     READ_UVLC( uiCode, "num_substreams_minus1" );                pcPPS->setNumSubstreams(uiCode+1);
   }
-#endif
-
-#if DBL_CONTROL
+
   READ_FLAG( uiCode, "deblocking_filter_control_present_flag" ); 
   pcPPS->setDeblockingFilterControlPresent( uiCode ? true : false);
-#endif
-#if PARALLEL_MERGE
   READ_UVLC( uiCode, "log2_parallel_merge_level_minus2");
   assert(uiCode == LOG2_PARALLEL_MERGE_LEVEL_MINUS2);
   pcPPS->setLog2ParallelMergeLevelMinus2 (uiCode);
-#endif
 
   READ_FLAG( uiCode, "pps_extension_flag");
@@ -1496,5 +1231,4 @@
   READ_UVLC (    uiCode, "pic_width_in_luma_samples" );          pcSPS->setPicWidthInLumaSamples ( uiCode    );
   READ_UVLC (    uiCode, "pic_height_in_luma_samples" );         pcSPS->setPicHeightInLumaSamples( uiCode    );
-#if PIC_CROPPING
   READ_FLAG(     uiCode, "pic_cropping_flag");                   pcSPS->setPicCroppingFlag ( uiCode ? true : false );
   if (uiCode != 0)
@@ -1505,5 +1239,4 @@
     READ_UVLC(   uiCode, "pic_crop_bottom_offset" );             pcSPS->setPicCropBottomOffset( uiCode );
   }
-#endif
 
 #if FULL_NBIT
@@ -1525,7 +1258,5 @@
 #endif
 
-#if H0736_AVC_STYLE_QP_RANGE
   pcSPS->setQpBDOffsetY( (Int) (6*uiCode) );
-#endif
 
   g_uiBASE_MAX  = ((1<<(g_uiBitDepth))-1);
@@ -1537,7 +1268,5 @@
 #endif
   READ_UVLC( uiCode,    "bit_depth_chroma_minus8" );
-#if H0736_AVC_STYLE_QP_RANGE
   pcSPS->setQpBDOffsetC( (Int) (6*uiCode) );
-#endif
 
   READ_FLAG( uiCode, "pcm_enabled_flag" ); pcSPS->setUsePCM( uiCode ? true : false );
@@ -1554,5 +1283,4 @@
 
   READ_UVLC( uiCode,    "log2_max_pic_order_cnt_lsb_minus4" );   pcSPS->setBitsForPOC( 4 + uiCode );
-#if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
   for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++)
   {
@@ -1564,14 +1292,5 @@
     pcSPS->setMaxLatencyIncrease( uiCode, i );
   }
-#else
-  READ_UVLC( uiCode,    "max_num_ref_pics" );                    pcSPS->setMaxNumberOfReferencePictures(uiCode);
-  READ_UVLC( uiCode,    "num_reorder_frames" );                  pcSPS->setNumReorderFrames(uiCode);
-  READ_UVLC ( uiCode, "max_dec_frame_buffering");
-  pcSPS->setMaxDecFrameBuffering( uiCode );
-  READ_UVLC ( uiCode, "max_latency_increase");
-  pcSPS->setMaxLatencyIncrease( uiCode );
-#endif
-
-#if H0412_REF_PIC_LIST_RESTRICTION
+
   READ_FLAG( uiCode, "restricted_ref_pic_lists_flag" );
   pcSPS->setRestrictedRefPicListsFlag( uiCode );
@@ -1585,5 +1304,4 @@
     pcSPS->setListsModificationPresentFlag(true);
   }
-#endif
   READ_UVLC( uiCode, "log2_min_coding_block_size_minus3" );
   UInt log2MinCUSize = uiCode + 3;
@@ -1628,10 +1346,8 @@
   READ_FLAG( uiCode, "sample_adaptive_offset_enabled_flag" );       pcSPS->setUseSAO ( uiCode ? true : false );  
   READ_FLAG( uiCode, "adaptive_loop_filter_enabled_flag" );         pcSPS->setUseALF ( uiCode ? true : false );
-#if LCU_SYNTAX_ALF
   if(pcSPS->getUseALF())
   {
     READ_FLAG( uiCode, "alf_coef_in_slice_flag" );      pcSPS->setUseALFCoefInSlice ( uiCode ? true : false );
   }
-#endif
   if( pcSPS->getUsePCM() )
   {
@@ -1642,5 +1358,4 @@
 
 
-#if RPS_IN_SPS
   TComRPSList* rpsList = pcSPS->getRPSList();
   TComReferencePictureSet* rps;
@@ -1655,11 +1370,4 @@
   }
   READ_FLAG( uiCode, "long_term_ref_pics_present_flag" );          pcSPS->setLongTermRefsPresent(uiCode);
-#endif
-#if !PIC_CROPPING
-  //!!!KS: Syntax not in WD !!!
-
-  xReadUvlc ( uiCode ); pcSPS->setPadX        ( uiCode    );
-  xReadUvlc ( uiCode ); pcSPS->setPadY        ( uiCode    );
-#endif
   
   // AMVP mode for each depth (AM_NONE or AM_EXPL)
@@ -1670,12 +1378,8 @@
   }
 
-#if TILES_WPP_ENTRY_POINT_SIGNALLING
   READ_CODE(2, uiCode, "tiles_or_entropy_coding_sync_idc");         pcSPS->setTilesOrEntropyCodingSyncIdc(uiCode);
-#endif
-
-#if TILES_OR_ENTROPY_SYNC_IDC
+
   if(pcSPS->getTilesOrEntropyCodingSyncIdc() == 1)
   {
-#endif
     READ_UVLC ( uiCode, "num_tile_columns_minus1" );
     pcSPS->setNumColumnsMinus1( uiCode );  
@@ -1704,26 +1408,12 @@
       free(rowHeight);  
     }
-#if !REMOVE_TILE_DEPENDENCE
-    pcSPS->setTileBoundaryIndependenceIdr( 1 ); //default
-#endif
     pcSPS->setLFCrossTileBoundaryFlag(true); //default
 
     if( pcSPS->getNumColumnsMinus1() !=0 || pcSPS->getNumRowsMinus1() != 0)
     {
-#if !REMOVE_TILE_DEPENDENCE
-      READ_FLAG ( uiCode, "tile_boundary_independence_flag" );  
-      pcSPS->setTileBoundaryIndependenceIdr( uiCode );
-      if(pcSPS->getTileBoundaryIndependenceIdr() == 1)
-      {
-#endif
         READ_FLAG ( uiCode, "loop_filter_across_tile_flag" );  
         pcSPS->setLFCrossTileBoundaryFlag( (uiCode==1)?true:false);
-#if !REMOVE_TILE_DEPENDENCE
-      }
-#endif
-    }
-#if TILES_OR_ENTROPY_SYNC_IDC
-  }
-#endif
+    }
+  }
   READ_FLAG( uiCode, "sps_extension_flag");
 #if !QC_MVHEVC_B0046
@@ -1894,12 +1584,8 @@
 }
 
-#if LCU_SYNTAX_ALF
 #if MTK_DEPTH_MERGE_TEXTURE_CANDIDATE_C0137
 Void TDecCavlc::parseSliceHeader (TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl, AlfParamSet& alfParamSet, bool isDepth)
 #else
 Void TDecCavlc::parseSliceHeader (TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl, AlfParamSet& alfParamSet)
-#endif
-#else
-Void TDecCavlc::parseSliceHeader (TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl)
 #endif
 {
@@ -1988,5 +1674,4 @@
     rpcSlice->setSPS(sps);
     rpcSlice->setPPS(pps);
-#if H0388
     if( pps->getOutputFlagPresentFlag() )
     {
@@ -1998,5 +1683,4 @@
       rpcSlice->setPicOutputFlag( true );
     }
-#endif
 #if QC_REM_IDV_B0046
 #if !QC_MVHEVC_B0046
@@ -2065,33 +1749,19 @@
         {
           rps = rpcSlice->getLocalRPS();
-#if RPS_IN_SPS
           parseShortTermRefPicSet(sps,rps, sps->getRPSList()->getNumberOfReferencePictureSets());
-#else
-          parseShortTermRefPicSet(pps,rps, pps->getRPSList()->getNumberOfReferencePictureSets());
-#endif
           rpcSlice->setRPS(rps);
         }
         else // use reference to short-term reference picture set in PPS
         {
-#if RPS_IN_SPS
           READ_UVLC( uiCode, "short_term_ref_pic_set_idx"); rpcSlice->setRPS(sps->getRPSList()->getReferencePictureSet(uiCode));
-#else
-          READ_UVLC( uiCode, "short_term_ref_pic_set_idx"); rpcSlice->setRPS(pps->getRPSList()->getReferencePictureSet(uiCode));
-#endif
           rps = rpcSlice->getRPS();
         }
-#if RPS_IN_SPS
         if(sps->getLongTermRefsPresent())
-#else
-        if(pps->getLongTermRefsPresent())
-#endif
         {
           Int offset = rps->getNumberOfNegativePictures()+rps->getNumberOfPositivePictures();
           READ_UVLC( uiCode, "num_long_term_pics");             rps->setNumberOfLongtermPictures(uiCode);
           Int prev = 0;
-#if LTRP_MULT
           Int prevMsb=0;
           Int prevDeltaPocLt=0;
-#endif
           for(Int j=rps->getNumberOfLongtermPictures()+offset-1 ; j > offset-1; j--)
           {
@@ -2099,5 +1769,4 @@
             prev += uiCode;
 
-#if LTRP_MULT
             READ_FLAG(uiCode,"delta_poc_msb_present_flag");
             Int decDeltaPOCMsbPresent=uiCode;
@@ -2120,11 +1789,8 @@
             else
             {
-#endif
               rps->setPOC(j,rpcSlice->getPOC()-prev);          
               rps->setDeltaPOC(j,-(Int)prev);
-#if LTRP_MULT
             }
             prevDeltaPocLt=prev;
-#endif
             READ_FLAG( uiCode, "used_by_curr_pic_lt_flag");     rps->setUsed(j,uiCode);
           }
@@ -2145,9 +1811,6 @@
       if (sps->getUseSAO())
       {
-#if SAO_UNIT_INTERLEAVING
         READ_FLAG(uiCode, "slice_sao_interleaving_flag");        rpcSlice->setSaoInterleavingFlag(uiCode);
-#endif
         READ_FLAG(uiCode, "slice_sample_adaptive_offset_flag");  rpcSlice->setSaoEnabledFlag((Bool)uiCode);
-#if SAO_UNIT_INTERLEAVING
         if (rpcSlice->getSaoEnabledFlag() && rpcSlice->getSaoInterleavingFlag())
         {
@@ -2160,5 +1823,4 @@
           rpcSlice->setSaoEnabledFlagCr(0);
         }
-#endif
       }
       READ_UVLC (    uiCode, "aps_id" );  rpcSlice->setAPSId(uiCode);
@@ -2188,5 +1850,4 @@
     if( !rpcSlice->isIntra() )
     {
-#if H0412_REF_PIC_LIST_RESTRICTION
 #if QC_MVHEVC_B0046
     if( !rpcSlice->getViewId() || !rpcSlice->getSPS()->getListsModificationPresentFlag() )
@@ -2199,9 +1860,6 @@
       else
       {
-#endif
         READ_FLAG( uiCode, "ref_pic_list_modification_flag_l0" ); refPicListModification->setRefPicListModificationFlagL0( uiCode ? 1 : 0 );
-#if H0412_REF_PIC_LIST_RESTRICTION
-      }
-#endif
+      }
       
       if(refPicListModification->getRefPicListModificationFlagL0())
@@ -2209,5 +1867,4 @@
         uiCode = 0;
         Int i = 0;
-#if H0137_0138_LIST_MODIFICATION
         Int NumPocTotalCurr = rpcSlice->getNumPocTotalCurrMvc();
         if ( NumPocTotalCurr > 1 )
@@ -2232,36 +1889,12 @@
           }
         }
-#else
-        Int list_modification_idc = 0;
-        while(list_modification_idc != 3)  
-        {
-          READ_UVLC( uiCode, "list_modification_idc" ); refPicListModification->setListIdcL0(i, uiCode );
-          list_modification_idc = uiCode;
-          if(uiCode != 3)
-          {
-            READ_UVLC( uiCode, "ref_pic_set_idx" ); refPicListModification->setRefPicSetIdxL0(i, uiCode );
-          }
-          i++;
-        }
-        refPicListModification->setNumberOfRefPicListModificationsL0(i-1);
-#endif
-      }
-#if !H0137_0138_LIST_MODIFICATION
-      else
-      {
-        refPicListModification->setNumberOfRefPicListModificationsL0(0); 
-      }
-#endif
+      }
     }
     else
     {
       refPicListModification->setRefPicListModificationFlagL0(0);
-#if !H0137_0138_LIST_MODIFICATION
-      refPicListModification->setNumberOfRefPicListModificationsL0(0);
-#endif
     }
     if(rpcSlice->isInterB())
     {
-#if H0412_REF_PIC_LIST_RESTRICTION
 #if QC_MVHEVC_B0046
     if( !rpcSlice->getViewId() || !rpcSlice->getSPS()->getListsModificationPresentFlag() )
@@ -2274,14 +1907,10 @@
       else
       {
-#endif
         READ_FLAG( uiCode, "ref_pic_list_modification_flag_l1" ); refPicListModification->setRefPicListModificationFlagL1( uiCode ? 1 : 0 );
-#if H0412_REF_PIC_LIST_RESTRICTION
-      }
-#endif
+      }
       if(refPicListModification->getRefPicListModificationFlagL1())
       {
         uiCode = 0;
         Int i = 0;
-#if H0137_0138_LIST_MODIFICATION
         Int NumPocTotalCurr = rpcSlice->getNumPocTotalCurrMvc();
         if ( NumPocTotalCurr > 1 )
@@ -2306,32 +1935,9 @@
           }
         }
-#else
-        Int list_modification_idc = 0;
-        while(list_modification_idc != 3)  
-        {
-          READ_UVLC( uiCode, "list_modification_idc" ); refPicListModification->setListIdcL1(i, uiCode );
-          list_modification_idc = uiCode;
-          if(uiCode != 3)
-          {
-            READ_UVLC( uiCode, "ref_pic_set_idx" ); refPicListModification->setRefPicSetIdxL1(i, uiCode );
-          }
-          i++;
-        }
-        refPicListModification->setNumberOfRefPicListModificationsL1(i-1);
-#endif
-      }
-#if !H0137_0138_LIST_MODIFICATION
-      else
-      {
-        refPicListModification->setNumberOfRefPicListModificationsL1(0);
-      }
-#endif
+      }
     }  
     else
     {
       refPicListModification->setRefPicListModificationFlagL1(0);
-#if !H0137_0138_LIST_MODIFICATION
-      refPicListModification->setNumberOfRefPicListModificationsL1(0);
-#endif
     }
   }
@@ -2351,5 +1957,4 @@
       READ_UVLC( uiCode, "num_ref_idx_lc_active_minus1" );      rpcSlice->setNumRefIdx( REF_PIC_LIST_C, uiCode + 1 );
       
-#if H0412_REF_PIC_LIST_RESTRICTION
 #if QC_MVHEVC_B0046
     if( rpcSlice->getViewId() && rpcSlice->getSPS()->getListsModificationPresentFlag() )
@@ -2358,5 +1963,4 @@
 #endif
       {
-#endif
         READ_FLAG( uiCode, "ref_pic_list_modification_flag_lc" ); rpcSlice->setRefPicListModificationFlagLC( uiCode ? 1 : 0 );
         if(uiCode)
@@ -2366,5 +1970,4 @@
             READ_FLAG( uiCode, "pic_from_list_0_flag" );
             rpcSlice->setListIdFromIdxOfLC(i, uiCode);
-#if H0137_0138_LIST_MODIFICATION
           if (((rpcSlice->getListIdFromIdxOfLC(i) == REF_PIC_LIST_0) && (rpcSlice->getNumRefIdx( REF_PIC_LIST_0 ) == 1)) || ((rpcSlice->getListIdFromIdxOfLC(i) == REF_PIC_LIST_1) && (rpcSlice->getNumRefIdx( REF_PIC_LIST_1 ) == 1)) )
           {
@@ -2375,12 +1978,8 @@
             READ_UVLC( uiCode, "ref_idx_list_curr" );
           }
-#else
-            READ_UVLC( uiCode, "ref_idx_list_curr" );
-#endif
             rpcSlice->setRefIdxFromIdxOfLC(i, uiCode);
             rpcSlice->setRefIdxOfLC((RefPicList)rpcSlice->getListIdFromIdxOfLC(i), rpcSlice->getRefIdxFromIdxOfLC(i), i);
           }
         }
-#if H0412_REF_PIC_LIST_RESTRICTION
       }
       else
@@ -2388,5 +1987,4 @@
         rpcSlice->setRefPicListModificationFlagLC(false);
       }
-#endif
     }
     else
@@ -2401,10 +1999,8 @@
   }
   
-#if H0111_MVD_L1_ZERO
   if (rpcSlice->isInterB())
   {
     READ_FLAG( uiCode, "mvd_l1_zero_flag" );       rpcSlice->setMvdL1ZeroFlag( (uiCode ? true : false) );
   }
-#endif
 
 #if CABAC_INIT_FLAG
@@ -2432,10 +2028,7 @@
     rpcSlice->setSliceQp (26 + pps->getPicInitQPMinus26() + iCode);
 
-#if H0736_AVC_STYLE_QP_RANGE
     assert( rpcSlice->getSliceQp() >= -sps->getQpBDOffsetY() );
     assert( rpcSlice->getSliceQp() <=  51 );
-#endif
-
-#if DBL_CONTROL
+
     if (rpcSlice->getPPS()->getDeblockingFilterControlPresent())
     {
@@ -2447,7 +2040,4 @@
         rpcSlice->setInheritDblParamFromAPS(0);
       }
-#else
-    READ_FLAG ( uiCode, "inherit_dbl_param_from_APS_flag" ); rpcSlice->setInheritDblParamFromAPS(uiCode ? 1 : 0);
-#endif
       if(!rpcSlice->getInheritDblParamFromAPS())
       {
@@ -2459,7 +2049,5 @@
         }
       }
-#if DBL_CONTROL
    }
-#endif
     if ( rpcSlice->getSliceType() == B_SLICE )
     {
@@ -2531,5 +2119,4 @@
 
       Int uiNumCUsInFrame = uiNumLCUsInWidth* uiNumLCUsInHeight; 
-#if LCU_SYNTAX_ALF
       if(sps->getUseALFCoefInSlice())
       {
@@ -2544,9 +2131,6 @@
       if(!sps->getUseALFCoefInSlice())
       {
-#endif
       xParseAlfCuControlParam(alfCUCtrl, uiNumCUsInFrame);
-#if LCU_SYNTAX_ALF
-      }
-#endif
+      }
 
     }
@@ -2557,16 +2141,8 @@
   if (!bEntropySlice)
   {
-#if !REMOVE_TILE_DEPENDENCE
-    if (sps->getTileBoundaryIndependenceIdr())
-    {   
-#endif
     xReadCode(1, uiCode); // read flag indicating if tile markers transmitted
     rpcSlice->setTileMarkerFlag( uiCode );
-#if !REMOVE_TILE_DEPENDENCE
-    }
-#endif
-  }
-
-#if TILES_WPP_ENTRY_POINT_SIGNALLING
+  }
+
   Int tilesOrEntropyCodingSyncIdc = rpcSlice->getSPS()->getTilesOrEntropyCodingSyncIdc();
   UInt *entryPointOffset          = NULL;
@@ -2629,95 +2205,11 @@
     delete [] entryPointOffset;
   }
-#else
-#if WPP_SIMPLIFICATION
-  if (pps->getNumSubstreams() > 1)
-#else
-  if (pps->getEntropyCodingSynchro())
-#endif
-  {
-    UInt uiNumSubstreams = pps->getNumSubstreams();
-    rpcSlice->allocSubstreamSizes(uiNumSubstreams);
-    UInt *puiSubstreamSizes = rpcSlice->getSubstreamSizes();
-
-    for (UInt ui = 0; ui+1 < uiNumSubstreams; ui++)
-    {
-      xReadCode(2, uiCode);
-      
-      switch ( uiCode )
-      {
-      case 0:
-        xReadCode(8,  uiCode);
-        break;
-      case 1:
-        xReadCode(16, uiCode);
-        break;
-      case 2:
-        xReadCode(24, uiCode);
-        break;
-      case 3:
-        xReadCode(32, uiCode);
-        break;
-      default:
-        printf("Error in parseSliceHeader\n");
-        exit(-1);
-        break;
-      }
-      puiSubstreamSizes[ui] = uiCode;
-    }
-  }
-#endif
 
   if (!bEntropySlice)
   {
     // Reading location information
-#if !REMOVE_TILE_DEPENDENCE
-    if (sps->getTileBoundaryIndependenceIdr())
-    {   
-#endif
-#if !TILES_WPP_ENTRY_POINT_SIGNALLING
-      xReadCode(1, uiCode); // read flag indicating if location information signaled in slice header
-      Bool bTileLocationInformationInSliceHeaderFlag = (uiCode)? true : false;
-
-      if (bTileLocationInformationInSliceHeaderFlag)
-      {
-        // location count
-        xReadCode(5, uiCode); // number of tiles for which location information signaled
-        rpcSlice->setTileLocationCount ( uiCode + 1 );
-
-        xReadCode(5, uiCode); // number of bits used by diff
-        Int iBitsUsedByDiff = uiCode + 1;
-
-        // read out tile start location
-        Int iLastSize = 0;
-        for (UInt uiIdx=0; uiIdx<rpcSlice->getTileLocationCount(); uiIdx++)
-        {
-          Int iAbsDiff, iCurSize, iCurDiff;
-          if (uiIdx==0)
-          {
-            xReadCode(iBitsUsedByDiff-1, uiCode); iAbsDiff  = uiCode;
-            rpcSlice->setTileLocation( uiIdx, iAbsDiff );
-            iCurDiff  = iAbsDiff;
-            iLastSize = iAbsDiff;
-          }
-          else
-          {
-            xReadCode(1, uiCode); // read sign
-            Int iSign = (uiCode) ? -1 : +1;
-
-            xReadCode(iBitsUsedByDiff-1, uiCode); iAbsDiff  = uiCode;
-            iCurDiff  = (iSign) * iAbsDiff;
-            iCurSize  = iLastSize + iCurDiff;
-            iLastSize = iCurSize;
-            rpcSlice->setTileLocation( uiIdx, rpcSlice->getTileLocation( uiIdx-1 ) + iCurSize ); // calculate byte location
-          }
-        }
-      }
-#endif
 
       // read out trailing bits
     m_pcBitstream->readOutTrailingBits();
-#if !REMOVE_TILE_DEPENDENCE
-    }
-#endif
   }
   return;
@@ -2814,81 +2306,5 @@
 Void TDecCavlc::parseIPCMInfo( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
 {
-#if BURST_IPCM
   assert(0);
-#else
-  UInt uiSymbol;
-
-  xReadFlag( uiSymbol );
-
-  if ( uiSymbol )
-  {
-    Bool bIpcmFlag   = true;
-
-    xReadPCMAlignZero();
-
-    pcCU->setPartSizeSubParts  ( SIZE_2Nx2N, uiAbsPartIdx, uiDepth );
-    pcCU->setSizeSubParts      ( g_uiMaxCUWidth>>uiDepth, g_uiMaxCUHeight>>uiDepth, uiAbsPartIdx, uiDepth );
-    pcCU->setIPCMFlagSubParts  ( bIpcmFlag, uiAbsPartIdx, uiDepth );
-
-    UInt uiMinCoeffSize = pcCU->getPic()->getMinCUWidth()*pcCU->getPic()->getMinCUHeight();
-    UInt uiLumaOffset   = uiMinCoeffSize*uiAbsPartIdx;
-    UInt uiChromaOffset = uiLumaOffset>>2;
-
-    Pel* piPCMSample;
-    UInt uiWidth;
-    UInt uiHeight;
-    UInt uiSampleBits;
-    UInt uiX, uiY;
-
-    piPCMSample = pcCU->getPCMSampleY() + uiLumaOffset;
-    uiWidth = pcCU->getWidth(uiAbsPartIdx);
-    uiHeight = pcCU->getHeight(uiAbsPartIdx);
-    uiSampleBits = pcCU->getSlice()->getSPS()->getPCMBitDepthLuma();
-
-    for(uiY = 0; uiY < uiHeight; uiY++)
-    {
-      for(uiX = 0; uiX < uiWidth; uiX++)
-      {
-        UInt uiSample;
-        xReadCode(uiSampleBits, uiSample);
-
-        piPCMSample[uiX] = uiSample;
-      }
-      piPCMSample += uiWidth;
-    }
-
-    piPCMSample = pcCU->getPCMSampleCb() + uiChromaOffset;
-    uiWidth = pcCU->getWidth(uiAbsPartIdx)/2;
-    uiHeight = pcCU->getHeight(uiAbsPartIdx)/2;
-    uiSampleBits = pcCU->getSlice()->getSPS()->getPCMBitDepthChroma();
-
-    for(uiY = 0; uiY < uiHeight; uiY++)
-    {
-      for(uiX = 0; uiX < uiWidth; uiX++)
-      {
-        UInt uiSample;
-        xReadCode(uiSampleBits, uiSample);
-        piPCMSample[uiX] = uiSample;
-      }
-      piPCMSample += uiWidth;
-    }
-
-    piPCMSample = pcCU->getPCMSampleCr() + uiChromaOffset;
-    uiWidth = pcCU->getWidth(uiAbsPartIdx)/2;
-    uiHeight = pcCU->getHeight(uiAbsPartIdx)/2;
-    uiSampleBits = pcCU->getSlice()->getSPS()->getPCMBitDepthChroma();
-
-    for(uiY = 0; uiY < uiHeight; uiY++)
-    {
-      for(uiX = 0; uiX < uiWidth; uiX++)
-      {
-        UInt uiSample;
-        xReadCode(uiSampleBits, uiSample);
-        piPCMSample[uiX] = uiSample;
-      }
-      piPCMSample += uiWidth;
-    }
-  }
-#endif
 }
 
@@ -2920,28 +2336,16 @@
 Void TDecCavlc::parseDeltaQP( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
 {
-#if H0736_AVC_STYLE_QP_RANGE
   Int qp;
-#else
-  UInt uiQp;
-#endif
   Int  iDQp;
   
   xReadSvlc( iDQp );
 
-#if H0736_AVC_STYLE_QP_RANGE
   Int qpBdOffsetY = pcCU->getSlice()->getSPS()->getQpBDOffsetY();
   qp = (((Int) pcCU->getRefQP( uiAbsPartIdx ) + iDQp + 52 + 2*qpBdOffsetY )%(52+ qpBdOffsetY)) -  qpBdOffsetY;
-#else
-  uiQp = pcCU->getRefQP( uiAbsPartIdx ) + iDQp;
-#endif
 
   UInt uiAbsQpCUPartIdx = (uiAbsPartIdx>>(8-(pcCU->getSlice()->getPPS()->getMaxCuDQPDepth()<<1)))<<(8-(pcCU->getSlice()->getPPS()->getMaxCuDQPDepth()<<1)) ;
   UInt uiQpCUDepth =   min(uiDepth,pcCU->getSlice()->getPPS()->getMaxCuDQPDepth()) ;
 
-#if H0736_AVC_STYLE_QP_RANGE
   pcCU->setQPSubParts( qp, uiAbsQpCUPartIdx, uiQpCUDepth );
-#else
-  pcCU->setQPSubParts( uiQp, uiAbsQpCUPartIdx, uiQpCUDepth );
-#endif
 }
 
@@ -3407,10 +2811,8 @@
           READ_UVLC( code, "scaling_list_pred_matrix_id_delta");
           scalingList->setRefMatrixId (sizeId,listId,(UInt)((Int)(listId)-(code+1)));
-#if SCALING_LIST
           if( sizeId > SCALING_LIST_8x8 )
           {
             scalingList->setScalingListDC(sizeId,listId,scalingList->getScalingListDC(sizeId, scalingList->getRefMatrixId (sizeId,listId)));
           }
-#endif
           scalingList->processRefMatrix( sizeId, listId, scalingList->getRefMatrixId (sizeId,listId));
           
@@ -3433,5 +2835,4 @@
 Void TDecCavlc::xDecodeScalingList(TComScalingList *scalingList, UInt sizeId, UInt listId)
 {
-#if SCALING_LIST
   Int i,coefNum = min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId]);
   Int data;
@@ -3473,18 +2874,4 @@
     }
   }
-#else
-  Int i,coefNum = g_scalingListSize[sizeId];
-  Int data;
-  Int nextCoef = SCALING_LIST_START_VALUE;
-  UInt* scan  = g_auiFrameScanXY [ sizeId + 1 ];
-  Int *dst = scalingList->getScalingListAddress(sizeId, listId);
-
-  for(i = 0; i < coefNum; i++)
-  {
-    READ_SVLC( data, "scaling_list_delta_coef");
-    nextCoef = (nextCoef + data + 256 ) % 256;
-    dst[scan[i]] = nextCoef;
-  }
-#endif
 }
 
Index: branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecCAVLC.h
===================================================================
--- branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecCAVLC.h	(revision 292)
+++ branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecCAVLC.h	(revision 294)
@@ -82,9 +82,5 @@
   UInt  xGetBit             ();
   
-#if RPS_IN_SPS
   void  parseShortTermRefPicSet            (TComSPS* pcSPS, TComReferencePictureSet* pcRPS, Int idx);
-#else
-  void  parseShortTermRefPicSet            (TComPPS* pcPPS, TComReferencePictureSet* pcRPS, Int idx);
-#endif
 private:
   TComInputBitstream*   m_pcBitstream;
@@ -123,19 +119,11 @@
   Void  parseSPS            ( TComSPS* pcSPS );
 #endif
-#if TILES_OR_ENTROPY_SYNC_IDC
   Void  parsePPS            ( TComPPS* pcPPS, ParameterSetManagerDecoder *parameterSet);
-#else
-  Void  parsePPS            ( TComPPS* pcPPS);
-#endif
   Void  parseSEI(SEImessages&);
   Void  parseAPS            ( TComAPS* pAPS );
-#if LCU_SYNTAX_ALF
 #if MTK_DEPTH_MERGE_TEXTURE_CANDIDATE_C0137
   Void  parseSliceHeader    ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl, AlfParamSet& alfParamSet, bool isDepth);
 #else
   Void  parseSliceHeader    ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl, AlfParamSet& alfParamSet);
-#endif
-#else
-  Void  parseSliceHeader    ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl );
 #endif
   Void  parseTerminatingBit ( UInt& ruiBit );
@@ -175,7 +163,5 @@
   Void readTileMarker     ( UInt& uiTileIdx, UInt uiBitsUsed );
   Void updateContextTables  ( SliceType eSliceType, Int iQp ) { return; }
-#if OL_FLUSH
   Void decodeFlush() {};
-#endif
 
   Void xParsePredWeightTable ( TComSlice* pcSlice );
@@ -190,21 +176,12 @@
 #endif
 protected:
-#if DBL_CONTROL
   Void  xParseDblParam       ( TComAPS* aps );
-#endif
   Void  xParseSaoParam       ( SAOParam* pSaoParam );
-#if SAO_UNIT_INTERLEAVING
   Void  xParseSaoOffset      (SaoLcuParam* saoLcuParam);
   Void  xParseSaoUnit        (Int rx, Int ry, Int compIdx, SAOParam* saoParam, Bool& repeatedRow );
-#else
-  Void  xParseSaoSplitParam  ( SAOParam* pSaoParam, Int iPartIdx, Int iYCbCr );
-  Void  xParseSaoOffsetParam ( SAOParam* pSaoParam, Int iPartIdx, Int iYCbCr );
-#endif
-#if LCU_SYNTAX_ALF 
   Void  xParseAlfParam(AlfParamSet* pAlfParamSet, Bool bSentInAPS = true, Int firstLCUAddr = 0, Bool acrossSlice = true, Int numLCUInWidth= -1, Int numLCUInHeight= -1);
   Void  parseAlfParamSet(AlfParamSet* pAlfParamSet, Int firstLCUAddr, Bool alfAcrossSlice);
   Void  parseAlfFixedLengthRun(UInt& idx, UInt rx, UInt numLCUInWidth);
   Void  parseAlfStoredFilterIdx(UInt& idx, UInt numFilterSetsInBuffer);
-#endif
   Void  xParseAlfParam       ( ALFParam* pAlfParam );
   Void  xParseAlfCuControlParam(AlfCUCtrlInfo& cAlfParam, Int iNumCUsInPic);
Index: branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecCu.cpp
===================================================================
--- branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecCu.cpp	(revision 292)
+++ branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecCu.cpp	(revision 294)
@@ -148,7 +148,5 @@
   }
 
-#if BURST_IPCM
   pcCU->setNumSucIPCM(0);
-#endif
 
   // start from the top level CU
@@ -240,5 +238,4 @@
   if((!bStartInCU) && ( uiRPelX < pcSlice->getSPS()->getPicWidthInLumaSamples() ) && ( uiBPelY < pcSlice->getSPS()->getPicHeightInLumaSamples() ) )
   {
-#if BURST_IPCM
     if(pcCU->getNumSucIPCM() == 0)
     {
@@ -252,10 +249,4 @@
       pcCU->setDepthSubParts( uiDepth, uiAbsPartIdx );
     }
-#else
-#if HHI_MPI
-    if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == -1 || uiDepth < pcCU->getTextureModeDepth( uiAbsPartIdx ) )
-#endif
-    m_pcEntropyDecoder->decodeSplitFlag( pcCU, uiAbsPartIdx, uiDepth );
-#endif
   }
   else
@@ -323,9 +314,5 @@
 
   // decode CU mode and the partition size
-#if BURST_IPCM
   if( !pcCU->getSlice()->isIntra() && pcCU->getNumSucIPCM() == 0 )
-#else
-  if( !pcCU->getSlice()->isIntra() )
-#endif
 #if HHI_MPI
   if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == -1 )
@@ -382,5 +369,4 @@
     {
 #endif
-#if SIMP_MRG_PRUN      
     UInt uiMergeIndex = pcCU->getMergeIndex(uiAbsPartIdx);
 #if MERL_VSP_C0152
@@ -404,8 +390,4 @@
     m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
 #endif
-#else
-    m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
-    UInt uiMergeIndex = pcCU->getMergeIndex(uiAbsPartIdx);
-#endif
     pcCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeIndex], uiAbsPartIdx, 0, uiDepth );
 
@@ -438,5 +420,4 @@
   {
 #endif
-#if BURST_IPCM
   if( pcCU->getNumSucIPCM() == 0 ) 
   {
@@ -451,8 +432,4 @@
     pcCU->setTrIdxSubParts( 0, uiAbsPartIdx, uiDepth );
   }
-#else
-  m_pcEntropyDecoder->decodePredMode( pcCU, uiAbsPartIdx, uiDepth );
-  m_pcEntropyDecoder->decodePartSize( pcCU, uiAbsPartIdx, uiDepth );
-#endif
 
   if (pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N )
@@ -592,5 +569,4 @@
   }
 
-#if BURST_IPCM
   if( pcCU->getNumSucIPCM() > 0 )
   {
@@ -598,5 +574,4 @@
     return;
   }
-#endif
 
   ruiIsLast = xDecodeSliceEnd( pcCU, uiAbsPartIdx, uiDepth);
@@ -820,9 +795,5 @@
   
   //===== inverse transform =====
-#if H0736_AVC_STYLE_QP_RANGE
   m_pcTrQuant->setQPforQuant  ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 );
-#else
-  m_pcTrQuant->setQPforQuant  ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA, 0 );
-#endif
 
   Int scalingListType = (pcCU->isIntra(uiAbsPartIdx) ? 0 : 3) + g_eTTable[(Int)TEXT_LUMA];
@@ -940,17 +911,9 @@
   if(eText == TEXT_CHROMA_U)
   {
-#if H0736_AVC_STYLE_QP_RANGE
     m_pcTrQuant->setQPforQuant  ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), eText, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset() );
-#else
-    m_pcTrQuant->setQPforQuant  ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), eText, pcCU->getSlice()->getPPS()->getChromaQpOffset() );
-#endif
   }
   else
   {
-#if H0736_AVC_STYLE_QP_RANGE
     m_pcTrQuant->setQPforQuant  ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), eText, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset2nd() );
-#else
-    m_pcTrQuant->setQPforQuant  ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), eText, pcCU->getSlice()->getPPS()->getChromaQpOffset2nd() );
-#endif
   }
 
@@ -1252,18 +1215,10 @@
   pResi = m_ppcYuvResi[uiDepth]->getLumaAddr();
 
-#if H0736_AVC_STYLE_QP_RANGE
   m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 );
-#else
-  m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA, 0 );
-#endif
 
   m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_LUMA, pResi, 0, m_ppcYuvResi[uiDepth]->getStride(), uiWidth, uiHeight, uiLumaTrMode, 0, piCoeff );
   
   // Cb and Cr
-#if H0736_AVC_STYLE_QP_RANGE
   m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset() );
-#else
-  m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getPPS()->getChromaQpOffset() );
-#endif
 
   uiWidth  >>= 1;
@@ -1272,9 +1227,5 @@
   m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_U, pResi, 0, m_ppcYuvResi[uiDepth]->getCStride(), uiWidth, uiHeight, uiChromaTrMode, 0, piCoeff );
 
-#if H0736_AVC_STYLE_QP_RANGE
   m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset2nd() );
-#else
-  m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getPPS()->getChromaQpOffset2nd() );
-#endif
 
   piCoeff = pcCU->getCoeffCr(); pResi = m_ppcYuvResi[uiDepth]->getCrAddr();
Index: branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecEntropy.cpp
===================================================================
--- branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecEntropy.cpp	(revision 292)
+++ branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecEntropy.cpp	(revision 294)
@@ -330,14 +330,8 @@
       else
       {
-#if SIMP_MRG_PRUN
         uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);
         pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
-#else      
-        pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
-        uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);
-#endif
       }
 #else
-#if SIMP_MRG_PRUN       
       UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);
 #if MERL_VSP_C0152
@@ -375,8 +369,4 @@
 #else
       pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
-#endif
-#else      
-      pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
-      UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);
 #endif
 #endif
@@ -547,14 +537,9 @@
 }
 
-#if UNIFIED_TRANSFORM_TREE
 Void TDecEntropy::xDecodeTransform( TComDataCU* pcCU, UInt offsetLuma, UInt offsetChroma, UInt uiAbsPartIdx, UInt absTUPartIdx, UInt uiDepth, UInt width, UInt height, UInt uiTrIdx, UInt uiInnerQuadIdx, UInt& uiYCbfFront3, UInt& uiUCbfFront3, UInt& uiVCbfFront3, Bool& bCodeDQP )
-#else
-Void TDecEntropy::xDecodeTransformSubdiv( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt absTUPartIdx, UInt uiDepth, UInt uiInnerQuadIdx, UInt& uiYCbfFront3, UInt& uiUCbfFront3, UInt& uiVCbfFront3 )
-#endif
 {
   UInt uiSubdiv;
   const UInt uiLog2TrafoSize = g_aucConvertToBit[pcCU->getSlice()->getSPS()->getMaxCUWidth()]+2 - uiDepth;
 
-#if UNIFIED_TRANSFORM_TREE
   if(uiTrIdx==0)
   {
@@ -570,14 +555,9 @@
     }
   }
-#endif // UNIFIED_TRANSFORM_TREE
   if( pcCU->getPredictionMode(uiAbsPartIdx) == MODE_INTRA && pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_NxN && uiDepth == pcCU->getDepth(uiAbsPartIdx) )
   {
     uiSubdiv = 1;
   }
-#if G519_TU_AMP_NSQT_HARMONIZATION
   else if( (pcCU->getSlice()->getSPS()->getQuadtreeTUMaxDepthInter() == 1) && (pcCU->getPredictionMode(uiAbsPartIdx) == MODE_INTER) && ( pcCU->getPartitionSize(uiAbsPartIdx) != SIZE_2Nx2N ) && (uiDepth == pcCU->getDepth(uiAbsPartIdx)) )
-#else
-  else if( (pcCU->getSlice()->getSPS()->getQuadtreeTUMaxDepthInter() == 1) && (pcCU->getPredictionMode(uiAbsPartIdx) == MODE_INTER) && ( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2NxN || pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_Nx2N) && (uiDepth == pcCU->getDepth(uiAbsPartIdx)) )
-#endif
   {
     uiSubdiv = (uiLog2TrafoSize > pcCU->getQuadtreeTULog2MinSizeInCU(uiAbsPartIdx));
@@ -656,5 +636,4 @@
   if( uiSubdiv )
   {
-#if UNIFIED_TRANSFORM_TREE
     UInt size;
     width  >>= 1;
@@ -662,5 +641,4 @@
     size = width*height;
     uiTrIdx++;
-#endif
     ++uiDepth;
     const UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1);
@@ -678,20 +656,12 @@
     for( Int i = 0; i < 4; i++ )
     {
-#if UNIFIED_TRANSFORM_TREE
       UInt nsAddr = 0;
       nsAddr = pcCU->getNSAbsPartIdx( uiLog2TrafoSize-1, uiAbsPartIdx, absTUPartIdx, i, uiTrDepth+1 );
       xDecodeTransform( pcCU, offsetLuma, offsetChroma, uiAbsPartIdx, nsAddr, uiDepth, width, height, uiTrIdx, i, uiCurrentCbfY, uiCurrentCbfU, uiCurrentCbfV, bCodeDQP );
-#else
-      UInt nsAddr = 0;
-      nsAddr = pcCU->getNSAbsPartIdx( uiLog2TrafoSize-1, uiAbsPartIdx, absTUPartIdx, i, uiTrDepth+1 );
-      xDecodeTransformSubdiv( pcCU, uiAbsPartIdx, nsAddr, uiDepth, i, uiCurrentCbfY, uiCurrentCbfU, uiCurrentCbfV );
-#endif
       uiYCbf |= pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiLumaTrMode );
       uiUCbf |= pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiChromaTrMode );
       uiVCbf |= pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiChromaTrMode );
       uiAbsPartIdx += uiQPartNum;
-#if UNIFIED_TRANSFORM_TREE
       offsetLuma += size;  offsetChroma += (size>>2);
-#endif
     }
     
@@ -751,5 +721,4 @@
       }
     }
-#if UNIFIED_TRANSFORM_TREE
     // transform_unit begin
     UInt cbfY = pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA    , uiTrIdx );
@@ -817,23 +786,8 @@
     }
     // transform_unit end
-#endif // UNIFIED_TRANSFORM_TREE
-  }
-}
-
-#if !UNIFIED_TRANSFORM_TREE
-Void TDecEntropy::decodeTransformIdx( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
-{
-  DTRACE_CABAC_VL( g_nSymbolCounter++ )
-  DTRACE_CABAC_T( "\tdecodeTransformIdx()\tCUDepth=" )
-  DTRACE_CABAC_V( uiDepth )
-  DTRACE_CABAC_T( "\n" )
-  UInt temp = 0;
-  UInt temp1 = 0;
-  UInt temp2 = 0;
-  xDecodeTransformSubdiv( pcCU, uiAbsPartIdx, uiAbsPartIdx, uiDepth, 0, temp, temp1, temp2 );
-}
-#endif // UNIFIED_TRANSFORM_TREE
-
-#if UNIFIED_TRANSFORM_TREE
+  }
+}
+
+
 Void TDecEntropy::decodeQP          ( TComDataCU* pcCU, UInt uiAbsPartIdx )
 {
@@ -843,141 +797,5 @@
   }
 }
-#else
-Void TDecEntropy::decodeQP          ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
-{
-  if ( pcCU->getSlice()->getPPS()->getUseDQP() )
-  {
-    m_pcEntropyDecoderIf->parseDeltaQP( pcCU, uiAbsPartIdx, uiDepth );
-  }
-}
-#endif
-
-#if !UNIFIED_TRANSFORM_TREE
-Void TDecEntropy::xDecodeCoeff( TComDataCU* pcCU, UInt uiLumaOffset, UInt uiChromaOffset, UInt uiAbsPartIdx, UInt uiDepth, UInt uiWidth, UInt uiHeight, UInt uiTrIdx, UInt uiCurrTrIdx, Bool& bCodeDQP )
-{
-  UInt uiLog2TrSize = g_aucConvertToBit[ pcCU->getSlice()->getSPS()->getMaxCUWidth() >> uiDepth ] + 2;
-  UInt uiCbfY = pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiTrIdx );
-  UInt uiCbfU = pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrIdx );
-  UInt uiCbfV = pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrIdx );
-  if( uiLog2TrSize == 2 )
-  {
-    UInt uiQPDiv = pcCU->getPic()->getNumPartInCU() >> ( ( uiDepth - 1 ) << 1 );
-    if( ( uiAbsPartIdx % uiQPDiv ) == 0 )
-    {
-      m_uiBakAbsPartIdx   = uiAbsPartIdx;
-      m_uiBakChromaOffset = uiChromaOffset;
-    }
-    else if( ( uiAbsPartIdx % uiQPDiv ) == (uiQPDiv - 1) )
-    {
-      uiCbfU = pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_U, uiTrIdx );
-      uiCbfV = pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_V, uiTrIdx );
-    }
-  }
-
-  if ( uiCbfY || uiCbfU || uiCbfV )
-  {
-    // dQP: only for LCU
-    if ( pcCU->getSlice()->getPPS()->getUseDQP() )
-    {
-      if ( bCodeDQP )
-      {
-        decodeQP( pcCU, uiAbsPartIdx, uiDepth);
-        bCodeDQP = false;
-      }
-    }   
-    UInt uiLumaTrMode, uiChromaTrMode;
-    pcCU->convertTransIdx( uiAbsPartIdx, pcCU->getTransformIdx( uiAbsPartIdx ), uiLumaTrMode, uiChromaTrMode );
-    const UInt uiStopTrMode = uiLumaTrMode;
-    
-    if( uiTrIdx == uiStopTrMode )
-    {
-      if( pcCU->getCbf( uiAbsPartIdx, TEXT_LUMA, uiTrIdx ) )
-      {
-        Int trWidth = uiWidth;
-        Int trHeight = uiHeight;
-        pcCU->getNSQTSize( uiTrIdx, uiAbsPartIdx, trWidth, trHeight );
-        m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffY()+uiLumaOffset), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_LUMA );
-      }
-      
-      uiWidth  >>= 1;
-      uiHeight >>= 1;
-
-      if( uiLog2TrSize == 2 )
-      {
-        UInt uiQPDiv = pcCU->getPic()->getNumPartInCU() >> ( ( uiDepth - 1 ) << 1 );
-        if( ( uiAbsPartIdx % uiQPDiv ) == (uiQPDiv - 1) )
-        {
-          uiWidth  <<= 1;
-          uiHeight <<= 1;
-          Int trWidth = uiWidth;
-          Int trHeight = uiHeight;
-          pcCU->getNSQTSize( uiTrIdx-1, uiAbsPartIdx, trWidth, trHeight );
-          if( pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_U, uiTrIdx ) )
-          {
-            m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCb()+m_uiBakChromaOffset), m_uiBakAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_U );
-          }
-          if( pcCU->getCbf( m_uiBakAbsPartIdx, TEXT_CHROMA_V, uiTrIdx ) )
-          {
-            m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCr()+m_uiBakChromaOffset), m_uiBakAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_V );
-          }
-        }
-      }
-      else
-      {
-        Int trWidth = uiWidth;
-        Int trHeight = uiHeight;
-        pcCU->getNSQTSize( uiTrIdx, uiAbsPartIdx, trWidth, trHeight );
-        if( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrIdx ) )
-        {
-          m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCb()+uiChromaOffset), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_U );
-        }
-        if( pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrIdx ) )
-        {
-          m_pcEntropyDecoderIf->parseCoeffNxN( pcCU, (pcCU->getCoeffCr()+uiChromaOffset), uiAbsPartIdx, trWidth, trHeight, uiDepth, TEXT_CHROMA_V );
-        }
-      }
-    }
-    else
-    {
-      {
-        DTRACE_CABAC_VL( g_nSymbolCounter++ );
-        DTRACE_CABAC_T( "\tgoing down\tdepth=" );
-        DTRACE_CABAC_V( uiDepth );
-        DTRACE_CABAC_T( "\ttridx=" );
-        DTRACE_CABAC_V( uiTrIdx );
-        DTRACE_CABAC_T( "\n" );
-      }
-      if( uiCurrTrIdx <= uiTrIdx )
-      {
-        assert(1);
-      }
-      UInt uiSize;
-      uiWidth  >>= 1;
-      uiHeight >>= 1;
-      uiSize = uiWidth*uiHeight;
-      uiDepth++;
-      uiTrIdx++;
-      
-      UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1);
-      UInt uiIdx      = uiAbsPartIdx;
-      
-      xDecodeCoeff( pcCU, uiLumaOffset, uiChromaOffset, uiIdx, uiDepth, uiWidth, uiHeight, uiTrIdx, uiCurrTrIdx, bCodeDQP );
-      uiLumaOffset += uiSize;  uiChromaOffset += (uiSize>>2);  uiIdx += uiQPartNum;
-      
-      xDecodeCoeff( pcCU, uiLumaOffset, uiChromaOffset, uiIdx, uiDepth, uiWidth, uiHeight, uiTrIdx, uiCurrTrIdx, bCodeDQP );
-      uiLumaOffset += uiSize;  uiChromaOffset += (uiSize>>2);  uiIdx += uiQPartNum;
-      
-      xDecodeCoeff( pcCU, uiLumaOffset, uiChromaOffset, uiIdx, uiDepth, uiWidth, uiHeight, uiTrIdx, uiCurrTrIdx, bCodeDQP );
-      uiLumaOffset += uiSize;  uiChromaOffset += (uiSize>>2);  uiIdx += uiQPartNum;
-      
-      xDecodeCoeff( pcCU, uiLumaOffset, uiChromaOffset, uiIdx, uiDepth, uiWidth, uiHeight, uiTrIdx, uiCurrTrIdx, bCodeDQP );
-      {
-        DTRACE_CABAC_VL( g_nSymbolCounter++ );
-        DTRACE_CABAC_T( "\tgoing up\n" );
-      }
-    }
-  }
-}
-#endif // !UNIFIED_TRANSFORM_TREE
+
 
 /** decode coefficients
@@ -994,11 +812,7 @@
   UInt uiLumaOffset   = uiMinCoeffSize*uiAbsPartIdx;
   UInt uiChromaOffset = uiLumaOffset>>2;
-#if UNIFIED_TRANSFORM_TREE
   UInt temp  = 0;
   UInt temp1 = 0;
   UInt temp2 = 0;
-#else
-  UInt uiLumaTrMode, uiChromaTrMode;
-#endif
   
 #if RWTH_SDC_DLT_B0036
@@ -1018,10 +832,4 @@
   if( pcCU->isIntra(uiAbsPartIdx) )
   {
-#if !UNIFIED_TRANSFORM_TREE
-    decodeTransformIdx( pcCU, uiAbsPartIdx, pcCU->getDepth(uiAbsPartIdx) );
-    
-    pcCU->convertTransIdx( uiAbsPartIdx, pcCU->getTransformIdx(uiAbsPartIdx), uiLumaTrMode, uiChromaTrMode );
-    
-#endif // !UNIFIED_TRANSFORM_TREE
   }
   else
@@ -1045,9 +853,4 @@
     }
     
-#if !UNIFIED_TRANSFORM_TREE
-    decodeTransformIdx( pcCU, uiAbsPartIdx, pcCU->getDepth(uiAbsPartIdx) );
-    
-    pcCU->convertTransIdx( uiAbsPartIdx, pcCU->getTransformIdx(uiAbsPartIdx), uiLumaTrMode, uiChromaTrMode );
-#endif // !UNIFIED_TRANSFORM_TREE
   }
 
@@ -1068,9 +871,5 @@
 #endif
 
-#if UNIFIED_TRANSFORM_TREE
   xDecodeTransform( pcCU, uiLumaOffset, uiChromaOffset, uiAbsPartIdx, uiAbsPartIdx, uiDepth, uiWidth, uiHeight, 0, 0, temp, temp1, temp2, bCodeDQP );
-#else // UNIFIED_TRANSFORM_TREE
-  xDecodeCoeff( pcCU, uiLumaOffset, uiChromaOffset, uiAbsPartIdx, uiDepth, uiWidth, uiHeight, 0, uiLumaTrMode, bCodeDQP );
-#endif // UNIFIED_TRANSFORM_TREE
 
 #if FIX_MPI_B0065
Index: branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecEntropy.h
===================================================================
--- branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecEntropy.h	(revision 292)
+++ branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecEntropy.h	(revision 294)
@@ -67,7 +67,5 @@
   virtual Void  setBitstream          ( TComInputBitstream* p )  = 0;
 
-#if OL_FLUSH
   virtual Void  decodeFlush()                                                                      = 0;
-#endif
 
 #if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
@@ -79,20 +77,12 @@
   virtual Void  parseSPS                  ( TComSPS* pcSPS )                                      = 0;
 #endif
-#if TILES_OR_ENTROPY_SYNC_IDC  
   virtual Void  parsePPS                  ( TComPPS* pcPPS, ParameterSetManagerDecoder *parameterSet )                                      = 0;
-#else
-  virtual Void  parsePPS                  ( TComPPS* pcPPS )                                      = 0;
-#endif
   virtual Void  parseAPS                  ( TComAPS* pAPS  )                                      = 0;
   virtual void parseSEI(SEImessages&) = 0;
 
-#if LCU_SYNTAX_ALF
 #if MTK_DEPTH_MERGE_TEXTURE_CANDIDATE_C0137
   virtual Void parseSliceHeader          ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl, AlfParamSet& alfParamSet, bool isDepth)       = 0;
 #else
   virtual Void parseSliceHeader          ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl, AlfParamSet& alfParamSet)       = 0;
-#endif
-#else
-  virtual Void parseSliceHeader          ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl )                                = 0;
 #endif
 
@@ -163,7 +153,5 @@
   UInt    m_uiBakAbsPartIdx;
   UInt    m_uiBakChromaOffset;
-#if UNIFIED_TRANSFORM_TREE
   UInt    m_bakAbsPartIdxCU;
-#endif
   
 public:
@@ -188,20 +176,12 @@
   Void    decodeSPS                   ( TComSPS* pcSPS     )    { m_pcEntropyDecoderIf->parseSPS(pcSPS);                    }
 #endif
-#if TILES_OR_ENTROPY_SYNC_IDC
   Void    decodePPS                   ( TComPPS* pcPPS, ParameterSetManagerDecoder *parameterSet    )    { m_pcEntropyDecoderIf->parsePPS(pcPPS, parameterSet);                    }
-#else
-  Void    decodePPS                   ( TComPPS* pcPPS     )    { m_pcEntropyDecoderIf->parsePPS(pcPPS);                    }
-#endif
   Void    decodeAPS                   ( TComAPS* pAPS      )    { m_pcEntropyDecoderIf->parseAPS(pAPS);}
   void decodeSEI(SEImessages& seis) { m_pcEntropyDecoderIf->parseSEI(seis); }
 
-#if LCU_SYNTAX_ALF
 #if MTK_DEPTH_MERGE_TEXTURE_CANDIDATE_C0137
   Void    decodeSliceHeader           ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl, AlfParamSet& alfParamSet, bool isDepth)  { m_pcEntropyDecoderIf->parseSliceHeader(rpcSlice, parameterSetManager, alfCUCtrl, alfParamSet, isDepth);         }
 #else
   Void    decodeSliceHeader           ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl, AlfParamSet& alfParamSet)  { m_pcEntropyDecoderIf->parseSliceHeader(rpcSlice, parameterSetManager, alfCUCtrl, alfParamSet);         }
-#endif
-#else
-  Void    decodeSliceHeader           ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl )  { m_pcEntropyDecoderIf->parseSliceHeader(rpcSlice, parameterSetManager, alfCUCtrl);         }
 #endif
 
@@ -231,12 +211,5 @@
   Void decodeIntraDirModeChroma( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
   
-#if !UNIFIED_TRANSFORM_TREE
-  Void decodeTransformIdx      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
-#endif
-#if UNIFIED_TRANSFORM_TREE
   Void decodeQP                ( TComDataCU* pcCU, UInt uiAbsPartIdx );
-#else
-  Void decodeQP                ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
-#endif
   
   Void readTileMarker         ( UInt& uiTileIdx, UInt uiBitsUsed )  {  m_pcEntropyDecoderIf->readTileMarker( uiTileIdx, uiBitsUsed ); }
@@ -245,11 +218,5 @@
   
 private:
-#if UNIFIED_TRANSFORM_TREE
   Void xDecodeTransform        ( TComDataCU* pcCU, UInt offsetLuma, UInt offsetChroma, UInt uiAbsPartIdx, UInt absTUPartIdx, UInt uiDepth, UInt width, UInt height, UInt uiTrIdx, UInt uiInnerQuadIdx, UInt& uiYCbfFront3, UInt& uiUCbfFront3, UInt& uiVCbfFront3, Bool& bCodeDQP );
-#else
-  Void xDecodeTransformSubdiv  ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt absTUPartIdx, UInt uiDepth, UInt uiInnerQuadIdx, UInt& uiYCbfFront3, UInt& uiUCbfFront3, UInt& uiVCbfFront3 );
-  
-  Void xDecodeCoeff            ( TComDataCU* pcCU, UInt uiLumaOffset, UInt uiChromaOffset, UInt uiAbsPartIdx, UInt uiDepth, UInt uiWidth, UInt uiHeight, UInt uiTrIdx, UInt uiCurrTrIdx, Bool& bCodeDQP );
-#endif //UNIFIED_TRANSFORM_TREE
 
 public:
@@ -261,13 +228,9 @@
   Void setSliceGranularity (Int iSliceGranularity) {m_pcEntropyDecoderIf->setSliceGranularity(iSliceGranularity);}
 
-#if SAO_UNIT_INTERLEAVING
   Void decodeSaoParam         (SAOParam* saoParam);
   void decodeSaoLcu(Int rx, Int ry, Int compIdx, SAOParam* saoParam, Bool &repeatedRow );
   Void decodeSaoOneLcu(SaoLcuParam* saoLcuParam);
-#endif
-
-#if OL_FLUSH
+
   Void decodeFlush() { m_pcEntropyDecoderIf->decodeFlush(); }
-#endif
   
 #if RWTH_SDC_DLT_B0036
Index: branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecGop.cpp
===================================================================
--- branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecGop.cpp	(revision 292)
+++ branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecGop.cpp	(revision 294)
@@ -79,7 +79,5 @@
 Void TDecGop::destroy()
 {
-#if LCU_SYNTAX_ALF
   m_alfParamSetPilot.releaseALFParam();
-#endif
 }
 
@@ -120,5 +118,4 @@
 // Private member functions
 // ====================================================================================================================
-#if LCU_SYNTAX_ALF
 Void TDecGop::patchAlfLCUParams(ALFParam*** alfLCUParam, AlfParamSet* alfParamSet, Int firstLCUAddr)
 {
@@ -195,5 +192,4 @@
 }
 
-#endif
 // ====================================================================================================================
 // Public member functions
@@ -279,5 +275,4 @@
         if(pcSlice->getAlfEnabledFlag())
         {
-#if LCU_SYNTAX_ALF
           if(pcSlice->getSPS()->getUseALFCoefInSlice())
           {
@@ -289,9 +284,6 @@
           if( !pcSlice->getSPS()->getUseALFCoefInSlice())
           {
-#endif
           m_vAlfCUCtrlSlices.push_back(m_cAlfCUCtrlOneSlice);
-#if LCU_SYNTAX_ALF
           }
-#endif
         }
       }
@@ -323,9 +315,5 @@
     m_pcSliceDecoder->decompressSlice( pcBitstream, ppcSubstreams, rpcPic, m_pcSbacDecoder, m_pcSbacDecoders);
     m_pcEntropyDecoder->setBitstream(  ppcSubstreams[uiNumSubstreams-1] );
-#if WPP_SIMPLIFICATION
     if ( uiNumSubstreams > 1 )
-#else
-    if ( pcSlice->getPPS()->getEntropyCodingSynchro() )
-#endif
     {
       // deallocate all created substreams, including internal buffers.
@@ -356,8 +344,6 @@
     Bool bLFCrossTileBoundary = (pcSlice->getPPS()->getTileBehaviorControlPresentFlag() == 1)?
                                 (pcSlice->getPPS()->getLFCrossTileBoundaryFlag()):(pcSlice->getPPS()->getSPS()->getLFCrossTileBoundaryFlag());
-#if DBL_CONTROL
     if (pcSlice->getPPS()->getDeblockingFilterControlPresent())
     {
-#endif
       if(pcSlice->getSPS()->getUseDF())
       {
@@ -372,10 +358,6 @@
         }
       }
-#if DBL_CONTROL
     }
     m_pcLoopFilter->setCfg(pcSlice->getPPS()->getDeblockingFilterControlPresent(), pcSlice->getLoopFilterDisable(), pcSlice->getLoopFilterBetaOffset(), pcSlice->getLoopFilterTcOffset(), bLFCrossTileBoundary);
-#else
-    m_pcLoopFilter->setCfg(pcSlice->getLoopFilterDisable(), pcSlice->getLoopFilterBetaOffset(), pcSlice->getLoopFilterTcOffset(), bLFCrossTileBoundary);
-#endif
     m_pcLoopFilter->loopFilterPic( rpcPic );
 
@@ -392,5 +374,4 @@
       if(pcSlice->getSaoEnabledFlag())
       {
-#if SAO_UNIT_INTERLEAVING
         if (pcSlice->getSaoInterleavingFlag())
         {
@@ -402,5 +383,4 @@
         }
         m_pcSAO->setSaoInterleavingFlag(pcSlice->getAPS()->getSaoInterleavingFlag());
-#endif
         m_pcSAO->createPicSaoInfo(rpcPic, m_uiILSliceCount);
         m_pcSAO->SAOProcess(rpcPic, pcSlice->getAPS()->getSaoParam());  
@@ -413,12 +393,7 @@
     if( pcSlice->getSPS()->getUseALF() )
     {
-#if LCU_SYNTAX_ALF
       if( (pcSlice->getSPS()->getUseALFCoefInSlice())?(true):(pcSlice->getAlfEnabledFlag()))
-#else
-      if(pcSlice->getAlfEnabledFlag())
-#endif
-      {
-
-#if LCU_SYNTAX_ALF
+      {
+
         if(!pcSlice->getSPS()->getUseALFCoefInSlice())
         {
@@ -427,14 +402,8 @@
         m_pcAdaptiveLoopFilter->createPicAlfInfo(rpcPic, m_uiILSliceCount, pcSlice->getSliceQp());
         m_pcAdaptiveLoopFilter->ALFProcess(rpcPic, m_vAlfCUCtrlSlices, pcSlice->getSPS()->getUseALFCoefInSlice());
-#else
-        m_pcAdaptiveLoopFilter->createPicAlfInfo(rpcPic, m_uiILSliceCount);
-      m_pcAdaptiveLoopFilter->ALFProcess(rpcPic, pcSlice->getAPS()->getAlfParam(), m_vAlfCUCtrlSlices);
-#endif
       m_pcAdaptiveLoopFilter->PCMLFDisableProcess(rpcPic);
       m_pcAdaptiveLoopFilter->destroyPicAlfInfo();
       }
-#if LCU_SYNTAX_ALF
       m_pcAdaptiveLoopFilter->resetLCUAlfInfo(); //reset all LCU ALFParam->alf_flag = 0
-#endif    
     }
     
Index: branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecGop.h
===================================================================
--- branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecGop.h	(revision 292)
+++ branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecGop.h	(revision 294)
@@ -101,7 +101,5 @@
   bool m_pictureDigestEnabled; ///< if true, handle picture_digest SEI messages
   AlfCUCtrlInfo       m_cAlfCUCtrlOneSlice;
-#if LCU_SYNTAX_ALF
   AlfParamSet           m_alfParamSetPilot;
-#endif
 
 public:
@@ -131,12 +129,8 @@
   void setPictureDigestEnabled(bool enabled) { m_pictureDigestEnabled = enabled; }
   AlfCUCtrlInfo& getAlfCuCtrlParam() { return m_cAlfCUCtrlOneSlice; }
-#if LCU_SYNTAX_ALF
   AlfParamSet& getAlfParamSet() {return m_alfParamSetPilot;}
-#endif
 
 private:
-#if LCU_SYNTAX_ALF
   Void patchAlfLCUParams(ALFParam*** alfLCUParam, AlfParamSet* alfParamSet, Int firstLCUAddr = 0);
-#endif
 
 
Index: branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecSbac.cpp
===================================================================
--- branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecSbac.cpp	(revision 292)
+++ branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecSbac.cpp	(revision 294)
@@ -87,18 +87,11 @@
 , m_cALFUvlcSCModel           ( 1,             1,               NUM_ALF_UVLC_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
 , m_cALFSvlcSCModel           ( 1,             1,               NUM_ALF_SVLC_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
-#if AMP_CTX
 , m_cCUAMPSCModel             ( 1,             1,               NUM_CU_AMP_CTX                , m_contextModels + m_numContextModels, m_numContextModels)
-#else
-, m_cCUXPosiSCModel           ( 1,             1,               NUM_CU_X_POS_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
-, m_cCUYPosiSCModel           ( 1,             1,               NUM_CU_Y_POS_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
-#endif
 , m_cSaoFlagSCModel           ( 1,             1,               NUM_SAO_FLAG_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
 , m_cSaoUvlcSCModel           ( 1,             1,               NUM_SAO_UVLC_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
 , m_cSaoSvlcSCModel           ( 1,             1,               NUM_SAO_SVLC_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
-#if SAO_UNIT_INTERLEAVING
 , m_cSaoMergeLeftSCModel      ( 1,             1,               NUM_SAO_MERGE_LEFT_FLAG_CTX   , m_contextModels + m_numContextModels, m_numContextModels)
 , m_cSaoMergeUpSCModel        ( 1,             1,               NUM_SAO_MERGE_UP_FLAG_CTX     , m_contextModels + m_numContextModels, m_numContextModels)
 , m_cSaoTypeIdxSCModel        ( 1,             1,               NUM_SAO_TYPE_IDX_CTX          , m_contextModels + m_numContextModels, m_numContextModels)
-#endif
 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
 , m_cDmmFlagSCModel           ( 1,             1,               NUM_DMM_FLAG_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
@@ -171,10 +164,5 @@
   m_cCUAlfCtrlFlagSCModel.initBuffer     ( sliceType, qp, (UChar*)INIT_ALF_CTRL_FLAG );
   m_cCUPartSizeSCModel.initBuffer        ( sliceType, qp, (UChar*)INIT_PART_SIZE );
-#if AMP_CTX
   m_cCUAMPSCModel.initBuffer             ( sliceType, qp, (UChar*)INIT_CU_AMP_POS );
-#else
-  m_cCUXPosiSCModel.initBuffer           ( sliceType, qp, (UChar*)INIT_CU_X_POS );
-  m_cCUYPosiSCModel.initBuffer           ( sliceType, qp, (UChar*)INIT_CU_Y_POS );
-#endif
   m_cCUPredModeSCModel.initBuffer        ( sliceType, qp, (UChar*)INIT_PRED_MODE );
   m_cCUIntraPredSCModel.initBuffer       ( sliceType, qp, (UChar*)INIT_INTRA_PRED_MODE );
@@ -199,9 +187,7 @@
   m_cSaoUvlcSCModel.initBuffer           ( sliceType, qp, (UChar*)INIT_SAO_UVLC );
   m_cSaoSvlcSCModel.initBuffer           ( sliceType, qp, (UChar*)INIT_SAO_SVLC );
-#if SAO_UNIT_INTERLEAVING
   m_cSaoMergeLeftSCModel.initBuffer      ( sliceType, qp, (UChar*)INIT_SAO_MERGE_LEFT_FLAG );
   m_cSaoMergeUpSCModel.initBuffer        ( sliceType, qp, (UChar*)INIT_SAO_MERGE_UP_FLAG );
   m_cSaoTypeIdxSCModel.initBuffer        ( sliceType, qp, (UChar*)INIT_SAO_TYPE_IDX );
-#endif
 
   m_cCUTransSubdivFlagSCModel.initBuffer ( sliceType, qp, (UChar*)INIT_TRANS_SUBDIV_FLAG );
@@ -265,10 +251,5 @@
   m_cCUAlfCtrlFlagSCModel.initBuffer     ( eSliceType, iQp, (UChar*)INIT_ALF_CTRL_FLAG );
   m_cCUPartSizeSCModel.initBuffer        ( eSliceType, iQp, (UChar*)INIT_PART_SIZE );
-#if AMP_CTX
   m_cCUAMPSCModel.initBuffer             ( eSliceType, iQp, (UChar*)INIT_CU_AMP_POS );
-#else
-  m_cCUXPosiSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_CU_X_POS );
-  m_cCUYPosiSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_CU_Y_POS );
-#endif
   m_cCUPredModeSCModel.initBuffer        ( eSliceType, iQp, (UChar*)INIT_PRED_MODE );
   m_cCUIntraPredSCModel.initBuffer       ( eSliceType, iQp, (UChar*)INIT_INTRA_PRED_MODE );
@@ -293,9 +274,7 @@
   m_cSaoUvlcSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_SAO_UVLC );
   m_cSaoSvlcSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_SAO_SVLC );
-#if SAO_UNIT_INTERLEAVING
   m_cSaoMergeLeftSCModel.initBuffer      ( eSliceType, iQp, (UChar*)INIT_SAO_MERGE_LEFT_FLAG );
   m_cSaoMergeUpSCModel.initBuffer        ( eSliceType, iQp, (UChar*)INIT_SAO_MERGE_UP_FLAG );
   m_cSaoTypeIdxSCModel.initBuffer        ( eSliceType, iQp, (UChar*)INIT_SAO_TYPE_IDX );
-#endif
   m_cCUTransSubdivFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_TRANS_SUBDIV_FLAG );
 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
@@ -449,9 +428,5 @@
   }
 
-#if EIGHT_BITS_RICE_CODE
   ruiGoRiceParam = g_aauiGoRiceUpdate[ ruiGoRiceParam ][ min<UInt>( ruiSymbol, 23 ) ];
-#else
-  ruiGoRiceParam = g_aauiGoRiceUpdate[ ruiGoRiceParam ][ min<UInt>( ruiSymbol, 15 ) ];
-#endif
 
   return;
@@ -470,5 +445,4 @@
 {
   UInt uiSymbol;
-#if BURST_IPCM
   Int numSubseqIPCM = 0;
   Bool readPCMSampleFlag = false;
@@ -490,19 +464,9 @@
     }
   }
-#else
-  m_pcTDecBinIf->decodeBinTrm(uiSymbol);
-#endif
-
-#if BURST_IPCM
+
   if (readPCMSampleFlag == true)
-#else
-  if (uiSymbol)
-#endif
   {
     Bool bIpcmFlag = true;
 
-#if !BURST_IPCM
-    m_pcTDecBinIf->decodePCMAlignBits();
-#endif
 
     pcCU->setPartSizeSubParts  ( SIZE_2Nx2N, uiAbsPartIdx, uiDepth );
@@ -568,5 +532,4 @@
     }
 
-#if BURST_IPCM
     pcCU->setNumSucIPCM( pcCU->getNumSucIPCM() - 1);
     if(pcCU->getNumSucIPCM() == 0)
@@ -574,7 +537,4 @@
       m_pcTDecBinIf->resetBac();
     }
-#else
-    m_pcTDecBinIf->resetBac();
-#endif
   }
 }
@@ -664,7 +624,4 @@
 {
   UInt uiNumCand = MRG_MAX_NUM_CANDS;
-#if !MRG_IDX_CTX_RED  
-  UInt auiCtx[4] = { 0, 1, 2, 3 };
-#endif
   UInt uiUnaryIdx = 0;
   uiNumCand = pcCU->getSlice()->getMaxNumMergeCand();
@@ -678,5 +635,4 @@
     {
       UInt uiSymbol = 0;
-#if MRG_IDX_CTX_RED
       if ( uiUnaryIdx==0 )
       {
@@ -687,7 +643,4 @@
         m_pcTDecBinIf->decodeBinEP( uiSymbol );
       }
-#else
-      m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUMergeIdxExtSCModel.get( 0, 0, auiCtx[uiUnaryIdx] ) );
-#endif
       if( uiSymbol == 0 )
       {
@@ -879,16 +832,8 @@
         if (eMode == SIZE_2NxN)
         {
-#if AMP_CTX
             m_pcTDecBinIf->decodeBin(uiSymbol, m_cCUAMPSCModel.get( 0, 0, 0 ));
-#else
-          m_pcTDecBinIf->decodeBin(uiSymbol, m_cCUYPosiSCModel.get( 0, 0, 0 ));
-#endif
           if (uiSymbol == 0)
           {
-#if AMP_CTX
             m_pcTDecBinIf->decodeBinEP(uiSymbol);
-#else
-            m_pcTDecBinIf->decodeBin(uiSymbol, m_cCUYPosiSCModel.get( 0, 0, 1 ));
-#endif
             eMode = (uiSymbol == 0? SIZE_2NxnU : SIZE_2NxnD);
           }
@@ -896,16 +841,8 @@
         else if (eMode == SIZE_Nx2N)
         {
-#if AMP_CTX
           m_pcTDecBinIf->decodeBin(uiSymbol, m_cCUAMPSCModel.get( 0, 0, 0 ));
-#else
-          m_pcTDecBinIf->decodeBin(uiSymbol, m_cCUXPosiSCModel.get( 0, 0, 0 ));
-#endif
           if (uiSymbol == 0)
           {
-#if AMP_CTX
             m_pcTDecBinIf->decodeBinEP(uiSymbol);
-#else
-            m_pcTDecBinIf->decodeBin(uiSymbol, m_cCUXPosiSCModel.get( 0, 0, 1 ));
-#endif
             eMode = (uiSymbol == 0? SIZE_nLx2N : SIZE_nRx2N);
           }
@@ -989,7 +926,4 @@
   {
 #endif
-#if !LOGI_INTRA_NAME_3MPM
-    Int iIntraIdx = pcCU->getIntraSizeIdx(uiAbsPartIdx);
-#endif
 
 #if LGE_EDGE_INTRA_A0070
@@ -1003,9 +937,5 @@
 #endif
 
-#if LOGI_INTRA_NAME_3MPM
     Int uiPreds[3] = {-1, -1, -1};
-#else
-    Int uiPreds[2] = {-1, -1};
-#endif
     Int uiPredNum = pcCU->getIntraDirLumaPredictor(uiAbsPartIdx, uiPreds);  
 #if LGE_EDGE_INTRA_A0070
@@ -1018,5 +948,4 @@
     {
       m_pcTDecBinIf->decodeBinEP( uiSymbol );
-#if LOGI_INTRA_NAME_3MPM
       if (uiSymbol)
       {
@@ -1024,5 +953,4 @@
         uiSymbol++;
       }
-#endif
       intraPredMode = uiPreds[uiSymbol];
     }
@@ -1031,5 +959,4 @@
       intraPredMode = 0;
 
-#if LOGI_INTRA_NAME_3MPM
 
       m_pcTDecBinIf->decodeBinsEP( uiSymbol, 5 );
@@ -1060,14 +987,4 @@
         std::swap(uiPreds[1], uiPreds[2]);
       }
-#else
-      m_pcTDecBinIf->decodeBinsEP( uiSymbol, g_aucIntraModeBitsAng[iIntraIdx] - 1 );
-      intraPredMode = uiSymbol;
-
-      if ( intraPredMode == 31 )
-      {
-        m_pcTDecBinIf->decodeBinEP( uiSymbol );
-        intraPredMode += uiSymbol;      
-      }
-#endif
 #if LGE_EDGE_INTRA_A0070
       if ( intraPredMode != EDGE_INTRA_IDX)
@@ -1158,9 +1075,5 @@
     {
       UInt uiIPredMode;
-#if CHROMA_MODE_CODING
       m_pcTDecBinIf->decodeBinsEP( uiIPredMode, 2 );
-#else
-      xReadUnaryMaxSymbol( uiIPredMode, m_cCUChromaPredSCModel.get( 0, 0 ) + 1, 0, 3 );
-#endif
       UInt uiAllowedChromaDir[ NUM_CHROMA_MODE ];
       pcCU->getAllowedChromaDir( uiAbsPartIdx, uiAllowedChromaDir );
@@ -1230,5 +1143,4 @@
   ContextModel *pCtx = m_cCUMvdSCModel.get( 0 );
 
-#if H0111_MVD_L1_ZERO
   if(pcCU->getSlice()->getMvdL1ZeroFlag() && eRefList == REF_PIC_LIST_1 && pcCU->getInterDir(uiAbsPartIdx)==3)
   {
@@ -1238,5 +1150,4 @@
   else
   {
-#endif
 
     m_pcTDecBinIf->decodeBin( uiHorAbs, *pCtx );
@@ -1281,7 +1192,5 @@
     }
 
-#if H0111_MVD_L1_ZERO
-  }
-#endif
+  }
 
   const TComMv cMv( uiHorSign ? -Int( uiHorAbs ): uiHorAbs, uiVerSign ? -Int( uiVerAbs ) : uiVerAbs );
@@ -1323,7 +1232,5 @@
 Void TDecSbac::parseDeltaQP( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
 {
-#if H0736_AVC_STYLE_QP_RANGE
   Int qp;
-#endif
   UInt uiDQp;
   Int  iDQp;
@@ -1333,25 +1240,13 @@
   if ( uiDQp == 0 )
   {
-#if H0736_AVC_STYLE_QP_RANGE
     qp = pcCU->getRefQP(uiAbsPartIdx);
-#else
-    uiDQp = pcCU->getRefQP(uiAbsPartIdx);
-#endif
   }
   else
   {
     UInt uiSign;
-#if H0736_AVC_STYLE_QP_RANGE
     Int qpBdOffsetY = pcCU->getSlice()->getSPS()->getQpBDOffsetY();
-#else
-    UInt uiQpBdOffsetY = 6*(g_uiBitIncrement + g_uiBitDepth - 8);
-#endif
     m_pcTDecBinIf->decodeBinEP(uiSign);
 
-#if H0736_AVC_STYLE_QP_RANGE
     UInt uiMaxAbsDQpMinus1 = 24 + (qpBdOffsetY/2) + (uiSign);
-#else
-    UInt uiMaxAbsDQpMinus1 = 24 + (uiQpBdOffsetY/2) + (uiSign);
-#endif
     UInt uiAbsDQpMinus1;
     xReadUnaryMaxSymbol (uiAbsDQpMinus1,  &m_cCUDeltaQpSCModel.get( 0, 0, 1 ), 1, uiMaxAbsDQpMinus1);
@@ -1364,22 +1259,10 @@
     }
 
-#if H0736_AVC_STYLE_QP_RANGE
     qp = (((Int) pcCU->getRefQP( uiAbsPartIdx ) + iDQp + 52 + 2*qpBdOffsetY )%(52+qpBdOffsetY)) - qpBdOffsetY;
-#else
-#if LOSSLESS_CODING
-    uiDQp = (pcCU->getRefQP(uiAbsPartIdx) + iDQp + 52) % 52;
-#else
-    uiDQp = pcCU->getRefQP(uiAbsPartIdx) + iDQp;
-#endif
-#endif
   }
   
   UInt uiAbsQpCUPartIdx = (uiAbsPartIdx>>(8-(pcCU->getSlice()->getPPS()->getMaxCuDQPDepth()<<1)))<<(8-(pcCU->getSlice()->getPPS()->getMaxCuDQPDepth()<<1)) ;
   UInt uiQpCUDepth =   min(uiDepth,pcCU->getSlice()->getPPS()->getMaxCuDQPDepth()) ;
-#if H0736_AVC_STYLE_QP_RANGE
   pcCU->setQPSubParts( qp, uiAbsQpCUPartIdx, uiQpCUDepth );
-#else
-  pcCU->setQPSubParts( uiDQp, uiAbsQpCUPartIdx, uiQpCUDepth );
-#endif
 }
 
@@ -1422,13 +1305,8 @@
 
   // posX
-#if LAST_CTX_REDUCTION
   Int widthCtx = eTType ? 4 : width;
   const UInt *puiCtxIdxX = g_uiLastCtx + ( g_aucConvertToBit[ widthCtx ] * ( g_aucConvertToBit[ widthCtx ] + 3 ) );
-#else
-  const UInt *puiCtxIdxX = g_uiLastCtx + ( g_aucConvertToBit[ width ] * ( g_aucConvertToBit[ width ] + 3 ) );
-#endif
   for( uiPosLastX = 0; uiPosLastX < g_uiGroupIdx[ width - 1 ]; uiPosLastX++ )
   {
-#if LAST_CTX_REDUCTION
     if ( eTType  )
     {
@@ -1437,9 +1315,6 @@
     else
     {
-#endif
       m_pcTDecBinIf->decodeBin( uiLast, *( pCtxX + puiCtxIdxX[ uiPosLastX ] ) );
-#if LAST_CTX_REDUCTION
-    }
-#endif
+    }
     if( !uiLast )
     {
@@ -1449,13 +1324,8 @@
 
   // posY
-#if LAST_CTX_REDUCTION
   Int heightCtx = eTType? 4 : height;
   const UInt *puiCtxIdxY = g_uiLastCtx + ( g_aucConvertToBit[ heightCtx ] * ( g_aucConvertToBit[ heightCtx ] + 3 ) );
-#else
-  const UInt *puiCtxIdxY = g_uiLastCtx + ( g_aucConvertToBit[ height ] * ( g_aucConvertToBit[ height ] + 3 ) );
-#endif
   for( uiPosLastY = 0; uiPosLastY < g_uiGroupIdx[ height - 1 ]; uiPosLastY++ )
   {
-#if LAST_CTX_REDUCTION
     if (eTType)
     {
@@ -1464,9 +1334,6 @@
     else
     {
-#endif
       m_pcTDecBinIf->decodeBin( uiLast, *( pCtxY + puiCtxIdxY[ uiPosLastY ] ) );
-#if LAST_CTX_REDUCTION
-    }
-#endif
+    }
     if( !uiLast )
     {
@@ -1588,5 +1455,4 @@
   UInt uiGoRiceParam           = 0;
 
-#if MULTIBITS_DATA_HIDING
   UInt const tsig = pcCU->getSlice()->getPPS()->getTSIG();
 #if LOSSLESS_CODING
@@ -1604,5 +1470,4 @@
 #endif
   UInt absSum = 0;
-#endif  // MULTIBITS_DATA_HIDING
 
   UInt uiSigCoeffGroupFlag[ MLS_GRP_NUM ];
@@ -1613,5 +1478,4 @@
   {
     scanCG = g_auiSigLastScan[ uiScanIdx ][ uiLog2BlockSize > 3 ? uiLog2BlockSize-2-1 : 0  ];    
-#if MULTILEVEL_SIGMAP_EXT
     if( uiLog2BlockSize == 3 )
     {
@@ -1622,5 +1486,4 @@
       scanCG = g_sigLastScanCG32x32;
     }
-#endif
   }
   else
@@ -1635,15 +1498,11 @@
     Int numNonZero = 0;
     
-#if MULTIBITS_DATA_HIDING
     Int lastNZPosInCG = -1, firstNZPosInCG = SCAN_SET_SIZE;
-#endif
 
     Int pos[SCAN_SET_SIZE];
     if( iScanPosSig == (Int) uiScanPosLast )
     {
-#if MULTIBITS_DATA_HIDING
       lastNZPosInCG  = iScanPosSig;
       firstNZPosInCG = iScanPosSig;
-#endif
       iScanPosSig--;
       pos[ numNonZero ] = uiBlkPosLast;
@@ -1651,13 +1510,8 @@
     }
 
-#if !MULTILEVEL_SIGMAP_EXT
-    if( blockType > 3 )
-    {
-#endif
       // decode significant_coeffgroup_flag
       Int iCGBlkPos = scanCG[ iSubSet ];
       Int iCGPosY   = iCGBlkPos / uiNumBlkSide;
       Int iCGPosX   = iCGBlkPos - (iCGPosY * uiNumBlkSide);
-#if MULTILEVEL_SIGMAP_EXT
       if( uiWidth == 8 && uiHeight == 8 && (uiScanIdx == SCAN_HOR || uiScanIdx == SCAN_VER) )
       {
@@ -1665,13 +1519,5 @@
         iCGPosX = (uiScanIdx == SCAN_VER ? iCGBlkPos : 0);
       }
-#endif
-#if !REMOVE_INFER_SIGGRP
-      Bool bInferredCGFlag = false;
-#endif
-#if REMOVE_INFER_SIGGRP
       if( iSubSet == iLastScanSet || iSubSet == 0)
-#else
-      if( iSubSet == iLastScanSet ) 
-#endif
       {
         uiSigCoeffGroupFlag[ iCGBlkPos ] = 1;
@@ -1679,28 +1525,8 @@
       else
       {
-#if !REMOVE_INFER_SIGGRP
-#if MULTILEVEL_SIGMAP_EXT
-        if( !TComTrQuant::bothCGNeighboursOne( uiSigCoeffGroupFlag, iCGPosX, iCGPosY, uiScanIdx, uiWidth, uiHeight) && ( iSubSet ) )
-#else
-        if( !TComTrQuant::bothCGNeighboursOne( uiSigCoeffGroupFlag, iCGPosX, iCGPosY, uiWidth, uiHeight) && ( iSubSet ) )
-#endif
-        {
-#endif
           UInt uiSigCoeffGroup;
-#if MULTILEVEL_SIGMAP_EXT
           UInt uiCtxSig  = TComTrQuant::getSigCoeffGroupCtxInc( uiSigCoeffGroupFlag, iCGPosX, iCGPosY, uiScanIdx, uiWidth, uiHeight );
-#else
-          UInt uiCtxSig  = TComTrQuant::getSigCoeffGroupCtxInc( uiSigCoeffGroupFlag, iCGPosX, iCGPosY, uiWidth, uiHeight );
-#endif
           m_pcTDecBinIf->decodeBin( uiSigCoeffGroup, baseCoeffGroupCtx[ uiCtxSig ] );
           uiSigCoeffGroupFlag[ iCGBlkPos ] = uiSigCoeffGroup;
-#if !REMOVE_INFER_SIGGRP
-        }
-        else
-        {
-          uiSigCoeffGroupFlag[ iCGBlkPos ] = 1;
-          bInferredCGFlag = true;
-        }
-#endif
       }
 
@@ -1716,9 +1542,5 @@
         if( uiSigCoeffGroupFlag[ iCGBlkPos ] )
         {
-#if REMOVE_INFER_SIGGRP
           if( iScanPosSig > iSubPos || iSubSet == 0  || numNonZero )
-#else
-          if( iScanPosSig > iSubPos || bInferredCGFlag || numNonZero )
-#endif
           {
             uiCtxSig  = TComTrQuant::getSigCtxInc( pcCoef, uiPosX, uiPosY, blockType, uiWidth, uiHeight, eTType );
@@ -1735,5 +1557,4 @@
           pos[ numNonZero ] = uiBlkPos;
           numNonZero ++;
-#if MULTIBITS_DATA_HIDING
           if( lastNZPosInCG == -1 )
           {
@@ -1741,53 +1562,15 @@
           }
           firstNZPosInCG = iScanPosSig;
-#endif
         }
       }
-#if !MULTILEVEL_SIGMAP_EXT
-    }
-    else
-    {
-      for( ; iScanPosSig >= iSubPos; iScanPosSig-- )
-      {
-        UInt uiBlkPos   = scan[ iScanPosSig ];
-        UInt  uiPosY    = uiBlkPos >> uiLog2BlockSize;
-        UInt  uiPosX    = uiBlkPos - ( uiPosY << uiLog2BlockSize );
-        UInt  uiSig     = 0;
-        UInt  uiCtxSig  = TComTrQuant::getSigCtxInc( pcCoef, uiPosX, uiPosY, blockType, uiWidth, uiHeight, eTType );
-        m_pcTDecBinIf->decodeBin( uiSig, baseCtx[ uiCtxSig ] );
-        pcCoef[ uiBlkPos ] = uiSig;
-        if( uiSig )
-        {
-          pos[ numNonZero ] = uiBlkPos;
-          numNonZero ++;
-#if MULTIBITS_DATA_HIDING
-          if( lastNZPosInCG == -1 )
-          {
-            lastNZPosInCG = iScanPosSig;
-          }
-          firstNZPosInCG = iScanPosSig;
-#endif
-        }
-      }
-    }
-#endif
 
     
     if( numNonZero )
     {
-#if MULTIBITS_DATA_HIDING
       Bool signHidden = ( lastNZPosInCG - firstNZPosInCG >= (Int)tsig );
       absSum = 0;
-#endif  // MULTIBITS_DATA_HIDING
 
       UInt c1 = 1;
-#if !RESTRICT_GR1GR2FLAG_NUMBER
-      UInt c2 = 0;
-#endif
-#if LEVEL_CTX_LUMA_RED
       UInt uiCtxSet    = (iSubSet > 0 && eTType==TEXT_LUMA) ? 2 : 0;
-#else
-      UInt uiCtxSet    = (iSubSet > 0 && eTType==TEXT_LUMA) ? 3 : 0;
-#endif
       UInt uiBin;
       
@@ -1795,10 +1578,4 @@
       {
         uiCtxSet++;
-#if !LEVEL_CTX_LUMA_RED
-        if(eTType==TEXT_LUMA && uiNumOne > 3)
-        {
-          uiCtxSet++;
-        }
-#endif
       }
       
@@ -1807,5 +1584,4 @@
       Int absCoeff[SCAN_SET_SIZE];
 
-#if RESTRICT_GR1GR2FLAG_NUMBER
       for ( Int i = 0; i < numNonZero; i++) absCoeff[i] = 1;   
       Int numC1Flag = min(numNonZero, C1FLAG_NUMBER);
@@ -1813,7 +1589,4 @@
 
       for( Int idx = 0; idx < numC1Flag; idx++ )
-#else
-      for( Int idx = 0; idx < numNonZero; idx++ )
-#endif
       {
         m_pcTDecBinIf->decodeBin( uiBin, baseCtxMod[c1] );
@@ -1821,10 +1594,8 @@
         {
           c1 = 0;
-#if RESTRICT_GR1GR2FLAG_NUMBER
           if (firstC2FlagIdx == -1)
           {
             firstC2FlagIdx = idx;
           }
-#endif
         }
         else if( (c1 < 3) && (c1 > 0) )
@@ -1837,5 +1608,4 @@
       if (c1 == 0)
       {
-#if RESTRICT_GR1GR2FLAG_NUMBER
         baseCtxMod = ( eTType==TEXT_LUMA ) ? m_cCUAbsSCModel.get( 0, 0 ) + uiCtxSet : m_cCUAbsSCModel.get( 0, 0 ) + NUM_ABS_FLAG_CTX_LUMA + uiCtxSet;
         if ( firstC2FlagIdx != -1)
@@ -1844,47 +1614,23 @@
           absCoeff[ firstC2FlagIdx ] = uiBin + 2;
         }
-#else    
-        baseCtxMod = ( eTType==TEXT_LUMA ) ? m_cCUAbsSCModel.get( 0, 0 ) + 3 * uiCtxSet : m_cCUAbsSCModel.get( 0, 0 ) + NUM_ABS_FLAG_CTX_LUMA + 3 * uiCtxSet;
+      }
+
+      UInt coeffSigns;
+      if ( signHidden && beValid )
+      {
+        m_pcTDecBinIf->decodeBinsEP( coeffSigns, numNonZero-1 );
+        coeffSigns <<= 32 - (numNonZero-1);
+      }
+      else
+      {
+        m_pcTDecBinIf->decodeBinsEP( coeffSigns, numNonZero );
+        coeffSigns <<= 32 - numNonZero;
+      }
+      
+      Int iFirstCoeff2 = 1;    
+      if (c1 == 0 || numNonZero > C1FLAG_NUMBER)
+      {
         for( Int idx = 0; idx < numNonZero; idx++ )
         {
-          if( absCoeff[ idx ] == 2 ) 
-          {
-            m_pcTDecBinIf->decodeBin( uiBin, baseCtxMod[c2] );
-            absCoeff[ idx ] = uiBin + 2;
-            c2 += (c2 < 2);
-            uiNumOne++;
-          }
-        }
-#endif
-      }
-
-#if MULTIBITS_DATA_HIDING
-      UInt coeffSigns;
-      if ( signHidden && beValid )
-      {
-        m_pcTDecBinIf->decodeBinsEP( coeffSigns, numNonZero-1 );
-        coeffSigns <<= 32 - (numNonZero-1);
-      }
-      else
-      {
-        m_pcTDecBinIf->decodeBinsEP( coeffSigns, numNonZero );
-        coeffSigns <<= 32 - numNonZero;
-      }
-#else
-      UInt coeffSigns;
-      m_pcTDecBinIf->decodeBinsEP( coeffSigns, numNonZero );
-      coeffSigns <<= 32 - numNonZero;
-#endif
-      
-#if RESTRICT_GR1GR2FLAG_NUMBER
-      Int iFirstCoeff2 = 1;    
-      if (c1 == 0 || numNonZero > C1FLAG_NUMBER)
-#else
-      if (c1 == 0)
-#endif
-      {
-        for( Int idx = 0; idx < numNonZero; idx++ )
-        {
-#if RESTRICT_GR1GR2FLAG_NUMBER   
           UInt baseLevel  = (idx < C1FLAG_NUMBER)? (2 + iFirstCoeff2) : 1;
 
@@ -1901,12 +1647,4 @@
             uiNumOne++;
           }
-#else
-          if( absCoeff[ idx ] == 3 )
-          {
-            UInt uiLevel;
-            xReadGoRiceExGolomb( uiLevel, uiGoRiceParam );
-            absCoeff[ idx ] = uiLevel + 3;
-          }
-#endif
         }
       }
@@ -1915,5 +1653,4 @@
       {
         Int blkPos = pos[ idx ];
-#if MULTIBITS_DATA_HIDING
         // Signs applied later.
         pcCoef[ blkPos ] = absCoeff[ idx ];
@@ -1932,9 +1669,4 @@
           coeffSigns <<= 1;
         }
-#else
-        Int sign = static_cast<Int>( coeffSigns ) >> 31;
-        pcCoef[ blkPos ] = ( absCoeff[ idx ] ^ sign ) - sign;
-        coeffSigns <<= 1;
-#endif
       }
     }
@@ -1949,5 +1681,4 @@
 
 
-#if SAO_UNIT_INTERLEAVING
 Void TDecSbac::parseSaoUvlc (UInt& ruiVal)
 {
@@ -2186,5 +1917,4 @@
   }
 }
-#endif
 
 /**
@@ -2217,5 +1947,4 @@
 }
 
-#if OL_FLUSH
 Void TDecSbac::decodeFlush ( )
 {
@@ -2225,5 +1954,4 @@
 
 }
-#endif
 
 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX || (LGE_EDGE_INTRA_A0070 && LGE_EDGE_INTRA_DELTA_DC)
Index: branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecSbac.h
===================================================================
--- branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecSbac.h	(revision 292)
+++ branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecSbac.h	(revision 294)
@@ -74,7 +74,5 @@
   Void xCopyFrom           ( TDecSbac* pSrc );
   Void xCopyContextsFrom       ( TDecSbac* pSrc );
-#if OL_FLUSH
   Void decodeFlush();
-#endif
 
 #if CABAC_INIT_FLAG
@@ -95,20 +93,12 @@
   Void  parseSPS                  ( TComSPS* pcSPS         ) {}
 #endif
-#if TILES_OR_ENTROPY_SYNC_IDC  
   Void  parsePPS                  ( TComPPS* pcPPS, ParameterSetManagerDecoder *parameterSet         ) {}
-#else
-  Void  parsePPS                  ( TComPPS* pcPPS         ) {}
-#endif
   Void  parseAPS                  ( TComAPS* pAPS          ) {}
   void parseSEI(SEImessages&) {}
 
-#if LCU_SYNTAX_ALF
 #if MTK_DEPTH_MERGE_TEXTURE_CANDIDATE_C0137
   Void  parseSliceHeader          ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl, AlfParamSet& alfParamSet, bool isDepth) {}
 #else
   Void  parseSliceHeader          ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl, AlfParamSet& alfParamSet) {}
-#endif
-#else
-  Void  parseSliceHeader          ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager, AlfCUCtrlInfo &alfCUCtrl ) {}
 #endif
 
@@ -120,5 +110,4 @@
 #endif
   
-#if SAO_UNIT_INTERLEAVING
   Void  parseSaoUvlc              ( UInt& ruiVal           );
   Void  parseSaoSvlc              ( Int&  riVal            );
@@ -129,5 +118,4 @@
   Void  parseSaoOneLcuInterleaving(Int rx, Int ry, SAOParam* pSaoParam, TComDataCU* pcCU, Int iCUAddrInSlice, Int iCUAddrUpInSlice, Bool bLFCrossSliceBoundaryFlag);
   Void  parseSaoOffset            (SaoLcuParam* psSaoLcuParam);
-#endif
   
 #if RWTH_SDC_DLT_B0036
@@ -256,18 +244,11 @@
   ContextModel3DBuffer m_cALFUvlcSCModel;
   ContextModel3DBuffer m_cALFSvlcSCModel;
-#if AMP_CTX
   ContextModel3DBuffer m_cCUAMPSCModel;
-#else
-  ContextModel3DBuffer m_cCUXPosiSCModel;
-  ContextModel3DBuffer m_cCUYPosiSCModel;
-#endif
   ContextModel3DBuffer m_cSaoFlagSCModel;
   ContextModel3DBuffer m_cSaoUvlcSCModel;
   ContextModel3DBuffer m_cSaoSvlcSCModel;
-#if SAO_UNIT_INTERLEAVING
   ContextModel3DBuffer m_cSaoMergeLeftSCModel;
   ContextModel3DBuffer m_cSaoMergeUpSCModel;
   ContextModel3DBuffer m_cSaoTypeIdxSCModel;
-#endif
 
 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
Index: branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecSlice.cpp
===================================================================
--- branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecSlice.cpp	(revision 292)
+++ branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecSlice.cpp	(revision 294)
@@ -148,7 +148,4 @@
   UInt uiCol=0, uiLin=0, uiSubStrm=0;
 
-#if !REMOVE_TILE_DEPENDENCE
-  Int iBreakDep;
-#endif
   UInt uiTileCol;
   UInt uiTileStartLCU;
@@ -163,7 +160,4 @@
     pcCU = rpcPic->getCU( iCUAddr );
     pcCU->initCU( rpcPic, iCUAddr );
-#if !REMOVE_TILE_DEPENDENCE
-    iBreakDep = rpcPic->getPicSym()->getTileBoundaryIndependenceIdr();
-#endif
     uiTileCol = rpcPic->getPicSym()->getTileIdxMap(iCUAddr) % (rpcPic->getPicSym()->getNumColumnsMinus1()+1); // what column of tiles are we in?
     uiTileStartLCU = rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(iCUAddr))->getFirstCUAddr();
@@ -175,23 +169,7 @@
     uiLin     = iCUAddr / uiWidthInLCUs;
     // inherit from TR if necessary, select substream to use.
-#if WPP_SIMPLIFICATION
     if( iSymbolMode && pcSlice->getPPS()->getNumSubstreams() > 1 )
-#else
-    if( iSymbolMode && pcSlice->getPPS()->getEntropyCodingSynchro() )
-#endif
-    {
-#if !REMOVE_TILE_DEPENDENCE
-#if WPP_SIMPLIFICATION
-      if (iBreakDep && pcSlice->getPPS()->getNumSubstreams() > 1)
-#else
-      if (iBreakDep && pcSlice->getPPS()->getEntropyCodingSynchro())
-#endif
-#else
-#if WPP_SIMPLIFICATION
+    {
       if (pcSlice->getPPS()->getNumSubstreams() > 1)
-#else
-      if (pcSlice->getPPS()->getEntropyCodingSynchro())
-#endif
-#endif
       {
         // independent tiles => substreams are "per tile".  iNumSubstreams has already been multiplied.
@@ -207,9 +185,5 @@
       m_pcEntropyDecoder->setBitstream( ppcSubstreams[uiSubStrm] );
       // Synchronize cabac probabilities with upper-right LCU if it's available and we're at the start of a line.
-#if WPP_SIMPLIFICATION
       if (pcSlice->getPPS()->getNumSubstreams() > 1 && uiCol == uiTileLCUX)
-#else
-      if (pcSlice->getPPS()->getEntropyCodingSynchro() && uiCol == uiTileLCUX)
-#endif
       {
         // We'll sync if the TR is available.
@@ -217,15 +191,8 @@
         UInt uiWidthInCU = rpcPic->getFrameWidthInCU();
         TComDataCU *pcCUTR = NULL;
-#if WPP_SIMPLIFICATION
         if ( pcCUUp && ((iCUAddr%uiWidthInCU+1) < uiWidthInCU)  )
         {
           pcCUTR = rpcPic->getCU( iCUAddr - uiWidthInCU + 1 );
         }
-#else
-        if ( pcCUUp && ((iCUAddr%uiWidthInCU+pcSlice->getPPS()->getEntropyCodingSynchro()) < uiWidthInCU)  )
-        {
-          pcCUTR = rpcPic->getCU( iCUAddr - uiWidthInCU + pcSlice->getPPS()->getEntropyCodingSynchro() );
-        }
-#endif
         UInt uiMaxParts = 1<<(pcSlice->getSPS()->getMaxCUDepth()<<1);
 
@@ -233,18 +200,10 @@
              ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) || 
              ((pcCUTR->getSCUAddr()+uiMaxParts-1) < pcSlice->getSliceCurStartCUAddr()) ||
-#if !REMOVE_TILE_DEPENDENCE
-             (rpcPic->getPicSym()->getTileBoundaryIndependenceIdr() && (rpcPic->getPicSym()->getTileIdxMap( pcCUTR->getAddr() ) != rpcPic->getPicSym()->getTileIdxMap(iCUAddr)))
-#else
              ((rpcPic->getPicSym()->getTileIdxMap( pcCUTR->getAddr() ) != rpcPic->getPicSym()->getTileIdxMap(iCUAddr)))
-#endif
              ))||
              (true/*bEnforceEntropySliceRestriction*/ &&
              ((pcCUTR==NULL) || (pcCUTR->getSlice()==NULL) || 
              ((pcCUTR->getSCUAddr()+uiMaxParts-1) < pcSlice->getEntropySliceCurStartCUAddr()) ||
-#if !REMOVE_TILE_DEPENDENCE
-             (rpcPic->getPicSym()->getTileBoundaryIndependenceIdr() && (rpcPic->getPicSym()->getTileIdxMap( pcCUTR->getAddr() ) != rpcPic->getPicSym()->getTileIdxMap(iCUAddr)))
-#else
              ((rpcPic->getPicSym()->getTileIdxMap( pcCUTR->getAddr() ) != rpcPic->getPicSym()->getTileIdxMap(iCUAddr)))
-#endif
              ))
            )
@@ -260,9 +219,5 @@
       pcSbacDecoder->load(&pcSbacDecoders[uiSubStrm]);  //this load is used to simplify the code (avoid to change all the call to pcSbacDecoders)
     }
-#if WPP_SIMPLIFICATION
     else if ( iSymbolMode && pcSlice->getPPS()->getNumSubstreams() <= 1 )
-#else
-    else if ( iSymbolMode && !pcSlice->getPPS()->getEntropyCodingSynchro() )
-#endif
     {
       // Set variables to appropriate values to avoid later code change.
@@ -273,9 +228,5 @@
          (iCUAddr!=0) && (iCUAddr!=rpcPic->getPicSym()->getPicSCUAddr(rpcPic->getSlice(rpcPic->getCurrSliceIdx())->getSliceCurStartCUAddr())/rpcPic->getNumPartInCU())) // !1st in frame && !1st in slice
     {
-#if WPP_SIMPLIFICATION
       if (pcSlice->getPPS()->getNumSubstreams() > 1)
-#else
-      if (pcSlice->getPPS()->getEntropyCodingSynchro())
-#endif
       {
         // We're crossing into another tile, tiles are independent.
@@ -330,37 +281,4 @@
     }
 
-#if !REMOVE_TILE_DEPENDENCE
-    if ( (rpcPic->getPicSym()->getTileBoundaryIndependenceIdr()==0) && (rpcPic->getPicSym()->getNumColumnsMinus1()!=0) )
-    {    
-      // Synchronize cabac probabilities with LCU among Tiles
-      if( (uiTileLCUX != 0) &&
-          (iCUAddr == rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(iCUAddr))->getFirstCUAddr()) )
-      {        
-        TComDataCU *pcCULeft = pcCU->getCULeft();
-        UInt uiMaxParts = 1<<(pcSlice->getSPS()->getMaxCUDepth()<<1);
-
-        if ( (true/*bEnforceSliceRestriction*/ &&
-              ((pcCULeft==NULL) || (pcCULeft->getSlice()==NULL) || 
-               ((pcCULeft->getSCUAddr()+uiMaxParts-1) < pcSlice->getSliceCurStartCUAddr()) 
-              )
-             )||
-             (true/*bEnforceEntropySliceRestriction*/ &&
-              ((pcCULeft==NULL) || (pcCULeft->getSlice()==NULL) || 
-               ((pcCULeft->getSCUAddr()+uiMaxParts-1) < pcSlice->getEntropySliceCurStartCUAddr())
-              )
-             )
-           )
-        {
-          // Left not available.
-        }
-        else
-        {
-          // Left is available, we use it.
-          pcSbacDecoders[uiSubStrm].loadContexts( &m_pcBufferLowLatSbacDecoders[uiTileCol-1] );
-          pcSbacDecoder->loadContexts(&pcSbacDecoders[uiSubStrm]);  //this load is used to simplify the code (avoid to change all the call to pcSbacDecoders)
-        }
-      }
-    }
-#endif
 
 
@@ -368,5 +286,4 @@
     g_bJustDoIt = g_bEncDecTraceEnable;
 #endif
-#if SAO_UNIT_INTERLEAVING
     if ( pcSlice->getSPS()->getUseSAO() && pcSlice->getSaoInterleavingFlag() && pcSlice->getSaoEnabledFlag() )
     {
@@ -384,5 +301,4 @@
       pcSbacDecoder->parseSaoOneLcuInterleaving(rx, ry, pcSlice->getAPS()->getSaoParam(),pcCU, cuAddrInSlice, cuAddrUpInSlice, pcSlice->getSPS()->getLFCrossSliceBoundaryFlag() );
     }
-#endif
 
     m_pcCuDecoder->decodeCU     ( pcCU, uiIsLast );
@@ -394,31 +310,16 @@
     if( iSymbolMode )
     {
-#if OL_FLUSH
       /*If at the end of a LCU line but not at the end of a substream, perform CABAC flush*/
-#if WPP_SIMPLIFICATION
       if (!uiIsLast && pcSlice->getPPS()->getNumSubstreams() > 1)
-#else
-      if (!uiIsLast && pcSlice->getPPS()->getCabacIstateReset())
-#endif
-      {
-#if !REMOVE_TILE_DEPENDENCE
-        if ((iBreakDep && (uiCol == uiTileLCUX+uiTileWidth-1) && (uiLin+iNumSubstreamsPerTile < uiTileLCUY+uiTileHeight))
-            || (!iBreakDep && (uiCol == uiWidthInLCUs-1) && (uiLin+iNumSubstreams < pcCU->getPic()->getFrameHeightInCU())))
-#else
+      {
         if ((uiCol == uiTileLCUX+uiTileWidth-1) && (uiLin+iNumSubstreamsPerTile < uiTileLCUY+uiTileHeight))
-#endif
         {
           m_pcEntropyDecoder->decodeFlush();
         }
       }
-#endif
       pcSbacDecoders[uiSubStrm].load(pcSbacDecoder);
 
       //Store probabilities of second LCU in line into buffer
-#if WPP_SIMPLIFICATION
       if (pcSlice->getPPS()->getNumSubstreams() > 1 && (uiCol == uiTileLCUX+1))
-#else
-      if (pcSlice->getPPS()->getEntropyCodingSynchro() && (uiCol == uiTileLCUX+pcSlice->getPPS()->getEntropyCodingSynchro()))
-#endif
       {
         m_pcBufferSbacDecoders[uiTileCol].loadContexts( &pcSbacDecoders[uiSubStrm] );
@@ -426,16 +327,4 @@
 
     }
-#if !REMOVE_TILE_DEPENDENCE
-    if ( (rpcPic->getPicSym()->getTileBoundaryIndependenceIdr()==0) && (rpcPic->getPicSym()->getNumColumnsMinus1()!=0) )
-    {
-      pcSbacDecoders[uiSubStrm].load(pcSbacDecoder);
-       //Store probabilties for next tile
-      if( (uiLin == (rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(iCUAddr))->getFirstCUAddr() / uiWidthInLCUs )) && 
-          (uiCol == rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(iCUAddr))->getRightEdgePosInCU()) )
-      {
-        m_pcBufferLowLatSbacDecoders[uiTileCol].loadContexts( &pcSbacDecoders[uiSubStrm] );
-      }
-    }
-#endif
   }
 
Index: branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecTop.cpp
===================================================================
--- branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecTop.cpp	(revision 292)
+++ branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecTop.cpp	(revision 294)
@@ -525,9 +525,5 @@
   xUpdateGopSize(pcSlice);
   
-#if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
   m_iMaxRefPicNum = pcSlice->getSPS()->getMaxDecPicBuffering(pcSlice->getTLayer())+pcSlice->getSPS()->getNumReorderPics(pcSlice->getTLayer()) + 1; // +1 to have space for the picture currently being decoded
-#else
-  m_iMaxRefPicNum = pcSlice->getSPS()->getMaxNumberOfReferencePictures()+pcSlice->getSPS()->getNumReorderFrames() + 1; // +1 to have space for the picture currently being decoded
-#endif
 
 #if DEPTH_MAP_GENERATION
@@ -716,17 +712,9 @@
   }
 
-#if !LCU_SYNTAX_ALF
-  // create ALF temporary buffer
-  m_cAdaptiveLoopFilter.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
-#endif
   m_cSAO.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
   m_cLoopFilter.        create( g_uiMaxCUDepth );
 }
 
-#if SKIPFRAME_BUGFIX
 Bool TDecTop::xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay )
-#else
-Bool TDecTop::xDecodeSlice(InputNALUnit &nalu, Int iSkipFrame, Int iPOCLastDisplay )
-#endif
 {
   TComPic*&   pcPic         = m_pcPic;
@@ -785,13 +773,8 @@
   }
 
-#if NAL_REF_FLAG
   m_apcSlicePilot->setReferenced(nalu.m_nalRefFlag);
-#else
-  m_apcSlicePilot->setReferenced(nalu.m_nalRefIDC != NAL_REF_IDC_PRIORITY_LOWEST);
-#endif
   m_apcSlicePilot->setTLayerInfo(nalu.m_temporalId);
 
   // ALF CU parameters should be part of the slice header -> needs to be fixed 
-#if LCU_SYNTAX_ALF
 #if MTK_DEPTH_MERGE_TEXTURE_CANDIDATE_C0137
   m_cEntropyDecoder.decodeSliceHeader (m_apcSlicePilot, &m_parameterSetManagerDecoder, m_cGopDecoder.getAlfCuCtrlParam(), m_cGopDecoder.getAlfParamSet(),m_apcSlicePilot->getVPS()->getDepthFlag(nalu.m_layerId));
@@ -799,7 +782,4 @@
   m_cEntropyDecoder.decodeSliceHeader (m_apcSlicePilot, &m_parameterSetManagerDecoder, m_cGopDecoder.getAlfCuCtrlParam(), m_cGopDecoder.getAlfParamSet());
 #endif
-#else
-  m_cEntropyDecoder.decodeSliceHeader (m_apcSlicePilot, &m_parameterSetManagerDecoder, m_cGopDecoder.getAlfCuCtrlParam() );
-#endif
   // byte align
   {
@@ -816,5 +796,4 @@
   if (m_apcSlicePilot->isNextSlice() && m_apcSlicePilot->getPOC()!=m_prevPOC && !m_bFirstSliceInSequence)
   {
-#if START_DECODING_AT_CRA
     if (m_prevPOC >= m_pocRandomAccess)
     {
@@ -823,8 +802,4 @@
     }
     m_prevPOC = m_apcSlicePilot->getPOC();
-#else
-    m_prevPOC = m_apcSlicePilot->getPOC();
-    return true;
-#endif
   }
   // actual decoding starts here
@@ -846,9 +821,5 @@
   }
   //detect lost reference picture and insert copy of earlier frame.
-#if START_DECODING_AT_CRA
   while(m_apcSlicePilot->checkThatAllRefPicsAreAvailable(m_cListPic, m_apcSlicePilot->getRPS(), true, m_pocRandomAccess) > 0)
-#else
-  while(m_apcSlicePilot->checkThatAllRefPicsAreAvailable(m_cListPic, m_apcSlicePilot->getRPS(), true) > 0)
-#endif
   {
     xCreateLostPicture(m_apcSlicePilot->checkThatAllRefPicsAreAvailable(m_cListPic, m_apcSlicePilot->getRPS(), false)-1);
@@ -897,15 +868,4 @@
   UInt i, j, p;
 
-#if !REMOVE_TILE_DEPENDENCE
-  //set the TileBoundaryIndependenceIdr
-  if(pcSlice->getPPS()->getTileBehaviorControlPresentFlag() == 1)
-  {
-    pcPic->getPicSym()->setTileBoundaryIndependenceIdr( pcSlice->getPPS()->getTileBoundaryIndependenceIdr() );
-  }
-  else
-  {
-    pcPic->getPicSym()->setTileBoundaryIndependenceIdr( pcSlice->getPPS()->getSPS()->getTileBoundaryIndependenceIdr() );
-  }
-#endif
 
   if( pcSlice->getPPS()->getColumnRowInfoPresent() == 1 )
@@ -1265,8 +1225,6 @@
 {
   TComSPS* sps = new TComSPS();
-#if RPS_IN_SPS
   TComRPSList* rps = new TComRPSList();
   sps->setRPSList(rps);
-#endif
 #if HHI_MPI || OL_QTLIMIT_PREDCODING_B0068
   m_cEntropyDecoder.decodeSPS( sps, m_isDepth );
@@ -1275,23 +1233,11 @@
 #endif
   m_parameterSetManagerDecoder.storePrefetchedSPS(sps);
-#if LCU_SYNTAX_ALF
   m_cAdaptiveLoopFilter.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
-#endif
 }
 
 Void TDecTop::xDecodePPS()
 {
-#if !RPS_IN_SPS
-  TComRPSList* rps = new TComRPSList();
-#endif
   TComPPS* pps = new TComPPS();
-#if !RPS_IN_SPS
-  pps->setRPSList(rps);
-#endif
-#if TILES_OR_ENTROPY_SYNC_IDC
   m_cEntropyDecoder.decodePPS( pps, &m_parameterSetManagerDecoder );
-#else
-  m_cEntropyDecoder.decodePPS( pps );
-#endif
   m_parameterSetManagerDecoder.storePrefetchedPPS( pps );
 
@@ -1346,5 +1292,4 @@
     case NAL_UNIT_CODED_SLICE:
     case NAL_UNIT_CODED_SLICE_IDR:
-#if H0566_TLA
 #if !QC_REM_IDV_B0046
     case NAL_UNIT_CODED_SLICE_IDV:
@@ -1352,7 +1297,4 @@
     case NAL_UNIT_CODED_SLICE_CRA:
     case NAL_UNIT_CODED_SLICE_TLA:
-#else
-    case NAL_UNIT_CODED_SLICE_CDR:
-#endif
       return xDecodeSlice(nalu, iSkipFrame, iPOCLastDisplay);
       break;
@@ -1375,7 +1317,5 @@
   sps = pSPSV0;
   m_parameterSetManagerDecoder.storePrefetchedSPS(sps);
-#if LCU_SYNTAX_ALF
   m_cAdaptiveLoopFilter.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth );
-#endif
 }
 
@@ -1412,9 +1352,5 @@
   else if (m_pocRandomAccess == MAX_INT) // start of random access point, m_pocRandomAccess has not been set yet.
   {
-#if H0566_TLA
     if( m_apcSlicePilot->getNalUnitTypeBaseViewMvc() == NAL_UNIT_CODED_SLICE_CRA )
-#else
-    if( m_apcSlicePilot->getNalUnitTypeBaseViewMvc() == NAL_UNIT_CODED_SLICE_CDR )
-#endif
     {
       m_pocRandomAccess = m_apcSlicePilot->getPOC(); // set the POC random access since we need to skip the reordered pictures in CRA.
@@ -1426,5 +1362,4 @@
     else 
     {
-#if START_DECODING_AT_CRA
       static bool warningMessage = false;
       if(!warningMessage)
@@ -1434,8 +1369,4 @@
       }
       return true;
-#else
-      printf("\nUnsafe random access point. Decoder may crash.");
-      m_pocRandomAccess = 0;
-#endif
     }
   }
@@ -1458,7 +1389,4 @@
   m_cSAO.allocSaoParam(pAPS->getSaoParam());
   pAPS->createAlfParam();
-#if !LCU_SYNTAX_ALF
-  m_cAdaptiveLoopFilter.allocALFParam(pAPS->getAlfParam());
-#endif
 }
 
Index: branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecTop.h
===================================================================
--- branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecTop.h	(revision 292)
+++ branches/HTM-5.1-dev0/source/Lib/TLibDecoder/TDecTop.h	(revision 294)
@@ -282,9 +282,5 @@
   Void      decodeAPS( TComAPS* cAPS) { m_cEntropyDecoder.decodeAPS(cAPS); };
   Void      xActivateParameterSets();
-#if SKIPFRAME_BUGFIX
   Bool      xDecodeSlice(InputNALUnit &nalu, Int &iSkipFrame, Int iPOCLastDisplay);
-#else
-  Bool      xDecodeSlice(InputNALUnit &nalu, Int iSkipFrame, Int iPOCLastDisplay);
-#endif
 #if VIDYO_VPS_INTEGRATION|QC_MVHEVC_B0046
   Void      xDecodeVPS();
