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
513}513}
514 514
515void RcInitSliceInformation (sWelsEncCtx* pEncCtx) {515void RcInitSliceInformation (sWelsEncCtx* pEncCtx) {
516 SSlice* pSliceInLayer = pEncCtx->pCurDqLayer->sLayerInfo.pSliceInLayer;516 SSlice** ppSliceInLayer = pEncCtx->pCurDqLayer->ppSliceInLayer;
517 SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];517 SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
518 SRCSlicing* pSOverRc = &pSliceInLayer[0].sSlicingOverRc;518 SRCSlicing* pSOverRc = &ppSliceInLayer[0]->sSlicingOverRc;
519 const int32_t kiSliceNum = pWelsSvcRc->iSliceNum;519 const int32_t kiSliceNum = pWelsSvcRc->iSliceNum;
520 const int32_t kiBitsPerMb = WELS_DIV_ROUND (static_cast<int64_t> (pWelsSvcRc->iTargetBits) * INT_MULTIPLY,520 const int32_t kiBitsPerMb = WELS_DIV_ROUND (static_cast<int64_t> (pWelsSvcRc->iTargetBits) * INT_MULTIPLY,
521 pWelsSvcRc->iNumberMbFrame);521 pWelsSvcRc->iNumberMbFrame);
522 522
523 for (int32_t i = 0; i < kiSliceNum; i++) {523 for (int32_t i = 0; i < kiSliceNum; i++) {
524 pSOverRc = &pSliceInLayer[i].sSlicingOverRc;524 pSOverRc = &ppSliceInLayer[i]->sSlicingOverRc;
525 pSOverRc->iStartMbSlice =525 pSOverRc->iStartMbSlice =
526 pSOverRc->iEndMbSlice = pSliceInLayer[i].sSliceHeaderExt.sSliceHeader.iFirstMbInSlice;526 pSOverRc->iEndMbSlice = ppSliceInLayer[i]->sSliceHeaderExt.sSliceHeader.iFirstMbInSlice;
527 pSOverRc->iEndMbSlice += (pSliceInLayer[i].iCountMbNumInSlice - 1);527 pSOverRc->iEndMbSlice += (ppSliceInLayer[i]->iCountMbNumInSlice - 1);
528 pSOverRc->iTotalQpSlice = 0;528 pSOverRc->iTotalQpSlice = 0;
529 pSOverRc->iTotalMbSlice = 0;529 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,
531 INT_MULTIPLY);531 INT_MULTIPLY);
532 pSOverRc->iFrameBitsSlice = 0;532 pSOverRc->iFrameBitsSlice = 0;
533 pSOverRc->iGomBitsSlice = 0;533 pSOverRc->iGomBitsSlice = 0;
@@ -610,15 +610,15 @@ void RcDecideTargetBitsTimestamp (sWelsEncCtx* pEncCtx) { · 76 unmodified lines
610}610}
611 611
612void RcInitGomParameters (sWelsEncCtx* pEncCtx) {612void RcInitGomParameters (sWelsEncCtx* pEncCtx) {
613 SSlice* pSliceInLayer = pEncCtx->pCurDqLayer->sLayerInfo.pSliceInLayer;613 SSlice** ppSliceInLayer = pEncCtx->pCurDqLayer->ppSliceInLayer;
614 SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];614 SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
615 SRCSlicing* pSOverRc = &pSliceInLayer[0].sSlicingOverRc;615 SRCSlicing* pSOverRc = &ppSliceInLayer[0]->sSlicingOverRc;
616 const int32_t kiSliceNum = pWelsSvcRc->iSliceNum;616 const int32_t kiSliceNum = pWelsSvcRc->iSliceNum;
617 const int32_t kiGlobalQp = pEncCtx->iGlobalQp;617 const int32_t kiGlobalQp = pEncCtx->iGlobalQp;
618 618
619 pWelsSvcRc->iAverageFrameQp = 0;619 pWelsSvcRc->iAverageFrameQp = 0;
620 for (int32_t i = 0; i < kiSliceNum; ++i) {620 for (int32_t i = 0; i < kiSliceNum; ++i) {
621 pSOverRc = &pSliceInLayer[i].sSlicingOverRc;621 pSOverRc = &ppSliceInLayer[i]->sSlicingOverRc;
622 pSOverRc->iComplexityIndexSlice = 0;622 pSOverRc->iComplexityIndexSlice = 0;
623 pSOverRc->iCalculatedQpSlice = kiGlobalQp;623 pSOverRc->iCalculatedQpSlice = kiGlobalQp;
624 }624 }
@@ -627,9 +627,9 @@ void RcInitGomParameters (sWelsEncCtx* pEncCtx) { · 2 unmodified lines
627}627}
628 628
629void RcCalculateMbQp (sWelsEncCtx* pEncCtx, SMB* pCurMb, const int32_t kiSliceId) {629void RcCalculateMbQp (sWelsEncCtx* pEncCtx, SMB* pCurMb, const int32_t kiSliceId) {
630 SSlice* pSliceInLayer = pEncCtx->pCurDqLayer->sLayerInfo.pSliceInLayer;630 SSlice** ppSliceInLayer = pEncCtx->pCurDqLayer->ppSliceInLayer;
631 SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];631 SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
632 SRCSlicing* pSOverRc = &pSliceInLayer[kiSliceId].sSlicingOverRc;632 SRCSlicing* pSOverRc = &ppSliceInLayer[kiSliceId]->sSlicingOverRc;
633 633
634 int32_t iLumaQp = pSOverRc->iCalculatedQpSlice;634 int32_t iLumaQp = pSOverRc->iCalculatedQpSlice;
635 SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;635 SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;
@@ -667,10 +667,10 @@ SWelsSvcRc* RcJudgeBaseUsability (sWelsEncCtx* pEncCtx) { · 31 unmodified lines
667}667}
668 668
669void RcGomTargetBits (sWelsEncCtx* pEncCtx, const int32_t kiSliceId) {669void RcGomTargetBits (sWelsEncCtx* pEncCtx, const int32_t kiSliceId) {
670 SSlice* pSliceInLayer = pEncCtx->pCurDqLayer->sLayerInfo.pSliceInLayer;670 SSlice** ppSliceInLayer = pEncCtx->pCurDqLayer->ppSliceInLayer;
671 SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];671 SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
672 SWelsSvcRc* pWelsSvcRc_Base = NULL;672 SWelsSvcRc* pWelsSvcRc_Base = NULL;
673 SRCSlicing* pSOverRc = &pSliceInLayer[kiSliceId].sSlicingOverRc;673 SRCSlicing* pSOverRc = &ppSliceInLayer[kiSliceId]->sSlicingOverRc;
674 674
675 int32_t iAllocateBits = 0;675 int32_t iAllocateBits = 0;
676 int32_t iSumSad = 0;676 int32_t iSumSad = 0;
@@ -705,9 +705,9 @@ void RcGomTargetBits (sWelsEncCtx* pEncCtx, const int32_t kiSliceId) { · 28 unmodified lines
705 705
706 706
707void RcCalculateGomQp (sWelsEncCtx* pEncCtx, SMB* pCurMb, int32_t iSliceId) {707void RcCalculateGomQp (sWelsEncCtx* pEncCtx, SMB* pCurMb, int32_t iSliceId) {
708 SSlice* pSliceInLayer = pEncCtx->pCurDqLayer->sLayerInfo.pSliceInLayer;708 SSlice** ppSliceInLayer = pEncCtx->pCurDqLayer->ppSliceInLayer;
709 SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];709 SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
710 SRCSlicing* pSOverRc = &pSliceInLayer[iSliceId].sSlicingOverRc;710 SRCSlicing* pSOverRc = &ppSliceInLayer[iSliceId]->sSlicingOverRc;
711 int64_t iBitsRatio = 1;711 int64_t iBitsRatio = 1;
712 712
713 int64_t iLeftBits = pSOverRc->iTargetBitsSlice - pSOverRc->iFrameBitsSlice;713 int64_t iLeftBits = pSOverRc->iTargetBitsSlice - pSOverRc->iFrameBitsSlice;
@@ -1016,8 +1016,8 @@ void RcTraceFrameBits (sWelsEncCtx* pEncCtx, long long uiTimeStamp) { · 302 unmodified lines
1016}1016}
1017 1017
1018void RcUpdatePictureQpBits (sWelsEncCtx* pEncCtx, int32_t iCodedBits) {1018void RcUpdatePictureQpBits (sWelsEncCtx* pEncCtx, int32_t iCodedBits) {
1019 SSlice* pSliceInLayer = pEncCtx->pCurDqLayer->sLayerInfo.pSliceInLayer;1019 SSlice** ppSliceInLayer = pEncCtx->pCurDqLayer->ppSliceInLayer;
1020 SRCSlicing* pSOverRc = &pSliceInLayer[0].sSlicingOverRc;1020 SRCSlicing* pSOverRc = &ppSliceInLayer[0]->sSlicingOverRc;
1021 SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];1021 SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
1022 SSliceCtx* pCurSliceCtx = &pEncCtx->pCurDqLayer->sSliceEncCtx;1022 SSliceCtx* pCurSliceCtx = &pEncCtx->pCurDqLayer->sSliceEncCtx;
1023 int32_t iTotalQp = 0, iTotalMb = 0;1023 int32_t iTotalQp = 0, iTotalMb = 0;
@@ -1025,7 +1025,7 @@ void RcUpdatePictureQpBits (sWelsEncCtx* pEncCtx, int32_t iCodedBits) { · 1 unmodified line
1025 1025
1026 if (pEncCtx->eSliceType == P_SLICE) {1026 if (pEncCtx->eSliceType == P_SLICE) {
1027 for (i = 0; i < pCurSliceCtx->iSliceNumInFrame; i++) {1027 for (i = 0; i < pCurSliceCtx->iSliceNumInFrame; i++) {
1028 pSOverRc = &pSliceInLayer[i].sSlicingOverRc;1028 pSOverRc = &ppSliceInLayer[i]->sSlicingOverRc;
1029 iTotalQp += pSOverRc->iTotalQpSlice;1029 iTotalQp += pSOverRc->iTotalQpSlice;
1030 iTotalMb += pSOverRc->iTotalMbSlice;1030 iTotalMb += pSOverRc->iTotalMbSlice;
1031 }1031 }
@@ -1191,10 +1191,10 @@ void WelsRcPictureInfoUpdateGom (sWelsEncCtx* pEncCtx, int32_t iLayerSize) { · 159 unmodified lines
1191}1191}
1192 1192
1193void WelsRcMbInitGom (sWelsEncCtx* pEncCtx, SMB* pCurMb, SSlice* pSlice) {1193void WelsRcMbInitGom (sWelsEncCtx* pEncCtx, SMB* pCurMb, SSlice* pSlice) {
1194 SSlice* pSliceInLayer = pEncCtx->pCurDqLayer->sLayerInfo.pSliceInLayer;1194 SSlice** ppSliceInLayer = pEncCtx->pCurDqLayer->ppSliceInLayer;
1195 SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];1195 SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
1196 const int32_t kiSliceId = pSlice->uiSliceIdx;1196 const int32_t kiSliceId = pSlice->uiSliceIdx;
1197 SRCSlicing* pSOverRc = &pSliceInLayer[kiSliceId].sSlicingOverRc;1197 SRCSlicing* pSOverRc = &ppSliceInLayer[kiSliceId]->sSlicingOverRc;
1198 SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;1198 SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;
1199 const uint8_t kuiChromaQpIndexOffset = pCurLayer->sLayerInfo.pPpsP->uiChromaQpIndexOffset;1199 const uint8_t kuiChromaQpIndexOffset = pCurLayer->sLayerInfo.pPpsP->uiChromaQpIndexOffset;
1200 1200
@@ -1218,10 +1218,10 @@ void WelsRcMbInitGom (sWelsEncCtx* pEncCtx, SMB* pCurMb, SSlice* pSlice) { · 17 unmodified lines
1218}1218}
1219 1219
1220void WelsRcMbInfoUpdateGom (sWelsEncCtx* pEncCtx, SMB* pCurMb, int32_t iCostLuma, SSlice* pSlice) {1220void WelsRcMbInfoUpdateGom (sWelsEncCtx* pEncCtx, SMB* pCurMb, int32_t iCostLuma, SSlice* pSlice) {
1221 SSlice* pSliceInLayer = pEncCtx->pCurDqLayer->sLayerInfo.pSliceInLayer;1221 SSlice** ppSliceInLayer = pEncCtx->pCurDqLayer->ppSliceInLayer;
1222 SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];1222 SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
1223 int32_t iSliceId = pSlice->uiSliceIdx;1223 int32_t iSliceId = pSlice->uiSliceIdx;
1224 SRCSlicing* pSOverRc = &pSliceInLayer[iSliceId].sSlicingOverRc;1224 SRCSlicing* pSOverRc = &ppSliceInLayer[iSliceId]->sSlicingOverRc;
1225 1225
1226 const int32_t kiComplexityIndex = pSOverRc->iComplexityIndexSlice;1226 const int32_t kiComplexityIndex = pSOverRc->iComplexityIndexSlice;
1227 1227

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