| 473 | } |
| 474 | |
| 475 | void GetValidEncParamBase (SEncParamBase* pEncParamBase) { |
| 476 | pEncParamBase->iUsageType = CAMERA_VIDEO_REAL_TIME; |
| 477 | pEncParamBase->iPicWidth = 2 + ((rand() % ((MAX_WIDTH >> 1) - 1)) << 1); |
| 478 | pEncParamBase->iPicHeight = 2 + ((rand() % ((MAX_HEIGHT >> 1) - 1)) << 1); |
| 479 | pEncParamBase->iPicWidth = VALID_SIZE (pEncParamBase->iPicWidth); |
| 480 | pEncParamBase->iPicHeight = VALID_SIZE (pEncParamBase->iPicHeight); |
| 481 | pEncParamBase->iTargetBitrate = rand() + 1; //!=0 |
| 482 | // Force a bitrate of at least w*h/50, otherwise we will only get skipped frames |
| 483 | pEncParamBase->iTargetBitrate = WELS_CLIP3 (pEncParamBase->iTargetBitrate, |
| 484 | pEncParamBase->iPicWidth * pEncParamBase->iPicHeight / 50, 60000000); |
| 485 | int32_t iLevelMaxBitrate = WelsCommon::g_ksLevelLimits[LEVEL_NUMBER - 1].uiMaxBR * CpbBrNalFactor; |
| 486 | if (pEncParamBase->iTargetBitrate > iLevelMaxBitrate) |
| 487 | pEncParamBase->iTargetBitrate = iLevelMaxBitrate; |
| 488 | pEncParamBase->iRCMode = RC_BITRATE_MODE; //-1, 0, 1, 2 |
| 489 | pEncParamBase->fMaxFrameRate = rand() + 0.5f; //!=0 |
| 490 | } |
| 491 | |
| 492 | TEST_F (EncoderInterfaceTest, BasicInitializeTest) { |
| 493 | SEncParamBase sEncParamBase; |