Showing the changes to codec/encoder/plus/src/welsEncoderExt.cpp (1 of 20 files). Show all
Unified · Split
| @@ -206,29 +206,49 @@ void CWelsH264SVCEncoder::InitEncoder (void) { · 205 unmodified lines | |||
| 206 | /* | 206 | /* |
| 207 | * SVC Encoder Initialization | 207 | * SVC Encoder Initialization |
| 208 | */ | 208 | */ |
| 209 | int CWelsH264SVCEncoder::Initialize (SVCEncodingParam* argv, const INIT_TYPE iInitType) { | 209 | int CWelsH264SVCEncoder::Initialize (SEncParamBase* argv, const INIT_TYPE iInitType) { |
| 210 | if (INIT_TYPE_PARAMETER_BASED != iInitType || NULL == argv) { | 210 | |
| 211 | |||
| 212 | if ((INIT_TYPE_PARAMETER_BASED != iInitType && INIT_TYPE_PARAMETER_EXT != iInitType)|| NULL == argv) { | ||
| 211 | WelsLog (m_pEncContext, WELS_LOG_ERROR, "CWelsH264SVCEncoder::Initialize(), invalid iInitType= %d, argv= 0x%p\n", | 213 | WelsLog (m_pEncContext, WELS_LOG_ERROR, "CWelsH264SVCEncoder::Initialize(), invalid iInitType= %d, argv= 0x%p\n", |
| 212 | iInitType, (void*)argv); | 214 | iInitType, (void*)argv); |
| 213 | return cmInitParaError; | 215 | return cmInitParaError; |
| 214 | } | 216 | } |
| 215 | 217 | if (m_bInitialFlag) { | |
| 216 | if (m_bInitialFlag) { | ||
| 217 | WelsLog (m_pEncContext, WELS_LOG_WARNING, "CWelsH264SVCEncoder::Initialize(), reinitialize, m_bInitialFlag= %d\n", | 218 | WelsLog (m_pEncContext, WELS_LOG_WARNING, "CWelsH264SVCEncoder::Initialize(), reinitialize, m_bInitialFlag= %d\n", |
| 218 | m_bInitialFlag); | 219 | m_bInitialFlag); |
| 219 | Uninitialize(); | 220 | Uninitialize(); |
| 220 | } | 221 | } |
| 221 | 222 | ||
| 222 | SVCEncodingParam sEncodingParam; | ||
| 223 | SWelsSvcCodingParam sConfig (true); | 223 | SWelsSvcCodingParam sConfig (true); |
| 224 | 224 | if(iInitType == INIT_TYPE_PARAMETER_BASED) | |
| 225 | memcpy (&sEncodingParam, argv, sizeof (SVCEncodingParam)); // confirmed_safe_unsafe_usage | 225 | { |
| 226 | 226 | SEncParamBase sEncodingParam; | |
| 227 | memcpy (&sEncodingParam, argv, sizeof (SEncParamBase)); // confirmed_safe_unsafe_usage | ||
| 228 | |||
| 229 | // Convert SEncParamBase into WelsSVCParamConfig here.. | ||
| 230 | if (sConfig.ParamBaseTranscode (sEncodingParam, true)) { | ||
| 231 | WelsLog (m_pEncContext, WELS_LOG_ERROR, "CWelsH264SVCEncoder::Initialize(), parameter_translation failed.\n"); | ||
| 232 | Uninitialize(); | ||
| 233 | return cmInitParaError; | ||
| 234 | } | ||
| 235 | } | ||
| 236 | else if(iInitType == INIT_TYPE_PARAMETER_EXT) | ||
| 237 | { | ||
| 238 | SEncParamExt sEncodingParam; | ||
| 239 | memcpy (&sEncodingParam, argv, sizeof (SEncParamExt)); // confirmed_safe_unsafe_usage | ||
| 240 | // Convert SEncParamBase into WelsSVCParamConfig here.. | ||
| 241 | if (sConfig.ParamTranscode (sEncodingParam, true)) { | ||
| 242 | WelsLog (m_pEncContext, WELS_LOG_ERROR, "CWelsH264SVCEncoder::Initialize(), parameter_translation failed.\n"); | ||
| 243 | Uninitialize(); | ||
| 244 | return cmInitParaError; | ||
| 245 | } | ||
| 246 | } | ||
| 227 | #ifdef REC_FRAME_COUNT | 247 | #ifdef REC_FRAME_COUNT |
| 228 | WelsLog (m_pEncContext, WELS_LOG_INFO, "CWelsH264SVCEncoder::Initialize, m_uiCountFrameNum= %d, m_iCspInternal= 0x%x\n", | 248 | WelsLog (m_pEncContext, WELS_LOG_INFO, "CWelsH264SVCEncoder::Initialize, m_uiCountFrameNum= %d, m_iCspInternal= 0x%x\n", |
| 229 | m_uiCountFrameNum, m_iCspInternal); | 249 | m_uiCountFrameNum, m_iCspInternal); |
| 230 | WelsLog (m_pEncContext, WELS_LOG_INFO, | 250 | WelsLog (m_pEncContext, WELS_LOG_INFO, |
| 231 | "coding_param->iPicWidth= %d;coding_param->iPicHeight= %d;coding_param->iTargetBitrate= %d;coding_param->iRCMode= %d;coding_param->iTemporalLayerNum= %d;coding_param->iSpatialLayerNum= %d;coding_param->fFrameRate= %.6ff;coding_param->iInputCsp= %d;coding_param->iKeyPicCodingMode= %d;coding_param->uiIntraPeriod= %d;coding_param->bEnableSpsPpsIdAddition = %d;coding_param->bPrefixNalAddingCtrl = %d;coding_param->bEnableDenoise= %d;coding_param->bEnableBackgroundDetection= %d;coding_param->bEnableAdaptiveQuant= %d;coding_param->bEnableFrameSkip= %d;coding_param->bEnableCropPic= %d;coding_param->bEnableLongTermReference= %d;coding_param->iLtrMarkPeriod= %d;\n", | 251 | "coding_param->iPicWidth= %d;coding_param->iPicHeight= %d;coding_param->iTargetBitrate= %d;coding_param->iRCMode= %d;coding_param->iTemporalLayerNum= %d;coding_param->iSpatialLayerNum= %d;coding_param->fFrameRate= %.6ff;coding_param->iInputCsp= %d;coding_param->uiIntraPeriod= %d;coding_param->bEnableSpsPpsIdAddition = %d;coding_param->bPrefixNalAddingCtrl = %d;coding_param->bEnableDenoise= %d;coding_param->bEnableBackgroundDetection= %d;coding_param->bEnableAdaptiveQuant= %d;coding_param->bEnableFrameSkip= %d;coding_param->bEnableCropPic= %d;coding_param->bEnableLongTermReference= %d;coding_param->iLtrMarkPeriod= %d;\n", |
| 232 | sEncodingParam.iPicWidth, | 252 | sEncodingParam.iPicWidth, |
| 233 | sEncodingParam.iPicHeight, | 253 | sEncodingParam.iPicHeight, |
| 234 | sEncodingParam.iTargetBitrate, | 254 | sEncodingParam.iTargetBitrate, |
| @@ -237,7 +257,6 @@ int CWelsH264SVCEncoder::Initialize (SVCEncodingParam* argv, const INIT_TYPE iIn · 2 unmodified lines | |||
| 237 | sEncodingParam.iSpatialLayerNum, | 257 | sEncodingParam.iSpatialLayerNum, |
| 238 | sEncodingParam.fFrameRate, | 258 | sEncodingParam.fFrameRate, |
| 239 | sEncodingParam.iInputCsp, | 259 | sEncodingParam.iInputCsp, |
| 240 | sEncodingParam.iKeyPicCodingMode, | ||
| 241 | sEncodingParam.iIntraPeriod, | 260 | sEncodingParam.iIntraPeriod, |
| 242 | sEncodingParam.bEnableSpsPpsIdAddition, | 261 | sEncodingParam.bEnableSpsPpsIdAddition, |
| 243 | sEncodingParam.bPrefixNalAddingCtrl, | 262 | sEncodingParam.bPrefixNalAddingCtrl, |
| @@ -267,21 +286,13 @@ int CWelsH264SVCEncoder::Initialize (SVCEncodingParam* argv, const INIT_TYPE iIn · 23 unmodified lines | |||
| 267 | ++ i; | 286 | ++ i; |
| 268 | } | 287 | } |
| 269 | #endif//REC_FRAME_COUNT | 288 | #endif//REC_FRAME_COUNT |
| 270 | |||
| 271 | // Convert SVCEncodingParam into WelsSVCParamConfig here.. | ||
| 272 | if (sConfig.ParamTranscode (sEncodingParam, true)) { | ||
| 273 | WelsLog (m_pEncContext, WELS_LOG_ERROR, "CWelsH264SVCEncoder::Initialize(), parameter_translation failed.\n"); | ||
| 274 | Uninitialize(); | ||
| 275 | return cmInitParaError; | ||
| 276 | } | ||
| 277 | |||
| 278 | m_iSrcListSize = 1; | 289 | m_iSrcListSize = 1; |
| 279 | 290 | ||
| 280 | return Initialize2 ((void*)&sConfig, INIT_TYPE_CONFIG_BASED); | 291 | return Initialize2 ((void*)&sConfig, INIT_TYPE_PARAMETER_BASED); |
| 281 | } | 292 | } |
| 282 | 293 | ||
| 283 | int CWelsH264SVCEncoder::Initialize2 (void* argv, const INIT_TYPE iInitType) { | 294 | int CWelsH264SVCEncoder::Initialize2 (void* argv, const INIT_TYPE iInitType) { |
| 284 | if (INIT_TYPE_CONFIG_BASED != iInitType || NULL == argv) { | 295 | if (INIT_TYPE_PARAMETER_BASED != iInitType || NULL == argv) { |
| 285 | WelsLog (m_pEncContext, WELS_LOG_ERROR, "CWelsH264SVCEncoder::Initialize(), invalid iInitType= %d, argv= 0x%p.\n", | 296 | WelsLog (m_pEncContext, WELS_LOG_ERROR, "CWelsH264SVCEncoder::Initialize(), invalid iInitType= %d, argv= 0x%p.\n", |
| 286 | iInitType, (void*)argv); | 297 | iInitType, (void*)argv); |
| 287 | return cmInitParaError; | 298 | return cmInitParaError; |
| @@ -303,20 +314,20 @@ int CWelsH264SVCEncoder::Initialize2 (void* argv, const INIT_TYPE iInitType) { · 15 unmodified lines | |||
| 303 | } | 314 | } |
| 304 | 315 | ||
| 305 | // Check valid parameters | 316 | // Check valid parameters |
| 306 | const int32_t iNumOfLayers = pCfg->iNumDependencyLayer; | 317 | const int32_t iNumOfLayers = pCfg->iSpatialLayerNum; |
| 307 | if (iNumOfLayers < 1 || iNumOfLayers > MAX_DEPENDENCY_LAYER) { | 318 | if (iNumOfLayers < 1 || iNumOfLayers > MAX_DEPENDENCY_LAYER) { |
| 308 | WelsLog (m_pEncContext, WELS_LOG_ERROR, | 319 | WelsLog (m_pEncContext, WELS_LOG_ERROR, |
| 309 | "CWelsH264SVCEncoder::Initialize(), invalid iNumDependencyLayer= %d, valid at range of [1, %d].\n", iNumOfLayers, | 320 | "CWelsH264SVCEncoder::Initialize(), invalid iSpatialLayerNum= %d, valid at range of [1, %d].\n", iNumOfLayers, |
| 310 | MAX_DEPENDENCY_LAYER); | 321 | MAX_DEPENDENCY_LAYER); |
| 311 | Uninitialize(); | 322 | Uninitialize(); |
| 312 | return cmInitParaError; | 323 | return cmInitParaError; |
| 313 | } | 324 | } |
| 314 | if (pCfg->iNumTemporalLayer < 1) | 325 | if (pCfg->iTemporalLayerNum < 1) |
| 315 | pCfg->iNumTemporalLayer = 1; | 326 | pCfg->iTemporalLayerNum = 1; |
| 316 | if (pCfg->iNumTemporalLayer > MAX_TEMPORAL_LEVEL) { | 327 | if (pCfg->iTemporalLayerNum > MAX_TEMPORAL_LEVEL) { |
| 317 | WelsLog (m_pEncContext, WELS_LOG_ERROR, | 328 | WelsLog (m_pEncContext, WELS_LOG_ERROR, |
| 318 | "CWelsH264SVCEncoder::Initialize(), invalid iNumTemporalLayer= %d, valid at range of [1, %d].\n", | 329 | "CWelsH264SVCEncoder::Initialize(), invalid iTemporalLayerNum= %d, valid at range of [1, %d].\n", |
| 319 | pCfg->iNumTemporalLayer, MAX_TEMPORAL_LEVEL); | 330 | pCfg->iTemporalLayerNum, MAX_TEMPORAL_LEVEL); |
| 320 | Uninitialize(); | 331 | Uninitialize(); |
| 321 | return cmInitParaError; | 332 | return cmInitParaError; |
| 322 | } | 333 | } |
| @@ -366,17 +377,17 @@ int CWelsH264SVCEncoder::Initialize2 (void* argv, const INIT_TYPE iInitType) { · 43 unmodified lines | |||
| 366 | 377 | ||
| 367 | pCfg->iNumRefFrame = WELS_CLIP3 (pCfg->iNumRefFrame, MIN_REF_PIC_COUNT, MAX_REFERENCE_PICTURE_COUNT_NUM); | 378 | pCfg->iNumRefFrame = WELS_CLIP3 (pCfg->iNumRefFrame, MIN_REF_PIC_COUNT, MAX_REFERENCE_PICTURE_COUNT_NUM); |
| 368 | 379 | ||
| 369 | if (pCfg->uiLtrMarkPeriod == 0) { | 380 | if (pCfg->iLtrMarkPeriod == 0) { |
| 370 | pCfg->uiLtrMarkPeriod = 30; | 381 | pCfg->iLtrMarkPeriod = 30; |
| 371 | } | 382 | } |
| 372 | 383 | ||
| 373 | const int32_t kiDecStages = WELS_LOG2 (pCfg->uiGopSize); | 384 | const int32_t kiDecStages = WELS_LOG2 (pCfg->uiGopSize); |
| 374 | pCfg->iInputCsp = iColorspace; | 385 | pCfg->iInputCsp = iColorspace; |
| 375 | pCfg->iNumTemporalLayer = (int8_t) (1 + kiDecStages); | 386 | pCfg->iTemporalLayerNum = (int8_t) (1 + kiDecStages); |
| 376 | pCfg->iLoopFilterAlphaC0Offset = WELS_CLIP3 (pCfg->iLoopFilterAlphaC0Offset, -6, 6); | 387 | pCfg->iLoopFilterAlphaC0Offset = WELS_CLIP3 (pCfg->iLoopFilterAlphaC0Offset, -6, 6); |
| 377 | pCfg->iLoopFilterBetaOffset = WELS_CLIP3 (pCfg->iLoopFilterBetaOffset, -6, 6); | 388 | pCfg->iLoopFilterBetaOffset = WELS_CLIP3 (pCfg->iLoopFilterBetaOffset, -6, 6); |
| 378 | 389 | ||
| 379 | // m_pSrcPicList = (SSourcePicture **)WelsMalloc( pCfg->iNumDependencyLayer * sizeof(SSourcePicture *), "m_pSrcPicList" ); | 390 | // m_pSrcPicList = (SSourcePicture **)WelsMalloc( pCfg->iSpatialLayerNum * sizeof(SSourcePicture *), "m_pSrcPicList" ); |
| 380 | // prefer use new/delete pair due encoder intialization stage not start yet for CacheLineSize not detection here (16 or 64 not matched) | 391 | // prefer use new/delete pair due encoder intialization stage not start yet for CacheLineSize not detection here (16 or 64 not matched) |
| 381 | m_pSrcPicList = new SSourcePicture* [iNumOfLayers]; | 392 | m_pSrcPicList = new SSourcePicture* [iNumOfLayers]; |
| 382 | 393 | ||
| @@ -388,8 +399,8 @@ int CWelsH264SVCEncoder::Initialize2 (void* argv, const INIT_TYPE iInitType) { · 5 unmodified lines | |||
| 388 | } | 399 | } |
| 389 | 400 | ||
| 390 | // decide property list size between INIT_TYPE_PARAMETER_BASED/INIT_TYPE_CONFIG_BASED | 401 | // decide property list size between INIT_TYPE_PARAMETER_BASED/INIT_TYPE_CONFIG_BASED |
| 391 | m_iMaxPicWidth = pCfg->iActualPicWidth; | 402 | m_iMaxPicWidth = pCfg->iPicWidth; |
| 392 | m_iMaxPicHeight = pCfg->iActualPicHeight; | 403 | m_iMaxPicHeight = pCfg->iPicHeight; |
| 393 | m_iSrcListSize = iNumOfLayers; | 404 | m_iSrcListSize = iNumOfLayers; |
| 394 | 405 | ||
| 395 | for (int32_t i = 0; i < m_iSrcListSize; ++ i) { | 406 | for (int32_t i = 0; i < m_iSrcListSize; ++ i) { |
| @@ -580,10 +591,10 @@ int CWelsH264SVCEncoder::EncodeFrame2 (const SSourcePicture** pSrcPicList, int · 184 unmodified lines | |||
| 580 | } | 591 | } |
| 581 | char strStreamFileName[128] = {0}; | 592 | char strStreamFileName[128] = {0}; |
| 582 | int32_t iLen = WelsSnprintf (strStreamFileName, 128, "adj%d_w%d.264", m_iSwitchTimes, | 593 | int32_t iLen = WelsSnprintf (strStreamFileName, 128, "adj%d_w%d.264", m_iSwitchTimes, |
| 583 | m_pEncContext->pSvcParam->iActualPicWidth); | 594 | m_pEncContext->pSvcParam->iPicWidth); |
| 584 | m_pFileBs = WelsFopen (strStreamFileName, "wb"); | 595 | m_pFileBs = WelsFopen (strStreamFileName, "wb"); |
| 585 | WelsSnprintf (strStreamFileName, 128, "adj%d_w%d_size.iLen", m_iSwitchTimes, | 596 | WelsSnprintf (strStreamFileName, 128, "adj%d_w%d_size.iLen", m_iSwitchTimes, |
| 586 | m_pEncContext->pSvcParam->iActualPicWidth); | 597 | m_pEncContext->pSvcParam->iPicWidth); |
| 587 | m_pFileBsSize = WelsFopen (strStreamFileName, "wb"); | 598 | m_pFileBsSize = WelsFopen (strStreamFileName, "wb"); |
| 588 | 599 | ||
| 589 | 600 | ||
| @@ -729,18 +740,18 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 139 unmodified lines | |||
| 729 | m_pEncContext->pSvcParam->uiIntraPeriod = (uint32_t)iValue; | 740 | m_pEncContext->pSvcParam->uiIntraPeriod = (uint32_t)iValue; |
| 730 | } | 741 | } |
| 731 | break; | 742 | break; |
| 732 | case ENCODER_OPTION_SVC_ENCODE_PARAM: { // SVC Encoding Parameter | 743 | case ENCODER_OPTION_SVC_ENCODE_PARAM_EXT: { // SVC Encoding Parameter |
| 733 | SVCEncodingParam sEncodingParam; | 744 | SEncParamExt sEncodingParam; |
| 734 | SWelsSvcCodingParam sConfig (true); | 745 | SWelsSvcCodingParam sConfig (true); |
| 735 | int32_t iInputColorspace = 0; | 746 | int32_t iInputColorspace = 0; |
| 736 | int32_t iTargetWidth = 0; | 747 | int32_t iTargetWidth = 0; |
| 737 | int32_t iTargetHeight = 0; | 748 | int32_t iTargetHeight = 0; |
| 738 | 749 | ||
| 739 | memcpy (&sEncodingParam, pOption, sizeof (SVCEncodingParam)); // confirmed_safe_unsafe_usage | 750 | memcpy (&sEncodingParam, pOption, sizeof (SEncParamBase)); // confirmed_safe_unsafe_usage |
| 740 | WelsLog (m_pEncContext, WELS_LOG_INFO, "ENCODER_OPTION_SVC_ENCODE_PARAM, sEncodingParam.iInputCsp= 0x%x\n", | 751 | WelsLog (m_pEncContext, WELS_LOG_INFO, "ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, sEncodingParam.iInputCsp= 0x%x\n", |
| 741 | sEncodingParam.iInputCsp); | 752 | sEncodingParam.iInputCsp); |
| 742 | WelsLog (m_pEncContext, WELS_LOG_INFO, | 753 | WelsLog (m_pEncContext, WELS_LOG_INFO, |
| 743 | "coding_param->iPicWidth= %d;coding_param->iPicHeight= %d;coding_param->iTargetBitrate= %d;coding_param->iRCMode= %d;coding_param->iPaddingFlag= %d;coding_param->iTemporalLayerNum= %d;coding_param->iSpatialLayerNum= %d;coding_param->fFrameRate= %.6ff;coding_param->iInputCsp= %d;coding_param->iKeyPicCodingMode= %d;coding_param->uiIntraPeriod= %d;coding_param->bEnableSpsPpsIdAddition = %d;coding_param->bPrefixNalAddingCtrl = %d;coding_param->bEnableDenoise= %d;coding_param->bEnableBackgroundDetection= %d;coding_param->bEnableAdaptiveQuant= %d;coding_param->bEnableAdaptiveQuant= %d;coding_param->bEnableCropPic= %d;coding_param->bEnableLongTermReference= %d;coding_param->iLtrMarkPeriod= %d;\n", | 754 | "coding_param->iPicWidth= %d;coding_param->iPicHeight= %d;coding_param->iTargetBitrate= %d;coding_param->iRCMode= %d;coding_param->iPaddingFlag= %d;coding_param->iTemporalLayerNum= %d;coding_param->iSpatialLayerNum= %d;coding_param->fFrameRate= %.6ff;coding_param->iInputCsp= %d;coding_param->uiIntraPeriod= %d;coding_param->bEnableSpsPpsIdAddition = %d;coding_param->bPrefixNalAddingCtrl = %d;coding_param->bEnableDenoise= %d;coding_param->bEnableBackgroundDetection= %d;coding_param->bEnableAdaptiveQuant= %d;coding_param->bEnableAdaptiveQuant= %d;coding_param->bEnableCropPic= %d;coding_param->bEnableLongTermReference= %d;coding_param->iLtrMarkPeriod= %d;\n", |
| 744 | sEncodingParam.iPicWidth, | 755 | sEncodingParam.iPicWidth, |
| 745 | sEncodingParam.iPicHeight, | 756 | sEncodingParam.iPicHeight, |
| 746 | sEncodingParam.iTargetBitrate, | 757 | sEncodingParam.iTargetBitrate, |
| @@ -748,10 +759,9 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 1 unmodified line | |||
| 748 | sEncodingParam.iPaddingFlag, | 759 | sEncodingParam.iPaddingFlag, |
| 749 | sEncodingParam.iTemporalLayerNum, | 760 | sEncodingParam.iTemporalLayerNum, |
| 750 | sEncodingParam.iSpatialLayerNum, | 761 | sEncodingParam.iSpatialLayerNum, |
| 751 | sEncodingParam.fFrameRate, | 762 | sEncodingParam.fMaxFrameRate, |
| 752 | sEncodingParam.iInputCsp, | 763 | sEncodingParam.iInputCsp, |
| 753 | sEncodingParam.iKeyPicCodingMode, | 764 | sEncodingParam.uiIntraPeriod, |
| 754 | sEncodingParam.iIntraPeriod, | ||
| 755 | sEncodingParam.bEnableSpsPpsIdAddition, | 765 | sEncodingParam.bEnableSpsPpsIdAddition, |
| 756 | sEncodingParam.bPrefixNalAddingCtrl, | 766 | sEncodingParam.bPrefixNalAddingCtrl, |
| 757 | sEncodingParam.bEnableDenoise, | 767 | sEncodingParam.bEnableDenoise, |
| @@ -781,7 +791,7 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 23 unmodified lines | |||
| 781 | } | 791 | } |
| 782 | #ifdef OUTPUT_BIT_STREAM | 792 | #ifdef OUTPUT_BIT_STREAM |
| 783 | if (sEncodingParam.sSpatialLayers[sEncodingParam.iSpatialLayerNum - 1].iVideoWidth != | 793 | if (sEncodingParam.sSpatialLayers[sEncodingParam.iSpatialLayerNum - 1].iVideoWidth != |
| 784 | m_pEncContext->pSvcParam->sDependencyLayers[m_pEncContext->pSvcParam->iNumDependencyLayer - 1].iFrameWidth) { | 794 | m_pEncContext->pSvcParam->sDependencyLayers[m_pEncContext->pSvcParam->iSpatialLayerNum - 1].iFrameWidth) { |
| 785 | ++ m_iSwitchTimes; | 795 | ++ m_iSwitchTimes; |
| 786 | m_bSwitch = true; | 796 | m_bSwitch = true; |
| 787 | } | 797 | } |
| @@ -795,11 +805,11 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 7 unmodified lines | |||
| 795 | if (sConfig.ParamTranscode (sEncodingParam, true)) { | 805 | if (sConfig.ParamTranscode (sEncodingParam, true)) { |
| 796 | return cmInitParaError; | 806 | return cmInitParaError; |
| 797 | } | 807 | } |
| 798 | if (sConfig.iNumDependencyLayer < 1) { | 808 | if (sConfig.iSpatialLayerNum < 1) { |
| 799 | return cmInitParaError; | 809 | return cmInitParaError; |
| 800 | } | 810 | } |
| 801 | iTargetWidth = sConfig.iActualPicWidth; | 811 | iTargetWidth = sConfig.iPicWidth; |
| 802 | iTargetHeight = sConfig.iActualPicHeight; | 812 | iTargetHeight = sConfig.iPicHeight; |
| 803 | if (m_pSrcPicList[0] == NULL) { | 813 | if (m_pSrcPicList[0] == NULL) { |
| 804 | return cmInitParaError; | 814 | return cmInitParaError; |
| 805 | } | 815 | } |
| @@ -812,7 +822,7 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 6 unmodified lines | |||
| 812 | } | 822 | } |
| 813 | #ifdef REC_FRAME_COUNT | 823 | #ifdef REC_FRAME_COUNT |
| 814 | WelsLog (m_pEncContext, WELS_LOG_INFO, | 824 | WelsLog (m_pEncContext, WELS_LOG_INFO, |
| 815 | "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_SVC_ENCODE_PARAM, m_uiCountFrameNum= %d, m_iCspInternal= 0x%x\n", | 825 | "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, m_uiCountFrameNum= %d, m_iCspInternal= 0x%x\n", |
| 816 | m_uiCountFrameNum, m_iCspInternal); | 826 | m_uiCountFrameNum, m_iCspInternal); |
| 817 | #endif//REC_FRAME_COUNT | 827 | #endif//REC_FRAME_COUNT |
| 818 | 828 | ||
| @@ -876,7 +886,7 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 57 unmodified lines | |||
| 876 | break; | 886 | break; |
| 877 | case ENCOCER_LTR_MARKING_PERIOD: { | 887 | case ENCOCER_LTR_MARKING_PERIOD: { |
| 878 | uint32_t iValue = * ((uint32_t*) (pOption)); | 888 | uint32_t iValue = * ((uint32_t*) (pOption)); |
| 879 | m_pEncContext->pSvcParam->uiLtrMarkPeriod = iValue; | 889 | m_pEncContext->pSvcParam->iLtrMarkPeriod = iValue; |
| 880 | } | 890 | } |
| 881 | break; | 891 | break; |
| 882 | case ENCODER_OPTION_LTR: { | 892 | case ENCODER_OPTION_LTR: { |
| @@ -954,15 +964,25 @@ int CWelsH264SVCEncoder::GetOption (ENCODER_OPTION eOptionId, void* pOption) { · 71 unmodified lines | |||
| 954 | * ((int32_t*)pOption) = m_pEncContext->pSvcParam->uiIntraPeriod; | 964 | * ((int32_t*)pOption) = m_pEncContext->pSvcParam->uiIntraPeriod; |
| 955 | } | 965 | } |
| 956 | break; | 966 | break; |
| 957 | case ENCODER_OPTION_SVC_ENCODE_PARAM: { // SVC Encoding Parameter | 967 | case ENCODER_OPTION_SVC_ENCODE_PARAM_EXT: { // SVC Encoding Parameter |
| 968 | #ifdef REC_FRAME_COUNT | ||
| 969 | WelsLog (m_pEncContext, WELS_LOG_INFO, | ||
| 970 | "CWelsH264SVCEncoder::GetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, m_uiCountFrameNum= %d, m_iCspInternal= 0x%x\n", | ||
| 971 | m_uiCountFrameNum, m_iCspInternal); | ||
| 972 | #endif//REC_FRAME_COUNT | ||
| 973 | memcpy (pOption, m_pEncContext->pSvcParam, sizeof (SEncParamExt)); // confirmed_safe_unsafe_usage | ||
| 974 | } | ||
| 975 | break; | ||
| 976 | case ENCODER_OPTION_SVC_ENCODE_PARAM_BASE: { // SVC Encoding Parameter | ||
| 958 | #ifdef REC_FRAME_COUNT | 977 | #ifdef REC_FRAME_COUNT |
| 959 | WelsLog (m_pEncContext, WELS_LOG_INFO, | 978 | WelsLog (m_pEncContext, WELS_LOG_INFO, |
| 960 | "CWelsH264SVCEncoder::GetOption():ENCODER_OPTION_SVC_ENCODE_PARAM, m_uiCountFrameNum= %d, m_iCspInternal= 0x%x\n", | 979 | "CWelsH264SVCEncoder::GetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_BASE, m_uiCountFrameNum= %d, m_iCspInternal= 0x%x\n", |
| 961 | m_uiCountFrameNum, m_iCspInternal); | 980 | m_uiCountFrameNum, m_iCspInternal); |
| 962 | #endif//REC_FRAME_COUNT | 981 | #endif//REC_FRAME_COUNT |
| 963 | memcpy (pOption, m_pEncContext->pSvcParam, sizeof (SWelsSvcCodingParam)); // confirmed_safe_unsafe_usage | 982 | memcpy (pOption, m_pEncContext->pSvcParam, sizeof (SEncParamBase)); // confirmed_safe_unsafe_usage |
| 964 | } | 983 | } |
| 965 | break; | 984 | break; |
| 985 | |||
| 966 | case ENCODER_OPTION_FRAME_RATE: { // Maximal input frame rate | 986 | case ENCODER_OPTION_FRAME_RATE: { // Maximal input frame rate |
| 967 | #ifdef REC_FRAME_COUNT | 987 | #ifdef REC_FRAME_COUNT |
| 968 | WelsLog (m_pEncContext, WELS_LOG_INFO, | 988 | WelsLog (m_pEncContext, WELS_LOG_INFO, |