ref: 7b461e109eea843e0b8795fbdbc64e19cd8f6727
parent: f9654726cfe8137a0767c0e85861988c7d2eed16
parent: efc5bbd9fb5c6c78a31d78e19b7aeef8c672e165
author: huili2 <[email protected]>
date: Wed Jun 25 13:26:22 EDT 2014
Merge pull request #1013 from ruil2/command_db add iSubSeqId calculation
--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -2899,6 +2899,21 @@
return ENC_RETURN_SUCCESS;
}
+int32_t GetSubSequenceId (sWelsEncCtx* pCtx, EVideoFrameType eFrameType) {
+ int32_t iSubSeqId = 0;
+ if (eFrameType == videoFrameTypeIDR)
+ iSubSeqId = 0;
+ else if (eFrameType == videoFrameTypeI)
+ iSubSeqId = 1;
+ else if (eFrameType == videoFrameTypeP) {
+ if (pCtx->bCurFrameMarkedAsSceneLtr)
+ iSubSeqId = 2;
+ else
+ iSubSeqId = 3 + pCtx->uiTemporalId; //T0:3 T1:4 T2:5 T3:6
+ } else
+ iSubSeqId = 3 + MAX_TEMPORAL_LAYER_NUM;
+ return iSubSeqId;
+}
/*!
* \brief core svc encoding process
*
@@ -3540,7 +3555,7 @@
++ pCtx->iCodingIndex;
pCtx->eLastNalPriority = eNalRefIdc;
pFbi->iLayerNum = iLayerNum;
-
+ pFbi->iSubSeqId = GetSubSequenceId (pCtx, eFrameType);
WelsEmms();
pFbi->eFrameType = eFrameType;
@@ -3801,12 +3816,13 @@
int16_t* pFirstMbInSlice = (int16_t*)pMA->WelsMalloc (iMaxSliceNum * sizeof (int16_t), "pSliceSeg->pFirstMbInSlice");
if (NULL == pFirstMbInSlice)
return ENC_RETURN_MEMALLOCERR;
- memset(pFirstMbInSlice, 0, sizeof(int16_t) * iMaxSliceNum);
+ memset (pFirstMbInSlice, 0, sizeof (int16_t) * iMaxSliceNum);
memcpy (pFirstMbInSlice, pCurLayer->pSliceEncCtx->pFirstMbInSlice, sizeof (int16_t) * iMaxSliceNumOld);
pMA->WelsFree (pCurLayer->pSliceEncCtx->pFirstMbInSlice, "pSliceSeg->pFirstMbInSlice");
pCurLayer->pSliceEncCtx->pFirstMbInSlice = pFirstMbInSlice;
- int32_t* pCountMbNumInSlice = (int32_t*)pMA->WelsMalloc (iMaxSliceNum * sizeof (int32_t),"pSliceSeg->pCountMbNumInSlice");
+ int32_t* pCountMbNumInSlice = (int32_t*)pMA->WelsMalloc (iMaxSliceNum * sizeof (int32_t),
+ "pSliceSeg->pCountMbNumInSlice");
if (NULL == pCountMbNumInSlice)
return ENC_RETURN_MEMALLOCERR;
memcpy (pCountMbNumInSlice, pCurLayer->pSliceEncCtx->pCountMbNumInSlice, sizeof (int32_t) * iMaxSliceNumOld);
@@ -3824,13 +3840,15 @@
memcpy (pSlcingOverRc, pCtx->pWelsSvcRc->pSlicingOverRc, sizeof (SRCSlicing) * iMaxSliceNumOld);
uiSliceIdx = iMaxSliceNumOld;
SRCSlicing* pSORC = &pSlcingOverRc[uiSliceIdx];
- const int32_t kiBitsPerMb = WELS_DIV_ROUND(pCtx->pWelsSvcRc->iTargetBits * INT_MULTIPLY, pCtx->pWelsSvcRc->iNumberMbFrame);
+ const int32_t kiBitsPerMb = WELS_DIV_ROUND (pCtx->pWelsSvcRc->iTargetBits * INT_MULTIPLY,
+ pCtx->pWelsSvcRc->iNumberMbFrame);
while (uiSliceIdx < iMaxSliceNum) {
pSORC->iComplexityIndexSlice = 0;
pSORC->iCalculatedQpSlice = pCtx->iGlobalQp;
pSORC->iTotalQpSlice = 0;
pSORC->iTotalMbSlice = 0;
- pSORC->iTargetBitsSlice = WELS_DIV_ROUND(kiBitsPerMb * pCurLayer->pSliceEncCtx->pCountMbNumInSlice[uiSliceIdx], INT_MULTIPLY);
+ pSORC->iTargetBitsSlice = WELS_DIV_ROUND (kiBitsPerMb * pCurLayer->pSliceEncCtx->pCountMbNumInSlice[uiSliceIdx],
+ INT_MULTIPLY);
pSORC->iFrameBitsSlice = 0;
pSORC->iGomBitsSlice = 0;
pSORC ++;