History

make SetOption():ENCODER_OPTION_SVC_ENCODE_PARAM_BASE work correclty

Karina committed 9 years ago

Commit c01ed5b1 parent fea27ca2 files · +57 −7Browse 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+45−1
@@ -34,7 +34,6 @@ void EncodeDecodeTestAPIBase::InitialEncDec (int iWidth, int iHeight) { · 33 unmodified lines
34 //set a fixed random value34 //set a fixed random value
35 iRandValue = rand() % 256;35 iRandValue = rand() % 256;
36}36}
37
38void EncodeDecodeTestAPIBase::RandomParamExtCombination() {37void EncodeDecodeTestAPIBase::RandomParamExtCombination() {
39 38
40 param_.iPicWidth = WelsClip3 ((((rand() % MAX_WIDTH) >> 1) + 1) << 1, 2, MAX_WIDTH);39 param_.iPicWidth = WelsClip3 ((((rand() % MAX_WIDTH) >> 1) + 1) << 1, 2, MAX_WIDTH);
@@ -340,6 +339,51 @@ TEST_F (EncodeDecodeTestAPI, SetOptionEncParamExt) { · 299 unmodified lines
340 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);339 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);
341}340}
342 341
342
343TEST_F (EncodeDecodeTestAPI, SetOptionEncParamBase) {
344 int iSpatialLayerNum = 4;
345 int iWidth = WelsClip3 ((((rand() % MAX_WIDTH) >> 1) + 1) << 1, 1 << iSpatialLayerNum, MAX_WIDTH);
346 int iHeight = WelsClip3 ((((rand() % MAX_HEIGHT) >> 1) + 1) << 1, 1 << iSpatialLayerNum, MAX_HEIGHT);
347 float fFrameRate = rand() + 0.5f;
348 int iEncFrameNum = WelsClip3 ((rand() % ENCODE_FRAME_NUM) + 1, 1, ENCODE_FRAME_NUM);
349 int iSliceNum = 1;
350 encoder_->GetDefaultParams (&param_);
351 prepareParamDefault (iSpatialLayerNum, iSliceNum, iWidth, iHeight, fFrameRate, &param_);
352
353 int rv = encoder_->InitializeExt (&param_);
354 ASSERT_TRUE (rv == cmResultSuccess);
355
356 int iTraceLevel = WELS_LOG_QUIET;
357 rv = encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);
358 ASSERT_TRUE (rv == cmResultSuccess);
359
360 for (int i = 0; i < iEncFrameNum; i++) {
361 int iResult;
362 int len = 0;
363 unsigned char* pData[3] = { NULL };
364
365 param_.iTargetBitrate = rand() % BIT_RATE_RANGE;
366 iResult = encoder_->SetOption (ENCODER_OPTION_SVC_ENCODE_PARAM_BASE, &param_);
367
368 if (cmResultSuccess == iResult) {
369 InitialEncDec (param_.iPicWidth, param_.iPicHeight);
370 EncodeOneFrame (0);
371 encToDecData (info, len);
372 pData[0] = pData[1] = pData[2] = 0;
373 memset (&dstBufInfo_, 0, sizeof (SBufferInfo));
374
375 iResult = decoder_->DecodeFrame2 (info.sLayerInfo[0].pBsBuf, len, pData, &dstBufInfo_);
376 ASSERT_TRUE (iResult == cmResultSuccess);
377 iResult = decoder_->DecodeFrame2 (NULL, 0, pData, &dstBufInfo_);
378 ASSERT_TRUE (iResult == cmResultSuccess);
379 EXPECT_EQ (dstBufInfo_.iBufferStatus, 1);
380 }
381 }
382
383 iTraceLevel = WELS_LOG_ERROR;
384 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);
385}
386
343struct EncodeDecodeParamBase {387struct EncodeDecodeParamBase {
344 int width;388 int width;
345 int height;389 int height;

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