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
4783 iRet = WelsEncoderParamAdjust (ppCtx, &sConfig);4783 iRet = WelsEncoderParamAdjust (ppCtx, &sConfig);
4784 return iRet;4784 return iRet;
4785}4785}
4786int32_t DynSliceRealloc (sWelsEncCtx* pCtx,4786int32_t FrameBsRealloc (sWelsEncCtx* pCtx,
4787 SFrameBSInfo* pFrameBsInfo,4787 SFrameBSInfo* pFrameBsInfo,
4788 SLayerBSInfo* pLayerBsInfo) {4788 SLayerBSInfo* pLayerBsInfo) {
4789 CMemoryAlign* pMA = pCtx->pMemAlign;4789 CMemoryAlign* pMA = pCtx->pMemAlign;
@@ -4823,6 +4823,17 @@ int32_t DynSliceRealloc (sWelsEncCtx* pCtx, · 33 unmodified lines
4823 pLBI1->pNalLengthInByte = pLBI2->pNalLengthInByte + pLBI2->iNalCount;4823 pLBI1->pNalLengthInByte = pLBI2->pNalLengthInByte + pLBI2->iNalCount;
4824 }4824 }
4825 4825
4826 return ENC_RETURN_SUCCESS;
4827
4828}
4829
4830int32_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
4826 SSlice* pSlice = (SSlice*)pMA->WelsMallocz (sizeof (SSlice) * iMaxSliceNum, "Slice");4837 SSlice* pSlice = (SSlice*)pMA->WelsMallocz (sizeof (SSlice) * iMaxSliceNum, "Slice");
4827 if (NULL == pSlice) {4838 if (NULL == pSlice) {
4828 WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "CWelsH264SVCEncoder::DynSliceRealloc: pSlice is NULL");4839 WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "CWelsH264SVCEncoder::DynSliceRealloc: pSlice is NULL");
@@ -4884,6 +4895,20 @@ int32_t DynSliceRealloc (sWelsEncCtx* pCtx, · 55 unmodified lines
4884 return ENC_RETURN_SUCCESS;4895 return ENC_RETURN_SUCCESS;
4885}4896}
4886 4897
4898int32_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
4887int32_t WelsCodeOnePicPartition (sWelsEncCtx* pCtx,4912int32_t WelsCodeOnePicPartition (sWelsEncCtx* pCtx,
4888 SFrameBSInfo* pFrameBSInfo,4913 SFrameBSInfo* pFrameBSInfo,
4889 SLayerBSInfo* pLayerBsInfo,4914 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