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_EncodeVLCZigzag_IntraACVLC.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 zigzag scanning and VLC encoding 29 * for intra block. 30 * 31 */ 32 33#include "omxtypes.h" 34#include "armOMX.h" 35#include "omxVC.h" 36 37#include "armVC.h" 38 39 40/** 41 * Function: omxVCM4P2_EncodeVLCZigzag_IntraACVLC (6.2.4.5.2) 42 * 43 * Description: 44 * Performs zigzag scan and VLC encoding of AC and DC coefficients for one 45 * intra block. Two versions of the function (DCVLC and ACVLC) are provided 46 * in order to support the two different methods of processing DC 47 * coefficients, as described in [ISO14496-2], subclause 7.4.1.4, Intra DC 48 * Coefficient Decoding for the Case of Switched VLC Encoding. 49 * 50 * Input Arguments: 51 * 52 * ppBitStream - double pointer to the current byte in the bitstream 53 * pBitOffset - pointer to the bit position in the byte pointed by 54 * *ppBitStream. Valid within 0 to 7. 55 * pQDctBlkCoef - pointer to the quantized DCT coefficient 56 * predDir - AC prediction direction, which is used to decide the zigzag 57 * scan pattern; takes one of the following values: 58 * - OMX_VC_NONE - AC prediction not used. 59 * Performs classical zigzag scan. 60 * - OMX_VC_HORIZONTAL - Horizontal prediction. 61 * Performs alternate-vertical zigzag scan. 62 * - OMX_VC_VERTICAL - Vertical prediction. 63 * Performs alternate-horizontal zigzag scan. 64 * pattern - block pattern which is used to decide whether this block is 65 * encoded 66 * shortVideoHeader - binary flag indicating presence of 67 * short_video_header; escape modes 0-3 are used if 68 * shortVideoHeader==0, and escape mode 4 is used when 69 * shortVideoHeader==1. 70 * 71 * Output Arguments: 72 * 73 * ppBitStream - *ppBitStream is updated after the block is encoded, so 74 * that it points to the current byte in the bit stream buffer. 75 * pBitOffset - *pBitOffset is updated so that it points to the current bit 76 * position in the byte pointed by *ppBitStream. 77 * 78 * Return Value: 79 * 80 * OMX_Sts_NoErr - no error 81 * OMX_Sts_BadArgErr - Bad arguments: 82 * - At least one of the following pointers is NULL: ppBitStream, 83 * *ppBitStream, pBitOffset, pQDctBlkCoef. 84 * - *pBitOffset < 0, or *pBitOffset >7. 85 * - PredDir is not one of: OMX_VC_NONE, OMX_VC_HORIZONTAL, or 86 * OMX_VC_VERTICAL. 87 * - VideoComp is not one component of enum OMXVCM4P2VideoComponent. 88 * 89 */ 90 91OMXResult omxVCM4P2_EncodeVLCZigzag_IntraACVLC( 92 OMX_U8 **ppBitStream, 93 OMX_INT *pBitOffset, 94 const OMX_S16 *pQDctBlkCoef, 95 OMX_U8 predDir, 96 OMX_U8 pattern, 97 OMX_INT shortVideoHeader 98) 99{ 100 OMX_U8 start = 0; 101 102 return armVCM4P2_EncodeVLCZigzag_Intra( 103 ppBitStream, 104 pBitOffset, 105 pQDctBlkCoef, 106 predDir, 107 pattern, 108 shortVideoHeader, 109 start); 110} 111 112/* End of file */ 113