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 | 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 | 296 | // Check valid parameters |
| 305 | 297 | const int32_t iNumOfLayers = pCfg->iSpatialLayerNum; |
| 306 | 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 | 372 | const int32_t kiDecStages = WELS_LOG2 (pCfg->uiGopSize); |
| 381 | − pCfg->iInputCsp = iColorspace; | |
| 382 | 373 | pCfg->iTemporalLayerNum = (int8_t) (1 + kiDecStages); |
| 383 | 374 | pCfg->iLoopFilterAlphaC0Offset = WELS_CLIP3 (pCfg->iLoopFilterAlphaC0Offset, -6, 6); |
| 384 | 375 | pCfg->iLoopFilterBetaOffset = WELS_CLIP3 (pCfg->iLoopFilterBetaOffset, -6, 6); |
| @@ -393,7 +384,6 @@ int CWelsH264SVCEncoder::InitializeInternal (SWelsSvcCodingParam* pCfg) { · 8 unmodified lines | ||
| 393 | 384 | return cmInitParaError; |
| 394 | 385 | } |
| 395 | 386 | |
| 396 | − m_iCspInternal = iColorspace; | |
| 397 | 387 | m_bInitialFlag = true; |
| 398 | 388 | |
| 399 | 389 | return cmResultSuccess; |
| @@ -645,16 +635,12 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 245 unmodified lines | ||
| 645 | 635 | case ENCODER_OPTION_SVC_ENCODE_PARAM_EXT: { // SVC Encoding Parameter |
| 646 | 636 | SEncParamExt sEncodingParam; |
| 647 | 637 | SWelsSvcCodingParam sConfig; |
| 648 | − int32_t iInputColorspace = 0; | |
| 649 | 638 | int32_t iTargetWidth = 0; |
| 650 | 639 | int32_t iTargetHeight = 0; |
| 651 | 640 | |
| 652 | 641 | memcpy (&sEncodingParam, pOption, sizeof (SEncParamExt)); // confirmed_safe_unsafe_usage |
| 653 | 642 | WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO, |
| 654 | − "ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, sEncodingParam.iInputCsp= 0x%x\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", | |
| 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", | |
| 658 | 644 | sEncodingParam.iPicWidth, |
| 659 | 645 | sEncodingParam.iPicHeight, |
| 660 | 646 | sEncodingParam.iTargetBitrate, |
| @@ -664,7 +650,6 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 3 unmodified lines | ||
| 664 | 650 | sEncodingParam.iTemporalLayerNum, |
| 665 | 651 | sEncodingParam.iSpatialLayerNum, |
| 666 | 652 | sEncodingParam.fMaxFrameRate, |
| 667 | − sEncodingParam.iInputCsp, | |
| 668 | 653 | sEncodingParam.uiIntraPeriod, |
| 669 | 654 | sEncodingParam.bEnableSpsPpsIdAddition, |
| 670 | 655 | sEncodingParam.bPrefixNalAddingCtrl, |
| @@ -702,7 +687,6 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 31 unmodified lines | ||
| 702 | 687 | return cmInitParaError; |
| 703 | 688 | } |
| 704 | 689 | |
| 705 | − iInputColorspace = sEncodingParam.iInputCsp; | |
| 706 | 690 | if (sConfig.ParamTranscode (sEncodingParam)) { |
| 707 | 691 | return cmInitParaError; |
| 708 | 692 | } |
| @@ -711,11 +695,10 @@ int CWelsH264SVCEncoder::SetOption (ENCODER_OPTION eOptionId, void* pOption) { · 2 unmodified lines | ||
| 711 | 695 | } |
| 712 | 696 | iTargetWidth = sConfig.iPicWidth; |
| 713 | 697 | iTargetHeight = sConfig.iPicHeight; |
| 714 | − if (m_iCspInternal != iInputColorspace || m_iMaxPicWidth != iTargetWidth | |
| 715 | − || m_iMaxPicHeight != iTargetHeight) { // for color space due to changed | |
| 698 | + if (m_iMaxPicWidth != iTargetWidth | |
| 699 | + || m_iMaxPicHeight != iTargetHeight) { | |
| 716 | 700 | m_iMaxPicWidth = iTargetWidth; |
| 717 | 701 | m_iMaxPicHeight = iTargetHeight; |
| 718 | − m_iCspInternal = iInputColorspace; | |
| 719 | 702 | } |
| 720 | 703 | #ifdef REC_FRAME_COUNT |
| 721 | 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 | 707 | #endif//REC_FRAME_COUNT |
| 725 | 708 | |
| 726 | 709 | /* New configuration available here */ |
| 727 | − sConfig.iInputCsp = m_iCspInternal; // I420 in default designed for presentation in encoder used internal | |
| 728 | 710 | sConfig.DetermineTemporalSettings(); |
| 729 | 711 | |
| 730 | 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 | 935 | m_pEncContext->iDropNumber = pValue->iDropNum; |
| 954 | 936 | } |
| 955 | 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 | 943 | default: |
| 957 | 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 | 1044 | break; |
| 1045 | + case ENCODER_OPTION_COMPLEXITY: { | |
| 1046 | + * ((int32_t*)pOption) = m_pEncContext->pSvcParam->iComplexityMode; | |
| 1047 | + } | |
| 1048 | + break; | |
| 1058 | 1049 | default: |
| 1059 | 1050 | return cmInitParaError; |
| 1060 | 1051 | } |