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
2736 * \brief write all parameter sets introduced in SVC extension2736 * \brief write all parameter sets introduced in SVC extension
2737 * \return writing results, success or error2737 * \return writing results, success or error
2738 */2738 */
2739int32_t WelsWriteParameterSets (sWelsEncCtx* pCtx, int32_t* pNalLen, int32_t* pNumNal) {2739int32_t WelsWriteParameterSets (sWelsEncCtx* pCtx, int32_t* pNalLen, int32_t* pNumNal, int32_t* pTotalLength) {
2740 int32_t iSize = 0;2740 int32_t iSize = 0;
2741 int32_t iNal = 0;2741 int32_t iNal = 0;
2742 int32_t iIdx = 0;2742 int32_t iIdx = 0;
@@ -2748,6 +2748,7 @@ int32_t WelsWriteParameterSets (sWelsEncCtx* pCtx, int32_t* pNalLen, int32_t* pN · 5 unmodified lines
2748 if (NULL == pCtx || NULL == pNalLen || NULL == pNumNal)2748 if (NULL == pCtx || NULL == pNalLen || NULL == pNumNal)
2749 return ENC_RETURN_UNEXPECTED;2749 return ENC_RETURN_UNEXPECTED;
2750 2750
2751 *pTotalLength = 0;
2751 /* write all SPS */2752 /* write all SPS */
2752 iIdx = 0;2753 iIdx = 0;
2753 while (iIdx < pCtx->iSpsNum) {2754 while (iIdx < pCtx->iSpsNum) {
@@ -2834,6 +2835,7 @@ int32_t WelsWriteParameterSets (sWelsEncCtx* pCtx, int32_t* pNalLen, int32_t* pN · 80 unmodified lines
2834 }2835 }
2835 2836
2836 *pNumNal = iCountNal;2837 *pNumNal = iCountNal;
2838 *pTotalLength = iSize;
2837 2839
2838 return ENC_RETURN_SUCCESS;2840 return ENC_RETURN_SUCCESS;
2839}2841}
@@ -2944,13 +2946,14 @@ int32_t WelsEncoderEncodeParameterSets (sWelsEncCtx* pCtx, void* pDst) { · 104 unmodified lines
2944 SFrameBSInfo* pFbi = (SFrameBSInfo*)pDst;2946 SFrameBSInfo* pFbi = (SFrameBSInfo*)pDst;
2945 SLayerBSInfo* pLayerBsInfo = &pFbi->sLayerInfo[0];2947 SLayerBSInfo* pLayerBsInfo = &pFbi->sLayerInfo[0];
2946 int32_t iCountNal = 0;2948 int32_t iCountNal = 0;
2949 int32_t iTotalLength = 0;
2947 2950
2948 pLayerBsInfo->pBsBuf = pCtx->pFrameBs;2951 pLayerBsInfo->pBsBuf = pCtx->pFrameBs;
2949 pLayerBsInfo->pNalLengthInByte = pCtx->pOut->pNalLen;2952 pLayerBsInfo->pNalLengthInByte = pCtx->pOut->pNalLen;
2950 InitBits (&pCtx->pOut->sBsWrite, pCtx->pOut->pBsBuffer, pCtx->pOut->uiSize);2953 InitBits (&pCtx->pOut->sBsWrite, pCtx->pOut->pBsBuffer, pCtx->pOut->uiSize);
2951 2954
2952 pCtx->iPosBsBuffer = 0;2955 pCtx->iPosBsBuffer = 0;
2953 int32_t iReturn = WelsWriteParameterSets (pCtx, &pLayerBsInfo->pNalLengthInByte[0], &iCountNal);2956 int32_t iReturn = WelsWriteParameterSets (pCtx, &pLayerBsInfo->pNalLengthInByte[0], &iCountNal, &iTotalLength);
2954 WELS_VERIFY_RETURN_IFNEQ (iReturn, ENC_RETURN_SUCCESS)2957 WELS_VERIFY_RETURN_IFNEQ (iReturn, ENC_RETURN_SUCCESS)
2955 2958
2956 pLayerBsInfo->uiSpatialId = 0;2959 pLayerBsInfo->uiSpatialId = 0;
@@ -3094,7 +3097,8 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 137 unmodified lines
3094 //if ( pSvcParam->bEnableSSEI )3097 //if ( pSvcParam->bEnableSSEI )
3095 3098
3096 // write parameter sets bitstream here3099 // 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);
3098 WELS_VERIFY_RETURN_IFNEQ (pCtx->iEncoderError, ENC_RETURN_SUCCESS)3102 WELS_VERIFY_RETURN_IFNEQ (pCtx->iEncoderError, ENC_RETURN_SUCCESS)
3099 3103
3100 pLayerBsInfo->uiSpatialId = 0;3104 pLayerBsInfo->uiSpatialId = 0;
@@ -3107,6 +3111,8 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 6 unmodified lines
3107 pLayerBsInfo->pBsBuf = pCtx->pFrameBs + pCtx->iPosBsBuffer;3111 pLayerBsInfo->pBsBuf = pCtx->pFrameBs + pCtx->iPosBsBuffer;
3108 pLayerBsInfo->pNalLengthInByte = (pLayerBsInfo - 1)->pNalLengthInByte + iCountNal;3112 pLayerBsInfo->pNalLengthInByte = (pLayerBsInfo - 1)->pNalLengthInByte + iCountNal;
3109 ++ iLayerNum;3113 ++ iLayerNum;
3114
3115 iFrameSize += iNonVclSize;
3110 }3116 }
3111 3117
3112 pCtx->pCurDqLayer = pCtx->ppDqLayerList[pSpatialIndexMap->iDid];3118 pCtx->pCurDqLayer = pCtx->ppDqLayerList[pSpatialIndexMap->iDid];
@@ -3605,6 +3611,8 @@ int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSour · 492 unmodified lines
3605 pLayerBsInfo->pBsBuf = pCtx->pFrameBs + pCtx->iPosBsBuffer;3611 pLayerBsInfo->pBsBuf = pCtx->pFrameBs + pCtx->iPosBsBuffer;
3606 pLayerBsInfo->pNalLengthInByte = (pLayerBsInfo - 1)->pNalLengthInByte + 1;3612 pLayerBsInfo->pNalLengthInByte = (pLayerBsInfo - 1)->pNalLengthInByte + 1;
3607 ++ iLayerNum;3613 ++ iLayerNum;
3614
3615 iFrameSize += iPaddingNalSize;
3608 }3616 }
3609 3617
3610 if ((pParam->sSliceCfg.uiSliceMode == SM_FIXEDSLCNUM_SLICE || pParam->sSliceCfg.uiSliceMode == SM_AUTO_SLICE)3618 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
3677 WelsEmms();3685 WelsEmms();
3678 3686
3679 pFbi->eFrameType = eFrameType;3687 pFbi->eFrameType = eFrameType;
3688 pFbi->iFrameSizeInBytes = iFrameSize;
3680 return ENC_RETURN_SUCCESS;3689 return ENC_RETURN_SUCCESS;
3681}3690}
3682 3691

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