Home | History | Annotate | Download | only in src
      1 /**
      2  *
      3  * File Name:  omxVCM4P2_DecodeBlockCoef_Inter.c
      4  * OpenMAX DL: v1.0.2
      5  * Revision:   12290
      6  * Date:       Wednesday, April 9, 2008
      7  *
      8  * (c) Copyright 2007-2008 ARM Limited. All Rights Reserved.
      9  *
     10  *
     11  *
     12  * Description:
     13  * Contains modules for inter reconstruction
     14  *
     15  */
     16 
     17 
     18 #include "omxtypes.h"
     19 #include "armOMX.h"
     20 #include "omxVC.h"
     21 
     22 #include "armCOMM.h"
     23 
     24 
     25 /**
     26  * Function: omxVCM4P2_DecodeBlockCoef_Inter
     27  *
     28  * Description:
     29  * Decodes the INTER block coefficients. Inverse quantization, inversely zigzag
     30  * positioning and IDCT, with appropriate clipping on each step, are performed
     31  * on the coefficients. The results (residuals) are placed in a contiguous array
     32  * of 64 elements. For INTER block, the output buffer holds the residuals for
     33  * further reconstruction.
     34  *
     35  * Remarks:
     36  *
     37  * Parameters:
     38  * [in]	ppBitStream		pointer to the pointer to the current byte in
     39  *								the bit stream buffer. There is no boundary
     40  *								check for the bit stream buffer.
     41  * [in]	pBitOffset		pointer to the bit position in the byte pointed
     42  *								to by *ppBitStream. *pBitOffset is valid within
     43  *								[0-7]
     44  * [in]	QP				quantization parameter
     45  * [in] shortVideoHeader    a flag indicating presence of short_video_header;
     46  *                           shortVideoHeader==1 indicates using quantization method defined in short
     47  *                           video header mode, and shortVideoHeader==0 indicates normail quantization method.
     48  * [out] ppBitStream 	*ppBitStream is updated after the block is decoded, so that it points to the
     49  *                      current byte in the bit stream buffer.
     50  * [out] pBitOffset		*pBitOffset is updated so that it points to the current bit position in the
     51  *                      byte pointed by *ppBitStream
     52  * [out] pDst			pointer to the decoded residual buffer (a contiguous array of 64 elements of
     53  *                      OMX_S16 data type). Must be 16-byte aligned.
     54  *
     55  * Return Value:
     56  * OMX_Sts_NoErr - no error
     57  * OMX_Sts_BadArgErr - bad arguments
     58  *   - At least one of the following pointers is Null: ppBitStream, *ppBitStream, pBitOffset , pDst
     59  *   - At least one of the below case:
     60  *   - *pBitOffset exceeds [0,7], QP <= 0;
     61  *	 - pDst not 16-byte aligned
     62  * OMX_Sts_Err - status error
     63  *
     64  */
     65 OMXResult omxVCM4P2_DecodeBlockCoef_Inter(
     66      const OMX_U8 ** ppBitStream,
     67      OMX_INT * pBitOffset,
     68      OMX_S16 * pDst,
     69      OMX_INT QP,
     70      OMX_INT shortVideoHeader
     71 )
     72 {
     73     /* 64 elements are needed but to align it to 16 bytes need
     74     15 more elements of padding */
     75     OMX_S16 tempBuf[79];
     76     OMX_S16 *pTempBuf1;
     77     OMXResult errorCode;
     78     /* Aligning the local buffers */
     79     pTempBuf1 = armAlignTo16Bytes(tempBuf);
     80 
     81 
     82     /* VLD and zigzag */
     83     errorCode = omxVCM4P2_DecodeVLCZigzag_Inter(ppBitStream, pBitOffset,
     84                                         pTempBuf1,shortVideoHeader);
     85     armRetDataErrIf((errorCode != OMX_Sts_NoErr), errorCode);
     86 
     87     /* Dequantization */
     88     errorCode = omxVCM4P2_QuantInvInter_I(
     89      pTempBuf1,
     90      QP);
     91     armRetDataErrIf((errorCode != OMX_Sts_NoErr), errorCode);
     92 
     93     /* Inverse transform */
     94     errorCode = omxVCM4P2_IDCT8x8blk(pTempBuf1, pDst);
     95     armRetDataErrIf((errorCode != OMX_Sts_NoErr), errorCode);
     96 
     97     return OMX_Sts_NoErr;
     98 }
     99 
    100 /* End of file */
    101 
    102 
    103