diff --git a/codec/encoder/core/inc/param_svc.h b/codec/encoder/core/inc/param_svc.h index e7124b13..50051fe2 100644 --- a/codec/encoder/core/inc/param_svc.h +++ b/codec/encoder/core/inc/param_svc.h @@ -369,8 +369,9 @@ int32_t ParamTranscode (const SEncParamExt& pCodingParam) { iNumRefFrame = WELS_MAX(1, WELS_LOG2 (uiGopSize)) + iLTRRefNum; } else { iLTRRefNum = 0; + if( iNumRefFrame == AUTO_REF_PIC_COUNT) - iNumRefFrame = 1; + iNumRefFrame = WELS_MAX(1, uiGopSize>>1); } } else { iLTRRefNum = bEnableLongTermReference ? WELS_CLIP3(pCodingParam.iLTRRefNum,1,LONG_TERM_REF_NUM) : 0; diff --git a/codec/encoder/core/src/encoder.cpp b/codec/encoder/core/src/encoder.cpp index 8a10f53a..abbbcaf1 100644 --- a/codec/encoder/core/src/encoder.cpp +++ b/codec/encoder/core/src/encoder.cpp @@ -292,7 +292,6 @@ EVideoFrameType DecideFrameType (sWelsEncCtx* pEncCtx, const int8_t kiSpatialNum } else { bSceneChangeFlag = pEncCtx->pVaa->bSceneChangeFlag; } - pEncCtx->bCurFrameMarkedAsSceneLtr = false; if (pEncCtx->pVaa->bIdrPeriodFlag || pEncCtx->bEncCurFrmAsIdrFlag || (!pSvcParam->bEnableLongTermReference && bSceneChangeFlag)) { iFrameType = videoFrameTypeIDR; diff --git a/codec/encoder/core/src/encoder_ext.cpp b/codec/encoder/core/src/encoder_ext.cpp index fb469698..7c9cf2e5 100644 --- a/codec/encoder/core/src/encoder_ext.cpp +++ b/codec/encoder/core/src/encoder_ext.cpp @@ -2867,6 +2867,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour #endif//_DEBUG pCtx->iEncoderError = ENC_RETURN_SUCCESS; + pCtx->bCurFrameMarkedAsSceneLtr = false; pFbi->iLayerNum = 0; // for initialization pFbi->uiTimeStamp = pSrcPic->uiTimeStamp; // perform csc/denoise/downsample/padding, generate spatial layers diff --git a/codec/encoder/plus/src/welsEncoderExt.cpp b/codec/encoder/plus/src/welsEncoderExt.cpp index 958863e5..38d7239e 100644 --- a/codec/encoder/plus/src/welsEncoderExt.cpp +++ b/codec/encoder/plus/src/welsEncoderExt.cpp @@ -350,7 +350,7 @@ int CWelsH264SVCEncoder::InitializeInternal(SWelsSvcCodingParam* pCfg) { pCfg->iNumRefFrame = WELS_MAX(1,WELS_LOG2 (pCfg->uiGopSize)) + pCfg->iLTRRefNum; } else { pCfg->iLTRRefNum = 0; - pCfg->iNumRefFrame = 1; + pCfg->iNumRefFrame = WELS_MAX(1, pCfg->uiGopSize>>1); } } else { pCfg->iLTRRefNum = pCfg->bEnableLongTermReference ? WELS_CLIP3(pCfg->iLTRRefNum,1,LONG_TERM_REF_NUM) : 0;