History

Merge pull request #895 from ruil2/enc_rc_1

remove redundant code for mb qp calculation

huili2 committed 12 years ago

Commit ce0d3712 parents 1113afb 31120dd2 files · +13 −13Browse files

Showing the changes to codec/encoder/core/src/ratectl.cpp (1 of 2 files). Show all

Unified · Split

codec/encoder/core/src/ratectl.cpp+12−6
@@ -562,14 +562,15 @@ void RcCalculateMbQp (sWelsEncCtx* pEncCtx, SMB* pCurMb, const int32_t kiSliceId · 561 unmodified lines
562562 SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
563563 SRCSlicing* pSOverRc = &pWelsSvcRc->pSlicingOverRc[kiSliceId];
564564 int32_t iLumaQp = pSOverRc->iCalculatedQpSlice;
565−
565+ SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;
566+ const uint8_t kuiChromaQpIndexOffset = pCurLayer->sLayerInfo.pPpsP->uiChromaQpIndexOffset;
566567 #ifndef _NOT_USE_AQ_FOR_TEST_
567568 if (pEncCtx->pSvcParam->bEnableAdaptiveQuant) {
568569 iLumaQp = (int8_t)WELS_CLIP3 (iLumaQp +
569570 pEncCtx->pVaa->sAdaptiveQuantParam.pMotionTextureIndexToDeltaQp[pCurMb->iMbXY], pWelsSvcRc->iMinQp, 51);
570571 }
571572 #endif
572− pCurMb->uiChromaQp = g_kuiChromaQpTable[iLumaQp];
573+ pCurMb->uiChromaQp = g_kuiChromaQpTable[CLIP3_QP_0_51 (iLumaQp + kuiChromaQpIndexOffset)];
573574 pCurMb->uiLumaQp = iLumaQp;
574575 }
575576
@@ -873,12 +874,16 @@ void WelsRcMbInitGom (void* pCtx, SMB* pCurMb, SSlice* pSlice) { · 297 unmodified lines
873874 const int32_t kiSliceId = pSlice->uiSliceIdx;
874875 SRCSlicing* pSOverRc = &pWelsSvcRc->pSlicingOverRc[kiSliceId];
875876 SBitStringAux* bs = pSlice->pSliceBsa;
876−
877+ SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;
878+ const uint8_t kuiChromaQpIndexOffset = pCurLayer->sLayerInfo.pPpsP->uiChromaQpIndexOffset;
877879
878880 pSOverRc->iBsPosSlice = BsGetBitsPos (bs);
879881
880− if (pEncCtx->eSliceType == I_SLICE)
882+ if (pEncCtx->eSliceType == I_SLICE) {
883+ pCurMb->uiLumaQp = pEncCtx->iGlobalQp;
884+ pCurMb->uiChromaQp = g_kuiChromaQpTable[CLIP3_QP_0_51 (pCurMb->uiLumaQp + kuiChromaQpIndexOffset)];
881885 return;
886+ }
882887 //calculate gom qp and target bits at the beginning of gom
883888 if (0 == (pCurMb->iMbXY % pWelsSvcRc->iNumberMbGom)) {
884889 if (pCurMb->iMbXY != pSOverRc->iStartMbSlice) {
@@ -915,7 +920,6 @@ void WelsRcPictureInitDisable (void* pCtx) { · 30 unmodified lines
915920 sWelsEncCtx* pEncCtx = (sWelsEncCtx*)pCtx;
916921 SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
917922 SDLayerParam* pDLayerParam = &pEncCtx->pSvcParam->sDependencyLayers[pEncCtx->uiDependencyId];
918−
919923 const int32_t kiQp = pDLayerParam->iDLayerQp;
920924
921925 pEncCtx->iGlobalQp = RcCalculateCascadingQp (pEncCtx, kiQp);
@@ -936,6 +940,8 @@ void WelsRcPictureInfoUpdateDisable (void* pCtx, int32_t layer_size) { · 14 unmodified lines
936940 void WelsRcMbInitDisable (void* pCtx, SMB* pCurMb, SSlice* pSlice) {
937941 sWelsEncCtx* pEncCtx = (sWelsEncCtx*)pCtx;
938942 int32_t iLumaQp = pEncCtx->iGlobalQp;
943+ SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;
944+ const uint8_t kuiChromaQpIndexOffset = pCurLayer->sLayerInfo.pPpsP->uiChromaQpIndexOffset;
939945
940946 if (pEncCtx->pSvcParam->bEnableAdaptiveQuant && (pEncCtx->eSliceType == P_SLICE)) {
941947 iLumaQp = (int8_t)WELS_CLIP3 (iLumaQp +
@@ -943,7 +949,7 @@ void WelsRcMbInitDisable (void* pCtx, SMB* pCurMb, SSlice* pSlice) { · 1 unmodified line
943949 } else {
944950 iLumaQp = WELS_CLIP3 (iLumaQp, FIX_MIN_QP_MODE, FIX_MAX_QP_MODE);
945951 }
946− pCurMb->uiChromaQp = g_kuiChromaQpTable[iLumaQp];
952+ pCurMb->uiChromaQp = g_kuiChromaQpTable[CLIP3_QP_0_51 (iLumaQp + kuiChromaQpIndexOffset)];
947953 pCurMb->uiLumaQp = iLumaQp;
948954 }
949955

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