Showing the changes to test/encoder/EncUT_EncoderExt.cpp (1 of 11 files). Show all
Unified · Split
| @@ -206,9 +206,13 @@ TEST_F (EncoderInterfaceTest, EncoderAdditionalOptionSetTest) { · 205 unmodified lines | ||
| 206 | 206 | sInfo.iBitrate = rand() % 100000 - 100; |
| 207 | 207 | sInfo.iLayer = static_cast<LAYER_NUM> (pParamExt->iSpatialLayerNum); |
| 208 | 208 | iResult = pPtrEnc->SetOption (eOptionId, &sInfo); |
| 209 | + pPtrEnc->GetOption (ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, pParamExt); | |
| 209 | 210 | if (sInfo.iBitrate <= 0) |
| 210 | 211 | EXPECT_EQ (iResult, static_cast<int> (cmInitParaError)); |
| 211 | − else { | |
| 212 | + else if (pParamExt->sSpatialLayers[sInfo.iLayer].iSpatialBitrate > | |
| 213 | + pParamExt->sSpatialLayers[sInfo.iLayer].iMaxSpatialBitrate) { | |
| 214 | + EXPECT_EQ (iResult, static_cast<int> (cmInitParaError)); | |
| 215 | + } else { | |
| 212 | 216 | EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess)); |
| 213 | 217 | sReturn.iLayer = static_cast<LAYER_NUM> (pParamExt->iSpatialLayerNum); |
| 214 | 218 | iResult = pPtrEnc->GetOption (eOptionId, &sReturn); |
| @@ -224,9 +228,13 @@ TEST_F (EncoderInterfaceTest, EncoderAdditionalOptionSetTest) { · 9 unmodified lines | ||
| 224 | 228 | sInfo.iBitrate = rand() % 100000 - 100; |
| 225 | 229 | sInfo.iLayer = static_cast<LAYER_NUM> (pParamExt->iSpatialLayerNum); |
| 226 | 230 | iResult = pPtrEnc->SetOption (eOptionId, &sInfo); |
| 231 | + pPtrEnc->GetOption (ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, pParamExt); | |
| 227 | 232 | if (sInfo.iBitrate <= 0) |
| 228 | 233 | EXPECT_EQ (iResult, static_cast<int> (cmInitParaError)); |
| 229 | − else { | |
| 234 | + else if (pParamExt->sSpatialLayers[sInfo.iLayer].iSpatialBitrate > | |
| 235 | + pParamExt->sSpatialLayers[sInfo.iLayer].iMaxSpatialBitrate) { | |
| 236 | + EXPECT_EQ (iResult, static_cast<int> (cmInitParaError)); | |
| 237 | + } else { | |
| 230 | 238 | EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess)); |
| 231 | 239 | sReturn.iLayer = static_cast<LAYER_NUM> (pParamExt->iSpatialLayerNum); |
| 232 | 240 | iResult = pPtrEnc->GetOption (eOptionId, &sReturn); |
| @@ -438,6 +446,9 @@ void GetValidEncParamBase (SEncParamBase* pEncParamBase) { · 205 unmodified lines | ||
| 438 | 446 | pEncParamBase->iPicWidth = VALID_SIZE (pEncParamBase->iPicWidth); |
| 439 | 447 | pEncParamBase->iPicHeight = VALID_SIZE (pEncParamBase->iPicHeight); |
| 440 | 448 | pEncParamBase->iTargetBitrate = rand() + 1; //!=0 |
| 449 | + int32_t iLevelMaxBitrate = WelsCommon::g_ksLevelLimits[LEVEL_5_0 - 1].uiMaxBR * CpbBrNalFactor; | |
| 450 | + if (pEncParamBase->iTargetBitrate > iLevelMaxBitrate) | |
| 451 | + pEncParamBase->iTargetBitrate = iLevelMaxBitrate; | |
| 441 | 452 | pEncParamBase->iRCMode = RC_BITRATE_MODE; //-1, 0, 1, 2 |
| 442 | 453 | pEncParamBase->fMaxFrameRate = rand() + 0.5f; //!=0 |
| 443 | 454 | } |
| @@ -584,12 +595,14 @@ TEST_F (EncoderInterfaceTest, ForceIntraFrameWithTemporal) { · 140 unmodified lines | ||
| 584 | 595 | sEncParamExt.iPicWidth = MB_SIZE + abs ((rand() * 2) % (MAX_WIDTH - MB_SIZE)); |
| 585 | 596 | sEncParamExt.iPicHeight = MB_SIZE + abs ((rand() * 2) % (MAX_HEIGHT - MB_SIZE)); |
| 586 | 597 | sEncParamExt.iTargetBitrate = rand() + 1; //!=0 |
| 598 | + int32_t iLevelMaxBitrate = WelsCommon::g_ksLevelLimits[LEVEL_5_0 - 1].uiMaxBR * CpbBrNalFactor; | |
| 599 | + if (sEncParamExt.iTargetBitrate > iLevelMaxBitrate) | |
| 600 | + sEncParamExt.iTargetBitrate = iLevelMaxBitrate; | |
| 587 | 601 | sEncParamExt.iRCMode = RC_BITRATE_MODE; //-1, 0, 1, 2 |
| 588 | 602 | sEncParamExt.fMaxFrameRate = rand() + 0.5f; //!=0 |
| 589 | 603 | sEncParamExt.sSpatialLayers[0].iVideoWidth = sEncParamExt.iPicWidth; |
| 590 | 604 | sEncParamExt.sSpatialLayers[0].iVideoHeight = sEncParamExt.iPicHeight; |
| 591 | 605 | sEncParamExt.sSpatialLayers[0].iSpatialBitrate = sEncParamExt.iTargetBitrate; |
| 592 | − | |
| 593 | 606 | int iTargetTemporalLayerNum = rand() % MAX_TEMPORAL_LAYER_NUM; |
| 594 | 607 | sEncParamExt.iTemporalLayerNum = (iTargetTemporalLayerNum > 2) ? iTargetTemporalLayerNum : 2; |
| 595 | 608 | |