History

update format

Karina committed 10 years ago

Commit 57c87f11 parent cd755412 files · +100 −79Browse files

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

Unified · Split

codec/encoder/core/src/encoder_ext.cpp+91−73
@@ -166,9 +166,9 @@ void CheckReferenceNumSetting (SLogContext* pLogCtx, SWelsSvcCodingParam* pParam · 165 unmodified lines
166166 }
167167 }
168168
169−int32_t SliceArgumentValidationFixedSliceMode(SLogContext* pLogCtx,
170− SSliceArgument* pSliceArgument, const RC_MODES kiRCMode,
171− const int32_t kiPicWidth, const int32_t kiPicHeight) {
169+int32_t SliceArgumentValidationFixedSliceMode (SLogContext* pLogCtx,
170+ SSliceArgument* pSliceArgument, const RC_MODES kiRCMode,
171+ const int32_t kiPicWidth, const int32_t kiPicHeight) {
172172 int32_t iCpuCores = 0;
173173 int32_t iIdx = 0;
174174 const int32_t iMbWidth = (kiPicWidth + 15) >> 4;
@@ -180,7 +180,7 @@ int32_t SliceArgumentValidationFixedSliceMode(SLogContext* pLogCtx, · 5 unmodified lines
180180
181181 if (pSliceArgument->uiSliceNum == 0) {
182182 WelsCPUFeatureDetect (&iCpuCores);
183− if (0 == iCpuCores ) {
183+ if (0 == iCpuCores) {
184184 // cpuid not supported or doesn't expose the number of cores,
185185 // use high level system API as followed to detect number of pysical/logic processor
186186 iCpuCores = DynamicDetectCpuCores();
@@ -189,15 +189,17 @@ int32_t SliceArgumentValidationFixedSliceMode(SLogContext* pLogCtx, · 2 unmodified lines
189189 }
190190
191191 if (pSliceArgument->uiSliceNum <= 1) {
192− WelsLog (pLogCtx, WELS_LOG_INFO, "SliceArgumentValidationFixedSliceMode(), uiSliceNum(%d) you set for SM_FIXEDSLCNUM_SLICE, now turn to SM_SINGLE_SLICE type!",
193− pSliceArgument->uiSliceNum);
192+ WelsLog (pLogCtx, WELS_LOG_INFO,
193+ "SliceArgumentValidationFixedSliceMode(), uiSliceNum(%d) you set for SM_FIXEDSLCNUM_SLICE, now turn to SM_SINGLE_SLICE type!",
194+ pSliceArgument->uiSliceNum);
194195 bSingleMode = true;
195196 }
196197
197198 // considering the coding efficient and performance,
198199 // iCountMbNum constraint by MIN_NUM_MB_PER_SLICE condition of multi-pSlice mode settting
199200 if (iMbNumInFrame <= MIN_NUM_MB_PER_SLICE) {
200− WelsLog (pLogCtx, WELS_LOG_INFO, "SliceArgumentValidationFixedSliceMode(), uiSliceNum(%d) you set for SM_FIXEDSLCNUM_SLICE, now turn to SM_SINGLE_SLICE type as CountMbNum less than MIN_NUM_MB_PER_SLICE!",
201+ WelsLog (pLogCtx, WELS_LOG_INFO,
202+ "SliceArgumentValidationFixedSliceMode(), uiSliceNum(%d) you set for SM_FIXEDSLCNUM_SLICE, now turn to SM_SINGLE_SLICE type as CountMbNum less than MIN_NUM_MB_PER_SLICE!",
201203 pSliceArgument->uiSliceNum);
202204 bSingleMode = true;
203205 }
@@ -213,15 +215,17 @@ int32_t SliceArgumentValidationFixedSliceMode(SLogContext* pLogCtx, · 9 unmodified lines
213215
214216 if (pSliceArgument->uiSliceNum > MAX_SLICES_NUM) {
215217 pSliceArgument->uiSliceNum = MAX_SLICES_NUM;
216− WelsLog (pLogCtx, WELS_LOG_WARNING, "SliceArgumentValidationFixedSliceMode(), uiSliceNum exceed MAX_SLICES_NUM! So setting slice num eqaul to MAX_SLICES_NUM(%d)!",
218+ WelsLog (pLogCtx, WELS_LOG_WARNING,
219+ "SliceArgumentValidationFixedSliceMode(), uiSliceNum exceed MAX_SLICES_NUM! So setting slice num eqaul to MAX_SLICES_NUM(%d)!",
217220 pSliceArgument->uiSliceNum);
218221 }
219222
220223 if (kiRCMode != RC_OFF_MODE) { // multiple slices verify with gom
221224 //check uiSliceNum and set uiSliceMbNum with current uiSliceNum
222225 if (!GomValidCheckSliceNum (iMbWidth, iMbHeight, &pSliceArgument->uiSliceNum)) {
223− WelsLog (pLogCtx, WELS_LOG_WARNING, "SliceArgumentValidationFixedSliceMode(), unsupported setting with Resolution and uiSliceNum combination under RC on! So uiSliceNum is changed to %d!",
224− pSliceArgument->uiSliceNum);
226+ WelsLog (pLogCtx, WELS_LOG_WARNING,
227+ "SliceArgumentValidationFixedSliceMode(), unsupported setting with Resolution and uiSliceNum combination under RC on! So uiSliceNum is changed to %d!",
228+ pSliceArgument->uiSliceNum);
225229 }
226230
227231 if (pSliceArgument->uiSliceNum <= 1 ||
@@ -235,7 +239,7 @@ int32_t SliceArgumentValidationFixedSliceMode(SLogContext* pLogCtx, · 7 unmodified lines
235239 //check uiSliceMbNum with current uiSliceNum
236240 WelsLog (pLogCtx, WELS_LOG_ERROR,
237241 "SliceArgumentValidationFixedSliceMode(), invalid uiSliceMbNum (%d) settings!,now turn to SM_SINGLE_SLICE type",
238− pSliceArgument->uiSliceMbNum[0]);
242+ pSliceArgument->uiSliceMbNum[0]);
239243 pSliceArgument->uiSliceMode = SM_SINGLE_SLICE;
240244 pSliceArgument->uiSliceNum = 1;
241245 for (iIdx = 0; iIdx < MAX_SLICES_NUM; iIdx++) {
@@ -500,7 +504,8 @@ int32_t ParamValidationExt (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingPa · 258 unmodified lines
500504 return ENC_RETURN_UNSUPPORTED_PARA;
501505 }
502506 if ((pCodingParam->uiMaxNalSize != 0) && (pSpatialLayer->sSliceArgument.uiSliceMode != SM_SIZELIMITED_SLICE)) {
503− WelsLog (pLogCtx, WELS_LOG_WARNING, "ParamValidationExt(), current layer %d uiSliceMode (%d) settings may not fulfill MaxNalSize = %d", i,
507+ WelsLog (pLogCtx, WELS_LOG_WARNING,
508+ "ParamValidationExt(), current layer %d uiSliceMode (%d) settings may not fulfill MaxNalSize = %d", i,
504509 pSpatialLayer->sSliceArgument.uiSliceMode, pCodingParam->uiMaxNalSize);
505510 }
506511 CheckProfileSetting (pLogCtx, pCodingParam, i, pSpatialLayer->uiProfileIdc);
@@ -519,9 +524,9 @@ int32_t ParamValidationExt (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingPa · 12 unmodified lines
519524 }
520525 break;
521526 case SM_FIXEDSLCNUM_SLICE: {
522− iReturn = SliceArgumentValidationFixedSliceMode(pLogCtx, &pSpatialLayer->sSliceArgument, pCodingParam->iRCMode,
523− kiPicWidth, kiPicHeight);
524− if(iReturn)
527+ iReturn = SliceArgumentValidationFixedSliceMode (pLogCtx, &pSpatialLayer->sSliceArgument, pCodingParam->iRCMode,
528+ kiPicWidth, kiPicHeight);
529+ if (iReturn)
525530 return ENC_RETURN_UNSUPPORTED_PARA;
526531 }
527532 break;
@@ -539,7 +544,7 @@ int32_t ParamValidationExt (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingPa · 11 unmodified lines
539544 return ENC_RETURN_UNSUPPORTED_PARA;
540545 }
541546 pSpatialLayer->sSliceArgument.uiSliceNum = iMbHeight;
542− for (uint32_t j=0; j<iMbHeight; j++) {
547+ for (uint32_t j = 0; j < iMbHeight; j++) {
543548 pSpatialLayer->sSliceArgument.uiSliceMbNum[j] = iMbWidth;
544549 }
545550 if (!CheckRowMbMultiSliceSetting (iMbWidth,
@@ -598,10 +603,10 @@ int32_t ParamValidationExt (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingPa · 52 unmodified lines
598603 }
599604
600605 if (pSpatialLayer->sSliceArgument.uiSliceSizeConstraint > (pCodingParam->uiMaxNalSize -
601− NAL_HEADER_ADD_0X30BYTES)) {
606+ NAL_HEADER_ADD_0X30BYTES)) {
602607 WelsLog (pLogCtx, WELS_LOG_WARNING,
603− "ParamValidationExt(), slice mode = SM_SIZELIMITED_SLICE, uiSliceSizeConstraint = %d ,uiMaxNalsize = %d, will take uiMaxNalsize!",
604− pSpatialLayer->sSliceArgument.uiSliceSizeConstraint, pCodingParam->uiMaxNalSize);
608+ "ParamValidationExt(), slice mode = SM_SIZELIMITED_SLICE, uiSliceSizeConstraint = %d ,uiMaxNalsize = %d, will take uiMaxNalsize!",
609+ pSpatialLayer->sSliceArgument.uiSliceSizeConstraint, pCodingParam->uiMaxNalSize);
605610 pSpatialLayer->sSliceArgument.uiSliceSizeConstraint = pCodingParam->uiMaxNalSize - NAL_HEADER_ADD_0X30BYTES;
606611 }
607612 }
@@ -905,7 +910,7 @@ int32_t AllocMbCacheAligned (SMbCache* pMbCache, CMemoryAlign* pMa) { · 297 unmodified lines
905910 "pMbCache->pPrevIntra4x4PredModeFlag");
906911 WELS_VERIFY_RETURN_IF (1, (NULL == pMbCache->pPrevIntra4x4PredModeFlag));
907912 pMbCache->pRemIntra4x4PredModeFlag = (int8_t*)pMa->WelsMalloc (16 * sizeof (int8_t),
908− "pMbCache->pRemIntra4x4PredModeFlag");
913+ "pMbCache->pRemIntra4x4PredModeFlag");
909914 WELS_VERIFY_RETURN_IF (1, (NULL == pMbCache->pRemIntra4x4PredModeFlag));
910915 pMbCache->pDct = (SDCTCoeff*)pMa->WelsMalloc (sizeof (SDCTCoeff), "pMbCache->pDct");
911916 WELS_VERIFY_RETURN_IF (1, (NULL == pMbCache->pDct));
@@ -1095,7 +1100,7 @@ int32_t FindExistingPps (SWelsSPS* pSps, SSubsetSps* pSubsetSps, const bool kbUs · 183 unmodified lines
10951100 }
10961101
10971102 static inline int32_t InitpSliceInLayer (sWelsEncCtx** ppCtx, SDqLayer* pDqLayer, CMemoryAlign* pMa,
1098− const int32_t iMaxSliceNum, const int32_t kiDlayerIndex) {
1103+ const int32_t iMaxSliceNum, const int32_t kiDlayerIndex) {
10991104 int32_t iMaxSliceBufferSize = (*ppCtx)->iSliceBufferSize[kiDlayerIndex];
11001105 int32_t iSliceIdx = 0;
11011106 SliceModeEnum uiSliceMode = (*ppCtx)->pSvcParam->sSpatialLayers[kiDlayerIndex].sSliceArgument.uiSliceMode;
@@ -1105,7 +1110,7 @@ static inline int32_t InitpSliceInLayer (sWelsEncCtx** ppCtx, SDqLayer* pDqLayer · 3 unmodified lines
11051110 bool bIndependenceBsBuffer = ((*ppCtx)->pSvcParam->iMultipleThreadIdc > 1 &&
11061111 SM_SINGLE_SLICE != uiSliceMode) ? true : false;
11071112
1108− if ( iMaxSliceBufferSize <= 0) {
1113+ if (iMaxSliceBufferSize <= 0) {
11091114 return ENC_RETURN_UNEXPECTED;
11101115 }
11111116
@@ -1115,10 +1120,10 @@ static inline int32_t InitpSliceInLayer (sWelsEncCtx** ppCtx, SDqLayer* pDqLayer · 3 unmodified lines
11151120 pSlice->uiSliceIdx = iSliceIdx;
11161121 pSlice->sSliceBs.uiSize = iMaxSliceBufferSize;
11171122 pSlice->sSliceBs.uiBsPos = 0;
1118− if (bIndependenceBsBuffer){
1123+ if (bIndependenceBsBuffer) {
11191124 pSlice->pSliceBsa = &pSlice->sSliceBs.sBsWrite;
11201125 pSlice->sSliceBs.pBs = (uint8_t*)pMa->WelsMalloc (iMaxSliceBufferSize, "SliceBs");
1121− if ( NULL == pSlice->sSliceBs.pBs) {
1126+ if (NULL == pSlice->sSliceBs.pBs) {
11221127 return ENC_RETURN_MEMALLOCERR;
11231128 }
11241129 } else {
@@ -1176,7 +1181,8 @@ static inline int32_t InitDqLayers (sWelsEncCtx** ppCtx, SExistingParasetList* p · 51 unmodified lines
11761181 int32_t iPicWidth = WELS_ALIGN (kiWidth, MB_WIDTH_LUMA) + (PADDING_LENGTH << 1); // with iWidth of horizon
11771182 int32_t iPicChromaWidth = iPicWidth >> 1;
11781183
1179− iPicWidth = WELS_ALIGN (iPicWidth, 32); // 32(or 16 for chroma below) to match original imp. here instead of iCacheLineSize
1184+ iPicWidth = WELS_ALIGN (iPicWidth,
1185+ 32); // 32(or 16 for chroma below) to match original imp. here instead of iCacheLineSize
11801186 iPicChromaWidth = WELS_ALIGN (iPicChromaWidth, 16);
11811187
11821188 WelsGetEncBlockStrideOffset ((*ppCtx)->pStrideTab->pStrideEncBlockOffset[iDlayerIndex], iPicWidth, iPicChromaWidth);
@@ -1826,12 +1832,13 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx, SExistingParasetList* pExistingPa · 643 unmodified lines
18261832 uiMaxSliceNumEstimation = WELS_MIN (AVERSLICENUM_CONSTRAINT,
18271833 (iLayerBsSize / pSliceArgument->uiSliceSizeConstraint) + 1);
18281834 (*ppCtx)->iMaxSliceCount = WELS_MAX ((*ppCtx)->iMaxSliceCount, (int) uiMaxSliceNumEstimation);
1829− iSliceBufferSize = (WELS_MAX(pSliceArgument->uiSliceSizeConstraint, iLayerBsSize/uiMaxSliceNumEstimation)<<1) + MAX_MACROBLOCK_SIZE_IN_BYTE_x2;
1835+ iSliceBufferSize = (WELS_MAX (pSliceArgument->uiSliceSizeConstraint,
1836+ iLayerBsSize / uiMaxSliceNumEstimation) << 1) + MAX_MACROBLOCK_SIZE_IN_BYTE_x2;
18301837 } else {
18311838 (*ppCtx)->iMaxSliceCount = WELS_MAX ((*ppCtx)->iMaxSliceCount, (int) pSliceArgument->uiSliceNum);
1832− iSliceBufferSize = ((iLayerBsSize / pSliceArgument->uiSliceNum)<<1) + MAX_MACROBLOCK_SIZE_IN_BYTE_x2;
1839+ iSliceBufferSize = ((iLayerBsSize / pSliceArgument->uiSliceNum) << 1) + MAX_MACROBLOCK_SIZE_IN_BYTE_x2;
18331840 }
1834− iMaxSliceBufferSize = WELS_MAX(iMaxSliceBufferSize, iSliceBufferSize);
1841+ iMaxSliceBufferSize = WELS_MAX (iMaxSliceBufferSize, iSliceBufferSize);
18351842 (*ppCtx)->iSliceBufferSize[iIndex] = iSliceBufferSize;
18361843 ++ iIndex;
18371844 }
@@ -1842,8 +1849,8 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx, SExistingParasetList* pExistingPa · 4 unmodified lines
18421849 iTotalLength = iCountBsLen;
18431850
18441851 pParam->iNumRefFrame = WELS_CLIP3 (pParam->iNumRefFrame, MIN_REF_PIC_COUNT,
1845− (pParam->iUsageType == CAMERA_VIDEO_REAL_TIME ? MAX_REFERENCE_PICTURE_COUNT_NUM_CAMERA :
1846− MAX_REFERENCE_PICTURE_COUNT_NUM_SCREEN));
1852+ (pParam->iUsageType == CAMERA_VIDEO_REAL_TIME ? MAX_REFERENCE_PICTURE_COUNT_NUM_CAMERA :
1853+ MAX_REFERENCE_PICTURE_COUNT_NUM_SCREEN));
18471854
18481855 // Output
18491856 (*ppCtx)->pOut = (SWelsEncoderOutput*)pMa->WelsMalloc (sizeof (SWelsEncoderOutput), "SWelsEncoderOutput");
@@ -1866,7 +1873,8 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx, SExistingParasetList* pExistingPa · 16 unmodified lines
18661873 (*ppCtx)->iPosBsBuffer = 0;
18671874
18681875 // for pSlice bs buffers
1869− if (pParam->iMultipleThreadIdc > 1 && RequestMtResource (ppCtx, pParam, iCountBsLen, iMaxSliceBufferSize, bDynamicSlice)) {
1876+ if (pParam->iMultipleThreadIdc > 1
1877+ && RequestMtResource (ppCtx, pParam, iCountBsLen, iMaxSliceBufferSize, bDynamicSlice)) {
18701878 WelsLog (& (*ppCtx)->sLogCtx, WELS_LOG_WARNING, "RequestMemorySvc(), RequestMtResource failed!");
18711879 FreeMemorySvc (ppCtx);
18721880 return 1;
@@ -1889,7 +1897,7 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx, SExistingParasetList* pExistingPa · 16 unmodified lines
18891897 WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pRefIndexBlock4x4), FreeMemorySvc (ppCtx))
18901898
18911899 (*ppCtx)->pSadCostMb = static_cast<int32_t*>
1892− (pMa->WelsMallocz (iCountMaxMbNum * sizeof (int32_t), "pSadCostMb"));
1900+ (pMa->WelsMallocz (iCountMaxMbNum * sizeof (int32_t), "pSadCostMb"));
18931901 WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pSadCostMb), FreeMemorySvc (ppCtx))
18941902
18951903 (*ppCtx)->bEncCurFrmAsIdrFlag = true; // make sure first frame is IDR
@@ -2148,8 +2156,8 @@ void FreeMemorySvc (sWelsEncCtx** ppCtx) { · 252 unmodified lines
21482156 FreeMbCache (&pSlice->sMbCacheInfo, pMa);
21492157
21502158 //slice bs buffer
2151− if(NULL != pSlice->sSliceBs.pBs) {
2152− pMa->WelsFree(pSlice->sSliceBs.pBs,"sSliceBs.pBs");
2159+ if (NULL != pSlice->sSliceBs.pBs) {
2160+ pMa->WelsFree (pSlice->sSliceBs.pBs, "sSliceBs.pBs");
21532161 pSlice->sSliceBs.pBs = NULL;
21542162 }
21552163 ++ iSliceIdx;
@@ -2292,16 +2300,16 @@ int32_t InitSliceSettings (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodin · 136 unmodified lines
22922300 iMaxSliceCount = AVERSLICENUM_CONSTRAINT;
22932301 break; // go through for SM_SIZELIMITED_SLICE?
22942302 case SM_FIXEDSLCNUM_SLICE: {
2295− iReturn = SliceArgumentValidationFixedSliceMode(pLogCtx, &pDlp->sSliceArgument, pCodingParam->iRCMode,
2296− pDlp->iVideoWidth, pDlp->iVideoHeight);
2297− if(iReturn)
2303+ iReturn = SliceArgumentValidationFixedSliceMode (pLogCtx, &pDlp->sSliceArgument, pCodingParam->iRCMode,
2304+ pDlp->iVideoWidth, pDlp->iVideoHeight);
2305+ if (iReturn)
22982306 return ENC_RETURN_UNSUPPORTED_PARA;
22992307
23002308 if (pSliceArgument->uiSliceNum > iMaxSliceCount) {
23012309 iMaxSliceCount = pSliceArgument->uiSliceNum;
23022310 }
23032311 }
2304− break;
2312+ break;
23052313 case SM_SINGLE_SLICE:
23062314 if (pSliceArgument->uiSliceNum > iMaxSliceCount)
23072315 iMaxSliceCount = pSliceArgument->uiSliceNum;
@@ -2380,7 +2388,8 @@ void OutputCpuFeaturesLog (SLogContext* pLogCtx, uint32_t uiCpuFeatureFlags, uin · 72 unmodified lines
23802388 int32_t GetMultipleThreadIdc (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingParam, int16_t& iSliceNum,
23812389 int32_t& iCacheLineSize, uint32_t& uiCpuFeatureFlags) {
23822390 // for cpu features detection, Only detect once??
2383− int32_t uiCpuCores = 0; // number of logic processors on physical processor package, zero logic processors means HTT not supported
2391+ int32_t uiCpuCores =
2392+ 0; // number of logic processors on physical processor package, zero logic processors means HTT not supported
23842393 uiCpuFeatureFlags = WelsCPUFeatureDetect (&uiCpuCores); // detect cpu capacity features
23852394
23862395 #ifdef X86_ASM
@@ -2403,8 +2412,8 @@ int32_t GetMultipleThreadIdc (SLogContext* pLogCtx, SWelsSvcCodingParam* pCoding · 16 unmodified lines
24032412 uiCpuCores = DynamicDetectCpuCores();
24042413 }
24052414
2406− if(0 == pCodingParam->iMultipleThreadIdc)
2407− pCodingParam->iMultipleThreadIdc = (uiCpuCores > 0) ? uiCpuCores : 1;
2415+ if (0 == pCodingParam->iMultipleThreadIdc)
2416+ pCodingParam->iMultipleThreadIdc = (uiCpuCores > 0) ? uiCpuCores : 1;
24082417
24092418 // So far so many cpu cores up to MAX_THREADS_NUM mean for server platforms,
24102419 // for client application here it is constrained by maximal to MAX_THREADS_NUM
@@ -2673,7 +2682,7 @@ void DynslcUpdateMbNeighbourInfoListForAllSlices (SDqLayer* pCurDq, SMB* pMbList · 262 unmodified lines
26732682
26742683 do {
26752684 SMB* pMb = &pMbList[iIdx];
2676− UpdateMbNeighbor(pCurDq, pMb, kiMbWidth, WelsMbToSliceIdc (pCurDq, pMb->iMbXY));
2685+ UpdateMbNeighbor (pCurDq, pMb, kiMbWidth, WelsMbToSliceIdc (pCurDq, pMb->iMbXY));
26772686 ++ iIdx;
26782687 } while (iIdx <= kiEndMbInSlice);
26792688 }
@@ -2881,7 +2890,7 @@ void WelsInitCurrentLayer (sWelsEncCtx* pCtx, · 201 unmodified lines
28812890 }
28822891
28832892 if (pCtx->pTaskManage) {
2884− pCtx->pTaskManage->InitFrame(kiCurDid);
2893+ pCtx->pTaskManage->InitFrame (kiCurDid);
28852894 }
28862895 }
28872896
@@ -3045,7 +3054,7 @@ void PreprocessSliceCoding (sWelsEncCtx* pCtx) { · 157 unmodified lines
30453054 const int32_t kiCurTid = pCtx->uiTemporalId;
30463055 if (pCurLayer->bDeblockingParallelFlag && (pCurLayer->iLoopFilterDisableIdc != 1)
30473056 #if !defined(ENABLE_FRAME_DUMP)
3048− && ( NRI_PRI_LOWEST != pCtx->eNalPriority )
3057+ && (NRI_PRI_LOWEST != pCtx->eNalPriority)
30493058 && (pCtx->pSvcParam->sDependencyLayers[kiCurDid].iHighestTemporalId == 0
30503059 || kiCurTid < pCtx->pSvcParam->sDependencyLayers[kiCurDid].iHighestTemporalId)
30513060 #endif// !ENABLE_FRAME_DUMP
@@ -3658,7 +3667,7 @@ void StackBackEncoderStatus (sWelsEncCtx* pEncCtx, · 606 unmodified lines
36583667 pEncCtx->iPOC = (1 << pEncCtx->pSps->iLog2MaxPocLsb) - 2;
36593668 }
36603669
3661− LoadBackFrameNum(pEncCtx);
3670+ LoadBackFrameNum (pEncCtx);
36623671 pEncCtx->eNalType = NAL_UNIT_CODED_SLICE;
36633672 pEncCtx->eSliceType = P_SLICE;
36643673 //pEncCtx->eNalPriority = pEncCtx->eLastNalPriority; //not need this since eNalPriority will be updated at the beginning of coding a frame
@@ -3709,7 +3718,8 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 44 unmodified lines
37093718 int32_t iDidList[MAX_DEPENDENCY_LAYER] = {0};
37103719 int32_t iLayerNum = 0;
37113720 int32_t iLayerSize = 0;
3712− int32_t iSpatialNum = 0; // available count number of spatial layers due to frame size changed in this given frame
3721+ int32_t iSpatialNum =
3722+ 0; // available count number of spatial layers due to frame size changed in this given frame
37133723 int32_t iSpatialIdx = 0; // iIndex of spatial layers due to frame size changed in this given frame
37143724 int32_t iFrameSize = 0;
37153725 int32_t iNalIdxInLayer = 0;
@@ -3851,8 +3861,8 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 135 unmodified lines
38513861 iNalIdxInLayer = 0;
38523862 bAvcBased = ((pSvcParam->bSimulcastAVC) || (iCurDid == BASE_DEPENDENCY_ID));
38533863 pCtx->bNeedPrefixNalFlag = ((!pSvcParam->bSimulcastAVC) && (bAvcBased &&
3854− (pSvcParam->bPrefixNalAddingCtrl ||
3855− (pSvcParam->iSpatialLayerNum > 1))));
3864+ (pSvcParam->bPrefixNalAddingCtrl ||
3865+ (pSvcParam->iSpatialLayerNum > 1))));
38563866
38573867 if (eFrameType == videoFrameTypeP) {
38583868 eNalType = bAvcBased ? NAL_UNIT_CODED_SLICE : NAL_UNIT_CODED_SLICE_EXT;
@@ -4009,7 +4019,8 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 150 unmodified lines
40094019 #else
40104020 int32_t iEndMbIdx = pCtx->pCurDqLayer->sSliceEncCtx.iMbNumInFrame;
40114021 for (int32_t iIdx = kiPartitionCnt - 1; iIdx >= 0; --iIdx) {
4012− const int32_t iFirstMbIdx = pCtx->pCurDqLayer->sLayerInfo.pSliceInLayer[iIdx].sSliceHeaderExt.sSliceHeader.iFirstMbInSlice;
4022+ const int32_t iFirstMbIdx =
4023+ pCtx->pCurDqLayer->sLayerInfo.pSliceInLayer[iIdx].sSliceHeaderExt.sSliceHeader.iFirstMbInSlice;
40134024 pCtx->pSliceThreading->pThreadPEncCtx[iIdx].iStartMbIndex = iFirstMbIdx;
40144025 pCtx->pSliceThreading->pThreadPEncCtx[iIdx].iEndMbIndex = iEndMbIdx;
40154026 iEndMbIdx = iFirstMbIdx;
@@ -4109,7 +4120,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 93 unmodified lines
41094120 pCtx->pFuncList->pfRc.pfWelsUpdateBufferWhenSkip (pCtx, iSpatialNum);
41104121 }
41114122
4112− WelsRcPostFrameSkippedUpdate(pCtx, iCurDid);
4123+ WelsRcPostFrameSkippedUpdate (pCtx, iCurDid);
41134124 WelsLog (& (pCtx->sLogCtx), WELS_LOG_INFO,
41144125 "[Rc] Frame timestamp = %lld, skip one frame due to post skip, continual skipped %d frames",
41154126 pSrcPic->uiTimeStamp, pCtx->iContinualSkipFrames);
@@ -4432,18 +4443,18 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa · 316 unmodified lines
44324443 /* Decide whether need reset for IDR frame based on adjusting prarameters changed */
44334444 /* Temporal levels, spatial settings and/ or quality settings changed need update parameter sets related. */
44344445 bNeedReset = (pOldParam == NULL) ||
4435− (pOldParam->bSimulcastAVC != pNewParam->bSimulcastAVC) ||
4436− (pOldParam->iSpatialLayerNum != pNewParam->iSpatialLayerNum) ||
4437− (pOldParam->iPicWidth != pNewParam->iPicWidth
4438− || pOldParam->iPicHeight != pNewParam->iPicHeight) ||
4439− (pOldParam->SUsedPicRect.iWidth != pNewParam->SUsedPicRect.iWidth
4440− || pOldParam->SUsedPicRect.iHeight != pNewParam->SUsedPicRect.iHeight) ||
4441− (pOldParam->bEnableLongTermReference != pNewParam->bEnableLongTermReference) ||
4442− (pOldParam->iLTRRefNum != pNewParam->iLTRRefNum) ||
4443− (pOldParam->iMultipleThreadIdc != pNewParam->iMultipleThreadIdc) ||
4444− (pOldParam->bEnableBackgroundDetection != pNewParam->bEnableBackgroundDetection) ||
4445− (pOldParam->bEnableAdaptiveQuant != pNewParam->bEnableAdaptiveQuant) ||
4446− (pOldParam->eSpsPpsIdStrategy != pNewParam->eSpsPpsIdStrategy);
4446+ (pOldParam->bSimulcastAVC != pNewParam->bSimulcastAVC) ||
4447+ (pOldParam->iSpatialLayerNum != pNewParam->iSpatialLayerNum) ||
4448+ (pOldParam->iPicWidth != pNewParam->iPicWidth
4449+ || pOldParam->iPicHeight != pNewParam->iPicHeight) ||
4450+ (pOldParam->SUsedPicRect.iWidth != pNewParam->SUsedPicRect.iWidth
4451+ || pOldParam->SUsedPicRect.iHeight != pNewParam->SUsedPicRect.iHeight) ||
4452+ (pOldParam->bEnableLongTermReference != pNewParam->bEnableLongTermReference) ||
4453+ (pOldParam->iLTRRefNum != pNewParam->iLTRRefNum) ||
4454+ (pOldParam->iMultipleThreadIdc != pNewParam->iMultipleThreadIdc) ||
4455+ (pOldParam->bEnableBackgroundDetection != pNewParam->bEnableBackgroundDetection) ||
4456+ (pOldParam->bEnableAdaptiveQuant != pNewParam->bEnableAdaptiveQuant) ||
4457+ (pOldParam->eSpsPpsIdStrategy != pNewParam->eSpsPpsIdStrategy);
44474458 if (pNewParam->iMaxNumRefFrame > pOldParam->iMaxNumRefFrame) {
44484459 bNeedReset = true;
44494460 }
@@ -4466,7 +4477,8 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa · 16 unmodified lines
44664477 break;
44674478 }
44684479
4469− if (pOldParam->sSpatialLayers[iIndexD].sSliceArgument.uiSliceMode != pNewParam->sSpatialLayers[iIndexD].sSliceArgument.uiSliceMode
4480+ if (pOldParam->sSpatialLayers[iIndexD].sSliceArgument.uiSliceMode !=
4481+ pNewParam->sSpatialLayers[iIndexD].sSliceArgument.uiSliceMode
44704482 ||
44714483 pOldParam->sSpatialLayers[iIndexD].sSliceArgument.uiSliceNum !=
44724484 pNewParam->sSpatialLayers[iIndexD].sSliceArgument.uiSliceNum) {
@@ -4571,8 +4583,8 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa · 98 unmodified lines
45714583 } else {
45724584 /* maybe adjustment introduced in bitrate or little settings adjustment and so on.. */
45734585 pNewParam->iNumRefFrame = WELS_CLIP3 (pNewParam->iNumRefFrame, MIN_REF_PIC_COUNT,
4574− (pNewParam->iUsageType == CAMERA_VIDEO_REAL_TIME ? MAX_REFERENCE_PICTURE_COUNT_NUM_CAMERA :
4575− MAX_REFERENCE_PICTURE_COUNT_NUM_SCREEN));
4586+ (pNewParam->iUsageType == CAMERA_VIDEO_REAL_TIME ? MAX_REFERENCE_PICTURE_COUNT_NUM_CAMERA :
4587+ MAX_REFERENCE_PICTURE_COUNT_NUM_SCREEN));
45764588 pNewParam->iLoopFilterDisableIdc = WELS_CLIP3 (pNewParam->iLoopFilterDisableIdc, 0, 6);
45774589 pNewParam->iLoopFilterAlphaC0Offset = WELS_CLIP3 (pNewParam->iLoopFilterAlphaC0Offset, -6, 6);
45784590 pNewParam->iLoopFilterBetaOffset = WELS_CLIP3 (pNewParam->iLoopFilterBetaOffset, -6, 6);
@@ -4612,13 +4624,16 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa · 33 unmodified lines
46124624 /* Motion search */
46134625
46144626 /* Deblocking loop filter */
4615− pOldParam->iLoopFilterDisableIdc = pNewParam->iLoopFilterDisableIdc; // 0: on, 1: off, 2: on except for slice boundaries
4627+ pOldParam->iLoopFilterDisableIdc =
4628+ pNewParam->iLoopFilterDisableIdc; // 0: on, 1: off, 2: on except for slice boundaries
46164629 pOldParam->iLoopFilterAlphaC0Offset = pNewParam->iLoopFilterAlphaC0Offset;// AlphaOffset: valid range [-6, 6], default 0
4617− pOldParam->iLoopFilterBetaOffset = pNewParam->iLoopFilterBetaOffset; // BetaOffset: valid range [-6, 6], default 0
4630+ pOldParam->iLoopFilterBetaOffset =
4631+ pNewParam->iLoopFilterBetaOffset; // BetaOffset: valid range [-6, 6], default 0
46184632
46194633 /* Rate Control */
46204634 pOldParam->iRCMode = pNewParam->iRCMode;
4621− pOldParam->iTargetBitrate = pNewParam->iTargetBitrate; // overall target bitrate introduced in RC module
4635+ pOldParam->iTargetBitrate =
4636+ pNewParam->iTargetBitrate; // overall target bitrate introduced in RC module
46224637 pOldParam->iPaddingFlag = pNewParam->iPaddingFlag;
46234638
46244639 /* Layer definition */
@@ -4637,7 +4652,8 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa · 12 unmodified lines
46374652 pOldDlpInternal->fOutputFrameRate = pNewDlpInternal->fOutputFrameRate; // output frame rate
46384653 pOldDlp->iSpatialBitrate = pNewDlp->iSpatialBitrate;
46394654
4640− pOldDlp->uiProfileIdc = pNewDlp->uiProfileIdc; // value of profile IDC (0 for auto-detection)
4655+ pOldDlp->uiProfileIdc =
4656+ pNewDlp->uiProfileIdc; // value of profile IDC (0 for auto-detection)
46414657 pOldDlp->iDLayerQp = pNewDlp->iDLayerQp;
46424658
46434659 /* Derived variants below */
@@ -4679,7 +4695,7 @@ int32_t WelsEncoderApplyLTR (SLogContext* pLogCtx, sWelsEncCtx** ppCtx, SLTRConf · 35 unmodified lines
46794695 sConfig.iLTRRefNum = 0;
46804696 }
46814697 iNumRefFrame = ((uiGopSize >> 1) > 1) ? ((uiGopSize >> 1) + sConfig.iLTRRefNum) : (MIN_REF_PIC_COUNT +
4682− sConfig.iLTRRefNum);
4698+ sConfig.iLTRRefNum);
46834699 iNumRefFrame = WELS_CLIP3 (iNumRefFrame, MIN_REF_PIC_COUNT, MAX_REFERENCE_PICTURE_COUNT_NUM_CAMERA);
46844700
46854701 }
@@ -4794,13 +4810,14 @@ int32_t DynSliceRealloc (sWelsEncCtx* pCtx, · 108 unmodified lines
47944810 uiSliceIdx = iMaxSliceNumOld;
47954811 SRCSlicing* pSORC = &pSlcingOverRc[uiSliceIdx];
47964812 const int32_t kiBitsPerMb = WELS_DIV_ROUND (pCtx->pWelsSvcRc[kiCurDid].iTargetBits * INT_MULTIPLY,
4797− pCtx->pWelsSvcRc[kiCurDid].iNumberMbFrame);
4813+ pCtx->pWelsSvcRc[kiCurDid].iNumberMbFrame);
47984814 while (uiSliceIdx < iMaxSliceNum) {
47994815 pSORC->iComplexityIndexSlice = 0;
48004816 pSORC->iCalculatedQpSlice = pCtx->iGlobalQp;
48014817 pSORC->iTotalQpSlice = 0;
48024818 pSORC->iTotalMbSlice = 0;
4803− pSORC->iTargetBitsSlice = WELS_DIV_ROUND (kiBitsPerMb * pCurLayer->sLayerInfo.pSliceInLayer[uiSliceIdx].iCountMbNumInSlice,
4819+ pSORC->iTargetBitsSlice = WELS_DIV_ROUND (kiBitsPerMb *
4820+ pCurLayer->sLayerInfo.pSliceInLayer[uiSliceIdx].iCountMbNumInSlice,
48044821 INT_MULTIPLY);
48054822 pSORC->iFrameBitsSlice = 0;
48064823 pSORC->iGomBitsSlice = 0;
@@ -4845,7 +4862,8 @@ int32_t WelsCodeOnePicPartition (sWelsEncCtx* pCtx, · 38 unmodified lines
48454862 //init
48464863 {
48474864 pStartSlice->sSliceHeaderExt.sSliceHeader.iFirstMbInSlice = iFirstMbInPartition;
4848− pCurLayer->pNumSliceCodedOfPartition[kiPartitionId] = 1; // one slice per partition intialized, dynamic slicing inside
4865+ pCurLayer->pNumSliceCodedOfPartition[kiPartitionId] =
4866+ 1; // one slice per partition intialized, dynamic slicing inside
48494867 pCurLayer->pLastMbIdxOfPartition[kiPartitionId] = iEndMbInPartition - 1;
48504868 }
48514869 pCurLayer->pLastCodedMbIdxOfPartition[kiPartitionId] = 0;

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