Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 5 files). Show all
Unified · Split
| @@ -2478,6 +2478,7 @@ void UpdateSlicepEncCtxWithPartition (SDqLayer* pCurDq, int32_t iPartitionNum) { · 2477 unmodified lines | ||
| 2478 | 2478 | void WelsInitCurrentDlayerMltslc (sWelsEncCtx* pCtx, int32_t iPartitionNum) { |
| 2479 | 2479 | SDqLayer* pCurDq = pCtx->pCurDqLayer; |
| 2480 | 2480 | SSliceCtx* pSliceCtx = &pCurDq->sSliceEncCtx; |
| 2481 | + uint32_t uiMiniPacketSize = 0; | |
| 2481 | 2482 | |
| 2482 | 2483 | UpdateSlicepEncCtxWithPartition (pCurDq, iPartitionNum); |
| 2483 | 2484 | |
| @@ -2508,12 +2509,9 @@ void WelsInitCurrentDlayerMltslc (sWelsEncCtx* pCtx, int32_t iPartitionNum) { · 24 unmodified lines | ||
| 2508 | 2509 | } |
| 2509 | 2510 | |
| 2510 | 2511 | //MINPACKETSIZE_CONSTRAINT |
| 2511 | − if (pSliceCtx->uiSliceSizeConstraint | |
| 2512 | − < | |
| 2513 | − (uint32_t) (uiFrmByte//suppose 16 byte per mb at average | |
| 2514 | − / (pSliceCtx->iMaxSliceNumConstraint)) | |
| 2515 | − ) { | |
| 2516 | − | |
| 2512 | + //suppose 16 byte per mb at average | |
| 2513 | + uiMiniPacketSize = (uint32_t) (uiFrmByte / pSliceCtx->iMaxSliceNumConstraint); | |
| 2514 | + if (pSliceCtx->uiSliceSizeConstraint < uiMiniPacketSize ) { | |
| 2517 | 2515 | WelsLog (& (pCtx->sLogCtx), |
| 2518 | 2516 | WELS_LOG_WARNING, |
| 2519 | 2517 | "Set-SliceConstraint(%d) too small for current resolution (MB# %d) under QP/BR!", |
| @@ -4445,7 +4443,7 @@ int32_t FrameBsRealloc (sWelsEncCtx* pCtx, · 1925 unmodified lines | ||
| 4445 | 4443 | SDqLayer* pCurLayer = pCtx->pCurDqLayer; |
| 4446 | 4444 | |
| 4447 | 4445 | int32_t iCountNals = pCtx->pOut->iCountNals; |
| 4448 | − int32_t iMaxSliceNumOld = pCurLayer->sSliceEncCtx.iMaxSliceNumConstraint; | |
| 4446 | + int32_t iMaxSliceNumOld = pCurLayer->iMaxSliceNum; | |
| 4449 | 4447 | int32_t iMaxSliceNum = iMaxSliceNumOld; |
| 4450 | 4448 | iCountNals += iMaxSliceNum * (pCtx->pSvcParam->iSpatialLayerNum + pCtx->bNeedPrefixNalFlag); |
| 4451 | 4449 | iMaxSliceNum *= SLICE_NUM_EXPAND_COEF; |
| @@ -4512,7 +4510,6 @@ int32_t WelsCodeOnePicPartition (sWelsEncCtx* pCtx, · 60 unmodified lines | ||
| 4512 | 4510 | ) { |
| 4513 | 4511 | |
| 4514 | 4512 | SDqLayer* pCurLayer = pCtx->pCurDqLayer; |
| 4515 | − SSliceCtx* pSliceCtx = &pCurLayer->sSliceEncCtx; | |
| 4516 | 4513 | SSlice* pStartSlice = pCurLayer->ppSliceInLayer[iStartSliceIdx]; |
| 4517 | 4514 | int32_t iNalIdxInLayer = *pNalIdxInLayer; |
| 4518 | 4515 | int32_t iSliceIdx = iStartSliceIdx; |
| @@ -4538,7 +4535,7 @@ int32_t WelsCodeOnePicPartition (sWelsEncCtx* pCtx, · 19 unmodified lines | ||
| 4538 | 4535 | int32_t iPayloadSize = 0; |
| 4539 | 4536 | SSlice* pCurSlice = NULL; |
| 4540 | 4537 | |
| 4541 | − if (iSliceIdx >= (pSliceCtx->iMaxSliceNumConstraint - kiSliceIdxStep)) { // insufficient memory in pSliceInLayer[] | |
| 4538 | + if (iSliceIdx >= (pCurLayer->iMaxSliceNum - kiSliceIdxStep)) { // insufficient memory in pSliceInLayer[] | |
| 4542 | 4539 | if (pCtx->iActiveThreadsNum == 1) { |
| 4543 | 4540 | //only single thread support re-alloc now |
| 4544 | 4541 | if (DynSliceRealloc (pCtx, pFrameBSInfo, pLayerBsInfo)) { |
| @@ -4546,10 +4543,10 @@ int32_t WelsCodeOnePicPartition (sWelsEncCtx* pCtx, · 1 unmodified line | ||
| 4546 | 4543 | "CWelsH264SVCEncoder::WelsCodeOnePicPartition: DynSliceRealloc not successful"); |
| 4547 | 4544 | return ENC_RETURN_MEMALLOCERR; |
| 4548 | 4545 | } |
| 4549 | − } else if (iSliceIdx >= pSliceCtx->iMaxSliceNumConstraint) { | |
| 4546 | + } else if (iSliceIdx >= pCurLayer->iMaxSliceNum) { | |
| 4550 | 4547 | WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, |
| 4551 | − "CWelsH264SVCEncoder::WelsCodeOnePicPartition: iSliceIdx(%d) over iMaxSliceNumConstraint(%d)", iSliceIdx, | |
| 4552 | − pSliceCtx->iMaxSliceNumConstraint); | |
| 4548 | + "CWelsH264SVCEncoder::WelsCodeOnePicPartition: iSliceIdx(%d) over iMaxSliceNum(%d)", iSliceIdx, | |
| 4549 | + pCurLayer->iMaxSliceNum); | |
| 4553 | 4550 | return ENC_RETURN_MEMALLOCERR; |
| 4554 | 4551 | } |
| 4555 | 4552 | } |