History

fix for a slicing and multi-threading setting

Sijia Chen committed 11 years ago

Commit 2dab8bf1 parent 597adfd2 files · +69 −0Browse files

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

Unified · Split

test/api/encode_decode_api_test.cpp+64−0
@@ -3796,6 +3796,70 @@ TEST_F (EncodeDecodeTestAPI, DiffSlicingInDlayer) { · 3795 unmodified lines
37963796 }
37973797 }
37983798
3799+TEST_F (EncodeDecodeTestAPI, DiffSlicingInDlayerMixed) {
3800+ int iSpatialLayerNum = 2;
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+ 1120);//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() % 4) + 1;
3812+ sParam.bSimulcastAVC = 1;
3813+ sParam.sSpatialLayers[0].iVideoWidth = (iWidth >> 2);
3814+ sParam.sSpatialLayers[0].iVideoHeight = (iHeight >> 2);
3815+ sParam.sSpatialLayers[0].sSliceCfg.uiSliceMode = SM_ROWMB_SLICE;
3816+
3817+ sParam.sSpatialLayers[1].iVideoWidth = iWidth;
3818+ sParam.sSpatialLayers[1].iVideoHeight = iHeight;
3819+ sParam.sSpatialLayers[1].sSliceCfg.uiSliceMode = SM_FIXEDSLCNUM_SLICE;
3820+ sParam.sSpatialLayers[1].sSliceCfg.sSliceArgument.uiSliceNum = 1;
3821+
3822+ int rv = encoder_->InitializeExt (&sParam);
3823+ ASSERT_TRUE (rv == cmResultSuccess) << "Init Failed sParam: rv = " << rv;;
3824+
3825+ unsigned char* pBsBuf[MAX_SPATIAL_LAYER_NUM];
3826+ ISVCDecoder* decoder[MAX_SPATIAL_LAYER_NUM];
3827+
3828+ int iIdx = 0;
3829+
3830+ //create decoder
3831+ for (iIdx = 0; iIdx < iSpatialLayerNum; iIdx++) {
3832+ pBsBuf[iIdx] = static_cast<unsigned char*> (malloc (iWidth * iHeight * 3 * sizeof (unsigned char) / 2));
3833+ EXPECT_TRUE (pBsBuf[iIdx] != NULL);
3834+
3835+ long rv = WelsCreateDecoder (&decoder[iIdx]);
3836+ ASSERT_EQ (0, rv);
3837+ EXPECT_TRUE (decoder[iIdx] != NULL);
3838+
3839+ SDecodingParam decParam;
3840+ memset (&decParam, 0, sizeof (SDecodingParam));
3841+ decParam.eOutputColorFormat = videoFormatI420;
3842+ decParam.uiTargetDqLayer = UCHAR_MAX;
3843+ decParam.eEcActiveIdc = ERROR_CON_SLICE_COPY;
3844+ decParam.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT;
3845+
3846+ rv = decoder[iIdx]->Initialize (&decParam);
3847+ ASSERT_EQ (0, rv);
3848+ }
3849+
3850+ TestOneSimulcastAVC (&sParam, decoder, pBsBuf, iSpatialLayerNum, iEncFrameNum, 0);
3851+
3852+ for (iIdx = 0; iIdx < iSpatialLayerNum; iIdx++) {
3853+ free (pBsBuf[iIdx]);
3854+
3855+ if (decoder[iIdx] != NULL) {
3856+ decoder[iIdx]->Uninitialize();
3857+ WelsDestroyDecoder (decoder[iIdx]);
3858+ }
3859+
3860+ }
3861+}
3862+
37993863 TEST_F (EncodeDecodeTestAPI, ThreadNumAndSliceNum) {
38003864 int iSpatialLayerNum = 1;
38013865 int iWidth = WelsClip3 ((((rand() % MAX_WIDTH) >> 1) + 1) << 1, (64 << 2), MAX_WIDTH);

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