History

add thread-based slice buffer and refact reallocate process for futher change

huade committed 10 years ago

Commit 5e8a7161 parent 3e538613 files · +70 −12Browse files

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

Unified · Split

codec/encoder/core/src/encoder_ext.cpp+26−1
@@ -4783,7 +4783,7 @@ int32_t WelsEncoderApplyLTR (SLogContext* pLogCtx, sWelsEncCtx** ppCtx, SLTRConf · 4782 unmodified lines
47834783 iRet = WelsEncoderParamAdjust (ppCtx, &sConfig);
47844784 return iRet;
47854785 }
4786−int32_t DynSliceRealloc (sWelsEncCtx* pCtx,
4786+int32_t FrameBsRealloc (sWelsEncCtx* pCtx,
47874787 SFrameBSInfo* pFrameBsInfo,
47884788 SLayerBSInfo* pLayerBsInfo) {
47894789 CMemoryAlign* pMA = pCtx->pMemAlign;
@@ -4823,6 +4823,17 @@ int32_t DynSliceRealloc (sWelsEncCtx* pCtx, · 33 unmodified lines
48234823 pLBI1->pNalLengthInByte = pLBI2->pNalLengthInByte + pLBI2->iNalCount;
48244824 }
48254825
4826+ return ENC_RETURN_SUCCESS;
4827+
4828+}
4829+
4830+int32_t SliceBufferRealloc (sWelsEncCtx* pCtx) {
4831+ CMemoryAlign* pMA = pCtx->pMemAlign;
4832+ SDqLayer* pCurLayer = pCtx->pCurDqLayer;
4833+ int32_t iMaxSliceNumOld = pCurLayer->sSliceEncCtx.iMaxSliceNumConstraint;
4834+ int32_t iMaxSliceNum = iMaxSliceNumOld;
4835+ iMaxSliceNum *= SLICE_NUM_EXPAND_COEF;
4836+
48264837 SSlice* pSlice = (SSlice*)pMA->WelsMallocz (sizeof (SSlice) * iMaxSliceNum, "Slice");
48274838 if (NULL == pSlice) {
48284839 WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "CWelsH264SVCEncoder::DynSliceRealloc: pSlice is NULL");
@@ -4884,6 +4895,20 @@ int32_t DynSliceRealloc (sWelsEncCtx* pCtx, · 55 unmodified lines
48844895 return ENC_RETURN_SUCCESS;
48854896 }
48864897
4898+int32_t DynSliceRealloc (sWelsEncCtx* pCtx,
4899+ SFrameBSInfo* pFrameBsInfo,
4900+ SLayerBSInfo* pLayerBsInfo) {
4901+ int32_t iRet = 0;
4902+
4903+ iRet = FrameBsRealloc (pCtx, pFrameBsInfo, pLayerBsInfo);
4904+ if(ENC_RETURN_SUCCESS != iRet)
4905+ return iRet;
4906+
4907+ iRet = SliceBufferRealloc (pCtx);
4908+
4909+ return iRet;
4910+}
4911+
48874912 int32_t WelsCodeOnePicPartition (sWelsEncCtx* pCtx,
48884913 SFrameBSInfo* pFrameBSInfo,
48894914 SLayerBSInfo* pLayerBsInfo,

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