Squashed commit of the following:
commit2dbb757d30Merge:34cb0d66a2a4efAuthor: ruil2 <ruil2@cisco.com> Date: Fri Oct 24 15:18:55 2014 +0800 Merge pull request #1451 from sijchen/for_format Fixes and change naming commit34cb0d60aaMerge:468fce0f0c6891Author: sijchen <sijchen@cisco.com> Date: Fri Oct 24 14:41:51 2014 +0800 Merge pull request #1450 from mstorsjo/avoid-warnings Add casts to avoid warnings about comparison between signed and unsigned commit6a2a4efef6Author: Sijia Chen <sijchen@cisco.com> Date: Fri Oct 24 14:39:50 2014 +0800 fix names to keep consistent of style improve UT to cover more cases under GetStatistics commitea9b80adb3Author: Sijia Chen <sijchen@cisco.com> Date: Fri Oct 24 14:12:53 2014 +0800 fix a wrong range clip commit468fce0887Merge:ac290d650fd617Author: sijchen <sijchen@cisco.com> Date: Fri Oct 24 14:12:40 2014 +0800 Merge pull request #1448 from sijchen/for_format roll back the file which is mis-formatted by astyle commitf0c6891627Author: Martin Storsjö <martin@martin.st> Date: Fri Oct 24 09:05:32 2014 +0300 Add casts to avoid warnings about comparison between signed and unsigned commit50fd617e86Author: Sijia Chen <sijchen@cisco.com> Date: Fri Oct 24 13:04:35 2014 +0800 roll back the file which is mis-formatted by astyle commitac290d65c7Merge:dcdcc7f3cce92eAuthor: ruil2 <ruil2@cisco.com> Date: Fri Oct 24 12:50:07 2014 +0800 Merge pull request #1446 from sijchen/for_format [Encoder] fix a small range of slice idx
This commit is contained in:
@@ -64,6 +64,7 @@ class EncoderInterfaceTest : public ::testing::Test {
|
||||
void EncodeOneFrame (SEncParamBase* pEncParamBase);
|
||||
void PrepareOneSrcFrame();
|
||||
void EncodeOneIDRandP (ISVCEncoder* pPtrEnc);
|
||||
void ChangeResolutionAndCheckStatistics (const SEncParamBase& sEncParamBase, SEncoderStatistics* pEncoderStatistics);
|
||||
|
||||
public:
|
||||
ISVCEncoder* pPtrEnc;
|
||||
@@ -662,6 +663,46 @@ TEST_F (EncoderInterfaceTest, BasicReturnTypeTest) {
|
||||
//TODO
|
||||
}
|
||||
|
||||
void EncoderInterfaceTest::ChangeResolutionAndCheckStatistics (const SEncParamBase& sEncParamBase,
|
||||
SEncoderStatistics* pEncoderStatistics) {
|
||||
unsigned int uiExistingFrameCount = pEncoderStatistics->uiInputFrameCount;
|
||||
unsigned int uiExistingIDR = pEncoderStatistics->uiIDRSentNum;
|
||||
unsigned int uiExistingResolutionChange = pEncoderStatistics->uiResolutionChangeTimes;
|
||||
|
||||
// 1, get the existing param
|
||||
int iResult = pPtrEnc->GetOption (ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, pParamExt);
|
||||
EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));
|
||||
|
||||
// 2, change setting
|
||||
unsigned int uiKnownResolutionChangeTimes = uiExistingResolutionChange;
|
||||
bool bCheckIDR = false;
|
||||
if (pParamExt->iPicWidth != sEncParamBase.iPicWidth || pParamExt->iPicHeight != sEncParamBase.iPicHeight) {
|
||||
uiKnownResolutionChangeTimes += 1;
|
||||
bCheckIDR = true;
|
||||
}
|
||||
pParamExt->iPicWidth = pParamExt->sSpatialLayers[0].iVideoWidth = sEncParamBase.iPicWidth;
|
||||
pParamExt->iPicHeight = pParamExt->sSpatialLayers[0].iVideoHeight = sEncParamBase.iPicHeight;
|
||||
pPtrEnc->SetOption (ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, pParamExt);
|
||||
EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));
|
||||
|
||||
// 3, code one frame
|
||||
PrepareOneSrcFrame();
|
||||
iResult = pPtrEnc->EncodeFrame (pSrcPic, &sFbi);
|
||||
EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));
|
||||
iResult = pPtrEnc->GetOption (ENCODER_OPTION_GET_STATISTICS, pEncoderStatistics);
|
||||
EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));
|
||||
|
||||
EXPECT_EQ (pEncoderStatistics->uiInputFrameCount, uiExistingFrameCount + 1);
|
||||
EXPECT_EQ (pEncoderStatistics->uiResolutionChangeTimes, uiKnownResolutionChangeTimes);
|
||||
if (bCheckIDR) {
|
||||
EXPECT_EQ (pEncoderStatistics->uiIDRSentNum, uiExistingIDR + 1);
|
||||
}
|
||||
|
||||
EXPECT_EQ (pEncoderStatistics->uiWidth, static_cast<unsigned int> (sEncParamBase.iPicWidth));
|
||||
EXPECT_EQ (pEncoderStatistics->uiHeight, static_cast<unsigned int> (sEncParamBase.iPicHeight));
|
||||
}
|
||||
|
||||
|
||||
TEST_F (EncoderInterfaceTest, GetStatistics) {
|
||||
SEncParamBase sEncParamBase;
|
||||
GetValidEncParamBase (&sEncParamBase);
|
||||
@@ -682,41 +723,20 @@ TEST_F (EncoderInterfaceTest, GetStatistics) {
|
||||
iResult = pPtrEnc->GetOption (ENCODER_OPTION_GET_STATISTICS, &sEncoderStatistics);
|
||||
EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));
|
||||
EXPECT_EQ (sEncoderStatistics.uiInputFrameCount, static_cast<unsigned int> (2));
|
||||
EXPECT_EQ (sEncoderStatistics.uIDRSentNum, static_cast<unsigned int> (1));
|
||||
EXPECT_EQ (sEncoderStatistics.uiIDRSentNum, static_cast<unsigned int> (1));
|
||||
EXPECT_EQ (sEncoderStatistics.uiResolutionChangeTimes, static_cast<unsigned int> (0));
|
||||
|
||||
EXPECT_EQ (sEncoderStatistics.uWidth, static_cast<unsigned int> (sEncParamBase.iPicWidth));
|
||||
EXPECT_EQ (sEncoderStatistics.uHeight, static_cast<unsigned int> (sEncParamBase.iPicHeight));
|
||||
EXPECT_EQ (sEncoderStatistics.uiWidth, static_cast<unsigned int> (sEncParamBase.iPicWidth));
|
||||
EXPECT_EQ (sEncoderStatistics.uiHeight, static_cast<unsigned int> (sEncParamBase.iPicHeight));
|
||||
|
||||
// try param change
|
||||
// 1, get the existing
|
||||
pPtrEnc->GetOption (ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, pParamExt);
|
||||
EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));
|
||||
|
||||
// 2, change the reoslution
|
||||
GetValidEncParamBase (&sEncParamBase);
|
||||
int32_t knownResolutionChangeTimes = 0;
|
||||
if (pParamExt->iPicWidth != sEncParamBase.iPicWidth || pParamExt->iPicHeight != sEncParamBase.iPicHeight) {
|
||||
knownResolutionChangeTimes = 1;
|
||||
}
|
||||
pParamExt->iPicWidth = pParamExt->sSpatialLayers[0].iVideoWidth = sEncParamBase.iPicWidth;
|
||||
pParamExt->iPicHeight = pParamExt->sSpatialLayers[0].iVideoHeight = sEncParamBase.iPicHeight;
|
||||
pPtrEnc->SetOption (ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, pParamExt);
|
||||
EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));
|
||||
ChangeResolutionAndCheckStatistics (sEncParamBase, &sEncoderStatistics);
|
||||
|
||||
// 3, code one frame
|
||||
PrepareOneSrcFrame();
|
||||
iResult = pPtrEnc->EncodeFrame (pSrcPic, &sFbi);
|
||||
EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));
|
||||
iResult = pPtrEnc->GetOption (ENCODER_OPTION_GET_STATISTICS, &sEncoderStatistics);
|
||||
EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess));
|
||||
|
||||
EXPECT_EQ (sEncoderStatistics.uiInputFrameCount, static_cast<unsigned int> (3));
|
||||
EXPECT_EQ (sEncoderStatistics.uIDRSentNum, static_cast<unsigned int> (2));
|
||||
EXPECT_EQ (sEncoderStatistics.uiResolutionChangeTimes, static_cast<unsigned int> (knownResolutionChangeTimes));
|
||||
|
||||
EXPECT_EQ (sEncoderStatistics.uWidth, static_cast<unsigned int> (sEncParamBase.iPicWidth));
|
||||
EXPECT_EQ (sEncoderStatistics.uHeight, static_cast<unsigned int> (sEncParamBase.iPicHeight));
|
||||
GetValidEncParamBase (&sEncParamBase);
|
||||
sEncParamBase.iPicWidth = (sEncParamBase.iPicWidth % 16) + 1; //try 1~16
|
||||
sEncParamBase.iPicHeight = (sEncParamBase.iPicHeight % 16) + 1; //try 1~16
|
||||
ChangeResolutionAndCheckStatistics (sEncParamBase, &sEncoderStatistics);
|
||||
|
||||
// 4, change log interval
|
||||
int32_t iInterval = 0;
|
||||
|
||||
Reference in New Issue
Block a user