Showing the changes to test/api/encode_decode_api_test.cpp (1 of 5 files). Show all
Unified · Split
| @@ -2461,7 +2461,6 @@ const uint32_t kiWidth = 160; //DO NOT CHANGE! · 2460 unmodified lines | |||
| 2461 | const uint32_t kiHeight = 96; //DO NOT CHANGE! | 2461 | const uint32_t kiHeight = 96; //DO NOT CHANGE! |
| 2462 | const uint32_t kiFrameRate = 12; //DO NOT CHANGE! | 2462 | const uint32_t kiFrameRate = 12; //DO NOT CHANGE! |
| 2463 | const uint32_t kiFrameNum = 100; //DO NOT CHANGE! | 2463 | const uint32_t kiFrameNum = 100; //DO NOT CHANGE! |
| 2464 | const uint32_t kiMaxBsSize = 10000000; //DO NOT CHANGE! | ||
| 2465 | const char* pHashStr[] = { //DO NOT CHANGE! | 2464 | const char* pHashStr[] = { //DO NOT CHANGE! |
| 2466 | "d1c255a57aa2c5e1192a90680c00e6ee3e73fe59", | 2465 | "d1c255a57aa2c5e1192a90680c00e6ee3e73fe59", |
| 2467 | "f350001c333902029800bd291fbed915a4bdf19a", | 2466 | "f350001c333902029800bd291fbed915a4bdf19a", |
| @@ -2487,9 +2486,6 @@ class DecodeParseAPI : public ::testing::TestWithParam<EncodeDecodeFileParamBase · 19 unmodified lines | |||
| 2487 | int rv = decoder_->Initialize (&decParam); | 2486 | int rv = decoder_->Initialize (&decParam); |
| 2488 | ASSERT_EQ (0, rv); | 2487 | ASSERT_EQ (0, rv); |
| 2489 | memset (&BsInfo_, 0, sizeof (SParserBsInfo)); | 2488 | memset (&BsInfo_, 0, sizeof (SParserBsInfo)); |
| 2490 | BsInfo_.pDstBuff = NULL; | ||
| 2491 | BsInfo_.pDstBuff = new unsigned char [kiMaxBsSize]; | ||
| 2492 | ASSERT_TRUE (BsInfo_.pDstBuff != NULL); | ||
| 2493 | fYuv_ = fopen ("./res/CiscoVT2people_160x96_6fps.yuv", "rb"); | 2489 | fYuv_ = fopen ("./res/CiscoVT2people_160x96_6fps.yuv", "rb"); |
| 2494 | ASSERT_TRUE (fYuv_ != NULL); | 2490 | ASSERT_TRUE (fYuv_ != NULL); |
| 2495 | iWidth_ = kiWidth; | 2491 | iWidth_ = kiWidth; |
| @@ -2497,10 +2493,6 @@ class DecodeParseAPI : public ::testing::TestWithParam<EncodeDecodeFileParamBase · 1 unmodified line | |||
| 2497 | } | 2493 | } |
| 2498 | void TearDown() { | 2494 | void TearDown() { |
| 2499 | EncodeDecodeTestBase::TearDown(); | 2495 | EncodeDecodeTestBase::TearDown(); |
| 2500 | if (BsInfo_.pDstBuff) { | ||
| 2501 | delete[] BsInfo_.pDstBuff; | ||
| 2502 | BsInfo_.pDstBuff = NULL; | ||
| 2503 | } | ||
| 2504 | fclose (fYuv_); | 2496 | fclose (fYuv_); |
| 2505 | } | 2497 | } |
| 2506 | 2498 | ||
| @@ -3449,7 +3441,7 @@ class EncodeTestAPI : public ::testing::TestWithParam<EncodeOptionParam>, public · 942 unmodified lines | |||
| 3449 | uint8_t* ptr = buf_.data(); | 3441 | uint8_t* ptr = buf_.data(); |
| 3450 | uint8_t uiVal = rand() % 256; | 3442 | uint8_t uiVal = rand() % 256; |
| 3451 | for (int i = 0; i < frameSize; i++) { | 3443 | for (int i = 0; i < frameSize; i++) { |
| 3452 | ptr[i] = bAllRandom? (rand() % 256) :uiVal; | 3444 | ptr[i] = bAllRandom ? (rand() % 256) : uiVal; |
| 3453 | } | 3445 | } |
| 3454 | int rv = encoder_->EncodeFrame (&EncPic, &info); | 3446 | int rv = encoder_->EncodeFrame (&EncPic, &info); |
| 3455 | if (0 == iCheckTypeIndex) | 3447 | if (0 == iCheckTypeIndex) |
| @@ -3464,9 +3456,9 @@ INSTANTIATE_TEST_CASE_P (EncodeDecodeTestAPIBase, EncodeTestAPI, · 8 unmodified lines | |||
| 3464 | 3456 | ||
| 3465 | TEST_P (EncodeTestAPI, SetEncOptionSize) { | 3457 | TEST_P (EncodeTestAPI, SetEncOptionSize) { |
| 3466 | EncodeOptionParam p = GetParam(); | 3458 | EncodeOptionParam p = GetParam(); |
| 3467 | FILE * pFile = NULL; | 3459 | FILE* pFile = NULL; |
| 3468 | if (p.sFileSave != NULL && strlen(p.sFileSave) > 0) { | 3460 | if (p.sFileSave != NULL && strlen (p.sFileSave) > 0) { |
| 3469 | pFile = fopen(p.sFileSave, "wb"); | 3461 | pFile = fopen (p.sFileSave, "wb"); |
| 3470 | } | 3462 | } |
| 3471 | memset (¶m_, 0, sizeof (SEncParamExt)); | 3463 | memset (¶m_, 0, sizeof (SEncParamExt)); |
| 3472 | encoder_->GetDefaultParams (¶m_); | 3464 | encoder_->GetDefaultParams (¶m_); |
| @@ -3502,16 +3494,16 @@ TEST_P (EncodeTestAPI, SetEncOptionSize) { · 29 unmodified lines | |||
| 3502 | unsigned char* pData[3] = { NULL }; | 3494 | unsigned char* pData[3] = { NULL }; |
| 3503 | while (iIdx <= p.iNumframes) { | 3495 | while (iIdx <= p.iNumframes) { |
| 3504 | EncodeOneFrameRandom (0, p.bAllRandom); | 3496 | EncodeOneFrameRandom (0, p.bAllRandom); |
| 3505 | encToDecData(info, iLen); | 3497 | encToDecData (info, iLen); |
| 3506 | if( pFile ) { | 3498 | if (pFile) { |
| 3507 | fwrite (info.sLayerInfo[0].pBsBuf, iLen, 1, pFile); | 3499 | fwrite (info.sLayerInfo[0].pBsBuf, iLen, 1, pFile); |
| 3508 | fflush (pFile); | 3500 | fflush (pFile); |
| 3509 | } | 3501 | } |
| 3510 | memset(&dstBufInfo_, 0, sizeof(SBufferInfo)); | 3502 | memset (&dstBufInfo_, 0, sizeof (SBufferInfo)); |
| 3511 | if(iLen && p.bTestDecoder) { | 3503 | if (iLen && p.bTestDecoder) { |
| 3512 | rv = decoder_->DecodeFrameNoDelay(info.sLayerInfo[0].pBsBuf, iLen, pData, &dstBufInfo_); | 3504 | rv = decoder_->DecodeFrameNoDelay (info.sLayerInfo[0].pBsBuf, iLen, pData, &dstBufInfo_); |
| 3513 | ASSERT_EQ(rv, 0); | 3505 | ASSERT_EQ (rv, 0); |
| 3514 | ASSERT_EQ(dstBufInfo_.iBufferStatus, 1); | 3506 | ASSERT_EQ (dstBufInfo_.iBufferStatus, 1); |
| 3515 | } | 3507 | } |
| 3516 | int iLayer = 0; | 3508 | int iLayer = 0; |
| 3517 | while (iLayer < info.iLayerNum) { | 3509 | while (iLayer < info.iLayerNum) { |
| @@ -3529,7 +3521,7 @@ TEST_P (EncodeTestAPI, SetEncOptionSize) { · 11 unmodified lines | |||
| 3529 | } | 3521 | } |
| 3530 | iIdx++; | 3522 | iIdx++; |
| 3531 | } | 3523 | } |
| 3532 | if( pFile ) { | 3524 | if (pFile) { |
| 3533 | fclose (pFile); | 3525 | fclose (pFile); |
| 3534 | } | 3526 | } |
| 3535 | } | 3527 | } |