History

Add fix for simulcast if frame rate in the middle spatial layer is smaller

Sijia Chen committed 11 years ago

Commit 82cc0531 parent f9f2bbf2 files · +23 −21Browse files

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

Unified · Split

test/api/encode_decode_api_test.cpp+16−13
@@ -3596,7 +3596,7 @@ TEST_P (EncodeTestAPI, SetEncOptionSize) { · 3595 unmodified lines
35963596
35973597
35983598 TEST_F (EncodeDecodeTestAPI, SimulcastAVCDiffFps) {
3599−//#define DEBUG_FILE_SAVE3
3599+//#define DEBUG_FILE_SAVE_SimulcastAVCDiffFps
36003600 int iSpatialLayerNum = WelsClip3 ((rand() % MAX_SPATIAL_LAYER_NUM), 2, MAX_SPATIAL_LAYER_NUM);
36013601 int iWidth = WelsClip3 ((((rand() % MAX_WIDTH) >> 1) + 1) << 1, 1 << iSpatialLayerNum, MAX_WIDTH);
36023602 int iHeight = WelsClip3 ((((rand() % MAX_HEIGHT) >> 1) + 1) << 1, 1 << iSpatialLayerNum, MAX_HEIGHT);
@@ -3608,10 +3608,7 @@ TEST_F (EncodeDecodeTestAPI, SimulcastAVCDiffFps) { · 5 unmodified lines
36083608
36093609 //set flag of bSimulcastAVC
36103610 param_.bSimulcastAVC = true;
3611− param_.iTemporalLayerNum = 3;
3612−
3613− int rv = encoder_->InitializeExt (&param_);
3614− ASSERT_TRUE (rv == cmResultSuccess);
3611+ param_.iTemporalLayerNum = (rand() % 2) ? 3 : 4;
36153612
36163613 unsigned char* pBsBuf[MAX_SPATIAL_LAYER_NUM];
36173614 int aLen[MAX_SPATIAL_LAYER_NUM] = {0};
@@ -3648,10 +3645,10 @@ TEST_F (EncodeDecodeTestAPI, SimulcastAVCDiffFps) { · 30 unmodified lines
36483645 ASSERT_EQ (0, rv);
36493646 }
36503647
3651−#define PATTERN_NUM (16)
3648+#define PATTERN_NUM (18)
36523649 const int32_t iTemporalPattern[PATTERN_NUM][MAX_SPATIAL_LAYER_NUM] = { {2, 1, 1, 1}, {2, 2, 2, 1}, {4, 1, 1, 1}, {4, 2, 1, 1},
3653− {1, 2, 1, 1}, {1, 1, 2, 1}, {1, 4, 1, 1}, {2, 4, 2, 1}, {1, 4, 2, 1},
3654− {1, 2, 2, 1}, {1, 2, 4, 1},
3650+ {1, 2, 1, 1}, {1, 1, 2, 1}, {1, 4, 1, 1}, {2, 4, 2, 1}, {1, 4, 2, 1}, {1, 4, 4, 1},
3651+ {1, 2, 2, 1}, {2, 1, 2, 1}, {1, 2, 4, 1},
36553652 {1, 1, 1, 2}, {1, 2, 2, 2}, {1, 2, 2, 4}, {1, 2, 4, 2}, {1, 4, 4, 4},
36563653 };
36573654 for (int iPatternIdx = 0; iPatternIdx < PATTERN_NUM; iPatternIdx++) {
@@ -3659,7 +3656,11 @@ TEST_F (EncodeDecodeTestAPI, SimulcastAVCDiffFps) { · 1 unmodified line
36593656 param_.sSpatialLayers[i].fFrameRate = (fFrameRate / iTemporalPattern[iPatternIdx][i]);
36603657 }
36613658
3659+ int rv = encoder_->InitializeExt (&param_);
3660+ ASSERT_TRUE (rv == cmResultSuccess);
3661+
36623662 iEncFrameNum = 10;
3663+ int iInsertIdr = rand() % iEncFrameNum;
36633664 for (int iFrame = 0; iFrame < iEncFrameNum; iFrame++) {
36643665 int iResult;
36653666 int iLayerLen = 0;
@@ -3668,7 +3669,11 @@ TEST_F (EncodeDecodeTestAPI, SimulcastAVCDiffFps) { · 2 unmodified lines
36683669 InitialEncDec (param_.iPicWidth, param_.iPicHeight);
36693670 EncodeOneFrame (0);
36703671
3671− // init
3672+ if (iInsertIdr == iFrame) {
3673+ encoder_->ForceIntraFrame (true);
3674+ }
3675+
3676+ // init aLen for the current frame
36723677 for (iIdx = 0; iIdx < iSpatialLayerNum; iIdx++) {
36733678 aLen[iIdx] = 0;
36743679 }
@@ -3700,7 +3705,7 @@ TEST_F (EncodeDecodeTestAPI, SimulcastAVCDiffFps) { · 25 unmodified lines
37003705 EXPECT_TRUE (iResult == cmResultSuccess) << "iResult=" << iResult << "LayerIdx=" << iIdx;
37013706
37023707 iResult = decoder[iIdx]->DecodeFrame2 (NULL, 0, pData, &dstBufInfo_);
3703− EXPECT_TRUE (iResult == cmResultSuccess) << "iResult=" << iResult << "LayerIdx=" << iIdx;
3708+ EXPECT_TRUE (iResult == cmResultSuccess) << "iResult=" << iResult << "LayerIdx=" << iIdx << iPatternIdx;
37043709 EXPECT_EQ (dstBufInfo_.iBufferStatus, 1) << "LayerIdx=" << iIdx;
37053710 }
37063711 }
@@ -3716,12 +3721,10 @@ TEST_F (EncodeDecodeTestAPI, SimulcastAVCDiffFps) { · 9 unmodified lines
37163721 }
37173722 }
37183723 #ifdef DEBUG_FILE_SAVE_SimulcastAVCDiffFps
3719− for (int i = 0; i <)MAX_SPATIAL_LAYER_NUM;
3720− i++) {
3724+ for (int i = 0; i < MAX_SPATIAL_LAYER_NUM; i++) {
37213725 fclose (fEnc[i]);
37223726 }
37233727 #endif
37243728 }
37253729
37263730
3727−

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