fix decodestatus uiEcRatio calc bug
This commit is contained in:
@@ -400,6 +400,8 @@ SWelsCabacCtx pCabacCtx[WELS_CONTEXT_COUNT];
|
|||||||
PWelsCabacDecEngine pCabacDecEngine;
|
PWelsCabacDecEngine pCabacDecEngine;
|
||||||
double dDecTime;
|
double dDecTime;
|
||||||
SDecoderStatistics sDecoderStatistics;// For real time debugging
|
SDecoderStatistics sDecoderStatistics;// For real time debugging
|
||||||
|
int32_t iMbEcedNum;
|
||||||
|
int32_t iMbNum;
|
||||||
int32_t iECMVs[16][2];
|
int32_t iECMVs[16][2];
|
||||||
PPicture pECRefPic[16];
|
PPicture pECRefPic[16];
|
||||||
unsigned long long uiTimeStamp;
|
unsigned long long uiTimeStamp;
|
||||||
|
|||||||
@@ -1683,7 +1683,8 @@ static void WriteBackActiveParameters (PWelsDecoderContext pCtx) {
|
|||||||
int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferInfo* pDstInfo) {
|
int32_t ConstructAccessUnit (PWelsDecoderContext pCtx, uint8_t** ppDst, SBufferInfo* pDstInfo) {
|
||||||
int32_t iErr;
|
int32_t iErr;
|
||||||
PAccessUnit pCurAu = pCtx->pAccessUnitList;
|
PAccessUnit pCurAu = pCtx->pAccessUnitList;
|
||||||
|
pCtx->iMbEcedNum = 0;
|
||||||
|
pCtx->iMbNum = 0;
|
||||||
pCtx->bAuReadyFlag = false;
|
pCtx->bAuReadyFlag = false;
|
||||||
pCtx->bLastHasMmco5 = false;
|
pCtx->bLastHasMmco5 = false;
|
||||||
bool bTmpNewSeqBegin = CheckNewSeqBeginAndUpdateActiveLayerSps (pCtx);
|
bool bTmpNewSeqBegin = CheckNewSeqBeginAndUpdateActiveLayerSps (pCtx);
|
||||||
|
|||||||
@@ -82,6 +82,8 @@ void DoErrorConFrameCopy (PWelsDecoderContext pCtx) {
|
|||||||
uint32_t uiHeightInPixelY = (pCtx->pSps->iMbHeight) << 4;
|
uint32_t uiHeightInPixelY = (pCtx->pSps->iMbHeight) << 4;
|
||||||
int32_t iStrideY = pDstPic->iLinesize[0];
|
int32_t iStrideY = pDstPic->iLinesize[0];
|
||||||
int32_t iStrideUV = pDstPic->iLinesize[1];
|
int32_t iStrideUV = pDstPic->iLinesize[1];
|
||||||
|
pCtx->iMbNum = pCtx->pSps->iMbWidth * pCtx->pSps->iMbHeight;
|
||||||
|
pCtx->iMbEcedNum = pCtx->iMbNum;
|
||||||
if ((pCtx->eErrorConMethod == ERROR_CON_FRAME_COPY) && (pCtx->pCurDqLayer->sLayerInfo.sNalHeaderExt.bIdrFlag))
|
if ((pCtx->eErrorConMethod == ERROR_CON_FRAME_COPY) && (pCtx->pCurDqLayer->sLayerInfo.sNalHeaderExt.bIdrFlag))
|
||||||
pSrcPic = NULL; //no cross IDR method, should fill in data instead of copy
|
pSrcPic = NULL; //no cross IDR method, should fill in data instead of copy
|
||||||
if (pSrcPic == NULL) { //no ref pic, assign specific data to picture
|
if (pSrcPic == NULL) { //no ref pic, assign specific data to picture
|
||||||
@@ -105,10 +107,10 @@ void DoErrorConSliceCopy (PWelsDecoderContext pCtx) {
|
|||||||
if ((pCtx->eErrorConMethod == ERROR_CON_SLICE_COPY) && (pCtx->pCurDqLayer->sLayerInfo.sNalHeaderExt.bIdrFlag))
|
if ((pCtx->eErrorConMethod == ERROR_CON_SLICE_COPY) && (pCtx->pCurDqLayer->sLayerInfo.sNalHeaderExt.bIdrFlag))
|
||||||
pSrcPic = NULL; //no cross IDR method, should fill in data instead of copy
|
pSrcPic = NULL; //no cross IDR method, should fill in data instead of copy
|
||||||
|
|
||||||
int32_t iMbNum = pCtx->pSps->iMbWidth * pCtx->pSps->iMbHeight;
|
pCtx->iMbNum = pCtx->pSps->iMbWidth * pCtx->pSps->iMbHeight;
|
||||||
//uint8_t *pDstData[3], *pSrcData[3];
|
//uint8_t *pDstData[3], *pSrcData[3];
|
||||||
bool* pMbCorrectlyDecodedFlag = pCtx->pCurDqLayer->pMbCorrectlyDecodedFlag;
|
bool* pMbCorrectlyDecodedFlag = pCtx->pCurDqLayer->pMbCorrectlyDecodedFlag;
|
||||||
int32_t iMbEcedNum = 0;
|
pCtx->iMbEcedNum = 0;
|
||||||
//Do slice copy late
|
//Do slice copy late
|
||||||
int32_t iMbXyIndex;
|
int32_t iMbXyIndex;
|
||||||
uint8_t* pSrcData, *pDstData;
|
uint8_t* pSrcData, *pDstData;
|
||||||
@@ -118,7 +120,7 @@ void DoErrorConSliceCopy (PWelsDecoderContext pCtx) {
|
|||||||
for (int32_t iMbX = 0; iMbX < iMbWidth; ++iMbX) {
|
for (int32_t iMbX = 0; iMbX < iMbWidth; ++iMbX) {
|
||||||
iMbXyIndex = iMbY * iMbWidth + iMbX;
|
iMbXyIndex = iMbY * iMbWidth + iMbX;
|
||||||
if (!pMbCorrectlyDecodedFlag[iMbXyIndex]) {
|
if (!pMbCorrectlyDecodedFlag[iMbXyIndex]) {
|
||||||
iMbEcedNum++;
|
pCtx->iMbEcedNum++;
|
||||||
if (pSrcPic != NULL) {
|
if (pSrcPic != NULL) {
|
||||||
iSrcStride = pSrcPic->iLinesize[0];
|
iSrcStride = pSrcPic->iLinesize[0];
|
||||||
//Y component
|
//Y component
|
||||||
@@ -156,10 +158,6 @@ void DoErrorConSliceCopy (PWelsDecoderContext pCtx) {
|
|||||||
} //!pMbCorrectlyDecodedFlag[iMbXyIndex]
|
} //!pMbCorrectlyDecodedFlag[iMbXyIndex]
|
||||||
} //iMbX
|
} //iMbX
|
||||||
} //iMbY
|
} //iMbY
|
||||||
|
|
||||||
if (!pCtx->bFreezeOutput)
|
|
||||||
pCtx->sDecoderStatistics.uiAvgEcRatio = (pCtx->sDecoderStatistics.uiAvgEcRatio * pCtx->sDecoderStatistics.uiEcFrameNum)
|
|
||||||
+ ((iMbEcedNum * 100) / iMbNum) ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Do error concealment using slice MV copy method
|
//Do error concealment using slice MV copy method
|
||||||
@@ -368,9 +366,9 @@ void DoErrorConSliceMVCopy (PWelsDecoderContext pCtx) {
|
|||||||
PPicture pDstPic = pCtx->pDec;
|
PPicture pDstPic = pCtx->pDec;
|
||||||
PPicture pSrcPic = pCtx->pPreviousDecodedPictureInDpb;
|
PPicture pSrcPic = pCtx->pPreviousDecodedPictureInDpb;
|
||||||
|
|
||||||
int32_t iMbNum = pCtx->pSps->iMbWidth * pCtx->pSps->iMbHeight;
|
pCtx->iMbNum = pCtx->pSps->iMbWidth * pCtx->pSps->iMbHeight;
|
||||||
bool* pMbCorrectlyDecodedFlag = pCtx->pCurDqLayer->pMbCorrectlyDecodedFlag;
|
bool* pMbCorrectlyDecodedFlag = pCtx->pCurDqLayer->pMbCorrectlyDecodedFlag;
|
||||||
int32_t iMbEcedNum = 0;
|
pCtx->iMbEcedNum = 0;
|
||||||
int32_t iMbXyIndex;
|
int32_t iMbXyIndex;
|
||||||
uint8_t* pDstData;
|
uint8_t* pDstData;
|
||||||
uint32_t iDstStride = pDstPic->iLinesize[0];
|
uint32_t iDstStride = pDstPic->iLinesize[0];
|
||||||
@@ -395,7 +393,7 @@ void DoErrorConSliceMVCopy (PWelsDecoderContext pCtx) {
|
|||||||
for (int32_t iMbX = 0; iMbX < iMbWidth; ++iMbX) {
|
for (int32_t iMbX = 0; iMbX < iMbWidth; ++iMbX) {
|
||||||
iMbXyIndex = iMbY * iMbWidth + iMbX;
|
iMbXyIndex = iMbY * iMbWidth + iMbX;
|
||||||
if (!pMbCorrectlyDecodedFlag[iMbXyIndex]) {
|
if (!pMbCorrectlyDecodedFlag[iMbXyIndex]) {
|
||||||
iMbEcedNum++;
|
pCtx->iMbEcedNum++;
|
||||||
if (pSrcPic != NULL) {
|
if (pSrcPic != NULL) {
|
||||||
DoMbECMvCopy (pCtx, pDstPic, pSrcPic, iMbXyIndex, iMbX, iMbY, &sMCRefMem);
|
DoMbECMvCopy (pCtx, pDstPic, pSrcPic, iMbXyIndex, iMbX, iMbY, &sMCRefMem);
|
||||||
} else { //pSrcPic == NULL
|
} else { //pSrcPic == NULL
|
||||||
@@ -422,10 +420,6 @@ void DoErrorConSliceMVCopy (PWelsDecoderContext pCtx) {
|
|||||||
} //!pMbCorrectlyDecodedFlag[iMbXyIndex]
|
} //!pMbCorrectlyDecodedFlag[iMbXyIndex]
|
||||||
} //iMbX
|
} //iMbX
|
||||||
} //iMbY
|
} //iMbY
|
||||||
|
|
||||||
if (!pCtx->bFreezeOutput)
|
|
||||||
pCtx->sDecoderStatistics.uiAvgEcRatio = (pCtx->sDecoderStatistics.uiAvgEcRatio * pCtx->sDecoderStatistics.uiEcFrameNum)
|
|
||||||
+ ((iMbEcedNum * 100) / iMbNum) ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Mark erroneous frame as Ref Pic into DPB
|
//Mark erroneous frame as Ref Pic into DPB
|
||||||
|
|||||||
@@ -385,6 +385,8 @@ DECODING_STATE CWelsDecoder::DecodeFrame2 (const unsigned char* kpSrc,
|
|||||||
const int kiSrcLen,
|
const int kiSrcLen,
|
||||||
unsigned char** ppDst,
|
unsigned char** ppDst,
|
||||||
SBufferInfo* pDstInfo) {
|
SBufferInfo* pDstInfo) {
|
||||||
|
m_pDecContext->iMbEcedNum = 0;
|
||||||
|
m_pDecContext->iMbNum = 0;
|
||||||
if (CheckBsBuffer (m_pDecContext, kiSrcLen)) {
|
if (CheckBsBuffer (m_pDecContext, kiSrcLen)) {
|
||||||
return dsOutOfMemory;
|
return dsOutOfMemory;
|
||||||
}
|
}
|
||||||
@@ -464,10 +466,6 @@ DECODING_STATE CWelsDecoder::DecodeFrame2 (const unsigned char* kpSrc,
|
|||||||
if ((m_pDecContext->eErrorConMethod != ERROR_CON_DISABLE) && (pDstInfo->iBufferStatus == 1)) {
|
if ((m_pDecContext->eErrorConMethod != ERROR_CON_DISABLE) && (pDstInfo->iBufferStatus == 1)) {
|
||||||
//TODO after dec status updated
|
//TODO after dec status updated
|
||||||
m_pDecContext->iErrorCode |= dsDataErrorConcealed;
|
m_pDecContext->iErrorCode |= dsDataErrorConcealed;
|
||||||
if (m_pDecContext->eErrorConMethod == ERROR_CON_FRAME_COPY)
|
|
||||||
|
|
||||||
m_pDecContext->sDecoderStatistics.uiAvgEcRatio = (m_pDecContext->sDecoderStatistics.uiAvgEcRatio *
|
|
||||||
m_pDecContext->sDecoderStatistics.uiEcFrameNum) + 100;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
if ((m_pDecContext->sDecoderStatistics.uiWidth != (unsigned int) pDstInfo->UsrData.sSystemBuffer.iWidth)
|
if ((m_pDecContext->sDecoderStatistics.uiWidth != (unsigned int) pDstInfo->UsrData.sSystemBuffer.iWidth)
|
||||||
@@ -482,6 +480,7 @@ DECODING_STATE CWelsDecoder::DecodeFrame2 (const unsigned char* kpSrc,
|
|||||||
ResetDecStatNums (&m_pDecContext->sDecoderStatistics);
|
ResetDecStatNums (&m_pDecContext->sDecoderStatistics);
|
||||||
m_pDecContext->sDecoderStatistics.uiDecodedFrameCount++;
|
m_pDecContext->sDecoderStatistics.uiDecodedFrameCount++;
|
||||||
}
|
}
|
||||||
|
m_pDecContext->sDecoderStatistics.uiAvgEcRatio = m_pDecContext->iMbEcedNum == 0 ? (m_pDecContext->sDecoderStatistics.uiAvgEcRatio * m_pDecContext->sDecoderStatistics.uiEcFrameNum) :((m_pDecContext->sDecoderStatistics.uiAvgEcRatio * m_pDecContext->sDecoderStatistics.uiEcFrameNum) + ((m_pDecContext->iMbEcedNum * 100) / m_pDecContext->iMbNum));
|
||||||
m_pDecContext->sDecoderStatistics.uiEcFrameNum++;
|
m_pDecContext->sDecoderStatistics.uiEcFrameNum++;
|
||||||
m_pDecContext->sDecoderStatistics.uiAvgEcRatio = m_pDecContext->sDecoderStatistics.uiAvgEcRatio /
|
m_pDecContext->sDecoderStatistics.uiAvgEcRatio = m_pDecContext->sDecoderStatistics.uiAvgEcRatio /
|
||||||
m_pDecContext->sDecoderStatistics.uiEcFrameNum;
|
m_pDecContext->sDecoderStatistics.uiEcFrameNum;
|
||||||
|
|||||||
Reference in New Issue
Block a user