| 297 | } |
| 298 | |
| 299 | TEST_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 (¶m_); |
| 307 | prepareParamDefault (iSpatialLayerNum, iSliceNum, iWidth, iHeight, fFrameRate, ¶m_); |
| 308 | |
| 309 | int rv = encoder_->InitializeExt (¶m_); |
| 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, ¶m_); |
| 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 | |
| 349 | TEST_F (EncodeDecodeTestAPI, SetOptionEncParamBase) { |
nothing calls this directly
no test coverage detected