ref: ec09d67a5fd82c7c2e391a7490f6271dc5570c96
parent: b0f95c47c9df38613cedd5ea00a117fb8af20339
author: xiaotiansf <xiaotianshimail@gmail.com>
date: Wed Oct 30 06:10:33 EDT 2019
add support for NAL with duplicated MBs in threaded decoding mode.
--- a/codec/decoder/core/inc/picture.h
+++ b/codec/decoder/core/inc/picture.h
@@ -95,6 +95,7 @@
int32_t iMbEcedPropNum;
int32_t iMbNum;
+ bool* pMbCorrectlyDecodedFlag;
uint32_t* pMbType; // mb type used for direct mode
int16_t (*pMv[LIST_A])[MB_BLOCK4x4_NUM][MV_A]; // used for direct mode
int8_t (*pRefIndex[LIST_A])[MB_BLOCK4x4_NUM]; //used for direct mode
--- a/codec/decoder/core/src/decode_slice.cpp
+++ b/codec/decoder/core/src/decode_slice.cpp
@@ -1736,8 +1736,9 @@
if (!pCurDqLayer->pMbCorrectlyDecodedFlag[iNextMbXyIndex]) { //already con-ed, overwrite
pCurDqLayer->pMbCorrectlyDecodedFlag[iNextMbXyIndex] = true;
pCtx->pDec->iMbEcedPropNum += (pCurDqLayer->pMbRefConcealedFlag[iNextMbXyIndex] ? 1 : 0);
+ ++pCtx->iTotalNumMbRec;
}
- ++pCtx->iTotalNumMbRec;
+
if (pCtx->iTotalNumMbRec > iTotalMbTargetLayer) {
WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING,
"WelsTargetSliceConstruction():::pCtx->iTotalNumMbRec:%d, iTotalMbTargetLayer:%d",
--- a/codec/decoder/core/src/decoder_core.cpp
+++ b/codec/decoder/core/src/decoder_core.cpp
@@ -2606,6 +2606,7 @@
pCtx->pDec->uiDecodingTimeStamp = pCtx->uiDecodingTimeStamp;
if (pThreadCtx != NULL) {
pThreadCtx->iPicBuffIdx = pCtx->pDec->iPicBuffIdx;
+ pCtx->pCurDqLayer->pMbCorrectlyDecodedFlag = pCtx->pDec->pMbCorrectlyDecodedFlag;
}
if (pCtx->iTotalNumMbRec == 0) { //Picture start to decode
--- a/codec/decoder/core/src/pic_queue.cpp
+++ b/codec/decoder/core/src/pic_queue.cpp
@@ -111,8 +111,8 @@
uint32_t uiMbWidth = (kiPicWidth + 15) >> 4;
uint32_t uiMbHeight = (kiPicHeight + 15) >> 4;
uint32_t uiMbCount = uiMbWidth * uiMbHeight;
- pPic->pMbType = (uint32_t*)pMa->WelsMallocz (uiMbCount * sizeof (uint32_t),
- "pPic->pMbType");
+ pPic->pMbCorrectlyDecodedFlag = (bool*)pMa->WelsMallocz (uiMbCount * sizeof (bool), "pPic->pMbCorrectlyDecodedFlag");
+ pPic->pMbType = (uint32_t*)pMa->WelsMallocz (uiMbCount * sizeof (uint32_t), "pPic->pMbType");
pPic->pMv[LIST_0] = (int16_t (*)[16][2])pMa->WelsMallocz (uiMbCount * sizeof (
int16_t) * MV_A * MB_BLOCK4x4_NUM, "pPic->pMv[]");
pPic->pMv[LIST_1] = (int16_t (*)[16][2])pMa->WelsMallocz (uiMbCount * sizeof (
@@ -138,6 +138,11 @@
if (pPic->pBuffer[0]) {
pMa->WelsFree (pPic->pBuffer[0], "pPic->pBuffer[0]");
pPic->pBuffer[0] = NULL;
+ }
+
+ if (pPic->pMbCorrectlyDecodedFlag) {
+ pMa->WelsFree (pPic->pMbCorrectlyDecodedFlag, "pPic->pMbCorrectlyDecodedFlag");
+ pPic->pMbCorrectlyDecodedFlag = NULL;
}
if (pPic->pMbType) {