Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix regression in PR#3707 for multi-thread decoding #3734

Merged
merged 2 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions codec/decoder/core/inc/decoder_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@ typedef struct TagWelsDecoderContext {
#endif
bool bNewSeqBegin;
bool bNextNewSeqBegin;
int32_t *pStreamSeqNum;
int32_t iSeqNum;

//for Parse only
Expand Down
10 changes: 8 additions & 2 deletions codec/decoder/core/src/decoder_core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2261,9 +2261,15 @@ int32_t WelsDecodeInitAccessUnitStart (PWelsDecoderContext pCtx, SBufferInfo* pD
pCtx->bAuReadyFlag = false;
pCtx->pLastDecPicInfo->bLastHasMmco5 = false;
bool bTmpNewSeqBegin = CheckNewSeqBeginAndUpdateActiveLayerSps (pCtx);
if (bTmpNewSeqBegin)
pCtx->iSeqNum++;
if (bTmpNewSeqBegin) {
if (pCtx->pStreamSeqNum)
(*pCtx->pStreamSeqNum)++;
else
pCtx->iSeqNum++;
}
pCtx->bNewSeqBegin = pCtx->bNewSeqBegin || bTmpNewSeqBegin;
if (pCtx->pStreamSeqNum)
pCtx->iSeqNum = *pCtx->pStreamSeqNum;
iErr = WelsDecodeAccessUnitStart (pCtx);
GetVclNalTemporalId (pCtx);

Expand Down
1 change: 1 addition & 0 deletions codec/decoder/plus/inc/welsDecoderExt.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ class CWelsDecoder : public ISVCDecoder {
SVlcTable m_sVlcTable;
SWelsLastDecPicInfo m_sLastDecPicInfo;
SDecoderStatistics m_sDecoderStatistics;// For real time debugging
int32_t m_iStreamSeqNum;

private:
int32_t InitDecoder (const SDecodingParam* pParam);
Expand Down
22 changes: 3 additions & 19 deletions codec/decoder/plus/src/welsDecoderExt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ CWelsDecoder::CWelsDecoder (void)
m_DecCtxActiveCount (0),
m_pDecThrCtx (NULL),
m_pLastDecThrCtx (NULL),
m_iLastBufferedIdx (0) {
m_iLastBufferedIdx (0),
m_iStreamSeqNum (0) {
#ifdef OUTPUT_BIT_STREAM
char chFileName[1024] = { 0 }; //for .264
int iBufUsed = 0;
Expand Down Expand Up @@ -417,6 +418,7 @@ int32_t CWelsDecoder::InitDecoderCtx (PWelsDecoderContext& pCtx, const SDecoding
pCtx->pPictInfoList = m_sPictInfoList;
pCtx->pPictReoderingStatus = &m_sReoderingStatus;
pCtx->pCsDecoder = &m_csDecoder;
pCtx->pStreamSeqNum = &m_iStreamSeqNum;
WelsDecoderDefaults (pCtx, &m_pWelsTrace->m_sLogCtx);
WelsDecoderSpsPpsDefaults (pCtx->sSpsPpsCtx);
//check param and update decoder context
Expand Down Expand Up @@ -1137,24 +1139,6 @@ DECODING_STATE CWelsDecoder::ReorderPicturesInDisplay(PWelsDecoderContext pDecCo
m_bIsBaseline = pDecContext->pSps->uiProfileIdc == 66 || pDecContext->pSps->uiProfileIdc == 83;
if (!m_bIsBaseline) {
if (pDstInfo->iBufferStatus == 1) {
if (pDecContext->pSliceHeader->eSliceType == B_SLICE &&
((pDecContext->iSeqNum == m_sReoderingStatus.iLastWrittenSeqNum) ?
(pDecContext->pSliceHeader->iPicOrderCntLsb <= m_sReoderingStatus.iLastWrittenPOC + 2) :
(pDecContext->iSeqNum - m_sReoderingStatus.iLastWrittenSeqNum == 1 && pDecContext->pSliceHeader->iPicOrderCntLsb == 0))) {
m_sReoderingStatus.iLastWrittenPOC = pDecContext->pSliceHeader->iPicOrderCntLsb;
m_sReoderingStatus.iLastWrittenSeqNum = pDecContext->iSeqNum;
//issue #3478, use b-slice type to determine correct picture order as the first priority as POC order is not as reliable as based on b-slice
ppDst[0] = pDstInfo->pDst[0];
ppDst[1] = pDstInfo->pDst[1];
ppDst[2] = pDstInfo->pDst[2];
#if defined (_DEBUG)
#ifdef _MOTION_VECTOR_DUMP_
fprintf (stderr, "Output POC: #%d uiDecodingTimeStamp=%d\n", pDecContext->pSliceHeader->iPicOrderCntLsb,
pDecContext->uiDecodingTimeStamp);
#endif
#endif
return iRet;
}
BufferingReadyPicture(pDecContext, ppDst, pDstInfo);
if (!m_sReoderingStatus.bHasBSlice && m_sReoderingStatus.iNumOfPicts > 1) {
ReleaseBufferedReadyPictureNoReorder (pDecContext, ppDst, pDstInfo);
Expand Down
Loading