History

adjust output order in log for readability add UT and log

sijchen@cisco.com committed 8 years ago

Commit f42cbac1 parent cd1991a2 files · +98 −19Browse files

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

Unified · Split

test/api/encode_options_test.cpp+76−5
@@ -1957,8 +1957,8 @@ TEST_F (EncodeDecodeTestAPI, ProfileLevelSetting) { · 1956 unmodified lines
1957 sParam.iEntropyCodingModeFlag = rand() % 2;1957 sParam.iEntropyCodingModeFlag = rand() % 2;
1958 sParam.sSpatialLayers[0].iSpatialBitrate = sParam.iTargetBitrate = 3000;1958 sParam.sSpatialLayers[0].iSpatialBitrate = sParam.iTargetBitrate = 3000;
1959 1959
1960 int TraceLevel = WELS_LOG_DEBUG;1960// int TraceLevel = WELS_LOG_DEBUG;
1961 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &TraceLevel);1961// encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &TraceLevel);
1962 //decoder_->SetOption (DECODER_OPTION_TRACE_LEVEL, &TraceLevel);1962 //decoder_->SetOption (DECODER_OPTION_TRACE_LEVEL, &TraceLevel);
1963 iEncProfileIdc = profileList[rand() % 11];1963 iEncProfileIdc = profileList[rand() % 11];
1964 iEncLevelIdc = levelList[rand() % 18];1964 iEncLevelIdc = levelList[rand() % 18];
@@ -1980,7 +1980,7 @@ TEST_F (EncodeDecodeTestAPI, ProfileLevelSetting) { · 15 unmodified lines
1980 }1980 }
1981 1981
1982 ASSERT_TRUE (iDecProfileIdc == iEncProfileIdc) << "enc_profile = " << iEncProfileIdc << " dec_profile = " <<1982 ASSERT_TRUE (iDecProfileIdc == iEncProfileIdc) << "enc_profile = " << iEncProfileIdc << " dec_profile = " <<
1983 iDecProfileIdc;1983 iDecProfileIdc;
1984 1984
1985 //check whether the level is changed according to level limitation1985 //check whether the level is changed according to level limitation
1986 ELevelIdc uiLevel = LEVEL_UNKNOWN;1986 ELevelIdc uiLevel = LEVEL_UNKNOWN;
@@ -2213,8 +2213,8 @@ TEST_F (EncodeDecodeTestAPI, TemporalLayerChangeDuringEncoding) { · 226 unmodified lines
2213 prepareParamDefault (1, iSliceNum, iWidth, iHeight, fFrameRate, &sParam);2213 prepareParamDefault (1, iSliceNum, iWidth, iHeight, fFrameRate, &sParam);
2214 sParam.iTemporalLayerNum = 2;2214 sParam.iTemporalLayerNum = 2;
2215 2215
2216 //int TraceLevel = WELS_LOG_DEBUG;2216// int TraceLevel = WELS_LOG_DEBUG;
2217 //encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &TraceLevel);2217// encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &TraceLevel);
2218 iRet = encoder_->InitializeExt (&sParam);2218 iRet = encoder_->InitializeExt (&sParam);
2219 ASSERT_TRUE (iRet == cmResultSuccess) << "InitializeExt: iRet = " << iRet << " at " << sParam.iPicWidth << "x" <<2219 ASSERT_TRUE (iRet == cmResultSuccess) << "InitializeExt: iRet = " << iRet << " at " << sParam.iPicWidth << "x" <<
2220 sParam.iPicHeight;2220 sParam.iPicHeight;
@@ -2261,3 +2261,74 @@ TEST_F (EncodeDecodeTestAPI, TemporalLayerChangeDuringEncoding) { · 40 unmodified lines
2261 ASSERT_TRUE (iRet == cmResultSuccess) << "rv = " << iRet;2261 ASSERT_TRUE (iRet == cmResultSuccess) << "rv = " << iRet;
2262 2262
2263}2263}
2264
2265TEST_F (EncodeDecodeTestAPI, TemporalLayerChangeDuringEncoding_Specific) {
2266 int iWidth = 320;
2267 int iHeight = 192;
2268 float fFrameRate = 15;
2269 int iSliceNum = 1;
2270 int iRet = 0;
2271 int iTotalFrame = (rand() % 20) + 3;
2272 int iFrameNum = 0;
2273 SEncParamExt sParam;
2274 encoder_->GetDefaultParams (&sParam);
2275 prepareParamDefault (1, iSliceNum, iWidth, iHeight, fFrameRate, &sParam);
2276
2277 int originalTemporalLayerNum = 1;
2278 int originalBR = 500000;
2279 float originalFR = 7.5;
2280 int iSteps[3] = {2, 1, 3};
2281 int iStepIdx = 0;
2282 bool bSetOption = false;
2283
2284 sParam.iTemporalLayerNum = originalTemporalLayerNum;
2285 sParam.iNumRefFrame = 1;
2286
2287 int TraceLevel = WELS_LOG_INFO;
2288 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &TraceLevel);
2289 iRet = encoder_->InitializeExt (&sParam);
2290 ASSERT_TRUE (iRet == cmResultSuccess) << "InitializeExt: iRet = " << iRet << " at " << sParam.iPicWidth << "x" <<
2291 sParam.iPicHeight;
2292
2293 ASSERT_TRUE (InitialEncDec (iWidth, iHeight));
2294
2295 int frameSize = EncPic.iPicWidth * EncPic.iPicHeight * 3 / 2;
2296 do {
2297 FileInputStream fileStream;
2298 ASSERT_TRUE (fileStream.Open ("res/CiscoVT2people_320x192_12fps.yuv"));
2299
2300 while (fileStream.read (buf_.data(), frameSize) == frameSize) {
2301
2302 if ( (iStepIdx < 3) && (iFrameNum == ((iTotalFrame / 3) * (iStepIdx + 1)))) {
2303 sParam.iTemporalLayerNum = originalTemporalLayerNum * iSteps[iStepIdx];
2304 sParam.iTargetBitrate = sParam.sSpatialLayers[0].iSpatialBitrate = originalBR * iSteps[iStepIdx];
2305 sParam.fMaxFrameRate = sParam.sSpatialLayers[0].fFrameRate = originalFR * pow (2, iSteps[iStepIdx]);
2306 encoder_->SetOption (ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, &sParam);
2307
2308 bSetOption = true;
2309 iStepIdx += 1;
2310 }
2311
2312 iRet = encoder_->EncodeFrame (&EncPic, &info);
2313 EXPECT_TRUE (iRet == cmResultSuccess) << "rv = " << iRet;
2314
2315 if (bSetOption) {
2316 if ((iStepIdx == 1) || (iStepIdx == 3)) {
2317 EXPECT_TRUE (info.eFrameType == videoFrameTypeIDR) << "iStepIdx=" << iStepIdx << "iFrameNum=" << iFrameNum << "iTotalFrame=" << iTotalFrame;
2318 } else {
2319 EXPECT_TRUE (info.eFrameType != videoFrameTypeIDR) << "iStepIdx=" << iStepIdx << "iFrameNum=" << iFrameNum << "iTotalFrame=" << iTotalFrame;
2320 }
2321
2322 bSetOption = false;
2323 }
2324
2325
2326 }
2327 iFrameNum++;
2328 } while (iFrameNum < iTotalFrame);
2329
2330 iRet = encoder_->Uninitialize();
2331 ASSERT_TRUE (iRet == cmResultSuccess) << "rv = " << iRet;
2332
2333}
2334

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