[Encoder] adjust encoder tasks, add ut and enable new thread pool under some cases
Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 15 files). Show all
Unified · Split
| @@ -2930,6 +2930,10 @@ void WelsInitCurrentLayer (sWelsEncCtx* pCtx, · 2929 unmodified lines | ||
| 2930 | 2930 | } else { |
| 2931 | 2931 | pCurDq->bBaseLayerAvailableFlag = false; |
| 2932 | 2932 | } |
| 2933 | + | |
| 2934 | + if (pCtx->pTaskManage) { | |
| 2935 | + pCtx->pTaskManage->InitFrame(kiCurDid); | |
| 2936 | + } | |
| 2933 | 2937 | } |
| 2934 | 2938 | |
| 2935 | 2939 | static inline void SetFastCodingFunc (SWelsFuncPtrList* pFuncList) { |
| @@ -4016,7 +4020,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 1080 unmodified lines | ||
| 4016 | 4020 | iSliceCount); |
| 4017 | 4021 | return ENC_RETURN_UNEXPECTED; |
| 4018 | 4022 | } |
| 4019 | − | |
| 4023 | + if (SM_AUTO_SLICE == pParam->sSliceCfg.uiSliceMode) { | |
| 4020 | 4024 | if (pSvcParam->iCountThreadsNum >= iSliceCount) { //THREAD_FULLY_FIRE_MODE |
| 4021 | 4025 | #if defined(MT_DEBUG) |
| 4022 | 4026 | int64_t t_bs_append = 0; |
| @@ -4105,6 +4109,19 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 82 unmodified lines | ||
| 4105 | 4109 | // append exclusive slice 0 bs to pFrameBs |
| 4106 | 4110 | iLayerSize = AppendSliceToFrameBs (pCtx, pLayerBsInfo, iSliceCount); |
| 4107 | 4111 | } |
| 4112 | + | |
| 4113 | + } else { | |
| 4114 | + pLayerBsInfo->pBsBuf = pCtx->pFrameBs + pCtx->iPosBsBuffer; | |
| 4115 | + pLayerBsInfo->uiLayerType = VIDEO_CODING_LAYER; | |
| 4116 | + pLayerBsInfo->uiSpatialId = pCtx->uiDependencyId; | |
| 4117 | + pLayerBsInfo->uiTemporalId = pCtx->uiTemporalId; | |
| 4118 | + pLayerBsInfo->uiQualityId = 0; | |
| 4119 | + pLayerBsInfo->iNalCount = 0; | |
| 4120 | + pCtx->pSliceBs[0].pBs = pLayerBsInfo->pBsBuf; | |
| 4121 | + | |
| 4122 | + pCtx->pTaskManage->ExecuteTasks(); | |
| 4123 | + iLayerSize = AppendSliceToFrameBs (pCtx, pLayerBsInfo, iSliceCount); | |
| 4124 | + } | |
| 4108 | 4125 | } |
| 4109 | 4126 | // THREAD_FULLY_FIRE_MODE && SM_DYN_SLICE |
| 4110 | 4127 | else if ((SM_DYN_SLICE == pParam->sSliceCfg.uiSliceMode) && (pSvcParam->iMultipleThreadIdc > 1)) { |