ref: cb346fea5c3fd74673d8ecf1cf30bc0ec41cb122
parent: b578deff151554c1d5a3b270f085b15582921298
author: sijchen@cisco.com <sijchen@cisco.com>
date: Wed Mar 14 08:33:47 EDT 2018
fix wrong setting at encoder SetOption ENCODER_OPTION_IDR_INTERVAL
--- a/codec/encoder/core/src/encoder.cpp
+++ b/codec/encoder/core/src/encoder.cpp
@@ -387,6 +387,13 @@
//pEncCtx->bEncCurFrmAsIdrFlag: 1. first frame should be IDR; 2. idr pause; 3. idr request
iFrameType = (pEncCtx->pVaa->bIdrPeriodFlag || bSceneChangeFlag
|| pParamInternal->bEncCurFrmAsIdrFlag) ? videoFrameTypeIDR : videoFrameTypeP;
+ if ( videoFrameTypeIDR == iFrameType ) {
+ WelsLog (& (pEncCtx->sLogCtx), WELS_LOG_DEBUG,
+ "encoding videoFrameTypeIDR due to ( bIdrPeriodFlag %d, bSceneChangeFlag %d, bEncCurFrmAsIdrFlag %d )",
+ pEncCtx->pVaa->bIdrPeriodFlag,
+ bSceneChangeFlag,
+ pParamInternal->bEncCurFrmAsIdrFlag);
+ }
if (videoFrameTypeP == iFrameType && bSkipFrameFlag) { // for frame skip, 1/5/2010
iFrameType = videoFrameTypeSkip;
--- a/codec/encoder/core/src/wels_preprocess.cpp
+++ b/codec/encoder/core/src/wels_preprocess.cpp
@@ -366,9 +366,17 @@
iSrcWidth = pSvcParam->SUsedPicRect.iWidth;
iSrcHeight = pSvcParam->SUsedPicRect.iHeight;
- if (pSvcParam->uiIntraPeriod)
+ if (pSvcParam->uiIntraPeriod) {
pCtx->pVaa->bIdrPeriodFlag = (1 + pDlayerParamInternal->iFrameIndex >= (int32_t)pSvcParam->uiIntraPeriod) ? true :
false;
+ if (pCtx->pVaa->bIdrPeriodFlag) {
+ WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG,
+ "pSvcParam->uiIntraPeriod=%d, pCtx->pVaa->bIdrPeriodFlag=%d",
+ pSvcParam->uiIntraPeriod,
+ pCtx->pVaa->bIdrPeriodFlag);
+ }
+ }
+
pSrcPic = pScaledPicture->pScaledInputPicture ? pScaledPicture->pScaledInputPicture : GetCurrentOrigFrame (
iDependencyId);
--- a/codec/encoder/plus/src/welsEncoderExt.cpp
+++ b/codec/encoder/plus/src/welsEncoderExt.cpp
@@ -715,19 +715,22 @@
m_iCspInternal = iColorspace;
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
- "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_DATAFORMAT, m_iCspInternal= 0x%x", m_iCspInternal);
+ "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_DATAFORMAT, m_iCspInternal = 0x%x", m_iCspInternal);
}
break;
case ENCODER_OPTION_IDR_INTERVAL: { // IDR Interval
int32_t iValue = * ((int32_t*)pOption);
WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
- "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_IDR_INTERVAL iValue= %d", iValue);
- if (iValue < -1 || iValue == 0)
- iValue = 1;
+ "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_IDR_INTERVAL iValue = %d", iValue);
+ if (iValue <= -1 || iValue == 0) {
+ iValue = 0;
+ }
if (iValue == (int32_t)m_pEncContext->pSvcParam->uiIntraPeriod) {
return cmResultSuccess;
}
m_pEncContext->pSvcParam->uiIntraPeriod = (uint32_t)iValue;
+ WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
+ "CWelsH264SVCEncoder::SetOption():ENCODER_OPTION_IDR_INTERVAL uiIntraPeriod updated to %d", m_pEncContext->pSvcParam->uiIntraPeriod);
}
break;
case ENCODER_OPTION_SVC_ENCODE_PARAM_BASE: { // SVC Encoding Parameter