Merge pull request #1614 from sijchen/fix_idr_id1

[Encoder] fix idr_id: idr_id should be adding regardless of the sps strategy
This commit is contained in:
ruil2 2014-12-11 16:41:59 +08:00
commit ec99819ce8
6 changed files with 15 additions and 14 deletions

View File

@ -202,6 +202,7 @@ typedef struct TagWelsEncCtx {
SSpatialPicIndex sSpatialIndexMap[MAX_DEPENDENCY_LAYER];
bool bLongTermRefFlag[MAX_DEPENDENCY_LAYER][MAX_TEMPORAL_LEVEL + 1/*+LONG_TERM_REF_NUM*/];
uint16_t uiIdrPicId; // IDR picture id: [0, 65535], this one is used for LTR
int16_t iMaxSliceCount;// maximal count number of slices for all layers observation
int16_t iActiveThreadsNum; // number of threads active so far

View File

@ -82,8 +82,7 @@ typedef struct TagParaSetOffset {
//in PSO design, "bPpsIdMappingIntoSubsetsps" uses the current para of current IDR period
bool
bPpsIdMappingIntoSubsetsps[MAX_DQ_LAYER_NUM/*+1*/]; // need not extra +1 due no MGS and FMO case so far
uint16_t
uiIdrPicId; // IDR picture id: [0, 65535], this one is used for LTR!! Can we just NOT put this into the SParaSetOffset structure?!!
#if _DEBUG
bool bEnableSpsPpsIdAddition;
#endif

View File

@ -3140,7 +3140,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour
pLayerBsInfo->pNalLengthInByte = pCtx->pOut->pNalLen;
if (eFrameType == videoFrameTypeIDR) {
++ pCtx->sPSOVector.uiIdrPicId;
++ pCtx->uiIdrPicId;
//if ( pSvcParam->bEnableSSEI )
// write parameter sets bitstream here
@ -3830,7 +3830,7 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa
memset (((*ppCtx)->sPSOVector.sParaSetOffsetVariable[k].bUsedParaSetIdInBs), 0, MAX_PPS_COUNT * sizeof (bool));
memcpy (sTmpPsoVariable, (*ppCtx)->sPSOVector.sParaSetOffsetVariable,
(PARA_SET_TYPE)*sizeof (SParaSetOffsetVariable)); // confirmed_safe_unsafe_usage
uiTmpIdrPicId = (*ppCtx)->sPSOVector.uiIdrPicId;
uiTmpIdrPicId = (*ppCtx)->uiIdrPicId;
SEncoderStatistics sTempEncoderStatistics = (*ppCtx)->sEncoderStatistics;
@ -3848,7 +3848,8 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa
//for FLEXIBLE_PARASET_ID
memcpy ((*ppCtx)->sPSOVector.sParaSetOffsetVariable, sTmpPsoVariable,
(PARA_SET_TYPE)*sizeof (SParaSetOffsetVariable)); // confirmed_safe_unsafe_usage
(*ppCtx)->sPSOVector.uiIdrPicId = uiTmpIdrPicId;
//for LTR
(*ppCtx)->uiIdrPicId = uiTmpIdrPicId;
//for sEncoderStatistics
(*ppCtx)->sEncoderStatistics = sTempEncoderStatistics;
} else {

View File

@ -498,7 +498,7 @@ int32_t FilterLTRRecoveryRequest (sWelsEncCtx* pCtx, SLTRRecoverRequest* pLTRRec
SLTRState* pLtr = &pCtx->pLtr[pCtx->uiDependencyId];
int32_t iMaxFrameNumPlus1 = (1 << pCtx->pSps->uiLog2MaxFrameNum);
if (pCtx->pSvcParam->bEnableLongTermReference) {
if (pRequest->uiFeedbackType == LTR_RECOVERY_REQUEST && pRequest->uiIDRPicId == pCtx->sPSOVector.uiIdrPicId) {
if (pRequest->uiFeedbackType == LTR_RECOVERY_REQUEST && pRequest->uiIDRPicId == pCtx->uiIdrPicId) {
if (pRequest->iLastCorrectFrameNum == -1) {
pCtx->bEncCurFrmAsIdrFlag = true;
return true;
@ -533,7 +533,7 @@ void FilterLTRMarkingFeedback (sWelsEncCtx* pCtx, SLTRMarkingFeedback* pLTRMarki
SLTRState* pLtr = &pCtx->pLtr[pCtx->uiDependencyId];
assert (pLTRMarkingFeedback);
if (pCtx->pSvcParam->bEnableLongTermReference) {
if (pLTRMarkingFeedback->uiIDRPicId == pCtx->sPSOVector.uiIdrPicId
if (pLTRMarkingFeedback->uiIDRPicId == pCtx->uiIdrPicId
&& (pLTRMarkingFeedback->uiFeedbackType == LTR_MARKING_SUCCESS
|| pLTRMarkingFeedback->uiFeedbackType == LTR_MARKING_FAILED)) { // avoid error pData
pLtr->uiLtrMarkState = pLTRMarkingFeedback->uiFeedbackType;
@ -541,13 +541,13 @@ void FilterLTRMarkingFeedback (sWelsEncCtx* pCtx, SLTRMarkingFeedback* pLTRMarki
WelsLog (& (pCtx->sLogCtx), WELS_LOG_INFO,
"Receive valid LTR marking feedback, feedback_type = %d , uiIdrPicId = %d , LTR_frame_num = %d , cur_idr_pic_id = %d",
pLTRMarkingFeedback->uiFeedbackType, pLTRMarkingFeedback->uiIDRPicId, pLTRMarkingFeedback->iLTRFrameNum ,
pCtx->sPSOVector.uiIdrPicId);
pCtx->uiIdrPicId);
} else {
WelsLog (& (pCtx->sLogCtx), WELS_LOG_INFO,
"Receive LTR marking feedback, feedback_type = %d , uiIdrPicId = %d , LTR_frame_num = %d , cur_idr_pic_id = %d",
pLTRMarkingFeedback->uiFeedbackType, pLTRMarkingFeedback->uiIDRPicId, pLTRMarkingFeedback->iLTRFrameNum ,
pCtx->sPSOVector.uiIdrPicId);
pCtx->uiIdrPicId);
}
}
}

View File

@ -97,7 +97,7 @@ void WelsSliceHeaderExtInit (sWelsEncCtx* pEncCtx, SDqLayer* pCurLayer, SSlice*
pCurSliceHeader->iFirstMbInSlice = WelsGetFirstMbOfSlice (pCurLayer->pSliceEncCtx, pSlice->uiSliceIdx);
pCurSliceHeader->iFrameNum = pEncCtx->iFrameNum;
pCurSliceHeader->uiIdrPicId = pEncCtx->sPSOVector.uiIdrPicId; //??
pCurSliceHeader->uiIdrPicId = pEncCtx->uiIdrPicId;
pCurSliceHeader->iPicOrderCntLsb = pEncCtx->pEncPic->iFramePoc; // 0

View File

@ -561,7 +561,7 @@ TEST_P (EncodeDecodeTestAPI, GetOptionIDR) {
EncodeOneFrame (0);
if (info.eFrameType == videoFrameTypeIDR) {
iEncCurIdrPicId = (iSpsPpsIdAddition == 0) ? 0 : (iEncCurIdrPicId + 1);
iEncCurIdrPicId = iEncCurIdrPicId + 1;
}
//decoding after each encoding frame
int len = 0;
@ -2321,9 +2321,9 @@ const uint32_t kiFrameRate = 12; //DO NOT CHANGE!
const uint32_t kiFrameNum = 100; //DO NOT CHANGE!
const uint32_t kiMaxBsSize = 10000000; //DO NOT CHANGE!
const char* pHashStr[] = { //DO NOT CHANGE!
"c58322f886a3ba958c6f60b46b98f67b5d860866",
"f2799e1e5f6e33c6274f4e1f6273c721475492d0",
"8f0fafeaa2746e04d42fb17104efb61c9dbd1a6f"
"be28b28101023f92b0c994fc63531890d28307d0",
"3be320b5af1164cb88519b214e4698f11b3e4eb1",
"4ed8aa9a107119ff7b1a8821dc757ccc343ffd0b"
};
class DecodeParseAPI : public EncodeDecodeTestBase {