| 79 | } |
| 80 | |
| 81 | int32_t WelsTargetSliceConstruction (PWelsDecoderContext pCtx) { |
| 82 | PDqLayer pCurDqLayer = pCtx->pCurDqLayer; |
| 83 | PSlice pCurSlice = &pCurDqLayer->sLayerInfo.sSliceInLayer; |
| 84 | PSliceHeader pSliceHeader = &pCurSlice->sSliceHeaderExt.sSliceHeader; |
| 85 | |
| 86 | int32_t iTotalMbTargetLayer = pSliceHeader->pSps->uiTotalMbCount; |
| 87 | |
| 88 | int32_t iCurLayerWidth = pCurDqLayer->iMbWidth << 4; |
| 89 | int32_t iCurLayerHeight = pCurDqLayer->iMbHeight << 4; |
| 90 | |
| 91 | int32_t iNextMbXyIndex = 0; |
| 92 | PFmo pFmo = pCtx->pFmo; |
| 93 | |
| 94 | int32_t iTotalNumMb = pCurSlice->iTotalMbInCurSlice; |
| 95 | int32_t iCountNumMb = 0; |
| 96 | PDeblockingFilterMbFunc pDeblockMb = WelsDeblockingMb; |
| 97 | |
| 98 | if (!pCtx->sSpsPpsCtx.bAvcBasedFlag && iCurLayerWidth != pCtx->iCurSeqIntervalMaxPicWidth) { |
| 99 | return ERR_INFO_WIDTH_MISMATCH; |
| 100 | } |
| 101 | |
| 102 | iNextMbXyIndex = pSliceHeader->iFirstMbInSlice; |
| 103 | pCurDqLayer->iMbX = iNextMbXyIndex % pCurDqLayer->iMbWidth; |
| 104 | pCurDqLayer->iMbY = iNextMbXyIndex / pCurDqLayer->iMbWidth; |
| 105 | pCurDqLayer->iMbXyIndex = iNextMbXyIndex; |
| 106 | |
| 107 | if (0 == iNextMbXyIndex) { |
| 108 | pCurDqLayer->pDec->iSpsId = pCtx->pSps->iSpsId; |
| 109 | pCurDqLayer->pDec->iPpsId = pCtx->pPps->iPpsId; |
| 110 | |
| 111 | pCurDqLayer->pDec->uiQualityId = pCurDqLayer->sLayerInfo.sNalHeaderExt.uiQualityId; |
| 112 | } |
| 113 | |
| 114 | do { |
| 115 | if (iCountNumMb >= iTotalNumMb) { |
| 116 | break; |
| 117 | } |
| 118 | |
| 119 | if (!pCtx->pParam->bParseOnly) { //for parse only, actual recon MB unnecessary |
| 120 | if (WelsTargetMbConstruction (pCtx)) { |
| 121 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, |
| 122 | "WelsTargetSliceConstruction():::MB(%d, %d) construction error. pCurSlice_type:%d", |
| 123 | pCurDqLayer->iMbX, pCurDqLayer->iMbY, pCurSlice->eSliceType); |
| 124 | |
| 125 | return ERR_INFO_MB_RECON_FAIL; |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | ++iCountNumMb; |
| 130 | if (!pCurDqLayer->pMbCorrectlyDecodedFlag[iNextMbXyIndex]) { //already con-ed, overwrite |
| 131 | pCurDqLayer->pMbCorrectlyDecodedFlag[iNextMbXyIndex] = true; |
| 132 | pCtx->pDec->iMbEcedPropNum += (pCurDqLayer->pMbRefConcealedFlag[iNextMbXyIndex] ? 1 : 0); |
| 133 | ++pCtx->iTotalNumMbRec; |
| 134 | } |
| 135 | |
| 136 | if (pCtx->iTotalNumMbRec > iTotalMbTargetLayer) { |
| 137 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, |
| 138 | "WelsTargetSliceConstruction():::pCtx->iTotalNumMbRec:%d, iTotalMbTargetLayer:%d", |
no test coverage detected