Changeset 1005 in SHVCSoftware for branches


Ignore:
Timestamp:
26 Jan 2015, 17:11:15 (10 years ago)
Author:
nokia
Message:

Implementation of JCTVC-R0235 - Processing of bitstreams without an available base layer

Location:
branches/SHM-dev/source
Files:
1 deleted
11 edited
1 copied
1 moved

Legend:

Unmodified
Added
Removed
  • branches/SHM-dev/source/App/TAppDecoder/TAppDecCfg.cpp

    r953 r1005  
    249249      }
    250250      fclose (targetDecLayerIdSetFile);
    251       if ( m_targetDecLayerIdSet.size() > 0 && !isLayerIdZeroIncluded )
     251#if !R0235_SMALLEST_LAYER_ID  // LayerId=0 is not required anymore in some cases
     252      if (m_targetDecLayerIdSet.size() > 0 && !isLayerIdZeroIncluded)
    252253      {
    253254        fprintf(stderr, "TargetDecLayerIdSet must contain LayerId=0, aborting" );
    254255        return false;
    255256      }
     257#endif
    256258    }
    257259    else
  • branches/SHM-dev/source/App/TAppDecoder/TAppDecTop.cpp

    r953 r1005  
    11131113    return true;
    11141114  }
     1115#if R0235_SMALLEST_LAYER_ID
     1116  if (nalu->m_layerId == 0 && (nalu->m_nalUnitType == NAL_UNIT_VPS || nalu->m_nalUnitType == NAL_UNIT_SPS || nalu->m_nalUnitType == NAL_UNIT_PPS || nalu->m_nalUnitType == NAL_UNIT_EOS))
     1117  {
     1118    return true;
     1119  }
     1120#endif
    11151121  for (std::vector<Int>::iterator it = m_targetDecLayerIdSet.begin(); it != m_targetDecLayerIdSet.end(); it++)
    11161122  {
  • branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.cpp

    r997 r1005  
    19851985#if MULTIPLE_PTL_SUPPORT
    19861986    Int olsToLsIndex = (olsCtr >= (m_numLayerSets + m_numAddLayerSets)) ? m_outputLayerSetIdx[olsCtr - (m_numLayerSets + m_numAddLayerSets)] : olsCtr;
     1987#if R0235_SMALLEST_LAYER_ID
     1988    // This is a fix to allow setting of PTL for additional layer sets
     1989    if (olsCtr >= m_numLayerSets && olsCtr < (m_numLayerSets + m_numAddLayerSets))
     1990    {
     1991      scanStringToArrayNumEntries(cfg_listOfLayerPTLOfOlss[olsCtr], m_numLayerInIdList[olsToLsIndex], "List of PTL for each layers in OLS", m_listOfLayerPTLofOlss[olsCtr]);
     1992    }
     1993    else
     1994    {
     1995      scanStringToArray(cfg_listOfLayerPTLOfOlss[olsCtr], m_numLayerInIdList[olsToLsIndex], "List of PTL for each layers in OLS", m_listOfLayerPTLofOlss[olsCtr]);
     1996    }
     1997#else
     1998    Int olsToLsIndex = (olsCtr >= (m_numLayerSets + m_numAddLayerSets)) ? m_outputLayerSetIdx[olsCtr - (m_numLayerSets + m_numAddLayerSets)] : olsCtr;
    19871999    scanStringToArray( cfg_listOfLayerPTLOfOlss[olsCtr], m_numLayerInIdList[olsToLsIndex], "List of PTL for each layers in OLS", m_listOfLayerPTLofOlss[olsCtr] );
     2000#endif
    19882001    //For conformance checking
    19892002    //Conformance of a layer in an output operation point associated with an OLS in a bitstream to the Scalable Main profile is indicated as follows:
     
    19922005    //If OpTid of the output operation point is equal to vps_max_sub_layer_minus1, the conformance is indicated by general_profile_idc being equal to 7 or general_profile_compatibility_flag[ 7 ] being equal to 1
    19932006    //The following assert may be updated / upgraded to take care of general_profile_compatibility_flag.
     2007#if R0235_SMALLEST_LAYER_ID
     2008    if (m_numAddLayerSets == 0)
     2009    {
     2010#endif
    19942011    for ( Int ii = 1; ii < m_numLayerInIdList[olsToLsIndex]; ii++)
    19952012    {
     
    20012018      }
    20022019    }   
     2020#if R0235_SMALLEST_LAYER_ID
     2021    }
     2022#endif
    20032023#endif
    20042024  }
     
    41754195#endif
    41764196#endif //SVC_EXTENSION
     4197
     4198#if SVC_EXTENSION
     4199#if R0235_SMALLEST_LAYER_ID
     4200#if OUTPUT_LAYER_SETS_CONFIG
     4201Void TAppEncCfg::cfgStringToArrayNumEntries(Int **arr, string const cfgString, Int &numEntries, const char* logString)
     4202{
     4203  Char *tempChar = cfgString.empty() ? NULL : strdup(cfgString.c_str());
     4204  if (numEntries > 0)
     4205  {
     4206    Char *arrayEntry;
     4207    Int i = 0;
     4208    *arr = new Int[numEntries];
     4209
     4210    if (tempChar == NULL)
     4211    {
     4212      arrayEntry = NULL;
     4213    }
     4214    else
     4215    {
     4216      arrayEntry = strtok(tempChar, " ,");
     4217    }
     4218    while (arrayEntry != NULL)
     4219    {
     4220      if (i >= numEntries)
     4221      {
     4222        printf("%s: The number of entries specified is larger than the allowed number.\n", logString);
     4223        exit(EXIT_FAILURE);
     4224      }
     4225      *(*arr + i) = atoi(arrayEntry);
     4226      arrayEntry = strtok(NULL, " ,");
     4227      i++;
     4228    }
     4229    numEntries = i;
     4230    /*
     4231    if (i < numEntries)
     4232    {
     4233      printf("%s: Some entries are not specified.\n", logString);
     4234      exit(EXIT_FAILURE);
     4235    }
     4236    */
     4237  }
     4238  else
     4239  {
     4240    *arr = NULL;
     4241  }
     4242
     4243  if (tempChar)
     4244  {
     4245    free(tempChar);
     4246    tempChar = NULL;
     4247  }
     4248}
     4249
     4250Bool TAppEncCfg::scanStringToArrayNumEntries(string const cfgString, Int &numEntries, const char* logString, std::vector<Int> & returnVector)
     4251{
     4252  Int *tempArray = NULL;
     4253  numEntries = MAX_LAYERS;
     4254  // For all layer sets
     4255  cfgStringToArrayNumEntries(&tempArray, cfgString, numEntries, logString);
     4256  if (tempArray)
     4257  {
     4258    returnVector.empty();
     4259    for (Int i = 0; i < numEntries; i++)
     4260    {
     4261      returnVector.push_back(tempArray[i]);
     4262    }
     4263    delete[] tempArray; tempArray = NULL;
     4264    return true;
     4265  }
     4266  return false;
     4267}
     4268#endif
     4269#endif // R0235
     4270#endif //SVC_EXTENSION
     4271
     4272
    41774273//! \}
  • branches/SHM-dev/source/App/TAppEncoder/TAppEncCfg.h

    r951 r1005  
    544544  Bool scanStringToArray(string const cfgString, Int const numEntries, const char* logString, std::vector<Int> &  returnVector);
    545545  Void cfgStringToArray(Int **arr, string const cfgString, Int const numEntries, const char* logString);
     546#if R0235_SMALLEST_LAYER_ID
     547  Bool scanStringToArrayNumEntries(string const cfgString, Int &numEntries, const char* logString, Int * const returnArray);
     548  Bool scanStringToArrayNumEntries(string const cfgString, Int &numEntries, const char* logString, std::vector<Int> &  returnVector);
     549  Void cfgStringToArrayNumEntries(Int **arr, string const cfgString, Int &numEntries, const char* logString);
     550#endif
    546551#else
    547552  Void cfgStringToArray(Int **arr, string cfgString, Int numEntries, const char* logString);
  • branches/SHM-dev/source/App/utils/ExtractAddLS/ExtractAddLS.c

    r1004 r1005  
    3434#include <stdlib.h>
    3535#include <stdio.h>
     36#include <string.h>
    3637
    3738
    3839enum NalUnitType
    3940{
    40   NAL_UNIT_CODED_SLICE_TRAIL_N = 0,   // 0
    41   NAL_UNIT_CODED_SLICE_TRAIL_R,   // 1
    42 
    43   NAL_UNIT_CODED_SLICE_TSA_N,     // 2
    44   NAL_UNIT_CODED_SLICE_TSA_R,       // 3
    45 
    46   NAL_UNIT_CODED_SLICE_STSA_N,    // 4
    47   NAL_UNIT_CODED_SLICE_STSA_R,    // 5
    48 
    49   NAL_UNIT_CODED_SLICE_RADL_N,    // 6
    50   NAL_UNIT_CODED_SLICE_RADL_R,      // 7
    51 
    52   NAL_UNIT_CODED_SLICE_RASL_N,    // 8
    53   NAL_UNIT_CODED_SLICE_RASL_R,      // 9
     41  NAL_UNIT_CODED_SLICE_TRAIL_N = 0,
     42  NAL_UNIT_CODED_SLICE_TRAIL_R,
     43
     44  NAL_UNIT_CODED_SLICE_TSA_N,
     45  NAL_UNIT_CODED_SLICE_TSA_R,
     46
     47  NAL_UNIT_CODED_SLICE_STSA_N,
     48  NAL_UNIT_CODED_SLICE_STSA_R,
     49
     50  NAL_UNIT_CODED_SLICE_RADL_N,
     51  NAL_UNIT_CODED_SLICE_RADL_R,
     52
     53  NAL_UNIT_CODED_SLICE_RASL_N,
     54  NAL_UNIT_CODED_SLICE_RASL_R,
    5455
    5556  NAL_UNIT_RESERVED_VCL_N10,
     
    6061  NAL_UNIT_RESERVED_VCL_R15,
    6162
    62   NAL_UNIT_CODED_SLICE_BLA_W_LP,    // 16
    63   NAL_UNIT_CODED_SLICE_BLA_W_RADL,  // 17
    64   NAL_UNIT_CODED_SLICE_BLA_N_LP,  // 18
    65   NAL_UNIT_CODED_SLICE_IDR_W_RADL,  // 19
    66   NAL_UNIT_CODED_SLICE_IDR_N_LP,  // 20
    67   NAL_UNIT_CODED_SLICE_CRA,       // 21
     63  NAL_UNIT_CODED_SLICE_BLA_W_LP,
     64  NAL_UNIT_CODED_SLICE_BLA_W_RADL,
     65  NAL_UNIT_CODED_SLICE_BLA_N_LP,
     66  NAL_UNIT_CODED_SLICE_IDR_W_RADL,
     67  NAL_UNIT_CODED_SLICE_IDR_N_LP,
     68  NAL_UNIT_CODED_SLICE_CRA,
    6869  NAL_UNIT_RESERVED_IRAP_VCL22,
    6970  NAL_UNIT_RESERVED_IRAP_VCL23,
     
    7879  NAL_UNIT_RESERVED_VCL31,
    7980
    80   NAL_UNIT_VPS,                   // 32
    81   NAL_UNIT_SPS,                   // 33
    82   NAL_UNIT_PPS,                   // 34
    83   NAL_UNIT_ACCESS_UNIT_DELIMITER, // 35
    84   NAL_UNIT_EOS,                   // 36
    85   NAL_UNIT_EOB,                   // 37
    86   NAL_UNIT_FILLER_DATA,           // 38
    87   NAL_UNIT_PREFIX_SEI,              // 39
    88   NAL_UNIT_SUFFIX_SEI,              // 40
     81  NAL_UNIT_VPS,
     82  NAL_UNIT_SPS,
     83  NAL_UNIT_PPS,
     84  NAL_UNIT_ACCESS_UNIT_DELIMITER,
     85  NAL_UNIT_EOS,
     86  NAL_UNIT_EOB,
     87  NAL_UNIT_FILLER_DATA,
     88  NAL_UNIT_PREFIX_SEI,
     89  NAL_UNIT_SUFFIX_SEI,
    8990  NAL_UNIT_RESERVED_NVCL41,
    9091  NAL_UNIT_RESERVED_NVCL42,
     
    113114};
    114115
     116char *nalUnitNames[] =
     117{
     118  "NAL_UNIT_CODED_SLICE_TRAIL_N",
     119  "NAL_UNIT_CODED_SLICE_TRAIL_R",
     120
     121  "NAL_UNIT_CODED_SLICE_TSA_N",
     122  "NAL_UNIT_CODED_SLICE_TSA_R",
     123
     124  "NAL_UNIT_CODED_SLICE_STSA_N",
     125  "NAL_UNIT_CODED_SLICE_STSA_R",
     126
     127  "NAL_UNIT_CODED_SLICE_RADL_N",
     128  "NAL_UNIT_CODED_SLICE_RADL_R",
     129
     130  "NAL_UNIT_CODED_SLICE_RASL_N",
     131  "NAL_UNIT_CODED_SLICE_RASL_R",
     132
     133  "NAL_UNIT_RESERVED_VCL_N10",
     134  "NAL_UNIT_RESERVED_VCL_R11",
     135  "NAL_UNIT_RESERVED_VCL_N12",
     136  "NAL_UNIT_RESERVED_VCL_R13",
     137  "NAL_UNIT_RESERVED_VCL_N14",
     138  "NAL_UNIT_RESERVED_VCL_R15",
     139
     140  "NAL_UNIT_CODED_SLICE_BLA_W_LP",
     141  "NAL_UNIT_CODED_SLICE_BLA_W_RADL",
     142  "NAL_UNIT_CODED_SLICE_BLA_N_LP",
     143  "NAL_UNIT_CODED_SLICE_IDR_W_RADL",
     144  "NAL_UNIT_CODED_SLICE_IDR_N_LP",
     145  "NAL_UNIT_CODED_SLICE_CRA",
     146  "NAL_UNIT_RESERVED_IRAP_VCL22",
     147  "NAL_UNIT_RESERVED_IRAP_VCL23",
     148
     149  "NAL_UNIT_RESERVED_VCL24",
     150  "NAL_UNIT_RESERVED_VCL25",
     151  "NAL_UNIT_RESERVED_VCL26",
     152  "NAL_UNIT_RESERVED_VCL27",
     153  "NAL_UNIT_RESERVED_VCL28",
     154  "NAL_UNIT_RESERVED_VCL29",
     155  "NAL_UNIT_RESERVED_VCL30",
     156  "NAL_UNIT_RESERVED_VCL31",
     157
     158  "NAL_UNIT_VPS",
     159  "NAL_UNIT_SPS",
     160  "NAL_UNIT_PPS",
     161  "NAL_UNIT_ACCESS_UNIT_DELIMITER",
     162  "NAL_UNIT_EOS",
     163  "NAL_UNIT_EOB",
     164  "NAL_UNIT_FILLER_DATA",
     165  "NAL_UNIT_PREFIX_SEI",
     166  "NAL_UNIT_SUFFIX_SEI",
     167  "NAL_UNIT_RESERVED_NVCL41",
     168  "NAL_UNIT_RESERVED_NVCL42",
     169  "NAL_UNIT_RESERVED_NVCL43",
     170  "NAL_UNIT_RESERVED_NVCL44",
     171  "NAL_UNIT_RESERVED_NVCL45",
     172  "NAL_UNIT_RESERVED_NVCL46",
     173  "NAL_UNIT_RESERVED_NVCL47",
     174  "NAL_UNIT_UNSPECIFIED_48",
     175  "NAL_UNIT_UNSPECIFIED_49",
     176  "NAL_UNIT_UNSPECIFIED_50",
     177  "NAL_UNIT_UNSPECIFIED_51",
     178  "NAL_UNIT_UNSPECIFIED_52",
     179  "NAL_UNIT_UNSPECIFIED_53",
     180  "NAL_UNIT_UNSPECIFIED_54",
     181  "NAL_UNIT_UNSPECIFIED_55",
     182  "NAL_UNIT_UNSPECIFIED_56",
     183  "NAL_UNIT_UNSPECIFIED_57",
     184  "NAL_UNIT_UNSPECIFIED_58",
     185  "NAL_UNIT_UNSPECIFIED_59",
     186  "NAL_UNIT_UNSPECIFIED_60",
     187  "NAL_UNIT_UNSPECIFIED_61",
     188  "NAL_UNIT_UNSPECIFIED_62",
     189  "NAL_UNIT_UNSPECIFIED_63"
     190};
     191
    115192typedef struct NalUnitHeader_s
    116193{
     
    126203  int currByte;
    127204 
    128   while (1)
     205  for (;;)
    129206  {
    130207    currByte = fgetc(inFile);
     
    201278  int numStartCodeZeros;
    202279  int nalIsSpsPpsEob;
     280  int nalIsVpsSpsPpsEos;
    203281  int removeNal;
    204 
    205   if (argc < 4 || argc > 5)
    206   {
    207     fprintf(stderr, "Usage: BLRewrite <infile> <outfile> <assigned base layer ID> [<max temporal ID>]\n");
     282  int layerIdListTarget[8];
     283  int i;
     284  int layerIdx;
     285  int numLayerIds;
     286  char nalName[32];
     287
     288  if (argc < 5 || argc > 10)
     289  {
     290    fprintf(stderr, "\n  Usage: ExtractAddLS <infile> <outfile> <max temporal ID> <list of layer IDs> \n\n");
     291    fprintf(stderr, "  If only one layer ID is given, independent non-base layer rewriting process\n");
     292    fprintf(stderr, "  is performed\n");
     293    fprintf(stderr, "  If more than one layer ID is given, sub-bitstream extraction process for\n");
     294    fprintf(stderr, "  additional layer sets is performed (Layer ID list should exactly match\n");
     295    fprintf(stderr, "  an additional layer set defined in VPS)\n");
    208296    exit(1);
    209297  }
     
    223311  }
    224312
    225   assignedBaseLayerId = atoi(argv[3]);
    226   if (assignedBaseLayerId < 1 || assignedBaseLayerId > 7)
    227   {
    228     fprintf(stderr, "Invalid assigned base layer ID (must be in range 1-7)\n");
     313  tIdTarget = atoi(argv[3]);
     314  if (tIdTarget < 0 || tIdTarget > 6)
     315  {
     316    fprintf(stderr, "Invalid maximum temporal ID (must be in range 0-6)\n");
    229317    exit(1);
    230318  }
    231319
    232   if (argc == 5)
    233   {
    234     tIdTarget = atoi(argv[4]);
    235     if (tIdTarget < 0 || tIdTarget > 6)
    236     {
    237       fprintf(stderr, "Invalid maximum temporal ID (must be in range 0-6)\n");
     320  for (i = 4, layerIdx = 0; i < argc; i++, layerIdx++)
     321  {
     322    layerIdListTarget[layerIdx] = atoi(argv[i]);
     323    if (layerIdListTarget[layerIdx] < 1 || layerIdListTarget[layerIdx] > 7)
     324    {
     325      fprintf(stderr, "Invalid layer ID (must be in range 1-7)\n");
    238326      exit(1);
    239327    }
    240328  }
    241329
    242   while (1)
     330  numLayerIds = layerIdx;
     331  assignedBaseLayerId = layerIdListTarget[0];
     332
     333  /* Iterate through all NAL units */
     334  for (;;)
    243335  {
    244336    if (!findStartCodePrefix(inFile, &numStartCodeZeros))
     
    251343    }
    252344
    253     printf("NAL unit type: %i,  NUH layer ID: %i,  NUH Temporal ID: %i\n", nalu.nalUnitType, nalu.nuhLayerId, nalu.nuhTemporalIdPlus1 - 1);
    254 
    255     nalIsSpsPpsEob = (nalu.nalUnitType == NAL_UNIT_SPS || nalu.nalUnitType == NAL_UNIT_PPS || nalu.nalUnitType == NAL_UNIT_EOB);
    256 
    257     removeNal = (!nalIsSpsPpsEob && (nalu.nuhLayerId != assignedBaseLayerId))
    258              || (nalIsSpsPpsEob && (nalu.nuhLayerId != 0) && (nalu.nuhLayerId != assignedBaseLayerId))
    259              || (nalu.nalUnitType == NAL_UNIT_VPS)
    260              || ((nalu.nuhTemporalIdPlus1 - 1) > tIdTarget);
     345    if (numLayerIds == 1)
     346    {
     347      /* independent non-base layer rewriting process */
     348
     349      nalIsSpsPpsEob = (nalu.nalUnitType == NAL_UNIT_SPS || nalu.nalUnitType == NAL_UNIT_PPS || nalu.nalUnitType == NAL_UNIT_EOB);
     350
     351      removeNal = (!nalIsSpsPpsEob && (nalu.nuhLayerId != assignedBaseLayerId))
     352                || (nalIsSpsPpsEob && (nalu.nuhLayerId != 0) && (nalu.nuhLayerId != assignedBaseLayerId))
     353                || (nalu.nalUnitType == NAL_UNIT_VPS)
     354                || ((nalu.nuhTemporalIdPlus1 - 1) > tIdTarget);
     355
     356      nalu.nuhLayerId = 0;
     357    }
     358    else /* numLayerIds > 1 */
     359    {
     360      /* sub-bitstream extraction process for additional layer sets */
     361
     362      int isTargetLayer = 0;
     363
     364      for (i = 0; i < numLayerIds; i++)
     365      {
     366        if (layerIdListTarget[i] == nalu.nuhLayerId)
     367        {
     368          isTargetLayer = 1;
     369        }
     370      }
     371   
     372      nalIsVpsSpsPpsEos = (nalu.nalUnitType == NAL_UNIT_VPS || nalu.nalUnitType == NAL_UNIT_SPS || nalu.nalUnitType == NAL_UNIT_PPS || nalu.nalUnitType == NAL_UNIT_EOS);
     373
     374      removeNal = (!(nalIsVpsSpsPpsEos || nalu.nalUnitType == NAL_UNIT_EOB) && !isTargetLayer)
     375                || (nalIsVpsSpsPpsEos && (nalu.nuhLayerId != 0) && !isTargetLayer)
     376                || ((nalu.nuhTemporalIdPlus1 - 1) > tIdTarget);
     377    }
    261378
    262379    if (!removeNal)
     
    268385      long i;
    269386
    270       nalu.nuhLayerId = 0;
     387      printf("Keep  ");
     388
    271389      writeStartCodePrefixAndNUH(outFile, numStartCodeZeros, &nalu);
    272390
     
    283401      fseek(inFile, naluBytesStartPos, SEEK_SET);
    284402
    285       for (i = 0; i < numNaluBytes; i++)
     403      i = 0;
     404
     405      if (numLayerIds > 1 && nalu.nalUnitType == NAL_UNIT_VPS)
     406      {
     407        /* sub-bitstream extraction process for additional layer sets */
     408        int nalByte = fgetc(inFile);
     409        nalByte = nalByte & ~(0x04);  /* vps_base_layer_available_flag in each VPS is set equal to 0 */
     410        fputc(nalByte, outFile);
     411        i++;
     412      }
     413
     414      for (; i < numNaluBytes; i++)
    286415      {
    287416        fputc(fgetc(inFile), outFile);
    288417      }
    289418    }
     419    else
     420    {
     421      printf("-     ");
     422    }
     423
     424    strcpy(nalName, nalUnitNames[nalu.nalUnitType]);
     425    for (i = strlen(nalName); i < 31; i++)
     426    {
     427      nalName[i] = ' ';
     428    }
     429    nalName[31] = '\0';
     430
     431    printf("%s  layer ID: %i  temporal ID: %i\n", nalName, nalu.nuhLayerId, nalu.nuhTemporalIdPlus1 - 1);
    290432  }
    291433
  • branches/SHM-dev/source/App/utils/ExtractAddLS/ReadMe.txt

    r778 r1005  
    11
    2 This is a simple tool that extracts an independent non-base layer from a multi-layer bitstream, converts it to a base-layer bistream and writes it to a file. The tool is invoked as follows.
     2This a tool that either:
    33
    4   BLRewrite <infile> <outfile> <layer ID of the extracted layer>
     4  1. Extracts an independent non-base layer from a multi-layer bitstream, converts it to a base-layer bistream and writes it to a file. The extraction processs is defined in chapter F.10.2 of the HEVC version 2 specification.
    55
    6 The tool is based on the contribution JCTVC-Q0078 / JCTVC-R0042. Sub-bitstream extraction process done by the tool can be summarized as follows.
     6or
    77
    8 - NAL units with nal_unit_type not equal to SPS_NUT, PPS_NUT, EOS_NUT and EOB_NUT and with nuh_layer_id not equal to the assignedBaseLayerId are removed from outBitstream.
    9 - NAL units with nal_unit_type equal to SPS_NUT, PPS_NUT, EOS_NUT or EOB_NUT with nuh_layer_id not equal to 0 are removed from outBitstream.
    10 - For each NAL unit, the following applies:
    11   – When nuh_layer_id is equal to assignedBaseLayerId, nuh_layer_id is set equal to 0.
     8  2. Extracts an additional layer set sub-bitstream from multi-layer bitstream and writes it to a file. The extraction processs is defined in chapter F.10.3 of the HEVC version 2 specification.
    129
    13 The resulting bitstream can be decoded with an HEVC/H.265 v1 compliant decoder as long as the extracted independent layer conform with v1 specification text. The tool removes VPS from the output bitstream so an HEVC/H.265 decoder should not expect it to be present.
     10
     11The tool is invoked as follows:
     12
     13  ExtractAddLS <infile> <outfile> <Max temporal ID> <layer IDs of the extracted layers>
     14
     15The process that is invoked is decided based on the number of IDs that are given in the layer ID list.  If only one layer ID is given, independent non-base layer rewriting process is invoked. If more than one layer ID is given, sub-bitstream extraction for additional layer sets is invoked.
     16
     17The result of independent non-base layer rewriting process can be decoded with an HEVC/H.265 v1 compliant decoder as long as the extracted independent layer conform with v1 specification text. The tool removes VPS from the output bitstream during rewriting so an HEVC/H.265 decoder should not expect it to be present.
    1418
    1519
  • branches/SHM-dev/source/Lib/TLibCommon/TComSlice.cpp

    r999 r1005  
    10761076 */
    10771077#if NO_CLRAS_OUTPUT_FLAG
     1078#if R0235_SMALLEST_LAYER_ID
     1079Void TComSlice::decodingRefreshMarking( TComList<TComPic*>& rcListPic, Bool noClrasOutputFlag, UInt smallestLayerId )
     1080#else
    10781081Void TComSlice::decodingRefreshMarking( TComList<TComPic*>& rcListPic, Bool noClrasOutputFlag )
     1082#endif
    10791083{
    10801084  if( !isIRAP() )
     
    10861090  TComPic* rpcPic = NULL;
    10871091
    1088   // When the current picture is an IRAP picture with nuh_layer_id equal to 0 and NoClrasOutputFlag is equal to 1,
     1092  // When the current picture is an IRAP picture with nuh_layer_id equal to SmallestLayerId and NoClrasOutputFlag is equal to 1,
    10891093  // all reference pictures with any value of nuh_layer_id currently in the DPB (if any) are marked as "unused for reference".
     1094#if R0235_SMALLEST_LAYER_ID
     1095  if (m_layerId == smallestLayerId && noClrasOutputFlag)
     1096#else
    10901097  if( m_layerId == 0 && noClrasOutputFlag )
     1098#endif
    10911099  {
    10921100    // mark all pictures for all layers as not used for reference
  • branches/SHM-dev/source/Lib/TLibCommon/TComSlice.h

    r951 r1005  
    24632463  Void      checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, NalUnitType& associatedIRAPType, TComList<TComPic *>& rcListPic);
    24642464#if NO_CLRAS_OUTPUT_FLAG
     2465#if R0235_SMALLEST_LAYER_ID
     2466  Void      decodingRefreshMarking( TComList<TComPic*>& rcListPic, Bool noClrasOutputFlag, UInt smallestLayerId = 0 );
     2467#else
    24652468  Void      decodingRefreshMarking( TComList<TComPic*>& rcListPic, Bool noClrasOutputFlag );
     2469#endif
    24662470  Void      decodingRefreshMarking(Int& pocCRA, Bool& bRefreshPending, TComList<TComPic*>& rcListPic, Bool noClrasOutputFlag);
    24672471#else
  • branches/SHM-dev/source/Lib/TLibCommon/TypeDef.h

    r978 r1005  
    8181#define R0227_BR_PR_ADD_LAYER_SET        1      ///< JCTVC-R0227, Signalling of bit-rate and picture rate for additional layer set
    8282#define R0042_PROFILE_INDICATION         1      ///< JCTVC-R0042, Profile indication for additional layer sets
     83#define R0235_SMALLEST_LAYER_ID          1      ///< JCTVC-R0235, SmallestLayerId semantics
    8384
    8485#define Q0108_TSA_STSA                   1      ///< JCTVC-Q0108, Remove cross-layer alignment constraints of TSA and STSA pictures, enable to have different prediction structures in different layers
  • branches/SHM-dev/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r1001 r1005  
    18131813        //If OpTid of the output operation point is equal to vps_max_sub_layer_minus1, the conformance is indicated by general_profile_idc being equal to 7 or general_profile_compatibility_flag[ 7 ] being equal to 1
    18141814        //The following assert may be updated / upgraded to take care of general_profile_compatibility_flag.
     1815#if R0235_SMALLEST_LAYER_ID
     1816        // The assertion below is not valid for independent non-base layers
     1817        if (vps->getNumAddLayerSets() == 0)
     1818        {
     1819#endif
    18151820        if (j > 0 && vps->getLayerSetLayerIdList(layerSetIdxForOutputLayerSet, j) != 0 && vps->getLayerSetLayerIdList(layerSetIdxForOutputLayerSet, j - 1) != 0)
    18161821        {
     
    18191824                 vps->getPTL(vps->getProfileLevelTierIdx(i, j))->getGeneralPTL()->getProfileCompatibilityFlag(vps->getPTL(vps->getProfileLevelTierIdx(i, j - 1))->getGeneralPTL()->getProfileIdc())  );
    18201825        }
     1826#if R0235_SMALLEST_LAYER_ID
     1827        }
     1828#endif
    18211829#endif
    18221830      }
     
    34203428        for(Int kk = 0; kk < rpcSlice->getVPS()->getNumLayersInIdList(layerSetIdxForOutputLayerSet); kk++)
    34213429        {
     3430#if R0235_SMALLEST_LAYER_ID
     3431          if(vps->getNecessaryLayerFlag(ii, kk) && rpcSlice->getLayerId()==rpcSlice->getVPS()->getLayerSetLayerIdList(layerSetIdxForOutputLayerSet, kk))
     3432#else
    34223433          if(rpcSlice->getLayerId()==rpcSlice->getVPS()->getLayerSetLayerIdList(layerSetIdxForOutputLayerSet, kk))
     3434#endif
    34233435          {
    34243436            chkAssert=1;
  • branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.cpp

    r978 r1005  
    8484#if SVC_EXTENSION
    8585  m_layerId = 0;
     86#if R0235_SMALLEST_LAYER_ID
     87  m_smallestLayerId = 0;
     88#endif
    8689#if AVC_BASE
    8790  m_pBLReconFile = NULL;
     
    10111014#if OUTPUT_LAYER_SET_INDEX
    10121015  // Following check should go wherever the VPS is activated
    1013   checkValueOfTargetOutputLayerSetIdx( m_apcSlicePilot->getVPS());
     1016#if R0235_SMALLEST_LAYER_ID
     1017  if (!m_apcSlicePilot->getVPS()->getBaseLayerAvailableFlag())
     1018  {
     1019    assert(nalu.m_layerId != 0);
     1020    assert(m_apcSlicePilot->getVPS()->getNumAddLayerSets() > 0);
     1021    if (getCommonDecoderParams()->getTargetOutputLayerSetIdx() >= 0)
     1022    {
     1023      UInt layerIdx = m_apcSlicePilot->getVPS()->getOutputLayerSetIdx(getCommonDecoderParams()->getTargetOutputLayerSetIdx());
     1024      assert(layerIdx > m_apcSlicePilot->getVPS()->getVpsNumLayerSetsMinus1());
     1025    }
     1026  }
     1027  if (m_apcSlicePilot->getVPS()->getNumAddLayerSets() == 0)
     1028  {
     1029    checkValueOfTargetOutputLayerSetIdx(m_apcSlicePilot->getVPS());
     1030  }
     1031#else
     1032  checkValueOfTargetOutputLayerSetIdx(m_apcSlicePilot->getVPS());
     1033#endif
    10141034#endif
    10151035#if RESOLUTION_BASED_DPB
     
    11431163#if NO_OUTPUT_OF_PRIOR_PICS
    11441164#if NO_CLRAS_OUTPUT_FLAG
     1165#if R0235_SMALLEST_LAYER_ID
     1166  if (m_layerId == m_smallestLayerId && m_apcSlicePilot->getRapPicFlag())
     1167#else
    11451168  if (m_layerId == 0 && m_apcSlicePilot->getRapPicFlag() )
     1169#endif
    11461170  {
    11471171    if (m_bFirstSliceInSequence)
     
    11751199  }
    11761200
     1201#if R0235_SMALLEST_LAYER_ID
     1202  m_apcSlicePilot->decodingRefreshMarking( m_cListPic, m_noClrasOutputFlag, m_smallestLayerId );
     1203#else
    11771204  m_apcSlicePilot->decodingRefreshMarking( m_cListPic, m_noClrasOutputFlag );
     1205#endif
    11781206#endif
    11791207
     
    26402668        cListPic->clear();
    26412669      }
     2670#endif
     2671#if R0235_SMALLEST_LAYER_ID
     2672      xDeriveSmallestLayerId(m_parameterSetManagerDecoder.getPrefetchedVPS(0));
    26422673#endif
    26432674      return false;
     
    31263157Void TDecTop::xCheckLayerReset()
    31273158{
     3159#if R0235_SMALLEST_LAYER_ID
     3160  if (m_apcSlicePilot->isIRAP() && m_layerId > m_smallestLayerId)
     3161#else
    31283162  if (m_apcSlicePilot->isIRAP() && m_layerId > 0)
     3163#endif
    31293164  {
    31303165    Bool layerResetFlag;
     
    32103245#endif
    32113246
     3247#if R0235_SMALLEST_LAYER_ID
     3248Void TDecTop::xDeriveSmallestLayerId(TComVPS* vps)
     3249{
     3250  UInt smallestLayerId;
     3251  UInt targetOlsIdx = getCommonDecoderParams()->getTargetOutputLayerSetIdx();
     3252  UInt targetDecLayerSetIdx = vps->getOutputLayerSetIdx(targetOlsIdx);
     3253  UInt lsIdx = targetDecLayerSetIdx;
     3254  UInt targetDecLayerIdList[MAX_LAYERS] = {0};
     3255
     3256  for (UInt i = 0, j = 0; i < vps->getNumLayersInIdList(lsIdx); i++)
     3257  {
     3258    if (vps->getNecessaryLayerFlag(targetOlsIdx, i))
     3259    {
     3260      targetDecLayerIdList[j++] = vps->getLayerSetLayerIdList(lsIdx, i);
     3261    }
     3262  }
     3263
     3264  if (targetDecLayerSetIdx <= vps->getVpsNumLayerSetsMinus1())
     3265  {
     3266    smallestLayerId = 0;
     3267  }
     3268  else if (vps->getNumLayersInIdList(targetDecLayerSetIdx) == 1)
     3269  {
     3270    smallestLayerId = 0;
     3271  }
     3272  else
     3273  {
     3274    smallestLayerId = targetDecLayerIdList[0];
     3275  }
     3276
     3277  for (UInt layer = 0; layer <= MAX_VPS_LAYER_ID_PLUS1 - 1; layer++)
     3278  {
     3279    m_ppcTDecTop[layer]->m_smallestLayerId = smallestLayerId;
     3280  }
     3281}
     3282#endif
     3283
    32123284#endif //SVC_EXTENSION
    32133285
  • branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.h

    r978 r1005  
    130130  UInt                    m_numLayer;
    131131  TDecTop**               m_ppcTDecTop;
     132#if R0235_SMALLEST_LAYER_ID
     133  UInt                    m_smallestLayerId;
     134#endif
    132135#if P0297_VPS_POC_LSB_ALIGNED_FLAG
    133136  Bool                    m_pocResettingFlag;
     
    247250  Void      setLayerDec(TDecTop **p)    { m_ppcTDecTop = p; }
    248251  TDecTop*  getLayerDec(UInt layer)     { return m_ppcTDecTop[layer]; }
     252#if R0235_SMALLEST_LAYER_ID
     253  Void      xDeriveSmallestLayerId(TComVPS* vps);
     254#endif
    249255#if VPS_EXTN_DIRECT_REF_LAYERS
    250256  TDecTop*  getRefLayerDec(UInt refLayerIdc);
Note: See TracChangeset for help on using the changeset viewer.