History

Convert tabs to spaces before comments

Martin Storsjö committed 11 years ago

Commit 78e0ec61 parent 3052b7a57 files · +278 −278Browse files

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

Unified · Split

codec/encoder/core/src/encoder_ext.cpp+36−36
@@ -51,7 +51,7 @@ · 50 unmodified lines
5151 #include "deblocking.h"
5252 #include "ref_list_mgr_svc.h"
5353 #include "ls_defines.h"
54−#include "crt_util_safe_x.h" // Safe CRT routines like utils for cross platforms
54+#include "crt_util_safe_x.h" // Safe CRT routines like utils for cross platforms
5555 #include "slice_multi_threading.h"
5656 #include "measure_time.h"
5757 #include "svc_set_mb_syn.h"
@@ -64,8 +64,8 @@ int32_t WelsCodeOnePicPartition (sWelsEncCtx* pCtx, · 6 unmodified lines
6464 SLayerBSInfo* pLayerBsInfo,
6565 int32_t* pNalIdxInLayer,
6666 int32_t* pLayerSize,
67− int32_t iFirstMbInPartition, // first mb inclusive in partition
68− int32_t iEndMbInPartition, // end mb exclusive in partition
67+ int32_t iFirstMbInPartition, // first mb inclusive in partition
68+ int32_t iEndMbInPartition, // end mb exclusive in partition
6969 int32_t iStartSliceIdx
7070 );
7171
@@ -453,7 +453,7 @@ int32_t ParamValidationExt (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingPa · 381 unmodified lines
453453 pSpatialLayer->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
454454 break;
455455 }
456− if (pCodingParam->iRCMode != RC_OFF_MODE) { // multiple slices verify with gom
456+ if (pCodingParam->iRCMode != RC_OFF_MODE) { // multiple slices verify with gom
457457 //check uiSliceNum and set uiSliceMbNum with current uiSliceNum
458458 if (!GomValidCheckSliceNum (iMbWidth, iMbHeight, &pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum)) {
459459 WelsLog (pLogCtx, WELS_LOG_WARNING,
@@ -469,7 +469,7 @@ int32_t ParamValidationExt (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingPa · 9 unmodified lines
469469 }
470470 assert (pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum > 1);
471471 } else if (!CheckFixedSliceNumMultiSliceSetting (iMbNumInFrame,
472− &pSpatialLayer->sSliceCfg.sSliceArgument)) { // verify interleave mode settings
472+ &pSpatialLayer->sSliceCfg.sSliceArgument)) { // verify interleave mode settings
473473 //check uiSliceMbNum with current uiSliceNum
474474 WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!",
475475 pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceMbNum[0]);
@@ -501,13 +501,13 @@ int32_t ParamValidationExt (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingPa · 25 unmodified lines
501501 }
502502
503503 if (!CheckRasterMultiSliceSetting (iMbNumInFrame,
504− &pSpatialLayer->sSliceCfg.sSliceArgument)) { // verify interleave mode settings
504+ &pSpatialLayer->sSliceCfg.sSliceArgument)) { // verify interleave mode settings
505505 WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!",
506506 pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceMbNum[0]);
507507 return ENC_RETURN_UNSUPPORTED_PARA;
508508 }
509509 if (pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum <= 0
510− || pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum > iMaxSliceNum) { // verify interleave mode settings
510+ || pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum > iMaxSliceNum) { // verify interleave mode settings
511511 WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceNum (%d) in SM_RASTER_SLICE settings!",
512512 pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceNum);
513513 return ENC_RETURN_UNSUPPORTED_PARA;
@@ -548,7 +548,7 @@ int32_t ParamValidationExt (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingPa · 34 unmodified lines
548548 return ENC_RETURN_UNSUPPORTED_PARA;
549549 }
550550 if (!CheckRowMbMultiSliceSetting (iMbWidth,
551− &pSpatialLayer->sSliceCfg.sSliceArgument)) { // verify interleave mode settings
551+ &pSpatialLayer->sSliceCfg.sSliceArgument)) { // verify interleave mode settings
552552 WelsLog (pLogCtx, WELS_LOG_ERROR, "ParamValidationExt(), invalid uiSliceMbNum (%d) settings!",
553553 pSpatialLayer->sSliceCfg.sSliceArgument.uiSliceMbNum[0]);
554554 return ENC_RETURN_UNSUPPORTED_PARA;
@@ -1178,7 +1178,7 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx, SExistingParasetList* p · 623 unmodified lines
11781178 }
11791179 }
11801180 // fix issue in case single pSlice coding might be inclusive exist in variant spatial layer setting, also introducing multi-pSlice modes
1181− else { // only one pSlice
1181+ else { // only one pSlice
11821182 SSlice* pSlice = &pDqLayer->sLayerInfo.pSliceInLayer[0];
11831183 pSlice->uiSliceIdx = 0;
11841184 pSlice->pSliceBsa = & (*ppCtx)->pOut->sBsWrite;
@@ -1410,8 +1410,8 @@ int32_t AllocStrideTables (sWelsEncCtx** ppCtx, const int32_t kiNumSpatialLayers · 225 unmodified lines
14101410 uint8_t* pBaseDec = NULL, *pBaseEnc = NULL, *pBaseMbX = NULL, *pBaseMbY = NULL;
14111411 struct {
14121412 int32_t iMbWidth;
1413− int32_t iCountMbNum; // count number of SMB in each spatial
1414− int32_t iSizeAllMbAlignCache; // cache line size aligned in each spatial
1413+ int32_t iCountMbNum; // count number of SMB in each spatial
1414+ int32_t iSizeAllMbAlignCache; // cache line size aligned in each spatial
14151415 } sMbSizeMap[MAX_DEPENDENCY_LAYER] = {{ 0 }};
14161416 int32_t iLineSizeY[MAX_DEPENDENCY_LAYER][2] = {{ 0 }};
14171417 int32_t iLineSizeUV[MAX_DEPENDENCY_LAYER][2] = {{ 0 }};
@@ -1607,7 +1607,7 @@ int32_t AllocStrideTables (sWelsEncCtx** ppCtx, const int32_t kiNumSpatialLayers · 189 unmodified lines
16071607
16081608 i = 0;
16091609 while (i < kiMbHeight) {
1610− memcpy (pMbIndexX, pRowX, kiLineSize); // confirmed_safe_unsafe_usage
1610+ memcpy (pMbIndexX, pRowX, kiLineSize); // confirmed_safe_unsafe_usage
16111611
16121612 pMbIndexX += kiMbWidth;
16131613 ++ i;
@@ -1630,7 +1630,7 @@ int32_t AllocStrideTables (sWelsEncCtx** ppCtx, const int32_t kiNumSpatialLayers · 16 unmodified lines
16301630 int16_t* pMbIndexY = pPtr->pMbIndexY[iSpatialIdx] + i * kiMbWidth;
16311631
16321632 if (i < kiMbHeight) {
1633− memcpy (pMbIndexY, pRowY, kiLineSize); // confirmed_safe_unsafe_usage
1633+ memcpy (pMbIndexY, pRowY, kiLineSize); // confirmed_safe_unsafe_usage
16341634 }
16351635 }
16361636 ++ i;
@@ -2205,7 +2205,7 @@ void FreeMemorySvc (sWelsEncCtx** ppCtx) { · 568 unmodified lines
22052205 }
22062206
22072207 #if defined(MEMORY_MONITOR)
2208− assert (pMa->WelsGetMemoryUsage() == 0); // ensure all memory free well
2208+ assert (pMa->WelsGetMemoryUsage() == 0); // ensure all memory free well
22092209 #endif//MEMORY_MONITOR
22102210
22112211 if ((*ppCtx)->pMemAlign != NULL) {
@@ -2277,7 +2277,7 @@ int32_t InitSliceSettings (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingPar · 65 unmodified lines
22772277 pDlp->sSliceCfg.uiSliceMode = SM_SINGLE_SLICE;
22782278 break;
22792279 }
2280− if (pCodingParam->iRCMode != RC_OFF_MODE) { // multiple slices verify with gom
2280+ if (pCodingParam->iRCMode != RC_OFF_MODE) { // multiple slices verify with gom
22812281 //check uiSliceNum and set uiSliceMbNum with current uiSliceNum
22822282 if (!GomValidCheckSliceNum (kiMbWidth, kiMbHeight, &pDlp->sSliceCfg.sSliceArgument.uiSliceNum)) {
22832283 WelsLog (pLogCtx, WELS_LOG_WARNING,
@@ -2292,7 +2292,7 @@ int32_t InitSliceSettings (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingPar · 8 unmodified lines
22922292 return ENC_RETURN_INVALIDINPUT;
22932293 }
22942294 } else if (!CheckFixedSliceNumMultiSliceSetting (kiMbNumInFrame,
2295− &pDlp->sSliceCfg.sSliceArgument)) { // verify interleave mode settings
2295+ &pDlp->sSliceCfg.sSliceArgument)) { // verify interleave mode settings
22962296 //check uiSliceMbNum with current uiSliceNum
22972297 WelsLog (pLogCtx, WELS_LOG_ERROR,
22982298 "InitSliceSettings(), invalid uiSliceMbNum (%d) settings!,now turn to SM_SINGLE_SLICE type",
@@ -2400,7 +2400,7 @@ int32_t GetMultipleThreadIdc (SLogContext* pLogCtx, SWelsSvcCodingParam* pCoding · 101 unmodified lines
24002400 uiCpuCores = pCodingParam->iMultipleThreadIdc;
24012401 else {
24022402 if (uiCpuCores ==
2403− 0) // cpuid not supported or doesn't expose the number of cores, use high level system API as followed to detect number of pysical/logic processor
2403+ 0) // cpuid not supported or doesn't expose the number of cores, use high level system API as followed to detect number of pysical/logic processor
24042404 uiCpuCores = DynamicDetectCpuCores();
24052405 // So far so many cpu cores up to MAX_THREADS_NUM mean for server platforms,
24062406 // for client application here it is constrained by maximal to MAX_THREADS_NUM
@@ -2475,7 +2475,7 @@ int32_t WelsInitEncoderExt (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pCodingPar · 68 unmodified lines
24752475 FreeMemorySvc (&pCtx);
24762476 return iRet;
24772477 }
2478− memcpy (pCtx->pSvcParam, pCodingParam, sizeof (SWelsSvcCodingParam)); // confirmed_safe_unsafe_usage
2478+ memcpy (pCtx->pSvcParam, pCodingParam, sizeof (SWelsSvcCodingParam)); // confirmed_safe_unsafe_usage
24792479
24802480 pCtx->pFuncList = (SWelsFuncPtrList*)pCtx->pMemAlign->WelsMalloc (sizeof (SWelsFuncPtrList), "SWelsFuncPtrList");
24812481 if (NULL == pCtx->pFuncList) {
@@ -2639,7 +2639,7 @@ void WelsUninitEncoderExt (sWelsEncCtx** ppCtx) { · 157 unmodified lines
26392639 if ((*ppCtx)->pSliceThreading->pThreadHandles[iThreadIdx]) {
26402640 WelsEventSignal (& (*ppCtx)->pSliceThreading->pExitEncodeEvent[iThreadIdx]);
26412641 WelsEventSignal (& (*ppCtx)->pSliceThreading->pThreadMasterEvent[iThreadIdx]);
2642− res = WelsThreadJoin ((*ppCtx)->pSliceThreading->pThreadHandles[iThreadIdx]); // waiting thread exit
2642+ res = WelsThreadJoin ((*ppCtx)->pSliceThreading->pThreadHandles[iThreadIdx]); // waiting thread exit
26432643 WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_INFO, "WelsUninitEncoderExt(), pthread_join(pThreadHandles%d) return %d..",
26442644 iThreadIdx,
26452645 res);
@@ -2844,7 +2844,7 @@ void WelsInitCurrentLayer (sWelsEncCtx* pCtx, · 198 unmodified lines
28442844
28452845 pCurDq->pDecPic = pDecPic;
28462846
2847− if (fDlp->sSliceCfg.uiSliceMode == SM_DYN_SLICE) // need get extra slices for update
2847+ if (fDlp->sSliceCfg.uiSliceMode == SM_DYN_SLICE) // need get extra slices for update
28482848 iSliceCount = GetInitialSliceNum (pCurDq->iMbWidth, pCurDq->iMbHeight, &fDlp->sSliceCfg);
28492849 else
28502850 iSliceCount = GetCurrentSliceNum (pCurDq->pSliceEncCtx);
@@ -3146,7 +3146,7 @@ void ParasetIdAdditionIdAdjust (SParaSetOffsetVariable* sParaSetOffsetVariable, · 295 unmodified lines
31463146 sParaSetOffsetVariable->iParaSetIdDelta[kiEncId] = uiNextIdInBs -
31473147 kiEncId; //for current parameter set, change its id_delta
31483148 //write pso pData for next update:
3149− sParaSetOffsetVariable->bUsedParaSetIdInBs[uiNextIdInBs] = true; // update current used_id
3149+ sParaSetOffsetVariable->bUsedParaSetIdInBs[uiNextIdInBs] = true; // update current used_id
31503150
31513151 //prepare for next update:
31523152 // find the next avaibable iId
@@ -3716,7 +3716,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 563 unmodified lines
37163716 pCtx->pFuncList->pfRc.pfWelsUpdateMaxBrWindowStatus (pCtx, iSpatialNum, pSrcPic->uiTimeStamp);
37173717 }
37183718
3719− if (iSpatialNum < 1) { // skip due to temporal layer settings (different frame rate)
3719+ if (iSpatialNum < 1) { // skip due to temporal layer settings (different frame rate)
37203720 ++ pCtx->iCodingIndex;
37213721 pFbi->eFrameType = videoFrameTypeSkip;
37223722 WelsLog (& (pCtx->sLogCtx), WELS_LOG_DEBUG,
@@ -3879,16 +3879,16 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 156 unmodified lines
38793879 && (pCtx->iNumRef0 > 0)) ? pCtx->pRefList0[0] : NULL,
38803880 iCurDid, (pCtx->eSliceType == P_SLICE) && pSvcParam->bEnableBackgroundDetection);
38813881 WelsUpdateRefSyntax (pCtx, pCtx->iPOC,
3882− eFrameType); //get reordering syntax used for writing slice header and transmit to encoder.
3883− PrefetchReferencePicture (pCtx, eFrameType); // update reference picture for current pDq layer
3882+ eFrameType); //get reordering syntax used for writing slice header and transmit to encoder.
3883+ PrefetchReferencePicture (pCtx, eFrameType); // update reference picture for current pDq layer
38843884
38853885 pCtx->pFuncList->pfRc.pfWelsRcPictureInit (pCtx, pSrcPic->uiTimeStamp);
3886− PreprocessSliceCoding (pCtx); // MUST be called after pfWelsRcPictureInit() and WelsInitCurrentLayer()
3886+ PreprocessSliceCoding (pCtx); // MUST be called after pfWelsRcPictureInit() and WelsInitCurrentLayer()
38873887
38883888 //TODO Complexity Calculation here for screen content
38893889 iLayerSize = 0;
38903890
3891− if (SM_SINGLE_SLICE == pParam->sSliceCfg.uiSliceMode) { // only one slice within a sQualityStat layer
3891+ if (SM_SINGLE_SLICE == pParam->sSliceCfg.uiSliceMode) { // only one slice within a sQualityStat layer
38923892 int32_t iSliceSize = 0;
38933893 int32_t iPayloadSize = 0;
38943894
@@ -3948,7 +3948,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 53 unmodified lines
39483948 return ENC_RETURN_UNEXPECTED;
39493949 }
39503950
3951− if (pSvcParam->iCountThreadsNum >= iSliceCount) { //THREAD_FULLY_FIRE_MODE
3951+ if (pSvcParam->iCountThreadsNum >= iSliceCount) { //THREAD_FULLY_FIRE_MODE
39523952 #if defined(MT_DEBUG)
39533953 int64_t t_bs_append = 0;
39543954 #endif
@@ -3986,7 +3986,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 31 unmodified lines
39863986 t_bs_append, pCtx->iCodingIndex, iCurDid, 0);
39873987 }
39883988 #endif//MT_DEBUG
3989− } else { //THREAD_PICK_UP_MODE
3989+ } else { //THREAD_PICK_UP_MODE
39903990 int32_t iNumThreadsRunning = 0;
39913991 int32_t iNumThreadsScheduled = 0;
39923992 int32_t iIndexOfSliceToBeCoded = 0;
@@ -4026,7 +4026,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 33 unmodified lines
40264026 WelsEventSignal (&pCtx->pSliceThreading->pThreadMasterEvent[iEventId]);
40274027
40284028 ++ iIndexOfSliceToBeCoded;
4029− } else { // no other slices left for coding
4029+ } else { // no other slices left for coding
40304030 -- iNumThreadsRunning;
40314031 }
40324032 }
@@ -4320,7 +4320,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 287 unmodified lines
43204320
43214321 #ifdef ENABLE_FRAME_DUMP
43224322 DumpRecFrame (fsnr, &pSvcParam->sDependencyLayers[pSvcParam->iSpatialLayerNum - 1].sRecFileName[0],
4323− pSvcParam->iSpatialLayerNum - 1, pCtx->bRecFlag, pCtx->pCurDqLayer); // pDecPic: final reconstruction output
4323+ pSvcParam->iSpatialLayerNum - 1, pCtx->bRecFlag, pCtx->pCurDqLayer); // pDecPic: final reconstruction output
43244324 pCtx->bRecFlag = true;
43254325
43264326 #endif//ENABLE_FRAME_DUMP
@@ -4431,7 +4431,7 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa · 104 unmodified lines
44314431 bNeedReset = true;
44324432 }
44334433
4434− if (!bNeedReset) { // Check its picture resolutions/quality settings respectively in each dependency layer
4434+ if (!bNeedReset) { // Check its picture resolutions/quality settings respectively in each dependency layer
44354435 iIndexD = 0;
44364436 assert (pOldParam->iSpatialLayerNum == pNewParam->iSpatialLayerNum);
44374437 do {
@@ -4628,7 +4628,7 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa · 190 unmodified lines
46284628 pOldDlpInternal->iDecompositionStages = pNewDlpInternal->iDecompositionStages;
46294629
46304630 memcpy (pOldDlpInternal->uiCodingIdx2TemporalId, pNewDlpInternal->uiCodingIdx2TemporalId,
4631− sizeof (pOldDlpInternal->uiCodingIdx2TemporalId)); // confirmed_safe_unsafe_usage
4631+ sizeof (pOldDlpInternal->uiCodingIdx2TemporalId)); // confirmed_safe_unsafe_usage
46324632
46334633 ++ iIndexD;
46344634 } while (iIndexD < pOldParam->iSpatialLayerNum);
@@ -4829,8 +4829,8 @@ int32_t WelsCodeOnePicPartition (sWelsEncCtx* pCtx, · 194 unmodified lines
48294829 SLayerBSInfo* pLayerBsInfo,
48304830 int32_t* pNalIdxInLayer,
48314831 int32_t* pLayerSize,
4832− int32_t iFirstMbInPartition, // first mb inclusive in partition
4833− int32_t iEndMbInPartition, // end mb exclusive in partition
4832+ int32_t iFirstMbInPartition, // first mb inclusive in partition
4833+ int32_t iEndMbInPartition, // end mb exclusive in partition
48344834 int32_t iStartSliceIdx
48354835 ) {
48364836
@@ -4860,7 +4860,7 @@ int32_t WelsCodeOnePicPartition (sWelsEncCtx* pCtx, · 23 unmodified lines
48604860 int32_t iSliceSize = 0;
48614861 int32_t iPayloadSize = 0;
48624862
4863− if (iSliceIdx >= (pSliceCtx->iMaxSliceNumConstraint - kiSliceIdxStep)) { // insufficient memory in pSliceInLayer[]
4863+ if (iSliceIdx >= (pSliceCtx->iMaxSliceNumConstraint - kiSliceIdxStep)) { // insufficient memory in pSliceInLayer[]
48644864 if (pCtx->iActiveThreadsNum == 1) {
48654865 //only single thread support re-alloc now
48664866 if (DynSliceRealloc (pCtx, pFrameBSInfo, pLayerBsInfo)) {
@@ -4909,7 +4909,7 @@ int32_t WelsCodeOnePicPartition (sWelsEncCtx* pCtx, · 42 unmodified lines
49094909 #endif//SLICE_INFO_OUTPUT
49104910
49114911 ++ iNalIdxInLayer;
4912− iSliceIdx += kiSliceStep; //if uiSliceIdx is not continuous
4912+ iSliceIdx += kiSliceStep; //if uiSliceIdx is not continuous
49134913 iAnyMbLeftInPartition = iEndMbInPartition - (1 + pCurLayer->pLastCodedMbIdxOfPartition[kiPartitionId]);
49144914 }
49154915

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