History

remove macros to clear codes

sijchen committed 12 years ago

Commit 10a4fb01 parent 3c29c925 files · +35 −520Browse files

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

Unified · Split

codec/encoder/core/src/encoder_ext.cpp+19−192
@@ -54,9 +54,7 @@ · 53 unmodified lines
5454 #if defined(MT_ENABLED)
5555 #include "slice_multi_threading.h"
5656 #endif//MT_ENABLED
57−#if defined(DYNAMIC_SLICE_ASSIGN) || defined(MT_DEBUG)
5857 #include "measure_time.h"
59−#endif//DYNAMIC_SLICE_ASSIGN
6058
6159 namespace WelsSVCEnc {
6260
@@ -467,9 +465,6 @@ static inline int32_t AcquireLayersNals (sWelsEncCtx** ppCtx, SWelsSvcCodingPara · 404 unmodified lines
467465 int32_t iCountNumNals = 0;
468466 int32_t iNumDependencyLayers = 0;
469467 int32_t iDIndex = 0;
470−#if defined(MT_ENABLED) && defined(PACKING_ONE_SLICE_PER_LAYER)
471− int32_t iNumLayersPack = 0;
472−#endif//MT_ENABLED && PACKING_ONE_SLICE_PER_LAYER
473468
474469 if (NULL == pParam || NULL == ppCtx || NULL == *ppCtx)
475470 return 1;
@@ -491,12 +486,7 @@ static inline int32_t AcquireLayersNals (sWelsEncCtx** ppCtx, SWelsSvcCodingPara · 15 unmodified lines
491486 if (iDIndex == 0)
492487 iCountNumNals += MAX_SLICES_NUM;
493488 // MAX_SLICES_NUM < MAX_LAYER_NUM_OF_FRAME ensured at svc_enc_slice_segment.h
494−#if defined(MT_ENABLED) && defined(PACKING_ONE_SLICE_PER_LAYER)
495− assert (MAX_SLICES_NUM < MAX_LAYER_NUM_OF_FRAME);
496− // iNumLayersPack += MAX_SLICES_NUM; // do not count it for dynamic slicing mode
497−#else//!MT_ENABLED || !PACKING_ONE_SLICE_PER_LAYER
498489 assert (iCountNumNals - iOrgNumNals <= MAX_NAL_UNITS_IN_LAYER);
499−#endif//MT_ENABLED && PACKING_ONE_SLICE_PER_LAYER
500490 } else { /*if ( SM_SINGLE_SLICE != pDLayer->sSliceCfg.uiSliceMode )*/
501491 const int32_t kiNumOfSlice = GetInitialSliceNum ((pDLayer->iFrameWidth + 0x0f) >> 4,
502492 (pDLayer->iFrameHeight + 0x0f) >> 4,
@@ -507,12 +497,7 @@ static inline int32_t AcquireLayersNals (sWelsEncCtx** ppCtx, SWelsSvcCodingPara · 4 unmodified lines
507497 // plus prefix NALs
508498 if (iDIndex == 0)
509499 iCountNumNals += kiNumOfSlice;
510−#if defined(MT_ENABLED) && defined(PACKING_ONE_SLICE_PER_LAYER)
511− assert (num_of_slice <= MAX_SLICES_NUM && MAX_SLICES_NUM < MAX_LAYER_NUM_OF_FRAME);
512− iNumLayersPack += num_of_slice;
513−#else//!MT_ENABLED || !PACKING_ONE_SLICE_PER_LAYER
514500 assert (iCountNumNals - iOrgNumNals <= MAX_NAL_UNITS_IN_LAYER);
515−#endif//MT_ENALBED && PACKING_ONE_SLICE_PER_LAYER
516501 if (kiNumOfSlice > MAX_SLICES_NUM) {
517502 WelsLog (*ppCtx, WELS_LOG_ERROR,
518503 "AcquireLayersNals(), num_of_slice(%d) > MAX_SLICES_NUM(%d) per (iDid= %d, qid= %d) settings!\n",
@@ -520,14 +505,13 @@ static inline int32_t AcquireLayersNals (sWelsEncCtx** ppCtx, SWelsSvcCodingPara · 1 unmodified line
520505 return 1;
521506 }
522507 }
523−#if !defined(MT_ENABLED) || !defined(PACKING_ONE_SLICE_PER_LAYER)
508+
524509 if (iCountNumNals - iOrgNumNals > MAX_NAL_UNITS_IN_LAYER) {
525510 WelsLog (*ppCtx, WELS_LOG_ERROR,
526− "AcquireLayersNals(), num_of_nals(%d) > MAX_NAL_UNITS_IN_LAYER(%d) per (iDid= %d, qid= %d) settings!\n",
527− (iCountNumNals - iOrgNumNals), MAX_NAL_UNITS_IN_LAYER, iDIndex, 0);
511+ "AcquireLayersNals(), num_of_nals(%d) > MAX_NAL_UNITS_IN_LAYER(%d) per (iDid= %d, qid= %d) settings!\n",
512+ (iCountNumNals - iOrgNumNals), MAX_NAL_UNITS_IN_LAYER, iDIndex, 0);
528513 return 1;
529514 }
530−#endif//!MT_ENABLED) || !PACKING_ONE_SLICE_PER_LAYER
531515
532516 iCountNumLayers ++;
533517
@@ -536,9 +520,6 @@ static inline int32_t AcquireLayersNals (sWelsEncCtx** ppCtx, SWelsSvcCodingPara · 2 unmodified lines
536520
537521 iCountNumNals += 1 + iNumDependencyLayers + (iCountNumLayers << 1) +
538522 iCountNumLayers; // plus iCountNumLayers for reserved application
539−#if defined(MT_ENABLED) && defined(PACKING_ONE_SLICE_PER_LAYER)
540− iNumLayersPack += 1 + iNumDependencyLayers + (iCountNumLayers << 1);
541−#endif//MT_ENABLED && PACKING_ONE_SLICE_PER_LAYER
542523
543524 // to check number of layers / nals / slices dependencies, 12/8/2010
544525 #if !defined(MT_ENABLED)
@@ -548,19 +529,11 @@ static inline int32_t AcquireLayersNals (sWelsEncCtx** ppCtx, SWelsSvcCodingPara · 3 unmodified lines
548529 return 1;
549530 }
550531 #else//MT_ENABLED
551−#if defined(PACKING_ONE_SLICE_PER_LAYER)
552− if (iNumLayersPack > MAX_LAYER_NUM_OF_FRAME) {
553− WelsLog (*ppCtx, WELS_LOG_ERROR, "AcquireLayersNals(), num_layers_pack_overall(%d) > MAX_LAYER_NUM_OF_FRAME(%d)!",
554− iNumLayersPack, MAX_LAYER_NUM_OF_FRAME);
555− return 1;
556− }
557−#else//!PACKING_ONE_SLICE_PER_LAYER
558532 if (iCountNumLayers > MAX_LAYER_NUM_OF_FRAME) {
559533 WelsLog (*ppCtx, WELS_LOG_ERROR, "AcquireLayersNals(), iCountNumLayers(%d) > MAX_LAYER_NUM_OF_FRAME(%d)!",
560534 iCountNumLayers, MAX_LAYER_NUM_OF_FRAME);
561535 return 1;
562536 }
563−#endif//PACKING_ONE_SLICE_PER_LAYER
564537 #endif//!MT_ENABLED
565538
566539 if (NULL != pCountLayers)
@@ -1770,14 +1743,9 @@ int32_t InitSliceSettings (SWelsSvcCodingParam* pCodingParam, const int32_t kiCp · 1203 unmodified lines
17701743 const int32_t kiMbHeight = (pDlp->iFrameHeight + 15) >> 4;
17711744 const int32_t kiMbNumInFrame = kiMbWidth * kiMbHeight;
17721745 #if defined(MT_ENABLED)
1773−#if defined(DYNAMIC_SLICE_ASSIGN)
17741746 int32_t iSliceNum = (SM_FIXEDSLCNUM_SLICE == pMso->uiSliceMode
17751747 || SM_DYN_SLICE == pMso->uiSliceMode) ? kiCpuCores :
17761748 pSlcArg->uiSliceNum; // uiSliceNum per input has been validated at ParamValidationExt()
1777−#else//!DYNAMIC_SLICE_ASSIGN
1778− int32_t iSliceNum = (SM_DYN_SLICE == pMso->uiSliceMode) ? kiCpuCores :
1779− pSlcArg->uiSliceNum; // uiSliceNum per input has been validated at ParamValidationExt()
1780−#endif//DYNAMIC_SLICE_ASSIGN
17811749 #else//!MT_ENABLED
17821750 int16_t iSliceNum = pSlcArg->uiSliceNum; // uiSliceNum per input has been validated at ParamValidationExt()
17831751 #endif//MT_ENABLED
@@ -2215,7 +2183,6 @@ void WelsUninitEncoderExt (sWelsEncCtx** ppCtx) { · 431 unmodified lines
22152183 res);
22162184 (*ppCtx)->pSliceThreading->pThreadHandles[iThreadIdx] = 0;
22172185 }
2218−#if defined(DYNAMIC_SLICE_ASSIGN) && defined(TRY_SLICING_BALANCE)
22192186 if ((*ppCtx)->pSliceThreading->pUpdateMbListThrdHandles[iThreadIdx]) {
22202187 res = WelsThreadCancel ((*ppCtx)->pSliceThreading->pUpdateMbListThrdHandles[iThreadIdx]);
22212188 WelsLog (*ppCtx, WELS_LOG_INFO, "WelsUninitEncoderExt(), WelsThreadCancel(pUpdateMbListThrdHandles%d) return %d..\n",
@@ -2225,7 +2192,6 @@ void WelsUninitEncoderExt (sWelsEncCtx** ppCtx) { · 3 unmodified lines
22252192 iThreadIdx, res);
22262193 (*ppCtx)->pSliceThreading->pUpdateMbListThrdHandles[iThreadIdx] = 0;
22272194 }
2228−#endif//DYNAMIC_SLICE_ASSIGN && TRY_SLICING_BALANCE
22292195 ++ iThreadIdx;
22302196 }
22312197 #endif//WIN32
@@ -2306,10 +2272,8 @@ int32_t PicPartitionNumDecision (sWelsEncCtx* pCtx) { · 74 unmodified lines
23062272 #ifdef MT_ENABLED
23072273 if (pCtx->pSvcParam->iMultipleThreadIdc > 1) {
23082274 iPartitionNum = pCtx->pSvcParam->iCountThreadsNum;
2309−#if !defined(FIXED_PARTITION_ASSIGN)
23102275 if (P_SLICE == pCtx->eSliceType)
23112276 iPartitionNum = 1;
2312−#endif//!FIXED_PARTITION_ASSIGN
23132277 }
23142278 return iPartitionNum;
23152279 #else
@@ -2946,71 +2910,6 @@ int32_t WritePadding (sWelsEncCtx* pCtx, int32_t iLen, int32_t& iSize) { · 630 unmodified lines
29462910 return ENC_RETURN_SUCCESS;
29472911 }
29482912
2949−/*
2950− * post process of dynamic slicing bs writing in case PACKING_ONE_SLICE_PER_LAYER
2951− * include: count bs size of over all the slices in layer,
2952− * return: count number of slices in layer
2953− */
2954−#if defined(MT_ENABLED) && defined(PACKING_ONE_SLICE_PER_LAYER)
2955−int32_t PostProcDynamicSlicingBsWriting (sWelsEncCtx* pCtx, SLayerBSInfo* pLayerBsInfo, int32_t* pLayerSize,
2956− const int32_t kiPartitionCnt) {
2957− SDqLayer* pCurDq = pCtx->pCurDqLayer;
2958− int32_t iPartitionIdx = 0;
2959− int32_t iCheckingIdx = 0;
2960− int32_t iSwappingIdx = -1;
2961− int32_t iSliceCount = 0;
2962− int32_t iLayerSize = 0;
2963−
2964− // count number of slices in layer and layer size
2965− while (iPartitionIdx < kiPartitionCnt) {
2966− const int32_t coded_slice_cnt = pCurDq->pNumSliceCodedOfPartition[iPartitionIdx];
2967− iLayerSize += pCtx->pSliceThreading->pCountBsSizeInPartition[iPartitionIdx];
2968− iSliceCount += coded_slice_cnt;
2969− ++ iPartitionIdx;
2970− }
2971− *pLayerSize = iLayerSize;
2972−
2973− // reordering pLayerBs pointers, but do not ensure raster scan order of picture
2974− // just maintain discontinuous items,i.e,
2975− // input:
2976− // partition 1: uiSliceIdx: 0 2 4 6
2977− // partition 2: uiSliceIdx: 1 3 5 7 9 11 13
2978− // output:
2979− // uiSliceIdx: 0 1 2 3 4 5 6 7 8 9 10
2980− iCheckingIdx = 0;
2981− while (true) {
2982− bool bMatchFlag = false;
2983− iPartitionIdx = 0;
2984− while (iPartitionIdx < kiPartitionCnt) {
2985− const int32_t coded_slice_cnt = pCurDq->pNumSliceCodedOfPartition[iPartitionIdx];
2986− // iCheckingIdx need convert to iIndex of iPartitionIdx based to avoid linear searching
2987− // belong this partition and not exceed the number of slices coded in partition
2988− if (iPartitionIdx == (iCheckingIdx % kiPartitionCnt)
2989− && iCheckingIdx / kiPartitionCnt < coded_slice_cnt) {
2990− if (iSwappingIdx >= 0) {
2991− // memory swapping
2992− memmove (pLayerBsInfo + iSwappingIdx, LayerBsInfo + iCheckingIdx, sizeof (SLayerBSInfo)); // confirmed_safe_unsafe_usage
2993− ++ iSwappingIdx; // record iSwappingIdx
2994− }
2995− ++ iCheckingIdx;
2996− bMatchFlag = true;
2997− break;
2998− }
2999− ++ iPartitionIdx;
3000− }
3001− if (!bMatchFlag) {
3002− if (iSwappingIdx < 0)
3003− iSwappingIdx = iCheckingIdx;
3004− ++ iCheckingIdx;
3005− }
3006− if (iSwappingIdx >= iSliceCount)
3007− break;
3008− }
3009−
3010− return iSliceCount;
3011−}
3012−#endif//MT_ENABLED && PACKING_ONE_SLICE_PER_LAYER
3013−
30142913 /*
30152914 * Force coding IDR as follows
30162915 */
@@ -3077,9 +2976,9 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 60 unmodified lines
30772976 SPicture* fsnr = NULL;
30782977 #endif//ENABLE_FRAME_DUMP || ENABLE_PSNR_CALC
30792978 SPicture* pEncPic = NULL; // to be decided later
3080−#if defined(MT_ENABLED) && (defined(DYNAMIC_SLICE_ASSIGN) || defined(MT_DEBUG))
2979+#if defined(MT_ENABLED)
30812980 int32_t did_list[MAX_DEPENDENCY_LAYER] = {0};
3082−#endif//MT_ENABLED && DYNAMIC_SLICE_ASSIGN
2981+#endif//MT_ENABLED
30832982 int32_t iLayerNum = 0;
30842983 int32_t iLayerSize = 0;
30852984 int32_t iSpatialNum = 0; // available count number of spatial layers due to frame size changed in this given frame
@@ -3169,21 +3068,21 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 83 unmodified lines
31693068 iCurWidth = param_d->iFrameWidth;
31703069 iCurHeight = param_d->iFrameHeight;
31713070
3172−#if defined(MT_ENABLED) && (defined(DYNAMIC_SLICE_ASSIGN) || defined(MT_DEBUG))
3071+#if defined(MT_ENABLED)
31733072 did_list[iSpatialIdx] = iCurDid;
3174−#endif//MT_ENABLED && DYNAMIC_SLICE_ASSIGN
3073+#endif//MT_ENABLED
31753074
31763075 // Encoding this picture might mulitiple sQualityStat layers potentially be encoded as followed
31773076
31783077 switch (param_d->sSliceCfg.uiSliceMode) {
31793078 case SM_FIXEDSLCNUM_SLICE: {
3180−#if defined(MT_ENABLED) && defined(DYNAMIC_SLICE_ASSIGN)
3079+#if defined(MT_ENABLED)
31813080 if ((iCurDid > 0) && (pSvcParam->iMultipleThreadIdc > 1) &&
31823081 (pSvcParam->sDependencyLayers[iCurDid].sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE
31833082 && pSvcParam->iMultipleThreadIdc >= pSvcParam->sDependencyLayers[iCurDid].sSliceCfg.sSliceArgument.uiSliceNum)
31843083 )
31853084 AdjustEnhanceLayer (pCtx, iCurDid);
3186−#endif//MT_ENABLED && DYNAMIC_SLICE_ASSIGN
3085+#endif//MT_ENABLED
31873086 break;
31883087 }
31893088 case SM_DYN_SLICE: {
@@ -3312,13 +3211,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 122 unmodified lines
33123211 // THREAD_FULLY_FIRE_MODE/THREAD_PICK_UP_MODE for any mode of non-SM_DYN_SLICE
33133212 if ((SM_DYN_SLICE != param_d->sSliceCfg.uiSliceMode) && (pSvcParam->iMultipleThreadIdc > 1)) {
33143213 iSliceCount = GetCurrentSliceNum (pCtx->pCurDqLayer->pSliceEncCtx);
3315− if (iLayerNum +
3316−#if defined(PACKING_ONE_SLICE_PER_LAYER)
3317− iSliceCount
3318−#else
3319− 1
3320−#endif//PACKING_ONE_SLICE_PER_LAYER
3321− >= MAX_LAYER_NUM_OF_FRAME) { // check available layer_bs_info for further writing as followed
3214+ if (iLayerNum + 1 >= MAX_LAYER_NUM_OF_FRAME) { // check available layer_bs_info for further writing as followed
33223215 WelsLog (pCtx, WELS_LOG_ERROR,
33233216 "WelsEncoderEncodeExt(), iLayerNum(%d) overflow(max:%d) at iDid= %d uiSliceMode= %d, iSliceCount= %d!",
33243217 iLayerNum, MAX_LAYER_NUM_OF_FRAME, iCurDid, param_d->sSliceCfg.uiSliceMode, iSliceCount);
@@ -3332,17 +3225,9 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 7 unmodified lines
33323225 }
33333226
33343227 if (pSvcParam->iCountThreadsNum >= iSliceCount) { //THREAD_FULLY_FIRE_MODE
3335−#if defined(PACKING_ONE_SLICE_PER_LAYER)
3336− int32_t iSliceIdx = 1;
3337− int32_t iOrgSlicePos[MAX_SLICES_NUM] = {0};
3338− iOrgSlicePos[0] = pCtx->iPosBsBuffer;
3339− while (uiSliceIdx < iSliceCount) {
3340− iOrgSlicePos[uiSliceIdx] = pCtx->pSliceBs[uiSliceIdx].uiBsPos;
3341− ++ uiSliceIdx;
3342− }
3343−#elif defined(MT_DEBUG)
3228+#if defined(MT_DEBUG)
33443229 int64_t t_bs_append = 0;
3345−#endif//PACKING_ONE_SLICE_PER_LAYER
3230+#endif
33463231
33473232 pCtx->iActiveThreadsNum = iSliceCount;
33483233 // to fire slice coding threads
@@ -3362,16 +3247,6 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 13 unmodified lines
33623247 WELS_VERIFY_RETURN_IFNEQ(pCtx->iEncoderError, ENC_RETURN_SUCCESS)
33633248
33643249 // append exclusive slice 0 bs to pFrameBs
3365−#if defined(PACKING_ONE_SLICE_PER_LAYER)
3366− iLayerSize = pCtx->iPosBsBuffer - iOrgSlicePos[0];
3367− uiSliceIdx = 1;
3368− while (uiSliceIdx < iSliceCount) {
3369− iLayerSize += pCtx->pSliceBs[uiSliceIdx].uiBsPos - iOrgSlicePos[uiSliceIdx];
3370− ++ uiSliceIdx;
3371− }
3372− iLayerNum += iSliceCount; // each slice stickly output as layer info for performance improvement directly
3373− pLayerBsInfo += iSliceCount;
3374−#else
33753250 #if defined(MT_DEBUG)
33763251 t_bs_append = WelsTime();
33773252 #endif//MT_DEBUG
@@ -3388,20 +3263,10 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 10 unmodified lines
33883263 t_bs_append, pCtx->iCodingIndex, iCurDid, 0);
33893264 }
33903265 #endif//MT_DEBUG
3391−#endif//PACKING_ONE_SLICE_PER_LAYER
33923266 } else { //THREAD_PICK_UP_MODE
33933267 int32_t iNumThreadsRunning = 0;
33943268 int32_t iNumThreadsScheduled = 0;
33953269 int32_t iIndexOfSliceToBeCoded = 0;
3396−#if defined(PACKING_ONE_SLICE_PER_LAYER)
3397− int32_t iSliceIdx = 1;
3398− int32_t iOrgSlicePos[MAX_SLICES_NUM] = {0};
3399− iOrgSlicePos[0] = pCtx->iPosBsBuffer;
3400− while (uiSliceIdx < iSliceCount) {
3401− iOrgSlicePos[uiSliceIdx] = pCtx->pSliceBs[uiSliceIdx].uiBsPos;
3402− ++ uiSliceIdx;
3403− }
3404−#endif//PACKING_ONE_SLICE_PER_LAYER
34053270
34063271 pCtx->iActiveThreadsNum = pSvcParam->iCountThreadsNum;
34073272 iNumThreadsScheduled = pCtx->iActiveThreadsNum;
@@ -3433,9 +3298,6 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 25 unmodified lines
34333298 // pick up succeeding slice for threading
34343299 // thread_id equal to iEventId per implementation here
34353300 pCtx->pSliceThreading->pThreadPEncCtx[iEventId].iSliceIndex = iIndexOfSliceToBeCoded;
3436−#ifdef PACKING_ONE_SLICE_PER_LAYER
3437− pCtx->pSliceThreading->pThreadPEncCtx[iEventId].pLayerBs = pLayerBsInfo + iIndexOfSliceToBeCoded;
3438−#endif//PACKING_ONE_SLICE_PER_LAYER
34393301 WelsEventSignal (&pCtx->pSliceThreading->pReadySliceCodingEvent[iEventId]);
34403302
34413303 ++ iIndexOfSliceToBeCoded;
@@ -3457,9 +3319,6 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 15 unmodified lines
34573319 if (iIndexOfSliceToBeCoded >= iSliceCount)
34583320 break;
34593321 pCtx->pSliceThreading->pThreadPEncCtx[iThreadIdx].iSliceIndex = iIndexOfSliceToBeCoded;
3460−#ifdef PACKING_ONE_SLICE_PER_LAYER
3461− pCtx->pSliceThreading->pThreadPEncCtx[iThreadIdx].pLayerBs = pLayerBsInfo + iIndexOfSliceToBeCoded;
3462−#endif//PACKING_ONE_SLICE_PER_LAYER
34633322 WelsEventSignal (pCtx->pSliceThreading->pReadySliceCodingEvent[iThreadIdx]);
34643323
34653324 ++ iIndexOfSliceToBeCoded;
@@ -3473,31 +3332,14 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 7 unmodified lines
34733332 #endif//_WIN32
34743333 }//while(1)
34753334
3476−// all slices are finished coding here
3335+ // all slices are finished coding here
34773336 // append exclusive slice 0 bs to pFrameBs
3478−#if defined(PACKING_ONE_SLICE_PER_LAYER)
3479− iLayerSize = pCtx->iPosBsBuffer - iOrgSlicePos[0];
3480− uiSliceIdx = 1;
3481− while (uiSliceIdx < iSliceCount) {
3482− iLayerSize += pCtx->pSliceBs[uiSliceIdx].uiBsPos - iOrgSlicePos[uiSliceIdx];
3483− ++ uiSliceIdx;
3484− }
3485− iLayerNum += iSliceCount; // each slice stickly output as layer info for performance improvement directly
3486− pLayerBsInfo += iSliceCount;
3487−#else
34883337 iLayerSize = AppendSliceToFrameBs (pCtx, pLayerBsInfo, iSliceCount);
3489−#endif//PACKING_ONE_SLICE_PER_LAYER
34903338 }
34913339 }
34923340 // THREAD_FULLY_FIRE_MODE && SM_DYN_SLICE
34933341 else if ((SM_DYN_SLICE == param_d->sSliceCfg.uiSliceMode) && (pSvcParam->iMultipleThreadIdc > 1)) {
34943342 const int32_t kiPartitionCnt = pCtx->iActiveThreadsNum; //pSvcParam->iCountThreadsNum;
3495−#if defined(PACKING_ONE_SLICE_PER_LAYER)
3496− ResetCountBsSizeInPartitions (pCtx->pSliceThreading->pCountBsSizeInPartition, kiPartitionCnt);
3497− pCtx->pCurDqLayer->pSliceEncCtx->iMaxSliceNumConstraint = WELS_MIN (MAX_SLICES_NUM,
3498− DynamicMaxSliceNumConstraint (MAX_LAYER_NUM_OF_FRAME, iLayerNum, 1 + /*( num_qlayer - 1) +*/ (((iCurDid == 0)
3499− && (pSvcParam->uiGopSize > 1)) ? 1 : 0)));
3500−#endif//PACKING_ONE_SLICE_PER_LAYER
35013343
35023344 // to fire slice coding threads
35033345 err = FiredSliceThreads (&pCtx->pSliceThreading->pThreadPEncCtx[0], &pCtx->pSliceThreading->pReadySliceCodingEvent[0],
@@ -3512,14 +3354,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 8 unmodified lines
35123354 WelsMultipleEventsWaitAllBlocking (kiPartitionCnt, &pCtx->pSliceThreading->pSliceCodedEvent[0]);
35133355 WELS_VERIFY_RETURN_IFNEQ(pCtx->iEncoderError, ENC_RETURN_SUCCESS)
35143356
3515−#if defined(PACKING_ONE_SLICE_PER_LAYER)
3516− iSliceCount = PostProcDynamicSlicingBsWriting (pCtx, pLayerBsInfo, &iLayerSize, kiPartitionCnt);
3517− assert (iLayerNum + iSliceCount < MAX_LAYER_NUM_OF_FRAME);
3518− pLayerBsInfo += iSliceCount;
3519− iLayerNum += iSliceCount;
3520−#else
35213357 iLayerSize = AppendSliceToFrameBs (pCtx, pLayerBsInfo, kiPartitionCnt);
3522−#endif//PACKING_ONE_SLICE_PER_LAYER
35233358 } else // for non-dynamic-slicing mode single threading branch..
35243359 #endif//MT_ENABLED
35253360 {
@@ -3686,16 +3521,8 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 160 unmodified lines
36863521 }
36873522 #endif//STAT_OUTPUT
36883523
3689−#if defined(MT_ENABLED) && defined(PACKING_ONE_SLICE_PER_LAYER)
3690− if (pSvcParam->iMultipleThreadIdc <= 1 || SM_SINGLE_SLICE == param_d->sSliceCfg.uiSliceMode) // sigle thread actually used
3691−#else
3692− if (1)
3693−#endif//MT_ENABLED && PACKING_ONE_SLICE_PER_LAYER
3694− {
3695− ++ iLayerNum;
3696− ++ pLayerBsInfo;
3697− }
3698−
3524+ ++ iLayerNum;
3525+ ++ pLayerBsInfo;
36993526
37003527 pLayerBsInfo->pBsBuf = pCtx->pFrameBs + pCtx->iPosBsBuffer;
37013528
@@ -3727,7 +3554,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 25 unmodified lines
37273554 ++ iLayerNum;
37283555 }
37293556
3730−#if defined(MT_ENABLED) && defined(DYNAMIC_SLICE_ASSIGN) && defined(TRY_SLICING_BALANCE)
3557+#if defined(MT_ENABLED)
37313558 if (param_d->sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE && pSvcParam->iMultipleThreadIdc > 1 &&
37323559 pSvcParam->iMultipleThreadIdc >= param_d->sSliceCfg.sSliceArgument.uiSliceNum) {
37333560 CalcSliceComplexRatio (pCtx->pSliceThreading->pSliceComplexRatio[iCurDid], pCtx->pCurDqLayer->pSliceEncCtx,
@@ -3736,7 +3563,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 2 unmodified lines
37363563 TrackSliceComplexities (pCtx, iCurDid);
37373564 #endif//#if defined(MT_DEBUG)
37383565 }
3739−#endif//MT_ENABLED && DYNAMIC_SLICE_ASSIGN && TRY_SLICING_BALANCE
3566+#endif//MT_ENABLED
37403567
37413568 ++ iSpatialIdx;
37423569
@@ -3767,7 +3594,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 24 unmodified lines
37673594 TrackSliceConsumeTime (pCtx, did_list, iSpatialNum);
37683595 #endif//MT_ENABLED && MT_DEBUG
37693596
3770−#if defined(MT_ENABLED) && defined(DYNAMIC_SLICE_ASSIGN)
3597+#if defined(MT_ENABLED)
37713598 if (pSvcParam->iMultipleThreadIdc > 1 && did_list[0] == BASE_DEPENDENCY_ID
37723599 && pSvcParam->sDependencyLayers[0].sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE
37733600 && pSvcParam->iMultipleThreadIdc >= pSvcParam->sDependencyLayers[0].sSliceCfg.sSliceArgument.uiSliceNum
@@ -3776,7 +3603,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, void* pDst, const SSourcePictur · 2 unmodified lines
37763603 1]].sSliceCfg.sSliceArgument.uiSliceNum) {
37773604 AdjustBaseLayer (pCtx);
37783605 }
3779−#endif//DYNAMIC_SLICE_ASSIGN
3606+#endif
37803607
37813608 #ifdef ENABLE_FRAME_DUMP
37823609 DumpRecFrame (fsnr, &pSvcParam->sDependencyLayers[pSvcParam->iSpatialLayerNum -

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