Merge pull request #864 from ruil2/enc_quant

set minimum quant as 4 to avoid level code overflow
This commit is contained in:
dongzha 2014-05-20 10:45:55 +08:00
commit e751502412
2 changed files with 7 additions and 0 deletions

View File

@ -66,6 +66,8 @@ enum {
VGOP_SIZE = 8,
//qp information
FIX_MIN_QP_MODE = 4, //qp <4 will cause level code overflow in cavlc coding which isn't suppored in baseline profile
FIX_MAX_QP_MODE = 51,
GOM_MIN_QP_MODE = 12,
GOM_MAX_QP_MODE = 36,
MAX_LOW_BR_QP = 42,

View File

@ -920,7 +920,10 @@ void WelsRcPictureInitDisable (void* pCtx) {
if (pEncCtx->pSvcParam->bEnableAdaptiveQuant && (pEncCtx->eSliceType == P_SLICE)) {
pEncCtx->iGlobalQp = (int32_t)WELS_CLIP3 (pEncCtx->iGlobalQp -
pEncCtx->pVaa->sAdaptiveQuantParam.dAverMotionTextureIndexToDeltaQp, GOM_MIN_QP_MODE, GOM_MAX_QP_MODE);
}else{
pEncCtx->iGlobalQp = WELS_CLIP3(pEncCtx->iGlobalQp, FIX_MIN_QP_MODE, FIX_MAX_QP_MODE);
}
pWelsSvcRc->iAverageFrameQp = pEncCtx->iGlobalQp;
}
@ -934,6 +937,8 @@ void WelsRcMbInitDisable (void* pCtx, SMB* pCurMb, SSlice* pSlice) {
if (pEncCtx->pSvcParam->bEnableAdaptiveQuant && (pEncCtx->eSliceType == P_SLICE)) {
iLumaQp = (int8_t)WELS_CLIP3 (iLumaQp +
pEncCtx->pVaa->sAdaptiveQuantParam.pMotionTextureIndexToDeltaQp[pCurMb->iMbXY], GOM_MIN_QP_MODE, 51);
}else{
iLumaQp = WELS_CLIP3(iLumaQp,FIX_MIN_QP_MODE,FIX_MAX_QP_MODE);
}
pCurMb->uiChromaQp = g_kuiChromaQpTable[iLumaQp];
pCurMb->uiLumaQp = iLumaQp;