Showing the changes to codec/encoder/core/src/encoder_ext.cpp (1 of 5 files). Show all
Unified · Split
| @@ -1748,6 +1748,13 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx, SExistingParasetList* pExistingPa · 1747 unmodified lines | ||
| 1748 | 1748 | (*ppCtx)->iFrameBsSize = iTotalLength; |
| 1749 | 1749 | (*ppCtx)->iPosBsBuffer = 0; |
| 1750 | 1750 | |
| 1751 | + // for dynamic slice mode&& CABAC,allocate slice buffer to restore slice data | |
| 1752 | + if (bDynamicSlice && pParam->iEntropyCodingModeFlag) { | |
| 1753 | + for (int32_t iIdx = 0; iIdx < MAX_THREADS_NUM; iIdx++) { | |
| 1754 | + (*ppCtx)->pDynamicBsBuffer[iIdx] = (uint8_t*)pMa->WelsMalloc (iMaxSliceBufferSize, "DynamicSliceBs"); | |
| 1755 | + WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pDynamicBsBuffer[iIdx]), FreeMemorySvc (ppCtx)) | |
| 1756 | + } | |
| 1757 | + } | |
| 1751 | 1758 | // for pSlice bs buffers |
| 1752 | 1759 | if (pParam->iMultipleThreadIdc > 1 |
| 1753 | 1760 | && RequestMtResource (ppCtx, pParam, iCountBsLen, iMaxSliceBufferSize, bDynamicSlice)) { |
| @@ -1957,7 +1964,11 @@ void FreeMemorySvc (sWelsEncCtx** ppCtx) { · 203 unmodified lines | ||
| 1957 | 1964 | pMa->WelsFree (pCtx->pFrameBs, "pFrameBs"); |
| 1958 | 1965 | pCtx->pFrameBs = NULL; |
| 1959 | 1966 | } |
| 1967 | + for (int32_t iIdx = 0; iIdx < MAX_THREADS_NUM; iIdx++) { | |
| 1968 | + pMa->WelsFree (pCtx->pDynamicBsBuffer[iIdx], "DynamicSliceBs"); | |
| 1969 | + pCtx->pDynamicBsBuffer[iIdx] = NULL; | |
| 1960 | 1970 | |
| 1971 | + } | |
| 1961 | 1972 | // pSpsArray |
| 1962 | 1973 | if (NULL != pCtx->pSpsArray) { |
| 1963 | 1974 | pMa->WelsFree (pCtx->pSpsArray, "pSpsArray"); |