Showing the changes to test/encoder/EncUT_EncoderExt.cpp (1 of 1 file). Show all
Unified · Split
| @@ -174,7 +174,7 @@ TEST_F (EncoderInterfaceTest, EncoderAdditionalOptionSetTest) { · 173 unmodified lines | |||
| 174 | iResult = pPtrEnc->GetOption (eOptionId, &iReturn); | 174 | iResult = pPtrEnc->GetOption (eOptionId, &iReturn); |
| 175 | EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess)); | 175 | EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess)); |
| 176 | EXPECT_EQ (iValue, iReturn); | 176 | EXPECT_EQ (iValue, iReturn); |
| 177 | 177 | ||
| 178 | PrepareOneSrcFrame(); | 178 | PrepareOneSrcFrame(); |
| 179 | iResult = pPtrEnc->EncodeFrame (pSrcPic, &sFbi); | 179 | iResult = pPtrEnc->EncodeFrame (pSrcPic, &sFbi); |
| 180 | EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess)); | 180 | EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess)); |
| @@ -188,7 +188,7 @@ TEST_F (EncoderInterfaceTest, EncoderAdditionalOptionSetTest) { · 7 unmodified lines | |||
| 188 | EXPECT_EQ (iResult, static_cast<int> (cmInitParaError)); | 188 | EXPECT_EQ (iResult, static_cast<int> (cmInitParaError)); |
| 189 | else{ | 189 | else{ |
| 190 | EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess)); | 190 | EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess)); |
| 191 | 191 | ||
| 192 | iResult = pPtrEnc->GetOption (eOptionId, &fReturn); | 192 | iResult = pPtrEnc->GetOption (eOptionId, &fReturn); |
| 193 | EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess)); | 193 | EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess)); |
| 194 | EXPECT_EQ (WELS_CLIP3 (fValue, 1, 30), fReturn); | 194 | EXPECT_EQ (WELS_CLIP3 (fValue, 1, 30), fReturn); |
| @@ -248,19 +248,20 @@ TEST_F (EncoderInterfaceTest, EncoderAdditionalOptionSetTest) { · 53 unmodified lines | |||
| 248 | 248 | ||
| 249 | TEST_F (EncoderInterfaceTest, TemporalLayerSettingTest) { | 249 | TEST_F (EncoderInterfaceTest, TemporalLayerSettingTest) { |
| 250 | 250 | ||
| 251 | pParamExt->iPicWidth = m_iWidth; | 251 | pParamExt->iPicWidth = 1280; |
| 252 | pParamExt->iPicHeight = m_iHeight; | 252 | pParamExt->iPicHeight = 720; |
| 253 | m_iWidth = pParamExt->iPicWidth; | ||
| 254 | m_iHeight = pParamExt->iPicHeight; | ||
| 253 | pParamExt->iTargetBitrate = 60000; | 255 | pParamExt->iTargetBitrate = 60000; |
| 254 | pParamExt->sSpatialLayers[0].iVideoHeight = pParamExt->iPicHeight; | 256 | pParamExt->sSpatialLayers[0].iVideoHeight = pParamExt->iPicHeight; |
| 255 | pParamExt->sSpatialLayers[0].iVideoWidth = pParamExt->iPicWidth; | 257 | pParamExt->sSpatialLayers[0].iVideoWidth = pParamExt->iPicWidth; |
| 256 | pParamExt->sSpatialLayers[0].iSpatialBitrate = 50000; | 258 | pParamExt->sSpatialLayers[0].iSpatialBitrate = 50000; |
| 257 | pParamExt->iTemporalLayerNum = 1; | 259 | pParamExt->iTemporalLayerNum = 1; |
| 258 | pParamExt->iSpatialLayerNum = 1; | 260 | pParamExt->iSpatialLayerNum = 1; |
| 259 | int iResult; | ||
| 260 | 261 | ||
| 261 | for(int i = 0; i < 2; i++){ | 262 | for(int i = 0; i < 2; i++){ |
| 262 | pParamExt->iUsageType = (( i == 0 ) ? SCREEN_CONTENT_REAL_TIME : CAMERA_VIDEO_REAL_TIME); | 263 | pParamExt->iUsageType = (( i == 0 ) ? SCREEN_CONTENT_REAL_TIME : CAMERA_VIDEO_REAL_TIME); |
| 263 | iResult = pPtrEnc->InitializeExt (pParamExt); | 264 | int iResult = pPtrEnc->InitializeExt (pParamExt); |
| 264 | EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess)); | 265 | EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess)); |
| 265 | 266 | ||
| 266 | PrepareOneSrcFrame(); | 267 | PrepareOneSrcFrame(); |
| @@ -307,6 +308,46 @@ TEST_F (EncoderInterfaceTest, TemporalLayerSettingTest) { · 40 unmodified lines | |||
| 307 | EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess)); | 308 | EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess)); |
| 308 | } | 309 | } |
| 309 | 310 | ||
| 311 | InitializeParamExt(); | ||
| 312 | pParamExt->iUsageType = (rand() % 2) ? SCREEN_CONTENT_REAL_TIME : CAMERA_VIDEO_REAL_TIME; | ||
| 313 | pParamExt->iRCMode = (rand() % 2) ? RC_BITRATE_MODE : RC_QUALITY_MODE; | ||
| 314 | |||
| 315 | int iResult = pPtrEnc->InitializeExt (pParamExt); | ||
| 316 | const int kiFrameNumber = TEST_FRAMES; | ||
| 317 | |||
| 318 | m_iWidth = pParamExt->iPicWidth; | ||
| 319 | m_iHeight = pParamExt->iPicHeight; | ||
| 320 | m_iPicResSize = m_iWidth * m_iHeight * 3 >> 1; | ||
| 321 | delete []pYUV; | ||
| 322 | pYUV = new unsigned char [m_iPicResSize]; | ||
| 323 | ASSERT_TRUE (pYUV != NULL); | ||
| 324 | PrepareOneSrcFrame(); | ||
| 325 | |||
| 326 | ENCODER_OPTION eOptionId = ENCODER_OPTION_SVC_ENCODE_PARAM_EXT; | ||
| 327 | memcpy (pOption, pParamExt, sizeof (SEncParamExt)); | ||
| 328 | |||
| 329 | for(int i = 0; i < kiFrameNumber; i ++){ | ||
| 330 | if ((i%7) == 0){ | ||
| 331 | if (pOption->iTemporalLayerNum<4){ | ||
| 332 | pOption->iTemporalLayerNum++; | ||
| 333 | } else { | ||
| 334 | pOption->iTemporalLayerNum--; | ||
| 335 | } | ||
| 336 | iResult = pPtrEnc->SetOption (eOptionId, pOption); | ||
| 337 | EXPECT_EQ (iResult, static_cast<int32_t> (cmResultSuccess)); | ||
| 338 | pSrcPic->uiTimeStamp += 30; | ||
| 339 | } | ||
| 340 | |||
| 341 | int iStartX = rand() % (m_iPicResSize >> 1); | ||
| 342 | int iEndX = (iStartX + (rand() % MEM_VARY_SIZE)) % m_iPicResSize; | ||
| 343 | for (int j = iStartX; j < iEndX; j++) | ||
| 344 | pYUV[j] = rand() % 256; | ||
| 345 | |||
| 346 | iResult = pPtrEnc->EncodeFrame (pSrcPic, &sFbi); | ||
| 347 | EXPECT_EQ (iResult, static_cast<int32_t> (cmResultSuccess)); | ||
| 348 | pSrcPic->uiTimeStamp += 30; | ||
| 349 | } | ||
| 350 | |||
| 310 | iResult = pPtrEnc->Uninitialize(); | 351 | iResult = pPtrEnc->Uninitialize(); |
| 311 | EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess)); | 352 | EXPECT_EQ (iResult, static_cast<int> (cmResultSuccess)); |
| 312 | 353 | ||