MCPcopy Create free account
hub / github.com/cisco/openh264 / TEST_F

Function TEST_F

test/api/encode_options_test.cpp:299–346  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

297}
298
299TEST_F (EncodeDecodeTestAPI, SetOptionEncParamExt) {
300 int iSpatialLayerNum = 4;
301 int iWidth = WelsClip3 ((((rand() % MAX_WIDTH) >> 1) + 1) << 1, 1 << iSpatialLayerNum, MAX_WIDTH);
302 int iHeight = WelsClip3 ((((rand() % MAX_HEIGHT) >> 1) + 1) << 1, 1 << iSpatialLayerNum, MAX_HEIGHT);
303 float fFrameRate = rand() + 0.5f;
304 int iEncFrameNum = WelsClip3 ((rand() % ENCODE_FRAME_NUM) + 1, 1, ENCODE_FRAME_NUM);
305 int iSliceNum = 1;
306 encoder_->GetDefaultParams (&param_);
307 prepareParamDefault (iSpatialLayerNum, iSliceNum, iWidth, iHeight, fFrameRate, &param_);
308
309 int rv = encoder_->InitializeExt (&param_);
310 ASSERT_TRUE (rv == cmResultSuccess);
311
312 int iTraceLevel = WELS_LOG_QUIET;
313 rv = encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);
314 ASSERT_TRUE (rv == cmResultSuccess);
315
316 for (int i = 0; i < iEncFrameNum; i++) {
317 int iResult;
318 int len = 0;
319 unsigned char* pData[3] = { NULL };
320
321 RandomParamExtCombination();
322 iResult = encoder_->SetOption (ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, &param_);
323 //ValidateParamExtCombination();
324 //ASSERT_TRUE (iResult == cmResultSuccess);
325 //to do
326 // currently, there are still some error cases even though under condition cmResultSuccess == iResult
327 // so need to enhance the validation check for any random value of each variable in ParamExt
328
329 if (cmResultSuccess == iResult) {
330 ASSERT_TRUE (InitialEncDec (param_.iPicWidth, param_.iPicHeight));
331 EncodeOneFrame (0);
332 encToDecData (info, len);
333 pData[0] = pData[1] = pData[2] = 0;
334 memset (&dstBufInfo_, 0, sizeof (SBufferInfo));
335
336 iResult = decoder_->DecodeFrame2 (info.sLayerInfo[0].pBsBuf, len, pData, &dstBufInfo_);
337 ASSERT_TRUE (iResult == cmResultSuccess);
338 iResult = decoder_->DecodeFrame2 (NULL, 0, pData, &dstBufInfo_);
339 ASSERT_TRUE (iResult == cmResultSuccess);
340 EXPECT_EQ (dstBufInfo_.iBufferStatus, 1);
341 }
342 }
343
344 iTraceLevel = WELS_LOG_ERROR;
345 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);
346}
347
348
349TEST_F (EncodeDecodeTestAPI, SetOptionEncParamBase) {

Callers

nothing calls this directly

Calls 15

WelsClip3Function · 0.85
WelsCreateDecoderFunction · 0.85
WelsDestroyDecoderFunction · 0.85
CheckLevelLimitationFunction · 0.85
beginMethod · 0.80
dataMethod · 0.80
GetDefaultParamsMethod · 0.45
InitializeExtMethod · 0.45
SetOptionMethod · 0.45
DecodeFrame2Method · 0.45
ForceIntraFrameMethod · 0.45
UninitializeMethod · 0.45

Tested by

no test coverage detected