ref: 91bbd18d2e32ce30df0b840668de165bff31aba4
parent: e286144524775a83fc785d4c4b899622f2337a05
parent: 65439007477c33b974c447601728888d8f22047e
author: ruil2 <[email protected]>
date: Sat Jul 26 06:23:59 EDT 2014
Merge pull request #1222 from mstorsjo/fix-test-valid-size Don't set iPicWidth or iPicHeight to 0 in random tests
--- a/test/encoder/EncUT_EncoderExt.cpp
+++ b/test/encoder/EncUT_EncoderExt.cpp
@@ -316,8 +316,8 @@
void GetValidEncParamBase (SEncParamBase* pEncParamBase) {
pEncParamBase->iUsageType = CAMERA_VIDEO_REAL_TIME;
- pEncParamBase->iPicWidth = ((rand() * 2) % (MAX_WIDTH));
- pEncParamBase->iPicHeight = ((rand() * 2) % (MAX_HEIGHT));
+ pEncParamBase->iPicWidth = 2 + ((rand() * 2) % (MAX_WIDTH - 2));
+ pEncParamBase->iPicHeight = 2 + ((rand() * 2) % (MAX_HEIGHT - 2));
pEncParamBase->iPicWidth = VALID_SIZE(pEncParamBase->iPicWidth);
pEncParamBase->iPicHeight = VALID_SIZE(pEncParamBase->iPicHeight);
pEncParamBase->iTargetBitrate = rand() + 1; //!=0
@@ -470,8 +470,8 @@
SEncParamExt sEncParamExt;
pPtrEnc->GetDefaultParams (&sEncParamExt);
sEncParamExt.iUsageType = CAMERA_VIDEO_REAL_TIME;
- sEncParamExt.iPicWidth = abs ((rand() * 2) + MB_SIZE) % (MAX_WIDTH + 1);
- sEncParamExt.iPicHeight = abs ((rand() * 2) + MB_SIZE) % (MAX_HEIGHT + 1);
+ sEncParamExt.iPicWidth = MB_SIZE + abs ((rand() * 2) % (MAX_WIDTH - MB_SIZE));
+ sEncParamExt.iPicHeight = MB_SIZE + abs ((rand() * 2) % (MAX_HEIGHT - MB_SIZE));
sEncParamExt.iTargetBitrate = rand() + 1; //!=0
sEncParamExt.iRCMode = RC_BITRATE_MODE; //-1, 0, 1, 2
sEncParamExt.fMaxFrameRate = rand() + 0.5f; //!=0
@@ -550,4 +550,4 @@
TEST_F (EncoderInterfaceTest, BasicReturnTypeTest) {
//TODO
-}
\ No newline at end of file
+}