Changeset 125 in SHVCSoftware for trunk/source/App/TAppEncoder/TAppEncLayerCfg.cpp
- Timestamp:
- 16 Apr 2013, 06:39:31 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/App/TAppEncoder/TAppEncLayerCfg.cpp
r55 r125 1 1 /** \file TAppEncLayerCfg.cpp 2 2 \brief Handle encoder configuration parameters 3 3 */ 4 4 … … 28 28 #if SVC_EXTENSION 29 29 TAppEncLayerCfg::TAppEncLayerCfg() 30 :m_cInputFile(string("")),31 m_cReconFile(string("")),32 m_croppingMode( 0 ),33 m_aidQP(NULL)34 { 35 m_c ropLeft = 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; 36 36 m_aiPad[1] = m_aiPad[0] = 0; 37 37 } … … 59 59 60 60 /** \param argc number of arguments 61 62 63 61 \param argv array of arguments 62 \retval true when success 63 */ 64 64 bool TAppEncLayerCfg::parseCfg( const string& cfgFileName ) 65 65 { … … 69 69 po::Options opts; 70 70 opts.addOptions() 71 ("InputFile,i", cfg_InputFile, string(""), "original YUV input file name")71 ("InputFile,i", cfg_InputFile, string(""), "original YUV input file name") 72 72 #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 91 91 po::setDefaults(opts); 92 92 po::parseConfigFile(opts, cfgFileName); … … 123 123 printf("Base layer input file : %s\n", m_cAppEncCfg->getBLSyntaxFile() ); 124 124 #endif 125 printf("Real Format : %dx%d %dHz\n", m_iSourceWidth - m_c ropLeft - 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 ); 126 126 printf("Internal Format : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate ); 127 127 printf("QP : %5.2f\n", m_fQP ); 128 128 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); 133 130 } 134 131 … … 137 134 Bool TAppEncLayerCfg::xCheckParameter() 138 135 { 139 switch (m_c roppingMode)136 switch (m_conformanceMode) 140 137 { 141 138 case 0: 142 139 { 143 140 // no cropping or padding 144 m_c ropLeft = m_cropRight = m_cropTop = m_cropBottom = 0;141 m_confLeft = m_confRight = m_confTop = m_confBottom = 0; 145 142 m_aiPad[1] = m_aiPad[0] = 0; 146 143 break; … … 152 149 if (m_iSourceWidth % minCuSize) 153 150 { 154 m_aiPad[0] = m_c ropRight = ((m_iSourceWidth / minCuSize) + 1) * minCuSize - m_iSourceWidth;155 m_iSourceWidth += m_c ropRight;151 m_aiPad[0] = m_confRight = ((m_iSourceWidth / minCuSize) + 1) * minCuSize - m_iSourceWidth; 152 m_iSourceWidth += m_confRight; 156 153 } 157 154 if (m_iSourceHeight % minCuSize) 158 155 { 159 m_aiPad[1] = m_c ropBottom = ((m_iSourceHeight / minCuSize) + 1) * minCuSize - m_iSourceHeight;160 m_iSourceHeight += m_c ropBottom;156 m_aiPad[1] = m_confBottom = ((m_iSourceHeight / minCuSize) + 1) * minCuSize - m_iSourceHeight; 157 m_iSourceHeight += m_confBottom; 161 158 } 162 159 break; … … 167 164 m_iSourceWidth += m_aiPad[0]; 168 165 m_iSourceHeight += m_aiPad[1]; 169 m_c ropRight = m_aiPad[0];170 m_c ropBottom = m_aiPad[1];166 m_confRight = m_aiPad[0]; 167 m_confBottom = m_aiPad[1]; 171 168 break; 172 169 } 173 170 case 3: 174 171 { 175 // c ropping176 if ((m_c ropLeft == 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)) 177 174 { 178 175 fprintf(stderr, "Warning: Cropping enabled, but all cropping parameters set to zero\n"); … … 200 197 { 201 198 Int iSwitchPOC = (Int)( iFrameToBeEncoded - (m_fQP - m_iQP)*iFrameToBeEncoded + 0.5 ); 202 199 203 200 204 201 iSwitchPOC = (Int)( (Double)iSwitchPOC / iGOPSize + 0.5 )*iGOPSize; … … 224 221 } 225 222 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 230 226 m_iWaveFrontSubstreams = m_cAppEncCfg->getWaveFrontSynchro() ? (m_iSourceHeight + m_cAppEncCfg->getMaxCUHeight() - 1) / m_cAppEncCfg->getMaxCUHeight() : 1; 231 227 xConfirmPara( m_iWaveFrontSubstreams <= 0, "WaveFrontSubstreams must be positive" ); 232 228 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"); 235 241 #undef xConfirmPara 236 242 return check_failed;
Note: See TracChangeset for help on using the changeset viewer.