fix for a slicing and multi-threading setting

This commit is contained in:
Sijia Chen
2015-11-03 14:42:56 -08:00
parent 597adfd98c
commit 2dab8bf087
2 changed files with 69 additions and 0 deletions

View File

@@ -3796,6 +3796,70 @@ TEST_F (EncodeDecodeTestAPI, DiffSlicingInDlayer) {
}
}
TEST_F (EncodeDecodeTestAPI, DiffSlicingInDlayerMixed) {
int iSpatialLayerNum = 2;
int iWidth = WelsClip3 ((((rand() % MAX_WIDTH) >> 1) + 1) << 1, (64 << 2), MAX_WIDTH);
int iHeight = WelsClip3 ((((rand() % MAX_HEIGHT) >> 1) + 1) << 1, (64 << 2),
1120);//TODO: use MAX_HEIGHT after the limit is removed
float fFrameRate = rand() + 0.5f;
int iEncFrameNum = WelsClip3 ((rand() % ENCODE_FRAME_NUM) + 1, 1, ENCODE_FRAME_NUM);
// prepare params
SEncParamExt sParam;
encoder_->GetDefaultParams (&sParam);
prepareParamDefault (iSpatialLayerNum, 1, iWidth, iHeight, fFrameRate, &sParam);
sParam.iMultipleThreadIdc = (rand() % 4) + 1;
sParam.bSimulcastAVC = 1;
sParam.sSpatialLayers[0].iVideoWidth = (iWidth >> 2);
sParam.sSpatialLayers[0].iVideoHeight = (iHeight >> 2);
sParam.sSpatialLayers[0].sSliceCfg.uiSliceMode = SM_ROWMB_SLICE;
sParam.sSpatialLayers[1].iVideoWidth = iWidth;
sParam.sSpatialLayers[1].iVideoHeight = iHeight;
sParam.sSpatialLayers[1].sSliceCfg.uiSliceMode = SM_FIXEDSLCNUM_SLICE;
sParam.sSpatialLayers[1].sSliceCfg.sSliceArgument.uiSliceNum = 1;
int rv = encoder_->InitializeExt (&sParam);
ASSERT_TRUE (rv == cmResultSuccess) << "Init Failed sParam: rv = " << rv;;
unsigned char* pBsBuf[MAX_SPATIAL_LAYER_NUM];
ISVCDecoder* decoder[MAX_SPATIAL_LAYER_NUM];
int iIdx = 0;
//create decoder
for (iIdx = 0; iIdx < iSpatialLayerNum; iIdx++) {
pBsBuf[iIdx] = static_cast<unsigned char*> (malloc (iWidth * iHeight * 3 * sizeof (unsigned char) / 2));
EXPECT_TRUE (pBsBuf[iIdx] != NULL);
long rv = WelsCreateDecoder (&decoder[iIdx]);
ASSERT_EQ (0, rv);
EXPECT_TRUE (decoder[iIdx] != NULL);
SDecodingParam decParam;
memset (&decParam, 0, sizeof (SDecodingParam));
decParam.eOutputColorFormat = videoFormatI420;
decParam.uiTargetDqLayer = UCHAR_MAX;
decParam.eEcActiveIdc = ERROR_CON_SLICE_COPY;
decParam.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT;
rv = decoder[iIdx]->Initialize (&decParam);
ASSERT_EQ (0, rv);
}
TestOneSimulcastAVC (&sParam, decoder, pBsBuf, iSpatialLayerNum, iEncFrameNum, 0);
for (iIdx = 0; iIdx < iSpatialLayerNum; iIdx++) {
free (pBsBuf[iIdx]);
if (decoder[iIdx] != NULL) {
decoder[iIdx]->Uninitialize();
WelsDestroyDecoder (decoder[iIdx]);
}
}
}
TEST_F (EncodeDecodeTestAPI, ThreadNumAndSliceNum) {
int iSpatialLayerNum = 1;
int iWidth = WelsClip3 ((((rand() % MAX_WIDTH) >> 1) + 1) << 1, (64 << 2), MAX_WIDTH);