Changeset 815 in SHVCSoftware for trunk/source/App/TAppEncoder


Ignore:
Timestamp:
30 Jun 2014, 06:13:06 (11 years ago)
Author:
seregin
Message:

merge with SHM-6-dev branch

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/source

  • TabularUnified trunk/source/App/TAppEncoder/TAppEncCfg.cpp

    r713 r815  
    6969, m_avcBaseLayerFlag(0)
    7070#endif
    71 #if N0120_MAX_TID_REF_CFG
    7271, m_maxTidRefPresentFlag(1)
    73 #endif
    7472, m_pColumnWidth()
    7573, m_pRowHeight()
     
    420418  Int*    cfg_OutputBitDepthC   [MAX_LAYERS];
    421419#endif
    422 #if N0120_MAX_TID_REF_CFG
    423420  Int*    cfg_maxTidIlRefPicsPlus1[MAX_LAYERS];
    424 #endif
    425421  for(UInt layer = 0; layer < MAX_LAYERS; layer++)
    426422  {
     
    491487  cfg_OutputBitDepthC  [layer] = &m_acLayerCfg[layer].m_outputBitDepthC;
    492488#endif
    493 #if N0120_MAX_TID_REF_CFG
    494     cfg_maxTidIlRefPicsPlus1[layer] = &m_acLayerCfg[layer].m_maxTidIlRefPicsPlus1;
    495 #endif
     489  cfg_maxTidIlRefPicsPlus1[layer] = &m_acLayerCfg[layer].m_maxTidIlRefPicsPlus1;
    496490#if AUXILIARY_PICTURES
    497491    cfg_auxId[layer]                = &m_acLayerCfg[layer].m_auxId;
    498492#endif
    499493  }
     494#if Q0078_ADD_LAYER_SETS
     495  Int* cfg_numLayerInIdList[MAX_VPS_LAYER_SETS_PLUS1];
     496  string cfg_layerSetLayerIdList[MAX_VPS_LAYER_SETS_PLUS1];
     497  string* cfg_layerSetLayerIdListPtr[MAX_VPS_LAYER_SETS_PLUS1];
     498  Int* cfg_numHighestLayerIdx[MAX_VPS_LAYER_SETS_PLUS1];
     499  string cfg_highestLayerIdx[MAX_VPS_LAYER_SETS_PLUS1];
     500  string* cfg_highestLayerIdxPtr[MAX_VPS_LAYER_SETS_PLUS1];
     501  for (UInt i = 0; i < MAX_VPS_LAYER_SETS_PLUS1; i++)
     502  {
     503    cfg_numLayerInIdList[i] = &m_numLayerInIdList[i];
     504    cfg_layerSetLayerIdListPtr[i] = &cfg_layerSetLayerIdList[i];
     505    cfg_highestLayerIdxPtr[i] = &cfg_highestLayerIdx[i];
     506    cfg_numHighestLayerIdx[i] = &m_numHighestLayerIdx[i];
     507  }
     508#endif
    500509#if AVC_BASE
    501510  string  cfg_BLInputFile;
     
    519528  string cfg_codedPivotValue;
    520529  string cfg_targetPivotValue;
     530#if P0050_KNEE_FUNCTION_SEI
     531  string cfg_kneeSEIInputKneePointValue;
     532  string cfg_kneeSEIOutputKneePointValue;
     533#endif
    521534  po::Options opts;
    522535  opts.addOptions()
     
    548561#endif
    549562  ("NumLayers",               m_numLayers, 1, "Number of layers to code")
     563#if Q0078_ADD_LAYER_SETS
     564  ("NumLayerSets",            m_numLayerSets, 0, "Number of layer sets")
     565  ("NumLayerInIdList%d",      cfg_numLayerInIdList, 0, MAX_VPS_LAYER_ID_PLUS1, "Number of layers in the set")
     566  ("LayerSetLayerIdList%d",   cfg_layerSetLayerIdListPtr, string(""), MAX_VPS_LAYER_ID_PLUS1, "Layer IDs for the set")
     567  ("NumAddLayerSets",         m_numAddLayerSets, 0, "Number of additional layer sets")
     568  ("NumHighestLayerIdx%d",    cfg_numHighestLayerIdx, 0, MAX_VPS_LAYER_ID_PLUS1, "Number of highest layer idx")
     569  ("HighestLayerIdx%d",       cfg_highestLayerIdxPtr, string(""), MAX_VPS_LAYER_ID_PLUS1, "Highest layer idx for an additional layer set")
     570#endif
    550571#if AUXILIARY_PICTURES
    551572  ("InputChromaFormat%d",     cfg_tmpInputChromaFormat,  420, MAX_LAYERS, "InputChromaFormatIDC for layer %d")
     
    554575#endif
    555576  ("ConformanceMode%d",       cfg_conformanceMode,0, MAX_LAYERS, "Window conformance mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping")
    556 #if SCALABILITY_MASK_E0104
    557577  ("ScalabilityMask1",        m_scalabilityMask[1], 0, "scalability_mask[1] (multiview)")
    558578  ("ScalabilityMask2",        m_scalabilityMask[2], 1, "scalability_mask[2] (scalable)" )
    559579#if AUXILIARY_PICTURES
    560580  ("ScalabilityMask3",        m_scalabilityMask[3], 0, "scalability_mask[3] (auxiliary pictures)" )
    561 #endif
    562 #else
    563   ("ScalabilityMask0",        m_scalabilityMask[0], 0, "scalability_mask[0] (multiview)")
    564   ("ScalabilityMask1",        m_scalabilityMask[1], 1, "scalability_mask[1] (scalable)" )
    565581#endif
    566582  ("BitstreamFile,b",         cfg_BitstreamFile, string(""), "Bitstream output file name")
     
    598614  ("OutputBitDepthC%d",     cfg_OutputBitDepthC,   0, MAX_LAYERS, "As per OutputBitDepth but for chroma component. (default:InternalBitDepthC)")
    599615#endif
    600 #if N0120_MAX_TID_REF_CFG
    601616  ("MaxTidRefPresentFlag", m_maxTidRefPresentFlag, true, "max_tid_ref_present_flag (0: not present, 1: present(default)) " )
    602617  ("MaxTidIlRefPicsPlus1%d", cfg_maxTidIlRefPicsPlus1, 1, MAX_LAYERS, "allowed maximum temporal_id for inter-layer prediction")
    603 #endif
    604618#if O0223_PICTURE_TYPES_ALIGN_FLAG
    605619  ("CrossLayerPictureTypeAlignFlag", m_crossLayerPictureTypeAlignFlag, true, "align picture type across layers" ) 
    606620#endif
    607 #if N0147_IRAP_ALIGN_FLAG
    608621  ("CrossLayerIrapAlignFlag", m_crossLayerIrapAlignFlag, true, "align IRAP across layers" ) 
    609 #endif
    610622#if P0068_CROSS_LAYER_ALIGNED_IDR_ONLY_FOR_IRAP_FLAG
    611623  ("CrossLayerAlignedIdrOnlyFlag", m_crossLayerAlignedIdrOnlyFlag, true, "only idr for IRAP across layers" ) 
     
    953965  ("SEISOPDescription",              m_SOPDescriptionSEIEnabled,              0, "Control generation of SOP description SEI messages")
    954966  ("SEIScalableNesting",             m_scalableNestingSEIEnabled,              0, "Control generation of scalable nesting SEI messages")
     967#if P0050_KNEE_FUNCTION_SEI
     968  ("SEIKneeFunctionInfo",                 m_kneeSEIEnabled,               false, "Control generation of Knee function SEI messages")
     969  ("SEIKneeFunctionId",                   m_kneeSEIId,                        0, "Specifies Id of Knee function SEI message for a given session")
     970  ("SEIKneeFunctionCancelFlag",           m_kneeSEICancelFlag,            false, "Indicates that Knee function SEI message cancels the persistance or follows")
     971  ("SEIKneeFunctionPersistenceFlag",      m_kneeSEIPersistenceFlag,        true, "Specifies the persistence of the Knee function SEI message")
     972  ("SEIKneeFunctionMappingFlag",          m_kneeSEIMappingFlag,           false, "Specifies the mapping mode of the Knee function SEI message")
     973  ("SEIKneeFunctionInputDrange",          m_kneeSEIInputDrange,            1000, "Specifies the peak luminance level for the input picture of Knee function SEI messages")
     974  ("SEIKneeFunctionInputDispLuminance",   m_kneeSEIInputDispLuminance,      100, "Specifies the expected display brightness for the input picture of Knee function SEI messages")
     975  ("SEIKneeFunctionOutputDrange",         m_kneeSEIOutputDrange,           4000, "Specifies the peak luminance level for the output picture of Knee function SEI messages")
     976  ("SEIKneeFunctionOutputDispLuminance",  m_kneeSEIOutputDispLuminance,     800, "Specifies the expected display brightness for the output picture of Knee function SEI messages")
     977  ("SEIKneeFunctionNumKneePointsMinus1",  m_kneeSEINumKneePointsMinus1,       2, "Specifies the number of knee points - 1")
     978  ("SEIKneeFunctionInputKneePointValue",  cfg_kneeSEIInputKneePointValue,     string("600 800 900"), "Array of input knee point")
     979  ("SEIKneeFunctionOutputKneePointValue", cfg_kneeSEIOutputKneePointValue,    string("100 250 450"), "Array of output knee point")
     980#endif
     981#if Q0189_TMVP_CONSTRAINTS
     982  ("SEITemporalMotionVectorPredictionConstraints",             m_TMVPConstraintsSEIEnabled,              0, "Control generation of TMVP constrants SEI message")
     983#endif
    955984#if M0040_ADAPTIVE_RESOLUTION_CHANGE
    956985  ("AdaptiveResolutionChange",     m_adaptiveResolutionChange, 0, "Adaptive resolution change frame number. Should coincide with EL RAP picture. (0: disable)")
     
    9761005  ("CGSLUTBit",     m_nCGSLUTBit , 12, "bit depth of CGS LUT")
    9771006#endif
     1007#if Q0108_TSA_STSA
     1008  ("InheritCodingStruct%d",m_inheritCodingStruct, 0, MAX_LAYERS, "Predicts the GOP structure of one layer for another layer")
     1009#endif
    9781010  ;
    9791011 
     
    9831015    opts.addOptions()(cOSS.str(), m_GOPList[i-1], GOPEntry());
    9841016  }
     1017
     1018#if Q0108_TSA_STSA
     1019  for (Int i=1; i<MAX_LAYERS; i++)
     1020  {
     1021    for(Int j=1; j<MAX_GOP+1; j++)
     1022    {
     1023      std::ostringstream cOSS;
     1024      cOSS<<"Layer"<<i<<"Frame"<<j;
     1025      opts.addOptions()(cOSS.str(), m_EhGOPList[i][j-1], GOPEntry());
     1026    }
     1027  }
     1028#endif
     1029
    9851030  po::setDefaults(opts);
    9861031  const list<const Char*>& argv_unhandled = po::scanArgv(opts, argc, (const Char**) argv);
     1032
     1033#if Q0108_TSA_STSA
     1034  for (Int i=1; i<MAX_LAYERS; i++)
     1035  {
     1036    if(m_inheritCodingStruct[i] == 0)
     1037    {
     1038      for(Int j=1; j<MAX_GOP+1; j++)
     1039      {
     1040        m_EhGOPList[i][j-1] = m_GOPList[j-1];
     1041      }
     1042    }
     1043    else if( m_inheritCodingStruct[i] > 0)
     1044    {
     1045      for(Int j=1; j<MAX_GOP+1; j++)
     1046      {
     1047        m_EhGOPList[i][j-1] = m_EhGOPList[m_inheritCodingStruct[i]][j-1];
     1048      }
     1049    }
     1050  }
     1051#endif
    9871052
    9881053  if(m_isField)
     
    13091374    {
    13101375      m_acLayerCfg[layer].m_predLayerIds = NULL;
     1376    }
     1377  }
     1378#endif
     1379#if Q0078_ADD_LAYER_SETS
     1380  for (Int layerSet = 0; layerSet < m_numLayerSets; layerSet++)
     1381  {
     1382    if (m_numLayerInIdList[layerSet] > 0)
     1383    {
     1384      Char* layerSetLayerIdListDup = cfg_layerSetLayerIdList[layerSet].empty() ? NULL : strdup(cfg_layerSetLayerIdList[layerSet].c_str());
     1385      Int  i = 0;
     1386      char *layerId = strtok(layerSetLayerIdListDup, " ,-");
     1387      while (layerId != NULL)
     1388      {
     1389        if (i >= m_numLayerInIdList[layerSet])
     1390        {
     1391          printf("NumLayerInIdList%d: The number of layers in the set is larger than the allowed number of layers.\n", layerSet);
     1392          exit(EXIT_FAILURE);
     1393        }
     1394        m_layerSetLayerIdList[layerSet][i] = atoi(layerId);
     1395        layerId = strtok(NULL, " ,-");
     1396        i++;
     1397      }
     1398    }
     1399  }
     1400  for (Int addLayerSet = 0; addLayerSet < m_numAddLayerSets; addLayerSet++)
     1401  {
     1402    if (m_numHighestLayerIdx[addLayerSet] > 0)
     1403    {
     1404      Char* highestLayrIdxListDup = cfg_highestLayerIdx[addLayerSet].empty() ? NULL : strdup(cfg_highestLayerIdx[addLayerSet].c_str());
     1405      Int  i = 0;
     1406      char *layerIdx = strtok(highestLayrIdxListDup, " ,-");
     1407      while (layerIdx != NULL)
     1408      {
     1409        if (i >= m_numLayerInIdList[addLayerSet])
     1410        {
     1411          printf("NumLayerInIdList%d: The number of layer idx's in the highest layer idx list is larger than the allowed number of idx's.\n", addLayerSet);
     1412          exit(EXIT_FAILURE);
     1413        }
     1414        m_highestLayerIdx[addLayerSet][i] = atoi(layerIdx);
     1415        layerIdx = strtok(NULL, " ,-");
     1416        i++;
     1417      }
    13111418    }
    13121419  }
     
    14951602    }
    14961603  }
     1604#if P0050_KNEE_FUNCTION_SEI
     1605  if( m_kneeSEIEnabled && !m_kneeSEICancelFlag )
     1606  {
     1607    Char* pcInputKneePointValue  = cfg_kneeSEIInputKneePointValue.empty()  ? NULL : strdup(cfg_kneeSEIInputKneePointValue.c_str());
     1608    Char* pcOutputKneePointValue = cfg_kneeSEIOutputKneePointValue.empty() ? NULL : strdup(cfg_kneeSEIOutputKneePointValue.c_str());
     1609    assert ( m_kneeSEINumKneePointsMinus1 >= 0 && m_kneeSEINumKneePointsMinus1 < 999 );
     1610    m_kneeSEIInputKneePoint = new Int[m_kneeSEINumKneePointsMinus1+1];
     1611    m_kneeSEIOutputKneePoint = new Int[m_kneeSEINumKneePointsMinus1+1];
     1612    char *InputVal = strtok(pcInputKneePointValue, " .,");
     1613    Int i=0;
     1614    while( InputVal && i<(m_kneeSEINumKneePointsMinus1+1) )
     1615    {
     1616      m_kneeSEIInputKneePoint[i] = (UInt) atoi( InputVal );
     1617      InputVal = strtok(NULL, " .,");
     1618      i++;
     1619    }
     1620    char *OutputVal = strtok(pcOutputKneePointValue, " .,");
     1621    i=0;
     1622    while( OutputVal && i<(m_kneeSEINumKneePointsMinus1+1) )
     1623    {
     1624      m_kneeSEIOutputKneePoint[i] = (UInt) atoi( OutputVal );
     1625      OutputVal = strtok(NULL, " .,");
     1626      i++;
     1627    }
     1628  }
     1629#endif
    14971630
    14981631#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     
    17421875   * This permits the ability to omit a GOP structure specification */
    17431876#if SVC_EXTENSION
     1877#if Q0108_TSA_STSA
     1878  if( m_acLayerCfg[0].m_iIntraPeriod == 1 && m_GOPList[0].m_POC == -1 )
     1879  {
     1880    m_GOPList[0] = GOPEntry();
     1881    m_GOPList[0].m_QPFactor = 1;
     1882    m_GOPList[0].m_betaOffsetDiv2 = 0;
     1883    m_GOPList[0].m_tcOffsetDiv2 = 0;
     1884    m_GOPList[0].m_POC = 1;
     1885    m_GOPList[0].m_numRefPicsActive = 4;
     1886  }
     1887
    17441888  for(UInt layer = 0; layer < MAX_LAYERS; layer++)
    17451889  {
     1890    if (m_acLayerCfg[layer].m_iIntraPeriod == 1 && m_EhGOPList[layer][0].m_POC == -1) {
     1891      m_EhGOPList[layer][0] = GOPEntry();
     1892      m_EhGOPList[layer][0].m_QPFactor = 1;
     1893      m_EhGOPList[layer][0].m_betaOffsetDiv2 = 0;
     1894      m_EhGOPList[layer][0].m_tcOffsetDiv2 = 0;
     1895      m_EhGOPList[layer][0].m_POC = 1;
     1896      m_EhGOPList[layer][0].m_numRefPicsActive = 4;
     1897    }
     1898  }
     1899#else
     1900  for(UInt layer = 0; layer < MAX_LAYERS; layer++)
     1901  {
    17461902    Int m_iIntraPeriod = m_acLayerCfg[layer].m_iIntraPeriod;
    1747 #endif
     1903    if (m_iIntraPeriod == 1 && m_GOPList[0].m_POC == -1) {
     1904      m_GOPList[0] = GOPEntry();
     1905      m_GOPList[0].m_QPFactor = 1;
     1906      m_GOPList[0].m_betaOffsetDiv2 = 0;
     1907      m_GOPList[0].m_tcOffsetDiv2 = 0;
     1908      m_GOPList[0].m_POC = 1;
     1909      m_GOPList[0].m_numRefPicsActive = 4;
     1910    }
     1911  }
     1912#endif
     1913#else
    17481914  if (m_iIntraPeriod == 1 && m_GOPList[0].m_POC == -1) {
    17491915    m_GOPList[0] = GOPEntry();
     
    17541920    m_GOPList[0].m_numRefPicsActive = 4;
    17551921  }
    1756 #if SVC_EXTENSION
    1757   }
    1758 #endif
    1759  
     1922#endif
    17601923
    17611924  Bool verifiedGOP=false;
     
    17901953  xConfirmPara( m_numLayers > MAX_LAYERS , "Number of layers in config file is greater than MAX_LAYERS" );
    17911954  m_numLayers = m_numLayers > MAX_LAYERS ? MAX_LAYERS : m_numLayers;
    1792 
    17931955 
    17941956  // it can be updated after AVC BL support will be added to the WD
     
    18271989#endif
    18281990
    1829   m_extraRPSs=0;
     1991#if !Q0108_TSA_STSA
     1992   m_extraRPSs = 0;                                     
     1993#else
     1994  memset( m_extraRPSs, 0, sizeof( m_extraRPSs ) );
     1995#endif
    18301996  //start looping through frames in coding order until we can verify that the GOP structure is correct.
    18311997  while(!verifiedGOP&&!errorGOP)
     
    18932059      {
    18942060        //create a new GOPEntry for this frame containing all the reference pictures that were available (POC > 0)
     2061#if !Q0108_TSA_STSA
    18952062        m_GOPList[m_iGOPSize+m_extraRPSs]=m_GOPList[curGOP];
     2063#else
     2064        m_GOPList[m_iGOPSize+m_extraRPSs[0]]=m_GOPList[curGOP];
     2065#endif
    18962066        Int newRefs=0;
    18972067        for(Int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++)
     
    19002070          if(absPOC>=0)
    19012071          {
     2072#if !Q0108_TSA_STSA
    19022073            m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[newRefs]=m_GOPList[curGOP].m_referencePics[i];
    19032074            m_GOPList[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[newRefs]=m_GOPList[curGOP].m_usedByCurrPic[i];
     2075#else
     2076            m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_referencePics[newRefs]=m_GOPList[curGOP].m_referencePics[i];
     2077            m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_usedByCurrPic[newRefs]=m_GOPList[curGOP].m_usedByCurrPic[i];
     2078#endif
    19042079            newRefs++;
    19052080          }
     
    19242099            for(Int i=0; i<newRefs; i++)
    19252100            {
     2101#if !Q0108_TSA_STSA
    19262102              if(m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[i]==offPOC-curPOC)
     2103#else
     2104              if(m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_referencePics[i]==offPOC-curPOC)
     2105#endif
    19272106              {
    19282107                newRef=false;
     
    19392118              for(Int j=0; j<newRefs; j++)
    19402119              {
     2120#if !Q0108_TSA_STSA
    19412121                if(m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[j]<offPOC-curPOC||m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[j]>0)
     2122#else
     2123                if(m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_referencePics[j]<offPOC-curPOC||m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_referencePics[j]>0)
     2124#endif
    19422125                {
    19432126                  insertPoint = j;
     
    19492132              for(Int j=insertPoint; j<newRefs+1; j++)
    19502133              {
     2134#if !Q0108_TSA_STSA
    19512135                Int newPrev = m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[j];
    19522136                Int newUsed = m_GOPList[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[j];
    19532137                m_GOPList[m_iGOPSize+m_extraRPSs].m_referencePics[j]=prev;
    19542138                m_GOPList[m_iGOPSize+m_extraRPSs].m_usedByCurrPic[j]=prevUsed;
     2139#else
     2140                Int newPrev = m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_referencePics[j];
     2141                Int newUsed = m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_usedByCurrPic[j];
     2142                m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_referencePics[j]=prev;
     2143                m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_usedByCurrPic[j]=prevUsed;
     2144#endif
     2145
    19552146                prevUsed=newUsed;
    19562147                prev=newPrev;
     
    19642155          }
    19652156        }
     2157#if !Q0108_TSA_STSA
    19662158        m_GOPList[m_iGOPSize+m_extraRPSs].m_numRefPics=newRefs;
    19672159        m_GOPList[m_iGOPSize+m_extraRPSs].m_POC = curPOC;
     2160#else
     2161        m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_numRefPics=newRefs;
     2162        m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_POC = curPOC;
     2163#endif
     2164#if !Q0108_TSA_STSA
    19682165        if (m_extraRPSs == 0)
    1969         {
     2166#else
     2167        if (m_extraRPSs[0] == 0)
     2168#endif
     2169        {
     2170#if !Q0108_TSA_STSA
    19702171          m_GOPList[m_iGOPSize+m_extraRPSs].m_interRPSPrediction = 0;
    19712172          m_GOPList[m_iGOPSize+m_extraRPSs].m_numRefIdc = 0;
     2173#else
     2174          m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_interRPSPrediction = 0;
     2175          m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_numRefIdc = 0;
     2176#endif
    19722177        }
    19732178        else
    19742179        {
     2180#if !Q0108_TSA_STSA
    19752181          Int rIdx =  m_iGOPSize + m_extraRPSs - 1;
     2182#else
     2183          Int rIdx =  m_iGOPSize + m_extraRPSs[0] - 1;
     2184#endif
    19762185          Int refPOC = m_GOPList[rIdx].m_POC;
    19772186          Int refPics = m_GOPList[rIdx].m_numRefPics;
     
    19822191            Int absPOCref = refPOC+deltaPOC;
    19832192            Int refIdc = 0;
     2193#if !Q0108_TSA_STSA
    19842194            for (Int j = 0; j < m_GOPList[m_iGOPSize+m_extraRPSs].m_numRefPics; j++)
    19852195            {
     
    20062216        m_extraRPSs++;
    20072217      }
     2218#else
     2219            for (Int j = 0; j < m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_numRefPics; j++)
     2220            {
     2221              if ( (absPOCref - curPOC) == m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_referencePics[j])
     2222              {
     2223                if (m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_usedByCurrPic[j])
     2224                {
     2225                  refIdc = 1;
     2226                }
     2227                else
     2228                {
     2229                  refIdc = 2;
     2230                }
     2231              }
     2232            }
     2233            m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_refIdc[newIdc]=refIdc;
     2234            newIdc++;
     2235          }
     2236          m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_interRPSPrediction = 1; 
     2237          m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_numRefIdc = newIdc;
     2238          m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_deltaRPS = refPOC - m_GOPList[m_iGOPSize+m_extraRPSs[0]].m_POC;
     2239        }
     2240        curGOP=m_iGOPSize+m_extraRPSs[0];
     2241        m_extraRPSs[0]++;
     2242      }
     2243#endif
     2244
    20082245      numRefs=0;
    20092246      for(Int i = 0; i< m_GOPList[curGOP].m_numRefPics; i++)
     
    20222259  }
    20232260  xConfirmPara(errorGOP,"Invalid GOP structure given");
     2261
     2262#if SVC_EXTENSION && Q0108_TSA_STSA
     2263  for ( Int layerId = 1; layerId < m_numLayers; layerId++ )
     2264  {
     2265    verifiedGOP=false;
     2266    errorGOP=false;
     2267    checkGOP=1;
     2268    numRefs = m_isField ? 2 : 1;
     2269    refList[0]=0;
     2270
     2271    if(m_isField)
     2272    {
     2273      refList[1] = 1;
     2274    }
     2275
     2276    memset( isOK, 0, sizeof( isOK ) );
     2277    numOK=0;
     2278
     2279    for(Int i=0; i<m_iGOPSize; i++)
     2280    {
     2281      if(m_EhGOPList[layerId][i].m_POC==m_iGOPSize)
     2282      {
     2283        xConfirmPara( m_EhGOPList[layerId][i].m_temporalId!=0 , "The last frame in each GOP must have temporal ID = 0 " );
     2284      }
     2285    }
     2286
     2287    xConfirmPara( m_numLayers > MAX_LAYERS , "Number of layers in config file is greater than MAX_LAYERS" );
     2288    m_numLayers = m_numLayers > MAX_LAYERS ? MAX_LAYERS : m_numLayers;
     2289
     2290    // verify layer configuration parameters
     2291    for(UInt layer=0; layer<m_numLayers; layer++)
     2292    {
     2293      Int m_iIntraPeriod = m_acLayerCfg[layer].m_iIntraPeriod;
     2294      if ( (m_iIntraPeriod != 1) && !m_loopFilterOffsetInPPS && m_DeblockingFilterControlPresent && (!m_bLoopFilterDisable) )
     2295      {
     2296        for(Int i=0; i<m_iGOPSize; i++)
     2297        {
     2298          xConfirmPara( (m_EhGOPList[layerId][i].m_betaOffsetDiv2 + m_loopFilterBetaOffsetDiv2) < -6 || (m_EhGOPList[layerId][i].m_betaOffsetDiv2 + m_loopFilterBetaOffsetDiv2) > 6, "Loop Filter Beta Offset div. 2 for one of the GOP entries exceeds supported range (-6 to 6)" );
     2299          xConfirmPara( (m_EhGOPList[layerId][i].m_tcOffsetDiv2 + m_loopFilterTcOffsetDiv2) < -6 || (m_EhGOPList[layerId][i].m_tcOffsetDiv2 + m_loopFilterTcOffsetDiv2) > 6, "Loop Filter Tc Offset div. 2 for one of the GOP entries exceeds supported range (-6 to 6)" );
     2300        }
     2301      }
     2302    }
     2303
     2304    //start looping through frames in coding order until we can verify that the GOP structure is correct.
     2305    while(!verifiedGOP&&!errorGOP)
     2306    {
     2307      Int curGOP = (checkGOP-1)%m_iGOPSize;
     2308      Int curPOC = ((checkGOP-1)/m_iGOPSize)*m_iGOPSize + m_EhGOPList[layerId][curGOP].m_POC;   
     2309      if(m_EhGOPList[layerId][curGOP].m_POC<0)
     2310      {
     2311        printf("\nError: found fewer Reference Picture Sets than GOPSize\n");
     2312        errorGOP=true;
     2313      }
     2314      else
     2315      {
     2316        //check that all reference pictures are available, or have a POC < 0 meaning they might be available in the next GOP.
     2317        Bool beforeI = false;
     2318        for(Int i = 0; i< m_EhGOPList[layerId][curGOP].m_numRefPics; i++)
     2319        {
     2320          Int absPOC = curPOC+m_EhGOPList[layerId][curGOP].m_referencePics[i];
     2321          if(absPOC < 0)
     2322          {
     2323            beforeI=true;
     2324          }
     2325          else
     2326          {
     2327            Bool found=false;
     2328            for(Int j=0; j<numRefs; j++)
     2329            {
     2330              if(refList[j]==absPOC)
     2331              {
     2332                found=true;
     2333                for(Int k=0; k<m_iGOPSize; k++)
     2334                {
     2335                  if(absPOC%m_iGOPSize == m_EhGOPList[layerId][k].m_POC%m_iGOPSize)
     2336                  {
     2337                    if(m_EhGOPList[layerId][k].m_temporalId==m_EhGOPList[layerId][curGOP].m_temporalId)
     2338                    {
     2339                      m_EhGOPList[layerId][k].m_refPic = true;
     2340                    }
     2341                    m_EhGOPList[layerId][curGOP].m_usedByCurrPic[i]=m_EhGOPList[layerId][k].m_temporalId<=m_EhGOPList[layerId][curGOP].m_temporalId;
     2342                  }
     2343                }
     2344              }
     2345            }
     2346            if(!found)
     2347            {
     2348              printf("\nError: ref pic %d is not available for GOP frame %d\n",m_EhGOPList[layerId][curGOP].m_referencePics[i],curGOP+1);
     2349              errorGOP=true;
     2350            }
     2351          }
     2352        }
     2353        if(!beforeI&&!errorGOP)
     2354        {
     2355          //all ref frames were present
     2356          if(!isOK[curGOP])
     2357          {
     2358            numOK++;
     2359            isOK[curGOP]=true;
     2360            if(numOK==m_iGOPSize)
     2361            {
     2362              verifiedGOP=true;
     2363            }
     2364          }
     2365        }
     2366        else
     2367        {
     2368          //create a new GOPEntry for this frame containing all the reference pictures that were available (POC > 0)
     2369
     2370          m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]]=m_EhGOPList[layerId][curGOP];
     2371          Int newRefs=0;
     2372          for(Int i = 0; i< m_EhGOPList[layerId][curGOP].m_numRefPics; i++)
     2373          {
     2374            Int absPOC = curPOC+m_EhGOPList[layerId][curGOP].m_referencePics[i];
     2375            if(absPOC>=0)
     2376            {
     2377              m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_referencePics[newRefs]=m_EhGOPList[layerId][curGOP].m_referencePics[i];
     2378              m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_usedByCurrPic[newRefs]=m_EhGOPList[layerId][curGOP].m_usedByCurrPic[i];
     2379              newRefs++;
     2380            }
     2381          }
     2382          Int numPrefRefs = m_EhGOPList[layerId][curGOP].m_numRefPicsActive;
     2383
     2384          for(Int offset = -1; offset>-checkGOP; offset--)
     2385          {
     2386            //step backwards in coding order and include any extra available pictures we might find useful to replace the ones with POC < 0.
     2387            Int offGOP = (checkGOP-1+offset)%m_iGOPSize;
     2388            Int offPOC = ((checkGOP-1+offset)/m_iGOPSize)*m_iGOPSize + m_EhGOPList[layerId][offGOP].m_POC;
     2389            if(offPOC>=0&&m_EhGOPList[layerId][offGOP].m_temporalId<=m_EhGOPList[layerId][curGOP].m_temporalId)
     2390            {
     2391              Bool newRef=false;
     2392              for(Int i=0; i<numRefs; i++)
     2393              {
     2394                if(refList[i]==offPOC)
     2395                {
     2396                  newRef=true;
     2397                }
     2398              }
     2399              for(Int i=0; i<newRefs; i++)
     2400              {
     2401                if(m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_referencePics[i]==offPOC-curPOC)
     2402                {
     2403                  newRef=false;
     2404                }
     2405              }
     2406              if(newRef)
     2407              {
     2408                Int insertPoint=newRefs;
     2409                //this picture can be added, find appropriate place in list and insert it.
     2410                if(m_EhGOPList[layerId][offGOP].m_temporalId==m_EhGOPList[layerId][curGOP].m_temporalId)
     2411                {
     2412                  m_EhGOPList[layerId][offGOP].m_refPic = true;
     2413                }
     2414                for(Int j=0; j<newRefs; j++)
     2415                {
     2416                  if(m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_referencePics[j]<offPOC-curPOC||m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_referencePics[j]>0)
     2417                  {
     2418                    insertPoint = j;
     2419                    break;
     2420                  }
     2421                }
     2422                Int prev = offPOC-curPOC;
     2423                Int prevUsed = m_EhGOPList[layerId][offGOP].m_temporalId<=m_EhGOPList[layerId][curGOP].m_temporalId;
     2424                for(Int j=insertPoint; j<newRefs+1; j++)
     2425                {
     2426                  Int newPrev = m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_referencePics[j];
     2427                  Int newUsed = m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_usedByCurrPic[j];
     2428                  m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_referencePics[j]=prev;
     2429                  m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_usedByCurrPic[j]=prevUsed;
     2430                  prevUsed=newUsed;
     2431                  prev=newPrev;
     2432                }
     2433                newRefs++;
     2434              }
     2435            }
     2436            if(newRefs>=numPrefRefs)
     2437            {
     2438              break;
     2439            }
     2440          }
     2441          m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_numRefPics=newRefs;
     2442          m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_POC = curPOC;
     2443          if (m_extraRPSs[layerId] == 0)
     2444          {
     2445            m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_interRPSPrediction = 0;
     2446            m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_numRefIdc = 0;
     2447          }
     2448          else
     2449          {
     2450            Int rIdx =  m_iGOPSize + m_extraRPSs[layerId] - 1;
     2451            Int refPOC = m_EhGOPList[layerId][rIdx].m_POC;
     2452            Int refPics = m_EhGOPList[layerId][rIdx].m_numRefPics;
     2453            Int newIdc=0;
     2454            for(Int i = 0; i<= refPics; i++)
     2455            {
     2456              Int deltaPOC = ((i != refPics)? m_EhGOPList[layerId][rIdx].m_referencePics[i] : 0);  // check if the reference abs POC is >= 0
     2457              Int absPOCref = refPOC+deltaPOC;
     2458              Int refIdc = 0;
     2459              for (Int j = 0; j < m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_numRefPics; j++)
     2460              {
     2461                if ( (absPOCref - curPOC) == m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_referencePics[j])
     2462                {
     2463                  if (m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_usedByCurrPic[j])
     2464                  {
     2465                    refIdc = 1;
     2466                  }
     2467                  else
     2468                  {
     2469                    refIdc = 2;
     2470                  }
     2471                }
     2472              }
     2473              m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_refIdc[newIdc]=refIdc;
     2474              newIdc++;
     2475            }
     2476            m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_interRPSPrediction = 1; 
     2477            m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_numRefIdc = newIdc;
     2478            m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_deltaRPS = refPOC - m_EhGOPList[layerId][m_iGOPSize+m_extraRPSs[layerId]].m_POC;
     2479          }
     2480          curGOP=m_iGOPSize+m_extraRPSs[layerId];
     2481          m_extraRPSs[layerId]++;
     2482        }
     2483        numRefs=0;
     2484        for(Int i = 0; i< m_EhGOPList[layerId][curGOP].m_numRefPics; i++)
     2485        {
     2486          Int absPOC = curPOC+m_EhGOPList[layerId][curGOP].m_referencePics[i];
     2487          if(absPOC >= 0)
     2488          {
     2489            refList[numRefs]=absPOC;
     2490            numRefs++;
     2491          }
     2492        }
     2493        refList[numRefs]=curPOC;
     2494        numRefs++;
     2495      }
     2496      checkGOP++;
     2497    }
     2498    xConfirmPara(errorGOP,"Invalid GOP structure given");
     2499  }
     2500#endif
     2501
    20242502  m_maxTempLayer = 1;
    20252503  for(Int i=0; i<m_iGOPSize; i++)
     
    20312509    xConfirmPara(m_GOPList[i].m_sliceType!='B'&&m_GOPList[i].m_sliceType!='P'&&m_GOPList[i].m_sliceType!='I', "Slice type must be equal to B or P or I");
    20322510  }
     2511
     2512#if Q0108_TSA_STSA
     2513  for ( Int layerId = 1; layerId < m_numLayers; layerId++)
     2514  {
     2515    m_EhMaxTempLayer[layerId] = 1;
     2516    for(Int i=0; i<m_iGOPSize; i++)
     2517    {
     2518      if(m_EhGOPList[layerId][i].m_temporalId >= m_EhMaxTempLayer[layerId] )
     2519      {
     2520        m_EhMaxTempLayer[layerId] = m_EhGOPList[layerId][i].m_temporalId;
     2521      }
     2522      xConfirmPara(m_GOPList[i].m_sliceType!='B'&&m_GOPList[i].m_sliceType!='P'&&m_GOPList[i].m_sliceType!='I', "Slice type must be equal to B or P or I");
     2523    }
     2524  }
     2525#endif
     2526
    20332527  for(Int i=0; i<MAX_TLAYER; i++)
    20342528  {
     
    21952689    xConfirmPara( m_extendedWhiteLevelLumaCodeValue < m_nominalWhiteLevelLumaCodeValue, "SEIToneMapExtendedWhiteLevelLumaCodeValue shall be greater than or equal to SEIToneMapNominalWhiteLevelLumaCodeValue");
    21962690  }
     2691#if P0050_KNEE_FUNCTION_SEI
     2692  if (m_kneeSEIEnabled && !m_kneeSEICancelFlag)
     2693  {
     2694    xConfirmPara( m_kneeSEINumKneePointsMinus1 < 0 || m_kneeSEINumKneePointsMinus1 > 998, "SEIKneeFunctionNumKneePointsMinus1 must be in the range of 0 to 998");
     2695    for ( UInt i=0; i<=m_kneeSEINumKneePointsMinus1; i++ ){
     2696      xConfirmPara( m_kneeSEIInputKneePoint[i] < 1 || m_kneeSEIInputKneePoint[i] > 999, "SEIKneeFunctionInputKneePointValue must be in the range of 1 to 999");
     2697      xConfirmPara( m_kneeSEIOutputKneePoint[i] < 0 || m_kneeSEIOutputKneePoint[i] > 1000, "SEIKneeFunctionInputKneePointValue must be in the range of 0 to 1000");
     2698      if ( i > 0 )
     2699      {
     2700        xConfirmPara( m_kneeSEIInputKneePoint[i-1] >= m_kneeSEIInputKneePoint[i],  "The i-th SEIKneeFunctionInputKneePointValue must be greather than the (i-1)-th value");
     2701      }
     2702    }
     2703  }
     2704#endif
    21972705
    21982706#if RC_SHVC_HARMONIZATION
     
    22342742    xConfirmPara(m_framePackingSEIType < 3 || m_framePackingSEIType > 5 , "SEIFramePackingType must be in rage 3 to 5");
    22352743  }
     2744
     2745#if SVC_EXTENSION
    22362746#if VPS_EXTN_DIRECT_REF_LAYERS
    22372747  xConfirmPara( (m_acLayerCfg[0].m_numSamplePredRefLayers != 0) && (m_acLayerCfg[0].m_numSamplePredRefLayers != -1), "Layer 0 cannot have any reference layers" );
     
    23042814  }
    23052815#endif
    2306 #if N0120_MAX_TID_REF_CFG
    23072816  for (UInt layer=0; layer < MAX_LAYERS-1; layer++)
    23082817  {
    23092818    xConfirmPara(m_acLayerCfg[layer].m_maxTidIlRefPicsPlus1 < 0 || m_acLayerCfg[layer].m_maxTidIlRefPicsPlus1 > 7, "MaxTidIlRefPicsPlus1 must be in range 0 to 7");
    23102819  }
    2311 #endif
    23122820#if AUXILIARY_PICTURES
    23132821  for (UInt layer=0; layer < MAX_LAYERS-1; layer++)
     
    23202828  xConfirmPara( m_nCGSFlag < 0 || m_nCGSFlag > 1 , "0<=CGS<=1" );
    23212829#endif
     2830#endif //SVC_EXTENSION
    23222831#undef xConfirmPara
    23232832  if (check_failed)
     
    23972906#if SVC_EXTENSION 
    23982907  printf("Total number of layers        : %d\n", m_numLayers       );
    2399 #if SCALABILITY_MASK_E0104
    2400   printf("Multiview                     : %d\n", m_scalabilityMask[1] );
    2401   printf("Scalable                      : %d\n", m_scalabilityMask[2] );
     2908  printf("Multiview                     : %d\n", m_scalabilityMask[VIEW_ORDER_INDEX] );
     2909  printf("Scalable                      : %d\n", m_scalabilityMask[SCALABILITY_ID] );
    24022910#if AVC_BASE
    24032911  printf("Base layer                    : %s\n", m_avcBaseLayerFlag ? "AVC" : "HEVC");
    24042912#endif
    24052913#if AUXILIARY_PICTURES
    2406   printf("Auxiliary pictures            : %d\n", m_scalabilityMask[3] );
    2407 #endif
    2408 #else
    2409   printf("Multiview                     : %d\n", m_scalabilityMask[0] );
    2410   printf("Scalable                      : %d\n", m_scalabilityMask[1] );
     2914  printf("Auxiliary pictures            : %d\n", m_scalabilityMask[AUX_ID] );
    24112915#endif
    24122916#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     
    24192923  printf("Align picture type            : %d\n", m_crossLayerPictureTypeAlignFlag );
    24202924#endif
    2421 #if N0147_IRAP_ALIGN_FLAG
    24222925  printf("Cross layer IRAP alignment    : %d\n", m_crossLayerIrapAlignFlag );
    2423 #endif
    24242926#if P0068_CROSS_LAYER_ALIGNED_IDR_ONLY_FOR_IRAP_FLAG
    24252927  printf("IDR only for IRAP             : %d\n", m_crossLayerAlignedIdrOnlyFlag );
  • TabularUnified trunk/source/App/TAppEncoder/TAppEncCfg.h

    r713 r815  
    7373  Char*     m_BLSyntaxFile;                                   ///< input syntax file
    7474#endif
    75 #if N0120_MAX_TID_REF_CFG
    7675  Bool      m_maxTidRefPresentFlag;
    77 #endif
     76#if Q0078_ADD_LAYER_SETS
     77  Int       m_numLayerSets;
     78  Int       m_numLayerInIdList[MAX_VPS_LAYER_SETS_PLUS1];
     79  Int       m_layerSetLayerIdList[MAX_VPS_LAYER_SETS_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
     80  Int       m_numAddLayerSets;
     81  Int       m_numHighestLayerIdx[MAX_VPS_LAYER_SETS_PLUS1];
     82  Int       m_highestLayerIdx[MAX_VPS_LAYER_SETS_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
     83#endif
    7884#else
    7985  Char*     m_pchInputFile;                                   ///< source file name
     
    119125  Int       m_iDecodingRefreshType;                           ///< random access type
    120126  Int       m_iGOPSize;                                       ///< GOP size of hierarchical structure
     127
     128#if !Q0108_TSA_STSA
    121129  Int       m_extraRPSs;                                      ///< extra RPSs added to handle CRA
     130#else
     131  Int       m_extraRPSs[MAX_LAYERS];                          ///< extra RPSs added to handle CRA
     132#endif
     133
    122134  GOPEntry  m_GOPList[MAX_GOP];                               ///< the coding structure entries from the config file
     135#if Q0108_TSA_STSA
     136  GOPEntry  m_EhGOPList[MAX_LAYERS][MAX_GOP];                 ///< the enhancement layer coding structure entries from the config file
     137  Int       m_inheritCodingStruct[MAX_LAYERS];
     138#endif
     139
    123140  Int       m_numReorderPics[MAX_TLAYER];                     ///< total number of reorder pictures
    124141  Int       m_maxDecPicBuffering[MAX_TLAYER];                 ///< total number of pictures in the decoded picture buffer
     
    148165 
    149166  Int       m_maxTempLayer;                                  ///< Max temporal layer
     167#if Q0108_TSA_STSA
     168  Int       m_EhMaxTempLayer[MAX_LAYERS];                    ///< Max temporal layer
     169#endif
    150170
    151171#if !LAYER_CTB
     
    285305  Int       m_SOPDescriptionSEIEnabled;
    286306  Int       m_scalableNestingSEIEnabled;
     307#if Q0189_TMVP_CONSTRAINTS
     308  Int       m_TMVPConstraintsSEIEnabled;
     309#endif
    287310  // weighted prediction
    288311  Bool      m_useWeightedPred;                    ///< Use of weighted prediction in P slices
     
    363386  Void  xPrintParameter ();                                   ///< print configuration values
    364387  Void  xPrintUsage     ();                                   ///< print usage
     388#if SVC_EXTENSION
    365389#if M0040_ADAPTIVE_RESOLUTION_CHANGE
    366390  Int       m_adaptiveResolutionChange;                       ///< Indicate adaptive resolution change frame
     
    386410  Bool      m_crossLayerPictureTypeAlignFlag;
    387411#endif
    388 #if N0147_IRAP_ALIGN_FLAG
    389412  Bool      m_crossLayerIrapAlignFlag;
     413#if P0050_KNEE_FUNCTION_SEI
     414  Bool      m_kneeSEIEnabled;
     415  Int       m_kneeSEIId;
     416  Bool      m_kneeSEICancelFlag;
     417  Bool      m_kneeSEIPersistenceFlag;
     418  Bool      m_kneeSEIMappingFlag;
     419  Int       m_kneeSEIInputDrange;
     420  Int       m_kneeSEIInputDispLuminance;
     421  Int       m_kneeSEIOutputDrange;
     422  Int       m_kneeSEIOutputDispLuminance;
     423  Int       m_kneeSEINumKneePointsMinus1;
     424  Int*      m_kneeSEIInputKneePoint;
     425  Int*      m_kneeSEIOutputKneePoint;
    390426#endif
    391427#if P0068_CROSS_LAYER_ALIGNED_IDR_ONLY_FOR_IRAP_FLAG
     
    404440  Int  m_nCGSLUTBit;
    405441#endif
     442#endif //SVC_EXTENSION
    406443public:
    407444  TAppEncCfg();
  • TabularUnified trunk/source/App/TAppEncoder/TAppEncLayerCfg.h

    r713 r815  
    8383#endif
    8484
    85 #if N0120_MAX_TID_REF_CFG
    8685  Int       m_maxTidIlRefPicsPlus1;
    87 #endif
    8886  Int       m_iWaveFrontSubstreams; //< If iWaveFrontSynchro, this is the number of substreams per frame (dependent tiles) or per tile (independent tiles).
    8987
     
    181179  Void    setSourceHeight(Int x)      { m_iSourceHeight = x;    }
    182180#endif
    183 #if N0120_MAX_TID_REF_CFG
    184181  Int     getMaxTidIlRefPicsPlus1()   { return m_maxTidIlRefPicsPlus1; }
    185 #endif
    186182#if LAYER_CTB
    187183  UInt    getMaxCUWidth()             {return m_uiMaxCUWidth;      }
  • TabularUnified trunk/source/App/TAppEncoder/TAppEncTop.cpp

    r713 r815  
    8282    vps->setTemporalNestingFlag(true);
    8383  }
    84 #if !VPS_RENAME
    85   vps.setMaxLayers                        ( 1 );
    86 #endif
    8784  for(Int i = 0; i < MAX_TLAYER; i++)
    8885  {
     
    190187  delete [] mapIdxToLayer;
    191188#endif
     189
     190  assert( m_numLayers <= MAX_LAYERS );
    192191
    193192  for(UInt layer=0; layer<m_numLayers; layer++)
     
    241240    m_acTEncTop[layer].setDecodingRefreshType          ( m_iDecodingRefreshType );
    242241    m_acTEncTop[layer].setGOPSize                      ( m_iGOPSize );
     242#if Q0108_TSA_STSA
     243    m_acTEncTop[layer].setGopList                      ( layer ? m_EhGOPList[layer] : m_GOPList );
     244#else
    243245    m_acTEncTop[layer].setGopList                      ( m_GOPList );
    244 
     246#endif
     247
     248#if !Q0108_TSA_STSA
    245249    m_acTEncTop[layer].setExtraRPSs                    ( m_extraRPSs );
     250#else
     251    m_acTEncTop[layer].setExtraRPSs                    ( m_extraRPSs[layer] );
     252#endif
    246253    for(Int i = 0; i < MAX_TLAYER; i++)
    247254    {
     
    256263
    257264    m_acTEncTop[layer].setPad                          ( m_acLayerCfg[layer].getPad() );
    258 
     265#if !Q0108_TSA_STSA
    259266    m_acTEncTop[layer].setMaxTempLayer                 ( m_maxTempLayer );
     267#else
     268    if (layer== 0)
     269    {
     270      m_acTEncTop[layer].setMaxTempLayer                 ( m_maxTempLayer );
     271    }
     272    else
     273    {
     274      m_acTEncTop[layer].setMaxTempLayer                 ( m_EhMaxTempLayer[layer] );
     275    }
     276#endif
    260277    m_acTEncTop[layer].setUseAMP( m_enableAMP );
    261 #if N0120_MAX_TID_REF_CFG
    262     if (layer<m_numLayers-1)
     278
     279    if( layer < m_numLayers - 1 )
    263280    {
    264281       m_acTEncTop[layer].setMaxTidIlRefPicsPlus1 ( m_acLayerCfg[layer].getMaxTidIlRefPicsPlus1());
    265282    }
    266 #endif
     283
    267284#if VPS_EXTN_DIRECT_REF_LAYERS
    268285    if(layer)
     
    306323      }
    307324      Int numDirectRefLayers = 0;
     325
     326      assert( layer < MAX_LAYERS );
     327
    308328      for (Int i = 0; i < layer; i++)
    309329      {
     
    480500    m_acTEncTop[layer].setTMISEINominalWhiteLevelLumaCodeValue      ( m_nominalWhiteLevelLumaCodeValue );
    481501    m_acTEncTop[layer].setTMISEIExtendedWhiteLevelLumaCodeValue     ( m_extendedWhiteLevelLumaCodeValue );
     502#if P0050_KNEE_FUNCTION_SEI
     503    m_acTEncTop[layer].setKneeSEIEnabled                            ( m_kneeSEIEnabled );
     504    m_acTEncTop[layer].setKneeSEIId                                 ( m_kneeSEIId );
     505    m_acTEncTop[layer].setKneeSEICancelFlag                         ( m_kneeSEICancelFlag );
     506    m_acTEncTop[layer].setKneeSEIPersistenceFlag                    ( m_kneeSEIPersistenceFlag );
     507    m_acTEncTop[layer].setKneeSEIMappingFlag                        ( m_kneeSEIMappingFlag );
     508    m_acTEncTop[layer].setKneeSEIInputDrange                        ( m_kneeSEIInputDrange );
     509    m_acTEncTop[layer].setKneeSEIInputDispLuminance                 ( m_kneeSEIInputDispLuminance );
     510    m_acTEncTop[layer].setKneeSEIOutputDrange                       ( m_kneeSEIOutputDrange );
     511    m_acTEncTop[layer].setKneeSEIOutputDispLuminance                ( m_kneeSEIOutputDispLuminance );
     512    m_acTEncTop[layer].setKneeSEINumKneePointsMinus1                ( m_kneeSEINumKneePointsMinus1 );
     513    m_acTEncTop[layer].setKneeSEIInputKneePoint                     ( m_kneeSEIInputKneePoint );
     514    m_acTEncTop[layer].setKneeSEIOutputKneePoint                    ( m_kneeSEIOutputKneePoint );
     515#endif
    482516#if Q0074_SEI_COLOR_MAPPING
    483517    m_acTEncTop[layer].setColorMappingInfoSEIFile                   ( m_acLayerCfg[layer].m_cSeiColorMappingFile.empty() ? NULL : const_cast<Char *>(m_acLayerCfg[layer].m_cSeiColorMappingFile.c_str()) );
     
    497531    m_acTEncTop[layer].setSOPDescriptionSEIEnabled( m_SOPDescriptionSEIEnabled );
    498532    m_acTEncTop[layer].setScalableNestingSEIEnabled( m_scalableNestingSEIEnabled );
     533#if Q0189_TMVP_CONSTRAINTS
     534    m_acTEncTop[layer].setTMVPConstraintsSEIEnabled( m_TMVPConstraintsSEIEnabled);           
     535#endif
    499536#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
    500537    m_acTEncTop[layer].setInterLayerConstrainedTileSetsSEIEnabled( m_interLayerConstrainedTileSetsSEIEnabled );
     
    614651    m_acTEncTop[layer].setCGSLUTBit( m_nCGSLUTBit );
    615652#endif
     653#if Q0078_ADD_LAYER_SETS
     654    m_acTEncTop[layer].setNumAddLayerSets( m_numAddLayerSets );
     655#endif
    616656  }
    617657}
     
    799839  m_cTEncTop.setTMISEINominalWhiteLevelLumaCodeValue      ( m_nominalWhiteLevelLumaCodeValue );
    800840  m_cTEncTop.setTMISEIExtendedWhiteLevelLumaCodeValue     ( m_extendedWhiteLevelLumaCodeValue );
     841#if P0050_KNEE_FUNCTION_SEI
     842  m_cTEncTop.setKneeSEIEnabled              ( m_kneeSEIEnabled );
     843  m_cTEncTop.setKneeSEIId                   ( m_kneeSEIId );
     844  m_cTEncTop.setKneeSEICancelFlag           ( m_kneeSEICancelFlag );
     845  m_cTEncTop.setKneeSEIPersistenceFlag      ( m_kneeSEIPersistenceFlag );
     846  m_cTEncTop.setKneeSEIMappingFlag          ( m_kneeSEIMappingFlag );
     847  m_cTEncTop.setKneeSEIInputDrange          ( m_kneeSEIInputDrange );
     848  m_cTEncTop.setKneeSEIInputDispLuminance   ( m_kneeSEIInputDispLuminance );
     849  m_cTEncTop.setKneeSEIOutputDrange         ( m_kneeSEIOutputDrange );
     850  m_cTEncTop.setKneeSEIOutputDispLuminance  ( m_kneeSEIOutputDispLuminance );
     851  m_cTEncTop.setKneeSEINumKneePointsMinus1  ( m_kneeSEINumKneePointsMinus1 );
     852  m_cTEncTop.setKneeSEIInputKneePoint       ( m_kneeSEIInputKneePoint );
     853  m_cTEncTop.setKneeSEIOutputKneePoint      ( m_kneeSEIOutputKneePoint );
     854#endif
    801855#if Q0074_SEI_COLOR_MAPPING
    802856  m_cTEncTop.setColorMappingInfoSEIFile                   ( m_pchSEIColorMappingFile );
     
    9941048#endif
    9951049  }
    996 #if VPS_RENAME
    9971050  m_acTEncTop[0].getVPS()->setMaxLayers( m_numLayers );
    998 #endif
    9991051#if VPS_EXTN_OP_LAYER_SETS
    10001052  TComVPS* vps = m_acTEncTop[0].getVPS();
     
    10031055  vps->setVpsExtensionFlag( m_numLayers > 1 ? true : false );
    10041056
    1005   vps->setNumLayerSets(m_numLayers);
    1006   for(Int setId = 1; setId < vps->getNumLayerSets(); setId++)
    1007   {
    1008     for(Int layerId = 0; layerId <= vps->getMaxLayerId(); layerId++)
    1009     {
     1057#if Q0078_ADD_LAYER_SETS
     1058  if (m_numLayerSets > 0)
     1059  {
     1060    vps->setNumLayerSets(m_numLayerSets+1);
     1061    for (Int setId = 1; setId < vps->getNumLayerSets(); setId++)
     1062    {
     1063      for (Int layerId = 0; layerId <= vps->getMaxLayerId(); layerId++)
     1064      {
     1065        vps->setLayerIdIncludedFlag(false, setId, layerId);
     1066      }
     1067    }
     1068    for (Int setId = 1; setId < vps->getNumLayerSets(); setId++)
     1069    {
     1070      for (Int i = 0; i < m_numLayerInIdList[setId-1]; i++)
     1071      {
     1072        Int layerId = m_layerSetLayerIdList[setId-1][i];
     1073
    10101074#if O0194_DIFFERENT_BITDEPTH_EL_BL
    1011       //4
    1012       g_bitDepthY = m_acLayerCfg[layerId].m_internalBitDepthY;
    1013       g_bitDepthC = m_acLayerCfg[layerId].m_internalBitDepthC;
    1014 
    1015       g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layerId].m_inputBitDepthY : m_acLayerCfg[layerId].m_internalBitDepthY;
    1016       g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layerId].m_inputBitDepthC : m_acLayerCfg[layerId].m_internalBitDepthC;
    1017 #endif
    1018       if( layerId <= setId )
    1019       {
     1075        //4
     1076        g_bitDepthY = m_acLayerCfg[layerId].m_internalBitDepthY;
     1077        g_bitDepthC = m_acLayerCfg[layerId].m_internalBitDepthC;
     1078
     1079        g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layerId].m_inputBitDepthY : m_acLayerCfg[layerId].m_internalBitDepthY;
     1080        g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layerId].m_inputBitDepthC : m_acLayerCfg[layerId].m_internalBitDepthC;
     1081#endif
     1082
    10201083        vps->setLayerIdIncludedFlag(true, setId, layerId);
    10211084      }
    1022       else
    1023       {
    1024         vps->setLayerIdIncludedFlag(false, setId, layerId);
    1025       }
    1026     }
    1027   }
     1085    }
     1086  }
     1087  else
     1088  {
     1089    // Default layer sets
     1090#endif
     1091    vps->setNumLayerSets(m_numLayers);
     1092    for (Int setId = 1; setId < vps->getNumLayerSets(); setId++)
     1093    {
     1094      for (Int layerId = 0; layerId <= vps->getMaxLayerId(); layerId++)
     1095      {
     1096#if O0194_DIFFERENT_BITDEPTH_EL_BL
     1097        //4
     1098        g_bitDepthY = m_acLayerCfg[layerId].m_internalBitDepthY;
     1099        g_bitDepthC = m_acLayerCfg[layerId].m_internalBitDepthC;
     1100
     1101        g_uiPCMBitDepthLuma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layerId].m_inputBitDepthY : m_acLayerCfg[layerId].m_internalBitDepthY;
     1102        g_uiPCMBitDepthChroma = m_bPCMInputBitDepthFlag ? m_acLayerCfg[layerId].m_inputBitDepthC : m_acLayerCfg[layerId].m_internalBitDepthC;
     1103#endif
     1104        if (layerId <= setId)
     1105        {
     1106          vps->setLayerIdIncludedFlag(true, setId, layerId);
     1107        }
     1108        else
     1109        {
     1110          vps->setLayerIdIncludedFlag(false, setId, layerId);
     1111        }
     1112      }
     1113    }
     1114#if Q0078_ADD_LAYER_SETS
     1115  }
     1116#endif
     1117#if Q0078_ADD_LAYER_SETS
     1118  vps->setVpsNumLayerSetsMinus1(vps->getNumLayerSets() - 1);
     1119  vps->setNumAddLayerSets(m_numAddLayerSets);
     1120  vps->setNumLayerSets(vps->getNumLayerSets() + vps->getNumAddLayerSets());
     1121  if (m_numAddLayerSets > 0)
     1122  {
     1123    for (Int setId = 0; setId < m_numAddLayerSets; setId++)
     1124    {
     1125      for (Int j = 0; j < m_numHighestLayerIdx[setId]; j++)
     1126      {
     1127        vps->setHighestLayerIdxPlus1(setId, j + 1, m_highestLayerIdx[setId][j] + 1);
     1128      }
     1129    }
     1130  }
     1131#endif
    10281132#if VPS_EXTN_MASK_AND_DIM_INFO
    10291133  UInt i = 0, dimIdLen = 0;
     
    10971201#if VPS_TSLAYERS
    10981202    vps->setMaxTSLayersPresentFlag(true);
     1203
    10991204    for( i = 0; i < vps->getMaxLayers(); i++ )
    11001205    {
     
    11021207    }
    11031208#endif
    1104 #if N0120_MAX_TID_REF_PRESENT_FLAG
    1105 #if N0120_MAX_TID_REF_CFG
    11061209  vps->setMaxTidRefPresentFlag(m_maxTidRefPresentFlag);
    1107 #else
    1108   vps->setMaxTidRefPresentFlag(true);
    1109 #endif
    11101210  if (vps->getMaxTidRefPresentFlag())
    11111211  {
    11121212    for( i = 0; i < vps->getMaxLayers() - 1; i++ )
    11131213    {
    1114 #if N0120_MAX_TID_REF_CFG
    11151214#if O0225_MAX_TID_FOR_REF_LAYERS
    11161215      for( Int j = i+1; j < vps->getMaxLayers(); j++)
     
    11211220      vps->setMaxTidIlRefPicsPlus1(i, m_acTEncTop[i].getMaxTidIlRefPicsPlus1());
    11221221#endif
    1123 #else
     1222    }
     1223  }
     1224  else
     1225  {
     1226    for( i = 0; i < vps->getMaxLayers() - 1; i++ )
     1227    {
    11241228#if O0225_MAX_TID_FOR_REF_LAYERS
    11251229      for( Int j = i+1; j < vps->getMaxLayers(); j++)
    11261230      {
    1127         vps->setMaxTidIlRefPicsPlus1(i, j, vps->getMaxTLayers()+1);
    1128       }
    1129 #else
    1130       vps->setMaxTidIlRefPicsPlus1(i, vps->getMaxTLayers()+1);
    1131 #endif
    1132 #endif
    1133     }
    1134   }
    1135   else
    1136   {
    1137     for( i = 0; i < vps->getMaxLayers() - 1; i++ )
    1138     {
    1139 #if O0225_MAX_TID_FOR_REF_LAYERS
    1140       for( Int j = i+1; j < vps->getMaxLayers(); j++)
    1141       {
    11421231        vps->setMaxTidIlRefPicsPlus1(i, j, 7);
    11431232      }
     
    11471236    }
    11481237  }
    1149 #endif
    1150 #if ILP_SSH_SIG
    1151 #if ILP_SSH_SIG_FIX
    11521238    vps->setIlpSshSignalingEnabledFlag(false);
    1153 #else
    1154     vps->setIlpSshSignalingEnabledFlag(true);
    1155 #endif
    1156 #endif
    11571239#if VPS_EXTN_PROFILE_INFO
    11581240  vps->getPTLForExtnPtr()->resize(vps->getNumLayerSets());
     
    11621244    // Note - may need to be changed for other layer structures.
    11631245    *(vps->getPTLForExtn(setId)) = *(m_acTEncTop[setId].getSPS()->getPTL());
    1164   }
    1165 #endif
    1166   // Target output layer
    1167   vps->setNumOutputLayerSets(vps->getNumLayerSets());
    1168   vps->setNumProfileTierLevel(vps->getNumLayerSets());
    1169 #if P0295_DEFAULT_OUT_LAYER_IDC
    1170   vps->setDefaultTargetOutputLayerIdc(1);
    1171 #else
    1172 #if O0109_DEFAULT_ONE_OUT_LAYER_IDC
    1173   vps->setDefaultOneTargetOutputLayerIdc(1);
    1174 #else
    1175   vps->setDefaultOneTargetOutputLayerFlag(true);
    1176 #endif
    1177 #endif
    1178   for(i = 1; i < vps->getNumLayerSets(); i++)
    1179   {
    1180     vps->setProfileLevelTierIdx(i, i);
    1181     vps->setOutputLayerSetIdx(i, i);
    1182   } 
    1183 #endif
    1184  #if VPS_DPB_SIZE_TABLE
    1185   // The Layer ID List variables can be derived here. 
    1186 #if DERIVE_LAYER_ID_LIST_VARIABLES
    1187   vps->deriveLayerIdListVariables();
    1188 #endif
    1189 #if RESOLUTION_BASED_DPB
    1190   vps->assignSubDpbIndices();
    1191 #else
    1192   vps->deriveNumberOfSubDpbs();
    1193 #endif
    1194 
    1195   // derive OutputLayerFlag[i][j]
    1196   if( vps->getDefaultTargetOutputLayerIdc() == 1 )
    1197   {
    1198     // default_target_output_layer_idc equal to 1 specifies that only the layer with the highest value of nuh_layer_id such that nuh_layer_id equal to nuhLayerIdA and
    1199     // AuxId[ nuhLayerIdA ] equal to 0 in each of the output layer sets with index in the range of 1 to vps_num_layer_sets_minus1, inclusive, is an output layer of its output layer set.
    1200 
    1201     // Include the highest layer as output layer for each layer set
    1202     for(Int lsIdx = 1; lsIdx < vps->getNumLayerSets(); lsIdx++)
    1203     {
    1204       for( UInt layer = 0; layer < vps->getNumLayersInIdList(lsIdx); layer++ )
    1205       {
    1206         if( vps->getLayerIdIncludedFlag(lsIdx, layer) )     
    1207         {       
    1208           vps->setOutputLayerFlag( lsIdx, layer, layer == vps->getNumLayersInIdList(lsIdx) - 1 );
    1209         }
    1210       }
    1211     }
    1212   }
    1213   else
    1214   {
    1215     // cases when default_target_output_layer_idc is not equal to 1
    1216     assert(!"default_target_output_layer_idc not equal to 1 is not yet supported");
    1217   }
    1218 
    1219   // Initialize dpb_size_table() for all ouput layer sets in the VPS extension
    1220   for(i = 1; i < vps->getNumOutputLayerSets(); i++)
    1221   {
    1222 #if CHANGE_NUMSUBDPB_IDX
    1223     Int layerSetIdxForOutputLayerSet = vps->getOutputLayerSetIdx( i );
    1224 #endif
    1225     Int layerSetId = vps->getOutputLayerSetIdx(i);
    1226 
    1227     for(Int j = 0; j < vps->getMaxTLayers(); j++)
    1228     {
    1229 
    1230       Int maxNumReorderPics = -1;
    1231 #if CHANGE_NUMSUBDPB_IDX
    1232 #if RESOLUTION_BASED_DPB
    1233       for(Int k = 0; k < vps->getNumLayersInIdList(layerSetIdxForOutputLayerSet); k++)
    1234 #else
    1235       for(Int k = 0; k < vps->getNumSubDpbs(layerSetIdxForOutputLayerSet); k++)
    1236 #endif
    1237 #else
    1238       for(Int k = 0; k < vps->getNumSubDpbs(i); k++)
    1239 #endif
    1240       {
    1241         Int layerId = vps->getLayerSetLayerIdList(layerSetId, k); // k-th layer in the output layer set
    1242 #if RESOLUTION_BASED_DPB
    1243         vps->setMaxVpsLayerDecPicBuffMinus1( i, k, j, m_acTEncTop[layerId].getMaxDecPicBuffering(j) - 1 );
    1244         // Add sub-DPB sizes of layers belonging to a sub-DPB. If a different sub-DPB size is calculated
    1245         // at the encoder, modify below
    1246         Int oldValue = vps->getMaxVpsDecPicBufferingMinus1( i, vps->getSubDpbAssigned( layerSetIdxForOutputLayerSet, k ), j );
    1247         oldValue += vps->getMaxVpsLayerDecPicBuffMinus1( i, k, j ) + 1;
    1248         vps->setMaxVpsDecPicBufferingMinus1( i, vps->getSubDpbAssigned( layerSetIdxForOutputLayerSet, k ), j, oldValue );
    1249 #else
    1250         vps->setMaxVpsDecPicBufferingMinus1( i, k, j,  m_acTEncTop[layerId].getMaxDecPicBuffering(j) - 1 );
    1251 #endif
    1252         maxNumReorderPics       = std::max( maxNumReorderPics, m_acTEncTop[layerId].getNumReorderPics(j));
    1253       }
    1254 #if RESOLUTION_BASED_DPB
    1255       for(Int k = 0; k < vps->getNumSubDpbs(i); k++)
    1256       {
    1257         // Decrement m_maxVpsDecPicBufferingMinus1
    1258         Int oldValue = vps->getMaxVpsDecPicBufferingMinus1( i, vps->getSubDpbAssigned( layerSetIdxForOutputLayerSet, k ), j );
    1259         vps->setMaxVpsDecPicBufferingMinus1( i, vps->getSubDpbAssigned( layerSetIdxForOutputLayerSet, k ), j, oldValue - 1 );
    1260       }
    1261 #endif
    1262       vps->setMaxVpsNumReorderPics(i, j, maxNumReorderPics);
    1263       vps->determineSubDpbInfoFlags();
    1264     }
    12651246  }
    12661247#endif
     
    12711252  Bool isDefaultDirectDependencyTypeSet = false;
    12721253#endif
    1273   for(UInt layerCtr = 1;layerCtr <= vps->getMaxLayers() - 1; layerCtr++)
    1274   {
    1275     vps->setNumDirectRefLayers( layerCtr, m_acTEncTop[layerCtr].getNumDirectRefLayers() );
    1276     maxDirectRefLayers = max<UInt>( maxDirectRefLayers, vps->getNumDirectRefLayers( layerCtr ) );
    1277 
    1278     for(i = 0; i < vps->getNumDirectRefLayers(layerCtr); i++)
    1279     {
    1280       vps->setRefLayerId( layerCtr, i, m_acTEncTop[layerCtr].getRefLayerId(i) );
     1254  for (UInt layerCtr = 1; layerCtr <= vps->getMaxLayers() - 1; layerCtr++)
     1255  {
     1256    vps->setNumDirectRefLayers(layerCtr, m_acTEncTop[layerCtr].getNumDirectRefLayers());
     1257    maxDirectRefLayers = max<UInt>(maxDirectRefLayers, vps->getNumDirectRefLayers(layerCtr));
     1258
     1259    for (i = 0; i < vps->getNumDirectRefLayers(layerCtr); i++)
     1260    {
     1261      vps->setRefLayerId(layerCtr, i, m_acTEncTop[layerCtr].getRefLayerId(i));
    12811262    }
    12821263    // Set direct dependency flag
    12831264    // Initialize flag to 0
    1284     for(Int refLayerCtr = 0; refLayerCtr < layerCtr; refLayerCtr++)
    1285     {
    1286       vps->setDirectDependencyFlag( layerCtr, refLayerCtr, false );
    1287     }
    1288     for(i = 0; i < vps->getNumDirectRefLayers(layerCtr); i++)
    1289     {
    1290       vps->setDirectDependencyFlag( layerCtr, vps->getLayerIdInVps(m_acTEncTop[layerCtr].getRefLayerId(i)), true);
     1265    for (Int refLayerCtr = 0; refLayerCtr < layerCtr; refLayerCtr++)
     1266    {
     1267      vps->setDirectDependencyFlag(layerCtr, refLayerCtr, false);
     1268    }
     1269    for (i = 0; i < vps->getNumDirectRefLayers(layerCtr); i++)
     1270    {
     1271      vps->setDirectDependencyFlag(layerCtr, vps->getLayerIdInVps(m_acTEncTop[layerCtr].getRefLayerId(i)), true);
    12911272    }
    12921273    // prediction indications
    12931274    vps->setDirectDepTypeLen(2); // sample and motion types are encoded
    1294     for(Int refLayerCtr = 0; refLayerCtr < layerCtr; refLayerCtr++)
    1295     {
    1296       if (vps->getDirectDependencyFlag( layerCtr, refLayerCtr))
     1275    for (Int refLayerCtr = 0; refLayerCtr < layerCtr; refLayerCtr++)
     1276    {
     1277      if (vps->getDirectDependencyFlag(layerCtr, refLayerCtr))
    12971278      {
    12981279        assert(m_acTEncTop[layerCtr].getSamplePredEnabledFlag(refLayerCtr) || m_acTEncTop[layerCtr].getMotionPredEnabledFlag(refLayerCtr));
    1299         vps->setDirectDependencyType( layerCtr, refLayerCtr, ((m_acTEncTop[layerCtr].getSamplePredEnabledFlag(refLayerCtr) ? 1 : 0) |
    1300                                                               (m_acTEncTop[layerCtr].getMotionPredEnabledFlag(refLayerCtr) ? 2 : 0)) - 1);
     1280        vps->setDirectDependencyType(layerCtr, refLayerCtr, ((m_acTEncTop[layerCtr].getSamplePredEnabledFlag(refLayerCtr) ? 1 : 0) |
     1281          (m_acTEncTop[layerCtr].getMotionPredEnabledFlag(refLayerCtr) ? 2 : 0)) - 1);
    13011282#if O0096_DEFAULT_DEPENDENCY_TYPE
    13021283        if (!isDefaultDirectDependencyTypeSet)
     
    13141295      else
    13151296      {
    1316         vps->setDirectDependencyType( layerCtr, refLayerCtr, 0 );
     1297        vps->setDirectDependencyType(layerCtr, refLayerCtr, 0);
    13171298      }
    13181299    }
     
    13201301
    13211302#if O0092_0094_DEPENDENCY_CONSTRAINT
    1322   for(UInt layerCtr = 1;layerCtr <= vps->getMaxLayers() - 1; layerCtr++)
    1323   {
    1324     vps->setNumRefLayers(vps->getLayerIdInNuh(layerCtr));   // identify the number of direct and indirect reference layers of current layer and set recursiveRefLayersFlags
    1325   }
    1326   if(vps->getMaxLayers() > MAX_REF_LAYERS)
    1327   {
    1328     for(UInt layerCtr = 1; layerCtr <= vps->getMaxLayers() - 1; layerCtr++)
    1329     {
    1330       assert( vps->getNumRefLayers(vps->getLayerIdInNuh(layerCtr)) <= MAX_REF_LAYERS);
    1331     }
    1332   }
    1333 #endif
     1303  vps->setNumRefLayers();
     1304
     1305  if (vps->getMaxLayers() > MAX_REF_LAYERS)
     1306  {
     1307    for (UInt layerCtr = 1; layerCtr <= vps->getMaxLayers() - 1; layerCtr++)
     1308    {
     1309      assert(vps->getNumRefLayers(vps->getLayerIdInNuh(layerCtr)) <= MAX_REF_LAYERS);
     1310    }
     1311  }
     1312#endif
     1313#if Q0078_ADD_LAYER_SETS
     1314  vps->setPredictedLayerIds();
     1315  vps->setTreePartitionLayerIdList();
     1316  vps->setLayerIdIncludedFlagsForAddLayerSets();
     1317#endif
     1318#endif
     1319  // Target output layer
     1320  vps->setNumOutputLayerSets(vps->getNumLayerSets());
     1321  vps->setNumProfileTierLevel(vps->getNumLayerSets());
     1322#if P0295_DEFAULT_OUT_LAYER_IDC
     1323  vps->setDefaultTargetOutputLayerIdc(1);
     1324#else
     1325#if O0109_DEFAULT_ONE_OUT_LAYER_IDC
     1326  vps->setDefaultOneTargetOutputLayerIdc(1);
     1327#else
     1328  vps->setDefaultOneTargetOutputLayerFlag(true);
     1329#endif
     1330#endif
     1331  for(i = 1; i < vps->getNumLayerSets(); i++)
     1332  {
     1333    vps->setProfileLevelTierIdx(i, i);
     1334    vps->setOutputLayerSetIdx(i, i);
     1335  } 
     1336#endif
     1337 #if VPS_DPB_SIZE_TABLE
     1338  // The Layer ID List variables can be derived here. 
     1339#if DERIVE_LAYER_ID_LIST_VARIABLES
     1340  vps->deriveLayerIdListVariables();
     1341#endif
     1342#if RESOLUTION_BASED_DPB
     1343  vps->assignSubDpbIndices();
     1344#else
     1345  vps->deriveNumberOfSubDpbs();
     1346#endif
     1347
     1348  // derive OutputLayerFlag[i][j]
     1349  if( vps->getDefaultTargetOutputLayerIdc() == 1 )
     1350  {
     1351    // default_output_layer_idc equal to 1 specifies that only the layer with the highest value of nuh_layer_id such that nuh_layer_id equal to nuhLayerIdA and
     1352    // AuxId[ nuhLayerIdA ] equal to 0 in each of the output layer sets with index in the range of 1 to vps_num_layer_sets_minus1, inclusive, is an output layer of its output layer set.
     1353
     1354    // Include the highest layer as output layer for each layer set
     1355    for(Int lsIdx = 1; lsIdx < vps->getNumLayerSets(); lsIdx++)
     1356    {
     1357      for( UInt layer = 0; layer < vps->getNumLayersInIdList(lsIdx); layer++ )
     1358      {
     1359#if !Q0078_ADD_LAYER_SETS  // the following condition is incorrect and is not needed anyway
     1360        if( vps->getLayerIdIncludedFlag(lsIdx, layer) )     
     1361#endif
     1362        {       
     1363          vps->setOutputLayerFlag( lsIdx, layer, layer == vps->getNumLayersInIdList(lsIdx) - 1 );
     1364        }
     1365      }
     1366    }
     1367  }
     1368  else
     1369  {
     1370    // cases when default_output_layer_idc is not equal to 1
     1371    assert(!"default_output_layer_idc not equal to 1 is not yet supported");
     1372  }
     1373
     1374  // Initialize dpb_size_table() for all ouput layer sets in the VPS extension
     1375  for(i = 1; i < vps->getNumOutputLayerSets(); i++)
     1376  {
     1377#if CHANGE_NUMSUBDPB_IDX
     1378    Int layerSetIdxForOutputLayerSet = vps->getOutputLayerSetIdx( i );
     1379#endif
     1380    Int layerSetId = vps->getOutputLayerSetIdx(i);
     1381
     1382    for(Int j = 0; j < vps->getMaxTLayers(); j++)
     1383    {
     1384
     1385      Int maxNumReorderPics = -1;
     1386#if CHANGE_NUMSUBDPB_IDX
     1387#if RESOLUTION_BASED_DPB
     1388      for(Int k = 0; k < vps->getNumLayersInIdList(layerSetIdxForOutputLayerSet); k++)
     1389#else
     1390      for(Int k = 0; k < vps->getNumSubDpbs(layerSetIdxForOutputLayerSet); k++)
     1391#endif
     1392#else
     1393      for(Int k = 0; k < vps->getNumSubDpbs(i); k++)
     1394#endif
     1395      {
     1396        Int layerId = vps->getLayerSetLayerIdList(layerSetId, k); // k-th layer in the output layer set
     1397#if RESOLUTION_BASED_DPB
     1398        vps->setMaxVpsLayerDecPicBuffMinus1( i, k, j, m_acTEncTop[layerId].getMaxDecPicBuffering(j) - 1 );
     1399        // Add sub-DPB sizes of layers belonging to a sub-DPB. If a different sub-DPB size is calculated
     1400        // at the encoder, modify below
     1401        Int oldValue = vps->getMaxVpsDecPicBufferingMinus1( i, vps->getSubDpbAssigned( layerSetIdxForOutputLayerSet, k ), j );
     1402        oldValue += vps->getMaxVpsLayerDecPicBuffMinus1( i, k, j ) + 1;
     1403        vps->setMaxVpsDecPicBufferingMinus1( i, vps->getSubDpbAssigned( layerSetIdxForOutputLayerSet, k ), j, oldValue );
     1404#else
     1405        vps->setMaxVpsDecPicBufferingMinus1( i, k, j,  m_acTEncTop[layerId].getMaxDecPicBuffering(j) - 1 );
     1406#endif
     1407        maxNumReorderPics       = std::max( maxNumReorderPics, m_acTEncTop[layerId].getNumReorderPics(j));
     1408      }
     1409#if RESOLUTION_BASED_DPB
     1410      for(Int k = 0; k < vps->getNumSubDpbs(i); k++)
     1411      {
     1412        // Decrement m_maxVpsDecPicBufferingMinus1
     1413        Int oldValue = vps->getMaxVpsDecPicBufferingMinus1( i, vps->getSubDpbAssigned( layerSetIdxForOutputLayerSet, k ), j );
     1414        vps->setMaxVpsDecPicBufferingMinus1( i, vps->getSubDpbAssigned( layerSetIdxForOutputLayerSet, k ), j, oldValue - 1 );
     1415      }
     1416#endif
     1417      vps->setMaxVpsNumReorderPics(i, j, maxNumReorderPics);
     1418      vps->determineSubDpbInfoFlags();
     1419    }
     1420  }
    13341421#endif
    13351422    vps->setMaxOneActiveRefLayerFlag(maxDirectRefLayers > 1 ? false : true);
     
    13391426      if( vps->getNumDirectRefLayers( vps->getLayerIdInNuh(i) ) == 0  )
    13401427      {
     1428#if Q0078_ADD_LAYER_SETS
     1429        vps->setPocLsbNotPresentFlag(i, true); // make independedent layers base-layer compliant
     1430#else
    13411431        vps->setPocLsbNotPresentFlag(i, false);
     1432#endif
    13421433      }
    13431434    }
     
    13491440    vps->setCrossLayerAlignedIdrOnlyFlag( m_crossLayerAlignedIdrOnlyFlag );
    13501441#endif
    1351 #if N0147_IRAP_ALIGN_FLAG
    13521442    vps->setCrossLayerIrapAlignFlag( m_crossLayerIrapAlignFlag );
    13531443    for(UInt layerCtr = 1;layerCtr <= vps->getMaxLayers() - 1; layerCtr++)
     
    13651455      }
    13661456    }
    1367 #endif
    13681457#if M0040_ADAPTIVE_RESOLUTION_CHANGE
    13691458  vps->setSingleLayerForNonIrapFlag(m_adaptiveResolutionChange > 0 ? true : false);
     
    14181507  {
    14191508    vps->setVpsVuiBspHrdPresentFlag(true);
     1509#if Q0078_ADD_LAYER_SETS
     1510    vps->setVpsNumBspHrdParametersMinus1(vps->getVpsNumLayerSetsMinus1() - 1);
     1511#else
    14201512    vps->setVpsNumBspHrdParametersMinus1(vps->getNumLayerSets() - 2);
     1513#endif
    14211514    vps->createBspHrdParamBuffer(vps->getVpsNumBspHrdParametersMinus1() + 1);
    14221515    for ( i = 0; i <= vps->getVpsNumBspHrdParametersMinus1(); i++ )
     
    14511544      vps->setBspHrdParameters( i, pcCfgLayer->getFrameRate(), numDU, pcCfgLayer->getTargetBitrate(), ( pcCfgLayer->getIntraPeriod() > 0 ) );
    14521545    }
     1546#if Q0078_ADD_LAYER_SETS
     1547    for (UInt h = 1; h <= vps->getVpsNumLayerSetsMinus1(); h++)
     1548#else
    14531549    for(UInt h = 1; h <= (vps->getNumLayerSets()-1); h++)
     1550#endif
    14541551    {
    14551552      vps->setNumBitstreamPartitions(h, 1);
     
    15321629    if( m_isField )
    15331630    {
    1534 #if SVC_UPSAMPLING
     1631#if SVC_EXTENSION
    15351632#if LAYER_CTB
    15361633#if AUXILIARY_PICTURES
     
    15521649    else
    15531650    {
    1554 #if SVC_UPSAMPLING
     1651#if SVC_EXTENSION
    15551652#if LAYER_CTB
    15561653#if AUXILIARY_PICTURES
     
    19912088    rpcPicYuvRec = new TComPicYuv;
    19922089
    1993 #if SVC_UPSAMPLING
    19942090#if LAYER_CTB
    19952091#if AUXILIARY_PICTURES
     
    20052101#endif
    20062102#endif
    2007 #else
    2008     rpcPicYuvRec->create( m_acLayerCfg[layer].getSourceWidth(), m_acLayerCfg[layer].getSourceHeight(), m_uiMaxCUWidth, m_uiMaxCUHeight, m_uiMaxCUDepth );
    2009 #endif
    20102103
    20112104  }
     
    20322125Void TAppEncTop::xWriteRecon(UInt layer, Int iNumEncoded)
    20332126{
     2127#if REPN_FORMAT_IN_VPS
     2128  ChromaFormat chromaFormatIdc = m_acLayerCfg[layer].getChromaFormatIDC();
     2129  Int xScal = TComSPS::getWinUnitX( chromaFormatIdc );
     2130  Int yScal = TComSPS::getWinUnitY( chromaFormatIdc );
     2131#endif
     2132
    20342133  if (m_isField)
    20352134  {
     
    20542153#endif
    20552154      {
     2155#if REPN_FORMAT_IN_VPS
     2156        m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRecTop, pcPicYuvRecBottom, m_acLayerCfg[layer].getConfLeft() * xScal, m_acLayerCfg[layer].getConfRight() * xScal,
     2157          m_acLayerCfg[layer].getConfTop() * yScal, m_acLayerCfg[layer].getConfBottom() * yScal, m_isTopFieldFirst );
     2158#else
    20562159        m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRecTop, pcPicYuvRecBottom, m_acLayerCfg[layer].getConfLeft(), m_acLayerCfg[layer].getConfRight(), m_acLayerCfg[layer].getConfTop(), m_acLayerCfg[layer].getConfBottom(), m_isTopFieldFirst );
     2160#endif
    20572161      }
    20582162    }
     
    20782182#endif
    20792183      {
     2184#if REPN_FORMAT_IN_VPS
     2185        m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRec, m_acLayerCfg[layer].getConfLeft() * xScal, m_acLayerCfg[layer].getConfRight() * xScal,
     2186          m_acLayerCfg[layer].getConfTop() * yScal, m_acLayerCfg[layer].getConfBottom() * yScal );
     2187#else
    20802188        m_acTVideoIOYuvReconFile[layer].write( pcPicYuvRec, m_acLayerCfg[layer].getConfLeft(), m_acLayerCfg[layer].getConfRight(),
    20812189          m_acLayerCfg[layer].getConfTop(), m_acLayerCfg[layer].getConfBottom() );
     2190#endif
    20822191      }
    20832192    }
Note: See TracChangeset for help on using the changeset viewer.