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
4446 iRet = WelsEncoderParamAdjust (ppCtx, &sConfig);4446 iRet = WelsEncoderParamAdjust (ppCtx, &sConfig);
4447 return iRet;4447 return iRet;
4448}4448}
4449int32_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}
4492 4449
4493int32_t DynSliceRealloc (sWelsEncCtx* pCtx,4450int32_t DynSliceRealloc (sWelsEncCtx* pCtx,
4494 SFrameBSInfo* pFrameBsInfo,4451 SFrameBSInfo* pFrameBsInfo,
4495 SLayerBSInfo* pLayerBsInfo) {4452 SLayerBSInfo* pLayerBsInfo) {
4496 int32_t iRet = 0;4453 int32_t iRet = 0;
4497 4454
4498 iRet = FrameBsRealloc (pCtx, pFrameBsInfo, pLayerBsInfo);4455 iRet = FrameBsRealloc (pCtx, pFrameBsInfo, pLayerBsInfo, pCtx->pCurDqLayer->iMaxSliceNum);
4499
4500 if(ENC_RETURN_SUCCESS != iRet) {4456 if(ENC_RETURN_SUCCESS != iRet) {
4501 return iRet;4457 return iRet;
4502 }4458 }
@@ -4571,7 +4527,6 @@ int32_t WelsCodeOnePicPartition (sWelsEncCtx* pCtx, · 68 unmodified lines
4571 }4527 }
4572 4528
4573 WelsLoadNal (pCtx->pOut, keNalType, keNalRefIdc);4529 WelsLoadNal (pCtx->pOut, keNalType, keNalRefIdc);
4574
4575 pCurSlice = &pCtx->pCurDqLayer->sSliceThreadInfo.pSliceInThread[uiTheadIdx][iSliceIdx];4530 pCurSlice = &pCtx->pCurDqLayer->sSliceThreadInfo.pSliceInThread[uiTheadIdx][iSliceIdx];
4576 assert (iSliceIdx == pCurSlice->iSliceIdx);4531 assert (iSliceIdx == pCurSlice->iSliceIdx);
4577 4532
@@ -4600,7 +4555,6 @@ int32_t WelsCodeOnePicPartition (sWelsEncCtx* pCtx, · 22 unmodified lines
4600#endif//SLICE_INFO_OUTPUT4555#endif//SLICE_INFO_OUTPUT
4601 4556
4602 ++ iNalIdxInLayer;4557 ++ iNalIdxInLayer;
4603
4604 iSliceIdx += kiSliceStep; //if iSliceIdx is not continuous4558 iSliceIdx += kiSliceStep; //if iSliceIdx is not continuous
4605 iAnyMbLeftInPartition = iEndMbIdxInPartition - pCurLayer->pLastCodedMbIdxOfPartition[kiPartitionId];4559 iAnyMbLeftInPartition = iEndMbIdxInPartition - pCurLayer->pLastCodedMbIdxOfPartition[kiPartitionId];
4606 }4560 }

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