From 2508cf925f28e8222b51d58caef6148f7b6766da Mon Sep 17 00:00:00 2001 From: ruil2 Date: Tue, 29 Apr 2014 17:24:22 +0800 Subject: [PATCH] fix the issue that long term reference frame is disable for screen --- codec/encoder/core/inc/param_svc.h | 3 ++- codec/encoder/core/src/encoder.cpp | 1 - codec/encoder/core/src/encoder_ext.cpp | 1 + codec/encoder/plus/src/welsEncoderExt.cpp | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) 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;