diff --git a/codec/decoder/core/inc/dec_frame.h b/codec/decoder/core/inc/dec_frame.h index b063dab3..2f5c22a2 100644 --- a/codec/decoder/core/inc/dec_frame.h +++ b/codec/decoder/core/inc/dec_frame.h @@ -61,8 +61,6 @@ typedef struct TagLayerInfo { struct TagDqLayer { SLayerInfo sLayerInfo; - uint8_t* pCsData[3]; // pointer to reconstructed picture data - int32_t iCsStride[3]; // Cs stride PBitStringAux pBitStringAux; // pointer to SBitStringAux PFmo pFmo; // Current fmo context pointer used int8_t* pMbType; diff --git a/codec/decoder/core/inc/decoder_context.h b/codec/decoder/core/inc/decoder_context.h index 14105c7a..b2719a35 100644 --- a/codec/decoder/core/inc/decoder_context.h +++ b/codec/decoder/core/inc/decoder_context.h @@ -246,11 +246,6 @@ typedef struct TagWelsDecoderContext { // Memory for pAccessUnitList is dynamically held till decoder destruction. PDqLayer pCurDqLayer; // current DQ layer representation, also carry reference base layer if applicable PDqLayer pDqLayersList[LAYER_NUM_EXCHANGEABLE]; // DQ layers list with memory allocated - uint8_t* pCsListXchg[LAYER_NUM_EXCHANGEABLE][3]; // Constructed picture buffer: 0- cur layer, 1- ref layer; - int16_t* pRsListXchg[LAYER_NUM_EXCHANGEABLE][3];// Residual picture buffer: 0- cur layer, 1- ref layer; - - int32_t iCsStride[3]; // strides for Cs - int32_t iRsStride[3]; // strides for Rs int32_t iPicWidthReq; // picture width have requested the memory int32_t iPicHeightReq; // picture height have requested the memory diff --git a/codec/decoder/core/src/decode_slice.cpp b/codec/decoder/core/src/decode_slice.cpp index a51daaf3..bd3c9d89 100644 --- a/codec/decoder/core/src/decode_slice.cpp +++ b/codec/decoder/core/src/decode_slice.cpp @@ -285,31 +285,7 @@ void WelsMbCopy (uint8_t* pDst, int32_t iStrideDst, uint8_t* pSrc, int32_t iStri int32_t WelsTargetMbConstruction (PWelsDecoderContext pCtx) { PDqLayer pCurLayer = pCtx->pCurDqLayer; if (MB_TYPE_INTRA_PCM == pCurLayer->pMbType[pCurLayer->iMbXyIndex]) { - //copy cs into fdec - int32_t iCsStrideL = pCurLayer->iCsStride[0]; - int32_t iCsStrideC = pCurLayer->iCsStride[1]; - - int32_t iDecStrideL = pCurLayer->pDec->iLinesize[0]; - int32_t iDecStrideC = pCurLayer->pDec->iLinesize[1]; - - int32_t iCsOffsetL = (pCurLayer->iMbX + pCurLayer->iMbY * iCsStrideL) << 4; - int32_t iCsOffsetC = (pCurLayer->iMbX + pCurLayer->iMbY * iCsStrideC) << 3; - - int32_t iDecOffsetL = (pCurLayer->iMbX + pCurLayer->iMbY * iDecStrideL) << 4; - int32_t iDecOffsetC = (pCurLayer->iMbX + pCurLayer->iMbY * iDecStrideC) << 3; - - uint8_t* pSrcY = pCurLayer->pCsData[0] + iCsOffsetL; - uint8_t* pSrcU = pCurLayer->pCsData[1] + iCsOffsetC; - uint8_t* pSrcV = pCurLayer->pCsData[2] + iCsOffsetC; - - uint8_t* pDecY = pCurLayer->pDec->pData[0] + iDecOffsetL; - uint8_t* pDecU = pCurLayer->pDec->pData[1] + iDecOffsetC; - uint8_t* pDecV = pCurLayer->pDec->pData[2] + iDecOffsetC; - - WelsMbCopy (pDecY, iDecStrideL, pSrcY, iCsStrideL, 16, 16); - WelsMbCopy (pDecU, iDecStrideC, pSrcU, iCsStrideC, 8, 8); - WelsMbCopy (pDecV, iDecStrideC, pSrcV, iCsStrideC, 8, 8); - + //already decoded and reconstructed when parsing return 0; } else if (IS_INTRA (pCurLayer->pMbType[pCurLayer->iMbXyIndex])) { WelsMbIntraPredictionConstruction (pCtx, pCurLayer, 1); @@ -512,9 +488,9 @@ int32_t WelsActualDecodeMbCavlcISlice (PWelsDecoderContext pCtx) { int32_t iOffsetL = (iMbX + iMbY * iDecStrideL) << 4; int32_t iOffsetC = (iMbX + iMbY * iDecStrideC) << 3; - uint8_t* pDecY = pCurLayer->pCsData[0] + iOffsetL; - uint8_t* pDecU = pCurLayer->pCsData[1] + iOffsetC; - uint8_t* pDecV = pCurLayer->pCsData[2] + iOffsetC; + uint8_t* pDecY = pCurLayer->pDec->pData[0] + iOffsetL; + uint8_t* pDecU = pCurLayer->pDec->pData[1] + iOffsetC; + uint8_t* pDecV = pCurLayer->pDec->pData[2] + iOffsetC; uint8_t* pTmpBsBuf; @@ -821,9 +797,9 @@ int32_t WelsActualDecodeMbCavlcPSlice (PWelsDecoderContext pCtx) { int32_t iOffsetL = (iMbX + iMbY * iDecStrideL) << 4; int32_t iOffsetC = (iMbX + iMbY * iDecStrideC) << 3; - uint8_t* pDecY = pCurLayer->pCsData[0] + iOffsetL; - uint8_t* pDecU = pCurLayer->pCsData[1] + iOffsetC; - uint8_t* pDecV = pCurLayer->pCsData[2] + iOffsetC; + uint8_t* pDecY = pCurLayer->pDec->pData[0] + iOffsetL; + uint8_t* pDecU = pCurLayer->pDec->pData[1] + iOffsetC; + uint8_t* pDecV = pCurLayer->pDec->pData[2] + iOffsetC; uint8_t* pTmpBsBuf; diff --git a/codec/decoder/core/src/decoder_core.cpp b/codec/decoder/core/src/decoder_core.cpp index f5d343eb..420332cd 100644 --- a/codec/decoder/core/src/decoder_core.cpp +++ b/codec/decoder/core/src/decoder_core.cpp @@ -903,9 +903,6 @@ int32_t UpdateAccessUnit (PWelsDecoderContext pCtx) { } int32_t InitialDqLayersContext (PWelsDecoderContext pCtx, const int32_t kiMaxWidth, const int32_t kiMaxHeight) { - const int32_t kiPicStride = ((kiMaxWidth + 15) & 0xfffff0) + (PADDING_LENGTH << 1); - const int32_t kiPicLines = ((kiMaxHeight + 15) & 0xfffff0); - int32_t i = 0; WELS_VERIFY_RETURN_IF (ERR_INFO_INVALID_PARAM, (NULL == pCtx || kiMaxWidth <= 0 || kiMaxHeight <= 0)) @@ -922,35 +919,11 @@ int32_t InitialDqLayersContext (PWelsDecoderContext pCtx, const int32_t kiMaxWid do { PDqLayer pDq = (PDqLayer)WelsMalloc (sizeof (SDqLayer), "PDqLayer"); - int32_t iPlaneIdx = 0; - if (pDq == NULL) return ERR_INFO_OUT_OF_MEMORY; memset (pDq, 0, sizeof (SDqLayer)); - do { - const int32_t kiHshift = iPlaneIdx ? 1 : 0; - const int32_t kiVshift = kiHshift; - const int32_t kiStride = WELS_ALIGN ((kiPicStride >> kiHshift), (16 << (1 - kiHshift))); - const int32_t kiLine = (kiPicLines + (PADDING_LENGTH << 1)) >> kiVshift; - const int32_t kiSize = kiStride * kiLine; - - pCtx->pCsListXchg[i][iPlaneIdx] = (uint8_t*)WelsMalloc (kiSize * sizeof (uint8_t), "pCtx->pCsListXchg[][]"); - - WELS_VERIFY_RETURN_IF (ERR_INFO_OUT_OF_MEMORY, (NULL == pCtx->pCsListXchg[i][iPlaneIdx])) - pCtx->iCsStride[iPlaneIdx] = kiStride; - - - pCtx->pRsListXchg[i][iPlaneIdx] = (int16_t*)WelsMalloc (kiSize * sizeof (int16_t), "pCtx->pRsListXchg[][]"); - - WELS_VERIFY_RETURN_IF (ERR_INFO_OUT_OF_MEMORY , (NULL == pCtx->pRsListXchg[i][iPlaneIdx])) - pCtx->iRsStride[iPlaneIdx] = kiStride; - - ++ iPlaneIdx; - } while (iPlaneIdx < 3); - - pCtx->sMb.pMbType[i] = (int8_t*)WelsMalloc (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof (int8_t), "pCtx->sMb.pMbType[]"); pCtx->sMb.pMv[i][0] = (int16_t (*)[16][2])WelsMalloc (pCtx->sMb.iMbWidth * pCtx->sMb.iMbHeight * sizeof ( @@ -1031,34 +1004,6 @@ void UninitialDqLayersContext (PWelsDecoderContext pCtx) { continue; } - if (pCtx->pCsListXchg[i]) { // cs picture - j = 0; - do { - if (NULL != pCtx->pCsListXchg[i][j]) { - WelsFree (pCtx->pCsListXchg[i][j], "pCtx->pCsListXchg[][]"); - - pCtx->pCsListXchg[i][j] = NULL; - } - pCtx->iCsStride[j] = 0; - ++ j; - } while (j < 3); - - pDq->pCsData[i] = NULL; // for safe - pDq->iCsStride[i] = 0; - } - if (pCtx->pRsListXchg[i]) { - j = 0; - do { - if (NULL != pCtx->pRsListXchg[i][j]) { - WelsFree (pCtx->pRsListXchg[i][j], "pCtx->pRsListXchg[][]"); - - pCtx->pRsListXchg[i][j] = NULL; - } - pCtx->iRsStride[j] = 0; - ++ j; - } while (j < 3); - } - if (pCtx->sMb.pMbType[i]) { WelsFree (pCtx->sMb.pMbType[i], "pCtx->sMb.pMbType[]"); @@ -1652,13 +1597,6 @@ int32_t InitRefPicList (PWelsDecoderContext pCtx, const uint8_t kuiNRi, const bo void InitCurDqLayerData (PWelsDecoderContext pCtx, PDqLayer pCurDq) { if (NULL != pCtx && NULL != pCurDq) { - pCurDq->pCsData[0] = pCtx->pCsListXchg[0][0]; - pCurDq->pCsData[1] = pCtx->pCsListXchg[0][1]; - pCurDq->pCsData[2] = pCtx->pCsListXchg[0][2]; - pCurDq->iCsStride[0] = pCtx->iCsStride[0]; - pCurDq->iCsStride[1] = pCtx->iCsStride[1]; - pCurDq->iCsStride[2] = pCtx->iCsStride[2]; - pCurDq->pMbType = pCtx->sMb.pMbType[0]; pCurDq->pSliceIdc = pCtx->sMb.pSliceIdc[0]; pCurDq->pMv[0] = pCtx->sMb.pMv[0][0]; diff --git a/codec/decoder/core/src/rec_mb.cpp b/codec/decoder/core/src/rec_mb.cpp index 474df6ac..4ca392f5 100644 --- a/codec/decoder/core/src/rec_mb.cpp +++ b/codec/decoder/core/src/rec_mb.cpp @@ -104,7 +104,7 @@ int32_t RecI4x4Luma (int32_t iMBXY, PWelsDecoderContext pCtx, int16_t* pScoeffLe int32_t RecI4x4Chroma (int32_t iMBXY, PWelsDecoderContext pCtx, int16_t* pScoeffLevel, PDqLayer pDqLayer) { - int32_t iChromaStride = pCtx->pCurDqLayer->iCsStride[1]; + int32_t iChromaStride = pCtx->pCurDqLayer->pDec->iLinesize[1]; int8_t iChromaPredMode = pDqLayer->pChromaPredMode[iMBXY]; @@ -128,7 +128,7 @@ int32_t RecI16x16Mb (int32_t iMBXY, PWelsDecoderContext pCtx, int16_t* pScoeffLe int8_t iChromaPredMode = pDqLayer->pChromaPredMode[iMBXY]; PGetIntraPredFunc* pGetIChromaPredFunc = pCtx->pGetIChromaPredFunc; PGetIntraPredFunc* pGetI16x16LumaPredFunc = pCtx->pGetI16x16LumaPredFunc; - int32_t iUVStride = pCtx->pCurDqLayer->iCsStride[1]; + int32_t iUVStride = pCtx->pCurDqLayer->pDec->iLinesize[1]; /*common use by decoder&encoder*/ int32_t iYStride = pDqLayer->iLumaStride; @@ -435,7 +435,7 @@ void GetInterPred (uint8_t* pPredY, uint8_t* pPredCb, uint8_t* pPredCr, PWelsDec } int32_t RecChroma (int32_t iMBXY, PWelsDecoderContext pCtx, int16_t* pScoeffLevel, PDqLayer pDqLayer) { - int32_t iChromaStride = pCtx->pCurDqLayer->iCsStride[1]; + int32_t iChromaStride = pCtx->pCurDqLayer->pDec->iLinesize[1]; PIdctResAddPredFunc pIdctResAddPredFunc = pCtx->pIdctResAddPredFunc; uint8_t i = 0, j = 0;