Home | History | Annotate | Download | only in src
      1 /**
      2  *
      3  * File Name:  omxVCM4P2_QuantInvInter_I.c
      4  * OpenMAX DL: v1.0.2
      5  * Revision:   9641
      6  * Date:       Thursday, February 7, 2008
      7  *
      8  * (c) Copyright 2007-2008 ARM Limited. All Rights Reserved.
      9  *
     10  *
     11  *
     12  * Description:
     13  * Contains modules for inter inverse Quantization
     14  *
     15  */
     16 
     17 #include "omxtypes.h"
     18 #include "armOMX.h"
     19 #include "omxVC.h"
     20 
     21 #include "armCOMM.h"
     22 
     23 
     24 /**
     25  * Function:  omxVCM4P2_QuantInvInter_I   (6.2.5.3.2)
     26  *
     27  * Description:
     28  * Performs the second inverse quantization mode on an intra/inter coded
     29  * block. Supports bits_per_pixel = 8. The output coefficients are clipped to
     30  * the range [-2048, 2047].
     31  *
     32  * Input Arguments:
     33  *
     34  *   pSrcDst - pointer to the input (quantized) intra/inter block; must be
     35  *            aligned on a 16-byte boundary.
     36  *   QP - quantization parameter (quantizer_scale)
     37  *   videoComp - video component type of the current block. Takes one of the
     38  *            following flags: OMX_VC_LUMINANCE, OMX_VC_CHROMINANCE (intra
     39  *            version only).
     40  *   shortVideoHeader - binary flag indicating presence of short_video_header
     41  *            (intra version only).
     42  *
     43  * Output Arguments:
     44  *
     45  *   pSrcDst - pointer to the output (dequantized) intra/inter block
     46  *
     47  * Return Value:
     48  *
     49  *    OMX_Sts_NoErr - no error
     50  *    OMX_Sts_BadArgErr - bad arguments; one or more of the following is
     51  *              true:
     52  *    -    pSrcDst is NULL
     53  *    -    QP <= 0 or QP >=31
     54  *    -    videoComp is neither OMX_VC_LUMINANCE nor OMX_VC_CHROMINANCE.
     55  *
     56  */
     57 
     58 OMXResult omxVCM4P2_QuantInvInter_I(
     59      OMX_S16 * pSrcDst,
     60      OMX_INT QP
     61 	 )
     62 {
     63 
     64     OMX_INT coeffCount, Sign;
     65 
     66     /* Argument error checks */
     67     armRetArgErrIf(pSrcDst == NULL, OMX_Sts_BadArgErr);
     68     armRetArgErrIf(((QP <= 0) || (QP >= 32)), OMX_Sts_BadArgErr);
     69 
     70     /* Second Inverse quantisation method */
     71     for (coeffCount = 0; coeffCount < 64; coeffCount++)
     72     {
     73         /* check sign */
     74         Sign =  armSignCheck (pSrcDst[coeffCount]);
     75 
     76         /* Quantize the coeff */
     77         if (QP & 0x1)
     78         {
     79             pSrcDst[coeffCount] = (2* armAbs(pSrcDst[coeffCount]) + 1) * QP;
     80             pSrcDst[coeffCount] *= Sign;
     81         }
     82         else
     83         {
     84             pSrcDst[coeffCount] = (2* armAbs(pSrcDst[coeffCount]) + 1)
     85                                                                 * QP - 1;
     86             pSrcDst[coeffCount] *= Sign;
     87         }
     88         /* Saturate */
     89         pSrcDst[coeffCount] = armClip (-2048, 2047, pSrcDst[coeffCount]);
     90     }
     91     return OMX_Sts_NoErr;
     92 }
     93 
     94 /* End of file */
     95 
     96 
     97