Merge pull request #1745 from sijchen/fix_ut
[UT] fix a random failure of UT
This commit is contained in:
commit
e7fff10d91
@ -95,6 +95,8 @@ static int32_t WelsCheckNumRefSetting (SLogContext* pLogCtx, SWelsSvcCodingParam
|
|||||||
WelsLog (pLogCtx, WELS_LOG_WARNING, "iLTRRefNum(%d) does not equal to currently supported %d, will be reset",
|
WelsLog (pLogCtx, WELS_LOG_WARNING, "iLTRRefNum(%d) does not equal to currently supported %d, will be reset",
|
||||||
pParam->iLTRRefNum, iCurrentSupportedLtrNum);
|
pParam->iLTRRefNum, iCurrentSupportedLtrNum);
|
||||||
pParam->iLTRRefNum = iCurrentSupportedLtrNum;
|
pParam->iLTRRefNum = iCurrentSupportedLtrNum;
|
||||||
|
} else if (!pParam->bEnableLongTermReference) {
|
||||||
|
pParam->iLTRRefNum = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: here is a fix needed here, the most reasonable value should be:
|
//TODO: here is a fix needed here, the most reasonable value should be:
|
||||||
@ -104,11 +106,11 @@ static int32_t WelsCheckNumRefSetting (SLogContext* pLogCtx, SWelsSvcCodingParam
|
|||||||
? (WELS_MAX (1, WELS_LOG2 (pParam->uiGopSize)))
|
? (WELS_MAX (1, WELS_LOG2 (pParam->uiGopSize)))
|
||||||
: (WELS_MAX (1, (pParam->uiGopSize >> 1))));
|
: (WELS_MAX (1, (pParam->uiGopSize >> 1))));
|
||||||
int32_t iNeededRefNum = (pParam->uiIntraPeriod != 1) ? (iCurrentStrNum + pParam->iLTRRefNum) : 0;
|
int32_t iNeededRefNum = (pParam->uiIntraPeriod != 1) ? (iCurrentStrNum + pParam->iLTRRefNum) : 0;
|
||||||
|
|
||||||
iNeededRefNum = WELS_CLIP3 (iNeededRefNum,
|
iNeededRefNum = WELS_CLIP3 (iNeededRefNum,
|
||||||
MIN_REF_PIC_COUNT,
|
MIN_REF_PIC_COUNT,
|
||||||
(pParam->iUsageType == CAMERA_VIDEO_REAL_TIME) ? MAX_REFERENCE_PICTURE_COUNT_NUM_CAMERA :
|
(pParam->iUsageType == CAMERA_VIDEO_REAL_TIME) ? MAX_REFERENCE_PICTURE_COUNT_NUM_CAMERA :
|
||||||
MAX_REFERENCE_PICTURE_COUNT_NUM_SCREEN);
|
MAX_REFERENCE_PICTURE_COUNT_NUM_SCREEN);
|
||||||
|
|
||||||
// to adjust default or invalid input, in case pParam->iNumRefFrame do not have a valid value for the next step
|
// to adjust default or invalid input, in case pParam->iNumRefFrame do not have a valid value for the next step
|
||||||
if (pParam->iNumRefFrame == AUTO_REF_PIC_COUNT) {
|
if (pParam->iNumRefFrame == AUTO_REF_PIC_COUNT) {
|
||||||
pParam->iNumRefFrame = iNeededRefNum;
|
pParam->iNumRefFrame = iNeededRefNum;
|
||||||
|
@ -491,7 +491,7 @@ int32_t ParamValidationExt (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingPa
|
|||||||
iMbHeight = (kiPicHeight + 15) >> 4;
|
iMbHeight = (kiPicHeight + 15) >> 4;
|
||||||
iMaxSliceNum = MAX_SLICES_NUM;
|
iMaxSliceNum = MAX_SLICES_NUM;
|
||||||
if (iMbHeight > iMaxSliceNum) {
|
if (iMbHeight > iMaxSliceNum) {
|
||||||
WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceNum (%d) settings more than MAX!", iMbHeight);
|
WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceNum (%d) settings more than MAX(%d)!", iMbHeight, MAX_SLICES_NUM);
|
||||||
return ENC_RETURN_UNSUPPORTED_PARA;
|
return ENC_RETURN_UNSUPPORTED_PARA;
|
||||||
}
|
}
|
||||||
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum = iMbHeight;
|
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum = iMbHeight;
|
||||||
@ -527,7 +527,7 @@ int32_t ParamValidationExt (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingPa
|
|||||||
if (pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint > (pCodingParam->uiMaxNalSize -
|
if (pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint > (pCodingParam->uiMaxNalSize -
|
||||||
NAL_HEADER_ADD_0X30BYTES)) {
|
NAL_HEADER_ADD_0X30BYTES)) {
|
||||||
WelsLog (pLogCtx, WELS_LOG_WARNING,
|
WelsLog (pLogCtx, WELS_LOG_WARNING,
|
||||||
"ParamValidationExt(), slice mode = SM_DYN_SLICE, uiSliceSizeConstraint = %d ,uiMaxNalsize = %d!",
|
"ParamValidationExt(), slice mode = SM_DYN_SLICE, uiSliceSizeConstraint = %d ,uiMaxNalsize = %d, will take uiMaxNalsize!",
|
||||||
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint, pCodingParam->uiMaxNalSize);
|
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint, pCodingParam->uiMaxNalSize);
|
||||||
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = pCodingParam->uiMaxNalSize - NAL_HEADER_ADD_0X30BYTES;
|
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = pCodingParam->uiMaxNalSize - NAL_HEADER_ADD_0X30BYTES;
|
||||||
}
|
}
|
||||||
@ -4121,9 +4121,13 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa
|
|||||||
return iReturn;
|
return iReturn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pOldParam = (*ppCtx)->pSvcParam;
|
pOldParam = (*ppCtx)->pSvcParam;
|
||||||
|
|
||||||
|
if (pOldParam->iUsageType != pNewParam->iUsageType) {
|
||||||
|
WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_ERROR, "WelsEncoderParamAdjust(), does not expect in-middle change of iUsgaeType from %d to %d", pOldParam->iUsageType, pNewParam->iUsageType);
|
||||||
|
return ENC_RETURN_UNSUPPORTED_PARA;
|
||||||
|
}
|
||||||
|
|
||||||
/* Decide whether need reset for IDR frame based on adjusting prarameters changed */
|
/* Decide whether need reset for IDR frame based on adjusting prarameters changed */
|
||||||
/* Temporal levels, spatial settings and/ or quality settings changed need update parameter sets related. */
|
/* Temporal levels, spatial settings and/ or quality settings changed need update parameter sets related. */
|
||||||
bNeedReset = (pOldParam == NULL) ||
|
bNeedReset = (pOldParam == NULL) ||
|
||||||
|
@ -333,6 +333,9 @@ void EncodeDecodeTestAPI::RandomParamExtCombination() {
|
|||||||
|
|
||||||
|
|
||||||
pSpatialLayer->sSliceCfg.uiSliceMode = static_cast<SliceModeEnum> (rand() % SLICE_MODE_NUM);
|
pSpatialLayer->sSliceCfg.uiSliceMode = static_cast<SliceModeEnum> (rand() % SLICE_MODE_NUM);
|
||||||
|
if (pSpatialLayer->sSliceCfg.uiSliceMode != SM_DYN_SLICE) {
|
||||||
|
param_.uiMaxNalSize = 0;
|
||||||
|
}
|
||||||
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum = rand();
|
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum = rand();
|
||||||
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = rand();
|
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = rand();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user