History

Multi-thread-fixed:RBC#1725:refactoring for ReOrderSliceInLayer module

huade committed 9 years ago

Commit 612a0a31 parent 57016556 files · +235 −124Browse files

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

Unified · Split

codec/encoder/core/src/encoder_ext.cpp+1−47
@@ -4446,57 +4446,13 @@ int32_t WelsEncoderApplyLTR (SLogContext* pLogCtx, sWelsEncCtx** ppCtx, SLTRConf · 4445 unmodified lines
44464446 iRet = WelsEncoderParamAdjust (ppCtx, &sConfig);
44474447 return iRet;
44484448 }
4449−int32_t FrameBsRealloc (sWelsEncCtx* pCtx,
4450− SFrameBSInfo* pFrameBsInfo,
4451− SLayerBSInfo* pLayerBsInfo) {
4452− CMemoryAlign* pMA = pCtx->pMemAlign;
4453− SDqLayer* pCurLayer = pCtx->pCurDqLayer;
4454−
4455− int32_t iCountNals = pCtx->pOut->iCountNals;
4456− int32_t iMaxSliceNumOld = pCurLayer->iMaxSliceNum;
4457− int32_t iMaxSliceNum = iMaxSliceNumOld;
4458− iCountNals += iMaxSliceNum * (pCtx->pSvcParam->iSpatialLayerNum + pCtx->bNeedPrefixNalFlag);
4459− iMaxSliceNum *= SLICE_NUM_EXPAND_COEF;
4460−
4461− SWelsNalRaw* pNalList = (SWelsNalRaw*)pMA->WelsMallocz (iCountNals * sizeof (SWelsNalRaw), "pOut->sNalList");
4462− if (NULL == pNalList) {
4463− WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "CWelsH264SVCEncoder::FrameBsRealloc: pNalList is NULL");
4464− return ENC_RETURN_MEMALLOCERR;
4465− }
4466− memcpy (pNalList, pCtx->pOut->sNalList, sizeof (SWelsNalRaw) * pCtx->pOut->iCountNals);
4467− pMA->WelsFree (pCtx->pOut->sNalList, "pOut->sNalList");
4468− pCtx->pOut->sNalList = pNalList;
4469−
4470− int32_t* pNalLen = (int32_t*)pMA->WelsMallocz (iCountNals * sizeof (int32_t), "pOut->pNalLen");
4471− if (NULL == pNalLen) {
4472− WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "CWelsH264SVCEncoder::FrameBsRealloc: pNalLen is NULL");
4473− return ENC_RETURN_MEMALLOCERR;
4474− }
4475− memcpy (pNalLen, pCtx->pOut->pNalLen, sizeof (int32_t) * pCtx->pOut->iCountNals);
4476− pMA->WelsFree (pCtx->pOut->pNalLen, "pOut->pNalLen");
4477− pCtx->pOut->pNalLen = pNalLen;
4478−
4479− pCtx->pOut->iCountNals = iCountNals;
4480− SLayerBSInfo* pLBI1, *pLBI2;
4481− pLBI1 = &pFrameBsInfo->sLayerInfo[0];
4482− pLBI1->pNalLengthInByte = pCtx->pOut->pNalLen;
4483− while (pLBI1 != pLayerBsInfo) {
4484− pLBI2 = pLBI1;
4485− ++ pLBI1;
4486− pLBI1->pNalLengthInByte = pLBI2->pNalLengthInByte + pLBI2->iNalCount;
4487− }
4488−
4489− return ENC_RETURN_SUCCESS;
4490−
4491−}
44924449
44934450 int32_t DynSliceRealloc (sWelsEncCtx* pCtx,
44944451 SFrameBSInfo* pFrameBsInfo,
44954452 SLayerBSInfo* pLayerBsInfo) {
44964453 int32_t iRet = 0;
44974454
4498− iRet = FrameBsRealloc (pCtx, pFrameBsInfo, pLayerBsInfo);
4499−
4455+ iRet = FrameBsRealloc (pCtx, pFrameBsInfo, pLayerBsInfo, pCtx->pCurDqLayer->iMaxSliceNum);
45004456 if(ENC_RETURN_SUCCESS != iRet) {
45014457 return iRet;
45024458 }
@@ -4571,7 +4527,6 @@ int32_t WelsCodeOnePicPartition (sWelsEncCtx* pCtx, · 68 unmodified lines
45714527 }
45724528
45734529 WelsLoadNal (pCtx->pOut, keNalType, keNalRefIdc);
4574−
45754530 pCurSlice = &pCtx->pCurDqLayer->sSliceThreadInfo.pSliceInThread[uiTheadIdx][iSliceIdx];
45764531 assert (iSliceIdx == pCurSlice->iSliceIdx);
45774532
@@ -4600,7 +4555,6 @@ int32_t WelsCodeOnePicPartition (sWelsEncCtx* pCtx, · 22 unmodified lines
46004555 #endif//SLICE_INFO_OUTPUT
46014556
46024557 ++ iNalIdxInLayer;
4603−
46044558 iSliceIdx += kiSliceStep; //if iSliceIdx is not continuous
46054559 iAnyMbLeftInPartition = iEndMbIdxInPartition - pCurLayer->pLastCodedMbIdxOfPartition[kiPartitionId];
46064560 }

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