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
99 #include <vector>
1010 using namespace WelsCommon;
1111
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+
1240 typedef struct SLost_Sim {
1341 WelsCommon::EWelsNalUnitType eNalType;
1442 bool isLost;
@@ -122,33 +150,43 @@ class EncodeDecodeTestAPI : public EncodeDecodeTestBase { · 107 unmodified lines
122150 EncodeDecodeTestBase::prepareParam (iLayers, iSlices, width, height, framerate);
123151 }
124152
125− void prepareEncDecParam (const EncodeDecodeFileParamBase EncDecFileParam);
126− void EncodeOneFrame() {
153+ void InitialEncDec (int iWidth, int iHeight);
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) {
127161 int frameSize = EncPic.iPicWidth * EncPic.iPicHeight * 3 / 2;
128162 memset (buf_.data(), iRandValue, (frameSize >> 2));
129163 memset (buf_.data() + (frameSize >> 2), rand() % 256, (frameSize - (frameSize >> 2)));
130164 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);
132169 }
133170 };
134171
135−void EncodeDecodeTestAPI::prepareEncDecParam (const EncodeDecodeFileParamBase EncDecFileParam) {
172+void EncodeDecodeTestAPI::InitialEncDec (int iWidth, int iHeight) {
173+
136174 // for encoder
137175 // 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;
139177
140178 buf_.SetLength (frameSize);
141179 ASSERT_TRUE (buf_.Length() == (size_t)frameSize);
142180
143181 memset (&EncPic, 0, sizeof (SSourcePicture));
144− EncPic.iPicWidth = EncDecFileParam.width;
145− EncPic.iPicHeight = EncDecFileParam.height;
182+ EncPic.iPicWidth = iWidth;
183+ EncPic.iPicHeight = iHeight;
146184 EncPic.iColorFormat = videoFormatI420;
147− EncPic.iStride[0] = EncPic.iPicWidth;
148− EncPic.iStride[1] = EncPic.iStride[2] = EncPic.iPicWidth >> 1;
149− EncPic.pData[0] = buf_.data();
150− EncPic.pData[1] = EncPic.pData[0] + EncDecFileParam.width * EncDecFileParam.height;
151− EncPic.pData[2] = EncPic.pData[1] + (EncDecFileParam.width * EncDecFileParam.height >> 2);
185+ EncPic.iStride[0] = EncPic.iPicWidth;
186+ EncPic.iStride[1] = EncPic.iStride[2] = EncPic.iPicWidth >> 1;
187+ EncPic.pData[0] = buf_.data();
188+ EncPic.pData[1] = EncPic.pData[0] + iWidth * iHeight;
189+ EncPic.pData[2] = EncPic.pData[1] + (iWidth * iHeight >> 2);
152190
153191 //for decoder
154192 memset (&info, 0, sizeof (SFrameBSInfo));
@@ -157,6 +195,245 @@ void EncodeDecodeTestAPI::prepareEncDecParam (const EncodeDecodeFileParamBase En · 2 unmodified lines
157195 iRandValue = rand() % 256;
158196 }
159197
198+void 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+
264+void 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+
376+void 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+}
413+void 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+
429+void 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+}
160437
161438 static const EncodeDecodeFileParamBase kFileParamArray[] = {
162439 {300, 160, 96, 6.0f, 2, 1, "000000000000001010101010101010101010101001101010100000010101000011"},
@@ -175,12 +452,12 @@ TEST_P (EncodeDecodeTestAPI, DecoderVclNal) { · 12 unmodified lines
175452 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);
176453 decoder_->SetOption (DECODER_OPTION_TRACE_LEVEL, &iTraceLevel);
177454
178− prepareEncDecParam (p);
455+ InitialEncDec (p.width, p.height);
179456
180457 int iIdx = 0;
181458 while (iIdx <= p.numframes) {
182459
183− EncodeOneFrame();
460+ EncodeOneFrame (0);
184461
185462 //decoding after each encoding frame
186463 int vclNal, len = 0;
@@ -211,13 +488,13 @@ TEST_P (EncodeDecodeTestAPI, GetOptionFramenum) { · 24 unmodified lines
211488 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);
212489 decoder_->SetOption (DECODER_OPTION_TRACE_LEVEL, &iTraceLevel);
213490
214− prepareEncDecParam (p);
491+ InitialEncDec (p.width, p.height);
215492
216493 int32_t iEncFrameNum = -1;
217494 int32_t iDecFrameNum;
218495 int iIdx = 0;
219496 while (iIdx <= p.numframes) {
220− EncodeOneFrame();
497+ EncodeOneFrame (0);
221498 //decoding after each encoding frame
222499 int len = 0;
223500 encToDecData (info, len);
@@ -250,7 +527,7 @@ TEST_P (EncodeDecodeTestAPI, GetOptionIDR) { · 26 unmodified lines
250527 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);
251528 decoder_->SetOption (DECODER_OPTION_TRACE_LEVEL, &iTraceLevel);
252529
253− prepareEncDecParam (p);
530+ InitialEncDec (p.width, p.height);
254531
255532 int32_t iEncCurIdrPicId = 0;
256533 int32_t iDecCurIdrPicId;
@@ -263,7 +540,7 @@ TEST_P (EncodeDecodeTestAPI, GetOptionIDR) { · 6 unmodified lines
263540 encoder_->SetOption (ENCODER_OPTION_IDR_INTERVAL, &iIDRPeriod);
264541 encoder_->SetOption (ENCODER_OPTION_ENABLE_SPS_PPS_ID_ADDITION, &iSpsPpsIdAddition);
265542
266− EncodeOneFrame();
543+ EncodeOneFrame (0);
267544
268545 if (info.eFrameType == videoFrameTypeIDR) {
269546 iEncCurIdrPicId = (iSpsPpsIdAddition == 0) ? 0 : (iEncCurIdrPicId + 1);
@@ -485,7 +762,7 @@ TEST_P (EncodeDecodeTestAPI, GetOptionLTR_ALLIDR) { · 215 unmodified lines
485762 int rv = encoder_->InitializeExt (&param_);
486763 ASSERT_TRUE (rv == cmResultSuccess);
487764
488− prepareEncDecParam (p);
765+ InitialEncDec (p.width, p.height);
489766
490767 int32_t iTraceLevel = WELS_LOG_QUIET;
491768 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);
@@ -502,7 +779,7 @@ TEST_P (EncodeDecodeTestAPI, GetOptionLTR_ALLIDR) { · 10 unmodified lines
502779 encoder_->SetOption (ENCODER_LTR_MARKING_PERIOD, &iLtrPeriod);
503780 int iIdx = 0;
504781 while (iIdx <= p.numframes) {
505− EncodeOneFrame();
782+ EncodeOneFrame (0);
506783 ASSERT_TRUE (info.eFrameType == videoFrameTypeIDR);
507784 encoder_->ForceIntraFrame (true);
508785 iIdx++;
@@ -578,7 +855,7 @@ TEST_P (EncodeDecodeTestAPI, GetOptionLTR_Engine) { · 69 unmodified lines
578855 ASSERT_TRUE (rv == cmResultSuccess);
579856 m_LTR_Recover_Request.uiFeedbackType = NO_RECOVERY_REQUSET;
580857
581− prepareEncDecParam (p);
858+ InitialEncDec (p.width, p.height);
582859
583860 int32_t iTraceLevel = WELS_LOG_QUIET;
584861 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);
@@ -597,7 +874,7 @@ TEST_P (EncodeDecodeTestAPI, GetOptionLTR_Engine) { · 12 unmodified lines
597874 int iLossIdx = 0;
598875 bool bVCLLoss = false;
599876 while (iIdx <= p.numframes) {
600− EncodeOneFrame();
877+ EncodeOneFrame (1);
601878 if (m_LTR_Recover_Request.uiFeedbackType == IDR_RECOVERY_REQUEST) {
602879 ASSERT_TRUE (info.eFrameType == videoFrameTypeIDR);
603880 }
@@ -641,7 +918,7 @@ TEST_P (EncodeDecodeTestAPI, SetOptionECFlag_ERROR_CON_DISABLE) { · 37 unmodified lines
641918 ASSERT_EQ (0, rv);
642919 m_LTR_Recover_Request.uiFeedbackType = NO_RECOVERY_REQUSET;
643920
644− prepareEncDecParam (p);
921+ InitialEncDec (p.width, p.height);
645922 int32_t iTraceLevel = WELS_LOG_QUIET;
646923 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);
647924 decoder_->SetOption (DECODER_OPTION_TRACE_LEVEL, &iTraceLevel);
@@ -660,7 +937,7 @@ TEST_P (EncodeDecodeTestAPI, SetOptionECFlag_ERROR_CON_DISABLE) { · 12 unmodified lines
660937 int iSkipedBytes;
661938 bool bVCLLoss = false;
662939 while (iIdx <= p.numframes) {
663− EncodeOneFrame();
940+ EncodeOneFrame (1);
664941 if (m_LTR_Recover_Request.uiFeedbackType == IDR_RECOVERY_REQUEST) {
665942 ASSERT_TRUE (info.eFrameType == videoFrameTypeIDR);
666943 }
@@ -695,7 +972,7 @@ TEST_P (EncodeDecodeTestAPI, SetOptionECFlag_ERROR_CON_SLICE_COPY) { · 28 unmodified lines
695972 ASSERT_TRUE (rv == cmResultSuccess);
696973 m_LTR_Recover_Request.uiFeedbackType = NO_RECOVERY_REQUSET;
697974
698− prepareEncDecParam (p);
975+ InitialEncDec (p.width, p.height);
699976 int32_t iTraceLevel = WELS_LOG_QUIET;
700977 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);
701978 decoder_->SetOption (DECODER_OPTION_TRACE_LEVEL, &iTraceLevel);
@@ -714,7 +991,7 @@ TEST_P (EncodeDecodeTestAPI, SetOptionECFlag_ERROR_CON_SLICE_COPY) { · 12 unmodified lines
714991 int iSkipedBytes;
715992 bool bVCLLoss = false;
716993 while (iIdx <= p.numframes) {
717− EncodeOneFrame();
994+ EncodeOneFrame (1);
718995 if (m_LTR_Recover_Request.uiFeedbackType == IDR_RECOVERY_REQUEST) {
719996 ASSERT_TRUE (info.eFrameType == videoFrameTypeIDR);
720997 }
@@ -750,7 +1027,7 @@ TEST_P (EncodeDecodeTestAPI, GetOptionTid_AVC_NOPREFIX) { · 29 unmodified lines
7501027 int rv = encoder_->InitializeExt (&param_);
7511028 ASSERT_TRUE (rv == cmResultSuccess);
7521029 m_LTR_Recover_Request.uiFeedbackType = NO_RECOVERY_REQUSET;
753− prepareEncDecParam (p);
1030+ InitialEncDec (p.width, p.height);
7541031 int32_t iTraceLevel = WELS_LOG_QUIET;
7551032 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);
7561033 decoder_->SetOption (DECODER_OPTION_TRACE_LEVEL, &iTraceLevel);
@@ -768,7 +1045,7 @@ TEST_P (EncodeDecodeTestAPI, GetOptionTid_AVC_NOPREFIX) { · 11 unmodified lines
7681045 int iLossIdx = 0;
7691046 bool bVCLLoss = false;
7701047 while (iIdx <= p.numframes) {
771− EncodeOneFrame();
1048+ EncodeOneFrame (1);
7721049 if (m_LTR_Recover_Request.uiFeedbackType == IDR_RECOVERY_REQUEST) {
7731050 ASSERT_TRUE (info.eFrameType == videoFrameTypeIDR);
7741051 }
@@ -821,7 +1098,7 @@ TEST_P (EncodeDecodeTestAPI, GetOptionTid_AVC_WITH_PREFIX_NOLOSS) { · 46 unmodified lines
8211098 ASSERT_TRUE (rv == cmResultSuccess);
8221099 m_LTR_Recover_Request.uiFeedbackType = NO_RECOVERY_REQUSET;
8231100
824− prepareEncDecParam (p);
1101+ InitialEncDec (p.width, p.height);
8251102 int32_t iTraceLevel = WELS_LOG_QUIET;
8261103 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);
8271104 decoder_->SetOption (DECODER_OPTION_TRACE_LEVEL, &iTraceLevel);
@@ -837,7 +1114,7 @@ TEST_P (EncodeDecodeTestAPI, GetOptionTid_AVC_WITH_PREFIX_NOLOSS) { · 9 unmodified lines
8371114 encoder_->SetOption (ENCODER_LTR_MARKING_PERIOD, &iLtrPeriod);
8381115 int iIdx = 0;
8391116 while (iIdx <= p.numframes) {
840− EncodeOneFrame();
1117+ EncodeOneFrame (1);
8411118 if (m_LTR_Recover_Request.uiFeedbackType == IDR_RECOVERY_REQUEST) {
8421119 ASSERT_TRUE (info.eFrameType == videoFrameTypeIDR);
8431120 }
@@ -875,7 +1152,7 @@ TEST_P (EncodeDecodeTestAPI, GetOptionTid_SVC_L1_NOLOSS) { · 31 unmodified lines
8751152 ASSERT_TRUE (rv == cmResultSuccess);
8761153 m_LTR_Recover_Request.uiFeedbackType = NO_RECOVERY_REQUSET;
8771154
878− prepareEncDecParam (p);
1155+ InitialEncDec (p.width, p.height);
8791156 int32_t iTraceLevel = WELS_LOG_QUIET;
8801157 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);
8811158 decoder_->SetOption (DECODER_OPTION_TRACE_LEVEL, &iTraceLevel);
@@ -891,7 +1168,7 @@ TEST_P (EncodeDecodeTestAPI, GetOptionTid_SVC_L1_NOLOSS) { · 9 unmodified lines
8911168 encoder_->SetOption (ENCODER_LTR_MARKING_PERIOD, &iLtrPeriod);
8921169 int iIdx = 0;
8931170 while (iIdx <= p.numframes) {
894− EncodeOneFrame();
1171+ EncodeOneFrame (1);
8951172 if (m_LTR_Recover_Request.uiFeedbackType == IDR_RECOVERY_REQUEST) {
8961173 ASSERT_TRUE (info.eFrameType == videoFrameTypeIDR);
8971174 }
@@ -930,7 +1207,7 @@ TEST_P (EncodeDecodeTestAPI, SetOption_Trace) { · 32 unmodified lines
9301207 ASSERT_TRUE (rv == cmResultSuccess);
9311208 m_LTR_Recover_Request.uiFeedbackType = NO_RECOVERY_REQUSET;
9321209
933− prepareEncDecParam (p);
1210+ InitialEncDec (p.width, p.height);
9341211 int32_t iTraceLevel = WELS_LOG_QUIET;
9351212 pFunc = TestOutPutTrace;
9361213 pTraceInfo = &sTrace;
@@ -960,7 +1237,7 @@ TEST_P (EncodeDecodeTestAPI, SetOption_Trace) { · 23 unmodified lines
9601237 sTrace.iTarLevel = iTraceLevel;
9611238 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);
9621239 decoder_->SetOption (DECODER_OPTION_TRACE_LEVEL, &iTraceLevel);
963− EncodeOneFrame();
1240+ EncodeOneFrame (1);
9641241 if (m_LTR_Recover_Request.uiFeedbackType == IDR_RECOVERY_REQUEST) {
9651242 ASSERT_TRUE (info.eFrameType == videoFrameTypeIDR);
9661243 }
@@ -992,7 +1269,7 @@ TEST_P (EncodeDecodeTestAPI, SetOption_Trace_NULL) { · 25 unmodified lines
9921269 ASSERT_TRUE (rv == cmResultSuccess);
9931270 m_LTR_Recover_Request.uiFeedbackType = NO_RECOVERY_REQUSET;
9941271
995− prepareEncDecParam (p);
1272+ InitialEncDec (p.width, p.height);
9961273
9971274 int32_t iTraceLevel = WELS_LOG_QUIET;
9981275 pFunc = NULL;
@@ -1021,7 +1298,7 @@ TEST_P (EncodeDecodeTestAPI, SetOption_Trace_NULL) { · 22 unmodified lines
10211298 iTraceLevel = rand() % 33;
10221299 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);
10231300 decoder_->SetOption (DECODER_OPTION_TRACE_LEVEL, &iTraceLevel);
1024− EncodeOneFrame();
1301+ EncodeOneFrame (1);
10251302 if (m_LTR_Recover_Request.uiFeedbackType == IDR_RECOVERY_REQUEST) {
10261303 ASSERT_TRUE (info.eFrameType == videoFrameTypeIDR);
10271304 }
@@ -1064,7 +1341,7 @@ TEST_P (EncodeDecodeTestAPI, SetOptionECIDC_GeneralSliceChange) { · 36 unmodified lines
10641341
10651342 //Start for enc/dec
10661343
1067− prepareEncDecParam (p);
1344+ InitialEncDec (p.width, p.height);
10681345 int32_t iTraceLevel = WELS_LOG_QUIET;
10691346 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);
10701347 decoder_->SetOption (DECODER_OPTION_TRACE_LEVEL, &iTraceLevel);
@@ -1076,7 +1353,7 @@ TEST_P (EncodeDecodeTestAPI, SetOptionECIDC_GeneralSliceChange) { · 5 unmodified lines
10761353
10771354 //enc/dec pictures
10781355 while (iIdx <= p.numframes) {
1079− EncodeOneFrame();
1356+ EncodeOneFrame (1);
10801357 //decoding after each encoding frame
10811358 len = 0;
10821359 iPacketNum = 0;
@@ -1151,9 +1428,9 @@ TEST_F (EncodeDecodeTestAPI, SetOptionECIDC_SpecificFrameChange) { · 68 unmodified lines
11511428 int len = 0;
11521429 unsigned char* pData[3] = { NULL };
11531430
1154− prepareEncDecParam (p);
1431+ InitialEncDec (p.width, p.height);
11551432 //Frame 0: IDR, EC_IDC=DISABLE, loss = 0
1156− EncodeOneFrame();
1433+ EncodeOneFrame (1);
11571434 encToDecData (info, len);
11581435 decoder_->GetOption (DECODER_OPTION_ERROR_CON_IDC, &uiGet);
11591436 EXPECT_EQ (uiGet, (ERROR_CON_IDC) ERROR_CON_DISABLE);
@@ -1168,11 +1445,11 @@ TEST_F (EncodeDecodeTestAPI, SetOptionECIDC_SpecificFrameChange) { · 8 unmodified lines
11681445 iIdx++;
11691446
11701447 //Frame 1: P, EC_IDC=DISABLE, loss = 1
1171− EncodeOneFrame();
1448+ EncodeOneFrame (1);
11721449 iIdx++;
11731450
11741451 //Frame 2: P, EC_IDC=DISABLE, loss = 0
1175− EncodeOneFrame();
1452+ EncodeOneFrame (1);
11761453 encToDecData (info, len);
11771454 pData[0] = pData[1] = pData[2] = 0;
11781455 memset (&dstBufInfo_, 0, sizeof (SBufferInfo));
@@ -1192,7 +1469,7 @@ TEST_F (EncodeDecodeTestAPI, SetOptionECIDC_SpecificFrameChange) { · 13 unmodified lines
11921469 decoder_->GetOption (DECODER_OPTION_ERROR_CON_IDC, &uiGet);
11931470 EXPECT_EQ (uiGet, uiEcIdc);
11941471 //Frame 3: P, EC_IDC=SLICE_COPY, loss = 0
1195− EncodeOneFrame();
1472+ EncodeOneFrame (1);
11961473 encToDecData (info, len);
11971474 decoder_->GetOption (DECODER_OPTION_ERROR_CON_IDC, &uiGet);
11981475 EXPECT_EQ (uiGet, (uint32_t) ERROR_CON_SLICE_COPY);
@@ -1212,7 +1489,7 @@ TEST_F (EncodeDecodeTestAPI, SetOptionECIDC_SpecificFrameChange) { · 13 unmodified lines
12121489 decoder_->GetOption (DECODER_OPTION_ERROR_CON_IDC, &uiGet);
12131490 EXPECT_EQ (uiGet, uiEcIdc);
12141491 //Frame 4: P, EC_IDC=DISABLE, loss = 0
1215− EncodeOneFrame();
1492+ EncodeOneFrame (1);
12161493 encToDecData (info, len);
12171494 decoder_->GetOption (DECODER_OPTION_ERROR_CON_IDC, &uiGet);
12181495 EXPECT_EQ (uiGet, (uint32_t) ERROR_CON_DISABLE);
@@ -1228,7 +1505,7 @@ TEST_F (EncodeDecodeTestAPI, SetOptionECIDC_SpecificFrameChange) { · 9 unmodified lines
12281505 iIdx++;
12291506
12301507 //Frame 5: P, EC_IDC=DISABLE, loss = 1
1231− EncodeOneFrame();
1508+ EncodeOneFrame (1);
12321509 iIdx++;
12331510
12341511 //set EC=FRAME_COPY
@@ -1237,12 +1514,12 @@ TEST_F (EncodeDecodeTestAPI, SetOptionECIDC_SpecificFrameChange) { · 2 unmodified lines
12371514 decoder_->GetOption (DECODER_OPTION_ERROR_CON_IDC, &uiGet);
12381515 EXPECT_EQ (uiGet, uiEcIdc);
12391516 //Frame 6: P, EC_IDC=FRAME_COPY, loss = 1
1240− EncodeOneFrame();
1517+ EncodeOneFrame (1);
12411518 EXPECT_EQ (uiGet, uiEcIdc);
12421519 iIdx++;
12431520
12441521 //Frame 7: P, EC_IDC=FRAME_COPY, loss = 0
1245− EncodeOneFrame();
1522+ EncodeOneFrame (1);
12461523 encToDecData (info, len);
12471524 decoder_->GetOption (DECODER_OPTION_ERROR_CON_IDC, &uiGet);
12481525 EXPECT_EQ (uiGet, (uint32_t) ERROR_CON_FRAME_COPY);
@@ -1285,10 +1562,10 @@ TEST_F (EncodeDecodeTestAPI, SetOptionECIDC_SpecificSliceChange_IDRLoss) { · 36 unmodified lines
12851562 unsigned char* pData[3] = { NULL };
12861563 int iTotalSliceSize = 0;
12871564
1288− prepareEncDecParam (p);
1565+ InitialEncDec (p.width, p.height);
12891566
12901567 //Frame 0: IDR, EC_IDC=2, loss = 2
1291− EncodeOneFrame();
1568+ EncodeOneFrame (1);
12921569 iTotalSliceSize = 0;
12931570 encToDecSliceData (0, 0, info, len); //SPS
12941571 iTotalSliceSize = len;
@@ -1310,7 +1587,7 @@ TEST_F (EncodeDecodeTestAPI, SetOptionECIDC_SpecificSliceChange_IDRLoss) { · 15 unmodified lines
13101587
13111588 //Frame 1: P, EC_IDC=2, loss = 0
13121589 //will clean SPS/PPS status
1313− EncodeOneFrame();
1590+ EncodeOneFrame (1);
13141591 encToDecData (info, len); //all slice together
13151592 pData[0] = pData[1] = pData[2] = 0;
13161593 memset (&dstBufInfo_, 0, sizeof (SBufferInfo));
@@ -1331,7 +1608,7 @@ TEST_F (EncodeDecodeTestAPI, SetOptionECIDC_SpecificSliceChange_IDRLoss) { · 14 unmodified lines
13311608 EXPECT_EQ (uiGet, uiEcIdc);
13321609 //Frame 2: P, EC_IDC=0, loss = 0
13331610 /////will clean SPS/PPS status
1334− EncodeOneFrame();
1611+ EncodeOneFrame (1);
13351612 encToDecData (info, len); //all slice together
13361613 pData[0] = pData[1] = pData[2] = 0;
13371614 memset (&dstBufInfo_, 0, sizeof (SBufferInfo));
@@ -1351,7 +1628,7 @@ TEST_F (EncodeDecodeTestAPI, SetOptionECIDC_SpecificSliceChange_IDRLoss) { · 13 unmodified lines
13511628 decoder_->GetOption (DECODER_OPTION_ERROR_CON_IDC, &uiGet);
13521629 EXPECT_EQ (uiGet, uiEcIdc);
13531630 //Frame 3: P, EC_IDC=2, loss = 1
1354− EncodeOneFrame();
1631+ EncodeOneFrame (1);
13551632 encToDecSliceData (0, 0, info, iTotalSliceSize); //slice 1 lost
13561633 encToDecSliceData (0, 1, info, len); //slice 2
13571634 pData[0] = pData[1] = pData[2] = 0;
@@ -1372,7 +1649,7 @@ TEST_F (EncodeDecodeTestAPI, SetOptionECIDC_SpecificSliceChange_IDRLoss) { · 14 unmodified lines
13721649 decoder_->GetOption (DECODER_OPTION_ERROR_CON_IDC, &uiGet);
13731650 EXPECT_EQ (uiGet, uiEcIdc);
13741651 //Frame 4: P, EC_IDC=0, loss = 0
1375− EncodeOneFrame();
1652+ EncodeOneFrame (1);
13761653 encToDecData (info, len); //all slice
13771654 pData[0] = pData[1] = pData[2] = 0;
13781655 memset (&dstBufInfo_, 0, sizeof (SBufferInfo));
@@ -1417,7 +1694,7 @@ TEST_F (EncodeDecodeTestAPI, SetOptionECIDC_SpecificSliceChange_IDRNoLoss) { · 38 unmodified lines
14171694 unsigned char* pData[3] = { NULL };
14181695 int iTotalSliceSize = 0;
14191696
1420− prepareEncDecParam (p);
1697+ InitialEncDec (p.width, p.height);
14211698
14221699 //set EC=DISABLE
14231700 uiEcIdc = (uint32_t) (ERROR_CON_DISABLE);
@@ -1426,7 +1703,7 @@ TEST_F (EncodeDecodeTestAPI, SetOptionECIDC_SpecificSliceChange_IDRNoLoss) { · 2 unmodified lines
14261703 EXPECT_EQ (uiGet, uiEcIdc);
14271704 //Frame 0: IDR, EC_IDC=0, loss = 0
14281705 //Expected result: all OK, 2nd Output
1429− EncodeOneFrame();
1706+ EncodeOneFrame (1);
14301707 encToDecData (info, len); //all slice
14311708 pData[0] = pData[1] = pData[2] = 0;
14321709 memset (&dstBufInfo_, 0, sizeof (SBufferInfo));
@@ -1441,7 +1718,7 @@ TEST_F (EncodeDecodeTestAPI, SetOptionECIDC_SpecificSliceChange_IDRNoLoss) { · 8 unmodified lines
14411718
14421719 //Frame 1: P, EC_IDC=0, loss = 0
14431720 //Expected result: all OK, 2nd Output
1444− EncodeOneFrame();
1721+ EncodeOneFrame (1);
14451722 encToDecData (info, len); //all slice together
14461723 pData[0] = pData[1] = pData[2] = 0;
14471724 memset (&dstBufInfo_, 0, sizeof (SBufferInfo));
@@ -1457,7 +1734,7 @@ TEST_F (EncodeDecodeTestAPI, SetOptionECIDC_SpecificSliceChange_IDRNoLoss) { · 9 unmodified lines
14571734
14581735 //Frame 2: P, EC_IDC=0, loss = 1
14591736 //Expected result: all OK, no Output
1460− EncodeOneFrame();
1737+ EncodeOneFrame (1);
14611738 encToDecSliceData (0, 0, info, iTotalSliceSize); // slice 1 lost
14621739 encToDecSliceData (0, 1, info, len); // slice 2 only
14631740 pData[0] = pData[1] = pData[2] = 0;
@@ -1479,7 +1756,7 @@ TEST_F (EncodeDecodeTestAPI, SetOptionECIDC_SpecificSliceChange_IDRNoLoss) { · 15 unmodified lines
14791756 EXPECT_EQ (uiGet, uiEcIdc);
14801757 //Frame 3: P, EC_IDC=2, loss = 2
14811758 //Expected result: neither OK, 1st Output
1482− EncodeOneFrame();
1759+ EncodeOneFrame (1);
14831760 encToDecSliceData (0, 0, info, len); //slice 1 only
14841761 pData[0] = pData[1] = pData[2] = 0;
14851762 memset (&dstBufInfo_, 0, sizeof (SBufferInfo));
@@ -1500,7 +1777,7 @@ TEST_F (EncodeDecodeTestAPI, SetOptionECIDC_SpecificSliceChange_IDRNoLoss) { · 14 unmodified lines
15001777 EXPECT_EQ (uiGet, uiEcIdc);
15011778 //Frame 4: P, EC_IDC=0, loss = 0
15021779 //Expected result: depends on DecodeFrame2 result. If OK, output; else ,no output
1503− EncodeOneFrame();
1780+ EncodeOneFrame (1);
15041781 encToDecData (info, len); //all slice
15051782 pData[0] = pData[1] = pData[2] = 0;
15061783 memset (&dstBufInfo_, 0, sizeof (SBufferInfo));
@@ -1519,7 +1796,7 @@ TEST_F (EncodeDecodeTestAPI, SetOptionECIDC_SpecificSliceChange_IDRNoLoss) { · 12 unmodified lines
15191796 //Expected result: depends on DecodeFrame2 result. If OK, output; else ,no output
15201797 int32_t iIDRPeriod = 1;
15211798 encoder_->SetOption (ENCODER_OPTION_IDR_INTERVAL, &iIDRPeriod);
1522− EncodeOneFrame();
1799+ EncodeOneFrame (1);
15231800 EXPECT_TRUE (info.eFrameType == videoFrameTypeIDR);
15241801 encToDecSliceData (0, 0, info, len); //SPS
15251802 iTotalSliceSize = len;
@@ -1577,7 +1854,7 @@ TEST_F (EncodeDecodeTestAPI, Engine_SVC_Switch_I) { · 51 unmodified lines
15771854 ASSERT_TRUE (rv == cmResultSuccess);
15781855 m_LTR_Recover_Request.uiFeedbackType = NO_RECOVERY_REQUSET;
15791856
1580− prepareEncDecParam (p);
1857+ InitialEncDec (p.width, p.height);
15811858 int32_t iTraceLevel = WELS_LOG_QUIET;
15821859 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);
15831860 decoder_->SetOption (DECODER_OPTION_TRACE_LEVEL, &iTraceLevel);
@@ -1594,7 +1871,7 @@ TEST_F (EncodeDecodeTestAPI, Engine_SVC_Switch_I) { · 10 unmodified lines
15941871 int iIdx = 0;
15951872 int iTarDid = 0;
15961873 while (iIdx <= p.numframes) {
1597− EncodeOneFrame();
1874+ EncodeOneFrame (1);
15981875 if (m_LTR_Recover_Request.uiFeedbackType == IDR_RECOVERY_REQUEST) {
15991876 ASSERT_TRUE (info.eFrameType == videoFrameTypeIDR);
16001877 }
@@ -1642,7 +1919,7 @@ TEST_F (EncodeDecodeTestAPI, Engine_SVC_Switch_P) { · 41 unmodified lines
16421919 ASSERT_TRUE (rv == cmResultSuccess);
16431920 m_LTR_Recover_Request.uiFeedbackType = NO_RECOVERY_REQUSET;
16441921
1645− prepareEncDecParam (p);
1922+ InitialEncDec (p.width, p.height);
16461923 int32_t iTraceLevel = WELS_LOG_QUIET;
16471924 encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &iTraceLevel);
16481925 decoder_->SetOption (DECODER_OPTION_TRACE_LEVEL, &iTraceLevel);
@@ -1659,7 +1936,7 @@ TEST_F (EncodeDecodeTestAPI, Engine_SVC_Switch_P) { · 10 unmodified lines
16591936 int iIdx = 0;
16601937
16611938 while (iIdx <= p.numframes) {
1662− EncodeOneFrame();
1939+ EncodeOneFrame (1);
16631940 if (m_LTR_Recover_Request.uiFeedbackType == IDR_RECOVERY_REQUEST) {
16641941 ASSERT_TRUE (info.eFrameType == videoFrameTypeIDR);
16651942 }
@@ -1711,3 +1988,49 @@ TEST_F (EncodeDecodeTestAPI, Engine_SVC_Switch_P) { · 45 unmodified lines
17111988 iLastDid = iTarDid;
17121989 }
17131990 }
1991+
1992+
1993+TEST_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