ref: c4586a2bed3c2305fab9715f288327aa213e47ff
parent: 613645fb407bb19b6357ad0f6b5755f1819b4358
parent: fdcecde1c7786b74426f32c4de4c9ab8b7667e5f
author: sijchen <[email protected]>
date: Tue Oct 10 06:17:58 EDT 2017
Merge pull request #2856 from ruil2/level fix frequent IDR issue when smaller level is set
--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -4238,20 +4238,7 @@
break;
}
- if (pOldParam->sSpatialLayers[iIndexD].uiProfileIdc !=
- pNewParam->sSpatialLayers[iIndexD].uiProfileIdc
- ||
- pOldParam->sSpatialLayers[iIndexD].uiLevelIdc !=
- pNewParam->sSpatialLayers[iIndexD].uiLevelIdc) {
- bNeedReset = true;
- WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_INFO,
- "WelsEncoderParamAdjust(),iIndexD = %d,uiProfileIdc(%d,%d),uiLevelIdc(%d,%d)", iIndexD,
- pOldParam->sSpatialLayers[iIndexD].uiProfileIdc, pNewParam->sSpatialLayers[iIndexD].uiProfileIdc,
- pOldParam->sSpatialLayers[iIndexD].uiLevelIdc, pNewParam->sSpatialLayers[iIndexD].uiLevelIdc);
- break;
- }
-
// check frame rate
// we can not check whether corresponding fFrameRate is equal or not,
// only need to check d_max/d_min and max_fr/d_max whether it is equal or not
@@ -4265,6 +4252,22 @@
"WelsEncoderParamAdjust() iIndexD = %d,fInputFrameRate(%f,%f),fOutputFrameRate(%f,%f),fMaxFrameRate(%f,%f)", iIndexD,
kpOldDlp->fInputFrameRate, kpNewDlp->fInputFrameRate, kpOldDlp->fOutputFrameRate, kpNewDlp->fOutputFrameRate,
pOldParam->fMaxFrameRate, pNewParam->fMaxFrameRate);
+ break;
+ }
+ if (pOldParam->sSpatialLayers[iIndexD].uiProfileIdc != pNewParam->sSpatialLayers[iIndexD].uiProfileIdc) {
+ bNeedReset = true;
+ WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_INFO,
+ "WelsEncoderParamAdjust(),iIndexD = %d,uiProfileIdc(%d,%d)", iIndexD,
+ pOldParam->sSpatialLayers[iIndexD].uiProfileIdc, pNewParam->sSpatialLayers[iIndexD].uiProfileIdc);
+ break;
+ }
+ //check level change,if new level is smaller than old level,don't reset encoder. still use old level.
+
+ if (pNewParam->sSpatialLayers[iIndexD].uiLevelIdc > pOldParam->sSpatialLayers[iIndexD].uiLevelIdc) {
+ bNeedReset = true;
+ WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_INFO,
+ "WelsEncoderParamAdjust(),iIndexD = %d,uiLevelIdc(%d,%d)", iIndexD,
+ pOldParam->sSpatialLayers[iIndexD].uiLevelIdc, pNewParam->sSpatialLayers[iIndexD].uiLevelIdc);
break;
}
++ iIndexD;