Merge pull request #416 from huili2/move_iTotalNumMbRec_to_pCtx

move iTotalNumMbRec from refpic to ctx
This commit is contained in:
Licai Guo 2014-03-05 17:12:43 +08:00
commit eb3dd8f0ae
4 changed files with 12 additions and 13 deletions

View File

@ -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

View File

@ -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

View File

@ -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;
}

View File

@ -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)));
}