Ignore:
Timestamp:
13 Jul 2013, 15:51:26 (11 years ago)
Author:
tech
Message:

Update to HM 11.0.

Location:
branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/SEIwrite.cpp

    r446 r537  
    8484    fprintf( g_hTrace, "=========== Decoding Unit Information SEI message ===========\n");
    8585    break;
    86 #if J0149_TONE_MAPPING_SEI
    8786  case SEI::TONE_MAPPING_INFO:
    8887    fprintf( g_hTrace, "=========== Tone Mapping Info SEI message ===========\n");
    8988    break;
    90 #endif
    91 #if L0208_SOP_DESCRIPTION_SEI
    9289  case SEI::SOP_DESCRIPTION:
    9390    fprintf( g_hTrace, "=========== SOP Description SEI message ===========\n");
    9491    break;
    95 #endif
    96 #if K0180_SCALABLE_NESTING_SEI
    9792  case SEI::SCALABLE_NESTING:
    9893    fprintf( g_hTrace, "=========== Scalable Nesting SEI message ===========\n");
    9994    break;
    100 #endif
    10195  default:
    10296    fprintf( g_hTrace, "=========== Unknown SEI message ===========\n");
     
    106100#endif
    107101
    108 #if K0180_SCALABLE_NESTING_SEI
    109102void SEIWriter::xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComSPS *sps)
    110 #else
    111 void SEIWriter::xWriteSEIpayloadData(const SEI& sei, TComSPS *sps)
    112 #endif
    113103{
    114104  switch (sei.payloadType())
     
    147137    xWriteSEIGradualDecodingRefreshInfo(*static_cast<const SEIGradualDecodingRefreshInfo*>(&sei));
    148138    break;
    149 #if J0149_TONE_MAPPING_SEI
    150139  case SEI::TONE_MAPPING_INFO:
    151140    xWriteSEIToneMappingInfo(*static_cast<const SEIToneMappingInfo*>(&sei));
    152141    break;
    153 #endif
    154 #if L0208_SOP_DESCRIPTION_SEI
    155142  case SEI::SOP_DESCRIPTION:
    156143    xWriteSEISOPDescription(*static_cast<const SEISOPDescription*>(&sei));
    157144    break;
    158 #endif
    159 #if K0180_SCALABLE_NESTING_SEI
    160145  case SEI::SCALABLE_NESTING:
    161146    xWriteSEIScalableNesting(bs, *static_cast<const SEIScalableNesting*>(&sei), sps);
    162147    break;
    163 #endif
    164148  default:
    165149    assert(!"Unhandled SEI message");
     
    179163  setBitstream(&bs_count);
    180164
    181 
    182 #if K0180_SCALABLE_NESTING_SEI
    183165
    184166#if ENC_DEC_TRACE
     
    191173#endif
    192174
    193 #else
    194 
    195 #if ENC_DEC_TRACE
    196   g_HLSTraceEnable = false;
    197 #endif
    198   xWriteSEIpayloadData(sei, sps);
    199 #if ENC_DEC_TRACE
    200   g_HLSTraceEnable = true;
    201 #endif
    202 
    203 #endif
    204 
    205175  UInt payload_data_num_bits = bs_count.getNumberOfWrittenBits();
    206176  assert(0 == payload_data_num_bits % 8);
     
    209179
    210180#if ENC_DEC_TRACE
    211 #if K0180_SCALABLE_NESTING_SEI
    212181  if (g_HLSTraceEnable)
    213 #endif
    214182  xTraceSEIHeader();
    215183#endif
     
    231199  /* payloadData */
    232200#if ENC_DEC_TRACE
    233 #if K0180_SCALABLE_NESTING_SEI
    234201  if (g_HLSTraceEnable)
    235 #endif
    236202  xTraceSEIMessageType(sei.payloadType());
    237203#endif
    238204
    239 #if K0180_SCALABLE_NESTING_SEI
    240205  xWriteSEIpayloadData(bs, sei, sps);
    241 #else
    242   xWriteSEIpayloadData(sei, sps);
    243 #endif
    244206}
    245207
     
    296258{
    297259  WRITE_CODE(sei.activeVPSId,     4, "active_vps_id");
    298 #if L0047_APS_FLAGS
    299260  WRITE_FLAG(sei.m_fullRandomAccessFlag, "full_random_access_flag");
    300261  WRITE_FLAG(sei.m_noParamSetUpdateFlag, "no_param_set_update_flag");
    301 #endif
    302262  WRITE_UVLC(sei.numSpsIdsMinus1,    "num_sps_ids_minus1");
    303263
     
    330290    WRITE_CODE( sei.m_duSptCpbRemovalDelay, (vui->getHrdParameters()->getDuCpbRemovalDelayLengthMinus1() + 1), "du_spt_cpb_removal_delay");
    331291  }
    332 #if L0044_DU_DPB_OUTPUT_DELAY_HRD
    333292  WRITE_FLAG( sei.m_dpbOutputDuDelayPresentFlag, "dpb_output_du_delay_present_flag");
    334293  if(sei.m_dpbOutputDuDelayPresentFlag)
     
    336295    WRITE_CODE(sei.m_picSptDpbOutputDuDelay, vui->getHrdParameters()->getDpbOutputDelayDuLengthMinus1() + 1, "pic_spt_dpb_output_du_delay");
    337296  }
    338 #endif
    339297  xWriteByteAlign();
    340298}
     
    351309    WRITE_FLAG( sei.m_rapCpbParamsPresentFlag, "rap_cpb_params_present_flag" );
    352310  }
    353 #if L0328_SPLICING
    354311  WRITE_FLAG( sei.m_concatenationFlag, "concatenation_flag");
    355312  WRITE_CODE( sei.m_auCpbRemovalDelayDelta - 1, ( hrd->getCpbRemovalDelayLengthMinus1() + 1 ), "au_cpb_removal_delay_delta_minus1" );
    356 #endif
    357 #if L0044_CPB_DPB_DELAY_OFFSET
    358313  if( sei.m_rapCpbParamsPresentFlag )
    359314  {
     
    361316    WRITE_CODE( sei.m_dpbDelayOffset, hrd->getDpbOutputDelayLengthMinus1()  + 1, "dpb_delay_offset" );
    362317  }
    363 #endif
    364318  for( nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ )
    365319  {
     
    387341  TComHRD *hrd = vui->getHrdParameters();
    388342
    389 #if !L0045_CONDITION_SIGNALLING
    390   // This condition was probably OK before the pic_struct, progressive_source_idc, duplicate_flag were added
    391   if( !hrd->getNalHrdParametersPresentFlag() && !hrd->getVclHrdParametersPresentFlag() )
    392     return;
    393 #endif
    394343  if( vui->getFrameFieldInfoPresentFlag() )
    395344  {
    396345    WRITE_CODE( sei.m_picStruct, 4,              "pic_struct" );
    397 #if L0046_RENAME_PROG_SRC_IDC
    398346    WRITE_CODE( sei.m_sourceScanType, 2,         "source_scan_type" );
    399 #else
    400     WRITE_CODE( sei.m_progressiveSourceIdc, 2,   "progressive_source_idc" );
    401 #endif
    402347    WRITE_FLAG( sei.m_duplicateFlag ? 1 : 0,     "duplicate_flag" );
    403348  }
    404349
    405 #if L0045_CONDITION_SIGNALLING
    406350  if( hrd->getCpbDpbDelaysPresentFlag() )
    407351  {
    408 #endif
    409352    WRITE_CODE( sei.m_auCpbRemovalDelay - 1, ( hrd->getCpbRemovalDelayLengthMinus1() + 1 ),                                         "au_cpb_removal_delay_minus1" );
    410353    WRITE_CODE( sei.m_picDpbOutputDelay, ( hrd->getDpbOutputDelayLengthMinus1() + 1 ),                                          "pic_dpb_output_delay" );
    411 #if L0044_DU_DPB_OUTPUT_DELAY_HRD
    412354    if(hrd->getSubPicCpbParamsPresentFlag())
    413355    {
    414356      WRITE_CODE(sei.m_picDpbOutputDuDelay, hrd->getDpbOutputDelayDuLengthMinus1()+1, "pic_dpb_output_du_delay" );
    415357    }
    416 #endif
    417358    if( hrd->getSubPicCpbParamsPresentFlag() && hrd->getSubPicCpbParamsInPicTimingSEIFlag() )
    418359    {
     
    432373      }
    433374    }
    434 #if L0045_CONDITION_SIGNALLING
    435   }
    436 #endif
     375  }
    437376  xWriteByteAlign();
    438377}
     
    471410
    472411    WRITE_CODE( sei.m_arrangementReservedByte, 8,   "frame_packing_arrangement_reserved_byte" );
    473 #if L0045_PERSISTENCE_FLAGS
    474412    WRITE_FLAG( sei.m_arrangementPersistenceFlag,   "frame_packing_arrangement_persistence_flag" );
    475 #else
    476     WRITE_UVLC( sei.m_arrangementRepetetionPeriod,  "frame_packing_arrangement_repetition_period" );
    477 #endif
    478413  }
    479414
     
    483418}
    484419
    485 #if J0149_TONE_MAPPING_SEI
    486420Void SEIWriter::xWriteSEIToneMappingInfo(const SEIToneMappingInfo& sei)
    487421{
     
    555489  xWriteByteAlign();
    556490}
    557 #endif
    558491
    559492Void SEIWriter::xWriteSEIDisplayOrientation(const SEIDisplayOrientation &sei)
     
    565498    WRITE_FLAG( sei.verFlip,                   "ver_flip" );
    566499    WRITE_CODE( sei.anticlockwiseRotation, 16, "anticlockwise_rotation" );
    567 #if L0045_PERSISTENCE_FLAGS
    568500    WRITE_FLAG( sei.persistenceFlag,          "display_orientation_persistence_flag" );
    569 #else
    570     WRITE_UVLC( sei.repetitionPeriod,          "display_orientation_repetition_period" );
    571 #endif
    572 #if !REMOVE_SINGLE_SEI_EXTENSION_FLAGS
    573     WRITE_FLAG( sei.extensionFlag,             "display_orientation_extension_flag" );
    574     assert( !sei.extensionFlag );
    575 #endif
    576501  }
    577502  xWriteByteAlign();
     
    591516}
    592517
    593 #if L0208_SOP_DESCRIPTION_SEI
    594518Void SEIWriter::xWriteSEISOPDescription(const SEISOPDescription& sei)
    595519{
     
    612536  xWriteByteAlign();
    613537}
    614 #endif
    615 
    616 #if K0180_SCALABLE_NESTING_SEI
     538
    617539Void SEIWriter::xWriteSEIScalableNesting(TComBitIf& bs, const SEIScalableNesting& sei, TComSPS *sps)
    618540{
     
    656578  }
    657579}
    658 #endif
    659580
    660581Void SEIWriter::xWriteByteAlign()
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/SEIwrite.h

    r446 r537  
    5050
    5151protected:
    52 #if K0180_SCALABLE_NESTING_SEI
    5352  Void xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComSPS *sps);
    54 #else
    55   Void xWriteSEIpayloadData(const SEI& sei, TComSPS *sps);
    56 #endif
    5753  Void xWriteSEIuserDataUnregistered(const SEIuserDataUnregistered &sei);
    5854  Void xWriteSEIActiveParameterSets(const SEIActiveParameterSets& sei);
     
    6763  Void xWriteSEITemporalLevel0Index(const SEITemporalLevel0Index &sei);
    6864  Void xWriteSEIGradualDecodingRefreshInfo(const SEIGradualDecodingRefreshInfo &sei);
    69 #if J0149_TONE_MAPPING_SEI
    7065  Void xWriteSEIToneMappingInfo(const SEIToneMappingInfo& sei);
    71 #endif
    72 #if L0208_SOP_DESCRIPTION_SEI
    7366  Void xWriteSEISOPDescription(const SEISOPDescription& sei);
    74 #endif
    75 #if K0180_SCALABLE_NESTING_SEI
    7667  Void xWriteSEIScalableNesting(TComBitIf& bs, const SEIScalableNesting& sei, TComSPS *sps);
    77 #endif
    7868  Void xWriteByteAlign();
    7969};
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncCavlc.cpp

    r534 r537  
    172172  WRITE_UVLC( pcPPS->getSPSId(),                             "pps_seq_parameter_set_id" );
    173173  WRITE_FLAG( pcPPS->getDependentSliceSegmentsEnabledFlag()    ? 1 : 0, "dependent_slice_segments_enabled_flag" );
    174 #if L0255_MOVE_PPS_FLAGS
    175174  WRITE_FLAG( pcPPS->getOutputFlagPresentFlag() ? 1 : 0,     "output_flag_present_flag" );
    176175  WRITE_CODE( pcPPS->getNumExtraSliceHeaderBits(), 3,        "num_extra_slice_header_bits");
    177 #endif
    178176  WRITE_FLAG( pcPPS->getSignHideFlag(), "sign_data_hiding_flag" );
    179177  WRITE_FLAG( pcPPS->getCabacInitPresentFlag() ? 1 : 0,   "cabac_init_present_flag" );
     
    195193  WRITE_FLAG( pcPPS->getUseWP() ? 1 : 0,  "weighted_pred_flag" );   // Use of Weighting Prediction (P_SLICE)
    196194  WRITE_FLAG( pcPPS->getWPBiPred() ? 1 : 0, "weighted_bipred_flag" );  // Use of Weighting Bi-Prediction (B_SLICE)
    197 #if !L0255_MOVE_PPS_FLAGS
    198   WRITE_FLAG( pcPPS->getOutputFlagPresentFlag() ? 1 : 0,  "output_flag_present_flag" );
    199 #endif
    200195  WRITE_FLAG( pcPPS->getTransquantBypassEnableFlag() ? 1 : 0, "transquant_bypass_enable_flag" );
    201196  WRITE_FLAG( pcPPS->getTilesEnabledFlag()             ? 1 : 0, "tiles_enabled_flag" );
     
    244239  WRITE_FLAG( pcPPS->getListsModificationPresentFlag(), "lists_modification_present_flag");
    245240  WRITE_UVLC( pcPPS->getLog2ParallelMergeLevelMinus2(), "log2_parallel_merge_level_minus2");
    246 #if !L0255_MOVE_PPS_FLAGS
    247   WRITE_CODE( pcPPS->getNumExtraSliceHeaderBits(), 3, "num_extra_slice_header_bits");
    248 #endif
    249241  WRITE_FLAG( pcPPS->getSliceHeaderExtensionPresentFlag() ? 1 : 0, "slice_segment_header_extension_present_flag");
    250242  WRITE_FLAG( 0, "pps_extension_flag" );
     
    305297    WRITE_UVLC(defaultDisplayWindow.getWindowBottomOffset(),    "def_disp_win_bottom_offset");
    306298  }
    307 #if L0043_TIMING_INFO
    308299  TimingInfo *timingInfo = pcVUI->getTimingInfo();
    309300  WRITE_FLAG(timingInfo->getTimingInfoPresentFlag(),          "vui_timing_info_present_flag");
     
    317308      WRITE_UVLC(timingInfo->getNumTicksPocDiffOneMinus1(),   "vui_num_ticks_poc_diff_one_minus1");
    318309    }
    319 #endif
    320310  WRITE_FLAG(pcVUI->getHrdParametersPresentFlag(),              "hrd_parameters_present_flag");
    321311  if( pcVUI->getHrdParametersPresentFlag() )
     
    323313    codeHrdParameters(pcVUI->getHrdParameters(), 1, pcSPS->getMaxTLayers() - 1 );
    324314  }
    325 #if L0043_TIMING_INFO
    326   }
    327 #endif
    328 #if !L0043_TIMING_INFO
    329   WRITE_FLAG( pcVUI->getPocProportionalToTimingFlag(), "poc_proportional_to_timing_flag" );
    330   if( pcVUI->getPocProportionalToTimingFlag() && pcVUI->getHrdParameters()->getTimingInfoPresentFlag() )
    331   {
    332     WRITE_UVLC( pcVUI->getNumTicksPocDiffOneMinus1(), "num_ticks_poc_diff_one_minus1" );
    333   }
    334 #endif
     315  }
    335316
    336317  WRITE_FLAG(pcVUI->getBitstreamRestrictionFlag(),              "bitstream_restriction_flag");
     
    346327    WRITE_FLAG(pcVUI->getMotionVectorsOverPicBoundariesFlag(),  "motion_vectors_over_pic_boundaries_flag");
    347328    WRITE_FLAG(pcVUI->getRestrictedRefPicListsFlag(),           "restricted_ref_pic_lists_flag");
    348 #if L0043_MSS_IDC
    349329    WRITE_UVLC(pcVUI->getMinSpatialSegmentationIdc(),           "min_spatial_segmentation_idc");
    350 #else
    351     WRITE_CODE(pcVUI->getMinSpatialSegmentationIdc(),        8, "min_spatial_segmentation_idc");
    352 #endif
    353330    WRITE_UVLC(pcVUI->getMaxBytesPerPicDenom(),                 "max_bytes_per_pic_denom");
    354331    WRITE_UVLC(pcVUI->getMaxBitsPerMinCuDenom(),                "max_bits_per_mincu_denom");
     
    362339  if( commonInfPresentFlag )
    363340  {
    364 #if !L0043_TIMING_INFO
    365     WRITE_FLAG( hrd->getTimingInfoPresentFlag() ? 1 : 0,        "timing_info_present_flag" );
    366     if( hrd->getTimingInfoPresentFlag() )
    367     {
    368       WRITE_CODE( hrd->getNumUnitsInTick(), 32,                  "num_units_in_tick" );
    369       WRITE_CODE( hrd->getTimeScale(),      32,                  "time_scale" );
    370     }
    371 #endif
    372341    WRITE_FLAG( hrd->getNalHrdParametersPresentFlag() ? 1 : 0 ,  "nal_hrd_parameters_present_flag" );
    373342    WRITE_FLAG( hrd->getVclHrdParametersPresentFlag() ? 1 : 0 ,  "vcl_hrd_parameters_present_flag" );
     
    380349        WRITE_CODE( hrd->getDuCpbRemovalDelayLengthMinus1(), 5,  "du_cpb_removal_delay_length_minus1" );
    381350        WRITE_FLAG( hrd->getSubPicCpbParamsInPicTimingSEIFlag() ? 1 : 0, "sub_pic_cpb_params_in_pic_timing_sei_flag" );
    382 #if L0044_DU_DPB_OUTPUT_DELAY_HRD
    383351        WRITE_CODE( hrd->getDpbOutputDelayDuLengthMinus1(), 5,   "dpb_output_delay_du_length_minus1"  );
    384 #endif
    385352      }
    386353      WRITE_CODE( hrd->getBitRateScale(), 4,                     "bit_rate_scale" );
     
    411378      WRITE_UVLC( hrd->getPicDurationInTcMinus1( i ),           "elemental_duration_in_tc_minus1");
    412379    }
    413 #if L0372
    414380    else
    415381    {
     
    420386      WRITE_UVLC( hrd->getCpbCntMinus1( i ),                      "cpb_cnt_minus1");
    421387    }
    422 #else
    423     WRITE_FLAG( hrd->getLowDelayHrdFlag( i ) ? 1 : 0,           "low_delay_hrd_flag");
    424     WRITE_UVLC( hrd->getCpbCntMinus1( i ),                      "cpb_cnt_minus1");
    425 #endif
    426388   
    427389    for( nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ )
     
    436398          if( hrd->getSubPicCpbParamsPresentFlag() )
    437399          {
    438 #if L0363_DU_BIT_RATE
     400            WRITE_UVLC( hrd->getDuCpbSizeValueMinus1( i, j, nalOrVcl ), "cpb_size_du_value_minus1"); 
    439401            WRITE_UVLC( hrd->getDuBitRateValueMinus1( i, j, nalOrVcl ), "bit_rate_du_value_minus1");
    440 #endif
    441             WRITE_UVLC( hrd->getDuCpbSizeValueMinus1( i, j, nalOrVcl ), "cpb_size_du_value_minus1"); 
    442402          }
    443403          WRITE_FLAG( hrd->getCbrFlag( i, j, nalOrVcl ) ? 1 : 0, "cbr_flag");
     
    499459  for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++)
    500460  {
    501 #if L0323_DPB
    502461    WRITE_UVLC( pcSPS->getMaxDecPicBuffering(i) - 1,       "sps_max_dec_pic_buffering_minus1[i]" );
    503 #else
    504     WRITE_UVLC( pcSPS->getMaxDecPicBuffering(i),           "sps_max_dec_pic_buffering[i]" );
    505 #endif
    506462    WRITE_UVLC( pcSPS->getNumReorderPics(i),               "sps_num_reorder_pics[i]" );
    507     WRITE_UVLC( pcSPS->getMaxLatencyIncrease(i),           "sps_max_latency_increase[i]" );
     463    WRITE_UVLC( pcSPS->getMaxLatencyIncrease(i),           "sps_max_latency_increase_plus1[i]" );
    508464    if (!subLayerOrderingInfoPresentFlag)
    509465    {
     
    642598#endif
    643599  codePTL( pcVPS->getPTL(), true, pcVPS->getMaxTLayers() - 1 );
    644 #if SIGNAL_BITRATE_PICRATE_IN_VPS
    645   codeBitratePicRateInfo(pcVPS->getBitratePicrateInfo(), 0, pcVPS->getMaxTLayers() - 1);
    646 #endif 
    647600  const Bool subLayerOrderingInfoPresentFlag = 1;
    648601  WRITE_FLAG(subLayerOrderingInfoPresentFlag,              "vps_sub_layer_ordering_info_present_flag");
    649602  for(UInt i=0; i <= pcVPS->getMaxTLayers()-1; i++)
    650603  {
    651 #if L0323_DPB
    652604    WRITE_UVLC( pcVPS->getMaxDecPicBuffering(i) - 1,       "vps_max_dec_pic_buffering_minus1[i]" );
    653 #else
    654     WRITE_UVLC( pcVPS->getMaxDecPicBuffering(i),           "vps_max_dec_pic_buffering[i]" );
    655 #endif
    656605    WRITE_UVLC( pcVPS->getNumReorderPics(i),               "vps_num_reorder_pics[i]" );
    657     WRITE_UVLC( pcVPS->getMaxLatencyIncrease(i),           "vps_max_latency_increase[i]" );
     606    WRITE_UVLC( pcVPS->getMaxLatencyIncrease(i),           "vps_max_latency_increase_plus1[i]" );
    658607    if (!subLayerOrderingInfoPresentFlag)
    659608    {
     
    676625  assert( pcVPS->getMaxNuhReservedZeroLayerId() < MAX_VPS_NUH_RESERVED_ZERO_LAYER_ID_PLUS1 );
    677626  WRITE_CODE( pcVPS->getMaxNuhReservedZeroLayerId(), 6,     "vps_max_nuh_reserved_zero_layer_id" );
    678 
    679627  pcVPS->setMaxOpSets(1);
    680628  WRITE_UVLC( pcVPS->getMaxOpSets() - 1,                    "vps_max_op_sets_minus1" );
     
    690638    }
    691639  }
    692 #if L0043_TIMING_INFO
    693640  TimingInfo *timingInfo = pcVPS->getTimingInfo();
    694641  WRITE_FLAG(timingInfo->getTimingInfoPresentFlag(),          "vps_timing_info_present_flag");
     
    702649      WRITE_UVLC(timingInfo->getNumTicksPocDiffOneMinus1(),   "vps_num_ticks_poc_diff_one_minus1");
    703650    }
    704 #endif
    705651    pcVPS->setNumHrdParameters( 0 );
    706652    WRITE_UVLC( pcVPS->getNumHrdParameters(),                 "vps_num_hrd_parameters" );
     
    721667      codeHrdParameters(pcVPS->getHrdParameters(i), pcVPS->getCprmsPresentFlag( i ), pcVPS->getMaxTLayers() - 1);
    722668    }
    723 #if L0043_TIMING_INFO
    724   }
    725 #endif
     669  }
    726670#if H_MV
    727671  WRITE_FLAG( 1,                                             "vps_extension_flag" );
     
    983927    //   colour_plane_id                                      u(2)
    984928
    985 #if H_MV && !H_MV_FIX1071
    986     // Temporary fix for FIX1071 should be removed later
    987     TComReferencePictureSet* rps = pcSlice->getRPS();
    988 #endif     
    989929    if( !pcSlice->getIdrPicFlag() )
    990930    {
    991931      Int picOrderCntLSB = (pcSlice->getPOC()-pcSlice->getLastIDR()+(1<<pcSlice->getSPS()->getBitsForPOC()))%(1<<pcSlice->getSPS()->getBitsForPOC());
    992932      WRITE_CODE( picOrderCntLSB, pcSlice->getSPS()->getBitsForPOC(), "pic_order_cnt_lsb");
    993 #if !H_MV || H_MV_FIX1071
    994933      TComReferencePictureSet* rps = pcSlice->getRPS();
    995 #endif     
    996 #if FIX1071 && H_MV_FIX1071
     934     
     935#if FIX1071
    997936      // check for bitstream restriction stating that:
    998937      // If the current picture is a BLA or CRA picture, the value of NumPocTotalCurr shall be equal to 0.
     
    1006945        }
    1007946#endif
    1008 #if FIX1071 && !H_MV_FIX1071
    1009       // Deal with bitstream restriction stating that:
    1010       // – If the current picture is a BLA or CRA picture, the value of NumPocTotalCurr shall be equal to 0.
    1011       // Ideally this process should not be repeated for each slice in a picture
    1012       TComReferencePictureSet altRps;
    1013       Bool useAltRps = false;
    1014       if (pcSlice->getRapPicFlag())
    1015       {
    1016         for (Int picIdx = 0; !useAltRps && picIdx < rps->getNumberOfPictures(); picIdx++)
    1017         {
    1018           useAltRps = rps->getUsed(picIdx);
    1019         }
    1020         if (useAltRps)
    1021         {
    1022           memcpy(&altRps, rps, sizeof(TComReferencePictureSet));
    1023           rps = &altRps;
    1024           for (Int picIdx = 0; picIdx < rps->getNumberOfPictures(); picIdx++)
    1025           {
    1026             rps->setUsed(picIdx, false);
    1027           }
    1028         }
    1029       }
    1030       if(pcSlice->getRPSidx() < 0 || useAltRps)
    1031 #else
     947
    1032948      if(pcSlice->getRPSidx() < 0)
    1033 #endif
    1034949      {
    1035950        WRITE_FLAG( 0, "short_term_ref_pic_set_sps_flag");
     
    11881103      pcSlice->setNumRefIdx(REF_PIC_LIST_1, 0);
    11891104    }
    1190 #if H_MV && !H_MV_FIX1071
    1191     // Temporary fix for FIX1071 should be removed later
    1192     if( pcSlice->getPPS()->getListsModificationPresentFlag() && pcSlice->getNumRpsCurrTempList( rps ) > 1)
    1193 #else
     1105
    11941106    if( pcSlice->getPPS()->getListsModificationPresentFlag() && pcSlice->getNumRpsCurrTempList() > 1)
    1195 #endif
    11961107    {
    11971108      TComRefPicListModification* refPicListModification = pcSlice->getRefPicListModification();
     
    13851296  WRITE_CODE( pcPTL->getGeneralPTL()->getLevelIdc(), 8, "general_level_idc" );
    13861297
    1387 #if L0363_BYTE_ALIGN
    13881298  for (Int i = 0; i < maxNumSubLayersMinus1; i++)
    13891299  {
     
    14071317    }
    14081318  }
    1409 #endif
    14101319 
    14111320  for(Int i = 0; i < maxNumSubLayersMinus1; i++)
    14121321  {
    1413 #if !L0363_BYTE_ALIGN
    1414     if(profilePresentFlag)
    1415     {
    1416       WRITE_FLAG( pcPTL->getSubLayerProfilePresentFlag(i), "sub_layer_profile_present_flag[i]" );
    1417     }
    1418 
    1419     WRITE_FLAG( pcPTL->getSubLayerLevelPresentFlag(i),   "sub_layer_level_present_flag[i]" );
    1420 #endif
    14211322    if( profilePresentFlag && pcPTL->getSubLayerProfilePresentFlag(i) )
    14221323    {
     
    14391340  }
    14401341
    1441 #if L0046_CONSTRAINT_FLAGS
    14421342  WRITE_FLAG(ptl->getProgressiveSourceFlag(),   "general_progressive_source_flag");
    14431343  WRITE_FLAG(ptl->getInterlacedSourceFlag(),    "general_interlaced_source_flag");
     
    14481348  WRITE_CODE(0 , 16, "XXX_reserved_zero_44bits[16..31]");
    14491349  WRITE_CODE(0 , 12, "XXX_reserved_zero_44bits[32..43]");
    1450 #elif L0363_MORE_BITS
    1451   WRITE_CODE(0 , 16, "XXX_reserved_zero_48bits[0..15]");
    1452   WRITE_CODE(0 , 16, "XXX_reserved_zero_48bits[16..31]");
    1453   WRITE_CODE(0 , 16, "XXX_reserved_zero_48bits[32..47]");
    1454 #else
    1455   WRITE_CODE(0 , 16, "XXX_reserved_zero_16bits[]");
    1456 #endif
    1457 }
    1458 #if SIGNAL_BITRATE_PICRATE_IN_VPS
    1459 Void TEncCavlc::codeBitratePicRateInfo(TComBitRatePicRateInfo *info, Int tempLevelLow, Int tempLevelHigh)
    1460 {
    1461   for(Int i = tempLevelLow; i <= tempLevelHigh; i++)
    1462   {
    1463     WRITE_FLAG( info->getBitRateInfoPresentFlag(i),  "bit_rate_info_present_flag[i]" );
    1464     WRITE_FLAG( info->getPicRateInfoPresentFlag(i),  "pic_rate_info_present_flag[i]" );
    1465     if(info->getBitRateInfoPresentFlag(i))
    1466     {
    1467       WRITE_CODE( info->getAvgBitRate(i), 16, "avg_bit_rate[i]" );
    1468       WRITE_CODE( info->getMaxBitRate(i), 16, "max_bit_rate[i]" );
    1469     }
    1470     if(info->getPicRateInfoPresentFlag(i))
    1471     {
    1472       WRITE_CODE( info->getConstantPicRateIdc(i),  2, "constant_pic_rate_idc[i]" );
    1473       WRITE_CODE( info->getAvgPicRate(i),         16, "avg_pic_rate[i]"          );
    1474     }
    1475   }
    1476 }
    1477 #endif 
     1350    }
     1351
    14781352/**
    14791353 - write wavefront substreams sizes for the slice header.
     
    15451419  for (UInt idx=0; idx<numEntryPointOffsets; idx++)
    15461420  {
    1547 #if L0116_ENTRY_POINT
    15481421    WRITE_CODE(entryPointOffset[ idx ]-1, offsetLenMinus1+1, "entry_point_offset_minus1");
    1549 #else
    1550     WRITE_CODE(entryPointOffset[ idx ], offsetLenMinus1+1, "entry_point_offset");
    1551 #endif
    15521422  }
    15531423
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncCavlc.h

    r504 r537  
    9494  Void  codePTL                 ( TComPTL* pcPTL, Bool profilePresentFlag, Int maxNumSubLayersMinus1);
    9595  Void  codeProfileTier         ( ProfileTierLevel* ptl );
    96 #if SIGNAL_BITRATE_PICRATE_IN_VPS
    97   Void codeBitratePicRateInfo(TComBitRatePicRateInfo *info, Int tempLevelLow, Int tempLevelHigh);
    98 #endif
    9996  Void  codeHrdParameters       ( TComHRD *hrd, Bool commonInfPresentFlag, UInt maxNumSubLayersMinus1 );
    10097  Void  codeTilesWPPEntryPoint( TComSlice* pSlice );
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncCfg.h

    r534 r537  
    135135  Level::Tier   m_levelTier;
    136136  Level::Name   m_level;
    137 #if L0046_CONSTRAINT_FLAGS
    138137  Bool m_progressiveSourceFlag;
    139138  Bool m_interlacedSourceFlag;
    140139  Bool m_nonPackedConstraintFlag;
    141140  Bool m_frameOnlyConstraintFlag;
    142 #endif
    143141
    144142  //====== Coding Structure ========
     
    177175  Int       m_loopFilterTcOffsetDiv2;
    178176  Bool      m_DeblockingFilterControlPresent;
    179 #if L0386_DB_METRIC
    180177  Bool      m_DeblockingFilterMetric;
    181 #endif
    182178  Bool      m_bUseSAO;
    183179  Int       m_maxNumOffsetsPerPic;
     
    210206  Bool      m_bUseASR;
    211207  Bool      m_bUseHADME;
    212 #if !L0034_COMBINED_LIST_CLEANUP
    213   Bool      m_bUseLComb;
    214 #endif
    215208  Bool      m_useRDOQ;
    216209  Bool      m_useRDOQTS;
    217 #if L0232_RD_PENALTY
    218210  UInt      m_rdPenalty;
    219 #endif
    220211  Bool      m_bUseFastEnc;
    221212  Bool      m_bUseEarlyCU;
     
    258249  Int       m_pictureTimingSEIEnabled;
    259250  Int       m_recoveryPointSEIEnabled;
    260 #if J0149_TONE_MAPPING_SEI
    261251  Bool      m_toneMappingInfoSEIEnabled;
    262252  Int       m_toneMapId;
     
    284274  Int*      m_codedPivotValue;
    285275  Int*      m_targetPivotValue;
    286 #endif
    287276  Int       m_framePackingSEIEnabled;
    288277  Int       m_framePackingSEIType;
     
    294283  Int       m_gradualDecodingRefreshInfoEnabled;
    295284  Int       m_decodingUnitInfoSEIEnabled;
    296 #if L0208_SOP_DESCRIPTION_SEI
    297285  Int       m_SOPDescriptionSEIEnabled;
    298 #endif
    299 #if K0180_SCALABLE_NESTING_SEI
    300286  Int       m_scalableNestingSEIEnabled;
    301 #endif
    302287  //====== Weighted Prediction ========
    303288  Bool      m_useWeightedPred;       //< Use of Weighting Prediction (P_SLICE)
     
    312297  Bool      m_RCEnableRateControl;
    313298  Int       m_RCTargetBitrate;
     299#if M0036_RC_IMPROVEMENT
     300  Int       m_RCKeepHierarchicalBit;
     301#else
    314302  Bool      m_RCKeepHierarchicalBit;
     303#endif
    315304  Bool      m_RCLCULevelRC;
    316305  Bool      m_RCUseLCUSeparateModel;
     
    389378  Double    m_dLambdaScaleVSO;
    390379  UInt      m_uiVSOMode;
    391  
    392380  // LGE_WVSO_A0119
    393381  Bool      m_bUseWVSO;
     
    395383  Int       m_iVSDWeight;
    396384  Int       m_iDWeight;
    397 #endif
    398 
    399385  // SAIT_VSO_EST_A0033
    400386  Bool      m_bUseEstimatedVSD;
    401387  Double    m_dDispCoeff;
    402 
     388#endif
    403389#if H_3D_ARP
    404390  UInt      m_uiUseAdvResPred;
    405391  UInt      m_uiARPStepNum;
    406392#endif
    407 
    408393#if H_3D_IC
    409394  Bool      m_bUseIC;
    410395#endif
    411 
    412396  //====== Depth Intra Modes ======
    413397#if H_3D_DIM
     
    417401  Bool      m_useDLT;
    418402#endif
    419 
    420 #endif
    421 
     403#endif
    422404public:
    423405  TEncCfg()
     
    519501  Void      setLoopFilterTcOffset           ( Int   i )      { m_loopFilterTcOffsetDiv2    = i; }
    520502  Void      setDeblockingFilterControlPresent ( Bool b ) { m_DeblockingFilterControlPresent = b; }
    521 #if L0386_DB_METRIC
    522503  Void      setDeblockingFilterMetric       ( Bool  b )      { m_DeblockingFilterMetric = b; }
    523 #endif
    524504
    525505  //====== Motion search ========
     
    576556  Int       getLoopFilterTcOffset           ()      { return m_loopFilterTcOffsetDiv2; }
    577557  Bool      getDeblockingFilterControlPresent()  { return  m_DeblockingFilterControlPresent; }
    578 #if L0386_DB_METRIC
    579558  Bool      getDeblockingFilterMetric       ()      { return m_DeblockingFilterMetric; }
    580 #endif
    581559
    582560  //==== Motion search ========
     
    596574  Void      setUseASR                       ( Bool  b )     { m_bUseASR     = b; }
    597575  Void      setUseHADME                     ( Bool  b )     { m_bUseHADME   = b; }
    598 #if !L0034_COMBINED_LIST_CLEANUP
    599   Void      setUseLComb                     ( Bool  b )     { m_bUseLComb   = b; }
    600 #endif
    601576  Void      setUseRDOQ                      ( Bool  b )     { m_useRDOQ    = b; }
    602577  Void      setUseRDOQTS                    ( Bool  b )     { m_useRDOQTS  = b; }
    603 #if L0232_RD_PENALTY
    604578  Void      setRDpenalty                 ( UInt  b )     { m_rdPenalty  = b; }
    605 #endif
    606579  Void      setUseFastEnc                   ( Bool  b )     { m_bUseFastEnc = b; }
    607580  Void      setUseEarlyCU                   ( Bool  b )     { m_bUseEarlyCU = b; }
     
    620593  Bool      getUseASR                       ()      { return m_bUseASR;     }
    621594  Bool      getUseHADME                     ()      { return m_bUseHADME;   }
    622 #if !L0034_COMBINED_LIST_CLEANUP
    623   Bool      getUseLComb                     ()      { return m_bUseLComb;   }
    624 #endif
    625595  Bool      getUseRDOQ                      ()      { return m_useRDOQ;    }
    626596  Bool      getUseRDOQTS                    ()      { return m_useRDOQTS;  }
    627 #if L0232_RD_PENALTY
    628597  Int      getRDpenalty                  ()      { return m_rdPenalty;  }
    629 #endif
    630598  Bool      getUseFastEnc                   ()      { return m_bUseFastEnc; }
    631599  Bool      getUseEarlyCU                   ()      { return m_bUseEarlyCU; }
     
    719687  Void  setRecoveryPointSEIEnabled(Int b)                { m_recoveryPointSEIEnabled = b; }
    720688  Int   getRecoveryPointSEIEnabled()                     { return m_recoveryPointSEIEnabled; }
    721 #if J0149_TONE_MAPPING_SEI
    722689  Void  setToneMappingInfoSEIEnabled(Bool b)                 {  m_toneMappingInfoSEIEnabled = b;  }
    723690  Bool  getToneMappingInfoSEIEnabled()                       {  return m_toneMappingInfoSEIEnabled;  }
     
    770737  Void  setTMISEIExtendedWhiteLevelLumaCodeValue(Int b)      {  m_extendedWhiteLevelLumaCodeValue =b;  }
    771738  Int   getTMISEIExtendedWhiteLevelLumaCodeValue()           {  return m_extendedWhiteLevelLumaCodeValue;  }
    772 #endif
    773739  Void  setFramePackingArrangementSEIEnabled(Int b)      { m_framePackingSEIEnabled = b; }
    774740  Int   getFramePackingArrangementSEIEnabled()           { return m_framePackingSEIEnabled; }
     
    789755  Void  setDecodingUnitInfoSEIEnabled(Int b)                { m_decodingUnitInfoSEIEnabled = b;    }
    790756  Int   getDecodingUnitInfoSEIEnabled()                     { return m_decodingUnitInfoSEIEnabled; }
    791 #if L0208_SOP_DESCRIPTION_SEI
    792757  Void  setSOPDescriptionSEIEnabled(Int b)                { m_SOPDescriptionSEIEnabled = b; }
    793758  Int   getSOPDescriptionSEIEnabled()                     { return m_SOPDescriptionSEIEnabled; }
    794 #endif
    795 #if K0180_SCALABLE_NESTING_SEI
    796759  Void  setScalableNestingSEIEnabled(Int b)                { m_scalableNestingSEIEnabled = b; }
    797760  Int   getScalableNestingSEIEnabled()                     { return m_scalableNestingSEIEnabled; }
    798 #endif
    799761  Void      setUseWP               ( Bool b )    { m_useWeightedPred   = b;    }
    800762  Void      setWPBiPred            ( Bool b )    { m_useWeightedBiPred = b;    }
     
    818780  Int       getTargetBitrate       ()              { return m_RCTargetBitrate;       }
    819781  Void      setTargetBitrate       ( Int bitrate ) { m_RCTargetBitrate  = bitrate;   }
     782#if M0036_RC_IMPROVEMENT
     783  Int       getKeepHierBit         ()              { return m_RCKeepHierarchicalBit; }
     784  Void      setKeepHierBit         ( Int i )       { m_RCKeepHierarchicalBit = i;    }
     785#else
    820786  Bool      getKeepHierBit         ()              { return m_RCKeepHierarchicalBit; }
    821787  Void      setKeepHierBit         ( Bool b )      { m_RCKeepHierarchicalBit = b;    }
     788#endif
    822789  Bool      getLCULevelRC          ()              { return m_RCLCULevelRC; }
    823790  Void      setLCULevelRC          ( Bool b )      { m_RCLCULevelRC = b; }
     
    916883  Void      setLog2MaxMvLengthVertical(Int i)             { m_log2MaxMvLengthVertical = i; }
    917884 
    918 #if L0046_CONSTRAINT_FLAGS
    919885  Bool getProgressiveSourceFlag() const { return m_progressiveSourceFlag; }
    920886  Void setProgressiveSourceFlag(Bool b) { m_progressiveSourceFlag = b; }
     
    928894  Bool getFrameOnlyConstraintFlag() const { return m_frameOnlyConstraintFlag; }
    929895  Void setFrameOnlyConstraintFlag(Bool b) { m_frameOnlyConstraintFlag = b; }
    930 #endif
    931896#if H_3D
    932897  /// 3D Tools
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncCu.cpp

    r531 r537  
    103103 
    104104  m_bEncodeDQP = false;
    105 #if RATE_CONTROL_LAMBDA_DOMAIN
     105#if RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT
    106106  m_LCUPredictionSAD = 0;
    107107  m_addSADDepth      = 0;
     
    256256  m_ppcTempCU[0]->initCU( rpcCU->getPic(), rpcCU->getAddr() );
    257257
    258 #if RATE_CONTROL_LAMBDA_DOMAIN
     258#if RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT
    259259  m_addSADDepth      = 0;
    260260  m_LCUPredictionSAD = 0;
     
    592592    }
    593593
    594 #if RATE_CONTROL_LAMBDA_DOMAIN
     594#if RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT
    595595    if ( uiDepth <= m_addSADDepth )
    596596    {
     
    862862  {
    863863    bBoundary = true;
    864 #if RATE_CONTROL_LAMBDA_DOMAIN
     864#if RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT
    865865    m_addSADDepth++;
    866866#endif
     
    13481348}
    13491349
     1350#if RATE_CONTROL_INTRA
     1351Int xCalcHADs8x8_ISlice(Pel *piOrg, Int iStrideOrg)
     1352{
     1353  Int k, i, j, jj;
     1354  Int diff[64], m1[8][8], m2[8][8], m3[8][8], iSumHad = 0;
     1355
     1356  for( k = 0; k < 64; k += 8 )
     1357  {
     1358    diff[k+0] = piOrg[0] ;
     1359    diff[k+1] = piOrg[1] ;
     1360    diff[k+2] = piOrg[2] ;
     1361    diff[k+3] = piOrg[3] ;
     1362    diff[k+4] = piOrg[4] ;
     1363    diff[k+5] = piOrg[5] ;
     1364    diff[k+6] = piOrg[6] ;
     1365    diff[k+7] = piOrg[7] ;
     1366 
     1367    piOrg += iStrideOrg;
     1368  }
     1369 
     1370  //horizontal
     1371  for (j=0; j < 8; j++)
     1372  {
     1373    jj = j << 3;
     1374    m2[j][0] = diff[jj  ] + diff[jj+4];
     1375    m2[j][1] = diff[jj+1] + diff[jj+5];
     1376    m2[j][2] = diff[jj+2] + diff[jj+6];
     1377    m2[j][3] = diff[jj+3] + diff[jj+7];
     1378    m2[j][4] = diff[jj  ] - diff[jj+4];
     1379    m2[j][5] = diff[jj+1] - diff[jj+5];
     1380    m2[j][6] = diff[jj+2] - diff[jj+6];
     1381    m2[j][7] = diff[jj+3] - diff[jj+7];
     1382   
     1383    m1[j][0] = m2[j][0] + m2[j][2];
     1384    m1[j][1] = m2[j][1] + m2[j][3];
     1385    m1[j][2] = m2[j][0] - m2[j][2];
     1386    m1[j][3] = m2[j][1] - m2[j][3];
     1387    m1[j][4] = m2[j][4] + m2[j][6];
     1388    m1[j][5] = m2[j][5] + m2[j][7];
     1389    m1[j][6] = m2[j][4] - m2[j][6];
     1390    m1[j][7] = m2[j][5] - m2[j][7];
     1391   
     1392    m2[j][0] = m1[j][0] + m1[j][1];
     1393    m2[j][1] = m1[j][0] - m1[j][1];
     1394    m2[j][2] = m1[j][2] + m1[j][3];
     1395    m2[j][3] = m1[j][2] - m1[j][3];
     1396    m2[j][4] = m1[j][4] + m1[j][5];
     1397    m2[j][5] = m1[j][4] - m1[j][5];
     1398    m2[j][6] = m1[j][6] + m1[j][7];
     1399    m2[j][7] = m1[j][6] - m1[j][7];
     1400  }
     1401 
     1402  //vertical
     1403  for (i=0; i < 8; i++)
     1404  {
     1405    m3[0][i] = m2[0][i] + m2[4][i];
     1406    m3[1][i] = m2[1][i] + m2[5][i];
     1407    m3[2][i] = m2[2][i] + m2[6][i];
     1408    m3[3][i] = m2[3][i] + m2[7][i];
     1409    m3[4][i] = m2[0][i] - m2[4][i];
     1410    m3[5][i] = m2[1][i] - m2[5][i];
     1411    m3[6][i] = m2[2][i] - m2[6][i];
     1412    m3[7][i] = m2[3][i] - m2[7][i];
     1413   
     1414    m1[0][i] = m3[0][i] + m3[2][i];
     1415    m1[1][i] = m3[1][i] + m3[3][i];
     1416    m1[2][i] = m3[0][i] - m3[2][i];
     1417    m1[3][i] = m3[1][i] - m3[3][i];
     1418    m1[4][i] = m3[4][i] + m3[6][i];
     1419    m1[5][i] = m3[5][i] + m3[7][i];
     1420    m1[6][i] = m3[4][i] - m3[6][i];
     1421    m1[7][i] = m3[5][i] - m3[7][i];
     1422   
     1423    m2[0][i] = m1[0][i] + m1[1][i];
     1424    m2[1][i] = m1[0][i] - m1[1][i];
     1425    m2[2][i] = m1[2][i] + m1[3][i];
     1426    m2[3][i] = m1[2][i] - m1[3][i];
     1427    m2[4][i] = m1[4][i] + m1[5][i];
     1428    m2[5][i] = m1[4][i] - m1[5][i];
     1429    m2[6][i] = m1[6][i] + m1[7][i];
     1430    m2[7][i] = m1[6][i] - m1[7][i];
     1431  }
     1432 
     1433  for (i = 0; i < 8; i++)
     1434  {
     1435    for (j = 0; j < 8; j++)
     1436    {
     1437      iSumHad += abs(m2[i][j]);
     1438    }
     1439  }
     1440  iSumHad -= abs(m2[0][0]);
     1441  iSumHad =(iSumHad+2)>>2;
     1442  return(iSumHad);
     1443}
     1444
     1445Int  TEncCu::updateLCUDataISlice(TComDataCU* pcCU, Int LCUIdx, Int width, Int height)
     1446{
     1447  Int  xBl, yBl;
     1448  const Int iBlkSize = 8;
     1449
     1450  Pel* pOrgInit   = pcCU->getPic()->getPicYuvOrg()->getLumaAddr(pcCU->getAddr(), 0);
     1451  Int  iStrideOrig = pcCU->getPic()->getPicYuvOrg()->getStride();
     1452  Pel  *pOrg;
     1453
     1454  Int iSumHad = 0;
     1455  for ( yBl=0; (yBl+iBlkSize)<=height; yBl+= iBlkSize)
     1456  {
     1457    for ( xBl=0; (xBl+iBlkSize)<=width; xBl+= iBlkSize)
     1458    {
     1459      pOrg = pOrgInit + iStrideOrig*yBl + xBl;
     1460      iSumHad += xCalcHADs8x8_ISlice(pOrg, iStrideOrig);
     1461    }
     1462  }
     1463  return(iSumHad);
     1464}
     1465#endif
     1466
    13501467/** check RD costs for a CU block encoded with merge
    13511468 * \param rpcBestCU
     
    13601477  UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM];
    13611478#else
    1362   TComMvField  cMvFieldNeighbours[MRG_MAX_NUM_CANDS << 1]; // double length for mv of both lists
     1479  TComMvField  cMvFieldNeighbours[2 * MRG_MAX_NUM_CANDS]; // double length for mv of both lists
    13631480  UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS];
    13641481#endif
     
    14001517  Int mergeCandBuffer[MRG_MAX_NUM_CANDS];
    14011518#endif
    1402   for( UInt ui = 0; ui < rpcTempCU->getSlice()->getMaxNumMergeCand(); ++ui )
     1519for( UInt ui = 0; ui < numValidMergeCand; ++ui )
    14031520  {
    14041521    mergeCandBuffer[ui] = 0;
     
    14301547  {
    14311548    for( UInt uiMergeCand = 0; uiMergeCand < numValidMergeCand; ++uiMergeCand )
    1432     {
    1433       {
     1549    {     
    14341550#if H_3D_IC
    14351551        if( rpcTempCU->getSlice()->getApplyIC() && rpcTempCU->getSlice()->getIcSkipParseFlag() )
     
    14431559        if(!(uiNoResidual==1 && mergeCandBuffer[uiMergeCand]==1))
    14441560        {
    1445 
    14461561        if( !(bestIsSkip && uiNoResidual == 0) )
    14471562        {
     
    14871602       m_pcPredSearch->motionCompensation ( rpcTempCU, m_ppcPredYuvTemp[uhDepth] );
    14881603       // estimate residual and encode everything
    1489 
    14901604#if H_3D_VSO //M2
    14911605       if( m_pcRdCost->getUseRenModel() )
     
    14981612       }
    14991613#endif
    1500 
    15011614       m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU,
    15021615         m_ppcOrigYuv    [uhDepth],
     
    15081621
    15091622
    1510        if(uiNoResidual==0)
    1511        {
    1512          if(rpcTempCU->getQtRootCbf(0) == 0)
     1623          if ( uiNoResidual == 0 && rpcTempCU->getQtRootCbf(0) == 0 )
    15131624         {
     1625            // If no residual when allowing for one, then set mark to not try case where residual is forced to 0
    15141626           mergeCandBuffer[uiMergeCand] = 1;
    15151627         }
    1516        }
    1517 
    1518        rpcTempCU->setSkipFlagSubParts( rpcTempCU->getQtRootCbf(0) == 0, 0, uhDepth );
     1628
     1629          rpcTempCU->setSkipFlagSubParts( rpcTempCU->getQtRootCbf(0) == 0, 0, uhDepth );
    15191630          Int orgQP = rpcTempCU->getQP( 0 );
    15201631          xCheckDQP( rpcTempCU );
     
    15221633          rpcTempCU->initEstData( uhDepth, orgQP );
    15231634
    1524 
    15251635      if( m_pcEncCfg->getUseFastDecisionForMerge() && !bestIsSkip )
    15261636      {
    15271637        bestIsSkip = rpcBestCU->getQtRootCbf(0) == 0;
    15281638      }
    1529 
    1530     }
    15311639    }
    15321640   }
     
    16891797#endif
    16901798
    1691 #if RATE_CONTROL_LAMBDA_DOMAIN
     1799#if RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT
    16921800  if ( m_pcEncCfg->getUseRateCtrl() && m_pcEncCfg->getLCULevelRC() && ePartSize == SIZE_2Nx2N && uhDepth <= m_addSADDepth )
    16931801  {
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncCu.h

    r504 r537  
    102102  Bool                    m_bUseSBACRD;
    103103  TEncRateCtrl*           m_pcRateCtrl;
    104 #if RATE_CONTROL_LAMBDA_DOMAIN
     104#if RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT
    105105  UInt                    m_LCUPredictionSAD;
    106106  Int                     m_addSADDepth;
     
    124124 
    125125  Void setBitCounter        ( TComBitCounter* pcBitCounter ) { m_pcBitCounter = pcBitCounter; }
    126 #if RATE_CONTROL_LAMBDA_DOMAIN
     126#if RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT
    127127  UInt getLCUPredictionSAD() { return m_LCUPredictionSAD; }
     128#endif
     129#if RATE_CONTROL_INTRA
     130  Int   updateLCUDataISlice ( TComDataCU* pcCU, Int LCUIdx, Int width, Int height );
    128131#endif
    129132protected:
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncGOP.cpp

    r534 r537  
    9494  m_cpbRemovalDelay   = 0;
    9595  m_lastBPSEI         = 0;
    96 #if L0045_NON_NESTED_SEI_RESTRICTIONS
    9796  xResetNonNestedSEIPresentFlags();
    98 #if K0180_SCALABLE_NESTING_SEI
    9997  xResetNestedSEIPresentFlags();
    100 #endif
    101 #endif
    10298#if H_MV
    10399  m_layerId      = 0;
     
    163159  SEIActiveParameterSets *seiActiveParameterSets = new SEIActiveParameterSets();
    164160  seiActiveParameterSets->activeVPSId = m_pcCfg->getVPS()->getVPSId();
    165 #if L0047_APS_FLAGS
    166161  seiActiveParameterSets->m_fullRandomAccessFlag = false;
    167162  seiActiveParameterSets->m_noParamSetUpdateFlag = false;
    168 #endif
    169163  seiActiveParameterSets->numSpsIdsMinus1 = 0;
    170164  seiActiveParameterSets->activeSeqParamSetId.resize(seiActiveParameterSets->numSpsIdsMinus1 + 1);
     
    179173  seiFramePacking->m_arrangementCancelFlag = 0;
    180174  seiFramePacking->m_arrangementType = m_pcCfg->getFramePackingArrangementSEIType();
    181 #if L0444_FPA_TYPE
    182175  assert((seiFramePacking->m_arrangementType > 2) && (seiFramePacking->m_arrangementType < 6) );
    183 #endif
    184176  seiFramePacking->m_quincunxSamplingFlag = m_pcCfg->getFramePackingArrangementSEIQuincunx();
    185177  seiFramePacking->m_contentInterpretationType = m_pcCfg->getFramePackingArrangementSEIInterpretation();
     
    195187  seiFramePacking->m_frame1GridPositionY = 0;
    196188  seiFramePacking->m_arrangementReservedByte = 0;
    197 #if L0045_PERSISTENCE_FLAGS
    198189  seiFramePacking->m_arrangementPersistenceFlag = true;
    199 #else
    200   seiFramePacking->m_arrangementRepetetionPeriod = 1;
    201 #endif
    202190  seiFramePacking->m_upsampledAspectRatio = 0;
    203191  return seiFramePacking;
     
    214202}
    215203
    216 #if J0149_TONE_MAPPING_SEI
    217204SEIToneMappingInfo*  TEncGOP::xCreateSEIToneMappingInfo()
    218205{
     
    225212  assert(seiToneMappingInfo->m_codedDataBitDepth >= 8 && seiToneMappingInfo->m_codedDataBitDepth <= 14);
    226213  seiToneMappingInfo->m_targetBitDepth = m_pcCfg->getTMISEITargetBitDepth();
    227   assert( (seiToneMappingInfo->m_targetBitDepth >= 1 && seiToneMappingInfo->m_targetBitDepth <= 17) || (seiToneMappingInfo->m_targetBitDepth  == 255) );
     214  assert( seiToneMappingInfo->m_targetBitDepth >= 1 && seiToneMappingInfo->m_targetBitDepth <= 17 );
    228215  seiToneMappingInfo->m_modelId = m_pcCfg->getTMISEIModelID();
    229216  assert(seiToneMappingInfo->m_modelId >=0 &&seiToneMappingInfo->m_modelId<=4);
     
    300287  return seiToneMappingInfo;
    301288}
    302 #endif
     289
    303290Void TEncGOP::xCreateLeadingSEIMessages (/*SEIMessages seiMessages,*/ AccessUnit &accessUnit, TComSPS *sps)
    304291{
     
    315302    accessUnit.push_back(new NALUnitEBSP(nalu));
    316303    delete sei;
    317 #if L0045_NON_NESTED_SEI_RESTRICTIONS
    318304    m_activeParameterSetSEIPresentInAU = true;
    319 #endif
    320305  }
    321306
     
    342327    delete sei;
    343328  }
    344 #if J0149_TONE_MAPPING_SEI
    345329  if(m_pcCfg->getToneMappingInfoSEIEnabled())
    346330  {
     
    354338    delete sei;
    355339  }
    356 #endif
    357340}
    358341
     
    389372#endif
    390373  SEIPictureTiming pictureTimingSEI;
    391 #if L0208_SOP_DESCRIPTION_SEI
    392374  Bool writeSOP = m_pcCfg->getSOPDescriptionSEIEnabled();
    393 #endif
    394 #if K0180_SCALABLE_NESTING_SEI
    395375  // Initialize Scalable Nesting SEI with single layer values
    396376  SEIScalableNesting scalableNestingSEI;
     
    403383  scalableNestingSEI.m_nestingLayerId[0]             = 0;
    404384  scalableNestingSEI.m_callerOwnsSEIs                = true;
    405 #endif
    406 #if L0044_DU_DPB_OUTPUT_DELAY_HRD
    407385  Int picSptDpbOutputDuDelay = 0;
    408 #endif
    409386  UInt *accumBitsDU = NULL;
    410387  UInt *accumNalsDU = NULL;
     
    596573    pcSlice->getRPS()->setNumberOfLongtermPictures(0);
    597574
    598 #if FIX1071 && H_MV_FIX1071
     575#if FIX1071
    599576    if ((pcSlice->checkThatAllRefPicsAreAvailable(rcListPic, pcSlice->getRPS(), false) != 0) || (pcSlice->isIRAP()))
    600577    {
     
    772749    }
    773750#endif
    774 #if !L0034_COMBINED_LIST_CLEANUP
    775     if (pcSlice->getSliceType() != B_SLICE || !pcSlice->getSPS()->getUseLComb())
    776     {
    777       pcSlice->setNumRefIdx(REF_PIC_LIST_C, 0);
    778       pcSlice->setRefPicListCombinationFlag(false);
    779       pcSlice->setRefPicListModificationFlagLC(false);
    780     }
    781     else
    782     {
    783       pcSlice->setRefPicListCombinationFlag(pcSlice->getSPS()->getUseLComb());
    784       pcSlice->setNumRefIdx(REF_PIC_LIST_C, pcSlice->getNumRefIdx(REF_PIC_LIST_0));
    785     }
    786 #endif
    787 
    788751    if (pcSlice->getSliceType() == B_SLICE)
    789752    {
     
    820783    pcSlice->setRefPOCList();
    821784
    822 #if L0034_COMBINED_LIST_CLEANUP
    823785    pcSlice->setList1IdxToList0Idx();
    824 #else
    825     pcSlice->setNoBackPredFlag( false );
    826     if ( pcSlice->getSliceType() == B_SLICE && !pcSlice->getRefPicListCombinationFlag())
    827     {
    828       if ( pcSlice->getNumRefIdx(RefPicList( 0 ) ) == pcSlice->getNumRefIdx(RefPicList( 1 ) ) )
    829       {
    830         pcSlice->setNoBackPredFlag( true );
    831         Int i;
    832         for ( i=0; i < pcSlice->getNumRefIdx(RefPicList( 1 ) ); i++ )
    833         {
    834           if ( pcSlice->getRefPOC(RefPicList(1), i) != pcSlice->getRefPOC(RefPicList(0), i) )
    835           {
    836             pcSlice->setNoBackPredFlag( false );
    837             break;
    838           }
    839         }
    840       }
    841     }
    842 
    843     if(pcSlice->getNoBackPredFlag())
    844     {
    845       pcSlice->setNumRefIdx(REF_PIC_LIST_C, 0);
    846     }
    847     pcSlice->generateCombinedList();
    848 #endif
    849786#if H_3D_TMVP
    850787    if(pcSlice->getLayerId())
     
    943880
    944881#if RATE_CONTROL_LAMBDA_DOMAIN
    945     Int sliceQP              = pcSlice->getSliceQp();
    946882    Double lambda            = 0.0;
    947883    Int actualHeadBits       = 0;
     
    959895      estimatedBits = m_pcRateCtrl->getRCPic()->getTargetBits();
    960896
     897      Int sliceQP = m_pcCfg->getInitialQP();
    961898      if ( ( pcSlice->getPOC() == 0 && m_pcCfg->getInitialQP() > 0 ) || ( frameLevel == 0 && m_pcCfg->getForceIntraQP() ) ) // QP is specified
    962899      {
    963         sliceQP              = m_pcCfg->getInitialQP();
    964900        Int    NumberBFrames = ( m_pcCfg->getGOPSize() - 1 );
    965901        Double dLambda_scale = 1.0 - Clip3( 0.0, 0.5, 0.05*(Double)NumberBFrames );
     
    972908      else if ( frameLevel == 0 )   // intra case, but use the model
    973909      {
     910#if RATE_CONTROL_INTRA
     911        m_pcSliceEncoder->calCostSliceI(pcPic);
     912#endif
    974913        if ( m_pcCfg->getIntraPeriod() != 1 )   // do not refine allocated bits for all intra case
    975914        {
    976915          Int bits = m_pcRateCtrl->getRCSeq()->getLeftAverageBits();
     916#if RATE_CONTROL_INTRA
     917          bits = m_pcRateCtrl->getRCPic()->getRefineBitsForIntra( bits );
     918#else
    977919          bits = m_pcRateCtrl->getRCSeq()->getRefineBitsForIntra( bits );
     920#endif
    978921          if ( bits < 200 )
    979922          {
     
    984927
    985928        list<TEncRCPic*> listPreviousPicture = m_pcRateCtrl->getPicList();
     929#if RATE_CONTROL_INTRA
     930        m_pcRateCtrl->getRCPic()->getLCUInitTargetBits();
     931        lambda  = m_pcRateCtrl->getRCPic()->estimatePicLambda( listPreviousPicture, pcSlice->getSliceType());
     932#else
    986933        lambda  = m_pcRateCtrl->getRCPic()->estimatePicLambda( listPreviousPicture );
     934#endif
    987935        sliceQP = m_pcRateCtrl->getRCPic()->estimatePicQP( lambda, listPreviousPicture );
    988936      }
     
    990938      {
    991939        list<TEncRCPic*> listPreviousPicture = m_pcRateCtrl->getPicList();
     940#if RATE_CONTROL_INTRA
     941        lambda  = m_pcRateCtrl->getRCPic()->estimatePicLambda( listPreviousPicture, pcSlice->getSliceType());
     942#else
    992943        lambda  = m_pcRateCtrl->getRCPic()->estimatePicLambda( listPreviousPicture );
     944#endif
    993945        sliceQP = m_pcRateCtrl->getRCPic()->estimatePicQP( lambda, listPreviousPicture );
    994946      }
     
    11991151    Bool bLFCrossTileBoundary = pcSlice->getPPS()->getLoopFilterAcrossTilesEnabledFlag();
    12001152    m_pcLoopFilter->setCfg(bLFCrossTileBoundary);
    1201 #if L0386_DB_METRIC
    12021153    if ( m_pcCfg->getDeblockingFilterMetric() )
    12031154    {
    12041155      dblMetric(pcPic, uiNumSlices);
    12051156    }
    1206 #endif
    12071157    m_pcLoopFilter->loopFilterPic( pcPic );
    12081158
     
    12671217        UInt maxCU = m_pcCfg->getSliceArgument() >> ( pcSlice->getSPS()->getMaxCUDepth() << 1);
    12681218        UInt numDU = ( m_pcCfg->getSliceMode() == 1 ) ? ( pcPic->getNumCUsInFrame() / maxCU ) : ( 0 );
    1269         if( pcPic->getNumCUsInFrame() % maxCU != 0 )
     1219        if( pcPic->getNumCUsInFrame() % maxCU != 0 || numDU == 0 )
    12701220        {
    12711221          numDU ++;
     
    13071257    }
    13081258
    1309 #if L0208_SOP_DESCRIPTION_SEI
    13101259    if (writeSOP) // write SOP description SEI (if enabled) at the beginning of GOP
    13111260    {
     
    13451294      writeSOP = false;
    13461295    }
    1347 #endif
    13481296
    13491297    if( ( m_pcCfg->getPictureTimingSEIEnabled() || m_pcCfg->getDecodingUnitInfoSEIEnabled() ) &&
     
    13771325      pictureTimingSEI.m_auCpbRemovalDelay = std::max<Int>(1, m_totalCoded - m_lastBPSEI); // Syntax element signalled as minus, hence the .
    13781326      pictureTimingSEI.m_picDpbOutputDelay = pcSlice->getSPS()->getNumReorderPics(0) + pcSlice->getPOC() - m_totalCoded;
    1379 #if L0044_DU_DPB_OUTPUT_DELAY_HRD
    13801327      Int factor = pcSlice->getSPS()->getVuiParameters()->getHrdParameters()->getTickDivisorMinus2() + 2;
    13811328      pictureTimingSEI.m_picDpbOutputDuDelay = factor * pictureTimingSEI.m_picDpbOutputDelay;
     
    13841331        picSptDpbOutputDuDelay = factor * pictureTimingSEI.m_picDpbOutputDelay;
    13851332      }
    1386 #endif
    13871333    }
    13881334
     
    14041350      sei_buffering_period.m_initialCpbRemovalDelayOffset[0][1]     = uiInitialCpbRemovalDelay;
    14051351
    1406 #if L0043_TIMING_INFO
    14071352      Double dTmp = (Double)pcSlice->getSPS()->getVuiParameters()->getTimingInfo()->getNumUnitsInTick() / (Double)pcSlice->getSPS()->getVuiParameters()->getTimingInfo()->getTimeScale();
    1408 #else
    1409       Double dTmp = (Double)pcSlice->getSPS()->getVuiParameters()->getHrdParameters()->getNumUnitsInTick() / (Double)pcSlice->getSPS()->getVuiParameters()->getHrdParameters()->getTimeScale();
    1410 #endif
    14111353
    14121354      UInt uiTmp = (UInt)( dTmp * 90000.0 );
     
    14191361
    14201362      sei_buffering_period.m_rapCpbParamsPresentFlag              = 0;
    1421 #if L0328_SPLICING
    14221363      //for the concatenation, it can be set to one during splicing.
    14231364      sei_buffering_period.m_concatenationFlag = 0;
    14241365      //since the temporal layer HRD is not ready, we assumed it is fixed
    14251366      sei_buffering_period.m_auCpbRemovalDelayDelta = 1;
    1426 #endif
    1427 #if L0044_CPB_DPB_DELAY_OFFSET
    14281367      sei_buffering_period.m_cpbDelayOffset = 0;
    14291368      sei_buffering_period.m_dpbDelayOffset = 0;
    1430 #endif
    14311369
    14321370      m_seiWriter.writeSEImessage( nalu.m_Bitstream, sei_buffering_period, pcSlice->getSPS());
    14331371      writeRBSPTrailingBits(nalu.m_Bitstream);
    1434 #if L0045_NON_NESTED_SEI_RESTRICTIONS
    14351372      {
    14361373      UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit);
     
    14441381      m_bufferingPeriodSEIPresentInAU = true;
    14451382      }
    1446 #else
    1447       accessUnit.push_back(new NALUnitEBSP(nalu));
    1448 #endif
    1449 
    1450 #if K0180_SCALABLE_NESTING_SEI
     1383
    14511384      if (m_pcCfg->getScalableNestingSEIEnabled())
    14521385      {
     
    14581391        m_seiWriter.writeSEImessage( naluTmp.m_Bitstream, scalableNestingSEI, pcSlice->getSPS());
    14591392        writeRBSPTrailingBits(naluTmp.m_Bitstream);
    1460 #if L0045_NON_NESTED_SEI_RESTRICTIONS
    14611393        UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit);
    14621394        UInt offsetPosition = m_activeParameterSetSEIPresentInAU + m_bufferingPeriodSEIPresentInAU + m_pictureTimingSEIPresentInAU;   // Insert BP SEI after non-nested APS, BP and PT SEIs
     
    14681400        accessUnit.insert(it, new NALUnitEBSP(naluTmp));
    14691401        m_nestedBufferingPeriodSEIPresentInAU = true;
    1470 #else
    1471         accessUnit.push_back(new NALUnitEBSP(naluTmp));
    1472 #endif
    1473       }
    1474 #endif
     1402      }
    14751403
    14761404      m_lastBPSEI = m_totalCoded;
     
    19351863      if ( m_pcCfg->getUseRateCtrl() )
    19361864      {
     1865#if !M0036_RC_IMPROVEMENT
    19371866        Double effectivePercentage = m_pcRateCtrl->getRCPic()->getEffectivePercentage();
     1867#endif
    19381868        Double avgQP     = m_pcRateCtrl->getRCPic()->calAverageQP();
    19391869        Double avgLambda = m_pcRateCtrl->getRCPic()->calAverageLambda();
     
    19421872          avgLambda = lambda;
    19431873        }
     1874#if M0036_RC_IMPROVEMENT
     1875#if RATE_CONTROL_INTRA
     1876        m_pcRateCtrl->getRCPic()->updateAfterPicture( actualHeadBits, actualTotalBits, avgQP, avgLambda, pcSlice->getSliceType());
     1877#else
     1878        m_pcRateCtrl->getRCPic()->updateAfterPicture( actualHeadBits, actualTotalBits, avgQP, avgLambda );
     1879#endif
     1880#else
    19441881        m_pcRateCtrl->getRCPic()->updateAfterPicture( actualHeadBits, actualTotalBits, avgQP, avgLambda, effectivePercentage );
     1882#endif
    19451883        m_pcRateCtrl->getRCPic()->addToPictureLsit( m_pcRateCtrl->getPicList() );
    19461884
     
    19621900      }
    19631901#endif
     1902
    19641903      if( ( m_pcCfg->getPictureTimingSEIEnabled() || m_pcCfg->getDecodingUnitInfoSEIEnabled() ) &&
    19651904          ( pcSlice->getSPS()->getVuiParametersPresentFlag() ) &&
     
    19961935            for( i = ( numDU - 2 ); i >= 0; i -- )
    19971936            {
    1998 #if L0043_TIMING_INFO
    19991937              ui64Tmp = ( ( ( accumBitsDU[ numDU - 1 ]  - accumBitsDU[ i ] ) * ( vui->getTimingInfo()->getTimeScale() / vui->getTimingInfo()->getNumUnitsInTick() ) * ( hrd->getTickDivisorMinus2() + 2 ) ) / ( m_pcCfg->getTargetBitrate() ) );
    2000 #else
    2001               ui64Tmp = ( ( ( accumBitsDU[ numDU - 1 ]  - accumBitsDU[ i ] ) * ( hrd->getTimeScale() / hrd->getNumUnitsInTick() ) * ( hrd->getTickDivisorMinus2() + 2 ) ) / ( m_pcCfg->getTargetBitrate() ) );
    2002 #endif
    20031938              if( (UInt)ui64Tmp > maxDiff )
    20041939              {
     
    20121947            {
    20131948              flag = 0;
    2014 #if L0043_TIMING_INFO
    20151949              ui64Tmp = ( ( ( accumBitsDU[ numDU - 1 ]  - accumBitsDU[ i ] ) * ( vui->getTimingInfo()->getTimeScale() / vui->getTimingInfo()->getNumUnitsInTick() ) * ( hrd->getTickDivisorMinus2() + 2 ) ) / ( m_pcCfg->getTargetBitrate() ) );
    2016 #else
    2017               ui64Tmp = ( ( ( accumBitsDU[ numDU - 1 ]  - accumBitsDU[ i ] ) * ( hrd->getTimeScale() / hrd->getNumUnitsInTick() ) * ( hrd->getTickDivisorMinus2() + 2 ) ) / ( m_pcCfg->getTargetBitrate() ) );
    2018 #endif
    20191950
    20201951              if( (UInt)ui64Tmp > maxDiff )
     
    20481979          m_seiWriter.writeSEImessage(nalu.m_Bitstream, pictureTimingSEI, pcSlice->getSPS());
    20491980          writeRBSPTrailingBits(nalu.m_Bitstream);
    2050 #if L0045_NON_NESTED_SEI_RESTRICTIONS
    20511981          UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit);
    20521982          UInt offsetPosition = m_activeParameterSetSEIPresentInAU
     
    20591989          accessUnit.insert(it, new NALUnitEBSP(nalu));
    20601990          m_pictureTimingSEIPresentInAU = true;
    2061 #else
    2062           AccessUnit::iterator it = find_if(accessUnit.begin(), accessUnit.end(), mem_fun(&NALUnit::isSlice));
    2063           accessUnit.insert(it, new NALUnitEBSP(nalu));
    2064 #endif
    2065         }
    2066 #if K0180_SCALABLE_NESTING_SEI
     1991        }
    20671992          if ( m_pcCfg->getScalableNestingSEIEnabled() ) // put picture timing SEI into scalable nesting SEI
    20681993          {
     
    20731998            m_seiWriter.writeSEImessage(nalu.m_Bitstream, scalableNestingSEI, pcSlice->getSPS());
    20741999            writeRBSPTrailingBits(nalu.m_Bitstream);
    2075 #if L0045_NON_NESTED_SEI_RESTRICTIONS
    20762000            UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit);
    20772001            UInt offsetPosition = m_activeParameterSetSEIPresentInAU
     
    20842008            accessUnit.insert(it, new NALUnitEBSP(nalu));
    20852009            m_nestedPictureTimingSEIPresentInAU = true;
    2086 #else
    2087             AccessUnit::iterator it = find_if(accessUnit.begin(), accessUnit.end(), mem_fun(&NALUnit::isSlice));
    2088             accessUnit.insert(it, new NALUnitEBSP(nalu));
    2089 #endif
    20902010          }
    2091 #endif
    2092 
    20932011        }
    20942012        if( m_pcCfg->getDecodingUnitInfoSEIEnabled() && hrd->getSubPicCpbParamsPresentFlag() )
     
    21022020            tempSEI.m_decodingUnitIdx = i;
    21032021            tempSEI.m_duSptCpbRemovalDelay = pictureTimingSEI.m_duCpbRemovalDelayMinus1[i] + 1;
    2104 #if L0044_DU_DPB_OUTPUT_DELAY_HRD
    21052022            tempSEI.m_dpbOutputDuDelayPresentFlag = false;
    21062023            tempSEI.m_picSptDpbOutputDuDelay = picSptDpbOutputDuDelay;
    2107 #endif
    21082024
    21092025            AccessUnit::iterator it;
     
    21152031              writeRBSPTrailingBits(nalu.m_Bitstream);
    21162032
    2117 #if L0045_NON_NESTED_SEI_RESTRICTIONS
    21182033              UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit);
    21192034              UInt offsetPosition = m_activeParameterSetSEIPresentInAU
     
    21252040              }
    21262041              accessUnit.insert(it, new NALUnitEBSP(nalu));
    2127 #else
    2128               it = find_if(accessUnit.begin(), accessUnit.end(), mem_fun(&NALUnit::isSlice));
    2129               accessUnit.insert(it, new NALUnitEBSP(nalu));
    2130 #endif
    21312042            }
    21322043            else
     
    21542065        }
    21552066      }
    2156 #if L0045_NON_NESTED_SEI_RESTRICTIONS
    21572067      xResetNonNestedSEIPresentFlags();
    2158 #if K0180_SCALABLE_NESTING_SEI
    21592068      xResetNestedSEIPresentFlags();
    2160 #endif
    2161 #endif
    21622069      pcPic->getPicYuvRec()->copyToPic(pcPicYuvRecOut);
    21632070
     
    28512758}
    28522759
    2853 #if L0045_NON_NESTED_SEI_RESTRICTIONS
    28542760/** Function for finding the position to insert the first of APS and non-nested BP, PT, DU info SEI messages.
    28552761 * \param accessUnit Access Unit of the current picture
     
    28712777  return seiStartPos;
    28722778}
    2873 #endif
    2874 
    2875 #if L0386_DB_METRIC
     2779
    28762780Void TEncGOP::dblMetric( TComPic* pcPic, UInt uiNumSlices )
    28772781{
     
    28872791  const UInt noCol = (picWidth>>log2maxTB);
    28882792  const UInt noRows = (picHeight>>log2maxTB);
     2793  assert(noCol > 1);
     2794  assert(noRows > 1);
    28892795  UInt64 *colSAD = (UInt64*)malloc(noCol*sizeof(UInt64));
    28902796  UInt64 *rowSAD = (UInt64*)malloc(noRows*sizeof(UInt64));
     
    29952901  free(rowSAD);
    29962902}
    2997 #endif
     2903
    29982904#if H_MV
    29992905Void TEncGOP::xSetRefPicListModificationsMv( TComSlice* pcSlice, UInt iGOPid )
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncGOP.h

    r534 r537  
    128128  UInt                    m_tl0Idx;
    129129  UInt                    m_rapIdx;
    130 #if L0045_NON_NESTED_SEI_RESTRICTIONS
    131130  Bool                    m_activeParameterSetSEIPresentInAU;
    132131  Bool                    m_bufferingPeriodSEIPresentInAU;
    133132  Bool                    m_pictureTimingSEIPresentInAU;
    134 #if K0180_SCALABLE_NESTING_SEI
    135133  Bool                    m_nestedBufferingPeriodSEIPresentInAU;
    136134  Bool                    m_nestedPictureTimingSEIPresentInAU;
    137 #endif
    138 #endif
    139135public:
    140136  TEncGOP();
     
    199195  SEIDisplayOrientation*  xCreateSEIDisplayOrientation();
    200196
    201 #if J0149_TONE_MAPPING_SEI
    202197  SEIToneMappingInfo*     xCreateSEIToneMappingInfo();
    203 #endif
    204198
    205199  Void xCreateLeadingSEIMessages (/*SEIMessages seiMessages,*/ AccessUnit &accessUnit, TComSPS *sps);
    206 #if L0045_NON_NESTED_SEI_RESTRICTIONS
    207200  Int xGetFirstSeiLocation (AccessUnit &accessUnit);
    208201  Void xResetNonNestedSEIPresentFlags()
     
    212205    m_pictureTimingSEIPresentInAU      = false;
    213206  }
    214 #if K0180_SCALABLE_NESTING_SEI
    215207  Void xResetNestedSEIPresentFlags()
    216208  {
     
    218210    m_nestedPictureTimingSEIPresentInAU      = false;
    219211  }
    220 #endif
    221 #endif
    222212#if H_MV
    223213   Void  xSetRefPicListModificationsMv( TComSlice* pcSlice, UInt iGOPid );
    224214#endif
    225 #if L0386_DB_METRIC
    226215  Void dblMetric( TComPic* pcPic, UInt uiNumSlices );
    227 #endif
    228216};// END CLASS DEFINITION TEncGOP
    229217
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncRateCtrl.cpp

    r324 r537  
    6767  m_bitsLeft            = 0;
    6868  m_useLCUSeparateModel = false;
     69#if M0036_RC_IMPROVEMENT
     70  m_adaptiveBit         = 0;
     71  m_lastLambda          = 0.0;
     72#endif
    6973}
    7074
     
    7478}
    7579
     80#if M0036_RC_IMPROVEMENT
     81Void TEncRCSeq::create( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Int numberOfLevel, Bool useLCUSeparateModel, Int adaptiveBit )
     82#else
    7683Void TEncRCSeq::create( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Int numberOfLevel, Bool useLCUSeparateModel )
     84#endif
    7785{
    7886  destroy();
     
    101109    m_betaUpdate  = 0.025;
    102110  }
    103   else
     111#if M0036_RC_IMPROVEMENT
     112  else if ( m_seqTargetBpp < 0.2 )
    104113  {
    105114    m_alphaUpdate = 0.1;
    106115    m_betaUpdate  = 0.05;
    107116  }
     117  else if ( m_seqTargetBpp < 0.5 )
     118  {
     119    m_alphaUpdate = 0.2;
     120    m_betaUpdate  = 0.1;
     121  }
     122  else
     123  {
     124    m_alphaUpdate = 0.4;
     125    m_betaUpdate  = 0.2;
     126  }
     127#else
     128  else
     129  {
     130    m_alphaUpdate = 0.1;
     131    m_betaUpdate  = 0.05;
     132  }
     133#endif
    108134  m_averageBits     = (Int)(m_targetBits / totalFrames);
    109135  Int picWidthInBU  = ( m_picWidth  % m_LCUWidth  ) == 0 ? m_picWidth  / m_LCUWidth  : m_picWidth  / m_LCUWidth  + 1;
     
    146172  m_framesLeft = m_totalFrames;
    147173  m_bitsLeft   = m_targetBits;
     174#if M0036_RC_IMPROVEMENT
     175  m_adaptiveBit = adaptiveBit;
     176  m_lastLambda = 0.0;
     177#endif
    148178}
    149179
     
    203233    for ( Int i=0; i<m_numberOfLevel; i++ )
    204234    {
     235#if RATE_CONTROL_INTRA
     236      if (i>0)
     237      {
     238        m_picPara[i].m_alpha = 3.2003;
     239        m_picPara[i].m_beta  = -1.367;
     240      }
     241      else
     242      {
     243        m_picPara[i].m_alpha = ALPHA;   
     244        m_picPara[i].m_beta  = BETA2;
     245      }
     246#else
    205247      m_picPara[i].m_alpha = 3.2003;
    206248      m_picPara[i].m_beta  = -1.367;
     249#endif
    207250    }
    208251  }
     
    228271      for ( Int j=0; j<m_numberOfLCU; j++)
    229272      {
     273#if RATE_CONTROL_INTRA
     274        m_LCUPara[i][j].m_alpha = m_picPara[i].m_alpha;
     275        m_LCUPara[i][j].m_beta  = m_picPara[i].m_beta;
     276#else
    230277        m_LCUPara[i][j].m_alpha = 3.2003;
    231278        m_LCUPara[i][j].m_beta  = -1.367;
     279#endif
    232280      }
    233281    }
     
    251299}
    252300
     301#if !RATE_CONTROL_INTRA
    253302Int TEncRCSeq::getRefineBitsForIntra( Int orgBits )
    254303{
     
    264313  return orgBits * 10;
    265314}
     315#endif
     316
     317#if M0036_RC_IMPROVEMENT
     318Void TEncRCSeq::setAllBitRatio( Double basicLambda, Double* equaCoeffA, Double* equaCoeffB )
     319{
     320  Int* bitsRatio = new Int[m_GOPSize];
     321  for ( Int i=0; i<m_GOPSize; i++ )
     322  {
     323    bitsRatio[i] = (Int)( equaCoeffA[i] * pow( basicLambda, equaCoeffB[i] ) * m_numberOfPixel );
     324  }
     325  initBitsRatio( bitsRatio );
     326  delete[] bitsRatio;
     327}
     328#endif
    266329
    267330//GOP level
     
    286349  Int targetBits = xEstGOPTargetBits( encRCSeq, numPic );
    287350
     351#if M0036_RC_IMPROVEMENT
     352  if ( encRCSeq->getAdaptiveBits() > 0 && encRCSeq->getLastLambda() > 0.1 )
     353  {
     354    Double targetBpp = (Double)targetBits / encRCSeq->getNumPixel();
     355    Double basicLambda = 0.0;
     356    Double* lambdaRatio = new Double[encRCSeq->getGOPSize()];
     357    Double* equaCoeffA = new Double[encRCSeq->getGOPSize()];
     358    Double* equaCoeffB = new Double[encRCSeq->getGOPSize()];
     359
     360    if ( encRCSeq->getAdaptiveBits() == 1 )   // for GOP size =4, low delay case
     361    {
     362      if ( encRCSeq->getLastLambda() < 120.0 )
     363      {
     364        lambdaRatio[1] = 0.725 * log( encRCSeq->getLastLambda() ) + 0.5793;
     365        lambdaRatio[0] = 1.3 * lambdaRatio[1];
     366        lambdaRatio[2] = 1.3 * lambdaRatio[1];
     367        lambdaRatio[3] = 1.0;
     368      }
     369      else
     370      {
     371        lambdaRatio[0] = 5.0;
     372        lambdaRatio[1] = 4.0;
     373        lambdaRatio[2] = 5.0;
     374        lambdaRatio[3] = 1.0;
     375      }
     376    }
     377    else if ( encRCSeq->getAdaptiveBits() == 2 )  // for GOP size = 8, random access case
     378    {
     379      if ( encRCSeq->getLastLambda() < 90.0 )
     380      {
     381        lambdaRatio[0] = 1.0;
     382        lambdaRatio[1] = 0.725 * log( encRCSeq->getLastLambda() ) + 0.7963;
     383        lambdaRatio[2] = 1.3 * lambdaRatio[1];
     384        lambdaRatio[3] = 3.25 * lambdaRatio[1];
     385        lambdaRatio[4] = 3.25 * lambdaRatio[1];
     386        lambdaRatio[5] = 1.3  * lambdaRatio[1];
     387        lambdaRatio[6] = 3.25 * lambdaRatio[1];
     388        lambdaRatio[7] = 3.25 * lambdaRatio[1];
     389      }
     390      else
     391      {
     392        lambdaRatio[0] = 1.0;
     393        lambdaRatio[1] = 4.0;
     394        lambdaRatio[2] = 5.0;
     395        lambdaRatio[3] = 12.3;
     396        lambdaRatio[4] = 12.3;
     397        lambdaRatio[5] = 5.0;
     398        lambdaRatio[6] = 12.3;
     399        lambdaRatio[7] = 12.3;
     400      }
     401    }
     402
     403    xCalEquaCoeff( encRCSeq, lambdaRatio, equaCoeffA, equaCoeffB, encRCSeq->getGOPSize() );
     404    basicLambda = xSolveEqua( targetBpp, equaCoeffA, equaCoeffB, encRCSeq->getGOPSize() );
     405    encRCSeq->setAllBitRatio( basicLambda, equaCoeffA, equaCoeffB );
     406
     407    delete []lambdaRatio;
     408    delete []equaCoeffA;
     409    delete []equaCoeffB;
     410  }
     411#endif
     412
    288413  m_picTargetBitInGOP = new Int[numPic];
    289414  Int i;
     
    297422  {
    298423    currPicRatio = encRCSeq->getBitRatio( i );
     424#if M0036_RC_IMPROVEMENT
     425    m_picTargetBitInGOP[i] = (Int)( ((Double)targetBits) * currPicRatio / totalPicRatio );
     426#else
    299427    m_picTargetBitInGOP[i] = targetBits * currPicRatio / totalPicRatio;
     428#endif
    300429  }
    301430
     
    306435  m_bitsLeft     = m_targetBits;
    307436}
     437
     438#if M0036_RC_IMPROVEMENT
     439Void TEncRCGOP::xCalEquaCoeff( TEncRCSeq* encRCSeq, Double* lambdaRatio, Double* equaCoeffA, Double* equaCoeffB, Int GOPSize )
     440{
     441  for ( Int i=0; i<GOPSize; i++ )
     442  {
     443    Int frameLevel = encRCSeq->getGOPID2Level(i);
     444    Double alpha   = encRCSeq->getPicPara(frameLevel).m_alpha;
     445    Double beta    = encRCSeq->getPicPara(frameLevel).m_beta;
     446    equaCoeffA[i] = pow( 1.0/alpha, 1.0/beta ) * pow( lambdaRatio[i], 1.0/beta );
     447    equaCoeffB[i] = 1.0/beta;
     448  }
     449}
     450
     451Double TEncRCGOP::xSolveEqua( Double targetBpp, Double* equaCoeffA, Double* equaCoeffB, Int GOPSize )
     452{
     453  Double solution = 100.0;
     454  Double minNumber = 0.1;
     455  Double maxNumber = 10000.0;
     456  for ( Int i=0; i<g_RCIterationNum; i++ )
     457  {
     458    Double fx = 0.0;
     459    for ( Int j=0; j<GOPSize; j++ )
     460    {
     461      fx += equaCoeffA[j] * pow( solution, equaCoeffB[j] );
     462    }
     463
     464    if ( fabs( fx - targetBpp ) < 0.000001 )
     465    {
     466      break;
     467    }
     468
     469    if ( fx > targetBpp )
     470    {
     471      minNumber = solution;
     472      solution = ( solution + maxNumber ) / 2.0;
     473    }
     474    else
     475    {
     476      maxNumber = solution;
     477      solution = ( solution + minNumber ) / 2.0;
     478    }
     479  }
     480
     481  solution = Clip3( 0.1, 10000.0, solution );
     482  return solution;
     483}
     484#endif
    308485
    309486Void TEncRCGOP::destroy()
     
    357534
    358535  m_LCUs         = NULL;
     536#if !M0036_RC_IMPROVEMENT
    359537  m_lastPicture  = NULL;
     538#endif
    360539  m_picActualHeaderBits = 0;
     540#if !M0036_RC_IMPROVEMENT
    361541  m_totalMAD            = 0.0;
     542#endif
    362543  m_picActualBits       = 0;
    363544  m_picQP               = 0;
     
    384565  }
    385566
     567#if M0036_RC_IMPROVEMENT
     568  targetBits  = Int( ((Double)GOPbitsLeft) * currPicRatio / totalPicRatio );
     569#else
    386570  targetBits  = Int( GOPbitsLeft * currPicRatio / totalPicRatio );
     571#endif
    387572
    388573  if ( targetBits < 100 )
     
    480665      m_LCUs[LCUIdx].m_lambda     = 0.0;
    481666      m_LCUs[LCUIdx].m_targetBits = 0;
     667#if M0036_RC_IMPROVEMENT
     668      m_LCUs[LCUIdx].m_bitWeight  = 1.0;
     669#else
    482670      m_LCUs[LCUIdx].m_MAD        = 0.0;
     671#endif
    483672      Int currWidth  = ( (i == picWidthInLCU -1) ? picWidth  - LCUWidth *(picWidthInLCU -1) : LCUWidth  );
    484673      Int currHeight = ( (j == picHeightInLCU-1) ? picHeight - LCUHeight*(picHeightInLCU-1) : LCUHeight );
     
    487676  }
    488677  m_picActualHeaderBits = 0;
     678#if !M0036_RC_IMPROVEMENT
    489679  m_totalMAD            = 0.0;
     680#endif
    490681  m_picActualBits       = 0;
    491682  m_picQP               = 0;
    492683  m_picLambda           = 0.0;
    493684
     685#if !M0036_RC_IMPROVEMENT
    494686  m_lastPicture = NULL;
    495687  list<TEncRCPic*>::reverse_iterator it;
     
    502694    }
    503695  }
     696#endif
    504697}
    505698
     
    515708}
    516709
     710
     711#if RATE_CONTROL_INTRA
     712Double TEncRCPic::estimatePicLambda( list<TEncRCPic*>& listPreviousPictures, SliceType eSliceType)
     713#else
    517714Double TEncRCPic::estimatePicLambda( list<TEncRCPic*>& listPreviousPictures )
     715#endif
    518716{
    519717  Double alpha         = m_encRCSeq->getPicPara( m_frameLevel ).m_alpha;
    520718  Double beta          = m_encRCSeq->getPicPara( m_frameLevel ).m_beta;
    521719  Double bpp       = (Double)m_targetBits/(Double)m_numberOfPixel;
     720#if RATE_CONTROL_INTRA
     721  Double estLambda;
     722  if (eSliceType == I_SLICE)
     723  {
     724    estLambda = calculateLambdaIntra(alpha, beta, pow(m_totalCostIntra/(Double)m_numberOfPixel, BETA1), bpp);
     725  }
     726  else
     727  {
     728    estLambda = alpha * pow( bpp, beta );
     729  }
     730#else
    522731  Double estLambda = alpha * pow( bpp, beta );
     732#endif 
     733 
    523734  Double lastLevelLambda = -1.0;
    524735  Double lastPicLambda   = -1.0;
     
    566777
    567778  m_estPicLambda = estLambda;
     779
     780#if M0036_RC_IMPROVEMENT
     781  Double totalWeight = 0.0;
     782  // initial BU bit allocation weight
     783  for ( Int i=0; i<m_numberOfLCU; i++ )
     784  {
     785#if RC_FIX
     786    Double alphaLCU, betaLCU;
     787    if ( m_encRCSeq->getUseLCUSeparateModel() )
     788    {
     789      alphaLCU = m_encRCSeq->getLCUPara( m_frameLevel, i ).m_alpha;
     790      betaLCU  = m_encRCSeq->getLCUPara( m_frameLevel, i ).m_beta;
     791    }
     792    else
     793    {
     794      alphaLCU = m_encRCSeq->getPicPara( m_frameLevel ).m_alpha;
     795      betaLCU  = m_encRCSeq->getPicPara( m_frameLevel ).m_beta;
     796    }
     797#else
     798    Double alphaLCU = m_encRCSeq->getLCUPara( m_frameLevel, i ).m_alpha;
     799    Double betaLCU  = m_encRCSeq->getLCUPara( m_frameLevel, i ).m_beta;
     800#endif
     801
     802    m_LCUs[i].m_bitWeight =  m_LCUs[i].m_numberOfPixel * pow( estLambda/alphaLCU, 1.0/betaLCU );
     803
     804    if ( m_LCUs[i].m_bitWeight < 0.01 )
     805    {
     806      m_LCUs[i].m_bitWeight = 0.01;
     807    }
     808    totalWeight += m_LCUs[i].m_bitWeight;
     809  }
     810  for ( Int i=0; i<m_numberOfLCU; i++ )
     811  {
     812    Double BUTargetBits = m_targetBits * m_LCUs[i].m_bitWeight / totalWeight;
     813    m_LCUs[i].m_bitWeight = BUTargetBits;
     814  }
     815#endif
     816
    568817  return estLambda;
    569818}
     
    607856}
    608857
     858#if RATE_CONTROL_INTRA
     859Double TEncRCPic::getLCUTargetBpp(SliceType eSliceType) 
     860#else
    609861Double TEncRCPic::getLCUTargetBpp()
     862#endif
    610863{
    611864  Int   LCUIdx    = getLCUCoded();
    612865  Double bpp      = -1.0;
    613866  Int avgBits     = 0;
     867#if !M0036_RC_IMPROVEMENT
    614868  Double totalMAD = -1.0;
    615869  Double MAD      = -1.0;
    616 
     870#endif
     871
     872#if RATE_CONTROL_INTRA
     873  if (eSliceType == I_SLICE){
     874    Int noOfLCUsLeft = m_numberOfLCU - LCUIdx + 1;
     875    Int bitrateWindow = min(4,noOfLCUsLeft);
     876    Double MAD      = getLCU(LCUIdx).m_costIntra;
     877
     878    if (m_remainingCostIntra > 0.1 )
     879    {
     880      Double weightedBitsLeft = (m_bitsLeft*bitrateWindow+(m_bitsLeft-getLCU(LCUIdx).m_targetBitsLeft)*noOfLCUsLeft)/(Double)bitrateWindow;
     881      avgBits = Int( MAD*weightedBitsLeft/m_remainingCostIntra );
     882    }
     883    else
     884    {
     885      avgBits = Int( m_bitsLeft / m_LCULeft );
     886    }
     887    m_remainingCostIntra -= MAD;
     888  }
     889  else
     890  {
     891#endif
     892#if M0036_RC_IMPROVEMENT
     893  Double totalWeight = 0;
     894  for ( Int i=LCUIdx; i<m_numberOfLCU; i++ )
     895  {
     896    totalWeight += m_LCUs[i].m_bitWeight;
     897  }
     898  Int realInfluenceLCU = min( g_RCLCUSmoothWindowSize, getLCULeft() );
     899  avgBits = (Int)( m_LCUs[LCUIdx].m_bitWeight - ( totalWeight - m_bitsLeft ) / realInfluenceLCU + 0.5 );
     900#else
    617901  if ( m_lastPicture == NULL )
    618902  {
     
    637921    }
    638922  }
    639 
    640 #if L0033_RC_BUGFIX
     923#endif
     924#if RATE_CONTROL_INTRA
     925  }
     926#endif
     927
    641928  if ( avgBits < 1 )
    642929  {
    643930    avgBits = 1;
    644931  }
    645 #else
    646   if ( avgBits < 5 )
    647   {
    648     avgBits = 5;
    649   }
    650 #endif
    651932
    652933  bpp = ( Double )avgBits/( Double )m_LCUs[ LCUIdx ].m_numberOfPixel;
     
    716997  //for Lambda clip, LCU level clip
    717998  Int clipNeighbourQP = g_RCInvalidQPValue;
    718 #if L0033_RC_BUGFIX
    719999  for ( int i=LCUIdx - 1; i>=0; i-- )
    720 #else
    721   for ( int i=LCUIdx; i>=0; i-- )
    722 #endif
    7231000  {
    7241001    if ( (getLCU(i)).m_QP > g_RCInvalidQPValue )
     
    7731050    beta  *= ( 1.0 - m_encRCSeq->getBetaUpdate() / 2.0 );
    7741051
     1052#if M0036_RC_IMPROVEMENT
     1053    alpha = Clip3( g_RCAlphaMinValue, g_RCAlphaMaxValue, alpha );
     1054    beta  = Clip3( g_RCBetaMinValue,  g_RCBetaMaxValue,  beta  );
     1055#else
    7751056    alpha = Clip3( 0.05, 20.0, alpha );
    7761057    beta  = Clip3( -3.0, -0.1, beta  );
     1058#endif
    7771059
    7781060    TRCParameter rcPara;
     
    7871069  alpha += m_encRCSeq->getAlphaUpdate() * ( log( inputLambda ) - log( calLambda ) ) * alpha;
    7881070  double lnbpp = log( bpp );
     1071#if M0036_RC_IMPROVEMENT
     1072  lnbpp = Clip3( -5.0, -0.1, lnbpp );
     1073#else
    7891074  lnbpp = Clip3( -5.0, 1.0, lnbpp );
     1075#endif
    7901076  beta  += m_encRCSeq->getBetaUpdate() * ( log( inputLambda ) - log( calLambda ) ) * lnbpp;
    7911077
     1078#if M0036_RC_IMPROVEMENT
     1079  alpha = Clip3( g_RCAlphaMinValue, g_RCAlphaMaxValue, alpha );
     1080  beta  = Clip3( g_RCBetaMinValue,  g_RCBetaMaxValue,  beta  );
     1081#else
    7921082  alpha = Clip3( 0.05, 20.0, alpha );
    7931083  beta  = Clip3( -3.0, -0.1, beta  );
     1084#endif
    7941085  TRCParameter rcPara;
    7951086  rcPara.m_alpha = alpha;
     
    7991090}
    8001091
     1092#if !M0036_RC_IMPROVEMENT
    8011093Double TEncRCPic::getEffectivePercentage()
    8021094{
     
    8161108  return effectivePixelPercentage;
    8171109}
     1110#endif
    8181111
    8191112Double TEncRCPic::calAverageQP()
     
    8711164}
    8721165
     1166#if M0036_RC_IMPROVEMENT
     1167#if RATE_CONTROL_INTRA
     1168Void TEncRCPic::updateAfterPicture( Int actualHeaderBits, Int actualTotalBits, Double averageQP, Double averageLambda, SliceType eSliceType)
     1169#else
     1170Void TEncRCPic::updateAfterPicture( Int actualHeaderBits, Int actualTotalBits, Double averageQP, Double averageLambda )
     1171#endif
     1172#else
    8731173Void TEncRCPic::updateAfterPicture( Int actualHeaderBits, Int actualTotalBits, Double averageQP, Double averageLambda, Double effectivePercentage )
     1174#endif
    8741175{
    8751176  m_picActualHeaderBits = actualHeaderBits;
     
    8841185  }
    8851186  m_picLambda           = averageLambda;
     1187#if !M0036_RC_IMPROVEMENT
    8861188  for ( Int i=0; i<m_numberOfLCU; i++ )
    8871189  {
    8881190    m_totalMAD += m_LCUs[i].m_MAD;
    8891191  }
     1192#endif
    8901193
    8911194  Double alpha = m_encRCSeq->getPicPara( m_frameLevel ).m_alpha;
    8921195  Double beta  = m_encRCSeq->getPicPara( m_frameLevel ).m_beta;
    893 
     1196#if RATE_CONTROL_INTRA
     1197  if (eSliceType == I_SLICE)
     1198  {
     1199    updateAlphaBetaIntra(&alpha, &beta);
     1200  }
     1201  else
     1202  {
     1203#endif
    8941204  // update parameters
    8951205  Double picActualBits = ( Double )m_picActualBits;
     
    8981208  Double inputLambda   = m_picLambda;
    8991209
     1210#if M0036_RC_IMPROVEMENT
     1211  if ( inputLambda < 0.01 || calLambda < 0.01 || picActualBpp < 0.0001 )
     1212#else
    9001213  if ( inputLambda < 0.01 || calLambda < 0.01 || picActualBpp < 0.0001 || effectivePercentage < 0.05 )
     1214#endif
    9011215  {
    9021216    alpha *= ( 1.0 - m_encRCSeq->getAlphaUpdate() / 2.0 );
    9031217    beta  *= ( 1.0 - m_encRCSeq->getBetaUpdate() / 2.0 );
    9041218
     1219#if M0036_RC_IMPROVEMENT
     1220    alpha = Clip3( g_RCAlphaMinValue, g_RCAlphaMaxValue, alpha );
     1221    beta  = Clip3( g_RCBetaMinValue,  g_RCBetaMaxValue,  beta  );
     1222#else
    9051223    alpha = Clip3( 0.05, 20.0, alpha );
    9061224    beta  = Clip3( -3.0, -0.1, beta  );
     1225#endif
    9071226    TRCParameter rcPara;
    9081227    rcPara.m_alpha = alpha;
     
    9161235  alpha += m_encRCSeq->getAlphaUpdate() * ( log( inputLambda ) - log( calLambda ) ) * alpha;
    9171236  double lnbpp = log( picActualBpp );
     1237#if M0036_RC_IMPROVEMENT
     1238  lnbpp = Clip3( -5.0, -0.1, lnbpp );
     1239#else
    9181240  lnbpp = Clip3( -5.0, 1.0, lnbpp );
     1241#endif
    9191242  beta  += m_encRCSeq->getBetaUpdate() * ( log( inputLambda ) - log( calLambda ) ) * lnbpp;
    9201243
     1244#if M0036_RC_IMPROVEMENT
     1245  alpha = Clip3( g_RCAlphaMinValue, g_RCAlphaMaxValue, alpha );
     1246  beta  = Clip3( g_RCBetaMinValue,  g_RCBetaMaxValue,  beta  );
     1247#else
    9211248  alpha = Clip3( 0.05, 20.0, alpha );
    9221249  beta  = Clip3( -3.0, -0.1, beta  );
     1250#endif
     1251#if RATE_CONTROL_INTRA
     1252  }
     1253#endif
    9231254
    9241255  TRCParameter rcPara;
     
    9271258
    9281259  m_encRCSeq->setPicPara( m_frameLevel, rcPara );
    929 }
     1260
     1261#if M0036_RC_IMPROVEMENT
     1262  if ( m_frameLevel == 1 )
     1263  {
     1264    Double currLambda = Clip3( 0.1, 10000.0, m_picLambda );
     1265    Double updateLastLambda = g_RCWeightHistoryLambda * m_encRCSeq->getLastLambda() + g_RCWeightCurrentLambda * currLambda;
     1266    m_encRCSeq->setLastLambda( updateLastLambda );
     1267  }
     1268#endif
     1269}
     1270
     1271#if RATE_CONTROL_INTRA
     1272Int TEncRCPic::getRefineBitsForIntra( Int orgBits )
     1273{
     1274  Double alpha=0.25, beta=0.5582;
     1275  Int iIntraBits;
     1276
     1277  if (orgBits*40 < m_numberOfPixel)
     1278  {
     1279    alpha=0.25;
     1280  }
     1281  else
     1282  {
     1283    alpha=0.30;
     1284  }
     1285
     1286  iIntraBits = (Int)(alpha* pow(m_totalCostIntra*4.0/(Double)orgBits, beta)*(Double)orgBits+0.5);
     1287 
     1288  return iIntraBits;
     1289}
     1290
     1291Double TEncRCPic::calculateLambdaIntra(double alpha, double beta, double MADPerPixel, double bitsPerPixel)
     1292{
     1293  return ( (alpha/256.0) * pow( MADPerPixel/bitsPerPixel, beta ) );
     1294}
     1295
     1296Void TEncRCPic::updateAlphaBetaIntra(double *alpha, double *beta)
     1297{
     1298  Double lnbpp = log(pow(m_totalCostIntra / (Double)m_numberOfPixel, BETA1));
     1299  Double diffLambda = (*beta)*(log((Double)m_picActualBits)-log((Double)m_targetBits));
     1300
     1301  diffLambda = Clip3(-0.125, 0.125, 0.25*diffLambda);
     1302  *alpha    =  (*alpha) * exp(diffLambda);
     1303  *beta     =  (*beta) + diffLambda / lnbpp;
     1304}
     1305
     1306
     1307Void TEncRCPic::getLCUInitTargetBits() 
     1308{
     1309  Int iAvgBits     = 0;
     1310
     1311  m_remainingCostIntra = m_totalCostIntra;
     1312  for (Int i=m_numberOfLCU-1; i>=0; i--)
     1313  {
     1314    iAvgBits += Int(m_targetBits * getLCU(i).m_costIntra/m_totalCostIntra);
     1315    getLCU(i).m_targetBitsLeft = iAvgBits;
     1316  }
     1317}
     1318
     1319
     1320Double TEncRCPic::getLCUEstLambdaAndQP(Double bpp, Int clipPicQP, Int *estQP)
     1321{
     1322  Int   LCUIdx = getLCUCoded();
     1323
     1324  Double   alpha = m_encRCSeq->getPicPara( m_frameLevel ).m_alpha;
     1325  Double   beta  = m_encRCSeq->getPicPara( m_frameLevel ).m_beta;
     1326
     1327  Double costPerPixel = getLCU(LCUIdx).m_costIntra/(Double)getLCU(LCUIdx).m_numberOfPixel;
     1328  costPerPixel = pow(costPerPixel, BETA1);
     1329  Double estLambda = calculateLambdaIntra(alpha, beta, costPerPixel, bpp);
     1330
     1331  Int clipNeighbourQP = g_RCInvalidQPValue;
     1332  for (int i=LCUIdx-1; i>=0; i--)
     1333  {
     1334    if ((getLCU(i)).m_QP > g_RCInvalidQPValue)
     1335    {
     1336      clipNeighbourQP = getLCU(i).m_QP;
     1337      break;
     1338    }
     1339  }
     1340
     1341  Int minQP = clipPicQP - 2;
     1342  Int maxQP = clipPicQP + 2;
     1343
     1344  if ( clipNeighbourQP > g_RCInvalidQPValue )
     1345  {
     1346    maxQP = min(clipNeighbourQP + 1, maxQP);
     1347    minQP = max(clipNeighbourQP - 1, minQP);
     1348  }
     1349
     1350  Double maxLambda=exp(((Double)(maxQP+0.49)-13.7122)/4.2005);
     1351  Double minLambda=exp(((Double)(minQP-0.49)-13.7122)/4.2005);
     1352
     1353  estLambda = Clip3(minLambda, maxLambda, estLambda);
     1354
     1355  *estQP = Int( 4.2005 * log(estLambda) + 13.7122 + 0.5 );
     1356  *estQP = Clip3(minQP, maxQP, *estQP);
     1357
     1358  return estLambda;
     1359}
     1360#endif
    9301361
    9311362TEncRateCtrl::TEncRateCtrl()
     
    9611392}
    9621393
     1394#if M0036_RC_IMPROVEMENT
     1395Void TEncRateCtrl::init( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Int keepHierBits, Bool useLCUSeparateModel, GOPEntry  GOPList[MAX_GOP] )
     1396#else
    9631397Void TEncRateCtrl::init( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Bool keepHierBits, Bool useLCUSeparateModel, GOPEntry  GOPList[MAX_GOP] )
     1398#endif
    9641399{
    9651400  destroy();
     
    9761411
    9771412  Int numberOfLevel = 1;
     1413#if M0036_RC_IMPROVEMENT
     1414  Int adaptiveBit = 0;
     1415  if ( keepHierBits > 0 )
     1416#else
    9781417  if ( keepHierBits )
     1418#endif
    9791419  {
    9801420    numberOfLevel = Int( log((Double)GOPSize)/log(2.0) + 0.5 ) + 1;
     
    9981438    }
    9991439  }
     1440
     1441#if M0036_RC_IMPROVEMENT
     1442  if ( keepHierBits > 0 )
     1443#else
    10001444  if ( keepHierBits )
     1445#endif
    10011446  {
    10021447    Double bpp = (Double)( targetBitrate / (Double)( frameRate*picWidth*picHeight ) );
     
    10311476        bitsRatio[3] = 14;
    10321477      }
     1478#if M0036_RC_IMPROVEMENT
     1479      if ( keepHierBits == 2 )
     1480      {
     1481        adaptiveBit = 1;
     1482      }
     1483#endif
    10331484    }
    10341485    else if ( GOPSize == 8 && !isLowdelay )
     
    10781529        bitsRatio[7] = 1;
    10791530      }
     1531#if M0036_RC_IMPROVEMENT
     1532      if ( keepHierBits == 2 )
     1533      {
     1534        adaptiveBit = 2;
     1535      }
     1536#endif
    10801537    }
    10811538    else
    10821539    {
     1540#if M0036_RC_IMPROVEMENT
     1541      printf( "\n hierarchical bit allocation is not support for the specified coding structure currently.\n" );
     1542#else
    10831543      printf( "\n hierarchical bit allocation is not support for the specified coding structure currently." );
     1544#endif
    10841545    }
    10851546  }
     
    10941555    }
    10951556  }
     1557#if M0036_RC_IMPROVEMENT
     1558  if ( keepHierBits > 0 )
     1559#else
    10961560  if ( keepHierBits )
     1561#endif
    10971562  {
    10981563    if ( GOPSize == 4 && isLowdelay )
     
    11291594
    11301595  m_encRCSeq = new TEncRCSeq;
     1596#if M0036_RC_IMPROVEMENT
     1597  m_encRCSeq->create( totalFrames, targetBitrate, frameRate, GOPSize, picWidth, picHeight, LCUWidth, LCUHeight, numberOfLevel, useLCUSeparateModel, adaptiveBit );
     1598#else
    11311599  m_encRCSeq->create( totalFrames, targetBitrate, frameRate, GOPSize, picWidth, picHeight, LCUWidth, LCUHeight, numberOfLevel, useLCUSeparateModel );
     1600#endif
    11321601  m_encRCSeq->initBitsRatio( bitsRatio );
    11331602  m_encRCSeq->initGOPID2Level( GOPID2Level );
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncRateCtrl.h

    r324 r537  
    6565const Double g_RCWeightPicTargetBitInGOP    = 0.9;
    6666const Double g_RCWeightPicRargetBitInBuffer = 1.0 - g_RCWeightPicTargetBitInGOP;
     67#if M0036_RC_IMPROVEMENT
     68const Int g_RCIterationNum = 20;
     69const Double g_RCWeightHistoryLambda = 0.5;
     70const Double g_RCWeightCurrentLambda = 1.0 - g_RCWeightHistoryLambda;
     71const Int g_RCLCUSmoothWindowSize = 4;
     72const Double g_RCAlphaMinValue = 0.05;
     73const Double g_RCAlphaMaxValue = 500.0;
     74const Double g_RCBetaMinValue  = -3.0;
     75const Double g_RCBetaMaxValue  = -0.1;
     76#endif
     77
     78#if RATE_CONTROL_INTRA
     79#define ALPHA     6.7542;
     80#define BETA1     1.2517
     81#define BETA2     1.7860
     82#endif
    6783
    6884struct TRCLCU
     
    7288  Int m_targetBits;
    7389  Double m_lambda;
     90#if M0036_RC_IMPROVEMENT
     91  Double m_bitWeight;
     92#else
    7493  Double m_MAD;
     94#endif
    7595  Int m_numberOfPixel;
     96#if RATE_CONTROL_INTRA
     97  Double m_costIntra;
     98  Int m_targetBitsLeft;
     99#endif
    76100};
    77101
     
    89113
    90114public:
     115#if M0036_RC_IMPROVEMENT
     116  Void create( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Int numberOfLevel, Bool useLCUSeparateModel, Int adaptiveBit );
     117#else
    91118  Void create( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Int numberOfLevel, Bool useLCUSeparateModel );
     119#endif
    92120  Void destroy();
    93121  Void initBitsRatio( Int bitsRatio[] );
     
    96124  Void initLCUPara( TRCParameter** LCUPara = NULL );    // NULL to initial with default value
    97125  Void updateAfterPic ( Int bits );
     126#if !RATE_CONTROL_INTRA
    98127  Int  getRefineBitsForIntra( Int orgBits );
     128#endif
     129#if M0036_RC_IMPROVEMENT
     130  Void setAllBitRatio( Double basicLambda, Double* equaCoeffA, Double* equaCoeffB );
     131#endif
    99132
    100133public:
     
    134167  Double getBetaUpdate()                { return m_betaUpdate; }
    135168
     169#if M0036_RC_IMPROVEMENT
     170  Int    getAdaptiveBits()              { return m_adaptiveBit;  }
     171  Double getLastLambda()                { return m_lastLambda;   }
     172  Void   setLastLambda( Double lamdba ) { m_lastLambda = lamdba; }
     173#endif
     174
    136175private:
    137176  Int m_totalFrames;
     
    160199  Double m_betaUpdate;
    161200  Bool m_useLCUSeparateModel;
     201
     202#if M0036_RC_IMPROVEMENT
     203  Int m_adaptiveBit;
     204  Double m_lastLambda;
     205#endif
    162206};
    163207
     
    175219private:
    176220  Int  xEstGOPTargetBits( TEncRCSeq* encRCSeq, Int GOPSize );
     221#if M0036_RC_IMPROVEMENT
     222  Void   xCalEquaCoeff( TEncRCSeq* encRCSeq, Double* lambdaRatio, Double* equaCoeffA, Double* equaCoeffB, Int GOPSize );
     223  Double xSolveEqua( Double targetBpp, Double* equaCoeffA, Double* equaCoeffB, Int GOPSize );
     224#endif
    177225
    178226public:
     
    203251  Void destroy();
    204252
     253#if !RATE_CONTROL_INTRA
    205254  Double estimatePicLambda( list<TEncRCPic*>& listPreviousPictures );
     255#endif
    206256  Int    estimatePicQP    ( Double lambda, list<TEncRCPic*>& listPreviousPictures );
     257#if RATE_CONTROL_INTRA
     258  Int    getRefineBitsForIntra(Int orgBits);
     259  Double calculateLambdaIntra(double alpha, double beta, double MADPerPixel, double bitsPerPixel);
     260  Double estimatePicLambda( list<TEncRCPic*>& listPreviousPictures, SliceType eSliceType);
     261
     262  Void   updateAlphaBetaIntra(double *alpha, double *beta);
     263
     264  Double getLCUTargetBpp(SliceType eSliceType);
     265  Double getLCUEstLambdaAndQP(Double bpp, Int clipPicQP, Int *estQP);
     266#else
    207267  Double getLCUTargetBpp();
     268#endif
    208269  Double getLCUEstLambda( Double bpp );
    209270  Int    getLCUEstQP( Double lambda, Int clipPicQP );
    210271
    211272  Void updateAfterLCU( Int LCUIdx, Int bits, Int QP, Double lambda, Bool updateLCUParameter = true );
     273#if M0036_RC_IMPROVEMENT
     274#if RATE_CONTROL_INTRA
     275  Void updateAfterPicture( Int actualHeaderBits, Int actualTotalBits, Double averageQP, Double averageLambda, SliceType eSliceType);
     276#else
     277  Void updateAfterPicture( Int actualHeaderBits, Int actualTotalBits, Double averageQP, Double averageLambda );
     278#endif
     279#else
    212280  Void updateAfterPicture( Int actualHeaderBits, Int actualTotalBits, Double averageQP, Double averageLambda, Double effectivePercentage );
     281#endif
    213282
    214283  Void addToPictureLsit( list<TEncRCPic*>& listPreviousPictures );
     284#if !M0036_RC_IMPROVEMENT
    215285  Double getEffectivePercentage();
     286#endif
    216287  Double calAverageQP();
    217288  Double calAverageLambda();
     
    229300  Int  getNumberOfLCU()                                   { return m_numberOfLCU; }
    230301  Int  getTargetBits()                                    { return m_targetBits; }
     302#if !RATE_CONTROL_INTRA
    231303  Void setTargetBits( Int bits )                          { m_targetBits = bits; }
     304#endif
    232305  Int  getEstHeaderBits()                                 { return m_estHeaderBits; }
    233306  Int  getLCULeft()                                       { return m_LCULeft; }
     
    239312  TRCLCU& getLCU( Int LCUIdx )                            { return m_LCUs[LCUIdx]; }
    240313  Int  getPicActualHeaderBits()                           { return m_picActualHeaderBits; }
     314#if !M0036_RC_IMPROVEMENT
    241315  Double getTotalMAD()                                    { return m_totalMAD; }
    242316  Void   setTotalMAD( Double MAD )                        { m_totalMAD = MAD; }
     317#endif
     318#if RATE_CONTROL_INTRA
     319  Void setTargetBits( Int bits )                          { m_targetBits = bits; m_bitsLeft = bits;}
     320  Void setTotalIntraCost(Double cost)                     { m_totalCostIntra = cost; }
     321  Void getLCUInitTargetBits();
     322#endif
     323
    243324  Int  getPicActualBits()                                 { return m_picActualBits; }
    244325  Int  getPicActualQP()                                   { return m_picQP; }
     
    267348  TRCLCU* m_LCUs;
    268349  Int m_picActualHeaderBits;    // only SH and potential APS
     350#if !M0036_RC_IMPROVEMENT
    269351  Double m_totalMAD;
     352#endif
     353#if RATE_CONTROL_INTRA
     354  Double m_totalCostIntra;
     355  Double m_remainingCostIntra;
     356#endif
    270357  Int m_picActualBits;          // the whole picture, including header
    271358  Int m_picQP;                  // in integer form
    272359  Double m_picLambda;
     360#if !M0036_RC_IMPROVEMENT
    273361  TEncRCPic* m_lastPicture;
     362#endif
    274363};
    275364
     
    281370
    282371public:
     372#if M0036_RC_IMPROVEMENT
     373  Void init( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Int keepHierBits, Bool useLCUSeparateModel, GOPEntry GOPList[MAX_GOP] );
     374#else
    283375  Void init( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Bool keepHierBits, Bool useLCUSeparateModel, GOPEntry GOPList[MAX_GOP] );
     376#endif
    284377  Void destroy();
    285378  Void initRCPic( Int frameLevel );
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp

    r446 r537  
    299299        m_iTypePartBest[iPartIdx] = -1;
    300300        if( m_bUseSBACRD )
     301        {
    301302          m_pcRDGoOnSbacCoder->store( m_pppcRDSbacCoder[pOnePart->PartLevel][CI_TEMP_BEST] );
     303        }
    302304      }
    303305    }
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncSearch.cpp

    r532 r537  
    10671067    }
    10681068#endif
    1069 
    10701069    // save prediction
    10711070    if(default0Save1Load2 == 1)
     
    14271426#if H_3D_DIM_ENC
    14281427                                , Bool        zeroResi
    1429 #endif
    1430                                 )
     1428#endif                               
     1429)
    14311430{
    14321431  UInt    uiFullDepth   = pcCU->getDepth( 0 ) +  uiTrDepth;
     
    14361435 
    14371436#if HHI_RQT_INTRA_SPEEDUP
    1438 #if L0232_RD_PENALTY
    14391437  Int maxTuSize = pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize();
    14401438  Int isIntraSlice = (pcCU->getSlice()->getSliceType() == I_SLICE);
     
    14531451  }
    14541452  if( bCheckFirst && noSplitIntraMaxTuSize )
     1453  {
     1454    bCheckSplit = false;
     1455  }
    14551456#else
    1456   if( bCheckFirst && bCheckFull )
    1457 #endif
    1458   {
    1459     bCheckSplit = false;
    1460   }
    1461 #else
    1462 #if L0232_RD_PENALTY
    14631457  Int maxTuSize = pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize();
    14641458  Int isIntraSlice = (pcCU->getSlice()->getSliceType() == I_SLICE);
     
    14691463  }
    14701464#endif
    1471 #endif
    14721465#if H_3D_DIM
    14731466  if( isDimMode( pcCU->getLumaIntraDir( uiAbsPartIdx ) ) )
     
    14761469  }
    14771470#endif
    1478 
    14791471  Double  dSingleCost   = MAX_DOUBLE;
    14801472#if H_3D_VSO
     
    16671659      //----- determine rate and r-d cost -----
    16681660      UInt uiSingleBits = xGetIntraBitsQT( pcCU, uiTrDepth, uiAbsPartIdx, true, !bLumaOnly, false );
    1669 #if L0232_RD_PENALTY
    16701661      if(m_pcEncCfg->getRDpenalty() && (uiLog2TrSize==5) && !isIntraSlice)
    16711662      {
    16721663        uiSingleBits=uiSingleBits*4;
    16731664      }
    1674 #endif
    16751665#if H_3D_VSO // M40
    16761666      if ( m_pcRdCost->getUseLambdaScaleVSO())     
     
    18231813    }
    18241814  }
    1825 
    18261815#if H_3D_VSO // M42
    18271816  if ( m_pcRdCost->getUseRenModel() && bCheckFull )
     
    18361825  }
    18371826#endif
    1838 
    18391827  ruiDistY += uiSingleDistY;
    18401828  ruiDistC += uiSingleDistC;
     
    27882776       
    27892777        UInt   iModeBits = xModeBitsIntra( pcCU, uiMode, uiPU, uiPartOffset, uiDepth, uiInitTrDepth );
    2790 
    2791      
    27922778#if H_3D_VSO // M35
    27932779#if H_3D_VSO_FIX // This fix should be enabled after verification
     
    29242910    }
    29252911#endif
    2926 
    29272912    //===== check modes (using r-d costs) =====
    29282913#if HHI_RQT_INTRA_SPEEDUP_MOD
     
    31123097      UInt   uiPUDistC = 0;
    31133098      Double dPUCost   = 0.0;
    3114 
    31153099#if H_3D_VSO // M37
    31163100      // reset Model
     
    31643148    {
    31653149#endif
    3166    
    3167     //--- update transform index and cbf ---
     3150        //--- update transform index and cbf ---
    31683151    UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> ( ( pcCU->getDepth(0) + uiInitTrDepth ) << 1 );
    31693152    ::memcpy( pcCU->getTransformIdx()       + uiPartOffset, m_puhQTTempTrIdx,  uiQPartNum * sizeof( UChar ) );
     
    37643747    UInt          uiBitsTempL0[MAX_NUM_REF];
    37653748
    3766 #if L0034_COMBINED_LIST_CLEANUP
    37673749    TComMv        mvValidList1;
    37683750    Int           refIdxValidList1 = 0;
    37693751    UInt          bitsValidList1 = MAX_UINT;
    37703752    UInt          costValidList1 = MAX_UINT;
    3771 #endif
    37723753
    37733754    xGetBlkBits( ePartSize, pcCU->getSlice()->isInterP(), iPartIdx, uiLastMode, uiMbBits);
     
    38213802        uiBitsTemp += m_auiMVPIdxCost[aaiMvpIdx[iRefList][iRefIdxTemp]][AMVP_MAX_NUM_CANDS];
    38223803#if ZERO_MVD_EST
    3823 #if L0034_COMBINED_LIST_CLEANUP
    38243804        if ( iRefList == 0 || pcCU->getSlice()->getList1IdxToList0Idx( iRefIdxTemp ) < 0 )
    3825 #else
    3826         if ((iRefList != 1 || !pcCU->getSlice()->getNoBackPredFlag()) &&
    3827             (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) <= 0 || pcCU->getSlice()->getRefIdxOfLC(eRefPicList, iRefIdxTemp)>=0))
    3828 #endif
    38293805        {
    38303806          uiZeroMvdBitsTemp = uiBitsTemp;
     
    38463822       
    38473823#if GPB_SIMPLE_UNI
    3848 #if L0034_COMBINED_LIST_CLEANUP
    38493824        if ( iRefList == 1 )    // list 1
    38503825        {
     
    38713846        }
    38723847#else
    3873         if ( pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0)
    3874         {
    3875           if ( iRefList && ( pcCU->getSlice()->getNoBackPredFlag() || (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && !pcCU->getSlice()->getNoBackPredFlag() && pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(iRefIdxTemp)>=0 ) ) )
    3876             {
    3877               if ( pcCU->getSlice()->getNoBackPredFlag() )
    3878               {
    3879                 cMvTemp[1][iRefIdxTemp] = cMvTemp[0][iRefIdxTemp];
    3880                 uiCostTemp = uiCostTempL0[iRefIdxTemp];
    3881                 /*first subtract the bit-rate part of the cost of the other list*/
    3882                 uiCostTemp -= m_pcRdCost->getCost( uiBitsTempL0[iRefIdxTemp] );
    3883               }
    3884               else
    3885               {
    3886                 cMvTemp[1][iRefIdxTemp] = cMvTemp[0][pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(iRefIdxTemp)];
    3887                 uiCostTemp = uiCostTempL0[pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(iRefIdxTemp)];
    3888                 /*first subtract the bit-rate part of the cost of the other list*/
    3889                 uiCostTemp -= m_pcRdCost->getCost( uiBitsTempL0[pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(iRefIdxTemp)] );
    3890               }
    3891               /*correct the bit-rate part of the current ref*/
    3892               m_pcRdCost->setPredictor  ( cMvPred[iRefList][iRefIdxTemp] );
    3893               uiBitsTemp += m_pcRdCost->getBits( cMvTemp[1][iRefIdxTemp].getHor(), cMvTemp[1][iRefIdxTemp].getVer() );
    3894               /*calculate the correct cost*/
    3895               uiCostTemp += m_pcRdCost->getCost( uiBitsTemp );
    3896             }
    3897             else
    3898             {
    3899               xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp );
    3900             }
    3901         }
    3902         else
    3903         {
    3904           if (iRefList && pcCU->getSlice()->getNoBackPredFlag())
    3905           {
    3906             uiCostTemp = MAX_UINT;
    3907             cMvTemp[1][iRefIdxTemp] = cMvTemp[0][iRefIdxTemp];
    3908           }
    3909           else
    3910           {
    3911             xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp );
    3912           }       
    3913         }
    3914 #endif
    3915 #else
    39163848        xMotionEstimation ( pcCU, pcOrgYuv, iPartIdx, eRefPicList, &cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp );
    39173849#endif
     
    39193851        xCheckBestMVP(pcCU, eRefPicList, cMvTemp[iRefList][iRefIdxTemp], cMvPred[iRefList][iRefIdxTemp], aaiMvpIdx[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp);
    39203852
    3921 #if L0034_COMBINED_LIST_CLEANUP
    39223853        if ( iRefList == 0 )
    39233854        {
     
    39443875          refIdxValidList1 = iRefIdxTemp;
    39453876        }
    3946 #else
    3947         if(pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && !pcCU->getSlice()->getNoBackPredFlag())
    3948         {
    3949           if(iRefList==REF_PIC_LIST_0)
    3950           {
    3951             uiCostTempL0[iRefIdxTemp] = uiCostTemp;
    3952             uiBitsTempL0[iRefIdxTemp] = uiBitsTemp;
    3953             if(pcCU->getSlice()->getRefIdxOfLC(REF_PIC_LIST_0, iRefIdxTemp)<0)
    3954             {
    3955               uiCostTemp = MAX_UINT;
    3956             }
    3957           }
    3958           else
    3959           {
    3960             if(pcCU->getSlice()->getRefIdxOfLC(REF_PIC_LIST_1, iRefIdxTemp)<0)
    3961             {
    3962               uiCostTemp = MAX_UINT;
    3963             }           
    3964           }
    3965         }
    3966 
    3967         if ( ( iRefList == 0 && uiCostTemp < uiCost[iRefList] ) ||
    3968             ( iRefList == 1 &&  pcCU->getSlice()->getNoBackPredFlag() && iRefIdxTemp == iRefIdx[0] ) ||
    3969             ( iRefList == 1 && (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0) && (iRefIdxTemp==0 || iRefIdxTemp == iRefIdx[0]) && !pcCU->getSlice()->getNoBackPredFlag() && (iRefIdxTemp == pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(iRefIdxTemp)) ) ||
    3970             ( iRefList == 1 && !pcCU->getSlice()->getNoBackPredFlag() && uiCostTemp < uiCost[iRefList] ) )
    3971           {
    3972             uiCost[iRefList] = uiCostTemp;
    3973             uiBits[iRefList] = uiBitsTemp; // storing for bi-prediction
    3974            
    3975             // set motion
    3976             cMv[iRefList]     = cMvTemp[iRefList][iRefIdxTemp];
    3977             iRefIdx[iRefList] = iRefIdxTemp;
    3978             pcCU->getCUMvField(eRefPicList)->setAllMv( cMv[iRefList], ePartSize, uiPartAddr, 0, iPartIdx );
    3979             pcCU->getCUMvField(eRefPicList)->setAllRefIdx( iRefIdx[iRefList], ePartSize, uiPartAddr, 0, iPartIdx );
    3980 
    3981             if(!pcCU->getSlice()->getMvdL1ZeroFlag())
    3982             {
    3983               // storing list 1 prediction signal for iterative bi-directional prediction
    3984               if ( eRefPicList == REF_PIC_LIST_1 )
    3985               {
    3986                 TComYuv*  pcYuvPred = &m_acYuvPred[iRefList];
    3987                 motionCompensation ( pcCU, pcYuvPred, eRefPicList, iPartIdx );
    3988               }
    3989               if ( (pcCU->getSlice()->getNoBackPredFlag() || (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(0)==0 )) && eRefPicList == REF_PIC_LIST_0 )
    3990               {
    3991                 TComYuv*  pcYuvPred = &m_acYuvPred[iRefList];
    3992                 motionCompensation ( pcCU, pcYuvPred, eRefPicList, iPartIdx );
    3993               }
    3994             }
    3995           }
    3996 #endif
    39973877      }
    39983878    }
     
    40583938       
    40593939        Int         iRefList    = iIter % 2;
    4060 #if L0034_COMBINED_LIST_CLEANUP
    40613940        if ( m_pcEncCfg->getUseFastEnc() )
    40623941        {
     
    40813960          motionCompensation ( pcCU, pcYuvPred, RefPicList(1-iRefList), iPartIdx );
    40823961        }
    4083 #else
    4084         if ( m_pcEncCfg->getUseFastEnc() && (pcCU->getSlice()->getNoBackPredFlag() || (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(0)==0 )) )
    4085         {
    4086           iRefList = 1;
    4087         }
    4088 #endif
    40893962        RefPicList  eRefPicList = ( iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0 );
    40903963
     
    42214094    UInt uiMEBits = 0;
    42224095    // Set Motion Field_
    4223 #if L0034_COMBINED_LIST_CLEANUP
    42244096    cMv[1] = mvValidList1;
    42254097    iRefIdx[1] = refIdxValidList1;
    42264098    uiBits[1] = bitsValidList1;
    42274099    uiCost[1] = costValidList1;
    4228 #else
    4229     if ( pcCU->getSlice()->getNoBackPredFlag() || (pcCU->getSlice()->getNumRefIdx(REF_PIC_LIST_C) > 0 && pcCU->getSlice()->getRefIdxOfL0FromRefIdxOfL1(0)==0 ) )
    4230     {
    4231       uiCost[1] = MAX_UINT;
    4232     }
    4233 #endif
    42344100#if AMP_MRG
    42354101    if (bTestNormalMC)
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncSlice.cpp

    r521 r537  
    475475#endif
    476476
    477 #if L0386_DB_METRIC
    478477  if ( m_pcCfg->getDeblockingFilterMetric() )
    479478  {
     
    483482    rpcSlice->setDeblockingFilterTcOffsetDiv2( 0 );
    484483  } else
    485 #endif
    486484  if (rpcSlice->getPPS()->getDeblockingFilterControlPresentFlag())
    487485  {
     
    560558  // store lambda
    561559  slice->setSliceQp( sliceQP );
    562 #if L0033_RC_BUGFIX
    563560  slice->setSliceQpBase ( sliceQP );
    564 #endif
    565561  m_pcRdCost ->setLambda( lambda );
    566562#if WEIGHTED_CHROMA_DISTORTION
     
    876872/** \param rpcPic   picture class
    877873 */
     874#if RATE_CONTROL_INTRA
     875Void TEncSlice::calCostSliceI(TComPic*& rpcPic)
     876{
     877  UInt    uiCUAddr;
     878  UInt    uiStartCUAddr;
     879  UInt    uiBoundingCUAddr;
     880  Int     iSumHad, shift = g_bitDepthY-8, offset = (shift>0)?(1<<(shift-1)):0;;
     881  Double  iSumHadSlice = 0;
     882
     883  rpcPic->getSlice(getSliceIdx())->setSliceSegmentBits(0);
     884  TComSlice* pcSlice            = rpcPic->getSlice(getSliceIdx());
     885  xDetermineStartAndBoundingCUAddr ( uiStartCUAddr, uiBoundingCUAddr, rpcPic, false );
     886
     887  UInt uiEncCUOrder;
     888  uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU());
     889  for( uiEncCUOrder = uiStartCUAddr/rpcPic->getNumPartInCU();
     890       uiEncCUOrder < (uiBoundingCUAddr+(rpcPic->getNumPartInCU()-1))/rpcPic->getNumPartInCU();
     891       uiCUAddr = rpcPic->getPicSym()->getCUOrderMap(++uiEncCUOrder) )
     892  {
     893    // initialize CU encoder
     894    TComDataCU*& pcCU = rpcPic->getCU( uiCUAddr );
     895    pcCU->initCU( rpcPic, uiCUAddr );
     896
     897    Int height  = min( pcSlice->getSPS()->getMaxCUHeight(),pcSlice->getSPS()->getPicHeightInLumaSamples() - uiCUAddr / rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUHeight() );
     898    Int width   = min( pcSlice->getSPS()->getMaxCUWidth(),pcSlice->getSPS()->getPicWidthInLumaSamples() - uiCUAddr % rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUWidth() );
     899
     900    iSumHad = m_pcCuEncoder->updateLCUDataISlice(pcCU, uiCUAddr, width, height);
     901
     902    (m_pcRateCtrl->getRCPic()->getLCU(uiCUAddr)).m_costIntra=(iSumHad+offset)>>shift;
     903    iSumHadSlice += (m_pcRateCtrl->getRCPic()->getLCU(uiCUAddr)).m_costIntra;
     904
     905  }
     906  m_pcRateCtrl->getRCPic()->setTotalIntraCost(iSumHadSlice);
     907}
     908#endif
     909
    878910Void TEncSlice::compressSlice( TComPic*& rpcPic )
    879911{
     
    11611193        Double bpp       = -1.0;
    11621194
     1195#if M0036_RC_IMPROVEMENT
     1196        if ( ( rpcPic->getSlice( 0 )->getSliceType() == I_SLICE && m_pcCfg->getForceIntraQP() ) || !m_pcCfg->getLCULevelRC() )
     1197#else
    11631198        if ( rpcPic->getSlice( 0 )->getSliceType() == I_SLICE || !m_pcCfg->getLCULevelRC() )
     1199#endif
    11641200        {
    11651201          estQP = pcSlice->getSliceQp();
     
    11671203        else
    11681204        {
     1205#if RATE_CONTROL_INTRA
     1206          bpp = m_pcRateCtrl->getRCPic()->getLCUTargetBpp(pcSlice->getSliceType());
     1207          if ( rpcPic->getSlice( 0 )->getSliceType() == I_SLICE)
     1208          {
     1209            estLambda = m_pcRateCtrl->getRCPic()->getLCUEstLambdaAndQP(bpp, pcSlice->getSliceQp(), &estQP);
     1210          }
     1211          else
     1212          {
     1213            estLambda = m_pcRateCtrl->getRCPic()->getLCUEstLambda( bpp );
     1214            estQP     = m_pcRateCtrl->getRCPic()->getLCUEstQP    ( estLambda, pcSlice->getSliceQp() );
     1215          }
     1216#else
    11691217          bpp       = m_pcRateCtrl->getRCPic()->getLCUTargetBpp();
    11701218          estLambda = m_pcRateCtrl->getRCPic()->getLCUEstLambda( bpp );
    11711219          estQP     = m_pcRateCtrl->getRCPic()->getLCUEstQP    ( estLambda, pcSlice->getSliceQp() );
     1220#endif
     1221
    11721222          estQP     = Clip3( -pcSlice->getSPS()->getQpBDOffsetY(), MAX_QP, estQP );
    11731223
    11741224          m_pcRdCost->setLambda(estLambda);
     1225#if M0036_RC_IMPROVEMENT
     1226#if RDOQ_CHROMA_LAMBDA
     1227          // set lambda for RDOQ
     1228          Double weight=m_pcRdCost->getChromaWeight();
     1229          m_pcTrQuant->setLambda( estLambda, estLambda / weight );
     1230#else
     1231          m_pcTrQuant->setLambda( estLambda );
     1232#endif
     1233#endif
    11751234        }
    11761235
    11771236        m_pcRateCtrl->setRCQP( estQP );
    1178 #if L0033_RC_BUGFIX
    11791237        pcCU->getSlice()->setSliceQpBase( estQP );
    1180 #endif
    11811238      }
    11821239#endif
     
    11851242      m_pcCuEncoder->compressCU( pcCU );
    11861243
     1244#if !TICKET_1090_FIX
    11871245#if RATE_CONTROL_LAMBDA_DOMAIN
    11881246      if ( m_pcCfg->getUseRateCtrl() )
    11891247      {
     1248#if !M0036_RC_IMPROVEMENT
    11901249        UInt SAD    = m_pcCuEncoder->getLCUPredictionSAD();
    11911250        Int height  = min( pcSlice->getSPS()->getMaxCUHeight(),pcSlice->getSPS()->getPicHeightInLumaSamples() - uiCUAddr / rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUHeight() );
     
    11941253        MAD = MAD * MAD;
    11951254        ( m_pcRateCtrl->getRCPic()->getLCU(uiCUAddr) ).m_MAD = MAD;
     1255#endif
    11961256
    11971257        Int actualQP        = g_RCInvalidQPValue;
     
    12171277        }
    12181278        m_pcRdCost->setLambda(oldLambda);
    1219 
     1279#if RATE_CONTROL_INTRA
     1280        m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda,
     1281          pcCU->getSlice()->getSliceType() == I_SLICE ? 0 : m_pcCfg->getLCULevelRC() );
     1282#else
    12201283        m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda, m_pcCfg->getLCULevelRC() );
    1221       }
     1284#endif
     1285      }
     1286#endif
    12221287#endif
    12231288     
     
    12531318        }
    12541319      }
     1320
     1321#if TICKET_1090_FIX
     1322#if RATE_CONTROL_LAMBDA_DOMAIN
     1323      if ( m_pcCfg->getUseRateCtrl() )
     1324      {
     1325#if !M0036_RC_IMPROVEMENT
     1326        UInt SAD    = m_pcCuEncoder->getLCUPredictionSAD();
     1327        Int height  = min( pcSlice->getSPS()->getMaxCUHeight(),pcSlice->getSPS()->getPicHeightInLumaSamples() - uiCUAddr / rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUHeight() );
     1328        Int width   = min( pcSlice->getSPS()->getMaxCUWidth(),pcSlice->getSPS()->getPicWidthInLumaSamples() - uiCUAddr % rpcPic->getFrameWidthInCU() * pcSlice->getSPS()->getMaxCUWidth() );
     1329        Double MAD = (Double)SAD / (Double)(height * width);
     1330        MAD = MAD * MAD;
     1331        ( m_pcRateCtrl->getRCPic()->getLCU(uiCUAddr) ).m_MAD = MAD;
     1332#endif
     1333
     1334        Int actualQP        = g_RCInvalidQPValue;
     1335        Double actualLambda = m_pcRdCost->getLambda();
     1336        Int actualBits      = pcCU->getTotalBits();
     1337        Int numberOfEffectivePixels    = 0;
     1338        for ( Int idx = 0; idx < rpcPic->getNumPartInCU(); idx++ )
     1339        {
     1340          if ( pcCU->getPredictionMode( idx ) != MODE_NONE && ( !pcCU->isSkipped( idx ) ) )
     1341          {
     1342            numberOfEffectivePixels = numberOfEffectivePixels + 16;
     1343            break;
     1344          }
     1345        }
     1346
     1347        if ( numberOfEffectivePixels == 0 )
     1348        {
     1349          actualQP = g_RCInvalidQPValue;
     1350        }
     1351        else
     1352        {
     1353          actualQP = pcCU->getQP( 0 );
     1354        }
     1355        m_pcRdCost->setLambda(oldLambda);
     1356
     1357#if RATE_CONTROL_INTRA
     1358        m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda,
     1359          pcCU->getSlice()->getSliceType() == I_SLICE ? 0 : m_pcCfg->getLCULevelRC() );
     1360#else
     1361        m_pcRateCtrl->getRCPic()->updateAfterLCU( m_pcRateCtrl->getRCPic()->getLCUCoded(), actualBits, actualQP, actualLambda, m_pcCfg->getLCULevelRC() );
     1362#endif
     1363      }
     1364#endif
     1365#endif
    12551366    }
    12561367    // other case: encodeCU is not called
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncSlice.h

    r481 r537  
    131131  Void    precompressSlice    ( TComPic*& rpcPic                                );      ///< precompress slice for multi-loop opt.
    132132  Void    compressSlice       ( TComPic*& rpcPic                                );      ///< analysis stage of slice
     133#if RATE_CONTROL_INTRA
     134  Void    calCostSliceI       ( TComPic*& rpcPic );
     135#endif
    133136  Void    encodeSlice         ( TComPic*& rpcPic, TComOutputBitstream* pcSubstreams  );
    134137 
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncTop.cpp

    r534 r537  
    293293  // This seems to be incorrect, but irrelevant for the MV-HEVC
    294294  *(m_cVPS->getPTL()) = *m_cSPS.getPTL();
    295 #if L0043_TIMING_INFO
    296295  m_cVPS->getTimingInfo()->setTimingInfoPresentFlag       ( false );
    297 #endif
    298296#else
    299297  *m_cVPS.getPTL() = *m_cSPS.getPTL();
    300 
    301 #if L0043_TIMING_INFO
    302298  m_cVPS.getTimingInfo()->setTimingInfoPresentFlag       ( false );
    303 #endif
    304299#endif
    305300  // initialize PPS
     
    532527  profileTierLevel.setProfileIdc(m_profile);
    533528  profileTierLevel.setProfileCompatibilityFlag(m_profile, 1);
    534 #if L0046_CONSTRAINT_FLAGS
    535529  profileTierLevel.setProgressiveSourceFlag(m_progressiveSourceFlag);
    536530  profileTierLevel.setInterlacedSourceFlag(m_interlacedSourceFlag);
    537531  profileTierLevel.setNonPackedConstraintFlag(m_nonPackedConstraintFlag);
    538532  profileTierLevel.setFrameOnlyConstraintFlag(m_frameOnlyConstraintFlag);
    539 #endif
    540533 
    541534  if (m_profile == Profile::MAIN10 && g_bitDepthY == 8 && g_bitDepthC == 8)
     
    584577
    585578  m_cSPS.setMaxTrSize   ( 1 << m_uiQuadtreeTULog2MaxSize );
    586 #if !L0034_COMBINED_LIST_CLEANUP
    587   m_cSPS.setUseLComb    ( m_bUseLComb           );
    588 #endif
    589579 
    590580  Int i;
     
    651641    pcVUI->setFieldSeqFlag(false);
    652642    pcVUI->setHrdParametersPresentFlag(false);
    653 #if L0043_TIMING_INFO
    654643    pcVUI->getTimingInfo()->setPocProportionalToTimingFlag(getPocProportionalToTimingFlag());
    655644    pcVUI->getTimingInfo()->setNumTicksPocDiffOneMinus1   (getNumTicksPocDiffOneMinus1()   );
    656 #else
    657     pcVUI->setPocProportionalToTimingFlag(getPocProportionalToTimingFlag());
    658     pcVUI->setNumTicksPocDiffOneMinus1   (getNumTicksPocDiffOneMinus1()   );
    659 #endif
    660645    pcVUI->setBitstreamRestrictionFlag(getBitstreamRestrictionFlag());
    661646    pcVUI->setTilesFixedStructureFlag(getTilesFixedStructureFlag());
     
    790775    }
    791776  }
    792 #if L0323_LIMIT_DEFAULT_LIST_SIZE
    793777  assert(bestPos <= 15);
    794 #endif
    795778  m_cPPS.setNumRefIdxL0DefaultActive(bestPos);
    796779  m_cPPS.setNumRefIdxL1DefaultActive(bestPos);
     
    10471030}
    10481031
    1049 #if L0208_SOP_DESCRIPTION_SEI
    10501032Int TEncTop::getReferencePictureSetIdxForSOP(TComSlice* slice, Int POCCurr, Int GOPid )
    10511033{
     
    10771059  return rpsIdx;
    10781060}
    1079 #endif
    10801061
    10811062Void  TEncTop::xInitPPSforTiles()
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibEncoder/TEncTop.h

    r479 r537  
    188188  TComPPS*                getPPS                () { return  &m_cPPS;                 }
    189189  Void selectReferencePictureSet(TComSlice* slice, Int POCCurr, Int GOPid );
    190 #if L0208_SOP_DESCRIPTION_SEI
    191190  Int getReferencePictureSetIdxForSOP(TComSlice* slice, Int POCCurr, Int GOPid );
    192 #endif
    193191  TComScalingList*        getScalingList        () { return  &m_scalingList;         }
    194192#if H_MV
Note: See TracChangeset for help on using the changeset viewer.