History

set option for ParamExt----random cases

huashi committed 12 years ago

Commit 26615ff1 parent 292d2511 file · +387 −64Browse files

Showing the changes to test/api/encode_decode_api_test.cpp (1 of 1 file). Show all

Unified · Split

test/api/encode_decode_api_test.cpp+387−64
@@ -9,6 +9,34 @@ · 8 unmodified lines
9#include <vector>9#include <vector>
10using namespace WelsCommon;10using namespace WelsCommon;
11 11
12#define TRY_TIME_RANGE (10)
13#define ENCODE_FRAME_NUM (30)
14#define LEVEL_ID_RANGE (18)
15#define MAX_WIDTH (4096)
16#define MAX_HEIGHT (2304)
17#define MAX_FRAME_RATE (30)
18#define MIN_FRAME_RATE (1)
19#define FRAME_RATE_RANGE (2*MAX_FRAME_RATE)
20#define RC_MODE_RANGE (4)
21#define BIT_RATE_RANGE (10000)
22#define MAX_QP (51)
23#define MIN_QP (0)
24#define QP_RANGE (2*MAX_QP)
25#define SPATIAL_LAYER_NUM_RANGE (2*MAX_SPATIAL_LAYER_NUM)
26#define TEMPORAL_LAYER_NUM_RANGE (2*MAX_TEMPORAL_LAYER_NUM)
27#define SAVED_NALUNIT_NUM ( (MAX_SPATIAL_LAYER_NUM*MAX_QUALITY_LAYER_NUM) + 1 + MAX_SPATIAL_LAYER_NUM )
28#define MAX_SLICES_NUM ( ( MAX_NAL_UNITS_IN_LAYER - SAVED_NALUNIT_NUM ) / 3 )
29#define SLICE_MODE_NUM (6)
30#define LOOP_FILTER_IDC_NUM (3)
31#define LOOF_FILTER_OFFSET_RANGE (6)
32#define MAX_REF_PIC_COUNT (16)
33#define MIN_REF_PIC_COUNT (1)
34#define LONG_TERM_REF_NUM (2)
35#define LONG_TERM_REF_NUM_SCREEN (4)
36#define MAX_REFERENCE_PICTURE_COUNT_NUM_CAMERA (6)
37#define MAX_REFERENCE_PICTURE_COUNT_NUM_SCREEN (8)
38
39
12typedef struct SLost_Sim {40typedef struct SLost_Sim {
13 WelsCommon::EWelsNalUnitType eNalType;41 WelsCommon::EWelsNalUnitType eNalType;
14 bool isLost;42 bool isLost;
@@ -122,33 +150,43 @@ class EncodeDecodeTestAPI : public EncodeDecodeTestBase { · 107 unmodified lines
122 EncodeDecodeTestBase::prepareParam (iLayers, iSlices, width, height, framerate);150 EncodeDecodeTestBase::prepareParam (iLayers, iSlices, width, height, framerate);
123 }151 }
124 152
125 void prepareEncDecParam (const EncodeDecodeFileParamBase EncDecFileParam);153 void InitialEncDec (int iWidth, int iHeight);
126 void EncodeOneFrame() {154 void RandomParamExtCombination();
155 void ValidateParamExtCombination();
156 void SliceParamValidationForMode2 (int iSpatialIdx);
157 void SliceParamValidationForMode3 (int iSpatialIdx);
158 void SliceParamValidationForMode4();
159
160 void EncodeOneFrame (int iCheckTypeIndex) {
127 int frameSize = EncPic.iPicWidth * EncPic.iPicHeight * 3 / 2;161 int frameSize = EncPic.iPicWidth * EncPic.iPicHeight * 3 / 2;
128 memset (buf_.data(), iRandValue, (frameSize >> 2));162 memset (buf_.data(), iRandValue, (frameSize >> 2));
129 memset (buf_.data() + (frameSize >> 2), rand() % 256, (frameSize - (frameSize >> 2)));163 memset (buf_.data() + (frameSize >> 2), rand() % 256, (frameSize - (frameSize >> 2)));
130 int rv = encoder_->EncodeFrame (&EncPic, &info);164 int rv = encoder_->EncodeFrame (&EncPic, &info);
131 ASSERT_TRUE (rv == cmResultSuccess || rv == cmUnkonwReason);165 if (0 == iCheckTypeIndex)
166 ASSERT_TRUE (rv == cmResultSuccess);
167 else if (1 == iCheckTypeIndex)
168 ASSERT_TRUE (rv == cmResultSuccess || rv == cmUnkonwReason);
132 }169 }
133};170};
134 171
135void EncodeDecodeTestAPI::prepareEncDecParam (const EncodeDecodeFileParamBase EncDecFileParam) {172void EncodeDecodeTestAPI::InitialEncDec (int iWidth, int iHeight) {
173
136 // for encoder174 // for encoder
137 // I420: 1(Y) + 1/4(U) + 1/4(V)175 // I420: 1(Y) + 1/4(U) + 1/4(V)
138 int frameSize = EncDecFileParam.width * EncDecFileParam.height * 3 / 2;176 int frameSize = iWidth * iHeight * 3 / 2;
139 177
140 buf_.SetLength (frameSize);178 buf_.SetLength (frameSize);
141 ASSERT_TRUE (buf_.Length() == (size_t)frameSize);179 ASSERT_TRUE (buf_.Length() == (size_t)frameSize);
142 180
143 memset (&EncPic, 0, sizeof (SSourcePicture));181 memset (&EncPic, 0, sizeof (SSourcePicture));
144 EncPic.iPicWidth = EncDecFileParam.width;182 EncPic.iPicWidth = iWidth;
145 EncPic.iPicHeight = EncDecFileParam.height;183 EncPic.iPicHeight = iHeight;
146 EncPic.iColorFormat = videoFormatI420;184 EncPic.iColorFormat = videoFormatI420;
147 EncPic.iStride[0] = EncPic.iPicWidth;185 EncPic.iStride[0] = EncPic.iPicWidth;
148 EncPic.iStride[1] = EncPic.iStride[2] = EncPic.iPicWidth >> 1;186 EncPic.iStride[1] = EncPic.iStride[2] = EncPic.iPicWidth >> 1;
149 EncPic.pData[0] = buf_.data();187 EncPic.pData[0] = buf_.data();
150 EncPic.pData[1] = EncPic.pData[0] + EncDecFileParam.width * EncDecFileParam.height;188 EncPic.pData[1] = EncPic.pData[0] + iWidth * iHeight;
151 EncPic.pData[2] = EncPic.pData[1] + (EncDecFileParam.width * EncDecFileParam.height >> 2);189 EncPic.pData[2] = EncPic.pData[1] + (iWidth * iHeight >> 2);
152 190
153 //for decoder191 //for decoder
154 memset (&info, 0, sizeof (SFrameBSInfo));192 memset (&info, 0, sizeof (SFrameBSInfo));
@@ -157,6 +195,245 @@ void EncodeDecodeTestAPI::prepareEncDecParam (const EncodeDecodeFileParamBase En · 2 unmodified lines
157 iRandValue = rand() % 256;195 iRandValue = rand() % 256;
158}196}
159 197
198void EncodeDecodeTestAPI::RandomParamExtCombination() {
199
200 param_.iPicWidth = WELS_CLIP3 ((((rand() % MAX_WIDTH) >> 1) + 1) << 1, 2, MAX_WIDTH);
201 param_.iPicHeight = WELS_CLIP3 ((((rand() % MAX_HEIGHT) >> 1) + 1) << 1, 2, MAX_HEIGHT);
202
203 param_.fMaxFrameRate = rand() % FRAME_RATE_RANGE + 0.5f;
204 param_.iUsageType = static_cast<EUsageType> (rand() % 2);
205 param_.iTemporalLayerNum = rand() % TEMPORAL_LAYER_NUM_RANGE;
206 param_.iSpatialLayerNum = rand() % SPATIAL_LAYER_NUM_RANGE;
207
208 param_.uiIntraPeriod = rand() - 1;
209 param_.iNumRefFrame = rand();
210 param_.iMultipleThreadIdc = rand();
211
212 param_.bEnableSpsPpsIdAddition = (rand() % 2 == 0) ? false : true;
213 param_.bPrefixNalAddingCtrl = (rand() % 2 == 0) ? false : true;
214 param_.bEnableSSEI = (rand() % 2 == 0) ? false : true;
215 param_.iPaddingFlag = rand() % 2;
216
217 //LTR
218 param_.bEnableLongTermReference = (rand() % 2 == 0) ? false : true;
219 param_.bIsLosslessLink = (rand() % 2 == 0) ? false : true;
220 param_.iLTRRefNum = rand();
221 param_.iLtrMarkPeriod = rand();
222
223 //loop filter
224 param_.iLoopFilterDisableIdc = rand();
225 param_.iLoopFilterAlphaC0Offset = rand();
226 param_.iLoopFilterBetaOffset = rand();
227
228 param_.bEnableDenoise = (rand() % 2 == 0) ? false : true;
229 param_.bEnableBackgroundDetection = (rand() % 2 == 0) ? false : true;
230 param_.bEnableAdaptiveQuant = (rand() % 2 == 0) ? false : true;
231 param_.bEnableFrameCroppingFlag = (rand() % 2 == 0) ? false : true;
232 param_.bEnableSceneChangeDetect = (rand() % 2 == 0) ? false : true;
233
234//for rc
235 param_.iRCMode = static_cast<RC_MODES> (rand() % RC_MODE_RANGE - 1);
236 param_.iMaxBitrate = rand() % BIT_RATE_RANGE;
237 param_.iTargetBitrate = rand() % BIT_RATE_RANGE;
238 param_.iMaxQp = rand() % QP_RANGE;
239 param_.iMinQp = rand() % QP_RANGE;
240 param_.uiMaxNalSize = rand();
241 param_.bEnableFrameSkip = (rand() % 2 == 0) ? false : true;
242
243 for (int iSpatialIdx = 0; iSpatialIdx < param_.iSpatialLayerNum; iSpatialIdx++) {
244 if (iSpatialIdx < MAX_SPATIAL_LAYER_NUM) {
245 SSpatialLayerConfig* pSpatialLayer = &param_.sSpatialLayers[iSpatialIdx];
246
247 //to do: profile and level id
248 //pSpatialLayer->uiProfileIdc = 0;
249 //pSpatialLayer->uiLevelIdc = 0;
250 pSpatialLayer->iVideoWidth = WELS_CLIP3 ((((rand() % MAX_WIDTH) >> 1) + 1) << 1, 2, MAX_WIDTH);
251 pSpatialLayer->iVideoHeight = WELS_CLIP3 ((((rand() % MAX_HEIGHT) >> 1) + 1) << 1, 2, MAX_HEIGHT);
252 pSpatialLayer->fFrameRate = rand() % FRAME_RATE_RANGE + 0.5f;
253 pSpatialLayer->iMaxSpatialBitrate = rand() % BIT_RATE_RANGE;
254 pSpatialLayer->iSpatialBitrate = rand() % BIT_RATE_RANGE;
255
256
257 pSpatialLayer->sSliceCfg.uiSliceMode = static_cast<SliceModeEnum> (rand() % SLICE_MODE_NUM);
258 pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum = rand();
259 pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = rand();
260 }
261 }
262}
263
264void EncodeDecodeTestAPI::ValidateParamExtCombination() {
265
266 bool bDynSliceModeFlag = false;
267 unsigned int uiGOPSize = 0;
268 unsigned int uiSliceNum = 0;
269 int iTotalBitRate = 0;
270 int iMinQP = 0;
271
272 param_.iPicWidth = WELS_CLIP3 (param_.iPicWidth, 2, MAX_WIDTH);
273 param_.iPicHeight = WELS_CLIP3 (param_.iPicHeight, 2, MAX_HEIGHT);
274 param_.fMaxFrameRate = WELS_CLIP3 (param_.fMaxFrameRate, MIN_FRAME_RATE, MAX_FRAME_RATE);
275 param_.iTemporalLayerNum = WELS_CLIP3 (param_.iTemporalLayerNum, 1, MAX_TEMPORAL_LAYER_NUM);
276
277 if (CAMERA_VIDEO_REAL_TIME == param_.iUsageType)
278 param_.iSpatialLayerNum = WELS_CLIP3 (param_.iSpatialLayerNum, 1, MAX_SPATIAL_LAYER_NUM);
279 else
280 param_.iSpatialLayerNum = 1;
281
282 //IntraPeriod
283 uiGOPSize = 1 << (param_.iTemporalLayerNum - 1);
284 param_.uiIntraPeriod -= param_.uiIntraPeriod % uiGOPSize;
285 if (param_.uiIntraPeriod < 0) {
286 param_.uiIntraPeriod = 0;
287 }
288
289//RefNum
290 int32_t iRefUpperBound = (param_.iUsageType == CAMERA_VIDEO_REAL_TIME) ?
291 MAX_REFERENCE_PICTURE_COUNT_NUM_CAMERA : MAX_REFERENCE_PICTURE_COUNT_NUM_SCREEN;
292 param_.iNumRefFrame = WELS_CLIP3 (param_.iNumRefFrame, MIN_REF_PIC_COUNT, iRefUpperBound);
293
294 //to do: will add more validate logic for thread number
295 param_.iMultipleThreadIdc = 1;
296
297 //LTR
298 //iLTRRefNum: not supported to set it arbitrary yet
299 if (true == param_.bEnableLongTermReference) {
300 param_.iLTRRefNum = (SCREEN_CONTENT_REAL_TIME == param_.iUsageType) ? LONG_TERM_REF_NUM_SCREEN : LONG_TERM_REF_NUM;
301 param_.iLtrMarkPeriod = (0 == param_.iLtrMarkPeriod) ? 1 : param_.iLtrMarkPeriod;
302
303 } else {
304 param_.iLTRRefNum = 0;
305 }
306
307 //loop filter
308 param_.iLoopFilterDisableIdc = param_.iLoopFilterDisableIdc % LOOP_FILTER_IDC_NUM;
309 param_.iLoopFilterAlphaC0Offset = param_.iLoopFilterAlphaC0Offset % (2 * LOOF_FILTER_OFFSET_RANGE + 1) -
310 LOOF_FILTER_OFFSET_RANGE;
311 param_.iLoopFilterBetaOffset = param_.iLoopFilterBetaOffset % (2 * LOOF_FILTER_OFFSET_RANGE + 1) -
312 LOOF_FILTER_OFFSET_RANGE;
313
314 for (int iSpatialIdx = 0; iSpatialIdx < param_.iSpatialLayerNum; iSpatialIdx++) {
315 SSpatialLayerConfig* pSpatialLayer = &param_.sSpatialLayers[iSpatialIdx];
316 pSpatialLayer->iVideoWidth = param_.iPicWidth >> (param_.iSpatialLayerNum - 1 - iSpatialIdx);
317 pSpatialLayer->iVideoHeight = param_.iPicHeight >> (param_.iSpatialLayerNum - 1 - iSpatialIdx);
318 pSpatialLayer->fFrameRate = param_.fMaxFrameRate;
319
320 pSpatialLayer->iMaxSpatialBitrate = WELS_CLIP3 (pSpatialLayer->iMaxSpatialBitrate, 1, BIT_RATE_RANGE);
321 pSpatialLayer->iSpatialBitrate = WELS_CLIP3 (pSpatialLayer->iSpatialBitrate, 1, pSpatialLayer->iMaxSpatialBitrate);
322 iTotalBitRate += pSpatialLayer->iSpatialBitrate;
323
324 uiSliceNum = pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum;
325 pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum = WELS_CLIP3 (uiSliceNum, 1, MAX_SLICES_NUM);
326 pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = 0;
327
328
329 //for SM_FIXEDSLCNUM_SLICE
330 // to do will add this when GOM bug fixed
331 if (SM_FIXEDSLCNUM_SLICE == pSpatialLayer->sSliceCfg.uiSliceMode) {
332 pSpatialLayer->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
333 }
334
335 //for slice mode = SM_DYN_SLICE
336 if (SM_DYN_SLICE == pSpatialLayer->sSliceCfg.uiSliceMode) {
337 bDynSliceModeFlag = true;
338 }
339
340 //for slice mode = SM_RASTER_SLICE
341 if (SM_RASTER_SLICE == pSpatialLayer->sSliceCfg.uiSliceMode) {
342 SliceParamValidationForMode2 (iSpatialIdx);
343 }
344 //for slice mode = SM_ROWMB_SLICE
345 if (SM_ROWMB_SLICE == pSpatialLayer->sSliceCfg.uiSliceMode) {
346 SliceParamValidationForMode3 (iSpatialIdx);
347 }
348
349 }
350
351 //for RC
352 if ((RC_QUALITY_MODE == param_.iRCMode) || (RC_BITRATE_MODE == param_.iRCMode)) {
353 param_.bEnableFrameSkip = true;
354 }
355 if (param_.iTargetBitrate < iTotalBitRate) {
356 param_.iTargetBitrate = iTotalBitRate;
357 }
358 if (param_.iMaxBitrate < param_.iTargetBitrate) {
359 param_.iMaxBitrate = param_.iTargetBitrate;
360 }
361 param_.iMaxQp = WELS_CLIP3 (param_.iMaxQp, MIN_QP, MAX_QP);
362 param_.iMinQp = WELS_CLIP3 (param_.iMinQp, MIN_QP, MAX_QP);
363 iMinQP = (param_.iMaxQp < param_.iMinQp) ? param_.iMaxQp : param_.iMinQp;
364 param_.iMaxQp = (param_.iMaxQp > param_.iMinQp) ? param_.iMaxQp : param_.iMinQp;
365 param_.iMinQp = iMinQP;
366 param_.uiMaxNalSize = 0;
367
368 //for slice mode = SM_DYN_SLICE
369 if (true == bDynSliceModeFlag) {
370 SliceParamValidationForMode4();
371 }
372
373}
374
375
376void EncodeDecodeTestAPI::SliceParamValidationForMode2 (int iSpatialIdx) {
377
378 unsigned int uiMbWidth = 0;
379 unsigned int uiMbHeight = 0;
380 unsigned int uiMbNumInFrame = 0;
381 unsigned int uiCountMb = 0;
382 unsigned int uiSliceIdx = 0;
383 unsigned int uiActualSliceCount = 0;
384
385 uiMbWidth = (param_.iPicWidth + 15) >> 4;
386 uiMbHeight = (param_.iPicHeight + 15) >> 4;
387 uiMbNumInFrame = uiMbWidth * uiMbHeight;
388
389 uiSliceIdx = 0;
390 while (uiSliceIdx < MAX_SLICES_NUM) {
391 param_.sSpatialLayers[iSpatialIdx].sSliceCfg.sSliceArgument.uiSliceMbNum[uiSliceIdx] = rand() % uiMbNumInFrame;
392 uiCountMb += param_.sSpatialLayers[iSpatialIdx].sSliceCfg.sSliceArgument.uiSliceMbNum[uiSliceIdx];
393 uiActualSliceCount = uiSliceIdx + 1;
394
395 if (uiCountMb >= uiMbNumInFrame) {
396 break;
397 }
398
399 ++ uiSliceIdx;
400 }
401
402 if (uiCountMb >= uiMbNumInFrame) {
403 param_.sSpatialLayers[iSpatialIdx].sSliceCfg.sSliceArgument.uiSliceMbNum[uiActualSliceCount - 1] -=
404 (uiCountMb - uiMbNumInFrame);
405
406 } else {
407 param_.sSpatialLayers[iSpatialIdx].sSliceCfg.sSliceArgument.uiSliceMbNum[uiActualSliceCount - 1 ] +=
408 (uiMbNumInFrame - uiCountMb);
409 }
410 param_.sSpatialLayers[iSpatialIdx].sSliceCfg.sSliceArgument.uiSliceNum = uiActualSliceCount;
411
412}
413void EncodeDecodeTestAPI::SliceParamValidationForMode3 (int iSpatialIdx) {
414
415 unsigned int uiMbWidth = 0;
416 unsigned int uiMbHeight = 0;
417 unsigned int uiMbNumInFrame = 0;
418
419 uiMbWidth = (param_.iPicWidth + 15) >> 4;
420 uiMbHeight = (param_.iPicHeight + 15) >> 4;
421
422 //change slice mode to SM_SINGLE_SLICE
423 if (uiMbHeight > MAX_SLICES_NUM) {
424 param_.sSpatialLayers[iSpatialIdx].sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
425 }
426
427}
428
429void EncodeDecodeTestAPI::SliceParamValidationForMode4() {
430 //slice mode of all spatial layer should be set as SM_DYN_SLICE
431 for (int iSpatialIdx = 0; iSpatialIdx < param_.iSpatialLayerNum; iSpatialIdx++) {
432 param_.sSpatialLayers[iSpatialIdx].sSliceCfg.sSliceArgument.uiSliceSizeConstraint = 600;
433 param_.sSpatialLayers[iSpatialIdx].sSliceCfg.uiSliceMode = SM_DYN_SLICE;
434 }
435 param_.uiMaxNalSize = 1500;
436}
160 437
161static const EncodeDecodeFileParamBase kFileParamArray[] = {438static const EncodeDecodeFileParamBase kFileParamArray[] = {
162 {300, 160, 96, 6.0f, 2, 1, "000000000000001010101010101010101010101001101010100000010101000011"},439 {300, 160, 96, 6.0f, 2, 1, "000000000000001010101010101010101010101001101010100000010101000011"},
@@ -175,12 +452,12 @@ TEST_P (EncodeDecodeTestAPI, DecoderVclNal) { · 12 unmodified lines
175 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);452 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);
176 decoder_->SetOption (DECODER_OPTION_TRACE_LEVEL, &iTraceLevel);453 decoder_->SetOption (DECODER_OPTION_TRACE_LEVEL, &iTraceLevel);
177 454
178 prepareEncDecParam (p);455 InitialEncDec (p.width, p.height);
179 456
180 int iIdx = 0;457 int iIdx = 0;
181 while (iIdx <= p.numframes) {458 while (iIdx <= p.numframes) {
182 459
183 EncodeOneFrame();460 EncodeOneFrame (0);
184 461
185 //decoding after each encoding frame462 //decoding after each encoding frame
186 int vclNal, len = 0;463 int vclNal, len = 0;
@@ -211,13 +488,13 @@ TEST_P (EncodeDecodeTestAPI, GetOptionFramenum) { · 24 unmodified lines
211 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);488 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);
212 decoder_->SetOption (DECODER_OPTION_TRACE_LEVEL, &iTraceLevel);489 decoder_->SetOption (DECODER_OPTION_TRACE_LEVEL, &iTraceLevel);
213 490
214 prepareEncDecParam (p);491 InitialEncDec (p.width, p.height);
215 492
216 int32_t iEncFrameNum = -1;493 int32_t iEncFrameNum = -1;
217 int32_t iDecFrameNum;494 int32_t iDecFrameNum;
218 int iIdx = 0;495 int iIdx = 0;
219 while (iIdx <= p.numframes) {496 while (iIdx <= p.numframes) {
220 EncodeOneFrame();497 EncodeOneFrame (0);
221 //decoding after each encoding frame498 //decoding after each encoding frame
222 int len = 0;499 int len = 0;
223 encToDecData (info, len);500 encToDecData (info, len);
@@ -250,7 +527,7 @@ TEST_P (EncodeDecodeTestAPI, GetOptionIDR) { · 26 unmodified lines
250 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);527 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);
251 decoder_->SetOption (DECODER_OPTION_TRACE_LEVEL, &iTraceLevel);528 decoder_->SetOption (DECODER_OPTION_TRACE_LEVEL, &iTraceLevel);
252 529
253 prepareEncDecParam (p);530 InitialEncDec (p.width, p.height);
254 531
255 int32_t iEncCurIdrPicId = 0;532 int32_t iEncCurIdrPicId = 0;
256 int32_t iDecCurIdrPicId;533 int32_t iDecCurIdrPicId;
@@ -263,7 +540,7 @@ TEST_P (EncodeDecodeTestAPI, GetOptionIDR) { · 6 unmodified lines
263 encoder_->SetOption (ENCODER_OPTION_IDR_INTERVAL, &iIDRPeriod);540 encoder_->SetOption (ENCODER_OPTION_IDR_INTERVAL, &iIDRPeriod);
264 encoder_->SetOption (ENCODER_OPTION_ENABLE_SPS_PPS_ID_ADDITION, &iSpsPpsIdAddition);541 encoder_->SetOption (ENCODER_OPTION_ENABLE_SPS_PPS_ID_ADDITION, &iSpsPpsIdAddition);
265 542
266 EncodeOneFrame();543 EncodeOneFrame (0);
267 544
268 if (info.eFrameType == videoFrameTypeIDR) {545 if (info.eFrameType == videoFrameTypeIDR) {
269 iEncCurIdrPicId = (iSpsPpsIdAddition == 0) ? 0 : (iEncCurIdrPicId + 1);546 iEncCurIdrPicId = (iSpsPpsIdAddition == 0) ? 0 : (iEncCurIdrPicId + 1);
@@ -485,7 +762,7 @@ TEST_P (EncodeDecodeTestAPI, GetOptionLTR_ALLIDR) { · 215 unmodified lines
485 int rv = encoder_->InitializeExt (&param_);762 int rv = encoder_->InitializeExt (&param_);
486 ASSERT_TRUE (rv == cmResultSuccess);763 ASSERT_TRUE (rv == cmResultSuccess);
487 764
488 prepareEncDecParam (p);765 InitialEncDec (p.width, p.height);
489 766
490 int32_t iTraceLevel = WELS_LOG_QUIET;767 int32_t iTraceLevel = WELS_LOG_QUIET;
491 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);768 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);
@@ -502,7 +779,7 @@ TEST_P (EncodeDecodeTestAPI, GetOptionLTR_ALLIDR) { · 10 unmodified lines
502 encoder_->SetOption (ENCODER_LTR_MARKING_PERIOD, &iLtrPeriod);779 encoder_->SetOption (ENCODER_LTR_MARKING_PERIOD, &iLtrPeriod);
503 int iIdx = 0;780 int iIdx = 0;
504 while (iIdx <= p.numframes) {781 while (iIdx <= p.numframes) {
505 EncodeOneFrame();782 EncodeOneFrame (0);
506 ASSERT_TRUE (info.eFrameType == videoFrameTypeIDR);783 ASSERT_TRUE (info.eFrameType == videoFrameTypeIDR);
507 encoder_->ForceIntraFrame (true);784 encoder_->ForceIntraFrame (true);
508 iIdx++;785 iIdx++;
@@ -578,7 +855,7 @@ TEST_P (EncodeDecodeTestAPI, GetOptionLTR_Engine) { · 69 unmodified lines
578 ASSERT_TRUE (rv == cmResultSuccess);855 ASSERT_TRUE (rv == cmResultSuccess);
579 m_LTR_Recover_Request.uiFeedbackType = NO_RECOVERY_REQUSET;856 m_LTR_Recover_Request.uiFeedbackType = NO_RECOVERY_REQUSET;
580 857
581 prepareEncDecParam (p);858 InitialEncDec (p.width, p.height);
582 859
583 int32_t iTraceLevel = WELS_LOG_QUIET;860 int32_t iTraceLevel = WELS_LOG_QUIET;
584 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);861 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);
@@ -597,7 +874,7 @@ TEST_P (EncodeDecodeTestAPI, GetOptionLTR_Engine) { · 12 unmodified lines
597 int iLossIdx = 0;874 int iLossIdx = 0;
598 bool bVCLLoss = false;875 bool bVCLLoss = false;
599 while (iIdx <= p.numframes) {876 while (iIdx <= p.numframes) {
600 EncodeOneFrame();877 EncodeOneFrame (1);
601 if (m_LTR_Recover_Request.uiFeedbackType == IDR_RECOVERY_REQUEST) {878 if (m_LTR_Recover_Request.uiFeedbackType == IDR_RECOVERY_REQUEST) {
602 ASSERT_TRUE (info.eFrameType == videoFrameTypeIDR);879 ASSERT_TRUE (info.eFrameType == videoFrameTypeIDR);
603 }880 }
@@ -641,7 +918,7 @@ TEST_P (EncodeDecodeTestAPI, SetOptionECFlag_ERROR_CON_DISABLE) { · 37 unmodified lines
641 ASSERT_EQ (0, rv);918 ASSERT_EQ (0, rv);
642 m_LTR_Recover_Request.uiFeedbackType = NO_RECOVERY_REQUSET;919 m_LTR_Recover_Request.uiFeedbackType = NO_RECOVERY_REQUSET;
643 920
644 prepareEncDecParam (p);921 InitialEncDec (p.width, p.height);
645 int32_t iTraceLevel = WELS_LOG_QUIET;922 int32_t iTraceLevel = WELS_LOG_QUIET;
646 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);923 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);
647 decoder_->SetOption (DECODER_OPTION_TRACE_LEVEL, &iTraceLevel);924 decoder_->SetOption (DECODER_OPTION_TRACE_LEVEL, &iTraceLevel);
@@ -660,7 +937,7 @@ TEST_P (EncodeDecodeTestAPI, SetOptionECFlag_ERROR_CON_DISABLE) { · 12 unmodified lines
660 int iSkipedBytes;937 int iSkipedBytes;
661 bool bVCLLoss = false;938 bool bVCLLoss = false;
662 while (iIdx <= p.numframes) {939 while (iIdx <= p.numframes) {
663 EncodeOneFrame();940 EncodeOneFrame (1);
664 if (m_LTR_Recover_Request.uiFeedbackType == IDR_RECOVERY_REQUEST) {941 if (m_LTR_Recover_Request.uiFeedbackType == IDR_RECOVERY_REQUEST) {
665 ASSERT_TRUE (info.eFrameType == videoFrameTypeIDR);942 ASSERT_TRUE (info.eFrameType == videoFrameTypeIDR);
666 }943 }
@@ -695,7 +972,7 @@ TEST_P (EncodeDecodeTestAPI, SetOptionECFlag_ERROR_CON_SLICE_COPY) { · 28 unmodified lines
695 ASSERT_TRUE (rv == cmResultSuccess);972 ASSERT_TRUE (rv == cmResultSuccess);
696 m_LTR_Recover_Request.uiFeedbackType = NO_RECOVERY_REQUSET;973 m_LTR_Recover_Request.uiFeedbackType = NO_RECOVERY_REQUSET;
697 974
698 prepareEncDecParam (p);975 InitialEncDec (p.width, p.height);
699 int32_t iTraceLevel = WELS_LOG_QUIET;976 int32_t iTraceLevel = WELS_LOG_QUIET;
700 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);977 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);
701 decoder_->SetOption (DECODER_OPTION_TRACE_LEVEL, &iTraceLevel);978 decoder_->SetOption (DECODER_OPTION_TRACE_LEVEL, &iTraceLevel);
@@ -714,7 +991,7 @@ TEST_P (EncodeDecodeTestAPI, SetOptionECFlag_ERROR_CON_SLICE_COPY) { · 12 unmodified lines
714 int iSkipedBytes;991 int iSkipedBytes;
715 bool bVCLLoss = false;992 bool bVCLLoss = false;
716 while (iIdx <= p.numframes) {993 while (iIdx <= p.numframes) {
717 EncodeOneFrame();994 EncodeOneFrame (1);
718 if (m_LTR_Recover_Request.uiFeedbackType == IDR_RECOVERY_REQUEST) {995 if (m_LTR_Recover_Request.uiFeedbackType == IDR_RECOVERY_REQUEST) {
719 ASSERT_TRUE (info.eFrameType == videoFrameTypeIDR);996 ASSERT_TRUE (info.eFrameType == videoFrameTypeIDR);
720 }997 }
@@ -750,7 +1027,7 @@ TEST_P (EncodeDecodeTestAPI, GetOptionTid_AVC_NOPREFIX) { · 29 unmodified lines
750 int rv = encoder_->InitializeExt (&param_);1027 int rv = encoder_->InitializeExt (&param_);
751 ASSERT_TRUE (rv == cmResultSuccess);1028 ASSERT_TRUE (rv == cmResultSuccess);
752 m_LTR_Recover_Request.uiFeedbackType = NO_RECOVERY_REQUSET;1029 m_LTR_Recover_Request.uiFeedbackType = NO_RECOVERY_REQUSET;
753 prepareEncDecParam (p);1030 InitialEncDec (p.width, p.height);
754 int32_t iTraceLevel = WELS_LOG_QUIET;1031 int32_t iTraceLevel = WELS_LOG_QUIET;
755 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);1032 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);
756 decoder_->SetOption (DECODER_OPTION_TRACE_LEVEL, &iTraceLevel);1033 decoder_->SetOption (DECODER_OPTION_TRACE_LEVEL, &iTraceLevel);
@@ -768,7 +1045,7 @@ TEST_P (EncodeDecodeTestAPI, GetOptionTid_AVC_NOPREFIX) { · 11 unmodified lines
768 int iLossIdx = 0;1045 int iLossIdx = 0;
769 bool bVCLLoss = false;1046 bool bVCLLoss = false;
770 while (iIdx <= p.numframes) {1047 while (iIdx <= p.numframes) {
771 EncodeOneFrame();1048 EncodeOneFrame (1);
772 if (m_LTR_Recover_Request.uiFeedbackType == IDR_RECOVERY_REQUEST) {1049 if (m_LTR_Recover_Request.uiFeedbackType == IDR_RECOVERY_REQUEST) {
773 ASSERT_TRUE (info.eFrameType == videoFrameTypeIDR);1050 ASSERT_TRUE (info.eFrameType == videoFrameTypeIDR);
774 }1051 }
@@ -821,7 +1098,7 @@ TEST_P (EncodeDecodeTestAPI, GetOptionTid_AVC_WITH_PREFIX_NOLOSS) { · 46 unmodified lines
821 ASSERT_TRUE (rv == cmResultSuccess);1098 ASSERT_TRUE (rv == cmResultSuccess);
822 m_LTR_Recover_Request.uiFeedbackType = NO_RECOVERY_REQUSET;1099 m_LTR_Recover_Request.uiFeedbackType = NO_RECOVERY_REQUSET;
823 1100
824 prepareEncDecParam (p);1101 InitialEncDec (p.width, p.height);
825 int32_t iTraceLevel = WELS_LOG_QUIET;1102 int32_t iTraceLevel = WELS_LOG_QUIET;
826 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);1103 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);
827 decoder_->SetOption (DECODER_OPTION_TRACE_LEVEL, &iTraceLevel);1104 decoder_->SetOption (DECODER_OPTION_TRACE_LEVEL, &iTraceLevel);
@@ -837,7 +1114,7 @@ TEST_P (EncodeDecodeTestAPI, GetOptionTid_AVC_WITH_PREFIX_NOLOSS) { · 9 unmodified lines
837 encoder_->SetOption (ENCODER_LTR_MARKING_PERIOD, &iLtrPeriod);1114 encoder_->SetOption (ENCODER_LTR_MARKING_PERIOD, &iLtrPeriod);
838 int iIdx = 0;1115 int iIdx = 0;
839 while (iIdx <= p.numframes) {1116 while (iIdx <= p.numframes) {
840 EncodeOneFrame();1117 EncodeOneFrame (1);
841 if (m_LTR_Recover_Request.uiFeedbackType == IDR_RECOVERY_REQUEST) {1118 if (m_LTR_Recover_Request.uiFeedbackType == IDR_RECOVERY_REQUEST) {
842 ASSERT_TRUE (info.eFrameType == videoFrameTypeIDR);1119 ASSERT_TRUE (info.eFrameType == videoFrameTypeIDR);
843 }1120 }
@@ -875,7 +1152,7 @@ TEST_P (EncodeDecodeTestAPI, GetOptionTid_SVC_L1_NOLOSS) { · 31 unmodified lines
875 ASSERT_TRUE (rv == cmResultSuccess);1152 ASSERT_TRUE (rv == cmResultSuccess);
876 m_LTR_Recover_Request.uiFeedbackType = NO_RECOVERY_REQUSET;1153 m_LTR_Recover_Request.uiFeedbackType = NO_RECOVERY_REQUSET;
877 1154
878 prepareEncDecParam (p);1155 InitialEncDec (p.width, p.height);
879 int32_t iTraceLevel = WELS_LOG_QUIET;1156 int32_t iTraceLevel = WELS_LOG_QUIET;
880 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);1157 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);
881 decoder_->SetOption (DECODER_OPTION_TRACE_LEVEL, &iTraceLevel);1158 decoder_->SetOption (DECODER_OPTION_TRACE_LEVEL, &iTraceLevel);
@@ -891,7 +1168,7 @@ TEST_P (EncodeDecodeTestAPI, GetOptionTid_SVC_L1_NOLOSS) { · 9 unmodified lines
891 encoder_->SetOption (ENCODER_LTR_MARKING_PERIOD, &iLtrPeriod);1168 encoder_->SetOption (ENCODER_LTR_MARKING_PERIOD, &iLtrPeriod);
892 int iIdx = 0;1169 int iIdx = 0;
893 while (iIdx <= p.numframes) {1170 while (iIdx <= p.numframes) {
894 EncodeOneFrame();1171 EncodeOneFrame (1);
895 if (m_LTR_Recover_Request.uiFeedbackType == IDR_RECOVERY_REQUEST) {1172 if (m_LTR_Recover_Request.uiFeedbackType == IDR_RECOVERY_REQUEST) {
896 ASSERT_TRUE (info.eFrameType == videoFrameTypeIDR);1173 ASSERT_TRUE (info.eFrameType == videoFrameTypeIDR);
897 }1174 }
@@ -930,7 +1207,7 @@ TEST_P (EncodeDecodeTestAPI, SetOption_Trace) { · 32 unmodified lines
930 ASSERT_TRUE (rv == cmResultSuccess);1207 ASSERT_TRUE (rv == cmResultSuccess);
931 m_LTR_Recover_Request.uiFeedbackType = NO_RECOVERY_REQUSET;1208 m_LTR_Recover_Request.uiFeedbackType = NO_RECOVERY_REQUSET;
932 1209
933 prepareEncDecParam (p);1210 InitialEncDec (p.width, p.height);
934 int32_t iTraceLevel = WELS_LOG_QUIET;1211 int32_t iTraceLevel = WELS_LOG_QUIET;
935 pFunc = TestOutPutTrace;1212 pFunc = TestOutPutTrace;
936 pTraceInfo = &sTrace;1213 pTraceInfo = &sTrace;
@@ -960,7 +1237,7 @@ TEST_P (EncodeDecodeTestAPI, SetOption_Trace) { · 23 unmodified lines
960 sTrace.iTarLevel = iTraceLevel;1237 sTrace.iTarLevel = iTraceLevel;
961 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);1238 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);
962 decoder_->SetOption (DECODER_OPTION_TRACE_LEVEL, &iTraceLevel);1239 decoder_->SetOption (DECODER_OPTION_TRACE_LEVEL, &iTraceLevel);
963 EncodeOneFrame();1240 EncodeOneFrame (1);
964 if (m_LTR_Recover_Request.uiFeedbackType == IDR_RECOVERY_REQUEST) {1241 if (m_LTR_Recover_Request.uiFeedbackType == IDR_RECOVERY_REQUEST) {
965 ASSERT_TRUE (info.eFrameType == videoFrameTypeIDR);1242 ASSERT_TRUE (info.eFrameType == videoFrameTypeIDR);
966 }1243 }
@@ -992,7 +1269,7 @@ TEST_P (EncodeDecodeTestAPI, SetOption_Trace_NULL) { · 25 unmodified lines
992 ASSERT_TRUE (rv == cmResultSuccess);1269 ASSERT_TRUE (rv == cmResultSuccess);
993 m_LTR_Recover_Request.uiFeedbackType = NO_RECOVERY_REQUSET;1270 m_LTR_Recover_Request.uiFeedbackType = NO_RECOVERY_REQUSET;
994 1271
995 prepareEncDecParam (p);1272 InitialEncDec (p.width, p.height);
996 1273
997 int32_t iTraceLevel = WELS_LOG_QUIET;1274 int32_t iTraceLevel = WELS_LOG_QUIET;
998 pFunc = NULL;1275 pFunc = NULL;
@@ -1021,7 +1298,7 @@ TEST_P (EncodeDecodeTestAPI, SetOption_Trace_NULL) { · 22 unmodified lines
1021 iTraceLevel = rand() % 33;1298 iTraceLevel = rand() % 33;
1022 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);1299 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);
1023 decoder_->SetOption (DECODER_OPTION_TRACE_LEVEL, &iTraceLevel);1300 decoder_->SetOption (DECODER_OPTION_TRACE_LEVEL, &iTraceLevel);
1024 EncodeOneFrame();1301 EncodeOneFrame (1);
1025 if (m_LTR_Recover_Request.uiFeedbackType == IDR_RECOVERY_REQUEST) {1302 if (m_LTR_Recover_Request.uiFeedbackType == IDR_RECOVERY_REQUEST) {
1026 ASSERT_TRUE (info.eFrameType == videoFrameTypeIDR);1303 ASSERT_TRUE (info.eFrameType == videoFrameTypeIDR);
1027 }1304 }
@@ -1064,7 +1341,7 @@ TEST_P (EncodeDecodeTestAPI, SetOptionECIDC_GeneralSliceChange) { · 36 unmodified lines
1064 1341
1065 //Start for enc/dec1342 //Start for enc/dec
1066 1343
1067 prepareEncDecParam (p);1344 InitialEncDec (p.width, p.height);
1068 int32_t iTraceLevel = WELS_LOG_QUIET;1345 int32_t iTraceLevel = WELS_LOG_QUIET;
1069 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);1346 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);
1070 decoder_->SetOption (DECODER_OPTION_TRACE_LEVEL, &iTraceLevel);1347 decoder_->SetOption (DECODER_OPTION_TRACE_LEVEL, &iTraceLevel);
@@ -1076,7 +1353,7 @@ TEST_P (EncodeDecodeTestAPI, SetOptionECIDC_GeneralSliceChange) { · 5 unmodified lines
1076 1353
1077 //enc/dec pictures1354 //enc/dec pictures
1078 while (iIdx <= p.numframes) {1355 while (iIdx <= p.numframes) {
1079 EncodeOneFrame();1356 EncodeOneFrame (1);
1080 //decoding after each encoding frame1357 //decoding after each encoding frame
1081 len = 0;1358 len = 0;
1082 iPacketNum = 0;1359 iPacketNum = 0;
@@ -1151,9 +1428,9 @@ TEST_F (EncodeDecodeTestAPI, SetOptionECIDC_SpecificFrameChange) { · 68 unmodified lines
1151 int len = 0;1428 int len = 0;
1152 unsigned char* pData[3] = { NULL };1429 unsigned char* pData[3] = { NULL };
1153 1430
1154 prepareEncDecParam (p);1431 InitialEncDec (p.width, p.height);
1155 //Frame 0: IDR, EC_IDC=DISABLE, loss = 01432 //Frame 0: IDR, EC_IDC=DISABLE, loss = 0
1156 EncodeOneFrame();1433 EncodeOneFrame (1);
1157 encToDecData (info, len);1434 encToDecData (info, len);
1158 decoder_->GetOption (DECODER_OPTION_ERROR_CON_IDC, &uiGet);1435 decoder_->GetOption (DECODER_OPTION_ERROR_CON_IDC, &uiGet);
1159 EXPECT_EQ (uiGet, (ERROR_CON_IDC) ERROR_CON_DISABLE);1436 EXPECT_EQ (uiGet, (ERROR_CON_IDC) ERROR_CON_DISABLE);
@@ -1168,11 +1445,11 @@ TEST_F (EncodeDecodeTestAPI, SetOptionECIDC_SpecificFrameChange) { · 8 unmodified lines
1168 iIdx++;1445 iIdx++;
1169 1446
1170 //Frame 1: P, EC_IDC=DISABLE, loss = 11447 //Frame 1: P, EC_IDC=DISABLE, loss = 1
1171 EncodeOneFrame();1448 EncodeOneFrame (1);
1172 iIdx++;1449 iIdx++;
1173 1450
1174 //Frame 2: P, EC_IDC=DISABLE, loss = 01451 //Frame 2: P, EC_IDC=DISABLE, loss = 0
1175 EncodeOneFrame();1452 EncodeOneFrame (1);
1176 encToDecData (info, len);1453 encToDecData (info, len);
1177 pData[0] = pData[1] = pData[2] = 0;1454 pData[0] = pData[1] = pData[2] = 0;
1178 memset (&dstBufInfo_, 0, sizeof (SBufferInfo));1455 memset (&dstBufInfo_, 0, sizeof (SBufferInfo));
@@ -1192,7 +1469,7 @@ TEST_F (EncodeDecodeTestAPI, SetOptionECIDC_SpecificFrameChange) { · 13 unmodified lines
1192 decoder_->GetOption (DECODER_OPTION_ERROR_CON_IDC, &uiGet);1469 decoder_->GetOption (DECODER_OPTION_ERROR_CON_IDC, &uiGet);
1193 EXPECT_EQ (uiGet, uiEcIdc);1470 EXPECT_EQ (uiGet, uiEcIdc);
1194 //Frame 3: P, EC_IDC=SLICE_COPY, loss = 01471 //Frame 3: P, EC_IDC=SLICE_COPY, loss = 0
1195 EncodeOneFrame();1472 EncodeOneFrame (1);
1196 encToDecData (info, len);1473 encToDecData (info, len);
1197 decoder_->GetOption (DECODER_OPTION_ERROR_CON_IDC, &uiGet);1474 decoder_->GetOption (DECODER_OPTION_ERROR_CON_IDC, &uiGet);
1198 EXPECT_EQ (uiGet, (uint32_t) ERROR_CON_SLICE_COPY);1475 EXPECT_EQ (uiGet, (uint32_t) ERROR_CON_SLICE_COPY);
@@ -1212,7 +1489,7 @@ TEST_F (EncodeDecodeTestAPI, SetOptionECIDC_SpecificFrameChange) { · 13 unmodified lines
1212 decoder_->GetOption (DECODER_OPTION_ERROR_CON_IDC, &uiGet);1489 decoder_->GetOption (DECODER_OPTION_ERROR_CON_IDC, &uiGet);
1213 EXPECT_EQ (uiGet, uiEcIdc);1490 EXPECT_EQ (uiGet, uiEcIdc);
1214 //Frame 4: P, EC_IDC=DISABLE, loss = 01491 //Frame 4: P, EC_IDC=DISABLE, loss = 0
1215 EncodeOneFrame();1492 EncodeOneFrame (1);
1216 encToDecData (info, len);1493 encToDecData (info, len);
1217 decoder_->GetOption (DECODER_OPTION_ERROR_CON_IDC, &uiGet);1494 decoder_->GetOption (DECODER_OPTION_ERROR_CON_IDC, &uiGet);
1218 EXPECT_EQ (uiGet, (uint32_t) ERROR_CON_DISABLE);1495 EXPECT_EQ (uiGet, (uint32_t) ERROR_CON_DISABLE);
@@ -1228,7 +1505,7 @@ TEST_F (EncodeDecodeTestAPI, SetOptionECIDC_SpecificFrameChange) { · 9 unmodified lines
1228 iIdx++;1505 iIdx++;
1229 1506
1230 //Frame 5: P, EC_IDC=DISABLE, loss = 11507 //Frame 5: P, EC_IDC=DISABLE, loss = 1
1231 EncodeOneFrame();1508 EncodeOneFrame (1);
1232 iIdx++;1509 iIdx++;
1233 1510
1234 //set EC=FRAME_COPY1511 //set EC=FRAME_COPY
@@ -1237,12 +1514,12 @@ TEST_F (EncodeDecodeTestAPI, SetOptionECIDC_SpecificFrameChange) { · 2 unmodified lines
1237 decoder_->GetOption (DECODER_OPTION_ERROR_CON_IDC, &uiGet);1514 decoder_->GetOption (DECODER_OPTION_ERROR_CON_IDC, &uiGet);
1238 EXPECT_EQ (uiGet, uiEcIdc);1515 EXPECT_EQ (uiGet, uiEcIdc);
1239 //Frame 6: P, EC_IDC=FRAME_COPY, loss = 11516 //Frame 6: P, EC_IDC=FRAME_COPY, loss = 1
1240 EncodeOneFrame();1517 EncodeOneFrame (1);
1241 EXPECT_EQ (uiGet, uiEcIdc);1518 EXPECT_EQ (uiGet, uiEcIdc);
1242 iIdx++;1519 iIdx++;
1243 1520
1244 //Frame 7: P, EC_IDC=FRAME_COPY, loss = 01521 //Frame 7: P, EC_IDC=FRAME_COPY, loss = 0
1245 EncodeOneFrame();1522 EncodeOneFrame (1);
1246 encToDecData (info, len);1523 encToDecData (info, len);
1247 decoder_->GetOption (DECODER_OPTION_ERROR_CON_IDC, &uiGet);1524 decoder_->GetOption (DECODER_OPTION_ERROR_CON_IDC, &uiGet);
1248 EXPECT_EQ (uiGet, (uint32_t) ERROR_CON_FRAME_COPY);1525 EXPECT_EQ (uiGet, (uint32_t) ERROR_CON_FRAME_COPY);
@@ -1285,10 +1562,10 @@ TEST_F (EncodeDecodeTestAPI, SetOptionECIDC_SpecificSliceChange_IDRLoss) { · 36 unmodified lines
1285 unsigned char* pData[3] = { NULL };1562 unsigned char* pData[3] = { NULL };
1286 int iTotalSliceSize = 0;1563 int iTotalSliceSize = 0;
1287 1564
1288 prepareEncDecParam (p);1565 InitialEncDec (p.width, p.height);
1289 1566
1290 //Frame 0: IDR, EC_IDC=2, loss = 21567 //Frame 0: IDR, EC_IDC=2, loss = 2
1291 EncodeOneFrame();1568 EncodeOneFrame (1);
1292 iTotalSliceSize = 0;1569 iTotalSliceSize = 0;
1293 encToDecSliceData (0, 0, info, len); //SPS1570 encToDecSliceData (0, 0, info, len); //SPS
1294 iTotalSliceSize = len;1571 iTotalSliceSize = len;
@@ -1310,7 +1587,7 @@ TEST_F (EncodeDecodeTestAPI, SetOptionECIDC_SpecificSliceChange_IDRLoss) { · 15 unmodified lines
1310 1587
1311 //Frame 1: P, EC_IDC=2, loss = 01588 //Frame 1: P, EC_IDC=2, loss = 0
1312 //will clean SPS/PPS status1589 //will clean SPS/PPS status
1313 EncodeOneFrame();1590 EncodeOneFrame (1);
1314 encToDecData (info, len); //all slice together1591 encToDecData (info, len); //all slice together
1315 pData[0] = pData[1] = pData[2] = 0;1592 pData[0] = pData[1] = pData[2] = 0;
1316 memset (&dstBufInfo_, 0, sizeof (SBufferInfo));1593 memset (&dstBufInfo_, 0, sizeof (SBufferInfo));
@@ -1331,7 +1608,7 @@ TEST_F (EncodeDecodeTestAPI, SetOptionECIDC_SpecificSliceChange_IDRLoss) { · 14 unmodified lines
1331 EXPECT_EQ (uiGet, uiEcIdc);1608 EXPECT_EQ (uiGet, uiEcIdc);
1332 //Frame 2: P, EC_IDC=0, loss = 01609 //Frame 2: P, EC_IDC=0, loss = 0
1333 /////will clean SPS/PPS status1610 /////will clean SPS/PPS status
1334 EncodeOneFrame();1611 EncodeOneFrame (1);
1335 encToDecData (info, len); //all slice together1612 encToDecData (info, len); //all slice together
1336 pData[0] = pData[1] = pData[2] = 0;1613 pData[0] = pData[1] = pData[2] = 0;
1337 memset (&dstBufInfo_, 0, sizeof (SBufferInfo));1614 memset (&dstBufInfo_, 0, sizeof (SBufferInfo));
@@ -1351,7 +1628,7 @@ TEST_F (EncodeDecodeTestAPI, SetOptionECIDC_SpecificSliceChange_IDRLoss) { · 13 unmodified lines
1351 decoder_->GetOption (DECODER_OPTION_ERROR_CON_IDC, &uiGet);1628 decoder_->GetOption (DECODER_OPTION_ERROR_CON_IDC, &uiGet);
1352 EXPECT_EQ (uiGet, uiEcIdc);1629 EXPECT_EQ (uiGet, uiEcIdc);
1353 //Frame 3: P, EC_IDC=2, loss = 11630 //Frame 3: P, EC_IDC=2, loss = 1
1354 EncodeOneFrame();1631 EncodeOneFrame (1);
1355 encToDecSliceData (0, 0, info, iTotalSliceSize); //slice 1 lost1632 encToDecSliceData (0, 0, info, iTotalSliceSize); //slice 1 lost
1356 encToDecSliceData (0, 1, info, len); //slice 21633 encToDecSliceData (0, 1, info, len); //slice 2
1357 pData[0] = pData[1] = pData[2] = 0;1634 pData[0] = pData[1] = pData[2] = 0;
@@ -1372,7 +1649,7 @@ TEST_F (EncodeDecodeTestAPI, SetOptionECIDC_SpecificSliceChange_IDRLoss) { · 14 unmodified lines
1372 decoder_->GetOption (DECODER_OPTION_ERROR_CON_IDC, &uiGet);1649 decoder_->GetOption (DECODER_OPTION_ERROR_CON_IDC, &uiGet);
1373 EXPECT_EQ (uiGet, uiEcIdc);1650 EXPECT_EQ (uiGet, uiEcIdc);
1374 //Frame 4: P, EC_IDC=0, loss = 01651 //Frame 4: P, EC_IDC=0, loss = 0
1375 EncodeOneFrame();1652 EncodeOneFrame (1);
1376 encToDecData (info, len); //all slice1653 encToDecData (info, len); //all slice
1377 pData[0] = pData[1] = pData[2] = 0;1654 pData[0] = pData[1] = pData[2] = 0;
1378 memset (&dstBufInfo_, 0, sizeof (SBufferInfo));1655 memset (&dstBufInfo_, 0, sizeof (SBufferInfo));
@@ -1417,7 +1694,7 @@ TEST_F (EncodeDecodeTestAPI, SetOptionECIDC_SpecificSliceChange_IDRNoLoss) { · 38 unmodified lines
1417 unsigned char* pData[3] = { NULL };1694 unsigned char* pData[3] = { NULL };
1418 int iTotalSliceSize = 0;1695 int iTotalSliceSize = 0;
1419 1696
1420 prepareEncDecParam (p);1697 InitialEncDec (p.width, p.height);
1421 1698
1422 //set EC=DISABLE1699 //set EC=DISABLE
1423 uiEcIdc = (uint32_t) (ERROR_CON_DISABLE);1700 uiEcIdc = (uint32_t) (ERROR_CON_DISABLE);
@@ -1426,7 +1703,7 @@ TEST_F (EncodeDecodeTestAPI, SetOptionECIDC_SpecificSliceChange_IDRNoLoss) { · 2 unmodified lines
1426 EXPECT_EQ (uiGet, uiEcIdc);1703 EXPECT_EQ (uiGet, uiEcIdc);
1427 //Frame 0: IDR, EC_IDC=0, loss = 01704 //Frame 0: IDR, EC_IDC=0, loss = 0
1428 //Expected result: all OK, 2nd Output1705 //Expected result: all OK, 2nd Output
1429 EncodeOneFrame();1706 EncodeOneFrame (1);
1430 encToDecData (info, len); //all slice1707 encToDecData (info, len); //all slice
1431 pData[0] = pData[1] = pData[2] = 0;1708 pData[0] = pData[1] = pData[2] = 0;
1432 memset (&dstBufInfo_, 0, sizeof (SBufferInfo));1709 memset (&dstBufInfo_, 0, sizeof (SBufferInfo));
@@ -1441,7 +1718,7 @@ TEST_F (EncodeDecodeTestAPI, SetOptionECIDC_SpecificSliceChange_IDRNoLoss) { · 8 unmodified lines
1441 1718
1442 //Frame 1: P, EC_IDC=0, loss = 01719 //Frame 1: P, EC_IDC=0, loss = 0
1443 //Expected result: all OK, 2nd Output1720 //Expected result: all OK, 2nd Output
1444 EncodeOneFrame();1721 EncodeOneFrame (1);
1445 encToDecData (info, len); //all slice together1722 encToDecData (info, len); //all slice together
1446 pData[0] = pData[1] = pData[2] = 0;1723 pData[0] = pData[1] = pData[2] = 0;
1447 memset (&dstBufInfo_, 0, sizeof (SBufferInfo));1724 memset (&dstBufInfo_, 0, sizeof (SBufferInfo));
@@ -1457,7 +1734,7 @@ TEST_F (EncodeDecodeTestAPI, SetOptionECIDC_SpecificSliceChange_IDRNoLoss) { · 9 unmodified lines
1457 1734
1458 //Frame 2: P, EC_IDC=0, loss = 11735 //Frame 2: P, EC_IDC=0, loss = 1
1459 //Expected result: all OK, no Output1736 //Expected result: all OK, no Output
1460 EncodeOneFrame();1737 EncodeOneFrame (1);
1461 encToDecSliceData (0, 0, info, iTotalSliceSize); // slice 1 lost1738 encToDecSliceData (0, 0, info, iTotalSliceSize); // slice 1 lost
1462 encToDecSliceData (0, 1, info, len); // slice 2 only1739 encToDecSliceData (0, 1, info, len); // slice 2 only
1463 pData[0] = pData[1] = pData[2] = 0;1740 pData[0] = pData[1] = pData[2] = 0;
@@ -1479,7 +1756,7 @@ TEST_F (EncodeDecodeTestAPI, SetOptionECIDC_SpecificSliceChange_IDRNoLoss) { · 15 unmodified lines
1479 EXPECT_EQ (uiGet, uiEcIdc);1756 EXPECT_EQ (uiGet, uiEcIdc);
1480 //Frame 3: P, EC_IDC=2, loss = 21757 //Frame 3: P, EC_IDC=2, loss = 2
1481 //Expected result: neither OK, 1st Output1758 //Expected result: neither OK, 1st Output
1482 EncodeOneFrame();1759 EncodeOneFrame (1);
1483 encToDecSliceData (0, 0, info, len); //slice 1 only1760 encToDecSliceData (0, 0, info, len); //slice 1 only
1484 pData[0] = pData[1] = pData[2] = 0;1761 pData[0] = pData[1] = pData[2] = 0;
1485 memset (&dstBufInfo_, 0, sizeof (SBufferInfo));1762 memset (&dstBufInfo_, 0, sizeof (SBufferInfo));
@@ -1500,7 +1777,7 @@ TEST_F (EncodeDecodeTestAPI, SetOptionECIDC_SpecificSliceChange_IDRNoLoss) { · 14 unmodified lines
1500 EXPECT_EQ (uiGet, uiEcIdc);1777 EXPECT_EQ (uiGet, uiEcIdc);
1501 //Frame 4: P, EC_IDC=0, loss = 01778 //Frame 4: P, EC_IDC=0, loss = 0
1502 //Expected result: depends on DecodeFrame2 result. If OK, output; else ,no output1779 //Expected result: depends on DecodeFrame2 result. If OK, output; else ,no output
1503 EncodeOneFrame();1780 EncodeOneFrame (1);
1504 encToDecData (info, len); //all slice1781 encToDecData (info, len); //all slice
1505 pData[0] = pData[1] = pData[2] = 0;1782 pData[0] = pData[1] = pData[2] = 0;
1506 memset (&dstBufInfo_, 0, sizeof (SBufferInfo));1783 memset (&dstBufInfo_, 0, sizeof (SBufferInfo));
@@ -1519,7 +1796,7 @@ TEST_F (EncodeDecodeTestAPI, SetOptionECIDC_SpecificSliceChange_IDRNoLoss) { · 12 unmodified lines
1519 //Expected result: depends on DecodeFrame2 result. If OK, output; else ,no output1796 //Expected result: depends on DecodeFrame2 result. If OK, output; else ,no output
1520 int32_t iIDRPeriod = 1;1797 int32_t iIDRPeriod = 1;
1521 encoder_->SetOption (ENCODER_OPTION_IDR_INTERVAL, &iIDRPeriod);1798 encoder_->SetOption (ENCODER_OPTION_IDR_INTERVAL, &iIDRPeriod);
1522 EncodeOneFrame();1799 EncodeOneFrame (1);
1523 EXPECT_TRUE (info.eFrameType == videoFrameTypeIDR);1800 EXPECT_TRUE (info.eFrameType == videoFrameTypeIDR);
1524 encToDecSliceData (0, 0, info, len); //SPS1801 encToDecSliceData (0, 0, info, len); //SPS
1525 iTotalSliceSize = len;1802 iTotalSliceSize = len;
@@ -1577,7 +1854,7 @@ TEST_F (EncodeDecodeTestAPI, Engine_SVC_Switch_I) { · 51 unmodified lines
1577 ASSERT_TRUE (rv == cmResultSuccess);1854 ASSERT_TRUE (rv == cmResultSuccess);
1578 m_LTR_Recover_Request.uiFeedbackType = NO_RECOVERY_REQUSET;1855 m_LTR_Recover_Request.uiFeedbackType = NO_RECOVERY_REQUSET;
1579 1856
1580 prepareEncDecParam (p);1857 InitialEncDec (p.width, p.height);
1581 int32_t iTraceLevel = WELS_LOG_QUIET;1858 int32_t iTraceLevel = WELS_LOG_QUIET;
1582 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);1859 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);
1583 decoder_->SetOption (DECODER_OPTION_TRACE_LEVEL, &iTraceLevel);1860 decoder_->SetOption (DECODER_OPTION_TRACE_LEVEL, &iTraceLevel);
@@ -1594,7 +1871,7 @@ TEST_F (EncodeDecodeTestAPI, Engine_SVC_Switch_I) { · 10 unmodified lines
1594 int iIdx = 0;1871 int iIdx = 0;
1595 int iTarDid = 0;1872 int iTarDid = 0;
1596 while (iIdx <= p.numframes) {1873 while (iIdx <= p.numframes) {
1597 EncodeOneFrame();1874 EncodeOneFrame (1);
1598 if (m_LTR_Recover_Request.uiFeedbackType == IDR_RECOVERY_REQUEST) {1875 if (m_LTR_Recover_Request.uiFeedbackType == IDR_RECOVERY_REQUEST) {
1599 ASSERT_TRUE (info.eFrameType == videoFrameTypeIDR);1876 ASSERT_TRUE (info.eFrameType == videoFrameTypeIDR);
1600 }1877 }
@@ -1642,7 +1919,7 @@ TEST_F (EncodeDecodeTestAPI, Engine_SVC_Switch_P) { · 41 unmodified lines
1642 ASSERT_TRUE (rv == cmResultSuccess);1919 ASSERT_TRUE (rv == cmResultSuccess);
1643 m_LTR_Recover_Request.uiFeedbackType = NO_RECOVERY_REQUSET;1920 m_LTR_Recover_Request.uiFeedbackType = NO_RECOVERY_REQUSET;
1644 1921
1645 prepareEncDecParam (p);1922 InitialEncDec (p.width, p.height);
1646 int32_t iTraceLevel = WELS_LOG_QUIET;1923 int32_t iTraceLevel = WELS_LOG_QUIET;
1647 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);1924 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);
1648 decoder_->SetOption (DECODER_OPTION_TRACE_LEVEL, &iTraceLevel);1925 decoder_->SetOption (DECODER_OPTION_TRACE_LEVEL, &iTraceLevel);
@@ -1659,7 +1936,7 @@ TEST_F (EncodeDecodeTestAPI, Engine_SVC_Switch_P) { · 10 unmodified lines
1659 int iIdx = 0;1936 int iIdx = 0;
1660 1937
1661 while (iIdx <= p.numframes) {1938 while (iIdx <= p.numframes) {
1662 EncodeOneFrame();1939 EncodeOneFrame (1);
1663 if (m_LTR_Recover_Request.uiFeedbackType == IDR_RECOVERY_REQUEST) {1940 if (m_LTR_Recover_Request.uiFeedbackType == IDR_RECOVERY_REQUEST) {
1664 ASSERT_TRUE (info.eFrameType == videoFrameTypeIDR);1941 ASSERT_TRUE (info.eFrameType == videoFrameTypeIDR);
1665 }1942 }
@@ -1711,3 +1988,49 @@ TEST_F (EncodeDecodeTestAPI, Engine_SVC_Switch_P) { · 45 unmodified lines
1711 iLastDid = iTarDid;1988 iLastDid = iTarDid;
1712 }1989 }
1713}1990}
1991
1992
1993TEST_F (EncodeDecodeTestAPI, SetOptionEncParamExt) {
1994 int iWidth = WELS_CLIP3 ((((rand() % MAX_WIDTH) >> 1) + 1) << 1, 2, MAX_WIDTH);
1995 int iHeight = WELS_CLIP3 ((((rand() % MAX_HEIGHT) >> 1) + 1) << 1, 2, MAX_HEIGHT);
1996 float fFrameRate = rand() + 0.5f;
1997 int iEncFrameNum = WELS_CLIP3 ((rand() % ENCODE_FRAME_NUM) + 1, 1, ENCODE_FRAME_NUM);
1998 int iSpatialLayerNum = 4;
1999 int iSliceNum = 1;
2000 encoder_->GetDefaultParams (&param_);
2001 prepareParam (iSpatialLayerNum, iSliceNum, iWidth, iHeight, fFrameRate);
2002 int rv = encoder_->InitializeExt (&param_);
2003 ASSERT_TRUE (rv == cmResultSuccess);
2004
2005 for (int i = 0; i < iEncFrameNum; i++) {
2006 //for (int i = 0; i < 9; i++) {
2007 int iResult;
2008 int len = 0;
2009 unsigned char* pData[3] = { NULL };
2010 int iTotalSliceSize = 0;
2011
2012
2013 RandomParamExtCombination();
2014 iResult = encoder_->SetOption (ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, &param_);
2015 //ValidateParamExtCombination();
2016 //ASSERT_TRUE (iResult == cmResultSuccess);
2017 //to do
2018 // currently, there are still some error cases even though under condition cmResultSuccess == iResult
2019 // so need to enhance the validation check for any random value of each variable in ParamExt
2020
2021 if (cmResultSuccess == iResult) {
2022 InitialEncDec (param_.iPicWidth, param_.iPicHeight);
2023 EncodeOneFrame (0);
2024 encToDecData (info, len);
2025 pData[0] = pData[1] = pData[2] = 0;
2026 memset (&dstBufInfo_, 0, sizeof (SBufferInfo));
2027
2028 iResult = decoder_->DecodeFrame2 (info.sLayerInfo[0].pBsBuf, iTotalSliceSize, pData, &dstBufInfo_);
2029 ASSERT_TRUE (iResult == cmResultSuccess);
2030 iResult = decoder_->DecodeFrame2 (NULL, 0, pData, &dstBufInfo_);
2031 ASSERT_TRUE (iResult == cmResultSuccess);
2032 EXPECT_EQ (dstBufInfo_.iBufferStatus, 0);
2033 }
2034 }
2035
2036}

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