Ignore:
Timestamp:
28 Jun 2013, 00:40:00 (11 years ago)
Author:
seregin
Message:

update to HM11.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncCavlc.cpp

    r300 r302  
    3939#include "TEncCavlc.h"
    4040#include "SEIwrite.h"
    41 #include <iostream>
     41
    4242//! \ingroup TLibEncoder
    4343//! \{
     
    163163  WRITE_UVLC( pcPPS->getSPSId(),                             "pps_seq_parameter_set_id" );
    164164  WRITE_FLAG( pcPPS->getDependentSliceSegmentsEnabledFlag()    ? 1 : 0, "dependent_slice_segments_enabled_flag" );
    165 #if L0255_MOVE_PPS_FLAGS
    166165  WRITE_FLAG( pcPPS->getOutputFlagPresentFlag() ? 1 : 0,     "output_flag_present_flag" );
    167166  WRITE_CODE( pcPPS->getNumExtraSliceHeaderBits(), 3,        "num_extra_slice_header_bits");
    168 #endif
    169167  WRITE_FLAG( pcPPS->getSignHideFlag(), "sign_data_hiding_flag" );
    170168  WRITE_FLAG( pcPPS->getCabacInitPresentFlag() ? 1 : 0,   "cabac_init_present_flag" );
     
    186184  WRITE_FLAG( pcPPS->getUseWP() ? 1 : 0,  "weighted_pred_flag" );   // Use of Weighting Prediction (P_SLICE)
    187185  WRITE_FLAG( pcPPS->getWPBiPred() ? 1 : 0, "weighted_bipred_flag" );  // Use of Weighting Bi-Prediction (B_SLICE)
    188 #if !L0255_MOVE_PPS_FLAGS
    189   WRITE_FLAG( pcPPS->getOutputFlagPresentFlag() ? 1 : 0,  "output_flag_present_flag" );
    190 #endif
    191186  WRITE_FLAG( pcPPS->getTransquantBypassEnableFlag() ? 1 : 0, "transquant_bypass_enable_flag" );
    192187  WRITE_FLAG( pcPPS->getTilesEnabledFlag()             ? 1 : 0, "tiles_enabled_flag" );
     
    235230  WRITE_FLAG( pcPPS->getListsModificationPresentFlag(), "lists_modification_present_flag");
    236231  WRITE_UVLC( pcPPS->getLog2ParallelMergeLevelMinus2(), "log2_parallel_merge_level_minus2");
    237 #if !L0255_MOVE_PPS_FLAGS
    238   WRITE_CODE( pcPPS->getNumExtraSliceHeaderBits(), 3, "num_extra_slice_header_bits");
    239 #endif
    240232  WRITE_FLAG( pcPPS->getSliceHeaderExtensionPresentFlag() ? 1 : 0, "slice_segment_header_extension_present_flag");
    241233  WRITE_FLAG( 0, "pps_extension_flag" );
     
    296288    WRITE_UVLC(defaultDisplayWindow.getWindowBottomOffset(),    "def_disp_win_bottom_offset");
    297289  }
    298 #if L0043_TIMING_INFO
    299290  TimingInfo *timingInfo = pcVUI->getTimingInfo();
    300291  WRITE_FLAG(timingInfo->getTimingInfoPresentFlag(),          "vui_timing_info_present_flag");
     
    308299      WRITE_UVLC(timingInfo->getNumTicksPocDiffOneMinus1(),   "vui_num_ticks_poc_diff_one_minus1");
    309300    }
    310 #endif
    311301  WRITE_FLAG(pcVUI->getHrdParametersPresentFlag(),              "hrd_parameters_present_flag");
    312302  if( pcVUI->getHrdParametersPresentFlag() )
     
    314304    codeHrdParameters(pcVUI->getHrdParameters(), 1, pcSPS->getMaxTLayers() - 1 );
    315305  }
    316 #if L0043_TIMING_INFO
    317   }
    318 #endif
    319 #if !L0043_TIMING_INFO
    320   WRITE_FLAG( pcVUI->getPocProportionalToTimingFlag(), "poc_proportional_to_timing_flag" );
    321   if( pcVUI->getPocProportionalToTimingFlag() && pcVUI->getHrdParameters()->getTimingInfoPresentFlag() )
    322   {
    323     WRITE_UVLC( pcVUI->getNumTicksPocDiffOneMinus1(), "num_ticks_poc_diff_one_minus1" );
    324   }
    325 #endif
     306  }
    326307
    327308  WRITE_FLAG(pcVUI->getBitstreamRestrictionFlag(),              "bitstream_restriction_flag");
     
    337318    WRITE_FLAG(pcVUI->getMotionVectorsOverPicBoundariesFlag(),  "motion_vectors_over_pic_boundaries_flag");
    338319    WRITE_FLAG(pcVUI->getRestrictedRefPicListsFlag(),           "restricted_ref_pic_lists_flag");
    339 #if L0043_MSS_IDC
    340320    WRITE_UVLC(pcVUI->getMinSpatialSegmentationIdc(),           "min_spatial_segmentation_idc");
    341 #else
    342     WRITE_CODE(pcVUI->getMinSpatialSegmentationIdc(),        8, "min_spatial_segmentation_idc");
    343 #endif
    344321    WRITE_UVLC(pcVUI->getMaxBytesPerPicDenom(),                 "max_bytes_per_pic_denom");
    345322    WRITE_UVLC(pcVUI->getMaxBitsPerMinCuDenom(),                "max_bits_per_mincu_denom");
     
    353330  if( commonInfPresentFlag )
    354331  {
    355 #if !L0043_TIMING_INFO
    356     WRITE_FLAG( hrd->getTimingInfoPresentFlag() ? 1 : 0,        "timing_info_present_flag" );
    357     if( hrd->getTimingInfoPresentFlag() )
    358     {
    359       WRITE_CODE( hrd->getNumUnitsInTick(), 32,                  "num_units_in_tick" );
    360       WRITE_CODE( hrd->getTimeScale(),      32,                  "time_scale" );
    361     }
    362 #endif
    363332    WRITE_FLAG( hrd->getNalHrdParametersPresentFlag() ? 1 : 0 ,  "nal_hrd_parameters_present_flag" );
    364333    WRITE_FLAG( hrd->getVclHrdParametersPresentFlag() ? 1 : 0 ,  "vcl_hrd_parameters_present_flag" );
     
    371340        WRITE_CODE( hrd->getDuCpbRemovalDelayLengthMinus1(), 5,  "du_cpb_removal_delay_length_minus1" );
    372341        WRITE_FLAG( hrd->getSubPicCpbParamsInPicTimingSEIFlag() ? 1 : 0, "sub_pic_cpb_params_in_pic_timing_sei_flag" );
    373 #if L0044_DU_DPB_OUTPUT_DELAY_HRD
    374342        WRITE_CODE( hrd->getDpbOutputDelayDuLengthMinus1(), 5,   "dpb_output_delay_du_length_minus1"  );
    375 #endif
    376343      }
    377344      WRITE_CODE( hrd->getBitRateScale(), 4,                     "bit_rate_scale" );
     
    402369      WRITE_UVLC( hrd->getPicDurationInTcMinus1( i ),           "elemental_duration_in_tc_minus1");
    403370    }
    404 #if L0372
    405371    else
    406372    {
     
    411377      WRITE_UVLC( hrd->getCpbCntMinus1( i ),                      "cpb_cnt_minus1");
    412378    }
    413 #else
    414     WRITE_FLAG( hrd->getLowDelayHrdFlag( i ) ? 1 : 0,           "low_delay_hrd_flag");
    415     WRITE_UVLC( hrd->getCpbCntMinus1( i ),                      "cpb_cnt_minus1");
    416 #endif
    417379   
    418380    for( nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ )
     
    427389          if( hrd->getSubPicCpbParamsPresentFlag() )
    428390          {
    429 #if L0363_DU_BIT_RATE
     391            WRITE_UVLC( hrd->getDuCpbSizeValueMinus1( i, j, nalOrVcl ), "cpb_size_du_value_minus1"); 
    430392            WRITE_UVLC( hrd->getDuBitRateValueMinus1( i, j, nalOrVcl ), "bit_rate_du_value_minus1");
    431 #endif
    432             WRITE_UVLC( hrd->getDuCpbSizeValueMinus1( i, j, nalOrVcl ), "cpb_size_du_value_minus1"); 
    433393          }
    434394          WRITE_FLAG( hrd->getCbrFlag( i, j, nalOrVcl ) ? 1 : 0, "cbr_flag");
     
    486446  for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++)
    487447  {
    488 #if L0323_DPB
    489448    WRITE_UVLC( pcSPS->getMaxDecPicBuffering(i) - 1,       "sps_max_dec_pic_buffering_minus1[i]" );
    490 #else
    491     WRITE_UVLC( pcSPS->getMaxDecPicBuffering(i),           "sps_max_dec_pic_buffering[i]" );
    492 #endif
    493449    WRITE_UVLC( pcSPS->getNumReorderPics(i),               "sps_num_reorder_pics[i]" );
    494     WRITE_UVLC( pcSPS->getMaxLatencyIncrease(i),           "sps_max_latency_increase[i]" );
     450    WRITE_UVLC( pcSPS->getMaxLatencyIncrease(i),           "sps_max_latency_increase_plus1[i]" );
    495451    if (!subLayerOrderingInfoPresentFlag)
    496452    {
     
    639595  WRITE_CODE( 0xffff,                              16,        "vps_reserved_ffff_16bits" );
    640596  codePTL( pcVPS->getPTL(), true, pcVPS->getMaxTLayers() - 1 );
    641 #if SIGNAL_BITRATE_PICRATE_IN_VPS
    642   codeBitratePicRateInfo(pcVPS->getBitratePicrateInfo(), 0, pcVPS->getMaxTLayers() - 1);
    643 #endif 
    644597  const Bool subLayerOrderingInfoPresentFlag = 1;
    645598  WRITE_FLAG(subLayerOrderingInfoPresentFlag,              "vps_sub_layer_ordering_info_present_flag");
    646599  for(UInt i=0; i <= pcVPS->getMaxTLayers()-1; i++)
    647600  {
    648 #if L0323_DPB
    649601    WRITE_UVLC( pcVPS->getMaxDecPicBuffering(i) - 1,       "vps_max_dec_pic_buffering_minus1[i]" );
    650 #else
    651     WRITE_UVLC( pcVPS->getMaxDecPicBuffering(i),           "vps_max_dec_pic_buffering[i]" );
    652 #endif
    653602    WRITE_UVLC( pcVPS->getNumReorderPics(i),               "vps_num_reorder_pics[i]" );
    654     WRITE_UVLC( pcVPS->getMaxLatencyIncrease(i),           "vps_max_latency_increase[i]" );
     603    WRITE_UVLC( pcVPS->getMaxLatencyIncrease(i),           "vps_max_latency_increase_plus1[i]" );
    655604    if (!subLayerOrderingInfoPresentFlag)
    656605    {
     
    693642  pcVPS->deriveLayerIdListVariables();
    694643#endif
    695 #if L0043_TIMING_INFO
    696644  TimingInfo *timingInfo = pcVPS->getTimingInfo();
    697645  WRITE_FLAG(timingInfo->getTimingInfoPresentFlag(),          "vps_timing_info_present_flag");
     
    705653      WRITE_UVLC(timingInfo->getNumTicksPocDiffOneMinus1(),   "vps_num_ticks_poc_diff_one_minus1");
    706654    }
    707 #endif
    708655    pcVPS->setNumHrdParameters( 0 );
    709656    WRITE_UVLC( pcVPS->getNumHrdParameters(),                 "vps_num_hrd_parameters" );
     
    724671      codeHrdParameters(pcVPS->getHrdParameters(i), pcVPS->getCprmsPresentFlag( i ), pcVPS->getMaxTLayers() - 1);
    725672    }
    726 #if L0043_TIMING_INFO
    727   }
    728 #endif
     673  }
    729674#if !VPS_EXTNS
    730675  WRITE_FLAG( 0,                     "vps_extension_flag" );
     
    994939     
    995940#if FIX1071
    996       // Deal with bitstream restriction stating that:
    997       // If the current picture is a BLA or CRA picture, the value of NumPocTotalCurr shall be equal to 0.
     941      // check for bitstream restriction stating that:
     942      // If the current picture is a BLA or CRA picture, the value of NumPocTotalCurr shall be equal to 0.
    998943      // Ideally this process should not be repeated for each slice in a picture
    999       TComReferencePictureSet altRps;
    1000       Bool useAltRps = false;
    1001944#if SVC_EXTENSION
    1002945      if( pcSlice->getLayerId() == 0 )
    1003946#endif
    1004       if (pcSlice->getRapPicFlag())
    1005       {
    1006         for (Int picIdx = 0; !useAltRps && picIdx < rps->getNumberOfPictures(); picIdx++)
    1007         {
    1008           useAltRps = rps->getUsed(picIdx);
    1009         }
    1010         if (useAltRps)
    1011         {
    1012           memcpy(&altRps, rps, sizeof(TComReferencePictureSet));
    1013           rps = &altRps;
    1014           for (Int picIdx = 0; picIdx < rps->getNumberOfPictures(); picIdx++)
    1015           {
    1016             rps->setUsed(picIdx, false);
    1017           }
    1018         }
    1019       }
    1020 
    1021       if(pcSlice->getRPSidx() < 0 || useAltRps)
    1022 #else
     947      if (pcSlice->isIRAP())
     948      {
     949        for (Int picIdx = 0; picIdx < rps->getNumberOfPictures(); picIdx++)
     950        {
     951          assert (!rps->getUsed(picIdx));
     952        }
     953      }
     954#endif
     955
    1023956      if(pcSlice->getRPSidx() < 0)
    1024 #endif
    1025957      {
    1026958        WRITE_FLAG( 0, "short_term_ref_pic_set_sps_flag");
     
    11141046        }
    11151047      }
    1116 
    11171048      if (pcSlice->getSPS()->getTMVPFlagsPresent())
    11181049      {
     
    13261257    }
    13271258  }
    1328 
    13291259  if(pcSlice->getPPS()->getSliceHeaderExtensionPresentFlag())
    13301260  {
     
    13411271  WRITE_CODE( pcPTL->getGeneralPTL()->getLevelIdc(), 8, "general_level_idc" );
    13421272
    1343 #if L0363_BYTE_ALIGN
    13441273  for (Int i = 0; i < maxNumSubLayersMinus1; i++)
    13451274  {
     
    13591288    }
    13601289  }
    1361 #endif
    13621290 
    13631291  for(Int i = 0; i < maxNumSubLayersMinus1; i++)
    13641292  {
    1365 #if !L0363_BYTE_ALIGN
    1366     if(profilePresentFlag)
    1367     {
    1368       WRITE_FLAG( pcPTL->getSubLayerProfilePresentFlag(i), "sub_layer_profile_present_flag[i]" );
    1369     }
    1370 
    1371     WRITE_FLAG( pcPTL->getSubLayerLevelPresentFlag(i),   "sub_layer_level_present_flag[i]" );
    1372 #endif
    13731293    if( profilePresentFlag && pcPTL->getSubLayerProfilePresentFlag(i) )
    13741294    {
     
    13911311  }
    13921312
    1393 #if L0046_CONSTRAINT_FLAGS
    13941313  WRITE_FLAG(ptl->getProgressiveSourceFlag(),   "general_progressive_source_flag");
    13951314  WRITE_FLAG(ptl->getInterlacedSourceFlag(),    "general_interlaced_source_flag");
     
    14001319  WRITE_CODE(0 , 16, "XXX_reserved_zero_44bits[16..31]");
    14011320  WRITE_CODE(0 , 12, "XXX_reserved_zero_44bits[32..43]");
    1402 #elif L0363_MORE_BITS
    1403   WRITE_CODE(0 , 16, "XXX_reserved_zero_48bits[0..15]");
    1404   WRITE_CODE(0 , 16, "XXX_reserved_zero_48bits[16..31]");
    1405   WRITE_CODE(0 , 16, "XXX_reserved_zero_48bits[32..47]");
    1406 #else
    1407   WRITE_CODE(0 , 16, "XXX_reserved_zero_16bits[]");
    1408 #endif
    1409 }
    1410 #if SIGNAL_BITRATE_PICRATE_IN_VPS
    1411 Void TEncCavlc::codeBitratePicRateInfo(TComBitRatePicRateInfo *info, Int tempLevelLow, Int tempLevelHigh)
    1412 {
    1413   for(Int i = tempLevelLow; i <= tempLevelHigh; i++)
    1414   {
    1415     WRITE_FLAG( info->getBitRateInfoPresentFlag(i),  "bit_rate_info_present_flag[i]" );
    1416     WRITE_FLAG( info->getPicRateInfoPresentFlag(i),  "pic_rate_info_present_flag[i]" );
    1417     if(info->getBitRateInfoPresentFlag(i))
    1418     {
    1419       WRITE_CODE( info->getAvgBitRate(i), 16, "avg_bit_rate[i]" );
    1420       WRITE_CODE( info->getMaxBitRate(i), 16, "max_bit_rate[i]" );
    1421     }
    1422     if(info->getPicRateInfoPresentFlag(i))
    1423     {
    1424       WRITE_CODE( info->getConstantPicRateIdc(i),  2, "constant_pic_rate_idc[i]" );
    1425       WRITE_CODE( info->getAvgPicRate(i),         16, "avg_pic_rate[i]"          );
    1426     }
    1427   }
    1428 }
    1429 #endif 
     1321}
     1322
    14301323/**
    14311324 - write wavefront substreams sizes for the slice header.
     
    14971390  for (UInt idx=0; idx<numEntryPointOffsets; idx++)
    14981391  {
    1499 #if L0116_ENTRY_POINT
    15001392    WRITE_CODE(entryPointOffset[ idx ]-1, offsetLenMinus1+1, "entry_point_offset_minus1");
    1501 #else
    1502     WRITE_CODE(entryPointOffset[ idx ], offsetLenMinus1+1, "entry_point_offset");
    1503 #endif
    15041393  }
    15051394
Note: See TracChangeset for help on using the changeset viewer.