History

Multi-thread-fixed:RBC#1689:refactoring for RcCalculateGomQp etc. functions

huade committed 9 years ago

Commit da4dd401 parent f8b60003 files · +13 −14Browse files

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

Unified · Split

codec/encoder/core/src/ratectl.cpp+9−14
@@ -626,10 +626,9 @@ void RcInitGomParameters (sWelsEncCtx* pEncCtx) { · 625 unmodified lines
626 memset (pWelsSvcRc->pGomCost, 0, pWelsSvcRc->iGomSize * sizeof (int32_t));626 memset (pWelsSvcRc->pGomCost, 0, pWelsSvcRc->iGomSize * sizeof (int32_t));
627}627}
628 628
629void RcCalculateMbQp (sWelsEncCtx* pEncCtx, SMB* pCurMb, const int32_t kiSliceId) {629void RcCalculateMbQp (sWelsEncCtx* pEncCtx, SSlice* pSlice, SMB* pCurMb) {
630 SSlice** ppSliceInLayer = pEncCtx->pCurDqLayer->ppSliceInLayer;
631 SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];630 SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
632 SRCSlicing* pSOverRc = &ppSliceInLayer[kiSliceId]->sSlicingOverRc;631 SRCSlicing* pSOverRc = &pSlice->sSlicingOverRc;
633 632
634 int32_t iLumaQp = pSOverRc->iCalculatedQpSlice;633 int32_t iLumaQp = pSOverRc->iCalculatedQpSlice;
635 SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;634 SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;
@@ -666,11 +665,10 @@ SWelsSvcRc* RcJudgeBaseUsability (sWelsEncCtx* pEncCtx) { · 30 unmodified lines
666 return NULL;665 return NULL;
667}666}
668 667
669void RcGomTargetBits (sWelsEncCtx* pEncCtx, const int32_t kiSliceId) {668void RcGomTargetBits (sWelsEncCtx* pEncCtx, SSlice* pSlice) {
670 SSlice** ppSliceInLayer = pEncCtx->pCurDqLayer->ppSliceInLayer;
671 SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];669 SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
672 SWelsSvcRc* pWelsSvcRc_Base = NULL;670 SWelsSvcRc* pWelsSvcRc_Base = NULL;
673 SRCSlicing* pSOverRc = &ppSliceInLayer[kiSliceId]->sSlicingOverRc;671 SRCSlicing* pSOverRc = &pSlice->sSlicingOverRc;
674 672
675 int32_t iAllocateBits = 0;673 int32_t iAllocateBits = 0;
676 int32_t iSumSad = 0;674 int32_t iSumSad = 0;
@@ -702,12 +700,9 @@ void RcGomTargetBits (sWelsEncCtx* pEncCtx, const int32_t kiSliceId) { · 25 unmodified lines
702 pSOverRc->iGomTargetBits = iAllocateBits;700 pSOverRc->iGomTargetBits = iAllocateBits;
703}701}
704 702
705 703void RcCalculateGomQp (sWelsEncCtx* pEncCtx, SSlice* pSlice, SMB* pCurMb) {
706
707void RcCalculateGomQp (sWelsEncCtx* pEncCtx, SMB* pCurMb, int32_t iSliceId) {
708 SSlice** ppSliceInLayer = pEncCtx->pCurDqLayer->ppSliceInLayer;
709 SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];704 SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
710 SRCSlicing* pSOverRc = &ppSliceInLayer[iSliceId]->sSlicingOverRc;705 SRCSlicing* pSOverRc = &pSlice->sSlicingOverRc;
711 int64_t iBitsRatio = 1;706 int64_t iBitsRatio = 1;
712 707
713 int64_t iLeftBits = pSOverRc->iTargetBitsSlice - pSOverRc->iFrameBitsSlice;708 int64_t iLeftBits = pSOverRc->iTargetBitsSlice - pSOverRc->iFrameBitsSlice;
@@ -1204,12 +1199,12 @@ void WelsRcMbInitGom (sWelsEncCtx* pEncCtx, SMB* pCurMb, SSlice* pSlice) { · 490 unmodified lines
1204 if (0 == (pCurMb->iMbXY % pWelsSvcRc->iNumberMbGom)) {1199 if (0 == (pCurMb->iMbXY % pWelsSvcRc->iNumberMbGom)) {
1205 if (pCurMb->iMbXY != pSOverRc->iStartMbSlice) {1200 if (pCurMb->iMbXY != pSOverRc->iStartMbSlice) {
1206 pSOverRc->iComplexityIndexSlice++;1201 pSOverRc->iComplexityIndexSlice++;
1207 RcCalculateGomQp (pEncCtx, pCurMb, kiSliceId);1202 RcCalculateGomQp (pEncCtx, pSlice, pCurMb);
1208 }1203 }
1209 RcGomTargetBits (pEncCtx, kiSliceId);1204 RcGomTargetBits (pEncCtx, pSlice);
1210 }1205 }
1211 1206
1212 RcCalculateMbQp (pEncCtx, pCurMb, kiSliceId);1207 RcCalculateMbQp (pEncCtx, pSlice, pCurMb);
1213 } else {1208 } else {
1214 pCurMb->uiLumaQp = pEncCtx->iGlobalQp;1209 pCurMb->uiLumaQp = pEncCtx->iGlobalQp;
1215 pCurMb->uiChromaQp = g_kuiChromaQpTable[CLIP3_QP_0_51 (pCurMb->uiLumaQp + kuiChromaQpIndexOffset)];1210 pCurMb->uiChromaQp = g_kuiChromaQpTable[CLIP3_QP_0_51 (pCurMb->uiLumaQp + kuiChromaQpIndexOffset)];

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