History

fix SM_FIXEDSLCNUM_SLICE bug, add SM_AUTO_SLICE mode

ruil2 committed 12 years ago

Commit 7c8ce791 parent ca457f59 files · +28 −24Browse files

Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 9 files). Show all

Unified · Split

codec/encoder/core/src/encoder_ext.cpp+9−13
@@ -226,7 +226,8 @@ int32_t ParamValidationExt (sWelsEncCtx*pCtx,SWelsSvcCodingParam* pCodingParam) · 225 unmodified lines
226226 fDlp->sSliceCfg.sSliceArgument.uiSliceMbNum[iIdx] = 0;
227227 }
228228 break;
229− case SM_FIXEDSLCNUM_SLICE: {
229+ case SM_FIXEDSLCNUM_SLICE:
230+ case SM_AUTO_SLICE:{
230231 fDlp->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = 0;
231232
232233 iMbWidth = (kiPicWidth + 15) >> 4;
@@ -1690,14 +1691,7 @@ int32_t InitSliceSettings (SWelsSvcCodingParam* pCodingParam, const int32_t kiCp · 1457 unmodified lines
16901691 const int32_t kiMbWidth = (pDlp->iFrameWidth + 15) >> 4;
16911692 const int32_t kiMbHeight = (pDlp->iFrameHeight + 15) >> 4;
16921693 const int32_t kiMbNumInFrame = kiMbWidth * kiMbHeight;
1693−#if defined(MT_ENABLED)
1694− int32_t iSliceNum = (SM_FIXEDSLCNUM_SLICE == pMso->uiSliceMode
1695− || SM_DYN_SLICE == pMso->uiSliceMode) ? kiCpuCores :
1696− pSlcArg->uiSliceNum; // uiSliceNum per input has been validated at ParamValidationExt()
1697−#else//!MT_ENABLED
1698− int16_t iSliceNum = pSlcArg->uiSliceNum; // uiSliceNum per input has been validated at ParamValidationExt()
1699−#endif//MT_ENABLED
1700−
1694+ int32_t iSliceNum = (SM_AUTO_SLICE == pMso->uiSliceMode)? kiCpuCores :pSlcArg->uiSliceNum;
17011695 // NOTE: Per design, in case MT/DYNAMIC_SLICE_ASSIGN enabled, for SM_FIXEDSLCNUM_SLICE mode,
17021696 // uiSliceNum of current spatial layer settings equals to uiCpuCores number; SM_DYN_SLICE mode,
17031697 // uiSliceNum intials as uiCpuCores also, stay tuned dynamically slicing in future
@@ -1710,6 +1704,7 @@ int32_t InitSliceSettings (SWelsSvcCodingParam* pCodingParam, const int32_t kiCp · 6 unmodified lines
17101704 break; // go through for MT_ENABLED & SM_DYN_SLICE?
17111705 //#endif//MT_ENABLED
17121706 case SM_FIXEDSLCNUM_SLICE:
1707+ case SM_AUTO_SLICE:
17131708 if (iSliceNum > iMaxSliceCount)
17141709 iMaxSliceCount = iSliceNum;
17151710 // need perform check due uiSliceNum might change, although has been initialized somewhere outside
@@ -2950,7 +2945,8 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo * pFbi, const SSou · 1234 unmodified lines
29502945 // Encoding this picture might mulitiple sQualityStat layers potentially be encoded as followed
29512946
29522947 switch (param_d->sSliceCfg.uiSliceMode) {
2953− case SM_FIXEDSLCNUM_SLICE: {
2948+ case SM_FIXEDSLCNUM_SLICE:
2949+ case SM_AUTO_SLICE:{
29542950 #if defined(MT_ENABLED)
29552951 if ((iCurDid > 0) && (pSvcParam->iMultipleThreadIdc > 1) &&
29562952 (pSvcParam->sDependencyLayers[iCurDid].sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE
@@ -3403,7 +3399,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo * pFbi, const SSou · 446 unmodified lines
34033399 }
34043400
34053401 #if defined(MT_ENABLED)
3406− if (param_d->sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE && pSvcParam->iMultipleThreadIdc > 1 &&
3402+ if ((param_d->sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE||param_d->sSliceCfg.uiSliceMode == SM_AUTO_SLICE) && pSvcParam->iMultipleThreadIdc > 1 &&
34073403 pSvcParam->iMultipleThreadIdc >= param_d->sSliceCfg.sSliceArgument.uiSliceNum) {
34083404 CalcSliceComplexRatio (pCtx->pSliceThreading->pSliceComplexRatio[iCurDid], pCtx->pCurDqLayer->pSliceEncCtx,
34093405 pCtx->pSliceThreading->pSliceConsumeTime[iCurDid]);
@@ -3444,9 +3440,9 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo * pFbi, const SSou · 34 unmodified lines
34443440
34453441 #if defined(MT_ENABLED)
34463442 if (pSvcParam->iMultipleThreadIdc > 1 && did_list[0] == BASE_DEPENDENCY_ID
3447− && pSvcParam->sDependencyLayers[0].sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE
3443+ && ((pSvcParam->sDependencyLayers[0].sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE)||(pSvcParam->sDependencyLayers[0].sSliceCfg.uiSliceMode == SM_AUTO_SLICE))
34483444 && pSvcParam->iMultipleThreadIdc >= pSvcParam->sDependencyLayers[0].sSliceCfg.sSliceArgument.uiSliceNum
3449− && pSvcParam->sDependencyLayers[did_list[iSpatialNum - 1]].sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE
3445+ && ((pSvcParam->sDependencyLayers[did_list[iSpatialNum - 1]].sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE)||(pSvcParam->sDependencyLayers[did_list[iSpatialNum - 1]].sSliceCfg.uiSliceMode == SM_AUTO_SLICE))
34503446 && pSvcParam->iMultipleThreadIdc >= pSvcParam->sDependencyLayers[did_list[iSpatialNum -
34513447 1]].sSliceCfg.sSliceArgument.uiSliceNum) {
34523448 AdjustBaseLayer (pCtx);

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