Showing the changes to codec/encoder/core/src/ratectl.cpp (1 of 3 files). Show all
Unified · Split
| @@ -512,25 +512,37 @@ void RcCalculatePictureQp (sWelsEncCtx* pEncCtx) { · 511 unmodified lines | ||
| 512 | 512 | pEncCtx->iGlobalQp = iLumaQp; |
| 513 | 513 | } |
| 514 | 514 | |
| 515 | −void RcInitSliceInformation (sWelsEncCtx* pEncCtx) { | |
| 516 | − SSlice** ppSliceInLayer = pEncCtx->pCurDqLayer->ppSliceInLayer; | |
| 517 | − SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId]; | |
| 518 | − SRCSlicing* pSOverRc = &ppSliceInLayer[0]->sSlicingOverRc; | |
| 519 | − const int32_t kiSliceNum = pWelsSvcRc->iSliceNum; | |
| 520 | − const int32_t kiBitsPerMb = WELS_DIV_ROUND (static_cast<int64_t> (pWelsSvcRc->iTargetBits) * INT_MULTIPLY, | |
| 521 | − pWelsSvcRc->iNumberMbFrame); | |
| 515 | +void RCInitOneSliceInformation(sWelsEncCtx* pEncCtx, SSlice* pSlice) { | |
| 516 | + | |
| 517 | + bool bGomRC = (RC_OFF_MODE == pEncCtx->pSvcParam->iRCMode || | |
| 518 | + RC_BUFFERBASED_MODE == pEncCtx->pSvcParam->iRCMode || | |
| 519 | + (RC_TIMESTAMP_MODE == pEncCtx->pSvcParam->iRCMode && | |
| 520 | + pEncCtx->pSvcParam->iUsageType == SCREEN_CONTENT_REAL_TIME) ) ? false : true; | |
| 521 | + if(bGomRC) { | |
| 522 | + SRCSlicing* pSOverRc = &pSlice->sSlicingOverRc; | |
| 523 | + const int32_t kiBitsPerMb = pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId].iBitsPerMb; | |
| 524 | + pSOverRc->iStartMbSlice = pSlice->sSliceHeaderExt.sSliceHeader.iFirstMbInSlice; | |
| 525 | + pSOverRc->iEndMbSlice = pSOverRc->iStartMbSlice + pSlice->iCountMbNumInSlice - 1; | |
| 526 | + pSOverRc->iTargetBitsSlice = WELS_DIV_ROUND (static_cast<int64_t> (kiBitsPerMb) * pSlice->iCountMbNumInSlice, | |
| 527 | + INT_MULTIPLY); | |
| 528 | + } | |
| 529 | +} | |
| 522 | 530 | |
| 531 | +void RcInitSliceInformation (sWelsEncCtx* pEncCtx) { | |
| 532 | + SSlice** ppSliceInLayer = pEncCtx->pCurDqLayer->ppSliceInLayer; | |
| 533 | + SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId]; | |
| 534 | + const int32_t kiSliceNum = pWelsSvcRc->iSliceNum; | |
| 535 | + pWelsSvcRc->iBitsPerMb = WELS_DIV_ROUND (static_cast<int64_t> (pWelsSvcRc->iTargetBits) * INT_MULTIPLY, | |
| 536 | + pWelsSvcRc->iNumberMbFrame); | |
| 523 | 537 | for (int32_t i = 0; i < kiSliceNum; i++) { |
| 524 | − pSOverRc = &ppSliceInLayer[i]->sSlicingOverRc; | |
| 525 | − pSOverRc->iStartMbSlice = | |
| 526 | − pSOverRc->iEndMbSlice = ppSliceInLayer[i]->sSliceHeaderExt.sSliceHeader.iFirstMbInSlice; | |
| 527 | − pSOverRc->iEndMbSlice += (ppSliceInLayer[i]->iCountMbNumInSlice - 1); | |
| 528 | − pSOverRc->iTotalQpSlice = 0; | |
| 529 | − pSOverRc->iTotalMbSlice = 0; | |
| 530 | − pSOverRc->iTargetBitsSlice = WELS_DIV_ROUND (static_cast<int64_t> (kiBitsPerMb) * ppSliceInLayer[i]->iCountMbNumInSlice, | |
| 531 | − INT_MULTIPLY); | |
| 532 | − pSOverRc->iFrameBitsSlice = 0; | |
| 533 | − pSOverRc->iGomBitsSlice = 0; | |
| 538 | + SRCSlicing* pSOverRc = &ppSliceInLayer[i]->sSlicingOverRc; | |
| 539 | + pSOverRc->iTotalQpSlice = 0; | |
| 540 | + pSOverRc->iTotalMbSlice = 0; | |
| 541 | + pSOverRc->iFrameBitsSlice = 0; | |
| 542 | + pSOverRc->iGomBitsSlice = 0; | |
| 543 | + pSOverRc->iStartMbSlice = 0; | |
| 544 | + pSOverRc->iEndMbSlice = 0; | |
| 545 | + pSOverRc->iTargetBitsSlice = 0; | |
| 534 | 546 | } |
| 535 | 547 | } |
| 536 | 548 | |