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
562 SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];562 SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
563 SRCSlicing* pSOverRc = &pWelsSvcRc->pSlicingOverRc[kiSliceId];563 SRCSlicing* pSOverRc = &pWelsSvcRc->pSlicingOverRc[kiSliceId];
564 int32_t iLumaQp = pSOverRc->iCalculatedQpSlice;564 int32_t iLumaQp = pSOverRc->iCalculatedQpSlice;
565 565 SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;
566 const uint8_t kuiChromaQpIndexOffset = pCurLayer->sLayerInfo.pPpsP->uiChromaQpIndexOffset;
566#ifndef _NOT_USE_AQ_FOR_TEST_567#ifndef _NOT_USE_AQ_FOR_TEST_
567 if (pEncCtx->pSvcParam->bEnableAdaptiveQuant) {568 if (pEncCtx->pSvcParam->bEnableAdaptiveQuant) {
568 iLumaQp = (int8_t)WELS_CLIP3 (iLumaQp +569 iLumaQp = (int8_t)WELS_CLIP3 (iLumaQp +
569 pEncCtx->pVaa->sAdaptiveQuantParam.pMotionTextureIndexToDeltaQp[pCurMb->iMbXY], pWelsSvcRc->iMinQp, 51);570 pEncCtx->pVaa->sAdaptiveQuantParam.pMotionTextureIndexToDeltaQp[pCurMb->iMbXY], pWelsSvcRc->iMinQp, 51);
570 }571 }
571#endif572#endif
572 pCurMb->uiChromaQp = g_kuiChromaQpTable[iLumaQp];573 pCurMb->uiChromaQp = g_kuiChromaQpTable[CLIP3_QP_0_51 (iLumaQp + kuiChromaQpIndexOffset)];
573 pCurMb->uiLumaQp = iLumaQp;574 pCurMb->uiLumaQp = iLumaQp;
574}575}
575 576
@@ -873,12 +874,16 @@ void WelsRcMbInitGom (void* pCtx, SMB* pCurMb, SSlice* pSlice) { · 297 unmodified lines
873 const int32_t kiSliceId = pSlice->uiSliceIdx;874 const int32_t kiSliceId = pSlice->uiSliceIdx;
874 SRCSlicing* pSOverRc = &pWelsSvcRc->pSlicingOverRc[kiSliceId];875 SRCSlicing* pSOverRc = &pWelsSvcRc->pSlicingOverRc[kiSliceId];
875 SBitStringAux* bs = pSlice->pSliceBsa;876 SBitStringAux* bs = pSlice->pSliceBsa;
876 877 SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;
878 const uint8_t kuiChromaQpIndexOffset = pCurLayer->sLayerInfo.pPpsP->uiChromaQpIndexOffset;
877 879
878 pSOverRc->iBsPosSlice = BsGetBitsPos (bs);880 pSOverRc->iBsPosSlice = BsGetBitsPos (bs);
879 881
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)];
881 return;885 return;
886 }
882 //calculate gom qp and target bits at the beginning of gom887 //calculate gom qp and target bits at the beginning of gom
883 if (0 == (pCurMb->iMbXY % pWelsSvcRc->iNumberMbGom)) {888 if (0 == (pCurMb->iMbXY % pWelsSvcRc->iNumberMbGom)) {
884 if (pCurMb->iMbXY != pSOverRc->iStartMbSlice) {889 if (pCurMb->iMbXY != pSOverRc->iStartMbSlice) {
@@ -915,7 +920,6 @@ void WelsRcPictureInitDisable (void* pCtx) { · 30 unmodified lines
915 sWelsEncCtx* pEncCtx = (sWelsEncCtx*)pCtx;920 sWelsEncCtx* pEncCtx = (sWelsEncCtx*)pCtx;
916 SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];921 SWelsSvcRc* pWelsSvcRc = &pEncCtx->pWelsSvcRc[pEncCtx->uiDependencyId];
917 SDLayerParam* pDLayerParam = &pEncCtx->pSvcParam->sDependencyLayers[pEncCtx->uiDependencyId];922 SDLayerParam* pDLayerParam = &pEncCtx->pSvcParam->sDependencyLayers[pEncCtx->uiDependencyId];
918
919 const int32_t kiQp = pDLayerParam->iDLayerQp;923 const int32_t kiQp = pDLayerParam->iDLayerQp;
920 924
921 pEncCtx->iGlobalQp = RcCalculateCascadingQp (pEncCtx, kiQp);925 pEncCtx->iGlobalQp = RcCalculateCascadingQp (pEncCtx, kiQp);
@@ -936,6 +940,8 @@ void WelsRcPictureInfoUpdateDisable (void* pCtx, int32_t layer_size) { · 14 unmodified lines
936void WelsRcMbInitDisable (void* pCtx, SMB* pCurMb, SSlice* pSlice) {940void WelsRcMbInitDisable (void* pCtx, SMB* pCurMb, SSlice* pSlice) {
937 sWelsEncCtx* pEncCtx = (sWelsEncCtx*)pCtx;941 sWelsEncCtx* pEncCtx = (sWelsEncCtx*)pCtx;
938 int32_t iLumaQp = pEncCtx->iGlobalQp;942 int32_t iLumaQp = pEncCtx->iGlobalQp;
943 SDqLayer* pCurLayer = pEncCtx->pCurDqLayer;
944 const uint8_t kuiChromaQpIndexOffset = pCurLayer->sLayerInfo.pPpsP->uiChromaQpIndexOffset;
939 945
940 if (pEncCtx->pSvcParam->bEnableAdaptiveQuant && (pEncCtx->eSliceType == P_SLICE)) {946 if (pEncCtx->pSvcParam->bEnableAdaptiveQuant && (pEncCtx->eSliceType == P_SLICE)) {
941 iLumaQp = (int8_t)WELS_CLIP3 (iLumaQp +947 iLumaQp = (int8_t)WELS_CLIP3 (iLumaQp +
@@ -943,7 +949,7 @@ void WelsRcMbInitDisable (void* pCtx, SMB* pCurMb, SSlice* pSlice) { · 1 unmodified line
943 } else {949 } else {
944 iLumaQp = WELS_CLIP3 (iLumaQp, FIX_MIN_QP_MODE, FIX_MAX_QP_MODE);950 iLumaQp = WELS_CLIP3 (iLumaQp, FIX_MIN_QP_MODE, FIX_MAX_QP_MODE);
945 }951 }
946 pCurMb->uiChromaQp = g_kuiChromaQpTable[iLumaQp];952 pCurMb->uiChromaQp = g_kuiChromaQpTable[CLIP3_QP_0_51 (iLumaQp + kuiChromaQpIndexOffset)];
947 pCurMb->uiLumaQp = iLumaQp;953 pCurMb->uiLumaQp = iLumaQp;
948}954}
949 955

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