Showing the changes to codec/decoder/core/src/decode_slice.cpp (1 of 29 files). Show all
Unified · Split
| @@ -79,14 +79,14 @@ static bool CheckRefPics (const PWelsDecoderContext& pCtx) { · 78 unmodified lines | ||
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | int32_t WelsTargetSliceConstruction (PWelsDecoderContext pCtx) { |
| 82 | − PDqLayer pCurLayer = pCtx->pCurDqLayer; | |
| 83 | − PSlice pCurSlice = &pCurLayer->sLayerInfo.sSliceInLayer; | |
| 82 | + PDqLayer pCurDqLayer = pCtx->pCurDqLayer; | |
| 83 | + PSlice pCurSlice = &pCurDqLayer->sLayerInfo.sSliceInLayer; | |
| 84 | 84 | PSliceHeader pSliceHeader = &pCurSlice->sSliceHeaderExt.sSliceHeader; |
| 85 | 85 | |
| 86 | 86 | int32_t iTotalMbTargetLayer = pSliceHeader->pSps->uiTotalMbCount; |
| 87 | 87 | |
| 88 | − int32_t iCurLayerWidth = pCurLayer->iMbWidth << 4; | |
| 89 | − int32_t iCurLayerHeight = pCurLayer->iMbHeight << 4; | |
| 88 | + int32_t iCurLayerWidth = pCurDqLayer->iMbWidth << 4; | |
| 89 | + int32_t iCurLayerHeight = pCurDqLayer->iMbHeight << 4; | |
| 90 | 90 | |
| 91 | 91 | int32_t iNextMbXyIndex = 0; |
| 92 | 92 | PFmo pFmo = pCtx->pFmo; |
| @@ -95,20 +95,20 @@ int32_t WelsTargetSliceConstruction (PWelsDecoderContext pCtx) { · 2 unmodified lines | ||
| 95 | 95 | int32_t iCountNumMb = 0; |
| 96 | 96 | PDeblockingFilterMbFunc pDeblockMb; |
| 97 | 97 | |
| 98 | − if (!pCtx->bAvcBasedFlag && iCurLayerWidth != pCtx->iCurSeqIntervalMaxPicWidth) { | |
| 98 | + if (!pCtx->sSpsPpsCtx.bAvcBasedFlag && iCurLayerWidth != pCtx->iCurSeqIntervalMaxPicWidth) { | |
| 99 | 99 | return ERR_INFO_WIDTH_MISMATCH; |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | iNextMbXyIndex = pSliceHeader->iFirstMbInSlice; |
| 103 | − pCurLayer->iMbX = iNextMbXyIndex % pCurLayer->iMbWidth; | |
| 104 | − pCurLayer->iMbY = iNextMbXyIndex / pCurLayer->iMbWidth; | |
| 105 | − pCurLayer->iMbXyIndex = iNextMbXyIndex; | |
| 103 | + pCurDqLayer->iMbX = iNextMbXyIndex % pCurDqLayer->iMbWidth; | |
| 104 | + pCurDqLayer->iMbY = iNextMbXyIndex / pCurDqLayer->iMbWidth; | |
| 105 | + pCurDqLayer->iMbXyIndex = iNextMbXyIndex; | |
| 106 | 106 | |
| 107 | 107 | if (0 == iNextMbXyIndex) { |
| 108 | − pCurLayer->pDec->iSpsId = pCtx->pSps->iSpsId; | |
| 109 | − pCurLayer->pDec->iPpsId = pCtx->pPps->iPpsId; | |
| 108 | + pCurDqLayer->pDec->iSpsId = pCtx->pSps->iSpsId; | |
| 109 | + pCurDqLayer->pDec->iPpsId = pCtx->pPps->iPpsId; | |
| 110 | 110 | |
| 111 | − pCurLayer->pDec->uiQualityId = pCurLayer->sLayerInfo.sNalHeaderExt.uiQualityId; | |
| 111 | + pCurDqLayer->pDec->uiQualityId = pCurDqLayer->sLayerInfo.sNalHeaderExt.uiQualityId; | |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | do { |
| @@ -120,16 +120,16 @@ int32_t WelsTargetSliceConstruction (PWelsDecoderContext pCtx) { · 5 unmodified lines | ||
| 120 | 120 | if (WelsTargetMbConstruction (pCtx)) { |
| 121 | 121 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, |
| 122 | 122 | "WelsTargetSliceConstruction():::MB(%d, %d) construction error. pCurSlice_type:%d", |
| 123 | − pCurLayer->iMbX, pCurLayer->iMbY, pCurSlice->eSliceType); | |
| 123 | + pCurDqLayer->iMbX, pCurDqLayer->iMbY, pCurSlice->eSliceType); | |
| 124 | 124 | |
| 125 | 125 | return ERR_INFO_MB_RECON_FAIL; |
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | ++iCountNumMb; |
| 130 | − if (!pCurLayer->pMbCorrectlyDecodedFlag[iNextMbXyIndex]) { //already con-ed, overwrite | |
| 131 | − pCurLayer->pMbCorrectlyDecodedFlag[iNextMbXyIndex] = true; | |
| 132 | − pCtx->pDec->iMbEcedPropNum += (pCurLayer->pMbRefConcealedFlag[iNextMbXyIndex] ? 1 : 0); | |
| 130 | + if (!pCurDqLayer->pMbCorrectlyDecodedFlag[iNextMbXyIndex]) { //already con-ed, overwrite | |
| 131 | + pCurDqLayer->pMbCorrectlyDecodedFlag[iNextMbXyIndex] = true; | |
| 132 | + pCtx->pDec->iMbEcedPropNum += (pCurDqLayer->pMbRefConcealedFlag[iNextMbXyIndex] ? 1 : 0); | |
| 133 | 133 | ++pCtx->iTotalNumMbRec; |
| 134 | 134 | } |
| 135 | 135 | |
| @@ -149,9 +149,9 @@ int32_t WelsTargetSliceConstruction (PWelsDecoderContext pCtx) { · 13 unmodified lines | ||
| 149 | 149 | if (-1 == iNextMbXyIndex || iNextMbXyIndex >= iTotalMbTargetLayer) { // slice group boundary or end of a frame |
| 150 | 150 | break; |
| 151 | 151 | } |
| 152 | − pCurLayer->iMbX = iNextMbXyIndex % pCurLayer->iMbWidth; | |
| 153 | − pCurLayer->iMbY = iNextMbXyIndex / pCurLayer->iMbWidth; | |
| 154 | − pCurLayer->iMbXyIndex = iNextMbXyIndex; | |
| 152 | + pCurDqLayer->iMbX = iNextMbXyIndex % pCurDqLayer->iMbWidth; | |
| 153 | + pCurDqLayer->iMbY = iNextMbXyIndex / pCurDqLayer->iMbWidth; | |
| 154 | + pCurDqLayer->iMbXyIndex = iNextMbXyIndex; | |
| 155 | 155 | } while (1); |
| 156 | 156 | |
| 157 | 157 | pCtx->pDec->iWidthInPixel = iCurLayerWidth; |
| @@ -176,32 +176,32 @@ int32_t WelsTargetSliceConstruction (PWelsDecoderContext pCtx) { · 18 unmodified lines | ||
| 176 | 176 | return ERR_NONE; |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | −int32_t WelsMbInterSampleConstruction (PWelsDecoderContext pCtx, PDqLayer pCurLayer, | |
| 179 | +int32_t WelsMbInterSampleConstruction (PWelsDecoderContext pCtx, PDqLayer pCurDqLayer, | |
| 180 | 180 | uint8_t* pDstY, uint8_t* pDstU, uint8_t* pDstV, int32_t iStrideL, int32_t iStrideC) { |
| 181 | − int32_t iMbXy = pCurLayer->iMbXyIndex; | |
| 181 | + int32_t iMbXy = pCurDqLayer->iMbXyIndex; | |
| 182 | 182 | int32_t i, iIndex, iOffset; |
| 183 | 183 | |
| 184 | − if (pCurLayer->pTransformSize8x8Flag[iMbXy]) { | |
| 184 | + if (pCurDqLayer->pTransformSize8x8Flag[iMbXy]) { | |
| 185 | 185 | for (i = 0; i < 4; i++) { |
| 186 | 186 | iIndex = g_kuiMbCountScan4Idx[i << 2]; |
| 187 | − if (pCurLayer->pNzc[iMbXy][iIndex] || pCurLayer->pNzc[iMbXy][iIndex + 1] || pCurLayer->pNzc[iMbXy][iIndex + 4] | |
| 188 | − || pCurLayer->pNzc[iMbXy][iIndex + 5]) { | |
| 187 | + if (pCurDqLayer->pNzc[iMbXy][iIndex] || pCurDqLayer->pNzc[iMbXy][iIndex + 1] || pCurDqLayer->pNzc[iMbXy][iIndex + 4] | |
| 188 | + || pCurDqLayer->pNzc[iMbXy][iIndex + 5]) { | |
| 189 | 189 | iOffset = ((iIndex >> 2) << 2) * iStrideL + ((iIndex % 4) << 2); |
| 190 | − pCtx->pIdctResAddPredFunc8x8 (pDstY + iOffset, iStrideL, pCurLayer->pScaledTCoeff[iMbXy] + (i << 6)); | |
| 190 | + pCtx->pIdctResAddPredFunc8x8 (pDstY + iOffset, iStrideL, pCurDqLayer->pScaledTCoeff[iMbXy] + (i << 6)); | |
| 191 | 191 | } |
| 192 | 192 | } |
| 193 | 193 | } else { |
| 194 | 194 | // luma. |
| 195 | − const int8_t* pNzc = pCurLayer->pNzc[iMbXy]; | |
| 196 | − int16_t* pScaledTCoeff = pCurLayer->pScaledTCoeff[iMbXy]; | |
| 195 | + const int8_t* pNzc = pCurDqLayer->pNzc[iMbXy]; | |
| 196 | + int16_t* pScaledTCoeff = pCurDqLayer->pScaledTCoeff[iMbXy]; | |
| 197 | 197 | pCtx->pIdctFourResAddPredFunc (pDstY + 0 * iStrideL + 0, iStrideL, pScaledTCoeff + 0 * 64, pNzc + 0); |
| 198 | 198 | pCtx->pIdctFourResAddPredFunc (pDstY + 0 * iStrideL + 8, iStrideL, pScaledTCoeff + 1 * 64, pNzc + 2); |
| 199 | 199 | pCtx->pIdctFourResAddPredFunc (pDstY + 8 * iStrideL + 0, iStrideL, pScaledTCoeff + 2 * 64, pNzc + 8); |
| 200 | 200 | pCtx->pIdctFourResAddPredFunc (pDstY + 8 * iStrideL + 8, iStrideL, pScaledTCoeff + 3 * 64, pNzc + 10); |
| 201 | 201 | } |
| 202 | 202 | |
| 203 | − const int8_t* pNzc = pCurLayer->pNzc[iMbXy]; | |
| 204 | − int16_t* pScaledTCoeff = pCurLayer->pScaledTCoeff[iMbXy]; | |
| 203 | + const int8_t* pNzc = pCurDqLayer->pNzc[iMbXy]; | |
| 204 | + int16_t* pScaledTCoeff = pCurDqLayer->pScaledTCoeff[iMbXy]; | |
| 205 | 205 | // Cb. |
| 206 | 206 | pCtx->pIdctFourResAddPredFunc (pDstU, iStrideC, pScaledTCoeff + 4 * 64, pNzc + 16); |
| 207 | 207 | // Cr. |
| @@ -209,17 +209,17 @@ int32_t WelsMbInterSampleConstruction (PWelsDecoderContext pCtx, PDqLayer pCurLa · 1 unmodified line | ||
| 209 | 209 | |
| 210 | 210 | return ERR_NONE; |
| 211 | 211 | } |
| 212 | −int32_t WelsMbInterConstruction (PWelsDecoderContext pCtx, PDqLayer pCurLayer) { | |
| 213 | − int32_t iMbX = pCurLayer->iMbX; | |
| 214 | − int32_t iMbY = pCurLayer->iMbY; | |
| 212 | +int32_t WelsMbInterConstruction (PWelsDecoderContext pCtx, PDqLayer pCurDqLayer) { | |
| 213 | + int32_t iMbX = pCurDqLayer->iMbX; | |
| 214 | + int32_t iMbY = pCurDqLayer->iMbY; | |
| 215 | 215 | uint8_t* pDstY, *pDstCb, *pDstCr; |
| 216 | 216 | |
| 217 | 217 | int32_t iLumaStride = pCtx->pDec->iLinesize[0]; |
| 218 | 218 | int32_t iChromaStride = pCtx->pDec->iLinesize[1]; |
| 219 | 219 | |
| 220 | − pDstY = pCurLayer->pDec->pData[0] + ((iMbY * iLumaStride + iMbX) << 4); | |
| 221 | − pDstCb = pCurLayer->pDec->pData[1] + ((iMbY * iChromaStride + iMbX) << 3); | |
| 222 | − pDstCr = pCurLayer->pDec->pData[2] + ((iMbY * iChromaStride + iMbX) << 3); | |
| 220 | + pDstY = pCurDqLayer->pDec->pData[0] + ((iMbY * iLumaStride + iMbX) << 4); | |
| 221 | + pDstCb = pCurDqLayer->pDec->pData[1] + ((iMbY * iChromaStride + iMbX) << 3); | |
| 222 | + pDstCr = pCurDqLayer->pDec->pData[2] + ((iMbY * iChromaStride + iMbX) << 3); | |
| 223 | 223 | |
| 224 | 224 | if (pCtx->eSliceType == P_SLICE) { |
| 225 | 225 | WELS_B_MB_REC_VERIFY (GetInterPred (pDstY, pDstCb, pDstCr, pCtx)); |
| @@ -236,10 +236,10 @@ int32_t WelsMbInterConstruction (PWelsDecoderContext pCtx, PDqLayer pCurLayer) { · 10 unmodified lines | ||
| 236 | 236 | pDstYCbCr[2] = pDstCr; |
| 237 | 237 | WELS_B_MB_REC_VERIFY (GetInterBPred (pDstYCbCr, pTempDstYCbCr, pCtx)); |
| 238 | 238 | } |
| 239 | − WelsMbInterSampleConstruction (pCtx, pCurLayer, pDstY, pDstCb, pDstCr, iLumaStride, iChromaStride); | |
| 239 | + WelsMbInterSampleConstruction (pCtx, pCurDqLayer, pDstY, pDstCb, pDstCr, iLumaStride, iChromaStride); | |
| 240 | 240 | |
| 241 | 241 | pCtx->sBlockFunc.pWelsSetNonZeroCountFunc ( |
| 242 | − pCurLayer->pNzc[pCurLayer->iMbXyIndex]); // set all none-zero nzc to 1; dbk can be opti! | |
| 242 | + pCurDqLayer->pNzc[pCurDqLayer->iMbXyIndex]); // set all none-zero nzc to 1; dbk can be opti! | |
| 243 | 243 | return ERR_NONE; |
| 244 | 244 | } |
| 245 | 245 | |
| @@ -285,33 +285,33 @@ void WelsLumaDcDequantIdct (int16_t* pBlock, int32_t iQp, PWelsDecoderContext pC · 39 unmodified lines | ||
| 285 | 285 | #undef STRIDE |
| 286 | 286 | } |
| 287 | 287 | |
| 288 | −int32_t WelsMbIntraPredictionConstruction (PWelsDecoderContext pCtx, PDqLayer pCurLayer, bool bOutput) { | |
| 288 | +int32_t WelsMbIntraPredictionConstruction (PWelsDecoderContext pCtx, PDqLayer pCurDqLayer, bool bOutput) { | |
| 289 | 289 | //seems IPCM should not enter this path |
| 290 | − int32_t iMbXy = pCurLayer->iMbXyIndex; | |
| 290 | + int32_t iMbXy = pCurDqLayer->iMbXyIndex; | |
| 291 | 291 | |
| 292 | − WelsFillRecNeededMbInfo (pCtx, bOutput, pCurLayer); | |
| 292 | + WelsFillRecNeededMbInfo (pCtx, bOutput, pCurDqLayer); | |
| 293 | 293 | |
| 294 | − if (IS_INTRA16x16 (pCurLayer->pMbType[iMbXy])) { | |
| 295 | − RecI16x16Mb (iMbXy, pCtx, pCurLayer->pScaledTCoeff[iMbXy], pCurLayer); | |
| 296 | − } else if (IS_INTRA8x8 (pCurLayer->pMbType[iMbXy])) { | |
| 297 | − RecI8x8Mb (iMbXy, pCtx, pCurLayer->pScaledTCoeff[iMbXy], pCurLayer); | |
| 298 | − } else if (IS_INTRA4x4 (pCurLayer->pMbType[iMbXy])) { | |
| 299 | − RecI4x4Mb (iMbXy, pCtx, pCurLayer->pScaledTCoeff[iMbXy], pCurLayer); | |
| 294 | + if (IS_INTRA16x16 (pCurDqLayer->pDec->pMbType[iMbXy])) { | |
| 295 | + RecI16x16Mb (iMbXy, pCtx, pCurDqLayer->pScaledTCoeff[iMbXy], pCurDqLayer); | |
| 296 | + } else if (IS_INTRA8x8 (pCurDqLayer->pDec->pMbType[iMbXy])) { | |
| 297 | + RecI8x8Mb (iMbXy, pCtx, pCurDqLayer->pScaledTCoeff[iMbXy], pCurDqLayer); | |
| 298 | + } else if (IS_INTRA4x4 (pCurDqLayer->pDec->pMbType[iMbXy])) { | |
| 299 | + RecI4x4Mb (iMbXy, pCtx, pCurDqLayer->pScaledTCoeff[iMbXy], pCurDqLayer); | |
| 300 | 300 | } |
| 301 | 301 | return ERR_NONE; |
| 302 | 302 | } |
| 303 | 303 | |
| 304 | −int32_t WelsMbInterPrediction (PWelsDecoderContext pCtx, PDqLayer pCurLayer) { | |
| 305 | − int32_t iMbX = pCurLayer->iMbX; | |
| 306 | − int32_t iMbY = pCurLayer->iMbY; | |
| 304 | +int32_t WelsMbInterPrediction (PWelsDecoderContext pCtx, PDqLayer pCurDqLayer) { | |
| 305 | + int32_t iMbX = pCurDqLayer->iMbX; | |
| 306 | + int32_t iMbY = pCurDqLayer->iMbY; | |
| 307 | 307 | uint8_t* pDstY, *pDstCb, *pDstCr; |
| 308 | 308 | |
| 309 | 309 | int32_t iLumaStride = pCtx->pDec->iLinesize[0]; |
| 310 | 310 | int32_t iChromaStride = pCtx->pDec->iLinesize[1]; |
| 311 | 311 | |
| 312 | − pDstY = pCurLayer->pDec->pData[0] + ((iMbY * iLumaStride + iMbX) << 4); | |
| 313 | − pDstCb = pCurLayer->pDec->pData[1] + ((iMbY * iChromaStride + iMbX) << 3); | |
| 314 | − pDstCr = pCurLayer->pDec->pData[2] + ((iMbY * iChromaStride + iMbX) << 3); | |
| 312 | + pDstY = pCurDqLayer->pDec->pData[0] + ((iMbY * iLumaStride + iMbX) << 4); | |
| 313 | + pDstCb = pCurDqLayer->pDec->pData[1] + ((iMbY * iChromaStride + iMbX) << 3); | |
| 314 | + pDstCr = pCurDqLayer->pDec->pData[2] + ((iMbY * iChromaStride + iMbX) << 3); | |
| 315 | 315 | |
| 316 | 316 | if (pCtx->eSliceType == P_SLICE) { |
| 317 | 317 | WELS_B_MB_REC_VERIFY (GetInterPred (pDstY, pDstCb, pDstCr, pCtx)); |
| @@ -332,24 +332,24 @@ int32_t WelsMbInterPrediction (PWelsDecoderContext pCtx, PDqLayer pCurLayer) { · 14 unmodified lines | ||
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | int32_t WelsTargetMbConstruction (PWelsDecoderContext pCtx) { |
| 335 | − PDqLayer pCurLayer = pCtx->pCurDqLayer; | |
| 336 | − if (MB_TYPE_INTRA_PCM == pCurLayer->pMbType[pCurLayer->iMbXyIndex]) { | |
| 335 | + PDqLayer pCurDqLayer = pCtx->pCurDqLayer; | |
| 336 | + if (MB_TYPE_INTRA_PCM == pCurDqLayer->pDec->pMbType[pCurDqLayer->iMbXyIndex]) { | |
| 337 | 337 | //already decoded and reconstructed when parsing |
| 338 | 338 | return ERR_NONE; |
| 339 | − } else if (IS_INTRA (pCurLayer->pMbType[pCurLayer->iMbXyIndex])) { | |
| 340 | − WelsMbIntraPredictionConstruction (pCtx, pCurLayer, 1); | |
| 341 | − } else if (IS_INTER (pCurLayer->pMbType[pCurLayer->iMbXyIndex])) { //InterMB | |
| 342 | − if (0 == pCurLayer->pCbp[pCurLayer->iMbXyIndex]) { //uiCbp==0 include SKIP | |
| 339 | + } else if (IS_INTRA (pCurDqLayer->pDec->pMbType[pCurDqLayer->iMbXyIndex])) { | |
| 340 | + WelsMbIntraPredictionConstruction (pCtx, pCurDqLayer, 1); | |
| 341 | + } else if (IS_INTER (pCurDqLayer->pDec->pMbType[pCurDqLayer->iMbXyIndex])) { //InterMB | |
| 342 | + if (0 == pCurDqLayer->pCbp[pCurDqLayer->iMbXyIndex]) { //uiCbp==0 include SKIP | |
| 343 | 343 | if (!CheckRefPics (pCtx)) { |
| 344 | 344 | return ERR_INFO_MB_RECON_FAIL; |
| 345 | 345 | } |
| 346 | − return WelsMbInterPrediction (pCtx, pCurLayer); | |
| 346 | + return WelsMbInterPrediction (pCtx, pCurDqLayer); | |
| 347 | 347 | } else { |
| 348 | − WelsMbInterConstruction (pCtx, pCurLayer); | |
| 348 | + WelsMbInterConstruction (pCtx, pCurDqLayer); | |
| 349 | 349 | } |
| 350 | 350 | } else { |
| 351 | 351 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "WelsTargetMbConstruction():::::Unknown MB type: %d", |
| 352 | − pCurLayer->pMbType[pCurLayer->iMbXyIndex]); | |
| 352 | + pCurDqLayer->pDec->pMbType[pCurDqLayer->iMbXyIndex]); | |
| 353 | 353 | return ERR_INFO_MB_RECON_FAIL; |
| 354 | 354 | } |
| 355 | 355 | |
| @@ -644,25 +644,25 @@ int32_t ParseIntra16x16Mode (PWelsDecoderContext pCtx, PWelsNeighAvail pNeighAva · 288 unmodified lines | ||
| 644 | 644 | } |
| 645 | 645 | |
| 646 | 646 | int32_t WelsDecodeMbCabacISliceBaseMode0 (PWelsDecoderContext pCtx, uint32_t& uiEosFlag) { |
| 647 | − PDqLayer pCurLayer = pCtx->pCurDqLayer; | |
| 648 | − PBitStringAux pBsAux = pCurLayer->pBitStringAux; | |
| 649 | − PSlice pSlice = &pCurLayer->sLayerInfo.sSliceInLayer; | |
| 647 | + PDqLayer pCurDqLayer = pCtx->pCurDqLayer; | |
| 648 | + PBitStringAux pBsAux = pCurDqLayer->pBitStringAux; | |
| 649 | + PSlice pSlice = &pCurDqLayer->sLayerInfo.sSliceInLayer; | |
| 650 | 650 | PSliceHeader pSliceHeader = &pSlice->sSliceHeaderExt.sSliceHeader; |
| 651 | 651 | SWelsNeighAvail sNeighAvail; |
| 652 | 652 | int32_t iScanIdxStart = pSlice->sSliceHeaderExt.uiScanIdxStart; |
| 653 | 653 | int32_t iScanIdxEnd = pSlice->sSliceHeaderExt.uiScanIdxEnd; |
| 654 | − int32_t iMbXy = pCurLayer->iMbXyIndex; | |
| 654 | + int32_t iMbXy = pCurDqLayer->iMbXyIndex; | |
| 655 | 655 | int32_t i; |
| 656 | 656 | uint32_t uiMbType = 0, uiCbp = 0, uiCbpLuma = 0, uiCbpChroma = 0; |
| 657 | 657 | |
| 658 | 658 | ENFORCE_STACK_ALIGN_1D (uint8_t, pNonZeroCount, 48, 16); |
| 659 | 659 | |
| 660 | − pCurLayer->pNoSubMbPartSizeLessThan8x8Flag[iMbXy] = true; | |
| 661 | − pCurLayer->pTransformSize8x8Flag[iMbXy] = false; | |
| 660 | + pCurDqLayer->pNoSubMbPartSizeLessThan8x8Flag[iMbXy] = true; | |
| 661 | + pCurDqLayer->pTransformSize8x8Flag[iMbXy] = false; | |
| 662 | 662 | |
| 663 | − pCurLayer->pInterPredictionDoneFlag[iMbXy] = 0; | |
| 664 | − pCurLayer->pResidualPredFlag[iMbXy] = pSlice->sSliceHeaderExt.bDefaultResidualPredFlag; | |
| 665 | − GetNeighborAvailMbType (&sNeighAvail, pCurLayer); | |
| 663 | + pCurDqLayer->pInterPredictionDoneFlag[iMbXy] = 0; | |
| 664 | + pCurDqLayer->pResidualPredFlag[iMbXy] = pSlice->sSliceHeaderExt.bDefaultResidualPredFlag; | |
| 665 | + GetNeighborAvailMbType (&sNeighAvail, pCurDqLayer); | |
| 666 | 666 | WELS_READ_VERIFY (ParseMBTypeISliceCabac (pCtx, &sNeighAvail, uiMbType)); |
| 667 | 667 | if (uiMbType > 25) { |
| 668 | 668 | return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_MB_TYPE); |
| @@ -680,104 +680,104 @@ int32_t WelsDecodeMbCabacISliceBaseMode0 (PWelsDecoderContext pCtx, uint32_t& ui · 11 unmodified lines | ||
| 680 | 680 | return ERR_NONE; |
| 681 | 681 | } else if (0 == uiMbType) { //I4x4 |
| 682 | 682 | ENFORCE_STACK_ALIGN_1D (int8_t, pIntraPredMode, 48, 16); |
| 683 | − pCurLayer->pMbType[iMbXy] = MB_TYPE_INTRA4x4; | |
| 683 | + pCurDqLayer->pDec->pMbType[iMbXy] = MB_TYPE_INTRA4x4; | |
| 684 | 684 | if (pCtx->pPps->bTransform8x8ModeFlag) { |
| 685 | 685 | // Transform 8x8 cabac will be added soon |
| 686 | 686 | WELS_READ_VERIFY (ParseTransformSize8x8FlagCabac (pCtx, &sNeighAvail, pCtx->pCurDqLayer->pTransformSize8x8Flag[iMbXy])); |
| 687 | 687 | } |
| 688 | 688 | if (pCtx->pCurDqLayer->pTransformSize8x8Flag[iMbXy]) { |
| 689 | − uiMbType = pCurLayer->pMbType[iMbXy] = MB_TYPE_INTRA8x8; | |
| 690 | − pCtx->pFillInfoCacheIntraNxNFunc (&sNeighAvail, pNonZeroCount, pIntraPredMode, pCurLayer); | |
| 691 | − WELS_READ_VERIFY (ParseIntra8x8Mode (pCtx, &sNeighAvail, pIntraPredMode, pBsAux, pCurLayer)); | |
| 689 | + uiMbType = pCurDqLayer->pDec->pMbType[iMbXy] = MB_TYPE_INTRA8x8; | |
| 690 | + pCtx->pFillInfoCacheIntraNxNFunc (&sNeighAvail, pNonZeroCount, pIntraPredMode, pCurDqLayer); | |
| 691 | + WELS_READ_VERIFY (ParseIntra8x8Mode (pCtx, &sNeighAvail, pIntraPredMode, pBsAux, pCurDqLayer)); | |
| 692 | 692 | } else { |
| 693 | − pCtx->pFillInfoCacheIntraNxNFunc (&sNeighAvail, pNonZeroCount, pIntraPredMode, pCurLayer); | |
| 694 | − WELS_READ_VERIFY (ParseIntra4x4Mode (pCtx, &sNeighAvail, pIntraPredMode, pBsAux, pCurLayer)); | |
| 693 | + pCtx->pFillInfoCacheIntraNxNFunc (&sNeighAvail, pNonZeroCount, pIntraPredMode, pCurDqLayer); | |
| 694 | + WELS_READ_VERIFY (ParseIntra4x4Mode (pCtx, &sNeighAvail, pIntraPredMode, pBsAux, pCurDqLayer)); | |
| 695 | 695 | } |
| 696 | 696 | //get uiCbp for I4x4 |
| 697 | 697 | WELS_READ_VERIFY (ParseCbpInfoCabac (pCtx, &sNeighAvail, uiCbp)); |
| 698 | − pCurLayer->pCbp[iMbXy] = uiCbp; | |
| 698 | + pCurDqLayer->pCbp[iMbXy] = uiCbp; | |
| 699 | 699 | pSlice->iLastDeltaQp = uiCbp == 0 ? 0 : pSlice->iLastDeltaQp; |
| 700 | 700 | uiCbpChroma = pCtx->pSps->uiChromaFormatIdc ? uiCbp >> 4 : 0; |
| 701 | 701 | uiCbpLuma = uiCbp & 15; |
| 702 | 702 | } else { //I16x16; |
| 703 | − pCurLayer->pMbType[iMbXy] = MB_TYPE_INTRA16x16; | |
| 704 | − pCurLayer->pTransformSize8x8Flag[iMbXy] = false; | |
| 705 | − pCurLayer->pNoSubMbPartSizeLessThan8x8Flag[iMbXy] = true; | |
| 706 | − pCurLayer->pIntraPredMode[iMbXy][7] = (uiMbType - 1) & 3; | |
| 707 | − pCurLayer->pCbp[iMbXy] = g_kuiI16CbpTable[ (uiMbType - 1) >> 2]; | |
| 708 | − uiCbpChroma = pCtx->pSps->uiChromaFormatIdc ? pCurLayer->pCbp[iMbXy] >> 4 : 0 ; | |
| 709 | − uiCbpLuma = pCurLayer->pCbp[iMbXy] & 15; | |
| 710 | − WelsFillCacheNonZeroCount (&sNeighAvail, pNonZeroCount, pCurLayer); | |
| 711 | − WELS_READ_VERIFY (ParseIntra16x16Mode (pCtx, &sNeighAvail, pBsAux, pCurLayer)); | |
| 712 | − } | |
| 713 | − | |
| 714 | − ST32 (&pCurLayer->pNzc[iMbXy][0], 0); | |
| 715 | − ST32 (&pCurLayer->pNzc[iMbXy][4], 0); | |
| 716 | − ST32 (&pCurLayer->pNzc[iMbXy][8], 0); | |
| 717 | − ST32 (&pCurLayer->pNzc[iMbXy][12], 0); | |
| 718 | − ST32 (&pCurLayer->pNzc[iMbXy][16], 0); | |
| 719 | − ST32 (&pCurLayer->pNzc[iMbXy][20], 0); | |
| 720 | − pCurLayer->pCbfDc[iMbXy] = 0; | |
| 721 | − | |
| 722 | − if (pCurLayer->pCbp[iMbXy] == 0 && IS_INTRANxN (pCurLayer->pMbType[iMbXy])) { | |
| 723 | − pCurLayer->pLumaQp[iMbXy] = pSlice->iLastMbQp; | |
| 703 | + pCurDqLayer->pDec->pMbType[iMbXy] = MB_TYPE_INTRA16x16; | |
| 704 | + pCurDqLayer->pTransformSize8x8Flag[iMbXy] = false; | |
| 705 | + pCurDqLayer->pNoSubMbPartSizeLessThan8x8Flag[iMbXy] = true; | |
| 706 | + pCurDqLayer->pIntraPredMode[iMbXy][7] = (uiMbType - 1) & 3; | |
| 707 | + pCurDqLayer->pCbp[iMbXy] = g_kuiI16CbpTable[ (uiMbType - 1) >> 2]; | |
| 708 | + uiCbpChroma = pCtx->pSps->uiChromaFormatIdc ? pCurDqLayer->pCbp[iMbXy] >> 4 : 0 ; | |
| 709 | + uiCbpLuma = pCurDqLayer->pCbp[iMbXy] & 15; | |
| 710 | + WelsFillCacheNonZeroCount (&sNeighAvail, pNonZeroCount, pCurDqLayer); | |
| 711 | + WELS_READ_VERIFY (ParseIntra16x16Mode (pCtx, &sNeighAvail, pBsAux, pCurDqLayer)); | |
| 712 | + } | |
| 713 | + | |
| 714 | + ST32 (&pCurDqLayer->pNzc[iMbXy][0], 0); | |
| 715 | + ST32 (&pCurDqLayer->pNzc[iMbXy][4], 0); | |
| 716 | + ST32 (&pCurDqLayer->pNzc[iMbXy][8], 0); | |
| 717 | + ST32 (&pCurDqLayer->pNzc[iMbXy][12], 0); | |
| 718 | + ST32 (&pCurDqLayer->pNzc[iMbXy][16], 0); | |
| 719 | + ST32 (&pCurDqLayer->pNzc[iMbXy][20], 0); | |
| 720 | + pCurDqLayer->pCbfDc[iMbXy] = 0; | |
| 721 | + | |
| 722 | + if (pCurDqLayer->pCbp[iMbXy] == 0 && IS_INTRANxN (pCurDqLayer->pDec->pMbType[iMbXy])) { | |
| 723 | + pCurDqLayer->pLumaQp[iMbXy] = pSlice->iLastMbQp; | |
| 724 | 724 | for (i = 0; i < 2; i++) { |
| 725 | − pCurLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 ((pCurLayer->pLumaQp[iMbXy] + | |
| 725 | + pCurDqLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 ((pCurDqLayer->pLumaQp[iMbXy] + | |
| 726 | 726 | pSliceHeader->pPps->iChromaQpIndexOffset[i]), 0, 51)]; |
| 727 | 727 | } |
| 728 | 728 | } |
| 729 | 729 | |
| 730 | − if (pCurLayer->pCbp[iMbXy] || MB_TYPE_INTRA16x16 == pCurLayer->pMbType[iMbXy]) { | |
| 731 | − memset (pCurLayer->pScaledTCoeff[iMbXy], 0, 384 * sizeof (pCurLayer->pScaledTCoeff[iMbXy][0])); | |
| 730 | + if (pCurDqLayer->pCbp[iMbXy] || MB_TYPE_INTRA16x16 == pCurDqLayer->pDec->pMbType[iMbXy]) { | |
| 731 | + memset (pCurDqLayer->pScaledTCoeff[iMbXy], 0, 384 * sizeof (pCurDqLayer->pScaledTCoeff[iMbXy][0])); | |
| 732 | 732 | int32_t iQpDelta, iId8x8, iId4x4; |
| 733 | 733 | WELS_READ_VERIFY (ParseDeltaQpCabac (pCtx, iQpDelta)); |
| 734 | 734 | if (iQpDelta > 25 || iQpDelta < -26) {//out of iQpDelta range |
| 735 | 735 | return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_QP); |
| 736 | 736 | } |
| 737 | − pCurLayer->pLumaQp[iMbXy] = (pSlice->iLastMbQp + iQpDelta + 52) % 52; //update last_mb_qp | |
| 738 | − pSlice->iLastMbQp = pCurLayer->pLumaQp[iMbXy]; | |
| 737 | + pCurDqLayer->pLumaQp[iMbXy] = (pSlice->iLastMbQp + iQpDelta + 52) % 52; //update last_mb_qp | |
| 738 | + pSlice->iLastMbQp = pCurDqLayer->pLumaQp[iMbXy]; | |
| 739 | 739 | for (i = 0; i < 2; i++) { |
| 740 | − pCurLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 ((pSlice->iLastMbQp + | |
| 740 | + pCurDqLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 ((pSlice->iLastMbQp + | |
| 741 | 741 | pSliceHeader->pPps->iChromaQpIndexOffset[i]), 0, 51)]; |
| 742 | 742 | } |
| 743 | − if (MB_TYPE_INTRA16x16 == pCurLayer->pMbType[iMbXy]) { | |
| 743 | + if (MB_TYPE_INTRA16x16 == pCurDqLayer->pDec->pMbType[iMbXy]) { | |
| 744 | 744 | //step1: Luma DC |
| 745 | 745 | WELS_READ_VERIFY (ParseResidualBlockCabac (&sNeighAvail, pNonZeroCount, pBsAux, 0, 16, g_kuiLumaDcZigzagScan, |
| 746 | − I16_LUMA_DC, pCurLayer->pScaledTCoeff[iMbXy], pCurLayer->pLumaQp[iMbXy], pCtx)); | |
| 746 | + I16_LUMA_DC, pCurDqLayer->pScaledTCoeff[iMbXy], pCurDqLayer->pLumaQp[iMbXy], pCtx)); | |
| 747 | 747 | //step2: Luma AC |
| 748 | 748 | if (uiCbpLuma) { |
| 749 | 749 | for (i = 0; i < 16; i++) { |
| 750 | 750 | WELS_READ_VERIFY (ParseResidualBlockCabac (&sNeighAvail, pNonZeroCount, pBsAux, i, |
| 751 | 751 | iScanIdxEnd - WELS_MAX (iScanIdxStart, 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1), I16_LUMA_AC, |
| 752 | − pCurLayer->pScaledTCoeff[iMbXy] + (i << 4), pCurLayer->pLumaQp[iMbXy], pCtx)); | |
| 752 | + pCurDqLayer->pScaledTCoeff[iMbXy] + (i << 4), pCurDqLayer->pLumaQp[iMbXy], pCtx)); | |
| 753 | 753 | } |
| 754 | − ST32 (&pCurLayer->pNzc[iMbXy][0], LD32 (&pNonZeroCount[1 + 8 * 1])); | |
| 755 | − ST32 (&pCurLayer->pNzc[iMbXy][4], LD32 (&pNonZeroCount[1 + 8 * 2])); | |
| 756 | − ST32 (&pCurLayer->pNzc[iMbXy][8], LD32 (&pNonZeroCount[1 + 8 * 3])); | |
| 757 | − ST32 (&pCurLayer->pNzc[iMbXy][12], LD32 (&pNonZeroCount[1 + 8 * 4])); | |
| 754 | + ST32 (&pCurDqLayer->pNzc[iMbXy][0], LD32 (&pNonZeroCount[1 + 8 * 1])); | |
| 755 | + ST32 (&pCurDqLayer->pNzc[iMbXy][4], LD32 (&pNonZeroCount[1 + 8 * 2])); | |
| 756 | + ST32 (&pCurDqLayer->pNzc[iMbXy][8], LD32 (&pNonZeroCount[1 + 8 * 3])); | |
| 757 | + ST32 (&pCurDqLayer->pNzc[iMbXy][12], LD32 (&pNonZeroCount[1 + 8 * 4])); | |
| 758 | 758 | } else { //pNonZeroCount = 0 |
| 759 | − ST32 (&pCurLayer->pNzc[iMbXy][0], 0); | |
| 760 | − ST32 (&pCurLayer->pNzc[iMbXy][4], 0); | |
| 761 | − ST32 (&pCurLayer->pNzc[iMbXy][8], 0); | |
| 762 | − ST32 (&pCurLayer->pNzc[iMbXy][12], 0); | |
| 759 | + ST32 (&pCurDqLayer->pNzc[iMbXy][0], 0); | |
| 760 | + ST32 (&pCurDqLayer->pNzc[iMbXy][4], 0); | |
| 761 | + ST32 (&pCurDqLayer->pNzc[iMbXy][8], 0); | |
| 762 | + ST32 (&pCurDqLayer->pNzc[iMbXy][12], 0); | |
| 763 | 763 | } |
| 764 | 764 | } else { //non-MB_TYPE_INTRA16x16 |
| 765 | − if (pCurLayer->pTransformSize8x8Flag[iMbXy]) { | |
| 765 | + if (pCurDqLayer->pTransformSize8x8Flag[iMbXy]) { | |
| 766 | 766 | // Transform 8x8 support for CABAC |
| 767 | 767 | for (iId8x8 = 0; iId8x8 < 4; iId8x8++) { |
| 768 | 768 | if (uiCbpLuma & (1 << iId8x8)) { |
| 769 | 769 | WELS_READ_VERIFY (ParseResidualBlockCabac8x8 (&sNeighAvail, pNonZeroCount, pBsAux, (iId8x8 << 2), |
| 770 | 770 | iScanIdxEnd - iScanIdxStart + 1, g_kuiZigzagScan8x8 + iScanIdxStart, LUMA_DC_AC_INTRA_8, |
| 771 | − pCurLayer->pScaledTCoeff[iMbXy] + (iId8x8 << 6), pCurLayer->pLumaQp[iMbXy], pCtx)); | |
| 771 | + pCurDqLayer->pScaledTCoeff[iMbXy] + (iId8x8 << 6), pCurDqLayer->pLumaQp[iMbXy], pCtx)); | |
| 772 | 772 | } else { |
| 773 | 773 | ST16 (&pNonZeroCount[g_kCacheNzcScanIdx[ (iId8x8 << 2)]], 0); |
| 774 | 774 | ST16 (&pNonZeroCount[g_kCacheNzcScanIdx[ (iId8x8 << 2) + 2]], 0); |
| 775 | 775 | } |
| 776 | 776 | } |
| 777 | − ST32 (&pCurLayer->pNzc[iMbXy][0], LD32 (&pNonZeroCount[1 + 8 * 1])); | |
| 778 | − ST32 (&pCurLayer->pNzc[iMbXy][4], LD32 (&pNonZeroCount[1 + 8 * 2])); | |
| 779 | − ST32 (&pCurLayer->pNzc[iMbXy][8], LD32 (&pNonZeroCount[1 + 8 * 3])); | |
| 780 | − ST32 (&pCurLayer->pNzc[iMbXy][12], LD32 (&pNonZeroCount[1 + 8 * 4])); | |
| 777 | + ST32 (&pCurDqLayer->pNzc[iMbXy][0], LD32 (&pNonZeroCount[1 + 8 * 1])); | |
| 778 | + ST32 (&pCurDqLayer->pNzc[iMbXy][4], LD32 (&pNonZeroCount[1 + 8 * 2])); | |
| 779 | + ST32 (&pCurDqLayer->pNzc[iMbXy][8], LD32 (&pNonZeroCount[1 + 8 * 3])); | |
| 780 | + ST32 (&pCurDqLayer->pNzc[iMbXy][12], LD32 (&pNonZeroCount[1 + 8 * 4])); | |
| 781 | 781 | } else { |
| 782 | 782 | for (iId8x8 = 0; iId8x8 < 4; iId8x8++) { |
| 783 | 783 | if (uiCbpLuma & (1 << iId8x8)) { |
| @@ -785,8 +785,8 @@ int32_t WelsDecodeMbCabacISliceBaseMode0 (PWelsDecoderContext pCtx, uint32_t& ui · 1 unmodified line | ||
| 785 | 785 | for (iId4x4 = 0; iId4x4 < 4; iId4x4++) { |
| 786 | 786 | //Luma (DC and AC decoding together) |
| 787 | 787 | WELS_READ_VERIFY (ParseResidualBlockCabac (&sNeighAvail, pNonZeroCount, pBsAux, iIdx, iScanIdxEnd - iScanIdxStart + 1, |
| 788 | − g_kuiZigzagScan + iScanIdxStart, LUMA_DC_AC_INTRA, pCurLayer->pScaledTCoeff[iMbXy] + (iIdx << 4), | |
| 789 | − pCurLayer->pLumaQp[iMbXy], pCtx)); | |
| 788 | + g_kuiZigzagScan + iScanIdxStart, LUMA_DC_AC_INTRA, pCurDqLayer->pScaledTCoeff[iMbXy] + (iIdx << 4), | |
| 789 | + pCurDqLayer->pLumaQp[iMbXy], pCtx)); | |
| 790 | 790 | iIdx++; |
| 791 | 791 | } |
| 792 | 792 | } else { |
| @@ -794,10 +794,10 @@ int32_t WelsDecodeMbCabacISliceBaseMode0 (PWelsDecoderContext pCtx, uint32_t& ui · 1 unmodified line | ||
| 794 | 794 | ST16 (&pNonZeroCount[g_kCacheNzcScanIdx[ (iId8x8 << 2) + 2]], 0); |
| 795 | 795 | } |
| 796 | 796 | } |
| 797 | − ST32 (&pCurLayer->pNzc[iMbXy][0], LD32 (&pNonZeroCount[1 + 8 * 1])); | |
| 798 | − ST32 (&pCurLayer->pNzc[iMbXy][4], LD32 (&pNonZeroCount[1 + 8 * 2])); | |
| 799 | − ST32 (&pCurLayer->pNzc[iMbXy][8], LD32 (&pNonZeroCount[1 + 8 * 3])); | |
| 800 | − ST32 (&pCurLayer->pNzc[iMbXy][12], LD32 (&pNonZeroCount[1 + 8 * 4])); | |
| 797 | + ST32 (&pCurDqLayer->pNzc[iMbXy][0], LD32 (&pNonZeroCount[1 + 8 * 1])); | |
| 798 | + ST32 (&pCurDqLayer->pNzc[iMbXy][4], LD32 (&pNonZeroCount[1 + 8 * 2])); | |
| 799 | + ST32 (&pCurDqLayer->pNzc[iMbXy][8], LD32 (&pNonZeroCount[1 + 8 * 3])); | |
| 800 | + ST32 (&pCurDqLayer->pNzc[iMbXy][12], LD32 (&pNonZeroCount[1 + 8 * 4])); | |
| 801 | 801 | } |
| 802 | 802 | } |
| 803 | 803 | int32_t iMbResProperty; |
| @@ -808,7 +808,7 @@ int32_t WelsDecodeMbCabacISliceBaseMode0 (PWelsDecoderContext pCtx, uint32_t& ui · 4 unmodified lines | ||
| 808 | 808 | for (i = 0; i < 2; i++) { |
| 809 | 809 | iMbResProperty = i ? CHROMA_DC_V : CHROMA_DC_U; |
| 810 | 810 | WELS_READ_VERIFY (ParseResidualBlockCabac (&sNeighAvail, pNonZeroCount, pBsAux, 16 + (i << 2), 4, g_kuiChromaDcScan, |
| 811 | − iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + 256 + (i << 6), pCurLayer->pChromaQp[iMbXy][i], pCtx)); | |
| 811 | + iMbResProperty, pCurDqLayer->pScaledTCoeff[iMbXy] + 256 + (i << 6), pCurDqLayer->pChromaQp[iMbXy][i], pCtx)); | |
| 812 | 812 | } |
| 813 | 813 | } |
| 814 | 814 | |
| @@ -820,27 +820,27 @@ int32_t WelsDecodeMbCabacISliceBaseMode0 (PWelsDecoderContext pCtx, uint32_t& ui · 5 unmodified lines | ||
| 820 | 820 | for (iId4x4 = 0; iId4x4 < 4; iId4x4++) { |
| 821 | 821 | WELS_READ_VERIFY (ParseResidualBlockCabac (&sNeighAvail, pNonZeroCount, pBsAux, iIdx, |
| 822 | 822 | iScanIdxEnd - WELS_MAX (iScanIdxStart, 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1), iMbResProperty, |
| 823 | − pCurLayer->pScaledTCoeff[iMbXy] + (iIdx << 4), pCurLayer->pChromaQp[iMbXy][i], pCtx)); | |
| 823 | + pCurDqLayer->pScaledTCoeff[iMbXy] + (iIdx << 4), pCurDqLayer->pChromaQp[iMbXy][i], pCtx)); | |
| 824 | 824 | iIdx++; |
| 825 | 825 | } |
| 826 | 826 | } |
| 827 | − ST16 (&pCurLayer->pNzc[iMbXy][16], LD16 (&pNonZeroCount[6 + 8 * 1])); | |
| 828 | − ST16 (&pCurLayer->pNzc[iMbXy][20], LD16 (&pNonZeroCount[6 + 8 * 2])); | |
| 829 | − ST16 (&pCurLayer->pNzc[iMbXy][18], LD16 (&pNonZeroCount[6 + 8 * 4])); | |
| 830 | − ST16 (&pCurLayer->pNzc[iMbXy][22], LD16 (&pNonZeroCount[6 + 8 * 5])); | |
| 827 | + ST16 (&pCurDqLayer->pNzc[iMbXy][16], LD16 (&pNonZeroCount[6 + 8 * 1])); | |
| 828 | + ST16 (&pCurDqLayer->pNzc[iMbXy][20], LD16 (&pNonZeroCount[6 + 8 * 2])); | |
| 829 | + ST16 (&pCurDqLayer->pNzc[iMbXy][18], LD16 (&pNonZeroCount[6 + 8 * 4])); | |
| 830 | + ST16 (&pCurDqLayer->pNzc[iMbXy][22], LD16 (&pNonZeroCount[6 + 8 * 5])); | |
| 831 | 831 | } else { |
| 832 | − ST16 (&pCurLayer->pNzc[iMbXy][16], 0); | |
| 833 | − ST16 (&pCurLayer->pNzc[iMbXy][20], 0); | |
| 834 | − ST16 (&pCurLayer->pNzc[iMbXy][18], 0); | |
| 835 | − ST16 (&pCurLayer->pNzc[iMbXy][22], 0); | |
| 832 | + ST16 (&pCurDqLayer->pNzc[iMbXy][16], 0); | |
| 833 | + ST16 (&pCurDqLayer->pNzc[iMbXy][20], 0); | |
| 834 | + ST16 (&pCurDqLayer->pNzc[iMbXy][18], 0); | |
| 835 | + ST16 (&pCurDqLayer->pNzc[iMbXy][22], 0); | |
| 836 | 836 | } |
| 837 | 837 | } else { |
| 838 | − ST32 (&pCurLayer->pNzc[iMbXy][0], 0); | |
| 839 | − ST32 (&pCurLayer->pNzc[iMbXy][4], 0); | |
| 840 | − ST32 (&pCurLayer->pNzc[iMbXy][8], 0); | |
| 841 | − ST32 (&pCurLayer->pNzc[iMbXy][12], 0); | |
| 842 | − ST32 (&pCurLayer->pNzc[iMbXy][16], 0); | |
| 843 | − ST32 (&pCurLayer->pNzc[iMbXy][20], 0); | |
| 838 | + ST32 (&pCurDqLayer->pNzc[iMbXy][0], 0); | |
| 839 | + ST32 (&pCurDqLayer->pNzc[iMbXy][4], 0); | |
| 840 | + ST32 (&pCurDqLayer->pNzc[iMbXy][8], 0); | |
| 841 | + ST32 (&pCurDqLayer->pNzc[iMbXy][12], 0); | |
| 842 | + ST32 (&pCurDqLayer->pNzc[iMbXy][16], 0); | |
| 843 | + ST32 (&pCurDqLayer->pNzc[iMbXy][20], 0); | |
| 844 | 844 | } |
| 845 | 845 | |
| 846 | 846 | WELS_READ_VERIFY (ParseEndOfSliceCabac (pCtx, uiEosFlag)); |
| @@ -856,21 +856,21 @@ int32_t WelsDecodeMbCabacISlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 9 unmodified lines | ||
| 856 | 856 | } |
| 857 | 857 | |
| 858 | 858 | int32_t WelsDecodeMbCabacPSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAvail pNeighAvail, uint32_t& uiEosFlag) { |
| 859 | − PDqLayer pCurLayer = pCtx->pCurDqLayer; | |
| 860 | − PBitStringAux pBsAux = pCurLayer->pBitStringAux; | |
| 861 | − PSlice pSlice = &pCurLayer->sLayerInfo.sSliceInLayer; | |
| 859 | + PDqLayer pCurDqLayer = pCtx->pCurDqLayer; | |
| 860 | + PBitStringAux pBsAux = pCurDqLayer->pBitStringAux; | |
| 861 | + PSlice pSlice = &pCurDqLayer->sLayerInfo.sSliceInLayer; | |
| 862 | 862 | PSliceHeader pSliceHeader = &pSlice->sSliceHeaderExt.sSliceHeader; |
| 863 | 863 | |
| 864 | 864 | int32_t iScanIdxStart = pSlice->sSliceHeaderExt.uiScanIdxStart; |
| 865 | 865 | int32_t iScanIdxEnd = pSlice->sSliceHeaderExt.uiScanIdxEnd; |
| 866 | − int32_t iMbXy = pCurLayer->iMbXyIndex; | |
| 866 | + int32_t iMbXy = pCurDqLayer->iMbXyIndex; | |
| 867 | 867 | int32_t iMbResProperty; |
| 868 | 868 | int32_t i; |
| 869 | 869 | uint32_t uiMbType = 0, uiCbp = 0, uiCbpLuma = 0, uiCbpChroma = 0; |
| 870 | 870 | |
| 871 | 871 | ENFORCE_STACK_ALIGN_1D (uint8_t, pNonZeroCount, 48, 16); |
| 872 | 872 | |
| 873 | − pCurLayer->pInterPredictionDoneFlag[iMbXy] = 0; | |
| 873 | + pCurDqLayer->pInterPredictionDoneFlag[iMbXy] = 0; | |
| 874 | 874 | |
| 875 | 875 | WELS_READ_VERIFY (ParseMBTypePSliceCabac (pCtx, pNeighAvail, uiMbType)); |
| 876 | 876 | // uiMbType = 4 is not allowded. |
| @@ -878,10 +878,10 @@ int32_t WelsDecodeMbCabacPSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 1 unmodified line | ||
| 878 | 878 | int16_t pMotionVector[LIST_A][30][MV_A]; |
| 879 | 879 | int16_t pMvdCache[LIST_A][30][MV_A]; |
| 880 | 880 | int8_t pRefIndex[LIST_A][30]; |
| 881 | − pCurLayer->pMbType[iMbXy] = g_ksInterPMbTypeInfo[uiMbType].iType; | |
| 882 | − WelsFillCacheInterCabac (pNeighAvail, pNonZeroCount, pMotionVector, pMvdCache, pRefIndex, pCurLayer); | |
| 881 | + pCurDqLayer->pDec->pMbType[iMbXy] = g_ksInterPMbTypeInfo[uiMbType].iType; | |
| 882 | + WelsFillCacheInterCabac (pNeighAvail, pNonZeroCount, pMotionVector, pMvdCache, pRefIndex, pCurDqLayer); | |
| 883 | 883 | WELS_READ_VERIFY (ParseInterPMotionInfoCabac (pCtx, pNeighAvail, pNonZeroCount, pMotionVector, pMvdCache, pRefIndex)); |
| 884 | − pCurLayer->pInterPredictionDoneFlag[iMbXy] = 0; | |
| 884 | + pCurDqLayer->pInterPredictionDoneFlag[iMbXy] = 0; | |
| 885 | 885 | } else { //Intra mode |
| 886 | 886 | uiMbType -= 5; |
| 887 | 887 | if (uiMbType > 25) |
| @@ -901,58 +901,58 @@ int32_t WelsDecodeMbCabacPSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 13 unmodified lines | ||
| 901 | 901 | } else { //normal Intra mode |
| 902 | 902 | if (0 == uiMbType) { //Intra4x4 |
| 903 | 903 | ENFORCE_STACK_ALIGN_1D (int8_t, pIntraPredMode, 48, 16); |
| 904 | − pCurLayer->pMbType[iMbXy] = MB_TYPE_INTRA4x4; | |
| 904 | + pCurDqLayer->pDec->pMbType[iMbXy] = MB_TYPE_INTRA4x4; | |
| 905 | 905 | if (pCtx->pPps->bTransform8x8ModeFlag) { |
| 906 | 906 | WELS_READ_VERIFY (ParseTransformSize8x8FlagCabac (pCtx, pNeighAvail, pCtx->pCurDqLayer->pTransformSize8x8Flag[iMbXy])); |
| 907 | 907 | } |
| 908 | 908 | if (pCtx->pCurDqLayer->pTransformSize8x8Flag[iMbXy]) { |
| 909 | − uiMbType = pCurLayer->pMbType[iMbXy] = MB_TYPE_INTRA8x8; | |
| 910 | − pCtx->pFillInfoCacheIntraNxNFunc (pNeighAvail, pNonZeroCount, pIntraPredMode, pCurLayer); | |
| 911 | − WELS_READ_VERIFY (ParseIntra8x8Mode (pCtx, pNeighAvail, pIntraPredMode, pBsAux, pCurLayer)); | |
| 909 | + uiMbType = pCurDqLayer->pDec->pMbType[iMbXy] = MB_TYPE_INTRA8x8; | |
| 910 | + pCtx->pFillInfoCacheIntraNxNFunc (pNeighAvail, pNonZeroCount, pIntraPredMode, pCurDqLayer); | |
| 911 | + WELS_READ_VERIFY (ParseIntra8x8Mode (pCtx, pNeighAvail, pIntraPredMode, pBsAux, pCurDqLayer)); | |
| 912 | 912 | } else { |
| 913 | − pCtx->pFillInfoCacheIntraNxNFunc (pNeighAvail, pNonZeroCount, pIntraPredMode, pCurLayer); | |
| 914 | − WELS_READ_VERIFY (ParseIntra4x4Mode (pCtx, pNeighAvail, pIntraPredMode, pBsAux, pCurLayer)); | |
| 913 | + pCtx->pFillInfoCacheIntraNxNFunc (pNeighAvail, pNonZeroCount, pIntraPredMode, pCurDqLayer); | |
| 914 | + WELS_READ_VERIFY (ParseIntra4x4Mode (pCtx, pNeighAvail, pIntraPredMode, pBsAux, pCurDqLayer)); | |
| 915 | 915 | } |
| 916 | 916 | } else { //Intra16x16 |
| 917 | − pCurLayer->pMbType[iMbXy] = MB_TYPE_INTRA16x16; | |
| 918 | − pCurLayer->pTransformSize8x8Flag[iMbXy] = false; | |
| 919 | − pCurLayer->pNoSubMbPartSizeLessThan8x8Flag[iMbXy] = true; | |
| 920 | − pCurLayer->pIntraPredMode[iMbXy][7] = (uiMbType - 1) & 3; | |
| 921 | − pCurLayer->pCbp[iMbXy] = g_kuiI16CbpTable[ (uiMbType - 1) >> 2]; | |
| 922 | − uiCbpChroma = pCtx->pSps->uiChromaFormatIdc ? pCurLayer->pCbp[iMbXy] >> 4 : 0; | |
| 923 | − uiCbpLuma = pCurLayer->pCbp[iMbXy] & 15; | |
| 924 | − WelsFillCacheNonZeroCount (pNeighAvail, pNonZeroCount, pCurLayer); | |
| 925 | − WELS_READ_VERIFY (ParseIntra16x16Mode (pCtx, pNeighAvail, pBsAux, pCurLayer)); | |
| 917 | + pCurDqLayer->pDec->pMbType[iMbXy] = MB_TYPE_INTRA16x16; | |
| 918 | + pCurDqLayer->pTransformSize8x8Flag[iMbXy] = false; | |
| 919 | + pCurDqLayer->pNoSubMbPartSizeLessThan8x8Flag[iMbXy] = true; | |
| 920 | + pCurDqLayer->pIntraPredMode[iMbXy][7] = (uiMbType - 1) & 3; | |
| 921 | + pCurDqLayer->pCbp[iMbXy] = g_kuiI16CbpTable[ (uiMbType - 1) >> 2]; | |
| 922 | + uiCbpChroma = pCtx->pSps->uiChromaFormatIdc ? pCurDqLayer->pCbp[iMbXy] >> 4 : 0; | |
| 923 | + uiCbpLuma = pCurDqLayer->pCbp[iMbXy] & 15; | |
| 924 | + WelsFillCacheNonZeroCount (pNeighAvail, pNonZeroCount, pCurDqLayer); | |
| 925 | + WELS_READ_VERIFY (ParseIntra16x16Mode (pCtx, pNeighAvail, pBsAux, pCurDqLayer)); | |
| 926 | 926 | } |
| 927 | 927 | } |
| 928 | 928 | } |
| 929 | 929 | |
| 930 | − ST32 (&pCurLayer->pNzc[iMbXy][0], 0); | |
| 931 | − ST32 (&pCurLayer->pNzc[iMbXy][4], 0); | |
| 932 | − ST32 (&pCurLayer->pNzc[iMbXy][8], 0); | |
| 933 | − ST32 (&pCurLayer->pNzc[iMbXy][12], 0); | |
| 934 | − ST32 (&pCurLayer->pNzc[iMbXy][16], 0); | |
| 935 | − ST32 (&pCurLayer->pNzc[iMbXy][20], 0); | |
| 930 | + ST32 (&pCurDqLayer->pNzc[iMbXy][0], 0); | |
| 931 | + ST32 (&pCurDqLayer->pNzc[iMbXy][4], 0); | |
| 932 | + ST32 (&pCurDqLayer->pNzc[iMbXy][8], 0); | |
| 933 | + ST32 (&pCurDqLayer->pNzc[iMbXy][12], 0); | |
| 934 | + ST32 (&pCurDqLayer->pNzc[iMbXy][16], 0); | |
| 935 | + ST32 (&pCurDqLayer->pNzc[iMbXy][20], 0); | |
| 936 | 936 | |
| 937 | − if (MB_TYPE_INTRA16x16 != pCurLayer->pMbType[iMbXy]) { | |
| 937 | + if (MB_TYPE_INTRA16x16 != pCurDqLayer->pDec->pMbType[iMbXy]) { | |
| 938 | 938 | WELS_READ_VERIFY (ParseCbpInfoCabac (pCtx, pNeighAvail, uiCbp)); |
| 939 | 939 | |
| 940 | − pCurLayer->pCbp[iMbXy] = uiCbp; | |
| 940 | + pCurDqLayer->pCbp[iMbXy] = uiCbp; | |
| 941 | 941 | pSlice->iLastDeltaQp = uiCbp == 0 ? 0 : pSlice->iLastDeltaQp; |
| 942 | − uiCbpChroma = pCtx->pSps->uiChromaFormatIdc ? pCurLayer->pCbp[iMbXy] >> 4 : 0 ; | |
| 943 | − uiCbpLuma = pCurLayer->pCbp[iMbXy] & 15; | |
| 942 | + uiCbpChroma = pCtx->pSps->uiChromaFormatIdc ? pCurDqLayer->pCbp[iMbXy] >> 4 : 0 ; | |
| 943 | + uiCbpLuma = pCurDqLayer->pCbp[iMbXy] & 15; | |
| 944 | 944 | } |
| 945 | 945 | |
| 946 | − if (pCurLayer->pCbp[iMbXy] || MB_TYPE_INTRA16x16 == pCurLayer->pMbType[iMbXy]) { | |
| 946 | + if (pCurDqLayer->pCbp[iMbXy] || MB_TYPE_INTRA16x16 == pCurDqLayer->pDec->pMbType[iMbXy]) { | |
| 947 | 947 | |
| 948 | − if (MB_TYPE_INTRA16x16 != pCurLayer->pMbType[iMbXy]) { | |
| 948 | + if (MB_TYPE_INTRA16x16 != pCurDqLayer->pDec->pMbType[iMbXy]) { | |
| 949 | 949 | // Need modification when B picutre add in |
| 950 | 950 | bool bNeedParseTransformSize8x8Flag = |
| 951 | − (((pCurLayer->pMbType[iMbXy] >= MB_TYPE_16x16 && pCurLayer->pMbType[iMbXy] <= MB_TYPE_8x16) | |
| 952 | − || pCurLayer->pNoSubMbPartSizeLessThan8x8Flag[iMbXy]) | |
| 953 | − && (pCurLayer->pMbType[iMbXy] != MB_TYPE_INTRA8x8) | |
| 954 | − && (pCurLayer->pMbType[iMbXy] != MB_TYPE_INTRA4x4) | |
| 955 | − && ((pCurLayer->pCbp[iMbXy] & 0x0F) > 0) | |
| 951 | + (((pCurDqLayer->pDec->pMbType[iMbXy] >= MB_TYPE_16x16 && pCurDqLayer->pDec->pMbType[iMbXy] <= MB_TYPE_8x16) | |
| 952 | + || pCurDqLayer->pNoSubMbPartSizeLessThan8x8Flag[iMbXy]) | |
| 953 | + && (pCurDqLayer->pDec->pMbType[iMbXy] != MB_TYPE_INTRA8x8) | |
| 954 | + && (pCurDqLayer->pDec->pMbType[iMbXy] != MB_TYPE_INTRA4x4) | |
| 955 | + && ((pCurDqLayer->pCbp[iMbXy] & 0x0F) > 0) | |
| 956 | 956 | && (pCtx->pPps->bTransform8x8ModeFlag)); |
| 957 | 957 | |
| 958 | 958 | if (bNeedParseTransformSize8x8Flag) { |
| @@ -961,7 +961,7 @@ int32_t WelsDecodeMbCabacPSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 2 unmodified lines | ||
| 961 | 961 | } |
| 962 | 962 | } |
| 963 | 963 | |
| 964 | − memset (pCurLayer->pScaledTCoeff[iMbXy], 0, 384 * sizeof (pCurLayer->pScaledTCoeff[iMbXy][0])); | |
| 964 | + memset (pCurDqLayer->pScaledTCoeff[iMbXy], 0, 384 * sizeof (pCurDqLayer->pScaledTCoeff[iMbXy][0])); | |
| 965 | 965 | |
| 966 | 966 | int32_t iQpDelta, iId8x8, iId4x4; |
| 967 | 967 | |
| @@ -969,33 +969,33 @@ int32_t WelsDecodeMbCabacPSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 1 unmodified line | ||
| 969 | 969 | if (iQpDelta > 25 || iQpDelta < -26) { //out of iQpDelta range |
| 970 | 970 | return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_QP); |
| 971 | 971 | } |
| 972 | − pCurLayer->pLumaQp[iMbXy] = (pSlice->iLastMbQp + iQpDelta + 52) % 52; //update last_mb_qp | |
| 973 | − pSlice->iLastMbQp = pCurLayer->pLumaQp[iMbXy]; | |
| 972 | + pCurDqLayer->pLumaQp[iMbXy] = (pSlice->iLastMbQp + iQpDelta + 52) % 52; //update last_mb_qp | |
| 973 | + pSlice->iLastMbQp = pCurDqLayer->pLumaQp[iMbXy]; | |
| 974 | 974 | for (i = 0; i < 2; i++) { |
| 975 | − pCurLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 (pSlice->iLastMbQp + | |
| 975 | + pCurDqLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 (pSlice->iLastMbQp + | |
| 976 | 976 | pSliceHeader->pPps->iChromaQpIndexOffset[i], 0, 51)]; |
| 977 | 977 | } |
| 978 | 978 | |
| 979 | − if (MB_TYPE_INTRA16x16 == pCurLayer->pMbType[iMbXy]) { | |
| 979 | + if (MB_TYPE_INTRA16x16 == pCurDqLayer->pDec->pMbType[iMbXy]) { | |
| 980 | 980 | //step1: Luma DC |
| 981 | 981 | WELS_READ_VERIFY (ParseResidualBlockCabac (pNeighAvail, pNonZeroCount, pBsAux, 0, 16, g_kuiLumaDcZigzagScan, |
| 982 | − I16_LUMA_DC, pCurLayer->pScaledTCoeff[iMbXy], pCurLayer->pLumaQp[iMbXy], pCtx)); | |
| 982 | + I16_LUMA_DC, pCurDqLayer->pScaledTCoeff[iMbXy], pCurDqLayer->pLumaQp[iMbXy], pCtx)); | |
| 983 | 983 | //step2: Luma AC |
| 984 | 984 | if (uiCbpLuma) { |
| 985 | 985 | for (i = 0; i < 16; i++) { |
| 986 | 986 | WELS_READ_VERIFY (ParseResidualBlockCabac (pNeighAvail, pNonZeroCount, pBsAux, i, iScanIdxEnd - WELS_MAX (iScanIdxStart, |
| 987 | − 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1), I16_LUMA_AC, pCurLayer->pScaledTCoeff[iMbXy] + (i << 4), | |
| 988 | − pCurLayer->pLumaQp[iMbXy], pCtx)); | |
| 987 | + 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1), I16_LUMA_AC, pCurDqLayer->pScaledTCoeff[iMbXy] + (i << 4), | |
| 988 | + pCurDqLayer->pLumaQp[iMbXy], pCtx)); | |
| 989 | 989 | } |
| 990 | − ST32 (&pCurLayer->pNzc[iMbXy][0], LD32 (&pNonZeroCount[1 + 8 * 1])); | |
| 991 | − ST32 (&pCurLayer->pNzc[iMbXy][4], LD32 (&pNonZeroCount[1 + 8 * 2])); | |
| 992 | − ST32 (&pCurLayer->pNzc[iMbXy][8], LD32 (&pNonZeroCount[1 + 8 * 3])); | |
| 993 | − ST32 (&pCurLayer->pNzc[iMbXy][12], LD32 (&pNonZeroCount[1 + 8 * 4])); | |
| 990 | + ST32 (&pCurDqLayer->pNzc[iMbXy][0], LD32 (&pNonZeroCount[1 + 8 * 1])); | |
| 991 | + ST32 (&pCurDqLayer->pNzc[iMbXy][4], LD32 (&pNonZeroCount[1 + 8 * 2])); | |
| 992 | + ST32 (&pCurDqLayer->pNzc[iMbXy][8], LD32 (&pNonZeroCount[1 + 8 * 3])); | |
| 993 | + ST32 (&pCurDqLayer->pNzc[iMbXy][12], LD32 (&pNonZeroCount[1 + 8 * 4])); | |
| 994 | 994 | } else { |
| 995 | − ST32 (&pCurLayer->pNzc[iMbXy][0], 0); | |
| 996 | − ST32 (&pCurLayer->pNzc[iMbXy][4], 0); | |
| 997 | − ST32 (&pCurLayer->pNzc[iMbXy][8], 0); | |
| 998 | − ST32 (&pCurLayer->pNzc[iMbXy][12], 0); | |
| 995 | + ST32 (&pCurDqLayer->pNzc[iMbXy][0], 0); | |
| 996 | + ST32 (&pCurDqLayer->pNzc[iMbXy][4], 0); | |
| 997 | + ST32 (&pCurDqLayer->pNzc[iMbXy][8], 0); | |
| 998 | + ST32 (&pCurDqLayer->pNzc[iMbXy][12], 0); | |
| 999 | 999 | } |
| 1000 | 1000 | } else { //non-MB_TYPE_INTRA16x16 |
| 1001 | 1001 | if (pCtx->pCurDqLayer->pTransformSize8x8Flag[iMbXy]) { |
| @@ -1004,27 +1004,27 @@ int32_t WelsDecodeMbCabacPSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 2 unmodified lines | ||
| 1004 | 1004 | if (uiCbpLuma & (1 << iId8x8)) { |
| 1005 | 1005 | WELS_READ_VERIFY (ParseResidualBlockCabac8x8 (pNeighAvail, pNonZeroCount, pBsAux, (iId8x8 << 2), |
| 1006 | 1006 | iScanIdxEnd - iScanIdxStart + 1, g_kuiZigzagScan8x8 + iScanIdxStart, |
| 1007 | − IS_INTRA (pCurLayer->pMbType[iMbXy]) ? LUMA_DC_AC_INTRA_8 : LUMA_DC_AC_INTER_8, | |
| 1008 | − pCurLayer->pScaledTCoeff[iMbXy] + (iId8x8 << 6), pCurLayer->pLumaQp[iMbXy], pCtx)); | |
| 1007 | + IS_INTRA (pCurDqLayer->pDec->pMbType[iMbXy]) ? LUMA_DC_AC_INTRA_8 : LUMA_DC_AC_INTER_8, | |
| 1008 | + pCurDqLayer->pScaledTCoeff[iMbXy] + (iId8x8 << 6), pCurDqLayer->pLumaQp[iMbXy], pCtx)); | |
| 1009 | 1009 | } else { |
| 1010 | 1010 | ST16 (&pNonZeroCount[g_kCacheNzcScanIdx[ (iId8x8 << 2)]], 0); |
| 1011 | 1011 | ST16 (&pNonZeroCount[g_kCacheNzcScanIdx[ (iId8x8 << 2) + 2]], 0); |
| 1012 | 1012 | } |
| 1013 | 1013 | } |
| 1014 | − ST32 (&pCurLayer->pNzc[iMbXy][0], LD32 (&pNonZeroCount[1 + 8 * 1])); | |
| 1015 | − ST32 (&pCurLayer->pNzc[iMbXy][4], LD32 (&pNonZeroCount[1 + 8 * 2])); | |
| 1016 | − ST32 (&pCurLayer->pNzc[iMbXy][8], LD32 (&pNonZeroCount[1 + 8 * 3])); | |
| 1017 | − ST32 (&pCurLayer->pNzc[iMbXy][12], LD32 (&pNonZeroCount[1 + 8 * 4])); | |
| 1014 | + ST32 (&pCurDqLayer->pNzc[iMbXy][0], LD32 (&pNonZeroCount[1 + 8 * 1])); | |
| 1015 | + ST32 (&pCurDqLayer->pNzc[iMbXy][4], LD32 (&pNonZeroCount[1 + 8 * 2])); | |
| 1016 | + ST32 (&pCurDqLayer->pNzc[iMbXy][8], LD32 (&pNonZeroCount[1 + 8 * 3])); | |
| 1017 | + ST32 (&pCurDqLayer->pNzc[iMbXy][12], LD32 (&pNonZeroCount[1 + 8 * 4])); | |
| 1018 | 1018 | } else { |
| 1019 | − iMbResProperty = (IS_INTRA (pCurLayer->pMbType[iMbXy])) ? LUMA_DC_AC_INTRA : LUMA_DC_AC_INTER; | |
| 1019 | + iMbResProperty = (IS_INTRA (pCurDqLayer->pDec->pMbType[iMbXy])) ? LUMA_DC_AC_INTRA : LUMA_DC_AC_INTER; | |
| 1020 | 1020 | for (iId8x8 = 0; iId8x8 < 4; iId8x8++) { |
| 1021 | 1021 | if (uiCbpLuma & (1 << iId8x8)) { |
| 1022 | 1022 | int32_t iIdx = (iId8x8 << 2); |
| 1023 | 1023 | for (iId4x4 = 0; iId4x4 < 4; iId4x4++) { |
| 1024 | 1024 | //Luma (DC and AC decoding together) |
| 1025 | 1025 | WELS_READ_VERIFY (ParseResidualBlockCabac (pNeighAvail, pNonZeroCount, pBsAux, iIdx, iScanIdxEnd - iScanIdxStart + 1, |
| 1026 | − g_kuiZigzagScan + iScanIdxStart, iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + (iIdx << 4), | |
| 1027 | − pCurLayer->pLumaQp[iMbXy], | |
| 1026 | + g_kuiZigzagScan + iScanIdxStart, iMbResProperty, pCurDqLayer->pScaledTCoeff[iMbXy] + (iIdx << 4), | |
| 1027 | + pCurDqLayer->pLumaQp[iMbXy], | |
| 1028 | 1028 | pCtx)); |
| 1029 | 1029 | iIdx++; |
| 1030 | 1030 | } |
| @@ -1033,10 +1033,10 @@ int32_t WelsDecodeMbCabacPSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 2 unmodified lines | ||
| 1033 | 1033 | ST16 (&pNonZeroCount[g_kCacheNzcScanIdx[ (iId8x8 << 2) + 2]], 0); |
| 1034 | 1034 | } |
| 1035 | 1035 | } |
| 1036 | − ST32 (&pCurLayer->pNzc[iMbXy][0], LD32 (&pNonZeroCount[1 + 8 * 1])); | |
| 1037 | − ST32 (&pCurLayer->pNzc[iMbXy][4], LD32 (&pNonZeroCount[1 + 8 * 2])); | |
| 1038 | − ST32 (&pCurLayer->pNzc[iMbXy][8], LD32 (&pNonZeroCount[1 + 8 * 3])); | |
| 1039 | − ST32 (&pCurLayer->pNzc[iMbXy][12], LD32 (&pNonZeroCount[1 + 8 * 4])); | |
| 1036 | + ST32 (&pCurDqLayer->pNzc[iMbXy][0], LD32 (&pNonZeroCount[1 + 8 * 1])); | |
| 1037 | + ST32 (&pCurDqLayer->pNzc[iMbXy][4], LD32 (&pNonZeroCount[1 + 8 * 2])); | |
| 1038 | + ST32 (&pCurDqLayer->pNzc[iMbXy][8], LD32 (&pNonZeroCount[1 + 8 * 3])); | |
| 1039 | + ST32 (&pCurDqLayer->pNzc[iMbXy][12], LD32 (&pNonZeroCount[1 + 8 * 4])); | |
| 1040 | 1040 | } |
| 1041 | 1041 | } |
| 1042 | 1042 | |
| @@ -1044,19 +1044,19 @@ int32_t WelsDecodeMbCabacPSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 1 unmodified line | ||
| 1044 | 1044 | //step1: DC |
| 1045 | 1045 | if (1 == uiCbpChroma || 2 == uiCbpChroma) { |
| 1046 | 1046 | for (i = 0; i < 2; i++) { |
| 1047 | − if (IS_INTRA (pCurLayer->pMbType[iMbXy])) | |
| 1047 | + if (IS_INTRA (pCurDqLayer->pDec->pMbType[iMbXy])) | |
| 1048 | 1048 | iMbResProperty = i ? CHROMA_DC_V : CHROMA_DC_U; |
| 1049 | 1049 | else |
| 1050 | 1050 | iMbResProperty = i ? CHROMA_DC_V_INTER : CHROMA_DC_U_INTER; |
| 1051 | 1051 | |
| 1052 | 1052 | WELS_READ_VERIFY (ParseResidualBlockCabac (pNeighAvail, pNonZeroCount, pBsAux, 16 + (i << 2), 4, g_kuiChromaDcScan, |
| 1053 | − iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + 256 + (i << 6), pCurLayer->pChromaQp[iMbXy][i], pCtx)); | |
| 1053 | + iMbResProperty, pCurDqLayer->pScaledTCoeff[iMbXy] + 256 + (i << 6), pCurDqLayer->pChromaQp[iMbXy][i], pCtx)); | |
| 1054 | 1054 | } |
| 1055 | 1055 | } |
| 1056 | 1056 | //step2: AC |
| 1057 | 1057 | if (2 == uiCbpChroma) { |
| 1058 | 1058 | for (i = 0; i < 2; i++) { |
| 1059 | − if (IS_INTRA (pCurLayer->pMbType[iMbXy])) | |
| 1059 | + if (IS_INTRA (pCurDqLayer->pDec->pMbType[iMbXy])) | |
| 1060 | 1060 | iMbResProperty = i ? CHROMA_AC_V : CHROMA_AC_U; |
| 1061 | 1061 | else |
| 1062 | 1062 | iMbResProperty = i ? CHROMA_AC_V_INTER : CHROMA_AC_U_INTER; |
| @@ -1064,22 +1064,22 @@ int32_t WelsDecodeMbCabacPSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 1 unmodified line | ||
| 1064 | 1064 | for (iId4x4 = 0; iId4x4 < 4; iId4x4++) { |
| 1065 | 1065 | WELS_READ_VERIFY (ParseResidualBlockCabac (pNeighAvail, pNonZeroCount, pBsAux, index, |
| 1066 | 1066 | iScanIdxEnd - WELS_MAX (iScanIdxStart, 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1), |
| 1067 | − iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + (index << 4), pCurLayer->pChromaQp[iMbXy][i], pCtx)); | |
| 1067 | + iMbResProperty, pCurDqLayer->pScaledTCoeff[iMbXy] + (index << 4), pCurDqLayer->pChromaQp[iMbXy][i], pCtx)); | |
| 1068 | 1068 | index++; |
| 1069 | 1069 | } |
| 1070 | 1070 | } |
| 1071 | − ST16 (&pCurLayer->pNzc[iMbXy][16], LD16 (&pNonZeroCount[6 + 8 * 1])); | |
| 1072 | − ST16 (&pCurLayer->pNzc[iMbXy][20], LD16 (&pNonZeroCount[6 + 8 * 2])); | |
| 1073 | − ST16 (&pCurLayer->pNzc[iMbXy][18], LD16 (&pNonZeroCount[6 + 8 * 4])); | |
| 1074 | − ST16 (&pCurLayer->pNzc[iMbXy][22], LD16 (&pNonZeroCount[6 + 8 * 5])); | |
| 1071 | + ST16 (&pCurDqLayer->pNzc[iMbXy][16], LD16 (&pNonZeroCount[6 + 8 * 1])); | |
| 1072 | + ST16 (&pCurDqLayer->pNzc[iMbXy][20], LD16 (&pNonZeroCount[6 + 8 * 2])); | |
| 1073 | + ST16 (&pCurDqLayer->pNzc[iMbXy][18], LD16 (&pNonZeroCount[6 + 8 * 4])); | |
| 1074 | + ST16 (&pCurDqLayer->pNzc[iMbXy][22], LD16 (&pNonZeroCount[6 + 8 * 5])); | |
| 1075 | 1075 | } else { |
| 1076 | − ST32 (&pCurLayer->pNzc[iMbXy][16], 0); | |
| 1077 | − ST32 (&pCurLayer->pNzc[iMbXy][20], 0); | |
| 1076 | + ST32 (&pCurDqLayer->pNzc[iMbXy][16], 0); | |
| 1077 | + ST32 (&pCurDqLayer->pNzc[iMbXy][20], 0); | |
| 1078 | 1078 | } |
| 1079 | 1079 | } else { |
| 1080 | − pCurLayer->pLumaQp[iMbXy] = pSlice->iLastMbQp; | |
| 1080 | + pCurDqLayer->pLumaQp[iMbXy] = pSlice->iLastMbQp; | |
| 1081 | 1081 | for (i = 0; i < 2; i++) { |
| 1082 | − pCurLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 (pCurLayer->pLumaQp[iMbXy] + | |
| 1082 | + pCurDqLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 (pCurDqLayer->pLumaQp[iMbXy] + | |
| 1083 | 1083 | pSliceHeader->pPps->iChromaQpIndexOffset[i], 0, 51)]; |
| 1084 | 1084 | } |
| 1085 | 1085 | } |
| @@ -1093,21 +1093,21 @@ int32_t WelsDecodeMbCabacPSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 7 unmodified lines | ||
| 1093 | 1093 | } |
| 1094 | 1094 | |
| 1095 | 1095 | int32_t WelsDecodeMbCabacBSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAvail pNeighAvail, uint32_t& uiEosFlag) { |
| 1096 | − PDqLayer pCurLayer = pCtx->pCurDqLayer; | |
| 1097 | − PBitStringAux pBsAux = pCurLayer->pBitStringAux; | |
| 1098 | − PSlice pSlice = &pCurLayer->sLayerInfo.sSliceInLayer; | |
| 1096 | + PDqLayer pCurDqLayer = pCtx->pCurDqLayer; | |
| 1097 | + PBitStringAux pBsAux = pCurDqLayer->pBitStringAux; | |
| 1098 | + PSlice pSlice = &pCurDqLayer->sLayerInfo.sSliceInLayer; | |
| 1099 | 1099 | PSliceHeader pSliceHeader = &pSlice->sSliceHeaderExt.sSliceHeader; |
| 1100 | 1100 | |
| 1101 | 1101 | int32_t iScanIdxStart = pSlice->sSliceHeaderExt.uiScanIdxStart; |
| 1102 | 1102 | int32_t iScanIdxEnd = pSlice->sSliceHeaderExt.uiScanIdxEnd; |
| 1103 | − int32_t iMbXy = pCurLayer->iMbXyIndex; | |
| 1103 | + int32_t iMbXy = pCurDqLayer->iMbXyIndex; | |
| 1104 | 1104 | int32_t iMbResProperty; |
| 1105 | 1105 | int32_t i; |
| 1106 | 1106 | uint32_t uiMbType = 0, uiCbp = 0, uiCbpLuma = 0, uiCbpChroma = 0; |
| 1107 | 1107 | |
| 1108 | 1108 | ENFORCE_STACK_ALIGN_1D (uint8_t, pNonZeroCount, 48, 16); |
| 1109 | 1109 | |
| 1110 | − pCurLayer->pInterPredictionDoneFlag[iMbXy] = 0; | |
| 1110 | + pCurDqLayer->pInterPredictionDoneFlag[iMbXy] = 0; | |
| 1111 | 1111 | |
| 1112 | 1112 | WELS_READ_VERIFY (ParseMBTypeBSliceCabac (pCtx, pNeighAvail, uiMbType)); |
| 1113 | 1113 | |
| @@ -1116,12 +1116,12 @@ int32_t WelsDecodeMbCabacBSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 2 unmodified lines | ||
| 1116 | 1116 | int16_t pMvdCache[LIST_A][30][MV_A]; |
| 1117 | 1117 | int8_t pRefIndex[LIST_A][30]; |
| 1118 | 1118 | int8_t pDirect[30]; |
| 1119 | − pCurLayer->pMbType[iMbXy] = g_ksInterBMbTypeInfo[uiMbType].iType; | |
| 1120 | − WelsFillCacheInterCabac (pNeighAvail, pNonZeroCount, pMotionVector, pMvdCache, pRefIndex, pCurLayer); | |
| 1121 | − WelsFillDirectCacheCabac (pNeighAvail, pDirect, pCurLayer); | |
| 1119 | + pCurDqLayer->pDec->pMbType[iMbXy] = g_ksInterBMbTypeInfo[uiMbType].iType; | |
| 1120 | + WelsFillCacheInterCabac (pNeighAvail, pNonZeroCount, pMotionVector, pMvdCache, pRefIndex, pCurDqLayer); | |
| 1121 | + WelsFillDirectCacheCabac (pNeighAvail, pDirect, pCurDqLayer); | |
| 1122 | 1122 | WELS_READ_VERIFY (ParseInterBMotionInfoCabac (pCtx, pNeighAvail, pNonZeroCount, pMotionVector, pMvdCache, pRefIndex, |
| 1123 | 1123 | pDirect)); |
| 1124 | − pCurLayer->pInterPredictionDoneFlag[iMbXy] = 0; | |
| 1124 | + pCurDqLayer->pInterPredictionDoneFlag[iMbXy] = 0; | |
| 1125 | 1125 | } else { //Intra mode |
| 1126 | 1126 | uiMbType -= 23; |
| 1127 | 1127 | if (uiMbType > 25) |
| @@ -1141,59 +1141,59 @@ int32_t WelsDecodeMbCabacBSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 13 unmodified lines | ||
| 1141 | 1141 | } else { //normal Intra mode |
| 1142 | 1142 | if (0 == uiMbType) { //Intra4x4 |
| 1143 | 1143 | ENFORCE_STACK_ALIGN_1D (int8_t, pIntraPredMode, 48, 16); |
| 1144 | − pCurLayer->pMbType[iMbXy] = MB_TYPE_INTRA4x4; | |
| 1144 | + pCurDqLayer->pDec->pMbType[iMbXy] = MB_TYPE_INTRA4x4; | |
| 1145 | 1145 | if (pCtx->pPps->bTransform8x8ModeFlag) { |
| 1146 | 1146 | WELS_READ_VERIFY (ParseTransformSize8x8FlagCabac (pCtx, pNeighAvail, pCtx->pCurDqLayer->pTransformSize8x8Flag[iMbXy])); |
| 1147 | 1147 | } |
| 1148 | 1148 | if (pCtx->pCurDqLayer->pTransformSize8x8Flag[iMbXy]) { |
| 1149 | − uiMbType = pCurLayer->pMbType[iMbXy] = MB_TYPE_INTRA8x8; | |
| 1150 | − pCtx->pFillInfoCacheIntraNxNFunc (pNeighAvail, pNonZeroCount, pIntraPredMode, pCurLayer); | |
| 1151 | − WELS_READ_VERIFY (ParseIntra8x8Mode (pCtx, pNeighAvail, pIntraPredMode, pBsAux, pCurLayer)); | |
| 1149 | + uiMbType = pCurDqLayer->pDec->pMbType[iMbXy] = MB_TYPE_INTRA8x8; | |
| 1150 | + pCtx->pFillInfoCacheIntraNxNFunc (pNeighAvail, pNonZeroCount, pIntraPredMode, pCurDqLayer); | |
| 1151 | + WELS_READ_VERIFY (ParseIntra8x8Mode (pCtx, pNeighAvail, pIntraPredMode, pBsAux, pCurDqLayer)); | |
| 1152 | 1152 | } else { |
| 1153 | − pCtx->pFillInfoCacheIntraNxNFunc (pNeighAvail, pNonZeroCount, pIntraPredMode, pCurLayer); | |
| 1154 | − WELS_READ_VERIFY (ParseIntra4x4Mode (pCtx, pNeighAvail, pIntraPredMode, pBsAux, pCurLayer)); | |
| 1153 | + pCtx->pFillInfoCacheIntraNxNFunc (pNeighAvail, pNonZeroCount, pIntraPredMode, pCurDqLayer); | |
| 1154 | + WELS_READ_VERIFY (ParseIntra4x4Mode (pCtx, pNeighAvail, pIntraPredMode, pBsAux, pCurDqLayer)); | |
| 1155 | 1155 | } |
| 1156 | 1156 | } else { //Intra16x16 |
| 1157 | − pCurLayer->pMbType[iMbXy] = MB_TYPE_INTRA16x16; | |
| 1158 | − pCurLayer->pTransformSize8x8Flag[iMbXy] = false; | |
| 1159 | − pCurLayer->pNoSubMbPartSizeLessThan8x8Flag[iMbXy] = true; | |
| 1160 | − pCurLayer->pIntraPredMode[iMbXy][7] = (uiMbType - 1) & 3; | |
| 1161 | − pCurLayer->pCbp[iMbXy] = g_kuiI16CbpTable[ (uiMbType - 1) >> 2]; | |
| 1162 | − uiCbpChroma = pCtx->pSps->uiChromaFormatIdc ? pCurLayer->pCbp[iMbXy] >> 4 : 0; | |
| 1163 | − uiCbpLuma = pCurLayer->pCbp[iMbXy] & 15; | |
| 1164 | − WelsFillCacheNonZeroCount (pNeighAvail, pNonZeroCount, pCurLayer); | |
| 1165 | − WELS_READ_VERIFY (ParseIntra16x16Mode (pCtx, pNeighAvail, pBsAux, pCurLayer)); | |
| 1157 | + pCurDqLayer->pDec->pMbType[iMbXy] = MB_TYPE_INTRA16x16; | |
| 1158 | + pCurDqLayer->pTransformSize8x8Flag[iMbXy] = false; | |
| 1159 | + pCurDqLayer->pNoSubMbPartSizeLessThan8x8Flag[iMbXy] = true; | |
| 1160 | + pCurDqLayer->pIntraPredMode[iMbXy][7] = (uiMbType - 1) & 3; | |
| 1161 | + pCurDqLayer->pCbp[iMbXy] = g_kuiI16CbpTable[ (uiMbType - 1) >> 2]; | |
| 1162 | + uiCbpChroma = pCtx->pSps->uiChromaFormatIdc ? pCurDqLayer->pCbp[iMbXy] >> 4 : 0; | |
| 1163 | + uiCbpLuma = pCurDqLayer->pCbp[iMbXy] & 15; | |
| 1164 | + WelsFillCacheNonZeroCount (pNeighAvail, pNonZeroCount, pCurDqLayer); | |
| 1165 | + WELS_READ_VERIFY (ParseIntra16x16Mode (pCtx, pNeighAvail, pBsAux, pCurDqLayer)); | |
| 1166 | 1166 | } |
| 1167 | 1167 | } |
| 1168 | 1168 | } |
| 1169 | 1169 | |
| 1170 | − ST32 (&pCurLayer->pNzc[iMbXy][0], 0); | |
| 1171 | − ST32 (&pCurLayer->pNzc[iMbXy][4], 0); | |
| 1172 | − ST32 (&pCurLayer->pNzc[iMbXy][8], 0); | |
| 1173 | − ST32 (&pCurLayer->pNzc[iMbXy][12], 0); | |
| 1174 | − ST32 (&pCurLayer->pNzc[iMbXy][16], 0); | |
| 1175 | − ST32 (&pCurLayer->pNzc[iMbXy][20], 0); | |
| 1170 | + ST32 (&pCurDqLayer->pNzc[iMbXy][0], 0); | |
| 1171 | + ST32 (&pCurDqLayer->pNzc[iMbXy][4], 0); | |
| 1172 | + ST32 (&pCurDqLayer->pNzc[iMbXy][8], 0); | |
| 1173 | + ST32 (&pCurDqLayer->pNzc[iMbXy][12], 0); | |
| 1174 | + ST32 (&pCurDqLayer->pNzc[iMbXy][16], 0); | |
| 1175 | + ST32 (&pCurDqLayer->pNzc[iMbXy][20], 0); | |
| 1176 | 1176 | |
| 1177 | − if (MB_TYPE_INTRA16x16 != pCurLayer->pMbType[iMbXy]) { | |
| 1177 | + if (MB_TYPE_INTRA16x16 != pCurDqLayer->pDec->pMbType[iMbXy]) { | |
| 1178 | 1178 | WELS_READ_VERIFY (ParseCbpInfoCabac (pCtx, pNeighAvail, uiCbp)); |
| 1179 | 1179 | |
| 1180 | − pCurLayer->pCbp[iMbXy] = uiCbp; | |
| 1180 | + pCurDqLayer->pCbp[iMbXy] = uiCbp; | |
| 1181 | 1181 | pSlice->iLastDeltaQp = uiCbp == 0 ? 0 : pSlice->iLastDeltaQp; |
| 1182 | − uiCbpChroma = pCtx->pSps->uiChromaFormatIdc ? pCurLayer->pCbp[iMbXy] >> 4 : 0; | |
| 1183 | − uiCbpLuma = pCurLayer->pCbp[iMbXy] & 15; | |
| 1182 | + uiCbpChroma = pCtx->pSps->uiChromaFormatIdc ? pCurDqLayer->pCbp[iMbXy] >> 4 : 0; | |
| 1183 | + uiCbpLuma = pCurDqLayer->pCbp[iMbXy] & 15; | |
| 1184 | 1184 | } |
| 1185 | 1185 | |
| 1186 | − if (pCurLayer->pCbp[iMbXy] || MB_TYPE_INTRA16x16 == pCurLayer->pMbType[iMbXy]) { | |
| 1186 | + if (pCurDqLayer->pCbp[iMbXy] || MB_TYPE_INTRA16x16 == pCurDqLayer->pDec->pMbType[iMbXy]) { | |
| 1187 | 1187 | |
| 1188 | − if (MB_TYPE_INTRA16x16 != pCurLayer->pMbType[iMbXy]) { | |
| 1188 | + if (MB_TYPE_INTRA16x16 != pCurDqLayer->pDec->pMbType[iMbXy]) { | |
| 1189 | 1189 | // Need modification when B picutre add in |
| 1190 | 1190 | bool bNeedParseTransformSize8x8Flag = |
| 1191 | − (((IS_INTER_16x16 (pCurLayer->pMbType[iMbXy]) || IS_DIRECT (pCurLayer->pMbType[iMbXy]) | |
| 1192 | − || IS_INTER_16x8 (pCurLayer->pMbType[iMbXy]) || IS_INTER_8x16 (pCurLayer->pMbType[iMbXy])) | |
| 1193 | − || pCurLayer->pNoSubMbPartSizeLessThan8x8Flag[iMbXy]) | |
| 1194 | − && (pCurLayer->pMbType[iMbXy] != MB_TYPE_INTRA8x8) | |
| 1195 | − && (pCurLayer->pMbType[iMbXy] != MB_TYPE_INTRA4x4) | |
| 1196 | − && ((pCurLayer->pCbp[iMbXy] & 0x0F) > 0) | |
| 1191 | + (((IS_INTER_16x16 (pCurDqLayer->pDec->pMbType[iMbXy]) || IS_DIRECT (pCurDqLayer->pDec->pMbType[iMbXy]) | |
| 1192 | + || IS_INTER_16x8 (pCurDqLayer->pDec->pMbType[iMbXy]) || IS_INTER_8x16 (pCurDqLayer->pDec->pMbType[iMbXy])) | |
| 1193 | + || pCurDqLayer->pNoSubMbPartSizeLessThan8x8Flag[iMbXy]) | |
| 1194 | + && (pCurDqLayer->pDec->pMbType[iMbXy] != MB_TYPE_INTRA8x8) | |
| 1195 | + && (pCurDqLayer->pDec->pMbType[iMbXy] != MB_TYPE_INTRA4x4) | |
| 1196 | + && ((pCurDqLayer->pCbp[iMbXy] & 0x0F) > 0) | |
| 1197 | 1197 | && (pCtx->pPps->bTransform8x8ModeFlag)); |
| 1198 | 1198 | |
| 1199 | 1199 | if (bNeedParseTransformSize8x8Flag) { |
| @@ -1202,7 +1202,7 @@ int32_t WelsDecodeMbCabacBSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 2 unmodified lines | ||
| 1202 | 1202 | } |
| 1203 | 1203 | } |
| 1204 | 1204 | |
| 1205 | − memset (pCurLayer->pScaledTCoeff[iMbXy], 0, 384 * sizeof (pCurLayer->pScaledTCoeff[iMbXy][0])); | |
| 1205 | + memset (pCurDqLayer->pScaledTCoeff[iMbXy], 0, 384 * sizeof (pCurDqLayer->pScaledTCoeff[iMbXy][0])); | |
| 1206 | 1206 | |
| 1207 | 1207 | int32_t iQpDelta, iId8x8, iId4x4; |
| 1208 | 1208 | |
| @@ -1210,33 +1210,33 @@ int32_t WelsDecodeMbCabacBSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 1 unmodified line | ||
| 1210 | 1210 | if (iQpDelta > 25 || iQpDelta < -26) { //out of iQpDelta range |
| 1211 | 1211 | return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_QP); |
| 1212 | 1212 | } |
| 1213 | − pCurLayer->pLumaQp[iMbXy] = (pSlice->iLastMbQp + iQpDelta + 52) % 52; //update last_mb_qp | |
| 1214 | − pSlice->iLastMbQp = pCurLayer->pLumaQp[iMbXy]; | |
| 1213 | + pCurDqLayer->pLumaQp[iMbXy] = (pSlice->iLastMbQp + iQpDelta + 52) % 52; //update last_mb_qp | |
| 1214 | + pSlice->iLastMbQp = pCurDqLayer->pLumaQp[iMbXy]; | |
| 1215 | 1215 | for (i = 0; i < 2; i++) { |
| 1216 | − pCurLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 (pSlice->iLastMbQp + | |
| 1216 | + pCurDqLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 (pSlice->iLastMbQp + | |
| 1217 | 1217 | pSliceHeader->pPps->iChromaQpIndexOffset[i], 0, 51)]; |
| 1218 | 1218 | } |
| 1219 | 1219 | |
| 1220 | − if (MB_TYPE_INTRA16x16 == pCurLayer->pMbType[iMbXy]) { | |
| 1220 | + if (MB_TYPE_INTRA16x16 == pCurDqLayer->pDec->pMbType[iMbXy]) { | |
| 1221 | 1221 | //step1: Luma DC |
| 1222 | 1222 | WELS_READ_VERIFY (ParseResidualBlockCabac (pNeighAvail, pNonZeroCount, pBsAux, 0, 16, g_kuiLumaDcZigzagScan, |
| 1223 | − I16_LUMA_DC, pCurLayer->pScaledTCoeff[iMbXy], pCurLayer->pLumaQp[iMbXy], pCtx)); | |
| 1223 | + I16_LUMA_DC, pCurDqLayer->pScaledTCoeff[iMbXy], pCurDqLayer->pLumaQp[iMbXy], pCtx)); | |
| 1224 | 1224 | //step2: Luma AC |
| 1225 | 1225 | if (uiCbpLuma) { |
| 1226 | 1226 | for (i = 0; i < 16; i++) { |
| 1227 | 1227 | WELS_READ_VERIFY (ParseResidualBlockCabac (pNeighAvail, pNonZeroCount, pBsAux, i, iScanIdxEnd - WELS_MAX (iScanIdxStart, |
| 1228 | − 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1), I16_LUMA_AC, pCurLayer->pScaledTCoeff[iMbXy] + (i << 4), | |
| 1229 | − pCurLayer->pLumaQp[iMbXy], pCtx)); | |
| 1228 | + 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1), I16_LUMA_AC, pCurDqLayer->pScaledTCoeff[iMbXy] + (i << 4), | |
| 1229 | + pCurDqLayer->pLumaQp[iMbXy], pCtx)); | |
| 1230 | 1230 | } |
| 1231 | − ST32 (&pCurLayer->pNzc[iMbXy][0], LD32 (&pNonZeroCount[1 + 8 * 1])); | |
| 1232 | − ST32 (&pCurLayer->pNzc[iMbXy][4], LD32 (&pNonZeroCount[1 + 8 * 2])); | |
| 1233 | − ST32 (&pCurLayer->pNzc[iMbXy][8], LD32 (&pNonZeroCount[1 + 8 * 3])); | |
| 1234 | − ST32 (&pCurLayer->pNzc[iMbXy][12], LD32 (&pNonZeroCount[1 + 8 * 4])); | |
| 1231 | + ST32 (&pCurDqLayer->pNzc[iMbXy][0], LD32 (&pNonZeroCount[1 + 8 * 1])); | |
| 1232 | + ST32 (&pCurDqLayer->pNzc[iMbXy][4], LD32 (&pNonZeroCount[1 + 8 * 2])); | |
| 1233 | + ST32 (&pCurDqLayer->pNzc[iMbXy][8], LD32 (&pNonZeroCount[1 + 8 * 3])); | |
| 1234 | + ST32 (&pCurDqLayer->pNzc[iMbXy][12], LD32 (&pNonZeroCount[1 + 8 * 4])); | |
| 1235 | 1235 | } else { |
| 1236 | − ST32 (&pCurLayer->pNzc[iMbXy][0], 0); | |
| 1237 | − ST32 (&pCurLayer->pNzc[iMbXy][4], 0); | |
| 1238 | − ST32 (&pCurLayer->pNzc[iMbXy][8], 0); | |
| 1239 | − ST32 (&pCurLayer->pNzc[iMbXy][12], 0); | |
| 1236 | + ST32 (&pCurDqLayer->pNzc[iMbXy][0], 0); | |
| 1237 | + ST32 (&pCurDqLayer->pNzc[iMbXy][4], 0); | |
| 1238 | + ST32 (&pCurDqLayer->pNzc[iMbXy][8], 0); | |
| 1239 | + ST32 (&pCurDqLayer->pNzc[iMbXy][12], 0); | |
| 1240 | 1240 | } |
| 1241 | 1241 | } else { //non-MB_TYPE_INTRA16x16 |
| 1242 | 1242 | if (pCtx->pCurDqLayer->pTransformSize8x8Flag[iMbXy]) { |
| @@ -1245,27 +1245,27 @@ int32_t WelsDecodeMbCabacBSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 2 unmodified lines | ||
| 1245 | 1245 | if (uiCbpLuma & (1 << iId8x8)) { |
| 1246 | 1246 | WELS_READ_VERIFY (ParseResidualBlockCabac8x8 (pNeighAvail, pNonZeroCount, pBsAux, (iId8x8 << 2), |
| 1247 | 1247 | iScanIdxEnd - iScanIdxStart + 1, g_kuiZigzagScan8x8 + iScanIdxStart, |
| 1248 | − IS_INTRA (pCurLayer->pMbType[iMbXy]) ? LUMA_DC_AC_INTRA_8 : LUMA_DC_AC_INTER_8, | |
| 1249 | − pCurLayer->pScaledTCoeff[iMbXy] + (iId8x8 << 6), pCurLayer->pLumaQp[iMbXy], pCtx)); | |
| 1248 | + IS_INTRA (pCurDqLayer->pDec->pMbType[iMbXy]) ? LUMA_DC_AC_INTRA_8 : LUMA_DC_AC_INTER_8, | |
| 1249 | + pCurDqLayer->pScaledTCoeff[iMbXy] + (iId8x8 << 6), pCurDqLayer->pLumaQp[iMbXy], pCtx)); | |
| 1250 | 1250 | } else { |
| 1251 | 1251 | ST16 (&pNonZeroCount[g_kCacheNzcScanIdx[ (iId8x8 << 2)]], 0); |
| 1252 | 1252 | ST16 (&pNonZeroCount[g_kCacheNzcScanIdx[ (iId8x8 << 2) + 2]], 0); |
| 1253 | 1253 | } |
| 1254 | 1254 | } |
| 1255 | − ST32 (&pCurLayer->pNzc[iMbXy][0], LD32 (&pNonZeroCount[1 + 8 * 1])); | |
| 1256 | − ST32 (&pCurLayer->pNzc[iMbXy][4], LD32 (&pNonZeroCount[1 + 8 * 2])); | |
| 1257 | − ST32 (&pCurLayer->pNzc[iMbXy][8], LD32 (&pNonZeroCount[1 + 8 * 3])); | |
| 1258 | − ST32 (&pCurLayer->pNzc[iMbXy][12], LD32 (&pNonZeroCount[1 + 8 * 4])); | |
| 1255 | + ST32 (&pCurDqLayer->pNzc[iMbXy][0], LD32 (&pNonZeroCount[1 + 8 * 1])); | |
| 1256 | + ST32 (&pCurDqLayer->pNzc[iMbXy][4], LD32 (&pNonZeroCount[1 + 8 * 2])); | |
| 1257 | + ST32 (&pCurDqLayer->pNzc[iMbXy][8], LD32 (&pNonZeroCount[1 + 8 * 3])); | |
| 1258 | + ST32 (&pCurDqLayer->pNzc[iMbXy][12], LD32 (&pNonZeroCount[1 + 8 * 4])); | |
| 1259 | 1259 | } else { |
| 1260 | − iMbResProperty = (IS_INTRA (pCurLayer->pMbType[iMbXy])) ? LUMA_DC_AC_INTRA : LUMA_DC_AC_INTER; | |
| 1260 | + iMbResProperty = (IS_INTRA (pCurDqLayer->pDec->pMbType[iMbXy])) ? LUMA_DC_AC_INTRA : LUMA_DC_AC_INTER; | |
| 1261 | 1261 | for (iId8x8 = 0; iId8x8 < 4; iId8x8++) { |
| 1262 | 1262 | if (uiCbpLuma & (1 << iId8x8)) { |
| 1263 | 1263 | int32_t iIdx = (iId8x8 << 2); |
| 1264 | 1264 | for (iId4x4 = 0; iId4x4 < 4; iId4x4++) { |
| 1265 | 1265 | //Luma (DC and AC decoding together) |
| 1266 | 1266 | WELS_READ_VERIFY (ParseResidualBlockCabac (pNeighAvail, pNonZeroCount, pBsAux, iIdx, iScanIdxEnd - iScanIdxStart + 1, |
| 1267 | − g_kuiZigzagScan + iScanIdxStart, iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + (iIdx << 4), | |
| 1268 | − pCurLayer->pLumaQp[iMbXy], | |
| 1267 | + g_kuiZigzagScan + iScanIdxStart, iMbResProperty, pCurDqLayer->pScaledTCoeff[iMbXy] + (iIdx << 4), | |
| 1268 | + pCurDqLayer->pLumaQp[iMbXy], | |
| 1269 | 1269 | pCtx)); |
| 1270 | 1270 | iIdx++; |
| 1271 | 1271 | } |
| @@ -1274,10 +1274,10 @@ int32_t WelsDecodeMbCabacBSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 2 unmodified lines | ||
| 1274 | 1274 | ST16 (&pNonZeroCount[g_kCacheNzcScanIdx[ (iId8x8 << 2) + 2]], 0); |
| 1275 | 1275 | } |
| 1276 | 1276 | } |
| 1277 | − ST32 (&pCurLayer->pNzc[iMbXy][0], LD32 (&pNonZeroCount[1 + 8 * 1])); | |
| 1278 | − ST32 (&pCurLayer->pNzc[iMbXy][4], LD32 (&pNonZeroCount[1 + 8 * 2])); | |
| 1279 | − ST32 (&pCurLayer->pNzc[iMbXy][8], LD32 (&pNonZeroCount[1 + 8 * 3])); | |
| 1280 | − ST32 (&pCurLayer->pNzc[iMbXy][12], LD32 (&pNonZeroCount[1 + 8 * 4])); | |
| 1277 | + ST32 (&pCurDqLayer->pNzc[iMbXy][0], LD32 (&pNonZeroCount[1 + 8 * 1])); | |
| 1278 | + ST32 (&pCurDqLayer->pNzc[iMbXy][4], LD32 (&pNonZeroCount[1 + 8 * 2])); | |
| 1279 | + ST32 (&pCurDqLayer->pNzc[iMbXy][8], LD32 (&pNonZeroCount[1 + 8 * 3])); | |
| 1280 | + ST32 (&pCurDqLayer->pNzc[iMbXy][12], LD32 (&pNonZeroCount[1 + 8 * 4])); | |
| 1281 | 1281 | } |
| 1282 | 1282 | } |
| 1283 | 1283 | |
| @@ -1285,19 +1285,19 @@ int32_t WelsDecodeMbCabacBSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 1 unmodified line | ||
| 1285 | 1285 | //step1: DC |
| 1286 | 1286 | if (1 == uiCbpChroma || 2 == uiCbpChroma) { |
| 1287 | 1287 | for (i = 0; i < 2; i++) { |
| 1288 | − if (IS_INTRA (pCurLayer->pMbType[iMbXy])) | |
| 1288 | + if (IS_INTRA (pCurDqLayer->pDec->pMbType[iMbXy])) | |
| 1289 | 1289 | iMbResProperty = i ? CHROMA_DC_V : CHROMA_DC_U; |
| 1290 | 1290 | else |
| 1291 | 1291 | iMbResProperty = i ? CHROMA_DC_V_INTER : CHROMA_DC_U_INTER; |
| 1292 | 1292 | |
| 1293 | 1293 | WELS_READ_VERIFY (ParseResidualBlockCabac (pNeighAvail, pNonZeroCount, pBsAux, 16 + (i << 2), 4, g_kuiChromaDcScan, |
| 1294 | − iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + 256 + (i << 6), pCurLayer->pChromaQp[iMbXy][i], pCtx)); | |
| 1294 | + iMbResProperty, pCurDqLayer->pScaledTCoeff[iMbXy] + 256 + (i << 6), pCurDqLayer->pChromaQp[iMbXy][i], pCtx)); | |
| 1295 | 1295 | } |
| 1296 | 1296 | } |
| 1297 | 1297 | //step2: AC |
| 1298 | 1298 | if (2 == uiCbpChroma) { |
| 1299 | 1299 | for (i = 0; i < 2; i++) { |
| 1300 | − if (IS_INTRA (pCurLayer->pMbType[iMbXy])) | |
| 1300 | + if (IS_INTRA (pCurDqLayer->pDec->pMbType[iMbXy])) | |
| 1301 | 1301 | iMbResProperty = i ? CHROMA_AC_V : CHROMA_AC_U; |
| 1302 | 1302 | else |
| 1303 | 1303 | iMbResProperty = i ? CHROMA_AC_V_INTER : CHROMA_AC_U_INTER; |
| @@ -1305,22 +1305,22 @@ int32_t WelsDecodeMbCabacBSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 1 unmodified line | ||
| 1305 | 1305 | for (iId4x4 = 0; iId4x4 < 4; iId4x4++) { |
| 1306 | 1306 | WELS_READ_VERIFY (ParseResidualBlockCabac (pNeighAvail, pNonZeroCount, pBsAux, index, |
| 1307 | 1307 | iScanIdxEnd - WELS_MAX (iScanIdxStart, 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1), |
| 1308 | − iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + (index << 4), pCurLayer->pChromaQp[iMbXy][i], pCtx)); | |
| 1308 | + iMbResProperty, pCurDqLayer->pScaledTCoeff[iMbXy] + (index << 4), pCurDqLayer->pChromaQp[iMbXy][i], pCtx)); | |
| 1309 | 1309 | index++; |
| 1310 | 1310 | } |
| 1311 | 1311 | } |
| 1312 | − ST16 (&pCurLayer->pNzc[iMbXy][16], LD16 (&pNonZeroCount[6 + 8 * 1])); | |
| 1313 | − ST16 (&pCurLayer->pNzc[iMbXy][20], LD16 (&pNonZeroCount[6 + 8 * 2])); | |
| 1314 | − ST16 (&pCurLayer->pNzc[iMbXy][18], LD16 (&pNonZeroCount[6 + 8 * 4])); | |
| 1315 | − ST16 (&pCurLayer->pNzc[iMbXy][22], LD16 (&pNonZeroCount[6 + 8 * 5])); | |
| 1312 | + ST16 (&pCurDqLayer->pNzc[iMbXy][16], LD16 (&pNonZeroCount[6 + 8 * 1])); | |
| 1313 | + ST16 (&pCurDqLayer->pNzc[iMbXy][20], LD16 (&pNonZeroCount[6 + 8 * 2])); | |
| 1314 | + ST16 (&pCurDqLayer->pNzc[iMbXy][18], LD16 (&pNonZeroCount[6 + 8 * 4])); | |
| 1315 | + ST16 (&pCurDqLayer->pNzc[iMbXy][22], LD16 (&pNonZeroCount[6 + 8 * 5])); | |
| 1316 | 1316 | } else { |
| 1317 | − ST32 (&pCurLayer->pNzc[iMbXy][16], 0); | |
| 1318 | − ST32 (&pCurLayer->pNzc[iMbXy][20], 0); | |
| 1317 | + ST32 (&pCurDqLayer->pNzc[iMbXy][16], 0); | |
| 1318 | + ST32 (&pCurDqLayer->pNzc[iMbXy][20], 0); | |
| 1319 | 1319 | } |
| 1320 | 1320 | } else { |
| 1321 | − pCurLayer->pLumaQp[iMbXy] = pSlice->iLastMbQp; | |
| 1321 | + pCurDqLayer->pLumaQp[iMbXy] = pSlice->iLastMbQp; | |
| 1322 | 1322 | for (i = 0; i < 2; i++) { |
| 1323 | − pCurLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 (pCurLayer->pLumaQp[iMbXy] + | |
| 1323 | + pCurDqLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 (pCurDqLayer->pLumaQp[iMbXy] + | |
| 1324 | 1324 | pSliceHeader->pPps->iChromaQpIndexOffset[i], 0, 51)]; |
| 1325 | 1325 | } |
| 1326 | 1326 | } |
| @@ -1335,52 +1335,52 @@ int32_t WelsDecodeMbCabacBSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv · 8 unmodified lines | ||
| 1335 | 1335 | |
| 1336 | 1336 | |
| 1337 | 1337 | int32_t WelsDecodeMbCabacPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uint32_t& uiEosFlag) { |
| 1338 | − PDqLayer pCurLayer = pCtx->pCurDqLayer; | |
| 1339 | − PSlice pSlice = &pCurLayer->sLayerInfo.sSliceInLayer; | |
| 1338 | + PDqLayer pCurDqLayer = pCtx->pCurDqLayer; | |
| 1339 | + PSlice pSlice = &pCurDqLayer->sLayerInfo.sSliceInLayer; | |
| 1340 | 1340 | PSliceHeader pSliceHeader = &pSlice->sSliceHeaderExt.sSliceHeader; |
| 1341 | 1341 | PPicture* ppRefPic = pCtx->sRefPic.pRefList[LIST_0]; |
| 1342 | 1342 | uint32_t uiCode; |
| 1343 | − int32_t iMbXy = pCurLayer->iMbXyIndex; | |
| 1343 | + int32_t iMbXy = pCurDqLayer->iMbXyIndex; | |
| 1344 | 1344 | int32_t i; |
| 1345 | 1345 | SWelsNeighAvail uiNeighAvail; |
| 1346 | − pCurLayer->pCbp[iMbXy] = 0; | |
| 1347 | − pCurLayer->pCbfDc[iMbXy] = 0; | |
| 1348 | − pCurLayer->pChromaPredMode[iMbXy] = C_PRED_DC; | |
| 1346 | + pCurDqLayer->pCbp[iMbXy] = 0; | |
| 1347 | + pCurDqLayer->pCbfDc[iMbXy] = 0; | |
| 1348 | + pCurDqLayer->pChromaPredMode[iMbXy] = C_PRED_DC; | |
| 1349 | 1349 | |
| 1350 | − pCurLayer->pNoSubMbPartSizeLessThan8x8Flag[iMbXy] = true; | |
| 1351 | − pCurLayer->pTransformSize8x8Flag[iMbXy] = false; | |
| 1350 | + pCurDqLayer->pNoSubMbPartSizeLessThan8x8Flag[iMbXy] = true; | |
| 1351 | + pCurDqLayer->pTransformSize8x8Flag[iMbXy] = false; | |
| 1352 | 1352 | |
| 1353 | − GetNeighborAvailMbType (&uiNeighAvail, pCurLayer); | |
| 1353 | + GetNeighborAvailMbType (&uiNeighAvail, pCurDqLayer); | |
| 1354 | 1354 | WELS_READ_VERIFY (ParseSkipFlagCabac (pCtx, &uiNeighAvail, uiCode)); |
| 1355 | 1355 | |
| 1356 | 1356 | if (uiCode) { |
| 1357 | 1357 | int16_t pMv[2] = {0}; |
| 1358 | − pCurLayer->pMbType[iMbXy] = MB_TYPE_SKIP; | |
| 1359 | − ST32 (&pCurLayer->pNzc[iMbXy][0], 0); | |
| 1360 | − ST32 (&pCurLayer->pNzc[iMbXy][4], 0); | |
| 1361 | − ST32 (&pCurLayer->pNzc[iMbXy][8], 0); | |
| 1362 | − ST32 (&pCurLayer->pNzc[iMbXy][12], 0); | |
| 1363 | − ST32 (&pCurLayer->pNzc[iMbXy][16], 0); | |
| 1364 | − ST32 (&pCurLayer->pNzc[iMbXy][20], 0); | |
| 1365 | − | |
| 1366 | − pCurLayer->pInterPredictionDoneFlag[iMbXy] = 0; | |
| 1367 | − memset (pCurLayer->pRefIndex[0][iMbXy], 0, sizeof (int8_t) * 16); | |
| 1358 | + pCurDqLayer->pDec->pMbType[iMbXy] = MB_TYPE_SKIP; | |
| 1359 | + ST32 (&pCurDqLayer->pNzc[iMbXy][0], 0); | |
| 1360 | + ST32 (&pCurDqLayer->pNzc[iMbXy][4], 0); | |
| 1361 | + ST32 (&pCurDqLayer->pNzc[iMbXy][8], 0); | |
| 1362 | + ST32 (&pCurDqLayer->pNzc[iMbXy][12], 0); | |
| 1363 | + ST32 (&pCurDqLayer->pNzc[iMbXy][16], 0); | |
| 1364 | + ST32 (&pCurDqLayer->pNzc[iMbXy][20], 0); | |
| 1365 | + | |
| 1366 | + pCurDqLayer->pInterPredictionDoneFlag[iMbXy] = 0; | |
| 1367 | + memset (pCurDqLayer->pDec->pRefIndex[0][iMbXy], 0, sizeof (int8_t) * 16); | |
| 1368 | 1368 | pCtx->bMbRefConcealed = pCtx->bRPLRError || pCtx->bMbRefConcealed || ! (ppRefPic[0] && ppRefPic[0]->bIsComplete); |
| 1369 | 1369 | //predict mv |
| 1370 | − PredPSkipMvFromNeighbor (pCurLayer, pMv); | |
| 1370 | + PredPSkipMvFromNeighbor (pCurDqLayer, pMv); | |
| 1371 | 1371 | for (i = 0; i < 16; i++) { |
| 1372 | − ST32 (pCurLayer->pMv[0][iMbXy][i], * (uint32_t*)pMv); | |
| 1373 | − ST32 (pCurLayer->pMvd[0][iMbXy][i], 0); | |
| 1372 | + ST32 (pCurDqLayer->pDec->pMv[0][iMbXy][i], * (uint32_t*)pMv); | |
| 1373 | + ST32 (pCurDqLayer->pMvd[0][iMbXy][i], 0); | |
| 1374 | 1374 | } |
| 1375 | 1375 | |
| 1376 | 1376 | //if (!pSlice->sSliceHeaderExt.bDefaultResidualPredFlag) { |
| 1377 | − // memset (pCurLayer->pScaledTCoeff[iMbXy], 0, 384 * sizeof (int16_t)); | |
| 1377 | + // memset (pCurDqLayer->pScaledTCoeff[iMbXy], 0, 384 * sizeof (int16_t)); | |
| 1378 | 1378 | //} |
| 1379 | 1379 | |
| 1380 | 1380 | //reset rS |
| 1381 | − pCurLayer->pLumaQp[iMbXy] = pSlice->iLastMbQp; //??????????????? dqaunt of previous mb | |
| 1381 | + pCurDqLayer->pLumaQp[iMbXy] = pSlice->iLastMbQp; //??????????????? dqaunt of previous mb | |
| 1382 | 1382 | for (i = 0; i < 2; i++) { |
| 1383 | − pCurLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 (pCurLayer->pLumaQp[iMbXy] + | |
| 1383 | + pCurDqLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 (pCurDqLayer->pLumaQp[iMbXy] + | |
| 1384 | 1384 | pSliceHeader->pPps->iChromaQpIndexOffset[i], 0, 51)]; |
| 1385 | 1385 | } |
| 1386 | 1386 | |
| @@ -1398,41 +1398,41 @@ int32_t WelsDecodeMbCabacPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 11 unmodified lines | ||
| 1398 | 1398 | |
| 1399 | 1399 | |
| 1400 | 1400 | int32_t WelsDecodeMbCabacBSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uint32_t& uiEosFlag) { |
| 1401 | − PDqLayer pCurLayer = pCtx->pCurDqLayer; | |
| 1402 | − PSlice pSlice = &pCurLayer->sLayerInfo.sSliceInLayer; | |
| 1401 | + PDqLayer pCurDqLayer = pCtx->pCurDqLayer; | |
| 1402 | + PSlice pSlice = &pCurDqLayer->sLayerInfo.sSliceInLayer; | |
| 1403 | 1403 | PSliceHeader pSliceHeader = &pSlice->sSliceHeaderExt.sSliceHeader; |
| 1404 | 1404 | PPicture* ppRefPicL0 = pCtx->sRefPic.pRefList[LIST_0]; |
| 1405 | 1405 | PPicture* ppRefPicL1 = pCtx->sRefPic.pRefList[LIST_1]; |
| 1406 | 1406 | uint32_t uiCode; |
| 1407 | − int32_t iMbXy = pCurLayer->iMbXyIndex; | |
| 1407 | + int32_t iMbXy = pCurDqLayer->iMbXyIndex; | |
| 1408 | 1408 | int32_t i; |
| 1409 | 1409 | SWelsNeighAvail uiNeighAvail; |
| 1410 | − pCurLayer->pCbp[iMbXy] = 0; | |
| 1411 | − pCurLayer->pCbfDc[iMbXy] = 0; | |
| 1412 | − pCurLayer->pChromaPredMode[iMbXy] = C_PRED_DC; | |
| 1410 | + pCurDqLayer->pCbp[iMbXy] = 0; | |
| 1411 | + pCurDqLayer->pCbfDc[iMbXy] = 0; | |
| 1412 | + pCurDqLayer->pChromaPredMode[iMbXy] = C_PRED_DC; | |
| 1413 | 1413 | |
| 1414 | − pCurLayer->pNoSubMbPartSizeLessThan8x8Flag[iMbXy] = true; | |
| 1415 | − pCurLayer->pTransformSize8x8Flag[iMbXy] = false; | |
| 1414 | + pCurDqLayer->pNoSubMbPartSizeLessThan8x8Flag[iMbXy] = true; | |
| 1415 | + pCurDqLayer->pTransformSize8x8Flag[iMbXy] = false; | |
| 1416 | 1416 | |
| 1417 | − GetNeighborAvailMbType (&uiNeighAvail, pCurLayer); | |
| 1417 | + GetNeighborAvailMbType (&uiNeighAvail, pCurDqLayer); | |
| 1418 | 1418 | WELS_READ_VERIFY (ParseSkipFlagCabac (pCtx, &uiNeighAvail, uiCode)); |
| 1419 | 1419 | |
| 1420 | − memset (pCurLayer->pDirect[iMbXy], 0, sizeof (int8_t) * 16); | |
| 1420 | + memset (pCurDqLayer->pDirect[iMbXy], 0, sizeof (int8_t) * 16); | |
| 1421 | 1421 | |
| 1422 | 1422 | if (uiCode) { |
| 1423 | 1423 | int16_t pMv[LIST_A][2] = { {0, 0}, { 0, 0 } }; |
| 1424 | 1424 | int8_t ref[LIST_A] = { 0 }; |
| 1425 | − pCurLayer->pMbType[iMbXy] = MB_TYPE_SKIP | MB_TYPE_DIRECT; | |
| 1426 | − ST32 (&pCurLayer->pNzc[iMbXy][0], 0); | |
| 1427 | − ST32 (&pCurLayer->pNzc[iMbXy][4], 0); | |
| 1428 | − ST32 (&pCurLayer->pNzc[iMbXy][8], 0); | |
| 1429 | − ST32 (&pCurLayer->pNzc[iMbXy][12], 0); | |
| 1430 | − ST32 (&pCurLayer->pNzc[iMbXy][16], 0); | |
| 1431 | − ST32 (&pCurLayer->pNzc[iMbXy][20], 0); | |
| 1432 | − | |
| 1433 | − pCurLayer->pInterPredictionDoneFlag[iMbXy] = 0; | |
| 1434 | − memset (pCurLayer->pRefIndex[LIST_0][iMbXy], 0, sizeof (int8_t) * 16); | |
| 1435 | − memset (pCurLayer->pRefIndex[LIST_1][iMbXy], 0, sizeof (int8_t) * 16); | |
| 1425 | + pCurDqLayer->pDec->pMbType[iMbXy] = MB_TYPE_SKIP | MB_TYPE_DIRECT; | |
| 1426 | + ST32 (&pCurDqLayer->pNzc[iMbXy][0], 0); | |
| 1427 | + ST32 (&pCurDqLayer->pNzc[iMbXy][4], 0); | |
| 1428 | + ST32 (&pCurDqLayer->pNzc[iMbXy][8], 0); | |
| 1429 | + ST32 (&pCurDqLayer->pNzc[iMbXy][12], 0); | |
| 1430 | + ST32 (&pCurDqLayer->pNzc[iMbXy][16], 0); | |
| 1431 | + ST32 (&pCurDqLayer->pNzc[iMbXy][20], 0); | |
| 1432 | + | |
| 1433 | + pCurDqLayer->pInterPredictionDoneFlag[iMbXy] = 0; | |
| 1434 | + memset (pCurDqLayer->pDec->pRefIndex[LIST_0][iMbXy], 0, sizeof (int8_t) * 16); | |
| 1435 | + memset (pCurDqLayer->pDec->pRefIndex[LIST_1][iMbXy], 0, sizeof (int8_t) * 16); | |
| 1436 | 1436 | pCtx->bMbRefConcealed = pCtx->bRPLRError || pCtx->bMbRefConcealed || ! (ppRefPicL0[0] && ppRefPicL0[0]->bIsComplete) |
| 1437 | 1437 | || ! (ppRefPicL1[0] && ppRefPicL1[0]->bIsComplete); |
| 1438 | 1438 | |
| @@ -1460,9 +1460,9 @@ int32_t WelsDecodeMbCabacBSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 21 unmodified lines | ||
| 1460 | 1460 | |
| 1461 | 1461 | |
| 1462 | 1462 | //reset rS |
| 1463 | − pCurLayer->pLumaQp[iMbXy] = pSlice->iLastMbQp; //??????????????? dqaunt of previous mb | |
| 1463 | + pCurDqLayer->pLumaQp[iMbXy] = pSlice->iLastMbQp; //??????????????? dqaunt of previous mb | |
| 1464 | 1464 | for (i = 0; i < 2; i++) { |
| 1465 | − pCurLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 (pCurLayer->pLumaQp[iMbXy] + | |
| 1465 | + pCurDqLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 (pCurDqLayer->pLumaQp[iMbXy] + | |
| 1466 | 1466 | pSliceHeader->pPps->iChromaQpIndexOffset[i], 0, 51)]; |
| 1467 | 1467 | } |
| 1468 | 1468 | |
| @@ -1509,12 +1509,12 @@ int32_t WelsCalcDeqCoeffScalingList (PWelsDecoderContext pCtx) { · 40 unmodified lines | ||
| 1509 | 1509 | } |
| 1510 | 1510 | |
| 1511 | 1511 | int32_t WelsDecodeSlice (PWelsDecoderContext pCtx, bool bFirstSliceInLayer, PNalUnit pNalCur) { |
| 1512 | − PDqLayer pCurLayer = pCtx->pCurDqLayer; | |
| 1512 | + PDqLayer pCurDqLayer = pCtx->pCurDqLayer; | |
| 1513 | 1513 | PFmo pFmo = pCtx->pFmo; |
| 1514 | 1514 | int32_t iRet; |
| 1515 | 1515 | int32_t iNextMbXyIndex, iSliceIdc; |
| 1516 | 1516 | |
| 1517 | − PSlice pSlice = &pCurLayer->sLayerInfo.sSliceInLayer; | |
| 1517 | + PSlice pSlice = &pCurDqLayer->sLayerInfo.sSliceInLayer; | |
| 1518 | 1518 | PSliceHeaderExt pSliceHeaderExt = &pSlice->sSliceHeaderExt; |
| 1519 | 1519 | PSliceHeader pSliceHeader = &pSliceHeaderExt->sSliceHeader; |
| 1520 | 1520 | int32_t iMbX, iMbY; |
| @@ -1560,7 +1560,7 @@ int32_t WelsDecodeSlice (PWelsDecoderContext pCtx, bool bFirstSliceInLayer, PNal · 39 unmodified lines | ||
| 1560 | 1560 | } |
| 1561 | 1561 | |
| 1562 | 1562 | pCtx->eSliceType = pSliceHeader->eSliceType; |
| 1563 | − if (pCurLayer->sLayerInfo.pPps->bEntropyCodingModeFlag == 1) { | |
| 1563 | + if (pCurDqLayer->sLayerInfo.pPps->bEntropyCodingModeFlag == 1) { | |
| 1564 | 1564 | int32_t iQp = pSlice->sSliceHeaderExt.sSliceHeader.iSliceQp; |
| 1565 | 1565 | int32_t iCabacInitIdc = pSlice->sSliceHeaderExt.sSliceHeader.iCabacInitIdc; |
| 1566 | 1566 | WelsCabacContextInit (pCtx, pSlice->eSliceType, iCabacInitIdc, iQp); |
| @@ -1572,24 +1572,24 @@ int32_t WelsDecodeSlice (PWelsDecoderContext pCtx, bool bFirstSliceInLayer, PNal · 5 unmodified lines | ||
| 1572 | 1572 | WelsCalcDeqCoeffScalingList (pCtx); |
| 1573 | 1573 | |
| 1574 | 1574 | iNextMbXyIndex = pSliceHeader->iFirstMbInSlice; |
| 1575 | − iMbX = iNextMbXyIndex % pCurLayer->iMbWidth; | |
| 1576 | − iMbY = iNextMbXyIndex / pCurLayer->iMbWidth; // error is introduced by multiple slices case, 11/23/2009 | |
| 1575 | + iMbX = iNextMbXyIndex % pCurDqLayer->iMbWidth; | |
| 1576 | + iMbY = iNextMbXyIndex / pCurDqLayer->iMbWidth; // error is introduced by multiple slices case, 11/23/2009 | |
| 1577 | 1577 | pSlice->iMbSkipRun = -1; |
| 1578 | − iSliceIdc = (pSliceHeader->iFirstMbInSlice << 7) + pCurLayer->uiLayerDqId; | |
| 1578 | + iSliceIdc = (pSliceHeader->iFirstMbInSlice << 7) + pCurDqLayer->uiLayerDqId; | |
| 1579 | 1579 | |
| 1580 | − pCurLayer->iMbX = iMbX; | |
| 1581 | − pCurLayer->iMbY = iMbY; | |
| 1582 | − pCurLayer->iMbXyIndex = iNextMbXyIndex; | |
| 1580 | + pCurDqLayer->iMbX = iMbX; | |
| 1581 | + pCurDqLayer->iMbY = iMbY; | |
| 1582 | + pCurDqLayer->iMbXyIndex = iNextMbXyIndex; | |
| 1583 | 1583 | |
| 1584 | 1584 | do { |
| 1585 | 1585 | if ((-1 == iNextMbXyIndex) || (iNextMbXyIndex >= kiCountNumMb)) { // slice group boundary or end of a frame |
| 1586 | 1586 | break; |
| 1587 | 1587 | } |
| 1588 | 1588 | |
| 1589 | − pCurLayer->pSliceIdc[iNextMbXyIndex] = iSliceIdc; | |
| 1589 | + pCurDqLayer->pSliceIdc[iNextMbXyIndex] = iSliceIdc; | |
| 1590 | 1590 | pCtx->bMbRefConcealed = false; |
| 1591 | 1591 | iRet = pDecMbFunc (pCtx, pNalCur, uiEosFlag); |
| 1592 | − pCurLayer->pMbRefConcealedFlag[iNextMbXyIndex] = pCtx->bMbRefConcealed; | |
| 1592 | + pCurDqLayer->pMbRefConcealedFlag[iNextMbXyIndex] = pCtx->bMbRefConcealed; | |
| 1593 | 1593 | if (iRet != ERR_NONE) { |
| 1594 | 1594 | return iRet; |
| 1595 | 1595 | } |
| @@ -1603,21 +1603,21 @@ int32_t WelsDecodeSlice (PWelsDecoderContext pCtx, bool bFirstSliceInLayer, PNal · 7 unmodified lines | ||
| 1603 | 1603 | } else { |
| 1604 | 1604 | ++iNextMbXyIndex; |
| 1605 | 1605 | } |
| 1606 | − iMbX = iNextMbXyIndex % pCurLayer->iMbWidth; | |
| 1607 | − iMbY = iNextMbXyIndex / pCurLayer->iMbWidth; | |
| 1608 | − pCurLayer->iMbX = iMbX; | |
| 1609 | − pCurLayer->iMbY = iMbY; | |
| 1610 | − pCurLayer->iMbXyIndex = iNextMbXyIndex; | |
| 1606 | + iMbX = iNextMbXyIndex % pCurDqLayer->iMbWidth; | |
| 1607 | + iMbY = iNextMbXyIndex / pCurDqLayer->iMbWidth; | |
| 1608 | + pCurDqLayer->iMbX = iMbX; | |
| 1609 | + pCurDqLayer->iMbY = iMbY; | |
| 1610 | + pCurDqLayer->iMbXyIndex = iNextMbXyIndex; | |
| 1611 | 1611 | } while (1); |
| 1612 | 1612 | |
| 1613 | 1613 | return ERR_NONE; |
| 1614 | 1614 | } |
| 1615 | 1615 | |
| 1616 | 1616 | int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { |
| 1617 | − SVlcTable* pVlcTable = &pCtx->sVlcTable; | |
| 1618 | − PDqLayer pCurLayer = pCtx->pCurDqLayer; | |
| 1619 | − PBitStringAux pBs = pCurLayer->pBitStringAux; | |
| 1620 | − PSlice pSlice = &pCurLayer->sLayerInfo.sSliceInLayer; | |
| 1617 | + SVlcTable* pVlcTable = pCtx->pVlcTable; | |
| 1618 | + PDqLayer pCurDqLayer = pCtx->pCurDqLayer; | |
| 1619 | + PBitStringAux pBs = pCurDqLayer->pBitStringAux; | |
| 1620 | + PSlice pSlice = &pCurDqLayer->sLayerInfo.sSliceInLayer; | |
| 1621 | 1621 | PSliceHeader pSliceHeader = &pSlice->sSliceHeaderExt.sSliceHeader; |
| 1622 | 1622 | |
| 1623 | 1623 | SWelsNeighAvail sNeighAvail; |
| @@ -1626,10 +1626,10 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 2 unmodified lines | ||
| 1626 | 1626 | int32_t iScanIdxStart = pSlice->sSliceHeaderExt.uiScanIdxStart; |
| 1627 | 1627 | int32_t iScanIdxEnd = pSlice->sSliceHeaderExt.uiScanIdxEnd; |
| 1628 | 1628 | |
| 1629 | − int32_t iMbX = pCurLayer->iMbX; | |
| 1630 | − int32_t iMbY = pCurLayer->iMbY; | |
| 1631 | − const int32_t iMbXy = pCurLayer->iMbXyIndex; | |
| 1632 | − int8_t* pNzc = pCurLayer->pNzc[iMbXy]; | |
| 1629 | + int32_t iMbX = pCurDqLayer->iMbX; | |
| 1630 | + int32_t iMbY = pCurDqLayer->iMbY; | |
| 1631 | + const int32_t iMbXy = pCurDqLayer->iMbXyIndex; | |
| 1632 | + int8_t* pNzc = pCurDqLayer->pNzc[iMbXy]; | |
| 1633 | 1633 | int32_t i; |
| 1634 | 1634 | int32_t iRet = ERR_NONE; |
| 1635 | 1635 | uint32_t uiMbType = 0, uiCbp = 0, uiCbpL = 0, uiCbpC = 0; |
| @@ -1637,12 +1637,12 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 1 unmodified line | ||
| 1637 | 1637 | int32_t iCode; |
| 1638 | 1638 | |
| 1639 | 1639 | ENFORCE_STACK_ALIGN_1D (uint8_t, pNonZeroCount, 48, 16); |
| 1640 | − GetNeighborAvailMbType (&sNeighAvail, pCurLayer); | |
| 1641 | − pCurLayer->pInterPredictionDoneFlag[iMbXy] = 0; | |
| 1642 | − pCurLayer->pResidualPredFlag[iMbXy] = pSlice->sSliceHeaderExt.bDefaultResidualPredFlag; | |
| 1640 | + GetNeighborAvailMbType (&sNeighAvail, pCurDqLayer); | |
| 1641 | + pCurDqLayer->pInterPredictionDoneFlag[iMbXy] = 0; | |
| 1642 | + pCurDqLayer->pResidualPredFlag[iMbXy] = pSlice->sSliceHeaderExt.bDefaultResidualPredFlag; | |
| 1643 | 1643 | |
| 1644 | − pCurLayer->pNoSubMbPartSizeLessThan8x8Flag[iMbXy] = true; | |
| 1645 | − pCurLayer->pTransformSize8x8Flag[iMbXy] = false; | |
| 1644 | + pCurDqLayer->pNoSubMbPartSizeLessThan8x8Flag[iMbXy] = true; | |
| 1645 | + pCurDqLayer->pTransformSize8x8Flag[iMbXy] = false; | |
| 1646 | 1646 | |
| 1647 | 1647 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //uiMbType |
| 1648 | 1648 | uiMbType = uiCode; |
| @@ -1653,15 +1653,15 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 4 unmodified lines | ||
| 1653 | 1653 | |
| 1654 | 1654 | if (25 == uiMbType) { |
| 1655 | 1655 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG, "I_PCM mode exists in I slice!"); |
| 1656 | − int32_t iDecStrideL = pCurLayer->pDec->iLinesize[0]; | |
| 1657 | − int32_t iDecStrideC = pCurLayer->pDec->iLinesize[1]; | |
| 1656 | + int32_t iDecStrideL = pCurDqLayer->pDec->iLinesize[0]; | |
| 1657 | + int32_t iDecStrideC = pCurDqLayer->pDec->iLinesize[1]; | |
| 1658 | 1658 | |
| 1659 | 1659 | int32_t iOffsetL = (iMbX + iMbY * iDecStrideL) << 4; |
| 1660 | 1660 | int32_t iOffsetC = (iMbX + iMbY * iDecStrideC) << 3; |
| 1661 | 1661 | |
| 1662 | − uint8_t* pDecY = pCurLayer->pDec->pData[0] + iOffsetL; | |
| 1663 | − uint8_t* pDecU = pCurLayer->pDec->pData[1] + iOffsetC; | |
| 1664 | − uint8_t* pDecV = pCurLayer->pDec->pData[2] + iOffsetC; | |
| 1662 | + uint8_t* pDecY = pCurDqLayer->pDec->pData[0] + iOffsetL; | |
| 1663 | + uint8_t* pDecU = pCurDqLayer->pDec->pData[1] + iOffsetC; | |
| 1664 | + uint8_t* pDecV = pCurDqLayer->pDec->pData[2] + iOffsetC; | |
| 1665 | 1665 | |
| 1666 | 1666 | uint8_t* pTmpBsBuf; |
| 1667 | 1667 | |
| @@ -1672,7 +1672,7 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 4 unmodified lines | ||
| 1672 | 1672 | |
| 1673 | 1673 | int32_t iIndex = ((-pBs->iLeftBits) >> 3) + 2; |
| 1674 | 1674 | |
| 1675 | − pCurLayer->pMbType[iMbXy] = MB_TYPE_INTRA_PCM; | |
| 1675 | + pCurDqLayer->pDec->pMbType[iMbXy] = MB_TYPE_INTRA_PCM; | |
| 1676 | 1676 | |
| 1677 | 1677 | //step 1: locating bit-stream pointer [must align into integer byte] |
| 1678 | 1678 | pBs->pCurBuf -= iIndex; |
| @@ -1700,27 +1700,27 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 21 unmodified lines | ||
| 1700 | 1700 | pBs->pCurBuf += 384; |
| 1701 | 1701 | |
| 1702 | 1702 | //step 3: update QP and pNonZeroCount |
| 1703 | − pCurLayer->pLumaQp[iMbXy] = 0; | |
| 1704 | − memset (pCurLayer->pChromaQp[iMbXy], 0, sizeof (pCurLayer->pChromaQp[iMbXy])); | |
| 1705 | − memset (pNzc, 16, sizeof (pCurLayer->pNzc[iMbXy])); //Rec. 9.2.1 for PCM, nzc=16 | |
| 1703 | + pCurDqLayer->pLumaQp[iMbXy] = 0; | |
| 1704 | + memset (pCurDqLayer->pChromaQp[iMbXy], 0, sizeof (pCurDqLayer->pChromaQp[iMbXy])); | |
| 1705 | + memset (pNzc, 16, sizeof (pCurDqLayer->pNzc[iMbXy])); //Rec. 9.2.1 for PCM, nzc=16 | |
| 1706 | 1706 | WELS_READ_VERIFY (InitReadBits (pBs, 0)); |
| 1707 | 1707 | return ERR_NONE; |
| 1708 | 1708 | } else if (0 == uiMbType) { //reference to JM |
| 1709 | 1709 | ENFORCE_STACK_ALIGN_1D (int8_t, pIntraPredMode, 48, 16); |
| 1710 | − pCurLayer->pMbType[iMbXy] = MB_TYPE_INTRA4x4; | |
| 1710 | + pCurDqLayer->pDec->pMbType[iMbXy] = MB_TYPE_INTRA4x4; | |
| 1711 | 1711 | if (pCtx->pPps->bTransform8x8ModeFlag) { |
| 1712 | 1712 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //transform_size_8x8_flag |
| 1713 | − pCurLayer->pTransformSize8x8Flag[iMbXy] = !!uiCode; | |
| 1714 | − if (pCurLayer->pTransformSize8x8Flag[iMbXy]) { | |
| 1715 | − uiMbType = pCurLayer->pMbType[iMbXy] = MB_TYPE_INTRA8x8; | |
| 1713 | + pCurDqLayer->pTransformSize8x8Flag[iMbXy] = !!uiCode; | |
| 1714 | + if (pCurDqLayer->pTransformSize8x8Flag[iMbXy]) { | |
| 1715 | + uiMbType = pCurDqLayer->pDec->pMbType[iMbXy] = MB_TYPE_INTRA8x8; | |
| 1716 | 1716 | } |
| 1717 | 1717 | } |
| 1718 | − if (!pCurLayer->pTransformSize8x8Flag[iMbXy]) { | |
| 1719 | − pCtx->pFillInfoCacheIntraNxNFunc (&sNeighAvail, pNonZeroCount, pIntraPredMode, pCurLayer); | |
| 1720 | − WELS_READ_VERIFY (ParseIntra4x4Mode (pCtx, &sNeighAvail, pIntraPredMode, pBs, pCurLayer)); | |
| 1718 | + if (!pCurDqLayer->pTransformSize8x8Flag[iMbXy]) { | |
| 1719 | + pCtx->pFillInfoCacheIntraNxNFunc (&sNeighAvail, pNonZeroCount, pIntraPredMode, pCurDqLayer); | |
| 1720 | + WELS_READ_VERIFY (ParseIntra4x4Mode (pCtx, &sNeighAvail, pIntraPredMode, pBs, pCurDqLayer)); | |
| 1721 | 1721 | } else { |
| 1722 | − pCtx->pFillInfoCacheIntraNxNFunc (&sNeighAvail, pNonZeroCount, pIntraPredMode, pCurLayer); | |
| 1723 | − WELS_READ_VERIFY (ParseIntra8x8Mode (pCtx, &sNeighAvail, pIntraPredMode, pBs, pCurLayer)); | |
| 1722 | + pCtx->pFillInfoCacheIntraNxNFunc (&sNeighAvail, pNonZeroCount, pIntraPredMode, pCurDqLayer); | |
| 1723 | + WELS_READ_VERIFY (ParseIntra8x8Mode (pCtx, &sNeighAvail, pIntraPredMode, pBs, pCurDqLayer)); | |
| 1724 | 1724 | } |
| 1725 | 1725 | |
| 1726 | 1726 | //uiCbp |
| @@ -1736,19 +1736,19 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 9 unmodified lines | ||
| 1736 | 1736 | uiCbp = g_kuiIntra4x4CbpTable[uiCbp]; |
| 1737 | 1737 | else |
| 1738 | 1738 | uiCbp = g_kuiIntra4x4CbpTable400[uiCbp]; |
| 1739 | − pCurLayer->pCbp[iMbXy] = uiCbp; | |
| 1739 | + pCurDqLayer->pCbp[iMbXy] = uiCbp; | |
| 1740 | 1740 | uiCbpC = uiCbp >> 4; |
| 1741 | 1741 | uiCbpL = uiCbp & 15; |
| 1742 | 1742 | } else { //I_PCM exclude, we can ignore it |
| 1743 | − pCurLayer->pMbType[iMbXy] = MB_TYPE_INTRA16x16; | |
| 1744 | − pCurLayer->pTransformSize8x8Flag[iMbXy] = false; | |
| 1745 | − pCurLayer->pNoSubMbPartSizeLessThan8x8Flag[iMbXy] = true; | |
| 1746 | − pCurLayer->pIntraPredMode[iMbXy][7] = (uiMbType - 1) & 3; | |
| 1747 | − pCurLayer->pCbp[iMbXy] = g_kuiI16CbpTable[ (uiMbType - 1) >> 2]; | |
| 1748 | − uiCbpC = pCtx->pSps->uiChromaFormatIdc ? pCurLayer->pCbp[iMbXy] >> 4 : 0; | |
| 1749 | − uiCbpL = pCurLayer->pCbp[iMbXy] & 15; | |
| 1750 | − WelsFillCacheNonZeroCount (&sNeighAvail, pNonZeroCount, pCurLayer); | |
| 1751 | − WELS_READ_VERIFY (ParseIntra16x16Mode (pCtx, &sNeighAvail, pBs, pCurLayer)); | |
| 1743 | + pCurDqLayer->pDec->pMbType[iMbXy] = MB_TYPE_INTRA16x16; | |
| 1744 | + pCurDqLayer->pTransformSize8x8Flag[iMbXy] = false; | |
| 1745 | + pCurDqLayer->pNoSubMbPartSizeLessThan8x8Flag[iMbXy] = true; | |
| 1746 | + pCurDqLayer->pIntraPredMode[iMbXy][7] = (uiMbType - 1) & 3; | |
| 1747 | + pCurDqLayer->pCbp[iMbXy] = g_kuiI16CbpTable[ (uiMbType - 1) >> 2]; | |
| 1748 | + uiCbpC = pCtx->pSps->uiChromaFormatIdc ? pCurDqLayer->pCbp[iMbXy] >> 4 : 0; | |
| 1749 | + uiCbpL = pCurDqLayer->pCbp[iMbXy] & 15; | |
| 1750 | + WelsFillCacheNonZeroCount (&sNeighAvail, pNonZeroCount, pCurDqLayer); | |
| 1751 | + WELS_READ_VERIFY (ParseIntra16x16Mode (pCtx, &sNeighAvail, pBs, pCurDqLayer)); | |
| 1752 | 1752 | } |
| 1753 | 1753 | |
| 1754 | 1754 | ST32A4 (&pNzc[0], 0); |
| @@ -1758,17 +1758,17 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 3 unmodified lines | ||
| 1758 | 1758 | ST32A4 (&pNzc[16], 0); |
| 1759 | 1759 | ST32A4 (&pNzc[20], 0); |
| 1760 | 1760 | |
| 1761 | − if (pCurLayer->pCbp[iMbXy] == 0 && IS_INTRANxN (pCurLayer->pMbType[iMbXy])) { | |
| 1762 | − pCurLayer->pLumaQp[iMbXy] = pSlice->iLastMbQp; | |
| 1761 | + if (pCurDqLayer->pCbp[iMbXy] == 0 && IS_INTRANxN (pCurDqLayer->pDec->pMbType[iMbXy])) { | |
| 1762 | + pCurDqLayer->pLumaQp[iMbXy] = pSlice->iLastMbQp; | |
| 1763 | 1763 | for (i = 0; i < 2; i++) { |
| 1764 | − pCurLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 (pCurLayer->pLumaQp[iMbXy] + | |
| 1764 | + pCurDqLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 (pCurDqLayer->pLumaQp[iMbXy] + | |
| 1765 | 1765 | pSliceHeader->pPps->iChromaQpIndexOffset[i], 0, 51)]; |
| 1766 | 1766 | } |
| 1767 | 1767 | |
| 1768 | 1768 | } |
| 1769 | 1769 | |
| 1770 | − if (pCurLayer->pCbp[iMbXy] || MB_TYPE_INTRA16x16 == pCurLayer->pMbType[iMbXy]) { | |
| 1771 | − memset (pCurLayer->pScaledTCoeff[iMbXy], 0, 384 * sizeof (pCurLayer->pScaledTCoeff[iMbXy][0])); | |
| 1770 | + if (pCurDqLayer->pCbp[iMbXy] || MB_TYPE_INTRA16x16 == pCurDqLayer->pDec->pMbType[iMbXy]) { | |
| 1771 | + memset (pCurDqLayer->pScaledTCoeff[iMbXy], 0, 384 * sizeof (pCurDqLayer->pScaledTCoeff[iMbXy][0])); | |
| 1772 | 1772 | int32_t iQpDelta, iId8x8, iId4x4; |
| 1773 | 1773 | |
| 1774 | 1774 | WELS_READ_VERIFY (BsGetSe (pBs, &iCode)); //mb_qp_delta |
| @@ -1778,10 +1778,10 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 3 unmodified lines | ||
| 1778 | 1778 | return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_QP); |
| 1779 | 1779 | } |
| 1780 | 1780 | |
| 1781 | − pCurLayer->pLumaQp[iMbXy] = (pSlice->iLastMbQp + iQpDelta + 52) % 52; //update last_mb_qp | |
| 1782 | − pSlice->iLastMbQp = pCurLayer->pLumaQp[iMbXy]; | |
| 1781 | + pCurDqLayer->pLumaQp[iMbXy] = (pSlice->iLastMbQp + iQpDelta + 52) % 52; //update last_mb_qp | |
| 1782 | + pSlice->iLastMbQp = pCurDqLayer->pLumaQp[iMbXy]; | |
| 1783 | 1783 | for (i = 0; i < 2; i++) { |
| 1784 | − pCurLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 (pSlice->iLastMbQp + | |
| 1784 | + pCurDqLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 (pSlice->iLastMbQp + | |
| 1785 | 1785 | pSliceHeader->pPps->iChromaQpIndexOffset[i], 0, |
| 1786 | 1786 | 51)]; |
| 1787 | 1787 | } |
| @@ -1789,18 +1789,18 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 1 unmodified line | ||
| 1789 | 1789 | |
| 1790 | 1790 | BsStartCavlc (pBs); |
| 1791 | 1791 | |
| 1792 | − if (MB_TYPE_INTRA16x16 == pCurLayer->pMbType[iMbXy]) { | |
| 1792 | + if (MB_TYPE_INTRA16x16 == pCurDqLayer->pDec->pMbType[iMbXy]) { | |
| 1793 | 1793 | //step1: Luma DC |
| 1794 | 1794 | if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, 0, 16, g_kuiLumaDcZigzagScan, I16_LUMA_DC, |
| 1795 | − pCurLayer->pScaledTCoeff[iMbXy], pCurLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) { | |
| 1795 | + pCurDqLayer->pScaledTCoeff[iMbXy], pCurDqLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) { | |
| 1796 | 1796 | return iRet;//abnormal |
| 1797 | 1797 | } |
| 1798 | 1798 | //step2: Luma AC |
| 1799 | 1799 | if (uiCbpL) { |
| 1800 | 1800 | for (i = 0; i < 16; i++) { |
| 1801 | 1801 | if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, i, iScanIdxEnd - WELS_MAX (iScanIdxStart, 1) + 1, |
| 1802 | − g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1), I16_LUMA_AC, pCurLayer->pScaledTCoeff[iMbXy] + (i << 4), | |
| 1803 | − pCurLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) { | |
| 1802 | + g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1), I16_LUMA_AC, pCurDqLayer->pScaledTCoeff[iMbXy] + (i << 4), | |
| 1803 | + pCurDqLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) { | |
| 1804 | 1804 | return iRet;//abnormal |
| 1805 | 1805 | } |
| 1806 | 1806 | } |
| @@ -1810,15 +1810,15 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 3 unmodified lines | ||
| 1810 | 1810 | ST32A4 (&pNzc[12], LD32 (&pNonZeroCount[1 + 8 * 4])); |
| 1811 | 1811 | } |
| 1812 | 1812 | } else { //non-MB_TYPE_INTRA16x16 |
| 1813 | − if (pCurLayer->pTransformSize8x8Flag[iMbXy]) { | |
| 1813 | + if (pCurDqLayer->pTransformSize8x8Flag[iMbXy]) { | |
| 1814 | 1814 | for (iId8x8 = 0; iId8x8 < 4; iId8x8++) { |
| 1815 | − iMbResProperty = (IS_INTRA (pCurLayer->pMbType[iMbXy])) ? LUMA_DC_AC_INTRA_8 : LUMA_DC_AC_INTER_8; | |
| 1815 | + iMbResProperty = (IS_INTRA (pCurDqLayer->pDec->pMbType[iMbXy])) ? LUMA_DC_AC_INTRA_8 : LUMA_DC_AC_INTER_8; | |
| 1816 | 1816 | if (uiCbpL & (1 << iId8x8)) { |
| 1817 | 1817 | int32_t iIndex = (iId8x8 << 2); |
| 1818 | 1818 | for (iId4x4 = 0; iId4x4 < 4; iId4x4++) { |
| 1819 | 1819 | if ((iRet = WelsResidualBlockCavlc8x8 (pVlcTable, pNonZeroCount, pBs, iIndex, iScanIdxEnd - iScanIdxStart + 1, |
| 1820 | − g_kuiZigzagScan8x8 + iScanIdxStart, iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + (iId8x8 << 6), iId4x4, | |
| 1821 | − pCurLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) { | |
| 1820 | + g_kuiZigzagScan8x8 + iScanIdxStart, iMbResProperty, pCurDqLayer->pScaledTCoeff[iMbXy] + (iId8x8 << 6), iId4x4, | |
| 1821 | + pCurDqLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) { | |
| 1822 | 1822 | return iRet; |
| 1823 | 1823 | } |
| 1824 | 1824 | iIndex++; |
| @@ -1839,8 +1839,8 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 14 unmodified lines | ||
| 1839 | 1839 | for (iId4x4 = 0; iId4x4 < 4; iId4x4++) { |
| 1840 | 1840 | //Luma (DC and AC decoding together) |
| 1841 | 1841 | if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex, iScanIdxEnd - iScanIdxStart + 1, |
| 1842 | − g_kuiZigzagScan + iScanIdxStart, LUMA_DC_AC_INTRA, pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), | |
| 1843 | − pCurLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) { | |
| 1842 | + g_kuiZigzagScan + iScanIdxStart, LUMA_DC_AC_INTRA, pCurDqLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), | |
| 1843 | + pCurDqLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) { | |
| 1844 | 1844 | return iRet;//abnormal |
| 1845 | 1845 | } |
| 1846 | 1846 | iIndex++; |
| @@ -1863,7 +1863,7 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 16 unmodified lines | ||
| 1863 | 1863 | for (i = 0; i < 2; i++) { //Cb Cr |
| 1864 | 1864 | iMbResProperty = i ? CHROMA_DC_V : CHROMA_DC_U; |
| 1865 | 1865 | if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, 16 + (i << 2), 4, g_kuiChromaDcScan, iMbResProperty, |
| 1866 | − pCurLayer->pScaledTCoeff[iMbXy] + 256 + (i << 6), pCurLayer->pChromaQp[iMbXy][i], pCtx)) != ERR_NONE) { | |
| 1866 | + pCurDqLayer->pScaledTCoeff[iMbXy] + 256 + (i << 6), pCurDqLayer->pChromaQp[iMbXy][i], pCtx)) != ERR_NONE) { | |
| 1867 | 1867 | return iRet;//abnormal |
| 1868 | 1868 | } |
| 1869 | 1869 | } |
| @@ -1876,8 +1876,8 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 6 unmodified lines | ||
| 1876 | 1876 | int32_t iIndex = 16 + (i << 2); |
| 1877 | 1877 | for (iId4x4 = 0; iId4x4 < 4; iId4x4++) { |
| 1878 | 1878 | if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex, iScanIdxEnd - WELS_MAX (iScanIdxStart, |
| 1879 | − 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1), iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), | |
| 1880 | − pCurLayer->pChromaQp[iMbXy][i], pCtx)) != ERR_NONE) { | |
| 1879 | + 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1), iMbResProperty, pCurDqLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), | |
| 1880 | + pCurDqLayer->pChromaQp[iMbXy][i], pCtx)) != ERR_NONE) { | |
| 1881 | 1881 | return iRet;//abnormal |
| 1882 | 1882 | } |
| 1883 | 1883 | iIndex++; |
| @@ -1895,9 +1895,9 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { · 11 unmodified lines | ||
| 1895 | 1895 | } |
| 1896 | 1896 | |
| 1897 | 1897 | int32_t WelsDecodeMbCavlcISlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uint32_t& uiEosFlag) { |
| 1898 | − PDqLayer pCurLayer = pCtx->pCurDqLayer; | |
| 1899 | − PBitStringAux pBs = pCurLayer->pBitStringAux; | |
| 1900 | − PSliceHeaderExt pSliceHeaderExt = &pCurLayer->sLayerInfo.sSliceInLayer.sSliceHeaderExt; | |
| 1898 | + PDqLayer pCurDqLayer = pCtx->pCurDqLayer; | |
| 1899 | + PBitStringAux pBs = pCurDqLayer->pBitStringAux; | |
| 1900 | + PSliceHeaderExt pSliceHeaderExt = &pCurDqLayer->sLayerInfo.sSliceInLayer.sSliceHeaderExt; | |
| 1901 | 1901 | int32_t iBaseModeFlag; |
| 1902 | 1902 | int32_t iRet = 0; //should have the return value to indicate decoding error or not, It's NECESSARY--2010.4.15 |
| 1903 | 1903 | uint32_t uiCode; |
| @@ -1922,7 +1922,7 @@ int32_t WelsDecodeMbCavlcISlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 18 unmodified lines | ||
| 1922 | 1922 | // check whether there is left bits to read next time in case multiple slices |
| 1923 | 1923 | iUsedBits = ((pBs->pCurBuf - pBs->pStartBuf) << 3) - (16 - pBs->iLeftBits); |
| 1924 | 1924 | // sub 1, for stop bit |
| 1925 | − if ((iUsedBits == (pBs->iBits - 1)) && (0 >= pCurLayer->sLayerInfo.sSliceInLayer.iMbSkipRun)) { // slice boundary | |
| 1925 | + if ((iUsedBits == (pBs->iBits - 1)) && (0 >= pCurDqLayer->sLayerInfo.sSliceInLayer.iMbSkipRun)) { // slice boundary | |
| 1926 | 1926 | uiEosFlag = 1; |
| 1927 | 1927 | } |
| 1928 | 1928 | if (iUsedBits > (pBs->iBits - |
| @@ -1936,20 +1936,20 @@ int32_t WelsDecodeMbCavlcISlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 7 unmodified lines | ||
| 1936 | 1936 | } |
| 1937 | 1937 | |
| 1938 | 1938 | int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { |
| 1939 | − SVlcTable* pVlcTable = &pCtx->sVlcTable; | |
| 1940 | − PDqLayer pCurLayer = pCtx->pCurDqLayer; | |
| 1941 | − PBitStringAux pBs = pCurLayer->pBitStringAux; | |
| 1942 | − PSlice pSlice = &pCurLayer->sLayerInfo.sSliceInLayer; | |
| 1939 | + SVlcTable* pVlcTable = pCtx->pVlcTable; | |
| 1940 | + PDqLayer pCurDqLayer = pCtx->pCurDqLayer; | |
| 1941 | + PBitStringAux pBs = pCurDqLayer->pBitStringAux; | |
| 1942 | + PSlice pSlice = &pCurDqLayer->sLayerInfo.sSliceInLayer; | |
| 1943 | 1943 | PSliceHeader pSliceHeader = &pSlice->sSliceHeaderExt.sSliceHeader; |
| 1944 | 1944 | |
| 1945 | 1945 | int32_t iScanIdxStart = pSlice->sSliceHeaderExt.uiScanIdxStart; |
| 1946 | 1946 | int32_t iScanIdxEnd = pSlice->sSliceHeaderExt.uiScanIdxEnd; |
| 1947 | 1947 | |
| 1948 | 1948 | SWelsNeighAvail sNeighAvail; |
| 1949 | − int32_t iMbX = pCurLayer->iMbX; | |
| 1950 | − int32_t iMbY = pCurLayer->iMbY; | |
| 1951 | − const int32_t iMbXy = pCurLayer->iMbXyIndex; | |
| 1952 | − int8_t* pNzc = pCurLayer->pNzc[iMbXy]; | |
| 1949 | + int32_t iMbX = pCurDqLayer->iMbX; | |
| 1950 | + int32_t iMbY = pCurDqLayer->iMbY; | |
| 1951 | + const int32_t iMbXy = pCurDqLayer->iMbXyIndex; | |
| 1952 | + int8_t* pNzc = pCurDqLayer->pNzc[iMbXy]; | |
| 1953 | 1953 | int32_t i; |
| 1954 | 1954 | int32_t iRet = ERR_NONE; |
| 1955 | 1955 | uint32_t uiMbType = 0, uiCbp = 0, uiCbpL = 0, uiCbpC = 0; |
| @@ -1957,16 +1957,16 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 1 unmodified line | ||
| 1957 | 1957 | int32_t iCode; |
| 1958 | 1958 | int32_t iMbResProperty; |
| 1959 | 1959 | |
| 1960 | − GetNeighborAvailMbType (&sNeighAvail, pCurLayer); | |
| 1960 | + GetNeighborAvailMbType (&sNeighAvail, pCurDqLayer); | |
| 1961 | 1961 | ENFORCE_STACK_ALIGN_1D (uint8_t, pNonZeroCount, 48, 16); |
| 1962 | − pCurLayer->pInterPredictionDoneFlag[iMbXy] = 0;//2009.10.23 | |
| 1962 | + pCurDqLayer->pInterPredictionDoneFlag[iMbXy] = 0;//2009.10.23 | |
| 1963 | 1963 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //uiMbType |
| 1964 | 1964 | uiMbType = uiCode; |
| 1965 | 1965 | if (uiMbType < 5) { //inter MB type |
| 1966 | 1966 | int16_t iMotionVector[LIST_A][30][MV_A]; |
| 1967 | 1967 | int8_t iRefIndex[LIST_A][30]; |
| 1968 | − pCurLayer->pMbType[iMbXy] = g_ksInterPMbTypeInfo[uiMbType].iType; | |
| 1969 | − WelsFillCacheInter (&sNeighAvail, pNonZeroCount, iMotionVector, iRefIndex, pCurLayer); | |
| 1968 | + pCurDqLayer->pDec->pMbType[iMbXy] = g_ksInterPMbTypeInfo[uiMbType].iType; | |
| 1969 | + WelsFillCacheInter (&sNeighAvail, pNonZeroCount, iMotionVector, iRefIndex, pCurDqLayer); | |
| 1970 | 1970 | |
| 1971 | 1971 | if ((iRet = ParseInterInfo (pCtx, iMotionVector, iRefIndex, pBs)) != ERR_NONE) { |
| 1972 | 1972 | return iRet;//abnormal |
| @@ -1974,13 +1974,13 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 1 unmodified line | ||
| 1974 | 1974 | |
| 1975 | 1975 | if (pSlice->sSliceHeaderExt.bAdaptiveResidualPredFlag == 1) { |
| 1976 | 1976 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //residual_prediction_flag |
| 1977 | − pCurLayer->pResidualPredFlag[iMbXy] = uiCode; | |
| 1977 | + pCurDqLayer->pResidualPredFlag[iMbXy] = uiCode; | |
| 1978 | 1978 | } else { |
| 1979 | − pCurLayer->pResidualPredFlag[iMbXy] = pSlice->sSliceHeaderExt.bDefaultResidualPredFlag; | |
| 1979 | + pCurDqLayer->pResidualPredFlag[iMbXy] = pSlice->sSliceHeaderExt.bDefaultResidualPredFlag; | |
| 1980 | 1980 | } |
| 1981 | 1981 | |
| 1982 | − if (pCurLayer->pResidualPredFlag[iMbXy] == 0) { | |
| 1983 | − pCurLayer->pInterPredictionDoneFlag[iMbXy] = 0; | |
| 1982 | + if (pCurDqLayer->pResidualPredFlag[iMbXy] == 0) { | |
| 1983 | + pCurDqLayer->pInterPredictionDoneFlag[iMbXy] = 0; | |
| 1984 | 1984 | } else { |
| 1985 | 1985 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "residual_pred_flag = 1 not supported."); |
| 1986 | 1986 | return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_UNSUPPORTED_ILP); |
| @@ -1994,15 +1994,15 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 7 unmodified lines | ||
| 1994 | 1994 | |
| 1995 | 1995 | if (25 == uiMbType) { |
| 1996 | 1996 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG, "I_PCM mode exists in P slice!"); |
| 1997 | − int32_t iDecStrideL = pCurLayer->pDec->iLinesize[0]; | |
| 1998 | − int32_t iDecStrideC = pCurLayer->pDec->iLinesize[1]; | |
| 1997 | + int32_t iDecStrideL = pCurDqLayer->pDec->iLinesize[0]; | |
| 1998 | + int32_t iDecStrideC = pCurDqLayer->pDec->iLinesize[1]; | |
| 1999 | 1999 | |
| 2000 | 2000 | int32_t iOffsetL = (iMbX + iMbY * iDecStrideL) << 4; |
| 2001 | 2001 | int32_t iOffsetC = (iMbX + iMbY * iDecStrideC) << 3; |
| 2002 | 2002 | |
| 2003 | − uint8_t* pDecY = pCurLayer->pDec->pData[0] + iOffsetL; | |
| 2004 | − uint8_t* pDecU = pCurLayer->pDec->pData[1] + iOffsetC; | |
| 2005 | − uint8_t* pDecV = pCurLayer->pDec->pData[2] + iOffsetC; | |
| 2003 | + uint8_t* pDecY = pCurDqLayer->pDec->pData[0] + iOffsetL; | |
| 2004 | + uint8_t* pDecU = pCurDqLayer->pDec->pData[1] + iOffsetC; | |
| 2005 | + uint8_t* pDecV = pCurDqLayer->pDec->pData[2] + iOffsetC; | |
| 2006 | 2006 | |
| 2007 | 2007 | uint8_t* pTmpBsBuf; |
| 2008 | 2008 | |
| @@ -2012,7 +2012,7 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 3 unmodified lines | ||
| 2012 | 2012 | |
| 2013 | 2013 | int32_t iIndex = ((-pBs->iLeftBits) >> 3) + 2; |
| 2014 | 2014 | |
| 2015 | − pCurLayer->pMbType[iMbXy] = MB_TYPE_INTRA_PCM; | |
| 2015 | + pCurDqLayer->pDec->pMbType[iMbXy] = MB_TYPE_INTRA_PCM; | |
| 2016 | 2016 | |
| 2017 | 2017 | //step 1: locating bit-stream pointer [must align into integer byte] |
| 2018 | 2018 | pBs->pCurBuf -= iIndex; |
| @@ -2041,8 +2041,8 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 22 unmodified lines | ||
| 2041 | 2041 | pBs->pCurBuf += 384; |
| 2042 | 2042 | |
| 2043 | 2043 | //step 3: update QP and pNonZeroCount |
| 2044 | − pCurLayer->pLumaQp[iMbXy] = 0; | |
| 2045 | − pCurLayer->pChromaQp[iMbXy][0] = pCurLayer->pChromaQp[iMbXy][1] = 0; | |
| 2044 | + pCurDqLayer->pLumaQp[iMbXy] = 0; | |
| 2045 | + pCurDqLayer->pChromaQp[iMbXy][0] = pCurDqLayer->pChromaQp[iMbXy][1] = 0; | |
| 2046 | 2046 | //Rec. 9.2.1 for PCM, nzc=16 |
| 2047 | 2047 | ST32A4 (&pNzc[0], 0x10101010); |
| 2048 | 2048 | ST32A4 (&pNzc[4], 0x10101010); |
| @@ -2055,38 +2055,38 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 6 unmodified lines | ||
| 2055 | 2055 | } else { |
| 2056 | 2056 | if (0 == uiMbType) { |
| 2057 | 2057 | ENFORCE_STACK_ALIGN_1D (int8_t, pIntraPredMode, 48, 16); |
| 2058 | − pCurLayer->pMbType[iMbXy] = MB_TYPE_INTRA4x4; | |
| 2058 | + pCurDqLayer->pDec->pMbType[iMbXy] = MB_TYPE_INTRA4x4; | |
| 2059 | 2059 | if (pCtx->pPps->bTransform8x8ModeFlag) { |
| 2060 | 2060 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //transform_size_8x8_flag |
| 2061 | − pCurLayer->pTransformSize8x8Flag[iMbXy] = !!uiCode; | |
| 2062 | − if (pCurLayer->pTransformSize8x8Flag[iMbXy]) { | |
| 2063 | − uiMbType = pCurLayer->pMbType[iMbXy] = MB_TYPE_INTRA8x8; | |
| 2061 | + pCurDqLayer->pTransformSize8x8Flag[iMbXy] = !!uiCode; | |
| 2062 | + if (pCurDqLayer->pTransformSize8x8Flag[iMbXy]) { | |
| 2063 | + uiMbType = pCurDqLayer->pDec->pMbType[iMbXy] = MB_TYPE_INTRA8x8; | |
| 2064 | 2064 | } |
| 2065 | 2065 | } |
| 2066 | − if (!pCurLayer->pTransformSize8x8Flag[iMbXy]) { | |
| 2067 | − pCtx->pFillInfoCacheIntraNxNFunc (&sNeighAvail, pNonZeroCount, pIntraPredMode, pCurLayer); | |
| 2068 | − WELS_READ_VERIFY (ParseIntra4x4Mode (pCtx, &sNeighAvail, pIntraPredMode, pBs, pCurLayer)); | |
| 2066 | + if (!pCurDqLayer->pTransformSize8x8Flag[iMbXy]) { | |
| 2067 | + pCtx->pFillInfoCacheIntraNxNFunc (&sNeighAvail, pNonZeroCount, pIntraPredMode, pCurDqLayer); | |
| 2068 | + WELS_READ_VERIFY (ParseIntra4x4Mode (pCtx, &sNeighAvail, pIntraPredMode, pBs, pCurDqLayer)); | |
| 2069 | 2069 | } else { |
| 2070 | − pCtx->pFillInfoCacheIntraNxNFunc (&sNeighAvail, pNonZeroCount, pIntraPredMode, pCurLayer); | |
| 2071 | − WELS_READ_VERIFY (ParseIntra8x8Mode (pCtx, &sNeighAvail, pIntraPredMode, pBs, pCurLayer)); | |
| 2070 | + pCtx->pFillInfoCacheIntraNxNFunc (&sNeighAvail, pNonZeroCount, pIntraPredMode, pCurDqLayer); | |
| 2071 | + WELS_READ_VERIFY (ParseIntra8x8Mode (pCtx, &sNeighAvail, pIntraPredMode, pBs, pCurDqLayer)); | |
| 2072 | 2072 | } |
| 2073 | 2073 | } else { //I_PCM exclude, we can ignore it |
| 2074 | − pCurLayer->pMbType[iMbXy] = MB_TYPE_INTRA16x16; | |
| 2075 | − pCurLayer->pTransformSize8x8Flag[iMbXy] = false; | |
| 2076 | − pCurLayer->pNoSubMbPartSizeLessThan8x8Flag[iMbXy] = true; | |
| 2077 | − pCurLayer->pIntraPredMode[iMbXy][7] = (uiMbType - 1) & 3; | |
| 2078 | − pCurLayer->pCbp[iMbXy] = g_kuiI16CbpTable[ (uiMbType - 1) >> 2]; | |
| 2079 | − uiCbpC = pCtx->pSps->uiChromaFormatIdc ? pCurLayer->pCbp[iMbXy] >> 4 : 0; | |
| 2080 | − uiCbpL = pCurLayer->pCbp[iMbXy] & 15; | |
| 2081 | − WelsFillCacheNonZeroCount (&sNeighAvail, pNonZeroCount, pCurLayer); | |
| 2082 | − if ((iRet = ParseIntra16x16Mode (pCtx, &sNeighAvail, pBs, pCurLayer)) != ERR_NONE) { | |
| 2074 | + pCurDqLayer->pDec->pMbType[iMbXy] = MB_TYPE_INTRA16x16; | |
| 2075 | + pCurDqLayer->pTransformSize8x8Flag[iMbXy] = false; | |
| 2076 | + pCurDqLayer->pNoSubMbPartSizeLessThan8x8Flag[iMbXy] = true; | |
| 2077 | + pCurDqLayer->pIntraPredMode[iMbXy][7] = (uiMbType - 1) & 3; | |
| 2078 | + pCurDqLayer->pCbp[iMbXy] = g_kuiI16CbpTable[ (uiMbType - 1) >> 2]; | |
| 2079 | + uiCbpC = pCtx->pSps->uiChromaFormatIdc ? pCurDqLayer->pCbp[iMbXy] >> 4 : 0; | |
| 2080 | + uiCbpL = pCurDqLayer->pCbp[iMbXy] & 15; | |
| 2081 | + WelsFillCacheNonZeroCount (&sNeighAvail, pNonZeroCount, pCurDqLayer); | |
| 2082 | + if ((iRet = ParseIntra16x16Mode (pCtx, &sNeighAvail, pBs, pCurDqLayer)) != ERR_NONE) { | |
| 2083 | 2083 | return iRet; |
| 2084 | 2084 | } |
| 2085 | 2085 | } |
| 2086 | 2086 | } |
| 2087 | 2087 | } |
| 2088 | 2088 | |
| 2089 | − if (MB_TYPE_INTRA16x16 != pCurLayer->pMbType[iMbXy]) { | |
| 2089 | + if (MB_TYPE_INTRA16x16 != pCurDqLayer->pDec->pMbType[iMbXy]) { | |
| 2090 | 2090 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //coded_block_pattern |
| 2091 | 2091 | uiCbp = uiCode; |
| 2092 | 2092 | { |
| @@ -2094,29 +2094,29 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 1 unmodified line | ||
| 2094 | 2094 | return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_CBP); |
| 2095 | 2095 | if (!pCtx->pSps->uiChromaFormatIdc && (uiCbp > 15)) |
| 2096 | 2096 | return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_CBP); |
| 2097 | − if (MB_TYPE_INTRA4x4 == pCurLayer->pMbType[iMbXy] || MB_TYPE_INTRA8x8 == pCurLayer->pMbType[iMbXy]) { | |
| 2097 | + if (MB_TYPE_INTRA4x4 == pCurDqLayer->pDec->pMbType[iMbXy] || MB_TYPE_INTRA8x8 == pCurDqLayer->pDec->pMbType[iMbXy]) { | |
| 2098 | 2098 | |
| 2099 | 2099 | uiCbp = pCtx->pSps->uiChromaFormatIdc ? g_kuiIntra4x4CbpTable[uiCbp] : g_kuiIntra4x4CbpTable400[uiCbp]; |
| 2100 | 2100 | } else //inter |
| 2101 | 2101 | uiCbp = pCtx->pSps->uiChromaFormatIdc ? g_kuiInterCbpTable[uiCbp] : g_kuiInterCbpTable400[uiCbp]; |
| 2102 | 2102 | } |
| 2103 | 2103 | |
| 2104 | − pCurLayer->pCbp[iMbXy] = uiCbp; | |
| 2105 | − uiCbpC = pCurLayer->pCbp[iMbXy] >> 4; | |
| 2106 | − uiCbpL = pCurLayer->pCbp[iMbXy] & 15; | |
| 2104 | + pCurDqLayer->pCbp[iMbXy] = uiCbp; | |
| 2105 | + uiCbpC = pCurDqLayer->pCbp[iMbXy] >> 4; | |
| 2106 | + uiCbpL = pCurDqLayer->pCbp[iMbXy] & 15; | |
| 2107 | 2107 | |
| 2108 | 2108 | // Need modification when B picutre add in |
| 2109 | 2109 | bool bNeedParseTransformSize8x8Flag = |
| 2110 | − (((pCurLayer->pMbType[iMbXy] >= MB_TYPE_16x16 && pCurLayer->pMbType[iMbXy] <= MB_TYPE_8x16) | |
| 2111 | − || pCurLayer->pNoSubMbPartSizeLessThan8x8Flag[iMbXy]) | |
| 2112 | − && (pCurLayer->pMbType[iMbXy] != MB_TYPE_INTRA8x8) | |
| 2113 | − && (pCurLayer->pMbType[iMbXy] != MB_TYPE_INTRA4x4) | |
| 2110 | + (((pCurDqLayer->pDec->pMbType[iMbXy] >= MB_TYPE_16x16 && pCurDqLayer->pDec->pMbType[iMbXy] <= MB_TYPE_8x16) | |
| 2111 | + || pCurDqLayer->pNoSubMbPartSizeLessThan8x8Flag[iMbXy]) | |
| 2112 | + && (pCurDqLayer->pDec->pMbType[iMbXy] != MB_TYPE_INTRA8x8) | |
| 2113 | + && (pCurDqLayer->pDec->pMbType[iMbXy] != MB_TYPE_INTRA4x4) | |
| 2114 | 2114 | && (uiCbpL > 0) |
| 2115 | 2115 | && (pCtx->pPps->bTransform8x8ModeFlag)); |
| 2116 | 2116 | |
| 2117 | 2117 | if (bNeedParseTransformSize8x8Flag) { |
| 2118 | 2118 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //transform_size_8x8_flag |
| 2119 | − pCurLayer->pTransformSize8x8Flag[iMbXy] = !!uiCode; | |
| 2119 | + pCurDqLayer->pTransformSize8x8Flag[iMbXy] = !!uiCode; | |
| 2120 | 2120 | } |
| 2121 | 2121 | } |
| 2122 | 2122 | |
| @@ -2126,17 +2126,17 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 3 unmodified lines | ||
| 2126 | 2126 | ST32A4 (&pNzc[12], 0); |
| 2127 | 2127 | ST32A4 (&pNzc[16], 0); |
| 2128 | 2128 | ST32A4 (&pNzc[20], 0); |
| 2129 | − if (pCurLayer->pCbp[iMbXy] == 0 && !IS_INTRA16x16 (pCurLayer->pMbType[iMbXy]) && !IS_I_BL (pCurLayer->pMbType[iMbXy])) { | |
| 2130 | − pCurLayer->pLumaQp[iMbXy] = pSlice->iLastMbQp; | |
| 2129 | + if (pCurDqLayer->pCbp[iMbXy] == 0 && !IS_INTRA16x16 (pCurDqLayer->pDec->pMbType[iMbXy]) && !IS_I_BL (pCurDqLayer->pDec->pMbType[iMbXy])) { | |
| 2130 | + pCurDqLayer->pLumaQp[iMbXy] = pSlice->iLastMbQp; | |
| 2131 | 2131 | for (i = 0; i < 2; i++) { |
| 2132 | − pCurLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 (pCurLayer->pLumaQp[iMbXy] + | |
| 2132 | + pCurDqLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 (pCurDqLayer->pLumaQp[iMbXy] + | |
| 2133 | 2133 | pSliceHeader->pPps->iChromaQpIndexOffset[i], 0, 51)]; |
| 2134 | 2134 | } |
| 2135 | 2135 | } |
| 2136 | 2136 | |
| 2137 | − if (pCurLayer->pCbp[iMbXy] || MB_TYPE_INTRA16x16 == pCurLayer->pMbType[iMbXy]) { | |
| 2137 | + if (pCurDqLayer->pCbp[iMbXy] || MB_TYPE_INTRA16x16 == pCurDqLayer->pDec->pMbType[iMbXy]) { | |
| 2138 | 2138 | int32_t iQpDelta, iId8x8, iId4x4; |
| 2139 | − memset (pCurLayer->pScaledTCoeff[iMbXy], 0, MB_COEFF_LIST_SIZE * sizeof (int16_t)); | |
| 2139 | + memset (pCurDqLayer->pScaledTCoeff[iMbXy], 0, MB_COEFF_LIST_SIZE * sizeof (int16_t)); | |
| 2140 | 2140 | WELS_READ_VERIFY (BsGetSe (pBs, &iCode)); //mb_qp_delta |
| 2141 | 2141 | iQpDelta = iCode; |
| 2142 | 2142 | |
| @@ -2144,28 +2144,28 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 1 unmodified line | ||
| 2144 | 2144 | return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_QP); |
| 2145 | 2145 | } |
| 2146 | 2146 | |
| 2147 | − pCurLayer->pLumaQp[iMbXy] = (pSlice->iLastMbQp + iQpDelta + 52) % 52; //update last_mb_qp | |
| 2148 | − pSlice->iLastMbQp = pCurLayer->pLumaQp[iMbXy]; | |
| 2147 | + pCurDqLayer->pLumaQp[iMbXy] = (pSlice->iLastMbQp + iQpDelta + 52) % 52; //update last_mb_qp | |
| 2148 | + pSlice->iLastMbQp = pCurDqLayer->pLumaQp[iMbXy]; | |
| 2149 | 2149 | for (i = 0; i < 2; i++) { |
| 2150 | − pCurLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 (pSlice->iLastMbQp + | |
| 2150 | + pCurDqLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 (pSlice->iLastMbQp + | |
| 2151 | 2151 | pSliceHeader->pPps->iChromaQpIndexOffset[i], 0, |
| 2152 | 2152 | 51)]; |
| 2153 | 2153 | } |
| 2154 | 2154 | |
| 2155 | 2155 | BsStartCavlc (pBs); |
| 2156 | 2156 | |
| 2157 | − if (MB_TYPE_INTRA16x16 == pCurLayer->pMbType[iMbXy]) { | |
| 2157 | + if (MB_TYPE_INTRA16x16 == pCurDqLayer->pDec->pMbType[iMbXy]) { | |
| 2158 | 2158 | //step1: Luma DC |
| 2159 | 2159 | if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, 0, 16, g_kuiLumaDcZigzagScan, I16_LUMA_DC, |
| 2160 | − pCurLayer->pScaledTCoeff[iMbXy], pCurLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) { | |
| 2160 | + pCurDqLayer->pScaledTCoeff[iMbXy], pCurDqLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) { | |
| 2161 | 2161 | return iRet;//abnormal |
| 2162 | 2162 | } |
| 2163 | 2163 | //step2: Luma AC |
| 2164 | 2164 | if (uiCbpL) { |
| 2165 | 2165 | for (i = 0; i < 16; i++) { |
| 2166 | 2166 | if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, i, iScanIdxEnd - WELS_MAX (iScanIdxStart, 1) + 1, |
| 2167 | − g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1), I16_LUMA_AC, pCurLayer->pScaledTCoeff[iMbXy] + (i << 4), | |
| 2168 | − pCurLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) { | |
| 2167 | + g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1), I16_LUMA_AC, pCurDqLayer->pScaledTCoeff[iMbXy] + (i << 4), | |
| 2168 | + pCurDqLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) { | |
| 2169 | 2169 | return iRet;//abnormal |
| 2170 | 2170 | } |
| 2171 | 2171 | } |
| @@ -2175,15 +2175,15 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 3 unmodified lines | ||
| 2175 | 2175 | ST32A4 (&pNzc[12], LD32 (&pNonZeroCount[1 + 8 * 4])); |
| 2176 | 2176 | } |
| 2177 | 2177 | } else { //non-MB_TYPE_INTRA16x16 |
| 2178 | − if (pCurLayer->pTransformSize8x8Flag[iMbXy]) { | |
| 2178 | + if (pCurDqLayer->pTransformSize8x8Flag[iMbXy]) { | |
| 2179 | 2179 | for (iId8x8 = 0; iId8x8 < 4; iId8x8++) { |
| 2180 | − iMbResProperty = (IS_INTRA (pCurLayer->pMbType[iMbXy])) ? LUMA_DC_AC_INTRA_8 : LUMA_DC_AC_INTER_8; | |
| 2180 | + iMbResProperty = (IS_INTRA (pCurDqLayer->pDec->pMbType[iMbXy])) ? LUMA_DC_AC_INTRA_8 : LUMA_DC_AC_INTER_8; | |
| 2181 | 2181 | if (uiCbpL & (1 << iId8x8)) { |
| 2182 | 2182 | int32_t iIndex = (iId8x8 << 2); |
| 2183 | 2183 | for (iId4x4 = 0; iId4x4 < 4; iId4x4++) { |
| 2184 | 2184 | if ((iRet = WelsResidualBlockCavlc8x8 (pVlcTable, pNonZeroCount, pBs, iIndex, iScanIdxEnd - iScanIdxStart + 1, |
| 2185 | − g_kuiZigzagScan8x8 + iScanIdxStart, iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + (iId8x8 << 6), iId4x4, | |
| 2186 | − pCurLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) { | |
| 2185 | + g_kuiZigzagScan8x8 + iScanIdxStart, iMbResProperty, pCurDqLayer->pScaledTCoeff[iMbXy] + (iId8x8 << 6), iId4x4, | |
| 2186 | + pCurDqLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) { | |
| 2187 | 2187 | return iRet; |
| 2188 | 2188 | } |
| 2189 | 2189 | iIndex++; |
| @@ -2199,14 +2199,14 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 9 unmodified lines | ||
| 2199 | 2199 | ST32A4 (&pNzc[12], LD32 (&pNonZeroCount[1 + 8 * 4])); |
| 2200 | 2200 | } else { // Normal T4x4 |
| 2201 | 2201 | for (iId8x8 = 0; iId8x8 < 4; iId8x8++) { |
| 2202 | − iMbResProperty = (IS_INTRA (pCurLayer->pMbType[iMbXy])) ? LUMA_DC_AC_INTRA : LUMA_DC_AC_INTER; | |
| 2202 | + iMbResProperty = (IS_INTRA (pCurDqLayer->pDec->pMbType[iMbXy])) ? LUMA_DC_AC_INTRA : LUMA_DC_AC_INTER; | |
| 2203 | 2203 | if (uiCbpL & (1 << iId8x8)) { |
| 2204 | 2204 | int32_t iIndex = (iId8x8 << 2); |
| 2205 | 2205 | for (iId4x4 = 0; iId4x4 < 4; iId4x4++) { |
| 2206 | 2206 | //Luma (DC and AC decoding together) |
| 2207 | 2207 | if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex, iScanIdxEnd - iScanIdxStart + 1, |
| 2208 | − g_kuiZigzagScan + iScanIdxStart, iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), | |
| 2209 | − pCurLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) { | |
| 2208 | + g_kuiZigzagScan + iScanIdxStart, iMbResProperty, pCurDqLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), | |
| 2209 | + pCurDqLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) { | |
| 2210 | 2210 | return iRet;//abnormal |
| 2211 | 2211 | } |
| 2212 | 2212 | iIndex++; |
| @@ -2228,13 +2228,13 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 15 unmodified lines | ||
| 2228 | 2228 | //step1: DC |
| 2229 | 2229 | if (1 == uiCbpC || 2 == uiCbpC) { |
| 2230 | 2230 | for (i = 0; i < 2; i++) { //Cb Cr |
| 2231 | − if (IS_INTRA (pCurLayer->pMbType[iMbXy])) | |
| 2231 | + if (IS_INTRA (pCurDqLayer->pDec->pMbType[iMbXy])) | |
| 2232 | 2232 | iMbResProperty = i ? CHROMA_DC_V : CHROMA_DC_U; |
| 2233 | 2233 | else |
| 2234 | 2234 | iMbResProperty = i ? CHROMA_DC_V_INTER : CHROMA_DC_U_INTER; |
| 2235 | 2235 | |
| 2236 | 2236 | if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, 16 + (i << 2), 4, g_kuiChromaDcScan, iMbResProperty, |
| 2237 | − pCurLayer->pScaledTCoeff[iMbXy] + 256 + (i << 6), pCurLayer->pChromaQp[iMbXy][i], pCtx)) != ERR_NONE) { | |
| 2237 | + pCurDqLayer->pScaledTCoeff[iMbXy] + 256 + (i << 6), pCurDqLayer->pChromaQp[iMbXy][i], pCtx)) != ERR_NONE) { | |
| 2238 | 2238 | return iRet;//abnormal |
| 2239 | 2239 | } |
| 2240 | 2240 | } |
| @@ -2243,7 +2243,7 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 2 unmodified lines | ||
| 2243 | 2243 | //step2: AC |
| 2244 | 2244 | if (2 == uiCbpC) { |
| 2245 | 2245 | for (i = 0; i < 2; i++) { //Cb Cr |
| 2246 | − if (IS_INTRA (pCurLayer->pMbType[iMbXy])) | |
| 2246 | + if (IS_INTRA (pCurDqLayer->pDec->pMbType[iMbXy])) | |
| 2247 | 2247 | iMbResProperty = i ? CHROMA_AC_V : CHROMA_AC_U; |
| 2248 | 2248 | else |
| 2249 | 2249 | iMbResProperty = i ? CHROMA_AC_V_INTER : CHROMA_AC_U_INTER; |
| @@ -2251,8 +2251,8 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 1 unmodified line | ||
| 2251 | 2251 | int32_t iIndex = 16 + (i << 2); |
| 2252 | 2252 | for (iId4x4 = 0; iId4x4 < 4; iId4x4++) { |
| 2253 | 2253 | if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex, iScanIdxEnd - WELS_MAX (iScanIdxStart, |
| 2254 | − 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1), iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), | |
| 2255 | − pCurLayer->pChromaQp[iMbXy][i], pCtx)) != ERR_NONE) { | |
| 2254 | + 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1), iMbResProperty, pCurDqLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), | |
| 2255 | + pCurDqLayer->pChromaQp[iMbXy][i], pCtx)) != ERR_NONE) { | |
| 2256 | 2256 | return iRet;//abnormal |
| 2257 | 2257 | } |
| 2258 | 2258 | iIndex++; |
| @@ -2270,20 +2270,20 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { · 11 unmodified lines | ||
| 2270 | 2270 | } |
| 2271 | 2271 | |
| 2272 | 2272 | int32_t WelsDecodeMbCavlcPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uint32_t& uiEosFlag) { |
| 2273 | − PDqLayer pCurLayer = pCtx->pCurDqLayer; | |
| 2274 | − PBitStringAux pBs = pCurLayer->pBitStringAux; | |
| 2275 | − PSlice pSlice = &pCurLayer->sLayerInfo.sSliceInLayer; | |
| 2273 | + PDqLayer pCurDqLayer = pCtx->pCurDqLayer; | |
| 2274 | + PBitStringAux pBs = pCurDqLayer->pBitStringAux; | |
| 2275 | + PSlice pSlice = &pCurDqLayer->sLayerInfo.sSliceInLayer; | |
| 2276 | 2276 | PSliceHeader pSliceHeader = &pSlice->sSliceHeaderExt.sSliceHeader; |
| 2277 | 2277 | PPicture* ppRefPic = pCtx->sRefPic.pRefList[LIST_0]; |
| 2278 | 2278 | intX_t iUsedBits; |
| 2279 | − const int32_t iMbXy = pCurLayer->iMbXyIndex; | |
| 2280 | − int8_t* pNzc = pCurLayer->pNzc[iMbXy]; | |
| 2279 | + const int32_t iMbXy = pCurDqLayer->iMbXyIndex; | |
| 2280 | + int8_t* pNzc = pCurDqLayer->pNzc[iMbXy]; | |
| 2281 | 2281 | int32_t iBaseModeFlag, i; |
| 2282 | 2282 | int32_t iRet = 0; //should have the return value to indicate decoding error or not, It's NECESSARY--2010.4.15 |
| 2283 | 2283 | uint32_t uiCode; |
| 2284 | 2284 | |
| 2285 | − pCurLayer->pNoSubMbPartSizeLessThan8x8Flag[iMbXy] = true; | |
| 2286 | − pCurLayer->pTransformSize8x8Flag[iMbXy] = false; | |
| 2285 | + pCurDqLayer->pNoSubMbPartSizeLessThan8x8Flag[iMbXy] = true; | |
| 2286 | + pCurDqLayer->pTransformSize8x8Flag[iMbXy] = false; | |
| 2287 | 2287 | |
| 2288 | 2288 | if (-1 == pSlice->iMbSkipRun) { |
| 2289 | 2289 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //mb_skip_run |
| @@ -2295,7 +2295,7 @@ int32_t WelsDecodeMbCavlcPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 5 unmodified lines | ||
| 2295 | 2295 | if (pSlice->iMbSkipRun--) { |
| 2296 | 2296 | int16_t iMv[2]; |
| 2297 | 2297 | |
| 2298 | − pCurLayer->pMbType[iMbXy] = MB_TYPE_SKIP; | |
| 2298 | + pCurDqLayer->pDec->pMbType[iMbXy] = MB_TYPE_SKIP; | |
| 2299 | 2299 | ST32A4 (&pNzc[0], 0); |
| 2300 | 2300 | ST32A4 (&pNzc[4], 0); |
| 2301 | 2301 | ST32A4 (&pNzc[8], 0); |
| @@ -2303,30 +2303,30 @@ int32_t WelsDecodeMbCavlcPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 1 unmodified line | ||
| 2303 | 2303 | ST32A4 (&pNzc[16], 0); |
| 2304 | 2304 | ST32A4 (&pNzc[20], 0); |
| 2305 | 2305 | |
| 2306 | − pCurLayer->pInterPredictionDoneFlag[iMbXy] = 0; | |
| 2307 | − memset (pCurLayer->pRefIndex[0][iMbXy], 0, sizeof (int8_t) * 16); | |
| 2306 | + pCurDqLayer->pInterPredictionDoneFlag[iMbXy] = 0; | |
| 2307 | + memset (pCurDqLayer->pDec->pRefIndex[0][iMbXy], 0, sizeof (int8_t) * 16); | |
| 2308 | 2308 | pCtx->bMbRefConcealed = pCtx->bRPLRError || pCtx->bMbRefConcealed || ! (ppRefPic[0] && ppRefPic[0]->bIsComplete); |
| 2309 | 2309 | //predict iMv |
| 2310 | − PredPSkipMvFromNeighbor (pCurLayer, iMv); | |
| 2310 | + PredPSkipMvFromNeighbor (pCurDqLayer, iMv); | |
| 2311 | 2311 | for (i = 0; i < 16; i++) { |
| 2312 | − ST32A2 (pCurLayer->pMv[0][iMbXy][i], * (uint32_t*)iMv); | |
| 2312 | + ST32A2 (pCurDqLayer->pDec->pMv[0][iMbXy][i], * (uint32_t*)iMv); | |
| 2313 | 2313 | } |
| 2314 | 2314 | |
| 2315 | 2315 | //if (!pSlice->sSliceHeaderExt.bDefaultResidualPredFlag) { |
| 2316 | − // memset (pCurLayer->pScaledTCoeff[iMbXy], 0, 384 * sizeof (int16_t)); | |
| 2316 | + // memset (pCurDqLayer->pScaledTCoeff[iMbXy], 0, 384 * sizeof (int16_t)); | |
| 2317 | 2317 | //} |
| 2318 | 2318 | |
| 2319 | 2319 | //reset rS |
| 2320 | 2320 | if (!pSlice->sSliceHeaderExt.bDefaultResidualPredFlag || |
| 2321 | 2321 | (pNalCur->sNalHeaderExt.uiQualityId == 0 && pNalCur->sNalHeaderExt.uiDependencyId == 0)) { |
| 2322 | − pCurLayer->pLumaQp[iMbXy] = pSlice->iLastMbQp; | |
| 2322 | + pCurDqLayer->pLumaQp[iMbXy] = pSlice->iLastMbQp; | |
| 2323 | 2323 | for (i = 0; i < 2; i++) { |
| 2324 | − pCurLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 (pCurLayer->pLumaQp[iMbXy] + | |
| 2324 | + pCurDqLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 (pCurDqLayer->pLumaQp[iMbXy] + | |
| 2325 | 2325 | pSliceHeader->pPps->iChromaQpIndexOffset[i], 0, 51)]; |
| 2326 | 2326 | } |
| 2327 | 2327 | } |
| 2328 | 2328 | |
| 2329 | − pCurLayer->pCbp[iMbXy] = 0; | |
| 2329 | + pCurDqLayer->pCbp[iMbXy] = 0; | |
| 2330 | 2330 | } else { |
| 2331 | 2331 | if (pSlice->sSliceHeaderExt.bAdaptiveBaseModeFlag == 1) { |
| 2332 | 2332 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //base_mode_flag |
| @@ -2348,7 +2348,7 @@ int32_t WelsDecodeMbCavlcPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 15 unmodified lines | ||
| 2348 | 2348 | // check whether there is left bits to read next time in case multiple slices |
| 2349 | 2349 | iUsedBits = ((pBs->pCurBuf - pBs->pStartBuf) << 3) - (16 - pBs->iLeftBits); |
| 2350 | 2350 | // sub 1, for stop bit |
| 2351 | − if ((iUsedBits == (pBs->iBits - 1)) && (0 >= pCurLayer->sLayerInfo.sSliceInLayer.iMbSkipRun)) { // slice boundary | |
| 2351 | + if ((iUsedBits == (pBs->iBits - 1)) && (0 >= pCurDqLayer->sLayerInfo.sSliceInLayer.iMbSkipRun)) { // slice boundary | |
| 2352 | 2352 | uiEosFlag = 1; |
| 2353 | 2353 | } |
| 2354 | 2354 | if (iUsedBits > (pBs->iBits - |
| @@ -2362,21 +2362,21 @@ int32_t WelsDecodeMbCavlcPSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 7 unmodified lines | ||
| 2362 | 2362 | } |
| 2363 | 2363 | |
| 2364 | 2364 | int32_t WelsDecodeMbCavlcBSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uint32_t& uiEosFlag) { |
| 2365 | − PDqLayer pCurLayer = pCtx->pCurDqLayer; | |
| 2366 | − PBitStringAux pBs = pCurLayer->pBitStringAux; | |
| 2367 | − PSlice pSlice = &pCurLayer->sLayerInfo.sSliceInLayer; | |
| 2365 | + PDqLayer pCurDqLayer = pCtx->pCurDqLayer; | |
| 2366 | + PBitStringAux pBs = pCurDqLayer->pBitStringAux; | |
| 2367 | + PSlice pSlice = &pCurDqLayer->sLayerInfo.sSliceInLayer; | |
| 2368 | 2368 | PSliceHeader pSliceHeader = &pSlice->sSliceHeaderExt.sSliceHeader; |
| 2369 | 2369 | PPicture* ppRefPicL0 = pCtx->sRefPic.pRefList[LIST_0]; |
| 2370 | 2370 | PPicture* ppRefPicL1 = pCtx->sRefPic.pRefList[LIST_1]; |
| 2371 | 2371 | intX_t iUsedBits; |
| 2372 | − const int32_t iMbXy = pCurLayer->iMbXyIndex; | |
| 2373 | − int8_t* pNzc = pCurLayer->pNzc[iMbXy]; | |
| 2372 | + const int32_t iMbXy = pCurDqLayer->iMbXyIndex; | |
| 2373 | + int8_t* pNzc = pCurDqLayer->pNzc[iMbXy]; | |
| 2374 | 2374 | int32_t iBaseModeFlag, i; |
| 2375 | 2375 | int32_t iRet = 0; //should have the return value to indicate decoding error or not, It's NECESSARY--2010.4.15 |
| 2376 | 2376 | uint32_t uiCode; |
| 2377 | 2377 | |
| 2378 | − pCurLayer->pNoSubMbPartSizeLessThan8x8Flag[iMbXy] = true; | |
| 2379 | − pCurLayer->pTransformSize8x8Flag[iMbXy] = false; | |
| 2378 | + pCurDqLayer->pNoSubMbPartSizeLessThan8x8Flag[iMbXy] = true; | |
| 2379 | + pCurDqLayer->pTransformSize8x8Flag[iMbXy] = false; | |
| 2380 | 2380 | |
| 2381 | 2381 | if (-1 == pSlice->iMbSkipRun) { |
| 2382 | 2382 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //mb_skip_run |
| @@ -2389,7 +2389,7 @@ int32_t WelsDecodeMbCavlcBSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 6 unmodified lines | ||
| 2389 | 2389 | int16_t iMv[LIST_A][2] = { { 0, 0 }, { 0, 0 } }; |
| 2390 | 2390 | int8_t ref[LIST_A] = { 0 }; |
| 2391 | 2391 | |
| 2392 | − pCurLayer->pMbType[iMbXy] = MB_TYPE_SKIP | MB_TYPE_DIRECT; | |
| 2392 | + pCurDqLayer->pDec->pMbType[iMbXy] = MB_TYPE_SKIP | MB_TYPE_DIRECT; | |
| 2393 | 2393 | ST32A4 (&pNzc[0], 0); |
| 2394 | 2394 | ST32A4 (&pNzc[4], 0); |
| 2395 | 2395 | ST32A4 (&pNzc[8], 0); |
| @@ -2397,9 +2397,9 @@ int32_t WelsDecodeMbCavlcBSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 1 unmodified line | ||
| 2397 | 2397 | ST32A4 (&pNzc[16], 0); |
| 2398 | 2398 | ST32A4 (&pNzc[20], 0); |
| 2399 | 2399 | |
| 2400 | − pCurLayer->pInterPredictionDoneFlag[iMbXy] = 0; | |
| 2401 | − memset (pCurLayer->pRefIndex[LIST_0][iMbXy], 0, sizeof (int8_t) * 16); | |
| 2402 | − memset (pCurLayer->pRefIndex[LIST_1][iMbXy], 0, sizeof (int8_t) * 16); | |
| 2400 | + pCurDqLayer->pInterPredictionDoneFlag[iMbXy] = 0; | |
| 2401 | + memset (pCurDqLayer->pDec->pRefIndex[LIST_0][iMbXy], 0, sizeof (int8_t) * 16); | |
| 2402 | + memset (pCurDqLayer->pDec->pRefIndex[LIST_1][iMbXy], 0, sizeof (int8_t) * 16); | |
| 2403 | 2403 | pCtx->bMbRefConcealed = pCtx->bRPLRError || pCtx->bMbRefConcealed || ! (ppRefPicL0[0] && ppRefPicL0[0]->bIsComplete) |
| 2404 | 2404 | || ! (ppRefPicL1[0] && ppRefPicL1[0]->bIsComplete); |
| 2405 | 2405 | |
| @@ -2426,20 +2426,20 @@ int32_t WelsDecodeMbCavlcBSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 20 unmodified lines | ||
| 2426 | 2426 | } |
| 2427 | 2427 | |
| 2428 | 2428 | //if (!pSlice->sSliceHeaderExt.bDefaultResidualPredFlag) { |
| 2429 | − // memset (pCurLayer->pScaledTCoeff[iMbXy], 0, 384 * sizeof (int16_t)); | |
| 2429 | + // memset (pCurDqLayer->pScaledTCoeff[iMbXy], 0, 384 * sizeof (int16_t)); | |
| 2430 | 2430 | //} |
| 2431 | 2431 | |
| 2432 | 2432 | //reset rS |
| 2433 | 2433 | if (!pSlice->sSliceHeaderExt.bDefaultResidualPredFlag || |
| 2434 | 2434 | (pNalCur->sNalHeaderExt.uiQualityId == 0 && pNalCur->sNalHeaderExt.uiDependencyId == 0)) { |
| 2435 | − pCurLayer->pLumaQp[iMbXy] = pSlice->iLastMbQp; | |
| 2435 | + pCurDqLayer->pLumaQp[iMbXy] = pSlice->iLastMbQp; | |
| 2436 | 2436 | for (i = 0; i < 2; i++) { |
| 2437 | − pCurLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 (pCurLayer->pLumaQp[iMbXy] + | |
| 2437 | + pCurDqLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 (pCurDqLayer->pLumaQp[iMbXy] + | |
| 2438 | 2438 | pSliceHeader->pPps->iChromaQpIndexOffset[i], 0, 51)]; |
| 2439 | 2439 | } |
| 2440 | 2440 | } |
| 2441 | 2441 | |
| 2442 | − pCurLayer->pCbp[iMbXy] = 0; | |
| 2442 | + pCurDqLayer->pCbp[iMbXy] = 0; | |
| 2443 | 2443 | } else { |
| 2444 | 2444 | if (pSlice->sSliceHeaderExt.bAdaptiveBaseModeFlag == 1) { |
| 2445 | 2445 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //base_mode_flag |
| @@ -2461,7 +2461,7 @@ int32_t WelsDecodeMbCavlcBSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 15 unmodified lines | ||
| 2461 | 2461 | // check whether there is left bits to read next time in case multiple slices |
| 2462 | 2462 | iUsedBits = ((pBs->pCurBuf - pBs->pStartBuf) << 3) - (16 - pBs->iLeftBits); |
| 2463 | 2463 | // sub 1, for stop bit |
| 2464 | − if ((iUsedBits == (pBs->iBits - 1)) && (0 >= pCurLayer->sLayerInfo.sSliceInLayer.iMbSkipRun)) { // slice boundary | |
| 2464 | + if ((iUsedBits == (pBs->iBits - 1)) && (0 >= pCurDqLayer->sLayerInfo.sSliceInLayer.iMbSkipRun)) { // slice boundary | |
| 2465 | 2465 | uiEosFlag = 1; |
| 2466 | 2466 | } |
| 2467 | 2467 | if (iUsedBits > (pBs->iBits - |
| @@ -2475,20 +2475,20 @@ int32_t WelsDecodeMbCavlcBSlice (PWelsDecoderContext pCtx, PNalUnit pNalCur, uin · 7 unmodified lines | ||
| 2475 | 2475 | } |
| 2476 | 2476 | |
| 2477 | 2477 | int32_t WelsActualDecodeMbCavlcBSlice (PWelsDecoderContext pCtx) { |
| 2478 | − SVlcTable* pVlcTable = &pCtx->sVlcTable; | |
| 2479 | − PDqLayer pCurLayer = pCtx->pCurDqLayer; | |
| 2480 | − PBitStringAux pBs = pCurLayer->pBitStringAux; | |
| 2481 | − PSlice pSlice = &pCurLayer->sLayerInfo.sSliceInLayer; | |
| 2478 | + SVlcTable* pVlcTable = pCtx->pVlcTable; | |
| 2479 | + PDqLayer pCurDqLayer = pCtx->pCurDqLayer; | |
| 2480 | + PBitStringAux pBs = pCurDqLayer->pBitStringAux; | |
| 2481 | + PSlice pSlice = &pCurDqLayer->sLayerInfo.sSliceInLayer; | |
| 2482 | 2482 | PSliceHeader pSliceHeader = &pSlice->sSliceHeaderExt.sSliceHeader; |
| 2483 | 2483 | |
| 2484 | 2484 | int32_t iScanIdxStart = pSlice->sSliceHeaderExt.uiScanIdxStart; |
| 2485 | 2485 | int32_t iScanIdxEnd = pSlice->sSliceHeaderExt.uiScanIdxEnd; |
| 2486 | 2486 | |
| 2487 | 2487 | SWelsNeighAvail sNeighAvail; |
| 2488 | − int32_t iMbX = pCurLayer->iMbX; | |
| 2489 | − int32_t iMbY = pCurLayer->iMbY; | |
| 2490 | − const int32_t iMbXy = pCurLayer->iMbXyIndex; | |
| 2491 | − int8_t* pNzc = pCurLayer->pNzc[iMbXy]; | |
| 2488 | + int32_t iMbX = pCurDqLayer->iMbX; | |
| 2489 | + int32_t iMbY = pCurDqLayer->iMbY; | |
| 2490 | + const int32_t iMbXy = pCurDqLayer->iMbXyIndex; | |
| 2491 | + int8_t* pNzc = pCurDqLayer->pNzc[iMbXy]; | |
| 2492 | 2492 | int32_t i; |
| 2493 | 2493 | int32_t iRet = ERR_NONE; |
| 2494 | 2494 | uint32_t uiMbType = 0, uiCbp = 0, uiCbpL = 0, uiCbpC = 0; |
| @@ -2496,16 +2496,16 @@ int32_t WelsActualDecodeMbCavlcBSlice (PWelsDecoderContext pCtx) { · 1 unmodified line | ||
| 2496 | 2496 | int32_t iCode; |
| 2497 | 2497 | int32_t iMbResProperty; |
| 2498 | 2498 | |
| 2499 | − GetNeighborAvailMbType (&sNeighAvail, pCurLayer); | |
| 2499 | + GetNeighborAvailMbType (&sNeighAvail, pCurDqLayer); | |
| 2500 | 2500 | ENFORCE_STACK_ALIGN_1D (uint8_t, pNonZeroCount, 48, 16); |
| 2501 | − pCurLayer->pInterPredictionDoneFlag[iMbXy] = 0;//2009.10.23 | |
| 2501 | + pCurDqLayer->pInterPredictionDoneFlag[iMbXy] = 0;//2009.10.23 | |
| 2502 | 2502 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //uiMbType |
| 2503 | 2503 | uiMbType = uiCode; |
| 2504 | 2504 | if (uiMbType < 23) { //inter MB type |
| 2505 | 2505 | int16_t iMotionVector[LIST_A][30][MV_A]; |
| 2506 | 2506 | int8_t iRefIndex[LIST_A][30]; |
| 2507 | − pCurLayer->pMbType[iMbXy] = g_ksInterBMbTypeInfo[uiMbType].iType; | |
| 2508 | − WelsFillCacheInter (&sNeighAvail, pNonZeroCount, iMotionVector, iRefIndex, pCurLayer); | |
| 2507 | + pCurDqLayer->pDec->pMbType[iMbXy] = g_ksInterBMbTypeInfo[uiMbType].iType; | |
| 2508 | + WelsFillCacheInter (&sNeighAvail, pNonZeroCount, iMotionVector, iRefIndex, pCurDqLayer); | |
| 2509 | 2509 | |
| 2510 | 2510 | if ((iRet = ParseInterBInfo (pCtx, iMotionVector, iRefIndex, pBs)) != ERR_NONE) { |
| 2511 | 2511 | return iRet;//abnormal |
| @@ -2513,13 +2513,13 @@ int32_t WelsActualDecodeMbCavlcBSlice (PWelsDecoderContext pCtx) { · 1 unmodified line | ||
| 2513 | 2513 | |
| 2514 | 2514 | if (pSlice->sSliceHeaderExt.bAdaptiveResidualPredFlag == 1) { |
| 2515 | 2515 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //residual_prediction_flag |
| 2516 | − pCurLayer->pResidualPredFlag[iMbXy] = uiCode; | |
| 2516 | + pCurDqLayer->pResidualPredFlag[iMbXy] = uiCode; | |
| 2517 | 2517 | } else { |
| 2518 | − pCurLayer->pResidualPredFlag[iMbXy] = pSlice->sSliceHeaderExt.bDefaultResidualPredFlag; | |
| 2518 | + pCurDqLayer->pResidualPredFlag[iMbXy] = pSlice->sSliceHeaderExt.bDefaultResidualPredFlag; | |
| 2519 | 2519 | } |
| 2520 | 2520 | |
| 2521 | − if (pCurLayer->pResidualPredFlag[iMbXy] == 0) { | |
| 2522 | − pCurLayer->pInterPredictionDoneFlag[iMbXy] = 0; | |
| 2521 | + if (pCurDqLayer->pResidualPredFlag[iMbXy] == 0) { | |
| 2522 | + pCurDqLayer->pInterPredictionDoneFlag[iMbXy] = 0; | |
| 2523 | 2523 | } else { |
| 2524 | 2524 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "residual_pred_flag = 1 not supported."); |
| 2525 | 2525 | return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_UNSUPPORTED_ILP); |
| @@ -2533,15 +2533,15 @@ int32_t WelsActualDecodeMbCavlcBSlice (PWelsDecoderContext pCtx) { · 7 unmodified lines | ||
| 2533 | 2533 | |
| 2534 | 2534 | if (25 == uiMbType) { |
| 2535 | 2535 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG, "I_PCM mode exists in B slice!"); |
| 2536 | − int32_t iDecStrideL = pCurLayer->pDec->iLinesize[0]; | |
| 2537 | − int32_t iDecStrideC = pCurLayer->pDec->iLinesize[1]; | |
| 2536 | + int32_t iDecStrideL = pCurDqLayer->pDec->iLinesize[0]; | |
| 2537 | + int32_t iDecStrideC = pCurDqLayer->pDec->iLinesize[1]; | |
| 2538 | 2538 | |
| 2539 | 2539 | int32_t iOffsetL = (iMbX + iMbY * iDecStrideL) << 4; |
| 2540 | 2540 | int32_t iOffsetC = (iMbX + iMbY * iDecStrideC) << 3; |
| 2541 | 2541 | |
| 2542 | − uint8_t* pDecY = pCurLayer->pDec->pData[0] + iOffsetL; | |
| 2543 | − uint8_t* pDecU = pCurLayer->pDec->pData[1] + iOffsetC; | |
| 2544 | − uint8_t* pDecV = pCurLayer->pDec->pData[2] + iOffsetC; | |
| 2542 | + uint8_t* pDecY = pCurDqLayer->pDec->pData[0] + iOffsetL; | |
| 2543 | + uint8_t* pDecU = pCurDqLayer->pDec->pData[1] + iOffsetC; | |
| 2544 | + uint8_t* pDecV = pCurDqLayer->pDec->pData[2] + iOffsetC; | |
| 2545 | 2545 | |
| 2546 | 2546 | uint8_t* pTmpBsBuf; |
| 2547 | 2547 | |
| @@ -2551,7 +2551,7 @@ int32_t WelsActualDecodeMbCavlcBSlice (PWelsDecoderContext pCtx) { · 3 unmodified lines | ||
| 2551 | 2551 | |
| 2552 | 2552 | int32_t iIndex = ((-pBs->iLeftBits) >> 3) + 2; |
| 2553 | 2553 | |
| 2554 | − pCurLayer->pMbType[iMbXy] = MB_TYPE_INTRA_PCM; | |
| 2554 | + pCurDqLayer->pDec->pMbType[iMbXy] = MB_TYPE_INTRA_PCM; | |
| 2555 | 2555 | |
| 2556 | 2556 | //step 1: locating bit-stream pointer [must align into integer byte] |
| 2557 | 2557 | pBs->pCurBuf -= iIndex; |
| @@ -2580,8 +2580,8 @@ int32_t WelsActualDecodeMbCavlcBSlice (PWelsDecoderContext pCtx) { · 22 unmodified lines | ||
| 2580 | 2580 | pBs->pCurBuf += 384; |
| 2581 | 2581 | |
| 2582 | 2582 | //step 3: update QP and pNonZeroCount |
| 2583 | − pCurLayer->pLumaQp[iMbXy] = 0; | |
| 2584 | − pCurLayer->pChromaQp[iMbXy][0] = pCurLayer->pChromaQp[iMbXy][1] = 0; | |
| 2583 | + pCurDqLayer->pLumaQp[iMbXy] = 0; | |
| 2584 | + pCurDqLayer->pChromaQp[iMbXy][0] = pCurDqLayer->pChromaQp[iMbXy][1] = 0; | |
| 2585 | 2585 | //Rec. 9.2.1 for PCM, nzc=16 |
| 2586 | 2586 | ST32A4 (&pNzc[0], 0x10101010); |
| 2587 | 2587 | ST32A4 (&pNzc[4], 0x10101010); |
| @@ -2594,38 +2594,38 @@ int32_t WelsActualDecodeMbCavlcBSlice (PWelsDecoderContext pCtx) { · 6 unmodified lines | ||
| 2594 | 2594 | } else { |
| 2595 | 2595 | if (0 == uiMbType) { |
| 2596 | 2596 | ENFORCE_STACK_ALIGN_1D (int8_t, pIntraPredMode, 48, 16); |
| 2597 | − pCurLayer->pMbType[iMbXy] = MB_TYPE_INTRA4x4; | |
| 2597 | + pCurDqLayer->pDec->pMbType[iMbXy] = MB_TYPE_INTRA4x4; | |
| 2598 | 2598 | if (pCtx->pPps->bTransform8x8ModeFlag) { |
| 2599 | 2599 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //transform_size_8x8_flag |
| 2600 | − pCurLayer->pTransformSize8x8Flag[iMbXy] = !!uiCode; | |
| 2601 | − if (pCurLayer->pTransformSize8x8Flag[iMbXy]) { | |
| 2602 | − uiMbType = pCurLayer->pMbType[iMbXy] = MB_TYPE_INTRA8x8; | |
| 2600 | + pCurDqLayer->pTransformSize8x8Flag[iMbXy] = !!uiCode; | |
| 2601 | + if (pCurDqLayer->pTransformSize8x8Flag[iMbXy]) { | |
| 2602 | + uiMbType = pCurDqLayer->pDec->pMbType[iMbXy] = MB_TYPE_INTRA8x8; | |
| 2603 | 2603 | } |
| 2604 | 2604 | } |
| 2605 | − if (!pCurLayer->pTransformSize8x8Flag[iMbXy]) { | |
| 2606 | − pCtx->pFillInfoCacheIntraNxNFunc (&sNeighAvail, pNonZeroCount, pIntraPredMode, pCurLayer); | |
| 2607 | − WELS_READ_VERIFY (ParseIntra4x4Mode (pCtx, &sNeighAvail, pIntraPredMode, pBs, pCurLayer)); | |
| 2605 | + if (!pCurDqLayer->pTransformSize8x8Flag[iMbXy]) { | |
| 2606 | + pCtx->pFillInfoCacheIntraNxNFunc (&sNeighAvail, pNonZeroCount, pIntraPredMode, pCurDqLayer); | |
| 2607 | + WELS_READ_VERIFY (ParseIntra4x4Mode (pCtx, &sNeighAvail, pIntraPredMode, pBs, pCurDqLayer)); | |
| 2608 | 2608 | } else { |
| 2609 | − pCtx->pFillInfoCacheIntraNxNFunc (&sNeighAvail, pNonZeroCount, pIntraPredMode, pCurLayer); | |
| 2610 | − WELS_READ_VERIFY (ParseIntra8x8Mode (pCtx, &sNeighAvail, pIntraPredMode, pBs, pCurLayer)); | |
| 2609 | + pCtx->pFillInfoCacheIntraNxNFunc (&sNeighAvail, pNonZeroCount, pIntraPredMode, pCurDqLayer); | |
| 2610 | + WELS_READ_VERIFY (ParseIntra8x8Mode (pCtx, &sNeighAvail, pIntraPredMode, pBs, pCurDqLayer)); | |
| 2611 | 2611 | } |
| 2612 | 2612 | } else { //I_PCM exclude, we can ignore it |
| 2613 | − pCurLayer->pMbType[iMbXy] = MB_TYPE_INTRA16x16; | |
| 2614 | − pCurLayer->pTransformSize8x8Flag[iMbXy] = false; | |
| 2615 | − pCurLayer->pNoSubMbPartSizeLessThan8x8Flag[iMbXy] = true; | |
| 2616 | − pCurLayer->pIntraPredMode[iMbXy][7] = (uiMbType - 1) & 3; | |
| 2617 | − pCurLayer->pCbp[iMbXy] = g_kuiI16CbpTable[ (uiMbType - 1) >> 2]; | |
| 2618 | − uiCbpC = pCtx->pSps->uiChromaFormatIdc ? pCurLayer->pCbp[iMbXy] >> 4 : 0; | |
| 2619 | − uiCbpL = pCurLayer->pCbp[iMbXy] & 15; | |
| 2620 | − WelsFillCacheNonZeroCount (&sNeighAvail, pNonZeroCount, pCurLayer); | |
| 2621 | − if ((iRet = ParseIntra16x16Mode (pCtx, &sNeighAvail, pBs, pCurLayer)) != ERR_NONE) { | |
| 2613 | + pCurDqLayer->pDec->pMbType[iMbXy] = MB_TYPE_INTRA16x16; | |
| 2614 | + pCurDqLayer->pTransformSize8x8Flag[iMbXy] = false; | |
| 2615 | + pCurDqLayer->pNoSubMbPartSizeLessThan8x8Flag[iMbXy] = true; | |
| 2616 | + pCurDqLayer->pIntraPredMode[iMbXy][7] = (uiMbType - 1) & 3; | |
| 2617 | + pCurDqLayer->pCbp[iMbXy] = g_kuiI16CbpTable[ (uiMbType - 1) >> 2]; | |
| 2618 | + uiCbpC = pCtx->pSps->uiChromaFormatIdc ? pCurDqLayer->pCbp[iMbXy] >> 4 : 0; | |
| 2619 | + uiCbpL = pCurDqLayer->pCbp[iMbXy] & 15; | |
| 2620 | + WelsFillCacheNonZeroCount (&sNeighAvail, pNonZeroCount, pCurDqLayer); | |
| 2621 | + if ((iRet = ParseIntra16x16Mode (pCtx, &sNeighAvail, pBs, pCurDqLayer)) != ERR_NONE) { | |
| 2622 | 2622 | return iRet; |
| 2623 | 2623 | } |
| 2624 | 2624 | } |
| 2625 | 2625 | } |
| 2626 | 2626 | } |
| 2627 | 2627 | |
| 2628 | − if (MB_TYPE_INTRA16x16 != pCurLayer->pMbType[iMbXy]) { | |
| 2628 | + if (MB_TYPE_INTRA16x16 != pCurDqLayer->pDec->pMbType[iMbXy]) { | |
| 2629 | 2629 | WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //coded_block_pattern |
| 2630 | 2630 | uiCbp = uiCode; |
| 2631 | 2631 | { |
| @@ -2633,29 +2633,29 @@ int32_t WelsActualDecodeMbCavlcBSlice (PWelsDecoderContext pCtx) { · 1 unmodified line | ||
| 2633 | 2633 | return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_CBP); |
| 2634 | 2634 | if (!pCtx->pSps->uiChromaFormatIdc && (uiCbp > 15)) |
| 2635 | 2635 | return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_CBP); |
| 2636 | − if (MB_TYPE_INTRA4x4 == pCurLayer->pMbType[iMbXy] || MB_TYPE_INTRA8x8 == pCurLayer->pMbType[iMbXy]) { | |
| 2636 | + if (MB_TYPE_INTRA4x4 == pCurDqLayer->pDec->pMbType[iMbXy] || MB_TYPE_INTRA8x8 == pCurDqLayer->pDec->pMbType[iMbXy]) { | |
| 2637 | 2637 | |
| 2638 | 2638 | uiCbp = pCtx->pSps->uiChromaFormatIdc ? g_kuiIntra4x4CbpTable[uiCbp] : g_kuiIntra4x4CbpTable400[uiCbp]; |
| 2639 | 2639 | } else //inter |
| 2640 | 2640 | uiCbp = pCtx->pSps->uiChromaFormatIdc ? g_kuiInterCbpTable[uiCbp] : g_kuiInterCbpTable400[uiCbp]; |
| 2641 | 2641 | } |
| 2642 | 2642 | |
| 2643 | − pCurLayer->pCbp[iMbXy] = uiCbp; | |
| 2644 | − uiCbpC = pCurLayer->pCbp[iMbXy] >> 4; | |
| 2645 | − uiCbpL = pCurLayer->pCbp[iMbXy] & 15; | |
| 2643 | + pCurDqLayer->pCbp[iMbXy] = uiCbp; | |
| 2644 | + uiCbpC = pCurDqLayer->pCbp[iMbXy] >> 4; | |
| 2645 | + uiCbpL = pCurDqLayer->pCbp[iMbXy] & 15; | |
| 2646 | 2646 | |
| 2647 | 2647 | // Need modification when B picutre add in |
| 2648 | 2648 | bool bNeedParseTransformSize8x8Flag = |
| 2649 | − (((pCurLayer->pMbType[iMbXy] >= MB_TYPE_16x16 && pCurLayer->pMbType[iMbXy] <= MB_TYPE_8x16) | |
| 2650 | − || pCurLayer->pNoSubMbPartSizeLessThan8x8Flag[iMbXy]) | |
| 2651 | − && (pCurLayer->pMbType[iMbXy] != MB_TYPE_INTRA8x8) | |
| 2652 | − && (pCurLayer->pMbType[iMbXy] != MB_TYPE_INTRA4x4) | |
| 2649 | + (((pCurDqLayer->pDec->pMbType[iMbXy] >= MB_TYPE_16x16 && pCurDqLayer->pDec->pMbType[iMbXy] <= MB_TYPE_8x16) | |
| 2650 | + || pCurDqLayer->pNoSubMbPartSizeLessThan8x8Flag[iMbXy]) | |
| 2651 | + && (pCurDqLayer->pDec->pMbType[iMbXy] != MB_TYPE_INTRA8x8) | |
| 2652 | + && (pCurDqLayer->pDec->pMbType[iMbXy] != MB_TYPE_INTRA4x4) | |
| 2653 | 2653 | && (uiCbpL > 0) |
| 2654 | 2654 | && (pCtx->pPps->bTransform8x8ModeFlag)); |
| 2655 | 2655 | |
| 2656 | 2656 | if (bNeedParseTransformSize8x8Flag) { |
| 2657 | 2657 | WELS_READ_VERIFY (BsGetOneBit (pBs, &uiCode)); //transform_size_8x8_flag |
| 2658 | − pCurLayer->pTransformSize8x8Flag[iMbXy] = !!uiCode; | |
| 2658 | + pCurDqLayer->pTransformSize8x8Flag[iMbXy] = !!uiCode; | |
| 2659 | 2659 | } |
| 2660 | 2660 | } |
| 2661 | 2661 | |
| @@ -2665,17 +2665,17 @@ int32_t WelsActualDecodeMbCavlcBSlice (PWelsDecoderContext pCtx) { · 3 unmodified lines | ||
| 2665 | 2665 | ST32A4 (&pNzc[12], 0); |
| 2666 | 2666 | ST32A4 (&pNzc[16], 0); |
| 2667 | 2667 | ST32A4 (&pNzc[20], 0); |
| 2668 | − if (pCurLayer->pCbp[iMbXy] == 0 && !IS_INTRA16x16 (pCurLayer->pMbType[iMbXy]) && !IS_I_BL (pCurLayer->pMbType[iMbXy])) { | |
| 2669 | − pCurLayer->pLumaQp[iMbXy] = pSlice->iLastMbQp; | |
| 2668 | + if (pCurDqLayer->pCbp[iMbXy] == 0 && !IS_INTRA16x16 (pCurDqLayer->pDec->pMbType[iMbXy]) && !IS_I_BL (pCurDqLayer->pDec->pMbType[iMbXy])) { | |
| 2669 | + pCurDqLayer->pLumaQp[iMbXy] = pSlice->iLastMbQp; | |
| 2670 | 2670 | for (i = 0; i < 2; i++) { |
| 2671 | − pCurLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 (pCurLayer->pLumaQp[iMbXy] + | |
| 2671 | + pCurDqLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 (pCurDqLayer->pLumaQp[iMbXy] + | |
| 2672 | 2672 | pSliceHeader->pPps->iChromaQpIndexOffset[i], 0, 51)]; |
| 2673 | 2673 | } |
| 2674 | 2674 | } |
| 2675 | 2675 | |
| 2676 | − if (pCurLayer->pCbp[iMbXy] || MB_TYPE_INTRA16x16 == pCurLayer->pMbType[iMbXy]) { | |
| 2676 | + if (pCurDqLayer->pCbp[iMbXy] || MB_TYPE_INTRA16x16 == pCurDqLayer->pDec->pMbType[iMbXy]) { | |
| 2677 | 2677 | int32_t iQpDelta, iId8x8, iId4x4; |
| 2678 | − memset (pCurLayer->pScaledTCoeff[iMbXy], 0, MB_COEFF_LIST_SIZE * sizeof (int16_t)); | |
| 2678 | + memset (pCurDqLayer->pScaledTCoeff[iMbXy], 0, MB_COEFF_LIST_SIZE * sizeof (int16_t)); | |
| 2679 | 2679 | WELS_READ_VERIFY (BsGetSe (pBs, &iCode)); //mb_qp_delta |
| 2680 | 2680 | iQpDelta = iCode; |
| 2681 | 2681 | |
| @@ -2683,28 +2683,28 @@ int32_t WelsActualDecodeMbCavlcBSlice (PWelsDecoderContext pCtx) { · 1 unmodified line | ||
| 2683 | 2683 | return GENERATE_ERROR_NO (ERR_LEVEL_MB_DATA, ERR_INFO_INVALID_QP); |
| 2684 | 2684 | } |
| 2685 | 2685 | |
| 2686 | − pCurLayer->pLumaQp[iMbXy] = (pSlice->iLastMbQp + iQpDelta + 52) % 52; //update last_mb_qp | |
| 2687 | − pSlice->iLastMbQp = pCurLayer->pLumaQp[iMbXy]; | |
| 2686 | + pCurDqLayer->pLumaQp[iMbXy] = (pSlice->iLastMbQp + iQpDelta + 52) % 52; //update last_mb_qp | |
| 2687 | + pSlice->iLastMbQp = pCurDqLayer->pLumaQp[iMbXy]; | |
| 2688 | 2688 | for (i = 0; i < 2; i++) { |
| 2689 | − pCurLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 (pSlice->iLastMbQp + | |
| 2689 | + pCurDqLayer->pChromaQp[iMbXy][i] = g_kuiChromaQpTable[WELS_CLIP3 (pSlice->iLastMbQp + | |
| 2690 | 2690 | pSliceHeader->pPps->iChromaQpIndexOffset[i], 0, |
| 2691 | 2691 | 51)]; |
| 2692 | 2692 | } |
| 2693 | 2693 | |
| 2694 | 2694 | BsStartCavlc (pBs); |
| 2695 | 2695 | |
| 2696 | − if (MB_TYPE_INTRA16x16 == pCurLayer->pMbType[iMbXy]) { | |
| 2696 | + if (MB_TYPE_INTRA16x16 == pCurDqLayer->pDec->pMbType[iMbXy]) { | |
| 2697 | 2697 | //step1: Luma DC |
| 2698 | 2698 | if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, 0, 16, g_kuiLumaDcZigzagScan, I16_LUMA_DC, |
| 2699 | − pCurLayer->pScaledTCoeff[iMbXy], pCurLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) { | |
| 2699 | + pCurDqLayer->pScaledTCoeff[iMbXy], pCurDqLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) { | |
| 2700 | 2700 | return iRet;//abnormal |
| 2701 | 2701 | } |
| 2702 | 2702 | //step2: Luma AC |
| 2703 | 2703 | if (uiCbpL) { |
| 2704 | 2704 | for (i = 0; i < 16; i++) { |
| 2705 | 2705 | if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, i, iScanIdxEnd - WELS_MAX (iScanIdxStart, 1) + 1, |
| 2706 | − g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1), I16_LUMA_AC, pCurLayer->pScaledTCoeff[iMbXy] + (i << 4), | |
| 2707 | − pCurLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) { | |
| 2706 | + g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1), I16_LUMA_AC, pCurDqLayer->pScaledTCoeff[iMbXy] + (i << 4), | |
| 2707 | + pCurDqLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) { | |
| 2708 | 2708 | return iRet;//abnormal |
| 2709 | 2709 | } |
| 2710 | 2710 | } |
| @@ -2714,15 +2714,15 @@ int32_t WelsActualDecodeMbCavlcBSlice (PWelsDecoderContext pCtx) { · 3 unmodified lines | ||
| 2714 | 2714 | ST32A4 (&pNzc[12], LD32 (&pNonZeroCount[1 + 8 * 4])); |
| 2715 | 2715 | } |
| 2716 | 2716 | } else { //non-MB_TYPE_INTRA16x16 |
| 2717 | − if (pCurLayer->pTransformSize8x8Flag[iMbXy]) { | |
| 2717 | + if (pCurDqLayer->pTransformSize8x8Flag[iMbXy]) { | |
| 2718 | 2718 | for (iId8x8 = 0; iId8x8 < 4; iId8x8++) { |
| 2719 | − iMbResProperty = (IS_INTRA (pCurLayer->pMbType[iMbXy])) ? LUMA_DC_AC_INTRA_8 : LUMA_DC_AC_INTER_8; | |
| 2719 | + iMbResProperty = (IS_INTRA (pCurDqLayer->pDec->pMbType[iMbXy])) ? LUMA_DC_AC_INTRA_8 : LUMA_DC_AC_INTER_8; | |
| 2720 | 2720 | if (uiCbpL & (1 << iId8x8)) { |
| 2721 | 2721 | int32_t iIndex = (iId8x8 << 2); |
| 2722 | 2722 | for (iId4x4 = 0; iId4x4 < 4; iId4x4++) { |
| 2723 | 2723 | if ((iRet = WelsResidualBlockCavlc8x8 (pVlcTable, pNonZeroCount, pBs, iIndex, iScanIdxEnd - iScanIdxStart + 1, |
| 2724 | − g_kuiZigzagScan8x8 + iScanIdxStart, iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + (iId8x8 << 6), iId4x4, | |
| 2725 | − pCurLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) { | |
| 2724 | + g_kuiZigzagScan8x8 + iScanIdxStart, iMbResProperty, pCurDqLayer->pScaledTCoeff[iMbXy] + (iId8x8 << 6), iId4x4, | |
| 2725 | + pCurDqLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) { | |
| 2726 | 2726 | return iRet; |
| 2727 | 2727 | } |
| 2728 | 2728 | iIndex++; |
| @@ -2738,14 +2738,14 @@ int32_t WelsActualDecodeMbCavlcBSlice (PWelsDecoderContext pCtx) { · 9 unmodified lines | ||
| 2738 | 2738 | ST32A4 (&pNzc[12], LD32 (&pNonZeroCount[1 + 8 * 4])); |
| 2739 | 2739 | } else { // Normal T4x4 |
| 2740 | 2740 | for (iId8x8 = 0; iId8x8 < 4; iId8x8++) { |
| 2741 | − iMbResProperty = (IS_INTRA (pCurLayer->pMbType[iMbXy])) ? LUMA_DC_AC_INTRA : LUMA_DC_AC_INTER; | |
| 2741 | + iMbResProperty = (IS_INTRA (pCurDqLayer->pDec->pMbType[iMbXy])) ? LUMA_DC_AC_INTRA : LUMA_DC_AC_INTER; | |
| 2742 | 2742 | if (uiCbpL & (1 << iId8x8)) { |
| 2743 | 2743 | int32_t iIndex = (iId8x8 << 2); |
| 2744 | 2744 | for (iId4x4 = 0; iId4x4 < 4; iId4x4++) { |
| 2745 | 2745 | //Luma (DC and AC decoding together) |
| 2746 | 2746 | if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex, iScanIdxEnd - iScanIdxStart + 1, |
| 2747 | − g_kuiZigzagScan + iScanIdxStart, iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), | |
| 2748 | − pCurLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) { | |
| 2747 | + g_kuiZigzagScan + iScanIdxStart, iMbResProperty, pCurDqLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), | |
| 2748 | + pCurDqLayer->pLumaQp[iMbXy], pCtx)) != ERR_NONE) { | |
| 2749 | 2749 | return iRet;//abnormal |
| 2750 | 2750 | } |
| 2751 | 2751 | iIndex++; |
| @@ -2767,13 +2767,13 @@ int32_t WelsActualDecodeMbCavlcBSlice (PWelsDecoderContext pCtx) { · 15 unmodified lines | ||
| 2767 | 2767 | //step1: DC |
| 2768 | 2768 | if (1 == uiCbpC || 2 == uiCbpC) { |
| 2769 | 2769 | for (i = 0; i < 2; i++) { //Cb Cr |
| 2770 | − if (IS_INTRA (pCurLayer->pMbType[iMbXy])) | |
| 2770 | + if (IS_INTRA (pCurDqLayer->pDec->pMbType[iMbXy])) | |
| 2771 | 2771 | iMbResProperty = i ? CHROMA_DC_V : CHROMA_DC_U; |
| 2772 | 2772 | else |
| 2773 | 2773 | iMbResProperty = i ? CHROMA_DC_V_INTER : CHROMA_DC_U_INTER; |
| 2774 | 2774 | |
| 2775 | 2775 | if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, 16 + (i << 2), 4, g_kuiChromaDcScan, iMbResProperty, |
| 2776 | − pCurLayer->pScaledTCoeff[iMbXy] + 256 + (i << 6), pCurLayer->pChromaQp[iMbXy][i], pCtx)) != ERR_NONE) { | |
| 2776 | + pCurDqLayer->pScaledTCoeff[iMbXy] + 256 + (i << 6), pCurDqLayer->pChromaQp[iMbXy][i], pCtx)) != ERR_NONE) { | |
| 2777 | 2777 | return iRet;//abnormal |
| 2778 | 2778 | } |
| 2779 | 2779 | } |
| @@ -2782,7 +2782,7 @@ int32_t WelsActualDecodeMbCavlcBSlice (PWelsDecoderContext pCtx) { · 2 unmodified lines | ||
| 2782 | 2782 | //step2: AC |
| 2783 | 2783 | if (2 == uiCbpC) { |
| 2784 | 2784 | for (i = 0; i < 2; i++) { //Cb Cr |
| 2785 | − if (IS_INTRA (pCurLayer->pMbType[iMbXy])) | |
| 2785 | + if (IS_INTRA (pCurDqLayer->pDec->pMbType[iMbXy])) | |
| 2786 | 2786 | iMbResProperty = i ? CHROMA_AC_V : CHROMA_AC_U; |
| 2787 | 2787 | else |
| 2788 | 2788 | iMbResProperty = i ? CHROMA_AC_V_INTER : CHROMA_AC_U_INTER; |
| @@ -2790,8 +2790,8 @@ int32_t WelsActualDecodeMbCavlcBSlice (PWelsDecoderContext pCtx) { · 1 unmodified line | ||
| 2790 | 2790 | int32_t iIndex = 16 + (i << 2); |
| 2791 | 2791 | for (iId4x4 = 0; iId4x4 < 4; iId4x4++) { |
| 2792 | 2792 | if ((iRet = WelsResidualBlockCavlc (pVlcTable, pNonZeroCount, pBs, iIndex, iScanIdxEnd - WELS_MAX (iScanIdxStart, |
| 2793 | − 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1), iMbResProperty, pCurLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), | |
| 2794 | − pCurLayer->pChromaQp[iMbXy][i], pCtx)) != ERR_NONE) { | |
| 2793 | + 1) + 1, g_kuiZigzagScan + WELS_MAX (iScanIdxStart, 1), iMbResProperty, pCurDqLayer->pScaledTCoeff[iMbXy] + (iIndex << 4), | |
| 2794 | + pCurDqLayer->pChromaQp[iMbXy][i], pCtx)) != ERR_NONE) { | |
| 2795 | 2795 | return iRet;//abnormal |
| 2796 | 2796 | } |
| 2797 | 2797 | iIndex++; |
| @@ -2860,8 +2860,8 @@ void WelsBlockZero8x8_c (int16_t* pBlock, int32_t iStride) { · 62 unmodified lines | ||
| 2860 | 2860 | // to all direct MBs in this slice, as per clause 8.4.1.2.3 |
| 2861 | 2861 | // of T-REC H.264 201704 |
| 2862 | 2862 | bool ComputeColocatedTemporalScaling (PWelsDecoderContext pCtx) { |
| 2863 | − PDqLayer pCurLayer = pCtx->pCurDqLayer; | |
| 2864 | − PSlice pCurSlice = &pCurLayer->sLayerInfo.sSliceInLayer; | |
| 2863 | + PDqLayer pCurDqLayer = pCtx->pCurDqLayer; | |
| 2864 | + PSlice pCurSlice = &pCurDqLayer->sLayerInfo.sSliceInLayer; | |
| 2865 | 2865 | PSliceHeader pSliceHeader = &pCurSlice->sSliceHeaderExt.sSliceHeader; |
| 2866 | 2866 | if (!pSliceHeader->iDirectSpatialMvPredFlag) { |
| 2867 | 2867 | uint32_t uiRefCount = pSliceHeader->uiRefCount[LIST_0]; |