Home | History | Annotate | Download | only in src
      1 /**
      2  *
      3  * File Name:  omxVCM4P2_TransRecBlockCoef_inter.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 DCT->quant and reconstructing the inter texture data
     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_TransRecBlockCoef_inter   (6.2.4.4.5)
     26  *
     27  * Description:
     28  * Implements DCT, and quantizes the DCT coefficients of the inter block
     29  * while reconstructing the texture residual. There is no boundary check for
     30  * the bit stream buffer.
     31  *
     32  * Input Arguments:
     33  *
     34  *   pSrc -pointer to the residuals to be encoded; must be aligned on an
     35  *            16-byte boundary.
     36  *   QP - quantization parameter.
     37  *   shortVideoHeader - binary flag indicating presence of short_video_header;
     38  *                      shortVideoHeader==1 selects linear intra DC mode, and
     39  *                      shortVideoHeader==0 selects non linear intra DC mode.
     40  *
     41  * Output Arguments:
     42  *
     43  *   pDst - pointer to the quantized DCT coefficients buffer; must be aligned
     44  *            on a 16-byte boundary.
     45  *   pRec - pointer to the reconstructed texture residuals; must be aligned
     46  *            on a 16-byte boundary.
     47  *
     48  * Return Value:
     49  *
     50  *    OMX_Sts_NoErr - no error
     51  *    OMX_Sts_BadArgErr - bad arguments:
     52  *    -    At least one of the following pointers is either NULL or
     53  *         not 16-byte aligned:
     54  *            - pSrc
     55  *            - pDst
     56  *            - pRec
     57  *    -    QP <= 0 or QP >= 32.
     58  *
     59  */
     60 
     61 OMXResult omxVCM4P2_TransRecBlockCoef_inter(
     62      const OMX_S16 *pSrc,
     63      OMX_S16 * pDst,
     64      OMX_S16 * pRec,
     65      OMX_U8 QP,
     66      OMX_INT shortVideoHeader
     67 )
     68 {
     69     /* 64 elements are needed but to align it to 16 bytes need
     70     8 more elements of padding */
     71     OMX_S16 tempBuffer[72];
     72     OMX_S16 *pTempBuffer;
     73     OMX_INT i;
     74 
     75     /* Aligning the local buffers */
     76     pTempBuffer = armAlignTo16Bytes(tempBuffer);
     77 
     78     /* Argument error checks */
     79     armRetArgErrIf(pSrc == NULL, OMX_Sts_BadArgErr);
     80     armRetArgErrIf(pRec == NULL, OMX_Sts_BadArgErr);
     81     armRetArgErrIf(pDst == NULL, OMX_Sts_BadArgErr);
     82     armRetArgErrIf(!armIs16ByteAligned(pSrc), OMX_Sts_BadArgErr);
     83     armRetArgErrIf(!armIs16ByteAligned(pRec), OMX_Sts_BadArgErr);
     84     armRetArgErrIf(!armIs16ByteAligned(pDst), OMX_Sts_BadArgErr);
     85     armRetArgErrIf(((QP <= 0) || (QP >= 32)), OMX_Sts_BadArgErr);
     86 
     87     omxVCM4P2_DCT8x8blk (pSrc, pDst);
     88     omxVCM4P2_QuantInter_I(
     89      pDst,
     90      QP,
     91      shortVideoHeader);
     92 
     93     for (i = 0; i < 64; i++)
     94     {
     95         pTempBuffer[i] = pDst[i];
     96     }
     97 
     98     omxVCM4P2_QuantInvInter_I(
     99      pTempBuffer,
    100      QP);
    101     omxVCM4P2_IDCT8x8blk (pTempBuffer, pRec);
    102 
    103     return OMX_Sts_NoErr;
    104 }
    105 
    106 /* End of file */
    107 
    108 
    109