History

add total length in encoder output and complete most of the statistis calculation

Sijia Chen committed 12 years ago

Commit b56b8721 parent aed7b236 files · +69 −13Browse files

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

Unified · Split

codec/encoder/core/src/encoder_ext.cpp+12−3
@@ -2736,7 +2736,7 @@ void ParasetIdAdditionIdAdjust (SParaSetOffsetVariable* sParaSetOffsetVariable, · 2735 unmodified lines
27362736 * \brief write all parameter sets introduced in SVC extension
27372737 * \return writing results, success or error
27382738 */
2739−int32_t WelsWriteParameterSets (sWelsEncCtx* pCtx, int32_t* pNalLen, int32_t* pNumNal) {
2739+int32_t WelsWriteParameterSets (sWelsEncCtx* pCtx, int32_t* pNalLen, int32_t* pNumNal, int32_t* pTotalLength) {
27402740 int32_t iSize = 0;
27412741 int32_t iNal = 0;
27422742 int32_t iIdx = 0;
@@ -2748,6 +2748,7 @@ int32_t WelsWriteParameterSets (sWelsEncCtx* pCtx, int32_t* pNalLen, int32_t* pN · 5 unmodified lines
27482748 if (NULL == pCtx || NULL == pNalLen || NULL == pNumNal)
27492749 return ENC_RETURN_UNEXPECTED;
27502750
2751+ *pTotalLength = 0;
27512752 /* write all SPS */
27522753 iIdx = 0;
27532754 while (iIdx < pCtx->iSpsNum) {
@@ -2834,6 +2835,7 @@ int32_t WelsWriteParameterSets (sWelsEncCtx* pCtx, int32_t* pNalLen, int32_t* pN · 80 unmodified lines
28342835 }
28352836
28362837 *pNumNal = iCountNal;
2838+ *pTotalLength = iSize;
28372839
28382840 return ENC_RETURN_SUCCESS;
28392841 }
@@ -2944,13 +2946,14 @@ int32_t WelsEncoderEncodeParameterSets (sWelsEncCtx* pCtx, void* pDst) { · 104 unmodified lines
29442946 SFrameBSInfo* pFbi = (SFrameBSInfo*)pDst;
29452947 SLayerBSInfo* pLayerBsInfo = &pFbi->sLayerInfo[0];
29462948 int32_t iCountNal = 0;
2949+ int32_t iTotalLength = 0;
29472950
29482951 pLayerBsInfo->pBsBuf = pCtx->pFrameBs;
29492952 pLayerBsInfo->pNalLengthInByte = pCtx->pOut->pNalLen;
29502953 InitBits (&pCtx->pOut->sBsWrite, pCtx->pOut->pBsBuffer, pCtx->pOut->uiSize);
29512954
29522955 pCtx->iPosBsBuffer = 0;
2953− int32_t iReturn = WelsWriteParameterSets (pCtx, &pLayerBsInfo->pNalLengthInByte[0], &iCountNal);
2956+ int32_t iReturn = WelsWriteParameterSets (pCtx, &pLayerBsInfo->pNalLengthInByte[0], &iCountNal, &iTotalLength);
29542957 WELS_VERIFY_RETURN_IFNEQ (iReturn, ENC_RETURN_SUCCESS)
29552958
29562959 pLayerBsInfo->uiSpatialId = 0;
@@ -3094,7 +3097,8 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 137 unmodified lines
30943097 //if ( pSvcParam->bEnableSSEI )
30953098
30963099 // write parameter sets bitstream here
3097− pCtx->iEncoderError = WelsWriteParameterSets (pCtx, &pLayerBsInfo->pNalLengthInByte[0], &iCountNal);
3100+ int32_t iNonVclSize = 0;
3101+ pCtx->iEncoderError = WelsWriteParameterSets (pCtx, &pLayerBsInfo->pNalLengthInByte[0], &iCountNal, &iNonVclSize);
30983102 WELS_VERIFY_RETURN_IFNEQ (pCtx->iEncoderError, ENC_RETURN_SUCCESS)
30993103
31003104 pLayerBsInfo->uiSpatialId = 0;
@@ -3107,6 +3111,8 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 6 unmodified lines
31073111 pLayerBsInfo->pBsBuf = pCtx->pFrameBs + pCtx->iPosBsBuffer;
31083112 pLayerBsInfo->pNalLengthInByte = (pLayerBsInfo - 1)->pNalLengthInByte + iCountNal;
31093113 ++ iLayerNum;
3114+
3115+ iFrameSize += iNonVclSize;
31103116 }
31113117
31123118 pCtx->pCurDqLayer = pCtx->ppDqLayerList[pSpatialIndexMap->iDid];
@@ -3605,6 +3611,8 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 492 unmodified lines
36053611 pLayerBsInfo->pBsBuf = pCtx->pFrameBs + pCtx->iPosBsBuffer;
36063612 pLayerBsInfo->pNalLengthInByte = (pLayerBsInfo - 1)->pNalLengthInByte + 1;
36073613 ++ iLayerNum;
3614+
3615+ iFrameSize += iPaddingNalSize;
36083616 }
36093617
36103618 if ((pParam->sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE || pParam->sSliceCfg.uiSliceMode == SM_AUTO_SLICE)
@@ -3677,6 +3685,7 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 66 unmodified lines
36773685 WelsEmms();
36783686
36793687 pFbi->eFrameType = eFrameType;
3688+ pFbi->iFrameSizeInBytes = iFrameSize;
36803689 return ENC_RETURN_SUCCESS;
36813690 }
36823691

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