History

Merge pull request #1657 from mstorsjo/clip-bitrate

Make sure the random test bitrate is high enough

sijchen committed 11 years ago

Commit 9a602ca2 parents 397c7ca 887b4f416 files · +705 −79Browse files

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

Unified · Split

codec/decoder/core/src/decode_slice.cpp+108−23
@@ -197,8 +197,8 @@ int32_t WelsMbInterConstruction (PWelsDecoderContext pCtx, PDqLayer pCurLayer) { · 196 unmodified lines
197 return 0;197 return 0;
198}198}
199 199
200void WelsLumaDcDequantIdct (int16_t* pBlock, int32_t iQp) {200void WelsLumaDcDequantIdct (int16_t* pBlock, int32_t iQp, PWelsDecoderContext pCtx) {
201 const int32_t kiQMul = g_kuiDequantCoeff[iQp][0];201 const int32_t kiQMul = pCtx->bUseScalingList ? pCtx->pDequant_coeff4x4[0][iQp][0] >> 4 : g_kuiDequantCoeff[iQp][0];
202#define STRIDE 16202#define STRIDE 16
203 int32_t i;203 int32_t i;
204 int32_t iTemp[16]; //FIXME check if this is a good idea204 int32_t iTemp[16]; //FIXME check if this is a good idea
@@ -246,7 +246,7 @@ int32_t WelsMbIntraPredictionConstruction (PWelsDecoderContext pCtx, PDqLayer pC · 41 unmodified lines
246 WelsFillRecNeededMbInfo (pCtx, bOutput, pCurLayer);246 WelsFillRecNeededMbInfo (pCtx, bOutput, pCurLayer);
247 247
248 if (IS_INTRA16x16 (pCurLayer->pMbType[iMbXy])) {248 if (IS_INTRA16x16 (pCurLayer->pMbType[iMbXy])) {
249 WelsLumaDcDequantIdct (pCurLayer->pScaledTCoeff[iMbXy], pCurLayer->pLumaQp[iMbXy]);249 WelsLumaDcDequantIdct (pCurLayer->pScaledTCoeff[iMbXy], pCurLayer->pLumaQp[iMbXy], pCtx);
250 RecI16x16Mb (iMbXy, pCtx, pCurLayer->pScaledTCoeff[iMbXy], pCurLayer);250 RecI16x16Mb (iMbXy, pCtx, pCurLayer->pScaledTCoeff[iMbXy], pCurLayer);
251 251
252 return 0;252 return 0;
@@ -596,7 +596,8 @@ int32_t WelsDecodeMbCabacISliceBaseMode0 (PWelsDecoderContext pCtx, uint32_t& ui · 343 unmodified lines
596 for (iId4x4 = 0; iId4x4 < 4; iId4x4++) {596 for (iId4x4 = 0; iId4x4 < 4; iId4x4++) {
597 //Luma (DC and AC decoding together)597 //Luma (DC and AC decoding together)
598 WELS_READ_VERIFY (ParseResidualBlockCabac (&sNeighAvail, pNonZeroCount, pBsAux, iIdx, iScanIdxEnd - iScanIdxStart + 1,598 WELS_READ_VERIFY (ParseResidualBlockCabac (&sNeighAvail, pNonZeroCount, pBsAux, iIdx, iScanIdxEnd - iScanIdxStart + 1,
599 g_kuiZigzagScan + iScanIdxStart, LUMA_DC_AC, pCurLayer->pScaledTCoeff[iMbXy] + (iIdx << 4), pCurLayer->pLumaQp[iMbXy],599 g_kuiZigzagScan + iScanIdxStart, LUMA_DC_AC_INTRA, pCurLayer->pScaledTCoeff[iMbXy] + (iIdx << 4),
600 pCurLayer->pLumaQp[iMbXy],
600 pCtx));601 pCtx));
601 iIdx++;602 iIdx++;
602 }603 }
@@ -610,25 +611,26 @@ int32_t WelsDecodeMbCabacISliceBaseMode0 (PWelsDecoderContext pCtx, uint32_t& ui · 7 unmodified lines
610 ST32 (&pCurLayer->pNzc[iMbXy][8], LD32 (&pNonZeroCount[1 + 8 * 3]));611 ST32 (&pCurLayer->pNzc[iMbXy][8], LD32 (&pNonZeroCount[1 + 8 * 3]));
611 ST32 (&pCurLayer->pNzc[iMbXy][12], LD32 (&pNonZeroCount[1 + 8 * 4]));612 ST32 (&pCurLayer->pNzc[iMbXy][12], LD32 (&pNonZeroCount[1 + 8 * 4]));
612 }613 }
613 614 int32_t iMbResProperty;
614 //chroma615 //chroma
615 //step1: DC616 //step1: DC
616 if (1 == uiCbpChroma || 2 == uiCbpChroma) {617 if (1 == uiCbpChroma || 2 == uiCbpChroma) {
617 //Cb Cr618 //Cb Cr
618 WELS_READ_VERIFY (ParseResidualBlockCabac (&sNeighAvail, pNonZeroCount, pBsAux, 16 + (0 << 2), 4, g_kuiChromaDcScan,619 for (i = 0; i < 2; i++) {
619 CHROMA_DC_V, pCurLayer->pScaledTCoeff[iMbXy] + 256 + (0 << 6), pCurLayer->pChromaQp[iMbXy], pCtx));620 iMbResProperty = i ? CHROMA_DC_V : CHROMA_DC_U;
620 WELS_READ_VERIFY (ParseResidualBlockCabac (&sNeighAvail, pNonZeroCount, pBsAux, 16 + (1 << 2), 4, g_kuiChromaDcScan,621 WELS_READ_VERIFY (ParseResidualBlockCabac (&sNeighAvail, pNonZeroCount, pBsAux, 16 + (i << 2), 4, g_kuiChromaDcScan,
621 CHROMA_DC_U, pCurLayer->pScaledTCoeff[iMbXy] + 256 + (1 << 6), pCurLayer->pChromaQp[iMbXy], pCtx));622 iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + 256 + (i << 6), pCurLayer->pChromaQp[iMbXy], pCtx));
623 }
622 }624 }
623 625
624 //step2: AC626 //step2: AC
625 if (2 == uiCbpChroma) {627 if (2 == uiCbpChroma) {
626 for (i = 0; i < 2; i++) { //Cb Cr628 for (i = 0; i < 2; i++) { //Cb Cr
627 int32_t iResProperty = i ? CHROMA_AC_V : CHROMA_AC_U;629 iMbResProperty = i ? CHROMA_AC_V : CHROMA_AC_U;
628 int32_t iIdx = 16 + (i << 2);630 int32_t iIdx = 16 + (i << 2);
629 for (iId4x4 = 0; iId4x4 < 4; iId4x4++) {631 for (iId4x4 = 0; iId4x4 < 4; iId4x4++) {
630 WELS_READ_VERIFY (ParseResidualBlockCabac (&sNeighAvail, pNonZeroCount, pBsAux, iIdx,632 WELS_READ_VERIFY (ParseResidualBlockCabac (&sNeighAvail, pNonZeroCount, pBsAux, iIdx,
631 iScanIdxEnd - WELS_MAX (iScanIdxStart, 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1), iResProperty,633 iScanIdxEnd - WELS_MAX (iScanIdxStart, 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1), iMbResProperty,
632 pCurLayer->pScaledTCoeff[iMbXy] + (iIdx << 4), pCurLayer->pChromaQp[iMbXy], pCtx));634 pCurLayer->pScaledTCoeff[iMbXy] + (iIdx << 4), pCurLayer->pChromaQp[iMbXy], pCtx));
633 iIdx++;635 iIdx++;
634 }636 }
@@ -673,7 +675,7 @@ int32_t WelsDecodeMbCabacPSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 38 unmodified lines
673 int32_t iScanIdxStart = pSlice->sSliceHeaderExt.uiScanIdxStart;675 int32_t iScanIdxStart = pSlice->sSliceHeaderExt.uiScanIdxStart;
674 int32_t iScanIdxEnd = pSlice->sSliceHeaderExt.uiScanIdxEnd;676 int32_t iScanIdxEnd = pSlice->sSliceHeaderExt.uiScanIdxEnd;
675 int32_t iMbXy = pCurLayer->iMbXyIndex;677 int32_t iMbXy = pCurLayer->iMbXyIndex;
676 678 int32_t iMbResProperty;
677 int32_t i;679 int32_t i;
678 uint32_t uiMbType = 0, uiCbp = 0, uiCbpLuma = 0, uiCbpChroma = 0;680 uint32_t uiMbType = 0, uiCbp = 0, uiCbpLuma = 0, uiCbpChroma = 0;
679 681
@@ -723,6 +725,21 @@ int32_t WelsDecodeMbCabacPSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 43 unmodified lines
723 }725 }
724 }726 }
725 727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
726 ST32 (&pCurLayer->pNzc[iMbXy][0], 0);743 ST32 (&pCurLayer->pNzc[iMbXy][0], 0);
727 ST32 (&pCurLayer->pNzc[iMbXy][4], 0);744 ST32 (&pCurLayer->pNzc[iMbXy][4], 0);
728 ST32 (&pCurLayer->pNzc[iMbXy][8], 0);745 ST32 (&pCurLayer->pNzc[iMbXy][8], 0);
@@ -774,13 +791,15 @@ int32_t WelsDecodeMbCabacPSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 45 unmodified lines
774 ST32 (&pCurLayer->pNzc[iMbXy][12], 0);791 ST32 (&pCurLayer->pNzc[iMbXy][12], 0);
775 }792 }
776 } else { //non-MB_TYPE_INTRA16x16793 } else { //non-MB_TYPE_INTRA16x16
794 iMbResProperty = (IS_INTRA (pCurLayer->pMbType[iMbXy])) ? LUMA_DC_AC_INTRA : LUMA_DC_AC_INTER;
777 for (iId8x8 = 0; iId8x8 < 4; iId8x8++) {795 for (iId8x8 = 0; iId8x8 < 4; iId8x8++) {
778 if (uiCbpLuma & (1 << iId8x8)) {796 if (uiCbpLuma & (1 << iId8x8)) {
779 int32_t iIdx = (iId8x8 << 2);797 int32_t iIdx = (iId8x8 << 2);
780 for (iId4x4 = 0; iId4x4 < 4; iId4x4++) {798 for (iId4x4 = 0; iId4x4 < 4; iId4x4++) {
781 //Luma (DC and AC decoding together)799 //Luma (DC and AC decoding together)
782 WELS_READ_VERIFY (ParseResidualBlockCabac (pNeighAvail, pNonZeroCount, pBsAux, iIdx, iScanIdxEnd - iScanIdxStart + 1,800 WELS_READ_VERIFY (ParseResidualBlockCabac (pNeighAvail, pNonZeroCount, pBsAux, iIdx, iScanIdxEnd - iScanIdxStart + 1,
783 g_kuiZigzagScan + iScanIdxStart, LUMA_DC_AC, pCurLayer->pScaledTCoeff[iMbXy] + (iIdx << 4), pCurLayer->pLumaQp[iMbXy],801 g_kuiZigzagScan + iScanIdxStart, iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + (iIdx << 4),
802 pCurLayer->pLumaQp[iMbXy],
784 pCtx));803 pCtx));
785 iIdx++;804 iIdx++;
786 }805 }
@@ -799,20 +818,27 @@ int32_t WelsDecodeMbCabacPSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 12 unmodified lines
799 //step1: DC818 //step1: DC
800 if (1 == uiCbpChroma || 2 == uiCbpChroma) {819 if (1 == uiCbpChroma || 2 == uiCbpChroma) {
801 for (i = 0; i < 2; i++) {820 for (i = 0; i < 2; i++) {
802 int32_t iResProperty = i ? CHROMA_DC_V : CHROMA_DC_U;821 if (IS_INTRA (pCurLayer->pMbType[iMbXy]))
822 iMbResProperty = i ? CHROMA_DC_V : CHROMA_DC_U;
823 else
824 iMbResProperty = i ? CHROMA_DC_V_INTER : CHROMA_DC_U_INTER;
825
803 WELS_READ_VERIFY (ParseResidualBlockCabac (pNeighAvail, pNonZeroCount, pBsAux, 16 + (i << 2), 4, g_kuiChromaDcScan,826 WELS_READ_VERIFY (ParseResidualBlockCabac (pNeighAvail, pNonZeroCount, pBsAux, 16 + (i << 2), 4, g_kuiChromaDcScan,
804 iResProperty, pCurLayer->pScaledTCoeff[iMbXy] + 256 + (i << 6), pCurLayer->pChromaQp[iMbXy], pCtx));827 iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + 256 + (i << 6), pCurLayer->pChromaQp[iMbXy], pCtx));
805 }828 }
806 }829 }
807 //step2: AC830 //step2: AC
808 if (2 == uiCbpChroma) {831 if (2 == uiCbpChroma) {
809 for (i = 0; i < 2; i++) {832 for (i = 0; i < 2; i++) {
810 int32_t iResProperty = i ? CHROMA_AC_V : CHROMA_AC_U;833 if (IS_INTRA (pCurLayer->pMbType[iMbXy]))
834 iMbResProperty = i ? CHROMA_AC_V : CHROMA_AC_U;
835 else
836 iMbResProperty = i ? CHROMA_AC_V_INTER : CHROMA_AC_U_INTER;
811 int32_t index = 16 + (i << 2);837 int32_t index = 16 + (i << 2);
812 for (iId4x4 = 0; iId4x4 < 4; iId4x4++) {838 for (iId4x4 = 0; iId4x4 < 4; iId4x4++) {
813 WELS_READ_VERIFY (ParseResidualBlockCabac (pNeighAvail, pNonZeroCount, pBsAux, index,839 WELS_READ_VERIFY (ParseResidualBlockCabac (pNeighAvail, pNonZeroCount, pBsAux, index,
814 iScanIdxEnd - WELS_MAX (iScanIdxStart, 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1),840 iScanIdxEnd - WELS_MAX (iScanIdxStart, 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1),
815 iResProperty, pCurLayer->pScaledTCoeff[iMbXy] + (index << 4), pCurLayer->pChromaQp[iMbXy], pCtx));841 iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + (index << 4), pCurLayer->pChromaQp[iMbXy], pCtx));
816 index++;842 index++;
817 }843 }
818 }844 }
@@ -893,6 +919,46 @@ int32_t WelsDecodeMbCabacPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 74 unmodified lines
893 WELS_READ_VERIFY (WelsDecodeMbCabacPSliceBaseMode0 (pCtx, &uiNeighAvail, uiEosFlag));919 WELS_READ_VERIFY (WelsDecodeMbCabacPSliceBaseMode0 (pCtx, &uiNeighAvail, uiEosFlag));
894 return ERR_NONE;920 return ERR_NONE;
895}921}
922// Calculate deqaunt coeff scaling list value
923int32_t WelsCalcDeqCoeffScalingList (PWelsDecoderContext pCtx) {
924 int32_t iScalingListNum = 0;
925 if (pCtx->pSps->bSeqScalingMatrixPresentFlag || pCtx->pPps->bPicScalingMatrixPresentFlag) {
926 pCtx->bUseScalingList = true;
927 iScalingListNum = (pCtx->pSps->uiChromaFormatIdc != 3) ? 8 : 12;
928
929 if (!pCtx->bDequantCoeff4x4Init || (pCtx->iDequantCoeffPpsid != pCtx->pPps->iPpsId)) {
930 int i, q, x;
931 // Rewrite pps scaling list for scalingList present flag=0
932 if (pCtx->bSpsLatePps) {
933 for (i = 0; i < 6; i++) {
934 if (!pCtx->pSps->bSeqScalingListPresentFlag[i]) {
935 if (i == 0 || i == 3)
936 memcpy (pCtx->pPps->iScalingList4x4[i], pCtx->pSps->iScalingList4x4[i], 16 * sizeof (uint8_t));
937 else
938 memcpy (pCtx->pPps->iScalingList4x4[i], pCtx->pPps->iScalingList4x4[i - 1], 16 * sizeof (uint8_t));
939
940 }
941 }
942 //TO DO, SUPPORT 8x8 SCALINGlist
943
944 }
945 //Init dequant coeff value for different QP
946 for (i = 0; i < 6; i++) {
947 pCtx->pDequant_coeff4x4[i] = pCtx->pDequant_coeff_buffer4x4[i];
948 for (q = 0; q < 51; q++) {
949 for (x = 0; x < 16; x++) {
950 pCtx->pDequant_coeff4x4[i][q][x] = pCtx->pPps->bPicScalingMatrixPresentFlag ? pCtx->pPps->iScalingList4x4[i][x] *
951 g_kuiDequantCoeff[q][x & 0x07] : pCtx->pSps->iScalingList4x4[i][x] * g_kuiDequantCoeff[q][x & 0x07];
952 }
953 }
954 }
955
956 pCtx->bDequantCoeff4x4Init = true;
957 }
958 } else
959 pCtx->bUseScalingList = false;
960 return ERR_NONE;
961}
896 962
897int32_t WelsDecodeSlice (PWelsDecoderContext pCtx, bool bFirstSliceInLayer, PNalUnit pNalCur) {963int32_t WelsDecodeSlice (PWelsDecoderContext pCtx, bool bFirstSliceInLayer, PNalUnit pNalCur) {
898 PDqLayer pCurLayer = pCtx->pCurDqLayer;964 PDqLayer pCurLayer = pCtx->pCurDqLayer;
@@ -950,6 +1016,8 @@ int32_t WelsDecodeSlice (PWelsDecoderContext pCtx, bool bFirstSliceInLayer, PNal · 51 unmodified lines
950 pSlice->iLastDeltaQp = 0;1016 pSlice->iLastDeltaQp = 0;
951 WELS_READ_VERIFY (InitCabacDecEngineFromBS (pCtx->pCabacDecEngine, pCtx->pCurDqLayer->pBitStringAux));1017 WELS_READ_VERIFY (InitCabacDecEngineFromBS (pCtx->pCabacDecEngine, pCtx->pCurDqLayer->pBitStringAux));
952 }1018 }
1019 //try to calculate the dequant_coeff
1020 WelsCalcDeqCoeffScalingList (pCtx);
953 1021
954 iNextMbXyIndex = pSliceHeader->iFirstMbInSlice;1022 iNextMbXyIndex = pSliceHeader->iFirstMbInSlice;
955 iMbX = iNextMbXyIndex % pCurLayer->iMbWidth;1023 iMbX = iNextMbXyIndex % pCurLayer->iMbWidth;
@@ -1001,6 +1069,7 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 45 unmodified lines
1001 PSliceHeader pSliceHeader = &pSlice->sSliceHeaderExt.sSliceHeader;1069 PSliceHeader pSliceHeader = &pSlice->sSliceHeaderExt.sSliceHeader;
1002 1070
1003 SWelsNeighAvail sNeighAvail;1071 SWelsNeighAvail sNeighAvail;
1072 int32_t iMbResProperty;
1004 1073
1005 int32_t iScanIdxStart = pSlice->sSliceHeaderExt.uiScanIdxStart;1074 int32_t iScanIdxStart = pSlice->sSliceHeaderExt.uiScanIdxStart;
1006 int32_t iScanIdxEnd = pSlice->sSliceHeaderExt.uiScanIdxEnd;1075 int32_t iScanIdxEnd = pSlice->sSliceHeaderExt.uiScanIdxEnd;
@@ -1038,6 +1107,7 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 31 unmodified lines
1038 1107
1039 uint8_t* pTmpBsBuf;1108 uint8_t* pTmpBsBuf;
1040 1109
1110
1041 int32_t i;1111 int32_t i;
1042 int32_t iCopySizeY = (sizeof (uint8_t) << 4);1112 int32_t iCopySizeY = (sizeof (uint8_t) << 4);
1043 int32_t iCopySizeUV = (sizeof (uint8_t) << 3);1113 int32_t iCopySizeUV = (sizeof (uint8_t) << 3);
@@ -1165,7 +1235,7 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 121 unmodified lines
1165 //Luma (DC and AC decoding together)1235 //Luma (DC and AC decoding together)
1166 if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex,1236 if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex,
1167 iScanIdxEnd - iScanIdxStart + 1, g_kuiZigzagScan + iScanIdxStart,1237 iScanIdxEnd - iScanIdxStart + 1, g_kuiZigzagScan + iScanIdxStart,
1168 LUMA_DC_AC, pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), pCurLayer->pLumaQp[iMbXy], pCtx)) {1238 LUMA_DC_AC_INTRA, pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), pCurLayer->pLumaQp[iMbXy], pCtx)) {
1169 return -1;//abnormal1239 return -1;//abnormal
1170 }1240 }
1171 iIndex++;1241 iIndex++;
@@ -1185,8 +1255,9 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 13 unmodified lines
1185 //step1: DC1255 //step1: DC
1186 if (1 == uiCbpC || 2 == uiCbpC) {1256 if (1 == uiCbpC || 2 == uiCbpC) {
1187 for (i = 0; i < 2; i++) { //Cb Cr1257 for (i = 0; i < 2; i++) { //Cb Cr
1258 iMbResProperty = i ? CHROMA_DC_V : CHROMA_DC_U;
1188 if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs,1259 if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs,
1189 16 + (i << 2), 4, g_kuiChromaDcScan, CHROMA_DC, pCurLayer->pScaledTCoeff[iMbXy] + 256 + (i << 6),1260 16 + (i << 2), 4, g_kuiChromaDcScan, iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + 256 + (i << 6),
1190 pCurLayer->pChromaQp[iMbXy], pCtx)) {1261 pCurLayer->pChromaQp[iMbXy], pCtx)) {
1191 return -1;//abnormal1262 return -1;//abnormal
1192 }1263 }
@@ -1196,11 +1267,12 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 3 unmodified lines
1196 //step2: AC1267 //step2: AC
1197 if (2 == uiCbpC) {1268 if (2 == uiCbpC) {
1198 for (i = 0; i < 2; i++) { //Cb Cr1269 for (i = 0; i < 2; i++) { //Cb Cr
1270 iMbResProperty = i ? CHROMA_AC_V : CHROMA_AC_U;
1199 int32_t iIndex = 16 + (i << 2);1271 int32_t iIndex = 16 + (i << 2);
1200 for (iId4x4 = 0; iId4x4 < 4; iId4x4++) {1272 for (iId4x4 = 0; iId4x4 < 4; iId4x4++) {
1201 if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex,1273 if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex,
1202 iScanIdxEnd - WELS_MAX (iScanIdxStart, 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1),1274 iScanIdxEnd - WELS_MAX (iScanIdxStart, 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1),
1203 CHROMA_AC, pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), pCurLayer->pChromaQp[iMbXy], pCtx)) {1275 iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), pCurLayer->pChromaQp[iMbXy], pCtx)) {
1204 return -1;//abnormal1276 return -1;//abnormal
1205 }1277 }
1206 iIndex++;1278 iIndex++;
@@ -1277,6 +1349,8 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 70 unmodified lines
1277 uint32_t uiMbType = 0, uiCbp = 0, uiCbpL = 0, uiCbpC = 0;1349 uint32_t uiMbType = 0, uiCbp = 0, uiCbpL = 0, uiCbpC = 0;
1278 uint32_t uiCode;1350 uint32_t uiCode;
1279 int32_t iCode;1351 int32_t iCode;
1352 int32_t iMbResProperty;
1353
1280 GetNeighborAvailMbType (&sNeighAvail, pCurLayer);1354 GetNeighborAvailMbType (&sNeighAvail, pCurLayer);
1281 ENFORCE_STACK_ALIGN_1D (uint8_t, pNonZeroCount, 48, 16);1355 ENFORCE_STACK_ALIGN_1D (uint8_t, pNonZeroCount, 48, 16);
1282 pCurLayer->pInterPredictionDoneFlag[iMbXy] = 0;//2009.10.231356 pCurLayer->pInterPredictionDoneFlag[iMbXy] = 0;//2009.10.23
@@ -1461,12 +1535,13 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 178 unmodified lines
1461 }1535 }
1462 } else { //non-MB_TYPE_INTRA16x161536 } else { //non-MB_TYPE_INTRA16x16
1463 for (iId8x8 = 0; iId8x8 < 4; iId8x8++) {1537 for (iId8x8 = 0; iId8x8 < 4; iId8x8++) {
1538 iMbResProperty = (IS_INTRA (pCurLayer->pMbType[iMbXy])) ? LUMA_DC_AC_INTRA : LUMA_DC_AC_INTER;
1464 if (uiCbpL & (1 << iId8x8)) {1539 if (uiCbpL & (1 << iId8x8)) {
1465 int32_t iIndex = (iId8x8 << 2);1540 int32_t iIndex = (iId8x8 << 2);
1466 for (iId4x4 = 0; iId4x4 < 4; iId4x4++) {1541 for (iId4x4 = 0; iId4x4 < 4; iId4x4++) {
1467 //Luma (DC and AC decoding together)1542 //Luma (DC and AC decoding together)
1468 if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex,1543 if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex,
1469 iScanIdxEnd - iScanIdxStart + 1, g_kuiZigzagScan + iScanIdxStart, LUMA_DC_AC,1544 iScanIdxEnd - iScanIdxStart + 1, g_kuiZigzagScan + iScanIdxStart, iMbResProperty,
1470 pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), pCurLayer->pLumaQp[iMbXy], pCtx)) {1545 pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), pCurLayer->pLumaQp[iMbXy], pCtx)) {
1471 return -1;//abnormal1546 return -1;//abnormal
1472 }1547 }
@@ -1488,8 +1563,13 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 15 unmodified lines
1488 //step1: DC1563 //step1: DC
1489 if (1 == uiCbpC || 2 == uiCbpC) {1564 if (1 == uiCbpC || 2 == uiCbpC) {
1490 for (i = 0; i < 2; i++) { //Cb Cr1565 for (i = 0; i < 2; i++) { //Cb Cr
1566 if (IS_INTRA (pCurLayer->pMbType[iMbXy]))
1567 iMbResProperty = i ? CHROMA_DC_V : CHROMA_DC_U;
1568 else
1569 iMbResProperty = i ? CHROMA_DC_V_INTER : CHROMA_DC_U_INTER;
1570
1491 if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs,1571 if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs,
1492 16 + (i << 2), 4, g_kuiChromaDcScan, CHROMA_DC, pCurLayer->pScaledTCoeff[iMbXy] + 256 + (i << 6),1572 16 + (i << 2), 4, g_kuiChromaDcScan, iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + 256 + (i << 6),
1493 pCurLayer->pChromaQp[iMbXy], pCtx)) {1573 pCurLayer->pChromaQp[iMbXy], pCtx)) {
1494 return -1;//abnormal1574 return -1;//abnormal
1495 }1575 }
@@ -1499,11 +1579,16 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 3 unmodified lines
1499 //step2: AC1579 //step2: AC
1500 if (2 == uiCbpC) {1580 if (2 == uiCbpC) {
1501 for (i = 0; i < 2; i++) { //Cb Cr1581 for (i = 0; i < 2; i++) { //Cb Cr
1582 if (IS_INTRA (pCurLayer->pMbType[iMbXy]))
1583 iMbResProperty = i ? CHROMA_AC_V : CHROMA_AC_U;
1584 else
1585 iMbResProperty = i ? CHROMA_AC_V_INTER : CHROMA_AC_U_INTER;
1586
1502 int32_t iIndex = 16 + (i << 2);1587 int32_t iIndex = 16 + (i << 2);
1503 for (iId4x4 = 0; iId4x4 < 4; iId4x4++) {1588 for (iId4x4 = 0; iId4x4 < 4; iId4x4++) {
1504 if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex,1589 if (WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex,
1505 iScanIdxEnd - WELS_MAX (iScanIdxStart, 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1),1590 iScanIdxEnd - WELS_MAX (iScanIdxStart, 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1),
1506 CHROMA_AC, pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), pCurLayer->pChromaQp[iMbXy], pCtx)) {1591 iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), pCurLayer->pChromaQp[iMbXy], pCtx)) {
1507 return -1;//abnormal1592 return -1;//abnormal
1508 }1593 }
1509 iIndex++;1594 iIndex++;

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