History

astyle and speed up decoding by removing unnessary memset

dong zhang committed 11 years ago

Commit 89f78e91 parent 2c696381 file · +24 −25Browse files

Showing the changes to codec/decoder/core/src/decode_slice.cpp (1 of 1 file). Show all

Unified · Split

codec/decoder/core/src/decode_slice.cpp+24−25
@@ -101,7 +101,7 @@ int32_t WelsTargetSliceConstruction (PWelsDecoderContext pCtx) { · 100 unmodified lines
101 ++iCountNumMb;101 ++iCountNumMb;
102 if (!pCurLayer->pMbCorrectlyDecodedFlag[iNextMbXyIndex]) { //already con-ed, overwrite102 if (!pCurLayer->pMbCorrectlyDecodedFlag[iNextMbXyIndex]) { //already con-ed, overwrite
103 pCurLayer->pMbCorrectlyDecodedFlag[iNextMbXyIndex] = true;103 pCurLayer->pMbCorrectlyDecodedFlag[iNextMbXyIndex] = true;
104 pCtx->pDec->iMbEcedPropNum += (pCurLayer->pMbRefConcealedFlag[iNextMbXyIndex]? 1 : 0);104 pCtx->pDec->iMbEcedPropNum += (pCurLayer->pMbRefConcealedFlag[iNextMbXyIndex] ? 1 : 0);
105 ++pCtx->iTotalNumMbRec;105 ++pCtx->iTotalNumMbRec;
106 }106 }
107 107
@@ -529,7 +529,7 @@ int32_t WelsDecodeMbCabacISliceBaseMode0 (PWelsDecoderContext pCtx, uint32_t& ui · 421 unmodified lines
529 //get uiCbp for I4x4529 //get uiCbp for I4x4
530 WELS_READ_VERIFY (ParseCbpInfoCabac (pCtx, &sNeighAvail, uiCbp));530 WELS_READ_VERIFY (ParseCbpInfoCabac (pCtx, &sNeighAvail, uiCbp));
531 pCurLayer->pCbp[iMbXy] = uiCbp;531 pCurLayer->pCbp[iMbXy] = uiCbp;
532 pSlice->iLastDeltaQp = uiCbp == 0 ? 0: pSlice->iLastDeltaQp;532 pSlice->iLastDeltaQp = uiCbp == 0 ? 0 : pSlice->iLastDeltaQp;
533 uiCbpChroma = uiCbp >> 4;533 uiCbpChroma = uiCbp >> 4;
534 uiCbpLuma = uiCbp & 15;534 uiCbpLuma = uiCbp & 15;
535 } else { //I16x16;535 } else { //I16x16;
@@ -542,7 +542,7 @@ int32_t WelsDecodeMbCabacISliceBaseMode0 (PWelsDecoderContext pCtx, uint32_t& ui · 6 unmodified lines
542 WELS_READ_VERIFY (ParseIntra16x16Mode (pCtx, &sNeighAvail, pBsAux, pCurLayer));542 WELS_READ_VERIFY (ParseIntra16x16Mode (pCtx, &sNeighAvail, pBsAux, pCurLayer));
543 }543 }
544 544
545 memset (pCurLayer->pScaledTCoeff[iMbXy], 0, 384 * sizeof (pCurLayer->pScaledTCoeff[iMbXy][0]));545
546 ST32 (&pCurLayer->pNzc[iMbXy][0], 0);546 ST32 (&pCurLayer->pNzc[iMbXy][0], 0);
547 ST32 (&pCurLayer->pNzc[iMbXy][4], 0);547 ST32 (&pCurLayer->pNzc[iMbXy][4], 0);
548 ST32 (&pCurLayer->pNzc[iMbXy][8], 0);548 ST32 (&pCurLayer->pNzc[iMbXy][8], 0);
@@ -558,6 +558,7 @@ int32_t WelsDecodeMbCabacISliceBaseMode0 (PWelsDecoderContext pCtx, uint32_t& ui · 9 unmodified lines
558 }558 }
559 559
560 if (pCurLayer->pCbp[iMbXy] || MB_TYPE_INTRA16x16 == pCurLayer->pMbType[iMbXy]) {560 if (pCurLayer->pCbp[iMbXy] || MB_TYPE_INTRA16x16 == pCurLayer->pMbType[iMbXy]) {
561 memset (pCurLayer->pScaledTCoeff[iMbXy], 0, 384 * sizeof (pCurLayer->pScaledTCoeff[iMbXy][0]));
561 int32_t iQpDelta, iId8x8, iId4x4;562 int32_t iQpDelta, iId8x8, iId4x4;
562 WELS_READ_VERIFY (ParseDeltaQpCabac (pCtx, iQpDelta));563 WELS_READ_VERIFY (ParseDeltaQpCabac (pCtx, iQpDelta));
563 if (iQpDelta > 25 || iQpDelta < -26) {//out of iQpDelta range564 if (iQpDelta > 25 || iQpDelta < -26) {//out of iQpDelta range
@@ -722,18 +723,6 @@ int32_t WelsDecodeMbCabacPSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 158 unmodified lines
722 }723 }
723 }724 }
724 725
725 if (MB_TYPE_INTRA16x16 != pCurLayer->pMbType[iMbXy]) {
726 WELS_READ_VERIFY (ParseCbpInfoCabac (pCtx, pNeighAvail, uiCbp));
727 pCurLayer->pCbp[iMbXy] = uiCbp;
728 pSlice->iLastDeltaQp = uiCbp == 0 ? 0: pSlice->iLastDeltaQp;
729 uiCbpChroma = pCurLayer->pCbp[iMbXy] >> 4;
730 uiCbpLuma = pCurLayer->pCbp[iMbXy] & 15;
731 }
732
733 pCtx->sBlockFunc.pWelsBlockZero16x16Func (pCurLayer->pScaledTCoeff[iMbXy], 16);
734 pCtx->sBlockFunc.pWelsBlockZero8x8Func (pCurLayer->pScaledTCoeff[iMbXy] + 256, 8);
735 pCtx->sBlockFunc.pWelsBlockZero8x8Func (pCurLayer->pScaledTCoeff[iMbXy] + 256 + 64, 8);
736
737 ST32 (&pCurLayer->pNzc[iMbXy][0], 0);726 ST32 (&pCurLayer->pNzc[iMbXy][0], 0);
738 ST32 (&pCurLayer->pNzc[iMbXy][4], 0);727 ST32 (&pCurLayer->pNzc[iMbXy][4], 0);
739 ST32 (&pCurLayer->pNzc[iMbXy][8], 0);728 ST32 (&pCurLayer->pNzc[iMbXy][8], 0);
@@ -741,7 +730,17 @@ int32_t WelsDecodeMbCabacPSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 1 unmodified line
741 ST32 (&pCurLayer->pNzc[iMbXy][16], 0);730 ST32 (&pCurLayer->pNzc[iMbXy][16], 0);
742 ST32 (&pCurLayer->pNzc[iMbXy][20], 0);731 ST32 (&pCurLayer->pNzc[iMbXy][20], 0);
743 732
733 if (MB_TYPE_INTRA16x16 != pCurLayer->pMbType[iMbXy]) {
734 WELS_READ_VERIFY (ParseCbpInfoCabac (pCtx, pNeighAvail, uiCbp));
735 pCurLayer->pCbp[iMbXy] = uiCbp;
736 pSlice->iLastDeltaQp = uiCbp == 0 ? 0 : pSlice->iLastDeltaQp;
737 uiCbpChroma = pCurLayer->pCbp[iMbXy] >> 4;
738 uiCbpLuma = pCurLayer->pCbp[iMbXy] & 15;
739 }
740
744 if (pCurLayer->pCbp[iMbXy] || MB_TYPE_INTRA16x16 == pCurLayer->pMbType[iMbXy]) {741 if (pCurLayer->pCbp[iMbXy] || MB_TYPE_INTRA16x16 == pCurLayer->pMbType[iMbXy]) {
742 memset (pCurLayer->pScaledTCoeff[iMbXy], 0, 384 * sizeof (pCurLayer->pScaledTCoeff[iMbXy][0]));
743
745 int32_t iQpDelta, iId8x8, iId4x4;744 int32_t iQpDelta, iId8x8, iId4x4;
746 745
747 WELS_READ_VERIFY (ParseDeltaQpCabac (pCtx, iQpDelta));746 WELS_READ_VERIFY (ParseDeltaQpCabac (pCtx, iQpDelta));
@@ -863,7 +862,7 @@ int32_t WelsDecodeMbCabacPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 115 unmodified lines
863 862
864 pCurLayer->pInterPredictionDoneFlag[iMbXy] = 0;863 pCurLayer->pInterPredictionDoneFlag[iMbXy] = 0;
865 memset (pCurLayer->pRefIndex[0][iMbXy], 0, sizeof (int8_t) * 16);864 memset (pCurLayer->pRefIndex[0][iMbXy], 0, sizeof (int8_t) * 16);
866 pCtx->bMbRefConcealed = pCtx->bRPLRError || pCtx->bMbRefConcealed || !(ppRefPic[0]&&ppRefPic[0]->bIsComplete);865 pCtx->bMbRefConcealed = pCtx->bRPLRError || pCtx->bMbRefConcealed || ! (ppRefPic[0] && ppRefPic[0]->bIsComplete);
867 //predict mv866 //predict mv
868 PredPSkipMvFromNeighbor (pCurLayer, pMv);867 PredPSkipMvFromNeighbor (pCurLayer, pMv);
869 for (i = 0; i < 16; i++) {868 for (i = 0; i < 16; i++) {
@@ -871,9 +870,9 @@ int32_t WelsDecodeMbCabacPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 1 unmodified line
871 ST32 (pCurLayer->pMvd[0][iMbXy][i], 0);870 ST32 (pCurLayer->pMvd[0][iMbXy][i], 0);
872 }871 }
873 872
874 if (!pSlice->sSliceHeaderExt.bDefaultResidualPredFlag) {873 //if (!pSlice->sSliceHeaderExt.bDefaultResidualPredFlag) {
875 memset (pCurLayer->pScaledTCoeff[iMbXy], 0, 384 * sizeof (int16_t));874 // memset (pCurLayer->pScaledTCoeff[iMbXy], 0, 384 * sizeof (int16_t));
876 }875 //}
877 876
878 //reset rS877 //reset rS
879 pCurLayer->pLumaQp[iMbXy] = pSlice->iLastMbQp; //??????????????? dqaunt of previous mb878 pCurLayer->pLumaQp[iMbXy] = pSlice->iLastMbQp; //??????????????? dqaunt of previous mb
@@ -1071,7 +1070,7 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 191 unmodified lines
1071 pCurLayer->pLumaQp[iMbXy] = 0;1070 pCurLayer->pLumaQp[iMbXy] = 0;
1072 pCurLayer->pChromaQp[iMbXy] = 0;1071 pCurLayer->pChromaQp[iMbXy] = 0;
1073 memset (pNzc, 16, sizeof (pCurLayer->pNzc[iMbXy])); //Rec. 9.2.1 for PCM, nzc=161072 memset (pNzc, 16, sizeof (pCurLayer->pNzc[iMbXy])); //Rec. 9.2.1 for PCM, nzc=16
1074 WELS_READ_VERIFY(InitReadBits (pBs, 0));1073 WELS_READ_VERIFY (InitReadBits (pBs, 0));
1075 return 0;1074 return 0;
1076 } else if (0 == uiMbType) { //reference to JM1075 } else if (0 == uiMbType) { //reference to JM
1077 ENFORCE_STACK_ALIGN_1D (int8_t, pIntraPredMode, 48, 16);1076 ENFORCE_STACK_ALIGN_1D (int8_t, pIntraPredMode, 48, 16);
@@ -1101,7 +1100,6 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 23 unmodified lines
1101 WELS_READ_VERIFY (ParseIntra16x16Mode (pCtx, &sNeighAvail, pBs, pCurLayer));1100 WELS_READ_VERIFY (ParseIntra16x16Mode (pCtx, &sNeighAvail, pBs, pCurLayer));
1102 }1101 }
1103 1102
1104 memset (pCurLayer->pScaledTCoeff[iMbXy], 0, 384 * sizeof (pCurLayer->pScaledTCoeff[iMbXy][0]));
1105 ST32A4 (&pNzc[0], 0);1103 ST32A4 (&pNzc[0], 0);
1106 ST32A4 (&pNzc[4], 0);1104 ST32A4 (&pNzc[4], 0);
1107 ST32A4 (&pNzc[8], 0);1105 ST32A4 (&pNzc[8], 0);
@@ -1117,6 +1115,7 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 9 unmodified lines
1117 }1115 }
1118 1116
1119 if (pCurLayer->pCbp[iMbXy] || MB_TYPE_INTRA16x16 == pCurLayer->pMbType[iMbXy]) {1117 if (pCurLayer->pCbp[iMbXy] || MB_TYPE_INTRA16x16 == pCurLayer->pMbType[iMbXy]) {
1118 memset (pCurLayer->pScaledTCoeff[iMbXy], 0, 384 * sizeof (pCurLayer->pScaledTCoeff[iMbXy][0]));
1120 int32_t iQpDelta, iId8x8, iId4x4;1119 int32_t iQpDelta, iId8x8, iId4x4;
1121 1120
1122 WELS_READ_VERIFY (BsGetSe (pBs, &iCode)); //mb_qp_delta1121 WELS_READ_VERIFY (BsGetSe (pBs, &iCode)); //mb_qp_delta
@@ -1551,16 +1550,16 @@ int32_t WelsDecodeMbCavlcPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 428 unmodified lines
1551 1550
1552 pCurLayer->pInterPredictionDoneFlag[iMbXy] = 0;1551 pCurLayer->pInterPredictionDoneFlag[iMbXy] = 0;
1553 memset (pCurLayer->pRefIndex[0][iMbXy], 0, sizeof (int8_t) * 16);1552 memset (pCurLayer->pRefIndex[0][iMbXy], 0, sizeof (int8_t) * 16);
1554 pCtx->bMbRefConcealed = pCtx->bRPLRError || pCtx->bMbRefConcealed || !(ppRefPic[0]&&ppRefPic[0]->bIsComplete);1553 pCtx->bMbRefConcealed = pCtx->bRPLRError || pCtx->bMbRefConcealed || ! (ppRefPic[0] && ppRefPic[0]->bIsComplete);
1555 //predict iMv1554 //predict iMv
1556 PredPSkipMvFromNeighbor (pCurLayer, iMv);1555 PredPSkipMvFromNeighbor (pCurLayer, iMv);
1557 for (i = 0; i < 16; i++) {1556 for (i = 0; i < 16; i++) {
1558 ST32A2 (pCurLayer->pMv[0][iMbXy][i], * (uint32_t*)iMv);1557 ST32A2 (pCurLayer->pMv[0][iMbXy][i], * (uint32_t*)iMv);
1559 }1558 }
1560 1559
1561 if (!pSlice->sSliceHeaderExt.bDefaultResidualPredFlag) {1560 //if (!pSlice->sSliceHeaderExt.bDefaultResidualPredFlag) {
1562 memset (pCurLayer->pScaledTCoeff[iMbXy], 0, 384 * sizeof (int16_t));1561 // memset (pCurLayer->pScaledTCoeff[iMbXy], 0, 384 * sizeof (int16_t));
1563 }1562 //}
1564 1563
1565 //reset rS1564 //reset rS
1566 if (!pSlice->sSliceHeaderExt.bDefaultResidualPredFlag ||1565 if (!pSlice->sSliceHeaderExt.bDefaultResidualPredFlag ||

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t