History

astyle code style for enc

Guangwei Wang committed 9 years ago

Commit 3d150f01 parent bc8317915 files · +184 −172Browse files

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

Unified · Split

codec/encoder/core/src/svc_encode_slice.cpp+81−75
@@ -827,7 +827,7 @@ int32_t InitSliceBoundaryInfo (SDqLayer* pCurLayer, · 826 unmodified lines
827827 int32_t iFirstMBInSlice = 0;
828828 int32_t iMbNumInSlice = 0;
829829
830− for( ;iSliceIdx < kiSliceNumInFrame; iSliceIdx++ ){
830+ for (; iSliceIdx < kiSliceNumInFrame; iSliceIdx++) {
831831 if (SM_SINGLE_SLICE == pSliceArgument->uiSliceMode) {
832832 iFirstMBInSlice = 0;
833833 iMbNumInSlice = kiCountNumMbInFrame;
@@ -836,7 +836,7 @@ int32_t InitSliceBoundaryInfo (SDqLayer* pCurLayer, · 2 unmodified lines
836836 iFirstMBInSlice = iSliceIdx * kiMBWidth;
837837 iMbNumInSlice = kiMBWidth;
838838 } else if (SM_RASTER_SLICE == pSliceArgument->uiSliceMode ||
839− SM_FIXEDSLCNUM_SLICE == pSliceArgument->uiSliceMode) {
839+ SM_FIXEDSLCNUM_SLICE == pSliceArgument->uiSliceMode) {
840840 int32_t iMbIdx = 0;
841841 for (int i = 0; i < iSliceIdx; i++) {
842842 iMbIdx += kpSlicesAssignList[i];
@@ -864,10 +864,10 @@ int32_t InitSliceBoundaryInfo (SDqLayer* pCurLayer, · 21 unmodified lines
864864 return ENC_RETURN_SUCCESS;
865865 }
866866
867−int32_t SetSliceBoundaryInfo(SDqLayer* pCurLayer, SSlice* pSlice, const int32_t kiSliceIdx) {
868− if(NULL == pCurLayer || NULL == pSlice ||
869− NULL == pCurLayer->pFirstMbIdxOfSlice ||
870− NULL == pCurLayer->pCountMbNumInSlice) {
867+int32_t SetSliceBoundaryInfo (SDqLayer* pCurLayer, SSlice* pSlice, const int32_t kiSliceIdx) {
868+ if (NULL == pCurLayer || NULL == pSlice ||
869+ NULL == pCurLayer->pFirstMbIdxOfSlice ||
870+ NULL == pCurLayer->pCountMbNumInSlice) {
871871
872872 return ENC_RETURN_UNEXPECTED;
873873 }
@@ -977,15 +977,15 @@ int32_t InitAllSlicesInThread (sWelsEncCtx* pCtx) { · 103 unmodified lines
977977 int32_t iSliceIdx = 0;
978978 int32_t iSlcBuffIdx = 0;
979979
980− for( ; iSliceIdx < pCurDqLayer->iMaxSliceNum; iSliceIdx++) {
981− if(NULL == pCurDqLayer->ppSliceInLayer[iSliceIdx]) {
980+ for (; iSliceIdx < pCurDqLayer->iMaxSliceNum; iSliceIdx++) {
981+ if (NULL == pCurDqLayer->ppSliceInLayer[iSliceIdx]) {
982982 return ENC_RETURN_UNEXPECTED;
983983 }
984984
985985 pCurDqLayer->ppSliceInLayer[iSliceIdx]->iSliceIdx = -1;
986986 }
987987
988− for( ; iSlcBuffIdx < pCtx->iActiveThreadsNum; iSlcBuffIdx++ ) {
988+ for (; iSlcBuffIdx < pCtx->iActiveThreadsNum; iSlcBuffIdx++) {
989989 pCurDqLayer->sSliceBufferInfo[iSlcBuffIdx].iCodedSliceNum = 0;
990990 }
991991
@@ -999,11 +999,11 @@ int32_t InitOneSliceInThread (sWelsEncCtx* pCtx, · 7 unmodified lines
999999 const int32_t kiSliceIdx) {
10001000
10011001 if (pCtx->pCurDqLayer->bThreadSlcBufferFlag) {
1002− const int32_t kiCodedNumInThread = pCtx->pCurDqLayer->sSliceBufferInfo[kiSlcBuffIdx].iCodedSliceNum;
1003− assert(kiCodedNumInThread <= pCtx->pCurDqLayer->sSliceBufferInfo[kiSlcBuffIdx].iMaxSliceNum -1 );
1004− pSlice = &pCtx->pCurDqLayer->sSliceBufferInfo [kiSlcBuffIdx].pSliceBuffer[kiCodedNumInThread];
1002+ const int32_t kiCodedNumInThread = pCtx->pCurDqLayer->sSliceBufferInfo[kiSlcBuffIdx].iCodedSliceNum;
1003+ assert (kiCodedNumInThread <= pCtx->pCurDqLayer->sSliceBufferInfo[kiSlcBuffIdx].iMaxSliceNum - 1);
1004+ pSlice = &pCtx->pCurDqLayer->sSliceBufferInfo [kiSlcBuffIdx].pSliceBuffer[kiCodedNumInThread];
10051005 } else {
1006− pSlice = &pCtx->pCurDqLayer->sSliceBufferInfo [0].pSliceBuffer[kiSliceIdx];
1006+ pSlice = &pCtx->pCurDqLayer->sSliceBufferInfo [0].pSliceBuffer[kiSliceIdx];
10071007 }
10081008 pSlice->iSliceIdx = kiSliceIdx;
10091009 pSlice->uiBufferIdx = kiSlcBuffIdx;
@@ -1029,7 +1029,7 @@ int32_t InitSliceThreadInfo (sWelsEncCtx* pCtx, · 19 unmodified lines
10291029 assert (iThreadNum > 0);
10301030
10311031 //for fixed slice num case, no need to reallocate, so one slice buffer for all thread
1032− if( pDqLayer->bThreadSlcBufferFlag) {
1032+ if (pDqLayer->bThreadSlcBufferFlag) {
10331033 iMaxSliceNum = pDqLayer->iMaxSliceNum / iThreadNum + 1;
10341034 iSlcBufferNum = iThreadNum;
10351035 } else {
@@ -1040,7 +1040,8 @@ int32_t InitSliceThreadInfo (sWelsEncCtx* pCtx, · 4 unmodified lines
10401040 while (iIdx < iSlcBufferNum) {
10411041 pDqLayer->sSliceBufferInfo[iIdx].iMaxSliceNum = iMaxSliceNum;
10421042 pDqLayer->sSliceBufferInfo[iIdx].iCodedSliceNum = 0;
1043− pDqLayer->sSliceBufferInfo[iIdx].pSliceBuffer = (SSlice*)pMa->WelsMallocz (sizeof (SSlice) * iMaxSliceNum, "pSliceBuffer");
1043+ pDqLayer->sSliceBufferInfo[iIdx].pSliceBuffer = (SSlice*)pMa->WelsMallocz (sizeof (SSlice) * iMaxSliceNum,
1044+ "pSliceBuffer");
10441045 if (NULL == pDqLayer->sSliceBufferInfo[iIdx].pSliceBuffer) {
10451046 WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR,
10461047 "CWelsH264SVCEncoder::InitSliceThreadInfo: pSliceThreadInfo->pSliceBuffer[iIdx] is NULL");
@@ -1081,21 +1082,21 @@ int32_t InitSliceInLayer (sWelsEncCtx* pCtx, · 34 unmodified lines
10811082 //SM_SINGLE_SLICE mode using single-thread bs writer pOut->sBsWrite
10821083 //even though multi-thread is on for other layers
10831084 pDqLayer->bSliceBsBufferFlag = (pCtx->pSvcParam->iMultipleThreadIdc > 1 &&
1084− SM_SINGLE_SLICE != pSliceArgument->uiSliceMode) ? true : false;
1085+ SM_SINGLE_SLICE != pSliceArgument->uiSliceMode) ? true : false;
10851086
10861087 pDqLayer->bThreadSlcBufferFlag = (pCtx->pSvcParam->iMultipleThreadIdc > 1 &&
1087− SM_SIZELIMITED_SLICE == pSliceArgument->uiSliceMode) ? true : false;
1088+ SM_SIZELIMITED_SLICE == pSliceArgument->uiSliceMode) ? true : false;
10881089
10891090 iRet = InitSliceThreadInfo (pCtx,
1090− pDqLayer,
1091− kiDlayerIndex,
1092− pMa);
1091+ pDqLayer,
1092+ kiDlayerIndex,
1093+ pMa);
10931094 if (ENC_RETURN_SUCCESS != iRet) {
10941095 return ENC_RETURN_MEMALLOCERR;
10951096 }
10961097
10971098 pDqLayer->iMaxSliceNum = 0;
1098− for(iSlcBuffIdx = 0; iSlcBuffIdx < pCtx->iActiveThreadsNum; iSlcBuffIdx++ ) {
1099+ for (iSlcBuffIdx = 0; iSlcBuffIdx < pCtx->iActiveThreadsNum; iSlcBuffIdx++) {
10991100 pDqLayer->iMaxSliceNum += pDqLayer->sSliceBufferInfo[iSlcBuffIdx].iMaxSliceNum;
11001101 }
11011102
@@ -1105,15 +1106,19 @@ int32_t InitSliceInLayer (sWelsEncCtx* pCtx, · 3 unmodified lines
11051106 return ENC_RETURN_MEMALLOCERR;
11061107 }
11071108
1108− pDqLayer->pFirstMbIdxOfSlice = (int32_t*)pMa->WelsMallocz (sizeof (int32_t*) * pDqLayer->iMaxSliceNum, "pFirstMbIdxOfSlice");
1109+ pDqLayer->pFirstMbIdxOfSlice = (int32_t*)pMa->WelsMallocz (sizeof (int32_t*) * pDqLayer->iMaxSliceNum,
1110+ "pFirstMbIdxOfSlice");
11091111 if (NULL == pDqLayer->pFirstMbIdxOfSlice) {
1110− WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "CWelsH264SVCEncoder::InitSliceInLayer() pDqLayer->pFirstMbIdxOfSlice is NULL");
1112+ WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR,
1113+ "CWelsH264SVCEncoder::InitSliceInLayer() pDqLayer->pFirstMbIdxOfSlice is NULL");
11111114 return ENC_RETURN_MEMALLOCERR;
11121115 }
11131116
1114− pDqLayer->pCountMbNumInSlice = (int32_t*)pMa->WelsMallocz (sizeof (int32_t*) * pDqLayer->iMaxSliceNum, "pCountMbNumInSlice");
1117+ pDqLayer->pCountMbNumInSlice = (int32_t*)pMa->WelsMallocz (sizeof (int32_t*) * pDqLayer->iMaxSliceNum,
1118+ "pCountMbNumInSlice");
11151119 if (NULL == pDqLayer->pCountMbNumInSlice) {
1116− WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "CWelsH264SVCEncoder::InitSliceInLayer() pDqLayer->pCountMbNumInSlice is NULL");
1120+ WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR,
1121+ "CWelsH264SVCEncoder::InitSliceInLayer() pDqLayer->pCountMbNumInSlice is NULL");
11171122 return ENC_RETURN_MEMALLOCERR;
11181123 }
11191124
@@ -1123,9 +1128,9 @@ int32_t InitSliceInLayer (sWelsEncCtx* pCtx, · 3 unmodified lines
11231128 }
11241129
11251130 iStartIdx = 0;
1126− for(iSlcBuffIdx = 0; iSlcBuffIdx < pCtx->iActiveThreadsNum; iSlcBuffIdx++ ) {
1127− for (iSliceIdx = 0; iSliceIdx < pDqLayer->sSliceBufferInfo[iSlcBuffIdx].iMaxSliceNum; iSliceIdx++ ) {
1128− pDqLayer->ppSliceInLayer[iStartIdx + iSliceIdx] = pDqLayer->sSliceBufferInfo[iSlcBuffIdx].pSliceBuffer+ iSliceIdx;
1131+ for (iSlcBuffIdx = 0; iSlcBuffIdx < pCtx->iActiveThreadsNum; iSlcBuffIdx++) {
1132+ for (iSliceIdx = 0; iSliceIdx < pDqLayer->sSliceBufferInfo[iSlcBuffIdx].iMaxSliceNum; iSliceIdx++) {
1133+ pDqLayer->ppSliceInLayer[iStartIdx + iSliceIdx] = pDqLayer->sSliceBufferInfo[iSlcBuffIdx].pSliceBuffer + iSliceIdx;
11291134 }
11301135
11311136 iStartIdx += pDqLayer->sSliceBufferInfo[iSlcBuffIdx].iMaxSliceNum;
@@ -1135,7 +1140,7 @@ int32_t InitSliceInLayer (sWelsEncCtx* pCtx, · 3 unmodified lines
11351140 }
11361141
11371142 void InitSliceHeadWithBase (SSlice* pSlice, SSlice* pBaseSlice) {
1138− if(NULL == pSlice || NULL == pBaseSlice) {
1143+ if (NULL == pSlice || NULL == pBaseSlice) {
11391144 return;
11401145 }
11411146
@@ -1150,7 +1155,7 @@ void InitSliceHeadWithBase (SSlice* pSlice, SSlice* pBaseSlice) { · 8 unmodified lines
11501155 }
11511156
11521157 void InitSliceRefInfoWithBase (SSlice* pSlice, SSlice* pBaseSlice, const uint8_t kuiRefCount) {
1153− if( NULL == pSlice || NULL == pBaseSlice) {
1158+ if (NULL == pSlice || NULL == pBaseSlice) {
11541159 return;
11551160 }
11561161
@@ -1213,7 +1218,7 @@ int32_t ReallocateSliceList (sWelsEncCtx* pCtx, · 56 unmodified lines
12131218 for (iSliceIdx = 0; iSliceIdx < kiMaxSliceNumOld; iSliceIdx++) {
12141219 pSlice = pNewSliceList + iSliceIdx;
12151220 if (NULL == pSlice) {
1216− FreeSliceBuffer(pNewSliceList, kiMaxSliceNumNew, pMA, "pSliceBuffer");
1221+ FreeSliceBuffer (pNewSliceList, kiMaxSliceNumNew, pMA, "pSliceBuffer");
12171222 return ENC_RETURN_MEMALLOCERR;
12181223 }
12191224
@@ -1224,14 +1229,14 @@ int32_t ReallocateSliceList (sWelsEncCtx* pCtx, · 4 unmodified lines
12241229
12251230 pBaseSlice = &pSliceList[0];
12261231 if (NULL == pBaseSlice) {
1227− FreeSliceBuffer(pNewSliceList, kiMaxSliceNumNew, pMA, "ReallocateSliceList()::InitSliceBsBuffer()");
1232+ FreeSliceBuffer (pNewSliceList, kiMaxSliceNumNew, pMA, "ReallocateSliceList()::InitSliceBsBuffer()");
12281233 return ENC_RETURN_MEMALLOCERR;
12291234 }
12301235
12311236 for (iSliceIdx = kiMaxSliceNumOld; iSliceIdx < kiMaxSliceNumNew; iSliceIdx++) {
12321237 pSlice = pNewSliceList + iSliceIdx;
12331238 if (NULL == pSlice) {
1234− FreeSliceBuffer(pNewSliceList, kiMaxSliceNumNew, pMA, "pSliceBuffer");
1239+ FreeSliceBuffer (pNewSliceList, kiMaxSliceNumNew, pMA, "pSliceBuffer");
12351240 return ENC_RETURN_MEMALLOCERR;
12361241 }
12371242
@@ -1246,13 +1251,13 @@ int32_t ReallocateSliceList (sWelsEncCtx* pCtx, · 8 unmodified lines
12461251 iMaxSliceBufferSize,
12471252 pMA);
12481253 if (ENC_RETURN_SUCCESS != iRet) {
1249− FreeSliceBuffer(pNewSliceList, kiMaxSliceNumNew, pMA, "pSliceBuffer");
1254+ FreeSliceBuffer (pNewSliceList, kiMaxSliceNumNew, pMA, "pSliceBuffer");
12501255 return iRet;
12511256 }
12521257
12531258 iRet = AllocateSliceMBBuffer (pSlice, pMA);
12541259 if (ENC_RETURN_SUCCESS != iRet) {
1255− FreeSliceBuffer(pNewSliceList, kiMaxSliceNumNew, pMA, "pSliceBuffer");
1260+ FreeSliceBuffer (pNewSliceList, kiMaxSliceNumNew, pMA, "pSliceBuffer");
12561261 return iRet;
12571262 }
12581263
@@ -1261,7 +1266,7 @@ int32_t ReallocateSliceList (sWelsEncCtx* pCtx, · 2 unmodified lines
12611266
12621267 iRet = InitSliceRC (pSlice, pCtx->iGlobalQp);
12631268 if (ENC_RETURN_SUCCESS != iRet) {
1264− FreeSliceBuffer(pNewSliceList, kiMaxSliceNumNew, pMA, "pSliceBuffer");
1269+ FreeSliceBuffer (pNewSliceList, kiMaxSliceNumNew, pMA, "pSliceBuffer");
12651270 return iRet;
12661271 }
12671272 }
@@ -1276,11 +1281,11 @@ int32_t CalculateNewSliceNum (sWelsEncCtx* pCtx, · 8 unmodified lines
12761281 SSlice* pLastCodedSlice,
12771282 const int32_t iMaxSliceNumOld,
12781283 int32_t& iMaxSliceNumNew) {
1279− if ( NULL == pCtx || NULL == pLastCodedSlice || 0 == iMaxSliceNumOld ) {
1284+ if (NULL == pCtx || NULL == pLastCodedSlice || 0 == iMaxSliceNumOld) {
12801285 return ENC_RETURN_INVALIDINPUT;
12811286 }
12821287
1283− if ( 1 == pCtx->iActiveThreadsNum ) {
1288+ if (1 == pCtx->iActiveThreadsNum) {
12841289 iMaxSliceNumNew = iMaxSliceNumOld * SLICE_NUM_EXPAND_COEF;
12851290 return ENC_RETURN_SUCCESS;
12861291 }
@@ -1292,7 +1297,7 @@ int32_t CalculateNewSliceNum (sWelsEncCtx* pCtx, · 5 unmodified lines
12921297 - pCtx->pCurDqLayer->LastCodedMbIdxOfPartition[iPartitionID] + 1;
12931298 int32_t iIncreaseSlicNum = (iLeftMBNum * INT_MULTIPLY / iMBNumInPatition) * iMaxSliceNumOld;
12941299
1295− iIncreaseSlicNum = ( 0 == (iIncreaseSlicNum / INT_MULTIPLY) ) ? 1 : (iIncreaseSlicNum / INT_MULTIPLY);
1300+ iIncreaseSlicNum = (0 == (iIncreaseSlicNum / INT_MULTIPLY)) ? 1 : (iIncreaseSlicNum / INT_MULTIPLY);
12961301 iIncreaseSlicNum = (iIncreaseSlicNum < iMaxSliceNumOld / 2) ? (iMaxSliceNumOld / 2) : iIncreaseSlicNum;
12971302 iMaxSliceNumNew = iMaxSliceNumOld + iIncreaseSlicNum;
12981303
@@ -1332,9 +1337,9 @@ int32_t ReallocateSliceInThread (sWelsEncCtx* pCtx, · 33 unmodified lines
13321337 return ENC_RETURN_SUCCESS;
13331338 }
13341339
1335−int32_t ExtendLayerBuffer(sWelsEncCtx* pCtx,
1336− const int32_t kiMaxSliceNumOld,
1337− const int32_t kiMaxSliceNumNew){
1340+int32_t ExtendLayerBuffer (sWelsEncCtx* pCtx,
1341+ const int32_t kiMaxSliceNumOld,
1342+ const int32_t kiMaxSliceNumNew) {
13381343 CMemoryAlign* pMA = pCtx->pMemAlign;
13391344 SDqLayer* pCurLayer = pCtx->pCurDqLayer;
13401345 SSlice** ppSlice = NULL;
@@ -1356,7 +1361,7 @@ int32_t ExtendLayerBuffer(sWelsEncCtx* pCtx, · 15 unmodified lines
13561361 WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "CWelsH264SVCEncoder::ExtendLayerBuffer: pFirstMbIdxOfSlice is NULL");
13571362 return ENC_RETURN_MEMALLOCERR;
13581363 }
1359− memset (pFirstMbIdxOfSlice, 0, sizeof(int32_t) * kiMaxSliceNumNew);
1364+ memset (pFirstMbIdxOfSlice, 0, sizeof (int32_t) * kiMaxSliceNumNew);
13601365 memcpy (pFirstMbIdxOfSlice, pCurLayer->pFirstMbIdxOfSlice, sizeof (int32_t) * kiMaxSliceNumOld);
13611366 pMA->WelsFree (pCurLayer->pFirstMbIdxOfSlice, "pFirstMbIdxOfSlice");
13621367 pCurLayer->pFirstMbIdxOfSlice = pFirstMbIdxOfSlice;
@@ -1367,7 +1372,7 @@ int32_t ExtendLayerBuffer(sWelsEncCtx* pCtx, · 4 unmodified lines
13671372 WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "CWelsH264SVCEncoder::ExtendLayerBuffer: pCountMbNumInSlice is NULL");
13681373 return ENC_RETURN_MEMALLOCERR;
13691374 }
1370− memset (pCountMbNumInSlice, 0, sizeof(int32_t) * kiMaxSliceNumNew);
1375+ memset (pCountMbNumInSlice, 0, sizeof (int32_t) * kiMaxSliceNumNew);
13711376 memcpy (pCountMbNumInSlice, pCurLayer->pCountMbNumInSlice, sizeof (int32_t) * kiMaxSliceNumOld);
13721377 pMA->WelsFree (pCurLayer->pCountMbNumInSlice, "pCountMbNumInSlice");
13731378 pCurLayer->pCountMbNumInSlice = pCountMbNumInSlice;
@@ -1408,16 +1413,16 @@ int32_t ReallocSliceBuffer (sWelsEncCtx* pCtx) { · 34 unmodified lines
14081413 pCurLayer->sSliceBufferInfo[0].iMaxSliceNum = iMaxSliceNumNew;
14091414
14101415 iMaxSliceNumNew = 0;
1411− for(iSlcBuffIdx = 0; iSlcBuffIdx < pCtx->iActiveThreadsNum; iSlcBuffIdx++ ) {
1412− iMaxSliceNumNew += pCurLayer->sSliceBufferInfo[iSlcBuffIdx].iMaxSliceNum;
1416+ for (iSlcBuffIdx = 0; iSlcBuffIdx < pCtx->iActiveThreadsNum; iSlcBuffIdx++) {
1417+ iMaxSliceNumNew += pCurLayer->sSliceBufferInfo[iSlcBuffIdx].iMaxSliceNum;
14131418 }
14141419
1415− iRet = ExtendLayerBuffer(pCtx, pCurLayer->iMaxSliceNum, iMaxSliceNumNew);
1420+ iRet = ExtendLayerBuffer (pCtx, pCurLayer->iMaxSliceNum, iMaxSliceNumNew);
14161421 if (ENC_RETURN_SUCCESS != iRet) {
14171422 return iRet;
14181423 }
14191424
1420− for(iSlcBuffIdx = 0; iSlcBuffIdx < pCtx->iActiveThreadsNum; iSlcBuffIdx++ ) {
1425+ for (iSlcBuffIdx = 0; iSlcBuffIdx < pCtx->iActiveThreadsNum; iSlcBuffIdx++) {
14211426 for (iSliceIdx = 0; iSliceIdx < pCurLayer->sSliceBufferInfo[iSlcBuffIdx].iMaxSliceNum; iSliceIdx++) {
14221427 pCurLayer->ppSliceInLayer[iStartIdx + iSliceIdx] = pCurLayer->sSliceBufferInfo[iSlcBuffIdx].pSliceBuffer + iSliceIdx;
14231428 }
@@ -1429,14 +1434,14 @@ int32_t ReallocSliceBuffer (sWelsEncCtx* pCtx) { · 5 unmodified lines
14291434 return ENC_RETURN_SUCCESS;
14301435 }
14311436
1432−static inline int32_t CheckAllSliceBuffer(SDqLayer* pCurLayer, const int32_t kiCodedSliceNum) {
1437+static inline int32_t CheckAllSliceBuffer (SDqLayer* pCurLayer, const int32_t kiCodedSliceNum) {
14331438 int32_t iSliceIdx = 0;
1434− for(; iSliceIdx <kiCodedSliceNum ; iSliceIdx ++ ) {
1435− if ( NULL == pCurLayer->ppSliceInLayer[iSliceIdx]) {
1439+ for (; iSliceIdx < kiCodedSliceNum ; iSliceIdx ++) {
1440+ if (NULL == pCurLayer->ppSliceInLayer[iSliceIdx]) {
14361441 return ENC_RETURN_UNEXPECTED;
14371442 }
14381443
1439− if ( iSliceIdx != pCurLayer->ppSliceInLayer[iSliceIdx]->iSliceIdx) {
1444+ if (iSliceIdx != pCurLayer->ppSliceInLayer[iSliceIdx]->iSliceIdx) {
14401445 return ENC_RETURN_UNEXPECTED;
14411446 }
14421447 }
@@ -1464,16 +1469,16 @@ int32_t ReOrderSliceInLayer (sWelsEncCtx* pCtx, · 21 unmodified lines
14641469
14651470 //for non-dynamic slice mode, iPartitionNum = 1, iPartitionOffset = 0
14661471 iPartitionNum = (SM_SIZELIMITED_SLICE == kuiSliceMode) ? kiThreadNum : 1;
1467− for(iPartitionIdx = 0; iPartitionIdx < iPartitionNum; iPartitionIdx++) {
1472+ for (iPartitionIdx = 0; iPartitionIdx < iPartitionNum; iPartitionIdx++) {
14681473 aiPartitionOffset[iPartitionIdx] = iEncodeSliceNum;
1469− if ( SM_SIZELIMITED_SLICE == kuiSliceMode) {
1474+ if (SM_SIZELIMITED_SLICE == kuiSliceMode) {
14701475 iEncodeSliceNum += pCurLayer->NumSliceCodedOfPartition[iPartitionIdx];
14711476 } else {
14721477 iEncodeSliceNum = pCurLayer->sSliceEncCtx.iSliceNumInFrame;
14731478 }
14741479 }
14751480
1476− if( iEncodeSliceNum != pCurLayer->sSliceEncCtx.iSliceNumInFrame) {
1481+ if (iEncodeSliceNum != pCurLayer->sSliceEncCtx.iSliceNumInFrame) {
14771482 return ENC_RETURN_UNEXPECTED;
14781483 }
14791484
@@ -1482,42 +1487,42 @@ int32_t ReOrderSliceInLayer (sWelsEncCtx* pCtx, · 2 unmodified lines
14821487 for (iSlcBuffIdx = 0; iSlcBuffIdx < kiThreadNum; iSlcBuffIdx++) {
14831488 iSliceNumInThread = pCurLayer->sSliceBufferInfo[iSlcBuffIdx].iMaxSliceNum;
14841489
1485− for(iSliceIdx =0; iSliceIdx < iSliceNumInThread; iSliceIdx++) {
1490+ for (iSliceIdx = 0; iSliceIdx < iSliceNumInThread; iSliceIdx++) {
14861491 pSliceBuffer = pCurLayer->sSliceBufferInfo[iSlcBuffIdx].pSliceBuffer + iSliceIdx;
14871492 if (NULL == pSliceBuffer) {
14881493 return ENC_RETURN_UNEXPECTED;
14891494 }
14901495
1491− if( -1 != pSliceBuffer->iSliceIdx) {
1496+ if (-1 != pSliceBuffer->iSliceIdx) {
14921497 iPartitionID = pSliceBuffer->iSliceIdx % iPartitionNum;
14931498 iActualSliceIdx = aiPartitionOffset[iPartitionID] + pSliceBuffer->iSliceIdx / iPartitionNum;
14941499 pSliceBuffer->iSliceIdx = iActualSliceIdx;
14951500 pCurLayer->ppSliceInLayer[iActualSliceIdx] = pSliceBuffer;
14961501 iUsedSliceNum ++;
14971502 } else {
1498− pCurLayer->ppSliceInLayer[iEncodeSliceNum + iNonUsedBufferNum] = pSliceBuffer;
1499− iNonUsedBufferNum ++;
1503+ pCurLayer->ppSliceInLayer[iEncodeSliceNum + iNonUsedBufferNum] = pSliceBuffer;
1504+ iNonUsedBufferNum ++;
15001505 }
15011506 }
15021507 }
15031508
1504− if( iUsedSliceNum != iEncodeSliceNum ||
1505− pCurLayer->iMaxSliceNum != (iNonUsedBufferNum + iUsedSliceNum)) {
1509+ if (iUsedSliceNum != iEncodeSliceNum ||
1510+ pCurLayer->iMaxSliceNum != (iNonUsedBufferNum + iUsedSliceNum)) {
15061511 return ENC_RETURN_UNEXPECTED;
15071512 }
15081513
1509− if (ENC_RETURN_SUCCESS != CheckAllSliceBuffer(pCurLayer, iEncodeSliceNum)) {
1514+ if (ENC_RETURN_SUCCESS != CheckAllSliceBuffer (pCurLayer, iEncodeSliceNum)) {
15101515 return ENC_RETURN_UNEXPECTED;
15111516 }
15121517
15131518 return ENC_RETURN_SUCCESS;
15141519 }
15151520
1516−int32_t GetCurLayerNalCount(const SDqLayer* pCurDq, const int32_t kiCodedSliceNum) {
1521+int32_t GetCurLayerNalCount (const SDqLayer* pCurDq, const int32_t kiCodedSliceNum) {
15171522 int32_t iTotalNalCount = 0;
15181523 int32_t iSliceIdx = 0;
15191524 SWelsSliceBs* pSliceBs = NULL;
1520− for ( ; iSliceIdx < kiCodedSliceNum; iSliceIdx++ ) {
1525+ for (; iSliceIdx < kiCodedSliceNum; iSliceIdx++) {
15211526 pSliceBs = &pCurDq->ppSliceInLayer[iSliceIdx]->sSliceBs;
15221527 if (pSliceBs != NULL && pSliceBs->uiBsPos > 0) {
15231528 iTotalNalCount += pSliceBs->iNalIndex;
@@ -1527,7 +1532,7 @@ int32_t GetCurLayerNalCount(const SDqLayer* pCurDq, const int32_t kiCodedSliceNu · 3 unmodified lines
15271532 return iTotalNalCount;
15281533 }
15291534
1530−int32_t GetTotalCodedNalCount(SFrameBSInfo* pFbi) {
1535+int32_t GetTotalCodedNalCount (SFrameBSInfo* pFbi) {
15311536 int32_t iTotalCodedNalCount = 0;
15321537 for (int32_t iNalIdx = 0; iNalIdx < MAX_LAYER_NUM_OF_FRAME; iNalIdx++) {
15331538 iTotalCodedNalCount += pFbi->sLayerInfo[iNalIdx].iNalCount;
@@ -1584,13 +1589,13 @@ int32_t SliceLayerInfoUpdate (sWelsEncCtx* pCtx, · 50 unmodified lines
15841589 int32_t iCodedNalCount = 0;
15851590 int32_t iRet = 0;
15861591
1587− for ( int32_t iSlcBuffIdx = 0; iSlcBuffIdx < pCtx->iActiveThreadsNum; iSlcBuffIdx++) {
1592+ for (int32_t iSlcBuffIdx = 0; iSlcBuffIdx < pCtx->iActiveThreadsNum; iSlcBuffIdx++) {
15881593 iMaxSliceNum += pCtx->pCurDqLayer->sSliceBufferInfo[iSlcBuffIdx].iMaxSliceNum;
15891594 }
15901595
15911596 //reallocate ppSliceInLayer if total encoded slice num exceed max slice num
15921597 if (iMaxSliceNum > pCtx->pCurDqLayer->iMaxSliceNum) {
1593− iRet = ExtendLayerBuffer(pCtx, pCtx->pCurDqLayer->iMaxSliceNum, iMaxSliceNum);
1598+ iRet = ExtendLayerBuffer (pCtx, pCtx->pCurDqLayer->iMaxSliceNum, iMaxSliceNum);
15941599 if (ENC_RETURN_SUCCESS != iRet) {
15951600 return iRet;
15961601 }
@@ -1607,12 +1612,12 @@ int32_t SliceLayerInfoUpdate (sWelsEncCtx* pCtx, · 10 unmodified lines
16071612
16081613 //Extend NalList buffer if exceed
16091614 iCodedSliceNum = GetCurrentSliceNum (pCtx->pCurDqLayer);
1610− pLayerBsInfo->iNalCount = GetCurLayerNalCount(pCtx->pCurDqLayer, iCodedSliceNum);
1611− iCodedNalCount = GetTotalCodedNalCount(pFrameBsInfo);
1615+ pLayerBsInfo->iNalCount = GetCurLayerNalCount (pCtx->pCurDqLayer, iCodedSliceNum);
1616+ iCodedNalCount = GetTotalCodedNalCount (pFrameBsInfo);
16121617
1613− if( iCodedNalCount > pCtx->pOut->iCountNals) {
1618+ if (iCodedNalCount > pCtx->pOut->iCountNals) {
16141619 iRet = FrameBsRealloc (pCtx, pFrameBsInfo, pLayerBsInfo, pCtx->pCurDqLayer->iMaxSliceNum);
1615− if(ENC_RETURN_SUCCESS != iRet) {
1620+ if (ENC_RETURN_SUCCESS != iRet) {
16161621 return iRet;
16171622 }
16181623 }
@@ -1625,8 +1630,9 @@ int32_t WelsCodeOneSlice (sWelsEncCtx* pEncCtx, SSlice* pCurSlice, const int32_t · 6 unmodified lines
16251630 SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
16261631 SNalUnitHeaderExt* pNalHeadExt = &pCurLayer->sLayerInfo.sNalHeaderExt;
16271632 SBitStringAux* pBs = pCurSlice->pSliceBsa;
1628− const int32_t kiDynamicSliceFlag = (pEncCtx->pSvcParam->sSpatialLayers[pEncCtx->uiDependencyId].sSliceArgument.uiSliceMode
1629− == SM_SIZELIMITED_SLICE);
1633+ const int32_t kiDynamicSliceFlag =
1634+ (pEncCtx->pSvcParam->sSpatialLayers[pEncCtx->uiDependencyId].sSliceArgument.uiSliceMode
1635+ == SM_SIZELIMITED_SLICE);
16301636 if (I_SLICE == pEncCtx->eSliceType) {
16311637 pNalHeadExt->bIdrFlag = 1;
16321638 pCurSlice->sScaleShift = 0;
@@ -1639,7 +1645,7 @@ int32_t WelsCodeOneSlice (sWelsEncCtx* pEncCtx, SSlice* pCurSlice, const int32_t · 6 unmodified lines
16391645
16401646 //RomRC init slice by slice
16411647 if (pWelsSvcRc->bGomRC) {
1642− GomRCInitForOneSlice(pCurSlice, pWelsSvcRc->iBitsPerMb);
1648+ GomRCInitForOneSlice (pCurSlice, pWelsSvcRc->iBitsPerMb);
16431649 }
16441650
16451651 g_pWelsWriteSliceHeader[pCurSlice->bSliceHeaderExtFlag] (pEncCtx, pBs, pCurLayer, pCurSlice,
@@ -1695,7 +1701,7 @@ void AddSliceBoundary (sWelsEncCtx* pEncCtx, SSlice* pCurSlice, SSliceCtx* pSlic · 49 unmodified lines
16951701 pCurSlice->sSliceHeaderExt.uiNumMbsInSlice = 1 + iCurMbIdx - pCurSlice->sSliceHeaderExt.sSliceHeader.iFirstMbInSlice;
16961702
16971703 //pNextSlice pointer/initialization
1698− if(pEncCtx->iActiveThreadsNum > 1) {
1704+ if (pEncCtx->iActiveThreadsNum > 1) {
16991705 pNextSlice = &pSliceBuffer[ iCodedSliceNum + 1 ];
17001706 } else {
17011707 pNextSlice = &pSliceBuffer[ iNextSliceIdc ];

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