armVCM4P2_Huff_Tables_VLC.c revision 78e52bfac041d71ce53b5b13c2abf78af742b09d
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:  armVCM4P2_Huff_Tables_VLC.c
20 * OpenMAX DL: v1.0.2
21 * Revision:   12290
22 * Date:       Wednesday, April 9, 2008
23 *
24 *
25 *
26 *
27 * File:        armVCM4P2_Huff_Tables_VLC.c
28 * Description: Contains all the Huffman tables used in MPEG4 codec
29 *
30 */
31
32#include "omxtypes.h"
33#include "armOMX.h"
34
35#include "armCOMM_Bitstream.h"
36
37
38
39
40// Contains optimized and Packed VLC tables with Last=0 and Last=1
41
42//              optimized Packed VLC table Entry Format
43//              ---------------------------------------
44//
45//        15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
46//       +------------------------------------------------+
47//       |  Len   |       Run       |     Level    |L | 1 |
48//       +------------------------------------------------+
49//       |                Offset                      | 0 |
50//       +------------------------------------------------+
51// If the table entry is a leaf entry then bit 0 set:
52//    Len    = Number of bits overread  (0 to 7)  3 bits
53//    Run    = RunLength of the Symbol  (0 to 63) 6 bits
54//    Level  = Level of the Symbol      (0 to 31) 5 bits
55//    L      = Last Value of the Symbol (0 or 1)  1 bit
56//
57// If the table entry is an internal node then bit 0 is clear:
58//    Offset = Number of (16-bit) half words from the table
59//             start to the next table node
60//
61// The table is accessed by successive lookup up on the
62// next Step bits of the input bitstream until a leaf node
63// is obtained. The Step sizes are supplied to the VLD macro.
64
65// The VLC tables used for Intra and non inta coefficients in non Escape mode
66// contains symbols with both Last=0 and Last=1.
67// If a symbol is not found in the table it will be coded as 0xFFF
68
69
70const OMX_U16 armVCM4P2_InterVlcL0L1[200] = {
71    0x0020, 0x0108, 0x0148, 0x0170, 0x0178, 0x0180, 0x0188, 0x1b09,
72    0x4009, 0x4009, 0x4009, 0x4009, 0x2109, 0x2109, 0x0209, 0x0011,
73    0x0028, 0x0060, 0x00b8, 0x00e0, 0x0030, 0x0048, 0x0050, 0x0058,
74    0x3fff, 0x3fff, 0x0038, 0x0040, 0x2115, 0x2115, 0x201d, 0x201d,
75    0x2059, 0x2059, 0x2051, 0x2051, 0x1c0d, 0x1b0d, 0x1a0d, 0x190d,
76    0x0911, 0x0811, 0x0711, 0x0611, 0x0511, 0x0319, 0x0219, 0x0121,
77    0x0068, 0x0090, 0x3fff, 0x3fff, 0x0070, 0x0078, 0x0080, 0x0088,
78    0x2061, 0x2061, 0x2129, 0x2129, 0x3709, 0x3709, 0x3809, 0x3809,
79    0x3d0d, 0x3d0d, 0x3e0d, 0x3e0d, 0x3f0d, 0x3f0d, 0x200d, 0x200d,
80    0x0098, 0x00a0, 0x00a8, 0x00b0, 0x0131, 0x0221, 0x0419, 0x0519,
81    0x0619, 0x0a11, 0x1909, 0x1a09, 0x210d, 0x220d, 0x230d, 0x240d,
82    0x250d, 0x260d, 0x270d, 0x280d, 0x00c0, 0x00c8, 0x00d0, 0x00d8,
83    0x0049, 0x0041, 0x380d, 0x380d, 0x370d, 0x370d, 0x360d, 0x360d,
84    0x350d, 0x350d, 0x340d, 0x340d, 0x330d, 0x330d, 0x320d, 0x320d,
85    0x00e8, 0x00f0, 0x00f8, 0x0100, 0x310d, 0x310d, 0x2015, 0x2015,
86    0x3609, 0x3609, 0x3509, 0x3509, 0x3409, 0x3409, 0x3309, 0x3309,
87    0x3209, 0x3209, 0x3109, 0x3109, 0x0110, 0x0130, 0x0138, 0x0140,
88    0x0118, 0x0120, 0x0128, 0x100d, 0x3009, 0x3009, 0x2f09, 0x2f09,
89    0x2411, 0x2411, 0x2311, 0x2311, 0x2039, 0x2039, 0x2031, 0x2031,
90    0x0f0d, 0x0e0d, 0x0d0d, 0x0c0d, 0x0b0d, 0x0a0d, 0x090d, 0x0e09,
91    0x0d09, 0x0211, 0x0119, 0x0029, 0x0150, 0x0158, 0x0160, 0x0168,
92    0x280d, 0x280d, 0x270d, 0x270d, 0x260d, 0x260d, 0x250d, 0x250d,
93    0x2c09, 0x2c09, 0xb759, 0xb759, 0x2a09, 0x2a09, 0x2021, 0x2021,
94    0x040d, 0x030d, 0x0b35, 0x010d, 0x0909, 0x0809, 0x0709, 0x0609,
95    0x0111, 0x0019, 0x2509, 0x2509, 0x2409, 0x2409, 0x2309, 0x2309
96};
97
98
99const OMX_U16 armVCM4P2_IntraVlcL0L1[200] = {
100    0x0020, 0x0108, 0x0148, 0x0170, 0x0178, 0x0180, 0x0188, 0x0f09,
101    0x4009, 0x4009, 0x4009, 0x4009, 0x2011, 0x2011, 0x0109, 0x0019,
102    0x0028, 0x0060, 0x00b8, 0x00e0, 0x0030, 0x0048, 0x0050, 0x0058,
103    0x3fff, 0x3fff, 0x0038, 0x0040, 0x203d, 0x203d, 0x2035, 0x2035,
104    0x20b1, 0x20b1, 0x20a9, 0x20a9, 0x0215, 0x011d, 0x002d, 0x0d09,
105    0x0519, 0x0811, 0x0419, 0x0321, 0x0221, 0x0139, 0x00a1, 0x0099,
106    0x0068, 0x0090, 0x3fff, 0x3fff, 0x0070, 0x0078, 0x0080, 0x0088,
107    0x20b9, 0x20b9, 0x20c1, 0x20c1, 0x2141, 0x2141, 0x2911, 0x2911,
108    0x2315, 0x2315, 0x2415, 0x2415, 0x2f0d, 0x2f0d, 0x300d, 0x300d,
109    0x0098, 0x00a0, 0x00a8, 0x00b0, 0x00c9, 0x00d1, 0x00d9, 0x0149,
110    0x0619, 0x0151, 0x0229, 0x0719, 0x0e09, 0x0045, 0x0515, 0x0615,
111    0x110d, 0x120d, 0x130d, 0x140d, 0x00c0, 0x00c8, 0x00d0, 0x00d8,
112    0x0091, 0x0089, 0x2e0d, 0x2e0d, 0x2d0d, 0x2d0d, 0x2c0d, 0x2c0d,
113    0x2b0d, 0x2b0d, 0x2a0d, 0x2a0d, 0x2115, 0x2115, 0x2025, 0x2025,
114    0x00e8, 0x00f0, 0x00f8, 0x0100, 0x2c09, 0x2c09, 0x2b09, 0x2b09,
115    0x2711, 0x2711, 0x2611, 0x2611, 0x2511, 0x2511, 0x2319, 0x2319,
116    0x2219, 0x2219, 0x2131, 0x2131, 0x0110, 0x0130, 0x0138, 0x0140,
117    0x0118, 0x0120, 0x0128, 0x080d, 0x2129, 0x2129, 0x2081, 0x2081,
118    0x2411, 0x2411, 0x2079, 0x2079, 0x2071, 0x2071, 0x2069, 0x2069,
119    0x1bb5, 0x060d, 0x001d, 0xd3f9, 0x0909, 0x0809, 0x090d, 0x0311,
120    0x0121, 0x0061, 0x0059, 0x0051, 0x0150, 0x0158, 0x0160, 0x0168,
121    0x240d, 0x240d, 0x230d, 0x230d, 0x2609, 0x2609, 0x250d, 0x250d,
122    0x2709, 0x2709, 0x2211, 0x2211, 0x2119, 0x2119, 0x2049, 0x2049,
123    0x0015, 0x0509, 0x020d, 0x010d, 0x0409, 0x0309, 0x0041, 0x0039,
124    0x0111, 0x0031, 0x2209, 0x2209, 0x2029, 0x2029, 0x2021, 0x2021
125};
126
127const OMX_U16 armVCM4P2_aIntraDCLumaChromaIndex[64] = {
128    0x0020, 0x000b, 0x2009, 0x2009, 0x2007, 0x2007, 0x2001, 0x2001,
129    0x4005, 0x4005, 0x4005, 0x4005, 0x4003, 0x4003, 0x4003, 0x4003,
130    0x0028, 0x000f, 0x200d, 0x200d, 0x0030, 0x0013, 0x2011, 0x2011,
131    0x0038, 0x0017, 0x2015, 0x2015, 0x3fff, 0x3fff, 0x2019, 0x2019,
132
133	0x0020, 0x0009, 0x2007, 0x2007, 0x4005, 0x4005, 0x4005, 0x4005,
134    0x4003, 0x4003, 0x4003, 0x4003, 0x4001, 0x4001, 0x4001, 0x4001,
135    0x0028, 0x000d, 0x200b, 0x200b, 0x0030, 0x0011, 0x200f, 0x200f,
136    0x0038, 0x0015, 0x2013, 0x2013, 0x1fff, 0x0019, 0x2017, 0x2017
137};
138
139
140const OMX_U16 armVCM4P2_aVlcMVD[124] = {
141    0x0010, 0x00f0, 0x0043, 0x003f, 0x4041, 0x4041, 0x4041, 0x4041,
142    0x0018, 0x00d8, 0x0047, 0x003b, 0x0020, 0x0080, 0x00a8, 0x00d0,
143    0x0028, 0x0048, 0x0070, 0x0078, 0x1fff, 0x0030, 0x0038, 0x0040,
144    0x0081, 0x0001, 0x007f, 0x0003, 0x207d, 0x207d, 0x2005, 0x2005,
145    0x207b, 0x207b, 0x2007, 0x2007, 0x0050, 0x0058, 0x0060, 0x0068,
146    0x2079, 0x2079, 0x2009, 0x2009, 0x2077, 0x2077, 0x200b, 0x200b,
147    0x2075, 0x2075, 0x200d, 0x200d, 0x2073, 0x2073, 0x200f, 0x200f,
148    0x0071, 0x0011, 0x006f, 0x0013, 0x006d, 0x0015, 0x006b, 0x0017,
149    0x0088, 0x0090, 0x0098, 0x00a0, 0x0069, 0x0019, 0x0067, 0x001b,
150    0x0065, 0x001d, 0x0063, 0x001f, 0x0061, 0x0021, 0x005f, 0x0023,
151    0x005d, 0x0025, 0x005b, 0x0027, 0x00b0, 0x00b8, 0x00c0, 0x00c8,
152    0x0059, 0x0029, 0x0057, 0x002b, 0x2055, 0x2055, 0x202d, 0x202d,
153    0x2053, 0x2053, 0x202f, 0x202f, 0x2051, 0x2051, 0x2031, 0x2031,
154    0x204f, 0x204f, 0x2033, 0x2033, 0x00e0, 0x00e8, 0x0049, 0x0039,
155    0x204d, 0x204d, 0x2035, 0x2035, 0x204b, 0x204b, 0x2037, 0x2037,
156    0x2045, 0x2045, 0x203d, 0x203d
157};
158
159/* LMAX table for non Inter (Last == 0 and Last=1)
160   Level - 1 Indexed
161   padded armVCM4P2_InterL0L1LMAX[27-31] with zeros to acess entries for Last=1 effectively
162
163*/
164const OMX_U8 armVCM4P2_InterL0L1LMAX[73] =
165{
166   12,  6,  4,  3,  3,  3,  3,  2,
167    2,  2,  2,  1,  1,  1,  1,  1,
168    1,  1,  1,  1,  1,  1,  1,  1,
169    1,  1,  1,  0,  0,  0,  0,  0,
170    3,  2,  1,  1,  1,  1,  1,  1,
171	1,  1,  1,  1,  1,  1,  1,  1,
172	1,  1,  1,  1,  1,  1,  1,  1,
173	1,  1,  1,  1,  1,  1,  1,  1,
174	1,  1,  1,  1,  1,  1,  1,  1,
175	1
176};
177
178/* RMAX table for non Inter (Last == 0 and Last=1)
179   Level - 1 Indexed
180 padded armVCM4P2_InterL0L1RMAX[12-31] with zeros to access entries for Last=1 table effectively */
181
182
183const OMX_U8 armVCM4P2_InterL0L1RMAX[35] =
184{
185   26, 10,  6,  2,  1,  1,
186    0,  0,  0,  0,  0,  0,
187	0,	0,	0,	0,	0,	0,
188	0,	0,	0,	0,	0,	0,
189	0,	0,	0,	0,
190    0,  0,  0,  0,  40,  1,  0
191};
192
193/* LMAX table for non Intra (Last == 0 and Last=1)
194   Level - 1 Indexed
195   padded armVCM4P2_IntraL0L1LMAX[15-31] with zeros to acess entries for Last=1 effectively
196
197*/
198const OMX_U8 armVCM4P2_IntraL0L1LMAX[53] =
199{
200   27, 10,  5,  4,  3,  3,  3,
201    3,  2,  2,  1,  1,  1,  1,  1,	0,
202	0,	0,	0,	0,	0,	0,	0,	0,
203	0,	0,	0,	0,	0,	0,	0,	0,
204
205	8,  3,  2,  2,  2,  2,  2,  1,
206	1,  1,  1,  1,  1,  1,  1,  1,
207	1,  1,  1,  1,  1
208};
209
210
211/* RMAX table for non Inter (Last == 0 and Last=1)
212   Level - 1 Indexed
213 padded armVCM4P2_IntraL0L1RMAX[27-31] with zeros to access entries for Last=1 table effectively */
214
215
216const OMX_U8 armVCM4P2_IntraL0L1RMAX[40] =
217{
218   14,  9,  7,  3,  2,  1,	1,
219    1,  1,  1,  0,  0,  0, 	0,
220    0,  0,  0,  0,  0,  0,  0,
221    0,  0,  0,  0,  0,  0,  0,
222	0,	0,	0,	0,
223
224	20,  6,  1,  0,  0,  0,  0,  0
225
226};
227