Home | History | Annotate | Download | only in src
      1 /*
      2  * Copyright (C) 2007-2008 ARM Limited
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  *
     16  */
     17 /**
     18  *
     19  * File Name:  omxVCM4P2_DecodeBlockCoef_Inter.c
     20  * OpenMAX DL: v1.0.2
     21  * Revision:   9641
     22  * Date:       Thursday, February 7, 2008
     23  *
     24  *
     25  *
     26  *
     27  * Description:
     28  * Contains modules for inter reconstruction
     29  *
     30  */
     31 
     32 
     33 #include "omxtypes.h"
     34 #include "armOMX.h"
     35 #include "omxVC.h"
     36 
     37 #include "armCOMM.h"
     38 
     39 
     40 /**
     41  * Function: omxVCM4P2_DecodeBlockCoef_Inter
     42  *
     43  * Description:
     44  * Decodes the INTER block coefficients. Inverse quantization, inversely zigzag
     45  * positioning and IDCT, with appropriate clipping on each step, are performed
     46  * on the coefficients. The results (residuals) are placed in a contiguous array
     47  * of 64 elements. For INTER block, the output buffer holds the residuals for
     48  * further reconstruction.
     49  *
     50  * Remarks:
     51  *
     52  * Parameters:
     53  * [in]	ppBitStream		pointer to the pointer to the current byte in
     54  *								the bit stream buffer. There is no boundary
     55  *								check for the bit stream buffer.
     56  * [in]	pBitOffset		pointer to the bit position in the byte pointed
     57  *								to by *ppBitStream. *pBitOffset is valid within
     58  *								[0-7]
     59  * [in]	QP				quantization parameter
     60  * [in] shortVideoHeader    a flag indicating presence of short_video_header;
     61  *                           shortVideoHeader==1 indicates using quantization method defined in short
     62  *                           video header mode, and shortVideoHeader==0 indicates normail quantization method.
     63  * [out] ppBitStream 	*ppBitStream is updated after the block is decoded, so that it points to the
     64  *                      current byte in the bit stream buffer.
     65  * [out] pBitOffset		*pBitOffset is updated so that it points to the current bit position in the
     66  *                      byte pointed by *ppBitStream
     67  * [out] pDst			pointer to the decoded residual buffer (a contiguous array of 64 elements of
     68  *                      OMX_S16 data type). Must be 16-byte aligned.
     69  *
     70  * Return Value:
     71  * OMX_Sts_NoErr - no error
     72  * OMX_Sts_BadArgErr - bad arguments
     73  *   - At least one of the following pointers is Null: ppBitStream, *ppBitStream, pBitOffset , pDst
     74  *   - At least one of the below case:
     75  *   - *pBitOffset exceeds [0,7], QP <= 0;
     76  *	 - pDst not 16-byte aligned
     77  * OMX_Sts_Err - status error
     78  *
     79  */
     80 OMXResult omxVCM4P2_DecodeBlockCoef_Inter(
     81      const OMX_U8 ** ppBitStream,
     82      OMX_INT * pBitOffset,
     83      OMX_S16 * pDst,
     84      OMX_INT QP,
     85      OMX_INT shortVideoHeader
     86 )
     87 {
     88     /* 64 elements are needed but to align it to 16 bytes need
     89     15 more elements of padding */
     90     OMX_S16 tempBuf[79];
     91     OMX_S16 *pTempBuf1;
     92     OMXResult errorCode;
     93     /* Aligning the local buffers */
     94     pTempBuf1 = armAlignTo16Bytes(tempBuf);
     95 
     96 
     97     /* VLD and zigzag */
     98     errorCode = omxVCM4P2_DecodeVLCZigzag_Inter(ppBitStream, pBitOffset,
     99                                         pTempBuf1,shortVideoHeader);
    100     armRetDataErrIf((errorCode != OMX_Sts_NoErr), errorCode);
    101 
    102     /* Dequantization */
    103     errorCode = omxVCM4P2_QuantInvInter_I(
    104      pTempBuf1,
    105      QP);
    106     armRetDataErrIf((errorCode != OMX_Sts_NoErr), errorCode);
    107 
    108     /* Inverse transform */
    109     errorCode = omxVCM4P2_IDCT8x8blk(pTempBuf1, pDst);
    110     armRetDataErrIf((errorCode != OMX_Sts_NoErr), errorCode);
    111 
    112     return OMX_Sts_NoErr;
    113 }
    114 
    115 /* End of file */
    116 
    117 
    118