Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 1 file). Show all
Unified · Split
| @@ -92,9 +92,9 @@ int32_t ParamValidation (SLogContext* pLogCtx, SWelsSvcCodingParam* pCfg) { · 91 unmodified lines | ||
| 92 | 92 | return ENC_RETURN_UNSUPPORTED_PARA; |
| 93 | 93 | } |
| 94 | 94 | if (pCfg->bEnableAdaptiveQuant) { |
| 95 | − WelsLog (pLogCtx, WELS_LOG_WARNING, "ParamValidation(), AdaptiveQuant(%d) is not supported yet for screen content, auto turned off\n", | |
| 95 | + WelsLog (pLogCtx, WELS_LOG_WARNING, "ParamValidation(), AdaptiveQuant(%d) is not supported yet for screen content, auto turned off\n", | |
| 96 | 96 | pCfg->bEnableAdaptiveQuant); |
| 97 | − pCfg->bEnableAdaptiveQuant = false; | |
| 97 | + pCfg->bEnableAdaptiveQuant = false; | |
| 98 | 98 | } |
| 99 | 99 | } |
| 100 | 100 | if (pCfg->iSpatialLayerNum > 1) { |
| @@ -458,12 +458,6 @@ void WelsEncoderApplyBitRate (SLogContext* pLogCtx, SWelsSvcCodingParam* pParam, · 357 unmodified lines | ||
| 458 | 458 | const int32_t iNumLayers = pParam->iSpatialLayerNum; |
| 459 | 459 | int32_t i, iOrigTotalBitrate = 0; |
| 460 | 460 | if (iLayer == SPATIAL_LAYER_ALL) { |
| 461 | − if (pParam->iMaxBitrate < pParam->iTargetBitrate) { | |
| 462 | − WelsLog (pLogCtx, WELS_LOG_WARNING, | |
| 463 | − "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_BITRATE,overall settting,TargetBitrate = %d,iMaxBitrate = %d\n", | |
| 464 | − pParam->iTargetBitrate, pParam->iMaxBitrate); | |
| 465 | − pParam->iMaxBitrate = pParam->iTargetBitrate; | |
| 466 | − } | |
| 467 | 461 | //read old BR |
| 468 | 462 | for (i = 0; i < iNumLayers; i++) { |
| 469 | 463 | iOrigTotalBitrate += pParam->sSpatialLayers[i].iSpatialBitrate; |
| @@ -475,14 +469,6 @@ void WelsEncoderApplyBitRate (SLogContext* pLogCtx, SWelsSvcCodingParam* pParam, · 5 unmodified lines | ||
| 475 | 469 | fRatio = pLayerParam->iSpatialBitrate / (static_cast<float> (iOrigTotalBitrate)); |
| 476 | 470 | pLayerParam->iSpatialBitrate = static_cast<int32_t> (pParam->iTargetBitrate * fRatio); |
| 477 | 471 | } |
| 478 | − } else { | |
| 479 | − if (pParam->sSpatialLayers[iLayer].iMaxSpatialBitrate < pParam->sSpatialLayers[iLayer].iSpatialBitrate) { | |
| 480 | − WelsLog (pLogCtx, WELS_LOG_WARNING, | |
| 481 | − "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_BITRATE,iLayer = %d,iTargetBitrate = %d,iMaxBitrate = %d\n", | |
| 482 | − iLayer, pParam->sSpatialLayers[iLayer].iSpatialBitrate, pParam->sSpatialLayers[iLayer].iMaxSpatialBitrate); | |
| 483 | − pParam->sSpatialLayers[iLayer].iMaxSpatialBitrate = pParam->sSpatialLayers[iLayer].iSpatialBitrate; | |
| 484 | − } | |
| 485 | − | |
| 486 | 472 | } |
| 487 | 473 | } |
| 488 | 474 | /*! |
| @@ -2943,6 +2929,28 @@ int32_t GetSubSequenceId (sWelsEncCtx* pCtx, EVideoFrameType eFrameType) { · 2454 unmodified lines | ||
| 2943 | 2929 | iSubSeqId = 3 + MAX_TEMPORAL_LAYER_NUM; |
| 2944 | 2930 | return iSubSeqId; |
| 2945 | 2931 | } |
| 2932 | + | |
| 2933 | +//loop each layer to check if have skip frame when RC and frame skip enable (maxbr>0) | |
| 2934 | +bool CheckFrameSkipBasedMaxbr(sWelsEncCtx* pCtx, int32_t iSpatialNum) { | |
| 2935 | + SSpatialPicIndex* pSpatialIndexMap = &pCtx->sSpatialIndexMap[0]; | |
| 2936 | + bool bSkipMustFlag = false; | |
| 2937 | + | |
| 2938 | + if (RC_OFF_MODE != pCtx->pSvcParam->iRCMode && true == pCtx->pSvcParam->bEnableFrameSkip) { | |
| 2939 | + for (int32_t i = 0; i < iSpatialNum; i++) { | |
| 2940 | + if(0 == pCtx->pSvcParam->sSpatialLayers[i].iMaxSpatialBitrate) { | |
| 2941 | + break; | |
| 2942 | + } | |
| 2943 | + pCtx->uiDependencyId = (uint8_t) (pSpatialIndexMap + i)->iDid; | |
| 2944 | + pCtx->pFuncList->pfRc.pfWelsRcPicDelayJudge (pCtx); | |
| 2945 | + if (true == pCtx->pWelsSvcRc[pCtx->uiDependencyId].bSkipFlag) { | |
| 2946 | + bSkipMustFlag = true; | |
| 2947 | + break; | |
| 2948 | + } | |
| 2949 | + } | |
| 2950 | + } | |
| 2951 | + return bSkipMustFlag; | |
| 2952 | +} | |
| 2953 | + | |
| 2946 | 2954 | /*! |
| 2947 | 2955 | * \brief core svc encoding process |
| 2948 | 2956 | * |
| @@ -3003,22 +3011,11 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 54 unmodified lines | ||
| 3003 | 3011 | } |
| 3004 | 3012 | |
| 3005 | 3013 | //loop each layer to check if have skip frame when RC and frame skip enable |
| 3006 | − if (RC_OFF_MODE != pCtx->pSvcParam->iRCMode && true == pCtx->pSvcParam->bEnableFrameSkip) { | |
| 3007 | − bool bSkipMustFlag = false; | |
| 3008 | − for (int32_t i = 0; i < iSpatialNum; i++) { | |
| 3009 | − pCtx->uiDependencyId = (uint8_t) (pSpatialIndexMap + i)->iDid; | |
| 3010 | − pCtx->pFuncList->pfRc.pfWelsRcPicDelayJudge (pCtx); | |
| 3011 | − if (true == pCtx->pWelsSvcRc[pCtx->uiDependencyId].bSkipFlag) { | |
| 3012 | − bSkipMustFlag = true; | |
| 3013 | − } | |
| 3014 | − } | |
| 3015 | − if (true == bSkipMustFlag) { | |
| 3016 | − pFbi->eFrameType = videoFrameTypeSkip; | |
| 3017 | − return ENC_RETURN_SUCCESS; | |
| 3018 | − } | |
| 3014 | + if (CheckFrameSkipBasedMaxbr(pCtx, iSpatialNum)) { | |
| 3015 | + pFbi->eFrameType = videoFrameTypeSkip; | |
| 3016 | + return ENC_RETURN_SUCCESS; | |
| 3019 | 3017 | } |
| 3020 | 3018 | |
| 3021 | − | |
| 3022 | 3019 | InitFrameCoding (pCtx, eFrameType); |
| 3023 | 3020 | |
| 3024 | 3021 | iCurTid = GetTemporalLevel (&pSvcParam->sDependencyLayers[pSpatialIndexMap->iDid], pCtx->iCodingIndex, |