Showing the changes to test/decoder/DecUT_DecExt.cpp (1 of 5 files). Show all
Unified · Split
| @@ -3,6 +3,7 @@ · 2 unmodified lines | |||
| 3 | #include "codec_def.h" | 3 | #include "codec_def.h" |
| 4 | #include "codec_app_def.h" | 4 | #include "codec_app_def.h" |
| 5 | #include "codec_api.h" | 5 | #include "codec_api.h" |
| 6 | #include "error_code.h" | ||
| 6 | #include "wels_common_basis.h" | 7 | #include "wels_common_basis.h" |
| 7 | #include "memory_align.h" | 8 | #include "memory_align.h" |
| 8 | #include "ls_defines.h" | 9 | #include "ls_defines.h" |
| @@ -25,9 +26,9 @@ class DecoderInterfaceTest : public ::testing::Test { · 16 unmodified lines | |||
| 25 | } | 26 | } |
| 26 | } | 27 | } |
| 27 | //Init members | 28 | //Init members |
| 28 | void Init(); | 29 | int32_t Init(); |
| 29 | //Init valid members | 30 | //Init valid members |
| 30 | void ValidInit(); | 31 | int32_t ValidInit(); |
| 31 | //Uninit members | 32 | //Uninit members |
| 32 | void Uninit(); | 33 | void Uninit(); |
| 33 | //Mock input data for test | 34 | //Mock input data for test |
| @@ -77,7 +78,7 @@ class DecoderInterfaceTest : public ::testing::Test { · 43 unmodified lines | |||
| 77 | }; | 78 | }; |
| 78 | 79 | ||
| 79 | //Init members | 80 | //Init members |
| 80 | void DecoderInterfaceTest::Init() { | 81 | int32_t DecoderInterfaceTest::Init() { |
| 81 | memset (&m_sBufferInfo, 0, sizeof (SBufferInfo)); | 82 | memset (&m_sBufferInfo, 0, sizeof (SBufferInfo)); |
| 82 | memset (&m_sParserBsInfo, 0, sizeof (SParserBsInfo)); | 83 | memset (&m_sParserBsInfo, 0, sizeof (SParserBsInfo)); |
| 83 | memset (&m_sDecParam, 0, sizeof (SDecodingParam)); | 84 | memset (&m_sDecParam, 0, sizeof (SDecodingParam)); |
| @@ -93,10 +94,11 @@ void DecoderInterfaceTest::Init() { · 9 unmodified lines | |||
| 93 | m_szBuffer[3] = 1; | 94 | m_szBuffer[3] = 1; |
| 94 | m_iBufLength = 4; | 95 | m_iBufLength = 4; |
| 95 | CM_RETURN eRet = (CM_RETURN) m_pDec->Initialize (&m_sDecParam); | 96 | CM_RETURN eRet = (CM_RETURN) m_pDec->Initialize (&m_sDecParam); |
| 96 | ASSERT_EQ (eRet, cmResultSuccess); | 97 | EXPECT_EQ (eRet, cmResultSuccess); |
| 98 | return (int32_t)eRet; | ||
| 97 | } | 99 | } |
| 98 | 100 | ||
| 99 | void DecoderInterfaceTest::ValidInit() { | 101 | int32_t DecoderInterfaceTest::ValidInit() { |
| 100 | memset (&m_sBufferInfo, 0, sizeof (SBufferInfo)); | 102 | memset (&m_sBufferInfo, 0, sizeof (SBufferInfo)); |
| 101 | memset (&m_sDecParam, 0, sizeof (SDecodingParam)); | 103 | memset (&m_sDecParam, 0, sizeof (SDecodingParam)); |
| 102 | m_sDecParam.pFileNameRestructed = NULL; | 104 | m_sDecParam.pFileNameRestructed = NULL; |
| @@ -111,7 +113,8 @@ void DecoderInterfaceTest::ValidInit() { · 8 unmodified lines | |||
| 111 | m_szBuffer[3] = 1; | 113 | m_szBuffer[3] = 1; |
| 112 | m_iBufLength = 4; | 114 | m_iBufLength = 4; |
| 113 | CM_RETURN eRet = (CM_RETURN) m_pDec->Initialize (&m_sDecParam); | 115 | CM_RETURN eRet = (CM_RETURN) m_pDec->Initialize (&m_sDecParam); |
| 114 | ASSERT_EQ (eRet, cmResultSuccess); | 116 | EXPECT_EQ (eRet, cmResultSuccess); |
| 117 | return (int32_t)eRet; | ||
| 115 | } | 118 | } |
| 116 | 119 | ||
| 117 | void DecoderInterfaceTest::Uninit() { | 120 | void DecoderInterfaceTest::Uninit() { |
| @@ -220,6 +223,7 @@ void DecoderInterfaceTest::MockPacketType (const EWelsNalUnitType eNalUnitType, · 102 unmodified lines | |||
| 220 | void DecoderInterfaceTest::TestInitUninit() { | 223 | void DecoderInterfaceTest::TestInitUninit() { |
| 221 | int iOutput; | 224 | int iOutput; |
| 222 | CM_RETURN eRet; | 225 | CM_RETURN eRet; |
| 226 | int32_t iRet = ERR_NONE; | ||
| 223 | //No initialize, no GetOption can be done | 227 | //No initialize, no GetOption can be done |
| 224 | m_pDec->Uninitialize(); | 228 | m_pDec->Uninitialize(); |
| 225 | for (int i = 0; i <= (int) DECODER_OPTION_TRACE_CALLBACK_CONTEXT; ++i) { | 229 | for (int i = 0; i <= (int) DECODER_OPTION_TRACE_CALLBACK_CONTEXT; ++i) { |
| @@ -227,9 +231,13 @@ void DecoderInterfaceTest::TestInitUninit() { · 1 unmodified line | |||
| 227 | EXPECT_EQ (eRet, cmInitExpected); | 231 | EXPECT_EQ (eRet, cmInitExpected); |
| 228 | } | 232 | } |
| 229 | //Initialize first, can get input color format | 233 | //Initialize first, can get input color format |
| 230 | Init(); | 234 | iRet = Init(); |
| 235 | ASSERT_EQ (iRet, ERR_NONE); | ||
| 236 | |||
| 231 | m_sDecParam.bParseOnly = false; | 237 | m_sDecParam.bParseOnly = false; |
| 232 | m_pDec->Initialize (&m_sDecParam); | 238 | eRet = (CM_RETURN)m_pDec->Initialize (&m_sDecParam); |
| 239 | ASSERT_EQ (eRet, cmResultSuccess); | ||
| 240 | |||
| 233 | eRet = (CM_RETURN) m_pDec->GetOption (DECODER_OPTION_END_OF_STREAM, &iOutput); | 241 | eRet = (CM_RETURN) m_pDec->GetOption (DECODER_OPTION_END_OF_STREAM, &iOutput); |
| 234 | EXPECT_EQ (eRet, cmResultSuccess); | 242 | EXPECT_EQ (eRet, cmResultSuccess); |
| 235 | EXPECT_EQ (iOutput, 0); | 243 | EXPECT_EQ (iOutput, 0); |
| @@ -329,8 +337,10 @@ void DecoderInterfaceTest::TestParseOnlyAPI() { · 93 unmodified lines | |||
| 329 | void DecoderInterfaceTest::TestEndOfStream() { | 337 | void DecoderInterfaceTest::TestEndOfStream() { |
| 330 | int iTmp, iOut; | 338 | int iTmp, iOut; |
| 331 | CM_RETURN eRet; | 339 | CM_RETURN eRet; |
| 340 | int32_t iRet = ERR_NONE; | ||
| 332 | 341 | ||
| 333 | ValidInit(); | 342 | iRet = ValidInit(); |
| 343 | ASSERT_EQ (iRet, ERR_NONE); | ||
| 334 | 344 | ||
| 335 | //invalid input | 345 | //invalid input |
| 336 | eRet = (CM_RETURN) m_pDec->SetOption (DECODER_OPTION_END_OF_STREAM, NULL); | 346 | eRet = (CM_RETURN) m_pDec->SetOption (DECODER_OPTION_END_OF_STREAM, NULL); |
| @@ -391,8 +401,10 @@ void DecoderInterfaceTest::TestEndOfStream() { · 54 unmodified lines | |||
| 391 | void DecoderInterfaceTest::TestVclNal() { | 401 | void DecoderInterfaceTest::TestVclNal() { |
| 392 | int iTmp, iOut; | 402 | int iTmp, iOut; |
| 393 | CM_RETURN eRet; | 403 | CM_RETURN eRet; |
| 404 | int32_t iRet = ERR_NONE; | ||
| 394 | 405 | ||
| 395 | ValidInit(); | 406 | iRet = ValidInit(); |
| 407 | ASSERT_EQ (iRet, ERR_NONE); | ||
| 396 | 408 | ||
| 397 | //Test SetOption | 409 | //Test SetOption |
| 398 | //VclNal never supports SetOption | 410 | //VclNal never supports SetOption |
| @@ -453,8 +465,10 @@ void DecoderInterfaceTest::TestLtrMarkedFrameNum() { · 54 unmodified lines | |||
| 453 | void DecoderInterfaceTest::TestErrorConIdc() { | 465 | void DecoderInterfaceTest::TestErrorConIdc() { |
| 454 | int iTmp, iOut; | 466 | int iTmp, iOut; |
| 455 | CM_RETURN eRet; | 467 | CM_RETURN eRet; |
| 468 | int32_t iRet = ERR_NONE; | ||
| 456 | 469 | ||
| 457 | Init(); | 470 | iRet = Init(); |
| 471 | ASSERT_EQ (iRet, ERR_NONE); | ||
| 458 | 472 | ||
| 459 | //Test GetOption | 473 | //Test GetOption |
| 460 | //invalid input | 474 | //invalid input |
| @@ -498,10 +512,12 @@ void DecoderInterfaceTest::TestTraceCallbackContext() { · 37 unmodified lines | |||
| 498 | //DECODER_OPTION_GET_STATISTICS | 512 | //DECODER_OPTION_GET_STATISTICS |
| 499 | void DecoderInterfaceTest::TestGetDecStatistics() { | 513 | void DecoderInterfaceTest::TestGetDecStatistics() { |
| 500 | CM_RETURN eRet; | 514 | CM_RETURN eRet; |
| 515 | int32_t iRet; | ||
| 501 | SDecoderStatistics sDecStatic; | 516 | SDecoderStatistics sDecStatic; |
| 502 | int32_t iError = 0; | 517 | int32_t iError = 0; |
| 503 | 518 | ||
| 504 | ValidInit(); | 519 | iRet = ValidInit(); |
| 520 | ASSERT_EQ (iRet, ERR_NONE); | ||
| 505 | //GetOption before decoding | 521 | //GetOption before decoding |
| 506 | m_pDec->GetOption (DECODER_OPTION_GET_STATISTICS, &sDecStatic); | 522 | m_pDec->GetOption (DECODER_OPTION_GET_STATISTICS, &sDecStatic); |
| 507 | EXPECT_EQ (0u, sDecStatic.uiDecodedFrameCount); | 523 | EXPECT_EQ (0u, sDecStatic.uiDecodedFrameCount); |
| @@ -528,7 +544,8 @@ void DecoderInterfaceTest::TestGetDecStatistics() { · 20 unmodified lines | |||
| 528 | Uninit(); | 544 | Uninit(); |
| 529 | 545 | ||
| 530 | //Decoder error bs when the first IDR lost | 546 | //Decoder error bs when the first IDR lost |
| 531 | ValidInit(); | 547 | iRet = ValidInit(); |
| 548 | ASSERT_EQ (iRet, ERR_NONE); | ||
| 532 | iError = 2; | 549 | iError = 2; |
| 533 | m_pDec->SetOption (DECODER_OPTION_ERROR_CON_IDC, &iError); | 550 | m_pDec->SetOption (DECODER_OPTION_ERROR_CON_IDC, &iError); |
| 534 | DecoderBs ("res/BA_MW_D_IDR_LOST.264"); | 551 | DecoderBs ("res/BA_MW_D_IDR_LOST.264"); |
| @@ -546,7 +563,9 @@ void DecoderInterfaceTest::TestGetDecStatistics() { · 11 unmodified lines | |||
| 546 | Uninit(); | 563 | Uninit(); |
| 547 | 564 | ||
| 548 | //ecoder error bs when the first P lost | 565 | //ecoder error bs when the first P lost |
| 549 | ValidInit(); | 566 | iRet = ValidInit(); |
| 567 | ASSERT_EQ (iRet, ERR_NONE); | ||
| 568 | |||
| 550 | iError = 2; | 569 | iError = 2; |
| 551 | m_pDec->SetOption (DECODER_OPTION_ERROR_CON_IDC, &iError); | 570 | m_pDec->SetOption (DECODER_OPTION_ERROR_CON_IDC, &iError); |
| 552 | 571 | ||
| @@ -567,7 +586,9 @@ void DecoderInterfaceTest::TestGetDecStatistics() { · 14 unmodified lines | |||
| 567 | //EC enable | 586 | //EC enable |
| 568 | 587 | ||
| 569 | //EC Off UT just correc bitstream | 588 | //EC Off UT just correc bitstream |
| 570 | ValidInit(); | 589 | iRet = ValidInit(); |
| 590 | ASSERT_EQ (iRet, ERR_NONE); | ||
| 591 | |||
| 571 | iError = 0; | 592 | iError = 0; |
| 572 | m_pDec->SetOption (DECODER_OPTION_ERROR_CON_IDC, &iError); | 593 | m_pDec->SetOption (DECODER_OPTION_ERROR_CON_IDC, &iError); |
| 573 | DecoderBs ("res/test_vd_1d.264"); | 594 | DecoderBs ("res/test_vd_1d.264"); |