OMXResult omxVCM4P2_QuantInvInter_I( OMX_S16 * pSrcDst, OMX_INT QP ) { OMX_INT coeffCount, Sign; /* Argument error checks */ armRetArgErrIf(pSrcDst == NULL, OMX_Sts_BadArgErr); armRetArgErrIf(((QP <= 0) || (QP >= 32)), OMX_Sts_BadArgErr); /* Second Inverse quantisation method */ for (coeffCount = 0; coeffCount < 64; coeffCount++) { /* check sign */ Sign = armSignCheck (pSrcDst[coeffCount]); /* Quantize the coeff */ if (QP & 0x1) { pSrcDst[coeffCount] = (2* armAbs(pSrcDst[coeffCount]) + 1) * QP; pSrcDst[coeffCount] *= Sign; } else { pSrcDst[coeffCount] = (2* armAbs(pSrcDst[coeffCount]) + 1) * QP - 1; pSrcDst[coeffCount] *= Sign; } /* Saturate */ pSrcDst[coeffCount] = armClip (-2048, 2047, pSrcDst[coeffCount]); } return OMX_Sts_NoErr; }
OMXResult omxVCM4P2_QuantInter_I( OMX_S16 * pSrcDst, OMX_U8 QP, OMX_INT shortVideoHeader ) { /* Definitions and Initializations*/ OMX_INT coeffCount; OMX_INT fSign; OMX_INT maxClpAC = 0, minClpAC = 0; OMX_INT maxClpDC = 0, minClpDC = 0; /* Argument error checks */ armRetArgErrIf(pSrcDst == NULL, OMX_Sts_BadArgErr); armRetArgErrIf(((QP <= 0) || (QP >= 32)), OMX_Sts_BadArgErr); /* One argument check is delayed until we have ascertained that */ /* pQMatrix is not NULL. */ /* Set the Clip Range based on SVH on/off */ if(shortVideoHeader == 1) { maxClpDC = 254; minClpDC = 1; maxClpAC = 127; minClpAC = -127; } else { maxClpDC = 2047; minClpDC = -2047; maxClpAC = 2047; minClpAC = -2047; } /* Second Inverse quantisation method */ for (coeffCount = 0; coeffCount < 64; coeffCount++) { fSign = armSignCheck (pSrcDst[coeffCount]); pSrcDst[coeffCount] = (armAbs(pSrcDst[coeffCount]) - (QP/2))/(2 * QP); pSrcDst[coeffCount] *= fSign; /* Clip */ if (coeffCount == 0) { pSrcDst[coeffCount] = (OMX_S16) armClip (minClpDC, maxClpDC, pSrcDst[coeffCount]); } else { pSrcDst[coeffCount] = (OMX_S16) armClip (minClpAC, maxClpAC, pSrcDst[coeffCount]); } } return OMX_Sts_NoErr; }
OMXResult omxVCM4P2_QuantIntra_I( OMX_S16 * pSrcDst, OMX_U8 QP, OMX_INT blockIndex, OMX_INT shortVideoHeader ) { /* Definitions and Initializations*/ /* Initialized to remove compilation error */ OMX_INT dcScaler = 0, coeffCount,fSign; OMX_INT maxClpAC, minClpAC; /* Argument error checks */ armRetArgErrIf(pSrcDst == NULL, OMX_Sts_BadArgErr); armRetArgErrIf(((blockIndex < 0) || (blockIndex >= 10)), OMX_Sts_BadArgErr); armRetArgErrIf(((QP <= 0) || (QP >= 32)), OMX_Sts_BadArgErr); /* One argument check is delayed until we have ascertained that */ /* pQMatrix is not NULL. */ /* Set the Clip Range based on SVH on/off */ if(shortVideoHeader == 1) { maxClpAC = 127; minClpAC = -127; dcScaler = 8; /* Dequant the DC value, this applies to both the methods */ pSrcDst[0] = armIntDivAwayFromZero (pSrcDst[0], dcScaler); /* Clip between 1 and 254 */ pSrcDst[0] = (OMX_S16) armClip (1, 254, pSrcDst[0]); } else { maxClpAC = 2047; minClpAC = -2047; /* Calculate the DC scaler value */ if ((blockIndex < 4) || (blockIndex > 5)) { if (QP >= 1 && QP <= 4) { dcScaler = 8; } else if (QP >= 5 && QP <= 8) { dcScaler = 2 * QP; } else if (QP >= 9 && QP <= 24) { dcScaler = QP + 8; } else { dcScaler = (2 * QP) - 16; } } else if (blockIndex < 6) { if (QP >= 1 && QP <= 4) { dcScaler = 8; } else if (QP >= 5 && QP <= 24) { dcScaler = (QP + 13)/2; } else { dcScaler = QP - 6; } } /* Dequant the DC value, this applies to both the methods */ pSrcDst[0] = armIntDivAwayFromZero (pSrcDst[0], dcScaler); } /* Second Inverse quantisation method */ for (coeffCount = 1; coeffCount < 64; coeffCount++) { fSign = armSignCheck (pSrcDst[coeffCount]); pSrcDst[coeffCount] = armAbs(pSrcDst[coeffCount])/(2 * QP); pSrcDst[coeffCount] *= fSign; /* Clip */ pSrcDst[coeffCount] = (OMX_S16) armClip (minClpAC, maxClpAC, pSrcDst[coeffCount]); } return OMX_Sts_NoErr; }
OMXResult omxVCM4P2_QuantInvIntra_I( OMX_S16 * pSrcDst, OMX_INT QP, OMXVCM4P2VideoComponent videoComp, OMX_INT shortVideoHeader ) { /* Initialized to remove compilation error */ OMX_INT dcScaler = 0, coeffCount, Sign; /* Argument error checks */ armRetArgErrIf(pSrcDst == NULL, OMX_Sts_BadArgErr); armRetArgErrIf(((QP <= 0) || (QP >= 32)), OMX_Sts_BadArgErr); armRetArgErrIf(((videoComp != OMX_VC_LUMINANCE) && (videoComp != OMX_VC_CHROMINANCE)), OMX_Sts_BadArgErr); /* Calculate the DC scaler value */ /* linear intra DC mode */ if(shortVideoHeader) { dcScaler = 8; } /* nonlinear intra DC mode */ else { if (videoComp == OMX_VC_LUMINANCE) { if (QP >= 1 && QP <= 4) { dcScaler = 8; } else if (QP >= 5 && QP <= 8) { dcScaler = 2 * QP; } else if (QP >= 9 && QP <= 24) { dcScaler = QP + 8; } else { dcScaler = (2 * QP) - 16; } } else if (videoComp == OMX_VC_CHROMINANCE) { if (QP >= 1 && QP <= 4) { dcScaler = 8; } else if (QP >= 5 && QP <= 24) { dcScaler = (QP + 13)/2; } else { dcScaler = QP - 6; } } } /* Dequant the DC value, this applies to both the methods */ pSrcDst[0] = pSrcDst[0] * dcScaler; /* Saturate */ pSrcDst[0] = armClip (-2048, 2047, pSrcDst[0]); /* Second Inverse quantisation method */ for (coeffCount = 1; coeffCount < 64; coeffCount++) { /* check sign */ Sign = armSignCheck (pSrcDst[coeffCount]); if (QP & 0x1) { pSrcDst[coeffCount] = (2* armAbs(pSrcDst[coeffCount]) + 1) * QP; pSrcDst[coeffCount] *= Sign; } else { pSrcDst[coeffCount] = (2* armAbs(pSrcDst[coeffCount]) + 1) * QP - 1; pSrcDst[coeffCount] *= Sign; } /* Saturate */ pSrcDst[coeffCount] = armClip (-2048, 2047, pSrcDst[coeffCount]); } return OMX_Sts_NoErr; }