ref: e7fff10d9181bf2b4676556b1a77c008762bbfa7
parent: 17030193e64cde4efaa5fbe284be71fb44f58c52
parent: 5b10c1ff8dac962adaa98a797bb06dd8c6a630d6
author: ruil2 <[email protected]>
date: Wed Jan 21 12:31:34 EST 2015
Merge pull request #1745 from sijchen/fix_ut [UT] fix a random failure of UT
--- a/codec/encoder/core/src/au_set.cpp
+++ b/codec/encoder/core/src/au_set.cpp
@@ -95,6 +95,8 @@
WelsLog (pLogCtx, WELS_LOG_WARNING, "iLTRRefNum(%d) does not equal to currently supported %d, will be reset",
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:
@@ -104,11 +106,11 @@
? (WELS_MAX (1, WELS_LOG2 (pParam->uiGopSize)))
: (WELS_MAX (1, (pParam->uiGopSize >> 1))));
int32_t iNeededRefNum = (pParam->uiIntraPeriod != 1) ? (iCurrentStrNum + pParam->iLTRRefNum) : 0;
+
iNeededRefNum = WELS_CLIP3 (iNeededRefNum,
MIN_REF_PIC_COUNT,
(pParam->iUsageType == CAMERA_VIDEO_REAL_TIME) ? MAX_REFERENCE_PICTURE_COUNT_NUM_CAMERA :
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
if (pParam->iNumRefFrame == AUTO_REF_PIC_COUNT) {
pParam->iNumRefFrame = iNeededRefNum;
--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -491,7 +491,7 @@
iMbHeight = (kiPicHeight + 15) >> 4;
iMaxSliceNum = MAX_SLICES_NUM;
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;
}
pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum = iMbHeight;
@@ -527,7 +527,7 @@
if (pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceSizeConstraint > (pCodingParam->uiMaxNalSize -
NAL_HEADER_ADD_0X30BYTES)) {
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 - NAL_HEADER_ADD_0X30BYTES;
}
@@ -4121,8 +4121,12 @@
return iReturn;
}
-
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 */
/* Temporal levels, spatial settings and/ or quality settings changed need update parameter sets related. */
--- a/test/api/encode_decode_api_test.cpp
+++ b/test/api/encode_decode_api_test.cpp
@@ -333,6 +333,9 @@
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.uiSliceSizeConstraint = rand();
}