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/svc_encode_slice.cpp (1 of 6 files). Show all

Unified · Split

codec/encoder/core/src/svc_encode_slice.cpp+208−74
@@ -977,6 +977,47 @@ int32_t InitSliceList (sWelsEncCtx* pCtx, · 976 unmodified lines
977977 return ENC_RETURN_SUCCESS;
978978 }
979979
980+int32_t InitAllSlicesInThread (sWelsEncCtx* pCtx) {
981+ SDqLayer* pDqLayer = pCtx->pCurDqLayer;
982+ int32_t iSliceIdx = 0;
983+
984+ for( ; iSliceIdx < pDqLayer->iMaxSliceNum; iSliceIdx++) {
985+ if(NULL == pDqLayer->ppSliceInLayer[iSliceIdx]) {
986+ return ENC_RETURN_UNEXPECTED;
987+ }
988+
989+ pDqLayer->ppSliceInLayer[iSliceIdx]->iSliceIdx = -1;
990+ }
991+
992+ return ENC_RETURN_SUCCESS;
993+}
994+
995+int32_t InitOneSliceInThread (sWelsEncCtx* pCtx,
996+ SSlice*& pSlice,
997+ const int32_t kiThreadIdx,
998+ const int32_t kiDlayerIdx,
999+ const int32_t kiSliceIdx) {
1000+ SDqLayer* pDqLayer = pCtx->pCurDqLayer;
1001+ const int32_t kiCodedNumInThread = pDqLayer->sSliceThreadInfo.iEncodedSliceNumInThread[kiThreadIdx];
1002+ const int32_t kiMaxSliceNumInThread = pDqLayer->sSliceThreadInfo.iMaxSliceNumInThread[kiThreadIdx];
1003+ int32_t iRet = 0;
1004+
1005+ if (kiCodedNumInThread >= kiMaxSliceNumInThread) {
1006+ iRet = ReallocateSliceInThread(pCtx, pDqLayer, kiDlayerIdx, kiThreadIdx);
1007+ if (ENC_RETURN_SUCCESS != iRet) {
1008+ return iRet;
1009+ }
1010+ }
1011+
1012+ pSlice = pDqLayer->sSliceThreadInfo.pSliceInThread [kiThreadIdx] + kiCodedNumInThread;
1013+ // Initialize slice bs buffer info
1014+ pSlice->sSliceBs.uiBsPos = 0;
1015+ pSlice->sSliceBs.iNalIndex = 0;
1016+ pSlice->sSliceBs.pBsBuffer = pCtx->pSliceThreading->pThreadBsBuffer[kiThreadIdx];
1017+
1018+ return ENC_RETURN_SUCCESS;
1019+}
1020+
9801021 int32_t InitSliceThreadInfo (sWelsEncCtx* pCtx,
9811022 SDqLayer* pDqLayer,
9821023 const int32_t kiDlayerIndex,
@@ -1214,25 +1255,21 @@ int32_t CalculateNewSliceNum (SDqLayer* pDqLayer, · 231 unmodified lines
12141255 return ENC_RETURN_SUCCESS;
12151256 }
12161257
1217−int32_t ReallocSliceBuffer (sWelsEncCtx* pCtx) {
1258+int32_t ReallocateSliceInThread (sWelsEncCtx* pCtx,
1259+ SDqLayer* pDqLayer,
1260+ const int32_t kiDlayerIdx,
1261+ const int32_t kiThreadIndex) {
12181262
1219− CMemoryAlign* pMA = pCtx->pMemAlign;
1220− SDqLayer* pCurLayer = pCtx->pCurDqLayer;
1221− SSlice** ppSlice = NULL;
1222− int32_t iMaxSliceNumOld = pCurLayer->iMaxSliceNum;
1223− int32_t iMaxSliceNumNew = 0;
1224− int32_t iRet = 0;
1225− int32_t iSliceIdx = 0;
1226− const int32_t kiCurDid = pCtx->uiDependencyId;
1263+ int32_t iMaxSliceNumInThread = pDqLayer->sSliceThreadInfo.iMaxSliceNumInThread[kiThreadIndex];
1264+ int32_t iMaxSliceNumUpdate = 0;
1265+ int32_t iRet = 0;
1266+ SSlice* pLastCodedSlice = pDqLayer->sSliceThreadInfo.pSliceInThread[kiThreadIndex] + (iMaxSliceNumInThread - 1);
1267+ SSliceArgument* pSliceArgument = & pCtx->pSvcParam->sSpatialLayers[kiDlayerIdx].sSliceArgument;
12271268
1228− int32_t* pFirstMbIdxofSlice = NULL;
1229− int32_t* pCountMbNumInSlice = NULL;
1230− SSlice* pLastCodedSlice = pCurLayer->sSliceThreadInfo.pSliceInThread[0] + (iMaxSliceNumOld - 1);
1231− SSliceArgument* pSliceArgument = & pCtx->pSvcParam->sSpatialLayers[kiCurDid].sSliceArgument;
1232− iRet = CalculateNewSliceNum (pCurLayer,
1269+ iRet = CalculateNewSliceNum (pDqLayer,
12331270 pLastCodedSlice,
1234− iMaxSliceNumOld,
1235− iMaxSliceNumNew);
1271+ iMaxSliceNumInThread,
1272+ iMaxSliceNumUpdate);
12361273
12371274 if (ENC_RETURN_SUCCESS != iRet) {
12381275 return iRet;
@@ -1240,44 +1277,91 @@ int32_t ReallocSliceBuffer (sWelsEncCtx* pCtx) { · 1 unmodified line
12401277
12411278 iRet = ReallocateSliceList (pCtx,
12421279 pSliceArgument,
1243− pCurLayer->sSliceThreadInfo.pSliceInThread[0],
1244− iMaxSliceNumOld,
1245− iMaxSliceNumNew);
1280+ pDqLayer->sSliceThreadInfo.pSliceInThread[kiThreadIndex],
1281+ iMaxSliceNumInThread,
1282+ iMaxSliceNumUpdate);
12461283 if (ENC_RETURN_SUCCESS != iRet) {
12471284 return iRet;
12481285 }
12491286
1287+ return ENC_RETURN_SUCCESS;
1288+}
1289+
1290+int32_t ExtendLayerBuffer(sWelsEncCtx* pCtx,
1291+ const int32_t kiMaxSliceNumOld,
1292+ const int32_t kiMaxSliceNumNew){
1293+ CMemoryAlign* pMA = pCtx->pMemAlign;
1294+ SDqLayer* pCurLayer = pCtx->pCurDqLayer;
1295+ SSlice** ppSlice = NULL;
1296+ int32_t* pFirstMbIdxofSlice = NULL;
1297+ int32_t* pCountMbNumInSlice = NULL;
1298+
12501299 // update for ppsliceInlayer
1251− ppSlice = (SSlice**)pMA->WelsMallocz (sizeof (SSlice*) * iMaxSliceNumNew, "ppSlice");
1300+ ppSlice = (SSlice**)pMA->WelsMallocz (sizeof (SSlice*) * kiMaxSliceNumNew, "ppSlice");
12521301 if (NULL == ppSlice) {
1253− WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "CWelsH264SVCEncoder::ReallocSliceBuffer: ppSlice is NULL");
1302+ WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "CWelsH264SVCEncoder::ExtendLayerBuffer: ppSlice is NULL");
12541303 return ENC_RETURN_MEMALLOCERR;
12551304 }
12561305 pMA->WelsFree (pCurLayer->ppSliceInLayer, "ppSliceInLayer");
12571306 pCurLayer->ppSliceInLayer = ppSlice;
12581307
12591308 // update for pFirstMbIdxInSlice
1260− pFirstMbIdxofSlice = (int32_t*)pMA->WelsMallocz (sizeof (int32_t*) * iMaxSliceNumNew, "pFirstMbIdxofSlice");
1309+ pFirstMbIdxofSlice = (int32_t*)pMA->WelsMallocz (sizeof (int32_t*) * kiMaxSliceNumNew, "pFirstMbIdxofSlice");
12611310 if (NULL == pFirstMbIdxofSlice) {
1262− WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "CWelsH264SVCEncoder::ReallocSliceBuffer: pFirstMbIdxofSlice is NULL");
1311+ WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "CWelsH264SVCEncoder::ExtendLayerBuffer: pFirstMbIdxofSlice is NULL");
12631312 return ENC_RETURN_MEMALLOCERR;
12641313 }
1265− memset (pFirstMbIdxofSlice, 0, sizeof(int32_t) * iMaxSliceNumNew);
1266− memcpy (pFirstMbIdxofSlice, pCurLayer->pFirstMbIdxOfSlice, sizeof (int32_t) * iMaxSliceNumOld);
1314+ memset (pFirstMbIdxofSlice, 0, sizeof(int32_t) * kiMaxSliceNumNew);
1315+ memcpy (pFirstMbIdxofSlice, pCurLayer->pFirstMbIdxOfSlice, sizeof (int32_t) * kiMaxSliceNumOld);
12671316 pMA->WelsFree (pCurLayer->pFirstMbIdxOfSlice, "pFirstMbIdxofSlice");
12681317 pCurLayer->pFirstMbIdxOfSlice = pFirstMbIdxofSlice;
12691318
12701319 // update for pCountMbNumInSlice
1271− pCountMbNumInSlice = (int32_t*)pMA->WelsMallocz (sizeof (int32_t*) * iMaxSliceNumNew, "pCountMbNumInSlice");
1320+ pCountMbNumInSlice = (int32_t*)pMA->WelsMallocz (sizeof (int32_t*) * kiMaxSliceNumNew, "pCountMbNumInSlice");
12721321 if (NULL == pCountMbNumInSlice) {
1273− WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "CWelsH264SVCEncoder::ReallocSliceBuffer: pCountMbNumInSlice is NULL");
1322+ WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "CWelsH264SVCEncoder::ExtendLayerBuffer: pCountMbNumInSlice is NULL");
12741323 return ENC_RETURN_MEMALLOCERR;
12751324 }
1276− memset (pCountMbNumInSlice, 0, sizeof(int32_t) * iMaxSliceNumNew);
1277− memcpy (pCountMbNumInSlice, pCurLayer->pCountMbNumInSlice, sizeof (int32_t) * iMaxSliceNumOld);
1325+ memset (pCountMbNumInSlice, 0, sizeof(int32_t) * kiMaxSliceNumNew);
1326+ memcpy (pCountMbNumInSlice, pCurLayer->pCountMbNumInSlice, sizeof (int32_t) * kiMaxSliceNumOld);
12781327 pMA->WelsFree (pCurLayer->pCountMbNumInSlice, "pCountMbNumInSlice");
12791328 pCurLayer->pCountMbNumInSlice = pCountMbNumInSlice;
12801329
1330+ return ENC_RETURN_SUCCESS;
1331+}
1332+
1333+int32_t ReallocSliceBuffer (sWelsEncCtx* pCtx) {
1334+
1335+ SDqLayer* pCurLayer = pCtx->pCurDqLayer;
1336+ int32_t iMaxSliceNumOld = pCurLayer->iMaxSliceNum;
1337+ int32_t iMaxSliceNumNew = 0;
1338+ int32_t iRet = 0;
1339+ int32_t iSliceIdx = 0;
1340+ const int32_t kiCurDid = pCtx->uiDependencyId;
1341+ SSlice* pLastCodedSlice = pCurLayer->sSliceThreadInfo.pSliceInThread[0] + (iMaxSliceNumOld - 1);
1342+ SSliceArgument* pSliceArgument = & pCtx->pSvcParam->sSpatialLayers[kiCurDid].sSliceArgument;
1343+ iRet = CalculateNewSliceNum (pCurLayer,
1344+ pLastCodedSlice,
1345+ iMaxSliceNumOld,
1346+ iMaxSliceNumNew);
1347+
1348+ if (ENC_RETURN_SUCCESS != iRet) {
1349+ return iRet;
1350+ }
1351+
1352+ iRet = ReallocateSliceList (pCtx,
1353+ pSliceArgument,
1354+ pCurLayer->sSliceThreadInfo.pSliceInThread[0],
1355+ iMaxSliceNumOld,
1356+ iMaxSliceNumNew);
1357+ if (ENC_RETURN_SUCCESS != iRet) {
1358+ return iRet;
1359+ }
1360+
1361+ iRet = ExtendLayerBuffer(pCtx, iMaxSliceNumOld, iMaxSliceNumNew);
1362+ if (ENC_RETURN_SUCCESS != iRet) {
1363+ return iRet;
1364+ }
12811365
12821366 for (iSliceIdx = 0; iSliceIdx < iMaxSliceNumNew; iSliceIdx++) {
12831367 pCurLayer->ppSliceInLayer[iSliceIdx] = pCurLayer->sSliceThreadInfo.pSliceInThread[0] + iSliceIdx;
@@ -1292,6 +1376,22 @@ int32_t ReallocSliceBuffer (sWelsEncCtx* pCtx) { · 8 unmodified lines
12921376 return ENC_RETURN_SUCCESS;
12931377 }
12941378
1379+static inline int32_t CheckAllSliceBuffer(SDqLayer* pCurLayer, const int32_t kiCodedSliceNum) {
1380+ int32_t iSliceIdx = 0;
1381+ for(; iSliceIdx <kiCodedSliceNum ; iSliceIdx ++ ) {
1382+ if ( NULL == pCurLayer->ppSliceInLayer[iSliceIdx]) {
1383+ return ENC_RETURN_UNEXPECTED;
1384+ }
1385+
1386+ if ( iSliceIdx != pCurLayer->ppSliceInLayer[iSliceIdx]->iSliceIdx) {
1387+ return ENC_RETURN_UNEXPECTED;
1388+ }
1389+ }
1390+
1391+ return ENC_RETURN_SUCCESS;
1392+}
1393+
1394+
12951395 int32_t ReOrderSliceInLayer (SDqLayer* pCurLayer,
12961396 const int32_t kiThreadNum,
12971397 const int32_t kiPartitionNum) {
@@ -1301,18 +1401,26 @@ int32_t ReOrderSliceInLayer (SDqLayer* pCurLayer, · 3 unmodified lines
13011401 int32_t iPartitionID = 0;
13021402 int32_t iSliceIdx = 0;
13031403 int32_t iSliceNumInThread = 0;
1304− int32_t iPartitionOffset = 0;
1404+ int32_t iEncodeSliceNum = 0;
13051405 int32_t iActualSliceIdx = 0;
1406+ int32_t iNonUsedBufferNum = 0;
1407+ int32_t iUsedSliceNum = 0;
13061408 int32_t aiPartitionOffset[MAX_THREADS_NUM] = {0};
13071409
13081410 //for non-dynamic slice mode, kiPartitionNum = 1, iPartitionOffset = 0
13091411 for(iPartitionIdx = 0; iPartitionIdx < kiPartitionNum; iPartitionIdx++) {
1310− aiPartitionOffset[iPartitionIdx] = iPartitionOffset;
1311− iPartitionOffset += pCurLayer->pNumSliceCodedOfPartition[iPartitionIdx];
1412+ aiPartitionOffset[iPartitionIdx] = iEncodeSliceNum;
1413+ iEncodeSliceNum += pCurLayer->pNumSliceCodedOfPartition[iPartitionIdx];
1414+ }
1415+
1416+ if( iEncodeSliceNum != pCurLayer->sSliceEncCtx.iSliceNumInFrame) {
1417+ return ENC_RETURN_UNEXPECTED;
13121418 }
13131419
1420+ //before encode all slices in layer, slices' index are init with -1
1421+ //pSliceInThread->iSliceIdx will be set to actual slice index when encode one slice
13141422 for (iThreadIdx = 0; iThreadIdx < kiThreadNum; iThreadIdx++) {
1315− iSliceNumInThread = pCurLayer->sSliceThreadInfo.iEncodedSliceNumInThread[iThreadIdx];
1423+ iSliceNumInThread = pCurLayer->sSliceThreadInfo.iMaxSliceNumInThread[iThreadIdx];
13161424
13171425 for(iSliceIdx =0; iSliceIdx < iSliceNumInThread; iSliceIdx++) {
13181426 pSliceInThread = pCurLayer->sSliceThreadInfo.pSliceInThread[iThreadIdx] + iSliceIdx;
@@ -1320,78 +1428,105 @@ int32_t ReOrderSliceInLayer (SDqLayer* pCurLayer, · 1 unmodified line
13201428 return ENC_RETURN_UNEXPECTED;
13211429 }
13221430
1323− iPartitionID = pSliceInThread->iSliceIdx % kiPartitionNum;
1324− iActualSliceIdx = aiPartitionOffset[iPartitionID] + pSliceInThread->iSliceIdx / kiPartitionNum;
1325− pCurLayer->ppSliceInLayer[iActualSliceIdx] = pSliceInThread;
1431+ if( -1 != pSliceInThread->iSliceIdx) {
1432+ iPartitionID = pSliceInThread->iSliceIdx % kiPartitionNum;
1433+ iActualSliceIdx = aiPartitionOffset[iPartitionID] + pSliceInThread->iSliceIdx / kiPartitionNum;
1434+ pCurLayer->ppSliceInLayer[iActualSliceIdx] = pSliceInThread;
1435+ iUsedSliceNum ++;
1436+ } else {
1437+ pCurLayer->ppSliceInLayer[iEncodeSliceNum + iNonUsedBufferNum] = pSliceInThread;
1438+ iNonUsedBufferNum ++;
1439+ }
13261440 }
13271441 }
13281442
1443+ if( iUsedSliceNum != iEncodeSliceNum ||
1444+ pCurLayer->iMaxSliceNum != (iNonUsedBufferNum + iUsedSliceNum)) {
1445+ return ENC_RETURN_UNEXPECTED;
1446+ }
1447+
1448+ if (ENC_RETURN_SUCCESS != CheckAllSliceBuffer(pCurLayer, iEncodeSliceNum)) {
1449+ return ENC_RETURN_UNEXPECTED;
1450+ }
1451+
13291452 return ENC_RETURN_SUCCESS;
13301453 }
13311454
1332−static inline int32_t CheckAllSliceBuffer(SDqLayer* pCurLayer, const int32_t kiCodedSliceNum) {
1333− int32_t iSliceIdx = 0;
1334− for(; iSliceIdx <kiCodedSliceNum ; iSliceIdx ++ ) {
1335− if ( NULL == pCurLayer->ppSliceInLayer[iSliceIdx]) {
1336− return ENC_RETURN_UNEXPECTED;
1337− }
1455+int32_t FrameBsRealloc (sWelsEncCtx* pCtx,
1456+ SFrameBSInfo* pFrameBsInfo,
1457+ SLayerBSInfo* pLayerBsInfo,
1458+ const int32_t kiMaxSliceNumOld) {
1459+ CMemoryAlign* pMA = pCtx->pMemAlign;
1460+ int32_t iCountNals = pCtx->pOut->iCountNals;
1461+ iCountNals += kiMaxSliceNumOld * (pCtx->pSvcParam->iSpatialLayerNum + pCtx->bNeedPrefixNalFlag);
1462+
1463+ SWelsNalRaw* pNalList = (SWelsNalRaw*)pMA->WelsMallocz (iCountNals * sizeof (SWelsNalRaw), "pOut->sNalList");
1464+ if (NULL == pNalList) {
1465+ WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "CWelsH264SVCEncoder::FrameBsRealloc: pNalList is NULL");
1466+ return ENC_RETURN_MEMALLOCERR;
1467+ }
1468+ memcpy (pNalList, pCtx->pOut->sNalList, sizeof (SWelsNalRaw) * pCtx->pOut->iCountNals);
1469+ pMA->WelsFree (pCtx->pOut->sNalList, "pOut->sNalList");
1470+ pCtx->pOut->sNalList = pNalList;
13381471
1339− if ( iSliceIdx != pCurLayer->ppSliceInLayer[iSliceIdx]->iSliceIdx) {
1340− return ENC_RETURN_UNEXPECTED;
1341− }
1472+ int32_t* pNalLen = (int32_t*)pMA->WelsMallocz (iCountNals * sizeof (int32_t), "pOut->pNalLen");
1473+ if (NULL == pNalLen) {
1474+ WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "CWelsH264SVCEncoder::FrameBsRealloc: pNalLen is NULL");
1475+ return ENC_RETURN_MEMALLOCERR;
1476+ }
1477+ memcpy (pNalLen, pCtx->pOut->pNalLen, sizeof (int32_t) * pCtx->pOut->iCountNals);
1478+ pMA->WelsFree (pCtx->pOut->pNalLen, "pOut->pNalLen");
1479+ pCtx->pOut->pNalLen = pNalLen;
1480+
1481+ pCtx->pOut->iCountNals = iCountNals;
1482+ SLayerBSInfo* pLBI1, *pLBI2;
1483+ pLBI1 = &pFrameBsInfo->sLayerInfo[0];
1484+ pLBI1->pNalLengthInByte = pCtx->pOut->pNalLen;
1485+ while (pLBI1 != pLayerBsInfo) {
1486+ pLBI2 = pLBI1;
1487+ ++ pLBI1;
1488+ pLBI1->pNalLengthInByte = pLBI2->pNalLengthInByte + pLBI2->iNalCount;
13421489 }
13431490
13441491 return ENC_RETURN_SUCCESS;
13451492 }
13461493
1347−int32_t SliceLayerInfoUpdate (sWelsEncCtx* pCtx, const int32_t kiDlayerIndex) {
1348−
1349− CMemoryAlign* pMA = pCtx->pMemAlign;
1494+int32_t SliceLayerInfoUpdate (sWelsEncCtx* pCtx,
1495+ SFrameBSInfo* pFrameBsInfo,
1496+ SLayerBSInfo* pLayerBsInfo,
1497+ const int32_t kiPartitionNum) {
13501498 SDqLayer* pCurLayer = pCtx->pCurDqLayer;
1351− SSlice** ppSlice = NULL;
1352− int32_t iCodedSliceNum = 0;
1499+ int32_t iMaxSliceNum = 0;
13531500 int32_t iThreadIdx = 0;
13541501 int32_t iRet = 0;
13551502 int32_t iThreadNum = 1; //TODO: should be equal to pCurLayer->iMaxSliceNum;
1356− SSliceArgument* pSliceArgument = & pCtx->pSvcParam->sSpatialLayers[kiDlayerIndex].sSliceArgument;
1357− int32_t iPartitionNum = (SM_SIZELIMITED_SLICE == pSliceArgument->uiSliceMode) ? pCtx->iActiveThreadsNum : 1;
13581503
13591504 for ( ; iThreadIdx < iThreadNum; iThreadIdx++) {
1360− iCodedSliceNum += pCurLayer->sSliceThreadInfo.iMaxSliceNumInThread[iThreadIdx];
1361− }
1362−
1363− if (iCodedSliceNum <= 0) {
1364− return ENC_RETURN_UNEXPECTED;
1505+ iMaxSliceNum += pCurLayer->sSliceThreadInfo.iMaxSliceNumInThread[iThreadIdx];
13651506 }
13661507
13671508 //reallocate ppSliceInLayer if total encoded slice num exceed max slice num
1368− if (iCodedSliceNum > pCurLayer->iMaxSliceNum) {
1369− ppSlice = (SSlice**)pMA->WelsMallocz (sizeof (SSlice*) * iCodedSliceNum, "ppSlice");
1370− if (NULL == ppSlice) {
1371− WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "CWelsH264SVCEncoder::SliceLayerInfoUpdate: ppSlice is NULL");
1372− return ENC_RETURN_MEMALLOCERR;
1509+ if (iMaxSliceNum > pCurLayer->iMaxSliceNum) {
1510+ iRet = FrameBsRealloc (pCtx, pFrameBsInfo, pLayerBsInfo, pCtx->pCurDqLayer->iMaxSliceNum);
1511+ if(ENC_RETURN_SUCCESS != iRet) {
1512+ return iRet;
13731513 }
13741514
1375− pMA->WelsFree (pCurLayer->ppSliceInLayer, "ppSliceInLayer");
1376− pCurLayer->ppSliceInLayer = ppSlice;
1377− pCurLayer->iMaxSliceNum = iCodedSliceNum;
1515+ iRet = ExtendLayerBuffer(pCtx, pCtx->pCurDqLayer->iMaxSliceNum, iMaxSliceNum);
1516+ if (ENC_RETURN_SUCCESS != iRet) {
1517+ return iRet;
1518+ }
1519+ pCurLayer->iMaxSliceNum = iMaxSliceNum;
13781520 }
13791521
13801522 //update ppSliceInLayer based on pSliceInThread, reordering based on slice index
1381− iRet = ReOrderSliceInLayer (pCurLayer, iThreadNum, iPartitionNum);
1523+ iRet = ReOrderSliceInLayer (pCurLayer, iThreadNum, kiPartitionNum);
13821524 if (ENC_RETURN_SUCCESS != iRet) {
13831525 WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR,
13841526 "CWelsH264SVCEncoder::SliceLayerInfoUpdate: ReOrderSliceInLayer failed");
13851527 return iRet;
13861528 }
13871529
1388− iRet = CheckAllSliceBuffer(pCurLayer, pCtx->iActiveThreadsNum);
1389− if (ENC_RETURN_SUCCESS != iRet) {
1390− WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR,
1391− "CWelsH264SVCEncoder::SliceLayerInfoUpdate: ReOrderSliceInLayerDynamic failed");
1392− return iRet;
1393− }
1394−
13951530 return ENC_RETURN_SUCCESS;
13961531 }
13971532
@@ -1450,7 +1585,6 @@ void UpdateMbNeighbourInfoForNextSlice (SDqLayer* pCurDq, · 52 unmodified lines
14501585 (iIdx <= kiLastMbIdxInPartition));
14511586 }
14521587
1453−
14541588 void AddSliceBoundary (sWelsEncCtx* pEncCtx, SSlice* pCurSlice, SSliceCtx* pSliceCtx, SMB* pCurMb,
14551589 int32_t iFirstMbIdxOfNextSlice, const int32_t kiLastMbIdxInPartition) {
14561590 SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;

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