History

add new SpsPpsStrategy and UT

Sijia Chen committed 11 years ago

Commit 98ed3021 parent e9ec60316 files · +1150 −161Browse files

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

Unified · Split

test/api/encode_decode_api_test.cpp+506−48
@@ -88,26 +88,25 @@ class EncodeDecodeTestBase : public ::testing::TestWithParam<EncodeDecodeFilePar · 87 unmodified lines
8888 BaseDecoderTest::TearDown();
8989 }
9090
91− virtual void prepareParam (int iLayers, int iSlices, int width, int height, float framerate) {
92− memset (&param_, 0, sizeof (SEncParamExt));
93− param_.iUsageType = CAMERA_VIDEO_REAL_TIME;
94− param_.iPicWidth = width;
95− param_.iPicHeight = height;
96− param_.fMaxFrameRate = framerate;
97− param_.iRCMode = RC_OFF_MODE; //rc off
98− param_.iMultipleThreadIdc = 1; //single thread
99− param_.iSpatialLayerNum = iLayers;
100− param_.iNumRefFrame = AUTO_REF_PIC_COUNT;
91+ virtual void prepareParam (int iLayers, int iSlices, int width, int height, float framerate, SEncParamExt* pParam) {
92+ memset (pParam, 0, sizeof (SEncParamExt));
93+ pParam->iUsageType = CAMERA_VIDEO_REAL_TIME;
94+ pParam->iPicWidth = width;
95+ pParam->iPicHeight = height;
96+ pParam->fMaxFrameRate = framerate;
97+ pParam->iRCMode = RC_OFF_MODE; //rc off
98+ pParam->iMultipleThreadIdc = 1; //single thread
99+ pParam->iSpatialLayerNum = iLayers;
100+ pParam->iNumRefFrame = AUTO_REF_PIC_COUNT;
101101 for (int i = 0; i < iLayers; i++) {
102− param_.sSpatialLayers[i].iVideoWidth = width >> (iLayers - i - 1);
103− param_.sSpatialLayers[i].iVideoHeight = height >> (iLayers - i - 1);
104− param_.sSpatialLayers[i].fFrameRate = framerate;
105− param_.sSpatialLayers[i].sSliceCfg.uiSliceMode = SM_FIXEDSLCNUM_SLICE;
106− param_.sSpatialLayers[i].sSliceCfg.sSliceArgument.uiSliceNum = iSlices;
102+ pParam->sSpatialLayers[i].iVideoWidth = width >> (iLayers - i - 1);
103+ pParam->sSpatialLayers[i].iVideoHeight = height >> (iLayers - i - 1);
104+ pParam->sSpatialLayers[i].fFrameRate = framerate;
105+ pParam->sSpatialLayers[i].sSliceCfg.uiSliceMode = SM_FIXEDSLCNUM_SLICE;
106+ pParam->sSpatialLayers[i].sSliceCfg.sSliceArgument.uiSliceNum = iSlices;
107107 }
108−
109−
110108 }
109+
111110 virtual void prepareEncDecParam (const EncodeDecodeFileParamBase EncDecFileParam) {
112111 //for encoder
113112 //I420: 1(Y) + 1/4(U) + 1/4(V)
@@ -147,6 +146,15 @@ class EncodeDecodeTestBase : public ::testing::TestWithParam<EncodeDecodeFilePar · 33 unmodified lines
147146 len = layerInfo.pNalLengthInByte[iSliceNum];
148147 }
149148
149+
150+ virtual int GetRandWidth() {
151+ return (WELS_CLIP3 ((((rand() % MAX_WIDTH) >> 1) + 1) << 1, 2, MAX_WIDTH));
152+ }
153+
154+ virtual int GetRandHeight() {
155+ return (WELS_CLIP3 ((((rand() % MAX_HEIGHT) >> 1) + 1) << 1, 2, MAX_HEIGHT));
156+ }
157+
150158 protected:
151159 SEncParamExt param_;
152160 BufferedData buf_;
@@ -171,8 +179,8 @@ class EncodeDecodeTestAPI : public EncodeDecodeTestBase { · 18 unmodified lines
171179 EncodeDecodeTestBase::TearDown();
172180 }
173181
174− void prepareParam (int iLayers, int iSlices, int width, int height, float framerate) {
175− EncodeDecodeTestBase::prepareParam (iLayers, iSlices, width, height, framerate);
182+ void prepareParam (int iLayers, int iSlices, int width, int height, float framerate, SEncParamExt* pParam) {
183+ EncodeDecodeTestBase::prepareParam (iLayers, iSlices, width, height, framerate, pParam);
176184 }
177185
178186 void InitialEncDec (int iWidth, int iHeight);
@@ -192,6 +200,24 @@ class EncodeDecodeTestAPI : public EncodeDecodeTestBase { · 13 unmodified lines
192200 else if (1 == iCheckTypeIndex)
193201 ASSERT_TRUE (rv == cmResultSuccess || rv == cmUnkonwReason);
194202 }
203+
204+ void EncDecOneFrame (const int iWidth, const int iHeight, const int iFrame, FILE* pfEnc) {
205+ int iLen = 0, rv;
206+ InitialEncDec (iWidth, iHeight);
207+ EncodeOneFrame (iFrame);
208+
209+ //extract target layer data
210+ encToDecData (info, iLen);
211+ //call decoder
212+ unsigned char* pData[3] = { NULL };
213+ memset (&dstBufInfo_, 0, sizeof (SBufferInfo));
214+ rv = decoder_->DecodeFrame2 (info.sLayerInfo[0].pBsBuf, iLen, pData, &dstBufInfo_);
215+ EXPECT_TRUE (rv == cmResultSuccess) << " rv = " << rv << " iFrameIdx = " << iFrame;
216+
217+ if (NULL != pfEnc) {
218+ fwrite (info.sLayerInfo[0].pBsBuf, iLen, 1, pfEnc);
219+ }
220+ }
195221 };
196222
197223 void EncodeDecodeTestAPI::InitialEncDec (int iWidth, int iHeight) {
@@ -234,7 +260,7 @@ void EncodeDecodeTestAPI::RandomParamExtCombination() { · 36 unmodified lines
234260 param_.iNumRefFrame = AUTO_REF_PIC_COUNT;
235261 param_.iMultipleThreadIdc = rand();
236262
237− param_.bEnableSpsPpsIdAddition = (rand() % 2 == 0) ? false : true;
263+ param_.iSpsPpsIdStrategy = rand() % 3;
238264 param_.bPrefixNalAddingCtrl = (rand() % 2 == 0) ? false : true;
239265 param_.bEnableSSEI = (rand() % 2 == 0) ? false : true;
240266 param_.iPaddingFlag = rand() % 2;
@@ -462,7 +488,7 @@ static const EncodeDecodeFileParamBase kFileParamArray[] = { · 221 unmodified lines
462488
463489 TEST_P (EncodeDecodeTestAPI, DecoderVclNal) {
464490 EncodeDecodeFileParamBase p = GetParam();
465− prepareParam (1, p.slicenum, p.width, p.height, p.frameRate);
491+ prepareParam (1, p.slicenum, p.width, p.height, p.frameRate, &param_);
466492 encoder_->Uninitialize();
467493 int rv = encoder_->InitializeExt (&param_);
468494 ASSERT_TRUE (rv == cmResultSuccess);
@@ -498,7 +524,7 @@ TEST_P (EncodeDecodeTestAPI, DecoderVclNal) { · 29 unmodified lines
498524
499525 TEST_P (EncodeDecodeTestAPI, GetOptionFramenum) {
500526 EncodeDecodeFileParamBase p = GetParam();
501− prepareParam (1, p.slicenum, p.width, p.height, p.frameRate);
527+ prepareParam (1, p.slicenum, p.width, p.height, p.frameRate, &param_);
502528 encoder_->Uninitialize();
503529 int rv = encoder_->InitializeExt (&param_);
504530 ASSERT_TRUE (rv == cmResultSuccess);
@@ -535,7 +561,7 @@ TEST_P (EncodeDecodeTestAPI, GetOptionFramenum) { · 30 unmodified lines
535561
536562 TEST_P (EncodeDecodeTestAPI, GetOptionIDR) {
537563 EncodeDecodeFileParamBase p = GetParam();
538− prepareParam (1, p.slicenum, p.width, p.height, p.frameRate);
564+ prepareParam (1, p.slicenum, p.width, p.height, p.frameRate, &param_);
539565 encoder_->Uninitialize();
540566 int rv = encoder_->InitializeExt (&param_);
541567 ASSERT_TRUE (rv == cmResultSuccess);
@@ -554,7 +580,8 @@ TEST_P (EncodeDecodeTestAPI, GetOptionIDR) { · 12 unmodified lines
554580 int32_t iSpsPpsIdAddition = 0;
555581 int iIdx = 0;
556582 while (iIdx <= p.numframes) {
557− iSpsPpsIdAddition = rand() % 2;
583+ iSpsPpsIdAddition = rand() %
584+ 2; //the current strategy supports more than 2 modes, but the switch between the modes>2 is not allowed
558585 iIDRPeriod = (rand() % 150) + 1;
559586 encoder_->SetOption (ENCODER_OPTION_IDR_INTERVAL, &iIDRPeriod);
560587 encoder_->SetOption (ENCODER_OPTION_ENABLE_SPS_PPS_ID_ADDITION, &iSpsPpsIdAddition);
@@ -776,7 +803,7 @@ int SimulateNALLoss (const unsigned char* pSrc, int& iSrcLen, std::vector<SLost · 215 unmodified lines
776803
777804 TEST_P (EncodeDecodeTestAPI, GetOptionLTR_ALLIDR) {
778805 EncodeDecodeFileParamBase p = GetParam();
779− prepareParam (1, p.slicenum, p.width, p.height, p.frameRate);
806+ prepareParam (1, p.slicenum, p.width, p.height, p.frameRate, &param_);
780807 encoder_->Uninitialize();
781808 int rv = encoder_->InitializeExt (&param_);
782809 ASSERT_TRUE (rv == cmResultSuccess);
@@ -809,7 +836,7 @@ TEST_P (EncodeDecodeTestAPI, GetOptionLTR_ALLLTR) { · 26 unmodified lines
809836 SLTRMarkingFeedback m_LTR_Marking_Feedback;
810837 SLTRRecoverRequest m_LTR_Recover_Request;
811838 EncodeDecodeFileParamBase p = GetParam();
812− prepareParam (1, p.slicenum, p.width, p.height, p.frameRate);
839+ prepareParam (1, p.slicenum, p.width, p.height, p.frameRate, &param_);
813840 encoder_->Uninitialize();
814841 int rv = encoder_->InitializeExt (&param_);
815842 ASSERT_TRUE (rv == cmResultSuccess);
@@ -868,7 +895,7 @@ TEST_P (EncodeDecodeTestAPI, GetOptionLTR_Engine) { · 52 unmodified lines
868895 SLTRRecoverRequest m_LTR_Recover_Request;
869896 m_LTR_Recover_Request.uiIDRPicId = 0;
870897 EncodeDecodeFileParamBase p = GetParam();
871− prepareParam (1, p.slicenum, p.width, p.height, p.frameRate);
898+ prepareParam (1, p.slicenum, p.width, p.height, p.frameRate, &param_);
872899 encoder_->Uninitialize();
873900 int rv = encoder_->InitializeExt (&param_);
874901 ASSERT_TRUE (rv == cmResultSuccess);
@@ -918,7 +945,7 @@ TEST_P (EncodeDecodeTestAPI, SetOptionECFlag_ERROR_CON_DISABLE) { · 43 unmodified lines
918945 SLTRRecoverRequest m_LTR_Recover_Request;
919946 m_LTR_Recover_Request.uiIDRPicId = 0;
920947 EncodeDecodeFileParamBase p = GetParam();
921− prepareParam (1, p.slicenum, p.width, p.height, p.frameRate);
948+ prepareParam (1, p.slicenum, p.width, p.height, p.frameRate, &param_);
922949 param_.bEnableLongTermReference = true;
923950 param_.iLTRRefNum = 1;
924951 encoder_->Uninitialize();
@@ -985,7 +1012,7 @@ TEST_P (EncodeDecodeTestAPI, SetOptionECFlag_ERROR_CON_SLICE_COPY) { · 60 unmodified lines
9851012 SLTRRecoverRequest m_LTR_Recover_Request;
9861013 m_LTR_Recover_Request.uiIDRPicId = 0;
9871014 EncodeDecodeFileParamBase p = GetParam();
988− prepareParam (1, p.slicenum, p.width, p.height, p.frameRate);
1015+ prepareParam (1, p.slicenum, p.width, p.height, p.frameRate, &param_);
9891016 encoder_->Uninitialize();
9901017 int rv = encoder_->InitializeExt (&param_);
9911018 ASSERT_TRUE (rv == cmResultSuccess);
@@ -1036,7 +1063,7 @@ TEST_P (EncodeDecodeTestAPI, SetOptionECFlag_ERROR_CON_SLICE_COPY) { · 44 unmodified lines
10361063
10371064 TEST_P (EncodeDecodeTestAPI, InOutTimeStamp) {
10381065 EncodeDecodeFileParamBase p = GetParam();
1039− prepareParam (1, p.slicenum, p.width, p.height, p.frameRate);
1066+ prepareParam (1, p.slicenum, p.width, p.height, p.frameRate, &param_);
10401067 encoder_->Uninitialize();
10411068 int rv = encoder_->InitializeExt (&param_);
10421069 ASSERT_TRUE (rv == cmResultSuccess);
@@ -1086,7 +1113,7 @@ TEST_P (EncodeDecodeTestAPI, GetOptionTid_AVC_NOPREFIX) { · 43 unmodified lines
10861113 SLTRRecoverRequest m_LTR_Recover_Request;
10871114 m_LTR_Recover_Request.uiIDRPicId = 0;
10881115 EncodeDecodeFileParamBase p = GetParam();
1089− prepareParam (1, p.slicenum, p.width, p.height, p.frameRate);
1116+ prepareParam (1, p.slicenum, p.width, p.height, p.frameRate, &param_);
10901117 param_.bPrefixNalAddingCtrl = false;
10911118 param_.iTemporalLayerNum = (rand() % 4) + 1;
10921119 encoder_->Uninitialize();
@@ -1155,7 +1182,7 @@ TEST_P (EncodeDecodeTestAPI, GetOptionTid_AVC_WITH_PREFIX_NOLOSS) { · 62 unmodified lines
11551182 SLTRRecoverRequest m_LTR_Recover_Request;
11561183 m_LTR_Recover_Request.uiIDRPicId = 0;
11571184 EncodeDecodeFileParamBase p = GetParam();
1158− prepareParam (1, p.slicenum, p.width, p.height, p.frameRate);
1185+ prepareParam (1, p.slicenum, p.width, p.height, p.frameRate, &param_);
11591186 param_.bPrefixNalAddingCtrl = true;
11601187 param_.iTemporalLayerNum = (rand() % 4) + 1;
11611188 param_.iSpatialLayerNum = 1;
@@ -1210,7 +1237,7 @@ TEST_P (EncodeDecodeTestAPI, GetOptionTid_SVC_L1_NOLOSS) { · 48 unmodified lines
12101237 SLTRRecoverRequest m_LTR_Recover_Request;
12111238 m_LTR_Recover_Request.uiIDRPicId = 0;
12121239 EncodeDecodeFileParamBase p = GetParam();
1213− prepareParam (2, p.slicenum, p.width, p.height, p.frameRate);
1240+ prepareParam (2, p.slicenum, p.width, p.height, p.frameRate, &param_);
12141241 param_.iTemporalLayerNum = (rand() % 4) + 1;
12151242 param_.iSpatialLayerNum = 2;
12161243 encoder_->Uninitialize();
@@ -1266,7 +1293,7 @@ TEST_P (EncodeDecodeTestAPI, SetOption_Trace) { · 49 unmodified lines
12661293 SLTRRecoverRequest m_LTR_Recover_Request;
12671294 m_LTR_Recover_Request.uiIDRPicId = 0;
12681295 EncodeDecodeFileParamBase p = GetParam();
1269− prepareParam (1, p.slicenum, p.width, p.height, p.frameRate);
1296+ prepareParam (1, p.slicenum, p.width, p.height, p.frameRate, &param_);
12701297 param_.iSpatialLayerNum = 1;
12711298
12721299 int rv = encoder_->InitializeExt (&param_);
@@ -1330,7 +1357,7 @@ TEST_P (EncodeDecodeTestAPI, SetOption_Trace_NULL) { · 57 unmodified lines
13301357 SLTRRecoverRequest m_LTR_Recover_Request;
13311358 m_LTR_Recover_Request.uiIDRPicId = 0;
13321359 EncodeDecodeFileParamBase p = GetParam();
1333− prepareParam (1, p.slicenum, p.width, p.height, p.frameRate);
1360+ prepareParam (1, p.slicenum, p.width, p.height, p.frameRate, &param_);
13341361 param_.iSpatialLayerNum = 1;
13351362 int rv = encoder_->InitializeExt (&param_);
13361363 ASSERT_TRUE (rv == cmResultSuccess);
@@ -1393,7 +1420,7 @@ TEST_P (EncodeDecodeTestAPI, SetOptionECIDC_GeneralSliceChange) { · 56 unmodified lines
13931420 uint32_t uiEcIdc;
13941421 uint32_t uiGet;
13951422 EncodeDecodeFileParamBase p = GetParam();
1396− prepareParam (1, p.slicenum, p.width, p.height, p.frameRate);
1423+ prepareParam (1, p.slicenum, p.width, p.height, p.frameRate, &param_);
13971424 param_.iSpatialLayerNum = 1;
13981425 encoder_->Uninitialize();
13991426 int rv = encoder_->InitializeExt (&param_);
@@ -1473,7 +1500,7 @@ TEST_F (EncodeDecodeTestAPI, SetOptionECIDC_SpecificFrameChange) { · 73 unmodified lines
14731500 uint32_t uiEcIdc;
14741501 uint32_t uiGet;
14751502 EncodeDecodeFileParamBase p = kFileParamArray[0];
1476− prepareParam (1, p.slicenum, p.width, p.height, p.frameRate);
1503+ prepareParam (1, p.slicenum, p.width, p.height, p.frameRate, &param_);
14771504 param_.iSpatialLayerNum = 1;
14781505 encoder_->Uninitialize();
14791506 int rv = encoder_->InitializeExt (&param_);
@@ -1612,7 +1639,7 @@ TEST_F (EncodeDecodeTestAPI, SetOptionECIDC_SpecificSliceChange_IDRLoss) { · 132 unmodified lines
16121639 uint32_t uiEcIdc = 2; //default set as SLICE_COPY
16131640 uint32_t uiGet;
16141641 EncodeDecodeFileParamBase p = kFileParamArray[0];
1615− prepareParam (1, 2, p.width, p.height, p.frameRate);
1642+ prepareParam (1, 2, p.width, p.height, p.frameRate, &param_);
16161643 param_.iSpatialLayerNum = 1;
16171644 encoder_->Uninitialize();
16181645 int rv = encoder_->InitializeExt (&param_);
@@ -1745,7 +1772,7 @@ TEST_F (EncodeDecodeTestAPI, SetOptionECIDC_SpecificSliceChange_IDRNoLoss) { · 126 unmodified lines
17451772 uint32_t uiEcIdc;
17461773 uint32_t uiGet;
17471774 EncodeDecodeFileParamBase p = kFileParamArray[0];
1748− prepareParam (1, 2, p.width, p.height, p.frameRate);
1775+ prepareParam (1, 2, p.width, p.height, p.frameRate, &param_);
17491776 param_.iSpatialLayerNum = 1;
17501777 encoder_->Uninitialize();
17511778 int rv = encoder_->InitializeExt (&param_);
@@ -1914,7 +1941,7 @@ TEST_F (EncodeDecodeTestAPI, Engine_SVC_Switch_I) { · 162 unmodified lines
19141941 EncodeDecodeFileParamBase p = kSVCSwitch[0];
19151942 p.width = p.width << 2;
19161943 p.height = p.height << 2;
1917− prepareParam (4, p.slicenum, p.width, p.height, p.frameRate);
1944+ prepareParam (4, p.slicenum, p.width, p.height, p.frameRate, &param_);
19181945 param_.iTemporalLayerNum = (rand() % 4) + 1;
19191946 param_.iSpatialLayerNum = 4;
19201947 encoder_->Uninitialize();
@@ -1979,7 +2006,7 @@ TEST_F (EncodeDecodeTestAPI, Engine_SVC_Switch_P) { · 58 unmodified lines
19792006 int iLastDid = 0;
19802007 p.width = p.width << 2;
19812008 p.height = p.height << 2;
1982− prepareParam (4, p.slicenum, p.width, p.height, p.frameRate);
2009+ prepareParam (4, p.slicenum, p.width, p.height, p.frameRate, &param_);
19832010 param_.iTemporalLayerNum = (rand() % 4) + 1;
19842011 param_.iSpatialLayerNum = 4;
19852012 encoder_->Uninitialize();
@@ -2065,7 +2092,7 @@ TEST_F (EncodeDecodeTestAPI, SetOptionEncParamExt) { · 79 unmodified lines
20652092 int iEncFrameNum = WelsClip3 ((rand() % ENCODE_FRAME_NUM) + 1, 1, ENCODE_FRAME_NUM);
20662093 int iSliceNum = 1;
20672094 encoder_->GetDefaultParams (&param_);
2068− prepareParam (iSpatialLayerNum, iSliceNum, iWidth, iHeight, fFrameRate);
2095+ prepareParam (iSpatialLayerNum, iSliceNum, iWidth, iHeight, fFrameRate, &param_);
20692096
20702097 int rv = encoder_->InitializeExt (&param_);
20712098 ASSERT_TRUE (rv == cmResultSuccess);
@@ -2128,8 +2155,8 @@ class DecodeCrashTestAPI : public EncodeDecodeTestBase { · 56 unmodified lines
21282155 ASSERT_TRUE (ucBuf_ == NULL);
21292156 }
21302157
2131− void prepareParam (int iLayerNum, int iSliceNum, int width, int height, float framerate) {
2132− EncodeDecodeTestBase::prepareParam (iLayerNum, iSliceNum, width, height, framerate);
2158+ void prepareParam (int iLayerNum, int iSliceNum, int width, int height, float framerate, SEncParamExt* pParam) {
2159+ EncodeDecodeTestBase::prepareParam (iLayerNum, iSliceNum, width, height, framerate, pParam);
21332160 }
21342161
21352162 void prepareEncDecParam (const EncodeDecodeFileParamBase EncDecFileParam);
@@ -2203,11 +2230,11 @@ TEST_F (DecodeCrashTestAPI, DecoderCrashTest) { · 67 unmodified lines
22032230 int iSeed = rand() % 3; //3 indicates the length of kParamArray[] used in the following
22042231 EncodeDecodeParamBase p = kParamArray[iSeed];
22052232 //Initialize Encoder
2206− prepareParam (1, 1, p.width, p.height, p.frameRate);
2233+ prepareParam (1, 1, p.width, p.height, p.frameRate, &param_);
22072234 param_.iRCMode = RC_BITRATE_MODE;
22082235 param_.iTargetBitrate = p.iTarBitrate;
22092236 param_.uiIntraPeriod = 0;
2210− param_.bEnableSpsPpsIdAddition = true;
2237+ param_.iSpsPpsIdStrategy = INCREASING_ID;
22112238 param_.bEnableBackgroundDetection = true;
22122239 param_.bEnableSceneChangeDetect = true;
22132240 param_.bPrefixNalAddingCtrl = true;
@@ -2398,7 +2425,7 @@ TEST_F (DecodeParseAPI, ParseOnly_General) { · 184 unmodified lines
23982425 p.height = iHeight_;
23992426 p.frameRate = kiFrameRate;
24002427 p.numframes = kiFrameNum;
2401− prepareParam (kiTotalLayer, kiSliceNum, p.width, p.height, p.frameRate);
2428+ prepareParam (kiTotalLayer, kiSliceNum, p.width, p.height, p.frameRate, &param_);
24022429 param_.iSpatialLayerNum = kiTotalLayer;
24032430 encoder_->Uninitialize();
24042431 int rv = encoder_->InitializeExt (&param_);
@@ -2475,7 +2502,7 @@ TEST_F (DecodeParseAPI, ParseOnly_SpecSliceLoss) { · 70 unmodified lines
24752502 p.height = iHeight_;
24762503 p.frameRate = kiFrameRate;
24772504 p.numframes = 5;
2478− prepareParam (iLayerNum, iSliceNum, p.width, p.height, p.frameRate);
2505+ prepareParam (iLayerNum, iSliceNum, p.width, p.height, p.frameRate, &param_);
24792506 param_.iSpatialLayerNum = iLayerNum;
24802507 encoder_->Uninitialize();
24812508 int rv = encoder_->InitializeExt (&param_);
@@ -2525,3 +2552,434 @@ TEST_F (DecodeParseAPI, ParseOnly_SpecSliceLoss) { · 43 unmodified lines
25252552 } //while
25262553 }
25272554
2555+//#define DEBUG_FILE_SAVE2
2556+TEST_F (EncodeDecodeTestAPI, ParameterSetStrategy_SPS_LISTING_AND_PPS_INCREASING1) {
2557+
2558+ int iWidth = GetRandWidth();
2559+ int iHeight = GetRandHeight();
2560+ float fFrameRate = rand() + 0.5f;
2561+ int iEncFrameNum = 0;
2562+ int iSpatialLayerNum = 1;
2563+ int iSliceNum = 1;
2564+
2565+ // prepare params
2566+ SEncParamExt sParam1;
2567+ SEncParamExt sParam2;
2568+ SEncParamExt sParam3;
2569+ encoder_->GetDefaultParams (&sParam1);
2570+ prepareParam (iSpatialLayerNum, iSliceNum, iWidth, iHeight, fFrameRate, &sParam1);
2571+ sParam1.iSpsPpsIdStrategy = SPS_LISTING_AND_PPS_INCREASING;
2572+ //prepare param2
2573+ memcpy (&sParam2, &sParam1, sizeof (SEncParamExt));
2574+ while (sParam2.iPicWidth == sParam1.iPicWidth) {
2575+ sParam2.iPicWidth = GetRandWidth();
2576+ }
2577+ prepareParam (iSpatialLayerNum, iSliceNum, sParam2.iPicWidth, sParam2.iPicHeight, fFrameRate, &sParam2);
2578+ sParam2.iSpsPpsIdStrategy = SPS_LISTING_AND_PPS_INCREASING;
2579+ //prepare param3
2580+ memcpy (&sParam3, &sParam1, sizeof (SEncParamExt));
2581+ while (sParam3.iPicHeight == sParam1.iPicHeight) {
2582+ sParam3.iPicHeight = GetRandHeight();
2583+ }
2584+ prepareParam (iSpatialLayerNum, iSliceNum, sParam3.iPicWidth, sParam3.iPicHeight, fFrameRate, &sParam3);
2585+ sParam3.iSpsPpsIdStrategy = SPS_LISTING_AND_PPS_INCREASING;
2586+
2587+ //prepare output if needed
2588+ FILE* fEnc = NULL;
2589+#ifdef DEBUG_FILE_SAVE2
2590+ fEnc = fopen ("enc2.264", "wb");
2591+#endif
2592+
2593+ // Test part#1
2594+ // step#1: pParam1
2595+ //int TraceLevel = WELS_LOG_INFO;
2596+ //encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &TraceLevel);
2597+ int rv = encoder_->InitializeExt (&sParam1);
2598+ ASSERT_TRUE (rv == cmResultSuccess) << "InitializeExt: rv = " << rv << " at " << sParam1.iPicWidth << "x" <<
2599+ sParam1.iPicHeight;
2600+ EncDecOneFrame (sParam1.iPicWidth, sParam1.iPicHeight, iEncFrameNum++, fEnc);
2601+
2602+ // new IDR
2603+ rv = encoder_->ForceIntraFrame (true);
2604+ ASSERT_TRUE (rv == cmResultSuccess) << "rv = " << rv;
2605+ EncDecOneFrame (sParam1.iPicWidth, sParam1.iPicHeight, iEncFrameNum++, fEnc);
2606+
2607+ // step#2: pParam2
2608+ rv = encoder_->SetOption (ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, &sParam2);
2609+ ASSERT_TRUE (rv == cmResultSuccess) << "SetOption: rv = " << rv << " at " << sParam2.iPicWidth << "x" <<
2610+ sParam2.iPicHeight;
2611+ EncDecOneFrame (sParam2.iPicWidth, sParam2.iPicHeight, iEncFrameNum++, fEnc);
2612+
2613+ // new IDR
2614+ rv = encoder_->ForceIntraFrame (true);
2615+ ASSERT_TRUE (rv == cmResultSuccess) << "rv = " << rv;
2616+ EncDecOneFrame (sParam2.iPicWidth, sParam2.iPicHeight, iEncFrameNum++, fEnc);
2617+
2618+ // step#3: back to pParam1
2619+ rv = encoder_->SetOption (ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, &sParam1);
2620+ ASSERT_TRUE (rv == cmResultSuccess) << "SetOption: rv = " << rv << " at " << sParam1.iPicWidth << "x" <<
2621+ sParam1.iPicHeight;
2622+ EncDecOneFrame (sParam1.iPicWidth, sParam1.iPicHeight, iEncFrameNum++, fEnc);
2623+
2624+ // step#4: back to pParam2
2625+ rv = encoder_->SetOption (ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, &sParam2);
2626+ ASSERT_TRUE (rv == cmResultSuccess) << "rv = " << rv << sParam2.iPicWidth << sParam2.iPicHeight;
2627+ EncDecOneFrame (sParam2.iPicWidth, sParam2.iPicHeight, iEncFrameNum++, fEnc);
2628+
2629+#ifdef DEBUG_FILE_SAVE2
2630+ fclose (fEnc);
2631+#endif
2632+ rv = encoder_->Uninitialize();
2633+ ASSERT_TRUE (rv == cmResultSuccess) << "rv = " << rv;
2634+
2635+ // Test part#2
2636+ // step#1: pParam1
2637+ rv = encoder_->InitializeExt (&sParam1);
2638+ ASSERT_TRUE (rv == cmResultSuccess) << "InitializeExt Failed: rv = " << rv;
2639+ rv = encoder_->SetOption (ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, &sParam2);
2640+ ASSERT_TRUE (rv == cmResultSuccess) << "SetOption Failed sParam2: rv = " << rv;
2641+ rv = encoder_->SetOption (ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, &sParam3);
2642+ ASSERT_TRUE (rv == cmResultSuccess) << "SetOption Failed sParam3: rv = " << rv;
2643+
2644+#ifdef DEBUG_FILE_SAVE2
2645+ fEnc = fopen ("enc3.264", "wb");
2646+#endif
2647+ iEncFrameNum = 0;
2648+ EncDecOneFrame (sParam3.iPicWidth, sParam3.iPicHeight, iEncFrameNum++, fEnc);
2649+
2650+ rv = encoder_->SetOption (ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, &sParam2);
2651+ ASSERT_TRUE (rv == cmResultSuccess) << "SetOption Failed sParam2: rv = " << rv;
2652+ EncDecOneFrame (sParam2.iPicWidth, sParam2.iPicHeight, iEncFrameNum++, fEnc);
2653+
2654+ rv = encoder_->SetOption (ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, &sParam1);
2655+ ASSERT_TRUE (rv == cmResultSuccess) << "SetOption Failed sParam2: rv = " << rv;
2656+ EncDecOneFrame (sParam1.iPicWidth, sParam1.iPicHeight, iEncFrameNum++, fEnc);
2657+
2658+#ifdef DEBUG_FILE_SAVE2
2659+ fclose (fEnc);
2660+#endif
2661+ rv = encoder_->Uninitialize();
2662+ ASSERT_TRUE (rv == cmResultSuccess) << "rv = " << rv;
2663+}
2664+
2665+#define DEBUG_FILE_SAVE5
2666+TEST_F (EncodeDecodeTestAPI, ParameterSetStrategy_SPS_LISTING_AND_PPS_INCREASING2) {
2667+ //usage 3: 2 Params with different num_ref, encode IDR0, P1, IDR2;
2668+ //the bs will show two SPS and different PPS
2669+
2670+ int iWidth = GetRandWidth();
2671+ int iHeight = GetRandHeight();
2672+ float fFrameRate = rand() + 0.5f;
2673+ int iEncFrameNum = 0;
2674+ int iSpatialLayerNum = 1;
2675+ int iSliceNum = 1;
2676+
2677+ // prepare params
2678+ SEncParamExt sParam1;
2679+ SEncParamExt sParam2;
2680+ encoder_->GetDefaultParams (&sParam1);
2681+ prepareParam (iSpatialLayerNum, iSliceNum, iWidth, iHeight, fFrameRate, &sParam1);
2682+ sParam1.iSpsPpsIdStrategy = SPS_LISTING_AND_PPS_INCREASING;
2683+ sParam1.iTemporalLayerNum = 1;
2684+ //prepare param2
2685+ memcpy (&sParam2, &sParam1, sizeof (SEncParamExt));
2686+ prepareParam (iSpatialLayerNum, iSliceNum, sParam2.iPicWidth, sParam2.iPicHeight, fFrameRate, &sParam2);
2687+ sParam2.iSpsPpsIdStrategy = SPS_LISTING_AND_PPS_INCREASING;
2688+ sParam2.iTemporalLayerNum = 3;
2689+
2690+ //prepare output if needed
2691+ FILE* fEnc = NULL;
2692+#ifdef DEBUG_FILE_SAVE5
2693+ fEnc = fopen ("encID2.264", "wb");
2694+#endif
2695+
2696+ // step#1: pParam1
2697+ int rv = encoder_->InitializeExt (&sParam1);
2698+ ASSERT_TRUE (rv == cmResultSuccess) << "InitializeExt: rv = " << rv << " at " << sParam1.iPicWidth << "x" <<
2699+ sParam1.iPicHeight;
2700+
2701+ // step#2: pParam2
2702+ rv = encoder_->SetOption (ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, &sParam2);
2703+ ASSERT_TRUE (rv == cmResultSuccess) << "SetOption Failed sParam2: rv = " << rv;
2704+
2705+ // step#3: set back to pParam1, with a smaller num_ref, it still uses the previous SPS
2706+ rv = encoder_->SetOption (ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, &sParam1);
2707+ ASSERT_TRUE (rv == cmResultSuccess) << "SetOption Failed sParam1: rv = " << rv;
2708+ EncDecOneFrame (sParam1.iPicWidth, sParam1.iPicHeight, iEncFrameNum++, fEnc);
2709+
2710+ // new IDR, PPS increases
2711+ rv = encoder_->ForceIntraFrame (true);
2712+ ASSERT_TRUE (rv == cmResultSuccess) << "rv = " << rv;
2713+ EncDecOneFrame (sParam1.iPicWidth, sParam1.iPicHeight, iEncFrameNum++, fEnc);
2714+
2715+ rv = encoder_->Uninitialize();
2716+ ASSERT_TRUE (rv == cmResultSuccess) << "rv = " << rv;
2717+
2718+#ifdef DEBUG_FILE_SAVE5
2719+ fclose (fEnc);
2720+#endif
2721+}
2722+
2723+TEST_F (EncodeDecodeTestAPI, ParameterSetStrategy_SPS_LISTING_AND_PPS_INCREASING3) {
2724+
2725+ int iWidth = GetRandWidth();
2726+ int iHeight = GetRandHeight();
2727+ float fFrameRate = rand() + 0.5f;
2728+ int iEncFrameNum = 0;
2729+ int iSpatialLayerNum = 1;
2730+ int iSliceNum = 1;
2731+
2732+ // prepare params
2733+ SEncParamExt sParam1;
2734+ SEncParamExt sParam2;
2735+ encoder_->GetDefaultParams (&sParam1);
2736+ prepareParam (iSpatialLayerNum, iSliceNum, iWidth, iHeight, fFrameRate, &sParam1);
2737+ sParam1.iSpsPpsIdStrategy = SPS_LISTING_AND_PPS_INCREASING;
2738+
2739+ //prepare output if needed
2740+ FILE* fEnc = NULL;
2741+#ifdef DEBUG_FILE_SAVE2
2742+ fEnc = fopen ("enc4.264", "wb");
2743+#endif
2744+
2745+ // step#1: pParam1
2746+ int rv = encoder_->InitializeExt (&sParam1);
2747+ ASSERT_TRUE (rv == cmResultSuccess) << "InitializeExt Failed: rv = " << rv;
2748+
2749+ int max_count = 65; // make it more then twice as MAX_SPS_COUNT
2750+ std::vector<int> vWidthTable;
2751+ vWidthTable.push_back (sParam1.iPicWidth);
2752+
2753+ std::vector<int>::iterator vWidthTableIt;
2754+ for (int times = 0; times < max_count; times++) {
2755+ //prepare param2
2756+ memcpy (&sParam2, &sParam1, sizeof (SEncParamExt));
2757+ do {
2758+ sParam2.iPicWidth = GetRandWidth();
2759+ vWidthTableIt = std::find (vWidthTable.begin(), vWidthTable.end(), sParam2.iPicWidth);
2760+ } while (vWidthTableIt == vWidthTable.end());
2761+ vWidthTable.push_back (sParam2.iPicWidth);
2762+ prepareParam (iSpatialLayerNum, iSliceNum, sParam2.iPicWidth, sParam2.iPicHeight, fFrameRate, &sParam2);
2763+ sParam2.iSpsPpsIdStrategy = SPS_LISTING_AND_PPS_INCREASING;
2764+
2765+ rv = encoder_->SetOption (ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, &sParam2);
2766+ ASSERT_TRUE (rv == cmResultSuccess) << "SetOption Failed sParam2: rv = " << rv << ", sParam2.iPicWidth=" <<
2767+ sParam2.iPicWidth;
2768+ } // end of setting loop
2769+
2770+ EncDecOneFrame (sParam2.iPicWidth, sParam2.iPicHeight, iEncFrameNum++, fEnc);
2771+
2772+#ifdef DEBUG_FILE_SAVE2
2773+ fclose (fEnc);
2774+#endif
2775+ rv = encoder_->Uninitialize();
2776+ ASSERT_TRUE (rv == cmResultSuccess) << "rv = " << rv;
2777+}
2778+
2779+//#define DEBUG_FILE_SAVE6
2780+TEST_F (EncodeDecodeTestAPI, ParameterSetStrategy_SPS_PPS_LISTING1) {
2781+ //usage 1: 1 resolution Params, encode IDR0, P1, IDR2;
2782+ //the bs will show same SPS and different PPS
2783+ // PPS: pic_parameter_set_id 1 ( 0)
2784+ // PPS: seq_parameter_set_id 1 ( 0)
2785+ // PPS: pic_parameter_set_id 010 ( 1)
2786+ // PPS: seq_parameter_set_id 1 ( 0)
2787+ // SH: slice_type 011 ( 2)
2788+ // SH: pic_parameter_set_id 1 ( 0)
2789+ // SH: slice_type 1 ( 0)
2790+ // SH: pic_parameter_set_id 1 ( 0)
2791+ // SH: slice_type 011 ( 2)
2792+ // SH: pic_parameter_set_id 010 ( 1)
2793+ int iWidth = GetRandWidth();
2794+ int iHeight = GetRandHeight();
2795+ float fFrameRate = rand() + 0.5f;
2796+ int iEncFrameNum = 0;
2797+ int iSpatialLayerNum = 1;
2798+ int iSliceNum = 1;
2799+
2800+ // prepare params
2801+ SEncParamExt sParam1;
2802+ encoder_->GetDefaultParams (&sParam1);
2803+ prepareParam (iSpatialLayerNum, iSliceNum, iWidth, iHeight, fFrameRate, &sParam1);
2804+ sParam1.iSpsPpsIdStrategy = SPS_PPS_LISTING;
2805+
2806+ //prepare output if needed
2807+ FILE* fEnc = NULL;
2808+#ifdef DEBUG_FILE_SAVE6
2809+ fEnc = fopen ("encLIST1.264", "wb");
2810+#endif
2811+
2812+ // step#1: pParam1
2813+ int rv = encoder_->InitializeExt (&sParam1);
2814+ ASSERT_TRUE (rv == cmResultSuccess) << "InitializeExt: rv = " << rv << " at " << sParam1.iPicWidth << "x" <<
2815+ sParam1.iPicHeight;
2816+ EncDecOneFrame (sParam1.iPicWidth, sParam1.iPicHeight, iEncFrameNum++, fEnc);
2817+ EncDecOneFrame (sParam1.iPicWidth, sParam1.iPicHeight, iEncFrameNum++, fEnc);
2818+
2819+ // new IDR
2820+ rv = encoder_->ForceIntraFrame (true);
2821+ ASSERT_TRUE (rv == cmResultSuccess) << "rv = " << rv;
2822+ EncDecOneFrame (sParam1.iPicWidth, sParam1.iPicHeight, iEncFrameNum++, fEnc);
2823+
2824+ rv = encoder_->Uninitialize();
2825+ ASSERT_TRUE (rv == cmResultSuccess) << "rv = " << rv;
2826+
2827+#ifdef DEBUG_FILE_SAVE6
2828+ fclose (fEnc);
2829+#endif
2830+}
2831+
2832+TEST_F (EncodeDecodeTestAPI, ParameterSetStrategy_SPS_PPS_LISTING2) {
2833+ //usage 2: 2 resolution Params, encode IDR0, IDR1, IDR2;
2834+ //the bs will show two SPS and different PPS
2835+ // === SPS LIST ===
2836+ //SPS: seq_parameter_set_id 1 ( 0) -- PARAM1
2837+ //SPS: seq_parameter_set_id 010 ( 1) -- PARAM2
2838+ // === PPS LIST ===
2839+ //PPS: pic_parameter_set_id 1 ( 0)
2840+ //PPS: seq_parameter_set_id 1 ( 0)
2841+ //PPS: pic_parameter_set_id 010 ( 1)
2842+ //PPS: seq_parameter_set_id 010 ( 1)
2843+ //PPS: pic_parameter_set_id 011 ( 2) -- PPS2 - SPS0
2844+ //PPS: seq_parameter_set_id 1 ( 0)
2845+ //PPS: pic_parameter_set_id 00100 ( 3) -- PPS3 - SPS1
2846+ //PPS: seq_parameter_set_id 010 ( 1)
2847+ //PPS: pic_parameter_set_id 00101 ( 4) -- PPS4 - SPS0
2848+ //PPS: seq_parameter_set_id 1 ( 0)
2849+ // === VCL LAYER ===
2850+ //SH: slice_type 011 ( 2) -- PARAM2
2851+ //SH: pic_parameter_set_id 010 ( 1) -- PPS1 - SPS1 - PARAM2
2852+ //SH: slice_type 011 ( 2) -- PARAM1
2853+ //SH: pic_parameter_set_id 011 ( 2) -- PPS2 - SPS0 - PARAM1
2854+ //SH: slice_type 011 ( 2) -- PARAM1
2855+ //SH: pic_parameter_set_id 00101 ( 4) -- PPS4 - SPS0 - PARAM1
2856+
2857+ int iWidth = GetRandWidth();
2858+ int iHeight = GetRandHeight();
2859+ float fFrameRate = rand() + 0.5f;
2860+ int iEncFrameNum = 0;
2861+ int iSpatialLayerNum = 1;
2862+ int iSliceNum = 1;
2863+
2864+ // prepare params
2865+ SEncParamExt sParam1;
2866+ SEncParamExt sParam2;
2867+ encoder_->GetDefaultParams (&sParam1);
2868+ prepareParam (iSpatialLayerNum, iSliceNum, iWidth, iHeight, fFrameRate, &sParam1);
2869+ sParam1.iSpsPpsIdStrategy = SPS_PPS_LISTING;
2870+ //prepare param2
2871+ memcpy (&sParam2, &sParam1, sizeof (SEncParamExt));
2872+ while (sParam2.iPicWidth == sParam1.iPicWidth) {
2873+ sParam2.iPicWidth = GetRandWidth();
2874+ }
2875+ prepareParam (iSpatialLayerNum, iSliceNum, sParam2.iPicWidth, sParam2.iPicHeight, fFrameRate, &sParam2);
2876+ sParam2.iSpsPpsIdStrategy = SPS_PPS_LISTING;
2877+
2878+ //prepare output if needed
2879+ FILE* fEnc = NULL;
2880+#ifdef DEBUG_FILE_SAVE5
2881+ fEnc = fopen ("encLIST2.264", "wb");
2882+#endif
2883+
2884+ // step#1: pParam1
2885+ int rv = encoder_->InitializeExt (&sParam1);
2886+ ASSERT_TRUE (rv == cmResultSuccess) << "InitializeExt: rv = " << rv << " at " << sParam1.iPicWidth << "x" <<
2887+ sParam1.iPicHeight;
2888+
2889+ // step#2: pParam2
2890+ rv = encoder_->SetOption (ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, &sParam2);
2891+ ASSERT_TRUE (rv == cmResultSuccess) << "SetOption Failed sParam2: rv = " << rv;
2892+ EncDecOneFrame (sParam2.iPicWidth, sParam2.iPicHeight, iEncFrameNum++, fEnc);
2893+
2894+ // step#3: back to pParam1, SHOULD NOT encounter ERROR
2895+ rv = encoder_->SetOption (ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, &sParam1);
2896+ ASSERT_TRUE (rv == cmResultSuccess) << "SetOption: rv = " << rv << " at " << sParam1.iPicWidth << "x" <<
2897+ sParam1.iPicHeight;
2898+ EncDecOneFrame (sParam1.iPicWidth, sParam1.iPicHeight, iEncFrameNum++, fEnc);
2899+
2900+ // new IDR
2901+ rv = encoder_->ForceIntraFrame (true);
2902+ ASSERT_TRUE (rv == cmResultSuccess) << "rv = " << rv;
2903+ EncDecOneFrame (sParam1.iPicWidth, sParam1.iPicHeight, iEncFrameNum++, fEnc);
2904+
2905+ rv = encoder_->Uninitialize();
2906+ ASSERT_TRUE (rv == cmResultSuccess) << "rv = " << rv;
2907+
2908+#ifdef DEBUG_FILE_SAVE5
2909+ fclose (fEnc);
2910+#endif
2911+}
2912+
2913+TEST_F (EncodeDecodeTestAPI, ParameterSetStrategy_SPS_PPS_LISTING3) {
2914+
2915+ int iWidth = GetRandWidth();
2916+ int iHeight = GetRandHeight();
2917+ float fFrameRate = rand() + 0.5f;
2918+ int iEncFrameNum = 0;
2919+ int iSpatialLayerNum = 1;
2920+ int iSliceNum = 1;
2921+
2922+ // prepare params
2923+ SEncParamExt sParam1;
2924+ SEncParamExt sParam2;
2925+ SEncParamExt sParam3;
2926+ encoder_->GetDefaultParams (&sParam1);
2927+ prepareParam (iSpatialLayerNum, iSliceNum, iWidth, iHeight, fFrameRate, &sParam1);
2928+ sParam1.iSpsPpsIdStrategy = SPS_PPS_LISTING;
2929+ //prepare param2
2930+ memcpy (&sParam2, &sParam1, sizeof (SEncParamExt));
2931+ while (sParam2.iPicWidth == sParam1.iPicWidth) {
2932+ sParam2.iPicWidth = GetRandWidth();
2933+ }
2934+ prepareParam (iSpatialLayerNum, iSliceNum, sParam2.iPicWidth, sParam2.iPicHeight, fFrameRate, &sParam2);
2935+ sParam2.iSpsPpsIdStrategy = SPS_PPS_LISTING;
2936+ //prepare param3
2937+ memcpy (&sParam3, &sParam1, sizeof (SEncParamExt));
2938+ while (sParam3.iPicWidth == sParam1.iPicWidth || sParam3.iPicWidth == sParam2.iPicWidth) {
2939+ sParam3.iPicWidth = GetRandWidth();
2940+ }
2941+ prepareParam (iSpatialLayerNum, iSliceNum, sParam3.iPicWidth, sParam3.iPicHeight, fFrameRate, &sParam3);
2942+ sParam3.iSpsPpsIdStrategy = SPS_PPS_LISTING;
2943+
2944+ //prepare output if needed
2945+ FILE* fEnc = NULL;
2946+#ifdef DEBUG_FILE_SAVE5
2947+ fEnc = fopen ("enc4.264", "wb");
2948+#endif
2949+
2950+ // step#1: ordinary encoding
2951+ int rv = encoder_->InitializeExt (&sParam1);
2952+ ASSERT_TRUE (rv == cmResultSuccess) << "InitializeExt: rv = " << rv << " at " << sParam1.iPicWidth << "x" <<
2953+ sParam1.iPicHeight;
2954+ rv = encoder_->SetOption (ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, &sParam2);
2955+ ASSERT_TRUE (rv == cmResultSuccess) << "SetOption Failed sParam2: rv = " << rv;
2956+ EncDecOneFrame (sParam2.iPicWidth, sParam2.iPicHeight, iEncFrameNum++, fEnc);
2957+
2958+ // step#2: set strategy for success
2959+ int32_t iNewStra = SPS_PPS_LISTING;
2960+ rv = encoder_->SetOption (ENCODER_OPTION_ENABLE_SPS_PPS_ID_ADDITION, &iNewStra);
2961+ ASSERT_TRUE (rv == cmResultSuccess) << "rv = " << rv << " iNewStra=" << iNewStra;
2962+
2963+ // step#3: setting new strategy, SHOULD encounter ERROR
2964+ unsigned int TraceLevel = WELS_LOG_QUIET;
2965+ rv = encoder_->SetOption (ENCODER_OPTION_TRACE_LEVEL, &TraceLevel);
2966+ ASSERT_TRUE (rv == cmResultSuccess);
2967+ iNewStra = CONSTANT_ID;
2968+ rv = encoder_->SetOption (ENCODER_OPTION_ENABLE_SPS_PPS_ID_ADDITION, &iNewStra);
2969+ ASSERT_TRUE (rv != cmResultSuccess);
2970+
2971+ EncDecOneFrame (sParam2.iPicWidth, sParam2.iPicHeight, iEncFrameNum++, fEnc);
2972+
2973+ // step#4: pParam3, SHOULD encounter ERROR
2974+ rv = encoder_->SetOption (ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, &sParam3);
2975+ ASSERT_TRUE (rv != cmResultSuccess) << "SetOption: rv = " << rv << " at " << sParam3.iPicWidth << "x" <<
2976+ sParam3.iPicHeight;
2977+
2978+ rv = encoder_->Uninitialize();
2979+ ASSERT_TRUE (rv == cmResultSuccess) << "rv = " << rv;
2980+
2981+#ifdef DEBUG_FILE_SAVE5
2982+ fclose (fEnc);
2983+#endif
2984+}
2985+

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