Ticket #44: VPS_Fix_jpadia_vidyo_150105.patch

File VPS_Fix_jpadia_vidyo_150105.patch, 10.5 KB (added by jaypadia, 9 years ago)

VPS_Fix_Patch

  • source/Lib/TLibCommon/TypeDef.h

     
    292292#endif
    293293#define R0157_RESTRICT_PPSID_FOR_CGS_LUT 1      ///< JCTVC-R0157: when pps_pic_parameter_set_id greater than or equal to 8, colour_mapping_enabled_flag shall be equal to 0
    294294
     295#define VPS_FIX_TO_MATCH_SPEC            1
     296
    295297/// scalability types
    296298enum ScalabilityType
    297299{
  • source/Lib/TLibDecoder/TDecCAVLC.cpp

     
    17241724#endif
    17251725  for(i = 1; i < numOutputLayerSets; i++)
    17261726  {
    1727     if( i > (vps->getNumLayerSets() - 1) )
     1727        if (
     1728#if VPS_FIX_TO_MATCH_SPEC
     1729                (vps->getNumLayerSets() > 2) &&
     1730#endif
     1731                (i > (vps->getNumLayerSets() - 1)))
    17281732    {
    17291733      Int numBits = 1;
    17301734      while ((1 << numBits) < (vps->getNumLayerSets() - 1))
     
    17391743    }
    17401744    Int layerSetIdxForOutputLayerSet = vps->getOutputLayerSetIdx(i);
    17411745#if Q0078_ADD_LAYER_SETS
     1746#if VPS_FIX_TO_MATCH_SPEC
     1747        if (i > vps->getVpsNumLayerSetsMinus1() || vps->getDefaultTargetOutputLayerIdc() == 2)
     1748#else
    17421749    if ( i > vps->getVpsNumLayerSetsMinus1() || vps->getDefaultTargetOutputLayerIdc() >= 2 )
     1750#endif
    17431751#else
    1744     if ( i > (vps->getNumLayerSets() - 1) || vps->getDefaultTargetOutputLayerIdc() >= 2 )
     1752#if VPS_FIX_TO_MATCH_SPEC
     1753    if ( i > (vps->getNumLayerSets() - 1) || vps->getDefaultTargetOutputLayerIdc() == 2 )
     1754#else
     1755        if ( i > (vps->getNumLayerSets() - 1) || vps->getDefaultTargetOutputLayerIdc() >= 2 )
    17451756#endif
     1757#endif
    17461758    {
    17471759#if NUM_OL_FLAGS
    17481760      for(j = 0; j < vps->getNumLayersInIdList(layerSetIdxForOutputLayerSet); j++)
     
    17841796    vps->getProfileLevelTierIdx(i)->assign(vps->getNumLayersInIdList(layerSetIdxForOutputLayerSet), -1);
    17851797    for(j = 0; j < vps->getNumLayersInIdList(layerSetIdxForOutputLayerSet) ; j++)
    17861798    {
    1787       if( vps->getNecessaryLayerFlag(i, j) )
     1799          if (vps->getNecessaryLayerFlag(i, j)
     1800#if VPS_FIX_TO_MATCH_SPEC
     1801                  && (vps->getNumProfileTierLevel()-1) > 0
     1802#endif
     1803                  )
    17881804      {
    17891805        READ_CODE( numBitsForPtlIdx, uiCode, "profile_level_tier_idx[i]" );
    17901806        vps->setProfileLevelTierIdx(i, j, uiCode );
     
    19751991
    19761992  if( vps->getRepFormatIdxPresentFlag() )
    19771993  {
    1978     for(i = 1; i < vps->getMaxLayers(); i++)
     1994#if VPS_FIX_TO_MATCH_SPEC
     1995          for (i = vps->getBaseLayerInternalFlag() ? 1 : 0; i < vps->getMaxLayers(); i++)
     1996#else
     1997          for (i = 1; i < vps->getMaxLayers(); i++)
     1998#endif
    19791999    {
    19802000      Int numBits = 1;
    19812001      while ((1 << numBits) < (vps->getVpsNumRepFormats()))
     
    24642484        {
    24652485#if DPB_INTERNAL_BL_SIG
    24662486            uiCode=0;
    2467         if(vps->getBaseLayerInternalFlag()  || ( vps->getLayerSetLayerIdList(layerSetIdxForOutputLayerSet, k)   !=  0 ) )
     2487                        if (
     2488#if VPS_FIX_TO_MATCH_SPEC
     2489                                vps->getNecessaryLayerFlag(i, k) &&
    24682490#endif
    2469           READ_UVLC( uiCode, "max_vps_dec_pic_buffering_minus1[i][k][j]" ); vps->setMaxVpsDecPicBufferingMinus1( i, k, j, uiCode );
     2491                                (vps->getBaseLayerInternalFlag() || (vps->getLayerSetLayerIdList(layerSetIdxForOutputLayerSet, k) != 0)))
     2492#endif
     2493              READ_UVLC( uiCode, "max_vps_dec_pic_buffering_minus1[i][k][j]" ); vps->setMaxVpsDecPicBufferingMinus1( i, k, j, uiCode );
    24702494        }
    24712495        READ_UVLC( uiCode, "max_vps_num_reorder_pics[i][j]" );              vps->setMaxVpsNumReorderPics( i, j, uiCode);
    24722496#if RESOLUTION_BASED_DPB
     
    27352759  READ_FLAG( uiCode, "tiles_not_in_use_flag" ); vps->setTilesNotInUseFlag(uiCode == 1);
    27362760  if (!uiCode)
    27372761  {
    2738     for(i = 0; i < vps->getMaxLayers(); i++)
     2762#if VPS_FIX_TO_MATCH_SPEC
     2763          for (i = vps->getBaseLayerInternalFlag() ? 0 : 1; i < vps->getMaxLayers(); i++)
     2764#else
     2765          for (i = 0; i < vps->getMaxLayers(); i++)
     2766#endif
    27392767    {
    27402768      READ_FLAG( uiCode, "tiles_in_use_flag[ i ]" ); vps->setTilesInUseFlag(i, (uiCode == 1));
    27412769      if (uiCode)
     
    27492777    }
    27502778#endif
    27512779
    2752     for(i = 1; i < vps->getMaxLayers(); i++)
     2780#if VPS_FIX_TO_MATCH_SPEC
     2781          for (i = vps->getBaseLayerInternalFlag() ? 1 : 2; i < vps->getMaxLayers(); i++)
     2782#else
     2783          for (i = 1; i < vps->getMaxLayers(); i++)
     2784#endif
    27532785    {
    27542786      for(j = 0; j < vps->getNumDirectRefLayers(vps->getLayerIdInNuh(i)); j++)
    27552787      {
     
    27702802  READ_FLAG( uiCode, "wpp_not_in_use_flag" ); vps->setWppNotInUseFlag(uiCode == 1);
    27712803  if (!uiCode)
    27722804  {
    2773     for(i = 0; i < vps->getMaxLayers(); i++)
     2805#if VPS_FIX_TO_MATCH_SPEC
     2806          for (i = vps->getBaseLayerInternalFlag() ? 0 : 1; i < vps->getMaxLayers(); i++)               //Added baselayerInternalFlagCondition: jpadia_vidyo
     2807#else
     2808          for (i = 0; i < vps->getMaxLayers(); i++)             //Added baselayerInternalFlagCondition: jpadia_vidyo
     2809#endif
    27742810    {
    27752811      READ_FLAG( uiCode, "wpp_in_use_flag[ i ]" ); vps->setWppInUseFlag(i, (uiCode == 1));
    27762812    }
     
    28022838    {
    28032839      for(j = 0; j < vps->getNumDirectRefLayers(vps->getLayerIdInNuh(i)); j++)
    28042840      {
    2805         READ_UVLC( uiCode, "min_spatial_segment_offset_plus1[i][j]" ); vps->setMinSpatialSegmentOffsetPlus1( i, j, uiCode );
    2806         if( vps->getMinSpatialSegmentOffsetPlus1(i,j ) > 0 )
    2807         {
    2808           READ_FLAG( uiCode, "ctu_based_offset_enabled_flag[i][j]"); vps->setCtuBasedOffsetEnabledFlag(i, j, uiCode == 1 );
    2809           if(vps->getCtuBasedOffsetEnabledFlag(i,j))
     2841#if VPS_FIX_TO_MATCH_SPEC
     2842                if (vps->getBaseLayerInternalFlag() || vps->getRefLayerId(vps->getLayerIdInNuh(i), j))
     2843                {
     2844#endif
     2845          READ_UVLC( uiCode, "min_spatial_segment_offset_plus1[i][j]" ); vps->setMinSpatialSegmentOffsetPlus1( i, j, uiCode );
     2846          if( vps->getMinSpatialSegmentOffsetPlus1(i,j ) > 0 )
    28102847          {
    2811             READ_UVLC( uiCode, "min_horizontal_ctu_offset_plus1[i][j]"); vps->setMinHorizontalCtuOffsetPlus1( i,j, uiCode );
     2848            READ_FLAG( uiCode, "ctu_based_offset_enabled_flag[i][j]"); vps->setCtuBasedOffsetEnabledFlag(i, j, uiCode == 1 );
     2849            if(vps->getCtuBasedOffsetEnabledFlag(i,j))
     2850            {
     2851              READ_UVLC( uiCode, "min_horizontal_ctu_offset_plus1[i][j]"); vps->setMinHorizontalCtuOffsetPlus1( i,j, uiCode );
     2852            }
    28122853          }
    2813         }
     2854#if VPS_FIX_TO_MATCH_SPEC
     2855                }
     2856#endif
    28142857      }
    28152858    }
    28162859  }
     
    47954838      }
    47964839    }
    47974840  }
    4798   for (Int h = 1; h < vps->getNumOutputLayerSets(); h++)
     4841#if VPS_FIX_TO_MATCH_SPEC
     4842  if (vps->getNumHrdParameters() + vps->getVpsNumAddHrdParams() > 0)
    47994843  {
    4800     Int lsIdx = vps->getOutputLayerSetIdx( h );
    4801     READ_UVLC( uiCode, "num_signalled_partitioning_schemes[h]"); vps->setNumSignalledPartitioningSchemes(h, uiCode);
    4802     for( Int j = 0; j < vps->getNumSignalledPartitioningSchemes(h); j++ )
    4803     {
    4804       READ_UVLC( uiCode, "num_partitions_in_scheme_minus1[h][j]" ); vps->setNumPartitionsInSchemeMinus1(h, j, uiCode);
    4805       for( Int k = 0; k <= vps->getNumPartitionsInSchemeMinus1(h, j); k++ )
    4806       {
    4807         for( Int r = 0; r < vps->getNumLayersInIdList( lsIdx ); r++ )
    4808         {
    4809           READ_FLAG( uiCode, "layer_included_in_partition_flag[h][j][k][r]" ); vps->setLayerIncludedInPartitionFlag(h, j, k, r, uiCode ? true : false);
    4810         }
    4811       }
    4812     }
    4813     for( Int i = 0; i < vps->getNumSignalledPartitioningSchemes(h) + 1; i++ )
    4814     {
    4815       for( Int t = 0; t <= vps->getMaxSLayersInLayerSetMinus1(lsIdx); t++ )
    4816       {
    4817         READ_UVLC( uiCode, "num_bsp_schedules_minus1[h][i][t]");              vps->setNumBspSchedulesMinus1(h, i, t, uiCode);
    4818         for( Int j = 0; j <= vps->getNumBspSchedulesMinus1(h, i, t); j++ )
    4819         {
    4820           for( Int k = 0; k < vps->getNumPartitionsInSchemeMinus1(h, i); k++ )
    4821           {
    4822             READ_UVLC( uiCode, "bsp_comb_hrd_idx[h][i][t][j][k]");      vps->setBspHrdIdx(h, i, t, j, k, uiCode);
    4823             READ_UVLC( uiCode, "bsp_comb_sched_idx[h][i][t][j][k]");    vps->setBspSchedIdx(h, i, t, j, k, uiCode);
    4824           }
    4825         }
    4826       }
    4827     }
     4844#endif
     4845          for (Int h = 1; h < vps->getNumOutputLayerSets(); h++)
     4846          {
     4847                  Int lsIdx = vps->getOutputLayerSetIdx(h);
     4848                  READ_UVLC(uiCode, "num_signalled_partitioning_schemes[h]"); vps->setNumSignalledPartitioningSchemes(h, uiCode);
     4849#if VPS_FIX_TO_MATCH_SPEC
     4850                  for (Int j = 1; j < vps->getNumSignalledPartitioningSchemes(h) + 1; j++)
     4851#else
     4852                  for (Int j = 0; j < vps->getNumSignalledPartitioningSchemes(h); j++)
     4853#endif
     4854                  {
     4855                          READ_UVLC(uiCode, "num_partitions_in_scheme_minus1[h][j]"); vps->setNumPartitionsInSchemeMinus1(h, j, uiCode);
     4856                          for (Int k = 0; k <= vps->getNumPartitionsInSchemeMinus1(h, j); k++)
     4857                          {
     4858                                  for (Int r = 0; r < vps->getNumLayersInIdList(lsIdx); r++)
     4859                                  {
     4860                                          READ_FLAG(uiCode, "layer_included_in_partition_flag[h][j][k][r]"); vps->setLayerIncludedInPartitionFlag(h, j, k, r, uiCode ? true : false);
     4861                                  }
     4862                          }
     4863                  }
     4864                  for (Int i = 0; i < vps->getNumSignalledPartitioningSchemes(h) + 1; i++)
     4865                  {
     4866                          for (Int t = 0; t <= vps->getMaxSLayersInLayerSetMinus1(lsIdx); t++)
     4867                          {
     4868                                  READ_UVLC(uiCode, "num_bsp_schedules_minus1[h][i][t]");              vps->setNumBspSchedulesMinus1(h, i, t, uiCode);
     4869                                  for (Int j = 0; j <= vps->getNumBspSchedulesMinus1(h, i, t); j++)
     4870                                  {
     4871#if VPS_FIX_TO_MATCH_SPEC
     4872                                          for (Int k = 0; k <= vps->getNumPartitionsInSchemeMinus1(h, i); k++)
     4873#else
     4874                                          for (Int k = 0; k < vps->getNumPartitionsInSchemeMinus1(h, i); k++)
     4875#endif                                   
     4876                                          {
     4877#if VPS_FIX_TO_MATCH_SPEC
     4878                                                  if (vps->getNumHrdParameters() + vps->getVpsNumAddHrdParams() > 1)
     4879                                                  {
     4880#endif
     4881#if VPS_FIX_TO_MATCH_SPEC
     4882                                                        Int numBits = 1;
     4883                                                        while ((1 << numBits) < (vps->getNumHrdParameters() + vps->getVpsNumAddHrdParams()))
     4884                                                        {
     4885                                                          numBits++;
     4886                                                        }
     4887                                                        READ_CODE(numBits, uiCode, "bsp_comb_hrd_idx[h][i][t][j][k]");      vps->setBspHrdIdx(h, i, t, j, k, uiCode);
     4888#else
     4889                                                        READ_UVLC(uiCode, "bsp_comb_hrd_idx[h][i][t][j][k]");      vps->setBspHrdIdx(h, i, t, j, k, uiCode);   
     4890#endif
     4891#if VPS_FIX_TO_MATCH_SPEC
     4892                                                  }
     4893#endif
     4894                                                  READ_UVLC(uiCode, "bsp_comb_sched_idx[h][i][t][j][k]");    vps->setBspSchedIdx(h, i, t, j, k, uiCode);
     4895                                          }
     4896                                  }
     4897                          }
     4898                  }
    48284899
    4829     // To be done: Check each layer included in not more than one BSP in every partitioning scheme,
    4830     // and other related checks associated with layers in bitstream partitions.
     4900                  // To be done: Check each layer included in not more than one BSP in every partitioning scheme,
     4901                  // and other related checks associated with layers in bitstream partitions.
    48314902
     4903          }
     4904#if VPS_FIX_TO_MATCH_SPEC
    48324905  }
     4906#endif
    48334907}
    48344908#endif
    48354909#endif