History

rename some varialbes

ruil2 committed 12 years ago

Commit 0520ace1 parent 75aa8e52 files · +48 −48Browse 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+47−47
@@ -2832,7 +2832,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 2831 unmodified lines
28322832 SPicture* fsnr = NULL;
28332833 #endif//ENABLE_FRAME_DUMP || ENABLE_PSNR_CALC
28342834 SPicture* pEncPic = NULL; // to be decided later
2835− int32_t did_list[MAX_DEPENDENCY_LAYER] = {0};
2835+ int32_t iDidList[MAX_DEPENDENCY_LAYER] = {0};
28362836 int32_t iLayerNum = 0;
28372837 int32_t iLayerSize = 0;
28382838 int32_t iSpatialNum = 0; // available count number of spatial layers due to frame size changed in this given frame
@@ -2850,7 +2850,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 11 unmodified lines
28502850 int8_t iCurTid = 0;
28512851 bool bAvcBased = false;
28522852 #if defined(ENABLE_PSNR_CALC)
2853− float snr_y = .0f, snr_u = .0f, snr_v = .0f;
2853+ float fSnrY = .0f, fSnrU = .0f, fSnrV = .0f;
28542854 #endif//ENABLE_PSNR_CALC
28552855
28562856 #if defined(_DEBUG)
@@ -2909,24 +2909,24 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 52 unmodified lines
29092909 pCtx->pCurDqLayer->pRefLayer = NULL;
29102910
29112911 while (iSpatialIdx < iSpatialNum) {
2912− const int32_t d_idx = (pSpatialIndexMap + iSpatialIdx)->iDid; // get iDid
2913− SDLayerParam* param_d = &pSvcParam->sDependencyLayers[d_idx];
2912+ const int32_t iDidIdx = (pSpatialIndexMap + iSpatialIdx)->iDid; // get iDid
2913+ SDLayerParam* pParam = &pSvcParam->sDependencyLayers[iDidIdx];
29142914
2915− pCtx->uiDependencyId = iCurDid = (int8_t)d_idx;
2916− pCtx->pVpp->AnalyzeSpatialPic (pCtx, d_idx);
2915+ pCtx->uiDependencyId = iCurDid = (int8_t)iDidIdx;
2916+ pCtx->pVpp->AnalyzeSpatialPic (pCtx, iDidIdx);
29172917
29182918 pCtx->pEncPic = pEncPic = (pSpatialIndexMap + iSpatialIdx)->pSrc;
29192919 pCtx->pEncPic->iPictureType = pCtx->eSliceType;
29202920 pCtx->pEncPic->iFramePoc = pCtx->iPOC;
29212921
2922− iCurWidth = param_d->iFrameWidth;
2923− iCurHeight = param_d->iFrameHeight;
2922+ iCurWidth = pParam->iFrameWidth;
2923+ iCurHeight = pParam->iFrameHeight;
29242924
2925− did_list[iSpatialIdx] = iCurDid;
2925+ iDidList[iSpatialIdx] = iCurDid;
29262926
29272927 // Encoding this picture might mulitiple sQualityStat layers potentially be encoded as followed
29282928
2929− switch (param_d->sSliceCfg.uiSliceMode) {
2929+ switch (pParam->sSliceCfg.uiSliceMode) {
29302930 case SM_FIXEDSLCNUM_SLICE:
29312931 case SM_AUTO_SLICE: {
29322932 if ((iCurDid > 0) && (pSvcParam->iMultipleThreadIdc > 1) &&
@@ -3000,7 +3000,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 67 unmodified lines
30003000 return ENC_RETURN_CORRECTED;
30013001 }
30023002 #ifdef LONG_TERM_REF_DUMP
3003− dump_ref (pCtx);
3003+ DumpRef (pCtx);
30043004 #endif
30053005 if((pSvcParam->iUsageType == SCREEN_CONTENT_REAL_TIME)&&(pSvcParam->iRCMode != RC_OFF_MODE))
30063006 pCtx->pVpp->AnalyzePictureComplexity(pCtx,pCtx->pEncPic,((pCtx->eSliceType == P_SLICE)&&(pCtx->iNumRef0>0))?pCtx->pRefList0[0]:NULL,
@@ -3016,7 +3016,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 9 unmodified lines
30163016 //TODO Complexity Calculation here for screen content
30173017 iLayerSize = 0;
30183018
3019− if (SM_SINGLE_SLICE == param_d->sSliceCfg.uiSliceMode) { // only one slice within a sQualityStat layer
3019+ if (SM_SINGLE_SLICE == pParam->sSliceCfg.uiSliceMode) { // only one slice within a sQualityStat layer
30203020 int32_t iSliceSize = 0;
30213021 int32_t iPayloadSize = 0;
30223022
@@ -3053,20 +3053,20 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 30 unmodified lines
30533053 pLayerBsInfo->iNalCount = ++ iNalIdxInLayer;
30543054 }
30553055 // for dynamic slicing single threading..
3056− else if ((SM_DYN_SLICE == param_d->sSliceCfg.uiSliceMode) && (pSvcParam->iMultipleThreadIdc <= 1)) {
3056+ else if ((SM_DYN_SLICE == pParam->sSliceCfg.uiSliceMode) && (pSvcParam->iMultipleThreadIdc <= 1)) {
30573057 const int32_t kiLastMbInFrame = pCtx->pCurDqLayer->pSliceEncCtx->iMbNumInFrame;
30583058 pCtx->iEncoderError = WelsCodeOnePicPartition (pCtx, pLayerBsInfo, &iNalIdxInLayer, &iLayerSize, 0, kiLastMbInFrame, 0);
30593059 WELS_VERIFY_RETURN_IFNEQ (pCtx->iEncoderError, ENC_RETURN_SUCCESS)
30603060 } else {
30613061 //other multi-slice uiSliceMode
3062− int err = 0;
3062+ int32_t iRet = 0;
30633063 // THREAD_FULLY_FIRE_MODE/THREAD_PICK_UP_MODE for any mode of non-SM_DYN_SLICE
3064− if ((SM_DYN_SLICE != param_d->sSliceCfg.uiSliceMode) && (pSvcParam->iMultipleThreadIdc > 1)) {
3064+ if ((SM_DYN_SLICE != pParam->sSliceCfg.uiSliceMode) && (pSvcParam->iMultipleThreadIdc > 1)) {
30653065 iSliceCount = GetCurrentSliceNum (pCtx->pCurDqLayer->pSliceEncCtx);
30663066 if (iLayerNum + 1 >= MAX_LAYER_NUM_OF_FRAME) { // check available layer_bs_info for further writing as followed
30673067 WelsLog (pCtx, WELS_LOG_ERROR,
30683068 "WelsEncoderEncodeExt(), iLayerNum(%d) overflow(max:%d) at iDid= %d uiSliceMode= %d, iSliceCount= %d!",
3069− iLayerNum, MAX_LAYER_NUM_OF_FRAME, iCurDid, param_d->sSliceCfg.uiSliceMode, iSliceCount);
3069+ iLayerNum, MAX_LAYER_NUM_OF_FRAME, iCurDid, pParam->sSliceCfg.uiSliceMode, iSliceCount);
30703070 return ENC_RETURN_UNSUPPORTED_PARA;
30713071 }
30723072 if (iSliceCount <= 1) {
@@ -3083,13 +3083,13 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 10 unmodified lines
30833083
30843084 pCtx->iActiveThreadsNum = iSliceCount;
30853085 // to fire slice coding threads
3086− err = FiredSliceThreads (&pCtx->pSliceThreading->pThreadPEncCtx[0], &pCtx->pSliceThreading->pReadySliceCodingEvent[0],
3086+ iRet = FiredSliceThreads (&pCtx->pSliceThreading->pThreadPEncCtx[0], &pCtx->pSliceThreading->pReadySliceCodingEvent[0],
30873087 &pCtx->pSliceThreading->pThreadMasterEvent[0],
30883088 pLayerBsInfo, iSliceCount, pCtx->pCurDqLayer->pSliceEncCtx, false);
3089− if (err) {
3089+ if (iRet) {
30903090 WelsLog (pCtx, WELS_LOG_ERROR,
30913091 "[MT] WelsEncoderEncodeExt(), FiredSliceThreads return(%d) failed and exit encoding frame, iCountThreadsNum= %d, iSliceCount= %d, uiSliceMode= %d, iMultipleThreadIdc= %d!!\n",
3092− err, pSvcParam->iCountThreadsNum, iSliceCount, param_d->sSliceCfg.uiSliceMode, pSvcParam->iMultipleThreadIdc);
3092+ iRet, pSvcParam->iCountThreadsNum, iSliceCount, pParam->sSliceCfg.uiSliceMode, pSvcParam->iMultipleThreadIdc);
30933093 return ENC_RETURN_UNEXPECTED;
30943094 }
30953095
@@ -3122,13 +3122,13 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 26 unmodified lines
31223122 iNumThreadsScheduled = pCtx->iActiveThreadsNum;
31233123 iNumThreadsRunning = iNumThreadsScheduled;
31243124 // to fire slice coding threads
3125− err = FiredSliceThreads (&pCtx->pSliceThreading->pThreadPEncCtx[0], &pCtx->pSliceThreading->pReadySliceCodingEvent[0],
3125+ iRet = FiredSliceThreads (&pCtx->pSliceThreading->pThreadPEncCtx[0], &pCtx->pSliceThreading->pReadySliceCodingEvent[0],
31263126 &pCtx->pSliceThreading->pThreadMasterEvent[0],
31273127 pLayerBsInfo, iNumThreadsRunning, pCtx->pCurDqLayer->pSliceEncCtx, false);
3128− if (err) {
3128+ if (iRet) {
31293129 WelsLog (pCtx, WELS_LOG_ERROR,
31303130 "[MT] WelsEncoderEncodeExt(), FiredSliceThreads return(%d) failed and exit encoding frame, iCountThreadsNum= %d, iSliceCount= %d, uiSliceMode= %d, iMultipleThreadIdc= %d!!\n",
3131− err, pSvcParam->iCountThreadsNum, iSliceCount, param_d->sSliceCfg.uiSliceMode, pSvcParam->iMultipleThreadIdc);
3131+ iRet, pSvcParam->iCountThreadsNum, iSliceCount, pParam->sSliceCfg.uiSliceMode, pSvcParam->iMultipleThreadIdc);
31323132 return ENC_RETURN_UNEXPECTED;
31333133 }
31343134
@@ -3164,17 +3164,17 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 29 unmodified lines
31643164 }
31653165 }
31663166 // THREAD_FULLY_FIRE_MODE && SM_DYN_SLICE
3167− else if ((SM_DYN_SLICE == param_d->sSliceCfg.uiSliceMode) && (pSvcParam->iMultipleThreadIdc > 1)) {
3167+ else if ((SM_DYN_SLICE == pParam->sSliceCfg.uiSliceMode) && (pSvcParam->iMultipleThreadIdc > 1)) {
31683168 const int32_t kiPartitionCnt = pCtx->iActiveThreadsNum; //pSvcParam->iCountThreadsNum;
31693169
31703170 // to fire slice coding threads
3171− err = FiredSliceThreads (&pCtx->pSliceThreading->pThreadPEncCtx[0], &pCtx->pSliceThreading->pReadySliceCodingEvent[0],
3171+ iRet = FiredSliceThreads (&pCtx->pSliceThreading->pThreadPEncCtx[0], &pCtx->pSliceThreading->pReadySliceCodingEvent[0],
31723172 &pCtx->pSliceThreading->pThreadMasterEvent[0],
31733173 pLayerBsInfo, kiPartitionCnt, pCtx->pCurDqLayer->pSliceEncCtx, true);
3174− if (err) {
3174+ if (iRet) {
31753175 WelsLog (pCtx, WELS_LOG_ERROR,
31763176 "[MT] WelsEncoderEncodeExt(), FiredSliceThreads return(%d) failed and exit encoding frame, iCountThreadsNum= %d, iSliceCount= %d, uiSliceMode= %d, iMultipleThreadIdc= %d!!\n",
3177− err, pSvcParam->iCountThreadsNum, iSliceCount, param_d->sSliceCfg.uiSliceMode, pSvcParam->iMultipleThreadIdc);
3177+ iRet, pSvcParam->iCountThreadsNum, iSliceCount, pParam->sSliceCfg.uiSliceMode, pSvcParam->iMultipleThreadIdc);
31783178 return ENC_RETURN_UNEXPECTED;
31793179 }
31803180
@@ -3240,7 +3240,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 59 unmodified lines
32403240 if (
32413241 (!pCtx->pCurDqLayer->bDeblockingParallelFlag) &&
32423242 #if !defined(ENABLE_FRAME_DUMP)
3243− ((eNalRefIdc != NRI_PRI_LOWEST) && (param_d->iHighestTemporalId == 0 || iCurTid < param_d->iHighestTemporalId)) &&
3243+ ((eNalRefIdc != NRI_PRI_LOWEST) && (pParam->iHighestTemporalId == 0 || iCurTid < pParam->iHighestTemporalId)) &&
32443244 #endif//!ENABLE_FRAME_DUMP
32453245 true
32463246 ) {
@@ -3266,23 +3266,23 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 19 unmodified lines
32663266 #ifdef ENABLE_FRAME_DUMP
32673267 // Dump reconstruction picture for each sQualityStat layer
32683268 if (iCurDid + 1 < pSvcParam->iSpatialLayerNum)
3269− DumpDependencyRec (fsnr, &param_d->sRecFileName[0], iCurDid);
3269+ DumpDependencyRec (fsnr, &pParam->sRecFileName[0], iCurDid);
32703270 #endif//ENABLE_FRAME_DUMP
32713271
32723272 #if defined(ENABLE_PSNR_CALC)
3273− snr_y = WelsCalcPsnr (fsnr->pData[0],
3273+ fSnrY = WelsCalcPsnr (fsnr->pData[0],
32743274 fsnr->iLineSize[0],
32753275 pEncPic->pData[0],
32763276 pEncPic->iLineSize[0],
32773277 iCurWidth,
32783278 iCurHeight);
3279− snr_u = WelsCalcPsnr (fsnr->pData[1],
3279+ fSnrU = WelsCalcPsnr (fsnr->pData[1],
32803280 fsnr->iLineSize[1],
32813281 pEncPic->pData[1],
32823282 pEncPic->iLineSize[1],
32833283 (iCurWidth >> 1),
32843284 (iCurHeight >> 1));
3285− snr_v = WelsCalcPsnr (fsnr->pData[2],
3285+ fSnrV = WelsCalcPsnr (fsnr->pData[2],
32863286 fsnr->iLineSize[2],
32873287 pEncPic->pData[2],
32883288 pEncPic->iLineSize[2],
@@ -3300,9 +3300,9 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 11 unmodified lines
33003300 iCurDid,
33013301 0,
33023302 pCtx->pWelsSvcRc[pCtx->uiDependencyId].iAverageFrameQp,
3303− snr_y,
3304− snr_u,
3305− snr_v,
3303+ fSnrY,
3304+ fSnrU,
3305+ fSnrV,
33063306 (iLayerSize << 3));
33073307 #endif//LAYER_INFO_OUTPUT
33083308
@@ -3310,9 +3310,9 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 1 unmodified line
33103310
33113311 #if defined(ENABLE_PSNR_CALC)
33123312 {
3313− pCtx->sStatData[iCurDid][0].sQualityStat.rYPsnr[pCtx->eSliceType] += snr_y;
3314− pCtx->sStatData[iCurDid][0].sQualityStat.rUPsnr[pCtx->eSliceType] += snr_u;
3315− pCtx->sStatData[iCurDid][0].sQualityStat.rVPsnr[pCtx->eSliceType] += snr_v;
3313+ pCtx->sStatData[iCurDid][0].sQualityStat.rYPsnr[pCtx->eSliceType] += fSnrY;
3314+ pCtx->sStatData[iCurDid][0].sQualityStat.rUPsnr[pCtx->eSliceType] += fSnrU;
3315+ pCtx->sStatData[iCurDid][0].sQualityStat.rVPsnr[pCtx->eSliceType] += fSnrV;
33163316 }
33173317 #endif//ENABLE_PSNR_CALC
33183318
@@ -3378,9 +3378,9 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 59 unmodified lines
33783378 ++ iLayerNum;
33793379 }
33803380
3381− if ((param_d->sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE || param_d->sSliceCfg.uiSliceMode == SM_AUTO_SLICE)
3381+ if ((pParam->sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE || pParam->sSliceCfg.uiSliceMode == SM_AUTO_SLICE)
33823382 && pSvcParam->iMultipleThreadIdc > 1 &&
3383− pSvcParam->iMultipleThreadIdc >= param_d->sSliceCfg.sSliceArgument.uiSliceNum) {
3383+ pSvcParam->iMultipleThreadIdc >= pParam->sSliceCfg.sSliceArgument.uiSliceNum) {
33843384 CalcSliceComplexRatio (pCtx->pSliceThreading->pSliceComplexRatio[iCurDid], pCtx->pCurDqLayer->pSliceEncCtx,
33853385 pCtx->pSliceThreading->pSliceConsumeTime[iCurDid]);
33863386 #if defined(MT_DEBUG)
@@ -3396,10 +3396,10 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 9 unmodified lines
33963396
33973397 if (pSvcParam->bEnableLongTermReference && (pCtx->pLtr[pCtx->uiDependencyId].bLTRMarkingFlag
33983398 && (pCtx->pLtr[pCtx->uiDependencyId].iLTRMarkMode == LTR_DELAY_MARK))) {
3399− pCtx->bLongTermRefFlag[d_idx][0] = true;
3399+ pCtx->bLongTermRefFlag[iDidIdx][0] = true;
34003400 }
34013401
3402− if (pCtx->pVpp->UpdateSpatialPictures (pCtx, pSvcParam, iCurTid, d_idx) != 0) {
3402+ if (pCtx->pVpp->UpdateSpatialPictures (pCtx, pSvcParam, iCurTid, iDidIdx) != 0) {
34033403 ForceCodingIDR (pCtx);
34043404 WelsLog (pCtx, WELS_LOG_WARNING, "WelsEncoderEncodeExt(), Logic Error Found in temporal level. ForceCodingIDR!\n");
34053405 //the above is to set the next frame IDR
@@ -3409,21 +3409,21 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 3 unmodified lines
34093409
34103410 if (pSvcParam->bEnableLongTermReference && ((pCtx->pLtr[pCtx->uiDependencyId].bLTRMarkingFlag
34113411 && (pCtx->pLtr[pCtx->uiDependencyId].iLTRMarkMode == LTR_DIRECT_MARK)) || eFrameType == videoFrameTypeIDR)) {
3412− pCtx->bLongTermRefFlag[d_idx][iCurTid] = true;
3412+ pCtx->bLongTermRefFlag[iDidIdx][iCurTid] = true;
34133413 }
34143414 }
34153415
34163416 #if defined(MT_DEBUG)
3417− TrackSliceConsumeTime (pCtx, did_list, iSpatialNum);
3417+ TrackSliceConsumeTime (pCtx, iDidList, iSpatialNum);
34183418 #endif//MT_DEBUG
34193419
3420− if (pSvcParam->iMultipleThreadIdc > 1 && did_list[0] == BASE_DEPENDENCY_ID
3420+ if (pSvcParam->iMultipleThreadIdc > 1 && iDidList[0] == BASE_DEPENDENCY_ID
34213421 && ((pSvcParam->sDependencyLayers[0].sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE)
34223422 || (pSvcParam->sDependencyLayers[0].sSliceCfg.uiSliceMode == SM_AUTO_SLICE))
34233423 && pSvcParam->iMultipleThreadIdc >= pSvcParam->sDependencyLayers[0].sSliceCfg.sSliceArgument.uiSliceNum
3424− && ((pSvcParam->sDependencyLayers[did_list[iSpatialNum - 1]].sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE)
3425− || (pSvcParam->sDependencyLayers[did_list[iSpatialNum - 1]].sSliceCfg.uiSliceMode == SM_AUTO_SLICE))
3426− && pSvcParam->iMultipleThreadIdc >= pSvcParam->sDependencyLayers[did_list[iSpatialNum -
3424+ && ((pSvcParam->sDependencyLayers[iDidList[iSpatialNum - 1]].sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE)
3425+ || (pSvcParam->sDependencyLayers[iDidList[iSpatialNum - 1]].sSliceCfg.uiSliceMode == SM_AUTO_SLICE))
3426+ && pSvcParam->iMultipleThreadIdc >= pSvcParam->sDependencyLayers[iDidList[iSpatialNum -
34273427 1]].sSliceCfg.sSliceArgument.uiSliceNum) {
34283428 AdjustBaseLayer (pCtx);
34293429 }

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