History

add one test case

Sijia Chen committed 11 years ago

Commit 3350cf71 parent 054a2971 file · +64 −2Browse 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+64−2
@@ -3738,7 +3738,7 @@ TEST_F (EncodeDecodeTestAPI, DiffSlicingInDlayer) { · 3737 unmodified lines
37383738 SEncParamExt sParam;
37393739 encoder_->GetDefaultParams (&sParam);
37403740 prepareParamDefault (iSpatialLayerNum, 1, iWidth, iHeight, fFrameRate, &sParam);
3741− sParam.iMultipleThreadIdc = (rand()%4) + 1;
3741+ sParam.iMultipleThreadIdc = (rand() % 4) + 1;
37423742 sParam.bSimulcastAVC = 1;
37433743 sParam.sSpatialLayers[0].iVideoWidth = (iWidth >> 2);
37443744 sParam.sSpatialLayers[0].iVideoHeight = (iHeight >> 2);
@@ -3753,7 +3753,7 @@ TEST_F (EncodeDecodeTestAPI, DiffSlicingInDlayer) { · 8 unmodified lines
37533753 sParam.sSpatialLayers[2].iVideoWidth = iWidth;
37543754 sParam.sSpatialLayers[2].iVideoHeight = iHeight;
37553755 sParam.sSpatialLayers[2].sSliceCfg.uiSliceMode = SM_FIXEDSLCNUM_SLICE;
3756− sParam.sSpatialLayers[2].sSliceCfg.sSliceArgument.uiSliceNum = 4;
3756+ sParam.sSpatialLayers[2].sSliceCfg.sSliceArgument.uiSliceNum = (rand() % 30) + 1;
37573757
37583758 int rv = encoder_->InitializeExt (&sParam);
37593759 ASSERT_TRUE (rv == cmResultSuccess) << "Init Failed sParam: rv = " << rv;;
@@ -3795,3 +3795,65 @@ TEST_F (EncodeDecodeTestAPI, DiffSlicingInDlayer) { · 35 unmodified lines
37953795
37963796 }
37973797 }
3798+
3799+TEST_F (EncodeDecodeTestAPI, ThreadNumAndSliceNum) {
3800+ int iSpatialLayerNum = 1;
3801+ int iWidth = WelsClip3 ((((rand() % MAX_WIDTH) >> 1) + 1) << 1, (64 << 2), MAX_WIDTH);
3802+ int iHeight = WelsClip3 ((((rand() % MAX_HEIGHT) >> 1) + 1) << 1, (64 << 2),
3803+ 2240);//TODO: use MAX_HEIGHT after the limit is removed
3804+ float fFrameRate = rand() + 0.5f;
3805+ int iEncFrameNum = WelsClip3 ((rand() % ENCODE_FRAME_NUM) + 1, 1, ENCODE_FRAME_NUM);
3806+
3807+ // prepare params
3808+ SEncParamExt sParam;
3809+ encoder_->GetDefaultParams (&sParam);
3810+ prepareParamDefault (iSpatialLayerNum, 1, iWidth, iHeight, fFrameRate, &sParam);
3811+ sParam.iMultipleThreadIdc = (rand() % 3) + 2;
3812+ sParam.bSimulcastAVC = 1;
3813+ sParam.sSpatialLayers[0].iVideoWidth = iWidth;
3814+ sParam.sSpatialLayers[0].iVideoHeight = iHeight;
3815+ sParam.sSpatialLayers[0].sSliceCfg.uiSliceMode = SM_FIXEDSLCNUM_SLICE;
3816+ sParam.sSpatialLayers[0].sSliceCfg.sSliceArgument.uiSliceNum = (rand() % 2) ? (sParam.iMultipleThreadIdc + 1) :
3817+ (sParam.iMultipleThreadIdc - 1);
3818+
3819+ int rv = encoder_->InitializeExt (&sParam);
3820+ ASSERT_TRUE (rv == cmResultSuccess) << "Init Failed sParam: rv = " << rv;;
3821+
3822+ unsigned char* pBsBuf[MAX_SPATIAL_LAYER_NUM];
3823+ ISVCDecoder* decoder[MAX_SPATIAL_LAYER_NUM];
3824+
3825+ int iIdx = 0;
3826+
3827+ //create decoder
3828+ for (iIdx = 0; iIdx < iSpatialLayerNum; iIdx++) {
3829+ pBsBuf[iIdx] = static_cast<unsigned char*> (malloc (iWidth * iHeight * 3 * sizeof (unsigned char) / 2));
3830+ EXPECT_TRUE (pBsBuf[iIdx] != NULL);
3831+
3832+ long rv = WelsCreateDecoder (&decoder[iIdx]);
3833+ ASSERT_EQ (0, rv);
3834+ EXPECT_TRUE (decoder[iIdx] != NULL);
3835+
3836+ SDecodingParam decParam;
3837+ memset (&decParam, 0, sizeof (SDecodingParam));
3838+ decParam.eOutputColorFormat = videoFormatI420;
3839+ decParam.uiTargetDqLayer = UCHAR_MAX;
3840+ decParam.eEcActiveIdc = ERROR_CON_SLICE_COPY;
3841+ decParam.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT;
3842+
3843+ rv = decoder[iIdx]->Initialize (&decParam);
3844+ ASSERT_EQ (0, rv);
3845+ }
3846+
3847+ TestOneSimulcastAVC (&sParam, decoder, pBsBuf, iSpatialLayerNum, iEncFrameNum, 0);
3848+
3849+ for (iIdx = 0; iIdx < iSpatialLayerNum; iIdx++) {
3850+ free (pBsBuf[iIdx]);
3851+
3852+ if (decoder[iIdx] != NULL) {
3853+ decoder[iIdx]->Uninitialize();
3854+ WelsDestroyDecoder (decoder[iIdx]);
3855+ }
3856+
3857+ }
3858+}
3859+

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