History

Multi-thread-fixed:RBC#1708:pSlice instead of ppSliceInLayer in MB RC init/update etc. functions

huade committed 9 years ago

Commit 067aa851 parent f40452d6 files · +17 −39Browse files

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

Unified · Split

codec/encoder/core/src/svc_encode_slice.cpp+10−26
@@ -948,7 +948,7 @@ int32_t InitSliceList (sWelsEncCtx* pCtx, · 947 unmodified lines
948948 iMaxSliceBufferSize,
949949 pMa);
950950 if (ENC_RETURN_SUCCESS != iRet) {
951− return iRet;
951+ return iRet;
952952 }
953953
954954 iRet = InitSliceMBInfo (pSliceArgument, pSlice,
@@ -1014,14 +1014,14 @@ int32_t InitSliceThreadInfo (sWelsEncCtx* pCtx, · 59 unmodified lines
10141014 int32_t iRet = 0;
10151015
10161016 assert (iThreadNum > 0);
1017− iMaxSliceNumInThread = (pCtx->iMaxSliceCount / iThreadNum + 1) * 2;
1017+ //iMaxSliceNumInThread = (pCtx->iMaxSliceCount / iThreadNum + 1) * 2;
1018+ iMaxSliceNumInThread = pDqLayer->iMaxSliceNum;
10181019 iMaxSliceNumInThread = WELS_MIN (pCtx->iMaxSliceCount, (int) iMaxSliceNumInThread);
10191020
10201021 while (iIdx < iThreadNum) {
10211022 pSliceThreadInfo->iMaxSliceNumInThread[iIdx] = iMaxSliceNumInThread;
10221023 pSliceThreadInfo->iEncodedSliceNumInThread[iIdx] = 0;
1023− pSliceThreadInfo->pSliceInThread[iIdx] = (SSlice*)pMa->WelsMallocz (sizeof (SSlice) *
1024− iMaxSliceNumInThread, "pSliceInThread");
1024+ pSliceThreadInfo->pSliceInThread[iIdx] = (SSlice*)pMa->WelsMallocz (sizeof (SSlice) * iMaxSliceNumInThread, "pSliceInThread");
10251025 if (NULL == pSliceThreadInfo->pSliceInThread[iIdx]) {
10261026 WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR,
10271027 "CWelsH264SVCEncoder::InitSliceThreadInfo: pSliceThreadInfo->pSliceInThread[iIdx] is NULL");
@@ -1069,25 +1069,8 @@ int32_t InitSliceInLayer (sWelsEncCtx* pCtx, · 41 unmodified lines
10691069 return iRet;
10701070 }
10711071
1072− pDqLayer->sLayerInfo.pSliceInLayer = (SSlice*)pMa->WelsMallocz (sizeof (SSlice) * iMaxSliceNum, "pSliceInLayer");
1073− if (NULL == pDqLayer->sLayerInfo.pSliceInLayer) {
1074− WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR,
1075− "CWelsH264SVCEncoder::InitSliceInLayer: pDqLayer->sLayerInfo.pSliceInLayeris NULL");
1076− return ENC_RETURN_MEMALLOCERR;
1077− }
1078−
1079− iRet = InitSliceList (pCtx,
1080− pDqLayer,
1081− pDqLayer->sLayerInfo.pSliceInLayer,
1082− iMaxSliceNum,
1083− kiDlayerIndex,
1084− pMa);
1085− if (ENC_RETURN_SUCCESS != iRet) {
1086− return iRet;
1087− }
1088−
10891072 for (iSliceIdx = 0; iSliceIdx < iMaxSliceNum; iSliceIdx++) {
1090− pDqLayer->ppSliceInLayer[iSliceIdx] = &pDqLayer->sLayerInfo.pSliceInLayer[iSliceIdx];
1073+ pDqLayer->ppSliceInLayer[iSliceIdx] = pDqLayer->sSliceThreadInfo.pSliceInThread[0] + iSliceIdx;
10911074 }
10921075
10931076 return ENC_RETURN_SUCCESS;
@@ -1295,7 +1278,7 @@ int32_t ReallocSliceBuffer (sWelsEncCtx* pCtx) { · 201 unmodified lines
12951278 int32_t iSliceIdx = 0;
12961279 const int32_t kiCurDid = pCtx->uiDependencyId;
12971280
1298− SSlice* pLastCodedSlice = pCurLayer->sLayerInfo.pSliceInLayer + (iMaxSliceNumOld - 1);
1281+ SSlice* pLastCodedSlice = pCurLayer->sSliceThreadInfo.pSliceInThread[0] + (iMaxSliceNumOld - 1);
12991282 SSliceArgument* pSliceArgument = & pCtx->pSvcParam->sSpatialLayers[kiCurDid].sSliceArgument;
13001283 iRet = CalculateNewSliceNum (pCurLayer,
13011284 pLastCodedSlice,
@@ -1308,7 +1291,7 @@ int32_t ReallocSliceBuffer (sWelsEncCtx* pCtx) { · 6 unmodified lines
13081291
13091292 iRet = ReallocateSliceList (pCtx,
13101293 pSliceArgument,
1311− pCurLayer->sLayerInfo.pSliceInLayer,
1294+ pCurLayer->sSliceThreadInfo.pSliceInThread[0],
13121295 iMaxSliceNumOld,
13131296 iMaxSliceNumNew);
13141297 if (ENC_RETURN_SUCCESS != iRet) {
@@ -1325,14 +1308,15 @@ int32_t ReallocSliceBuffer (sWelsEncCtx* pCtx) { · 10 unmodified lines
13251308 pCurLayer->ppSliceInLayer = ppSlice;
13261309
13271310 for (iSliceIdx = 0; iSliceIdx < iMaxSliceNumNew; iSliceIdx++) {
1328− pCurLayer->ppSliceInLayer[iSliceIdx] = &pCurLayer->sLayerInfo.pSliceInLayer[iSliceIdx];
1311+ pCurLayer->ppSliceInLayer[iSliceIdx] = pCurLayer->sSliceThreadInfo.pSliceInThread[0] + iSliceIdx;
13291312 }
13301313
13311314 if (pCtx->iMaxSliceCount < iMaxSliceNumNew) {
13321315 pCtx->iMaxSliceCount = iMaxSliceNumNew;
13331316 }
13341317
1335− pCurLayer->sSliceEncCtx.iMaxSliceNumConstraint = iMaxSliceNumNew;
1318+ pCurLayer->sSliceEncCtx.iMaxSliceNumConstraint = iMaxSliceNumNew;
1319+ pCurLayer->sSliceThreadInfo.iMaxSliceNumInThread[0] = iMaxSliceNumNew;
13361320 pCurLayer->iMaxSliceNum = iMaxSliceNumNew;
13371321 return ENC_RETURN_SUCCESS;
13381322 }

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