Showing the changes to test/decoder/DecUT_ErrorConcealment.cpp (1 of 6 files). Show all
Unified · Split
| @@ -121,6 +121,9 @@ void DoAncErrorConSliceCopy (PECInputCtx pECCtx) { · 120 unmodified lines | ||
| 121 | 121 | int32_t iMbHeight = (int32_t) pECCtx->iMbHeight; |
| 122 | 122 | PPicture pDstPic = &pECCtx->sAncPic; |
| 123 | 123 | PPicture pSrcPic = pECCtx->pCtx->pPreviousDecodedPictureInDpb; |
| 124 | + if ((pECCtx->pCtx->eErrorConMethod == ERROR_CON_SLICE_COPY) | |
| 125 | + && (pECCtx->pCtx->pCurDqLayer->sLayerInfo.sNalHeaderExt.bIdrFlag)) | |
| 126 | + pSrcPic = NULL; | |
| 124 | 127 | |
| 125 | 128 | //uint8_t *pDstData[3], *pSrcData[3]; |
| 126 | 129 | bool* pMbCorrectlyDecodedFlag = pECCtx->pMbCorrectlyDecodedFlag; |
| @@ -231,26 +234,30 @@ TEST (ErrorConTest, DoErrorConFrameCopy) { · 104 unmodified lines | ||
| 231 | 234 | return; |
| 232 | 235 | } |
| 233 | 236 | |
| 234 | − pECCtx->pCtx->eErrorConMethod = ERROR_CON_FRAME_COPY; | |
| 235 | − InitECCopyData (pECCtx); | |
| 236 | − //case 1: no reference picture | |
| 237 | − pECCtx->pCtx->pPreviousDecodedPictureInDpb = NULL; | |
| 238 | − DoErrorConFrameCopy (pECCtx->pCtx); | |
| 239 | − | |
| 240 | − int32_t iLumaSize = pECCtx->iMbWidth * pECCtx->iMbHeight * 256; | |
| 241 | − memset (pECCtx->sAncPic.pData[0], 128, iLumaSize * 3 / 2); //should be the same as known EC method, here all 128 | |
| 242 | − bOK = ComparePictureDataI420 (pECCtx->sAncPic.pData[0], pECCtx->sWelsPic.pData[0], pECCtx->iLinesize[0], | |
| 243 | − pECCtx->iMbHeight * 16); | |
| 244 | − EXPECT_EQ (bOK, true); | |
| 245 | − | |
| 246 | − //case 2: with reference picture | |
| 247 | − pECCtx->pCtx->pPreviousDecodedPictureInDpb = &pECCtx->sSrcPic; | |
| 248 | − DoErrorConFrameCopy (pECCtx->pCtx); | |
| 249 | − | |
| 250 | − memcpy (pECCtx->sAncPic.pData[0], pECCtx->sSrcPic.pData[0], iLumaSize * 3 / 2); | |
| 251 | − bOK = ComparePictureDataI420 (pECCtx->sAncPic.pData[0], pECCtx->sWelsPic.pData[0], pECCtx->iLinesize[0], | |
| 252 | − pECCtx->iMbHeight * 16); | |
| 253 | − EXPECT_EQ (bOK, true); | |
| 237 | + for (int iEC = 0; iEC < 2; ++ iEC) { //ERROR_CON_FRAME_COPY, ERROR_CON_FRAME_COPY_CROSS_IDR | |
| 238 | + pECCtx->pCtx->eErrorConMethod = iEC > 0 ? ERROR_CON_FRAME_COPY_CROSS_IDR : ERROR_CON_FRAME_COPY; | |
| 239 | + InitECCopyData (pECCtx); | |
| 240 | + int32_t iLumaSize = pECCtx->iMbWidth * pECCtx->iMbHeight * 256; | |
| 241 | + | |
| 242 | + for (int iRef = 0; iRef < 2; ++ iRef) { //no ref, with ref | |
| 243 | + pECCtx->pCtx->pPreviousDecodedPictureInDpb = iRef ? &pECCtx->sSrcPic : NULL; | |
| 244 | + for (int iIDR = 0; iIDR < 2; ++ iIDR) { //non IDR, IDR | |
| 245 | + pECCtx->pCtx->pCurDqLayer->sLayerInfo.sNalHeaderExt.bIdrFlag = (iIDR > 0); | |
| 246 | + //Do reference code method | |
| 247 | + DoErrorConFrameCopy (pECCtx->pCtx); | |
| 248 | + //Do anchor method | |
| 249 | + if (iRef && ! ((pECCtx->pCtx->eErrorConMethod == ERROR_CON_FRAME_COPY) | |
| 250 | + && (pECCtx->pCtx->pCurDqLayer->sLayerInfo.sNalHeaderExt.bIdrFlag))) | |
| 251 | + memcpy (pECCtx->sAncPic.pData[0], pECCtx->sSrcPic.pData[0], iLumaSize * 3 / 2); | |
| 252 | + else | |
| 253 | + memset (pECCtx->sAncPic.pData[0], 128, iLumaSize * 3 / 2); //should be the same as known EC method, here all 128 | |
| 254 | + //Compare results | |
| 255 | + bOK = ComparePictureDataI420 (pECCtx->sAncPic.pData[0], pECCtx->sWelsPic.pData[0], pECCtx->iLinesize[0], | |
| 256 | + pECCtx->iMbHeight * 16); | |
| 257 | + EXPECT_EQ (bOK, true); | |
| 258 | + } //non IDR, IDR | |
| 259 | + } // no ref, with ref | |
| 260 | + } //FRAME_COPY methods | |
| 254 | 261 | |
| 255 | 262 | FreeInputData (pECCtx); |
| 256 | 263 | } |
| @@ -263,25 +270,25 @@ TEST (ErrorConTest, DoErrorConSliceCopy) { · 6 unmodified lines | ||
| 263 | 270 | FreeInputData (pECCtx); |
| 264 | 271 | return; |
| 265 | 272 | } |
| 266 | − pECCtx->pCtx->eErrorConMethod = ERROR_CON_SLICE_COPY; | |
| 267 | − InitECCopyData (pECCtx); | |
| 268 | − //case 1: no reference picture | |
| 269 | − pECCtx->pCtx->pPreviousDecodedPictureInDpb = NULL; | |
| 270 | − DoAncErrorConSliceCopy (pECCtx); | |
| 271 | − DoErrorConSliceCopy (pECCtx->pCtx); | |
| 272 | − | |
| 273 | − bOK = ComparePictureDataI420 (pECCtx->sAncPic.pData[0], pECCtx->sWelsPic.pData[0], pECCtx->iLinesize[0], | |
| 274 | − pECCtx->iMbHeight * 16); | |
| 275 | − EXPECT_EQ (bOK, true); | |
| 276 | − | |
| 277 | − //case 2: with reference picture | |
| 278 | − pECCtx->pCtx->pPreviousDecodedPictureInDpb = &pECCtx->sSrcPic; | |
| 279 | − DoAncErrorConSliceCopy (pECCtx); | |
| 280 | − DoErrorConSliceCopy (pECCtx->pCtx); | |
| 281 | − | |
| 282 | − bOK = ComparePictureDataI420 (pECCtx->sAncPic.pData[0], pECCtx->sWelsPic.pData[0], pECCtx->iLinesize[0], | |
| 283 | − pECCtx->iMbHeight * 16); | |
| 284 | − EXPECT_EQ (bOK, true); | |
| 273 | + | |
| 274 | + for (int iEC = 0; iEC < 2; ++ iEC) { //ERROR_CON_SLICE_COPY, ERROR_CON_SLICE_COPY_CROSS_IDR | |
| 275 | + pECCtx->pCtx->eErrorConMethod = iEC > 0 ? ERROR_CON_SLICE_COPY_CROSS_IDR : ERROR_CON_SLICE_COPY; | |
| 276 | + InitECCopyData (pECCtx); | |
| 277 | + for (int iRef = 0; iRef < 2; ++ iRef) { //no ref, with ref | |
| 278 | + pECCtx->pCtx->pPreviousDecodedPictureInDpb = iRef ? &pECCtx->sSrcPic : NULL; | |
| 279 | + for (int iIDR = 0; iIDR < 2; ++ iIDR) { //non IDR, IDR | |
| 280 | + pECCtx->pCtx->pCurDqLayer->sLayerInfo.sNalHeaderExt.bIdrFlag = (iIDR > 0); | |
| 281 | + //Do reference code method | |
| 282 | + DoErrorConSliceCopy (pECCtx->pCtx); | |
| 283 | + //Do anchor method | |
| 284 | + DoAncErrorConSliceCopy (pECCtx); | |
| 285 | + //Compare results | |
| 286 | + bOK = ComparePictureDataI420 (pECCtx->sAncPic.pData[0], pECCtx->sWelsPic.pData[0], pECCtx->iLinesize[0], | |
| 287 | + pECCtx->iMbHeight * 16); | |
| 288 | + EXPECT_EQ (bOK, true); | |
| 289 | + } //non IDR, IDR | |
| 290 | + } // no ref, with ref | |
| 291 | + } //FRAME_COPY methods | |
| 285 | 292 | |
| 286 | 293 | FreeInputData (pECCtx); |
| 287 | 294 | } |