History

refactor slice level rc structure

huade committed 10 years ago

Commit 7bcb3ba1 parent 27541294 files · +66 −78Browse files

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

Unified · Split

codec/encoder/core/src/encoder_ext.cpp+18−34
@@ -4834,6 +4834,9 @@ int32_t DynSliceRealloc (sWelsEncCtx* pCtx, · 4833 unmodified lines
48344834 SSlice* pBaseSlice = &pCurLayer->sLayerInfo.pSliceInLayer[0];
48354835 SSliceHeaderExt* pBaseSHExt = &pBaseSlice->sSliceHeaderExt;
48364836 SSlice* pSliceIdx = &pSlice[uiSliceIdx];
4837+ const int32_t kiCurDid = pCtx->uiDependencyId;
4838+ const int32_t kiBitsPerMb = WELS_DIV_ROUND (pCtx->pWelsSvcRc[kiCurDid].iTargetBits * INT_MULTIPLY,
4839+ pCtx->pWelsSvcRc[kiCurDid].iNumberMbFrame);
48374840 while (uiSliceIdx < iMaxSliceNum) {
48384841 SSliceHeaderExt* pSHExt = &pSliceIdx->sSliceHeaderExt;
48394842 pSliceIdx->uiSliceIdx = uiSliceIdx;
@@ -4848,51 +4851,32 @@ int32_t DynSliceRealloc (sWelsEncCtx* pCtx, · 8 unmodified lines
48484851 return ENC_RETURN_MEMALLOCERR;
48494852 }
48504853
4851− pSliceIdx->bSliceHeaderExtFlag = pBaseSlice->bSliceHeaderExtFlag;
4852− pSHExt->sSliceHeader.iPpsId = pBaseSHExt->sSliceHeader.iPpsId;
4853− pSHExt->sSliceHeader.pPps = pBaseSHExt->sSliceHeader.pPps;
4854− pSHExt->sSliceHeader.iSpsId = pBaseSHExt->sSliceHeader.iSpsId;
4855− pSHExt->sSliceHeader.pSps = pBaseSHExt->sSliceHeader.pSps;
4854+ pSliceIdx->bSliceHeaderExtFlag = pBaseSlice->bSliceHeaderExtFlag;
4855+ pSHExt->sSliceHeader.iPpsId = pBaseSHExt->sSliceHeader.iPpsId;
4856+ pSHExt->sSliceHeader.pPps = pBaseSHExt->sSliceHeader.pPps;
4857+ pSHExt->sSliceHeader.iSpsId = pBaseSHExt->sSliceHeader.iSpsId;
4858+ pSHExt->sSliceHeader.pSps = pBaseSHExt->sSliceHeader.pSps;
48564859 pSHExt->sSliceHeader.uiRefCount = pCtx->iNumRef0;
48574860 memcpy (&pSHExt->sSliceHeader.sRefMarking, &pBaseSHExt->sSliceHeader.sRefMarking, sizeof (SRefPicMarking));
48584861 memcpy (&pSHExt->sSliceHeader.sRefReordering, &pBaseSHExt->sSliceHeader.sRefReordering,
48594862 sizeof (SRefPicListReorderSyntax));
48604863
4864+ pSliceIdx->sSlicingOverRc.iComplexityIndexSlice = 0;
4865+ pSliceIdx->sSlicingOverRc.iCalculatedQpSlice = pCtx->iGlobalQp;
4866+ pSliceIdx->sSlicingOverRc.iTotalQpSlice = 0;
4867+ pSliceIdx->sSlicingOverRc.iTotalMbSlice = 0;
4868+ pSliceIdx->sSlicingOverRc.iTargetBitsSlice = WELS_DIV_ROUND (kiBitsPerMb *
4869+ pCurLayer->sLayerInfo.pSliceInLayer[uiSliceIdx].iCountMbNumInSlice,
4870+ INT_MULTIPLY);
4871+ pSliceIdx->sSlicingOverRc.iFrameBitsSlice = 0;
4872+ pSliceIdx->sSlicingOverRc.iGomBitsSlice = 0;
4873+
48614874 pSliceIdx++;
48624875 uiSliceIdx++;
48634876 }
48644877 pMA->WelsFree (pCurLayer->sLayerInfo.pSliceInLayer, "Slice");
48654878 pCurLayer->sLayerInfo.pSliceInLayer = pSlice;
48664879
4867− //deal with rate control variables
4868− const int32_t kiCurDid = pCtx->uiDependencyId;
4869− SRCSlicing* pSlcingOverRc = (SRCSlicing*)pMA->WelsMallocz (iMaxSliceNum * sizeof (SRCSlicing), "SlicingOverRC");
4870− if (NULL == pSlcingOverRc) {
4871− WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR,
4872− "CWelsH264SVCEncoder::DynSliceRealloc: realloc pSlcingOverRc not successful");
4873− return ENC_RETURN_MEMALLOCERR;
4874− }
4875− memcpy (pSlcingOverRc, pCtx->pWelsSvcRc[kiCurDid].pSlicingOverRc, sizeof (SRCSlicing) * iMaxSliceNumOld);
4876− uiSliceIdx = iMaxSliceNumOld;
4877− SRCSlicing* pSORC = &pSlcingOverRc[uiSliceIdx];
4878− const int32_t kiBitsPerMb = WELS_DIV_ROUND (pCtx->pWelsSvcRc[kiCurDid].iTargetBits * INT_MULTIPLY,
4879− pCtx->pWelsSvcRc[kiCurDid].iNumberMbFrame);
4880− while (uiSliceIdx < iMaxSliceNum) {
4881− pSORC->iComplexityIndexSlice = 0;
4882− pSORC->iCalculatedQpSlice = pCtx->iGlobalQp;
4883− pSORC->iTotalQpSlice = 0;
4884− pSORC->iTotalMbSlice = 0;
4885− pSORC->iTargetBitsSlice = WELS_DIV_ROUND (kiBitsPerMb *
4886− pCurLayer->sLayerInfo.pSliceInLayer[uiSliceIdx].iCountMbNumInSlice,
4887− INT_MULTIPLY);
4888− pSORC->iFrameBitsSlice = 0;
4889− pSORC->iGomBitsSlice = 0;
4890− pSORC ++;
4891− uiSliceIdx ++;
4892− }
4893− pMA->WelsFree (pCtx->pWelsSvcRc[kiCurDid].pSlicingOverRc, "SlicingOverRC");
4894− pCtx->pWelsSvcRc[kiCurDid].pSlicingOverRc = pSlcingOverRc;
4895−
48964880 if (pCtx->iMaxSliceCount < iMaxSliceNum)
48974881 pCtx->iMaxSliceCount = iMaxSliceNum;
48984882 pCurLayer->sSliceEncCtx.iMaxSliceNumConstraint = iMaxSliceNum;

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