fix idr_id: idr_id should be adding regardless of the sps strategy
This commit is contained in:
@@ -202,6 +202,7 @@ typedef struct TagWelsEncCtx {
|
|||||||
SSpatialPicIndex sSpatialIndexMap[MAX_DEPENDENCY_LAYER];
|
SSpatialPicIndex sSpatialIndexMap[MAX_DEPENDENCY_LAYER];
|
||||||
|
|
||||||
bool bLongTermRefFlag[MAX_DEPENDENCY_LAYER][MAX_TEMPORAL_LEVEL + 1/*+LONG_TERM_REF_NUM*/];
|
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 iMaxSliceCount;// maximal count number of slices for all layers observation
|
||||||
int16_t iActiveThreadsNum; // number of threads active so far
|
int16_t iActiveThreadsNum; // number of threads active so far
|
||||||
|
|||||||
@@ -82,8 +82,7 @@ typedef struct TagParaSetOffset {
|
|||||||
//in PSO design, "bPpsIdMappingIntoSubsetsps" uses the current para of current IDR period
|
//in PSO design, "bPpsIdMappingIntoSubsetsps" uses the current para of current IDR period
|
||||||
bool
|
bool
|
||||||
bPpsIdMappingIntoSubsetsps[MAX_DQ_LAYER_NUM/*+1*/]; // need not extra +1 due no MGS and FMO case so far
|
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
|
#if _DEBUG
|
||||||
bool bEnableSpsPpsIdAddition;
|
bool bEnableSpsPpsIdAddition;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -3126,7 +3126,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour
|
|||||||
pLayerBsInfo->pNalLengthInByte = pCtx->pOut->pNalLen;
|
pLayerBsInfo->pNalLengthInByte = pCtx->pOut->pNalLen;
|
||||||
|
|
||||||
if (eFrameType == videoFrameTypeIDR) {
|
if (eFrameType == videoFrameTypeIDR) {
|
||||||
++ pCtx->sPSOVector.uiIdrPicId;
|
++ pCtx->uiIdrPicId;
|
||||||
//if ( pSvcParam->bEnableSSEI )
|
//if ( pSvcParam->bEnableSSEI )
|
||||||
|
|
||||||
// write parameter sets bitstream here
|
// write parameter sets bitstream here
|
||||||
@@ -3816,7 +3816,7 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa
|
|||||||
memset (((*ppCtx)->sPSOVector.sParaSetOffsetVariable[k].bUsedParaSetIdInBs), 0, MAX_PPS_COUNT * sizeof (bool));
|
memset (((*ppCtx)->sPSOVector.sParaSetOffsetVariable[k].bUsedParaSetIdInBs), 0, MAX_PPS_COUNT * sizeof (bool));
|
||||||
memcpy (sTmpPsoVariable, (*ppCtx)->sPSOVector.sParaSetOffsetVariable,
|
memcpy (sTmpPsoVariable, (*ppCtx)->sPSOVector.sParaSetOffsetVariable,
|
||||||
(PARA_SET_TYPE)*sizeof (SParaSetOffsetVariable)); // confirmed_safe_unsafe_usage
|
(PARA_SET_TYPE)*sizeof (SParaSetOffsetVariable)); // confirmed_safe_unsafe_usage
|
||||||
uiTmpIdrPicId = (*ppCtx)->sPSOVector.uiIdrPicId;
|
uiTmpIdrPicId = (*ppCtx)->uiIdrPicId;
|
||||||
|
|
||||||
SEncoderStatistics sTempEncoderStatistics = (*ppCtx)->sEncoderStatistics;
|
SEncoderStatistics sTempEncoderStatistics = (*ppCtx)->sEncoderStatistics;
|
||||||
|
|
||||||
@@ -3834,7 +3834,8 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa
|
|||||||
//for FLEXIBLE_PARASET_ID
|
//for FLEXIBLE_PARASET_ID
|
||||||
memcpy ((*ppCtx)->sPSOVector.sParaSetOffsetVariable, sTmpPsoVariable,
|
memcpy ((*ppCtx)->sPSOVector.sParaSetOffsetVariable, sTmpPsoVariable,
|
||||||
(PARA_SET_TYPE)*sizeof (SParaSetOffsetVariable)); // confirmed_safe_unsafe_usage
|
(PARA_SET_TYPE)*sizeof (SParaSetOffsetVariable)); // confirmed_safe_unsafe_usage
|
||||||
(*ppCtx)->sPSOVector.uiIdrPicId = uiTmpIdrPicId;
|
//for LTR
|
||||||
|
(*ppCtx)->uiIdrPicId = uiTmpIdrPicId;
|
||||||
//for sEncoderStatistics
|
//for sEncoderStatistics
|
||||||
(*ppCtx)->sEncoderStatistics = sTempEncoderStatistics;
|
(*ppCtx)->sEncoderStatistics = sTempEncoderStatistics;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -498,7 +498,7 @@ int32_t FilterLTRRecoveryRequest (sWelsEncCtx* pCtx, SLTRRecoverRequest* pLTRRec
|
|||||||
SLTRState* pLtr = &pCtx->pLtr[pCtx->uiDependencyId];
|
SLTRState* pLtr = &pCtx->pLtr[pCtx->uiDependencyId];
|
||||||
int32_t iMaxFrameNumPlus1 = (1 << pCtx->pSps->uiLog2MaxFrameNum);
|
int32_t iMaxFrameNumPlus1 = (1 << pCtx->pSps->uiLog2MaxFrameNum);
|
||||||
if (pCtx->pSvcParam->bEnableLongTermReference) {
|
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) {
|
if (pRequest->iLastCorrectFrameNum == -1) {
|
||||||
pCtx->bEncCurFrmAsIdrFlag = true;
|
pCtx->bEncCurFrmAsIdrFlag = true;
|
||||||
return true;
|
return true;
|
||||||
@@ -533,7 +533,7 @@ void FilterLTRMarkingFeedback (sWelsEncCtx* pCtx, SLTRMarkingFeedback* pLTRMarki
|
|||||||
SLTRState* pLtr = &pCtx->pLtr[pCtx->uiDependencyId];
|
SLTRState* pLtr = &pCtx->pLtr[pCtx->uiDependencyId];
|
||||||
assert (pLTRMarkingFeedback);
|
assert (pLTRMarkingFeedback);
|
||||||
if (pCtx->pSvcParam->bEnableLongTermReference) {
|
if (pCtx->pSvcParam->bEnableLongTermReference) {
|
||||||
if (pLTRMarkingFeedback->uiIDRPicId == pCtx->sPSOVector.uiIdrPicId
|
if (pLTRMarkingFeedback->uiIDRPicId == pCtx->uiIdrPicId
|
||||||
&& (pLTRMarkingFeedback->uiFeedbackType == LTR_MARKING_SUCCESS
|
&& (pLTRMarkingFeedback->uiFeedbackType == LTR_MARKING_SUCCESS
|
||||||
|| pLTRMarkingFeedback->uiFeedbackType == LTR_MARKING_FAILED)) { // avoid error pData
|
|| pLTRMarkingFeedback->uiFeedbackType == LTR_MARKING_FAILED)) { // avoid error pData
|
||||||
pLtr->uiLtrMarkState = pLTRMarkingFeedback->uiFeedbackType;
|
pLtr->uiLtrMarkState = pLTRMarkingFeedback->uiFeedbackType;
|
||||||
@@ -541,13 +541,13 @@ void FilterLTRMarkingFeedback (sWelsEncCtx* pCtx, SLTRMarkingFeedback* pLTRMarki
|
|||||||
WelsLog (& (pCtx->sLogCtx), WELS_LOG_INFO,
|
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",
|
"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 ,
|
pLTRMarkingFeedback->uiFeedbackType, pLTRMarkingFeedback->uiIDRPicId, pLTRMarkingFeedback->iLTRFrameNum ,
|
||||||
pCtx->sPSOVector.uiIdrPicId);
|
pCtx->uiIdrPicId);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
WelsLog (& (pCtx->sLogCtx), WELS_LOG_INFO,
|
WelsLog (& (pCtx->sLogCtx), WELS_LOG_INFO,
|
||||||
"Receive LTR marking feedback, feedback_type = %d , uiIdrPicId = %d , LTR_frame_num = %d , cur_idr_pic_id = %d",
|
"Receive LTR marking feedback, feedback_type = %d , uiIdrPicId = %d , LTR_frame_num = %d , cur_idr_pic_id = %d",
|
||||||
pLTRMarkingFeedback->uiFeedbackType, pLTRMarkingFeedback->uiIDRPicId, pLTRMarkingFeedback->iLTRFrameNum ,
|
pLTRMarkingFeedback->uiFeedbackType, pLTRMarkingFeedback->uiIDRPicId, pLTRMarkingFeedback->iLTRFrameNum ,
|
||||||
pCtx->sPSOVector.uiIdrPicId);
|
pCtx->uiIdrPicId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ void WelsSliceHeaderExtInit (sWelsEncCtx* pEncCtx, SDqLayer* pCurLayer, SSlice*
|
|||||||
pCurSliceHeader->iFirstMbInSlice = WelsGetFirstMbOfSlice (pCurLayer->pSliceEncCtx, pSlice->uiSliceIdx);
|
pCurSliceHeader->iFirstMbInSlice = WelsGetFirstMbOfSlice (pCurLayer->pSliceEncCtx, pSlice->uiSliceIdx);
|
||||||
|
|
||||||
pCurSliceHeader->iFrameNum = pEncCtx->iFrameNum;
|
pCurSliceHeader->iFrameNum = pEncCtx->iFrameNum;
|
||||||
pCurSliceHeader->uiIdrPicId = pEncCtx->sPSOVector.uiIdrPicId; //??
|
pCurSliceHeader->uiIdrPicId = pEncCtx->uiIdrPicId;
|
||||||
|
|
||||||
pCurSliceHeader->iPicOrderCntLsb = pEncCtx->pEncPic->iFramePoc; // 0
|
pCurSliceHeader->iPicOrderCntLsb = pEncCtx->pEncPic->iFramePoc; // 0
|
||||||
|
|
||||||
|
|||||||
@@ -561,7 +561,7 @@ TEST_P (EncodeDecodeTestAPI, GetOptionIDR) {
|
|||||||
EncodeOneFrame (0);
|
EncodeOneFrame (0);
|
||||||
|
|
||||||
if (info.eFrameType == videoFrameTypeIDR) {
|
if (info.eFrameType == videoFrameTypeIDR) {
|
||||||
iEncCurIdrPicId = (iSpsPpsIdAddition == 0) ? 0 : (iEncCurIdrPicId + 1);
|
iEncCurIdrPicId = iEncCurIdrPicId + 1;
|
||||||
}
|
}
|
||||||
//decoding after each encoding frame
|
//decoding after each encoding frame
|
||||||
int len = 0;
|
int len = 0;
|
||||||
@@ -2317,9 +2317,9 @@ const uint32_t kiFrameRate = 12; //DO NOT CHANGE!
|
|||||||
const uint32_t kiFrameNum = 100; //DO NOT CHANGE!
|
const uint32_t kiFrameNum = 100; //DO NOT CHANGE!
|
||||||
const uint32_t kiMaxBsSize = 10000000; //DO NOT CHANGE!
|
const uint32_t kiMaxBsSize = 10000000; //DO NOT CHANGE!
|
||||||
const char* pHashStr[] = { //DO NOT CHANGE!
|
const char* pHashStr[] = { //DO NOT CHANGE!
|
||||||
"c58322f886a3ba958c6f60b46b98f67b5d860866",
|
"be28b28101023f92b0c994fc63531890d28307d0",
|
||||||
"f2799e1e5f6e33c6274f4e1f6273c721475492d0",
|
"3be320b5af1164cb88519b214e4698f11b3e4eb1",
|
||||||
"8f0fafeaa2746e04d42fb17104efb61c9dbd1a6f"
|
"4ed8aa9a107119ff7b1a8821dc757ccc343ffd0b"
|
||||||
};
|
};
|
||||||
|
|
||||||
class DecodeParseAPI : public EncodeDecodeTestBase {
|
class DecodeParseAPI : public EncodeDecodeTestBase {
|
||||||
|
|||||||
Reference in New Issue
Block a user