Index: trunk/source/Lib/TLibEncoder/TEncCavlc.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 210)
+++ trunk/source/Lib/TLibEncoder/TEncCavlc.cpp	(revision 296)
@@ -161,19 +161,9 @@
   //DF flag
   WRITE_FLAG(pcAPS->getLoopFilterOffsetInAPS()?1:0, "aps_deblocking_filter_flag");
-#if !SAO_UNIT_INTERLEAVING
-  //SAO flag
-  WRITE_FLAG( pcAPS->getSaoEnabled()?1:0, "aps_sample_adaptive_offset_flag"); 
-#endif
-#if !LCU_SYNTAX_ALF
-  //ALF flag
-  WRITE_FLAG( pcAPS->getAlfEnabled()?1:0, "aps_adaptive_loop_filter_flag"); 
-#endif
-}
-#if LCU_SYNTAX_ALF
+}
 Void TEncCavlc::codeAPSAlflag(UInt uiCode)
 {
   WRITE_FLAG(uiCode, "aps_adaptive_loop_filter_flag");
 }
-#endif
 
 Void TEncCavlc::codeDFFlag(UInt uiCode, const Char *pSymbolName)
@@ -186,9 +176,5 @@
 }
 
-#if RPS_IN_SPS
 Void TEncCavlc::codeShortTermRefPicSet( TComSPS* pcSPS, TComReferencePictureSet* rps )
-#else
-Void TEncCavlc::codeShortTermRefPicSet( TComPPS* pcPPS, TComReferencePictureSet* rps )
-#endif
 {
 #if PRINT_RPS_INFO
@@ -245,12 +231,8 @@
   xTracePPSHeader (pcPPS);
 #endif
-#if !RPS_IN_SPS
-  TComRPSList* rpsList = pcPPS->getRPSList();
-#endif
   
   WRITE_UVLC( pcPPS->getPPSId(),                             "pic_parameter_set_id" );
   WRITE_UVLC( pcPPS->getSPSId(),                             "seq_parameter_set_id" );
 
-#if MULTIBITS_DATA_HIDING
   WRITE_FLAG( pcPPS->getSignHideFlag(), "sign_data_hiding_flag" );
   if( pcPPS->getSignHideFlag() )
@@ -258,20 +240,6 @@
     WRITE_CODE(pcPPS->getTSIG(), 4, "sign_hiding_threshold");
   }
-#endif
 #if CABAC_INIT_FLAG
   WRITE_FLAG( pcPPS->getCabacInitPresentFlag() ? 1 : 0,   "cabac_init_present_flag" );
-#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*      rps;
-
-  WRITE_UVLC(rpsList->getNumberOfReferencePictureSets(), "num_short_term_ref_pic_sets" );
-  for(UInt i=0; i < rpsList->getNumberOfReferencePictureSets(); i++)
-  {
-    rps = rpsList->getReferencePictureSet(i);
-    codeShortTermRefPicSet(pcPPS,rps);
-  }
-  WRITE_FLAG( pcPPS->getLongTermRefsPresent() ? 1 : 0,         "long_term_ref_pics_present_flag" );
 #endif
   // entropy_coding_mode_flag
@@ -280,24 +248,5 @@
   if (pcPPS->getEntropyCodingMode())
   {
-#if !WPP_SIMPLIFICATION
-    WRITE_UVLC( pcPPS->getEntropyCodingSynchro(),            "entropy_coding_synchro" );
-    WRITE_FLAG( pcPPS->getCabacIstateReset() ? 1 : 0,        "cabac_istate_reset" );
-#endif
-#if !TILES_OR_ENTROPY_SYNC_IDC
-#if !WPP_SIMPLIFICATION
-    if ( pcPPS->getEntropyCodingSynchro() )
-#endif
-    {
-      WRITE_UVLC( pcPPS->getNumSubstreams()-1,               "num_substreams_minus1" );
-    }
-#endif
-  }
-#if !H0566_TLA
-  WRITE_UVLC( pcPPS->getNumTLayerSwitchingFlags(),           "num_temporal_layer_switching_point_flags" );
-  for( UInt i = 0; i < pcPPS->getNumTLayerSwitchingFlags(); i++ ) 
-  {
-    WRITE_FLAG( pcPPS->getTLayerSwitchingFlag( i ) ? 1 : 0 , "temporal_layer_switching_point_flag" ); 
-  }
-#endif
+  }
   //   num_ref_idx_l0_default_active_minus1
   //   num_ref_idx_l1_default_active_minus1
@@ -313,11 +262,7 @@
   WRITE_FLAG( pcPPS->getUseWP() ? 1 : 0,  "weighted_pred_flag" );   // Use of Weighting Prediction (P_SLICE)
   WRITE_CODE( pcPPS->getWPBiPredIdc(), 2, "weighted_bipred_idc" );  // Use of Weighting Bi-Prediction (B_SLICE)
-#if H0388
   WRITE_FLAG( pcPPS->getOutputFlagPresentFlag() ? 1 : 0,  "output_flag_present_flag" );
-#endif
-#if TILES_OR_ENTROPY_SYNC_IDC
   if(pcPPS->getSPS()->getTilesOrEntropyCodingSyncIdc()==1)
   {
-#endif
     WRITE_FLAG( pcPPS->getColumnRowInfoPresent(),           "tile_info_present_flag" );
     WRITE_FLAG( pcPPS->getTileBehaviorControlPresentFlag(),  "tile_control_present_flag");
@@ -347,16 +292,7 @@
       if(iNumColTilesMinus1 !=0 || iNumRowTilesMinus1 !=0)
       {
-#if !REMOVE_TILE_DEPENDENCE
-        WRITE_FLAG( pcPPS->getTileBoundaryIndependenceIdr(),                         "tile_boundary_independence_flag" );
-        if(pcPPS->getTileBoundaryIndependenceIdr() == 1)
-        {
-#endif
           WRITE_FLAG( pcPPS->getLFCrossTileBoundaryFlag()?1 : 0,            "loop_filter_across_tile_flag");
-#if !REMOVE_TILE_DEPENDENCE
-        }
-#endif
-      }
-    }
-#if TILES_OR_ENTROPY_SYNC_IDC
+      }
+    }
   }
   else if(pcPPS->getSPS()->getTilesOrEntropyCodingSyncIdc()==2)
@@ -364,12 +300,7 @@
     WRITE_UVLC( pcPPS->getNumSubstreams()-1,               "num_substreams_minus1" );
   }
-#endif
-
-#if DBL_CONTROL
+
   WRITE_FLAG( pcPPS->getDeblockingFilterControlPresent()?1 : 0, "deblocking_filter_control_present_flag");
-#endif
-#if PARALLEL_MERGE
   WRITE_UVLC( pcPPS->getLog2ParallelMergeLevelMinus2(), "log2_parallel_merge_level_minus2");
-#endif
   WRITE_FLAG( 0, "pps_extension_flag" );
 }
@@ -498,4 +429,7 @@
       }
     }
+#if INTER_VIEW_VECTOR_SCALING_C0115
+      WRITE_FLAG( pcVPS->getIVScalingFlag(),                      "inter_view_vector_scaling_flag" );
+#endif
   }
   
@@ -508,5 +442,5 @@
 #endif
 #endif
-#if HHI_MPI
+#if HHI_MPI || OL_QTLIMIT_PREDCODING_B0068 
 Void TEncCavlc::codeSPS( TComSPS* pcSPS, Bool bIsDepth )
 #else
@@ -528,5 +462,4 @@
   WRITE_UVLC( pcSPS->getPicWidthInLumaSamples (),   "pic_width_in_luma_samples" );
   WRITE_UVLC( pcSPS->getPicHeightInLumaSamples(),   "pic_height_in_luma_samples" );
-#if PIC_CROPPING
   WRITE_FLAG( pcSPS->getPicCroppingFlag(),          "pic_cropping_flag" );
   if (pcSPS->getPicCroppingFlag())
@@ -537,5 +470,4 @@
     WRITE_UVLC( pcSPS->getPicCropBottomOffset(),    "pic_crop_bottom_offset" );
   }
-#endif
 
 #if FULL_NBIT
@@ -563,5 +495,4 @@
 
   WRITE_UVLC( pcSPS->getBitsForPOC()-4,                 "log2_max_pic_order_cnt_lsb_minus4" );
-#if H0567_DPB_PARAMETERS_PER_TEMPORAL_LAYER
   for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++)
   {
@@ -570,10 +501,4 @@
     WRITE_UVLC( pcSPS->getMaxLatencyIncrease(i),           "max_latency_increase[i]" );
   }
-#else
-  WRITE_UVLC( pcSPS->getMaxNumberOfReferencePictures(), "max_num_ref_pics" ); 
-  WRITE_UVLC( pcSPS->getNumReorderFrames(),             "num_reorder_frames" ); 
-  WRITE_UVLC(pcSPS->getMaxDecFrameBuffering(),          "max_dec_frame_buffering" );
-  WRITE_UVLC(pcSPS->getMaxLatencyIncrease(),            "max_latency_increase"    );
-#endif
   assert( pcSPS->getMaxCUWidth() == pcSPS->getMaxCUHeight() );
   
@@ -586,5 +511,4 @@
   }
 
-#if H0412_REF_PIC_LIST_RESTRICTION
   WRITE_FLAG( pcSPS->getRestrictedRefPicListsFlag(),                                 "restricted_ref_pic_lists_flag" );
   if( pcSPS->getRestrictedRefPicListsFlag() )
@@ -592,5 +516,4 @@
     WRITE_FLAG( pcSPS->getListsModificationPresentFlag(),                            "lists_modification_present_flag" );
   }
-#endif
   WRITE_UVLC( log2MinCUSize - 3,                                                     "log2_min_coding_block_size_minus3" );
   WRITE_UVLC( pcSPS->getMaxCUDepth()-g_uiAddCUDepth,                                 "log2_diff_max_min_coding_block_size" );
@@ -618,10 +541,8 @@
   WRITE_FLAG( pcSPS->getUseSAO() ? 1 : 0,                                            "sample_adaptive_offset_enabled_flag");
   WRITE_FLAG( pcSPS->getUseALF () ? 1 : 0,                                           "adaptive_loop_filter_enabled_flag");
-#if LCU_SYNTAX_ALF
   if(pcSPS->getUseALF())
   {
     WRITE_FLAG( (pcSPS->getUseALFCoefInSlice()) ? 1 : 0,                             "alf_coef_in_slice_flag");
   }
-#endif
 
   if( pcSPS->getUsePCM() )
@@ -634,5 +555,4 @@
   WRITE_FLAG( pcSPS->getTemporalIdNestingFlag() ? 1 : 0,                             "temporal_id_nesting_flag" );
 
-#if RPS_IN_SPS
   TComRPSList* rpsList = pcSPS->getRPSList();
   TComReferencePictureSet*      rps;
@@ -645,11 +565,4 @@
   }    
   WRITE_FLAG( pcSPS->getLongTermRefsPresent() ? 1 : 0,         "long_term_ref_pics_present_flag" );
-#endif
-#if !PIC_CROPPING
-  //!!!KS: Syntax not in WD !!!
-  
-  xWriteUvlc  ( pcSPS->getPad (0) );
-  xWriteUvlc  ( pcSPS->getPad (1) );
-#endif
   // AMVP mode for each depth
   for (Int i = 0; i < pcSPS->getMaxCUDepth(); i++)
@@ -658,5 +571,4 @@
   }
 
-#if TILES_WPP_ENTRY_POINT_SIGNALLING
   Int tilesOrEntropyCodingSyncIdc = 0;
   if ( pcSPS->getNumColumnsMinus1() > 0 || pcSPS->getNumRowsMinus1() > 0)
@@ -670,10 +582,7 @@
   pcSPS->setTilesOrEntropyCodingSyncIdc( tilesOrEntropyCodingSyncIdc );
   WRITE_CODE(tilesOrEntropyCodingSyncIdc, 2, "tiles_or_entropy_coding_sync_idc");
-#endif
-
-#if TILES_OR_ENTROPY_SYNC_IDC
+
   if(tilesOrEntropyCodingSyncIdc == 1)
   {
-#endif
     WRITE_UVLC( pcSPS->getNumColumnsMinus1(),                           "num_tile_columns_minus1" );
     WRITE_UVLC( pcSPS->getNumRowsMinus1(),                              "num_tile_rows_minus1" );
@@ -694,17 +603,7 @@
     if( pcSPS->getNumColumnsMinus1() !=0 || pcSPS->getNumRowsMinus1() != 0)
     {
-#if !REMOVE_TILE_DEPENDENCE
-      WRITE_FLAG( pcSPS->getTileBoundaryIndependenceIdr(),                "tile_boundary_independence_flag" );
-      if(pcSPS->getTileBoundaryIndependenceIdr() == 1)
-      {
-#endif
         WRITE_FLAG( pcSPS->getLFCrossTileBoundaryFlag()?1 : 0,            "loop_filter_across_tile_flag");
-#if !REMOVE_TILE_DEPENDENCE
-      }
-#endif
-    }
-#if TILES_OR_ENTROPY_SYNC_IDC
-  }
-#endif
+    }
+  }
   WRITE_FLAG( 1, "sps_extension_flag" );
 #if !QC_MVHEVC_B0046
@@ -792,8 +691,8 @@
           WRITE_SVLC( pcSPS->getPdmOffset       ()[ uiId ], "Pdm_offset" );
         }
-#if HHI_INTER_VIEW_MOTION_PRED
+#if H3D_IVMP
         WRITE_UVLC( pcSPS->getMultiviewMvPredMode(), "multi_view_mv_pred_mode" );
 #endif
-#if HHI_INTER_VIEW_RESIDUAL_PRED
+#if H3D_IVRP
         WRITE_FLAG  ( pcSPS->getMultiviewResPredMode(), "multi_view_residual_pred_mode" );
 #endif
@@ -866,5 +765,9 @@
   if (address==0)
   {
-    if( pcSlice->getSPS()->getViewId() && !pcSlice->getIsDepth() )
+    if( pcSlice->getSPS()->getViewId() 
+#if !LGE_ILLUCOMP_DEPTH_C0046
+        && !pcSlice->getIsDepth()
+#endif
+        )
     {
       WRITE_FLAG( pcSlice->getApplyIC() ? 1 : 0, "applying IC flag" );
@@ -889,10 +792,8 @@
     WRITE_UVLC( pcSlice->getPPS()->getPPSId(), "pic_parameter_set_id" );
 #endif
-#if H0388
     if( pcSlice->getPPS()->getOutputFlagPresentFlag() )
     {
       WRITE_FLAG( pcSlice->getPicOutputFlag() ? 1 : 0, "pic_output_flag" );
     }
-#endif
 #if QC_REM_IDV_B0046
     if(pcSlice->getNalUnitType()==NAL_UNIT_CODED_SLICE_IDR && pcSlice->getViewId() == 0) 
@@ -917,9 +818,5 @@
         {
           WRITE_FLAG( 0, "short_term_ref_pic_set_sps_flag");
-#if RPS_IN_SPS
           codeShortTermRefPicSet(pcSlice->getSPS(), rps);
-#else
-          codeShortTermRefPicSet(pcSlice->getPPS(), rps);
-#endif
         }
         else
@@ -928,22 +825,15 @@
           WRITE_UVLC( pcSlice->getRPSidx(), "short_term_ref_pic_set_idx" );
         }
-#if RPS_IN_SPS
         if(pcSlice->getSPS()->getLongTermRefsPresent())
-#else
-        if(pcSlice->getPPS()->getLongTermRefsPresent())
-#endif
         {
           WRITE_UVLC( rps->getNumberOfLongtermPictures(), "num_long_term_pics");
           Int maxPocLsb = 1<<pcSlice->getSPS()->getBitsForPOC();
           Int prev = 0;
-#if LTRP_MULT
           Int prevDeltaPocLt=0;
           Int currDeltaPocLt=0;
-#endif
           for(Int i=rps->getNumberOfPictures()-1 ; i > rps->getNumberOfPictures()-rps->getNumberOfLongtermPictures()-1; i--)
           {
             WRITE_UVLC((maxPocLsb-rps->getDeltaPOC(i)+prev)%maxPocLsb, "delta_poc_lsb_lt");
           
-#if LTRP_MULT
             currDeltaPocLt=((maxPocLsb-rps->getDeltaPOC(i)+prev)%maxPocLsb)+prevDeltaPocLt;
 
@@ -976,5 +866,4 @@
             }
             prevDeltaPocLt=currDeltaPocLt;
-#endif
             prev = rps->getDeltaPOC(i);
             WRITE_FLAG( rps->getUsed(i), "used_by_curr_pic_lt_flag"); 
@@ -988,9 +877,5 @@
         {
           WRITE_FLAG( 0, "short_term_ref_pic_set_sps_flag");
-#if RPS_IN_SPS
           codeShortTermRefPicSet(pcSlice->getSPS(), rps);
-#else
-          codeShortTermRefPicSet(pcSlice->getPPS(), rps);
-#endif
         }
         else
@@ -999,22 +884,15 @@
           WRITE_UVLC( pcSlice->getRPSidx(), "short_term_ref_pic_set_idx" );
         }
-#if RPS_IN_SPS
         if(pcSlice->getSPS()->getLongTermRefsPresent())
-#else
-        if(pcSlice->getPPS()->getLongTermRefsPresent())
-#endif
         {
           WRITE_UVLC( rps->getNumberOfLongtermPictures(), "num_long_term_pics");
           Int maxPocLsb = 1<<pcSlice->getSPS()->getBitsForPOC();
           Int prev = 0;
-#if LTRP_MULT
           Int prevDeltaPocLt=0;
           Int currDeltaPocLt=0;
-#endif
           for(Int i=rps->getNumberOfPictures()-1 ; i > rps->getNumberOfPictures()-rps->getNumberOfLongtermPictures()-1; i--)
           {
             WRITE_UVLC((maxPocLsb-rps->getDeltaPOC(i)+prev)%maxPocLsb, "delta_poc_lsb_lt");
           
-#if LTRP_MULT
             currDeltaPocLt=((maxPocLsb-rps->getDeltaPOC(i)+prev)%maxPocLsb)+prevDeltaPocLt;
 
@@ -1047,5 +925,4 @@
             }
             prevDeltaPocLt=currDeltaPocLt;
-#endif
             prev = rps->getDeltaPOC(i);
             WRITE_FLAG( rps->getUsed(i), "used_by_curr_pic_lt_flag"); 
@@ -1059,20 +936,11 @@
       if (pcSlice->getSPS()->getUseALF())
       {
-#if !LCU_SYNTAX_ALF
-         if (pcSlice->getAlfEnabledFlag())
-         {
-           assert (pcSlice->getAPS()->getAlfEnabled());
-         }
-#endif
          WRITE_FLAG( pcSlice->getAlfEnabledFlag(), "ALF on/off flag in slice header" );
       }
       if (pcSlice->getSPS()->getUseSAO())
       {
-#if SAO_UNIT_INTERLEAVING
         WRITE_FLAG( pcSlice->getSaoInterleavingFlag(), "SAO interleaving flag" );
-#endif
          assert (pcSlice->getSaoEnabledFlag() == pcSlice->getAPS()->getSaoEnabled());
          WRITE_FLAG( pcSlice->getSaoEnabledFlag(), "SAO on/off flag in slice header" );
-#if SAO_UNIT_INTERLEAVING
          if (pcSlice->getSaoInterleavingFlag()&&pcSlice->getSaoEnabledFlag() )
          {
@@ -1080,5 +948,4 @@
            WRITE_FLAG( pcSlice->getAPS()->getSaoParam()->bSaoFlag[2], "SAO on/off flag for Cr in slice header" );
          }
-#endif
       }
       WRITE_UVLC( pcSlice->getAPS()->getAPSID(), "aps_id");
@@ -1103,10 +970,7 @@
       pcSlice->setNumRefIdx(REF_PIC_LIST_1, 0);
     }
-#if H0412_REF_PIC_LIST_RESTRICTION
     if( pcSlice->getSPS()->getListsModificationPresentFlag() )
     {
-#endif
     TComRefPicListModification* refPicListModification = pcSlice->getRefPicListModification();
-#if H0137_0138_LIST_MODIFICATION
     if( !pcSlice->isIntra() )
     {
@@ -1151,32 +1015,6 @@
       }
     }
-#else
-      if(!pcSlice->isIntra())
-      {
-        WRITE_FLAG(pcSlice->getRefPicListModification()->getRefPicListModificationFlagL0() ? 1 : 0,       "ref_pic_list_modification_flag" );    
-        for(Int i = 0; i < refPicListModification->getNumberOfRefPicListModificationsL0(); i++)
-        {
-          WRITE_UVLC( refPicListModification->getListIdcL0(i), "ref_pic_list_modification_idc");
-          WRITE_UVLC( refPicListModification->getRefPicSetIdxL0(i), "ref_pic_set_idx");
-        }
-        if(pcSlice->getRefPicListModification()->getRefPicListModificationFlagL0())
-          WRITE_UVLC( 3, "ref_pic_list_modification_idc");
-      }
-      if(pcSlice->isInterB())
-      {    
-        WRITE_FLAG(pcSlice->getRefPicListModification()->getRefPicListModificationFlagL1() ? 1 : 0,       "ref_pic_list_modification_flag" );
-        for(Int i = 0; i < refPicListModification->getNumberOfRefPicListModificationsL1(); i++)
-        {
-          WRITE_UVLC( refPicListModification->getListIdcL1(i), "ref_pic_list_modification_idc");
-          WRITE_UVLC( refPicListModification->getRefPicSetIdxL1(i), "ref_pic_set_idx");
-        }
-        if(pcSlice->getRefPicListModification()->getRefPicListModificationFlagL1())
-          WRITE_UVLC( 3, "ref_pic_list_modification_idc");
-      }
-#endif
-    }
-#if H0412_REF_PIC_LIST_RESTRICTION
-  }
-#endif
+    }
+  }
   // ref_pic_list_combination( )
   // maybe move to own function?
@@ -1188,8 +1026,6 @@
       WRITE_UVLC( pcSlice->getNumRefIdx(REF_PIC_LIST_C) - 1,          "num_ref_idx lc_active_minus1");
       
-#if H0412_REF_PIC_LIST_RESTRICTION
       if( pcSlice->getSPS()->getListsModificationPresentFlag() )
       {
-#endif
         WRITE_FLAG( pcSlice->getRefPicListModificationFlagLC() ? 1 : 0, "ref_pic_list_modification_flag_lc" );
         if(pcSlice->getRefPicListModificationFlagLC())
@@ -1198,26 +1034,18 @@
           {
             WRITE_FLAG( pcSlice->getListIdFromIdxOfLC(i),               "pic_from_list_0_flag" );
-#if H0137_0138_LIST_MODIFICATION
           if (((pcSlice->getListIdFromIdxOfLC(i)==REF_PIC_LIST_0) && pcSlice->getNumRefIdx( REF_PIC_LIST_0 )>1 ) || ((pcSlice->getListIdFromIdxOfLC(i)==REF_PIC_LIST_1) && pcSlice->getNumRefIdx( REF_PIC_LIST_1 )>1 ) )
           {
             WRITE_UVLC( pcSlice->getRefIdxFromIdxOfLC(i),               "ref_idx_list_curr" );
           }
-#else
-            WRITE_UVLC( pcSlice->getRefIdxFromIdxOfLC(i),               "ref_idx_list_curr" );
-#endif
           }
         }
-#if H0412_REF_PIC_LIST_RESTRICTION
-      }
-#endif
+      }
     }
   }
     
-#if H0111_MVD_L1_ZERO
   if (pcSlice->isInterB())
   {
     WRITE_FLAG( pcSlice->getMvdL1ZeroFlag() ? 1 : 0,   "mvd_l1_zero_flag");
   }
-#endif
 
   if(pcSlice->getPPS()->getEntropyCodingMode() && !pcSlice->isIntra())
@@ -1242,5 +1070,4 @@
     Int iCode = pcSlice->getSliceQp() - ( pcSlice->getPPS()->getPicInitQPMinus26() + 26 );
     WRITE_SVLC( iCode, "slice_qp_delta" ); 
-#if DBL_CONTROL
     if (pcSlice->getPPS()->getDeblockingFilterControlPresent())
     {
@@ -1249,7 +1076,4 @@
         WRITE_FLAG(pcSlice->getInheritDblParamFromAPS(), "inherit_dbl_param_from_APS_flag");
       }
-#else
-    WRITE_FLAG(pcSlice->getInheritDblParamFromAPS(), "inherit_dbl_param_from_APS_flag");
-#endif
       if (!pcSlice->getInheritDblParamFromAPS())
       {
@@ -1261,7 +1085,5 @@
         }
       }
-#if DBL_CONTROL
-    }
-#endif
+    }
     if ( pcSlice->getSliceType() == B_SLICE )
     {
@@ -1299,9 +1121,11 @@
   }
   
-#if ( HHI_MPI || HHI_INTER_VIEW_MOTION_PRED )
-  #if ( HHI_MPI && HHI_INTER_VIEW_MOTION_PRED )
+#if ( HHI_MPI || H3D_IVMP )
+  #if ( HHI_MPI && H3D_IVMP )
   const int iExtraMergeCandidates = ( pcSlice->getSPS()->getUseMVI() || pcSlice->getSPS()->getMultiviewMvPredMode() ) ? 1 : 0;
   #elif HHI_MPI
   const int iExtraMergeCandidates = pcSlice->getSPS()->getUseMVI() ? 1 : 0;
+  #elif MTK_DEPTH_MERGE_TEXTURE_CANDIDATE_C0137
+  const int iExtraMergeCandidates = ( pcSlice->getIsDepth() || pcSlice->getSPS()->getMultiviewMvPredMode() ) ? 1 : 0;
   #else
   const int iExtraMergeCandidates = pcSlice->getSPS()->getMultiviewMvPredMode() ? 1 : 0;
@@ -1332,5 +1156,4 @@
  \param pcSlice Where we find the substream size information.
  */
-#if TILES_WPP_ENTRY_POINT_SIGNALLING
 Void  TEncCavlc::codeTilesWPPEntryPoint( TComSlice* pSlice )
 {
@@ -1432,44 +1255,4 @@
   delete [] entryPointOffset;
 }
-#else
-Void TEncCavlc::codeSliceHeaderSubstreamTable( TComSlice* pcSlice )
-{
-  UInt uiNumSubstreams = pcSlice->getPPS()->getNumSubstreams();
-  UInt*puiSubstreamSizes = pcSlice->getSubstreamSizes();
-
-  // Write header information for all substreams except the last.
-  for (UInt ui = 0; ui+1 < uiNumSubstreams; ui++)
-  {
-    UInt uiNumbits = puiSubstreamSizes[ui];
-
-    //the 2 first bits are used to give the size of the header
-    if ( uiNumbits < (1<<8) )
-    {
-      xWriteCode(0,         2  );
-      xWriteCode(uiNumbits, 8  );
-    }
-    else if ( uiNumbits < (1<<16) )
-    {
-      xWriteCode(1,         2  );
-      xWriteCode(uiNumbits, 16 );
-    }
-    else if ( uiNumbits < (1<<24) )
-    {
-      xWriteCode(2,         2  );
-      xWriteCode(uiNumbits, 24 );
-    }
-    else if ( uiNumbits < (1<<31) )
-    {
-      xWriteCode(3,         2  );
-      xWriteCode(uiNumbits, 32 );
-    }
-    else
-    {
-      printf("Error in codeSliceHeaderTable\n");
-      exit(-1);
-    }
-  }
-}
-#endif
 
 Void TEncCavlc::codeTerminatingBit      ( UInt uilsLast )
@@ -1481,5 +1264,5 @@
 }
 
-#if HHI_INTER_VIEW_MOTION_PRED
+#if H3D_IVMP
 Void TEncCavlc::codeMVPIdx ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefList, Int iNum )
 #else
@@ -1510,5 +1293,5 @@
 }
 
-#if HHI_INTER_VIEW_RESIDUAL_PRED
+#if H3D_IVRP
 Void
 TEncCavlc::codeResPredFlag( TComDataCU* pcCU, UInt uiAbsPartIdx )
@@ -1590,5 +1373,4 @@
 }
 
-#if BURST_IPCM
 /** Code I_PCM information. 
  * \param pcCU pointer to CU
@@ -1602,82 +1384,4 @@
   assert(0);
 }
-#else
-/** Code I_PCM information. 
- * \param pcCU pointer to CU
- * \param uiAbsPartIdx CU index
- * \returns Void
- *
- * If I_PCM flag indicates that the CU is I_PCM, code its PCM alignment bits and codes.  
- */
-Void TEncCavlc::codeIPCMInfo( TComDataCU* pcCU, UInt uiAbsPartIdx)
-{
-  UInt uiIPCM = (pcCU->getIPCMFlag(uiAbsPartIdx) == true)? 1 : 0;
-
-  xWriteFlag(uiIPCM);
-
-  if (uiIPCM)
-  {
-    xWritePCMAlignZero();
-
-    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 = piPCMSample[uiX];
-
-        xWriteCode(uiSample, uiSampleBits);
-      }
-      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 = piPCMSample[uiX];
-
-        xWriteCode(uiSample, uiSampleBits);
-      }
-      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 = piPCMSample[uiX];
-
-        xWriteCode(uiSample, uiSampleBits);
-      }
-      piPCMSample += uiWidth;
-    }
-  }
-}
-#endif
 
 Void TEncCavlc::codeIntraDirLumaAng( TComDataCU* pcCU, UInt uiAbsPartIdx )
@@ -1710,8 +1414,6 @@
   Int iDQp  = pcCU->getQP( uiAbsPartIdx ) - pcCU->getRefQP( uiAbsPartIdx );
 
-#if H0736_AVC_STYLE_QP_RANGE
   Int qpBdOffsetY =  pcCU->getSlice()->getSPS()->getQpBDOffsetY();
   iDQp = (iDQp + 78 + qpBdOffsetY + (qpBdOffsetY/2)) % (52 + qpBdOffsetY) - 26 - (qpBdOffsetY/2);
-#endif
 
   xWriteSvlc( iDQp );
@@ -1744,5 +1446,4 @@
   xWriteSvlc( iCode );
 }
-#if LCU_SYNTAX_ALF
 /** Code the fixed length code (smaller than one max value) in OSALF
  * \param idx:  coded value 
@@ -1769,5 +1470,4 @@
   }
 }
-#endif
 
 Void TEncCavlc::codeSaoFlag( UInt uiCode )
@@ -1785,5 +1485,4 @@
     xWriteSvlc( iCode );
 }
-#if SAO_UNIT_INTERLEAVING
 /** Code SAO run. 
  * \param uiCode
@@ -1809,5 +1508,4 @@
   WRITE_CODE( uiCode, uiLength, "sao_run_diff");
 }
-#endif
 
 Void TEncCavlc::estBit( estBitsSbacStruct* pcEstBitsCabac, Int width, Int height, TextType eTType )
@@ -2114,15 +1812,9 @@
 Void TEncCavlc::xCodeScalingList(TComScalingList* scalingList, UInt sizeId, UInt listId)
 {
-#if SCALING_LIST
   Int coefNum = min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId]);
   UInt* scan    = g_auiFrameScanXY [ (sizeId == 0)? 1 : 2];
-#else
-  Int coefNum = (Int)g_scalingListSize[sizeId];
-  UInt* scan    = g_auiFrameScanXY [ sizeId + 1];
-#endif
   Int nextCoef = SCALING_LIST_START_VALUE;
   Int data;
   Int *src = scalingList->getScalingListAddress(sizeId, listId);
-#if SCALING_LIST
   if(sizeId > SCALING_LIST_8x8 && scalingList->getUseDefaultScalingMatrixFlag(sizeId,listId))
   {
@@ -2155,21 +1847,4 @@
     }
   }
-#else
-  for(Int i=0;i<coefNum;i++)
-  {
-    data = src[scan[i]] - nextCoef;
-    nextCoef = src[scan[i]];
-    if(data > 127)
-    {
-      data = data - 256;
-    }
-    if(data < -128)
-    {
-      data = data + 256;
-    }
-
-    WRITE_SVLC( data,  "delta_coef");
-  }
-#endif
 }
 Bool TComScalingList::checkPredMode(UInt sizeId, UInt listId)
@@ -2177,10 +1852,6 @@
   for(Int predListIdx = (Int)listId -1 ; predListIdx >= 0; predListIdx--)
   {
-#if SCALING_LIST
     if( !memcmp(getScalingListAddress(sizeId,listId),getScalingListAddress(sizeId, predListIdx),sizeof(Int)*min(MAX_MATRIX_COEF_NUM,(Int)g_scalingListSize[sizeId])) // check value of matrix
      && ((sizeId < SCALING_LIST_16x16) || (getScalingListDC(sizeId,listId) == getScalingListDC(sizeId,predListIdx)))) // check DC value
-#else
-    if( !memcmp(getScalingListAddress(sizeId,listId),getScalingListAddress(sizeId, predListIdx),sizeof(Int)*(Int)g_scalingListSize[sizeId])) // check value of matrix
-#endif
     {
       setRefMatrixId(sizeId, listId, predListIdx);
