History

allow slice-level data come in for parse only

huili2 committed 11 years ago

Commit 06b8e1a1 parent 5b125785 files · +147 −101Browse files

Showing the changes to test/api/encode_decode_api_test.cpp (1 of 5 files). Show all

Unified · Split

test/api/encode_decode_api_test.cpp+12−20
@@ -2461,7 +2461,6 @@ const uint32_t kiWidth = 160; //DO NOT CHANGE! · 2460 unmodified lines
24612461 const uint32_t kiHeight = 96; //DO NOT CHANGE!
24622462 const uint32_t kiFrameRate = 12; //DO NOT CHANGE!
24632463 const uint32_t kiFrameNum = 100; //DO NOT CHANGE!
2464−const uint32_t kiMaxBsSize = 10000000; //DO NOT CHANGE!
24652464 const char* pHashStr[] = { //DO NOT CHANGE!
24662465 "d1c255a57aa2c5e1192a90680c00e6ee3e73fe59",
24672466 "f350001c333902029800bd291fbed915a4bdf19a",
@@ -2487,9 +2486,6 @@ class DecodeParseAPI : public ::testing::TestWithParam<EncodeDecodeFileParamBase · 19 unmodified lines
24872486 int rv = decoder_->Initialize (&decParam);
24882487 ASSERT_EQ (0, rv);
24892488 memset (&BsInfo_, 0, sizeof (SParserBsInfo));
2490− BsInfo_.pDstBuff = NULL;
2491− BsInfo_.pDstBuff = new unsigned char [kiMaxBsSize];
2492− ASSERT_TRUE (BsInfo_.pDstBuff != NULL);
24932489 fYuv_ = fopen ("./res/CiscoVT2people_160x96_6fps.yuv", "rb");
24942490 ASSERT_TRUE (fYuv_ != NULL);
24952491 iWidth_ = kiWidth;
@@ -2497,10 +2493,6 @@ class DecodeParseAPI : public ::testing::TestWithParam<EncodeDecodeFileParamBase · 1 unmodified line
24972493 }
24982494 void TearDown() {
24992495 EncodeDecodeTestBase::TearDown();
2500− if (BsInfo_.pDstBuff) {
2501− delete[] BsInfo_.pDstBuff;
2502− BsInfo_.pDstBuff = NULL;
2503− }
25042496 fclose (fYuv_);
25052497 }
25062498
@@ -3449,7 +3441,7 @@ class EncodeTestAPI : public ::testing::TestWithParam<EncodeOptionParam>, public · 942 unmodified lines
34493441 uint8_t* ptr = buf_.data();
34503442 uint8_t uiVal = rand() % 256;
34513443 for (int i = 0; i < frameSize; i++) {
3452− ptr[i] = bAllRandom? (rand() % 256) :uiVal;
3444+ ptr[i] = bAllRandom ? (rand() % 256) : uiVal;
34533445 }
34543446 int rv = encoder_->EncodeFrame (&EncPic, &info);
34553447 if (0 == iCheckTypeIndex)
@@ -3464,9 +3456,9 @@ INSTANTIATE_TEST_CASE_P (EncodeDecodeTestAPIBase, EncodeTestAPI, · 8 unmodified lines
34643456
34653457 TEST_P (EncodeTestAPI, SetEncOptionSize) {
34663458 EncodeOptionParam p = GetParam();
3467− FILE * pFile = NULL;
3468− if (p.sFileSave != NULL && strlen(p.sFileSave) > 0) {
3469− pFile = fopen(p.sFileSave, "wb");
3459+ FILE* pFile = NULL;
3460+ if (p.sFileSave != NULL && strlen (p.sFileSave) > 0) {
3461+ pFile = fopen (p.sFileSave, "wb");
34703462 }
34713463 memset (&param_, 0, sizeof (SEncParamExt));
34723464 encoder_->GetDefaultParams (&param_);
@@ -3502,16 +3494,16 @@ TEST_P (EncodeTestAPI, SetEncOptionSize) { · 29 unmodified lines
35023494 unsigned char* pData[3] = { NULL };
35033495 while (iIdx <= p.iNumframes) {
35043496 EncodeOneFrameRandom (0, p.bAllRandom);
3505− encToDecData(info, iLen);
3506− if( pFile ) {
3497+ encToDecData (info, iLen);
3498+ if (pFile) {
35073499 fwrite (info.sLayerInfo[0].pBsBuf, iLen, 1, pFile);
35083500 fflush (pFile);
35093501 }
3510− memset(&dstBufInfo_, 0, sizeof(SBufferInfo));
3511− if(iLen && p.bTestDecoder) {
3512− rv = decoder_->DecodeFrameNoDelay(info.sLayerInfo[0].pBsBuf, iLen, pData, &dstBufInfo_);
3513− ASSERT_EQ(rv, 0);
3514− ASSERT_EQ(dstBufInfo_.iBufferStatus, 1);
3502+ memset (&dstBufInfo_, 0, sizeof (SBufferInfo));
3503+ if (iLen && p.bTestDecoder) {
3504+ rv = decoder_->DecodeFrameNoDelay (info.sLayerInfo[0].pBsBuf, iLen, pData, &dstBufInfo_);
3505+ ASSERT_EQ (rv, 0);
3506+ ASSERT_EQ (dstBufInfo_.iBufferStatus, 1);
35153507 }
35163508 int iLayer = 0;
35173509 while (iLayer < info.iLayerNum) {
@@ -3529,7 +3521,7 @@ TEST_P (EncodeTestAPI, SetEncOptionSize) { · 11 unmodified lines
35293521 }
35303522 iIdx++;
35313523 }
3532− if( pFile ) {
3524+ if (pFile) {
35333525 fclose (pFile);
35343526 }
35353527 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t