Ticket #1354: jctvc_hm.patch

File jctvc_hm.patch, 17.1 KB (added by kolya, 10 years ago)

decoder patch

  • source/Lib/TLibDecoder/TDecCAVLC.cpp

    diff --git a/source/Lib/TLibDecoder/TDecCAVLC.cpp b/source/Lib/TLibDecoder/TDecCAVLC.cpp
    index 2df3075..969756b 100644
    a b  
    341341
    342342            if (pcPPS->getUseTransformSkip())
    343343            {
    344               READ_UVLC( uiCode, "log2_transform_skip_max_size_minus2");
     344              READ_UVLC( uiCode, "log2_max_transform_skip_block_size_minus2");
    345345              pcPPS->setTransformSkipLog2MaxSize(uiCode+2);
    346346            }
    347347
    348             READ_FLAG( uiCode, "cross_component_prediction_flag");
     348            READ_FLAG( uiCode, "cross_component_prediction_enabled_flag");
    349349            pcPPS->setUseCrossComponentPrediction(uiCode != 0);
    350350
    351             READ_FLAG( uiCode, "chroma_qp_adjustment_enabled_flag");
     351            READ_FLAG( uiCode, "chroma_qp_offset_list_enabled_flag ");
    352352            if (uiCode == 0)
    353353            {
    354354              pcPPS->clearChromaQpAdjTable();
     
    356356            }
    357357            else
    358358            {
    359               READ_UVLC(uiCode, "diff_cu_chroma_qp_adjustment_depth"); pcPPS->setMaxCuChromaQpAdjDepth(uiCode);
     359              READ_UVLC(uiCode, "diff_cu_chroma_qp_offset_depth"); pcPPS->setMaxCuChromaQpAdjDepth(uiCode);
    360360              UInt tableSizeMinus1 = 0;
    361               READ_UVLC(tableSizeMinus1, "chroma_qp_adjustment_table_size_minus1");
     361              READ_UVLC(tableSizeMinus1, "chroma_qp_offset_list_len_minus1");
    362362              /* skip zero index */
    363363              for (Int chromaQpAdjustmentIndex = 1; chromaQpAdjustmentIndex <= (tableSizeMinus1 + 1); chromaQpAdjustmentIndex++)
    364364              {
     
    371371              assert(pcPPS->getChromaQpAdjTableSize() == tableSizeMinus1 + 1);
    372372            }
    373373
    374             READ_UVLC( uiCode, "sao_luma_bit_shift");
     374            READ_UVLC( uiCode, "log2_sao_offset_scale_luma");
    375375            pcPPS->setSaoOffsetBitShift(CHANNEL_TYPE_LUMA, uiCode);
    376             READ_UVLC( uiCode, "sao_chroma_bit_shift");
     376            READ_UVLC( uiCode, "log2_sao_offset_scale_chroma");
    377377            pcPPS->setSaoOffsetBitShift(CHANNEL_TYPE_CHROMA, uiCode);
    378378            break;
    379379          default:
     
    426426    {
    427427      READ_CODE(8, uiCode, "colour_primaries");                       pcVUI->setColourPrimaries(uiCode);
    428428      READ_CODE(8, uiCode, "transfer_characteristics");               pcVUI->setTransferCharacteristics(uiCode);
    429       READ_CODE(8, uiCode, "matrix_coefficients");                    pcVUI->setMatrixCoefficients(uiCode);
     429      READ_CODE(8, uiCode, "matrix_coeffs");                    pcVUI->setMatrixCoefficients(uiCode);
    430430    }
    431431  }
    432432
     
    481481    READ_UVLC( uiCode, "min_spatial_segmentation_idc");            pcVUI->setMinSpatialSegmentationIdc(uiCode);
    482482    assert(uiCode < 4096);
    483483    READ_UVLC(   uiCode, "max_bytes_per_pic_denom" );                 pcVUI->setMaxBytesPerPicDenom(uiCode);
    484     READ_UVLC(   uiCode, "max_bits_per_mincu_denom" );                pcVUI->setMaxBitsPerMinCuDenom(uiCode);
     484    READ_UVLC(   uiCode, "max_bits_per_min_cu_denom" );                pcVUI->setMaxBitsPerMinCuDenom(uiCode);
    485485    READ_UVLC(   uiCode, "log2_max_mv_length_horizontal" );           pcVUI->setLog2MaxMvLengthHorizontal(uiCode);
    486486    READ_UVLC(   uiCode, "log2_max_mv_length_vertical" );             pcVUI->setLog2MaxMvLengthVertical(uiCode);
    487487  }
     
    496496    READ_FLAG( uiCode, "vcl_hrd_parameters_present_flag" );           hrd->setVclHrdParametersPresentFlag( uiCode == 1 ? true : false );
    497497    if( hrd->getNalHrdParametersPresentFlag() || hrd->getVclHrdParametersPresentFlag() )
    498498    {
    499       READ_FLAG( uiCode, "sub_pic_cpb_params_present_flag" );         hrd->setSubPicCpbParamsPresentFlag( uiCode == 1 ? true : false );
     499      READ_FLAG( uiCode, "sub_pic_hrd_params_present_flag" );         hrd->setSubPicCpbParamsPresentFlag( uiCode == 1 ? true : false );
    500500      if( hrd->getSubPicCpbParamsPresentFlag() )
    501501      {
    502502        READ_CODE( 8, uiCode, "tick_divisor_minus2" );                hrd->setTickDivisorMinus2( uiCode );
     
    651651  {
    652652    READ_UVLC ( uiCode, "sps_max_dec_pic_buffering_minus1[i]");
    653653    pcSPS->setMaxDecPicBuffering( uiCode + 1, i);
    654     READ_UVLC ( uiCode, "sps_num_reorder_pics[i]" );
     654    READ_UVLC ( uiCode, "sps_max_num_reorder_pics[i]" );
    655655    pcSPS->setNumReorderPics(uiCode, i);
    656656    READ_UVLC ( uiCode, "sps_max_latency_increase_plus1[i]");
    657657    pcSPS->setMaxLatencyIncrease( uiCode, i );
     
    668668    }
    669669  }
    670670
    671   READ_UVLC( uiCode, "log2_min_coding_block_size_minus3" );
     671  READ_UVLC( uiCode, "log2_min_luma_coding_block_size_minus3" );
    672672  Int log2MinCUSize = uiCode + 3;
    673673  pcSPS->setLog2MinCodingBlockSize(log2MinCUSize);
    674   READ_UVLC( uiCode, "log2_diff_max_min_coding_block_size" );
     674  READ_UVLC( uiCode, "log2_diff_max_min_luma_coding_block_size " );
    675675  pcSPS->setLog2DiffMaxMinCodingBlockSize(uiCode);
    676676 
    677677  if (pcSPS->getPTL()->getGeneralPTL()->getLevelIdc() >= Level::LEVEL5)
     
    682682  Int maxCUDepthDelta = uiCode;
    683683  pcSPS->setMaxCUWidth  ( 1<<(log2MinCUSize + maxCUDepthDelta) );
    684684  pcSPS->setMaxCUHeight ( 1<<(log2MinCUSize + maxCUDepthDelta) );
    685   READ_UVLC( uiCode, "log2_min_transform_block_size_minus2" );   pcSPS->setQuadtreeTULog2MinSize( uiCode + 2 );
     685  READ_UVLC( uiCode, "log2_min_luma_transform_block_size_minus2" );   pcSPS->setQuadtreeTULog2MinSize( uiCode + 2 );
    686686
    687   READ_UVLC( uiCode, "log2_diff_max_min_transform_block_size" ); pcSPS->setQuadtreeTULog2MaxSize( uiCode + pcSPS->getQuadtreeTULog2MinSize() );
     687  READ_UVLC( uiCode, "log2_diff_max_min_luma_transform_block_size " ); pcSPS->setQuadtreeTULog2MaxSize( uiCode + pcSPS->getQuadtreeTULog2MinSize() );
    688688  pcSPS->setMaxTrSize( 1<<(uiCode + pcSPS->getQuadtreeTULog2MinSize()) );
    689689
    690690  READ_UVLC( uiCode, "max_transform_hierarchy_depth_inter" );    pcSPS->setQuadtreeTUMaxDepthInter( uiCode+1 );
     
    730730  READ_FLAG( uiCode, "long_term_ref_pics_present_flag" );          pcSPS->setLongTermRefsPresent(uiCode);
    731731  if (pcSPS->getLongTermRefsPresent())
    732732  {
    733     READ_UVLC( uiCode, "num_long_term_ref_pic_sps" );
     733    READ_UVLC( uiCode, "num_long_term_ref_pics_sps" );
    734734    pcSPS->setNumLongTermRefPicSPS(uiCode);
    735735    for (UInt k = 0; k < pcSPS->getNumLongTermRefPicSPS(); k++)
    736736    {
     
    773773
    774774            READ_FLAG( uiCode, "transform_skip_rotation_enabled_flag");     pcSPS->setUseResidualRotation                    (uiCode != 0);
    775775            READ_FLAG( uiCode, "transform_skip_context_enabled_flag");      pcSPS->setUseSingleSignificanceMapContext        (uiCode != 0);
    776             READ_FLAG( uiCode, "residual_dpcm_implicit_enabled_flag");      pcSPS->setUseResidualDPCM(RDPCM_SIGNAL_IMPLICIT, (uiCode != 0));
    777             READ_FLAG( uiCode, "residual_dpcm_explicit_enabled_flag");      pcSPS->setUseResidualDPCM(RDPCM_SIGNAL_EXPLICIT, (uiCode != 0));
     776            READ_FLAG( uiCode, "implicit_rdpcm_enabled_flag");      pcSPS->setUseResidualDPCM(RDPCM_SIGNAL_IMPLICIT, (uiCode != 0));
     777            READ_FLAG( uiCode, "explicit_rdpcm_enabled_flag");      pcSPS->setUseResidualDPCM(RDPCM_SIGNAL_EXPLICIT, (uiCode != 0));
    778778            READ_FLAG( uiCode, "extended_precision_processing_flag");       pcSPS->setUseExtendedPrecision                   (uiCode != 0);
    779779            READ_FLAG( uiCode, "intra_smoothing_disabled_flag");            pcSPS->setDisableIntraReferenceSmoothing         (uiCode != 0);
    780             READ_FLAG( uiCode, "high_precision_prediction_weighting_flag"); pcSPS->setUseHighPrecisionPredictionWeighting    (uiCode != 0);
    781             READ_FLAG( uiCode, "golomb_rice_parameter_adaptation_flag");    pcSPS->setUseGolombRiceParameterAdaptation       (uiCode != 0);
     780            READ_FLAG( uiCode, "high_precision_offsets_enabled_flag"); pcSPS->setUseHighPrecisionPredictionWeighting    (uiCode != 0);
     781            READ_FLAG( uiCode, "persistent_rice_adaptation_enabled_flag");    pcSPS->setUseGolombRiceParameterAdaptation       (uiCode != 0);
    782782            READ_FLAG( uiCode, "cabac_bypass_alignment_enabled_flag");      pcSPS->setAlignCABACBeforeBypass                 (uiCode != 0);
    783783            break;
    784784          default:
     
    807807  READ_CODE( 3,  uiCode,  "vps_max_sub_layers_minus1" );          pcVPS->setMaxTLayers( uiCode + 1 );    assert(uiCode+1 <= MAX_TLAYER);
    808808  READ_FLAG(     uiCode,  "vps_temporal_id_nesting_flag" );       pcVPS->setTemporalNestingFlag( uiCode ? true:false );
    809809  assert (pcVPS->getMaxTLayers()>1||pcVPS->getTemporalNestingFlag());
    810   READ_CODE( 16, uiCode,  "vps_reserved_ffff_16bits" );           assert(uiCode == 0xffff);
     810  READ_CODE( 16, uiCode,  "vps_reserved_0xffff_16bits" );           assert(uiCode == 0xffff);
    811811  parsePTL ( pcVPS->getPTL(), true, pcVPS->getMaxTLayers()-1);
    812812  UInt subLayerOrderingInfoPresentFlag;
    813813  READ_FLAG(subLayerOrderingInfoPresentFlag, "vps_sub_layer_ordering_info_present_flag");
    814814  for(UInt i = 0; i <= pcVPS->getMaxTLayers()-1; i++)
    815815  {
    816816    READ_UVLC( uiCode,  "vps_max_dec_pic_buffering_minus1[i]" );     pcVPS->setMaxDecPicBuffering( uiCode + 1, i );
    817     READ_UVLC( uiCode,  "vps_num_reorder_pics[i]" );          pcVPS->setNumReorderPics( uiCode, i );
     817    READ_UVLC( uiCode,  "vps_max_num_reorder_pics[i]" );          pcVPS->setNumReorderPics( uiCode, i );
    818818    READ_UVLC( uiCode,  "vps_max_latency_increase_plus1[i]" );      pcVPS->setMaxLatencyIncrease( uiCode, i );
    819819
    820820    if (!subLayerOrderingInfoPresentFlag)
     
    831831
    832832  assert( pcVPS->getNumHrdParameters() < MAX_VPS_OP_SETS_PLUS1 );
    833833  assert( pcVPS->getMaxNuhReservedZeroLayerId() < MAX_VPS_NUH_RESERVED_ZERO_LAYER_ID_PLUS1 );
    834   READ_CODE( 6, uiCode, "vps_max_nuh_reserved_zero_layer_id" );   pcVPS->setMaxNuhReservedZeroLayerId( uiCode );
    835   READ_UVLC(    uiCode, "vps_max_op_sets_minus1" );               pcVPS->setMaxOpSets( uiCode + 1 );
     834  READ_CODE( 6, uiCode, "vps_max_layer_id" );   pcVPS->setMaxNuhReservedZeroLayerId( uiCode );
     835  READ_UVLC(    uiCode, "vps_num_layer_sets_minus1" );               pcVPS->setMaxOpSets( uiCode + 1 );
    836836  for( UInt opsIdx = 1; opsIdx <= ( pcVPS->getMaxOpSets() - 1 ); opsIdx ++ )
    837837  {
    838838    // Operation point set
     
    862862    }
    863863    for( UInt i = 0; i < pcVPS->getNumHrdParameters(); i ++ )
    864864    {
    865       READ_UVLC( uiCode, "hrd_op_set_idx" );                       pcVPS->setHrdOpSetIdx( uiCode, i );
     865      READ_UVLC( uiCode, "hrd_layer_set_idx" );                       pcVPS->setHrdOpSetIdx( uiCode, i );
    866866      if( i > 0 )
    867867      {
    868868        READ_FLAG( uiCode, "cprms_present_flag[i]" );               pcVPS->setCprmsPresentFlag( uiCode == 1 ? true : false, i );
     
    952952  {
    953953    for (Int i = 0; i < pps->getNumExtraSliceHeaderBits(); i++)
    954954    {
    955       READ_FLAG(uiCode, "slice_reserved_undetermined_flag[]"); // ignored
     955      READ_FLAG(uiCode, "slice_reserved_flag[]"); // ignored
    956956    }
    957957
    958958    READ_UVLC (    uiCode, "slice_type" );            pcSlice->setSliceType((SliceType)uiCode);
     
    11301130      }
    11311131      if (sps->getTMVPFlagsPresent())
    11321132      {
    1133         READ_FLAG( uiCode, "slice_temporal_mvp_enable_flag" );
     1133        READ_FLAG( uiCode, "slice_temporal_mvp_enabled_flag" );
    11341134        pcSlice->setEnableTMVPFlag( uiCode == 1 ? true : false );
    11351135      }
    11361136      else
     
    13251325    {
    13261326      if (numValidComp>COMPONENT_Cb)
    13271327      {
    1328         READ_SVLC( iCode, "slice_qp_delta_cb" );
     1328        READ_SVLC( iCode, "slice_cb_qp_offset" );
    13291329        pcSlice->setSliceChromaQpDelta(COMPONENT_Cb, iCode );
    13301330        assert( pcSlice->getSliceChromaQpDelta(COMPONENT_Cb) >= -12 );
    13311331        assert( pcSlice->getSliceChromaQpDelta(COMPONENT_Cb) <=  12 );
     
    13351335
    13361336      if (numValidComp>COMPONENT_Cr)
    13371337      {
    1338         READ_SVLC( iCode, "slice_qp_delta_cr" );
     1338        READ_SVLC( iCode, "slice_cr_qp_offset" );
    13391339        pcSlice->setSliceChromaQpDelta(COMPONENT_Cr, iCode );
    13401340        assert( pcSlice->getSliceChromaQpDelta(COMPONENT_Cr) >= -12 );
    13411341        assert( pcSlice->getSliceChromaQpDelta(COMPONENT_Cr) <=  12 );
     
    13461346
    13471347    if (pps->getChromaQpAdjTableSize() > 0)
    13481348    {
    1349       READ_FLAG(uiCode, "slice_chroma_qp_adjustment_enabled_flag"); pcSlice->setUseChromaQpAdj(uiCode != 0);
     1349      READ_FLAG(uiCode, "cu_chroma_qp_offset_enabled_flag"); pcSlice->setUseChromaQpAdj(uiCode != 0);
    13501350    }
    13511351    else
    13521352    {
     
    14251425
    14261426  if(pps->getSliceHeaderExtensionPresentFlag())
    14271427  {
    1428     READ_UVLC(uiCode,"slice_header_extension_length");
     1428    READ_UVLC(uiCode,"slice_segment_header_extension_length");
    14291429    for(Int i=0; i<uiCode; i++)
    14301430    {
    14311431      UInt ignore;
    1432       READ_CODE(8,ignore,"slice_header_extension_data_byte");
     1432      READ_CODE(8,ignore,"slice_segment_header_extension_data_byte");
    14331433    }
    14341434  }
    14351435#if RExt__DECODER_DEBUG_BIT_STATISTICS
     
    15211521Void TDecCavlc::parseProfileTier(ProfileTierLevel *ptl)
    15221522{
    15231523  UInt uiCode;
    1524   READ_CODE(2 , uiCode, "XXX_profile_space[]");   ptl->setProfileSpace(uiCode);
    1525   READ_FLAG(    uiCode, "XXX_tier_flag[]"    );   ptl->setTierFlag    (uiCode ? Level::HIGH : Level::MAIN);
    1526   READ_CODE(5 , uiCode, "XXX_profile_idc[]"  );   ptl->setProfileIdc  (Profile::Name(uiCode));
     1524  READ_CODE(2 , uiCode, "general_profile_space[]");   ptl->setProfileSpace(uiCode);
     1525  READ_FLAG(    uiCode, "general_tier_flag[]"    );   ptl->setTierFlag    (uiCode ? Level::HIGH : Level::MAIN);
     1526  READ_CODE(5 , uiCode, "general_profile_idc[]"  );   ptl->setProfileIdc  (Profile::Name(uiCode));
    15271527  for(Int j = 0; j < 32; j++)
    15281528  {
    15291529    READ_FLAG(  uiCode, "XXX_profile_compatibility_flag[][j]");   ptl->setProfileCompatibilityFlag(j, uiCode ? 1 : 0);
     
    15551555    READ_FLAG(    uiCode, "general_intra_constraint_flag");          ptl->setIntraConstraintFlag(uiCode != 0);
    15561556    READ_FLAG(    uiCode, "general_one_picture_only_constraint_flag");
    15571557    READ_FLAG(    uiCode, "general_lower_bit_rate_constraint_flag"); ptl->setLowerBitRateConstraintFlag(uiCode != 0);
    1558     READ_CODE(16, uiCode, "XXX_reserved_zero_35bits[0..15]");
    1559     READ_CODE(16, uiCode, "XXX_reserved_zero_35bits[16..31]");
    1560     READ_CODE(3,  uiCode, "XXX_reserved_zero_35bits[32..34]");
     1558    READ_CODE(16, uiCode, "general_reserved_zero_35bits[0..15]");
     1559    READ_CODE(16, uiCode, "general_reserved_zero_35bits[16..31]");
     1560    READ_CODE(3,  uiCode, "general_reserved_zero_35bits[32..34]");
    15611561  }
    15621562  else
    15631563  {
     
    15651565    ptl->setChromaFormatConstraint(CHROMA_420);
    15661566    ptl->setIntraConstraintFlag(false);
    15671567    ptl->setLowerBitRateConstraintFlag(true);
    1568     READ_CODE(16, uiCode, "XXX_reserved_zero_44bits[0..15]");
    1569     READ_CODE(16, uiCode, "XXX_reserved_zero_44bits[16..31]");
    1570     READ_CODE(12, uiCode, "XXX_reserved_zero_44bits[32..43]");
     1568    READ_CODE(16, uiCode, "general_reserved_zero_44bits[0..15]");
     1569    READ_CODE(16, uiCode, "general_reserved_zero_44bits[16..31]");
     1570    READ_CODE(12, uiCode, "general_reserved_zero_44bits[32..43]");
    15711571  }
    15721572}
    15731573
     
    17841784      }
    17851785
    17861786      UInt  uiCode;
    1787       READ_FLAG( uiCode, "luma_weight_lX_flag" );           // u(1): luma_weight_l0_flag
     1787      READ_FLAG( uiCode, "luma_weight_l0_flag" );           // u(1): luma_weight_l0_flag
    17881788      wp[COMPONENT_Y].bPresentFlag = ( uiCode == 1 );
    17891789      uiTotalSignalledWeightFlags += wp[COMPONENT_Y].bPresentFlag;
    17901790    }
     
    17941794      for ( Int iRefIdx=0 ; iRefIdx<pcSlice->getNumRefIdx(eRefPicList) ; iRefIdx++ )
    17951795      {
    17961796        pcSlice->getWpScaling(eRefPicList, iRefIdx, wp);
    1797         READ_FLAG( uiCode, "chroma_weight_lX_flag" );      // u(1): chroma_weight_l0_flag
     1797        READ_FLAG( uiCode, "chroma_weight_l0_flag" );      // u(1): chroma_weight_l0_flag
    17981798        for(Int j=1; j<numValidComp; j++)
    17991799        {
    18001800          wp[j].bPresentFlag = ( uiCode == 1 );
     
    18081808      if ( wp[COMPONENT_Y].bPresentFlag )
    18091809      {
    18101810        Int iDeltaWeight;
    1811         READ_SVLC( iDeltaWeight, "delta_luma_weight_lX" );  // se(v): delta_luma_weight_l0[i]
     1811        READ_SVLC( iDeltaWeight, "delta_luma_weight_l0" );  // se(v): delta_luma_weight_l0[i]
    18121812        assert( iDeltaWeight >= -128 );
    18131813        assert( iDeltaWeight <=  127 );
    18141814        wp[COMPONENT_Y].iWeight = (iDeltaWeight + (1<<wp[COMPONENT_Y].uiLog2WeightDenom));
    1815         READ_SVLC( wp[COMPONENT_Y].iOffset, "luma_offset_lX" );       // se(v): luma_offset_l0[i]
     1815        READ_SVLC( wp[COMPONENT_Y].iOffset, "luma_offset_l0" );       // se(v): luma_offset_l0[i]
    18161816        Int range=sps->getUseHighPrecisionPredictionWeighting() ? (1<<g_bitDepth[CHANNEL_TYPE_LUMA])/2 : 128;
    18171817        assert( wp[0].iOffset >= -range );
    18181818        assert( wp[0].iOffset <   range );
     
    18301830          for ( Int j=1 ; j<numValidComp ; j++ )
    18311831          {
    18321832            Int iDeltaWeight;
    1833             READ_SVLC( iDeltaWeight, "delta_chroma_weight_lX" );  // se(v): chroma_weight_l0[i][j]
     1833            READ_SVLC( iDeltaWeight, "delta_chroma_weight_l0" );  // se(v): chroma_weight_l0[i][j]
    18341834            assert( iDeltaWeight >= -128 );
    18351835            assert( iDeltaWeight <=  127 );
    18361836            wp[j].iWeight = (iDeltaWeight + (1<<wp[j].uiLog2WeightDenom));
    18371837
    18381838            Int iDeltaChroma;
    1839             READ_SVLC( iDeltaChroma, "delta_chroma_offset_lX" );  // se(v): delta_chroma_offset_l0[i][j]
     1839            READ_SVLC( iDeltaChroma, "delta_chroma_offset_l0" );  // se(v): delta_chroma_offset_l0[i][j]
    18401840            assert( iDeltaChroma >= -4*range);
    18411841            assert( iDeltaChroma <   4*range);
    18421842            Int pred = ( range - ( ( range*wp[j].iWeight)>>(wp[j].uiLog2WeightDenom) ) );