From 9e4ab64c738171f4329a4c1a8c12890d783c5bf5 Mon Sep 17 00:00:00 2001 From: Licai Guo Date: Tue, 4 Mar 2014 19:23:15 -0800 Subject: [PATCH] move iTotalNumMbRec from refpic to ctx --- codec/decoder/core/inc/decoder_context.h | 1 + codec/decoder/core/inc/picture.h | 2 -- codec/decoder/core/src/decode_slice.cpp | 8 ++++---- codec/decoder/core/src/decoder_core.cpp | 14 +++++++------- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/codec/decoder/core/inc/decoder_context.h b/codec/decoder/core/inc/decoder_context.h index f6b4428e..14105c7a 100644 --- a/codec/decoder/core/inc/decoder_context.h +++ b/codec/decoder/core/inc/decoder_context.h @@ -271,6 +271,7 @@ typedef struct TagWelsDecoderContext { bool bSubspsAvailFlags[MAX_SPS_COUNT]; bool bPpsAvailFlags[MAX_PPS_COUNT]; bool bReferenceLostAtT0Flag; + int32_t iTotalNumMbRec; //record current number of decoded MB #ifdef LONG_TERM_REF bool bParamSetsLostFlag; //sps or pps do not exist or not correct diff --git a/codec/decoder/core/inc/picture.h b/codec/decoder/core/inc/picture.h index 69cbbd9e..ddd957a2 100644 --- a/codec/decoder/core/inc/picture.h +++ b/codec/decoder/core/inc/picture.h @@ -71,8 +71,6 @@ uint8_t uiQualityId; int32_t iFrameNum; // frame number //for ref pic management int32_t iLongTermFrameIdx; //id for long term ref pic -int32_t iTotalNumMbRec; //show how many MB constructed - int32_t iSpsId; //against mosaic caused by cross-IDR interval reference. int32_t iPpsId; } SPicture, *PPicture; // "Picture" declaration is comflict with Mac system diff --git a/codec/decoder/core/src/decode_slice.cpp b/codec/decoder/core/src/decode_slice.cpp index afcef8c0..a51daaf3 100644 --- a/codec/decoder/core/src/decode_slice.cpp +++ b/codec/decoder/core/src/decode_slice.cpp @@ -97,13 +97,13 @@ int32_t WelsTargetSliceConstruction (PWelsDecoderContext pCtx) { } ++iCountNumMb; - ++pCurLayer->pDec->iTotalNumMbRec; + ++pCtx->iTotalNumMbRec; if (iCountNumMb >= iTotalNumMb) { break; } - if (pCurLayer->pDec->iTotalNumMbRec > iTotalMbTargetLayer) { - WelsLog (pCtx, WELS_LOG_WARNING, "WelsTargetSliceConstruction():::fdec->iTotalNumMbRec:%d, iTotalMbTargetLayer:%d\n", - pCurLayer->pDec->iTotalNumMbRec, iTotalMbTargetLayer); + if (pCtx->iTotalNumMbRec > iTotalMbTargetLayer) { + WelsLog (pCtx, WELS_LOG_WARNING, "WelsTargetSliceConstruction():::pCtx->iTotalNumMbRec:%d, iTotalMbTargetLayer:%d\n", + pCtx->iTotalNumMbRec, iTotalMbTargetLayer); return -1; } diff --git a/codec/decoder/core/src/decoder_core.cpp b/codec/decoder/core/src/decoder_core.cpp index 97c7e298..f5d343eb 100644 --- a/codec/decoder/core/src/decoder_core.cpp +++ b/codec/decoder/core/src/decoder_core.cpp @@ -54,14 +54,14 @@ static inline int32_t DecodeFrameConstruction (PWelsDecoderContext pCtx, uint8_t const int32_t kiTotalNumMbInCurLayer = pCurDq->iMbWidth * pCurDq->iMbHeight; - if (pPic->iTotalNumMbRec != kiTotalNumMbInCurLayer) { + if (pCtx->iTotalNumMbRec != kiTotalNumMbInCurLayer) { WelsLog (pCtx, WELS_LOG_WARNING, "DecodeFrameConstruction():::iTotalNumMbRec:%d, total_num_mb_sps:%d, cur_layer_mb_width:%d, cur_layer_mb_height:%d \n", - pPic->iTotalNumMbRec, kiTotalNumMbInCurLayer, pCurDq->iMbWidth, pCurDq->iMbHeight); + pCtx->iTotalNumMbRec, kiTotalNumMbInCurLayer, pCurDq->iMbWidth, pCurDq->iMbHeight); return -1; } #ifdef NO_WAITING_AU - pPic->iTotalNumMbRec = 0; + pCtx->iTotalNumMbRec = 0; #endif if (I_SLICE == pCurDq->sLayerInfo.sSliceInLayer.eSliceType) { @@ -1738,16 +1738,16 @@ int32_t DecodeCurrentAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, int3 #ifdef NO_WAITING_AU //For fixing the nal lossing issue - if ((pCtx->pDec->iTotalNumMbRec != 0) && + if ((pCtx->iTotalNumMbRec != 0) && (CheckAccessUnitBoundaryExt (&pCtx->sLastNalHdrExt, &pNalCur->sNalHeaderExt, &pCtx->sLastSliceHeader, &pNalCur->sNalData.sVclNal.sSliceHeaderExt.sSliceHeader))) { - pCtx->pDec->iTotalNumMbRec = 0; + pCtx->iTotalNumMbRec = 0; } #else //initialize at the starting of AU. - pCtx->pDec->iTotalNumMbRec = 0; + pCtx->iTotalNumMbRec = 0; #endif - if (pCtx->pDec->iTotalNumMbRec == 0) { //Picture start to decode + if (pCtx->iTotalNumMbRec == 0) { //Picture start to decode for (int32_t i = 0; i < LAYER_NUM_EXCHANGEABLE; ++ i) memset (pCtx->sMb.pSliceIdc[i], 0xff, (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (int32_t))); }