History

replace LayerBsInfo with FrameBsInfo in thread-based private data structure

huade committed 11 years ago

Commit 7b286bc1 parent 5d9b9527 files · +41 −23Browse files

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

Unified · Split

codec/encoder/core/src/slice_multi_threading.cpp+17−12
@@ -602,7 +602,7 @@ int32_t AppendSliceToFrameBs (sWelsEncCtx* pCtx, SLayerBSInfo* pLbi, const int32 · 601 unmodified lines
602602 while (iIdx < kiCountSlicesCoded) {
603603 pSliceBs = &pCtx->pSliceBs[iSliceIdx];
604604 if (pSliceBs != NULL && pSliceBs->uiBsPos > 0) {
605− if (iPartitionIdx > 0) {
605+ if (iSliceIdx > 0) {
606606 int32_t iNalIdx = 0;
607607 const int32_t iCountNal = pSliceBs->iNalIndex;
608608
@@ -706,7 +706,10 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 97 unmodified lines
706706 &pEventsList[0],
707707 &pEncPEncCtx->pSliceThreading->pThreadMasterEvent[iEventIdx]); // blocking until at least one event is signalled
708708 if (WELS_THREAD_ERROR_WAIT_OBJECT_0 == iWaitRet) { // start pSlice coding signal waited
709− SLayerBSInfo* pLbi = pPrivateData->pLayerBs;
709+ int iLayerIndex = pEncPEncCtx->pOut->iLayerBsIndex;
710+ SFrameBSInfo* pFrameBsInfo = pPrivateData->pFrameBsInfo;
711+ SLayerBSInfo* pLbi = &pFrameBsInfo->sLayerInfo [iLayerIndex];
712+
710713 const int32_t kiCurDid = pEncPEncCtx->uiDependencyId;
711714 SWelsSvcCodingParam* pCodingParam = pEncPEncCtx->pSvcParam;
712715 SSpatialLayerConfig* pParamD = &pCodingParam->sSpatialLayers[kiCurDid];
@@ -868,7 +871,7 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 155 unmodified lines
868871
869872 WelsUnloadNalForSlice (pSliceBs);
870873
871− if (0 == kiPartitionId) {
874+ if (0 == iSliceIdx) {
872875 iReturn = WriteSliceBs (pEncPEncCtx, pLbi->pBsBuf,
873876 &pLbi->pNalLengthInByte[pLbi->iNalCount],
874877 pEncPEncCtx->iFrameBsSize - pEncPEncCtx->iPosBsBuffer,
@@ -969,16 +972,18 @@ int32_t CreateSliceThreads (sWelsEncCtx* pCtx) { · 94 unmodified lines
969972 }
970973
971974 int32_t FiredSliceThreads (sWelsEncCtx* pCtx, SSliceThreadPrivateData* pPriData, WELS_EVENT* pEventsList,
972− WELS_EVENT* pMasterEventsList, SLayerBSInfo* pLbi,
975+ WELS_EVENT* pMasterEventsList, SFrameBSInfo* pFrameBsInfo,
973976 const uint32_t uiNumThreads, SSliceCtx* pSliceCtx, const bool bIsDynamicSlicingMode) {
974− int32_t iEndMbIdx = 0;
975− int32_t iIdx = 0;
976− const int32_t kiEventCnt = uiNumThreads;
977+ int32_t iEndMbIdx = 0;
978+ int32_t iIdx = 0;
979+ const int32_t kiEventCnt = uiNumThreads;
980+ int32_t iLayerBsIdx = pCtx->pOut->iLayerBsIndex;
981+ SLayerBSInfo* pLbi = &pFrameBsInfo->sLayerInfo[iLayerBsIdx];
977982
978− if (pPriData == NULL || pLbi == NULL || kiEventCnt <= 0 || pEventsList == NULL) {
983+ if (pPriData == NULL || pFrameBsInfo == NULL || pLbi == NULL || kiEventCnt <= 0 || pEventsList == NULL) {
979984 WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR,
980− "FiredSliceThreads(), fail due pPriData == %p || pLbi == %p || iEventCnt(%d) <= 0 || pEventsList == %p!!",
981− (void*)pPriData, (void*)pLbi, uiNumThreads, (void*)pEventsList);
985+ "FiredSliceThreads(), fail due pPriData == %p ||pFrameBsInfo == %p || pLbi == %p || iEventCnt(%d) <= 0 || pEventsList == %p!!",
986+ (void*)pPriData, (void*)pFrameBsInfo, (void*)pLbi, uiNumThreads, (void*)pEventsList);
982987 return 1;
983988 }
984989
@@ -1003,8 +1008,8 @@ int32_t FiredSliceThreads (sWelsEncCtx* pCtx, SSliceThreadPrivateData* pPriData, · 18 unmodified lines
10031008
10041009 iIdx = 0;
10051010 while (iIdx < kiEventCnt) {
1006− pPriData[iIdx].pLayerBs = pLbi;
1007− pPriData[iIdx].iSliceIndex = iIdx;
1011+ pPriData[iIdx].pFrameBsInfo = pFrameBsInfo;
1012+ pPriData[iIdx].iSliceIndex = iIdx;
10081013 SetOneSliceBsBufferUnderMultithread (pCtx, iIdx, iIdx);
10091014 if (pEventsList[iIdx])
10101015 WelsEventSignal (&pEventsList[iIdx]);

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