Showing the changes to codec/decoder/core/src/decode_slice.cpp (1 of 7 files). Show all
Unified · Split
| @@ -271,7 +271,7 @@ int32_t WelsMbInterPrediction (PWelsDecoderContext pCtx, PDqLayer pCurLayer) { · 270 unmodified lines | ||
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | void WelsMbCopy (uint8_t* pDst, int32_t iStrideDst, uint8_t* pSrc, int32_t iStrideSrc, |
| 274 | − int32_t iHeight, int32_t iWidth) { | |
| 274 | + int32_t iHeight, int32_t iWidth) { | |
| 275 | 275 | int32_t i; |
| 276 | 276 | int32_t iOffsetDst = 0, iOffsetSrc = 0; |
| 277 | 277 | for (i = 0; i < iHeight; i++) { |
| @@ -491,13 +491,16 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 213 unmodified lines | ||
| 491 | 491 | int32_t iMbXy = pCurLayer->iMbXyIndex; |
| 492 | 492 | int32_t iNMbMode, i; |
| 493 | 493 | uint32_t uiMbType = 0, uiCbp = 0, uiCbpL = 0, uiCbpC = 0; |
| 494 | + uint32_t uiCode; | |
| 495 | + int32_t iCode; | |
| 494 | 496 | |
| 495 | 497 | ENFORCE_STACK_ALIGN_1D (uint8_t, pNonZeroCount, 48, 16); |
| 496 | 498 | |
| 497 | 499 | pCurLayer->pInterPredictionDoneFlag[iMbXy] = 0; |
| 498 | 500 | pCurLayer->pResidualPredFlag[iMbXy] = pSlice->sSliceHeaderExt.bDefaultResidualPredFlag; |
| 499 | 501 | |
| 500 | − uiMbType = BsGetUe (pBs); | |
| 502 | + WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //mb_type | |
| 503 | + uiMbType = uiCode; | |
| 501 | 504 | if (uiMbType > 25) { |
| 502 | 505 | return ERR_INFO_INVALID_MB_TYPE; |
| 503 | 506 | } |
| @@ -561,7 +564,8 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 57 unmodified lines | ||
| 561 | 564 | } |
| 562 | 565 | |
| 563 | 566 | //uiCbp |
| 564 | − uiCbp = BsGetUe (pBs); | |
| 567 | + WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //coded_block_pattern | |
| 568 | + uiCbp = uiCode; | |
| 565 | 569 | //G.9.1 Alternative parsing process for coded pBlock pattern |
| 566 | 570 | if (uiCbp > 47) |
| 567 | 571 | return ERR_INFO_INVALID_CBP; |
| @@ -603,7 +607,8 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 35 unmodified lines | ||
| 603 | 607 | if (pCurLayer->pCbp[iMbXy] || MB_TYPE_INTRA16x16 == pCurLayer->pMbType[iMbXy]) { |
| 604 | 608 | int32_t iQpDelta, iId8x8, iId4x4; |
| 605 | 609 | |
| 606 | − iQpDelta = BsGetSe (pBs); | |
| 610 | + WELS_READ_VERIFY (BsGetSe (pBs, &iCode)); //mb_qp_delta | |
| 611 | + iQpDelta = iCode; | |
| 607 | 612 | |
| 608 | 613 | if (iQpDelta > 25 || iQpDelta < -26) { //out of iQpDelta range |
| 609 | 614 | return ERR_INFO_INVALID_QP; |
| @@ -732,9 +737,11 @@ int32_t WelsDecodeMbCavlcISlice (PWelsDecoderContext pCtx, PNalUnit pNalCur) { · 122 unmodified lines | ||
| 732 | 737 | PSliceHeaderExt pSliceHeaderExt = &pCurLayer->sLayerInfo.sSliceInLayer.sSliceHeaderExt; |
| 733 | 738 | int32_t iBaseModeFlag; |
| 734 | 739 | int32_t iRet = 0; //should have the return value to indicate decoding error or not, It's NECESSARY--2010.4.15 |
| 740 | + uint32_t uiCode; | |
| 735 | 741 | |
| 736 | 742 | if (pSliceHeaderExt->bAdaptiveBaseModeFlag == 1) { |
| 737 | − iBaseModeFlag = BsGetOneBit (pBs); | |
| 743 | + WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //base_mode_flag | |
| 744 | + iBaseModeFlag = uiCode; | |
| 738 | 745 | } else { |
| 739 | 746 | iBaseModeFlag = pSliceHeaderExt->bDefaultBaseModeFlag; |
| 740 | 747 | } |
| @@ -769,11 +776,14 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 28 unmodified lines | ||
| 769 | 776 | |
| 770 | 777 | int32_t iNMbMode, i; |
| 771 | 778 | uint32_t uiMbType = 0, uiCbp = 0, uiCbpL = 0, uiCbpC = 0; |
| 779 | + uint32_t uiCode; | |
| 780 | + int32_t iCode; | |
| 772 | 781 | |
| 773 | 782 | ENFORCE_STACK_ALIGN_1D (uint8_t, pNonZeroCount, 48, 16); |
| 774 | 783 | pCurLayer->pInterPredictionDoneFlag[iMbXy] = 0;//2009.10.23 |
| 775 | 784 | |
| 776 | − uiMbType = BsGetUe (pBs); | |
| 785 | + WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //mb_type | |
| 786 | + uiMbType = uiCode; | |
| 777 | 787 | if (uiMbType < 5) { //inter MB type |
| 778 | 788 | int16_t iMotionVector[LIST_A][30][MV_A]; |
| 779 | 789 | |
| @@ -785,7 +795,8 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 5 unmodified lines | ||
| 785 | 795 | } |
| 786 | 796 | |
| 787 | 797 | if (pSlice->sSliceHeaderExt.bAdaptiveResidualPredFlag == 1) { |
| 788 | − pCurLayer->pResidualPredFlag[iMbXy] = BsGetOneBit (pBs); | |
| 798 | + WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //residual_prediction_flag | |
| 799 | + pCurLayer->pResidualPredFlag[iMbXy] = uiCode; | |
| 789 | 800 | } else { |
| 790 | 801 | pCurLayer->pResidualPredFlag[iMbXy] = pSlice->sSliceHeaderExt.bDefaultResidualPredFlag; |
| 791 | 802 | } |
| @@ -882,7 +893,8 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 90 unmodified lines | ||
| 882 | 893 | } |
| 883 | 894 | |
| 884 | 895 | if (MB_TYPE_INTRA16x16 != pCurLayer->pMbType[iMbXy]) { |
| 885 | − uiCbp = BsGetUe (pBs); | |
| 896 | + WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //coded_block_pattern | |
| 897 | + uiCbp = uiCode; | |
| 886 | 898 | { |
| 887 | 899 | if (uiCbp > 47) |
| 888 | 900 | return ERR_INFO_INVALID_CBP; |
| @@ -918,7 +930,8 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 29 unmodified lines | ||
| 918 | 930 | if (pCurLayer->pCbp[iMbXy] || MB_TYPE_INTRA16x16 == pCurLayer->pMbType[iMbXy]) { |
| 919 | 931 | int32_t iQpDelta, iId8x8, iId4x4; |
| 920 | 932 | |
| 921 | − iQpDelta = BsGetSe (pBs); | |
| 933 | + WELS_READ_VERIFY (BsGetSe (pBs, &iCode)); //mb_qp_delta | |
| 934 | + iQpDelta = iCode; | |
| 922 | 935 | |
| 923 | 936 | if (iQpDelta > 25 || iQpDelta < -26) { //out of iQpDelta range |
| 924 | 937 | return ERR_INFO_INVALID_QP; |
| @@ -1048,9 +1061,11 @@ int32_t WelsDecodeMbCavlcPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur) { · 123 unmodified lines | ||
| 1048 | 1061 | int32_t iMbXy = pCurLayer->iMbXyIndex; |
| 1049 | 1062 | int32_t iBaseModeFlag, i; |
| 1050 | 1063 | int32_t iRet = 0; //should have the return value to indicate decoding error or not, It's NECESSARY--2010.4.15 |
| 1064 | + uint32_t uiCode; | |
| 1051 | 1065 | |
| 1052 | 1066 | if (-1 == pSlice->iMbSkipRun) { |
| 1053 | − pSlice->iMbSkipRun = BsGetUe (pBs); | |
| 1067 | + WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //mb_skip_run | |
| 1068 | + pSlice->iMbSkipRun = uiCode; | |
| 1054 | 1069 | if (-1 == pSlice->iMbSkipRun) { |
| 1055 | 1070 | return -1; |
| 1056 | 1071 | } |
| @@ -1094,7 +1109,8 @@ int32_t WelsDecodeMbCavlcPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur) { · 37 unmodified lines | ||
| 1094 | 1109 | } |
| 1095 | 1110 | |
| 1096 | 1111 | if (pSlice->sSliceHeaderExt.bAdaptiveBaseModeFlag == 1) { |
| 1097 | − iBaseModeFlag = BsGetOneBit (pBs); | |
| 1112 | + WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //base_mode_flag | |
| 1113 | + iBaseModeFlag = uiCode; | |
| 1098 | 1114 | } else { |
| 1099 | 1115 | iBaseModeFlag = pSlice->sSliceHeaderExt.bDefaultBaseModeFlag; |
| 1100 | 1116 | } |