History

add parseoly statistics

huili2 committed 9 years ago

Commit 5cd3c5d1 parent 7f172774 files · +164 −63Browse files

Showing the changes to test/api/decode_api_test.cpp (1 of 4 files). Show all

Unified · Split

test/api/decode_api_test.cpp+73−1
@@ -970,6 +970,79 @@ TEST_F (DecodeParseAPI, ParseOnly_SpecSliceLoss) { · 969 unmodified lines
970 } //while970 } //while
971}971}
972 972
973TEST_F (DecodeParseAPI, ParseOnly_SpecStatistics) {
974 //set params
975 int32_t iLayerNum = 1;
976 int32_t iSliceNum = 1;
977 EncodeDecodeFileParamBase p;
978 const int iLoopNum = 10;
979 p.frameRate = kiFrameRate;
980 p.numframes = 2; //encode 2 frames in each test
981 p.width = iWidth_ = 16;
982 p.height = iHeight_ = 16; //default start width/height = 16, will be modified each time
983 int iTotalFrmCnt = 0;
984 for (int i = 0; i < iLoopNum; ++i) {
985 prepareParam (iLayerNum, iSliceNum, p.width, p.height, p.frameRate, &param_);
986 param_.iSpatialLayerNum = iLayerNum;
987 param_.sSpatialLayers[0].iDLayerQp = 40; //to revent size too limited to encoding fail
988 encoder_->Uninitialize();
989 int rv = encoder_->InitializeExt (&param_);
990 ASSERT_TRUE (rv == 0);
991 int32_t iTraceLevel = WELS_LOG_QUIET;
992 rv = encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);
993 ASSERT_TRUE (rv == 0);
994 rv = decoder_->SetOption (DECODER_OPTION_TRACE_LEVEL, &iTraceLevel);
995 ASSERT_TRUE (rv == 0);
996 //Start for enc
997 int iLen = 0;
998 ASSERT_TRUE (prepareEncDecParam (p));
999 int iFrame = 0;
1000 while (iFrame < p.numframes) {
1001 EncodeOneFrame (0);
1002 encToDecData (info, iLen);
1003 iFrame++;
1004 iTotalFrmCnt++;
1005 rv = decoder_->DecodeParser (info.sLayerInfo[0].pBsBuf, iLen, &BsInfo_);
1006 ASSERT_TRUE (rv == 0);
1007 ASSERT_TRUE (BsInfo_.iNalNum == 0);
1008 rv = decoder_->DecodeParser (NULL, 0, &BsInfo_);
1009 ASSERT_TRUE (rv == 0);
1010 ASSERT_TRUE (BsInfo_.iNalNum != 0);
1011 SDecoderStatistics sDecStat;
1012 rv = decoder_->GetOption (DECODER_OPTION_GET_STATISTICS, &sDecStat);
1013 ASSERT_TRUE (rv == 0);
1014 uint32_t uiProfile, uiLevel;
1015 rv = decoder_->GetOption (DECODER_OPTION_PROFILE, &uiProfile);
1016 ASSERT_TRUE (rv == 0);
1017 rv = decoder_->GetOption (DECODER_OPTION_LEVEL, &uiLevel);
1018 ASSERT_TRUE (rv == 0);
1019
1020 ASSERT_EQ (sDecStat.uiWidth, p.width);
1021 ASSERT_EQ (sDecStat.uiHeight, p.height);
1022 ASSERT_EQ (sDecStat.uiResolutionChangeTimes, (i + 1));
1023 EXPECT_EQ (sDecStat.iCurrentActiveSpsId, 0);
1024 EXPECT_EQ (sDecStat.iCurrentActivePpsId, 0);
1025 ASSERT_EQ (sDecStat.uiDecodedFrameCount, iTotalFrmCnt);
1026 ASSERT_EQ (sDecStat.uiProfile, uiProfile);
1027 ASSERT_EQ (sDecStat.uiLevel, uiLevel);
1028 EXPECT_TRUE (sDecStat.fActualAverageFrameSpeedInMs != 0.);
1029 EXPECT_TRUE (sDecStat.fAverageFrameSpeedInMs != 0.);
1030 EXPECT_TRUE (sDecStat.iAvgLumaQp != 0);
1031 EXPECT_EQ (sDecStat.uiIDRCorrectNum, (i + 1));
1032 }
1033 //set next width & height
1034 p.width += 16;
1035 p.height += 16;
1036 if ((unsigned int) p.width > kiWidth) //exceeds max frame size
1037 p.width = 16;
1038 if ((unsigned int) p.height > kiHeight)
1039 p.height = 16;
1040 iWidth_ = p.width;
1041 iHeight_ = p.height;
1042 }
1043}
1044
1045
973//Test parseonly crash cases1046//Test parseonly crash cases
974class DecodeParseCrashAPI : public DecodeParseAPI {1047class DecodeParseCrashAPI : public DecodeParseAPI {
975 public:1048 public:
@@ -1163,4 +1236,3 @@ TEST_F (DecodeParseCrashAPI, ParseOnlyCrash_General) { · 187 unmodified lines
1163 1236
1164}1237}
1165 1238
1166

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t