History

format update by using astyle

ruil2 committed 12 years ago

Commit 044af8f1 parent 36c7b551 file · +51 −44Browse files

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

Unified · Split

codec/encoder/core/src/encoder_ext.cpp+51−44
@@ -1287,7 +1287,8 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx) { · 1286 unmodified lines
12871287
12881288 fCompressRatioThr = COMPRESS_RATIO_THR;
12891289
1290− iLayerBsSize = WELS_ROUND (((3 * fDlp->iFrameWidth * fDlp->iFrameHeight) >> 1) * fCompressRatioThr) + MAX_MACROBLOCK_SIZE_IN_BYTE;
1290+ iLayerBsSize = WELS_ROUND (((3 * fDlp->iFrameWidth * fDlp->iFrameHeight) >> 1) * fCompressRatioThr) +
1291+ MAX_MACROBLOCK_SIZE_IN_BYTE;
12911292 iLayerBsSize = WELS_ALIGN (iLayerBsSize, 4); // 4 bytes alinged
12921293 iVclLayersBsSizeCount += iLayerBsSize;
12931294 ++ iIndex;
@@ -1305,8 +1306,8 @@ int32_t RequestMemorySvc (sWelsEncCtx** ppCtx) { · 11 unmodified lines
13051306 (*ppCtx)->pOut->uiSize = iCountBsLen;
13061307 (*ppCtx)->pOut->sNalList = (SWelsNalRaw*)pMa->WelsMalloc (iCountNals * sizeof (SWelsNalRaw), "pOut->sNalList");
13071308 WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pOut->sNalList), FreeMemorySvc (ppCtx))
1308− (*ppCtx)->pOut->pNalLen = (int32_t*)pMa->WelsMallocz(iCountNals * sizeof (int32_t), "pOut->pNalLen");
1309− WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pOut->pNalLen), FreeMemorySvc(ppCtx))
1309+ (*ppCtx)->pOut->pNalLen = (int32_t*)pMa->WelsMallocz (iCountNals * sizeof (int32_t), "pOut->pNalLen");
1310+ WELS_VERIFY_RETURN_PROC_IF (1, (NULL == (*ppCtx)->pOut->pNalLen), FreeMemorySvc (ppCtx))
13101311 (*ppCtx)->pOut->iCountNals = iCountNals;
13111312 (*ppCtx)->pOut->iNalIndex = 0;
13121313
@@ -1504,7 +1505,7 @@ void FreeMemorySvc (sWelsEncCtx** ppCtx) { · 191 unmodified lines
15041505 // NALs len
15051506 if (NULL != pCtx->pOut->pNalLen) {
15061507 pMa->WelsFree (pCtx->pOut->pNalLen, "pOut->pNalLen");
1507− pCtx->pOut->pNalLen = NULL;
1508+ pCtx->pOut->pNalLen = NULL;
15081509 }
15091510 pMa->WelsFree (pCtx->pOut, "SWelsEncoderOutput");
15101511 pCtx->pOut = NULL;
@@ -3090,7 +3091,8 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 1579 unmodified lines
30903091 int32_t iPayloadSize = 0;
30913092
30923093 if (pCtx->bNeedPrefixNalFlag) {
3093− pCtx->iEncoderError = AddPrefixNal (pCtx, pLayerBsInfo, &pLayerBsInfo->pNalLengthInByte[0], &iNalIdxInLayer, eNalType, eNalRefIdc,
3094+ pCtx->iEncoderError = AddPrefixNal (pCtx, pLayerBsInfo, &pLayerBsInfo->pNalLengthInByte[0], &iNalIdxInLayer, eNalType,
3095+ eNalRefIdc,
30943096 iPayloadSize);
30953097 WELS_VERIFY_RETURN_IFNEQ (pCtx->iEncoderError, ENC_RETURN_SUCCESS)
30963098 iLayerSize += iPayloadSize;
@@ -3123,7 +3125,8 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 26 unmodified lines
31233125 // for dynamic slicing single threading..
31243126 else if ((SM_DYN_SLICE == pParam->sSliceCfg.uiSliceMode) && (pSvcParam->iMultipleThreadIdc <= 1)) {
31253127 const int32_t kiLastMbInFrame = pCtx->pCurDqLayer->pSliceEncCtx->iMbNumInFrame;
3126− pCtx->iEncoderError = WelsCodeOnePicPartition (pCtx, pFbi, pLayerBsInfo, &iNalIdxInLayer, &iLayerSize, 0, kiLastMbInFrame, 0);
3128+ pCtx->iEncoderError = WelsCodeOnePicPartition (pCtx, pFbi, pLayerBsInfo, &iNalIdxInLayer, &iLayerSize, 0,
3129+ kiLastMbInFrame, 0);
31273130 WELS_VERIFY_RETURN_IFNEQ (pCtx->iEncoderError, ENC_RETURN_SUCCESS)
31283131 } else {
31293132 //other multi-slice uiSliceMode
@@ -3260,7 +3263,8 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 130 unmodified lines
32603263 int32_t iSliceSize = 0;
32613264 int32_t iPayloadSize = 0;
32623265 if (bNeedPrefix) {
3263− pCtx->iEncoderError = AddPrefixNal (pCtx, pLayerBsInfo, &pLayerBsInfo->pNalLengthInByte[0], &iNalIdxInLayer, eNalType, eNalRefIdc,
3266+ pCtx->iEncoderError = AddPrefixNal (pCtx, pLayerBsInfo, &pLayerBsInfo->pNalLengthInByte[0], &iNalIdxInLayer, eNalType,
3267+ eNalRefIdc,
32643268 iPayloadSize);
32653269 WELS_VERIFY_RETURN_IFNEQ (pCtx->iEncoderError, ENC_RETURN_SUCCESS)
32663270 iLayerSize += iPayloadSize;
@@ -3686,9 +3690,9 @@ int32_t WelsEncoderParamAdjust (sWelsEncCtx** ppCtx, SWelsSvcCodingParam* pNewPa · 419 unmodified lines
36863690 return 0;
36873691 }
36883692
3689−int32_t DynSliceRealloc(sWelsEncCtx* pCtx,
3690− SFrameBSInfo* pFrameBsInfo,
3691− SLayerBSInfo* pLayerBsInfo) {
3693+int32_t DynSliceRealloc (sWelsEncCtx* pCtx,
3694+ SFrameBSInfo* pFrameBsInfo,
3695+ SLayerBSInfo* pLayerBsInfo) {
36923696 CMemoryAlign* pMA = pCtx->pMemAlign;
36933697 SDqLayer* pCurLayer = pCtx->pCurDqLayer;
36943698
@@ -3698,22 +3702,22 @@ int32_t DynSliceRealloc(sWelsEncCtx* pCtx, · 3 unmodified lines
36983702 iCountNals += iMaxSliceNum * (pCtx->pSvcParam->iSpatialLayerNum + pCtx->bNeedPrefixNalFlag);
36993703 iMaxSliceNum *= SLICE_NUM_EXPAND_COEF;
37003704
3701− SWelsNalRaw* pNalList = (SWelsNalRaw*)pMA->WelsMalloc(iCountNals * sizeof(SWelsNalRaw), "pOut->sNalList");
3705+ SWelsNalRaw* pNalList = (SWelsNalRaw*)pMA->WelsMalloc (iCountNals * sizeof (SWelsNalRaw), "pOut->sNalList");
37023706 if (NULL == pNalList)
37033707 return ENC_RETURN_MEMALLOCERR;
3704− memcpy(pNalList, pCtx->pOut->sNalList, sizeof(SWelsNalRaw) * pCtx->pOut->iCountNals);
3705− pMA->WelsFree(pCtx->pOut->sNalList, "pOut->sNalList");
3708+ memcpy (pNalList, pCtx->pOut->sNalList, sizeof (SWelsNalRaw) * pCtx->pOut->iCountNals);
3709+ pMA->WelsFree (pCtx->pOut->sNalList, "pOut->sNalList");
37063710 pCtx->pOut->sNalList = pNalList;
37073711
3708− int32_t* pNalLen = (int32_t*)pMA->WelsMalloc(iCountNals * sizeof(int32_t), "pOut->pNalLen");
3712+ int32_t* pNalLen = (int32_t*)pMA->WelsMalloc (iCountNals * sizeof (int32_t), "pOut->pNalLen");
37093713 if (NULL == pNalLen)
37103714 return ENC_RETURN_MEMALLOCERR;
3711− memcpy(pNalLen, pCtx->pOut->pNalLen, sizeof(int32_t) * pCtx->pOut->iCountNals);
3712− pMA->WelsFree(pCtx->pOut->pNalLen, "pOut->pNalLen");
3715+ memcpy (pNalLen, pCtx->pOut->pNalLen, sizeof (int32_t) * pCtx->pOut->iCountNals);
3716+ pMA->WelsFree (pCtx->pOut->pNalLen, "pOut->pNalLen");
37133717 pCtx->pOut->pNalLen = pNalLen;
37143718
37153719 pCtx->pOut->iCountNals = iCountNals;
3716− SLayerBSInfo *pLBI1, *pLBI2;
3720+ SLayerBSInfo* pLBI1, *pLBI2;
37173721 pLBI1 = &pFrameBsInfo->sLayerInfo[0];
37183722 pLBI1->pNalLengthInByte = pCtx->pOut->pNalLen;
37193723 while (pLBI1 != pLayerBsInfo) {
@@ -3722,23 +3726,23 @@ int32_t DynSliceRealloc(sWelsEncCtx* pCtx, · 2 unmodified lines
37223726 pLBI1->pNalLengthInByte = pLBI2->pNalLengthInByte + pLBI2->iNalCount;
37233727 }
37243728
3725− SSlice *pSlice = (SSlice*)pMA->WelsMallocz( sizeof(SSlice) * iMaxSliceNum, "Slice");
3729+ SSlice* pSlice = (SSlice*)pMA->WelsMallocz (sizeof (SSlice) * iMaxSliceNum, "Slice");
37263730 if (NULL == pSlice)
37273731 return ENC_RETURN_MEMALLOCERR;
3728− memcpy(pSlice, pCurLayer->sLayerInfo.pSliceInLayer, sizeof(SSlice) * iMaxSliceNumOld);
3732+ memcpy (pSlice, pCurLayer->sLayerInfo.pSliceInLayer, sizeof (SSlice) * iMaxSliceNumOld);
37293733 uint32_t uiSliceIdx;
37303734 uiSliceIdx = iMaxSliceNumOld;
3731− SSlice *pBaseSlice = &pCurLayer->sLayerInfo.pSliceInLayer[0];
3732− SSliceHeaderExt *pBaseSHExt = &pBaseSlice->sSliceHeaderExt;
3733− SSlice *pSliceIdx = &pSlice[uiSliceIdx];
3735+ SSlice* pBaseSlice = &pCurLayer->sLayerInfo.pSliceInLayer[0];
3736+ SSliceHeaderExt* pBaseSHExt = &pBaseSlice->sSliceHeaderExt;
3737+ SSlice* pSliceIdx = &pSlice[uiSliceIdx];
37343738 while (uiSliceIdx < iMaxSliceNum) {
3735− SSliceHeaderExt *pSHExt = &pSliceIdx->sSliceHeaderExt;
3739+ SSliceHeaderExt* pSHExt = &pSliceIdx->sSliceHeaderExt;
37363740 pSliceIdx->uiSliceIdx = uiSliceIdx;
37373741 if (pCtx->pSvcParam->iMultipleThreadIdc > 1)
37383742 pSliceIdx->pSliceBsa = &pCtx->pSliceBs[uiSliceIdx].sBsWrite;
37393743 else
37403744 pSliceIdx->pSliceBsa = &pCtx->pOut->sBsWrite;
3741− if (AllocMbCacheAligned(&pSliceIdx->sMbCacheInfo, pMA))
3745+ if (AllocMbCacheAligned (&pSliceIdx->sMbCacheInfo, pMA))
37423746 return ENC_RETURN_MEMALLOCERR;
37433747
37443748 pSliceIdx->bSliceHeaderExtFlag = pBaseSlice->bSliceHeaderExtFlag;
@@ -3747,48 +3751,50 @@ int32_t DynSliceRealloc(sWelsEncCtx* pCtx, · 2 unmodified lines
37473751 pSHExt->sSliceHeader.iSpsId = pBaseSHExt->sSliceHeader.iSpsId;
37483752 pSHExt->sSliceHeader.pSps = pBaseSHExt->sSliceHeader.pSps;
37493753 pSHExt->sSliceHeader.uiRefCount = pCtx->iNumRef0;
3750− memcpy(&pSHExt->sSliceHeader.sRefMarking, &pBaseSHExt->sSliceHeader.sRefMarking, sizeof(SRefPicMarking));
3751− memcpy(&pSHExt->sSliceHeader.sRefReordering, &pBaseSHExt->sSliceHeader.sRefReordering, sizeof(SRefPicListReorderSyntax));
3754+ memcpy (&pSHExt->sSliceHeader.sRefMarking, &pBaseSHExt->sSliceHeader.sRefMarking, sizeof (SRefPicMarking));
3755+ memcpy (&pSHExt->sSliceHeader.sRefReordering, &pBaseSHExt->sSliceHeader.sRefReordering,
3756+ sizeof (SRefPicListReorderSyntax));
37523757
37533758 pSliceIdx++;
37543759 uiSliceIdx++;
3755− }
3756− pMA->WelsFree(pCurLayer->sLayerInfo.pSliceInLayer, "Slice");
3760+ }
3761+ pMA->WelsFree (pCurLayer->sLayerInfo.pSliceInLayer, "Slice");
37573762 pCurLayer->sLayerInfo.pSliceInLayer = pSlice;
37583763
3759− SRCSlicing *pSlcingOverRc = (SRCSlicing *)pMA->WelsMalloc(iMaxSliceNum * sizeof(SRCSlicing), "SlicingOverRC");
3764+ SRCSlicing* pSlcingOverRc = (SRCSlicing*)pMA->WelsMalloc (iMaxSliceNum * sizeof (SRCSlicing), "SlicingOverRC");
37603765 if (NULL == pSlcingOverRc)
37613766 return ENC_RETURN_MEMALLOCERR;
3762− memcpy(pSlcingOverRc, pCtx->pWelsSvcRc->pSlicingOverRc, sizeof(SRCSlicing) * iMaxSliceNumOld);
3767+ memcpy (pSlcingOverRc, pCtx->pWelsSvcRc->pSlicingOverRc, sizeof (SRCSlicing) * iMaxSliceNumOld);
37633768 uiSliceIdx = iMaxSliceNumOld;
3764− SRCSlicing *pSORC = &pSlcingOverRc[uiSliceIdx];
3769+ SRCSlicing* pSORC = &pSlcingOverRc[uiSliceIdx];
37653770 while (uiSliceIdx < iMaxSliceNum) {
37663771 pSORC->iComplexityIndexSlice = 0;
37673772 pSORC->iCalculatedQpSlice = pCtx->iGlobalQp;
37683773 pSORC ++;
37693774 uiSliceIdx ++;
37703775 }
3771− pMA->WelsFree(pCtx->pWelsSvcRc->pSlicingOverRc, "SlicingOverRC");
3776+ pMA->WelsFree (pCtx->pWelsSvcRc->pSlicingOverRc, "SlicingOverRC");
37723777 pCtx->pWelsSvcRc->pSlicingOverRc = pSlcingOverRc;
37733778
3774− int16_t *pFirstMbInSlice = (int16_t *)pMA->WelsMalloc(iMaxSliceNum * sizeof(int16_t), "pSliceSeg->pFirstMbInSlice");
3779+ int16_t* pFirstMbInSlice = (int16_t*)pMA->WelsMalloc (iMaxSliceNum * sizeof (int16_t), "pSliceSeg->pFirstMbInSlice");
37753780 if (NULL == pFirstMbInSlice)
37763781 return ENC_RETURN_MEMALLOCERR;
3777− memcpy(pFirstMbInSlice, pCurLayer->pSliceEncCtx->pFirstMbInSlice, sizeof(int16_t) * iMaxSliceNumOld);
3778− pMA->WelsFree(pCurLayer->pSliceEncCtx->pFirstMbInSlice, "pSliceSeg->pFirstMbInSlice");
3782+ memcpy (pFirstMbInSlice, pCurLayer->pSliceEncCtx->pFirstMbInSlice, sizeof (int16_t) * iMaxSliceNumOld);
3783+ pMA->WelsFree (pCurLayer->pSliceEncCtx->pFirstMbInSlice, "pSliceSeg->pFirstMbInSlice");
37793784 pCurLayer->pSliceEncCtx->pFirstMbInSlice = pFirstMbInSlice;
37803785
3781− int32_t *pCountMbNumInSlice = (int32_t *)pMA->WelsMalloc(iMaxSliceNum * sizeof(int32_t), "pSliceSeg->pCountMbNumInSlice");
3786+ int32_t* pCountMbNumInSlice = (int32_t*)pMA->WelsMalloc (iMaxSliceNum * sizeof (int32_t),
3787+ "pSliceSeg->pCountMbNumInSlice");
37823788 if (NULL == pCountMbNumInSlice)
37833789 return ENC_RETURN_MEMALLOCERR;
3784− memcpy(pCountMbNumInSlice, pCurLayer->pSliceEncCtx->pCountMbNumInSlice, sizeof(int32_t) * iMaxSliceNumOld);
3785− pMA->WelsFree(pCurLayer->pSliceEncCtx->pCountMbNumInSlice, "pSliceSeg->pCountMbNumInSlice");
3790+ memcpy (pCountMbNumInSlice, pCurLayer->pSliceEncCtx->pCountMbNumInSlice, sizeof (int32_t) * iMaxSliceNumOld);
3791+ pMA->WelsFree (pCurLayer->pSliceEncCtx->pCountMbNumInSlice, "pSliceSeg->pCountMbNumInSlice");
37863792 pCurLayer->pSliceEncCtx->pCountMbNumInSlice = pCountMbNumInSlice;
37873793
37883794 if (pCtx->iMaxSliceCount < iMaxSliceNum)
37893795 pCtx->iMaxSliceCount = iMaxSliceNum;
37903796 pCurLayer->pSliceEncCtx->iMaxSliceNumConstraint = iMaxSliceNum;
3791− return ENC_RETURN_SUCCESS;
3797+ return ENC_RETURN_SUCCESS;
37923798 }
37933799 int32_t WelsCodeOnePicPartition (sWelsEncCtx* pCtx,
37943800 SFrameBSInfo* pFrameBSInfo,
@@ -3828,15 +3834,16 @@ int32_t WelsCodeOnePicPartition (sWelsEncCtx* pCtx, · 33 unmodified lines
38283834
38293835 if (iSliceIdx >= (pSliceCtx->iMaxSliceNumConstraint - kiSliceIdxStep)) { // insufficient memory in pSliceInLayer[]
38303836 if (pCtx->iActiveThreadsNum == 1)
3831− if (DynSliceRealloc(pCtx, pFrameBSInfo, pLayerBsInfo)) //only single thread support re-alloc now
3837+ if (DynSliceRealloc (pCtx, pFrameBSInfo, pLayerBsInfo)) //only single thread support re-alloc now
38323838 return ENC_RETURN_MEMALLOCERR;
3833− else if (iSliceIdx >= pSliceCtx->iMaxSliceNumConstraint) {
3834− return ENC_RETURN_MEMALLOCERR;
3835− }
3839+ else if (iSliceIdx >= pSliceCtx->iMaxSliceNumConstraint) {
3840+ return ENC_RETURN_MEMALLOCERR;
3841+ }
38363842 }
38373843
38383844 if (kbNeedPrefix) {
3839− iReturn = AddPrefixNal (pCtx, pLayerBsInfo, &pLayerBsInfo->pNalLengthInByte[0], &iNalIdxInLayer, keNalType, keNalRefIdc, iPayloadSize);
3845+ iReturn = AddPrefixNal (pCtx, pLayerBsInfo, &pLayerBsInfo->pNalLengthInByte[0], &iNalIdxInLayer, keNalType, keNalRefIdc,
3846+ iPayloadSize);
38403847 WELS_VERIFY_RETURN_IFNEQ (iReturn, ENC_RETURN_SUCCESS)
38413848 iPartitionBsSize += iPayloadSize;
38423849 }

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