ref: 1ccaf1175b986f7fb0f000c9d800a5bcd98433fa
parent: 83abff213906b123865e16685496400d430708a7
parent: 7772a9dc311fdf5c89cc5023a1d56ba3238daa92
author: dongzha <dongzha@cisco.com>
date: Tue Apr 29 08:10:28 EDT 2014
Merge pull request #762 from huili2/ec_ut_bugfix bug fix of EC_copy, it fixes the memory issue for decoder EC Unit Test which may lead crash.
--- a/test/decoder/DecUT_ErrorConcealment.cpp
+++ b/test/decoder/DecUT_ErrorConcealment.cpp
@@ -71,7 +71,7 @@
pECCtx->sAncPic.pData[2] = pECCtx->sAncPic.pData[1] + (kiLumaSize >> 2);
pECCtx->sSrcPic.pData[0] = (uint8_t*) WelsMalloc (kiLumaSize * 3 / 2 * sizeof (uint8_t), "pECCtx->sSrcPic.pData");
- if (pECCtx->sAncPic.pData[0] == NULL)
+ if (pECCtx->sSrcPic.pData[0] == NULL)
return 1;
pECCtx->sSrcPic.pData[1] = pECCtx->sSrcPic.pData[0] + kiLumaSize;
pECCtx->sSrcPic.pData[2] = pECCtx->sSrcPic.pData[1] + (kiLumaSize >> 2);
@@ -152,8 +152,8 @@
pSrcData = pSrcPic->pData[1] + iMbY * 8 * iSrcStride / 2 + iMbX * 8;
for (i = 0; i < 8; ++i) {
memcpy (pDstData, pSrcData, 8);
- pDstData += iDstStride;
- pSrcData += iSrcStride;
+ pDstData += iDstStride / 2;
+ pSrcData += iSrcStride / 2;
}
//V component
pDstData = pDstPic->pData[2] + iMbY * 8 * iDstStride / 2 + iMbX * 8;
@@ -160,25 +160,25 @@
pSrcData = pSrcPic->pData[2] + iMbY * 8 * iSrcStride / 2 + iMbX * 8;
for (i = 0; i < 8; ++i) {
memcpy (pDstData, pSrcData, 8);
- pDstData += iDstStride;
- pSrcData += iSrcStride;
+ pDstData += iDstStride / 2;
+ pSrcData += iSrcStride / 2;
}
} else { //pSrcPic == NULL
//Y component
pDstData = pDstPic->pData[0] + iMbY * 16 * iDstStride + iMbX * 16;
- for (int32_t i = 0; i < 16; ++i) {
+ for (i = 0; i < 16; ++i) {
memset (pDstData, 0, 16);
pDstData += iDstStride;
}
//U component
pDstData = pDstPic->pData[1] + iMbY * 8 * iDstStride / 2 + iMbX * 8;
- for (int32_t i = 0; i < 8; ++i) {
+ for (i = 0; i < 8; ++i) {
memset (pDstData, 0, 8);
pDstData += iDstStride / 2;
}
//V component
pDstData = pDstPic->pData[2] + iMbY * 8 * iDstStride / 2 + iMbX * 8;
- for (int32_t i = 0; i < 8; ++i) {
+ for (i = 0; i < 8; ++i) {
memset (pDstData, 0, 8);
pDstData += iDstStride / 2;
}
@@ -279,7 +279,7 @@
EXPECT_EQ (bOK, true);
//case 2: with reference picture
- pECCtx->pCtx->pPreviousDecodedPictureInDpb = &pECCtx->sAncPic;
+ pECCtx->pCtx->pPreviousDecodedPictureInDpb = &pECCtx->sSrcPic;
DoAncErrorConSliceCopy (pECCtx);
DoErrorConSliceCopy (pECCtx->pCtx);