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
512512 pEncCtx->iGlobalQp = iLumaQp;
513513 }
514514
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+}
522530
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);
523537 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;
534546 }
535547 }
536548

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