Ignore:
Timestamp:
16 Apr 2013, 06:39:31 (12 years ago)
Author:
seregin
Message:

copy from HM-10.0-dev-SHM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/App/TAppEncoder/TAppEncLayerCfg.cpp

    r55 r125  
    11/** \file     TAppEncLayerCfg.cpp
    2     \brief    Handle encoder configuration parameters
     2\brief    Handle encoder configuration parameters
    33*/
    44
     
    2828#if SVC_EXTENSION
    2929TAppEncLayerCfg::TAppEncLayerCfg()
    30 :m_cInputFile(string("")),
    31  m_cReconFile(string("")),
    32  m_croppingMode( 0 ),
    33  m_aidQP(NULL)
    34 {
    35   m_cropLeft = m_cropRight = m_cropTop = m_cropBottom = 0;
     30  :m_cInputFile(string("")),
     31  m_cReconFile(string("")),
     32  m_conformanceMode( 0 ),
     33  m_aidQP(NULL)
     34{
     35  m_confLeft = m_confRight = m_confTop = m_confBottom = 0;
    3636  m_aiPad[1] = m_aiPad[0] = 0;
    3737}
     
    5959
    6060/** \param  argc        number of arguments
    61     \param  argv        array of arguments
    62     \retval             true when success
    63  */
     61\param  argv        array of arguments
     62\retval             true when success
     63*/
    6464bool TAppEncLayerCfg::parseCfg( const string& cfgFileName  )
    6565{
     
    6969  po::Options opts;
    7070  opts.addOptions()
    71   ("InputFile,i",           cfg_InputFile,  string(""), "original YUV input file name")
     71    ("InputFile,i",           cfg_InputFile,  string(""), "original YUV input file name")
    7272#if AVC_BASE
    73   ("InputBLFile,-ibl",      cfg_InputFile,  string(""), "original YUV input file name")
    74 #endif
    75   ("ReconFile,o",           cfg_ReconFile,  string(""), "reconstructed YUV output file name")
    76   ("SourceWidth,-wdt",      m_iSourceWidth,  0, "Source picture width")
    77   ("SourceHeight,-hgt",     m_iSourceHeight, 0, "Source picture height")
    78   ("CroppingMode",          m_croppingMode,  0, "Cropping mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping")
    79   ("CropLeft",              m_cropLeft,      0, "Left cropping/padding for cropping mode 3")
    80   ("CropRight",             m_cropRight,     0, "Right cropping/padding for cropping mode 3")
    81   ("CropTop",               m_cropTop,       0, "Top cropping/padding for cropping mode 3")
    82   ("CropBottom",            m_cropBottom,    0, "Bottom cropping/padding for cropping mode 3")
    83   ("HorizontalPadding,-pdx",m_aiPad[0],      0, "horizontal source padding for cropping mode 2")
    84   ("VerticalPadding,-pdy",  m_aiPad[1],      0, "vertical source padding for cropping mode 2")
    85   ("IntraPeriod,-ip",       m_iIntraPeriod,  -1, "intra period in frames, (-1: only first frame)")
    86   ("FrameRate,-fr",         m_iFrameRate,    0, "Frame rate")
    87   ("dQPFile,m",             cfg_dQPFile, string(""), "dQP file name")
    88   ("QP,q",                  m_fQP,          30.0, "Qp value, if value is float, QP is switched once during encoding")
    89   ;
    90  
     73    ("InputBLFile,-ibl",      cfg_InputFile,  string(""), "original YUV input file name")
     74#endif
     75    ("ReconFile,o",           cfg_ReconFile,  string(""), "reconstructed YUV output file name")
     76    ("SourceWidth,-wdt",      m_iSourceWidth,  0, "Source picture width")
     77    ("SourceHeight,-hgt",     m_iSourceHeight, 0, "Source picture height")
     78    ("CroppingMode",          m_conformanceMode,  0, "Cropping mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping")
     79    ("CropLeft",              m_confLeft,      0, "Left cropping/padding for cropping mode 3")
     80    ("CropRight",             m_confRight,     0, "Right cropping/padding for cropping mode 3")
     81    ("CropTop",               m_confTop,       0, "Top cropping/padding for cropping mode 3")
     82    ("CropBottom",            m_confBottom,    0, "Bottom cropping/padding for cropping mode 3")
     83    ("HorizontalPadding,-pdx",m_aiPad[0],      0, "horizontal source padding for cropping mode 2")
     84    ("VerticalPadding,-pdy",  m_aiPad[1],      0, "vertical source padding for cropping mode 2")
     85    ("IntraPeriod,-ip",       m_iIntraPeriod,  -1, "intra period in frames, (-1: only first frame)")
     86    ("FrameRate,-fr",         m_iFrameRate,    0, "Frame rate")
     87    ("dQPFile,m",             cfg_dQPFile, string(""), "dQP file name")
     88    ("QP,q",                  m_fQP,          30.0, "Qp value, if value is float, QP is switched once during encoding")
     89    ;
     90
    9191  po::setDefaults(opts);
    9292  po::parseConfigFile(opts, cfgFileName);
     
    123123  printf("Base layer input file         : %s\n", m_cAppEncCfg->getBLSyntaxFile() );
    124124#endif
    125   printf("Real     Format               : %dx%d %dHz\n", m_iSourceWidth - m_cropLeft - m_cropRight, m_iSourceHeight - m_cropTop - m_cropBottom, m_iFrameRate );
     125  printf("Real     Format               : %dx%d %dHz\n", m_iSourceWidth - m_confLeft - m_confRight, m_iSourceHeight - m_confTop - m_confBottom, m_iFrameRate );
    126126  printf("Internal Format               : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate );
    127127  printf("QP                            : %5.2f\n", m_fQP );
    128128  printf("Intra period                  : %d\n", m_iIntraPeriod );
    129 #if SVC_EXTENSION
    130   printf("WaveFrontSynchro:%d WaveFrontSubstreams:%d",
    131           m_cAppEncCfg->getWaveFrontSynchro(), m_iWaveFrontSubstreams);
    132 #endif
     129  printf("WaveFrontSynchro:%d WaveFrontSubstreams:%d", m_cAppEncCfg->getWaveFrontSynchro(), m_iWaveFrontSubstreams);
    133130}
    134131
     
    137134Bool TAppEncLayerCfg::xCheckParameter()
    138135{
    139   switch (m_croppingMode)
     136  switch (m_conformanceMode)
    140137  {
    141138  case 0:
    142139    {
    143140      // no cropping or padding
    144       m_cropLeft = m_cropRight = m_cropTop = m_cropBottom = 0;
     141      m_confLeft = m_confRight = m_confTop = m_confBottom = 0;
    145142      m_aiPad[1] = m_aiPad[0] = 0;
    146143      break;
     
    152149      if (m_iSourceWidth % minCuSize)
    153150      {
    154         m_aiPad[0] = m_cropRight  = ((m_iSourceWidth / minCuSize) + 1) * minCuSize - m_iSourceWidth;
    155         m_iSourceWidth  += m_cropRight;
     151        m_aiPad[0] = m_confRight  = ((m_iSourceWidth / minCuSize) + 1) * minCuSize - m_iSourceWidth;
     152        m_iSourceWidth  += m_confRight;
    156153      }
    157154      if (m_iSourceHeight % minCuSize)
    158155      {
    159         m_aiPad[1] = m_cropBottom = ((m_iSourceHeight / minCuSize) + 1) * minCuSize - m_iSourceHeight;
    160         m_iSourceHeight += m_cropBottom;
     156        m_aiPad[1] = m_confBottom = ((m_iSourceHeight / minCuSize) + 1) * minCuSize - m_iSourceHeight;
     157        m_iSourceHeight += m_confBottom;
    161158      }
    162159      break;
     
    167164      m_iSourceWidth  += m_aiPad[0];
    168165      m_iSourceHeight += m_aiPad[1];
    169       m_cropRight  = m_aiPad[0];
    170       m_cropBottom = m_aiPad[1];
     166      m_confRight  = m_aiPad[0];
     167      m_confBottom = m_aiPad[1];
    171168      break;
    172169    }
    173170  case 3:
    174171    {
    175       // cropping
    176       if ((m_cropLeft == 0) && (m_cropRight == 0) && (m_cropTop == 0) && (m_cropBottom == 0))
     172      // conformance
     173      if ((m_confLeft == 0) && (m_confRight == 0) && (m_confTop == 0) && (m_confBottom == 0))
    177174      {
    178175        fprintf(stderr, "Warning: Cropping enabled, but all cropping parameters set to zero\n");
     
    200197  {
    201198    Int iSwitchPOC = (Int)( iFrameToBeEncoded - (m_fQP - m_iQP)*iFrameToBeEncoded + 0.5 );
    202    
     199
    203200
    204201    iSwitchPOC = (Int)( (Double)iSwitchPOC / iGOPSize + 0.5 )*iGOPSize;
     
    224221  }
    225222
    226   xConfirmPara( m_iQP <  -6 * ((Int)m_cAppEncCfg->getInternalBitDepth() - 8) || m_iQP > 51,                "QP exceeds supported range (-QpBDOffsety to 51)" );
    227 
    228  
    229 #if SVC_EXTENSION
     223  xConfirmPara( m_iQP <  -6 * ((Int)m_cAppEncCfg->getInternalBitDepthY() - 8) || m_iQP > 51,                "QP exceeds supported range (-QpBDOffsety to 51)" );
     224
     225
    230226  m_iWaveFrontSubstreams = m_cAppEncCfg->getWaveFrontSynchro() ? (m_iSourceHeight + m_cAppEncCfg->getMaxCUHeight() - 1) / m_cAppEncCfg->getMaxCUHeight() : 1;
    231227  xConfirmPara( m_iWaveFrontSubstreams <= 0, "WaveFrontSubstreams must be positive" );
    232228  xConfirmPara( m_iWaveFrontSubstreams > 1 && !m_cAppEncCfg->getWaveFrontSynchro(), "Must have WaveFrontSynchro > 0 in order to have WaveFrontSubstreams > 1" );
    233 #endif
    234 
     229
     230  //chekc parameters
     231  xConfirmPara( m_iSourceWidth  % TComSPS::getWinUnitX(CHROMA_420) != 0, "Picture width must be an integer multiple of the specified chroma subsampling");
     232  xConfirmPara( m_iSourceHeight % TComSPS::getWinUnitY(CHROMA_420) != 0, "Picture height must be an integer multiple of the specified chroma subsampling");
     233
     234  xConfirmPara( m_aiPad[0] % TComSPS::getWinUnitX(CHROMA_420) != 0, "Horizontal padding must be an integer multiple of the specified chroma subsampling");
     235  xConfirmPara( m_aiPad[1] % TComSPS::getWinUnitY(CHROMA_420) != 0, "Vertical padding must be an integer multiple of the specified chroma subsampling");
     236
     237  xConfirmPara( m_confLeft   % TComSPS::getWinUnitX(CHROMA_420) != 0, "Left conformance window offset must be an integer multiple of the specified chroma subsampling");
     238  xConfirmPara( m_confRight  % TComSPS::getWinUnitX(CHROMA_420) != 0, "Right conformance window offset must be an integer multiple of the specified chroma subsampling");
     239  xConfirmPara( m_confTop    % TComSPS::getWinUnitY(CHROMA_420) != 0, "Top conformance window offset must be an integer multiple of the specified chroma subsampling");
     240  xConfirmPara( m_confBottom % TComSPS::getWinUnitY(CHROMA_420) != 0, "Bottom conformance window offset must be an integer multiple of the specified chroma subsampling");
    235241#undef xConfirmPara
    236242  return check_failed;
Note: See TracChangeset for help on using the changeset viewer.