History

Multi-thread-fixed:RBC#1711:refactoring for RcInitSliceInformation

huade committed 9 years ago

Commit cfae7231 parent c2e37d53 files · +34 −17Browse 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+29−17
@@ -512,25 +512,37 @@ void RcCalculatePictureQp (sWelsEncCtx* pEncCtx) { · 511 unmodified lines
512 pEncCtx->iGlobalQp = iLumaQp;512 pEncCtx->iGlobalQp = iLumaQp;
513}513}
514 514
515void RcInitSliceInformation (sWelsEncCtx* pEncCtx) {515void RCInitOneSliceInformation(sWelsEncCtx* pEncCtx, SSlice* pSlice) {
516 SSlice** ppSliceInLayer = pEncCtx->pCurDqLayer->ppSliceInLayer;516
517 SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];517 bool bGomRC = (RC_OFF_MODE == pEncCtx->pSvcParam->iRCMode ||
518 SRCSlicing* pSOverRc = &ppSliceInLayer[0]->sSlicingOverRc;518 RC_BUFFERBASED_MODE == pEncCtx->pSvcParam->iRCMode ||
519 const int32_t kiSliceNum = pWelsSvcRc->iSliceNum;519 (RC_TIMESTAMP_MODE == pEncCtx->pSvcParam->iRCMode &&
520 const int32_t kiBitsPerMb = WELS_DIV_ROUND (static_cast<int64_t> (pWelsSvcRc->iTargetBits) * INT_MULTIPLY,520 pEncCtx->pSvcParam->iUsageType == SCREEN_CONTENT_REAL_TIME) ) ? false : true;
521 pWelsSvcRc->iNumberMbFrame);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
531void 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 for (int32_t i = 0; i < kiSliceNum; i++) {537 for (int32_t i = 0; i < kiSliceNum; i++) {
524 pSOverRc = &ppSliceInLayer[i]->sSlicingOverRc;538 SRCSlicing* pSOverRc = &ppSliceInLayer[i]->sSlicingOverRc;
525 pSOverRc->iStartMbSlice =539 pSOverRc->iTotalQpSlice = 0;
526 pSOverRc->iEndMbSlice = ppSliceInLayer[i]->sSliceHeaderExt.sSliceHeader.iFirstMbInSlice;540 pSOverRc->iTotalMbSlice = 0;
527 pSOverRc->iEndMbSlice += (ppSliceInLayer[i]->iCountMbNumInSlice - 1);541 pSOverRc->iFrameBitsSlice = 0;
528 pSOverRc->iTotalQpSlice = 0;542 pSOverRc->iGomBitsSlice = 0;
529 pSOverRc->iTotalMbSlice = 0;543 pSOverRc->iStartMbSlice = 0;
530 pSOverRc->iTargetBitsSlice = WELS_DIV_ROUND (static_cast<int64_t> (kiBitsPerMb) * ppSliceInLayer[i]->iCountMbNumInSlice,544 pSOverRc->iEndMbSlice = 0;
531 INT_MULTIPLY);545 pSOverRc->iTargetBitsSlice = 0;
532 pSOverRc->iFrameBitsSlice = 0;
533 pSOverRc->iGomBitsSlice = 0;
534 }546 }
535}547}
536 548

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