Showing the changes to codec/encoder/plus/src/welsEncoderExt.cpp (1 of 9 files). Show all
Unified · Split
| @@ -293,14 +293,6 @@ int CWelsH264SVCEncoder::InitializeInternal (SWelsSvcCodingParam* pCfg) { · 292 unmodified lines | |||
| 293 | } | 293 | } |
| 294 | #endif//REC_FRAME_COUNT | 294 | #endif//REC_FRAME_COUNT |
| 295 | 295 | ||
| 296 | const int32_t iColorspace = pCfg->iInputCsp; | ||
| 297 | if (videoFormatI420 != iColorspace) { | ||
| 298 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_ERROR, "CWelsH264SVCEncoder::Initialize(), invalid iInputCsp= %d.\n", | ||
| 299 | iColorspace); | ||
| 300 | Uninitialize(); | ||
| 301 | return cmInitParaError; | ||
| 302 | } | ||
| 303 | |||
| 304 | // Check valid parameters | 296 | // Check valid parameters |
| 305 | const int32_t iNumOfLayers = pCfg->iSpatialLayerNum; | 297 | const int32_t iNumOfLayers = pCfg->iSpatialLayerNum; |
| 306 | if (iNumOfLayers < 1 || iNumOfLayers > MAX_DEPENDENCY_LAYER) { | 298 | if (iNumOfLayers < 1 || iNumOfLayers > MAX_DEPENDENCY_LAYER) { |
| @@ -378,7 +370,6 @@ int CWelsH264SVCEncoder::InitializeInternal (SWelsSvcCodingParam* pCfg) { · 71 unmodified lines | |||
| 378 | } | 370 | } |
| 379 | 371 | ||
| 380 | const int32_t kiDecStages = WELS_LOG2 (pCfg->uiGopSize); | 372 | const int32_t kiDecStages = WELS_LOG2 (pCfg->uiGopSize); |
| 381 | pCfg->iInputCsp = iColorspace; | ||
| 382 | pCfg->iTemporalLayerNum = (int8_t) (1 + kiDecStages); | 373 | pCfg->iTemporalLayerNum = (int8_t) (1 + kiDecStages); |
| 383 | pCfg->iLoopFilterAlphaC0Offset = WELS_CLIP3 (pCfg->iLoopFilterAlphaC0Offset, -6, 6); | 374 | pCfg->iLoopFilterAlphaC0Offset = WELS_CLIP3 (pCfg->iLoopFilterAlphaC0Offset, -6, 6); |
| 384 | pCfg->iLoopFilterBetaOffset = WELS_CLIP3 (pCfg->iLoopFilterBetaOffset, -6, 6); | 375 | pCfg->iLoopFilterBetaOffset = WELS_CLIP3 (pCfg->iLoopFilterBetaOffset, -6, 6); |
| @@ -393,7 +384,6 @@ int CWelsH264SVCEncoder::InitializeInternal (SWelsSvcCodingParam* pCfg) { · 8 unmodified lines | |||
| 393 | return cmInitParaError; | 384 | return cmInitParaError; |
| 394 | } | 385 | } |
| 395 | 386 | ||
| 396 | m_iCspInternal = iColorspace; | ||
| 397 | m_bInitialFlag = true; | 387 | m_bInitialFlag = true; |
| 398 | 388 | ||
| 399 | return cmResultSuccess; | 389 | return cmResultSuccess; |
| @@ -645,16 +635,12 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 245 unmodified lines | |||
| 645 | case ENCODER_OPTION_SVC_ENCODE_PARAM_EXT: { // SVC Encoding Parameter | 635 | case ENCODER_OPTION_SVC_ENCODE_PARAM_EXT: { // SVC Encoding Parameter |
| 646 | SEncParamExt sEncodingParam; | 636 | SEncParamExt sEncodingParam; |
| 647 | SWelsSvcCodingParam sConfig; | 637 | SWelsSvcCodingParam sConfig; |
| 648 | int32_t iInputColorspace = 0; | ||
| 649 | int32_t iTargetWidth = 0; | 638 | int32_t iTargetWidth = 0; |
| 650 | int32_t iTargetHeight = 0; | 639 | int32_t iTargetHeight = 0; |
| 651 | 640 | ||
| 652 | memcpy (&sEncodingParam, pOption, sizeof (SEncParamExt)); // confirmed_safe_unsafe_usage | 641 | memcpy (&sEncodingParam, pOption, sizeof (SEncParamExt)); // confirmed_safe_unsafe_usage |
| 653 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, | 642 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, |
| 654 | "ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, sEncodingParam.iInputCsp= 0x%x\n", | 643 | "coding_param->iPicWidth= %d;coding_param->iPicHeight= %d;coding_param->iTargetBitrate= %d; coding_param->iMaxBitrate= %d; coding_param->iRCMode= %d;coding_param->iPaddingFlag= %d;coding_param->iTemporalLayerNum= %d;coding_param->iSpatialLayerNum= %d;coding_param->fFrameRate= %.6ff;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->bEnableLongTermReference= %d;coding_param->iLtrMarkPeriod= %d;\n", |
| 655 | sEncodingParam.iInputCsp); | ||
| 656 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, | ||
| 657 | "coding_param->iPicWidth= %d;coding_param->iPicHeight= %d;coding_param->iTargetBitrate= %d; coding_param->iMaxBitrate= %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->bEnableLongTermReference= %d;coding_param->iLtrMarkPeriod= %d;\n", | ||
| 658 | sEncodingParam.iPicWidth, | 644 | sEncodingParam.iPicWidth, |
| 659 | sEncodingParam.iPicHeight, | 645 | sEncodingParam.iPicHeight, |
| 660 | sEncodingParam.iTargetBitrate, | 646 | sEncodingParam.iTargetBitrate, |
| @@ -664,7 +650,6 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 3 unmodified lines | |||
| 664 | sEncodingParam.iTemporalLayerNum, | 650 | sEncodingParam.iTemporalLayerNum, |
| 665 | sEncodingParam.iSpatialLayerNum, | 651 | sEncodingParam.iSpatialLayerNum, |
| 666 | sEncodingParam.fMaxFrameRate, | 652 | sEncodingParam.fMaxFrameRate, |
| 667 | sEncodingParam.iInputCsp, | ||
| 668 | sEncodingParam.uiIntraPeriod, | 653 | sEncodingParam.uiIntraPeriod, |
| 669 | sEncodingParam.bEnableSpsPpsIdAddition, | 654 | sEncodingParam.bEnableSpsPpsIdAddition, |
| 670 | sEncodingParam.bPrefixNalAddingCtrl, | 655 | sEncodingParam.bPrefixNalAddingCtrl, |
| @@ -702,7 +687,6 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 31 unmodified lines | |||
| 702 | return cmInitParaError; | 687 | return cmInitParaError; |
| 703 | } | 688 | } |
| 704 | 689 | ||
| 705 | iInputColorspace = sEncodingParam.iInputCsp; | ||
| 706 | if (sConfig.ParamTranscode (sEncodingParam)) { | 690 | if (sConfig.ParamTranscode (sEncodingParam)) { |
| 707 | return cmInitParaError; | 691 | return cmInitParaError; |
| 708 | } | 692 | } |
| @@ -711,11 +695,10 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 2 unmodified lines | |||
| 711 | } | 695 | } |
| 712 | iTargetWidth = sConfig.iPicWidth; | 696 | iTargetWidth = sConfig.iPicWidth; |
| 713 | iTargetHeight = sConfig.iPicHeight; | 697 | iTargetHeight = sConfig.iPicHeight; |
| 714 | if (m_iCspInternal != iInputColorspace || m_iMaxPicWidth != iTargetWidth | 698 | if (m_iMaxPicWidth != iTargetWidth |
| 715 | || m_iMaxPicHeight != iTargetHeight) { // for color space due to changed | 699 | || m_iMaxPicHeight != iTargetHeight) { |
| 716 | m_iMaxPicWidth = iTargetWidth; | 700 | m_iMaxPicWidth = iTargetWidth; |
| 717 | m_iMaxPicHeight = iTargetHeight; | 701 | m_iMaxPicHeight = iTargetHeight; |
| 718 | m_iCspInternal = iInputColorspace; | ||
| 719 | } | 702 | } |
| 720 | #ifdef REC_FRAME_COUNT | 703 | #ifdef REC_FRAME_COUNT |
| 721 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, | 704 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, |
| @@ -724,7 +707,6 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 2 unmodified lines | |||
| 724 | #endif//REC_FRAME_COUNT | 707 | #endif//REC_FRAME_COUNT |
| 725 | 708 | ||
| 726 | /* New configuration available here */ | 709 | /* New configuration available here */ |
| 727 | sConfig.iInputCsp = m_iCspInternal; // I420 in default designed for presentation in encoder used internal | ||
| 728 | sConfig.DetermineTemporalSettings(); | 710 | sConfig.DetermineTemporalSettings(); |
| 729 | 711 | ||
| 730 | /* Check every field whether there is new request for memory block changed or else, Oct. 24, 2008 */ | 712 | /* Check every field whether there is new request for memory block changed or else, Oct. 24, 2008 */ |
| @@ -953,6 +935,11 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 222 unmodified lines | |||
| 953 | m_pEncContext->iDropNumber = pValue->iDropNum; | 935 | m_pEncContext->iDropNumber = pValue->iDropNum; |
| 954 | } | 936 | } |
| 955 | break; | 937 | break; |
| 938 | case ENCODER_OPTION_COMPLEXITY: { | ||
| 939 | int32_t iValue = * ((int32_t*)pOption); | ||
| 940 | m_pEncContext->pSvcParam->iComplexityMode = (ECOMPLEXITY_MODE)iValue; | ||
| 941 | } | ||
| 942 | break; | ||
| 956 | default: | 943 | default: |
| 957 | return cmInitParaError; | 944 | return cmInitParaError; |
| 958 | } | 945 | } |
| @@ -1055,6 +1042,10 @@ int CWelsH264SVCEncoder::GetOption (ENCODER_OPTION eOptionId, void* pOption) { · 96 unmodified lines | |||
| 1055 | } | 1042 | } |
| 1056 | } | 1043 | } |
| 1057 | break; | 1044 | break; |
| 1045 | case ENCODER_OPTION_COMPLEXITY: { | ||
| 1046 | * ((int32_t*)pOption) = m_pEncContext->pSvcParam->iComplexityMode; | ||
| 1047 | } | ||
| 1048 | break; | ||
| 1058 | default: | 1049 | default: |
| 1059 | return cmInitParaError; | 1050 | return cmInitParaError; |
| 1060 | } | 1051 | } |