History

second commit for threaded decoding support: Add function WelsDecodeAndConstructSlice (and add associted functions) which combines decoding->reconstructing->deblocking in single MB loop so that it allows multile frames to decode MBs in parallel.

xiaotiansf committed 7 years ago

Commit fd42f041 parent 2f5ecec22 files · +924 −190Browse files

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

Unified · Split

codec/decoder/core/src/decode_slice.cpp+202−35
@@ -93,7 +93,7 @@ int32_t WelsTargetSliceConstruction (PWelsDecoderContext pCtx) { · 92 unmodified lines
9393
9494 int32_t iTotalNumMb = pCurSlice->iTotalMbInCurSlice;
9595 int32_t iCountNumMb = 0;
96− PDeblockingFilterMbFunc pDeblockMb;
96+ PDeblockingFilterMbFunc pDeblockMb = WelsDeblockingMb;
9797
9898 if (!pCtx->sSpsPpsCtx.bAvcBasedFlag && iCurLayerWidth != pCtx->iCurSeqIntervalMaxPicWidth) {
9999 return ERR_INFO_WIDTH_MISMATCH;
@@ -163,8 +163,6 @@ int32_t WelsTargetSliceConstruction (PWelsDecoderContext pCtx) { · 63 unmodified lines
163163 if (pCtx->pParam->bParseOnly) //for parse only, deblocking should not go on
164164 return ERR_NONE;
165165
166− pDeblockMb = WelsDeblockingMb;
167−
168166 if (1 == pSliceHeader->uiDisableDeblockingFilterIdc
169167 || pCtx->pCurDqLayer->sLayerInfo.sSliceInLayer.iTotalMbInCurSlice <= 0) {
170168 return ERR_NONE;//NO_SUPPORTED_FILTER_IDX
@@ -238,8 +236,10 @@ int32_t WelsMbInterConstruction (PWelsDecoderContext pCtx, PDqLayer pCurDqLayer) · 67 unmodified lines
238236 }
239237 WelsMbInterSampleConstruction (pCtx, pCurDqLayer, pDstY, pDstCb, pDstCr, iLumaStride, iChromaStride);
240238
241− pCtx->sBlockFunc.pWelsSetNonZeroCountFunc (
242− pCurDqLayer->pNzc[pCurDqLayer->iMbXyIndex]); // set all none-zero nzc to 1; dbk can be opti!
239+ if (pCtx->pThreadCtx == NULL) {
240+ pCtx->sBlockFunc.pWelsSetNonZeroCountFunc (
241+ pCurDqLayer->pNzc[pCurDqLayer->iMbXyIndex]); // set all none-zero nzc to 1; dbk can be opti!
242+ }
243243 return ERR_NONE;
244244 }
245245
@@ -723,7 +723,7 @@ int32_t WelsDecodeMbCabacISliceBaseMode0 (PWelsDecoderContext pCtx, uint32_t& ui · 477 unmodified lines
723723 pCurDqLayer->pLumaQp[iMbXy] = pSlice->iLastMbQp;
724724 for (i = 0; i < 2; i++) {
725725 pCurDqLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 ((pCurDqLayer->pLumaQp[iMbXy] +
726− pSliceHeader->pPps->iChromaQpIndexOffset[i]), 0, 51)];
726+ pSliceHeader->pPps->iChromaQpIndexOffset[i]), 0, 51)];
727727 }
728728 }
729729
@@ -738,7 +738,7 @@ int32_t WelsDecodeMbCabacISliceBaseMode0 (PWelsDecoderContext pCtx, uint32_t& ui · 8 unmodified lines
738738 pSlice->iLastMbQp = pCurDqLayer->pLumaQp[iMbXy];
739739 for (i = 0; i < 2; i++) {
740740 pCurDqLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 ((pSlice->iLastMbQp +
741− pSliceHeader->pPps->iChromaQpIndexOffset[i]), 0, 51)];
741+ pSliceHeader->pPps->iChromaQpIndexOffset[i]), 0, 51)];
742742 }
743743 if (MB_TYPE_INTRA16x16 == pCurDqLayer->pDec->pMbType[iMbXy]) {
744744 //step1: Luma DC
@@ -973,7 +973,7 @@ int32_t WelsDecodeMbCabacPSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 228 unmodified lines
973973 pSlice->iLastMbQp = pCurDqLayer->pLumaQp[iMbXy];
974974 for (i = 0; i < 2; i++) {
975975 pCurDqLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 (pSlice->iLastMbQp +
976− pSliceHeader->pPps->iChromaQpIndexOffset[i], 0, 51)];
976+ pSliceHeader->pPps->iChromaQpIndexOffset[i], 0, 51)];
977977 }
978978
979979 if (MB_TYPE_INTRA16x16 == pCurDqLayer->pDec->pMbType[iMbXy]) {
@@ -1080,7 +1080,7 @@ int32_t WelsDecodeMbCabacPSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 100 unmodified lines
10801080 pCurDqLayer->pLumaQp[iMbXy] = pSlice->iLastMbQp;
10811081 for (i = 0; i < 2; i++) {
10821082 pCurDqLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 (pCurDqLayer->pLumaQp[iMbXy] +
1083− pSliceHeader->pPps->iChromaQpIndexOffset[i], 0, 51)];
1083+ pSliceHeader->pPps->iChromaQpIndexOffset[i], 0, 51)];
10841084 }
10851085 }
10861086
@@ -1214,7 +1214,7 @@ int32_t WelsDecodeMbCabacBSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 127 unmodified lines
12141214 pSlice->iLastMbQp = pCurDqLayer->pLumaQp[iMbXy];
12151215 for (i = 0; i < 2; i++) {
12161216 pCurDqLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 (pSlice->iLastMbQp +
1217− pSliceHeader->pPps->iChromaQpIndexOffset[i], 0, 51)];
1217+ pSliceHeader->pPps->iChromaQpIndexOffset[i], 0, 51)];
12181218 }
12191219
12201220 if (MB_TYPE_INTRA16x16 == pCurDqLayer->pDec->pMbType[iMbXy]) {
@@ -1321,7 +1321,7 @@ int32_t WelsDecodeMbCabacBSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 100 unmodified lines
13211321 pCurDqLayer->pLumaQp[iMbXy] = pSlice->iLastMbQp;
13221322 for (i = 0; i < 2; i++) {
13231323 pCurDqLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 (pCurDqLayer->pLumaQp[iMbXy] +
1324− pSliceHeader->pPps->iChromaQpIndexOffset[i], 0, 51)];
1324+ pSliceHeader->pPps->iChromaQpIndexOffset[i], 0, 51)];
13251325 }
13261326 }
13271327
@@ -1365,7 +1365,9 @@ int32_t WelsDecodeMbCabacPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 37 unmodified lines
13651365
13661366 pCurDqLayer->pInterPredictionDoneFlag[iMbXy] = 0;
13671367 memset (pCurDqLayer->pDec->pRefIndex[0][iMbXy], 0, sizeof (int8_t) * 16);
1368− pCtx->bMbRefConcealed = pCtx->bRPLRError || pCtx->bMbRefConcealed || ! (ppRefPic[0] && ppRefPic[0]->bIsComplete);
1368+ bool bIsPending = pCtx->pThreadCtx != NULL;
1369+ pCtx->bMbRefConcealed = pCtx->bRPLRError || pCtx->bMbRefConcealed || ! (ppRefPic[0] && (ppRefPic[0]->bIsComplete
1370+ || bIsPending));
13691371 //predict mv
13701372 PredPSkipMvFromNeighbor (pCurDqLayer, pMv);
13711373 for (i = 0; i < 16; i++) {
@@ -1381,7 +1383,7 @@ int32_t WelsDecodeMbCabacPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 9 unmodified lines
13811383 pCurDqLayer->pLumaQp[iMbXy] = pSlice->iLastMbQp; //??????????????? dqaunt of previous mb
13821384 for (i = 0; i < 2; i++) {
13831385 pCurDqLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 (pCurDqLayer->pLumaQp[iMbXy] +
1384− pSliceHeader->pPps->iChromaQpIndexOffset[i], 0, 51)];
1386+ pSliceHeader->pPps->iChromaQpIndexOffset[i], 0, 51)];
13851387 }
13861388
13871389 //for neighboring CABAC usage
@@ -1419,6 +1421,8 @@ int32_t WelsDecodeMbCabacBSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 31 unmodified lines
14191421
14201422 memset (pCurDqLayer->pDirect[iMbXy], 0, sizeof (int8_t) * 16);
14211423
1424+ bool bIsPending = pCtx->pThreadCtx != NULL;
1425+
14221426 if (uiCode) {
14231427 int16_t pMv[LIST_A][2] = { {0, 0}, { 0, 0 } };
14241428 int8_t ref[LIST_A] = { 0 };
@@ -1433,8 +1437,8 @@ int32_t WelsDecodeMbCabacBSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 8 unmodified lines
14331437 pCurDqLayer->pInterPredictionDoneFlag[iMbXy] = 0;
14341438 memset (pCurDqLayer->pDec->pRefIndex[LIST_0][iMbXy], 0, sizeof (int8_t) * 16);
14351439 memset (pCurDqLayer->pDec->pRefIndex[LIST_1][iMbXy], 0, sizeof (int8_t) * 16);
1436− pCtx->bMbRefConcealed = pCtx->bRPLRError || pCtx->bMbRefConcealed || ! (ppRefPicL0[0] && ppRefPicL0[0]->bIsComplete)
1437− || ! (ppRefPicL1[0] && ppRefPicL1[0]->bIsComplete);
1440+ pCtx->bMbRefConcealed = pCtx->bRPLRError || pCtx->bMbRefConcealed || ! (ppRefPicL0[0] && (ppRefPicL0[0]->bIsComplete
1441+ || bIsPending)) || ! (ppRefPicL1[0] && (ppRefPicL1[0]->bIsComplete || bIsPending));
14381442
14391443 if (pCtx->bMbRefConcealed) {
14401444 SLogContext* pLogCtx = & (pCtx->sLogCtx);
@@ -1463,7 +1467,7 @@ int32_t WelsDecodeMbCabacBSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 22 unmodified lines
14631467 pCurDqLayer->pLumaQp[iMbXy] = pSlice->iLastMbQp; //??????????????? dqaunt of previous mb
14641468 for (i = 0; i < 2; i++) {
14651469 pCurDqLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 (pCurDqLayer->pLumaQp[iMbXy] +
1466− pSliceHeader->pPps->iChromaQpIndexOffset[i], 0, 51)];
1470+ pSliceHeader->pPps->iChromaQpIndexOffset[i], 0, 51)];
14671471 }
14681472
14691473 //for neighboring CABAC usage
@@ -1613,6 +1617,161 @@ int32_t WelsDecodeSlice (PWelsDecoderContext pCtx, bool bFirstSliceInLayer, PNal · 143 unmodified lines
16131617 return ERR_NONE;
16141618 }
16151619
1620+int32_t WelsDecodeAndConstructSlice (PWelsDecoderContext pCtx) {
1621+ PNalUnit pNalCur = pCtx->pNalCur;
1622+ PDqLayer pCurDqLayer = pCtx->pCurDqLayer;
1623+ PFmo pFmo = pCtx->pFmo;
1624+ int32_t iRet;
1625+ int32_t iNextMbXyIndex, iSliceIdc;
1626+
1627+ PSlice pSlice = &pCurDqLayer->sLayerInfo.sSliceInLayer;
1628+ PSliceHeaderExt pSliceHeaderExt = &pSlice->sSliceHeaderExt;
1629+ PSliceHeader pSliceHeader = &pSliceHeaderExt->sSliceHeader;
1630+ int32_t iMbX, iMbY;
1631+ const int32_t kiCountNumMb = pSliceHeader->pSps->uiTotalMbCount; //need to be correct when fmo or multi slice
1632+ int32_t iTotalMbTargetLayer = kiCountNumMb;
1633+ uint32_t uiEosFlag = 0;
1634+ PWelsDecMbFunc pDecMbFunc;
1635+
1636+ pSlice->iTotalMbInCurSlice = 0; //initialize at the starting of slice decoding.
1637+
1638+ if (pCtx->pPps->bEntropyCodingModeFlag) {
1639+ if (pSlice->sSliceHeaderExt.bAdaptiveMotionPredFlag ||
1640+ pSlice->sSliceHeaderExt.bAdaptiveBaseModeFlag ||
1641+ pSlice->sSliceHeaderExt.bAdaptiveResidualPredFlag) {
1642+ WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR,
1643+ "WelsDecodeSlice()::::ILP flag exist, not supported with CABAC enabled!");
1644+ pCtx->iErrorCode |= dsBitstreamError;
1645+ return dsBitstreamError;
1646+ }
1647+ if (P_SLICE == pSliceHeader->eSliceType)
1648+ pDecMbFunc = WelsDecodeMbCabacPSlice;
1649+ else if (B_SLICE == pSliceHeader->eSliceType)
1650+ pDecMbFunc = WelsDecodeMbCabacBSlice;
1651+ else //I_SLICE. B_SLICE is being supported
1652+ pDecMbFunc = WelsDecodeMbCabacISlice;
1653+ } else {
1654+ if (P_SLICE == pSliceHeader->eSliceType) {
1655+ pDecMbFunc = WelsDecodeMbCavlcPSlice;
1656+ } else if (B_SLICE == pSliceHeader->eSliceType) {
1657+ pDecMbFunc = WelsDecodeMbCavlcBSlice;
1658+ } else { //I_SLICE
1659+ pDecMbFunc = WelsDecodeMbCavlcISlice;
1660+ }
1661+ }
1662+
1663+ if (pSliceHeader->pPps->bConstainedIntraPredFlag) {
1664+ pCtx->pFillInfoCacheIntraNxNFunc = WelsFillCacheConstrain1IntraNxN;
1665+ pCtx->pMapNxNNeighToSampleFunc = WelsMapNxNNeighToSampleConstrain1;
1666+ pCtx->pMap16x16NeighToSampleFunc = WelsMap16x16NeighToSampleConstrain1;
1667+ } else {
1668+ pCtx->pFillInfoCacheIntraNxNFunc = WelsFillCacheConstrain0IntraNxN;
1669+ pCtx->pMapNxNNeighToSampleFunc = WelsMapNxNNeighToSampleNormal;
1670+ pCtx->pMap16x16NeighToSampleFunc = WelsMap16x16NeighToSampleNormal;
1671+ }
1672+
1673+ pCtx->eSliceType = pSliceHeader->eSliceType;
1674+ if (pCurDqLayer->sLayerInfo.pPps->bEntropyCodingModeFlag == 1) {
1675+ int32_t iQp = pSlice->sSliceHeaderExt.sSliceHeader.iSliceQp;
1676+ int32_t iCabacInitIdc = pSlice->sSliceHeaderExt.sSliceHeader.iCabacInitIdc;
1677+ WelsCabacContextInit (pCtx, pSlice->eSliceType, iCabacInitIdc, iQp);
1678+ //InitCabacCtx (pCtx->pCabacCtx, pSlice->eSliceType, iCabacInitIdc, iQp);
1679+ pSlice->iLastDeltaQp = 0;
1680+ WELS_READ_VERIFY (InitCabacDecEngineFromBS (pCtx->pCabacDecEngine, pCtx->pCurDqLayer->pBitStringAux));
1681+ }
1682+ //try to calculate the dequant_coeff
1683+ WelsCalcDeqCoeffScalingList (pCtx);
1684+
1685+ iNextMbXyIndex = pSliceHeader->iFirstMbInSlice;
1686+ iMbX = iNextMbXyIndex % pCurDqLayer->iMbWidth;
1687+ iMbY = iNextMbXyIndex / pCurDqLayer->iMbWidth; // error is introduced by multiple slices case, 11/23/2009
1688+ pSlice->iMbSkipRun = -1;
1689+ iSliceIdc = (pSliceHeader->iFirstMbInSlice << 7) + pCurDqLayer->uiLayerDqId;
1690+
1691+ pCurDqLayer->iMbX = iMbX;
1692+ pCurDqLayer->iMbY = iMbY;
1693+ pCurDqLayer->iMbXyIndex = iNextMbXyIndex;
1694+
1695+ PDeblockingFilterMbFunc pDeblockMb = WelsDeblockingMb;
1696+
1697+ SDeblockingFilter pFilter;
1698+ int32_t iFilterIdc = 1;
1699+ if (pCtx->pThreadCtx && pSliceHeader->uiDisableDeblockingFilterIdc != 1) {
1700+ WelsDeblockingInitFilter (pCtx, pFilter, iFilterIdc);
1701+ }
1702+
1703+ do {
1704+ if ((-1 == iNextMbXyIndex) || (iNextMbXyIndex >= kiCountNumMb)) { // slice group boundary or end of a frame
1705+ break;
1706+ }
1707+
1708+ pCurDqLayer->pSliceIdc[iNextMbXyIndex] = iSliceIdc;
1709+ pCtx->bMbRefConcealed = false;
1710+ iRet = pDecMbFunc (pCtx, pNalCur, uiEosFlag);
1711+ pCurDqLayer->pMbRefConcealedFlag[iNextMbXyIndex] = pCtx->bMbRefConcealed;
1712+ if (iRet != ERR_NONE) {
1713+ return iRet;
1714+ }
1715+ if (WelsTargetMbConstruction (pCtx)) {
1716+ WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING,
1717+ "WelsTargetSliceConstruction():::MB(%d, %d) construction error. pCurSlice_type:%d",
1718+ pCurDqLayer->iMbX, pCurDqLayer->iMbY, pSlice->eSliceType);
1719+
1720+ return ERR_INFO_MB_RECON_FAIL;
1721+ }
1722+ WelsDeblockingFilterMB (pCurDqLayer, pFilter, iFilterIdc, pDeblockMb);
1723+ if (pCtx->uiNalRefIdc > 0) {
1724+ if (pCurDqLayer->iMbX == 0 || pCurDqLayer->iMbX == pCurDqLayer->iMbWidth - 1 || pCurDqLayer->iMbY == 0
1725+ || pCurDqLayer->iMbY == pCurDqLayer->iMbHeight - 1) {
1726+ PadMBLuma_c (pCurDqLayer->pDec->pData[0], pCurDqLayer->pDec->iLinesize[0], pCurDqLayer->pDec->iWidthInPixel,
1727+ pCurDqLayer->pDec->iHeightInPixel, pCurDqLayer->iMbX, pCurDqLayer->iMbY, pCurDqLayer->iMbWidth, pCurDqLayer->iMbHeight);
1728+ PadMBChroma_c (pCurDqLayer->pDec->pData[1], pCurDqLayer->pDec->iLinesize[1], pCurDqLayer->pDec->iWidthInPixel / 2,
1729+ pCurDqLayer->pDec->iHeightInPixel / 2, pCurDqLayer->iMbX, pCurDqLayer->iMbY, pCurDqLayer->iMbWidth,
1730+ pCurDqLayer->iMbHeight);
1731+ PadMBChroma_c (pCurDqLayer->pDec->pData[2], pCurDqLayer->pDec->iLinesize[2], pCurDqLayer->pDec->iWidthInPixel / 2,
1732+ pCurDqLayer->pDec->iHeightInPixel / 2, pCurDqLayer->iMbX, pCurDqLayer->iMbY, pCurDqLayer->iMbWidth,
1733+ pCurDqLayer->iMbHeight);
1734+ }
1735+ }
1736+ if (!pCurDqLayer->pMbCorrectlyDecodedFlag[iNextMbXyIndex]) { //already con-ed, overwrite
1737+ pCurDqLayer->pMbCorrectlyDecodedFlag[iNextMbXyIndex] = true;
1738+ pCtx->pDec->iMbEcedPropNum += (pCurDqLayer->pMbRefConcealedFlag[iNextMbXyIndex] ? 1 : 0);
1739+ ++pCtx->iTotalNumMbRec;
1740+ }
1741+
1742+ if (pCtx->iTotalNumMbRec > iTotalMbTargetLayer) {
1743+ WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING,
1744+ "WelsTargetSliceConstruction():::pCtx->iTotalNumMbRec:%d, iTotalMbTargetLayer:%d",
1745+ pCtx->iTotalNumMbRec, iTotalMbTargetLayer);
1746+
1747+ return ERR_INFO_MB_NUM_EXCEED_FAIL;
1748+ }
1749+
1750+ ++pSlice->iTotalMbInCurSlice;
1751+ if (uiEosFlag) { //end of slice
1752+ SET_EVENT (&pCtx->pDec->pReadyEvent[pCurDqLayer->iMbY]);
1753+ break;
1754+ }
1755+ if (pSliceHeader->pPps->uiNumSliceGroups > 1) {
1756+ iNextMbXyIndex = FmoNextMb (pFmo, iNextMbXyIndex);
1757+ } else {
1758+ ++iNextMbXyIndex;
1759+ }
1760+ int32_t iLastMby = iMbY;
1761+ int32_t iLastMbx = iMbX;
1762+ iMbX = iNextMbXyIndex % pCurDqLayer->iMbWidth;
1763+ iMbY = iNextMbXyIndex / pCurDqLayer->iMbWidth;
1764+ pCurDqLayer->iMbX = iMbX;
1765+ pCurDqLayer->iMbY = iMbY;
1766+ pCurDqLayer->iMbXyIndex = iNextMbXyIndex;
1767+ if ((iMbY > iLastMby) && (iLastMbx == pCurDqLayer->iMbWidth - 1)) {
1768+ SET_EVENT (&pCtx->pDec->pReadyEvent[iLastMby]);
1769+ }
1770+ } while (1);
1771+ SET_EVENT (&pCtx->pDec->pReadyEvent[pCurDqLayer->iMbY]);
1772+ return ERR_NONE;
1773+}
1774+
16161775 int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) {
16171776 SVlcTable* pVlcTable = pCtx->pVlcTable;
16181777 PDqLayer pCurDqLayer = pCtx->pCurDqLayer;
@@ -1762,7 +1921,7 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 143 unmodified lines
17621921 pCurDqLayer->pLumaQp[iMbXy] = pSlice->iLastMbQp;
17631922 for (i = 0; i < 2; i++) {
17641923 pCurDqLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 (pCurDqLayer->pLumaQp[iMbXy] +
1765− pSliceHeader->pPps->iChromaQpIndexOffset[i], 0, 51)];
1924+ pSliceHeader->pPps->iChromaQpIndexOffset[i], 0, 51)];
17661925 }
17671926
17681927 }
@@ -1782,8 +1941,8 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 13 unmodified lines
17821941 pSlice->iLastMbQp = pCurDqLayer->pLumaQp[iMbXy];
17831942 for (i = 0; i < 2; i++) {
17841943 pCurDqLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 (pSlice->iLastMbQp +
1785− pSliceHeader->pPps->iChromaQpIndexOffset[i], 0,
1786− 51)];
1944+ pSliceHeader->pPps->iChromaQpIndexOffset[i], 0,
1945+ 51)];
17871946 }
17881947
17891948
@@ -1876,7 +2035,8 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 86 unmodified lines
18762035 int32_t iIndex = 16 + (i << 2);
18772036 for (iId4x4 = 0; iId4x4 < 4; iId4x4++) {
18782037 if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex, iScanIdxEnd - WELS_MAX (iScanIdxStart,
1879− 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1), iMbResProperty, pCurDqLayer->pScaledTCoeff[iMbXy] + (iIndex << 4),
2038+ 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1), iMbResProperty,
2039+ pCurDqLayer->pScaledTCoeff[iMbXy] + (iIndex << 4),
18802040 pCurDqLayer->pChromaQp[iMbXy][i], pCtx)) != ERR_NONE) {
18812041 return iRet;//abnormal
18822042 }
@@ -2126,11 +2286,12 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 243 unmodified lines
21262286 ST32A4 (&pNzc[12], 0);
21272287 ST32A4 (&pNzc[16], 0);
21282288 ST32A4 (&pNzc[20], 0);
2129− if (pCurDqLayer->pCbp[iMbXy] == 0 && !IS_INTRA16x16 (pCurDqLayer->pDec->pMbType[iMbXy]) && !IS_I_BL (pCurDqLayer->pDec->pMbType[iMbXy])) {
2289+ if (pCurDqLayer->pCbp[iMbXy] == 0 && !IS_INTRA16x16 (pCurDqLayer->pDec->pMbType[iMbXy])
2290+ && !IS_I_BL (pCurDqLayer->pDec->pMbType[iMbXy])) {
21302291 pCurDqLayer->pLumaQp[iMbXy] = pSlice->iLastMbQp;
21312292 for (i = 0; i < 2; i++) {
21322293 pCurDqLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 (pCurDqLayer->pLumaQp[iMbXy] +
2133− pSliceHeader->pPps->iChromaQpIndexOffset[i], 0, 51)];
2294+ pSliceHeader->pPps->iChromaQpIndexOffset[i], 0, 51)];
21342295 }
21352296 }
21362297
@@ -2148,8 +2309,8 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 11 unmodified lines
21482309 pSlice->iLastMbQp = pCurDqLayer->pLumaQp[iMbXy];
21492310 for (i = 0; i < 2; i++) {
21502311 pCurDqLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 (pSlice->iLastMbQp +
2151− pSliceHeader->pPps->iChromaQpIndexOffset[i], 0,
2152− 51)];
2312+ pSliceHeader->pPps->iChromaQpIndexOffset[i], 0,
2313+ 51)];
21532314 }
21542315
21552316 BsStartCavlc (pBs);
@@ -2251,7 +2412,8 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 95 unmodified lines
22512412 int32_t iIndex = 16 + (i << 2);
22522413 for (iId4x4 = 0; iId4x4 < 4; iId4x4++) {
22532414 if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex, iScanIdxEnd - WELS_MAX (iScanIdxStart,
2254− 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1), iMbResProperty, pCurDqLayer->pScaledTCoeff[iMbXy] + (iIndex << 4),
2415+ 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1), iMbResProperty,
2416+ pCurDqLayer->pScaledTCoeff[iMbXy] + (iIndex << 4),
22552417 pCurDqLayer->pChromaQp[iMbXy][i], pCtx)) != ERR_NONE) {
22562418 return iRet;//abnormal
22572419 }
@@ -2305,7 +2467,9 @@ int32_t WelsDecodeMbCavlcPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 47 unmodified lines
23052467
23062468 pCurDqLayer->pInterPredictionDoneFlag[iMbXy] = 0;
23072469 memset (pCurDqLayer->pDec->pRefIndex[0][iMbXy], 0, sizeof (int8_t) * 16);
2308− pCtx->bMbRefConcealed = pCtx->bRPLRError || pCtx->bMbRefConcealed || ! (ppRefPic[0] && ppRefPic[0]->bIsComplete);
2470+ bool bIsPending = pCtx->pThreadCtx != NULL;
2471+ pCtx->bMbRefConcealed = pCtx->bRPLRError || pCtx->bMbRefConcealed || ! (ppRefPic[0] && (ppRefPic[0]->bIsComplete
2472+ || bIsPending));
23092473 //predict iMv
23102474 PredPSkipMvFromNeighbor (pCurDqLayer, iMv);
23112475 for (i = 0; i < 16; i++) {
@@ -2322,7 +2486,7 @@ int32_t WelsDecodeMbCavlcPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 10 unmodified lines
23222486 pCurDqLayer->pLumaQp[iMbXy] = pSlice->iLastMbQp;
23232487 for (i = 0; i < 2; i++) {
23242488 pCurDqLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 (pCurDqLayer->pLumaQp[iMbXy] +
2325− pSliceHeader->pPps->iChromaQpIndexOffset[i], 0, 51)];
2489+ pSliceHeader->pPps->iChromaQpIndexOffset[i], 0, 51)];
23262490 }
23272491 }
23282492
@@ -2400,8 +2564,9 @@ int32_t WelsDecodeMbCavlcBSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 71 unmodified lines
24002564 pCurDqLayer->pInterPredictionDoneFlag[iMbXy] = 0;
24012565 memset (pCurDqLayer->pDec->pRefIndex[LIST_0][iMbXy], 0, sizeof (int8_t) * 16);
24022566 memset (pCurDqLayer->pDec->pRefIndex[LIST_1][iMbXy], 0, sizeof (int8_t) * 16);
2403− pCtx->bMbRefConcealed = pCtx->bRPLRError || pCtx->bMbRefConcealed || ! (ppRefPicL0[0] && ppRefPicL0[0]->bIsComplete)
2404− || ! (ppRefPicL1[0] && ppRefPicL1[0]->bIsComplete);
2567+ bool bIsPending = pCtx->pThreadCtx != NULL;
2568+ pCtx->bMbRefConcealed = pCtx->bRPLRError || pCtx->bMbRefConcealed || ! (ppRefPicL0[0] && (ppRefPicL0[0]->bIsComplete
2569+ || bIsPending)) || ! (ppRefPicL1[0] && (ppRefPicL1[0]->bIsComplete || bIsPending));
24052570
24062571 /*if (pCtx->bMbRefConcealed) {
24072572 SLogContext* pLogCtx = & (pCtx->sLogCtx);
@@ -2435,7 +2600,7 @@ int32_t WelsDecodeMbCavlcBSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 27 unmodified lines
24352600 pCurDqLayer->pLumaQp[iMbXy] = pSlice->iLastMbQp;
24362601 for (i = 0; i < 2; i++) {
24372602 pCurDqLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 (pCurDqLayer->pLumaQp[iMbXy] +
2438− pSliceHeader->pPps->iChromaQpIndexOffset[i], 0, 51)];
2603+ pSliceHeader->pPps->iChromaQpIndexOffset[i], 0, 51)];
24392604 }
24402605 }
24412606
@@ -2665,11 +2830,12 @@ int32_t WelsActualDecodeMbCavlcBSlice (PWelsDecoderContext pCtx) { · 223 unmodified lines
26652830 ST32A4 (&pNzc[12], 0);
26662831 ST32A4 (&pNzc[16], 0);
26672832 ST32A4 (&pNzc[20], 0);
2668− if (pCurDqLayer->pCbp[iMbXy] == 0 && !IS_INTRA16x16 (pCurDqLayer->pDec->pMbType[iMbXy]) && !IS_I_BL (pCurDqLayer->pDec->pMbType[iMbXy])) {
2833+ if (pCurDqLayer->pCbp[iMbXy] == 0 && !IS_INTRA16x16 (pCurDqLayer->pDec->pMbType[iMbXy])
2834+ && !IS_I_BL (pCurDqLayer->pDec->pMbType[iMbXy])) {
26692835 pCurDqLayer->pLumaQp[iMbXy] = pSlice->iLastMbQp;
26702836 for (i = 0; i < 2; i++) {
26712837 pCurDqLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 (pCurDqLayer->pLumaQp[iMbXy] +
2672− pSliceHeader->pPps->iChromaQpIndexOffset[i], 0, 51)];
2838+ pSliceHeader->pPps->iChromaQpIndexOffset[i], 0, 51)];
26732839 }
26742840 }
26752841
@@ -2687,8 +2853,8 @@ int32_t WelsActualDecodeMbCavlcBSlice (PWelsDecoderContext pCtx) { · 11 unmodified lines
26872853 pSlice->iLastMbQp = pCurDqLayer->pLumaQp[iMbXy];
26882854 for (i = 0; i < 2; i++) {
26892855 pCurDqLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 (pSlice->iLastMbQp +
2690− pSliceHeader->pPps->iChromaQpIndexOffset[i], 0,
2691− 51)];
2856+ pSliceHeader->pPps->iChromaQpIndexOffset[i], 0,
2857+ 51)];
26922858 }
26932859
26942860 BsStartCavlc (pBs);
@@ -2790,7 +2956,8 @@ int32_t WelsActualDecodeMbCavlcBSlice (PWelsDecoderContext pCtx) { · 95 unmodified lines
27902956 int32_t iIndex = 16 + (i << 2);
27912957 for (iId4x4 = 0; iId4x4 < 4; iId4x4++) {
27922958 if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex, iScanIdxEnd - WELS_MAX (iScanIdxStart,
2793− 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1), iMbResProperty, pCurDqLayer->pScaledTCoeff[iMbXy] + (iIndex << 4),
2959+ 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1), iMbResProperty,
2960+ pCurDqLayer->pScaledTCoeff[iMbXy] + (iIndex << 4),
27942961 pCurDqLayer->pChromaQp[iMbXy][i], pCtx)) != ERR_NONE) {
27952962 return iRet;//abnormal
27962963 }

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