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
1285 CMemoryAlign* pMA = pCtx->pMemAlign;1285 CMemoryAlign* pMA = pCtx->pMemAlign;
1286 SDqLayer* pCurLayer = pCtx->pCurDqLayer;1286 SDqLayer* pCurLayer = pCtx->pCurDqLayer;
1287 SSlice** ppSlice = NULL;1287 SSlice** ppSlice = NULL;
1288 int32_t iMaxSliceNumOld = pCurLayer->sSliceEncCtx.iMaxSliceNumConstraint;1288 int32_t iMaxSliceNumOld = pCurLayer->iMaxSliceNum;
1289 int32_t iMaxSliceNumNew = 0;1289 int32_t iMaxSliceNumNew = 0;
1290 int32_t iRet = 0;1290 int32_t iRet = 0;
1291 int32_t iSliceIdx = 0;1291 int32_t iSliceIdx = 0;
@@ -1352,7 +1352,6 @@ int32_t ReallocSliceBuffer (sWelsEncCtx* pCtx) { · 60 unmodified lines
1352 pCtx->iMaxSliceCount = iMaxSliceNumNew;1352 pCtx->iMaxSliceCount = iMaxSliceNumNew;
1353 }1353 }
1354 1354
1355 pCurLayer->sSliceEncCtx.iMaxSliceNumConstraint = iMaxSliceNumNew;
1356 pCurLayer->sSliceThreadInfo.iMaxSliceNumInThread[0] = iMaxSliceNumNew;1355 pCurLayer->sSliceThreadInfo.iMaxSliceNumInThread[0] = iMaxSliceNumNew;
1357 pCurLayer->iMaxSliceNum = iMaxSliceNumNew;1356 pCurLayer->iMaxSliceNum = iMaxSliceNumNew;
1358 return ENC_RETURN_SUCCESS;1357 return ENC_RETURN_SUCCESS;
@@ -1431,7 +1430,7 @@ int32_t SliceLayerInfoUpdate (sWelsEncCtx* pCtx, const int32_t kiDlayerIndex) { · 72 unmodified lines
1431 }1430 }
1432 1431
1433 //reallocate ppSliceInLayer if total encoded slice num exceed max slice num1432 //reallocate ppSliceInLayer if total encoded slice num exceed max slice num
1434 if (iCodedSliceNum > pCurLayer->sSliceEncCtx.iMaxSliceNumConstraint) {1433 if (iCodedSliceNum > pCurLayer->iMaxSliceNum) {
1435 ppSlice = (SSlice**)pMA->WelsMallocz (sizeof (SSlice*) * iCodedSliceNum, "ppSlice");1434 ppSlice = (SSlice**)pMA->WelsMallocz (sizeof (SSlice*) * iCodedSliceNum, "ppSlice");
1436 if (NULL == ppSlice) {1435 if (NULL == ppSlice) {
1437 WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "CWelsH264SVCEncoder::SliceLayerInfoUpdate: ppSlice is NULL");1436 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
1440 1439
1441 pMA->WelsFree (pCurLayer->ppSliceInLayer, "ppSliceInLayer");1440 pMA->WelsFree (pCurLayer->ppSliceInLayer, "ppSliceInLayer");
1442 pCurLayer->ppSliceInLayer = ppSlice;1441 pCurLayer->ppSliceInLayer = ppSlice;
1443 pCurLayer->sSliceEncCtx.iMaxSliceNumConstraint = iCodedSliceNum;1442 pCurLayer->iMaxSliceNum = iCodedSliceNum;
1444 }1443 }
1445 1444
1446 //update ppSliceInLayer based on pSliceInThread, reordering based on slice index1445 //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
1535 1534
1536#if _DEBUG1535#if _DEBUG
1537 assert (NULL != pNextSlice);1536 assert (NULL != pNextSlice);
1538 // now ( pSliceCtx->iSliceNumInFrame < pSliceCtx->iMaxSliceNumConstraint ) always true by the call of this pFunc
1539#endif1537#endif
1540 1538
1541 //init next pSlice info1539 //init next pSlice info
@@ -1587,12 +1585,15 @@ bool DynSlcJudgeSliceBoundaryStepBack (void* pCtx, void* pSlice, SSliceCtx* pSli · 45 unmodified lines
1587 WelsMutexLock (&pEncCtx->pSliceThreading->mutexSliceNumUpdate);1585 WelsMutexLock (&pEncCtx->pSliceThreading->mutexSliceNumUpdate);
1588 //lock the acessing to this variable: pSliceCtx->iSliceNumInFrame1586 //lock the acessing to this variable: pSliceCtx->iSliceNumInFrame
1589 }1587 }
1590 const bool kbSliceNumNotExceedConstraint = pSliceCtx->iSliceNumInFrame <1588 //tmp choice to avoid complex memory operation, 100520, to be modify
1591 pSliceCtx->iMaxSliceNumConstraint; /*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
1592 const bool kbSliceIdxNotExceedConstraint = ((int) pCurSlice->uiSliceIdx + kiActiveThreadsNum) <1590 // current change is tmp solution which equal to origin design,
1593 pSliceCtx->iMaxSliceNumConstraint;1591 // as iMaxSliceNum is always equal to iMaxSliceNumConstraint in origin design
1594 const bool kbSliceNumReachConstraint = (pSliceCtx->iSliceNumInFrame ==1592 // and will also extend when reallocated,
1595 pSliceCtx->iMaxSliceNumConstraint);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);
1596 1597
1597 //DYNAMIC_SLICING_ONE_THREAD: judge jump_avoiding_pack_exceed1598 //DYNAMIC_SLICING_ONE_THREAD: judge jump_avoiding_pack_exceed
1598 if (kbSliceNumNotExceedConstraint && kbSliceIdxNotExceedConstraint) {//able to add new pSlice1599 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