Showing the changes to codec/decoder/core/src/decode_slice.cpp (1 of 11 files). Show all
Unified · Split
| @@ -70,7 +70,7 @@ int32_t WelsTargetSliceConstruction (PWelsDecoderContext pCtx) { · 69 unmodified lines | ||
| 70 | 70 | PDeblockingFilterMbFunc pDeblockMb; |
| 71 | 71 | |
| 72 | 72 | if (!pCtx->bAvcBasedFlag && iCurLayerWidth != pCtx->iCurSeqIntervalMaxPicWidth) { |
| 73 | − return -1; | |
| 73 | + return ERR_INFO_WIDTH_MISMATCH; | |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | iNextMbXyIndex = pSliceHeader->iFirstMbInSlice; |
| @@ -96,7 +96,7 @@ int32_t WelsTargetSliceConstruction (PWelsDecoderContext pCtx) { · 19 unmodified lines | ||
| 96 | 96 | "WelsTargetSliceConstruction():::MB(%d, %d) construction error. pCurSlice_type:%d", |
| 97 | 97 | pCurLayer->iMbX, pCurLayer->iMbY, pCurSlice->eSliceType); |
| 98 | 98 | |
| 99 | − return -1; | |
| 99 | + return ERR_INFO_MB_RECON_FAIL; | |
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | |
| @@ -112,7 +112,7 @@ int32_t WelsTargetSliceConstruction (PWelsDecoderContext pCtx) { · 9 unmodified lines | ||
| 112 | 112 | "WelsTargetSliceConstruction():::pCtx->iTotalNumMbRec:%d, iTotalMbTargetLayer:%d", |
| 113 | 113 | pCtx->iTotalNumMbRec, iTotalMbTargetLayer); |
| 114 | 114 | |
| 115 | − return -1; | |
| 115 | + return ERR_INFO_MB_NUM_EXCEED_FAIL; | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if (pSliceHeader->pPps->uiNumSliceGroups > 1) { |
| @@ -132,22 +132,22 @@ int32_t WelsTargetSliceConstruction (PWelsDecoderContext pCtx) { · 13 unmodified lines | ||
| 132 | 132 | pCtx->pDec->iHeightInPixel = iCurLayerHeight; |
| 133 | 133 | |
| 134 | 134 | if ((pCurSlice->eSliceType != I_SLICE) && (pCurSlice->eSliceType != P_SLICE)) |
| 135 | − return 0; | |
| 135 | + return ERR_NONE; //no error but just ignore the type unsupported | |
| 136 | 136 | |
| 137 | 137 | if (pCtx->pParam->bParseOnly) //for parse only, deblocking should not go on |
| 138 | − return 0; | |
| 138 | + return ERR_NONE; | |
| 139 | 139 | |
| 140 | 140 | pDeblockMb = WelsDeblockingMb; |
| 141 | 141 | |
| 142 | 142 | if (1 == pSliceHeader->uiDisableDeblockingFilterIdc |
| 143 | 143 | || pCtx->pCurDqLayer->sLayerInfo.sSliceInLayer.iTotalMbInCurSlice <= 0) { |
| 144 | − return 0;//NO_SUPPORTED_FILTER_IDX | |
| 144 | + return ERR_NONE;//NO_SUPPORTED_FILTER_IDX | |
| 145 | 145 | } else { |
| 146 | 146 | WelsDeblockingFilterSlice (pCtx, pDeblockMb); |
| 147 | 147 | } |
| 148 | 148 | // any other filter_idc not supported here, 7/22/2010 |
| 149 | 149 | |
| 150 | − return 0; | |
| 150 | + return ERR_NONE; | |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | int32_t WelsMbInterSampleConstruction (PWelsDecoderContext pCtx, PDqLayer pCurLayer, |
| @@ -191,7 +191,7 @@ int32_t WelsMbInterSampleConstruction (PWelsDecoderContext pCtx, PDqLayer pCurLa · 37 unmodified lines | ||
| 191 | 191 | } |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | − return 0; | |
| 194 | + return ERR_NONE; | |
| 195 | 195 | } |
| 196 | 196 | int32_t WelsMbInterConstruction (PWelsDecoderContext pCtx, PDqLayer pCurLayer) { |
| 197 | 197 | int32_t iMbX = pCurLayer->iMbX; |
| @@ -210,7 +210,7 @@ int32_t WelsMbInterConstruction (PWelsDecoderContext pCtx, PDqLayer pCurLayer) { · 12 unmodified lines | ||
| 210 | 210 | |
| 211 | 211 | pCtx->sBlockFunc.pWelsSetNonZeroCountFunc ( |
| 212 | 212 | pCurLayer->pNzc[pCurLayer->iMbXyIndex]); // set all none-zero nzc to 1; dbk can be opti! |
| 213 | − return 0; | |
| 213 | + return ERR_NONE; | |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | void WelsLumaDcDequantIdct (int16_t* pBlock, int32_t iQp, PWelsDecoderContext pCtx) { |
| @@ -265,7 +265,7 @@ int32_t WelsMbIntraPredictionConstruction (PWelsDecoderContext pCtx, PDqLayer pC · 48 unmodified lines | ||
| 265 | 265 | WelsLumaDcDequantIdct (pCurLayer->pScaledTCoeff[iMbXy], pCurLayer->pLumaQp[iMbXy], pCtx); |
| 266 | 266 | RecI16x16Mb (iMbXy, pCtx, pCurLayer->pScaledTCoeff[iMbXy], pCurLayer); |
| 267 | 267 | |
| 268 | − return 0; | |
| 268 | + return ERR_NONE; | |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | if (IS_INTRA8x8 (pCurLayer->pMbType[iMbXy])) { |
| @@ -275,7 +275,7 @@ int32_t WelsMbIntraPredictionConstruction (PWelsDecoderContext pCtx, PDqLayer pC · 3 unmodified lines | ||
| 275 | 275 | if (IS_INTRA4x4 (pCurLayer->pMbType[iMbXy])) |
| 276 | 276 | RecI4x4Mb (iMbXy, pCtx, pCurLayer->pScaledTCoeff[iMbXy], pCurLayer); |
| 277 | 277 | |
| 278 | − return 0; | |
| 278 | + return ERR_NONE; | |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | int32_t WelsMbInterPrediction (PWelsDecoderContext pCtx, PDqLayer pCurLayer) { |
| @@ -292,14 +292,14 @@ int32_t WelsMbInterPrediction (PWelsDecoderContext pCtx, PDqLayer pCurLayer) { · 10 unmodified lines | ||
| 292 | 292 | |
| 293 | 293 | GetInterPred (pDstY, pDstCb, pDstCr, pCtx); |
| 294 | 294 | |
| 295 | − return 0; | |
| 295 | + return ERR_NONE; | |
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | int32_t WelsTargetMbConstruction (PWelsDecoderContext pCtx) { |
| 299 | 299 | PDqLayer pCurLayer = pCtx->pCurDqLayer; |
| 300 | 300 | if (MB_TYPE_INTRA_PCM == pCurLayer->pMbType[pCurLayer->iMbXyIndex]) { |
| 301 | 301 | //already decoded and reconstructed when parsing |
| 302 | − return 0; | |
| 302 | + return ERR_NONE; | |
| 303 | 303 | } else if (IS_INTRA (pCurLayer->pMbType[pCurLayer->iMbXyIndex])) { |
| 304 | 304 | WelsMbIntraPredictionConstruction (pCtx, pCurLayer, 1); |
| 305 | 305 | } else if (IS_INTER (pCurLayer->pMbType[pCurLayer->iMbXyIndex])) { //InterMB |
| @@ -311,10 +311,10 @@ int32_t WelsTargetMbConstruction (PWelsDecoderContext pCtx) { · 5 unmodified lines | ||
| 311 | 311 | } else { |
| 312 | 312 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "WelsTargetMbConstruction():::::Unknown MB type: %d", |
| 313 | 313 | pCurLayer->pMbType[pCurLayer->iMbXyIndex]); |
| 314 | − return -1; | |
| 314 | + return ERR_INFO_MB_RECON_FAIL; | |
| 315 | 315 | } |
| 316 | 316 | |
| 317 | − return 0; | |
| 317 | + return ERR_NONE; | |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | void WelsChromaDcIdct (int16_t* pBlock) { |
| @@ -445,7 +445,7 @@ int32_t ParseIntra4x4Mode (PWelsDecoderContext pCtx, PWelsNeighAvail pNeighAvail · 124 unmodified lines | ||
| 445 | 445 | |
| 446 | 446 | iFinalMode = CheckIntraNxNPredMode (&iSampleAvail[0], &iBestMode, i, false); |
| 447 | 447 | if (iFinalMode == ERR_INVALID_INTRA4X4_MODE) { |
| 448 | − return ERR_INFO_INVALID_I4x4_PRED_MODE; | |
| 448 | + return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I4x4_PRED_MODE); | |
| 449 | 449 | } |
| 450 | 450 | |
| 451 | 451 | pCurDqLayer->pIntra4x4FinalMode[iMbXy][g_kuiScan4[i]] = iFinalMode; |
| @@ -465,20 +465,20 @@ int32_t ParseIntra4x4Mode (PWelsDecoderContext pCtx, PWelsNeighAvail pNeighAvail · 13 unmodified lines | ||
| 465 | 465 | if (pCurDqLayer->sLayerInfo.pPps->bEntropyCodingModeFlag) { |
| 466 | 466 | WELS_READ_VERIFY (ParseIntraPredModeChromaCabac (pCtx, uiNeighAvail, iCode)); |
| 467 | 467 | if (iCode > MAX_PRED_MODE_ID_CHROMA) { |
| 468 | − return ERR_INFO_INVALID_I_CHROMA_PRED_MODE; | |
| 468 | + return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I_CHROMA_PRED_MODE); | |
| 469 | 469 | } |
| 470 | 470 | pCurDqLayer->pChromaPredMode[iMbXy] = iCode; |
| 471 | 471 | } else { |
| 472 | 472 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //intra_chroma_pred_mode |
| 473 | 473 | if (uiCode > MAX_PRED_MODE_ID_CHROMA) { |
| 474 | − return ERR_INFO_INVALID_I_CHROMA_PRED_MODE; | |
| 474 | + return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I_CHROMA_PRED_MODE); | |
| 475 | 475 | } |
| 476 | 476 | pCurDqLayer->pChromaPredMode[iMbXy] = uiCode; |
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | if (-1 == pCurDqLayer->pChromaPredMode[iMbXy] |
| 480 | 480 | || CheckIntraChromaPredMode (uiNeighAvail, &pCurDqLayer->pChromaPredMode[iMbXy])) { |
| 481 | − return ERR_INFO_INVALID_I_CHROMA_PRED_MODE; | |
| 481 | + return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I_CHROMA_PRED_MODE); | |
| 482 | 482 | } |
| 483 | 483 | return ERR_NONE; |
| 484 | 484 | } |
| @@ -529,7 +529,7 @@ int32_t ParseIntra8x8Mode (PWelsDecoderContext pCtx, PWelsNeighAvail pNeighAvail · 44 unmodified lines | ||
| 529 | 529 | iFinalMode = CheckIntraNxNPredMode (&iSampleAvail[0], &iBestMode, i << 2, true); |
| 530 | 530 | |
| 531 | 531 | if (iFinalMode == ERR_INVALID_INTRA4X4_MODE) { |
| 532 | − return ERR_INFO_INVALID_I4x4_PRED_MODE; | |
| 532 | + return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I4x4_PRED_MODE); | |
| 533 | 533 | } |
| 534 | 534 | |
| 535 | 535 | for (int j = 0; j < 4; j++) { |
| @@ -545,20 +545,20 @@ int32_t ParseIntra8x8Mode (PWelsDecoderContext pCtx, PWelsNeighAvail pNeighAvail · 9 unmodified lines | ||
| 545 | 545 | if (pCurDqLayer->sLayerInfo.pPps->bEntropyCodingModeFlag) { |
| 546 | 546 | WELS_READ_VERIFY (ParseIntraPredModeChromaCabac (pCtx, uiNeighAvail, iCode)); |
| 547 | 547 | if (iCode > MAX_PRED_MODE_ID_CHROMA) { |
| 548 | − return ERR_INFO_INVALID_I_CHROMA_PRED_MODE; | |
| 548 | + return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I_CHROMA_PRED_MODE); | |
| 549 | 549 | } |
| 550 | 550 | pCurDqLayer->pChromaPredMode[iMbXy] = iCode; |
| 551 | 551 | } else { |
| 552 | 552 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //intra_chroma_pred_mode |
| 553 | 553 | if (uiCode > MAX_PRED_MODE_ID_CHROMA) { |
| 554 | − return ERR_INFO_INVALID_I_CHROMA_PRED_MODE; | |
| 554 | + return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I_CHROMA_PRED_MODE); | |
| 555 | 555 | } |
| 556 | 556 | pCurDqLayer->pChromaPredMode[iMbXy] = uiCode; |
| 557 | 557 | } |
| 558 | 558 | |
| 559 | 559 | if (-1 == pCurDqLayer->pChromaPredMode[iMbXy] |
| 560 | 560 | || CheckIntraChromaPredMode (uiNeighAvail, &pCurDqLayer->pChromaPredMode[iMbXy])) { |
| 561 | − return ERR_INFO_INVALID_I_CHROMA_PRED_MODE; | |
| 561 | + return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I_CHROMA_PRED_MODE); | |
| 562 | 562 | } |
| 563 | 563 | |
| 564 | 564 | return ERR_NONE; |
| @@ -574,7 +574,7 @@ int32_t ParseIntra16x16Mode (PWelsDecoderContext pCtx, PWelsNeighAvail pNeighAva · 9 unmodified lines | ||
| 574 | 574 | |
| 575 | 575 | if (CheckIntra16x16PredMode (uiNeighAvail, |
| 576 | 576 | &pCurDqLayer->pIntraPredMode[iMbXy][7])) { //invalid iPredMode, must stop decoding |
| 577 | − return ERR_INFO_INVALID_I16x16_PRED_MODE; | |
| 577 | + return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I16x16_PRED_MODE); | |
| 578 | 578 | } |
| 579 | 579 | if (pCtx->pSps->uiChromaFormatIdc == 0) |
| 580 | 580 | return ERR_NONE; |
| @@ -582,19 +582,19 @@ int32_t ParseIntra16x16Mode (PWelsDecoderContext pCtx, PWelsNeighAvail pNeighAva · 1 unmodified line | ||
| 582 | 582 | if (pCurDqLayer->sLayerInfo.pPps->bEntropyCodingModeFlag) { |
| 583 | 583 | WELS_READ_VERIFY (ParseIntraPredModeChromaCabac (pCtx, uiNeighAvail, iCode)); |
| 584 | 584 | if (iCode > MAX_PRED_MODE_ID_CHROMA) { |
| 585 | − return ERR_INFO_INVALID_I_CHROMA_PRED_MODE; | |
| 585 | + return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I_CHROMA_PRED_MODE); | |
| 586 | 586 | } |
| 587 | 587 | pCurDqLayer->pChromaPredMode[iMbXy] = iCode; |
| 588 | 588 | } else { |
| 589 | 589 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //intra_chroma_pred_mode |
| 590 | 590 | if (uiCode > MAX_PRED_MODE_ID_CHROMA) { |
| 591 | − return ERR_INFO_INVALID_I_CHROMA_PRED_MODE; | |
| 591 | + return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I_CHROMA_PRED_MODE); | |
| 592 | 592 | } |
| 593 | 593 | pCurDqLayer->pChromaPredMode[iMbXy] = uiCode; |
| 594 | 594 | } |
| 595 | 595 | if (-1 == pCurDqLayer->pChromaPredMode[iMbXy] |
| 596 | 596 | || CheckIntraChromaPredMode (uiNeighAvail, &pCurDqLayer->pChromaPredMode[iMbXy])) { |
| 597 | − return ERR_INFO_INVALID_I_CHROMA_PRED_MODE; | |
| 597 | + return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I_CHROMA_PRED_MODE); | |
| 598 | 598 | } |
| 599 | 599 | |
| 600 | 600 | return ERR_NONE; |
| @@ -622,10 +622,10 @@ int32_t WelsDecodeMbCabacISliceBaseMode0 (PWelsDecoderContext pCtx, uint32_t& ui · 21 unmodified lines | ||
| 622 | 622 | GetNeighborAvailMbType (&sNeighAvail, pCurLayer); |
| 623 | 623 | WELS_READ_VERIFY (ParseMBTypeISliceCabac (pCtx, &sNeighAvail, uiMbType)); |
| 624 | 624 | if (uiMbType > 25) { |
| 625 | − return ERR_INFO_INVALID_MB_TYPE; | |
| 625 | + return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_MB_TYPE); | |
| 626 | 626 | } else if (!pCtx->pSps->uiChromaFormatIdc && ((uiMbType >= 5 && uiMbType <= 12) || (uiMbType >= 17 |
| 627 | 627 | && uiMbType <= 24))) { |
| 628 | − return ERR_INFO_INVALID_MB_TYPE; | |
| 628 | + return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_MB_TYPE); | |
| 629 | 629 | } else if (25 == uiMbType) { //I_PCM |
| 630 | 630 | WELS_READ_VERIFY (ParseIPCMInfoCabac (pCtx)); |
| 631 | 631 | pSlice->iLastDeltaQp = 0; |
| @@ -688,7 +688,7 @@ int32_t WelsDecodeMbCabacISliceBaseMode0 (PWelsDecoderContext pCtx, uint32_t& ui · 56 unmodified lines | ||
| 688 | 688 | int32_t iQpDelta, iId8x8, iId4x4; |
| 689 | 689 | WELS_READ_VERIFY (ParseDeltaQpCabac (pCtx, iQpDelta)); |
| 690 | 690 | if (iQpDelta > 25 || iQpDelta < -26) {//out of iQpDelta range |
| 691 | − return ERR_INFO_INVALID_QP; | |
| 691 | + return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_QP); | |
| 692 | 692 | } |
| 693 | 693 | pCurLayer->pLumaQp[iMbXy] = (pSlice->iLastMbQp + iQpDelta + 52) % 52; //update last_mb_qp |
| 694 | 694 | pSlice->iLastMbQp = pCurLayer->pLumaQp[iMbXy]; |
| @@ -841,9 +841,9 @@ int32_t WelsDecodeMbCabacPSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 146 unmodified lines | ||
| 841 | 841 | } else { //Intra mode |
| 842 | 842 | uiMbType -= 5; |
| 843 | 843 | if (uiMbType > 25) |
| 844 | − return ERR_INFO_INVALID_MB_TYPE; | |
| 844 | + return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_MB_TYPE); | |
| 845 | 845 | if (!pCtx->pSps->uiChromaFormatIdc && ((uiMbType >= 5 && uiMbType <= 12) || (uiMbType >= 17 && uiMbType <= 24))) |
| 846 | − return ERR_INFO_INVALID_MB_TYPE; | |
| 846 | + return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_MB_TYPE); | |
| 847 | 847 | |
| 848 | 848 | if (25 == uiMbType) { //I_PCM |
| 849 | 849 | WELS_READ_VERIFY (ParseIPCMInfoCabac (pCtx)); |
| @@ -922,7 +922,7 @@ int32_t WelsDecodeMbCabacPSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 72 unmodified lines | ||
| 922 | 922 | |
| 923 | 923 | WELS_READ_VERIFY (ParseDeltaQpCabac (pCtx, iQpDelta)); |
| 924 | 924 | if (iQpDelta > 25 || iQpDelta < -26) { //out of iQpDelta range |
| 925 | − return ERR_INFO_INVALID_QP; | |
| 925 | + return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_QP); | |
| 926 | 926 | } |
| 927 | 927 | pCurLayer->pLumaQp[iMbXy] = (pSlice->iLastMbQp + iQpDelta + 52) % 52; //update last_mb_qp |
| 928 | 928 | pSlice->iLastMbQp = pCurLayer->pLumaQp[iMbXy]; |
| @@ -1276,6 +1276,7 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 347 unmodified lines | ||
| 1276 | 1276 | const int32_t iMbXy = pCurLayer->iMbXyIndex; |
| 1277 | 1277 | int8_t* pNzc = pCurLayer->pNzc[iMbXy]; |
| 1278 | 1278 | int32_t i; |
| 1279 | + int32_t iRet = ERR_NONE; | |
| 1279 | 1280 | uint32_t uiMbType = 0, uiCbp = 0, uiCbpL = 0, uiCbpC = 0; |
| 1280 | 1281 | uint32_t uiCode; |
| 1281 | 1282 | int32_t iCode; |
| @@ -1291,9 +1292,9 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 9 unmodified lines | ||
| 1291 | 1292 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //uiMbType |
| 1292 | 1293 | uiMbType = uiCode; |
| 1293 | 1294 | if (uiMbType > 25) |
| 1294 | − return ERR_INFO_INVALID_MB_TYPE; | |
| 1295 | + return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_MB_TYPE); | |
| 1295 | 1296 | if (!pCtx->pSps->uiChromaFormatIdc && ((uiMbType >= 5 && uiMbType <= 12) || (uiMbType >= 17 && uiMbType <= 24))) |
| 1296 | − return ERR_INFO_INVALID_MB_TYPE; | |
| 1297 | + return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_MB_TYPE); | |
| 1297 | 1298 | |
| 1298 | 1299 | if (25 == uiMbType) { |
| 1299 | 1300 | int32_t iDecStrideL = pCurLayer->pDec->iLinesize[0]; |
| @@ -1345,7 +1346,7 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 45 unmodified lines | ||
| 1345 | 1346 | memset (pCurLayer->pChromaQp[iMbXy], 0, sizeof (pCurLayer->pChromaQp[iMbXy])); |
| 1346 | 1347 | memset (pNzc, 16, sizeof (pCurLayer->pNzc[iMbXy])); //Rec. 9.2.1 for PCM, nzc=16 |
| 1347 | 1348 | WELS_READ_VERIFY (InitReadBits (pBs, 0)); |
| 1348 | − return 0; | |
| 1349 | + return ERR_NONE; | |
| 1349 | 1350 | } else if (0 == uiMbType) { //reference to JM |
| 1350 | 1351 | ENFORCE_STACK_ALIGN_1D (int8_t, pIntraPredMode, 48, 16); |
| 1351 | 1352 | pCurLayer->pMbType[iMbXy] = MB_TYPE_INTRA4x4; |
| @@ -1369,9 +1370,9 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 17 unmodified lines | ||
| 1369 | 1370 | uiCbp = uiCode; |
| 1370 | 1371 | //G.9.1 Alternative parsing process for coded pBlock pattern |
| 1371 | 1372 | if (pCtx->pSps->uiChromaFormatIdc && (uiCbp > 47)) |
| 1372 | − return ERR_INFO_INVALID_CBP; | |
| 1373 | + return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_CBP); | |
| 1373 | 1374 | if (!pCtx->pSps->uiChromaFormatIdc && (uiCbp > 15)) |
| 1374 | − return ERR_INFO_INVALID_CBP; | |
| 1375 | + return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_CBP); | |
| 1375 | 1376 | |
| 1376 | 1377 | if (pCtx->pSps->uiChromaFormatIdc) |
| 1377 | 1378 | uiCbp = g_kuiIntra4x4CbpTable[uiCbp]; |
| @@ -1416,7 +1417,7 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 38 unmodified lines | ||
| 1416 | 1417 | iQpDelta = iCode; |
| 1417 | 1418 | |
| 1418 | 1419 | if (iQpDelta > 25 || iQpDelta < -26) { //out of iQpDelta range |
| 1419 | − return ERR_INFO_INVALID_QP; | |
| 1420 | + return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_QP); | |
| 1420 | 1421 | } |
| 1421 | 1422 | |
| 1422 | 1423 | pCurLayer->pLumaQp[iMbXy] = (pSlice->iLastMbQp + iQpDelta + 52) % 52; //update last_mb_qp |
| @@ -1432,17 +1433,17 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 9 unmodified lines | ||
| 1432 | 1433 | |
| 1433 | 1434 | if (MB_TYPE_INTRA16x16 == pCurLayer->pMbType[iMbXy]) { |
| 1434 | 1435 | //step1: Luma DC |
| 1435 | − if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, 0, 16, | |
| 1436 | − g_kuiLumaDcZigzagScan, I16_LUMA_DC, pCurLayer->pScaledTCoeff[iMbXy], pCurLayer->pLumaQp[iMbXy], pCtx)) { | |
| 1437 | − return -1;//abnormal | |
| 1436 | + if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, 0, 16, g_kuiLumaDcZigzagScan, I16_LUMA_DC, | |
| 1437 | + pCurLayer->pScaledTCoeff[iMbXy], pCurLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) { | |
| 1438 | + return iRet;//abnormal | |
| 1438 | 1439 | } |
| 1439 | 1440 | //step2: Luma AC |
| 1440 | 1441 | if (uiCbpL) { |
| 1441 | 1442 | for (i = 0; i < 16; i++) { |
| 1442 | − if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, i, | |
| 1443 | − iScanIdxEnd - WELS_MAX (iScanIdxStart, 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1), | |
| 1444 | − I16_LUMA_AC, pCurLayer->pScaledTCoeff[iMbXy] + (i << 4), pCurLayer->pLumaQp[iMbXy], pCtx)) { | |
| 1445 | − return -1;//abnormal | |
| 1443 | + if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, i, iScanIdxEnd - WELS_MAX (iScanIdxStart, 1) + 1, | |
| 1444 | + g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1), I16_LUMA_AC, pCurLayer->pScaledTCoeff[iMbXy] + (i << 4), | |
| 1445 | + pCurLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) { | |
| 1446 | + return iRet;//abnormal | |
| 1446 | 1447 | } |
| 1447 | 1448 | } |
| 1448 | 1449 | ST32A4 (&pNzc[0], LD32 (&pNonZeroCount[1 + 8 * 1])); |
| @@ -1457,10 +1458,10 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 8 unmodified lines | ||
| 1457 | 1458 | if (uiCbpL & (1 << iId8x8)) { |
| 1458 | 1459 | int32_t iIndex = (iId8x8 << 2); |
| 1459 | 1460 | for (iId4x4 = 0; iId4x4 < 4; iId4x4++) { |
| 1460 | − if (WelsResidualBlockCavlc8x8 (pVlcTable, pNonZeroCount, pBs, iIndex, | |
| 1461 | − iScanIdxEnd - iScanIdxStart + 1, g_kuiZigzagScan8x8 + iScanIdxStart, iMbResProperty, | |
| 1462 | − pCurLayer->pScaledTCoeff[iMbXy] + (iId8x8 << 6), iId4x4, pCurLayer->pLumaQp[iMbXy], pCtx)) { | |
| 1463 | − return -1; | |
| 1461 | + if ((iRet = WelsResidualBlockCavlc8x8 (pVlcTable, pNonZeroCount, pBs, iIndex, iScanIdxEnd - iScanIdxStart + 1, | |
| 1462 | + g_kuiZigzagScan8x8 + iScanIdxStart, iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + (iId8x8 << 6), iId4x4, | |
| 1463 | + pCurLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) { | |
| 1464 | + return iRet; | |
| 1464 | 1465 | } |
| 1465 | 1466 | iIndex++; |
| 1466 | 1467 | } |
| @@ -1479,10 +1480,10 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 12 unmodified lines | ||
| 1479 | 1480 | int32_t iIndex = (iId8x8 << 2); |
| 1480 | 1481 | for (iId4x4 = 0; iId4x4 < 4; iId4x4++) { |
| 1481 | 1482 | //Luma (DC and AC decoding together) |
| 1482 | − if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex, | |
| 1483 | − iScanIdxEnd - iScanIdxStart + 1, g_kuiZigzagScan + iScanIdxStart, | |
| 1484 | − LUMA_DC_AC_INTRA, pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), pCurLayer->pLumaQp[iMbXy], pCtx)) { | |
| 1485 | − return -1;//abnormal | |
| 1483 | + if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex, iScanIdxEnd - iScanIdxStart + 1, | |
| 1484 | + g_kuiZigzagScan + iScanIdxStart, LUMA_DC_AC_INTRA, pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), | |
| 1485 | + pCurLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) { | |
| 1486 | + return iRet;//abnormal | |
| 1486 | 1487 | } |
| 1487 | 1488 | iIndex++; |
| 1488 | 1489 | } |
| @@ -1503,10 +1504,9 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 14 unmodified lines | ||
| 1503 | 1504 | if (1 == uiCbpC || 2 == uiCbpC) { |
| 1504 | 1505 | for (i = 0; i < 2; i++) { //Cb Cr |
| 1505 | 1506 | iMbResProperty = i ? CHROMA_DC_V : CHROMA_DC_U; |
| 1506 | − if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, | |
| 1507 | − 16 + (i << 2), 4, g_kuiChromaDcScan, iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + 256 + (i << 6), | |
| 1508 | − pCurLayer->pChromaQp[iMbXy][i], pCtx)) { | |
| 1509 | − return -1;//abnormal | |
| 1507 | + if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, 16 + (i << 2), 4, g_kuiChromaDcScan, iMbResProperty, | |
| 1508 | + pCurLayer->pScaledTCoeff[iMbXy] + 256 + (i << 6), pCurLayer->pChromaQp[iMbXy][i], pCtx)) != ERR_NONE) { | |
| 1509 | + return iRet;//abnormal | |
| 1510 | 1510 | } |
| 1511 | 1511 | } |
| 1512 | 1512 | } |
| @@ -1517,10 +1517,10 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 4 unmodified lines | ||
| 1517 | 1517 | iMbResProperty = i ? CHROMA_AC_V : CHROMA_AC_U; |
| 1518 | 1518 | int32_t iIndex = 16 + (i << 2); |
| 1519 | 1519 | for (iId4x4 = 0; iId4x4 < 4; iId4x4++) { |
| 1520 | − if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex, | |
| 1521 | − iScanIdxEnd - WELS_MAX (iScanIdxStart, 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1), | |
| 1522 | − iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), pCurLayer->pChromaQp[iMbXy][i], pCtx)) { | |
| 1523 | − return -1;//abnormal | |
| 1520 | + if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex, iScanIdxEnd - WELS_MAX (iScanIdxStart, | |
| 1521 | + 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1), iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), | |
| 1522 | + pCurLayer->pChromaQp[iMbXy][i], pCtx)) != ERR_NONE) { | |
| 1523 | + return iRet;//abnormal | |
| 1524 | 1524 | } |
| 1525 | 1525 | iIndex++; |
| 1526 | 1526 | } |
| @@ -1533,7 +1533,7 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 6 unmodified lines | ||
| 1533 | 1533 | BsEndCavlc (pBs); |
| 1534 | 1534 | } |
| 1535 | 1535 | |
| 1536 | − return 0; | |
| 1536 | + return ERR_NONE; | |
| 1537 | 1537 | } |
| 1538 | 1538 | |
| 1539 | 1539 | int32_t WelsDecodeMbCavlcISlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uint32_t& uiEosFlag) { |
| @@ -1572,9 +1572,9 @@ int32_t WelsDecodeMbCavlcISlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 32 unmodified lines | ||
| 1572 | 1572 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, |
| 1573 | 1573 | "WelsDecodeMbCavlcISlice()::::pBs incomplete, iUsedBits:%" PRId64 " > pBs->iBits:%d, MUST stop decoding.", |
| 1574 | 1574 | (int64_t) iUsedBits, pBs->iBits); |
| 1575 | − return -1; | |
| 1575 | + return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_BS_INCOMPLETE); | |
| 1576 | 1576 | } |
| 1577 | − return 0; | |
| 1577 | + return ERR_NONE; | |
| 1578 | 1578 | } |
| 1579 | 1579 | |
| 1580 | 1580 | int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { |
| @@ -1593,6 +1593,7 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 12 unmodified lines | ||
| 1593 | 1593 | const int32_t iMbXy = pCurLayer->iMbXyIndex; |
| 1594 | 1594 | int8_t* pNzc = pCurLayer->pNzc[iMbXy]; |
| 1595 | 1595 | int32_t i; |
| 1596 | + int32_t iRet = ERR_NONE; | |
| 1596 | 1597 | uint32_t uiMbType = 0, uiCbp = 0, uiCbpL = 0, uiCbpC = 0; |
| 1597 | 1598 | uint32_t uiCode; |
| 1598 | 1599 | int32_t iCode; |
| @@ -1609,8 +1610,8 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 10 unmodified lines | ||
| 1609 | 1610 | pCurLayer->pMbType[iMbXy] = g_ksInterMbTypeInfo[uiMbType].iType; |
| 1610 | 1611 | WelsFillCacheInter (&sNeighAvail, pNonZeroCount, iMotionVector, iRefIndex, pCurLayer); |
| 1611 | 1612 | |
| 1612 | − if (ParseInterInfo (pCtx, iMotionVector, iRefIndex, pBs)) { | |
| 1613 | − return -1;//abnormal | |
| 1613 | + if ((iRet = ParseInterInfo (pCtx, iMotionVector, iRefIndex, pBs)) != ERR_NONE) { | |
| 1614 | + return iRet;//abnormal | |
| 1614 | 1615 | } |
| 1615 | 1616 | |
| 1616 | 1617 | if (pSlice->sSliceHeaderExt.bAdaptiveResidualPredFlag == 1) { |
| @@ -1624,14 +1625,14 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 7 unmodified lines | ||
| 1624 | 1625 | pCurLayer->pInterPredictionDoneFlag[iMbXy] = 0; |
| 1625 | 1626 | } else { |
| 1626 | 1627 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "residual_pred_flag = 1 not supported."); |
| 1627 | − return -1; | |
| 1628 | + return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_UNSUPPORTED_ILP); | |
| 1628 | 1629 | } |
| 1629 | 1630 | } else { //intra MB type |
| 1630 | 1631 | uiMbType -= 5; |
| 1631 | 1632 | if (uiMbType > 25) |
| 1632 | − return ERR_INFO_INVALID_MB_TYPE; | |
| 1633 | + return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_MB_TYPE); | |
| 1633 | 1634 | if (!pCtx->pSps->uiChromaFormatIdc && ((uiMbType >= 5 && uiMbType <= 12) || (uiMbType >= 17 && uiMbType <= 24))) |
| 1634 | − return ERR_INFO_INVALID_MB_TYPE; | |
| 1635 | + return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_MB_TYPE); | |
| 1635 | 1636 | |
| 1636 | 1637 | if (25 == uiMbType) { |
| 1637 | 1638 | int32_t iDecStrideL = pCurLayer->pDec->iLinesize[0]; |
| @@ -1689,7 +1690,7 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 51 unmodified lines | ||
| 1689 | 1690 | ST32A4 (&pNzc[16], 0x10101010); |
| 1690 | 1691 | ST32A4 (&pNzc[20], 0x10101010); |
| 1691 | 1692 | WELS_READ_VERIFY (InitReadBits (pBs, 0)); |
| 1692 | − return 0; | |
| 1693 | + return ERR_NONE; | |
| 1693 | 1694 | } else { |
| 1694 | 1695 | if (0 == uiMbType) { |
| 1695 | 1696 | ENFORCE_STACK_ALIGN_1D (int8_t, pIntraPredMode, 48, 16); |
| @@ -1717,8 +1718,8 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 21 unmodified lines | ||
| 1717 | 1718 | uiCbpC = pCtx->pSps->uiChromaFormatIdc ? pCurLayer->pCbp[iMbXy] >> 4 : 0; |
| 1718 | 1719 | uiCbpL = pCurLayer->pCbp[iMbXy] & 15; |
| 1719 | 1720 | WelsFillCacheNonZeroCount (&sNeighAvail, pNonZeroCount, pCurLayer); |
| 1720 | − if (ParseIntra16x16Mode (pCtx, &sNeighAvail, pBs, pCurLayer)) { | |
| 1721 | − return -1; | |
| 1721 | + if ((iRet = ParseIntra16x16Mode (pCtx, &sNeighAvail, pBs, pCurLayer)) != ERR_NONE) { | |
| 1722 | + return iRet; | |
| 1722 | 1723 | } |
| 1723 | 1724 | } |
| 1724 | 1725 | } |
| @@ -1729,9 +1730,9 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 4 unmodified lines | ||
| 1729 | 1730 | uiCbp = uiCode; |
| 1730 | 1731 | { |
| 1731 | 1732 | if (pCtx->pSps->uiChromaFormatIdc && (uiCbp > 47)) |
| 1732 | − return ERR_INFO_INVALID_CBP; | |
| 1733 | + return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_CBP); | |
| 1733 | 1734 | if (!pCtx->pSps->uiChromaFormatIdc && (uiCbp > 15)) |
| 1734 | − return ERR_INFO_INVALID_CBP; | |
| 1735 | + return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_CBP); | |
| 1735 | 1736 | if (MB_TYPE_INTRA4x4 == pCurLayer->pMbType[iMbXy] || MB_TYPE_INTRA8x8 == pCurLayer->pMbType[iMbXy]) { |
| 1736 | 1737 | |
| 1737 | 1738 | uiCbp = pCtx->pSps->uiChromaFormatIdc ? g_kuiIntra4x4CbpTable[uiCbp] : g_kuiIntra4x4CbpTable400[uiCbp]; |
| @@ -1779,7 +1780,7 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 41 unmodified lines | ||
| 1779 | 1780 | iQpDelta = iCode; |
| 1780 | 1781 | |
| 1781 | 1782 | if (iQpDelta > 25 || iQpDelta < -26) { //out of iQpDelta range |
| 1782 | − return ERR_INFO_INVALID_QP; | |
| 1783 | + return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_QP); | |
| 1783 | 1784 | } |
| 1784 | 1785 | |
| 1785 | 1786 | pCurLayer->pLumaQp[iMbXy] = (pSlice->iLastMbQp + iQpDelta + 52) % 52; //update last_mb_qp |
| @@ -1794,17 +1795,17 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 8 unmodified lines | ||
| 1794 | 1795 | |
| 1795 | 1796 | if (MB_TYPE_INTRA16x16 == pCurLayer->pMbType[iMbXy]) { |
| 1796 | 1797 | //step1: Luma DC |
| 1797 | − if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, 0, 16, g_kuiLumaDcZigzagScan, | |
| 1798 | − I16_LUMA_DC, pCurLayer->pScaledTCoeff[iMbXy], pCurLayer->pLumaQp[iMbXy], pCtx)) { | |
| 1799 | − return -1;//abnormal | |
| 1798 | + if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, 0, 16, g_kuiLumaDcZigzagScan, I16_LUMA_DC, | |
| 1799 | + pCurLayer->pScaledTCoeff[iMbXy], pCurLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) { | |
| 1800 | + return iRet;//abnormal | |
| 1800 | 1801 | } |
| 1801 | 1802 | //step2: Luma AC |
| 1802 | 1803 | if (uiCbpL) { |
| 1803 | 1804 | for (i = 0; i < 16; i++) { |
| 1804 | − if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, i, | |
| 1805 | − iScanIdxEnd - WELS_MAX (iScanIdxStart, 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1), | |
| 1806 | − I16_LUMA_AC, pCurLayer->pScaledTCoeff[iMbXy] + (i << 4), pCurLayer->pLumaQp[iMbXy], pCtx)) { | |
| 1807 | − return -1;//abnormal | |
| 1805 | + if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, i, iScanIdxEnd - WELS_MAX (iScanIdxStart, 1) + 1, | |
| 1806 | + g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1), I16_LUMA_AC, pCurLayer->pScaledTCoeff[iMbXy] + (i << 4), | |
| 1807 | + pCurLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) { | |
| 1808 | + return iRet;//abnormal | |
| 1808 | 1809 | } |
| 1809 | 1810 | } |
| 1810 | 1811 | ST32A4 (&pNzc[0], LD32 (&pNonZeroCount[1 + 8 * 1])); |
| @@ -1819,10 +1820,10 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 8 unmodified lines | ||
| 1819 | 1820 | if (uiCbpL & (1 << iId8x8)) { |
| 1820 | 1821 | int32_t iIndex = (iId8x8 << 2); |
| 1821 | 1822 | for (iId4x4 = 0; iId4x4 < 4; iId4x4++) { |
| 1822 | − if (WelsResidualBlockCavlc8x8 (pVlcTable, pNonZeroCount, pBs, iIndex, | |
| 1823 | − iScanIdxEnd - iScanIdxStart + 1, g_kuiZigzagScan8x8 + iScanIdxStart, iMbResProperty, | |
| 1824 | − pCurLayer->pScaledTCoeff[iMbXy] + (iId8x8 << 6), iId4x4, pCurLayer->pLumaQp[iMbXy], pCtx)) { | |
| 1825 | − return -1; | |
| 1823 | + if ((iRet = WelsResidualBlockCavlc8x8 (pVlcTable, pNonZeroCount, pBs, iIndex, iScanIdxEnd - iScanIdxStart + 1, | |
| 1824 | + g_kuiZigzagScan8x8 + iScanIdxStart, iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + (iId8x8 << 6), iId4x4, | |
| 1825 | + pCurLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) { | |
| 1826 | + return iRet; | |
| 1826 | 1827 | } |
| 1827 | 1828 | iIndex++; |
| 1828 | 1829 | } |
| @@ -1842,10 +1843,10 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 13 unmodified lines | ||
| 1842 | 1843 | int32_t iIndex = (iId8x8 << 2); |
| 1843 | 1844 | for (iId4x4 = 0; iId4x4 < 4; iId4x4++) { |
| 1844 | 1845 | //Luma (DC and AC decoding together) |
| 1845 | − if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex, | |
| 1846 | − iScanIdxEnd - iScanIdxStart + 1, g_kuiZigzagScan + iScanIdxStart, iMbResProperty, | |
| 1847 | − pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), pCurLayer->pLumaQp[iMbXy], pCtx)) { | |
| 1848 | − return -1;//abnormal | |
| 1846 | + if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex, iScanIdxEnd - iScanIdxStart + 1, | |
| 1847 | + g_kuiZigzagScan + iScanIdxStart, iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), | |
| 1848 | + pCurLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) { | |
| 1849 | + return iRet;//abnormal | |
| 1849 | 1850 | } |
| 1850 | 1851 | iIndex++; |
| 1851 | 1852 | } |
| @@ -1871,10 +1872,9 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 19 unmodified lines | ||
| 1871 | 1872 | else |
| 1872 | 1873 | iMbResProperty = i ? CHROMA_DC_V_INTER : CHROMA_DC_U_INTER; |
| 1873 | 1874 | |
| 1874 | − if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, | |
| 1875 | − 16 + (i << 2), 4, g_kuiChromaDcScan, iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + 256 + (i << 6), | |
| 1876 | − pCurLayer->pChromaQp[iMbXy][i], pCtx)) { | |
| 1877 | − return -1;//abnormal | |
| 1875 | + if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, 16 + (i << 2), 4, g_kuiChromaDcScan, iMbResProperty, | |
| 1876 | + pCurLayer->pScaledTCoeff[iMbXy] + 256 + (i << 6), pCurLayer->pChromaQp[iMbXy][i], pCtx)) != ERR_NONE) { | |
| 1877 | + return iRet;//abnormal | |
| 1878 | 1878 | } |
| 1879 | 1879 | } |
| 1880 | 1880 | } else { |
| @@ -1889,10 +1889,10 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 8 unmodified lines | ||
| 1889 | 1889 | |
| 1890 | 1890 | int32_t iIndex = 16 + (i << 2); |
| 1891 | 1891 | for (iId4x4 = 0; iId4x4 < 4; iId4x4++) { |
| 1892 | − if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex, | |
| 1893 | − iScanIdxEnd - WELS_MAX (iScanIdxStart, 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1), | |
| 1894 | − iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), pCurLayer->pChromaQp[iMbXy][i], pCtx)) { | |
| 1895 | − return -1;//abnormal | |
| 1892 | + if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex, iScanIdxEnd - WELS_MAX (iScanIdxStart, | |
| 1893 | + 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1), iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), | |
| 1894 | + pCurLayer->pChromaQp[iMbXy][i], pCtx)) != ERR_NONE) { | |
| 1895 | + return iRet;//abnormal | |
| 1896 | 1896 | } |
| 1897 | 1897 | iIndex++; |
| 1898 | 1898 | } |
| @@ -1905,7 +1905,7 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 6 unmodified lines | ||
| 1905 | 1905 | BsEndCavlc (pBs); |
| 1906 | 1906 | } |
| 1907 | 1907 | |
| 1908 | − return 0; | |
| 1908 | + return ERR_NONE; | |
| 1909 | 1909 | } |
| 1910 | 1910 | |
| 1911 | 1911 | int32_t WelsDecodeMbCavlcPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uint32_t& uiEosFlag) { |
| @@ -1928,7 +1928,7 @@ int32_t WelsDecodeMbCavlcPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 16 unmodified lines | ||
| 1928 | 1928 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //mb_skip_run |
| 1929 | 1929 | pSlice->iMbSkipRun = uiCode; |
| 1930 | 1930 | if (-1 == pSlice->iMbSkipRun) { |
| 1931 | − return -1; | |
| 1931 | + return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_MB_SKIP_RUN); | |
| 1932 | 1932 | } |
| 1933 | 1933 | } |
| 1934 | 1934 | if (pSlice->iMbSkipRun--) { |
| @@ -1995,9 +1995,9 @@ int32_t WelsDecodeMbCavlcPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 60 unmodified lines | ||
| 1995 | 1995 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, |
| 1996 | 1996 | "WelsDecodeMbCavlcISlice()::::pBs incomplete, iUsedBits:%" PRId64 " > pBs->iBits:%d, MUST stop decoding.", |
| 1997 | 1997 | (int64_t) iUsedBits, pBs->iBits); |
| 1998 | − return -1; | |
| 1998 | + return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_BS_INCOMPLETE); | |
| 1999 | 1999 | } |
| 2000 | − return 0; | |
| 2000 | + return ERR_NONE; | |
| 2001 | 2001 | } |
| 2002 | 2002 | |
| 2003 | 2003 | void WelsBlockFuncInit (SBlockFunc* pFunc, int32_t iCpu) { |