3Author: ruil2 <ruil2@cisco.com>

modify the parameter verification for SM_AUTO_SLICE mode -- uiSliceNum
 iis ignored
This commit is contained in:
ruil2 2014-03-12 10:44:13 +08:00
parent cece1fe2cf
commit c7f2a0b7f6
5 changed files with 48 additions and 8 deletions

View File

@ -226,8 +226,7 @@ int32_t ParamValidationExt (sWelsEncCtx*pCtx,SWelsSvcCodingParam* pCodingParam)
fDlp->sSliceCfg.sSliceArgument.uiSliceMbNum[iIdx] = 0;
}
break;
case SM_FIXEDSLCNUM_SLICE:
case SM_AUTO_SLICE:{
case SM_FIXEDSLCNUM_SLICE:{
fDlp->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = 0;
iMbWidth = (kiPicWidth + 15) >> 4;
@ -235,7 +234,7 @@ int32_t ParamValidationExt (sWelsEncCtx*pCtx,SWelsSvcCodingParam* pCodingParam)
iMbNumInFrame = iMbWidth * iMbHeight;
iMaxSliceNum = MAX_SLICES_NUM;
if (fDlp->sSliceCfg.sSliceArgument.uiSliceNum <= 0
|| fDlp->sSliceCfg.sSliceArgument.uiSliceNum > iMaxSliceNum) {
|| fDlp->sSliceCfg.sSliceArgument.uiSliceNum > iMaxSliceNum) {
WelsLog (pCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceNum (%d) settings!\n", fDlp->sSliceCfg.sSliceArgument.uiSliceNum);
return ENC_RETURN_UNSUPPORTED_PARA;
}
@ -267,6 +266,10 @@ int32_t ParamValidationExt (sWelsEncCtx*pCtx,SWelsSvcCodingParam* pCodingParam)
}
}
break;
case SM_AUTO_SLICE:{
fDlp->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = 0;
}
break;
case SM_RASTER_SLICE: {
fDlp->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = 0;
@ -1704,7 +1707,6 @@ int32_t InitSliceSettings (SWelsSvcCodingParam* pCodingParam, const int32_t kiCp
break; // go through for MT_ENABLED & SM_DYN_SLICE?
//#endif//MT_ENABLED
case SM_FIXEDSLCNUM_SLICE:
case SM_AUTO_SLICE:
if (iSliceNum > iMaxSliceCount)
iMaxSliceCount = iSliceNum;
// need perform check due uiSliceNum might change, although has been initialized somewhere outside
@ -1726,6 +1728,40 @@ int32_t InitSliceSettings (SWelsSvcCodingParam* pCodingParam, const int32_t kiCp
if (iSliceNum > iMaxSliceCount)
iMaxSliceCount = iSliceNum;
break;
case SM_AUTO_SLICE:
iMaxSliceCount = MAX_SLICES_NUM;
pDlp->sSliceCfg.sSliceArgument.uiSliceNum = kiCpuCores;
if (pDlp->sSliceCfg.sSliceArgument.uiSliceNum > iMaxSliceCount){
pDlp->sSliceCfg.sSliceArgument.uiSliceNum = iMaxSliceCount;
}
if (pDlp->sSliceCfg.sSliceArgument.uiSliceNum == 1) {
WelsLog (NULL, WELS_LOG_DEBUG,
"InitSliceSettings(), uiSliceNum(%d) you set for SM_AUTO_SLICE, now turn to SM_SINGLE_SLICE type!\n",
pDlp->sSliceCfg.sSliceArgument.uiSliceNum);
pDlp->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
break;
}
if (pCodingParam->bEnableRc) { // multiple slices verify with gom
//check uiSliceNum
GomValidCheckSliceNum (kiMbWidth, kiMbHeight, &pDlp->sSliceCfg.sSliceArgument.uiSliceNum);
assert (pDlp->sSliceCfg.sSliceArgument.uiSliceNum > 1);
//set uiSliceMbNum with current uiSliceNum
GomValidCheckSliceMbNum (kiMbWidth, kiMbHeight, &pDlp->sSliceCfg.sSliceArgument);
} else if (!CheckFixedSliceNumMultiSliceSetting (kiMbNumInFrame,
&pDlp->sSliceCfg.sSliceArgument)) { // verify interleave mode settings
//check uiSliceMbNum with current uiSliceNum
WelsLog (NULL, WELS_LOG_ERROR, "InitSliceSettings(), invalid uiSliceMbNum (%d) settings!,now turn to SM_SINGLE_SLICE type\n",
pDlp->sSliceCfg.sSliceArgument.uiSliceMbNum[0]);
pDlp->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
pDlp->sSliceCfg.sSliceArgument.uiSliceNum = 1;
}
// considering the coding efficient and performance, iCountMbNum constraint by MIN_NUM_MB_PER_SLICE condition of multi-pSlice mode settting
if (kiMbNumInFrame <= MIN_NUM_MB_PER_SLICE) {
pDlp->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
pDlp->sSliceCfg.sSliceArgument.uiSliceNum = 1;
break;
}
break;
default:
break;
}

View File

@ -34,4 +34,5 @@ SlicesAssign7 0 # count number of MBs in slice #7
# 2 SM_RASTER_SLICE | according to SlicesAssign | Need input of MB numbers each slice. In addition, if other constraint in slice_argument is presented, need to follow the constraints. Typically if MB num and slice size are both constrained, re-encoding may be involved.
# 3 SM_ROWMB_SLICE | according to PictureMBHeight | Typical of single row of mbs each slice?+ slice size constraint which including re-encoding
# 4 SM_DYN_SLICE | according to SliceSize | Dynamic slicing (have no idea about slice_nums until encoding current frame)
# 5 SM_AUTO_SLICE | according to thread number | the number of slices is decided by the number of threads
# 5 SM_AUTO_SLICE | according to thread number | the number of slices is decided by the number of threads,SliceNum is ignored

View File

@ -35,4 +35,5 @@ SlicesAssign7 0 # count number of MBs in slice #7
# 2 SM_RASTER_SLICE | according to SlicesAssign | Need input of MB numbers each slice. In addition, if other constraint in slice_argument is presented, need to follow the constraints. Typically if MB num and slice size are both constrained, re-encoding may be involved.
# 3 SM_ROWMB_SLICE | according to PictureMBHeight | Typical of single row of mbs each slice?+ slice size constraint which including re-encoding
# 4 SM_DYN_SLICE | according to SliceSize | Dynamic slicing (have no idea about slice_nums until encoding current frame)
# 5 SM_AUTO_SLICE | according to thread number | the number of slices is decided by the number of threads
# 5 SM_AUTO_SLICE | according to thread number | the number of slices is decided by the number of threads,SliceNum is ignored

View File

@ -35,4 +35,5 @@ SlicesAssign7 0 # count number of MBs in slice #7
# 2 SM_RASTER_SLICE | according to SlicesAssign | Need input of MB numbers each slice. In addition, if other constraint in slice_argument is presented, need to follow the constraints. Typically if MB num and slice size are both constrained, re-encoding may be involved.
# 3 SM_ROWMB_SLICE | according to PictureMBHeight | Specially for TP. Typical of single row of mbs each slice?+ slice size constraint which including re-encoding
# 4 SM_DYN_SLICE | according to SliceSize | Dynamic slicing (have no idea about slice_nums until encoding current frame)
# 5 SM_AUTO_SLICE | according to thread number | the number of slices is decided by the number of threads
# 5 SM_AUTO_SLICE | according to thread number | the number of slices is decided by the number of threads,SliceNum is ignored

View File

@ -35,4 +35,5 @@ SlicesAssign7 0 # count number of MBs in slice #7
# 2 SM_RASTER_SLICE | according to SlicesAssign | Need input of MB numbers each slice. In addition, if other constraint in slice_argument is presented, need to follow the constraints. Typically if MB num and slice size are both constrained, re-encoding may be involved.
# 3 SM_ROWMB_SLICE | according to PictureMBHeight | Specially for TP. Typical of single row of mbs each slice?+ slice size constraint which including re-encoding
# 4 SM_DYN_SLICE | according to SliceSize | Dynamic slicing (have no idea about slice_nums until encoding current frame)
# 5 SM_AUTO_SLICE | according to thread number | the number of slices is decided by the number of threads
# 5 SM_AUTO_SLICE | according to thread number | the number of slices is decided by the number of threads,SliceNum is ignored