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
226 fDlp->sSliceCfg.sSliceArgument.uiSliceMbNum[iIdx] = 0;226 fDlp->sSliceCfg.sSliceArgument.uiSliceMbNum[iIdx] = 0;
227 }227 }
228 break;228 break;
229 case SM_FIXEDSLCNUM_SLICE: {229 case SM_FIXEDSLCNUM_SLICE:
230 case SM_AUTO_SLICE:{
230 fDlp->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = 0;231 fDlp->sSliceCfg.sSliceArgument.uiSliceSizeConstraint = 0;
231 232
232 iMbWidth = (kiPicWidth + 15) >> 4;233 iMbWidth = (kiPicWidth + 15) >> 4;
@@ -1690,14 +1691,7 @@ int32_t InitSliceSettings (SWelsSvcCodingParam* pCodingParam, const int32_t kiCp · 1457 unmodified lines
1690 const int32_t kiMbWidth = (pDlp->iFrameWidth + 15) >> 4;1691 const int32_t kiMbWidth = (pDlp->iFrameWidth + 15) >> 4;
1691 const int32_t kiMbHeight = (pDlp->iFrameHeight + 15) >> 4;1692 const int32_t kiMbHeight = (pDlp->iFrameHeight + 15) >> 4;
1692 const int32_t kiMbNumInFrame = kiMbWidth * kiMbHeight;1693 const int32_t kiMbNumInFrame = kiMbWidth * kiMbHeight;
1693#if defined(MT_ENABLED)1694 int32_t iSliceNum = (SM_AUTO_SLICE == pMso->uiSliceMode)? kiCpuCores :pSlcArg->uiSliceNum;
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
1701 // NOTE: Per design, in case MT/DYNAMIC_SLICE_ASSIGN enabled, for SM_FIXEDSLCNUM_SLICE mode,1695 // NOTE: Per design, in case MT/DYNAMIC_SLICE_ASSIGN enabled, for SM_FIXEDSLCNUM_SLICE mode,
1702 // uiSliceNum of current spatial layer settings equals to uiCpuCores number; SM_DYN_SLICE mode,1696 // uiSliceNum of current spatial layer settings equals to uiCpuCores number; SM_DYN_SLICE mode,
1703 // uiSliceNum intials as uiCpuCores also, stay tuned dynamically slicing in future1697 // 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
1710 break; // go through for MT_ENABLED & SM_DYN_SLICE?1704 break; // go through for MT_ENABLED & SM_DYN_SLICE?
1711//#endif//MT_ENABLED1705//#endif//MT_ENABLED
1712 case SM_FIXEDSLCNUM_SLICE:1706 case SM_FIXEDSLCNUM_SLICE:
1707 case SM_AUTO_SLICE:
1713 if (iSliceNum > iMaxSliceCount)1708 if (iSliceNum > iMaxSliceCount)
1714 iMaxSliceCount = iSliceNum;1709 iMaxSliceCount = iSliceNum;
1715 // need perform check due uiSliceNum might change, although has been initialized somewhere outside1710 // 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
2950 // Encoding this picture might mulitiple sQualityStat layers potentially be encoded as followed2945 // Encoding this picture might mulitiple sQualityStat layers potentially be encoded as followed
2951 2946
2952 switch (param_d->sSliceCfg.uiSliceMode) {2947 switch (param_d->sSliceCfg.uiSliceMode) {
2953 case SM_FIXEDSLCNUM_SLICE: {2948 case SM_FIXEDSLCNUM_SLICE:
2949 case SM_AUTO_SLICE:{
2954#if defined(MT_ENABLED)2950#if defined(MT_ENABLED)
2955 if ((iCurDid > 0) && (pSvcParam->iMultipleThreadIdc > 1) &&2951 if ((iCurDid > 0) && (pSvcParam->iMultipleThreadIdc > 1) &&
2956 (pSvcParam->sDependencyLayers[iCurDid].sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE2952 (pSvcParam->sDependencyLayers[iCurDid].sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE
@@ -3403,7 +3399,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo * pFbi, const SSou · 446 unmodified lines
3403 }3399 }
3404 3400
3405#if defined(MT_ENABLED)3401#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 &&
3407 pSvcParam->iMultipleThreadIdc >= param_d->sSliceCfg.sSliceArgument.uiSliceNum) {3403 pSvcParam->iMultipleThreadIdc >= param_d->sSliceCfg.sSliceArgument.uiSliceNum) {
3408 CalcSliceComplexRatio (pCtx->pSliceThreading->pSliceComplexRatio[iCurDid], pCtx->pCurDqLayer->pSliceEncCtx,3404 CalcSliceComplexRatio (pCtx->pSliceThreading->pSliceComplexRatio[iCurDid], pCtx->pCurDqLayer->pSliceEncCtx,
3409 pCtx->pSliceThreading->pSliceConsumeTime[iCurDid]);3405 pCtx->pSliceThreading->pSliceConsumeTime[iCurDid]);
@@ -3444,9 +3440,9 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo * pFbi, const SSou · 34 unmodified lines
3444 3440
3445#if defined(MT_ENABLED)3441#if defined(MT_ENABLED)
3446 if (pSvcParam->iMultipleThreadIdc > 1 && did_list[0] == BASE_DEPENDENCY_ID3442 if (pSvcParam->iMultipleThreadIdc > 1 && did_list[0] == BASE_DEPENDENCY_ID
3447 && pSvcParam->sDependencyLayers[0].sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE3443 && ((pSvcParam->sDependencyLayers[0].sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE)||(pSvcParam->sDependencyLayers[0].sSliceCfg.uiSliceMode == SM_AUTO_SLICE))
3448 && pSvcParam->iMultipleThreadIdc >= pSvcParam->sDependencyLayers[0].sSliceCfg.sSliceArgument.uiSliceNum3444 && pSvcParam->iMultipleThreadIdc >= pSvcParam->sDependencyLayers[0].sSliceCfg.sSliceArgument.uiSliceNum
3449 && pSvcParam->sDependencyLayers[did_list[iSpatialNum - 1]].sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE3445 && ((pSvcParam->sDependencyLayers[did_list[iSpatialNum - 1]].sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE)||(pSvcParam->sDependencyLayers[did_list[iSpatialNum - 1]].sSliceCfg.uiSliceMode == SM_AUTO_SLICE))
3450 && pSvcParam->iMultipleThreadIdc >= pSvcParam->sDependencyLayers[did_list[iSpatialNum -3446 && pSvcParam->iMultipleThreadIdc >= pSvcParam->sDependencyLayers[did_list[iSpatialNum -
3451 1]].sSliceCfg.sSliceArgument.uiSliceNum) {3447 1]].sSliceCfg.sSliceArgument.uiSliceNum) {
3452 AdjustBaseLayer (pCtx);3448 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