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


Ignore:
Timestamp:
21 Oct 2013, 13:41:29 (11 years ago)
Author:
seregin
Message:

reintegrate SHM-3.1-dev branch

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/source

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

    r345 r442  
    6969, m_avcBaseLayerFlag(0)
    7070#endif
     71#if N0120_MAX_TID_REF_CFG
     72, m_maxTidRefPresentFlag(1)
     73#endif
    7174, m_pColumnWidth()
    7275, m_pRowHeight()
    7376, m_scalingListFile()
    74 #if REF_IDX_FRAMEWORK
    7577, m_elRapSliceBEnabled(0)
    76 #endif
    7778{
    7879  for(UInt layer=0; layer<MAX_LAYERS; layer++)
     
    217218    {
    218219      in>>entry.m_refIdc[i];
     220    }
     221  }
     222#endif
     223#if EXTERNAL_USEDBYCURR_N0082
     224  if(entry.m_numRefPics>0){
     225    in>>entry.m_UseExtusedByCurrPic;
     226    if(entry.m_UseExtusedByCurrPic)
     227    {
     228      for ( Int i = 0; i < entry.m_numRefPics; i++ )
     229      {
     230        in>>entry.m_ExtusedByCurrPic[i];
     231      }
    219232    }
    220233  }
     
    335348 
    336349#if SVC_EXTENSION
    337   string  cfg_LayerCfgFile  [MAX_LAYERS];
     350  string  cfg_LayerCfgFile   [MAX_LAYERS];
    338351  string  cfg_BitstreamFile;
    339   string* cfg_InputFile     [MAX_LAYERS];
    340   string* cfg_ReconFile     [MAX_LAYERS];
    341   Double* cfg_fQP           [MAX_LAYERS];
    342 
     352  string* cfg_InputFile      [MAX_LAYERS];
     353  string* cfg_ReconFile      [MAX_LAYERS];
     354  Double* cfg_fQP            [MAX_LAYERS];
     355
     356#if REPN_FORMAT_IN_VPS
     357  Int*    cfg_repFormatIdx  [MAX_LAYERS];
     358#endif
    343359  Int*    cfg_SourceWidth   [MAX_LAYERS];
    344360  Int*    cfg_SourceHeight  [MAX_LAYERS];
     
    384400  Bool*   cfg_RCForceIntraQP       [MAX_LAYERS];
    385401#endif
     402#if N0120_MAX_TID_REF_CFG
     403  Int*    cfg_maxTidIlRefPicsPlus1[MAX_LAYERS];
     404#endif
    386405  for(UInt layer = 0; layer < MAX_LAYERS; layer++)
    387406  {
     
    389408    cfg_ReconFile[layer]    = &m_acLayerCfg[layer].m_cReconFile;
    390409    cfg_fQP[layer]          = &m_acLayerCfg[layer].m_fQP;
     410#if REPN_FORMAT_IN_VPS
     411    cfg_repFormatIdx[layer] = &m_acLayerCfg[layer].m_repFormatIdx;
     412#endif
    391413    cfg_SourceWidth[layer]  = &m_acLayerCfg[layer].m_iSourceWidth;
    392414    cfg_SourceHeight[layer] = &m_acLayerCfg[layer].m_iSourceHeight;
     
    426448    cfg_RCForceIntraQP[layer]        = &m_acLayerCfg[layer].m_RCForceIntraQP;
    427449#endif
     450#if N0120_MAX_TID_REF_CFG
     451    cfg_maxTidIlRefPicsPlus1[layer] = &m_acLayerCfg[layer].m_maxTidIlRefPicsPlus1;
     452#endif
    428453  }
    429454#if AVC_BASE
     
    432457#if AVC_SYNTAX
    433458  string  cfg_BLSyntaxFile;
     459#endif
     460#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     461  string  cfg_tileSets;
    434462#endif
    435463#else
     
    459487  ("FrameRate%d,-fr%d",       cfg_FrameRate,  0, MAX_LAYERS, "Frame rate for layer %d")
    460488  ("LambdaModifier%d,-LM%d",  m_adLambdaModifier, ( double )1.0, MAX_TLAYER, "Lambda modifier for temporal layer %d")
     489#if REPN_FORMAT_IN_VPS
     490  ("RepFormatIdx%d",          cfg_repFormatIdx, -1, MAX_LAYERS, "Index to the representation format structure used from the VPS")
     491#endif
    461492#if VPS_EXTN_DIRECT_REF_LAYERS
    462493#if M0457_PREDICTION_INDICATIONS
     
    474505  ("NumLayers",               m_numLayers, 1, "Number of layers to code")
    475506  ("ConformanceMode%d",       cfg_conformanceMode,0, MAX_LAYERS, "Window conformance mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping")
     507#if SCALABILITY_MASK_E0104
     508  ("ScalabilityMask1",        m_scalabilityMask[1], 0, "scalability_mask[1] (multiview)")
     509  ("ScalabilityMask2",        m_scalabilityMask[2], 1, "scalability_mask[2] (scalable)" )
     510#else
    476511  ("ScalabilityMask0",        m_scalabilityMask[0], 0, "scalability_mask[0] (multiview)")
    477512  ("ScalabilityMask1",        m_scalabilityMask[1], 1, "scalability_mask[1] (scalable)" )
     513#endif
    478514  ("BitstreamFile,b",         cfg_BitstreamFile, string(""), "Bitstream output file name")
    479515  ("InputBitDepth",           m_inputBitDepthY,    8, "Bit-depth of input file")
     
    495531                                                                 " bottom-right luma sample of the EL picture, in units of two luma samples")
    496532#endif
     533#if N0120_MAX_TID_REF_CFG
     534  ("MaxTidRefPresentFlag", m_maxTidRefPresentFlag, true, "max_tid_ref_present_flag (0: not present, 1: present(default)) " )
     535  ("MaxTidIlRefPicsPlus1%d", cfg_maxTidIlRefPicsPlus1, 1, MAX_LAYERS, "allowed maximum temporal_id for inter-layer prediction")
     536#endif
    497537#if AVC_BASE
    498538  ("AvcBase,-avc",            m_avcBaseLayerFlag,     0, "avc_base_layer_flag")
     
    502542#endif
    503543#endif
    504 #if REF_IDX_FRAMEWORK
    505544  ("EnableElRapB,-use-rap-b",  m_elRapSliceBEnabled, 0, "Set ILP over base-layer I picture to B picture (default is P picture)")
    506 #endif 
    507545#if M0457_IL_SAMPLE_PRED_ONLY_FLAG
    508546  ("IlSampleOnlyPred%d",       m_ilSampleOnlyPred, 0, MAX_LAYERS, "Set inter_layer_sample_pred_only_flag for all slices")
    509547#endif
    510 #else 
     548#else
    511549  ("InputFile,i",           cfg_InputFile,     string(""), "Original YUV input file name")
    512550  ("BitstreamFile,b",       cfg_BitstreamFile, string(""), "Bitstream output file name")
     
    530568  ("FrameRate,-fr",         m_iFrameRate,          0, "Frame rate")
    531569#endif
     570
     571  //Field coding parameters
     572  ("FieldCoding", m_isField, false, "Signals if it's a field based coding")
     573  ("TopFieldFirst, Tff", m_isTopFieldFirst, false, "In case of field based coding, signals whether if it's a top field first or not")
    532574  ("FrameSkip,-fs",         m_FrameSkip,          0u, "Number of frames to skip at start of input YUV")
    533575  ("FramesToBeEncoded,f",   m_framesToBeEncoded,   0, "Number of frames to be encoded (default=all)")
     
    810852  ("AdaptiveResolutionChange",     m_adaptiveResolutionChange, 0, "Adaptive resolution change frame number. Should coincide with EL RAP picture. (0: disable)")
    811853#endif
     854#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     855  ("SEIInterLayerConstrainedTileSets", m_interLayerConstrainedTileSetsSEIEnabled, false, "Control generation of inter layer constrained tile sets SEI message")
     856  ("IlNumSetsInMessage",               m_ilNumSetsInMessage,                         0u, "Number of inter layer constrained tile sets")
     857  ("TileSetsArray",                    cfg_tileSets,                         string(""), "Array containing tile sets params (TopLeftTileIndex, BottonRightTileIndex and ilcIdc for each set) ")
     858#endif
    812859  ;
    813860 
     
    827874  const list<const Char*>& argv_unhandled = po::scanArgv(opts, argc, (const Char**) argv);
    828875
     876  if(m_isField)
     877  {
     878#if SVC_EXTENSION
     879    for(Int layer = 0; layer < MAX_LAYERS; layer++)
     880    {
     881      //Frame height
     882      m_acLayerCfg[layer].m_iSourceHeightOrg = m_acLayerCfg[layer].m_iSourceHeight;
     883      //Field height
     884      m_acLayerCfg[layer].m_iSourceHeight = m_acLayerCfg[layer].m_iSourceHeight >> 1;
     885    }
     886#else
     887    //Frame height
     888    m_iSourceHeightOrg = m_iSourceHeight;
     889    //Field height
     890    m_iSourceHeight = m_iSourceHeight >> 1;
     891#endif
     892    //number of fields to encode
     893    m_framesToBeEncoded *= 2;
     894  }
     895 
    829896  for (list<const Char*>::const_iterator it = argv_unhandled.begin(); it != argv_unhandled.end(); it++)
    830897  {
     
    11191186#endif
    11201187  m_scalingListFile = cfg_ScalingListFile.empty() ? NULL : strdup(cfg_ScalingListFile.c_str());
    1121  
     1188
     1189#if REPN_FORMAT_IN_VPS_123
     1190  for(Int layer = 0; layer < MAX_LAYERS; layer++)
     1191  {
     1192    m_acLayerCfg[layer].setSourceHeight( m_repFormatCfg[ m_acLayerCfg[layer].getRepFormatIdx() ].m_picHeightInLumaSamples);
     1193    m_acLayerCfg[layer].setSourceWidth ( m_repFormatCfg[ m_acLayerCfg[layer].getRepFormatIdx() ].m_picWidthInLumaSamples );
     1194  }
     1195#endif
    11221196  /* rules for input, output and internal bitdepths as per help text */
    11231197  if (!m_internalBitDepthY) { m_internalBitDepthY = m_inputBitDepthY; }
     
    11511225        m_aiPad[1] = m_confBottom = ((m_iSourceHeight / minCuSize) + 1) * minCuSize - m_iSourceHeight;
    11521226        m_iSourceHeight += m_confBottom;
     1227        if ( m_isField )
     1228        {
     1229          m_iSourceHeightOrg += m_confBottom << 1;
     1230          m_aiPad[1] = m_confBottom << 1;
     1231        }
    11531232      }
    11541233      if (m_aiPad[0] % TComSPS::getWinUnitX(CHROMA_420) != 0)
     
    12841363    }
    12851364  }
     1365#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
     1366  if (m_interLayerConstrainedTileSetsSEIEnabled)
     1367  {
     1368    if (m_iNumColumnsMinus1 == 0 && m_iNumRowsMinus1 == 0)
     1369    {
     1370      printf( "Tiles are not defined (needed for inter-layer comnstrained tile sets SEI).\n" );
     1371      exit( EXIT_FAILURE );
     1372    }
     1373    Char* pTileSets = cfg_tileSets.empty() ? NULL : strdup(cfg_tileSets.c_str());
     1374    int i = 0;
     1375    char *topLeftTileIndex = strtok(pTileSets, " ,");
     1376    while(topLeftTileIndex != NULL)
     1377    {
     1378      if( i >= m_ilNumSetsInMessage )
     1379      {
     1380        printf( "The number of tile sets is larger than defined by IlNumSetsInMessage.\n" );
     1381        exit( EXIT_FAILURE );
     1382      }
     1383      *( m_topLeftTileIndex + i ) = atoi( topLeftTileIndex );
     1384      char *bottonRightTileIndex = strtok(NULL, " ,");
     1385      if( bottonRightTileIndex == NULL )
     1386      {
     1387        printf( "BottonRightTileIndex is missing in the tile sets.\n" );
     1388        exit( EXIT_FAILURE );
     1389      }
     1390      *( m_bottomRightTileIndex + i ) = atoi( bottonRightTileIndex );
     1391      char *ilcIdc = strtok(NULL, " ,");
     1392      if( ilcIdc == NULL )
     1393      {
     1394        printf( "IlcIdc is missing in the tile sets.\n" );
     1395        exit( EXIT_FAILURE );
     1396      }
     1397      *( m_ilcIdc + i ) = atoi( ilcIdc );
     1398      topLeftTileIndex = strtok(NULL, " ,");
     1399      i++;
     1400    }
     1401    if( i < m_ilNumSetsInMessage )
     1402    {
     1403      printf( "The number of tile sets is smaller than defined by IlNumSetsInMessage.\n" );
     1404      exit( EXIT_FAILURE );
     1405    }
     1406    m_skippedTileSetPresentFlag = false;
     1407  }
     1408#endif
    12861409  // check validity of input parameters
    12871410  xCheckParameter();
     
    14671590#endif
    14681591 
    1469 #if !FINAL_RPL_CHANGE_N0082
     1592#if EXTERNAL_USEDBYCURR_N0082|| !FINAL_RPL_CHANGE_N0082
    14701593  Bool verifiedGOP=false;
    14711594#endif
    14721595  Bool errorGOP=false;
    1473 #if !FINAL_RPL_CHANGE_N0082
     1596#if  EXTERNAL_USEDBYCURR_N0082|| !FINAL_RPL_CHANGE_N0082
    14741597  Int checkGOP=1;
    1475   Int numRefs = 1;
     1598  Int numRefs = m_isField ? 2 : 1;
    14761599#endif
    14771600  Int refList[MAX_NUM_REF_PICS+1];
    14781601  refList[0]=0;
     1602  if(m_isField)
     1603  {
     1604    refList[1] = 1;
     1605  }
    14791606  Bool isOK[MAX_GOP];
    14801607  for(Int i=0; i<MAX_GOP; i++)
     
    14821609    isOK[i]=false;
    14831610  }
    1484 #if !FINAL_RPL_CHANGE_N0082
     1611#if  EXTERNAL_USEDBYCURR_N0082|| !FINAL_RPL_CHANGE_N0082
    14851612  Int numOK=0;
    14861613#endif
     
    15041631  for(UInt layer=0; layer<m_numLayers; layer++)
    15051632  {
    1506     if(m_acLayerCfg[layer].xCheckParameter())
     1633    if(m_acLayerCfg[layer].xCheckParameter(m_isField))
    15071634    {
    15081635      printf("\nError: invalid configuration parameter found in layer %d \n", layer);
     
    15301657  for(UInt layer=0; layer<m_numLayers; layer++)
    15311658  {
    1532     if (m_acLayerCfg[layer].m_GOPListLayer[0].m_POC<0){
     1659    if (m_acLayerCfg[layer].m_GOPListLayer[0].m_POC<0)
     1660    {
    15331661      memcpy( m_acLayerCfg[layer].m_GOPListLayer, m_GOPList, sizeof(GOPEntry)*MAX_GOP );
    15341662    }
     
    15361664    xConfirmPara(errorGOP,"Invalid GOP structure given");
    15371665  }
     1666#if TEMP_SCALABILITY_FIX
     1667  if( m_acLayerCfg[1].m_GOPListLayer[5].m_POC == 6  && m_acLayerCfg[1].m_GOPListLayer[7].m_POC == 7  &&
     1668    m_acLayerCfg[1].m_GOPListLayer[5].m_temporalId == 0 && m_acLayerCfg[1].m_GOPListLayer[7].m_temporalId == 0)
     1669#else
    15381670  //tentative for encoder
    1539   if( m_acLayerCfg[1].m_GOPListLayer[5].m_POC == 6  && m_acLayerCfg[1].m_GOPListLayer[7].m_POC == 7 ){
     1671  if( m_acLayerCfg[1].m_GOPListLayer[5].m_POC == 6  && m_acLayerCfg[1].m_GOPListLayer[7].m_POC == 7 )
     1672#endif
     1673  {
    15401674    //RA, POC5
    15411675    m_acLayerCfg[1].m_GOPListLayer[5].m_usedByCurrPic[2] = 0;
     
    15451679    m_acLayerCfg[1].m_GOPListLayer[7].m_refIdc[2] = 0;
    15461680  }
    1547 #else
     1681#endif
     1682#if  EXTERNAL_USEDBYCURR_N0082|| !FINAL_RPL_CHANGE_N0082
    15481683  m_extraRPSs=0;
    15491684  //start looping through frames in coding order until we can verify that the GOP structure is correct.
     
    17421877  xConfirmPara(errorGOP,"Invalid GOP structure given");
    17431878#endif
     1879#if EXTERNAL_USEDBYCURR_N0082
     1880  for(UInt layer=0; layer<m_numLayers; layer++)
     1881  {
     1882    for (Int i=0; i< m_iGOPSize; i++){
     1883      if (m_acLayerCfg[layer].m_GOPListLayer[i].m_UseExtusedByCurrPic == 1 )
     1884      {
     1885        for(Int j=0; j<m_acLayerCfg[layer].m_GOPListLayer[i].m_numRefPics; j++ )
     1886        {
     1887          m_acLayerCfg[layer].m_GOPListLayer[i].m_usedByCurrPic[j] = m_acLayerCfg[layer].m_GOPListLayer[i].m_ExtusedByCurrPic[j];
     1888          m_acLayerCfg[layer].m_GOPListLayer[i].m_refIdc[j] = m_acLayerCfg[layer].m_GOPListLayer[i].m_ExtusedByCurrPic[j];
     1889        }
     1890      }
     1891    }
     1892  }
     1893#endif
    17441894  m_maxTempLayer = 1;
    17451895  for(Int i=0; i<m_iGOPSize; i++)
     
    20452195  }
    20462196#endif
     2197#if N0120_MAX_TID_REF_CFG
     2198  for (UInt layer=0; layer < MAX_LAYERS-1; layer++)
     2199  {
     2200    xConfirmPara(m_acLayerCfg[layer].m_maxTidIlRefPicsPlus1 < 0 || m_acLayerCfg[layer].m_maxTidIlRefPicsPlus1 > 7, "MaxTidIlRefPicsPlus1 must be in range 0 to 7");
     2201  }
     2202#endif
    20472203#undef xConfirmPara
    20482204  if (check_failed)
     
    20812237#if SVC_EXTENSION 
    20822238  printf("Total number of layers        : %d\n", m_numLayers       );
     2239#if SCALABILITY_MASK_E0104
     2240  printf("Multiview                     : %d\n", m_scalabilityMask[1] );
     2241  printf("Scalable                      : %d\n", m_scalabilityMask[2] );
     2242#else
    20832243  printf("Multiview                     : %d\n", m_scalabilityMask[0] );
    20842244  printf("Scalable                      : %d\n", m_scalabilityMask[1] );
     2245#endif
    20852246#if M0040_ADAPTIVE_RESOLUTION_CHANGE
    20862247  printf("Adaptive Resolution Change    : %d\n", m_adaptiveResolutionChange );
     
    21052266  printf("Internal Format              : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate );
    21062267#endif
    2107   printf("Frame index                  : %u - %d (%d frames)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded );
     2268  if (m_isField)
     2269  {
     2270    printf("Frame/Field          : Field based coding\n");
     2271    printf("Field index          : %u - %d (%d fields)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded );
     2272    if (m_isTopFieldFirst)
     2273    {
     2274      printf("Field Order            : Top field first\n");
     2275    }
     2276    else
     2277    {
     2278      printf("Field Order            : Bottom field first\n");
     2279    }
     2280  }
     2281  else
     2282  {
     2283    printf("Frame/Field                  : Frame based coding\n");
     2284    printf("Frame index                  : %u - %d (%d frames)\n", m_FrameSkip, m_FrameSkip+m_framesToBeEncoded-1, m_framesToBeEncoded );
     2285  }
    21082286  printf("CU size / depth              : %d / %d\n", m_uiMaxCUWidth, m_uiMaxCUDepth );
    21092287  printf("RQT trans. size (min / max)  : %d / %d\n", 1 << m_uiQuadtreeTULog2MinSize, 1 << m_uiQuadtreeTULog2MaxSize );
     
    22092387  printf("AvcBase:%d ", 0);
    22102388#endif
    2211 #if REF_IDX_FRAMEWORK
    2212   printf("REF_IDX_FRAMEWORK:%d ", REF_IDX_FRAMEWORK);
    22132389  printf("EL_RAP_SliceType: %d ", m_elRapSliceBEnabled);
    22142390  printf("REF_IDX_ME_ZEROMV: %d ", REF_IDX_ME_ZEROMV);
    22152391  printf("ENCODER_FAST_MODE: %d ", ENCODER_FAST_MODE);
    22162392  printf("REF_IDX_MFM: %d ", REF_IDX_MFM);
    2217 #endif
    22182393#else
    22192394  printf("RecalQP:%d", m_recalculateQPAccordingToLambda ? 1 : 0 );
Note: See TracChangeset for help on using the changeset viewer.