Changeset 815 in SHVCSoftware for trunk/source/App/TAppEncoder/TAppEncCfg.cpp


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

merge with SHM-6-dev branch

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/source

  • 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 );
Note: See TracChangeset for help on using the changeset viewer.