History

Multi-thread-fixed:RBC#1680:ppSliceInLayer instead of pSliceInLayer for all slice buffer management

huade committed 9 years ago

Commit 8ff579b1 parent 01e31ff11 files · +162 −153Browse files

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

Unified · Split

codec/encoder/core/src/ratectl.cpp+22−22
@@ -513,21 +513,21 @@ void RcCalculatePictureQp (sWelsEncCtx* pEncCtx) { · 512 unmodified lines
513513 }
514514
515515 void RcInitSliceInformation (sWelsEncCtx* pEncCtx) {
516− SSlice* pSliceInLayer = pEncCtx->pCurDqLayer->sLayerInfo.pSliceInLayer;
516+ SSlice** ppSliceInLayer = pEncCtx->pCurDqLayer->ppSliceInLayer;
517517 SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
518− SRCSlicing* pSOverRc = &pSliceInLayer[0].sSlicingOverRc;
518+ SRCSlicing* pSOverRc = &ppSliceInLayer[0]->sSlicingOverRc;
519519 const int32_t kiSliceNum = pWelsSvcRc->iSliceNum;
520520 const int32_t kiBitsPerMb = WELS_DIV_ROUND (static_cast<int64_t> (pWelsSvcRc->iTargetBits) * INT_MULTIPLY,
521521 pWelsSvcRc->iNumberMbFrame);
522522
523523 for (int32_t i = 0; i < kiSliceNum; i++) {
524− pSOverRc = &pSliceInLayer[i].sSlicingOverRc;
524+ pSOverRc = &ppSliceInLayer[i]->sSlicingOverRc;
525525 pSOverRc->iStartMbSlice =
526− pSOverRc->iEndMbSlice = pSliceInLayer[i].sSliceHeaderExt.sSliceHeader.iFirstMbInSlice;
527− pSOverRc->iEndMbSlice += (pSliceInLayer[i].iCountMbNumInSlice - 1);
526+ pSOverRc->iEndMbSlice = ppSliceInLayer[i]->sSliceHeaderExt.sSliceHeader.iFirstMbInSlice;
527+ pSOverRc->iEndMbSlice += (ppSliceInLayer[i]->iCountMbNumInSlice - 1);
528528 pSOverRc->iTotalQpSlice = 0;
529529 pSOverRc->iTotalMbSlice = 0;
530− pSOverRc->iTargetBitsSlice = WELS_DIV_ROUND (static_cast<int64_t> (kiBitsPerMb) * pSliceInLayer[i].iCountMbNumInSlice,
530+ pSOverRc->iTargetBitsSlice = WELS_DIV_ROUND (static_cast<int64_t> (kiBitsPerMb) * ppSliceInLayer[i]->iCountMbNumInSlice,
531531 INT_MULTIPLY);
532532 pSOverRc->iFrameBitsSlice = 0;
533533 pSOverRc->iGomBitsSlice = 0;
@@ -610,15 +610,15 @@ void RcDecideTargetBitsTimestamp (sWelsEncCtx* pEncCtx) { · 76 unmodified lines
610610 }
611611
612612 void RcInitGomParameters (sWelsEncCtx* pEncCtx) {
613− SSlice* pSliceInLayer = pEncCtx->pCurDqLayer->sLayerInfo.pSliceInLayer;
613+ SSlice** ppSliceInLayer = pEncCtx->pCurDqLayer->ppSliceInLayer;
614614 SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
615− SRCSlicing* pSOverRc = &pSliceInLayer[0].sSlicingOverRc;
615+ SRCSlicing* pSOverRc = &ppSliceInLayer[0]->sSlicingOverRc;
616616 const int32_t kiSliceNum = pWelsSvcRc->iSliceNum;
617617 const int32_t kiGlobalQp = pEncCtx->iGlobalQp;
618618
619619 pWelsSvcRc->iAverageFrameQp = 0;
620620 for (int32_t i = 0; i < kiSliceNum; ++i) {
621− pSOverRc = &pSliceInLayer[i].sSlicingOverRc;
621+ pSOverRc = &ppSliceInLayer[i]->sSlicingOverRc;
622622 pSOverRc->iComplexityIndexSlice = 0;
623623 pSOverRc->iCalculatedQpSlice = kiGlobalQp;
624624 }
@@ -627,9 +627,9 @@ void RcInitGomParameters (sWelsEncCtx* pEncCtx) { · 2 unmodified lines
627627 }
628628
629629 void RcCalculateMbQp (sWelsEncCtx* pEncCtx, SMB* pCurMb, const int32_t kiSliceId) {
630− SSlice* pSliceInLayer = pEncCtx->pCurDqLayer->sLayerInfo.pSliceInLayer;
630+ SSlice** ppSliceInLayer = pEncCtx->pCurDqLayer->ppSliceInLayer;
631631 SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
632− SRCSlicing* pSOverRc = &pSliceInLayer[kiSliceId].sSlicingOverRc;
632+ SRCSlicing* pSOverRc = &ppSliceInLayer[kiSliceId]->sSlicingOverRc;
633633
634634 int32_t iLumaQp = pSOverRc->iCalculatedQpSlice;
635635 SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;
@@ -667,10 +667,10 @@ SWelsSvcRc* RcJudgeBaseUsability (sWelsEncCtx* pEncCtx) { · 31 unmodified lines
667667 }
668668
669669 void RcGomTargetBits (sWelsEncCtx* pEncCtx, const int32_t kiSliceId) {
670− SSlice* pSliceInLayer = pEncCtx->pCurDqLayer->sLayerInfo.pSliceInLayer;
670+ SSlice** ppSliceInLayer = pEncCtx->pCurDqLayer->ppSliceInLayer;
671671 SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
672672 SWelsSvcRc* pWelsSvcRc_Base = NULL;
673− SRCSlicing* pSOverRc = &pSliceInLayer[kiSliceId].sSlicingOverRc;
673+ SRCSlicing* pSOverRc = &ppSliceInLayer[kiSliceId]->sSlicingOverRc;
674674
675675 int32_t iAllocateBits = 0;
676676 int32_t iSumSad = 0;
@@ -705,9 +705,9 @@ void RcGomTargetBits (sWelsEncCtx* pEncCtx, const int32_t kiSliceId) { · 28 unmodified lines
705705
706706
707707 void RcCalculateGomQp (sWelsEncCtx* pEncCtx, SMB* pCurMb, int32_t iSliceId) {
708− SSlice* pSliceInLayer = pEncCtx->pCurDqLayer->sLayerInfo.pSliceInLayer;
708+ SSlice** ppSliceInLayer = pEncCtx->pCurDqLayer->ppSliceInLayer;
709709 SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
710− SRCSlicing* pSOverRc = &pSliceInLayer[iSliceId].sSlicingOverRc;
710+ SRCSlicing* pSOverRc = &ppSliceInLayer[iSliceId]->sSlicingOverRc;
711711 int64_t iBitsRatio = 1;
712712
713713 int64_t iLeftBits = pSOverRc->iTargetBitsSlice - pSOverRc->iFrameBitsSlice;
@@ -1016,8 +1016,8 @@ void RcTraceFrameBits (sWelsEncCtx* pEncCtx, long long uiTimeStamp) { · 302 unmodified lines
10161016 }
10171017
10181018 void RcUpdatePictureQpBits (sWelsEncCtx* pEncCtx, int32_t iCodedBits) {
1019− SSlice* pSliceInLayer = pEncCtx->pCurDqLayer->sLayerInfo.pSliceInLayer;
1020− SRCSlicing* pSOverRc = &pSliceInLayer[0].sSlicingOverRc;
1019+ SSlice** ppSliceInLayer = pEncCtx->pCurDqLayer->ppSliceInLayer;
1020+ SRCSlicing* pSOverRc = &ppSliceInLayer[0]->sSlicingOverRc;
10211021 SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
10221022 SSliceCtx* pCurSliceCtx = &pEncCtx->pCurDqLayer->sSliceEncCtx;
10231023 int32_t iTotalQp = 0, iTotalMb = 0;
@@ -1025,7 +1025,7 @@ void RcUpdatePictureQpBits (sWelsEncCtx* pEncCtx, int32_t iCodedBits) { · 1 unmodified line
10251025
10261026 if (pEncCtx->eSliceType == P_SLICE) {
10271027 for (i = 0; i < pCurSliceCtx->iSliceNumInFrame; i++) {
1028− pSOverRc = &pSliceInLayer[i].sSlicingOverRc;
1028+ pSOverRc = &ppSliceInLayer[i]->sSlicingOverRc;
10291029 iTotalQp += pSOverRc->iTotalQpSlice;
10301030 iTotalMb += pSOverRc->iTotalMbSlice;
10311031 }
@@ -1191,10 +1191,10 @@ void WelsRcPictureInfoUpdateGom (sWelsEncCtx* pEncCtx, int32_t iLayerSize) { · 159 unmodified lines
11911191 }
11921192
11931193 void WelsRcMbInitGom (sWelsEncCtx* pEncCtx, SMB* pCurMb, SSlice* pSlice) {
1194− SSlice* pSliceInLayer = pEncCtx->pCurDqLayer->sLayerInfo.pSliceInLayer;
1194+ SSlice** ppSliceInLayer = pEncCtx->pCurDqLayer->ppSliceInLayer;
11951195 SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
11961196 const int32_t kiSliceId = pSlice->uiSliceIdx;
1197− SRCSlicing* pSOverRc = &pSliceInLayer[kiSliceId].sSlicingOverRc;
1197+ SRCSlicing* pSOverRc = &ppSliceInLayer[kiSliceId]->sSlicingOverRc;
11981198 SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;
11991199 const uint8_t kuiChromaQpIndexOffset = pCurLayer->sLayerInfo.pPpsP->uiChromaQpIndexOffset;
12001200
@@ -1218,10 +1218,10 @@ void WelsRcMbInitGom (sWelsEncCtx* pEncCtx, SMB* pCurMb, SSlice* pSlice) { · 17 unmodified lines
12181218 }
12191219
12201220 void WelsRcMbInfoUpdateGom (sWelsEncCtx* pEncCtx, SMB* pCurMb, int32_t iCostLuma, SSlice* pSlice) {
1221− SSlice* pSliceInLayer = pEncCtx->pCurDqLayer->sLayerInfo.pSliceInLayer;
1221+ SSlice** ppSliceInLayer = pEncCtx->pCurDqLayer->ppSliceInLayer;
12221222 SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
12231223 int32_t iSliceId = pSlice->uiSliceIdx;
1224− SRCSlicing* pSOverRc = &pSliceInLayer[iSliceId].sSlicingOverRc;
1224+ SRCSlicing* pSOverRc = &ppSliceInLayer[iSliceId]->sSlicingOverRc;
12251225
12261226 const int32_t kiComplexityIndex = pSOverRc->iComplexityIndexSlice;
12271227

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