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


Ignore:
Timestamp:
21 Apr 2014, 04:44:16 (11 years ago)
Author:
seregin
Message:

merge with SHM-6-dev

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/source

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

    r649 r713  
    339339  string* cfg_ReconFile      [MAX_LAYERS];
    340340  Double* cfg_fQP            [MAX_LAYERS];
     341#if Q0074_SEI_COLOR_MAPPING
     342  string* cfg_seiColorMappingFile[MAX_LAYERS];
     343#endif
    341344
    342345#if REPN_FORMAT_IN_VPS
     
    433436    cfg_IntraPeriod[layer]  = &m_acLayerCfg[layer].m_iIntraPeriod;
    434437    cfg_conformanceMode[layer] = &m_acLayerCfg[layer].m_conformanceMode;
     438#if Q0074_SEI_COLOR_MAPPING
     439    cfg_seiColorMappingFile[layer] = &m_acLayerCfg[layer].m_cSeiColorMappingFile;
     440#endif
    435441#if LAYER_CTB
    436442    // coding unit (CU) definition
     
    616622#endif
    617623  ("EnableElRapB,-use-rap-b",  m_elRapSliceBEnabled, 0, "Set ILP over base-layer I picture to B picture (default is P picture)")
     624#if Q0074_SEI_COLOR_MAPPING
     625  ("SEIColorMappingFile%d", cfg_seiColorMappingFile, string(""), MAX_LAYERS, "File Containing SEI Color Mapping data")
     626#endif
    618627#else //SVC_EXTENSION
    619628  ("InputFile,i",           cfg_InputFile,     string(""), "Original YUV input file name")
     
    710719  ("IntraPeriod,-ip",         m_iIntraPeriod,              -1, "Intra period in frames, (-1: only first frame)")
    711720#endif
     721#if ALLOW_RECOVERY_POINT_AS_RAP
     722  ("DecodingRefreshType,-dr", m_iDecodingRefreshType,       0, "Intra refresh type (0:none 1:CRA 2:IDR 3:RecPointSEI)")
     723#else
    712724  ("DecodingRefreshType,-dr", m_iDecodingRefreshType,       0, "Intra refresh type (0:none 1:CRA 2:IDR)")
     725#endif
    713726  ("GOPSize,g",               m_iGOPSize,                   1, "GOP size of temporal structure")
    714727  // motion options
     
    905918  ("SEIToneMapCameraIsoSpeedIdc",                     m_cameraIsoSpeedIdc,                        0, "Indicates the camera ISO speed for daylight illumination")
    906919  ("SEIToneMapCameraIsoSpeedValue",                   m_cameraIsoSpeedValue,                    400, "Specifies the camera ISO speed for daylight illumination of Extended_ISO")
     920  ("SEIToneMapExposureIndexIdc",                      m_exposureIndexIdc,                         0, "Indicates the exposure index setting of the camera")
     921  ("SEIToneMapExposureIndexValue",                    m_exposureIndexValue,                     400, "Specifies the exposure index setting of the cameran of Extended_ISO")
    907922  ("SEIToneMapExposureCompensationValueSignFlag",     m_exposureCompensationValueSignFlag,        0, "Specifies the sign of ExposureCompensationValue")
    908923  ("SEIToneMapExposureCompensationValueNumerator",    m_exposureCompensationValueNumerator,       0, "Specifies the numerator of ExposureCompensationValue")
     
    955970  ("CrossLayerBLAFlag",                m_crossLayerBLAFlag,                       false, "Specifies the value of cross_layer_bla_flag in VPS")
    956971#endif
     972#if Q0048_CGS_3D_ASYMLUT
     973  ("CGS",     m_nCGSFlag , 0, "whether CGS is enabled")
     974  ("CGSMaxOctantDepth", m_nCGSMaxOctantDepth , 1, "max octant depth")
     975  ("CGSMaxYPartNumLog",  m_nCGSMaxYPartNumLog2 , 2, "max Y part number ")
     976  ("CGSLUTBit",     m_nCGSLUTBit , 12, "bit depth of CGS LUT")
     977#endif
    957978  ;
    958979 
     
    12021223        if( i >= m_acLayerCfg[layer].m_numSamplePredRefLayers )
    12031224        {
    1204           printf( "NumSamplePredRefLayers: The number of columns whose width are defined is larger than the allowed number of columns.\n" );
     1225          printf( "NumSamplePredRefLayers%d: The number of columns whose width are defined is larger than the allowed number of columns.\n", layer );
    12051226          exit( EXIT_FAILURE );
    12061227        }
     
    12111232      if( i < m_acLayerCfg[layer].m_numSamplePredRefLayers )
    12121233      {
    1213         printf( "NumSamplePredRefLayers: The width of some columns is not defined.\n" );
     1234        printf( "NumSamplePredRefLayers%d: The width of some columns is not defined.\n", layer );
    12141235        exit( EXIT_FAILURE );
    12151236      }
     
    12331254        if( i >= m_acLayerCfg[layer].m_numMotionPredRefLayers )
    12341255        {
    1235           printf( "NumMotionPredRefLayers: The number of columns whose width are defined is larger than the allowed number of columns.\n" );
     1256          printf( "NumMotionPredRefLayers%d: The number of columns whose width are defined is larger than the allowed number of columns.\n", layer );
    12361257          exit( EXIT_FAILURE );
    12371258        }
     
    12421263      if( i < m_acLayerCfg[layer].m_numMotionPredRefLayers )
    12431264      {
    1244         printf( "NumMotionPredRefLayers: The width of some columns is not defined.\n" );
     1265        printf( "NumMotionPredRefLayers%d: The width of some columns is not defined.\n", layer );
    12451266        exit( EXIT_FAILURE );
    12461267      }
     
    12721293        if( i >= m_acLayerCfg[layer].m_numActiveRefLayers )
    12731294        {
    1274           printf( "NumActiveRefLayers: The number of columns whose width are defined is larger than the allowed number of columns.\n" );
     1295          printf( "NumActiveRefLayers%d: The number of columns whose width are defined is larger than the allowed number of columns.\n", layer );
    12751296          exit( EXIT_FAILURE );
    12761297        }
     
    12811302      if( i < m_acLayerCfg[layer].m_numActiveRefLayers )
    12821303      {
    1283         printf( "NumActiveRefLayers: The width of some columns is not defined.\n" );
     1304        printf( "NumActiveRefLayers%d: The width of some columns is not defined.\n", layer );
    12841305        exit( EXIT_FAILURE );
    12851306      }
     
    14741495    }
    14751496  }
     1497
    14761498#if N0383_IL_CONSTRAINED_TILE_SETS_SEI
    14771499  if (m_interLayerConstrainedTileSetsSEIEnabled)
     
    15871609  xConfirmPara( (m_iIntraPeriod > 0 && m_iIntraPeriod < m_iGOPSize) || m_iIntraPeriod == 0, "Intra period must be more than GOP size, or -1 , not 0" );
    15881610#endif
     1611#if ALLOW_RECOVERY_POINT_AS_RAP
     1612  xConfirmPara( m_iDecodingRefreshType < 0 || m_iDecodingRefreshType > 3,                   "Decoding Refresh Type must be comprised between 0 and 3 included" );
     1613  if(m_iDecodingRefreshType == 3)
     1614  {
     1615    xConfirmPara( !m_recoveryPointSEIEnabled,                                               "When using RecoveryPointSEI messages as RA points, recoveryPointSEI must be enabled" );
     1616  }
     1617#else
    15891618  xConfirmPara( m_iDecodingRefreshType < 0 || m_iDecodingRefreshType > 2,                   "Decoding Refresh Type must be equal to 0, 1 or 2" );
     1619#endif
    15901620#if !SVC_EXTENSION
    15911621  xConfirmPara( m_iQP <  -6 * (m_internalBitDepthY - 8) || m_iQP > 51,                    "QP exceeds supported range (-QpBDOffsety to 51)" );
     
    21602190    xConfirmPara( m_toneMapModelId < 0 || m_toneMapModelId > 4 , "SEIToneMapModelId must be in rage 0 to 4");
    21612191    xConfirmPara( m_cameraIsoSpeedValue == 0, "SEIToneMapCameraIsoSpeedValue shall not be equal to 0");
     2192    xConfirmPara( m_exposureIndexValue  == 0, "SEIToneMapExposureIndexValue shall not be equal to 0");
    21622193    xConfirmPara( m_extendedRangeWhiteLevel < 100, "SEIToneMapExtendedRangeWhiteLevel should be greater than or equal to 100");
    21632194    xConfirmPara( m_nominalBlackLevelLumaCodeValue >= m_nominalWhiteLevelLumaCodeValue, "SEIToneMapNominalWhiteLevelLumaCodeValue shall be greater than SEIToneMapNominalBlackLevelLumaCodeValue");
     
    22862317  }
    22872318#endif
     2319#if Q0048_CGS_3D_ASYMLUT
     2320  xConfirmPara( m_nCGSFlag < 0 || m_nCGSFlag > 1 , "0<=CGS<=1" );
     2321#endif
    22882322#undef xConfirmPara
    22892323  if (check_failed)
     
    25452579  printf("RecalQP:%d", m_recalculateQPAccordingToLambda ? 1 : 0 );
    25462580#endif
     2581#if Q0048_CGS_3D_ASYMLUT
     2582  printf("CGS: %d CGSMaxOctantDepth: %d CGSMaxYPartNumLog2: %d CGSLUTBit:%d " , m_nCGSFlag , m_nCGSMaxOctantDepth , m_nCGSMaxYPartNumLog2 , m_nCGSLUTBit );
     2583#endif
    25472584  printf("\n\n");
    25482585 
  • trunk/source/App/TAppEncoder/TAppEncCfg.h

    r644 r713  
    255255  Int       m_cameraIsoSpeedIdc;
    256256  Int       m_cameraIsoSpeedValue;
     257  Int       m_exposureIndexIdc;
     258  Int       m_exposureIndexValue;
    257259  Int       m_exposureCompensationValueSignFlag;
    258260  Int       m_exposureCompensationValueNumerator;
     
    266268  Int*      m_codedPivotValue;
    267269  Int*      m_targetPivotValue;
     270#if Q0074_SEI_COLOR_MAPPING
     271  Char*     m_pchSEIColorMappingFile;             ///< SEI Color Mapping File (initialized from external file)
     272#endif
    268273  Int       m_framePackingSEIEnabled;
    269274  Int       m_framePackingSEIType;
     
    393398  Bool      m_useInterLayerWeightedPred;
    394399#endif
     400#if Q0048_CGS_3D_ASYMLUT
     401  Int  m_nCGSFlag;
     402  Int  m_nCGSMaxOctantDepth;
     403  Int  m_nCGSMaxYPartNumLog2;
     404  Int  m_nCGSLUTBit;
     405#endif
    395406public:
    396407  TAppEncCfg();
  • trunk/source/App/TAppEncoder/TAppEncLayerCfg.cpp

    r644 r713  
    171171  }
    172172#endif
     173#if REPN_FORMAT_IN_VPS
     174  printf("Real     Format               : %dx%d %dHz\n", m_iSourceWidth - ( m_confLeft + m_confRight ) * TComSPS::getWinUnitX( m_chromaFormatIDC ), m_iSourceHeight - ( m_confTop + m_confBottom ) * TComSPS::getWinUnitY( m_chromaFormatIDC ), m_iFrameRate );
     175#else
    173176  printf("Real     Format               : %dx%d %dHz\n", m_iSourceWidth - m_confLeft - m_confRight, m_iSourceHeight - m_confTop - m_confBottom, m_iFrameRate );
     177#endif
    174178  printf("Internal Format               : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate );
    175179#if O0194_DIFFERENT_BITDEPTH_EL_BL
     
    229233        m_aiPad[0] = m_confRight  = ((m_iSourceWidth / minCuSize) + 1) * minCuSize - m_iSourceWidth;
    230234        m_iSourceWidth  += m_confRight;
     235#if REPN_FORMAT_IN_VPS
     236        m_confRight /= TComSPS::getWinUnitX( m_chromaFormatIDC );
     237#endif
    231238      }
    232239      if (m_iSourceHeight % minCuSize)
     
    239246          m_aiPad[1] = m_confBottom << 1;
    240247        }
     248#if REPN_FORMAT_IN_VPS
     249        m_confBottom /= TComSPS::getWinUnitY( m_chromaFormatIDC );
     250#endif
    241251      }
    242252      break;
     
    249259      m_confRight  = m_aiPad[0];
    250260      m_confBottom = m_aiPad[1];
     261#if REPN_FORMAT_IN_VPS
     262      m_confRight /= TComSPS::getWinUnitX( m_chromaFormatIDC );
     263      m_confBottom /= TComSPS::getWinUnitY( m_chromaFormatIDC );
     264#endif
    251265      break;
    252266    }
     
    331345  xConfirmPara( m_aiPad[1] % TComSPS::getWinUnitY(CHROMA_420) != 0, "Vertical padding must be an integer multiple of the specified chroma subsampling");
    332346
     347#if !REPN_FORMAT_IN_VPS
    333348  xConfirmPara( m_confLeft   % TComSPS::getWinUnitX(CHROMA_420) != 0, "Left conformance window offset must be an integer multiple of the specified chroma subsampling");
    334349  xConfirmPara( m_confRight  % TComSPS::getWinUnitX(CHROMA_420) != 0, "Right conformance window offset must be an integer multiple of the specified chroma subsampling");
    335350  xConfirmPara( m_confTop    % TComSPS::getWinUnitY(CHROMA_420) != 0, "Top conformance window offset must be an integer multiple of the specified chroma subsampling");
    336351  xConfirmPara( m_confBottom % TComSPS::getWinUnitY(CHROMA_420) != 0, "Bottom conformance window offset must be an integer multiple of the specified chroma subsampling");
     352#endif
    337353
    338354#if LAYER_CTB 
  • trunk/source/App/TAppEncoder/TAppEncLayerCfg.h

    r644 r713  
    5454  Int       *m_predLayerIds;
    5555  Int       m_numActiveRefLayers;
     56#endif
     57#if Q0074_SEI_COLOR_MAPPING
     58  string    m_cSeiColorMappingFile;
    5659#endif
    5760
  • trunk/source/App/TAppEncoder/TAppEncTop.cpp

    r649 r713  
    9191  }
    9292
    93 #if REPN_FORMAT_IN_VPS
    94   vps->setRepFormatIdxPresentFlag( true );   // Could be disabled to optimize in some cases.
     93#if REPN_FORMAT_IN_VPS 
    9594  Int maxRepFormatIdx = -1;
    9695  Int formatIdx = -1;
     
    125124
    126125    assert( m_acLayerCfg[layer].getRepFormatIdx() != -1 && "RepFormatIdx not assigned for a layer" );
     126
    127127    vps->setVpsRepFormatIdx( layer, m_acLayerCfg[layer].getRepFormatIdx() );
     128
    128129    maxRepFormatIdx = std::max( m_acLayerCfg[layer].getRepFormatIdx(), maxRepFormatIdx );
    129130  }
     131
    130132  assert( vps->getVpsRepFormatIdx( 0 ) == 0 );  // Base layer should point to the first one.
     133
    131134  Int* mapIdxToLayer = new Int[maxRepFormatIdx + 1];
     135
    132136  // Check that all the indices from 0 to maxRepFormatIdx are used in the VPS
    133137  for(Int i = 0; i <= maxRepFormatIdx; i++)
     
    145149    assert( layer != m_numLayers );   // One of the VPS Rep format indices not set
    146150  }
     151
    147152  vps->setVpsNumRepFormats( maxRepFormatIdx + 1 );
     153
     154#if Q0195_REP_FORMAT_CLEANUP
     155  // When not present, the value of rep_format_idx_present_flag is inferred to be equal to 0
     156  vps->setRepFormatIdxPresentFlag( vps->getVpsNumRepFormats() > 1 ? true : false );
     157#else
     158  vps->setRepFormatIdxPresentFlag( true );
     159#endif
     160
    148161  for(UInt idx=0; idx < vps->getVpsNumRepFormats(); idx++)
    149162  {
     
    467480    m_acTEncTop[layer].setTMISEINominalWhiteLevelLumaCodeValue      ( m_nominalWhiteLevelLumaCodeValue );
    468481    m_acTEncTop[layer].setTMISEIExtendedWhiteLevelLumaCodeValue     ( m_extendedWhiteLevelLumaCodeValue );
     482#if Q0074_SEI_COLOR_MAPPING
     483    m_acTEncTop[layer].setColorMappingInfoSEIFile                   ( m_acLayerCfg[layer].m_cSeiColorMappingFile.empty() ? NULL : const_cast<Char *>(m_acLayerCfg[layer].m_cSeiColorMappingFile.c_str()) );
     484#endif
    469485    m_acTEncTop[layer].setFramePackingArrangementSEIEnabled( m_framePackingSEIEnabled );
    470486    m_acTEncTop[layer].setFramePackingArrangementSEIType( m_framePackingSEIType );
     
    592608    m_acTEncTop[layer].setCrossLayerBLAFlag( m_crossLayerBLAFlag );
    593609#endif
     610#if Q0048_CGS_3D_ASYMLUT
     611    m_acTEncTop[layer].setCGSFlag( layer == 0 ? 0 : m_nCGSFlag );
     612    m_acTEncTop[layer].setCGSMaxOctantDepth( m_nCGSMaxOctantDepth );
     613    m_acTEncTop[layer].setCGSMaxYPartNumLog2( m_nCGSMaxYPartNumLog2 );
     614    m_acTEncTop[layer].setCGSLUTBit( m_nCGSLUTBit );
     615#endif
    594616  }
    595617}
     
    767789  m_cTEncTop.setTMISEICameraIsoSpeedIdc                   ( m_cameraIsoSpeedIdc );
    768790  m_cTEncTop.setTMISEICameraIsoSpeedValue                 ( m_cameraIsoSpeedValue );
     791  m_cTEncTop.setTMISEIExposureIndexIdc                    ( m_exposureIndexIdc );
     792  m_cTEncTop.setTMISEIExposureIndexValue                  ( m_exposureIndexValue );
    769793  m_cTEncTop.setTMISEIExposureCompensationValueSignFlag   ( m_exposureCompensationValueSignFlag );
    770794  m_cTEncTop.setTMISEIExposureCompensationValueNumerator  ( m_exposureCompensationValueNumerator );
     
    775799  m_cTEncTop.setTMISEINominalWhiteLevelLumaCodeValue      ( m_nominalWhiteLevelLumaCodeValue );
    776800  m_cTEncTop.setTMISEIExtendedWhiteLevelLumaCodeValue     ( m_extendedWhiteLevelLumaCodeValue );
     801#if Q0074_SEI_COLOR_MAPPING
     802  m_cTEncTop.setColorMappingInfoSEIFile                   ( m_pchSEIColorMappingFile );
     803#endif
    777804  m_cTEncTop.setFramePackingArrangementSEIEnabled( m_framePackingSEIEnabled );
    778805  m_cTEncTop.setFramePackingArrangementSEIType( m_framePackingSEIType );
     
    9741001  vps->setMaxLayerId(m_numLayers - 1);    // Set max-layer ID
    9751002
     1003  vps->setVpsExtensionFlag( m_numLayers > 1 ? true : false );
     1004
    9761005  vps->setNumLayerSets(m_numLayers);
    9771006  for(Int setId = 1; setId < vps->getNumLayerSets(); setId++)
     
    10681097#if VPS_TSLAYERS
    10691098    vps->setMaxTSLayersPresentFlag(true);
    1070     for( i = 0; i < MAX_VPS_LAYER_ID_PLUS1 - 1; i++ )
    1071     {
    1072         vps->setMaxTSLayersMinus1(i, vps->getMaxTLayers()-1);
     1099    for( i = 0; i < vps->getMaxLayers(); i++ )
     1100    {
     1101      vps->setMaxTSLayersMinus1(i, vps->getMaxTLayers()-1);
    10731102    }
    10741103#endif
     
    10811110  if (vps->getMaxTidRefPresentFlag())
    10821111  {
    1083     for( i = 0; i < MAX_VPS_LAYER_ID_PLUS1 - 1; i++ )
     1112    for( i = 0; i < vps->getMaxLayers() - 1; i++ )
    10841113    {
    10851114#if N0120_MAX_TID_REF_CFG
    10861115#if O0225_MAX_TID_FOR_REF_LAYERS
    1087       for( Int j = i+1; j <= MAX_VPS_LAYER_ID_PLUS1 - 1; j++)
     1116      for( Int j = i+1; j < vps->getMaxLayers(); j++)
    10881117      {
    10891118        vps->setMaxTidIlRefPicsPlus1(i, j, m_acTEncTop[i].getMaxTidIlRefPicsPlus1());
     
    10941123#else
    10951124#if O0225_MAX_TID_FOR_REF_LAYERS
    1096       for( Int j = i+1; j <= MAX_VPS_LAYER_ID_PLUS1 - 1; j++)
     1125      for( Int j = i+1; j < vps->getMaxLayers(); j++)
    10971126      {
    10981127        vps->setMaxTidIlRefPicsPlus1(i, j, vps->getMaxTLayers()+1);
     
    11061135  else
    11071136  {
    1108     for( i = 0; i < MAX_VPS_LAYER_ID_PLUS1 - 1; i++ )
     1137    for( i = 0; i < vps->getMaxLayers() - 1; i++ )
    11091138    {
    11101139#if O0225_MAX_TID_FOR_REF_LAYERS
    1111       for( Int j = i+1; j <= MAX_VPS_LAYER_ID_PLUS1 - 1; j++)
     1140      for( Int j = i+1; j < vps->getMaxLayers(); j++)
    11121141      {
    11131142        vps->setMaxTidIlRefPicsPlus1(i, j, 7);
     
    12971326  if(vps->getMaxLayers() > MAX_REF_LAYERS)
    12981327  {
    1299     for(UInt layerCtr = 1;layerCtr <= vps->getMaxLayers() - 1; layerCtr++)
     1328    for(UInt layerCtr = 1; layerCtr <= vps->getMaxLayers() - 1; layerCtr++)
    13001329    {
    13011330      assert( vps->getNumRefLayers(vps->getLayerIdInNuh(layerCtr)) <= MAX_REF_LAYERS);
     
    14001429      Int iPicWidth         = pcCfgLayer->getSourceWidth();
    14011430      Int iPicHeight        = pcCfgLayer->getSourceHeight();
     1431#if LAYER_CTB
     1432      UInt uiWidthInCU       = ( iPicWidth  % m_acLayerCfg[layerId].m_uiMaxCUWidth  ) ? iPicWidth  / m_acLayerCfg[layerId].m_uiMaxCUWidth  + 1 : iPicWidth  / m_acLayerCfg[layerId].m_uiMaxCUWidth;
     1433      UInt uiHeightInCU      = ( iPicHeight % m_acLayerCfg[layerId].m_uiMaxCUHeight ) ? iPicHeight / m_acLayerCfg[layerId].m_uiMaxCUHeight + 1 : iPicHeight / m_acLayerCfg[layerId].m_uiMaxCUHeight;
     1434#else
    14021435      UInt uiWidthInCU       = ( iPicWidth %m_uiMaxCUWidth  ) ? iPicWidth /m_uiMaxCUWidth  + 1 : iPicWidth /m_uiMaxCUWidth;
    14031436      UInt uiHeightInCU      = ( iPicHeight%m_uiMaxCUHeight ) ? iPicHeight/m_uiMaxCUHeight + 1 : iPicHeight/m_uiMaxCUHeight;
     1437#endif
    14041438      UInt uiNumCUsInFrame   = uiWidthInCU * uiHeightInCU;
    14051439
     1440#if LAYER_CTB
     1441      UInt maxCU = pcCfgLayer->getSliceArgument() >> ( m_acLayerCfg[layerId].m_uiMaxCUDepth << 1);
     1442#else
    14061443      UInt maxCU = pcCfgLayer->getSliceArgument() >> ( m_uiMaxCUDepth << 1);
     1444#endif
    14071445      UInt numDU = ( pcCfgLayer->getSliceMode() == 1 ) ? ( uiNumCUsInFrame / maxCU ) : ( 0 );
    14081446      if( uiNumCUsInFrame % maxCU != 0 || numDU == 0 )
Note: See TracChangeset for help on using the changeset viewer.