Changeset 302 in SHVCSoftware for branches/SHM-2.1-dev/source/Lib/TLibDecoder


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

update to HM11.0

Location:
branches/SHM-2.1-dev/source/Lib/TLibDecoder
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-2.1-dev/source/Lib/TLibDecoder/SEIread.cpp

    r292 r302  
    9090    fprintf( g_hTrace, "=========== Decoding Unit Information SEI message ===========\n");
    9191    break;
    92 #if J0149_TONE_MAPPING_SEI
    9392  case SEI::TONE_MAPPING_INFO:
    9493    fprintf( g_hTrace, "===========Tone Mapping Info SEI message ===========\n");
    9594    break;
    96 #endif
    9795#if M0043_LAYERS_PRESENT_SEI
    9896  case SEI::LAYERS_PRESENT:
     
    10098    break;
    10199#endif
    102 #if L0208_SOP_DESCRIPTION_SEI
    103100  case SEI::SOP_DESCRIPTION:
    104101    fprintf( g_hTrace, "=========== SOP Description SEI message ===========\n");
    105102    break;
    106 #endif
    107 #if K0180_SCALABLE_NESTING_SEI
    108103  case SEI::SCALABLE_NESTING:
    109104    fprintf( g_hTrace, "=========== Scalable Nesting SEI message ===========\n");
    110105    break;
    111 #endif
    112106  default:
    113107    fprintf( g_hTrace, "=========== Unknown SEI message ===========\n");
     
    251245      xParseSEIGradualDecodingRefreshInfo((SEIGradualDecodingRefreshInfo&) *sei, payloadSize);
    252246      break;
    253 #if J0149_TONE_MAPPING_SEI
    254247    case SEI::TONE_MAPPING_INFO:
    255248      sei = new SEIToneMappingInfo;
    256249      xParseSEIToneMappingInfo((SEIToneMappingInfo&) *sei, payloadSize);
    257250      break;
    258 #endif
    259251#if M0043_LAYERS_PRESENT_SEI
    260252    case SEI::LAYERS_PRESENT:
     
    270262      break;
    271263#endif
    272 #if L0208_SOP_DESCRIPTION_SEI
    273264    case SEI::SOP_DESCRIPTION:
    274265      sei = new SEISOPDescription;
    275266      xParseSEISOPDescription((SEISOPDescription&) *sei, payloadSize);
    276267      break;
    277 #endif
    278 #if K0180_SCALABLE_NESTING_SEI
    279268    case SEI::SCALABLE_NESTING:
    280269      sei = new SEIScalableNesting;
     
    285274#endif
    286275      break;
    287 #endif
    288276    default:
    289277      for (UInt i = 0; i < payloadSize; i++)
     
    299287    switch (payloadType)
    300288    {
    301 #if L0363_SEI_ALLOW_SUFFIX
    302289      case SEI::USER_DATA_UNREGISTERED:
    303290        sei = new SEIuserDataUnregistered;
    304291        xParseSEIuserDataUnregistered((SEIuserDataUnregistered&) *sei, payloadSize);
    305292        break;
    306 #endif
    307293      case SEI::DECODED_PICTURE_HASH:
    308294        sei = new SEIDecodedPictureHash;
     
    436422  UInt val;
    437423  READ_CODE(4, val, "active_vps_id");      sei.activeVPSId = val;
    438 #if L0047_APS_FLAGS
    439424  READ_FLAG( val, "full_random_access_flag");  sei.m_fullRandomAccessFlag = val ? true : false;
    440425  READ_FLAG( val, "no_param_set_update_flag"); sei.m_noParamSetUpdateFlag = val ? true : false;
    441 #endif
    442426  READ_UVLC(   val, "num_sps_ids_minus1"); sei.numSpsIdsMinus1 = val;
    443427
     
    472456    sei.m_duSptCpbRemovalDelay = 0;
    473457  }
    474 #if L0044_DU_DPB_OUTPUT_DELAY_HRD
    475458  READ_FLAG( val, "dpb_output_du_delay_present_flag"); sei.m_dpbOutputDuDelayPresentFlag = val ? true : false;
    476459  if(sei.m_dpbOutputDuDelayPresentFlag)
     
    479462    sei.m_picSptDpbOutputDuDelay = val;
    480463  }
    481 #endif
    482464  xParseByteAlign();
    483465}
     
    496478    READ_FLAG( code, "rap_cpb_params_present_flag" );                   sei.m_rapCpbParamsPresentFlag = code;
    497479  }
    498 #if L0328_SPLICING
    499480  //read splicing flag and cpb_removal_delay_delta
    500481  READ_FLAG( code, "concatenation_flag");
     
    502483  READ_CODE( ( pHRD->getCpbRemovalDelayLengthMinus1() + 1 ), code, "au_cpb_removal_delay_delta_minus1" );
    503484  sei.m_auCpbRemovalDelayDelta = code + 1;
    504 #endif
    505 #if L0044_CPB_DPB_DELAY_OFFSET
    506485  if( sei.m_rapCpbParamsPresentFlag )
    507486  {
     
    509488    READ_CODE( pHRD->getDpbOutputDelayLengthMinus1()  + 1, code, "dpb_delay_offset" );      sei.m_dpbDelayOffset = code;
    510489  }
    511 #endif
    512490  for( nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ )
    513491  {
     
    541519  TComHRD *hrd = vui->getHrdParameters();
    542520
    543 #if !L0045_CONDITION_SIGNALLING
    544   // This condition was probably OK before the pic_struct, progressive_source_idc, duplicate_flag were added
    545   if( !hrd->getNalHrdParametersPresentFlag() && !hrd->getVclHrdParametersPresentFlag() )
    546   {
    547     return;
    548   }
    549 #endif
    550 
    551521  if( vui->getFrameFieldInfoPresentFlag() )
    552522  {
    553523    READ_CODE( 4, code, "pic_struct" );             sei.m_picStruct            = code;
    554 #if L0046_RENAME_PROG_SRC_IDC
    555524    READ_CODE( 2, code, "source_scan_type" );       sei.m_sourceScanType = code;
    556 #else
    557     READ_CODE( 2, code, "progressive_source_idc" ); sei.m_progressiveSourceIdc = code;
    558 #endif
    559525    READ_FLAG(    code, "duplicate_flag" );         sei.m_duplicateFlag        = ( code == 1 ? true : false );
    560526  }
    561527
    562 #if L0045_CONDITION_SIGNALLING
    563528  if( hrd->getCpbDpbDelaysPresentFlag())
    564529  {
    565 #endif
    566530    READ_CODE( ( hrd->getCpbRemovalDelayLengthMinus1() + 1 ), code, "au_cpb_removal_delay_minus1" );
    567531    sei.m_auCpbRemovalDelay = code + 1;
     
    569533    sei.m_picDpbOutputDelay = code;
    570534
    571 #if L0044_DU_DPB_OUTPUT_DELAY_HRD
    572535    if(hrd->getSubPicCpbParamsPresentFlag())
    573536    {
     
    575538      sei.m_picDpbOutputDuDelay = code;
    576539    }
    577 #endif
    578540    if( hrd->getSubPicCpbParamsPresentFlag() && hrd->getSubPicCpbParamsInPicTimingSEIFlag() )
    579541    {
     
    609571      }
    610572    }
    611 #if L0045_CONDITION_SIGNALLING
    612   }
    613 #endif
     573  }
    614574  xParseByteAlign();
    615575}
     
    632592  {
    633593    READ_CODE( 7, val, "frame_packing_arrangement_type" );          sei.m_arrangementType = val;
    634 #if L0444_FPA_TYPE
    635594    assert((sei.m_arrangementType > 2) && (sei.m_arrangementType < 6) );
    636 #endif
    637595    READ_FLAG( val, "quincunx_sampling_flag" );                     sei.m_quincunxSamplingFlag = val;
    638596
     
    654612
    655613    READ_CODE( 8, val, "frame_packing_arrangement_reserved_byte" );   sei.m_arrangementReservedByte = val;
    656 #if L0045_PERSISTENCE_FLAGS
    657614    READ_FLAG( val,  "frame_packing_arrangement_persistence_flag" );  sei.m_arrangementPersistenceFlag = val ? true : false;
    658 #else
    659     READ_UVLC( val, "frame_packing_arrangement_repetition_period" );  sei.m_arrangementRepetetionPeriod = val;
    660 #endif
    661615  }
    662616  READ_FLAG( val, "upsampled_aspect_ratio" );                       sei.m_upsampledAspectRatio = val;
     
    674628    READ_FLAG( val,     "ver_flip" );                              sei.verFlip               = val;
    675629    READ_CODE( 16, val, "anticlockwise_rotation" );                sei.anticlockwiseRotation = val;
    676 #if L0045_PERSISTENCE_FLAGS
    677630    READ_FLAG( val,     "display_orientation_persistence_flag" );  sei.persistenceFlag       = val;
    678 #else
    679     READ_UVLC( val,     "display_orientation_repetition_period" ); sei.repetitionPeriod      = val;
    680 #endif
    681 #if !REMOVE_SINGLE_SEI_EXTENSION_FLAGS
    682     READ_FLAG( val,     "display_orientation_extension_flag" );    sei.extensionFlag         = val;
    683     assert( !sei.extensionFlag );
    684 #endif
    685631  }
    686632  xParseByteAlign();
     
    702648}
    703649
    704 #if J0149_TONE_MAPPING_SEI
    705650Void SEIReader::xParseSEIToneMappingInfo(SEIToneMappingInfo& sei, UInt /*payloadSize*/)
    706651{
     
    783728  xParseByteAlign();
    784729}
    785 #endif
    786730
    787731#if M0043_LAYERS_PRESENT_SEI
     
    806750#endif
    807751
    808 #if L0208_SOP_DESCRIPTION_SEI
    809752Void SEIReader::xParseSEISOPDescription(SEISOPDescription &sei, UInt payloadSize)
    810753{
     
    830773  xParseByteAlign();
    831774}
    832 #endif
    833 
    834 
    835 #if K0180_SCALABLE_NESTING_SEI
     775
    836776#if M0043_LAYERS_PRESENT_SEI
    837777Void SEIReader::xParseSEIScalableNesting(SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, TComVPS *vps, TComSPS *sps)
     
    888828
    889829}
    890 #endif
    891830
    892831Void SEIReader::xParseByteAlign()
  • branches/SHM-2.1-dev/source/Lib/TLibDecoder/SEIread.h

    r292 r302  
    7878  Void xParseSEITemporalLevel0Index   (SEITemporalLevel0Index &sei, UInt payloadSize);
    7979  Void xParseSEIGradualDecodingRefreshInfo (SEIGradualDecodingRefreshInfo &sei, UInt payloadSize);
    80 #if J0149_TONE_MAPPING_SEI
    8180  Void xParseSEIToneMappingInfo       (SEIToneMappingInfo& sei, UInt payloadSize);
    82 #endif
     81  Void xParseSEISOPDescription        (SEISOPDescription &sei, UInt payloadSize);
    8382#if M0043_LAYERS_PRESENT_SEI
    8483  Void xParseSEILayersPresent         (SEILayersPresent &sei, UInt payloadSize, TComVPS *vps);
    85 #endif
    86 #if L0208_SOP_DESCRIPTION_SEI
    87   Void xParseSEISOPDescription        (SEISOPDescription &sei, UInt payloadSize);
    88 #endif
    89 #if K0180_SCALABLE_NESTING_SEI
    90 #if M0043_LAYERS_PRESENT_SEI
    9184  Void xParseSEIScalableNesting       (SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, TComVPS *vps, TComSPS *sps);
    9285#else
    9386  Void xParseSEIScalableNesting       (SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, TComSPS *sps);
    94 #endif
    9587#endif
    9688  Void xParseByteAlign();
  • branches/SHM-2.1-dev/source/Lib/TLibDecoder/TDecBinCoder.h

    r191 r302  
    5454  virtual Void  start             ()                                          = 0;
    5555  virtual Void  finish            ()                                          = 0;
    56   virtual Void  flush            ()                                           = 0;
    5756
    5857  virtual Void  decodeBin         ( UInt& ruiBin, ContextModel& rcCtxModel )  = 0;
     
    6160  virtual Void  decodeBinTrm      ( UInt& ruiBin                           )  = 0;
    6261 
    63   virtual Void  resetBac          ()                                          = 0;
    64   virtual Void  decodePCMAlignBits()                                          = 0;
    6562  virtual Void  xReadPCMCode      ( UInt uiLength, UInt& ruiCode)              = 0;
    6663
  • branches/SHM-2.1-dev/source/Lib/TLibDecoder/TDecBinCoderCABAC.cpp

    r191 r302  
    7575TDecBinCABAC::finish()
    7676{
    77 }
    78 
    79 Void
    80 TDecBinCABAC::flush()
    81 {
    82   while (m_pcTComBitstream->getNumBitsLeft() > 0 && m_pcTComBitstream->getNumBitsUntilByteAligned() != 0)
    83   {
    84     UInt uiBits;
    85     m_pcTComBitstream->read ( 1, uiBits );
    86   }
    87   start();
     77  UInt lastByte;
     78
     79  m_pcTComBitstream->peekPreviousByte( lastByte );
     80  // Check for proper stop/alignment pattern
     81  assert( ((lastByte << (8 + m_bitsNeeded)) & 0xff) == 0x80 );
    8882}
    8983
     
    241235}
    242236
    243 /** Reset BAC register values.
    244  * \returns Void
    245  */
    246 Void TDecBinCABAC::resetBac()
    247 {
    248   m_uiRange    = 510;
    249   m_bitsNeeded = -8;
    250   m_uiValue    = m_pcTComBitstream->read( 16 );
    251 }
    252 
    253 /** Decode PCM alignment zero bits.
    254  * \returns Void
    255  */
    256 Void TDecBinCABAC::decodePCMAlignBits()
    257 {
    258   Int iNum = m_pcTComBitstream->getNumBitsUntilByteAligned();
    259  
    260   UInt uiBit = 0;
    261   m_pcTComBitstream->read( iNum, uiBit );
    262 }
    263 
    264237/** Read a PCM code.
    265238 * \param uiLength code bit-depth
  • branches/SHM-2.1-dev/source/Lib/TLibDecoder/TDecBinCoderCABAC.h

    r191 r302  
    5656  Void  start             ();
    5757  Void  finish            ();
    58   Void  flush             ();
    5958 
    6059  Void  decodeBin         ( UInt& ruiBin, ContextModel& rcCtxModel );
     
    6362  Void  decodeBinTrm      ( UInt& ruiBin                           );
    6463 
    65   Void  resetBac          ();
    66   Void  decodePCMAlignBits();
    6764  Void  xReadPCMCode      ( UInt uiLength, UInt& ruiCode );
    6865 
  • branches/SHM-2.1-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r300 r302  
    175175}
    176176
    177 /** copy SAO parameter
    178 * \param dst
    179 * \param src
    180 */
    181 inline Void copySaoOneLcuParam(SaoLcuParam* dst,  SaoLcuParam* src)
    182 {
    183   Int i;
    184   dst->partIdx = src->partIdx;
    185   dst->typeIdx = src->typeIdx;
    186   if (dst->typeIdx != -1)
    187   {
    188     dst->subTypeIdx = src->subTypeIdx ;
    189     dst->length  = src->length;
    190     for (i=0;i<dst->length;i++)
    191     {
    192       dst->offset[i] = src->offset[i];
    193     }
    194   }
    195   else
    196   {
    197     dst->length  = 0;
    198     for (i=0;i<SAO_BO_LEN;i++)
    199     {
    200       dst->offset[i] = 0;
    201     }
    202   }
    203 }
    204 
    205177Void TDecCavlc::parsePPS(TComPPS* pcPPS)
    206178{
     
    212184  Int   iCode;
    213185
    214   READ_UVLC( uiCode, "pps_pic_parameter_set_id");                     pcPPS->setPPSId (uiCode);
    215   READ_UVLC( uiCode, "pps_seq_parameter_set_id");                     pcPPS->setSPSId (uiCode);
     186  READ_UVLC( uiCode, "pps_pic_parameter_set_id");
     187  assert(uiCode <= 63);
     188  pcPPS->setPPSId (uiCode);
     189 
     190  READ_UVLC( uiCode, "pps_seq_parameter_set_id");
     191  assert(uiCode <= 15);
     192  pcPPS->setSPSId (uiCode);
     193 
    216194  READ_FLAG( uiCode, "dependent_slice_segments_enabled_flag"    );    pcPPS->setDependentSliceSegmentsEnabledFlag   ( uiCode == 1 );
    217 #if L0255_MOVE_PPS_FLAGS
    218195  READ_FLAG( uiCode, "output_flag_present_flag" );                    pcPPS->setOutputFlagPresentFlag( uiCode==1 );
    219196
    220197  READ_CODE(3, uiCode, "num_extra_slice_header_bits");                pcPPS->setNumExtraSliceHeaderBits(uiCode);
    221 #endif
    222198  READ_FLAG ( uiCode, "sign_data_hiding_flag" ); pcPPS->setSignHideFlag( uiCode );
    223199
    224200  READ_FLAG( uiCode,   "cabac_init_present_flag" );            pcPPS->setCabacInitPresentFlag( uiCode ? true : false );
    225201
    226 #if L0323_LIMIT_DEFAULT_LIST_SIZE
    227202  READ_UVLC(uiCode, "num_ref_idx_l0_default_active_minus1");
    228203  assert(uiCode <= 14);
     
    232207  assert(uiCode <= 14);
    233208  pcPPS->setNumRefIdxL1DefaultActive(uiCode+1);
    234 #else
    235   READ_UVLC(uiCode, "num_ref_idx_l0_default_active_minus1");       pcPPS->setNumRefIdxL0DefaultActive(uiCode+1);
    236   READ_UVLC(uiCode, "num_ref_idx_l1_default_active_minus1");       pcPPS->setNumRefIdxL1DefaultActive(uiCode+1);
    237 #endif
    238209
    239210  READ_SVLC(iCode, "init_qp_minus26" );                            pcPPS->setPicInitQPMinus26(iCode);
     
    270241  pcPPS->setWPBiPred( uiCode==1 );
    271242
    272 #if !L0255_MOVE_PPS_FLAGS
    273   READ_FLAG( uiCode, "output_flag_present_flag" );
    274   pcPPS->setOutputFlagPresentFlag( uiCode==1 );
    275 #endif
    276243  READ_FLAG( uiCode, "transquant_bypass_enable_flag");
    277244  pcPPS->setTransquantBypassEnableFlag(uiCode ? true : false);
     
    335302  pcPPS->setLog2ParallelMergeLevelMinus2 (uiCode);
    336303
    337 #if !L0255_MOVE_PPS_FLAGS
    338   READ_CODE(3, uiCode, "num_extra_slice_header_bits");
    339   pcPPS->setNumExtraSliceHeaderBits(uiCode);
    340 #endif
    341304  READ_FLAG( uiCode, "slice_segment_header_extension_present_flag");
    342305  pcPPS->setSliceHeaderExtensionPresentFlag(uiCode);
     
    400363
    401364  READ_FLAG(     uiCode, "field_seq_flag");                           pcVUI->setFieldSeqFlag(uiCode);
    402   assert(pcVUI->getFieldSeqFlag() == false);        // not supported yet
    403365
    404366  READ_FLAG(uiCode, "frame_field_info_present_flag");                 pcVUI->setFrameFieldInfoPresentFlag(uiCode);
     
    413375    READ_UVLC(   uiCode, "def_disp_win_bottom_offset" );              defDisp.setWindowBottomOffset( uiCode * TComSPS::getWinUnitY( pcSPS->getChromaFormatIdc()) );
    414376  }
    415 #if L0043_TIMING_INFO
    416377  TimingInfo *timingInfo = pcVUI->getTimingInfo();
    417378  READ_FLAG(       uiCode, "vui_timing_info_present_flag");         timingInfo->setTimingInfoPresentFlag      (uiCode ? true : false);
     
    425386      READ_UVLC(   uiCode, "vui_num_ticks_poc_diff_one_minus1");    timingInfo->setNumTicksPocDiffOneMinus1   (uiCode);
    426387    }
    427 #endif
    428388  READ_FLAG(     uiCode, "hrd_parameters_present_flag");              pcVUI->setHrdParametersPresentFlag(uiCode);
    429389  if( pcVUI->getHrdParametersPresentFlag() )
     
    431391    parseHrdParameters( pcVUI->getHrdParameters(), 1, pcSPS->getMaxTLayers() - 1 );
    432392  }
    433 #if L0043_TIMING_INFO
    434   }
    435 #endif
    436 #if !L0043_TIMING_INFO
    437   READ_FLAG( uiCode, "poc_proportional_to_timing_flag" ); pcVUI->setPocProportionalToTimingFlag(uiCode ? true : false);
    438   if( pcVUI->getPocProportionalToTimingFlag() && pcVUI->getHrdParameters()->getTimingInfoPresentFlag() )
    439   {
    440     READ_UVLC( uiCode, "num_ticks_poc_diff_one_minus1" ); pcVUI->setNumTicksPocDiffOneMinus1(uiCode);
    441   }
    442 #endif
     393  }
    443394  READ_FLAG(     uiCode, "bitstream_restriction_flag");               pcVUI->setBitstreamRestrictionFlag(uiCode);
    444395  if (pcVUI->getBitstreamRestrictionFlag())
     
    453404    READ_FLAG(   uiCode, "motion_vectors_over_pic_boundaries_flag");  pcVUI->setMotionVectorsOverPicBoundariesFlag(uiCode);
    454405    READ_FLAG(   uiCode, "restricted_ref_pic_lists_flag");            pcVUI->setRestrictedRefPicListsFlag(uiCode);
    455 #if L0043_MSS_IDC
    456406    READ_UVLC( uiCode, "min_spatial_segmentation_idc");            pcVUI->setMinSpatialSegmentationIdc(uiCode);
    457407    assert(uiCode < 4096);
    458 #else
    459     READ_CODE( 8, uiCode, "min_spatial_segmentation_idc");            pcVUI->setMinSpatialSegmentationIdc(uiCode);
    460 #endif
    461408    READ_UVLC(   uiCode, "max_bytes_per_pic_denom" );                 pcVUI->setMaxBytesPerPicDenom(uiCode);
    462409    READ_UVLC(   uiCode, "max_bits_per_mincu_denom" );                pcVUI->setMaxBitsPerMinCuDenom(uiCode);
     
    471418  if( commonInfPresentFlag )
    472419  {
    473 #if !L0043_TIMING_INFO
    474     READ_FLAG( uiCode, "timing_info_present_flag" );                  hrd->setTimingInfoPresentFlag( uiCode == 1 ? true : false );
    475     if( hrd->getTimingInfoPresentFlag() )
    476     {
    477       READ_CODE( 32, uiCode, "num_units_in_tick" );                   hrd->setNumUnitsInTick( uiCode );
    478       READ_CODE( 32, uiCode, "time_scale" );                          hrd->setTimeScale( uiCode );
    479     }
    480 #endif
    481420    READ_FLAG( uiCode, "nal_hrd_parameters_present_flag" );           hrd->setNalHrdParametersPresentFlag( uiCode == 1 ? true : false );
    482421    READ_FLAG( uiCode, "vcl_hrd_parameters_present_flag" );           hrd->setVclHrdParametersPresentFlag( uiCode == 1 ? true : false );
     
    489428        READ_CODE( 5, uiCode, "du_cpb_removal_delay_length_minus1" ); hrd->setDuCpbRemovalDelayLengthMinus1( uiCode );
    490429        READ_FLAG( uiCode, "sub_pic_cpb_params_in_pic_timing_sei_flag" ); hrd->setSubPicCpbParamsInPicTimingSEIFlag( uiCode == 1 ? true : false );
    491 #if L0044_DU_DPB_OUTPUT_DELAY_HRD
    492430        READ_CODE( 5, uiCode, "dpb_output_delay_du_length_minus1"  ); hrd->setDpbOutputDelayDuLengthMinus1( uiCode );
    493 #endif
    494431      }
    495432      READ_CODE( 4, uiCode, "bit_rate_scale" );                       hrd->setBitRateScale( uiCode );
     
    516453      hrd->setFixedPicRateWithinCvsFlag( i, true );
    517454    }
    518 #if L0372
    519455    hrd->setLowDelayHrdFlag( i, 0 ); // Infered to be 0 when not present
    520456    hrd->setCpbCntMinus1   ( i, 0 ); // Infered to be 0 when not present
    521 #endif
    522457    if( hrd->getFixedPicRateWithinCvsFlag( i ) )
    523458    {
    524459      READ_UVLC( uiCode, "elemental_duration_in_tc_minus1" );             hrd->setPicDurationInTcMinus1( i, uiCode );
    525460    }
    526 #if L0372
    527461    else
    528462    {
     
    533467      READ_UVLC( uiCode, "cpb_cnt_minus1" );                          hrd->setCpbCntMinus1( i, uiCode );
    534468    }
    535 #else
    536     READ_FLAG( uiCode, "low_delay_hrd_flag" );                      hrd->setLowDelayHrdFlag( i, uiCode == 1 ? true : false  );
    537     READ_UVLC( uiCode, "cpb_cnt_minus1" );                          hrd->setCpbCntMinus1( i, uiCode );
    538 #endif
    539469    for( nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ )
    540470    {
     
    548478          if( hrd->getSubPicCpbParamsPresentFlag() )
    549479          {
    550 #if L0363_DU_BIT_RATE
     480            READ_UVLC( uiCode, "cpb_size_du_value_minus1" );       hrd->setDuCpbSizeValueMinus1( i, j, nalOrVcl, uiCode );
    551481            READ_UVLC( uiCode, "bit_rate_du_value_minus1" );       hrd->setDuBitRateValueMinus1( i, j, nalOrVcl, uiCode );
    552 #endif
    553             READ_UVLC( uiCode, "cpb_size_du_value_minus1" );       hrd->setDuCpbSizeValueMinus1( i, j, nalOrVcl, uiCode );
    554482          }
    555483          READ_FLAG( uiCode, "cbr_flag" );                          hrd->setCbrFlag( i, j, nalOrVcl, uiCode == 1 ? true : false  );
     
    577505#endif
    578506    READ_CODE( 3,  uiCode, "sps_max_sub_layers_minus1" );          pcSPS->setMaxTLayers   ( uiCode+1 );
     507    assert(uiCode <= 6);
     508 
    579509    READ_FLAG( uiCode, "sps_temporal_id_nesting_flag" );               pcSPS->setTemporalIdNestingFlag ( uiCode > 0 ? true : false );
    580510#if SPS_SUB_LAYER_INFO
     
    598528  parsePTL(pcSPS->getPTL(), 1, pcSPS->getMaxTLayers() - 1);
    599529  READ_UVLC(     uiCode, "sps_seq_parameter_set_id" );           pcSPS->setSPSId( uiCode );
     530  assert(uiCode <= 15);
     531 
    600532  READ_UVLC(     uiCode, "chroma_format_idc" );                  pcSPS->setChromaFormatIdc( uiCode );
     533  assert(uiCode <= 3);
    601534  // in the first version we only support chroma_format_idc equal to 1 (4:2:0), so separate_colour_plane_flag cannot appear in the bitstream
    602535  assert (uiCode == 1);
     
    619552
    620553  READ_UVLC(     uiCode, "bit_depth_luma_minus8" );
     554  assert(uiCode <= 6);
    621555  pcSPS->setBitDepthY( uiCode + 8 );
    622556  pcSPS->setQpBDOffsetY( (Int) (6*uiCode) );
    623557
    624558  READ_UVLC( uiCode,    "bit_depth_chroma_minus8" );
     559  assert(uiCode <= 6);
    625560  pcSPS->setBitDepthC( uiCode + 8 );
    626561  pcSPS->setQpBDOffsetC( (Int) (6*uiCode) );
    627562
    628563  READ_UVLC( uiCode,    "log2_max_pic_order_cnt_lsb_minus4" );   pcSPS->setBitsForPOC( 4 + uiCode );
     564  assert(uiCode <= 12);
    629565
    630566  UInt subLayerOrderingInfoPresentFlag;
    631567  READ_FLAG(subLayerOrderingInfoPresentFlag, "sps_sub_layer_ordering_info_present_flag");
     568 
    632569  for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++)
    633570  {
    634 #if L0323_DPB
    635571    READ_UVLC ( uiCode, "sps_max_dec_pic_buffering_minus1");
    636572    pcSPS->setMaxDecPicBuffering( uiCode + 1, i);
    637 #else
    638     READ_UVLC ( uiCode, "sps_max_dec_pic_buffering");
    639     pcSPS->setMaxDecPicBuffering( uiCode, i);
    640 #endif
    641573    READ_UVLC ( uiCode, "sps_num_reorder_pics" );
    642574    pcSPS->setNumReorderPics(uiCode, i);
    643     READ_UVLC ( uiCode, "sps_max_latency_increase");
     575    READ_UVLC ( uiCode, "sps_max_latency_increase_plus1");
    644576    pcSPS->setMaxLatencyIncrease( uiCode, i );
    645577
     
    698630
    699631  READ_UVLC( uiCode, "num_short_term_ref_pic_sets" );
     632  assert(uiCode <= 64);
    700633  pcSPS->createRPSList(uiCode);
    701634
     
    823756  READ_CODE( 16, uiCode,  "vps_reserved_ffff_16bits" );           assert(uiCode == 0xffff);
    824757  parsePTL ( pcVPS->getPTL(), true, pcVPS->getMaxTLayers()-1);
    825 #if SIGNAL_BITRATE_PICRATE_IN_VPS
    826   parseBitratePicRateInfo( pcVPS->getBitratePicrateInfo(), 0, pcVPS->getMaxTLayers() - 1);
    827 #endif
    828758  UInt subLayerOrderingInfoPresentFlag;
    829759  READ_FLAG(subLayerOrderingInfoPresentFlag, "vps_sub_layer_ordering_info_present_flag");
    830760  for(UInt i = 0; i <= pcVPS->getMaxTLayers()-1; i++)
    831761  {
    832 #if L0323_DPB
    833762    READ_UVLC( uiCode,  "vps_max_dec_pic_buffering_minus1[i]" );     pcVPS->setMaxDecPicBuffering( uiCode + 1, i );
    834 #else
    835     READ_UVLC( uiCode,  "vps_max_dec_pic_buffering[i]" );     pcVPS->setMaxDecPicBuffering( uiCode, i );
    836 #endif
    837763    READ_UVLC( uiCode,  "vps_num_reorder_pics[i]" );          pcVPS->setNumReorderPics( uiCode, i );
    838     READ_UVLC( uiCode,  "vps_max_latency_increase[i]" );      pcVPS->setMaxLatencyIncrease( uiCode, i );
     764    READ_UVLC( uiCode,  "vps_max_latency_increase_plus1[i]" );      pcVPS->setMaxLatencyIncrease( uiCode, i );
    839765
    840766    if (!subLayerOrderingInfoPresentFlag)
     
    876802  pcVPS->deriveLayerIdListVariables();
    877803#endif
    878 #if L0043_TIMING_INFO
    879804  TimingInfo *timingInfo = pcVPS->getTimingInfo();
    880805  READ_FLAG(       uiCode, "vps_timing_info_present_flag");         timingInfo->setTimingInfoPresentFlag      (uiCode ? true : false);
     
    888813      READ_UVLC(   uiCode, "vps_num_ticks_poc_diff_one_minus1");    timingInfo->setNumTicksPocDiffOneMinus1   (uiCode);
    889814    }
    890 #endif
    891815    READ_UVLC( uiCode, "vps_num_hrd_parameters" );                  pcVPS->setNumHrdParameters( uiCode );
    892816
     
    904828      parseHrdParameters(pcVPS->getHrdParameters(i), pcVPS->getCprmsPresentFlag( i ), pcVPS->getMaxTLayers() - 1);
    905829    }
    906 #if L0043_TIMING_INFO
    907   }
    908 #endif
     830  }
    909831  READ_FLAG( uiCode,  "vps_extension_flag" );
    910832  if (uiCode)
     
    13531275          uiCode = 0;
    13541276        }
    1355         memcpy(rps,sps->getRPSList()->getReferencePictureSet(uiCode),sizeof(TComReferencePictureSet));
     1277        *rps = *(sps->getRPSList()->getReferencePictureSet(uiCode));
    13561278      }
    13571279      if(sps->getLongTermRefsPresent())
     
    14461368        rpcSlice->setRPS(rps);
    14471369      }
    1448 
    1449 
    14501370      if (rpcSlice->getSPS()->getTMVPFlagsPresent())
    14511371      {
     
    17941714    for (UInt idx=0; idx<numEntryPointOffsets; idx++)
    17951715    {
    1796 #if L0116_ENTRY_POINT
    17971716      READ_CODE(offsetLenMinus1+1, uiCode, "entry_point_offset_minus1");
    17981717      entryPointOffset[ idx ] = uiCode + 1;
    1799 #else
    1800       READ_CODE(offsetLenMinus1+1, uiCode, "entry_point_offset");
    1801       entryPointOffset[ idx ] = uiCode;
    1802 #endif
    18031718    }
    18041719  }
     
    18221737  {
    18231738    Int endOfSliceHeaderLocation = m_pcBitstream->getByteLocation();
     1739   
     1740    // Adjust endOfSliceHeaderLocation to account for emulation prevention bytes in the slice segment header
     1741    for ( UInt curByteIdx  = 0; curByteIdx<m_pcBitstream->numEmulationPreventionBytesRead(); curByteIdx++ )
     1742    {
     1743      if ( m_pcBitstream->getEmulationPreventionByteLocation( curByteIdx ) < endOfSliceHeaderLocation )
     1744      {
     1745        endOfSliceHeaderLocation++;
     1746      }
     1747    }
     1748
    18241749    Int  curEntryPointOffset     = 0;
    18251750    Int  prevEntryPointOffset    = 0;
     
    18891814  READ_CODE( 8, uiCode, "general_level_idc" );    rpcPTL->getGeneralPTL()->setLevelIdc(uiCode);
    18901815
    1891 #if L0363_BYTE_ALIGN
    18921816  for (Int i = 0; i < maxNumSubLayersMinus1; i++)
    18931817  {
     
    19071831    }
    19081832  }
    1909 #endif
    19101833
    19111834  for(Int i = 0; i < maxNumSubLayersMinus1; i++)
    19121835  {
    1913 #if !L0363_BYTE_ALIGN
    1914     if(profilePresentFlag)
    1915     {
    1916       READ_FLAG( uiCode, "sub_layer_profile_present_flag[i]" ); rpcPTL->setSubLayerProfilePresentFlag(i, uiCode);
    1917     }
    1918     READ_FLAG( uiCode, "sub_layer_level_present_flag[i]"   ); rpcPTL->setSubLayerLevelPresentFlag  (i, uiCode);
    1919 #endif
    19201836    if( profilePresentFlag && rpcPTL->getSubLayerProfilePresentFlag(i) )
    19211837    {
     
    19391855    READ_FLAG(  uiCode, "XXX_profile_compatibility_flag[][j]");   ptl->setProfileCompatibilityFlag(j, uiCode ? 1 : 0);
    19401856  }
    1941 #if L0046_CONSTRAINT_FLAGS
    19421857  READ_FLAG(uiCode, "general_progressive_source_flag");
    19431858  ptl->setProgressiveSourceFlag(uiCode ? true : false);
     
    19551870  READ_CODE(16, uiCode, "XXX_reserved_zero_44bits[16..31]");
    19561871  READ_CODE(12, uiCode, "XXX_reserved_zero_44bits[32..43]");
    1957 #elif L0363_MORE_BITS
    1958   READ_CODE(16, uiCode, "XXX_reserved_zero_48bits[0..15]");
    1959   READ_CODE(16, uiCode, "XXX_reserved_zero_48bits[16..31]");
    1960   READ_CODE(16, uiCode, "XXX_reserved_zero_48bits[32..47]");
    1961 #else
    1962   READ_CODE(16, uiCode, "XXX_reserved_zero_16bits[]");  assert( uiCode == 0 );
    1963 #endif
    1964 }
    1965 #if SIGNAL_BITRATE_PICRATE_IN_VPS
    1966 Void TDecCavlc::parseBitratePicRateInfo(TComBitRatePicRateInfo *info, Int tempLevelLow, Int tempLevelHigh)
    1967 {
    1968   UInt uiCode;
    1969   for(Int i = tempLevelLow; i <= tempLevelHigh; i++)
    1970   {
    1971     READ_FLAG( uiCode, "bit_rate_info_present_flag[i]" ); info->setBitRateInfoPresentFlag(i, uiCode ? true : false);
    1972     READ_FLAG( uiCode, "pic_rate_info_present_flag[i]" ); info->setPicRateInfoPresentFlag(i, uiCode ? true : false);
    1973     if(info->getBitRateInfoPresentFlag(i))
    1974     {
    1975       READ_CODE( 16, uiCode, "avg_bit_rate[i]" ); info->setAvgBitRate(i, uiCode);
    1976       READ_CODE( 16, uiCode, "max_bit_rate[i]" ); info->setMaxBitRate(i, uiCode);
    1977     }
    1978     if(info->getPicRateInfoPresentFlag(i))
    1979     {
    1980       READ_CODE(  2, uiCode,  "constant_pic_rate_idc[i]" ); info->setConstantPicRateIdc(i, uiCode);
    1981       READ_CODE( 16, uiCode,  "avg_pic_rate[i]"          ); info->setAvgPicRate(i, uiCode);
    1982     }
    1983   }
    1984 }
    1985 #endif
     1872}
     1873
    19861874Void TDecCavlc::parseTerminatingBit( UInt& ruiBit )
    19871875{
  • branches/SHM-2.1-dev/source/Lib/TLibDecoder/TDecCAVLC.h

    r226 r302  
    8888  Void  parsePTL            ( TComPTL *rpcPTL, Bool profilePresentFlag, Int maxNumSubLayersMinus1 );
    8989  Void  parseProfileTier    (ProfileTierLevel *ptl);
    90 #if SIGNAL_BITRATE_PICRATE_IN_VPS
    91   Void  parseBitratePicRateInfo(TComBitRatePicRateInfo *info, Int tempLevelLow, Int tempLevelHigh);
    92 #endif
    9390  Void  parseHrdParameters  (TComHRD *hrd, Bool cprms_present_flag, UInt tempLevelHigh);
    9491  Void  parseSliceHeader    ( TComSlice*& rpcSlice, ParameterSetManagerDecoder *parameterSetManager);
  • branches/SHM-2.1-dev/source/Lib/TLibDecoder/TDecEntropy.cpp

    r191 r302  
    188188      decodeMergeIndex( pcCU, uiPartIdx, uiSubPartIdx, uiDepth );
    189189      UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);
    190 #if 0 //REF_IDX_FRAMEWORK  // HM bug fix
    191       if(uiPartIdx)
    192       {
    193         for(UInt ui=0; ui<uiMergeIndex+1; ui++)
    194         {
    195           cMvFieldNeighbours[(ui<<1)].setMvField(TComMv(), NOT_VALID);
    196           cMvFieldNeighbours[(ui<<1)+1].setMvField(TComMv(), NOT_VALID);
    197         }
    198       }
    199 #endif
    200190      if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && ePartSize != SIZE_2Nx2N && pcSubCU->getWidth( 0 ) <= 8 )
    201191      {
  • branches/SHM-2.1-dev/source/Lib/TLibDecoder/TDecSbac.cpp

    r191 r302  
    158158  UInt uiBit;
    159159  m_pcTDecBinIf->decodeBinTrm(uiBit);
     160  assert(uiBit); // end_of_sub_stream_one_bit must be equal to 1
    160161  m_pcTDecBinIf->finish(); 
    161162  m_pcBitstream->readOutTrailingBits();
     
    196197{
    197198  m_pcTDecBinIf->decodeBinTrm( ruiBit );
     199  if ( ruiBit )
     200  {
     201    m_pcTDecBinIf->finish();
     202  }
    198203}
    199204
     
    318323{
    319324  UInt uiSymbol;
    320   Bool readPCMSampleFlag = false;
    321325
    322326    m_pcTDecBinIf->decodeBinTrm(uiSymbol);
     
    324328    if (uiSymbol)
    325329    {
    326       readPCMSampleFlag = true;
    327       m_pcTDecBinIf->decodePCMAlignBits();
    328     }
    329 
    330   if (readPCMSampleFlag == true)
    331   {
    332330    Bool bIpcmFlag = true;
    333331
     
    395393    }
    396394
    397       m_pcTDecBinIf->resetBac();
     395    m_pcTDecBinIf->start();
    398396  }
    399397}
     
    681679    else
    682680    {
    683       intraPredMode = 0;
    684681      m_pcTDecBinIf->decodeBinsEP( symbol, 5 );
    685682      intraPredMode = symbol;
     
    917914  else
    918915  {
    919     iDQp=0;
    920916    qp = pcCU->getRefQP(uiAbsPartIdx);
    921917  }
     
    11021098
    11031099  //===== decode significance flags =====
    1104   UInt uiScanPosLast = uiBlkPosLast;
     1100  UInt uiScanPosLast;
    11051101  const UInt *scan   = g_auiSigLastScan[ uiScanIdx ][ uiLog2BlockSize-1 ];
    11061102  for( uiScanPosLast = 0; uiScanPosLast < uiMaxNumCoeffM1; uiScanPosLast++ )
  • branches/SHM-2.1-dev/source/Lib/TLibDecoder/TDecSlice.cpp

    r191 r302  
    384384    pcSbacDecoders[uiSubStrm].load(pcSbacDecoder);
    385385
     386    if ( uiCol == rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(iCUAddr))->getRightEdgePosInCU()
     387        && pcSlice->getPPS()->getEntropyCodingSyncEnabledFlag()
     388        && !uiIsLast )
     389    {
     390      // Parse end_of_substream_one_bit for WPP case
     391      UInt binVal;
     392      pcSbacDecoder->parseTerminatingBit( binVal );
     393      assert( binVal );
     394    }
     395
    386396    //Store probabilities of second LCU in line into buffer
    387397    if ( (uiCol == uiTileLCUX+1)&& (depSliceSegmentsEnabled || (pcSlice->getPPS()->getNumSubstreams() > 1)) && (pcSlice->getPPS()->getEntropyCodingSyncEnabledFlag()) )
  • branches/SHM-2.1-dev/source/Lib/TLibDecoder/TDecTop.cpp

    r297 r302  
    241241  }
    242242
    243 #if L0323_DPB
    244   m_iMaxRefPicNum = pcSlice->getSPS()->getMaxDecPicBuffering(pcSlice->getTLayer())+pcSlice->getSPS()->getNumReorderPics(pcSlice->getTLayer());     // m_uiMaxDecPicBuffering has the space for the picture currently being decoded
    245 #else
    246   m_iMaxRefPicNum = pcSlice->getSPS()->getMaxDecPicBuffering(pcSlice->getTLayer())+pcSlice->getSPS()->getNumReorderPics(pcSlice->getTLayer()) + 1; // +1 to have space for the picture currently being decoded
    247 #endif
     243  m_iMaxRefPicNum = pcSlice->getSPS()->getMaxDecPicBuffering(pcSlice->getTLayer());     // m_uiMaxDecPicBuffering has the space for the picture currently being decoded
    248244  if (m_cListPic.size() < (UInt)m_iMaxRefPicNum)
    249245  {
     
    476472  m_apcSlicePilot->setPPS(pps);
    477473  m_apcSlicePilot->setSPS(sps);
    478 
    479474  pps->setSPS(sps);
    480475  pps->setNumSubstreams(pps->getEntropyCodingSyncEnabledFlag() ? ((sps->getPicHeightInLumaSamples() + sps->getMaxCUHeight() - 1) / sps->getMaxCUHeight()) * (pps->getNumColumnsMinus1() + 1) : 1);
     
    991986    //---------------
    992987    pcSlice->setRefPOCList();
    993 #if !L0034_COMBINED_LIST_CLEANUP
    994     pcSlice->setNoBackPredFlag( false );
    995     if ( pcSlice->getSliceType() == B_SLICE )
    996     {
    997       if ( pcSlice->getNumRefIdx(RefPicList( 0 ) ) == pcSlice->getNumRefIdx(RefPicList( 1 ) ) )
    998       {
    999         pcSlice->setNoBackPredFlag( true );
    1000         for ( i=0; i < pcSlice->getNumRefIdx(RefPicList( 1 ) ); i++ )
    1001         {
    1002           if ( pcSlice->getRefPOC(RefPicList(1), i) != pcSlice->getRefPOC(RefPicList(0), i) )
    1003           {
    1004             pcSlice->setNoBackPredFlag( false );
    1005             break;
    1006           }
    1007         }
    1008       }
    1009     }
    1010 #endif
    1011988  }
    1012989
Note: See TracChangeset for help on using the changeset viewer.