Showing the changes to codec/encoder/core/src/svc_encode_slice.cpp (1 of 5 files). Show all
Unified · Split
| @@ -1285,7 +1285,7 @@ int32_t ReallocSliceBuffer (sWelsEncCtx* pCtx) { · 1284 unmodified lines | ||
| 1285 | 1285 | CMemoryAlign* pMA = pCtx->pMemAlign; |
| 1286 | 1286 | SDqLayer* pCurLayer = pCtx->pCurDqLayer; |
| 1287 | 1287 | SSlice** ppSlice = NULL; |
| 1288 | − int32_t iMaxSliceNumOld = pCurLayer->sSliceEncCtx.iMaxSliceNumConstraint; | |
| 1288 | + int32_t iMaxSliceNumOld = pCurLayer->iMaxSliceNum; | |
| 1289 | 1289 | int32_t iMaxSliceNumNew = 0; |
| 1290 | 1290 | int32_t iRet = 0; |
| 1291 | 1291 | int32_t iSliceIdx = 0; |
| @@ -1352,7 +1352,6 @@ int32_t ReallocSliceBuffer (sWelsEncCtx* pCtx) { · 60 unmodified lines | ||
| 1352 | 1352 | pCtx->iMaxSliceCount = iMaxSliceNumNew; |
| 1353 | 1353 | } |
| 1354 | 1354 | |
| 1355 | − pCurLayer->sSliceEncCtx.iMaxSliceNumConstraint = iMaxSliceNumNew; | |
| 1356 | 1355 | pCurLayer->sSliceThreadInfo.iMaxSliceNumInThread[0] = iMaxSliceNumNew; |
| 1357 | 1356 | pCurLayer->iMaxSliceNum = iMaxSliceNumNew; |
| 1358 | 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 | 1432 | //reallocate ppSliceInLayer if total encoded slice num exceed max slice num |
| 1434 | − if (iCodedSliceNum > pCurLayer->sSliceEncCtx.iMaxSliceNumConstraint) { | |
| 1433 | + if (iCodedSliceNum > pCurLayer->iMaxSliceNum) { | |
| 1435 | 1434 | ppSlice = (SSlice**)pMA->WelsMallocz (sizeof (SSlice*) * iCodedSliceNum, "ppSlice"); |
| 1436 | 1435 | if (NULL == ppSlice) { |
| 1437 | 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 | 1440 | pMA->WelsFree (pCurLayer->ppSliceInLayer, "ppSliceInLayer"); |
| 1442 | 1441 | pCurLayer->ppSliceInLayer = ppSlice; |
| 1443 | − pCurLayer->sSliceEncCtx.iMaxSliceNumConstraint = iCodedSliceNum; | |
| 1442 | + pCurLayer->iMaxSliceNum = iCodedSliceNum; | |
| 1444 | 1443 | } |
| 1445 | 1444 | |
| 1446 | 1445 | //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 | 1535 | #if _DEBUG |
| 1537 | 1536 | assert (NULL != pNextSlice); |
| 1538 | − // now ( pSliceCtx->iSliceNumInFrame < pSliceCtx->iMaxSliceNumConstraint ) always true by the call of this pFunc | |
| 1539 | 1537 | #endif |
| 1540 | 1538 | |
| 1541 | 1539 | //init next pSlice info |
| @@ -1587,12 +1585,15 @@ bool DynSlcJudgeSliceBoundaryStepBack (void* pCtx, void* pSlice, SSliceCtx* pSli · 45 unmodified lines | ||
| 1587 | 1585 | WelsMutexLock (&pEncCtx->pSliceThreading->mutexSliceNumUpdate); |
| 1588 | 1586 | //lock the acessing to this variable: pSliceCtx->iSliceNumInFrame |
| 1589 | 1587 | } |
| 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); | |
| 1596 | 1597 | |
| 1597 | 1598 | //DYNAMIC_SLICING_ONE_THREAD: judge jump_avoiding_pack_exceed |
| 1598 | 1599 | if (kbSliceNumNotExceedConstraint && kbSliceIdxNotExceedConstraint) {//able to add new pSlice |