Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 1 file). Show all
Unified · Split
| @@ -76,11 +76,6 @@ int32_t WelsBitRateVerification (SLogContext* pLogCtx, SSpatialLayerConfig* pLay · 75 unmodified lines | ||
| 76 | 76 | pLayerParam->iSpatialBitrate); |
| 77 | 77 | return ENC_RETURN_UNSUPPORTED_PARA; |
| 78 | 78 | } |
| 79 | − if (pLayerParam->iMaxSpatialBitrate == pLayerParam->iSpatialBitrate) { | |
| 80 | − WelsLog (pLogCtx, WELS_LOG_INFO, | |
| 81 | − "Setting MaxSpatialBitrate (%d) the same at SpatialBitrate (%d) will make the actual bit rate lower than SpatialBitrate", | |
| 82 | − pLayerParam->iMaxSpatialBitrate, pLayerParam->iSpatialBitrate); | |
| 83 | − } | |
| 84 | 79 | int32_t iLevelMaxBitrate = g_ksLevelLimits[pLayerParam->uiLevelIdc - 1].uiMaxBR * CpbBrNalFactor; |
| 85 | 80 | if (pLayerParam->iMaxSpatialBitrate == UNSPECIFIED_BIT_RATE) { |
| 86 | 81 | pLayerParam->iMaxSpatialBitrate = iLevelMaxBitrate; |
| @@ -90,15 +85,21 @@ int32_t WelsBitRateVerification (SLogContext* pLogCtx, SSpatialLayerConfig* pLay · 3 unmodified lines | ||
| 90 | 85 | if (pLayerParam->iMaxSpatialBitrate > iLevelMaxBitrate) { |
| 91 | 86 | ELevelIdc iCurLevel = pLayerParam->uiLevelIdc; |
| 92 | 87 | if (WelsAdjustLevel (pLayerParam)) { |
| 88 | + int32_t iLevel52MaxBitrate = g_ksLevelLimits[LEVEL_NUMBER - 1].uiMaxBR * CpbBrNalFactor; | |
| 93 | 89 | WelsLog (pLogCtx, WELS_LOG_WARNING, |
| 94 | − "MaxSpatialBitrate (%d) is larger that the limitation LEVEL_5_2, the setting will be invalid", | |
| 95 | − pLayerParam->iMaxSpatialBitrate); | |
| 90 | + "MaxSpatialBitrate (%d) is larger that the limitation LEVEL_5_2, the setting will be invalid, and will use max-br (%d) of LEVEL_5_2", | |
| 91 | + pLayerParam->iMaxSpatialBitrate, iLevel52MaxBitrate); | |
| 92 | + pLayerParam->iMaxSpatialBitrate = iLevel52MaxBitrate; | |
| 96 | 93 | } |
| 97 | 94 | WelsLog (pLogCtx, WELS_LOG_INFO, |
| 98 | 95 | "Level is changed from (%d) to (%d) according to the maxbitrate", |
| 99 | 96 | iCurLevel, pLayerParam->uiLevelIdc); |
| 100 | 97 | } |
| 101 | − if (pLayerParam->iMaxSpatialBitrate < pLayerParam->iSpatialBitrate) { | |
| 98 | + if (pLayerParam->iMaxSpatialBitrate == pLayerParam->iSpatialBitrate) { | |
| 99 | + WelsLog (pLogCtx, WELS_LOG_INFO, | |
| 100 | + "Setting MaxSpatialBitrate (%d) the same at SpatialBitrate (%d) will make the actual bit rate lower than SpatialBitrate", | |
| 101 | + pLayerParam->iMaxSpatialBitrate, pLayerParam->iSpatialBitrate); | |
| 102 | + } else if (pLayerParam->iMaxSpatialBitrate < pLayerParam->iSpatialBitrate) { | |
| 102 | 103 | WelsLog (pLogCtx, WELS_LOG_ERROR, |
| 103 | 104 | "MaxSpatialBitrate (%d) should be larger than SpatialBitrate (%d), considering it as error setting", |
| 104 | 105 | pLayerParam->iMaxSpatialBitrate, pLayerParam->iSpatialBitrate); |