Showing the changes to test/api/encode_decode_api_test.cpp (1 of 2 files). Show all
Unified · Split
| @@ -3596,7 +3596,7 @@ TEST_P (EncodeTestAPI, SetEncOptionSize) { · 3595 unmodified lines | |||
| 3596 | 3596 | ||
| 3597 | 3597 | ||
| 3598 | TEST_F (EncodeDecodeTestAPI, SimulcastAVCDiffFps) { | 3598 | TEST_F (EncodeDecodeTestAPI, SimulcastAVCDiffFps) { |
| 3599 | //#define DEBUG_FILE_SAVE3 | 3599 | //#define DEBUG_FILE_SAVE_SimulcastAVCDiffFps |
| 3600 | int iSpatialLayerNum = WelsClip3 ((rand() % MAX_SPATIAL_LAYER_NUM), 2, MAX_SPATIAL_LAYER_NUM); | 3600 | int iSpatialLayerNum = WelsClip3 ((rand() % MAX_SPATIAL_LAYER_NUM), 2, MAX_SPATIAL_LAYER_NUM); |
| 3601 | int iWidth = WelsClip3 ((((rand() % MAX_WIDTH) >> 1) + 1) << 1, 1 << iSpatialLayerNum, MAX_WIDTH); | 3601 | int iWidth = WelsClip3 ((((rand() % MAX_WIDTH) >> 1) + 1) << 1, 1 << iSpatialLayerNum, MAX_WIDTH); |
| 3602 | int iHeight = WelsClip3 ((((rand() % MAX_HEIGHT) >> 1) + 1) << 1, 1 << iSpatialLayerNum, MAX_HEIGHT); | 3602 | int iHeight = WelsClip3 ((((rand() % MAX_HEIGHT) >> 1) + 1) << 1, 1 << iSpatialLayerNum, MAX_HEIGHT); |
| @@ -3608,10 +3608,7 @@ TEST_F (EncodeDecodeTestAPI, SimulcastAVCDiffFps) { · 5 unmodified lines | |||
| 3608 | 3608 | ||
| 3609 | //set flag of bSimulcastAVC | 3609 | //set flag of bSimulcastAVC |
| 3610 | param_.bSimulcastAVC = true; | 3610 | param_.bSimulcastAVC = true; |
| 3611 | param_.iTemporalLayerNum = 3; | 3611 | param_.iTemporalLayerNum = (rand() % 2) ? 3 : 4; |
| 3612 | |||
| 3613 | int rv = encoder_->InitializeExt (¶m_); | ||
| 3614 | ASSERT_TRUE (rv == cmResultSuccess); | ||
| 3615 | 3612 | ||
| 3616 | unsigned char* pBsBuf[MAX_SPATIAL_LAYER_NUM]; | 3613 | unsigned char* pBsBuf[MAX_SPATIAL_LAYER_NUM]; |
| 3617 | int aLen[MAX_SPATIAL_LAYER_NUM] = {0}; | 3614 | int aLen[MAX_SPATIAL_LAYER_NUM] = {0}; |
| @@ -3648,10 +3645,10 @@ TEST_F (EncodeDecodeTestAPI, SimulcastAVCDiffFps) { · 30 unmodified lines | |||
| 3648 | ASSERT_EQ (0, rv); | 3645 | ASSERT_EQ (0, rv); |
| 3649 | } | 3646 | } |
| 3650 | 3647 | ||
| 3651 | #define PATTERN_NUM (16) | 3648 | #define PATTERN_NUM (18) |
| 3652 | 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}, | 3649 | 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}, | 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}, |
| 3654 | {1, 2, 2, 1}, {1, 2, 4, 1}, | 3651 | {1, 2, 2, 1}, {2, 1, 2, 1}, {1, 2, 4, 1}, |
| 3655 | {1, 1, 1, 2}, {1, 2, 2, 2}, {1, 2, 2, 4}, {1, 2, 4, 2}, {1, 4, 4, 4}, | 3652 | {1, 1, 1, 2}, {1, 2, 2, 2}, {1, 2, 2, 4}, {1, 2, 4, 2}, {1, 4, 4, 4}, |
| 3656 | }; | 3653 | }; |
| 3657 | for (int iPatternIdx = 0; iPatternIdx < PATTERN_NUM; iPatternIdx++) { | 3654 | for (int iPatternIdx = 0; iPatternIdx < PATTERN_NUM; iPatternIdx++) { |
| @@ -3659,7 +3656,11 @@ TEST_F (EncodeDecodeTestAPI, SimulcastAVCDiffFps) { · 1 unmodified line | |||
| 3659 | param_.sSpatialLayers[i].fFrameRate = (fFrameRate / iTemporalPattern[iPatternIdx][i]); | 3656 | param_.sSpatialLayers[i].fFrameRate = (fFrameRate / iTemporalPattern[iPatternIdx][i]); |
| 3660 | } | 3657 | } |
| 3661 | 3658 | ||
| 3659 | int rv = encoder_->InitializeExt (¶m_); | ||
| 3660 | ASSERT_TRUE (rv == cmResultSuccess); | ||
| 3661 | |||
| 3662 | iEncFrameNum = 10; | 3662 | iEncFrameNum = 10; |
| 3663 | int iInsertIdr = rand() % iEncFrameNum; | ||
| 3663 | for (int iFrame = 0; iFrame < iEncFrameNum; iFrame++) { | 3664 | for (int iFrame = 0; iFrame < iEncFrameNum; iFrame++) { |
| 3664 | int iResult; | 3665 | int iResult; |
| 3665 | int iLayerLen = 0; | 3666 | int iLayerLen = 0; |
| @@ -3668,7 +3669,11 @@ TEST_F (EncodeDecodeTestAPI, SimulcastAVCDiffFps) { · 2 unmodified lines | |||
| 3668 | InitialEncDec (param_.iPicWidth, param_.iPicHeight); | 3669 | InitialEncDec (param_.iPicWidth, param_.iPicHeight); |
| 3669 | EncodeOneFrame (0); | 3670 | EncodeOneFrame (0); |
| 3670 | 3671 | ||
| 3671 | // init | 3672 | if (iInsertIdr == iFrame) { |
| 3673 | encoder_->ForceIntraFrame (true); | ||
| 3674 | } | ||
| 3675 | |||
| 3676 | // init aLen for the current frame | ||
| 3672 | for (iIdx = 0; iIdx < iSpatialLayerNum; iIdx++) { | 3677 | for (iIdx = 0; iIdx < iSpatialLayerNum; iIdx++) { |
| 3673 | aLen[iIdx] = 0; | 3678 | aLen[iIdx] = 0; |
| 3674 | } | 3679 | } |
| @@ -3700,7 +3705,7 @@ TEST_F (EncodeDecodeTestAPI, SimulcastAVCDiffFps) { · 25 unmodified lines | |||
| 3700 | EXPECT_TRUE (iResult == cmResultSuccess) << "iResult=" << iResult << "LayerIdx=" << iIdx; | 3705 | EXPECT_TRUE (iResult == cmResultSuccess) << "iResult=" << iResult << "LayerIdx=" << iIdx; |
| 3701 | 3706 | ||
| 3702 | iResult = decoder[iIdx]->DecodeFrame2 (NULL, 0, pData, &dstBufInfo_); | 3707 | 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; |
| 3704 | EXPECT_EQ (dstBufInfo_.iBufferStatus, 1) << "LayerIdx=" << iIdx; | 3709 | EXPECT_EQ (dstBufInfo_.iBufferStatus, 1) << "LayerIdx=" << iIdx; |
| 3705 | } | 3710 | } |
| 3706 | } | 3711 | } |
| @@ -3716,12 +3721,10 @@ TEST_F (EncodeDecodeTestAPI, SimulcastAVCDiffFps) { · 9 unmodified lines | |||
| 3716 | } | 3721 | } |
| 3717 | } | 3722 | } |
| 3718 | #ifdef DEBUG_FILE_SAVE_SimulcastAVCDiffFps | 3723 | #ifdef DEBUG_FILE_SAVE_SimulcastAVCDiffFps |
| 3719 | for (int i = 0; i <)MAX_SPATIAL_LAYER_NUM; | 3724 | for (int i = 0; i < MAX_SPATIAL_LAYER_NUM; i++) { |
| 3720 | i++) { | ||
| 3721 | fclose (fEnc[i]); | 3725 | fclose (fEnc[i]); |
| 3722 | } | 3726 | } |
| 3723 | #endif | 3727 | #endif |
| 3724 | } | 3728 | } |
| 3725 | 3729 | ||
| 3726 | 3730 | ||
| 3727 | |||