History

improve the para checking of max-br

Sijia Chen committed 11 years ago

Commit ee40ba61 parent 8bef6bc1 file · +9 −8Browse files

Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 1 file). Show all

Unified · Split

codec/encoder/core/src/encoder_ext.cpp+9−8
@@ -76,11 +76,6 @@ int32_t WelsBitRateVerification (SLogContext* pLogCtx, SSpatialLayerConfig* pLay · 75 unmodified lines
7676 pLayerParam->iSpatialBitrate);
7777 return ENC_RETURN_UNSUPPORTED_PARA;
7878 }
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− }
8479 int32_t iLevelMaxBitrate = g_ksLevelLimits[pLayerParam->uiLevelIdc - 1].uiMaxBR * CpbBrNalFactor;
8580 if (pLayerParam->iMaxSpatialBitrate == UNSPECIFIED_BIT_RATE) {
8681 pLayerParam->iMaxSpatialBitrate = iLevelMaxBitrate;
@@ -90,15 +85,21 @@ int32_t WelsBitRateVerification (SLogContext* pLogCtx, SSpatialLayerConfig* pLay · 3 unmodified lines
9085 if (pLayerParam->iMaxSpatialBitrate > iLevelMaxBitrate) {
9186 ELevelIdc iCurLevel = pLayerParam->uiLevelIdc;
9287 if (WelsAdjustLevel (pLayerParam)) {
88+ int32_t iLevel52MaxBitrate = g_ksLevelLimits[LEVEL_NUMBER - 1].uiMaxBR * CpbBrNalFactor;
9389 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;
9693 }
9794 WelsLog (pLogCtx, WELS_LOG_INFO,
9895 "Level is changed from (%d) to (%d) according to the maxbitrate",
9996 iCurLevel, pLayerParam->uiLevelIdc);
10097 }
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) {
102103 WelsLog (pLogCtx, WELS_LOG_ERROR,
103104 "MaxSpatialBitrate (%d) should be larger than SpatialBitrate (%d), considering it as error setting",
104105 pLayerParam->iMaxSpatialBitrate, pLayerParam->iSpatialBitrate);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t