Home | History | Annotate | Download | only in api
      1 /**
      2  *
      3  * File Name:  armCOMM_Bitstream.h
      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  * File: armCOMM_Bitstream.h
     13  * Brief: Declares common API's/Data types used across the OpenMax Encoders/Decoders.
     14  *
     15  */
     16 
     17 #ifndef _armCodec_H_
     18 #define _armCodec_H_
     19 
     20 #include "omxtypes.h"
     21 
     22 typedef struct {
     23     OMX_U8   codeLen;
     24     OMX_U32	 codeWord;
     25 } ARM_VLC32;
     26 
     27 /* The above should be renamed as "ARM_VLC32" */
     28 
     29 /**
     30  * Function: armLookAheadBits()
     31  *
     32  * Description:
     33  * Get the next N bits from the bitstream without advancing the bitstream pointer
     34  *
     35  * Parameters:
     36  * [in]     **ppBitStream
     37  * [in]     *pOffset
     38  * [in]     N=1...32
     39  *
     40  * Returns  Value
     41  */
     42 
     43 OMX_U32 armLookAheadBits(const OMX_U8 **ppBitStream, OMX_INT *pOffset, OMX_INT N);
     44 
     45 /**
     46  * Function: armGetBits()
     47  *
     48  * Description:
     49  * Read N bits from the bitstream
     50  *
     51  * Parameters:
     52  * [in]     *ppBitStream
     53  * [in]     *pOffset
     54  * [in]     N=1..32
     55  *
     56  * [out]    *ppBitStream
     57  * [out]    *pOffset
     58  * Returns  Value
     59  */
     60 
     61 OMX_U32 armGetBits(const OMX_U8 **ppBitStream, OMX_INT *pOffset, OMX_INT N);
     62 
     63 /**
     64  * Function: armByteAlign()
     65  *
     66  * Description:
     67  * Align the pointer *ppBitStream to the next byte boundary
     68  *
     69  * Parameters:
     70  * [in]     *ppBitStream
     71  * [in]     *pOffset
     72  *
     73  * [out]    *ppBitStream
     74  * [out]    *pOffset
     75  *
     76  **/
     77 
     78 OMXVoid armByteAlign(const OMX_U8 **ppBitStream,OMX_INT *pOffset);
     79 
     80 /**
     81  * Function: armSkipBits()
     82  *
     83  * Description:
     84  * Skip N bits from the value at *ppBitStream
     85  *
     86  * Parameters:
     87  * [in]     *ppBitStream
     88  * [in]     *pOffset
     89  * [in]     N
     90  *
     91  * [out]    *ppBitStream
     92  * [out]    *pOffset
     93  *
     94  **/
     95 
     96 OMXVoid armSkipBits(const OMX_U8 **ppBitStream,OMX_INT *pOffset,OMX_INT N);
     97 
     98 /***************************************
     99  * Variable bit length Decode
    100  ***************************************/
    101 
    102 /**
    103  * Function: armUnPackVLC32()
    104  *
    105  * Description:
    106  * Variable length decode of variable length symbol (max size 32 bits) read from
    107  * the bit stream pointed by *ppBitStream at *pOffset by using the table
    108  * pointed by pCodeBook
    109  *
    110  * Parameters:
    111  * [in]     **ppBitStream
    112  * [in]     *pOffset
    113  * [in]     pCodeBook
    114  *
    115  * [out]    **ppBitStream
    116  * [out]    *pOffset
    117  *
    118  * Returns : Code Book Index if successfull.
    119  *         : "ARM_NO_CODEBOOK_INDEX = 0xFFFF" if search fails.
    120  **/
    121 
    122 #define ARM_NO_CODEBOOK_INDEX (OMX_U16)(0xFFFF)
    123 
    124 OMX_U16 armUnPackVLC32(
    125     const OMX_U8 **ppBitStream,
    126     OMX_INT *pOffset,
    127     const ARM_VLC32 *pCodeBook
    128 );
    129 
    130 /***************************************
    131  * Fixed bit length Encode
    132  ***************************************/
    133 
    134 /**
    135  * Function: armPackBits
    136  *
    137  * Description:
    138  * Pack a VLC code word into the bitstream
    139  *
    140  * Remarks:
    141  *
    142  * Parameters:
    143  * [in]	ppBitStream		pointer to the pointer to the current byte
    144  *                      in the bit stream.
    145  * [in]	pOffset	        pointer to the bit position in the byte
    146  *                      pointed by *ppBitStream. Valid within 0
    147  *                      to 7.
    148  * [in]	codeWord		Code word that need to be inserted in to the
    149  *                          bitstream
    150  * [in]	codeLength		Length of the code word valid range 1...32
    151  *
    152  * [out] ppBitStream	*ppBitStream is updated after the block is encoded,
    153  *	                        so that it points to the current byte in the bit
    154  *							stream buffer.
    155  * [out] pBitOffset		*pBitOffset is updated so that it points to the
    156  *							current bit position in the byte pointed by
    157  *							*ppBitStream.
    158  *
    159  * Return Value:
    160  * Standard OMX_RESULT result. See enumeration for possible result codes.
    161  *
    162  */
    163 
    164 OMXResult armPackBits (
    165     OMX_U8  **ppBitStream,
    166     OMX_INT *pOffset,
    167     OMX_U32 codeWord,
    168     OMX_INT codeLength
    169 );
    170 
    171 /***************************************
    172  * Variable bit length Encode
    173  ***************************************/
    174 
    175 /**
    176  * Function: armPackVLC32
    177  *
    178  * Description:
    179  * Pack a VLC code word into the bitstream
    180  *
    181  * Remarks:
    182  *
    183  * Parameters:
    184  * [in]	ppBitStream		pointer to the pointer to the current byte
    185  *                      in the bit stream.
    186  * [in]	pBitOffset	    pointer to the bit position in the byte
    187  *                      pointed by *ppBitStream. Valid within 0
    188  *                      to 7.
    189  * [in]	 code     		VLC code word that need to be inserted in to the
    190  *                      bitstream
    191  *
    192  * [out] ppBitStream	*ppBitStream is updated after the block is encoded,
    193  *	                    so that it points to the current byte in the bit
    194  *						stream buffer.
    195  * [out] pBitOffset		*pBitOffset is updated so that it points to the
    196  *						current bit position in the byte pointed by
    197  *						*ppBitStream.
    198  *
    199  * Return Value:
    200  * Standard OMX_RESULT result. See enumeration for possible result codes.
    201  *
    202  */
    203 
    204 OMXResult armPackVLC32 (
    205     OMX_U8 **ppBitStream,
    206     OMX_INT *pBitOffset,
    207     ARM_VLC32 code
    208 );
    209 
    210 #endif      /*_armCodec_H_*/
    211 
    212 /*End of File*/
    213