1 /** 2 * 3 * File Name: omxVCM4P2_EncodeVLCZigzag_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 encoding 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_EncodeVLCZigzag_Inter (6.2.4.5.3) 32 * 33 * Description: 34 * Performs classical zigzag scanning and VLC encoding for one inter block. 35 * 36 * Input Arguments: 37 * 38 * ppBitStream - pointer to the pointer to the current byte in the bit 39 * stream 40 * pBitOffset - pointer to the bit position in the byte pointed by 41 * *ppBitStream. Valid within 0 to 7 42 * pQDctBlkCoef - pointer to the quantized DCT coefficient 43 * pattern - block pattern which is used to decide whether this block is 44 * encoded 45 * shortVideoHeader - binary flag indicating presence of 46 * short_video_header; escape modes 0-3 are used if 47 * shortVideoHeader==0, and escape mode 4 is used when 48 * shortVideoHeader==1. 49 * 50 * Output Arguments: 51 * 52 * ppBitStream - *ppBitStream is updated after the block is encoded so that 53 * it points to the current byte in the bit stream buffer. 54 * pBitOffset - *pBitOffset is updated so that it points to the current bit 55 * position in the byte pointed by *ppBitStream. 56 * 57 * Return Value: 58 * 59 * OMX_Sts_NoErr - no error 60 * OMX_Sts_BadArgErr - Bad arguments 61 * - At least one of the pointers: is NULL: ppBitStream, *ppBitStream, 62 * pBitOffset, pQDctBlkCoef 63 * - *pBitOffset < 0, or *pBitOffset >7. 64 * 65 */ 66 OMXResult omxVCM4P2_EncodeVLCZigzag_Inter( 67 OMX_U8 **ppBitStream, 68 OMX_INT * pBitOffset, 69 const OMX_S16 *pQDctBlkCoef, 70 OMX_U8 pattern, 71 OMX_INT shortVideoHeader 72 ) 73 { 74 OMX_U8 start = 0; 75 const OMX_U8 *pZigzagTable = armVCM4P2_aClassicalZigzagScan; 76 77 /* Argument error checks */ 78 armRetArgErrIf(ppBitStream == NULL, OMX_Sts_BadArgErr); 79 armRetArgErrIf(*ppBitStream == NULL, OMX_Sts_BadArgErr); 80 armRetArgErrIf(pBitOffset == NULL, OMX_Sts_BadArgErr); 81 armRetArgErrIf(pQDctBlkCoef == NULL, OMX_Sts_BadArgErr); 82 armRetArgErrIf((*pBitOffset < 0) || (*pBitOffset >7), OMX_Sts_BadArgErr); 83 84 if (pattern) 85 { 86 armVCM4P2_PutVLCBits ( 87 ppBitStream, 88 pBitOffset, 89 pQDctBlkCoef, 90 shortVideoHeader, 91 start, 92 26, 93 40, 94 10, 95 1, 96 armVCM4P2_InterL0RunIdx, 97 armVCM4P2_InterVlcL0, 98 armVCM4P2_InterL1RunIdx, 99 armVCM4P2_InterVlcL1, 100 armVCM4P2_InterL0LMAX, 101 armVCM4P2_InterL1LMAX, 102 armVCM4P2_InterL0RMAX, 103 armVCM4P2_InterL1RMAX, 104 pZigzagTable 105 ); 106 } /* Pattern check ends*/ 107 108 return OMX_Sts_NoErr; 109 110 } 111 112 /* End of file */ 113