History

re-structure SWelsDecoderContext and others and prepare for the support of multi-threading support.

xiaotiansf committed 7 years ago

Commit 2f5ecec1 parent 9ed97c729 files · +2285 −1568Browse files

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

Unified · Split

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

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t