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