ref: 32d6193f97851b115ec620854948226df950ca55
parent: 065c3a776922dadda280e7ef88d339f3d57d8fcc
author: Sijia Chen <[email protected]>
date: Thu Dec 11 05:58:27 EST 2014
fix idr_id: idr_id should be adding regardless of the sps strategy
--- a/codec/encoder/core/inc/encoder_context.h
+++ b/codec/encoder/core/inc/encoder_context.h
@@ -202,6 +202,7 @@
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
--- a/codec/encoder/core/inc/wels_common_basis.h
+++ b/codec/encoder/core/inc/wels_common_basis.h
@@ -82,8 +82,7 @@
//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
--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -3126,7 +3126,7 @@
pLayerBsInfo->pNalLengthInByte = pCtx->pOut->pNalLen;
if (eFrameType == videoFrameTypeIDR) {
- ++ pCtx->sPSOVector.uiIdrPicId;
+ ++ pCtx->uiIdrPicId;
//if ( pSvcParam->bEnableSSEI )
// write parameter sets bitstream here
@@ -3816,7 +3816,7 @@
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;
@@ -3834,7 +3834,8 @@
//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 {
--- a/codec/encoder/core/src/ref_list_mgr_svc.cpp
+++ b/codec/encoder/core/src/ref_list_mgr_svc.cpp
@@ -498,7 +498,7 @@
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 @@
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 @@
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);
}
}
}
--- a/codec/encoder/core/src/svc_encode_slice.cpp
+++ b/codec/encoder/core/src/svc_encode_slice.cpp
@@ -97,7 +97,7 @@
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
--- a/test/api/encode_decode_api_test.cpp
+++ b/test/api/encode_decode_api_test.cpp
@@ -561,7 +561,7 @@
EncodeOneFrame (0);
if (info.eFrameType == videoFrameTypeIDR) {
- iEncCurIdrPicId = (iSpsPpsIdAddition == 0) ? 0 : (iEncCurIdrPicId + 1);
+ iEncCurIdrPicId = iEncCurIdrPicId + 1;
}
//decoding after each encoding frame
int len = 0;
@@ -2317,9 +2317,9 @@
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 {