History

fix issues with dynamic slice mode and cabac

Karina committed 9 years ago

Commit 1d481661 parent 61b9ddc5 files · +39 −10Browse files

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

Unified · Split

codec/encoder/core/src/encoder_ext.cpp+11−0
@@ -1748,6 +1748,13 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx, SExistingParasetList* pExistingPa · 1747 unmodified lines
17481748 (*ppCtx)->iFrameBsSize = iTotalLength;
17491749 (*ppCtx)->iPosBsBuffer = 0;
17501750
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+ }
17511758 // for pSlice bs buffers
17521759 if (pParam->iMultipleThreadIdc > 1
17531760 && RequestMtResource (ppCtx, pParam, iCountBsLen, iMaxSliceBufferSize, bDynamicSlice)) {
@@ -1957,7 +1964,11 @@ void FreeMemorySvc (sWelsEncCtx** ppCtx) { · 203 unmodified lines
19571964 pMa->WelsFree (pCtx->pFrameBs, "pFrameBs");
19581965 pCtx->pFrameBs = NULL;
19591966 }
1967+ for (int32_t iIdx = 0; iIdx < MAX_THREADS_NUM; iIdx++) {
1968+ pMa->WelsFree (pCtx->pDynamicBsBuffer[iIdx], "DynamicSliceBs");
1969+ pCtx->pDynamicBsBuffer[iIdx] = NULL;
19601970
1971+ }
19611972 // pSpsArray
19621973 if (NULL != pCtx->pSpsArray) {
19631974 pMa->WelsFree (pCtx->pSpsArray, "pSpsArray");

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