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