History

Multi-thread-fixed:RBC#1720:iMaxSliceNumConstraint replaced by iMaxSliceNum

huade committed 9 years ago

Commit c2e37d51 parent c917d315 files · +31 −36Browse files

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

Unified · Split

codec/encoder/core/src/svc_encode_slice.cpp+12−11
@@ -1285,7 +1285,7 @@ int32_t ReallocSliceBuffer (sWelsEncCtx* pCtx) { · 1284 unmodified lines
12851285 CMemoryAlign* pMA = pCtx->pMemAlign;
12861286 SDqLayer* pCurLayer = pCtx->pCurDqLayer;
12871287 SSlice** ppSlice = NULL;
1288− int32_t iMaxSliceNumOld = pCurLayer->sSliceEncCtx.iMaxSliceNumConstraint;
1288+ int32_t iMaxSliceNumOld = pCurLayer->iMaxSliceNum;
12891289 int32_t iMaxSliceNumNew = 0;
12901290 int32_t iRet = 0;
12911291 int32_t iSliceIdx = 0;
@@ -1352,7 +1352,6 @@ int32_t ReallocSliceBuffer (sWelsEncCtx* pCtx) { · 60 unmodified lines
13521352 pCtx->iMaxSliceCount = iMaxSliceNumNew;
13531353 }
13541354
1355− pCurLayer->sSliceEncCtx.iMaxSliceNumConstraint = iMaxSliceNumNew;
13561355 pCurLayer->sSliceThreadInfo.iMaxSliceNumInThread[0] = iMaxSliceNumNew;
13571356 pCurLayer->iMaxSliceNum = iMaxSliceNumNew;
13581357 return ENC_RETURN_SUCCESS;
@@ -1431,7 +1430,7 @@ int32_t SliceLayerInfoUpdate (sWelsEncCtx* pCtx, const int32_t kiDlayerIndex) { · 72 unmodified lines
14311430 }
14321431
14331432 //reallocate ppSliceInLayer if total encoded slice num exceed max slice num
1434− if (iCodedSliceNum > pCurLayer->sSliceEncCtx.iMaxSliceNumConstraint) {
1433+ if (iCodedSliceNum > pCurLayer->iMaxSliceNum) {
14351434 ppSlice = (SSlice**)pMA->WelsMallocz (sizeof (SSlice*) * iCodedSliceNum, "ppSlice");
14361435 if (NULL == ppSlice) {
14371436 WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "CWelsH264SVCEncoder::SliceLayerInfoUpdate: ppSlice is NULL");
@@ -1440,7 +1439,7 @@ int32_t SliceLayerInfoUpdate (sWelsEncCtx* pCtx, const int32_t kiDlayerIndex) { · 2 unmodified lines
14401439
14411440 pMA->WelsFree (pCurLayer->ppSliceInLayer, "ppSliceInLayer");
14421441 pCurLayer->ppSliceInLayer = ppSlice;
1443− pCurLayer->sSliceEncCtx.iMaxSliceNumConstraint = iCodedSliceNum;
1442+ pCurLayer->iMaxSliceNum = iCodedSliceNum;
14441443 }
14451444
14461445 //update ppSliceInLayer based on pSliceInThread, reordering based on slice index
@@ -1535,7 +1534,6 @@ void AddSliceBoundary (sWelsEncCtx* pEncCtx, SSlice* pCurSlice, SSliceCtx* pSlic · 88 unmodified lines
15351534
15361535 #if _DEBUG
15371536 assert (NULL != pNextSlice);
1538− // now ( pSliceCtx->iSliceNumInFrame < pSliceCtx->iMaxSliceNumConstraint ) always true by the call of this pFunc
15391537 #endif
15401538
15411539 //init next pSlice info
@@ -1587,12 +1585,15 @@ bool DynSlcJudgeSliceBoundaryStepBack (void* pCtx, void* pSlice, SSliceCtx* pSli · 45 unmodified lines
15871585 WelsMutexLock (&pEncCtx->pSliceThreading->mutexSliceNumUpdate);
15881586 //lock the acessing to this variable: pSliceCtx->iSliceNumInFrame
15891587 }
1590− const bool kbSliceNumNotExceedConstraint = pSliceCtx->iSliceNumInFrame <
1591− pSliceCtx->iMaxSliceNumConstraint; /*tmp choice to avoid complex memory operation, 100520, to be modify*/
1592− const bool kbSliceIdxNotExceedConstraint = ((int) pCurSlice->uiSliceIdx + kiActiveThreadsNum) <
1593− pSliceCtx->iMaxSliceNumConstraint;
1594− const bool kbSliceNumReachConstraint = (pSliceCtx->iSliceNumInFrame ==
1595− pSliceCtx->iMaxSliceNumConstraint);
1588+ //tmp choice to avoid complex memory operation, 100520, to be modify
1589+ //TODO: pSliceCtx->iSliceNumInFrame should match max slice num limitation in given profile based on standard
1590+ // current change is tmp solution which equal to origin design,
1591+ // as iMaxSliceNum is always equal to iMaxSliceNumConstraint in origin design
1592+ // and will also extend when reallocated,
1593+ // tmp change is: iMaxSliceNumConstraint is alway set to be MAXSLICENUM, will not change even reallocate
1594+ const bool kbSliceNumNotExceedConstraint = pSliceCtx->iSliceNumInFrame < pEncCtx->pCurDqLayer->iMaxSliceNum;
1595+ const bool kbSliceIdxNotExceedConstraint = ((int) pCurSlice->uiSliceIdx + kiActiveThreadsNum) < pEncCtx->pCurDqLayer->iMaxSliceNum;
1596+ const bool kbSliceNumReachConstraint = (pSliceCtx->iSliceNumInFrame == pEncCtx->pCurDqLayer->iMaxSliceNum);
15961597
15971598 //DYNAMIC_SLICING_ONE_THREAD: judge jump_avoiding_pack_exceed
15981599 if (kbSliceNumNotExceedConstraint && kbSliceIdxNotExceedConstraint) {//able to add new pSlice

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