Merge pull request #666 from ruil2/enc_scc_1

modify the initialization of the number of LTR
This commit is contained in:
Licai Guo 2014-04-11 15:40:49 +08:00
commit b86da1b9d1
4 changed files with 15 additions and 12 deletions

View File

@ -363,16 +363,15 @@ int32_t ParamTranscode (const SEncParamExt& pCodingParam) {
uiIntraPeriod = ((uiIntraPeriod + uiGopSize - 1) / uiGopSize) * uiGopSize;
if (iUsageType == SCREEN_CONTENT_REAL_TIME) {
bEnableLongTermReference &= (pCodingParam.iLTRRefNum > 0);
if (bEnableLongTermReference) {
iLTRRefNum = pCodingParam.iLTRRefNum;
iNumRefFrame = 1 + WELS_LOG2 (uiGopSize) + iLTRRefNum;
} else {
iLTRRefNum = 0;
iNumRefFrame = 1;
}
iLTRRefNum = WELS_CLIP3(pCodingParam.iLTRRefNum,1,LONG_TERM_REF_NUM_SCREEN);
iNumRefFrame = WELS_MAX(1, WELS_LOG2 (uiGopSize)) + iLTRRefNum;
} else {
iLTRRefNum = 0;
iNumRefFrame = 1;
}
} else {
iLTRRefNum = bEnableLongTermReference ? LONG_TERM_REF_NUM : 0;
iLTRRefNum = bEnableLongTermReference ? WELS_CLIP3(pCodingParam.iLTRRefNum,1,LONG_TERM_REF_NUM) : 0;
iNumRefFrame = ((uiGopSize >> 1) > 1) ? ((uiGopSize >> 1) + iLTRRefNum) : (MIN_REF_PIC_COUNT + iLTRRefNum);
iNumRefFrame = WELS_CLIP3 (iNumRefFrame, MIN_REF_PIC_COUNT, MAX_REFERENCE_PICTURE_COUNT_NUM);
}

View File

@ -148,6 +148,7 @@
#define MAX_SHORT_REF_COUNT (MAX_GOP_SIZE>>1) // 16 in standard, maximal count number of short reference pictures
#define LONG_TERM_REF_NUM 2
#define LONG_TERM_REF_NUM_SCREEN 4
#define MAX_LONG_REF_COUNT 2 // 16 in standard, maximal count number of long reference pictures
#define MAX_REF_PIC_COUNT 16 // 32 in standard, maximal Short + Long reference pictures
#define MIN_REF_PIC_COUNT 1 // minimal count number of reference pictures, 1 short + 2 key reference based?

View File

@ -660,7 +660,10 @@ void WelsUpdateRefSyntax (sWelsEncCtx* pCtx, const int32_t iPOC, const int32_t u
pRefPicMark->bNoOutputOfPriorPicsFlag = false;
pRefPicMark->bLongTermRefFlag = pCtx->pSvcParam->bEnableLongTermReference;
} else {
pRefPicMark->bAdaptiveRefPicMarkingModeFlag = (pCtx->pSvcParam->bEnableLongTermReference
if(pCtx->pSvcParam->iUsageType == SCREEN_CONTENT_REAL_TIME)
pRefPicMark->bAdaptiveRefPicMarkingModeFlag = pCtx->pSvcParam->bEnableLongTermReference;
else
pRefPicMark->bAdaptiveRefPicMarkingModeFlag = (pCtx->pSvcParam->bEnableLongTermReference
&& pLtr->bLTRMarkingFlag) ? (true) : (false);
}
}

View File

@ -354,14 +354,14 @@ int CWelsH264SVCEncoder::InitializeInternal(SWelsSvcCodingParam* pCfg) {
}
if (pCfg->iUsageType == SCREEN_CONTENT_REAL_TIME) {
if (pCfg->bEnableLongTermReference) {
pCfg->iLTRRefNum = LONG_TERM_REF_NUM;
pCfg->iNumRefFrame = 1 + WELS_LOG2 (pCfg->uiGopSize) + pCfg->iLTRRefNum;
pCfg->iLTRRefNum = WELS_CLIP3(pCfg->iLTRRefNum,1,LONG_TERM_REF_NUM_SCREEN);;
pCfg->iNumRefFrame = WELS_MAX(1,WELS_LOG2 (pCfg->uiGopSize)) + pCfg->iLTRRefNum;
} else {
pCfg->iLTRRefNum = 0;
pCfg->iNumRefFrame = 1;
}
} else {
pCfg->iLTRRefNum = pCfg->bEnableLongTermReference ? LONG_TERM_REF_NUM : 0;
pCfg->iLTRRefNum = pCfg->bEnableLongTermReference ? WELS_CLIP3(pCfg->iLTRRefNum,1,LONG_TERM_REF_NUM) : 0;
pCfg->iNumRefFrame = ((pCfg->uiGopSize >> 1) > 1) ? ((pCfg->uiGopSize >> 1) + pCfg->iLTRRefNum) :
pCfg->iNumRefFrame = WELS_CLIP3 (pCfg->iNumRefFrame, MIN_REF_PIC_COUNT, MAX_REFERENCE_PICTURE_COUNT_NUM);
}