Ticket #1358: pps(sps)_extension_flag_encoder.patch

File pps(sps)_extension_flag_encoder.patch, 3.0 KB (added by kolya, 10 years ago)
  • source/Lib/TLibEncoder/TEncCavlc.cpp

    diff --git a/source/Lib/TLibEncoder/TEncCavlc.cpp b/source/Lib/TLibEncoder/TEncCavlc.cpp
    index 1bb6679..a459a81 100644
    a b  
    230230  WRITE_FLAG( pcPPS->getSliceHeaderExtensionPresentFlag() ? 1 : 0, "slice_segment_header_extension_present_flag");
    231231
    232232  Bool pps_extension_present_flag=false;
    233   Bool pps_extension_flags[NUM_PPS_EXTENSION_FLAGS]={false};
     233  Bool pps_extension_Xbits[NUM_PPS_EXTENSION_FLAGS]={false};
    234234
    235   pps_extension_flags[PPS_EXT__REXT] = (
     235  pps_extension_Xbits[PPS_EXT__REXT] = (
    236236             ( pcPPS->getUseTransformSkip() && (pcPPS->getTransformSkipLog2MaxSize() != 2))
    237237          || pcPPS->getUseCrossComponentPrediction()
    238238          || ( pcPPS->getChromaQpAdjTableSize() > 0 )
     
    244244
    245245  for(Int i=0; i<NUM_PPS_EXTENSION_FLAGS; i++)
    246246  {
    247     pps_extension_present_flag|=pps_extension_flags[i];
     247    pps_extension_present_flag|=pps_extension_Xbits[i];
    248248  }
    249249
    250250  WRITE_FLAG( (pps_extension_present_flag?1:0), "pps_extension_present_flag" );
    251251
    252252  if (pps_extension_present_flag)
    253253  {
    254     for(Int i=0; i<NUM_PPS_EXTENSION_FLAGS; i++)
     254
     255    WRITE_FLAG( pps_extension_Xbits[0] ? 1:0, "pps_range_extensions_flag" );
     256
     257    for(Int i=1; i<NUM_PPS_EXTENSION_FLAGS; i++)
    255258    {
    256       WRITE_FLAG( pps_extension_flags[i]?1:0, "pps_extension_flag[]" );
     259      WRITE_FLAG( pps_extension_Xbits[i] ? 1:0, "pps_extension_7bits" );
    257260    }
    258261
    259262    for(Int i=0; i<NUM_PPS_EXTENSION_FLAGS; i++) // loop used so that the order is determined by the enum.
    260263    {
    261       if (pps_extension_flags[i])
     264      if (pps_extension_Xbits[i])
    262265      {
    263266        switch (PPSExtensionFlagIndex(i))
    264267        {
     
    565568  }
    566569
    567570  Bool sps_extension_present_flag=false;
    568   Bool sps_extension_flags[NUM_SPS_EXTENSION_FLAGS]={false};
     571  Bool sps_extension_Xbits[NUM_SPS_EXTENSION_FLAGS]={false};
    569572
    570   sps_extension_flags[SPS_EXT__REXT] = (
     573  sps_extension_Xbits[SPS_EXT__REXT] = (
    571574          pcSPS->getUseResidualRotation()
    572575       || pcSPS->getUseSingleSignificanceMapContext()
    573576       || pcSPS->getUseResidualDPCM(RDPCM_SIGNAL_IMPLICIT)
     
    583586
    584587  for(Int i=0; i<NUM_SPS_EXTENSION_FLAGS; i++)
    585588  {
    586     sps_extension_present_flag|=sps_extension_flags[i];
     589    sps_extension_present_flag|=sps_extension_Xbits[i];
    587590  }
    588591
    589592  WRITE_FLAG( (sps_extension_present_flag?1:0), "sps_extension_present_flag" );
    590593
    591594  if (sps_extension_present_flag)
    592595  {
    593     for(Int i=0; i<NUM_SPS_EXTENSION_FLAGS; i++)
     596    WRITE_FLAG( sps_extension_Xbits[0]?1:0, "sps_range_extensions_flag" );
     597
     598    for(Int i=1; i<NUM_SPS_EXTENSION_FLAGS; i++)
    594599    {
    595       WRITE_FLAG( sps_extension_flags[i]?1:0, "sps_extension_flag[]" );
     600      WRITE_FLAG( sps_extension_Xbits[i]?1:0, "sps_extension_flag[]" );
    596601    }
    597602
    598603    for(Int i=0; i<NUM_SPS_EXTENSION_FLAGS; i++) // loop used so that the order is determined by the enum.
    599604    {
    600       if (sps_extension_flags[i])
     605      if (sps_extension_Xbits[i])
    601606      {
    602607        switch (SPSExtensionFlagIndex(i))
    603608        {