Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 3 files). Show all
Unified · Split
| @@ -494,6 +494,20 @@ void WelsEncoderApplyBitRate (SLogContext* pLogCtx, SWelsSvcCodingParam* pParam, · 493 unmodified lines | ||
| 494 | 494 | pLayerParam = & (pParam->sSpatialLayers[i]); |
| 495 | 495 | fRatio = pLayerParam->iSpatialBitrate / (static_cast<float> (iOrigTotalBitrate)); |
| 496 | 496 | pLayerParam->iSpatialBitrate = static_cast<int32_t> (pParam->iTargetBitrate * fRatio); |
| 497 | + if ( UNSPECIFIED_BIT_RATE != pLayerParam->iMaxSpatialBitrate && pLayerParam->iSpatialBitrate > pLayerParam->iMaxSpatialBitrate ) { | |
| 498 | + WelsLog (pLogCtx, WELS_LOG_WARNING, | |
| 499 | + "WelsEncoderApplyBitRate(), iSpatialBitrate(%d) > iMaxSpatialBitrate(%d) at Layer %d, limiting iSpatialBitrate to iMaxSpatialBitrate!", | |
| 500 | + pLayerParam->iSpatialBitrate, pLayerParam->iMaxSpatialBitrate, iLayer); | |
| 501 | + pLayerParam->iSpatialBitrate = pLayerParam->iMaxSpatialBitrate; | |
| 502 | + } | |
| 503 | + } | |
| 504 | + } else { | |
| 505 | + SSpatialLayerConfig* pLayerParam = & (pParam->sSpatialLayers[iLayer]); | |
| 506 | + if ( UNSPECIFIED_BIT_RATE != pLayerParam->iMaxSpatialBitrate && pLayerParam->iSpatialBitrate > pLayerParam->iMaxSpatialBitrate ) { | |
| 507 | + WelsLog (pLogCtx, WELS_LOG_WARNING, | |
| 508 | + "WelsEncoderApplyBitRate(), iSpatialBitrate(%d) > iMaxSpatialBitrate(%d) at Layer %d, limiting iSpatialBitrate to iMaxSpatialBitrate!", | |
| 509 | + pLayerParam->iSpatialBitrate, pLayerParam->iMaxSpatialBitrate, iLayer); | |
| 510 | + pLayerParam->iSpatialBitrate = pLayerParam->iMaxSpatialBitrate; | |
| 497 | 511 | } |
| 498 | 512 | } |
| 499 | 513 | } |
| @@ -3005,7 +3019,7 @@ bool CheckFrameSkipBasedMaxbr (sWelsEncCtx* pCtx, int32_t iSpatialNum, EVideoFra · 2505 unmodified lines | ||
| 3005 | 3019 | if (pCtx->pSvcParam->bEnableFrameSkip) { |
| 3006 | 3020 | if ((RC_QUALITY_MODE == pCtx->pSvcParam->iRCMode) || (RC_BITRATE_MODE == pCtx->pSvcParam->iRCMode)) { |
| 3007 | 3021 | for (int32_t i = 0; i < iSpatialNum; i++) { |
| 3008 | − if (0 == pCtx->pSvcParam->sSpatialLayers[i].iMaxSpatialBitrate) { | |
| 3022 | + if (UNSPECIFIED_BIT_RATE == pCtx->pSvcParam->sSpatialLayers[i].iMaxSpatialBitrate) { | |
| 3009 | 3023 | break; |
| 3010 | 3024 | } |
| 3011 | 3025 | pCtx->uiDependencyId = (uint8_t) (pSpatialIndexMap + i)->iDid; |