Showing the changes to codec/decoder/core/src/decode_slice.cpp (1 of 71 files). Show all
Unified · Split
| @@ -50,13 +50,11 @@ · 49 unmodified lines | |||
| 50 | 50 | ||
| 51 | #include "cpu_core.h" | 51 | #include "cpu_core.h" |
| 52 | 52 | ||
| 53 | namespace WelsDec { | ||
| 54 | |||
| 55 | extern void FreePicture (PPicture pPic, CMemoryAlign* pMa); | 53 | extern void FreePicture (PPicture pPic, CMemoryAlign* pMa); |
| 56 | 54 | ||
| 57 | extern PPicture AllocPicture (PWelsDecoderContext pCtx, const int32_t kiPicWidth, const int32_t kiPicHeight); | 55 | extern PPicture AllocPicture (PWelsDecoderContext pCtx, const int32_t kiPicWidth, const int32_t kiPicHeight); |
| 58 | 56 | ||
| 59 | static bool CheckRefPics (const PWelsDecoderContext& pCtx) { | 57 | static bool CheckRefPics (const PWelsDecoderContext pCtx) { |
| 60 | int32_t listCount = 1; | 58 | int32_t listCount = 1; |
| 61 | if (pCtx->eSliceType == B_SLICE) { | 59 | if (pCtx->eSliceType == B_SLICE) { |
| 62 | ++listCount; | 60 | ++listCount; |
| @@ -88,7 +86,7 @@ int32_t WelsTargetSliceConstruction (PWelsDecoderContext pCtx) { · 25 unmodified lines | |||
| 88 | int32_t iCurLayerWidth = pCurDqLayer->iMbWidth << 4; | 86 | int32_t iCurLayerWidth = pCurDqLayer->iMbWidth << 4; |
| 89 | int32_t iCurLayerHeight = pCurDqLayer->iMbHeight << 4; | 87 | int32_t iCurLayerHeight = pCurDqLayer->iMbHeight << 4; |
| 90 | 88 | ||
| 91 | int32_t iNextMbXyIndex = 0; | 89 | int32_t iNextMbXyIndex; |
| 92 | PFmo pFmo = pCtx->pFmo; | 90 | PFmo pFmo = pCtx->pFmo; |
| 93 | 91 | ||
| 94 | int32_t iTotalNumMb = pCurSlice->iTotalMbInCurSlice; | 92 | int32_t iTotalNumMb = pCurSlice->iTotalMbInCurSlice; |
| @@ -451,15 +449,15 @@ int32_t ParseIntra4x4Mode (PWelsDecoderContext pCtx, PWelsNeighAvail pNeighAvail · 356 unmodified lines | |||
| 451 | int32_t iMbXy = pCurDqLayer->iMbXyIndex; | 449 | int32_t iMbXy = pCurDqLayer->iMbXyIndex; |
| 452 | int32_t iFinalMode, i; | 450 | int32_t iFinalMode, i; |
| 453 | 451 | ||
| 454 | uint8_t uiNeighAvail = 0; | 452 | uint8_t uiNeighAvail; |
| 455 | uint32_t uiCode; | 453 | uint32_t uiCode; |
| 456 | int32_t iCode; | 454 | int32_t iCode; |
| 457 | pCtx->pMapNxNNeighToSampleFunc (pNeighAvail, iSampleAvail); | 455 | pCtx->pMapNxNNeighToSampleFunc (pNeighAvail, iSampleAvail); |
| 458 | uiNeighAvail = (iSampleAvail[6] << 2) | (iSampleAvail[0] << 1) | (iSampleAvail[1]); | 456 | uiNeighAvail = (iSampleAvail[6] << 2) | (iSampleAvail[0] << 1) | (iSampleAvail[1]); |
| 459 | for (i = 0; i < 16; i++) { | 457 | for (i = 0; i < 16; i++) { |
| 460 | int32_t iPrevIntra4x4PredMode = 0; | 458 | int32_t iPrevIntra4x4PredMode; |
| 461 | if (pCurDqLayer->sLayerInfo.pPps->bEntropyCodingModeFlag) { | 459 | if (pCurDqLayer->sLayerInfo.pPps->bEntropyCodingModeFlag) { |
| 462 | WELS_READ_VERIFY (ParseIntraPredModeLumaCabac (pCtx, iCode)); | 460 | WELS_READ_VERIFY (ParseIntraPredModeLumaCabac (pCtx, &iCode)); |
| 463 | iPrevIntra4x4PredMode = iCode; | 461 | iPrevIntra4x4PredMode = iCode; |
| 464 | } else { | 462 | } else { |
| 465 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); | 463 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); |
| @@ -502,7 +500,7 @@ int32_t ParseIntra4x4Mode (PWelsDecoderContext pCtx, PWelsNeighAvail pNeighAvail · 36 unmodified lines | |||
| 502 | return ERR_NONE; | 500 | return ERR_NONE; |
| 503 | 501 | ||
| 504 | if (pCurDqLayer->sLayerInfo.pPps->bEntropyCodingModeFlag) { | 502 | if (pCurDqLayer->sLayerInfo.pPps->bEntropyCodingModeFlag) { |
| 505 | WELS_READ_VERIFY (ParseIntraPredModeChromaCabac (pCtx, uiNeighAvail, iCode)); | 503 | WELS_READ_VERIFY (ParseIntraPredModeChromaCabac (pCtx, uiNeighAvail, &iCode)); |
| 506 | if (iCode > MAX_PRED_MODE_ID_CHROMA) { | 504 | if (iCode > MAX_PRED_MODE_ID_CHROMA) { |
| 507 | return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I_CHROMA_PRED_MODE); | 505 | return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I_CHROMA_PRED_MODE); |
| 508 | } | 506 | } |
| @@ -530,7 +528,7 @@ int32_t ParseIntra8x8Mode (PWelsDecoderContext pCtx, PWelsNeighAvail pNeighAvail · 21 unmodified lines | |||
| 530 | int32_t iMbXy = pCurDqLayer->iMbXyIndex; | 528 | int32_t iMbXy = pCurDqLayer->iMbXyIndex; |
| 531 | int32_t iFinalMode, i; | 529 | int32_t iFinalMode, i; |
| 532 | 530 | ||
| 533 | uint8_t uiNeighAvail = 0; | 531 | uint8_t uiNeighAvail; |
| 534 | uint32_t uiCode; | 532 | uint32_t uiCode; |
| 535 | int32_t iCode; | 533 | int32_t iCode; |
| 536 | pCtx->pMapNxNNeighToSampleFunc (pNeighAvail, iSampleAvail); | 534 | pCtx->pMapNxNNeighToSampleFunc (pNeighAvail, iSampleAvail); |
| @@ -540,9 +538,9 @@ int32_t ParseIntra8x8Mode (PWelsDecoderContext pCtx, PWelsNeighAvail pNeighAvail · 3 unmodified lines | |||
| 540 | pCurDqLayer->pIntraNxNAvailFlag[iMbXy] = uiNeighAvail; | 538 | pCurDqLayer->pIntraNxNAvailFlag[iMbXy] = uiNeighAvail; |
| 541 | 539 | ||
| 542 | for (i = 0; i < 4; i++) { | 540 | for (i = 0; i < 4; i++) { |
| 543 | int32_t iPrevIntra4x4PredMode = 0; | 541 | int32_t iPrevIntra4x4PredMode; |
| 544 | if (pCurDqLayer->sLayerInfo.pPps->bEntropyCodingModeFlag) { | 542 | if (pCurDqLayer->sLayerInfo.pPps->bEntropyCodingModeFlag) { |
| 545 | WELS_READ_VERIFY (ParseIntraPredModeLumaCabac (pCtx, iCode)); | 543 | WELS_READ_VERIFY (ParseIntraPredModeLumaCabac (pCtx, &iCode)); |
| 546 | iPrevIntra4x4PredMode = iCode; | 544 | iPrevIntra4x4PredMode = iCode; |
| 547 | } else { | 545 | } else { |
| 548 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); | 546 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); |
| @@ -586,7 +584,7 @@ int32_t ParseIntra8x8Mode (PWelsDecoderContext pCtx, PWelsNeighAvail pNeighAvail · 37 unmodified lines | |||
| 586 | return ERR_NONE; | 584 | return ERR_NONE; |
| 587 | 585 | ||
| 588 | if (pCurDqLayer->sLayerInfo.pPps->bEntropyCodingModeFlag) { | 586 | if (pCurDqLayer->sLayerInfo.pPps->bEntropyCodingModeFlag) { |
| 589 | WELS_READ_VERIFY (ParseIntraPredModeChromaCabac (pCtx, uiNeighAvail, iCode)); | 587 | WELS_READ_VERIFY (ParseIntraPredModeChromaCabac (pCtx, uiNeighAvail, &iCode)); |
| 590 | if (iCode > MAX_PRED_MODE_ID_CHROMA) { | 588 | if (iCode > MAX_PRED_MODE_ID_CHROMA) { |
| 591 | return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I_CHROMA_PRED_MODE); | 589 | return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I_CHROMA_PRED_MODE); |
| 592 | } | 590 | } |
| @@ -623,7 +621,7 @@ int32_t ParseIntra16x16Mode (PWelsDecoderContext pCtx, PWelsNeighAvail pNeighAva · 30 unmodified lines | |||
| 623 | return ERR_NONE; | 621 | return ERR_NONE; |
| 624 | 622 | ||
| 625 | if (pCurDqLayer->sLayerInfo.pPps->bEntropyCodingModeFlag) { | 623 | if (pCurDqLayer->sLayerInfo.pPps->bEntropyCodingModeFlag) { |
| 626 | WELS_READ_VERIFY (ParseIntraPredModeChromaCabac (pCtx, uiNeighAvail, iCode)); | 624 | WELS_READ_VERIFY (ParseIntraPredModeChromaCabac (pCtx, uiNeighAvail, &iCode)); |
| 627 | if (iCode > MAX_PRED_MODE_ID_CHROMA) { | 625 | if (iCode > MAX_PRED_MODE_ID_CHROMA) { |
| 628 | return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I_CHROMA_PRED_MODE); | 626 | return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_I_CHROMA_PRED_MODE); |
| 629 | } | 627 | } |
| @@ -643,7 +641,7 @@ int32_t ParseIntra16x16Mode (PWelsDecoderContext pCtx, PWelsNeighAvail pNeighAva · 13 unmodified lines | |||
| 643 | return ERR_NONE; | 641 | return ERR_NONE; |
| 644 | } | 642 | } |
| 645 | 643 | ||
| 646 | int32_t WelsDecodeMbCabacISliceBaseMode0 (PWelsDecoderContext pCtx, uint32_t& uiEosFlag) { | 644 | int32_t WelsDecodeMbCabacISliceBaseMode0 (PWelsDecoderContext pCtx, uint32_t *uiEosFlag) { |
| 647 | PDqLayer pCurDqLayer = pCtx->pCurDqLayer; | 645 | PDqLayer pCurDqLayer = pCtx->pCurDqLayer; |
| 648 | PBitStringAux pBsAux = pCurDqLayer->pBitStringAux; | 646 | PBitStringAux pBsAux = pCurDqLayer->pBitStringAux; |
| 649 | PSlice pSlice = &pCurDqLayer->sLayerInfo.sSliceInLayer; | 647 | PSlice pSlice = &pCurDqLayer->sLayerInfo.sSliceInLayer; |
| @@ -653,7 +651,7 @@ int32_t WelsDecodeMbCabacISliceBaseMode0 (PWelsDecoderContext pCtx, uint32_t& ui · 3 unmodified lines | |||
| 653 | int32_t iScanIdxEnd = pSlice->sSliceHeaderExt.uiScanIdxEnd; | 651 | int32_t iScanIdxEnd = pSlice->sSliceHeaderExt.uiScanIdxEnd; |
| 654 | int32_t iMbXy = pCurDqLayer->iMbXyIndex; | 652 | int32_t iMbXy = pCurDqLayer->iMbXyIndex; |
| 655 | int32_t i; | 653 | int32_t i; |
| 656 | uint32_t uiMbType = 0, uiCbp = 0, uiCbpLuma = 0, uiCbpChroma = 0; | 654 | uint32_t uiMbType = 0, uiCbp = 0, uiCbpLuma, uiCbpChroma; |
| 657 | 655 | ||
| 658 | ENFORCE_STACK_ALIGN_1D (uint8_t, pNonZeroCount, 48, 16); | 656 | ENFORCE_STACK_ALIGN_1D (uint8_t, pNonZeroCount, 48, 16); |
| 659 | 657 | ||
| @@ -663,7 +661,7 @@ int32_t WelsDecodeMbCabacISliceBaseMode0 (PWelsDecoderContext pCtx, uint32_t& ui · 3 unmodified lines | |||
| 663 | pCurDqLayer->pInterPredictionDoneFlag[iMbXy] = 0; | 661 | pCurDqLayer->pInterPredictionDoneFlag[iMbXy] = 0; |
| 664 | pCurDqLayer->pResidualPredFlag[iMbXy] = pSlice->sSliceHeaderExt.bDefaultResidualPredFlag; | 662 | pCurDqLayer->pResidualPredFlag[iMbXy] = pSlice->sSliceHeaderExt.bDefaultResidualPredFlag; |
| 665 | GetNeighborAvailMbType (&sNeighAvail, pCurDqLayer); | 663 | GetNeighborAvailMbType (&sNeighAvail, pCurDqLayer); |
| 666 | WELS_READ_VERIFY (ParseMBTypeISliceCabac (pCtx, &sNeighAvail, uiMbType)); | 664 | WELS_READ_VERIFY (ParseMBTypeISliceCabac (pCtx, &sNeighAvail, &uiMbType)); |
| 667 | if (uiMbType > 25) { | 665 | if (uiMbType > 25) { |
| 668 | return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_MB_TYPE); | 666 | return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_MB_TYPE); |
| 669 | } else if (!pCtx->pSps->uiChromaFormatIdc && ((uiMbType >= 5 && uiMbType <= 12) || (uiMbType >= 17 | 667 | } else if (!pCtx->pSps->uiChromaFormatIdc && ((uiMbType >= 5 && uiMbType <= 12) || (uiMbType >= 17 |
| @@ -674,7 +672,7 @@ int32_t WelsDecodeMbCabacISliceBaseMode0 (PWelsDecoderContext pCtx, uint32_t& ui · 4 unmodified lines | |||
| 674 | WELS_READ_VERIFY (ParseIPCMInfoCabac (pCtx)); | 672 | WELS_READ_VERIFY (ParseIPCMInfoCabac (pCtx)); |
| 675 | pSlice->iLastDeltaQp = 0; | 673 | pSlice->iLastDeltaQp = 0; |
| 676 | WELS_READ_VERIFY (ParseEndOfSliceCabac (pCtx, uiEosFlag)); | 674 | WELS_READ_VERIFY (ParseEndOfSliceCabac (pCtx, uiEosFlag)); |
| 677 | if (uiEosFlag) { | 675 | if (*uiEosFlag) { |
| 678 | RestoreCabacDecEngineToBS (pCtx->pCabacDecEngine, pCtx->pCurDqLayer->pBitStringAux); | 676 | RestoreCabacDecEngineToBS (pCtx->pCabacDecEngine, pCtx->pCurDqLayer->pBitStringAux); |
| 679 | } | 677 | } |
| 680 | return ERR_NONE; | 678 | return ERR_NONE; |
| @@ -683,7 +681,7 @@ int32_t WelsDecodeMbCabacISliceBaseMode0 (PWelsDecoderContext pCtx, uint32_t& ui · 2 unmodified lines | |||
| 683 | pCurDqLayer->pDec->pMbType[iMbXy] = MB_TYPE_INTRA4x4; | 681 | pCurDqLayer->pDec->pMbType[iMbXy] = MB_TYPE_INTRA4x4; |
| 684 | if (pCtx->pPps->bTransform8x8ModeFlag) { | 682 | if (pCtx->pPps->bTransform8x8ModeFlag) { |
| 685 | // Transform 8x8 cabac will be added soon | 683 | // Transform 8x8 cabac will be added soon |
| 686 | WELS_READ_VERIFY (ParseTransformSize8x8FlagCabac (pCtx, &sNeighAvail, pCtx->pCurDqLayer->pTransformSize8x8Flag[iMbXy])); | 684 | WELS_READ_VERIFY (ParseTransformSize8x8FlagCabac (pCtx, &sNeighAvail, &pCtx->pCurDqLayer->pTransformSize8x8Flag[iMbXy])); |
| 687 | } | 685 | } |
| 688 | if (pCtx->pCurDqLayer->pTransformSize8x8Flag[iMbXy]) { | 686 | if (pCtx->pCurDqLayer->pTransformSize8x8Flag[iMbXy]) { |
| 689 | uiMbType = pCurDqLayer->pDec->pMbType[iMbXy] = MB_TYPE_INTRA8x8; | 687 | uiMbType = pCurDqLayer->pDec->pMbType[iMbXy] = MB_TYPE_INTRA8x8; |
| @@ -694,7 +692,7 @@ int32_t WelsDecodeMbCabacISliceBaseMode0 (PWelsDecoderContext pCtx, uint32_t& ui · 4 unmodified lines | |||
| 694 | WELS_READ_VERIFY (ParseIntra4x4Mode (pCtx, &sNeighAvail, pIntraPredMode, pBsAux, pCurDqLayer)); | 692 | WELS_READ_VERIFY (ParseIntra4x4Mode (pCtx, &sNeighAvail, pIntraPredMode, pBsAux, pCurDqLayer)); |
| 695 | } | 693 | } |
| 696 | //get uiCbp for I4x4 | 694 | //get uiCbp for I4x4 |
| 697 | WELS_READ_VERIFY (ParseCbpInfoCabac (pCtx, &sNeighAvail, uiCbp)); | 695 | WELS_READ_VERIFY (ParseCbpInfoCabac (pCtx, &sNeighAvail, &uiCbp)); |
| 698 | pCurDqLayer->pCbp[iMbXy] = uiCbp; | 696 | pCurDqLayer->pCbp[iMbXy] = uiCbp; |
| 699 | pSlice->iLastDeltaQp = uiCbp == 0 ? 0 : pSlice->iLastDeltaQp; | 697 | pSlice->iLastDeltaQp = uiCbp == 0 ? 0 : pSlice->iLastDeltaQp; |
| 700 | uiCbpChroma = pCtx->pSps->uiChromaFormatIdc ? uiCbp >> 4 : 0; | 698 | uiCbpChroma = pCtx->pSps->uiChromaFormatIdc ? uiCbp >> 4 : 0; |
| @@ -730,7 +728,7 @@ int32_t WelsDecodeMbCabacISliceBaseMode0 (PWelsDecoderContext pCtx, uint32_t& ui · 29 unmodified lines | |||
| 730 | if (pCurDqLayer->pCbp[iMbXy] || MB_TYPE_INTRA16x16 == pCurDqLayer->pDec->pMbType[iMbXy]) { | 728 | if (pCurDqLayer->pCbp[iMbXy] || MB_TYPE_INTRA16x16 == pCurDqLayer->pDec->pMbType[iMbXy]) { |
| 731 | memset (pCurDqLayer->pScaledTCoeff[iMbXy], 0, 384 * sizeof (pCurDqLayer->pScaledTCoeff[iMbXy][0])); | 729 | memset (pCurDqLayer->pScaledTCoeff[iMbXy], 0, 384 * sizeof (pCurDqLayer->pScaledTCoeff[iMbXy][0])); |
| 732 | int32_t iQpDelta, iId8x8, iId4x4; | 730 | int32_t iQpDelta, iId8x8, iId4x4; |
| 733 | WELS_READ_VERIFY (ParseDeltaQpCabac (pCtx, iQpDelta)); | 731 | WELS_READ_VERIFY (ParseDeltaQpCabac (pCtx, &iQpDelta)); |
| 734 | if (iQpDelta > 25 || iQpDelta < -26) {//out of iQpDelta range | 732 | if (iQpDelta > 25 || iQpDelta < -26) {//out of iQpDelta range |
| 735 | return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_QP); | 733 | return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_QP); |
| 736 | } | 734 | } |
| @@ -844,18 +842,19 @@ int32_t WelsDecodeMbCabacISliceBaseMode0 (PWelsDecoderContext pCtx, uint32_t& ui · 107 unmodified lines | |||
| 844 | } | 842 | } |
| 845 | 843 | ||
| 846 | WELS_READ_VERIFY (ParseEndOfSliceCabac (pCtx, uiEosFlag)); | 844 | WELS_READ_VERIFY (ParseEndOfSliceCabac (pCtx, uiEosFlag)); |
| 847 | if (uiEosFlag) { | 845 | if (*uiEosFlag) { |
| 848 | RestoreCabacDecEngineToBS (pCtx->pCabacDecEngine, pCtx->pCurDqLayer->pBitStringAux); | 846 | RestoreCabacDecEngineToBS (pCtx->pCabacDecEngine, pCtx->pCurDqLayer->pBitStringAux); |
| 849 | } | 847 | } |
| 850 | return ERR_NONE; | 848 | return ERR_NONE; |
| 851 | } | 849 | } |
| 852 | 850 | ||
| 853 | int32_t WelsDecodeMbCabacISlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uint32_t& uiEosFlag) { | 851 | int32_t WelsDecodeMbCabacISlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uint32_t *uiEosFlag) { |
| 852 | USED(pNalCur); | ||
| 854 | WELS_READ_VERIFY (WelsDecodeMbCabacISliceBaseMode0 (pCtx, uiEosFlag)); | 853 | WELS_READ_VERIFY (WelsDecodeMbCabacISliceBaseMode0 (pCtx, uiEosFlag)); |
| 855 | return ERR_NONE; | 854 | return ERR_NONE; |
| 856 | } | 855 | } |
| 857 | 856 | ||
| 858 | int32_t WelsDecodeMbCabacPSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAvail pNeighAvail, uint32_t& uiEosFlag) { | 857 | int32_t WelsDecodeMbCabacPSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAvail pNeighAvail, uint32_t *uiEosFlag) { |
| 859 | PDqLayer pCurDqLayer = pCtx->pCurDqLayer; | 858 | PDqLayer pCurDqLayer = pCtx->pCurDqLayer; |
| 860 | PBitStringAux pBsAux = pCurDqLayer->pBitStringAux; | 859 | PBitStringAux pBsAux = pCurDqLayer->pBitStringAux; |
| 861 | PSlice pSlice = &pCurDqLayer->sLayerInfo.sSliceInLayer; | 860 | PSlice pSlice = &pCurDqLayer->sLayerInfo.sSliceInLayer; |
| @@ -872,7 +871,7 @@ int32_t WelsDecodeMbCabacPSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 10 unmodified lines | |||
| 872 | 871 | ||
| 873 | pCurDqLayer->pInterPredictionDoneFlag[iMbXy] = 0; | 872 | pCurDqLayer->pInterPredictionDoneFlag[iMbXy] = 0; |
| 874 | 873 | ||
| 875 | WELS_READ_VERIFY (ParseMBTypePSliceCabac (pCtx, pNeighAvail, uiMbType)); | 874 | WELS_READ_VERIFY (ParseMBTypePSliceCabac (pCtx, pNeighAvail, &uiMbType)); |
| 876 | // uiMbType = 4 is not allowded. | 875 | // uiMbType = 4 is not allowded. |
| 877 | if (uiMbType < 4) { //Inter mode | 876 | if (uiMbType < 4) { //Inter mode |
| 878 | int16_t pMotionVector[LIST_A][30][MV_A]; | 877 | int16_t pMotionVector[LIST_A][30][MV_A]; |
| @@ -894,7 +893,7 @@ int32_t WelsDecodeMbCabacPSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 15 unmodified lines | |||
| 894 | WELS_READ_VERIFY (ParseIPCMInfoCabac (pCtx)); | 893 | WELS_READ_VERIFY (ParseIPCMInfoCabac (pCtx)); |
| 895 | pSlice->iLastDeltaQp = 0; | 894 | pSlice->iLastDeltaQp = 0; |
| 896 | WELS_READ_VERIFY (ParseEndOfSliceCabac (pCtx, uiEosFlag)); | 895 | WELS_READ_VERIFY (ParseEndOfSliceCabac (pCtx, uiEosFlag)); |
| 897 | if (uiEosFlag) { | 896 | if (*uiEosFlag) { |
| 898 | RestoreCabacDecEngineToBS (pCtx->pCabacDecEngine, pCtx->pCurDqLayer->pBitStringAux); | 897 | RestoreCabacDecEngineToBS (pCtx->pCabacDecEngine, pCtx->pCurDqLayer->pBitStringAux); |
| 899 | } | 898 | } |
| 900 | return ERR_NONE; | 899 | return ERR_NONE; |
| @@ -903,7 +902,7 @@ int32_t WelsDecodeMbCabacPSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 2 unmodified lines | |||
| 903 | ENFORCE_STACK_ALIGN_1D (int8_t, pIntraPredMode, 48, 16); | 902 | ENFORCE_STACK_ALIGN_1D (int8_t, pIntraPredMode, 48, 16); |
| 904 | pCurDqLayer->pDec->pMbType[iMbXy] = MB_TYPE_INTRA4x4; | 903 | pCurDqLayer->pDec->pMbType[iMbXy] = MB_TYPE_INTRA4x4; |
| 905 | if (pCtx->pPps->bTransform8x8ModeFlag) { | 904 | if (pCtx->pPps->bTransform8x8ModeFlag) { |
| 906 | WELS_READ_VERIFY (ParseTransformSize8x8FlagCabac (pCtx, pNeighAvail, pCtx->pCurDqLayer->pTransformSize8x8Flag[iMbXy])); | 905 | WELS_READ_VERIFY (ParseTransformSize8x8FlagCabac (pCtx, pNeighAvail, &pCtx->pCurDqLayer->pTransformSize8x8Flag[iMbXy])); |
| 907 | } | 906 | } |
| 908 | if (pCtx->pCurDqLayer->pTransformSize8x8Flag[iMbXy]) { | 907 | if (pCtx->pCurDqLayer->pTransformSize8x8Flag[iMbXy]) { |
| 909 | uiMbType = pCurDqLayer->pDec->pMbType[iMbXy] = MB_TYPE_INTRA8x8; | 908 | uiMbType = pCurDqLayer->pDec->pMbType[iMbXy] = MB_TYPE_INTRA8x8; |
| @@ -935,7 +934,7 @@ int32_t WelsDecodeMbCabacPSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 25 unmodified lines | |||
| 935 | ST32 (&pCurDqLayer->pNzc[iMbXy][20], 0); | 934 | ST32 (&pCurDqLayer->pNzc[iMbXy][20], 0); |
| 936 | 935 | ||
| 937 | if (MB_TYPE_INTRA16x16 != pCurDqLayer->pDec->pMbType[iMbXy]) { | 936 | if (MB_TYPE_INTRA16x16 != pCurDqLayer->pDec->pMbType[iMbXy]) { |
| 938 | WELS_READ_VERIFY (ParseCbpInfoCabac (pCtx, pNeighAvail, uiCbp)); | 937 | WELS_READ_VERIFY (ParseCbpInfoCabac (pCtx, pNeighAvail, &uiCbp)); |
| 939 | 938 | ||
| 940 | pCurDqLayer->pCbp[iMbXy] = uiCbp; | 939 | pCurDqLayer->pCbp[iMbXy] = uiCbp; |
| 941 | pSlice->iLastDeltaQp = uiCbp == 0 ? 0 : pSlice->iLastDeltaQp; | 940 | pSlice->iLastDeltaQp = uiCbp == 0 ? 0 : pSlice->iLastDeltaQp; |
| @@ -957,7 +956,7 @@ int32_t WelsDecodeMbCabacPSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 15 unmodified lines | |||
| 957 | 956 | ||
| 958 | if (bNeedParseTransformSize8x8Flag) { | 957 | if (bNeedParseTransformSize8x8Flag) { |
| 959 | WELS_READ_VERIFY (ParseTransformSize8x8FlagCabac (pCtx, pNeighAvail, | 958 | WELS_READ_VERIFY (ParseTransformSize8x8FlagCabac (pCtx, pNeighAvail, |
| 960 | pCtx->pCurDqLayer->pTransformSize8x8Flag[iMbXy])); //transform_size_8x8_flag | 959 | &pCtx->pCurDqLayer->pTransformSize8x8Flag[iMbXy])); //transform_size_8x8_flag |
| 961 | } | 960 | } |
| 962 | } | 961 | } |
| 963 | 962 | ||
| @@ -965,7 +964,7 @@ int32_t WelsDecodeMbCabacPSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 1 unmodified line | |||
| 965 | 964 | ||
| 966 | int32_t iQpDelta, iId8x8, iId4x4; | 965 | int32_t iQpDelta, iId8x8, iId4x4; |
| 967 | 966 | ||
| 968 | WELS_READ_VERIFY (ParseDeltaQpCabac (pCtx, iQpDelta)); | 967 | WELS_READ_VERIFY (ParseDeltaQpCabac (pCtx, &iQpDelta)); |
| 969 | if (iQpDelta > 25 || iQpDelta < -26) { //out of iQpDelta range | 968 | if (iQpDelta > 25 || iQpDelta < -26) { //out of iQpDelta range |
| 970 | return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_QP); | 969 | return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_QP); |
| 971 | } | 970 | } |
| @@ -1085,14 +1084,14 @@ int32_t WelsDecodeMbCabacPSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 113 unmodified lines | |||
| 1085 | } | 1084 | } |
| 1086 | 1085 | ||
| 1087 | WELS_READ_VERIFY (ParseEndOfSliceCabac (pCtx, uiEosFlag)); | 1086 | WELS_READ_VERIFY (ParseEndOfSliceCabac (pCtx, uiEosFlag)); |
| 1088 | if (uiEosFlag) { | 1087 | if (*uiEosFlag) { |
| 1089 | RestoreCabacDecEngineToBS (pCtx->pCabacDecEngine, pCtx->pCurDqLayer->pBitStringAux); | 1088 | RestoreCabacDecEngineToBS (pCtx->pCabacDecEngine, pCtx->pCurDqLayer->pBitStringAux); |
| 1090 | } | 1089 | } |
| 1091 | 1090 | ||
| 1092 | return ERR_NONE; | 1091 | return ERR_NONE; |
| 1093 | } | 1092 | } |
| 1094 | 1093 | ||
| 1095 | int32_t WelsDecodeMbCabacBSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAvail pNeighAvail, uint32_t& uiEosFlag) { | 1094 | int32_t WelsDecodeMbCabacBSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAvail pNeighAvail, uint32_t *uiEosFlag) { |
| 1096 | PDqLayer pCurDqLayer = pCtx->pCurDqLayer; | 1095 | PDqLayer pCurDqLayer = pCtx->pCurDqLayer; |
| 1097 | PBitStringAux pBsAux = pCurDqLayer->pBitStringAux; | 1096 | PBitStringAux pBsAux = pCurDqLayer->pBitStringAux; |
| 1098 | PSlice pSlice = &pCurDqLayer->sLayerInfo.sSliceInLayer; | 1097 | PSlice pSlice = &pCurDqLayer->sLayerInfo.sSliceInLayer; |
| @@ -1109,7 +1108,7 @@ int32_t WelsDecodeMbCabacBSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 10 unmodified lines | |||
| 1109 | 1108 | ||
| 1110 | pCurDqLayer->pInterPredictionDoneFlag[iMbXy] = 0; | 1109 | pCurDqLayer->pInterPredictionDoneFlag[iMbXy] = 0; |
| 1111 | 1110 | ||
| 1112 | WELS_READ_VERIFY (ParseMBTypeBSliceCabac (pCtx, pNeighAvail, uiMbType)); | 1111 | WELS_READ_VERIFY (ParseMBTypeBSliceCabac (pCtx, pNeighAvail, &uiMbType)); |
| 1113 | 1112 | ||
| 1114 | if (uiMbType < 23) { //Inter B mode | 1113 | if (uiMbType < 23) { //Inter B mode |
| 1115 | int16_t pMotionVector[LIST_A][30][MV_A]; | 1114 | int16_t pMotionVector[LIST_A][30][MV_A]; |
| @@ -1134,7 +1133,7 @@ int32_t WelsDecodeMbCabacBSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 18 unmodified lines | |||
| 1134 | WELS_READ_VERIFY (ParseIPCMInfoCabac (pCtx)); | 1133 | WELS_READ_VERIFY (ParseIPCMInfoCabac (pCtx)); |
| 1135 | pSlice->iLastDeltaQp = 0; | 1134 | pSlice->iLastDeltaQp = 0; |
| 1136 | WELS_READ_VERIFY (ParseEndOfSliceCabac (pCtx, uiEosFlag)); | 1135 | WELS_READ_VERIFY (ParseEndOfSliceCabac (pCtx, uiEosFlag)); |
| 1137 | if (uiEosFlag) { | 1136 | if (*uiEosFlag) { |
| 1138 | RestoreCabacDecEngineToBS (pCtx->pCabacDecEngine, pCtx->pCurDqLayer->pBitStringAux); | 1137 | RestoreCabacDecEngineToBS (pCtx->pCabacDecEngine, pCtx->pCurDqLayer->pBitStringAux); |
| 1139 | } | 1138 | } |
| 1140 | return ERR_NONE; | 1139 | return ERR_NONE; |
| @@ -1143,7 +1142,7 @@ int32_t WelsDecodeMbCabacBSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 2 unmodified lines | |||
| 1143 | ENFORCE_STACK_ALIGN_1D (int8_t, pIntraPredMode, 48, 16); | 1142 | ENFORCE_STACK_ALIGN_1D (int8_t, pIntraPredMode, 48, 16); |
| 1144 | pCurDqLayer->pDec->pMbType[iMbXy] = MB_TYPE_INTRA4x4; | 1143 | pCurDqLayer->pDec->pMbType[iMbXy] = MB_TYPE_INTRA4x4; |
| 1145 | if (pCtx->pPps->bTransform8x8ModeFlag) { | 1144 | if (pCtx->pPps->bTransform8x8ModeFlag) { |
| 1146 | WELS_READ_VERIFY (ParseTransformSize8x8FlagCabac (pCtx, pNeighAvail, pCtx->pCurDqLayer->pTransformSize8x8Flag[iMbXy])); | 1145 | WELS_READ_VERIFY (ParseTransformSize8x8FlagCabac (pCtx, pNeighAvail, &pCtx->pCurDqLayer->pTransformSize8x8Flag[iMbXy])); |
| 1147 | } | 1146 | } |
| 1148 | if (pCtx->pCurDqLayer->pTransformSize8x8Flag[iMbXy]) { | 1147 | if (pCtx->pCurDqLayer->pTransformSize8x8Flag[iMbXy]) { |
| 1149 | uiMbType = pCurDqLayer->pDec->pMbType[iMbXy] = MB_TYPE_INTRA8x8; | 1148 | uiMbType = pCurDqLayer->pDec->pMbType[iMbXy] = MB_TYPE_INTRA8x8; |
| @@ -1175,7 +1174,7 @@ int32_t WelsDecodeMbCabacBSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 25 unmodified lines | |||
| 1175 | ST32 (&pCurDqLayer->pNzc[iMbXy][20], 0); | 1174 | ST32 (&pCurDqLayer->pNzc[iMbXy][20], 0); |
| 1176 | 1175 | ||
| 1177 | if (MB_TYPE_INTRA16x16 != pCurDqLayer->pDec->pMbType[iMbXy]) { | 1176 | if (MB_TYPE_INTRA16x16 != pCurDqLayer->pDec->pMbType[iMbXy]) { |
| 1178 | WELS_READ_VERIFY (ParseCbpInfoCabac (pCtx, pNeighAvail, uiCbp)); | 1177 | WELS_READ_VERIFY (ParseCbpInfoCabac (pCtx, pNeighAvail, &uiCbp)); |
| 1179 | 1178 | ||
| 1180 | pCurDqLayer->pCbp[iMbXy] = uiCbp; | 1179 | pCurDqLayer->pCbp[iMbXy] = uiCbp; |
| 1181 | pSlice->iLastDeltaQp = uiCbp == 0 ? 0 : pSlice->iLastDeltaQp; | 1180 | pSlice->iLastDeltaQp = uiCbp == 0 ? 0 : pSlice->iLastDeltaQp; |
| @@ -1198,7 +1197,7 @@ int32_t WelsDecodeMbCabacBSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 16 unmodified lines | |||
| 1198 | 1197 | ||
| 1199 | if (bNeedParseTransformSize8x8Flag) { | 1198 | if (bNeedParseTransformSize8x8Flag) { |
| 1200 | WELS_READ_VERIFY (ParseTransformSize8x8FlagCabac (pCtx, pNeighAvail, | 1199 | WELS_READ_VERIFY (ParseTransformSize8x8FlagCabac (pCtx, pNeighAvail, |
| 1201 | pCtx->pCurDqLayer->pTransformSize8x8Flag[iMbXy])); //transform_size_8x8_flag | 1200 | &pCtx->pCurDqLayer->pTransformSize8x8Flag[iMbXy])); //transform_size_8x8_flag |
| 1202 | } | 1201 | } |
| 1203 | } | 1202 | } |
| 1204 | 1203 | ||
| @@ -1206,7 +1205,7 @@ int32_t WelsDecodeMbCabacBSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 1 unmodified line | |||
| 1206 | 1205 | ||
| 1207 | int32_t iQpDelta, iId8x8, iId4x4; | 1206 | int32_t iQpDelta, iId8x8, iId4x4; |
| 1208 | 1207 | ||
| 1209 | WELS_READ_VERIFY (ParseDeltaQpCabac (pCtx, iQpDelta)); | 1208 | WELS_READ_VERIFY (ParseDeltaQpCabac (pCtx, &iQpDelta)); |
| 1210 | if (iQpDelta > 25 || iQpDelta < -26) { //out of iQpDelta range | 1209 | if (iQpDelta > 25 || iQpDelta < -26) { //out of iQpDelta range |
| 1211 | return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_QP); | 1210 | return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_QP); |
| 1212 | } | 1211 | } |
| @@ -1326,7 +1325,7 @@ int32_t WelsDecodeMbCabacBSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 113 unmodified lines | |||
| 1326 | } | 1325 | } |
| 1327 | 1326 | ||
| 1328 | WELS_READ_VERIFY (ParseEndOfSliceCabac (pCtx, uiEosFlag)); | 1327 | WELS_READ_VERIFY (ParseEndOfSliceCabac (pCtx, uiEosFlag)); |
| 1329 | if (uiEosFlag) { | 1328 | if (*uiEosFlag) { |
| 1330 | RestoreCabacDecEngineToBS (pCtx->pCabacDecEngine, pCtx->pCurDqLayer->pBitStringAux); | 1329 | RestoreCabacDecEngineToBS (pCtx->pCabacDecEngine, pCtx->pCurDqLayer->pBitStringAux); |
| 1331 | } | 1330 | } |
| 1332 | 1331 | ||
| @@ -1334,7 +1333,8 @@ int32_t WelsDecodeMbCabacBSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 1 unmodified line | |||
| 1334 | } | 1333 | } |
| 1335 | 1334 | ||
| 1336 | 1335 | ||
| 1337 | int32_t WelsDecodeMbCabacPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uint32_t& uiEosFlag) { | 1336 | int32_t WelsDecodeMbCabacPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uint32_t *uiEosFlag) { |
| 1337 | USED(pNalCur); | ||
| 1338 | PDqLayer pCurDqLayer = pCtx->pCurDqLayer; | 1338 | PDqLayer pCurDqLayer = pCtx->pCurDqLayer; |
| 1339 | PSlice pSlice = &pCurDqLayer->sLayerInfo.sSliceInLayer; | 1339 | PSlice pSlice = &pCurDqLayer->sLayerInfo.sSliceInLayer; |
| 1340 | PSliceHeader pSliceHeader = &pSlice->sSliceHeaderExt.sSliceHeader; | 1340 | PSliceHeader pSliceHeader = &pSlice->sSliceHeaderExt.sSliceHeader; |
| @@ -1351,8 +1351,7 @@ int32_t WelsDecodeMbCabacPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 10 unmodified lines | |||
| 1351 | pCurDqLayer->pTransformSize8x8Flag[iMbXy] = false; | 1351 | pCurDqLayer->pTransformSize8x8Flag[iMbXy] = false; |
| 1352 | 1352 | ||
| 1353 | GetNeighborAvailMbType (&uiNeighAvail, pCurDqLayer); | 1353 | GetNeighborAvailMbType (&uiNeighAvail, pCurDqLayer); |
| 1354 | WELS_READ_VERIFY (ParseSkipFlagCabac (pCtx, &uiNeighAvail, uiCode)); | 1354 | WELS_READ_VERIFY (ParseSkipFlagCabac (pCtx, &uiNeighAvail, &uiCode)); |
| 1355 | |||
| 1356 | if (uiCode) { | 1355 | if (uiCode) { |
| 1357 | int16_t pMv[2] = {0}; | 1356 | int16_t pMv[2] = {0}; |
| 1358 | pCurDqLayer->pDec->pMbType[iMbXy] = MB_TYPE_SKIP; | 1357 | pCurDqLayer->pDec->pMbType[iMbXy] = MB_TYPE_SKIP; |
| @@ -1399,7 +1398,8 @@ int32_t WelsDecodeMbCabacPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 40 unmodified lines | |||
| 1399 | } | 1398 | } |
| 1400 | 1399 | ||
| 1401 | 1400 | ||
| 1402 | int32_t WelsDecodeMbCabacBSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uint32_t& uiEosFlag) { | 1401 | int32_t WelsDecodeMbCabacBSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uint32_t *uiEosFlag) { |
| 1402 | USED(pNalCur); | ||
| 1403 | PDqLayer pCurDqLayer = pCtx->pCurDqLayer; | 1403 | PDqLayer pCurDqLayer = pCtx->pCurDqLayer; |
| 1404 | PSlice pSlice = &pCurDqLayer->sLayerInfo.sSliceInLayer; | 1404 | PSlice pSlice = &pCurDqLayer->sLayerInfo.sSliceInLayer; |
| 1405 | PSliceHeader pSliceHeader = &pSlice->sSliceHeaderExt.sSliceHeader; | 1405 | PSliceHeader pSliceHeader = &pSlice->sSliceHeaderExt.sSliceHeader; |
| @@ -1417,7 +1417,7 @@ int32_t WelsDecodeMbCabacBSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 11 unmodified lines | |||
| 1417 | pCurDqLayer->pTransformSize8x8Flag[iMbXy] = false; | 1417 | pCurDqLayer->pTransformSize8x8Flag[iMbXy] = false; |
| 1418 | 1418 | ||
| 1419 | GetNeighborAvailMbType (&uiNeighAvail, pCurDqLayer); | 1419 | GetNeighborAvailMbType (&uiNeighAvail, pCurDqLayer); |
| 1420 | WELS_READ_VERIFY (ParseSkipFlagCabac (pCtx, &uiNeighAvail, uiCode)); | 1420 | WELS_READ_VERIFY (ParseSkipFlagCabac (pCtx, &uiNeighAvail, &uiCode)); |
| 1421 | 1421 | ||
| 1422 | memset (pCurDqLayer->pDirect[iMbXy], 0, sizeof (int8_t) * 16); | 1422 | memset (pCurDqLayer->pDirect[iMbXy], 0, sizeof (int8_t) * 16); |
| 1423 | 1423 | ||
| @@ -1450,13 +1450,13 @@ int32_t WelsDecodeMbCabacBSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 26 unmodified lines | |||
| 1450 | if (pSliceHeader->iDirectSpatialMvPredFlag) { | 1450 | if (pSliceHeader->iDirectSpatialMvPredFlag) { |
| 1451 | 1451 | ||
| 1452 | //predict direct spatial mv | 1452 | //predict direct spatial mv |
| 1453 | int32_t ret = PredMvBDirectSpatial (pCtx, pMv, ref, subMbType); | 1453 | int32_t ret = PredMvBDirectSpatial (pCtx, pMv, ref, &subMbType); |
| 1454 | if (ret != ERR_NONE) { | 1454 | if (ret != ERR_NONE) { |
| 1455 | return ret; | 1455 | return ret; |
| 1456 | } | 1456 | } |
| 1457 | } else { | 1457 | } else { |
| 1458 | //temporal direct mode | 1458 | //temporal direct mode |
| 1459 | int32_t ret = PredBDirectTemporal (pCtx, pMv, ref, subMbType); | 1459 | int32_t ret = PredBDirectTemporal (pCtx, pMv, ref, &subMbType); |
| 1460 | if (ret != ERR_NONE) { | 1460 | if (ret != ERR_NONE) { |
| 1461 | return ret; | 1461 | return ret; |
| 1462 | } | 1462 | } |
| @@ -1513,6 +1513,7 @@ int32_t WelsCalcDeqCoeffScalingList (PWelsDecoderContext pCtx) { · 50 unmodified lines | |||
| 1513 | } | 1513 | } |
| 1514 | 1514 | ||
| 1515 | int32_t WelsDecodeSlice (PWelsDecoderContext pCtx, bool bFirstSliceInLayer, PNalUnit pNalCur) { | 1515 | int32_t WelsDecodeSlice (PWelsDecoderContext pCtx, bool bFirstSliceInLayer, PNalUnit pNalCur) { |
| 1516 | USED(bFirstSliceInLayer); | ||
| 1516 | PDqLayer pCurDqLayer = pCtx->pCurDqLayer; | 1517 | PDqLayer pCurDqLayer = pCtx->pCurDqLayer; |
| 1517 | PFmo pFmo = pCtx->pFmo; | 1518 | PFmo pFmo = pCtx->pFmo; |
| 1518 | int32_t iRet; | 1519 | int32_t iRet; |
| @@ -1523,7 +1524,7 @@ int32_t WelsDecodeSlice (PWelsDecoderContext pCtx, bool bFirstSliceInLayer, PNal · 4 unmodified lines | |||
| 1523 | PSliceHeader pSliceHeader = &pSliceHeaderExt->sSliceHeader; | 1524 | PSliceHeader pSliceHeader = &pSliceHeaderExt->sSliceHeader; |
| 1524 | int32_t iMbX, iMbY; | 1525 | int32_t iMbX, iMbY; |
| 1525 | const int32_t kiCountNumMb = pSliceHeader->pSps->uiTotalMbCount; //need to be correct when fmo or multi slice | 1526 | const int32_t kiCountNumMb = pSliceHeader->pSps->uiTotalMbCount; //need to be correct when fmo or multi slice |
| 1526 | uint32_t uiEosFlag = 0; | 1527 | uint32_t uiEosFlag; |
| 1527 | PWelsDecMbFunc pDecMbFunc; | 1528 | PWelsDecMbFunc pDecMbFunc; |
| 1528 | 1529 | ||
| 1529 | pSlice->iTotalMbInCurSlice = 0; //initialize at the starting of slice decoding. | 1530 | pSlice->iTotalMbInCurSlice = 0; //initialize at the starting of slice decoding. |
| @@ -1535,6 +1536,7 @@ int32_t WelsDecodeSlice (PWelsDecoderContext pCtx, bool bFirstSliceInLayer, PNal · 5 unmodified lines | |||
| 1535 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, | 1536 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, |
| 1536 | "WelsDecodeSlice()::::ILP flag exist, not supported with CABAC enabled!"); | 1537 | "WelsDecodeSlice()::::ILP flag exist, not supported with CABAC enabled!"); |
| 1537 | pCtx->iErrorCode |= dsBitstreamError; | 1538 | pCtx->iErrorCode |= dsBitstreamError; |
| 1539 | fprint(2, "dsBitstreamError\n"); | ||
| 1538 | return dsBitstreamError; | 1540 | return dsBitstreamError; |
| 1539 | } | 1541 | } |
| 1540 | if (P_SLICE == pSliceHeader->eSliceType) | 1542 | if (P_SLICE == pSliceHeader->eSliceType) |
| @@ -1586,15 +1588,17 @@ int32_t WelsDecodeSlice (PWelsDecoderContext pCtx, bool bFirstSliceInLayer, PNal · 45 unmodified lines | |||
| 1586 | pCurDqLayer->iMbXyIndex = iNextMbXyIndex; | 1588 | pCurDqLayer->iMbXyIndex = iNextMbXyIndex; |
| 1587 | 1589 | ||
| 1588 | do { | 1590 | do { |
| 1591 | //fprint(2, "(-1 == %d) || (%d >= %d) → %d\n", iNextMbXyIndex, iNextMbXyIndex, kiCountNumMb, (-1 == iNextMbXyIndex) || (iNextMbXyIndex >= kiCountNumMb)); | ||
| 1589 | if ((-1 == iNextMbXyIndex) || (iNextMbXyIndex >= kiCountNumMb)) { // slice group boundary or end of a frame | 1592 | if ((-1 == iNextMbXyIndex) || (iNextMbXyIndex >= kiCountNumMb)) { // slice group boundary or end of a frame |
| 1590 | break; | 1593 | break; |
| 1591 | } | 1594 | } |
| 1592 | 1595 | ||
| 1593 | pCurDqLayer->pSliceIdc[iNextMbXyIndex] = iSliceIdc; | 1596 | pCurDqLayer->pSliceIdc[iNextMbXyIndex] = iSliceIdc; |
| 1594 | pCtx->bMbRefConcealed = false; | 1597 | pCtx->bMbRefConcealed = false; |
| 1595 | iRet = pDecMbFunc (pCtx, pNalCur, uiEosFlag); | 1598 | iRet = pDecMbFunc (pCtx, pNalCur, &uiEosFlag); |
| 1596 | pCurDqLayer->pMbRefConcealedFlag[iNextMbXyIndex] = pCtx->bMbRefConcealed; | 1599 | pCurDqLayer->pMbRefConcealedFlag[iNextMbXyIndex] = pCtx->bMbRefConcealed; |
| 1597 | if (iRet != ERR_NONE) { | 1600 | if (iRet != ERR_NONE) { |
| 1601 | fprint(2, "pDecMbFunc %p %p %d\n", pDecMbFunc, WelsDecodeMbCabacPSlice, iRet); | ||
| 1598 | return iRet; | 1602 | return iRet; |
| 1599 | } | 1603 | } |
| 1600 | 1604 | ||
| @@ -1659,6 +1663,7 @@ int32_t WelsDecodeAndConstructSlice (PWelsDecoderContext pCtx) { · 58 unmodified lines | |||
| 1659 | pDecMbFunc = WelsDecodeMbCavlcISlice; | 1663 | pDecMbFunc = WelsDecodeMbCavlcISlice; |
| 1660 | } | 1664 | } |
| 1661 | } | 1665 | } |
| 1666 | USED(pDecMbFunc); | ||
| 1662 | 1667 | ||
| 1663 | if (pSliceHeader->pPps->bConstainedIntraPredFlag) { | 1668 | if (pSliceHeader->pPps->bConstainedIntraPredFlag) { |
| 1664 | pCtx->pFillInfoCacheIntraNxNFunc = WelsFillCacheConstrain1IntraNxN; | 1669 | pCtx->pFillInfoCacheIntraNxNFunc = WelsFillCacheConstrain1IntraNxN; |
| @@ -1697,7 +1702,7 @@ int32_t WelsDecodeAndConstructSlice (PWelsDecoderContext pCtx) { · 32 unmodified lines | |||
| 1697 | SDeblockingFilter pFilter; | 1702 | SDeblockingFilter pFilter; |
| 1698 | int32_t iFilterIdc = 1; | 1703 | int32_t iFilterIdc = 1; |
| 1699 | if (pSliceHeader->uiDisableDeblockingFilterIdc != 1) { | 1704 | if (pSliceHeader->uiDisableDeblockingFilterIdc != 1) { |
| 1700 | WelsDeblockingInitFilter (pCtx, pFilter, iFilterIdc); | 1705 | WelsDeblockingInitFilter (pCtx, &pFilter, &iFilterIdc); |
| 1701 | } | 1706 | } |
| 1702 | 1707 | ||
| 1703 | do { | 1708 | do { |
| @@ -1707,7 +1712,7 @@ int32_t WelsDecodeAndConstructSlice (PWelsDecoderContext pCtx) { · 3 unmodified lines | |||
| 1707 | 1712 | ||
| 1708 | pCurDqLayer->pSliceIdc[iNextMbXyIndex] = iSliceIdc; | 1713 | pCurDqLayer->pSliceIdc[iNextMbXyIndex] = iSliceIdc; |
| 1709 | pCtx->bMbRefConcealed = false; | 1714 | pCtx->bMbRefConcealed = false; |
| 1710 | iRet = pDecMbFunc (pCtx, pNalCur, uiEosFlag); | 1715 | iRet = pDecMbFunc (pCtx, pNalCur, &uiEosFlag); |
| 1711 | pCurDqLayer->pMbRefConcealedFlag[iNextMbXyIndex] = pCtx->bMbRefConcealed; | 1716 | pCurDqLayer->pMbRefConcealedFlag[iNextMbXyIndex] = pCtx->bMbRefConcealed; |
| 1712 | if (iRet != ERR_NONE) { | 1717 | if (iRet != ERR_NONE) { |
| 1713 | return iRet; | 1718 | return iRet; |
| @@ -1724,7 +1729,7 @@ int32_t WelsDecodeAndConstructSlice (PWelsDecoderContext pCtx) { · 10 unmodified lines | |||
| 1724 | pCtx->sBlockFunc.pWelsSetNonZeroCountFunc ( | 1729 | pCtx->sBlockFunc.pWelsSetNonZeroCountFunc ( |
| 1725 | pCtx->pDec->pNzc[pCurDqLayer->iMbXyIndex]); // set all none-zero nzc to 1; dbk can be opti! | 1730 | pCtx->pDec->pNzc[pCurDqLayer->iMbXyIndex]); // set all none-zero nzc to 1; dbk can be opti! |
| 1726 | } | 1731 | } |
| 1727 | WelsDeblockingFilterMB (pCurDqLayer, pFilter, iFilterIdc, pDeblockMb); | 1732 | WelsDeblockingFilterMB (pCurDqLayer, &pFilter, &iFilterIdc, pDeblockMb); |
| 1728 | if (pCtx->uiNalRefIdc > 0) { | 1733 | if (pCtx->uiNalRefIdc > 0) { |
| 1729 | if (pCurDqLayer->iMbX == 0 || pCurDqLayer->iMbX == pCurDqLayer->iMbWidth - 1 || pCurDqLayer->iMbY == 0 | 1734 | if (pCurDqLayer->iMbX == 0 || pCurDqLayer->iMbX == pCurDqLayer->iMbWidth - 1 || pCurDqLayer->iMbY == 0 |
| 1730 | || pCurDqLayer->iMbY == pCurDqLayer->iMbHeight - 1) { | 1735 | || pCurDqLayer->iMbY == pCurDqLayer->iMbHeight - 1) { |
| @@ -1799,8 +1804,8 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 68 unmodified lines | |||
| 1799 | const int32_t iMbXy = pCurDqLayer->iMbXyIndex; | 1804 | const int32_t iMbXy = pCurDqLayer->iMbXyIndex; |
| 1800 | int8_t* pNzc = pCurDqLayer->pNzc[iMbXy]; | 1805 | int8_t* pNzc = pCurDqLayer->pNzc[iMbXy]; |
| 1801 | int32_t i; | 1806 | int32_t i; |
| 1802 | int32_t iRet = ERR_NONE; | 1807 | int32_t iRet; |
| 1803 | uint32_t uiMbType = 0, uiCbp = 0, uiCbpL = 0, uiCbpC = 0; | 1808 | uint32_t uiMbType, uiCbp, uiCbpL, uiCbpC; |
| 1804 | uint32_t uiCode; | 1809 | uint32_t uiCode; |
| 1805 | int32_t iCode; | 1810 | int32_t iCode; |
| 1806 | 1811 | ||
| @@ -1881,6 +1886,7 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 74 unmodified lines | |||
| 1881 | pCurDqLayer->pTransformSize8x8Flag[iMbXy] = !!uiCode; | 1886 | pCurDqLayer->pTransformSize8x8Flag[iMbXy] = !!uiCode; |
| 1882 | if (pCurDqLayer->pTransformSize8x8Flag[iMbXy]) { | 1887 | if (pCurDqLayer->pTransformSize8x8Flag[iMbXy]) { |
| 1883 | uiMbType = pCurDqLayer->pDec->pMbType[iMbXy] = MB_TYPE_INTRA8x8; | 1888 | uiMbType = pCurDqLayer->pDec->pMbType[iMbXy] = MB_TYPE_INTRA8x8; |
| 1889 | USED(uiMbType); | ||
| 1884 | } | 1890 | } |
| 1885 | } | 1891 | } |
| 1886 | if (!pCurDqLayer->pTransformSize8x8Flag[iMbXy]) { | 1892 | if (!pCurDqLayer->pTransformSize8x8Flag[iMbXy]) { |
| @@ -2063,12 +2069,13 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 176 unmodified lines | |||
| 2063 | return ERR_NONE; | 2069 | return ERR_NONE; |
| 2064 | } | 2070 | } |
| 2065 | 2071 | ||
| 2066 | int32_t WelsDecodeMbCavlcISlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uint32_t& uiEosFlag) { | 2072 | int32_t WelsDecodeMbCavlcISlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uint32_t *uiEosFlag) { |
| 2073 | USED(pNalCur); | ||
| 2067 | PDqLayer pCurDqLayer = pCtx->pCurDqLayer; | 2074 | PDqLayer pCurDqLayer = pCtx->pCurDqLayer; |
| 2068 | PBitStringAux pBs = pCurDqLayer->pBitStringAux; | 2075 | PBitStringAux pBs = pCurDqLayer->pBitStringAux; |
| 2069 | PSliceHeaderExt pSliceHeaderExt = &pCurDqLayer->sLayerInfo.sSliceInLayer.sSliceHeaderExt; | 2076 | PSliceHeaderExt pSliceHeaderExt = &pCurDqLayer->sLayerInfo.sSliceInLayer.sSliceHeaderExt; |
| 2070 | int32_t iBaseModeFlag; | 2077 | int32_t iBaseModeFlag; |
| 2071 | int32_t iRet = 0; //should have the return value to indicate decoding error or not, It's NECESSARY--2010.4.15 | 2078 | int32_t iRet; //should have the return value to indicate decoding error or not, It's NECESSARY--2010.4.15 |
| 2072 | uint32_t uiCode; | 2079 | uint32_t uiCode; |
| 2073 | intX_t iUsedBits; | 2080 | intX_t iUsedBits; |
| 2074 | if (pSliceHeaderExt->bAdaptiveBaseModeFlag == 1) { | 2081 | if (pSliceHeaderExt->bAdaptiveBaseModeFlag == 1) { |
| @@ -2092,7 +2099,7 @@ int32_t WelsDecodeMbCavlcISlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 17 unmodified lines | |||
| 2092 | iUsedBits = ((pBs->pCurBuf - pBs->pStartBuf) << 3) - (16 - pBs->iLeftBits); | 2099 | iUsedBits = ((pBs->pCurBuf - pBs->pStartBuf) << 3) - (16 - pBs->iLeftBits); |
| 2093 | // sub 1, for stop bit | 2100 | // sub 1, for stop bit |
| 2094 | if ((iUsedBits == (pBs->iBits - 1)) && (0 >= pCurDqLayer->sLayerInfo.sSliceInLayer.iMbSkipRun)) { // slice boundary | 2101 | if ((iUsedBits == (pBs->iBits - 1)) && (0 >= pCurDqLayer->sLayerInfo.sSliceInLayer.iMbSkipRun)) { // slice boundary |
| 2095 | uiEosFlag = 1; | 2102 | *uiEosFlag = 1; |
| 2096 | } | 2103 | } |
| 2097 | if (iUsedBits > (pBs->iBits - | 2104 | if (iUsedBits > (pBs->iBits - |
| 2098 | 1)) { //When BS incomplete, as long as find it, SHOULD stop decoding to avoid mosaic or crash. | 2105 | 1)) { //When BS incomplete, as long as find it, SHOULD stop decoding to avoid mosaic or crash. |
| @@ -2120,8 +2127,8 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 21 unmodified lines | |||
| 2120 | const int32_t iMbXy = pCurDqLayer->iMbXyIndex; | 2127 | const int32_t iMbXy = pCurDqLayer->iMbXyIndex; |
| 2121 | int8_t* pNzc = pCurDqLayer->pNzc[iMbXy]; | 2128 | int8_t* pNzc = pCurDqLayer->pNzc[iMbXy]; |
| 2122 | int32_t i; | 2129 | int32_t i; |
| 2123 | int32_t iRet = ERR_NONE; | 2130 | int32_t iRet; |
| 2124 | uint32_t uiMbType = 0, uiCbp = 0, uiCbpL = 0, uiCbpC = 0; | 2131 | uint32_t uiMbType, uiCbp, uiCbpL = 0, uiCbpC = 0; |
| 2125 | uint32_t uiCode; | 2132 | uint32_t uiCode; |
| 2126 | int32_t iCode; | 2133 | int32_t iCode; |
| 2127 | int32_t iMbResProperty; | 2134 | int32_t iMbResProperty; |
| @@ -2230,6 +2237,7 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 102 unmodified lines | |||
| 2230 | pCurDqLayer->pTransformSize8x8Flag[iMbXy] = !!uiCode; | 2237 | pCurDqLayer->pTransformSize8x8Flag[iMbXy] = !!uiCode; |
| 2231 | if (pCurDqLayer->pTransformSize8x8Flag[iMbXy]) { | 2238 | if (pCurDqLayer->pTransformSize8x8Flag[iMbXy]) { |
| 2232 | uiMbType = pCurDqLayer->pDec->pMbType[iMbXy] = MB_TYPE_INTRA8x8; | 2239 | uiMbType = pCurDqLayer->pDec->pMbType[iMbXy] = MB_TYPE_INTRA8x8; |
| 2240 | USED(uiMbType); | ||
| 2233 | } | 2241 | } |
| 2234 | } | 2242 | } |
| 2235 | if (!pCurDqLayer->pTransformSize8x8Flag[iMbXy]) { | 2243 | if (!pCurDqLayer->pTransformSize8x8Flag[iMbXy]) { |
| @@ -2440,7 +2448,7 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 204 unmodified lines | |||
| 2440 | return ERR_NONE; | 2448 | return ERR_NONE; |
| 2441 | } | 2449 | } |
| 2442 | 2450 | ||
| 2443 | int32_t WelsDecodeMbCavlcPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uint32_t& uiEosFlag) { | 2451 | int32_t WelsDecodeMbCavlcPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uint32_t *uiEosFlag) { |
| 2444 | PDqLayer pCurDqLayer = pCtx->pCurDqLayer; | 2452 | PDqLayer pCurDqLayer = pCtx->pCurDqLayer; |
| 2445 | PBitStringAux pBs = pCurDqLayer->pBitStringAux; | 2453 | PBitStringAux pBs = pCurDqLayer->pBitStringAux; |
| 2446 | PSlice pSlice = &pCurDqLayer->sLayerInfo.sSliceInLayer; | 2454 | PSlice pSlice = &pCurDqLayer->sLayerInfo.sSliceInLayer; |
| @@ -2450,7 +2458,7 @@ int32_t WelsDecodeMbCavlcPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 3 unmodified lines | |||
| 2450 | const int32_t iMbXy = pCurDqLayer->iMbXyIndex; | 2458 | const int32_t iMbXy = pCurDqLayer->iMbXyIndex; |
| 2451 | int8_t* pNzc = pCurDqLayer->pNzc[iMbXy]; | 2459 | int8_t* pNzc = pCurDqLayer->pNzc[iMbXy]; |
| 2452 | int32_t iBaseModeFlag, i; | 2460 | int32_t iBaseModeFlag, i; |
| 2453 | int32_t iRet = 0; //should have the return value to indicate decoding error or not, It's NECESSARY--2010.4.15 | 2461 | int32_t iRet; //should have the return value to indicate decoding error or not, It's NECESSARY--2010.4.15 |
| 2454 | uint32_t uiCode; | 2462 | uint32_t uiCode; |
| 2455 | 2463 | ||
| 2456 | pCurDqLayer->pNoSubMbPartSizeLessThan8x8Flag[iMbXy] = true; | 2464 | pCurDqLayer->pNoSubMbPartSizeLessThan8x8Flag[iMbXy] = true; |
| @@ -2522,7 +2530,7 @@ int32_t WelsDecodeMbCavlcPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 65 unmodified lines | |||
| 2522 | iUsedBits = ((pBs->pCurBuf - pBs->pStartBuf) << 3) - (16 - pBs->iLeftBits); | 2530 | iUsedBits = ((pBs->pCurBuf - pBs->pStartBuf) << 3) - (16 - pBs->iLeftBits); |
| 2523 | // sub 1, for stop bit | 2531 | // sub 1, for stop bit |
| 2524 | if ((iUsedBits == (pBs->iBits - 1)) && (0 >= pCurDqLayer->sLayerInfo.sSliceInLayer.iMbSkipRun)) { // slice boundary | 2532 | if ((iUsedBits == (pBs->iBits - 1)) && (0 >= pCurDqLayer->sLayerInfo.sSliceInLayer.iMbSkipRun)) { // slice boundary |
| 2525 | uiEosFlag = 1; | 2533 | *uiEosFlag = 1; |
| 2526 | } | 2534 | } |
| 2527 | if (iUsedBits > (pBs->iBits - | 2535 | if (iUsedBits > (pBs->iBits - |
| 2528 | 1)) { //When BS incomplete, as long as find it, SHOULD stop decoding to avoid mosaic or crash. | 2536 | 1)) { //When BS incomplete, as long as find it, SHOULD stop decoding to avoid mosaic or crash. |
| @@ -2534,7 +2542,7 @@ int32_t WelsDecodeMbCavlcPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 5 unmodified lines | |||
| 2534 | return ERR_NONE; | 2542 | return ERR_NONE; |
| 2535 | } | 2543 | } |
| 2536 | 2544 | ||
| 2537 | int32_t WelsDecodeMbCavlcBSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uint32_t& uiEosFlag) { | 2545 | int32_t WelsDecodeMbCavlcBSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uint32_t *uiEosFlag) { |
| 2538 | PDqLayer pCurDqLayer = pCtx->pCurDqLayer; | 2546 | PDqLayer pCurDqLayer = pCtx->pCurDqLayer; |
| 2539 | PBitStringAux pBs = pCurDqLayer->pBitStringAux; | 2547 | PBitStringAux pBs = pCurDqLayer->pBitStringAux; |
| 2540 | PSlice pSlice = &pCurDqLayer->sLayerInfo.sSliceInLayer; | 2548 | PSlice pSlice = &pCurDqLayer->sLayerInfo.sSliceInLayer; |
| @@ -2545,7 +2553,7 @@ int32_t WelsDecodeMbCavlcBSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 4 unmodified lines | |||
| 2545 | const int32_t iMbXy = pCurDqLayer->iMbXyIndex; | 2553 | const int32_t iMbXy = pCurDqLayer->iMbXyIndex; |
| 2546 | int8_t* pNzc = pCurDqLayer->pNzc[iMbXy]; | 2554 | int8_t* pNzc = pCurDqLayer->pNzc[iMbXy]; |
| 2547 | int32_t iBaseModeFlag, i; | 2555 | int32_t iBaseModeFlag, i; |
| 2548 | int32_t iRet = 0; //should have the return value to indicate decoding error or not, It's NECESSARY--2010.4.15 | 2556 | int32_t iRet; //should have the return value to indicate decoding error or not, It's NECESSARY--2010.4.15 |
| 2549 | uint32_t uiCode; | 2557 | uint32_t uiCode; |
| 2550 | 2558 | ||
| 2551 | pCurDqLayer->pNoSubMbPartSizeLessThan8x8Flag[iMbXy] = true; | 2559 | pCurDqLayer->pNoSubMbPartSizeLessThan8x8Flag[iMbXy] = true; |
| @@ -2587,13 +2595,13 @@ int32_t WelsDecodeMbCavlcBSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 35 unmodified lines | |||
| 2587 | if (pSliceHeader->iDirectSpatialMvPredFlag) { | 2595 | if (pSliceHeader->iDirectSpatialMvPredFlag) { |
| 2588 | 2596 | ||
| 2589 | //predict direct spatial mv | 2597 | //predict direct spatial mv |
| 2590 | int32_t ret = PredMvBDirectSpatial (pCtx, iMv, ref, subMbType); | 2598 | int32_t ret = PredMvBDirectSpatial (pCtx, iMv, ref, &subMbType); |
| 2591 | if (ret != ERR_NONE) { | 2599 | if (ret != ERR_NONE) { |
| 2592 | return ret; | 2600 | return ret; |
| 2593 | } | 2601 | } |
| 2594 | } else { | 2602 | } else { |
| 2595 | //temporal direct mode | 2603 | //temporal direct mode |
| 2596 | int32_t ret = PredBDirectTemporal (pCtx, iMv, ref, subMbType); | 2604 | int32_t ret = PredBDirectTemporal (pCtx, iMv, ref, &subMbType); |
| 2597 | if (ret != ERR_NONE) { | 2605 | if (ret != ERR_NONE) { |
| 2598 | return ret; | 2606 | return ret; |
| 2599 | } | 2607 | } |
| @@ -2636,7 +2644,7 @@ int32_t WelsDecodeMbCavlcBSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 36 unmodified lines | |||
| 2636 | iUsedBits = ((pBs->pCurBuf - pBs->pStartBuf) << 3) - (16 - pBs->iLeftBits); | 2644 | iUsedBits = ((pBs->pCurBuf - pBs->pStartBuf) << 3) - (16 - pBs->iLeftBits); |
| 2637 | // sub 1, for stop bit | 2645 | // sub 1, for stop bit |
| 2638 | if ((iUsedBits == (pBs->iBits - 1)) && (0 >= pCurDqLayer->sLayerInfo.sSliceInLayer.iMbSkipRun)) { // slice boundary | 2646 | if ((iUsedBits == (pBs->iBits - 1)) && (0 >= pCurDqLayer->sLayerInfo.sSliceInLayer.iMbSkipRun)) { // slice boundary |
| 2639 | uiEosFlag = 1; | 2647 | *uiEosFlag = 1; |
| 2640 | } | 2648 | } |
| 2641 | if (iUsedBits > (pBs->iBits - | 2649 | if (iUsedBits > (pBs->iBits - |
| 2642 | 1)) { //When BS incomplete, as long as find it, SHOULD stop decoding to avoid mosaic or crash. | 2650 | 1)) { //When BS incomplete, as long as find it, SHOULD stop decoding to avoid mosaic or crash. |
| @@ -2664,8 +2672,8 @@ int32_t WelsActualDecodeMbCavlcBSlice (PWelsDecoderContext pCtx) { · 21 unmodified lines | |||
| 2664 | const int32_t iMbXy = pCurDqLayer->iMbXyIndex; | 2672 | const int32_t iMbXy = pCurDqLayer->iMbXyIndex; |
| 2665 | int8_t* pNzc = pCurDqLayer->pNzc[iMbXy]; | 2673 | int8_t* pNzc = pCurDqLayer->pNzc[iMbXy]; |
| 2666 | int32_t i; | 2674 | int32_t i; |
| 2667 | int32_t iRet = ERR_NONE; | 2675 | int32_t iRet; |
| 2668 | uint32_t uiMbType = 0, uiCbp = 0, uiCbpL = 0, uiCbpC = 0; | 2676 | uint32_t uiMbType, uiCbp, uiCbpL = 0, uiCbpC = 0; |
| 2669 | uint32_t uiCode; | 2677 | uint32_t uiCode; |
| 2670 | int32_t iCode; | 2678 | int32_t iCode; |
| 2671 | int32_t iMbResProperty; | 2679 | int32_t iMbResProperty; |
| @@ -2774,6 +2782,7 @@ int32_t WelsActualDecodeMbCavlcBSlice (PWelsDecoderContext pCtx) { · 102 unmodified lines | |||
| 2774 | pCurDqLayer->pTransformSize8x8Flag[iMbXy] = !!uiCode; | 2782 | pCurDqLayer->pTransformSize8x8Flag[iMbXy] = !!uiCode; |
| 2775 | if (pCurDqLayer->pTransformSize8x8Flag[iMbXy]) { | 2783 | if (pCurDqLayer->pTransformSize8x8Flag[iMbXy]) { |
| 2776 | uiMbType = pCurDqLayer->pDec->pMbType[iMbXy] = MB_TYPE_INTRA8x8; | 2784 | uiMbType = pCurDqLayer->pDec->pMbType[iMbXy] = MB_TYPE_INTRA8x8; |
| 2785 | USED(uiMbType); | ||
| 2777 | } | 2786 | } |
| 2778 | } | 2787 | } |
| 2779 | if (!pCurDqLayer->pTransformSize8x8Flag[iMbXy]) { | 2788 | if (!pCurDqLayer->pTransformSize8x8Flag[iMbXy]) { |
| @@ -2985,6 +2994,7 @@ int32_t WelsActualDecodeMbCavlcBSlice (PWelsDecoderContext pCtx) { · 205 unmodified lines | |||
| 2985 | } | 2994 | } |
| 2986 | 2995 | ||
| 2987 | void WelsBlockFuncInit (SBlockFunc* pFunc, int32_t iCpu) { | 2996 | void WelsBlockFuncInit (SBlockFunc* pFunc, int32_t iCpu) { |
| 2997 | USED(iCpu); | ||
| 2988 | pFunc->pWelsSetNonZeroCountFunc = WelsNonZeroCount_c; | 2998 | pFunc->pWelsSetNonZeroCountFunc = WelsNonZeroCount_c; |
| 2989 | pFunc->pWelsBlockZero16x16Func = WelsBlockZero16x16_c; | 2999 | pFunc->pWelsBlockZero16x16Func = WelsBlockZero16x16_c; |
| 2990 | pFunc->pWelsBlockZero8x8Func = WelsBlockZero8x8_c; | 3000 | pFunc->pWelsBlockZero8x8Func = WelsBlockZero8x8_c; |
| @@ -3061,4 +3071,3 @@ bool ComputeColocatedTemporalScaling (PWelsDecoderContext pCtx) { · 70 unmodified lines | |||
| 3061 | } | 3071 | } |
| 3062 | return true; | 3072 | return true; |
| 3063 | } | 3073 | } |
| 3064 | } // namespace WelsDec | ||