History

to support monochroma

add mbtype judge logic

zhuiling committed 11 years ago

Commit 0a8a4f21 parent a00dd565 files · +65 −39Browse files

Showing the changes to codec/decoder (5 of 5 files). Show all

Unified · Split

5 files
  1. codec/decoder/core/inc/dec_golomb.h +2 −0
  2. codec/decoder/core/src/au_parser.cpp +9 −3
  3. codec/decoder/core/src/decode_slice.cpp +39 −36
  4. codec/decoder/core/src/decoder_data_tables.cpp +9 −0
  5. codec/decoder/core/src/parse_mb_syn_cabac.cpp +6 −0
codec/decoder/core/inc/dec_golomb.h+2−0
@@ -89,7 +89,9 @@ static inline int32_t BsGetBits (PBitStringAux pBs, int32_t iNumBits, uint32_t* · 88 unmodified lines
89 89
90// for data sharing cross modules and try to reduce size of binary generated, 12/10/200990// for data sharing cross modules and try to reduce size of binary generated, 12/10/2009
91extern const uint8_t g_kuiIntra4x4CbpTable[48];91extern const uint8_t g_kuiIntra4x4CbpTable[48];
92 extern const uint8_t g_kuiIntra4x4CbpTable400[16];
92extern const uint8_t g_kuiInterCbpTable[48];93extern const uint8_t g_kuiInterCbpTable[48];
94 extern const uint8_t g_kuiInterCbpTable400[16];
93 95
94extern const uint8_t g_kuiLeadingZeroTable[256];96extern const uint8_t g_kuiLeadingZeroTable[256];
95 97
codec/decoder/core/src/au_parser.cpp+9−3
@@ -936,11 +936,17 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 935 unmodified lines
936 936
937 WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //chroma_format_idc937 WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //chroma_format_idc
938 pSps->uiChromaFormatIdc = uiCode;938 pSps->uiChromaFormatIdc = uiCode;
939 if (pSps->uiChromaFormatIdc != 1) {939// if (pSps->uiChromaFormatIdc != 1) {
940 WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "ParseSps(): chroma_format_idc (%d) = 1 supported.",940// WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "ParseSps(): chroma_format_idc (%d) = 1 supported.",
941// pSps->uiChromaFormatIdc);
942// return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_NON_BASELINE);
943// }
944 if (pSps->uiChromaFormatIdc > 1) {
945 WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "ParseSps(): chroma_format_idc (%d) <=1 supported.",
941 pSps->uiChromaFormatIdc);946 pSps->uiChromaFormatIdc);
942 return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_NON_BASELINE);947 return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_UNSUPPORTED_NON_BASELINE);
943 }948
949 }// To support 4:0:0; 4:2:0
944 pSps->uiChromaArrayType = pSps->uiChromaFormatIdc;950 pSps->uiChromaArrayType = pSps->uiChromaFormatIdc;
945 WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //bit_depth_luma_minus8951 WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //bit_depth_luma_minus8
946 if (uiCode != 0) {952 if (uiCode != 0) {
codec/decoder/core/src/decode_slice.cpp+39−36
@@ -444,6 +444,10 @@ int32_t ParseIntra4x4Mode (PWelsDecoderContext pCtx, PWelsNeighAvail pNeighAvail · 443 unmodified lines
444 pCurDqLayer->pIntraPredMode[iMbXy][4] = pIntraPredMode[4 + 8 * 1];444 pCurDqLayer->pIntraPredMode[iMbXy][4] = pIntraPredMode[4 + 8 * 1];
445 pCurDqLayer->pIntraPredMode[iMbXy][5] = pIntraPredMode[4 + 8 * 2];445 pCurDqLayer->pIntraPredMode[iMbXy][5] = pIntraPredMode[4 + 8 * 2];
446 pCurDqLayer->pIntraPredMode[iMbXy][6] = pIntraPredMode[4 + 8 * 3];446 pCurDqLayer->pIntraPredMode[iMbXy][6] = pIntraPredMode[4 + 8 * 3];
447
448 if (pCtx->pSps->uiChromaFormatIdc == 0)//no need parse chroma
449 return ERR_NONE;
450
447 if (pCurDqLayer->sLayerInfo.pPps->bEntropyCodingModeFlag) {451 if (pCurDqLayer->sLayerInfo.pPps->bEntropyCodingModeFlag) {
448 WELS_READ_VERIFY (ParseIntraPredModeChromaCabac (pCtx, uiNeighAvail, iCode));452 WELS_READ_VERIFY (ParseIntraPredModeChromaCabac (pCtx, uiNeighAvail, iCode));
449 if (iCode > MAX_PRED_MODE_ID_CHROMA) {453 if (iCode > MAX_PRED_MODE_ID_CHROMA) {
@@ -462,7 +466,6 @@ int32_t ParseIntra4x4Mode (PWelsDecoderContext pCtx, PWelsNeighAvail pNeighAvail · 12 unmodified lines
462 || CheckIntraChromaPredMode (uiNeighAvail, &pCurDqLayer->pChromaPredMode[iMbXy])) {466 || CheckIntraChromaPredMode (uiNeighAvail, &pCurDqLayer->pChromaPredMode[iMbXy])) {
463 return ERR_INFO_INVALID_I_CHROMA_PRED_MODE;467 return ERR_INFO_INVALID_I_CHROMA_PRED_MODE;
464 }468 }
465
466 return ERR_NONE;469 return ERR_NONE;
467}470}
468 471
@@ -478,6 +481,9 @@ int32_t ParseIntra16x16Mode (PWelsDecoderContext pCtx, PWelsNeighAvail pNeighAva · 9 unmodified lines
478 &pCurDqLayer->pIntraPredMode[iMbXy][7])) { //invalid iPredMode, must stop decoding481 &pCurDqLayer->pIntraPredMode[iMbXy][7])) { //invalid iPredMode, must stop decoding
479 return ERR_INFO_INVALID_I16x16_PRED_MODE;482 return ERR_INFO_INVALID_I16x16_PRED_MODE;
480 }483 }
484 if (pCtx->pSps->uiChromaFormatIdc == 0)
485 return ERR_NONE;
486
481 if (pCurDqLayer->sLayerInfo.pPps->bEntropyCodingModeFlag) {487 if (pCurDqLayer->sLayerInfo.pPps->bEntropyCodingModeFlag) {
482 WELS_READ_VERIFY (ParseIntraPredModeChromaCabac (pCtx, uiNeighAvail, iCode));488 WELS_READ_VERIFY (ParseIntraPredModeChromaCabac (pCtx, uiNeighAvail, iCode));
483 if (iCode > MAX_PRED_MODE_ID_CHROMA) {489 if (iCode > MAX_PRED_MODE_ID_CHROMA) {
@@ -519,6 +525,9 @@ int32_t WelsDecodeMbCabacISliceBaseMode0 (PWelsDecoderContext pCtx, uint32_t& ui · 35 unmodified lines
519 WELS_READ_VERIFY (ParseMBTypeISliceCabac (pCtx, &sNeighAvail, uiMbType));525 WELS_READ_VERIFY (ParseMBTypeISliceCabac (pCtx, &sNeighAvail, uiMbType));
520 if (uiMbType > 25) {526 if (uiMbType > 25) {
521 return ERR_INFO_INVALID_MB_TYPE;527 return ERR_INFO_INVALID_MB_TYPE;
528 } else if (!pCtx->pSps->uiChromaFormatIdc && ((uiMbType >= 5 && uiMbType <= 12) || (uiMbType >= 17
529 && uiMbType <= 24))) {
530 return ERR_INFO_INVALID_MB_TYPE;
522 } else if (25 == uiMbType) { //I_PCM531 } else if (25 == uiMbType) { //I_PCM
523 WELS_READ_VERIFY (ParseIPCMInfoCabac (pCtx));532 WELS_READ_VERIFY (ParseIPCMInfoCabac (pCtx));
524 pSlice->iLastDeltaQp = 0;533 pSlice->iLastDeltaQp = 0;
@@ -536,19 +545,18 @@ int32_t WelsDecodeMbCabacISliceBaseMode0 (PWelsDecoderContext pCtx, uint32_t& ui · 11 unmodified lines
536 WELS_READ_VERIFY (ParseCbpInfoCabac (pCtx, &sNeighAvail, uiCbp));545 WELS_READ_VERIFY (ParseCbpInfoCabac (pCtx, &sNeighAvail, uiCbp));
537 pCurLayer->pCbp[iMbXy] = uiCbp;546 pCurLayer->pCbp[iMbXy] = uiCbp;
538 pSlice->iLastDeltaQp = uiCbp == 0 ? 0 : pSlice->iLastDeltaQp;547 pSlice->iLastDeltaQp = uiCbp == 0 ? 0 : pSlice->iLastDeltaQp;
539 uiCbpChroma = uiCbp >> 4;548 uiCbpChroma = pCtx->pSps->uiChromaFormatIdc ? uiCbp >> 4 : 0;
540 uiCbpLuma = uiCbp & 15;549 uiCbpLuma = uiCbp & 15;
541 } else { //I16x16;550 } else { //I16x16;
542 pCurLayer->pMbType[iMbXy] = MB_TYPE_INTRA16x16;551 pCurLayer->pMbType[iMbXy] = MB_TYPE_INTRA16x16;
543 pCurLayer->pIntraPredMode[iMbXy][7] = (uiMbType - 1) & 3;552 pCurLayer->pIntraPredMode[iMbXy][7] = (uiMbType - 1) & 3;
544 pCurLayer->pCbp[iMbXy] = g_kuiI16CbpTable[ (uiMbType - 1) >> 2];553 pCurLayer->pCbp[iMbXy] = g_kuiI16CbpTable[ (uiMbType - 1) >> 2];
545 uiCbpChroma = pCurLayer->pCbp[iMbXy] >> 4;554 uiCbpChroma = pCtx->pSps->uiChromaFormatIdc ? pCurLayer->pCbp[iMbXy] >> 4 : 0 ;
546 uiCbpLuma = pCurLayer->pCbp[iMbXy] & 15;555 uiCbpLuma = pCurLayer->pCbp[iMbXy] & 15;
547 WelsFillCacheNonZeroCount (&sNeighAvail, pNonZeroCount, pCurLayer);556 WelsFillCacheNonZeroCount (&sNeighAvail, pNonZeroCount, pCurLayer);
548 WELS_READ_VERIFY (ParseIntra16x16Mode (pCtx, &sNeighAvail, pBsAux, pCurLayer));557 WELS_READ_VERIFY (ParseIntra16x16Mode (pCtx, &sNeighAvail, pBsAux, pCurLayer));
549 }558 }
550 559
551
552 ST32 (&pCurLayer->pNzc[iMbXy][0], 0);560 ST32 (&pCurLayer->pNzc[iMbXy][0], 0);
553 ST32 (&pCurLayer->pNzc[iMbXy][4], 0);561 ST32 (&pCurLayer->pNzc[iMbXy][4], 0);
554 ST32 (&pCurLayer->pNzc[iMbXy][8], 0);562 ST32 (&pCurLayer->pNzc[iMbXy][8], 0);
@@ -705,9 +713,10 @@ int32_t WelsDecodeMbCabacPSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 150 unmodified lines
705 pCurLayer->pInterPredictionDoneFlag[iMbXy] = 0;713 pCurLayer->pInterPredictionDoneFlag[iMbXy] = 0;
706 } else { //Intra mode714 } else { //Intra mode
707 uiMbType -= 5;715 uiMbType -= 5;
708 if (uiMbType > 25) {716 if (uiMbType > 25)
717 return ERR_INFO_INVALID_MB_TYPE;
718 if (!pCtx->pSps->uiChromaFormatIdc && ((uiMbType >= 5 && uiMbType <= 12) || (uiMbType >= 17 && uiMbType <= 24)))
709 return ERR_INFO_INVALID_MB_TYPE;719 return ERR_INFO_INVALID_MB_TYPE;
710 }
711 720
712 if (25 == uiMbType) { //I_PCM721 if (25 == uiMbType) { //I_PCM
713 WELS_READ_VERIFY (ParseIPCMInfoCabac (pCtx));722 WELS_READ_VERIFY (ParseIPCMInfoCabac (pCtx));
@@ -727,7 +736,7 @@ int32_t WelsDecodeMbCabacPSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 13 unmodified lines
727 pCurLayer->pMbType[iMbXy] = MB_TYPE_INTRA16x16;736 pCurLayer->pMbType[iMbXy] = MB_TYPE_INTRA16x16;
728 pCurLayer->pIntraPredMode[iMbXy][7] = (uiMbType - 1) & 3;737 pCurLayer->pIntraPredMode[iMbXy][7] = (uiMbType - 1) & 3;
729 pCurLayer->pCbp[iMbXy] = g_kuiI16CbpTable[ (uiMbType - 1) >> 2];738 pCurLayer->pCbp[iMbXy] = g_kuiI16CbpTable[ (uiMbType - 1) >> 2];
730 uiCbpChroma = pCurLayer->pCbp[iMbXy] >> 4;739 uiCbpChroma = pCtx->pSps->uiChromaFormatIdc ? pCurLayer->pCbp[iMbXy] >> 4 : 0;
731 uiCbpLuma = pCurLayer->pCbp[iMbXy] & 15;740 uiCbpLuma = pCurLayer->pCbp[iMbXy] & 15;
732 WelsFillCacheNonZeroCount (pNeighAvail, pNonZeroCount, pCurLayer);741 WelsFillCacheNonZeroCount (pNeighAvail, pNonZeroCount, pCurLayer);
733 WELS_READ_VERIFY (ParseIntra16x16Mode (pCtx, pNeighAvail, pBsAux, pCurLayer));742 WELS_READ_VERIFY (ParseIntra16x16Mode (pCtx, pNeighAvail, pBsAux, pCurLayer));
@@ -735,21 +744,6 @@ int32_t WelsDecodeMbCabacPSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 1 unmodified line
735 }744 }
736 }745 }
737 746
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753 ST32 (&pCurLayer->pNzc[iMbXy][0], 0);747 ST32 (&pCurLayer->pNzc[iMbXy][0], 0);
754 ST32 (&pCurLayer->pNzc[iMbXy][4], 0);748 ST32 (&pCurLayer->pNzc[iMbXy][4], 0);
755 ST32 (&pCurLayer->pNzc[iMbXy][8], 0);749 ST32 (&pCurLayer->pNzc[iMbXy][8], 0);
@@ -759,9 +753,10 @@ int32_t WelsDecodeMbCabacPSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 3 unmodified lines
759 753
760 if (MB_TYPE_INTRA16x16 != pCurLayer->pMbType[iMbXy]) {754 if (MB_TYPE_INTRA16x16 != pCurLayer->pMbType[iMbXy]) {
761 WELS_READ_VERIFY (ParseCbpInfoCabac (pCtx, pNeighAvail, uiCbp));755 WELS_READ_VERIFY (ParseCbpInfoCabac (pCtx, pNeighAvail, uiCbp));
756
762 pCurLayer->pCbp[iMbXy] = uiCbp;757 pCurLayer->pCbp[iMbXy] = uiCbp;
763 pSlice->iLastDeltaQp = uiCbp == 0 ? 0 : pSlice->iLastDeltaQp;758 pSlice->iLastDeltaQp = uiCbp == 0 ? 0 : pSlice->iLastDeltaQp;
764 uiCbpChroma = pCurLayer->pCbp[iMbXy] >> 4;759 uiCbpChroma = pCtx->pSps->uiChromaFormatIdc ? pCurLayer->pCbp[iMbXy] >> 4 : 0 ;
765 uiCbpLuma = pCurLayer->pCbp[iMbXy] & 15;760 uiCbpLuma = pCurLayer->pCbp[iMbXy] & 15;
766 }761 }
767 762
@@ -1104,9 +1099,10 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 336 unmodified lines
1104 1099
1105 WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //uiMbType1100 WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //uiMbType
1106 uiMbType = uiCode;1101 uiMbType = uiCode;
1107 if (uiMbType > 25) {1102 if (uiMbType > 25)
1103 return ERR_INFO_INVALID_MB_TYPE;
1104 if (!pCtx->pSps->uiChromaFormatIdc && ((uiMbType >= 5 && uiMbType <= 12) || (uiMbType >= 17 && uiMbType <= 24)))
1108 return ERR_INFO_INVALID_MB_TYPE;1105 return ERR_INFO_INVALID_MB_TYPE;
1109 }
1110 1106
1111 if (25 == uiMbType) {1107 if (25 == uiMbType) {
1112 int32_t iDecStrideL = pCurLayer->pDec->iLinesize[0];1108 int32_t iDecStrideL = pCurLayer->pDec->iLinesize[0];
@@ -1169,11 +1165,15 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 56 unmodified lines
1169 WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //coded_block_pattern1165 WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //coded_block_pattern
1170 uiCbp = uiCode;1166 uiCbp = uiCode;
1171 //G.9.1 Alternative parsing process for coded pBlock pattern1167 //G.9.1 Alternative parsing process for coded pBlock pattern
1172 if (uiCbp > 47)1168 if (pCtx->pSps->uiChromaFormatIdc && (uiCbp > 47))
1169 return ERR_INFO_INVALID_CBP;
1170 if (!pCtx->pSps->uiChromaFormatIdc && (uiCbp > 15))
1173 return ERR_INFO_INVALID_CBP;1171 return ERR_INFO_INVALID_CBP;
1174 1172
1175 uiCbp = g_kuiIntra4x4CbpTable[uiCbp];1173 if (pCtx->pSps->uiChromaFormatIdc)
1176 1174 uiCbp = g_kuiIntra4x4CbpTable[uiCbp];
1175 else
1176 uiCbp = g_kuiIntra4x4CbpTable400[uiCbp];
1177 pCurLayer->pCbp[iMbXy] = uiCbp;1177 pCurLayer->pCbp[iMbXy] = uiCbp;
1178 uiCbpC = uiCbp >> 4;1178 uiCbpC = uiCbp >> 4;
1179 uiCbpL = uiCbp & 15;1179 uiCbpL = uiCbp & 15;
@@ -1181,7 +1181,7 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 1 unmodified line
1181 pCurLayer->pMbType[iMbXy] = MB_TYPE_INTRA16x16;1181 pCurLayer->pMbType[iMbXy] = MB_TYPE_INTRA16x16;
1182 pCurLayer->pIntraPredMode[iMbXy][7] = (uiMbType - 1) & 3;1182 pCurLayer->pIntraPredMode[iMbXy][7] = (uiMbType - 1) & 3;
1183 pCurLayer->pCbp[iMbXy] = g_kuiI16CbpTable[ (uiMbType - 1) >> 2];1183 pCurLayer->pCbp[iMbXy] = g_kuiI16CbpTable[ (uiMbType - 1) >> 2];
1184 uiCbpC = pCurLayer->pCbp[iMbXy] >> 4;1184 uiCbpC = pCtx->pSps->uiChromaFormatIdc ? pCurLayer->pCbp[iMbXy] >> 4 : 0;
1185 uiCbpL = pCurLayer->pCbp[iMbXy] & 15;1185 uiCbpL = pCurLayer->pCbp[iMbXy] & 15;
1186 WelsFillCacheNonZeroCount (&sNeighAvail, pNonZeroCount, pCurLayer);1186 WelsFillCacheNonZeroCount (&sNeighAvail, pNonZeroCount, pCurLayer);
1187 WELS_READ_VERIFY (ParseIntra16x16Mode (pCtx, &sNeighAvail, pBs, pCurLayer));1187 WELS_READ_VERIFY (ParseIntra16x16Mode (pCtx, &sNeighAvail, pBs, pCurLayer));
@@ -1398,9 +1398,10 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 210 unmodified lines
1398 }1398 }
1399 } else { //intra MB type1399 } else { //intra MB type
1400 uiMbType -= 5;1400 uiMbType -= 5;
1401 if (uiMbType > 25) {1401 if (uiMbType > 25)
1402 return ERR_INFO_INVALID_MB_TYPE;
1403 if (!pCtx->pSps->uiChromaFormatIdc && ((uiMbType >= 5 && uiMbType <= 12) || (uiMbType >= 17 && uiMbType <= 24)))
1402 return ERR_INFO_INVALID_MB_TYPE;1404 return ERR_INFO_INVALID_MB_TYPE;
1403 }
1404 1405
1405 if (25 == uiMbType) {1406 if (25 == uiMbType) {
1406 int32_t iDecStrideL = pCurLayer->pDec->iLinesize[0];1407 int32_t iDecStrideL = pCurLayer->pDec->iLinesize[0];
@@ -1471,7 +1472,7 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 64 unmodified lines
1471 pCurLayer->pMbType[iMbXy] = MB_TYPE_INTRA16x16;1472 pCurLayer->pMbType[iMbXy] = MB_TYPE_INTRA16x16;
1472 pCurLayer->pIntraPredMode[iMbXy][7] = (uiMbType - 1) & 3;1473 pCurLayer->pIntraPredMode[iMbXy][7] = (uiMbType - 1) & 3;
1473 pCurLayer->pCbp[iMbXy] = g_kuiI16CbpTable[ (uiMbType - 1) >> 2];1474 pCurLayer->pCbp[iMbXy] = g_kuiI16CbpTable[ (uiMbType - 1) >> 2];
1474 uiCbpC = pCurLayer->pCbp[iMbXy] >> 4;1475 uiCbpC = pCtx->pSps->uiChromaFormatIdc ? pCurLayer->pCbp[iMbXy] >> 4 : 0;
1475 uiCbpL = pCurLayer->pCbp[iMbXy] & 15;1476 uiCbpL = pCurLayer->pCbp[iMbXy] & 15;
1476 WelsFillCacheNonZeroCount (&sNeighAvail, pNonZeroCount, pCurLayer);1477 WelsFillCacheNonZeroCount (&sNeighAvail, pNonZeroCount, pCurLayer);
1477 if (ParseIntra16x16Mode (pCtx, &sNeighAvail, pBs, pCurLayer)) {1478 if (ParseIntra16x16Mode (pCtx, &sNeighAvail, pBs, pCurLayer)) {
@@ -1485,13 +1486,15 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 7 unmodified lines
1485 WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //coded_block_pattern1486 WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //coded_block_pattern
1486 uiCbp = uiCode;1487 uiCbp = uiCode;
1487 {1488 {
1488 if (uiCbp > 47)1489 if (pCtx->pSps->uiChromaFormatIdc && (uiCbp > 47))
1490 return ERR_INFO_INVALID_CBP;
1491 if (!pCtx->pSps->uiChromaFormatIdc && (uiCbp > 15))
1489 return ERR_INFO_INVALID_CBP;1492 return ERR_INFO_INVALID_CBP;
1490
1491 if (MB_TYPE_INTRA4x4 == pCurLayer->pMbType[iMbXy]) {1493 if (MB_TYPE_INTRA4x4 == pCurLayer->pMbType[iMbXy]) {
1492 uiCbp = g_kuiIntra4x4CbpTable[uiCbp];1494
1495 uiCbp = pCtx->pSps->uiChromaFormatIdc ? g_kuiIntra4x4CbpTable[uiCbp] : g_kuiIntra4x4CbpTable400[uiCbp];
1493 } else //inter1496 } else //inter
1494 uiCbp = g_kuiInterCbpTable[uiCbp];1497 uiCbp = pCtx->pSps->uiChromaFormatIdc ? g_kuiInterCbpTable[uiCbp] : g_kuiInterCbpTable400[uiCbp];
1495 }1498 }
1496 1499
1497 pCurLayer->pCbp[iMbXy] = uiCbp;1500 pCurLayer->pCbp[iMbXy] = uiCbp;
codec/decoder/core/src/decoder_data_tables.cpp+9−0
@@ -134,12 +134,21 @@ const uint8_t g_kuiIntra4x4CbpTable[48] = { · 133 unmodified lines
134 8, 17, 18, 20, 24, 6, 9, 22, 25, 32, 33, 34, 36, 40, 38, 41 //47134 8, 17, 18, 20, 24, 6, 9, 22, 25, 32, 33, 34, 36, 40, 38, 41 //47
135};135};
136 136
137const uint8_t g_kuiIntra4x4CbpTable400[16] = {
138 15, 0, 7, 11, 13, 14, 3, 5, 10, 12, 1, 2, 4, 8, 6, 9
139
140};
141
137const uint8_t g_kuiInterCbpTable[48] = {142const uint8_t g_kuiInterCbpTable[48] = {
138 0, 16, 1, 2, 4, 8, 32, 3, 5, 10, 12, 15, 47, 7, 11, 13, //15143 0, 16, 1, 2, 4, 8, 32, 3, 5, 10, 12, 15, 47, 7, 11, 13, //15
139 14, 6, 9, 31, 35, 37, 42, 44, 33, 34, 36, 40, 39, 43, 45, 46, //31144 14, 6, 9, 31, 35, 37, 42, 44, 33, 34, 36, 40, 39, 43, 45, 46, //31
140 17, 18, 20, 24, 19, 21, 26, 28, 23, 27, 29, 30, 22, 25, 38, 41 //47145 17, 18, 20, 24, 19, 21, 26, 28, 23, 27, 29, 30, 22, 25, 38, 41 //47
141};146};
142 147
148const uint8_t g_kuiInterCbpTable400[16] = {
149 0, 1, 2, 4, 8, 3, 5, 10, 12, 15, 7, 11, 13, 14, 6, 9
150};
151
143const uint8_t g_kuiLeadingZeroTable[256] = {152const uint8_t g_kuiLeadingZeroTable[256] = {
144 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,153 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
145 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,154 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
codec/decoder/core/src/parse_mb_syn_cabac.cpp+6−0
@@ -669,6 +669,10 @@ int32_t ParseCbpInfoCabac (PWelsDecoderContext pCtx, PWelsNeighAvail pNeighAvail · 668 unmodified lines
669 if (pCbpBit[3])669 if (pCbpBit[3])
670 uiCbp += 0x08;670 uiCbp += 0x08;
671 671
672 if (pCtx->pSps->uiChromaFormatIdc == 0)//monochroma
673 return ERR_NONE;
674
675
672 //Chroma: bit by bit676 //Chroma: bit by bit
673 iIdxB = pNeighAvail->iTopAvail && (pNeighAvail->iTopType == MB_TYPE_INTRA_PCM || (pNeighAvail->iTopCbp >> 4));677 iIdxB = pNeighAvail->iTopAvail && (pNeighAvail->iTopType == MB_TYPE_INTRA_PCM || (pNeighAvail->iTopCbp >> 4));
674 iIdxA = pNeighAvail->iLeftAvail && (pNeighAvail->iLeftType == MB_TYPE_INTRA_PCM || (pNeighAvail->iLeftCbp >> 4));678 iIdxA = pNeighAvail->iLeftAvail && (pNeighAvail->iLeftType == MB_TYPE_INTRA_PCM || (pNeighAvail->iLeftCbp >> 4));
@@ -687,7 +691,9 @@ int32_t ParseCbpInfoCabac (PWelsDecoderContext pCtx, PWelsNeighAvail pNeighAvail · 12 unmodified lines
687 pCtx->pCabacCtx + NEW_CTX_OFFSET_CBP + 2 * CTX_NUM_CBP + iCtxInc,691 pCtx->pCabacCtx + NEW_CTX_OFFSET_CBP + 2 * CTX_NUM_CBP + iCtxInc,
688 pCbpBit[5]));692 pCbpBit[5]));
689 uiCbp += 1 << (4 + pCbpBit[5]);693 uiCbp += 1 << (4 + pCbpBit[5]);
694
690 }695 }
696
691 return ERR_NONE;697 return ERR_NONE;
692}698}
693 699

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