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
602 while (iIdx < kiCountSlicesCoded) {602 while (iIdx < kiCountSlicesCoded) {
603 pSliceBs = &pCtx->pSliceBs[iSliceIdx];603 pSliceBs = &pCtx->pSliceBs[iSliceIdx];
604 if (pSliceBs != NULL && pSliceBs->uiBsPos > 0) {604 if (pSliceBs != NULL && pSliceBs->uiBsPos > 0) {
605 if (iPartitionIdx > 0) {605 if (iSliceIdx > 0) {
606 int32_t iNalIdx = 0;606 int32_t iNalIdx = 0;
607 const int32_t iCountNal = pSliceBs->iNalIndex;607 const int32_t iCountNal = pSliceBs->iNalIndex;
608 608
@@ -706,7 +706,10 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 97 unmodified lines
706 &pEventsList[0],706 &pEventsList[0],
707 &pEncPEncCtx->pSliceThreading->pThreadMasterEvent[iEventIdx]); // blocking until at least one event is signalled707 &pEncPEncCtx->pSliceThreading->pThreadMasterEvent[iEventIdx]); // blocking until at least one event is signalled
708 if (WELS_THREAD_ERROR_WAIT_OBJECT_0 == iWaitRet) { // start pSlice coding signal waited708 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
710 const int32_t kiCurDid = pEncPEncCtx->uiDependencyId;713 const int32_t kiCurDid = pEncPEncCtx->uiDependencyId;
711 SWelsSvcCodingParam* pCodingParam = pEncPEncCtx->pSvcParam;714 SWelsSvcCodingParam* pCodingParam = pEncPEncCtx->pSvcParam;
712 SSpatialLayerConfig* pParamD = &pCodingParam->sSpatialLayers[kiCurDid];715 SSpatialLayerConfig* pParamD = &pCodingParam->sSpatialLayers[kiCurDid];
@@ -868,7 +871,7 @@ WELS_THREAD_ROUTINE_TYPE CodingSliceThreadProc (void* arg) { · 155 unmodified lines
868 871
869 WelsUnloadNalForSlice (pSliceBs);872 WelsUnloadNalForSlice (pSliceBs);
870 873
871 if (0 == kiPartitionId) {874 if (0 == iSliceIdx) {
872 iReturn = WriteSliceBs (pEncPEncCtx, pLbi->pBsBuf,875 iReturn = WriteSliceBs (pEncPEncCtx, pLbi->pBsBuf,
873 &pLbi->pNalLengthInByte[pLbi->iNalCount],876 &pLbi->pNalLengthInByte[pLbi->iNalCount],
874 pEncPEncCtx->iFrameBsSize - pEncPEncCtx->iPosBsBuffer,877 pEncPEncCtx->iFrameBsSize - pEncPEncCtx->iPosBsBuffer,
@@ -969,16 +972,18 @@ int32_t CreateSliceThreads (sWelsEncCtx* pCtx) { · 94 unmodified lines
969}972}
970 973
971int32_t FiredSliceThreads (sWelsEncCtx* pCtx, SSliceThreadPrivateData* pPriData, WELS_EVENT* pEventsList,974int32_t FiredSliceThreads (sWelsEncCtx* pCtx, SSliceThreadPrivateData* pPriData, WELS_EVENT* pEventsList,
972 WELS_EVENT* pMasterEventsList, SLayerBSInfo* pLbi,975 WELS_EVENT* pMasterEventsList, SFrameBSInfo* pFrameBsInfo,
973 const uint32_t uiNumThreads, SSliceCtx* pSliceCtx, const bool bIsDynamicSlicingMode) {976 const uint32_t uiNumThreads, SSliceCtx* pSliceCtx, const bool bIsDynamicSlicingMode) {
974 int32_t iEndMbIdx = 0;977 int32_t iEndMbIdx = 0;
975 int32_t iIdx = 0;978 int32_t iIdx = 0;
976 const int32_t kiEventCnt = uiNumThreads;979 const int32_t kiEventCnt = uiNumThreads;
980 int32_t iLayerBsIdx = pCtx->pOut->iLayerBsIndex;
981 SLayerBSInfo* pLbi = &pFrameBsInfo->sLayerInfo[iLayerBsIdx];
977 982
978 if (pPriData == NULL || pLbi == NULL || kiEventCnt <= 0 || pEventsList == NULL) {983 if (pPriData == NULL || pFrameBsInfo == NULL || pLbi == NULL || kiEventCnt <= 0 || pEventsList == NULL) {
979 WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR,984 WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR,
980 "FiredSliceThreads(), fail due pPriData == %p || pLbi == %p || iEventCnt(%d) <= 0 || pEventsList == %p!!",985 "FiredSliceThreads(), fail due pPriData == %p ||pFrameBsInfo == %p || pLbi == %p || iEventCnt(%d) <= 0 || pEventsList == %p!!",
981 (void*)pPriData, (void*)pLbi, uiNumThreads, (void*)pEventsList);986 (void*)pPriData, (void*)pFrameBsInfo, (void*)pLbi, uiNumThreads, (void*)pEventsList);
982 return 1;987 return 1;
983 }988 }
984 989
@@ -1003,8 +1008,8 @@ int32_t FiredSliceThreads (sWelsEncCtx* pCtx, SSliceThreadPrivateData* pPriData, · 18 unmodified lines
1003 1008
1004 iIdx = 0;1009 iIdx = 0;
1005 while (iIdx < kiEventCnt) {1010 while (iIdx < kiEventCnt) {
1006 pPriData[iIdx].pLayerBs = pLbi;1011 pPriData[iIdx].pFrameBsInfo = pFrameBsInfo;
1007 pPriData[iIdx].iSliceIndex = iIdx;1012 pPriData[iIdx].iSliceIndex = iIdx;
1008 SetOneSliceBsBufferUnderMultithread (pCtx, iIdx, iIdx);1013 SetOneSliceBsBufferUnderMultithread (pCtx, iIdx, iIdx);
1009 if (pEventsList[iIdx])1014 if (pEventsList[iIdx])
1010 WelsEventSignal (&pEventsList[iIdx]);1015 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