ref: d30fec558e691547950bff755849c1ffb7fe744d
parent: e47d57e8dd1f5590835a91fccae3b39b74135b3e
parent: 1052fc6b8f915d2eb9e44f8bff0c268d9f8e47a6
author: huili2 <[email protected]>
date: Tue Mar 7 07:00:48 EST 2017
Merge pull request #2672 from ruil2/loadbalance refine loadbalancing logic
--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -3591,7 +3591,9 @@
SPicture* fsnr = NULL;
#endif//ENABLE_FRAME_DUMP || ENABLE_PSNR_CALC
SPicture* pEncPic = NULL; // to be decided later
+#if defined(MT_DEBUG)
int32_t iDidList[MAX_DEPENDENCY_LAYER] = {0};
+#endif
int32_t iLayerNum = 0;
int32_t iLayerSize = 0;
int32_t iSpatialNum =
@@ -3699,17 +3701,22 @@
iCurWidth = pParam->iVideoWidth;
iCurHeight = pParam->iVideoHeight;
-
+#if defined(MT_DEBUG)
iDidList[iSpatialIdx] = iCurDid;
-
+#endif
// Encoding this picture might mulitiple sQualityStat layers potentially be encoded as followed
switch (pParam->sSliceArgument.uiSliceMode) {
case SM_FIXEDSLCNUM_SLICE: {
- if ((iCurDid > 0) && (pSvcParam->iMultipleThreadIdc > 1) &&
+ if ((pSvcParam->iMultipleThreadIdc > 1) &&
(pSvcParam->bUseLoadBalancing
&& pSvcParam->iMultipleThreadIdc >= pSvcParam->sSpatialLayers[iCurDid].sSliceArgument.uiSliceNum)
- )
- AdjustEnhanceLayer (pCtx, iCurDid);
+ ) {
+ if (iCurDid > 0)
+ AdjustEnhanceLayer (pCtx, iCurDid);
+ else
+ AdjustBaseLayer (pCtx);
+ }
+
break;
}
case SM_SIZELIMITED_SLICE: {
@@ -4207,16 +4214,6 @@
#if defined(MT_DEBUG)
TrackSliceConsumeTime (pCtx, iDidList, iSpatialNum);
#endif//MT_DEBUG
-
- if (pSvcParam->iMultipleThreadIdc > 1 && iDidList[0] == BASE_DEPENDENCY_ID
- && (pSvcParam->sSpatialLayers[0].sSliceArgument.uiSliceMode == SM_FIXEDSLCNUM_SLICE)
- && pSvcParam->bUseLoadBalancing
- && pSvcParam->iMultipleThreadIdc >= pSvcParam->sSpatialLayers[0].sSliceArgument.uiSliceNum
- && ((pSvcParam->sSpatialLayers[iDidList[iSpatialNum - 1]].sSliceArgument.uiSliceMode == SM_FIXEDSLCNUM_SLICE))
- && pSvcParam->iMultipleThreadIdc >= pSvcParam->sSpatialLayers[iDidList[iSpatialNum -
- 1]].sSliceArgument.uiSliceNum) {
- AdjustBaseLayer (pCtx);
- }
// to check number of layers / nals / slices dependencies
if (iLayerNum > MAX_LAYER_NUM_OF_FRAME) {