| 235 | } |
| 236 | |
| 237 | int CWelsH264SVCEncoder::InitializeInternal (SWelsSvcCodingParam* pCfg) { |
| 238 | if (NULL == pCfg) { |
| 239 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, "CWelsH264SVCEncoder::Initialize(), invalid argv= 0x%p.", |
| 240 | pCfg); |
| 241 | return cmInitParaError; |
| 242 | } |
| 243 | |
| 244 | if (m_bInitialFlag) { |
| 245 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_WARNING, |
| 246 | "CWelsH264SVCEncoder::Initialize(), reinitialize, m_bInitialFlag= %d.", |
| 247 | m_bInitialFlag); |
| 248 | Uninitialize(); |
| 249 | } |
| 250 | // Check valid parameters |
| 251 | const int32_t iNumOfLayers = pCfg->iSpatialLayerNum; |
| 252 | if (iNumOfLayers < 1 || iNumOfLayers > MAX_DEPENDENCY_LAYER) { |
| 253 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, |
| 254 | "CWelsH264SVCEncoder::Initialize(), invalid iSpatialLayerNum= %d, valid at range of [1, %d].", iNumOfLayers, |
| 255 | MAX_DEPENDENCY_LAYER); |
| 256 | Uninitialize(); |
| 257 | return cmInitParaError; |
| 258 | } |
| 259 | if (pCfg->iTemporalLayerNum < 1) |
| 260 | pCfg->iTemporalLayerNum = 1; |
| 261 | if (pCfg->iTemporalLayerNum > MAX_TEMPORAL_LEVEL) { |
| 262 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, |
| 263 | "CWelsH264SVCEncoder::Initialize(), invalid iTemporalLayerNum= %d, valid at range of [1, %d].", |
| 264 | pCfg->iTemporalLayerNum, MAX_TEMPORAL_LEVEL); |
| 265 | Uninitialize(); |
| 266 | return cmInitParaError; |
| 267 | } |
| 268 | |
| 269 | // assert( cfg.uiGopSize >= 1 && ( cfg.uiIntraPeriod && (cfg.uiIntraPeriod % cfg.uiGopSize) == 0) ); |
| 270 | |
| 271 | if (pCfg->uiGopSize < 1 || pCfg->uiGopSize > MAX_GOP_SIZE) { |
| 272 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, |
| 273 | "CWelsH264SVCEncoder::Initialize(), invalid uiGopSize= %d, valid at range of [1, %d].", pCfg->uiGopSize, |
| 274 | MAX_GOP_SIZE); |
| 275 | Uninitialize(); |
| 276 | return cmInitParaError; |
| 277 | } |
| 278 | |
| 279 | if (!WELS_POWER2_IF (pCfg->uiGopSize)) { |
| 280 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, |
| 281 | "CWelsH264SVCEncoder::Initialize(), invalid uiGopSize= %d, valid at range of [1, %d] and yield to power of 2.", |
| 282 | pCfg->uiGopSize, MAX_GOP_SIZE); |
| 283 | Uninitialize(); |
| 284 | return cmInitParaError; |
| 285 | } |
| 286 | |
| 287 | if (pCfg->uiIntraPeriod && pCfg->uiIntraPeriod < pCfg->uiGopSize) { |
| 288 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, |
| 289 | "CWelsH264SVCEncoder::Initialize(), invalid uiIntraPeriod= %d, valid in case it equals to 0 for unlimited intra period or exceeds specified uiGopSize= %d.", |
| 290 | pCfg->uiIntraPeriod, pCfg->uiGopSize); |
| 291 | Uninitialize(); |
| 292 | return cmInitParaError; |
| 293 | } |
| 294 |
nothing calls this directly
no test coverage detected