Home | History | Annotate | Download | only in src
      1 /**
      2  *
      3  * File Name:  omxVCM4P2_DecodeVLCZigzag_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 for zigzag scanning and VLC decoding
     14  * for inter block.
     15  *
     16  */
     17 
     18 #include "omxtypes.h"
     19 #include "armOMX.h"
     20 #include "omxVC.h"
     21 
     22 #include "armVC.h"
     23 #include "armCOMM_Bitstream.h"
     24 #include "armCOMM.h"
     25 #include "armVCM4P2_Huff_Tables_VLC.h"
     26 #include "armVCM4P2_ZigZag_Tables.h"
     27 
     28 
     29 
     30 /**
     31  * Function:  omxVCM4P2_DecodeVLCZigzag_Inter   (6.2.5.2.3)
     32  *
     33  * Description:
     34  * Performs VLC decoding and inverse zigzag scan for one inter-coded block.
     35  *
     36  * Input Arguments:
     37  *
     38  *   ppBitStream - double pointer to the current byte in the stream buffer
     39  *   pBitOffset - pointer to the next available bit in the current stream
     40  *            byte referenced by *ppBitStream. The parameter *pBitOffset is
     41  *            valid within the range [0-7].
     42  *   shortVideoHeader - binary flag indicating presence of
     43  *            short_video_header; escape modes 0-3 are used if
     44  *            shortVideoHeader==0, and escape mode 4 is used when
     45  *            shortVideoHeader==1.
     46  *
     47  * Output Arguments:
     48  *
     49  *   ppBitStream - *ppBitStream is updated after the block is decoded such
     50  *            that it points to the current byte in the stream buffer
     51  *   pBitOffset - *pBitOffset is updated after decoding such that it points
     52  *            to the next available bit in the stream byte referenced by
     53  *            *ppBitStream
     54  *   pDst - pointer to the coefficient buffer of current block; must be
     55  *            4-byte aligned.
     56  *
     57  * Return Value:
     58  *
     59  *    OMX_Sts_BadArgErr - bad arguments:
     60  *    -    At least one of the following pointers is NULL:
     61  *         ppBitStream, *ppBitStream, pBitOffset, pDst
     62  *    -    pDst is not 4-byte aligned
     63  *    -   *pBitOffset exceeds [0,7]
     64  *    OMX_Sts_Err - status error, if:
     65  *    -    At least one mark bit is equal to zero
     66  *    -    Encountered an illegal stream code that cannot be found in the VLC table
     67  *    -    Encountered an illegal code in the VLC FLC table
     68  *    -    The number of coefficients is greater than 64
     69  *
     70  */
     71 
     72 OMXResult omxVCM4P2_DecodeVLCZigzag_Inter(
     73      const OMX_U8 ** ppBitStream,
     74      OMX_INT * pBitOffset,
     75      OMX_S16 * pDst,
     76      OMX_INT shortVideoHeader
     77 )
     78 {
     79     OMX_U8  last,start = 0;
     80     const OMX_U8  *pZigzagTable = armVCM4P2_aClassicalZigzagScan;
     81     OMXResult errorCode;
     82 
     83     /* Argument error checks */
     84     armRetArgErrIf(ppBitStream == NULL, OMX_Sts_BadArgErr);
     85     armRetArgErrIf(*ppBitStream == NULL, OMX_Sts_BadArgErr);
     86     armRetArgErrIf(pBitOffset == NULL, OMX_Sts_BadArgErr);
     87     armRetArgErrIf(pDst == NULL, OMX_Sts_BadArgErr);
     88     armRetArgErrIf(!armIs4ByteAligned(pDst), OMX_Sts_BadArgErr);
     89 
     90     errorCode = armVCM4P2_GetVLCBits (
     91               ppBitStream,
     92               pBitOffset,
     93 			  pDst,
     94 			  shortVideoHeader,
     95               start,
     96 			  &last,
     97 			  11,
     98 			  42,
     99 			   2,
    100 			   5,
    101               armVCM4P2_InterL0RunIdx,
    102               armVCM4P2_InterVlcL0,
    103 			  armVCM4P2_InterL1RunIdx,
    104               armVCM4P2_InterVlcL1,
    105               armVCM4P2_InterL0LMAX,
    106               armVCM4P2_InterL1LMAX,
    107               armVCM4P2_InterL0RMAX,
    108               armVCM4P2_InterL1RMAX,
    109               pZigzagTable );
    110     armRetDataErrIf((errorCode != OMX_Sts_NoErr), errorCode);
    111 
    112     if (last == 0)
    113     {
    114         return OMX_Sts_Err;
    115     }
    116     return OMX_Sts_NoErr;
    117 }
    118 
    119 /* End of file */
    120 
    121