1 /******************************************************************************
2 * *
3 * Copyright (C) 2018 The Android Open Source Project
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at:
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *****************************************************************************
18 * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
19 */
20 #include <math.h>
21 #include <string.h>
22 #include "ixheaacd_type_def.h"
23 #include "ixheaacd_constants.h"
24 #include "ixheaacd_basic_ops32.h"
25 #include "ixheaacd_basic_ops16.h"
26 #include "ixheaacd_basic_ops40.h"
27 #include "ixheaacd_bitbuffer.h"
28 #include "ixheaacd_interface.h"
29
30 #include "ixheaacd_tns_usac.h"
31 #include "ixheaacd_cnst.h"
32
33 #include "ixheaacd_acelp_info.h"
34
35 #include "ixheaacd_sbrdecsettings.h"
36 #include "ixheaacd_info.h"
37 #include "ixheaacd_sbr_common.h"
38 #include "ixheaacd_drc_data_struct.h"
39 #include "ixheaacd_drc_dec.h"
40 #include "ixheaacd_sbrdecoder.h"
41 #include "ixheaacd_mps_polyphase.h"
42 #include "ixheaacd_sbr_const.h"
43 #include "ixheaacd_ec_defines.h"
44 #include "ixheaacd_ec_struct_def.h"
45 #include "ixheaacd_main.h"
46 #include "ixheaacd_arith_dec.h"
47
48 #include "ixheaacd_bit_extract.h"
49
50 #include "ixheaacd_error_codes.h"
51
52 #define ARITH_ESCAPE 16
53
54 static const UWORD16 ixheaacd_ari_cf_r[3][4] = {
55 {12571, 10569, 3696, 0}, {12661, 5700, 3751, 0}, {10827, 6884, 2929, 0}};
56
57 static const UWORD16 ixheaacd_ari_lookup_m[742] = {
58 0x01, 0x34, 0x0D, 0x13, 0x12, 0x25, 0x00, 0x3A, 0x05, 0x00, 0x21, 0x13,
59 0x1F, 0x1A, 0x1D, 0x36, 0x24, 0x2B, 0x1B, 0x33, 0x37, 0x29, 0x1D, 0x33,
60 0x37, 0x33, 0x37, 0x33, 0x37, 0x33, 0x2C, 0x00, 0x21, 0x13, 0x25, 0x2A,
61 0x00, 0x21, 0x24, 0x12, 0x2C, 0x1E, 0x37, 0x24, 0x1F, 0x35, 0x37, 0x24,
62 0x35, 0x37, 0x35, 0x37, 0x38, 0x2D, 0x21, 0x29, 0x1E, 0x21, 0x13, 0x2D,
63 0x36, 0x38, 0x29, 0x36, 0x37, 0x24, 0x36, 0x38, 0x37, 0x38, 0x00, 0x20,
64 0x23, 0x20, 0x23, 0x36, 0x38, 0x24, 0x3B, 0x24, 0x26, 0x29, 0x1F, 0x30,
65 0x2D, 0x0D, 0x12, 0x3F, 0x2D, 0x21, 0x1C, 0x2A, 0x00, 0x21, 0x12, 0x1E,
66 0x36, 0x38, 0x36, 0x37, 0x3F, 0x1E, 0x0D, 0x1F, 0x2A, 0x1E, 0x21, 0x24,
67 0x12, 0x2A, 0x3C, 0x21, 0x24, 0x1F, 0x3C, 0x21, 0x29, 0x36, 0x38, 0x36,
68 0x37, 0x38, 0x21, 0x1E, 0x00, 0x3B, 0x25, 0x1E, 0x20, 0x10, 0x1F, 0x3C,
69 0x20, 0x23, 0x29, 0x08, 0x23, 0x12, 0x08, 0x23, 0x21, 0x38, 0x00, 0x20,
70 0x13, 0x20, 0x3B, 0x1C, 0x20, 0x3B, 0x29, 0x20, 0x23, 0x24, 0x21, 0x24,
71 0x21, 0x24, 0x3B, 0x13, 0x23, 0x26, 0x23, 0x13, 0x21, 0x24, 0x26, 0x29,
72 0x12, 0x22, 0x2B, 0x02, 0x1E, 0x0D, 0x1F, 0x2D, 0x00, 0x0D, 0x12, 0x00,
73 0x3C, 0x21, 0x29, 0x3C, 0x21, 0x2A, 0x3C, 0x3B, 0x22, 0x1E, 0x20, 0x10,
74 0x1F, 0x3C, 0x0D, 0x29, 0x3C, 0x21, 0x24, 0x08, 0x23, 0x20, 0x38, 0x39,
75 0x3C, 0x20, 0x13, 0x3C, 0x00, 0x0D, 0x13, 0x1F, 0x3C, 0x09, 0x26, 0x1F,
76 0x08, 0x09, 0x26, 0x12, 0x08, 0x23, 0x29, 0x20, 0x23, 0x21, 0x24, 0x20,
77 0x13, 0x20, 0x3B, 0x16, 0x20, 0x3B, 0x29, 0x20, 0x3B, 0x29, 0x20, 0x3B,
78 0x13, 0x21, 0x24, 0x29, 0x0B, 0x13, 0x09, 0x3B, 0x13, 0x09, 0x3B, 0x13,
79 0x21, 0x3B, 0x13, 0x0D, 0x26, 0x29, 0x26, 0x29, 0x3D, 0x12, 0x22, 0x28,
80 0x2E, 0x04, 0x08, 0x13, 0x3C, 0x3B, 0x3C, 0x20, 0x10, 0x3C, 0x21, 0x07,
81 0x08, 0x10, 0x00, 0x08, 0x0D, 0x29, 0x08, 0x0D, 0x29, 0x08, 0x09, 0x13,
82 0x20, 0x23, 0x39, 0x08, 0x09, 0x13, 0x08, 0x09, 0x16, 0x08, 0x09, 0x10,
83 0x12, 0x20, 0x3B, 0x3D, 0x09, 0x26, 0x20, 0x3B, 0x24, 0x39, 0x09, 0x26,
84 0x20, 0x0D, 0x13, 0x00, 0x09, 0x13, 0x20, 0x0D, 0x26, 0x12, 0x20, 0x3B,
85 0x13, 0x21, 0x26, 0x0B, 0x12, 0x09, 0x3B, 0x16, 0x09, 0x3B, 0x3D, 0x09,
86 0x26, 0x0D, 0x13, 0x26, 0x3D, 0x1C, 0x12, 0x1F, 0x28, 0x2E, 0x07, 0x0B,
87 0x08, 0x09, 0x00, 0x39, 0x0B, 0x08, 0x26, 0x08, 0x09, 0x13, 0x20, 0x0B,
88 0x39, 0x10, 0x39, 0x0D, 0x13, 0x20, 0x10, 0x12, 0x09, 0x13, 0x20, 0x3B,
89 0x13, 0x09, 0x26, 0x0B, 0x09, 0x3B, 0x1C, 0x09, 0x3B, 0x13, 0x20, 0x3B,
90 0x13, 0x09, 0x26, 0x0B, 0x16, 0x0D, 0x13, 0x09, 0x13, 0x09, 0x13, 0x26,
91 0x3D, 0x1C, 0x1F, 0x28, 0x2E, 0x07, 0x10, 0x39, 0x0B, 0x39, 0x39, 0x13,
92 0x39, 0x0B, 0x39, 0x0B, 0x39, 0x26, 0x39, 0x10, 0x20, 0x3B, 0x16, 0x20,
93 0x10, 0x09, 0x26, 0x0B, 0x13, 0x09, 0x13, 0x26, 0x1C, 0x0B, 0x3D, 0x1C,
94 0x1F, 0x28, 0x2B, 0x07, 0x0C, 0x39, 0x0B, 0x39, 0x0B, 0x0C, 0x0B, 0x26,
95 0x0B, 0x26, 0x3D, 0x0D, 0x1C, 0x14, 0x28, 0x2B, 0x39, 0x0B, 0x0C, 0x0E,
96 0x3D, 0x1C, 0x0D, 0x12, 0x22, 0x2B, 0x07, 0x0C, 0x0E, 0x3D, 0x1C, 0x10,
97 0x1F, 0x2B, 0x0C, 0x0E, 0x19, 0x14, 0x10, 0x1F, 0x28, 0x0C, 0x0E, 0x19,
98 0x14, 0x26, 0x22, 0x2B, 0x0C, 0x0E, 0x19, 0x14, 0x26, 0x28, 0x0E, 0x19,
99 0x14, 0x26, 0x28, 0x0E, 0x19, 0x14, 0x28, 0x0E, 0x19, 0x14, 0x22, 0x28,
100 0x2B, 0x0E, 0x14, 0x2B, 0x31, 0x00, 0x3A, 0x3A, 0x05, 0x05, 0x1B, 0x1D,
101 0x33, 0x06, 0x35, 0x35, 0x20, 0x21, 0x37, 0x21, 0x24, 0x05, 0x1B, 0x2C,
102 0x2C, 0x2C, 0x06, 0x34, 0x1E, 0x34, 0x00, 0x08, 0x36, 0x09, 0x21, 0x26,
103 0x1C, 0x2C, 0x00, 0x02, 0x02, 0x02, 0x3F, 0x04, 0x04, 0x04, 0x34, 0x39,
104 0x20, 0x0A, 0x0C, 0x39, 0x0B, 0x0F, 0x07, 0x07, 0x07, 0x07, 0x34, 0x39,
105 0x39, 0x0A, 0x0C, 0x39, 0x0C, 0x0F, 0x07, 0x07, 0x07, 0x00, 0x39, 0x39,
106 0x0C, 0x0F, 0x07, 0x07, 0x39, 0x0C, 0x0F, 0x07, 0x39, 0x0C, 0x0F, 0x39,
107 0x39, 0x0C, 0x0F, 0x39, 0x0C, 0x39, 0x0C, 0x0F, 0x00, 0x11, 0x27, 0x17,
108 0x2F, 0x27, 0x00, 0x27, 0x17, 0x00, 0x11, 0x17, 0x00, 0x11, 0x17, 0x11,
109 0x00, 0x27, 0x15, 0x11, 0x17, 0x01, 0x15, 0x11, 0x15, 0x11, 0x15, 0x15,
110 0x17, 0x00, 0x27, 0x01, 0x27, 0x27, 0x15, 0x00, 0x27, 0x11, 0x27, 0x15,
111 0x15, 0x15, 0x27, 0x15, 0x15, 0x15, 0x15, 0x17, 0x2F, 0x11, 0x17, 0x27,
112 0x27, 0x27, 0x11, 0x27, 0x15, 0x27, 0x27, 0x15, 0x15, 0x27, 0x17, 0x2F,
113 0x27, 0x17, 0x2F, 0x27, 0x17, 0x2F, 0x27, 0x17, 0x2F, 0x27, 0x17, 0x2F,
114 0x27, 0x17, 0x2F, 0x27, 0x17, 0x2F, 0x27, 0x17, 0x2F, 0x27, 0x17, 0x2F,
115 0x27, 0x17, 0x2F, 0x27, 0x17, 0x2F, 0x27, 0x17, 0x2F, 0x27, 0x17, 0x2F,
116 0x17, 0x2F, 0x2B, 0x00, 0x27, 0x00, 0x00, 0x11, 0x15, 0x00, 0x11, 0x11,
117 0x27, 0x27, 0x15, 0x17, 0x15, 0x17, 0x15, 0x17, 0x27, 0x17, 0x27, 0x17,
118 0x27, 0x17, 0x27, 0x17, 0x27, 0x17, 0x27, 0x17, 0x27, 0x17, 0x27, 0x17,
119 0x27, 0x17, 0x27, 0x17, 0x27, 0x15, 0x27, 0x27, 0x15, 0x27};
120
121 static const UWORD32 ixheaacd_ari_hash_m[742] = {
122 0x00000104UL >> 8, 0x0000030AUL >> 8, 0x00000510UL >> 8, 0x00000716UL >> 8,
123 0x00000A1FUL >> 8, 0x00000F2EUL >> 8, 0x00011100UL >> 8, 0x00111103UL >> 8,
124 0x00111306UL >> 8, 0x00111436UL >> 8, 0x00111623UL >> 8, 0x00111929UL >> 8,
125 0x00111F2EUL >> 8, 0x0011221BUL >> 8, 0x00112435UL >> 8, 0x00112621UL >> 8,
126 0x00112D12UL >> 8, 0x00113130UL >> 8, 0x0011331DUL >> 8, 0x00113535UL >> 8,
127 0x00113938UL >> 8, 0x0011411BUL >> 8, 0x00114433UL >> 8, 0x00114635UL >> 8,
128 0x00114F29UL >> 8, 0x00116635UL >> 8, 0x00116F24UL >> 8, 0x00117433UL >> 8,
129 0x0011FF0FUL >> 8, 0x00121102UL >> 8, 0x0012132DUL >> 8, 0x00121436UL >> 8,
130 0x00121623UL >> 8, 0x00121912UL >> 8, 0x0012213FUL >> 8, 0x0012232DUL >> 8,
131 0x00122436UL >> 8, 0x00122638UL >> 8, 0x00122A29UL >> 8, 0x00122F2BUL >> 8,
132 0x0012322DUL >> 8, 0x00123436UL >> 8, 0x00123738UL >> 8, 0x00123B29UL >> 8,
133 0x0012411DUL >> 8, 0x00124536UL >> 8, 0x00124938UL >> 8, 0x00124F12UL >> 8,
134 0x00125535UL >> 8, 0x00125F29UL >> 8, 0x00126535UL >> 8, 0x0012B837UL >> 8,
135 0x0013112AUL >> 8, 0x0013131EUL >> 8, 0x0013163BUL >> 8, 0x0013212DUL >> 8,
136 0x0013233CUL >> 8, 0x00132623UL >> 8, 0x00132F2EUL >> 8, 0x0013321EUL >> 8,
137 0x00133521UL >> 8, 0x00133824UL >> 8, 0x0013411EUL >> 8, 0x00134336UL >> 8,
138 0x00134838UL >> 8, 0x00135135UL >> 8, 0x00135537UL >> 8, 0x00135F12UL >> 8,
139 0x00137637UL >> 8, 0x0013FF29UL >> 8, 0x00140024UL >> 8, 0x00142321UL >> 8,
140 0x00143136UL >> 8, 0x00143321UL >> 8, 0x00143F25UL >> 8, 0x00144321UL >> 8,
141 0x00148638UL >> 8, 0x0014FF29UL >> 8, 0x00154323UL >> 8, 0x0015FF12UL >> 8,
142 0x0016F20CUL >> 8, 0x0018A529UL >> 8, 0x00210031UL >> 8, 0x0021122CUL >> 8,
143 0x00211408UL >> 8, 0x00211713UL >> 8, 0x00211F2EUL >> 8, 0x0021222AUL >> 8,
144 0x00212408UL >> 8, 0x00212710UL >> 8, 0x00212F2EUL >> 8, 0x0021331EUL >> 8,
145 0x00213436UL >> 8, 0x00213824UL >> 8, 0x0021412DUL >> 8, 0x0021431EUL >> 8,
146 0x00214536UL >> 8, 0x00214F1FUL >> 8, 0x00216637UL >> 8, 0x00220004UL >> 8,
147 0x0022122AUL >> 8, 0x00221420UL >> 8, 0x00221829UL >> 8, 0x00221F2EUL >> 8,
148 0x0022222DUL >> 8, 0x00222408UL >> 8, 0x00222623UL >> 8, 0x00222929UL >> 8,
149 0x00222F2BUL >> 8, 0x0022321EUL >> 8, 0x00223408UL >> 8, 0x00223724UL >> 8,
150 0x00223A29UL >> 8, 0x0022411EUL >> 8, 0x00224436UL >> 8, 0x00224823UL >> 8,
151 0x00225134UL >> 8, 0x00225621UL >> 8, 0x00225F12UL >> 8, 0x00226336UL >> 8,
152 0x00227637UL >> 8, 0x0022FF29UL >> 8, 0x0023112DUL >> 8, 0x0023133CUL >> 8,
153 0x00231420UL >> 8, 0x00231916UL >> 8, 0x0023212DUL >> 8, 0x0023233CUL >> 8,
154 0x00232509UL >> 8, 0x00232929UL >> 8, 0x0023312DUL >> 8, 0x00233308UL >> 8,
155 0x00233509UL >> 8, 0x00233724UL >> 8, 0x0023413CUL >> 8, 0x00234421UL >> 8,
156 0x00234A13UL >> 8, 0x0023513CUL >> 8, 0x00235421UL >> 8, 0x00235F1FUL >> 8,
157 0x00236421UL >> 8, 0x0023FF29UL >> 8, 0x00240024UL >> 8, 0x0024153BUL >> 8,
158 0x00242108UL >> 8, 0x00242409UL >> 8, 0x00242726UL >> 8, 0x00243108UL >> 8,
159 0x00243409UL >> 8, 0x00243610UL >> 8, 0x00244136UL >> 8, 0x00244321UL >> 8,
160 0x00244523UL >> 8, 0x00244F1FUL >> 8, 0x00245423UL >> 8, 0x0024610AUL >> 8,
161 0x00246423UL >> 8, 0x0024FF29UL >> 8, 0x00252510UL >> 8, 0x00253121UL >> 8,
162 0x0025343BUL >> 8, 0x00254121UL >> 8, 0x00254510UL >> 8, 0x00254F25UL >> 8,
163 0x00255221UL >> 8, 0x0025FF12UL >> 8, 0x00266513UL >> 8, 0x0027F529UL >> 8,
164 0x0029F101UL >> 8, 0x002CF224UL >> 8, 0x00310030UL >> 8, 0x0031122AUL >> 8,
165 0x00311420UL >> 8, 0x00311816UL >> 8, 0x0031212CUL >> 8, 0x0031231EUL >> 8,
166 0x00312408UL >> 8, 0x00312710UL >> 8, 0x0031312AUL >> 8, 0x0031321EUL >> 8,
167 0x00313408UL >> 8, 0x00313623UL >> 8, 0x0031411EUL >> 8, 0x0031433CUL >> 8,
168 0x00320007UL >> 8, 0x0032122DUL >> 8, 0x00321420UL >> 8, 0x00321816UL >> 8,
169 0x0032212DUL >> 8, 0x0032233CUL >> 8, 0x00322509UL >> 8, 0x00322916UL >> 8,
170 0x0032312DUL >> 8, 0x00323420UL >> 8, 0x00323710UL >> 8, 0x00323F2BUL >> 8,
171 0x00324308UL >> 8, 0x00324623UL >> 8, 0x00324F25UL >> 8, 0x00325421UL >> 8,
172 0x00325F1FUL >> 8, 0x00326421UL >> 8, 0x0032FF29UL >> 8, 0x00331107UL >> 8,
173 0x00331308UL >> 8, 0x0033150DUL >> 8, 0x0033211EUL >> 8, 0x00332308UL >> 8,
174 0x00332420UL >> 8, 0x00332610UL >> 8, 0x00332929UL >> 8, 0x0033311EUL >> 8,
175 0x00333308UL >> 8, 0x0033363BUL >> 8, 0x00333A29UL >> 8, 0x0033413CUL >> 8,
176 0x00334320UL >> 8, 0x0033463BUL >> 8, 0x00334A29UL >> 8, 0x0033510AUL >> 8,
177 0x00335320UL >> 8, 0x00335824UL >> 8, 0x0033610AUL >> 8, 0x00336321UL >> 8,
178 0x00336F12UL >> 8, 0x00337623UL >> 8, 0x00341139UL >> 8, 0x0034153BUL >> 8,
179 0x00342108UL >> 8, 0x00342409UL >> 8, 0x00342610UL >> 8, 0x00343108UL >> 8,
180 0x00343409UL >> 8, 0x00343610UL >> 8, 0x00344108UL >> 8, 0x0034440DUL >> 8,
181 0x00344610UL >> 8, 0x0034510AUL >> 8, 0x00345309UL >> 8, 0x0034553BUL >> 8,
182 0x0034610AUL >> 8, 0x00346309UL >> 8, 0x0034F824UL >> 8, 0x00350029UL >> 8,
183 0x00352510UL >> 8, 0x00353120UL >> 8, 0x0035330DUL >> 8, 0x00353510UL >> 8,
184 0x00354120UL >> 8, 0x0035430DUL >> 8, 0x00354510UL >> 8, 0x00354F28UL >> 8,
185 0x0035530DUL >> 8, 0x00355510UL >> 8, 0x00355F1FUL >> 8, 0x00356410UL >> 8,
186 0x00359626UL >> 8, 0x0035FF12UL >> 8, 0x00366426UL >> 8, 0x0036FF12UL >> 8,
187 0x0037F426UL >> 8, 0x0039D712UL >> 8, 0x003BF612UL >> 8, 0x003DF81FUL >> 8,
188 0x00410004UL >> 8, 0x00411207UL >> 8, 0x0041150DUL >> 8, 0x0041212AUL >> 8,
189 0x00412420UL >> 8, 0x0041311EUL >> 8, 0x00413308UL >> 8, 0x00413509UL >> 8,
190 0x00413F2BUL >> 8, 0x00414208UL >> 8, 0x00420007UL >> 8, 0x0042123CUL >> 8,
191 0x00421409UL >> 8, 0x00422107UL >> 8, 0x0042223CUL >> 8, 0x00422409UL >> 8,
192 0x00422610UL >> 8, 0x0042313CUL >> 8, 0x00423409UL >> 8, 0x0042363BUL >> 8,
193 0x0042413CUL >> 8, 0x00424320UL >> 8, 0x0042463BUL >> 8, 0x00425108UL >> 8,
194 0x00425409UL >> 8, 0x0042FF29UL >> 8, 0x00431107UL >> 8, 0x00431320UL >> 8,
195 0x0043153BUL >> 8, 0x0043213CUL >> 8, 0x00432320UL >> 8, 0x00432610UL >> 8,
196 0x0043313CUL >> 8, 0x00433320UL >> 8, 0x0043353BUL >> 8, 0x00433813UL >> 8,
197 0x00434108UL >> 8, 0x00434409UL >> 8, 0x00434610UL >> 8, 0x00435108UL >> 8,
198 0x0043553BUL >> 8, 0x00435F25UL >> 8, 0x00436309UL >> 8, 0x0043753BUL >> 8,
199 0x0043FF29UL >> 8, 0x00441239UL >> 8, 0x0044143BUL >> 8, 0x00442139UL >> 8,
200 0x00442309UL >> 8, 0x0044253BUL >> 8, 0x00443108UL >> 8, 0x00443220UL >> 8,
201 0x0044353BUL >> 8, 0x0044410AUL >> 8, 0x00444309UL >> 8, 0x0044453BUL >> 8,
202 0x00444813UL >> 8, 0x0044510AUL >> 8, 0x00445309UL >> 8, 0x00445510UL >> 8,
203 0x00445F25UL >> 8, 0x0044630DUL >> 8, 0x00450026UL >> 8, 0x00452713UL >> 8,
204 0x00453120UL >> 8, 0x0045330DUL >> 8, 0x00453510UL >> 8, 0x00454120UL >> 8,
205 0x0045430DUL >> 8, 0x00454510UL >> 8, 0x00455120UL >> 8, 0x0045530DUL >> 8,
206 0x00456209UL >> 8, 0x00456410UL >> 8, 0x0045FF12UL >> 8, 0x00466513UL >> 8,
207 0x0047FF22UL >> 8, 0x0048FF25UL >> 8, 0x0049F43DUL >> 8, 0x004BFB25UL >> 8,
208 0x004EF825UL >> 8, 0x004FFF18UL >> 8, 0x00511339UL >> 8, 0x00512107UL >> 8,
209 0x00513409UL >> 8, 0x00520007UL >> 8, 0x00521107UL >> 8, 0x00521320UL >> 8,
210 0x00522107UL >> 8, 0x00522409UL >> 8, 0x0052313CUL >> 8, 0x00523320UL >> 8,
211 0x0052353BUL >> 8, 0x00524108UL >> 8, 0x00524320UL >> 8, 0x00531139UL >> 8,
212 0x00531309UL >> 8, 0x00532139UL >> 8, 0x00532309UL >> 8, 0x0053253BUL >> 8,
213 0x00533108UL >> 8, 0x0053340DUL >> 8, 0x00533713UL >> 8, 0x00534108UL >> 8,
214 0x0053453BUL >> 8, 0x00534F2BUL >> 8, 0x00535309UL >> 8, 0x00535610UL >> 8,
215 0x00535F25UL >> 8, 0x0053643BUL >> 8, 0x00541139UL >> 8, 0x00542139UL >> 8,
216 0x00542309UL >> 8, 0x00542613UL >> 8, 0x00543139UL >> 8, 0x00543309UL >> 8,
217 0x00543510UL >> 8, 0x00543F2BUL >> 8, 0x00544309UL >> 8, 0x00544510UL >> 8,
218 0x00544F28UL >> 8, 0x0054530DUL >> 8, 0x0054FF12UL >> 8, 0x00553613UL >> 8,
219 0x00553F2BUL >> 8, 0x00554410UL >> 8, 0x0055510AUL >> 8, 0x0055543BUL >> 8,
220 0x00555F25UL >> 8, 0x0055633BUL >> 8, 0x0055FF12UL >> 8, 0x00566513UL >> 8,
221 0x00577413UL >> 8, 0x0059FF28UL >> 8, 0x005CC33DUL >> 8, 0x005EFB28UL >> 8,
222 0x005FFF18UL >> 8, 0x00611339UL >> 8, 0x00612107UL >> 8, 0x00613320UL >> 8,
223 0x0061A724UL >> 8, 0x00621107UL >> 8, 0x0062140BUL >> 8, 0x00622107UL >> 8,
224 0x00622320UL >> 8, 0x00623139UL >> 8, 0x00623320UL >> 8, 0x00631139UL >> 8,
225 0x0063130CUL >> 8, 0x00632139UL >> 8, 0x00632309UL >> 8, 0x00633139UL >> 8,
226 0x00633309UL >> 8, 0x00633626UL >> 8, 0x00633F2BUL >> 8, 0x00634309UL >> 8,
227 0x00634F2BUL >> 8, 0x0063543BUL >> 8, 0x0063FF12UL >> 8, 0x0064343BUL >> 8,
228 0x00643F2BUL >> 8, 0x0064443BUL >> 8, 0x00645209UL >> 8, 0x00665513UL >> 8,
229 0x0066610AUL >> 8, 0x00666526UL >> 8, 0x0067A616UL >> 8, 0x0069843DUL >> 8,
230 0x006CF612UL >> 8, 0x006EF326UL >> 8, 0x006FFF18UL >> 8, 0x0071130CUL >> 8,
231 0x00721107UL >> 8, 0x00722239UL >> 8, 0x0072291CUL >> 8, 0x0072340BUL >> 8,
232 0x00731139UL >> 8, 0x00732239UL >> 8, 0x0073630BUL >> 8, 0x0073FF12UL >> 8,
233 0x0074430BUL >> 8, 0x00755426UL >> 8, 0x00776F28UL >> 8, 0x00777410UL >> 8,
234 0x0078843DUL >> 8, 0x007CF416UL >> 8, 0x007EF326UL >> 8, 0x007FFF18UL >> 8,
235 0x00822239UL >> 8, 0x00831139UL >> 8, 0x0083430BUL >> 8, 0x0084530BUL >> 8,
236 0x0087561CUL >> 8, 0x00887F25UL >> 8, 0x00888426UL >> 8, 0x008AF61CUL >> 8,
237 0x008F0018UL >> 8, 0x008FFF18UL >> 8, 0x00911107UL >> 8, 0x0093230BUL >> 8,
238 0x0094530BUL >> 8, 0x0097743DUL >> 8, 0x00998C25UL >> 8, 0x00999616UL >> 8,
239 0x009EF825UL >> 8, 0x009FFF18UL >> 8, 0x00A3430BUL >> 8, 0x00A4530BUL >> 8,
240 0x00A7743DUL >> 8, 0x00AA9F2BUL >> 8, 0x00AAA616UL >> 8, 0x00ABD61FUL >> 8,
241 0x00AFFF18UL >> 8, 0x00B3330BUL >> 8, 0x00B44426UL >> 8, 0x00B7643DUL >> 8,
242 0x00BB971FUL >> 8, 0x00BBB53DUL >> 8, 0x00BEF512UL >> 8, 0x00BFFF18UL >> 8,
243 0x00C22139UL >> 8, 0x00C5330EUL >> 8, 0x00C7633DUL >> 8, 0x00CCAF2EUL >> 8,
244 0x00CCC616UL >> 8, 0x00CFFF18UL >> 8, 0x00D4440EUL >> 8, 0x00D6420EUL >> 8,
245 0x00DDCF2EUL >> 8, 0x00DDD516UL >> 8, 0x00DFFF18UL >> 8, 0x00E4330EUL >> 8,
246 0x00E6841CUL >> 8, 0x00EEE61CUL >> 8, 0x00EFFF18UL >> 8, 0x00F3320EUL >> 8,
247 0x00F55319UL >> 8, 0x00F8F41CUL >> 8, 0x00FAFF2EUL >> 8, 0x00FF002EUL >> 8,
248 0x00FFF10CUL >> 8, 0x00FFF33DUL >> 8, 0x00FFF722UL >> 8, 0x00FFFF18UL >> 8,
249 0x01000232UL >> 8, 0x0111113EUL >> 8, 0x01112103UL >> 8, 0x0111311AUL >> 8,
250 0x0112111AUL >> 8, 0x01122130UL >> 8, 0x01123130UL >> 8, 0x0112411DUL >> 8,
251 0x01131102UL >> 8, 0x01132102UL >> 8, 0x01133102UL >> 8, 0x01141108UL >> 8,
252 0x01142136UL >> 8, 0x01143136UL >> 8, 0x01144135UL >> 8, 0x0115223BUL >> 8,
253 0x01211103UL >> 8, 0x0121211AUL >> 8, 0x01213130UL >> 8, 0x01221130UL >> 8,
254 0x01222130UL >> 8, 0x01223102UL >> 8, 0x01231104UL >> 8, 0x01232104UL >> 8,
255 0x01233104UL >> 8, 0x01241139UL >> 8, 0x01241220UL >> 8, 0x01242220UL >> 8,
256 0x01251109UL >> 8, 0x0125223BUL >> 8, 0x0125810AUL >> 8, 0x01283212UL >> 8,
257 0x0131111AUL >> 8, 0x01312130UL >> 8, 0x0131222CUL >> 8, 0x0131322AUL >> 8,
258 0x0132122AUL >> 8, 0x0132222DUL >> 8, 0x0132322DUL >> 8, 0x01331207UL >> 8,
259 0x01332234UL >> 8, 0x01333234UL >> 8, 0x01341139UL >> 8, 0x01343134UL >> 8,
260 0x01344134UL >> 8, 0x01348134UL >> 8, 0x0135220BUL >> 8, 0x0136110BUL >> 8,
261 0x01365224UL >> 8, 0x01411102UL >> 8, 0x01412104UL >> 8, 0x01431239UL >> 8,
262 0x01432239UL >> 8, 0x0143320AUL >> 8, 0x01435134UL >> 8, 0x01443107UL >> 8,
263 0x01444134UL >> 8, 0x01446134UL >> 8, 0x0145220EUL >> 8, 0x01455134UL >> 8,
264 0x0147110EUL >> 8, 0x01511102UL >> 8, 0x01521239UL >> 8, 0x01531239UL >> 8,
265 0x01532239UL >> 8, 0x01533107UL >> 8, 0x0155220EUL >> 8, 0x01555134UL >> 8,
266 0x0157110EUL >> 8, 0x01611107UL >> 8, 0x01621239UL >> 8, 0x01631239UL >> 8,
267 0x01661139UL >> 8, 0x01666134UL >> 8, 0x01711107UL >> 8, 0x01721239UL >> 8,
268 0x01745107UL >> 8, 0x0177110CUL >> 8, 0x01811107UL >> 8, 0x01821107UL >> 8,
269 0x0185110CUL >> 8, 0x0188210CUL >> 8, 0x01911107UL >> 8, 0x01933139UL >> 8,
270 0x01A11107UL >> 8, 0x01A31139UL >> 8, 0x01F5220EUL >> 8, 0x02000001UL >> 8,
271 0x02000127UL >> 8, 0x02000427UL >> 8, 0x02000727UL >> 8, 0x02000E2FUL >> 8,
272 0x02110000UL >> 8, 0x02111200UL >> 8, 0x02111411UL >> 8, 0x02111827UL >> 8,
273 0x02111F2FUL >> 8, 0x02112411UL >> 8, 0x02112715UL >> 8, 0x02113200UL >> 8,
274 0x02113411UL >> 8, 0x02113715UL >> 8, 0x02114200UL >> 8, 0x02121200UL >> 8,
275 0x02121301UL >> 8, 0x02121F2FUL >> 8, 0x02122200UL >> 8, 0x02122615UL >> 8,
276 0x02122F2FUL >> 8, 0x02123311UL >> 8, 0x02123F2FUL >> 8, 0x02124411UL >> 8,
277 0x02131211UL >> 8, 0x02132311UL >> 8, 0x02133211UL >> 8, 0x02184415UL >> 8,
278 0x02211200UL >> 8, 0x02211311UL >> 8, 0x02211F2FUL >> 8, 0x02212311UL >> 8,
279 0x02212F2FUL >> 8, 0x02213211UL >> 8, 0x02221201UL >> 8, 0x02221311UL >> 8,
280 0x02221F2FUL >> 8, 0x02222311UL >> 8, 0x02222F2FUL >> 8, 0x02223211UL >> 8,
281 0x02223F2FUL >> 8, 0x02231211UL >> 8, 0x02232211UL >> 8, 0x02232F2FUL >> 8,
282 0x02233211UL >> 8, 0x02233F2FUL >> 8, 0x02287515UL >> 8, 0x022DAB17UL >> 8,
283 0x02311211UL >> 8, 0x02311527UL >> 8, 0x02312211UL >> 8, 0x02321211UL >> 8,
284 0x02322211UL >> 8, 0x02322F2FUL >> 8, 0x02323311UL >> 8, 0x02323F2FUL >> 8,
285 0x02331211UL >> 8, 0x02332211UL >> 8, 0x02332F2FUL >> 8, 0x02333F2FUL >> 8,
286 0x0237FF17UL >> 8, 0x02385615UL >> 8, 0x023D9517UL >> 8, 0x02410027UL >> 8,
287 0x02487827UL >> 8, 0x024E3117UL >> 8, 0x024FFF2FUL >> 8, 0x02598627UL >> 8,
288 0x025DFF2FUL >> 8, 0x025FFF2FUL >> 8, 0x02687827UL >> 8, 0x026DFA17UL >> 8,
289 0x026FFF2FUL >> 8, 0x02796427UL >> 8, 0x027E4217UL >> 8, 0x027FFF2FUL >> 8,
290 0x02888727UL >> 8, 0x028EFF2FUL >> 8, 0x028FFF2FUL >> 8, 0x02984327UL >> 8,
291 0x029F112FUL >> 8, 0x029FFF2FUL >> 8, 0x02A76527UL >> 8, 0x02AEF717UL >> 8,
292 0x02AFFF2FUL >> 8, 0x02B7C827UL >> 8, 0x02BEF917UL >> 8, 0x02BFFF2FUL >> 8,
293 0x02C66527UL >> 8, 0x02CD5517UL >> 8, 0x02CFFF2FUL >> 8, 0x02D63227UL >> 8,
294 0x02DDD527UL >> 8, 0x02DFFF2BUL >> 8, 0x02E84717UL >> 8, 0x02EEE327UL >> 8,
295 0x02EFFF2FUL >> 8, 0x02F54527UL >> 8, 0x02FCF817UL >> 8, 0x02FFEF2BUL >> 8,
296 0x02FFFA2FUL >> 8, 0x02FFFE2FUL >> 8, 0x03000127UL >> 8, 0x03000201UL >> 8,
297 0x03111200UL >> 8, 0x03122115UL >> 8, 0x03123200UL >> 8, 0x03133211UL >> 8,
298 0x03211200UL >> 8, 0x03213127UL >> 8, 0x03221200UL >> 8, 0x03345215UL >> 8,
299 0x04000F17UL >> 8, 0x04122F17UL >> 8, 0x043F6515UL >> 8, 0x043FFF17UL >> 8,
300 0x044F5527UL >> 8, 0x044FFF17UL >> 8, 0x045F0017UL >> 8, 0x045FFF17UL >> 8,
301 0x046F6517UL >> 8, 0x04710027UL >> 8, 0x047F4427UL >> 8, 0x04810027UL >> 8,
302 0x048EFA15UL >> 8, 0x048FFF2FUL >> 8, 0x049F4427UL >> 8, 0x049FFF2FUL >> 8,
303 0x04AEA727UL >> 8, 0x04AFFF2FUL >> 8, 0x04BE9C15UL >> 8, 0x04BFFF2FUL >> 8,
304 0x04CE5427UL >> 8, 0x04CFFF2FUL >> 8, 0x04DE3527UL >> 8, 0x04DFFF17UL >> 8,
305 0x04EE4627UL >> 8, 0x04EFFF17UL >> 8, 0x04FEF327UL >> 8, 0x04FFFF2FUL >> 8,
306 0x06000F27UL >> 8, 0x069FFF17UL >> 8, 0x06FFFF17UL >> 8, 0x08110017UL >> 8,
307 0x08EFFF15UL >> 8, 0xFFFFFF00UL >> 8};
308
309 static const UWORD8 ixheaacd_ari_hash_m_1[742] = {
310 (UWORD8)0x04, (UWORD8)0x0A, (UWORD8)0x10, (UWORD8)0x16, (UWORD8)0x1F,
311 (UWORD8)0x2E, (UWORD8)0x00, (UWORD8)0x03, (UWORD8)0x06, (UWORD8)0x36,
312 (UWORD8)0x23, (UWORD8)0x29, (UWORD8)0x2E, (UWORD8)0x1B, (UWORD8)0x35,
313 (UWORD8)0x21, (UWORD8)0x12, (UWORD8)0x30, (UWORD8)0x1D, (UWORD8)0x35,
314 (UWORD8)0x38, (UWORD8)0x1B, (UWORD8)0x33, (UWORD8)0x35, (UWORD8)0x29,
315 (UWORD8)0x35, (UWORD8)0x24, (UWORD8)0x33, (UWORD8)0x0F, (UWORD8)0x02,
316 (UWORD8)0x2D, (UWORD8)0x36, (UWORD8)0x23, (UWORD8)0x12, (UWORD8)0x3F,
317 (UWORD8)0x2D, (UWORD8)0x36, (UWORD8)0x38, (UWORD8)0x29, (UWORD8)0x2B,
318 (UWORD8)0x2D, (UWORD8)0x36, (UWORD8)0x38, (UWORD8)0x29, (UWORD8)0x1D,
319 (UWORD8)0x36, (UWORD8)0x38, (UWORD8)0x12, (UWORD8)0x35, (UWORD8)0x29,
320 (UWORD8)0x35, (UWORD8)0x37, (UWORD8)0x2A, (UWORD8)0x1E, (UWORD8)0x3B,
321 (UWORD8)0x2D, (UWORD8)0x3C, (UWORD8)0x23, (UWORD8)0x2E, (UWORD8)0x1E,
322 (UWORD8)0x21, (UWORD8)0x24, (UWORD8)0x1E, (UWORD8)0x36, (UWORD8)0x38,
323 (UWORD8)0x35, (UWORD8)0x37, (UWORD8)0x12, (UWORD8)0x37, (UWORD8)0x29,
324 (UWORD8)0x24, (UWORD8)0x21, (UWORD8)0x36, (UWORD8)0x21, (UWORD8)0x25,
325 (UWORD8)0x21, (UWORD8)0x38, (UWORD8)0x29, (UWORD8)0x23, (UWORD8)0x12,
326 (UWORD8)0x0C, (UWORD8)0x29, (UWORD8)0x31, (UWORD8)0x2C, (UWORD8)0x08,
327 (UWORD8)0x13, (UWORD8)0x2E, (UWORD8)0x2A, (UWORD8)0x08, (UWORD8)0x10,
328 (UWORD8)0x2E, (UWORD8)0x1E, (UWORD8)0x36, (UWORD8)0x24, (UWORD8)0x2D,
329 (UWORD8)0x1E, (UWORD8)0x36, (UWORD8)0x1F, (UWORD8)0x37, (UWORD8)0x04,
330 (UWORD8)0x2A, (UWORD8)0x20, (UWORD8)0x29, (UWORD8)0x2E, (UWORD8)0x2D,
331 (UWORD8)0x08, (UWORD8)0x23, (UWORD8)0x29, (UWORD8)0x2B, (UWORD8)0x1E,
332 (UWORD8)0x08, (UWORD8)0x24, (UWORD8)0x29, (UWORD8)0x1E, (UWORD8)0x36,
333 (UWORD8)0x23, (UWORD8)0x34, (UWORD8)0x21, (UWORD8)0x12, (UWORD8)0x36,
334 (UWORD8)0x37, (UWORD8)0x29, (UWORD8)0x2D, (UWORD8)0x3C, (UWORD8)0x20,
335 (UWORD8)0x16, (UWORD8)0x2D, (UWORD8)0x3C, (UWORD8)0x09, (UWORD8)0x29,
336 (UWORD8)0x2D, (UWORD8)0x08, (UWORD8)0x09, (UWORD8)0x24, (UWORD8)0x3C,
337 (UWORD8)0x21, (UWORD8)0x13, (UWORD8)0x3C, (UWORD8)0x21, (UWORD8)0x1F,
338 (UWORD8)0x21, (UWORD8)0x29, (UWORD8)0x24, (UWORD8)0x3B, (UWORD8)0x08,
339 (UWORD8)0x09, (UWORD8)0x26, (UWORD8)0x08, (UWORD8)0x09, (UWORD8)0x10,
340 (UWORD8)0x36, (UWORD8)0x21, (UWORD8)0x23, (UWORD8)0x1F, (UWORD8)0x23,
341 (UWORD8)0x0A, (UWORD8)0x23, (UWORD8)0x29, (UWORD8)0x10, (UWORD8)0x21,
342 (UWORD8)0x3B, (UWORD8)0x21, (UWORD8)0x10, (UWORD8)0x25, (UWORD8)0x21,
343 (UWORD8)0x12, (UWORD8)0x13, (UWORD8)0x29, (UWORD8)0x01, (UWORD8)0x24,
344 (UWORD8)0x30, (UWORD8)0x2A, (UWORD8)0x20, (UWORD8)0x16, (UWORD8)0x2C,
345 (UWORD8)0x1E, (UWORD8)0x08, (UWORD8)0x10, (UWORD8)0x2A, (UWORD8)0x1E,
346 (UWORD8)0x08, (UWORD8)0x23, (UWORD8)0x1E, (UWORD8)0x3C, (UWORD8)0x07,
347 (UWORD8)0x2D, (UWORD8)0x20, (UWORD8)0x16, (UWORD8)0x2D, (UWORD8)0x3C,
348 (UWORD8)0x09, (UWORD8)0x16, (UWORD8)0x2D, (UWORD8)0x20, (UWORD8)0x10,
349 (UWORD8)0x2B, (UWORD8)0x08, (UWORD8)0x23, (UWORD8)0x25, (UWORD8)0x21,
350 (UWORD8)0x1F, (UWORD8)0x21, (UWORD8)0x29, (UWORD8)0x07, (UWORD8)0x08,
351 (UWORD8)0x0D, (UWORD8)0x1E, (UWORD8)0x08, (UWORD8)0x20, (UWORD8)0x10,
352 (UWORD8)0x29, (UWORD8)0x1E, (UWORD8)0x08, (UWORD8)0x3B, (UWORD8)0x29,
353 (UWORD8)0x3C, (UWORD8)0x20, (UWORD8)0x3B, (UWORD8)0x29, (UWORD8)0x0A,
354 (UWORD8)0x20, (UWORD8)0x24, (UWORD8)0x0A, (UWORD8)0x21, (UWORD8)0x12,
355 (UWORD8)0x23, (UWORD8)0x39, (UWORD8)0x3B, (UWORD8)0x08, (UWORD8)0x09,
356 (UWORD8)0x10, (UWORD8)0x08, (UWORD8)0x09, (UWORD8)0x10, (UWORD8)0x08,
357 (UWORD8)0x0D, (UWORD8)0x10, (UWORD8)0x0A, (UWORD8)0x09, (UWORD8)0x3B,
358 (UWORD8)0x0A, (UWORD8)0x09, (UWORD8)0x24, (UWORD8)0x29, (UWORD8)0x10,
359 (UWORD8)0x20, (UWORD8)0x0D, (UWORD8)0x10, (UWORD8)0x20, (UWORD8)0x0D,
360 (UWORD8)0x10, (UWORD8)0x28, (UWORD8)0x0D, (UWORD8)0x10, (UWORD8)0x1F,
361 (UWORD8)0x10, (UWORD8)0x26, (UWORD8)0x12, (UWORD8)0x26, (UWORD8)0x12,
362 (UWORD8)0x26, (UWORD8)0x12, (UWORD8)0x12, (UWORD8)0x1F, (UWORD8)0x04,
363 (UWORD8)0x07, (UWORD8)0x0D, (UWORD8)0x2A, (UWORD8)0x20, (UWORD8)0x1E,
364 (UWORD8)0x08, (UWORD8)0x09, (UWORD8)0x2B, (UWORD8)0x08, (UWORD8)0x07,
365 (UWORD8)0x3C, (UWORD8)0x09, (UWORD8)0x07, (UWORD8)0x3C, (UWORD8)0x09,
366 (UWORD8)0x10, (UWORD8)0x3C, (UWORD8)0x09, (UWORD8)0x3B, (UWORD8)0x3C,
367 (UWORD8)0x20, (UWORD8)0x3B, (UWORD8)0x08, (UWORD8)0x09, (UWORD8)0x29,
368 (UWORD8)0x07, (UWORD8)0x20, (UWORD8)0x3B, (UWORD8)0x3C, (UWORD8)0x20,
369 (UWORD8)0x10, (UWORD8)0x3C, (UWORD8)0x20, (UWORD8)0x3B, (UWORD8)0x13,
370 (UWORD8)0x08, (UWORD8)0x09, (UWORD8)0x10, (UWORD8)0x08, (UWORD8)0x3B,
371 (UWORD8)0x25, (UWORD8)0x09, (UWORD8)0x3B, (UWORD8)0x29, (UWORD8)0x39,
372 (UWORD8)0x3B, (UWORD8)0x39, (UWORD8)0x09, (UWORD8)0x3B, (UWORD8)0x08,
373 (UWORD8)0x20, (UWORD8)0x3B, (UWORD8)0x0A, (UWORD8)0x09, (UWORD8)0x3B,
374 (UWORD8)0x13, (UWORD8)0x0A, (UWORD8)0x09, (UWORD8)0x10, (UWORD8)0x25,
375 (UWORD8)0x0D, (UWORD8)0x26, (UWORD8)0x13, (UWORD8)0x20, (UWORD8)0x0D,
376 (UWORD8)0x10, (UWORD8)0x20, (UWORD8)0x0D, (UWORD8)0x10, (UWORD8)0x20,
377 (UWORD8)0x0D, (UWORD8)0x09, (UWORD8)0x10, (UWORD8)0x12, (UWORD8)0x13,
378 (UWORD8)0x22, (UWORD8)0x25, (UWORD8)0x3D, (UWORD8)0x25, (UWORD8)0x25,
379 (UWORD8)0x18, (UWORD8)0x39, (UWORD8)0x07, (UWORD8)0x09, (UWORD8)0x07,
380 (UWORD8)0x07, (UWORD8)0x20, (UWORD8)0x07, (UWORD8)0x09, (UWORD8)0x3C,
381 (UWORD8)0x20, (UWORD8)0x3B, (UWORD8)0x08, (UWORD8)0x20, (UWORD8)0x39,
382 (UWORD8)0x09, (UWORD8)0x39, (UWORD8)0x09, (UWORD8)0x3B, (UWORD8)0x08,
383 (UWORD8)0x0D, (UWORD8)0x13, (UWORD8)0x08, (UWORD8)0x3B, (UWORD8)0x2B,
384 (UWORD8)0x09, (UWORD8)0x10, (UWORD8)0x25, (UWORD8)0x3B, (UWORD8)0x39,
385 (UWORD8)0x39, (UWORD8)0x09, (UWORD8)0x13, (UWORD8)0x39, (UWORD8)0x09,
386 (UWORD8)0x10, (UWORD8)0x2B, (UWORD8)0x09, (UWORD8)0x10, (UWORD8)0x28,
387 (UWORD8)0x0D, (UWORD8)0x12, (UWORD8)0x13, (UWORD8)0x2B, (UWORD8)0x10,
388 (UWORD8)0x0A, (UWORD8)0x3B, (UWORD8)0x25, (UWORD8)0x3B, (UWORD8)0x12,
389 (UWORD8)0x13, (UWORD8)0x13, (UWORD8)0x28, (UWORD8)0x3D, (UWORD8)0x28,
390 (UWORD8)0x18, (UWORD8)0x39, (UWORD8)0x07, (UWORD8)0x20, (UWORD8)0x24,
391 (UWORD8)0x07, (UWORD8)0x0B, (UWORD8)0x07, (UWORD8)0x20, (UWORD8)0x39,
392 (UWORD8)0x20, (UWORD8)0x39, (UWORD8)0x0C, (UWORD8)0x39, (UWORD8)0x09,
393 (UWORD8)0x39, (UWORD8)0x09, (UWORD8)0x26, (UWORD8)0x2B, (UWORD8)0x09,
394 (UWORD8)0x2B, (UWORD8)0x3B, (UWORD8)0x12, (UWORD8)0x3B, (UWORD8)0x2B,
395 (UWORD8)0x3B, (UWORD8)0x09, (UWORD8)0x13, (UWORD8)0x0A, (UWORD8)0x26,
396 (UWORD8)0x16, (UWORD8)0x3D, (UWORD8)0x12, (UWORD8)0x26, (UWORD8)0x18,
397 (UWORD8)0x0C, (UWORD8)0x07, (UWORD8)0x39, (UWORD8)0x1C, (UWORD8)0x0B,
398 (UWORD8)0x39, (UWORD8)0x39, (UWORD8)0x0B, (UWORD8)0x12, (UWORD8)0x0B,
399 (UWORD8)0x26, (UWORD8)0x28, (UWORD8)0x10, (UWORD8)0x3D, (UWORD8)0x16,
400 (UWORD8)0x26, (UWORD8)0x18, (UWORD8)0x39, (UWORD8)0x39, (UWORD8)0x0B,
401 (UWORD8)0x0B, (UWORD8)0x1C, (UWORD8)0x25, (UWORD8)0x26, (UWORD8)0x1C,
402 (UWORD8)0x18, (UWORD8)0x18, (UWORD8)0x07, (UWORD8)0x0B, (UWORD8)0x0B,
403 (UWORD8)0x3D, (UWORD8)0x25, (UWORD8)0x16, (UWORD8)0x25, (UWORD8)0x18,
404 (UWORD8)0x0B, (UWORD8)0x0B, (UWORD8)0x3D, (UWORD8)0x2B, (UWORD8)0x16,
405 (UWORD8)0x1F, (UWORD8)0x18, (UWORD8)0x0B, (UWORD8)0x26, (UWORD8)0x3D,
406 (UWORD8)0x1F, (UWORD8)0x3D, (UWORD8)0x12, (UWORD8)0x18, (UWORD8)0x39,
407 (UWORD8)0x0E, (UWORD8)0x3D, (UWORD8)0x2E, (UWORD8)0x16, (UWORD8)0x18,
408 (UWORD8)0x0E, (UWORD8)0x0E, (UWORD8)0x2E, (UWORD8)0x16, (UWORD8)0x18,
409 (UWORD8)0x0E, (UWORD8)0x1C, (UWORD8)0x1C, (UWORD8)0x18, (UWORD8)0x0E,
410 (UWORD8)0x19, (UWORD8)0x1C, (UWORD8)0x2E, (UWORD8)0x2E, (UWORD8)0x0C,
411 (UWORD8)0x3D, (UWORD8)0x22, (UWORD8)0x18, (UWORD8)0x32, (UWORD8)0x3E,
412 (UWORD8)0x03, (UWORD8)0x1A, (UWORD8)0x1A, (UWORD8)0x30, (UWORD8)0x30,
413 (UWORD8)0x1D, (UWORD8)0x02, (UWORD8)0x02, (UWORD8)0x02, (UWORD8)0x08,
414 (UWORD8)0x36, (UWORD8)0x36, (UWORD8)0x35, (UWORD8)0x3B, (UWORD8)0x03,
415 (UWORD8)0x1A, (UWORD8)0x30, (UWORD8)0x30, (UWORD8)0x30, (UWORD8)0x02,
416 (UWORD8)0x04, (UWORD8)0x04, (UWORD8)0x04, (UWORD8)0x39, (UWORD8)0x20,
417 (UWORD8)0x20, (UWORD8)0x09, (UWORD8)0x3B, (UWORD8)0x0A, (UWORD8)0x12,
418 (UWORD8)0x1A, (UWORD8)0x30, (UWORD8)0x2C, (UWORD8)0x2A, (UWORD8)0x2A,
419 (UWORD8)0x2D, (UWORD8)0x2D, (UWORD8)0x07, (UWORD8)0x34, (UWORD8)0x34,
420 (UWORD8)0x39, (UWORD8)0x34, (UWORD8)0x34, (UWORD8)0x34, (UWORD8)0x0B,
421 (UWORD8)0x0B, (UWORD8)0x24, (UWORD8)0x02, (UWORD8)0x04, (UWORD8)0x39,
422 (UWORD8)0x39, (UWORD8)0x0A, (UWORD8)0x34, (UWORD8)0x07, (UWORD8)0x34,
423 (UWORD8)0x34, (UWORD8)0x0E, (UWORD8)0x34, (UWORD8)0x0E, (UWORD8)0x02,
424 (UWORD8)0x39, (UWORD8)0x39, (UWORD8)0x39, (UWORD8)0x07, (UWORD8)0x0E,
425 (UWORD8)0x34, (UWORD8)0x0E, (UWORD8)0x07, (UWORD8)0x39, (UWORD8)0x39,
426 (UWORD8)0x39, (UWORD8)0x34, (UWORD8)0x07, (UWORD8)0x39, (UWORD8)0x07,
427 (UWORD8)0x0C, (UWORD8)0x07, (UWORD8)0x07, (UWORD8)0x0C, (UWORD8)0x0C,
428 (UWORD8)0x07, (UWORD8)0x39, (UWORD8)0x07, (UWORD8)0x39, (UWORD8)0x0E,
429 (UWORD8)0x01, (UWORD8)0x27, (UWORD8)0x27, (UWORD8)0x27, (UWORD8)0x2F,
430 (UWORD8)0x00, (UWORD8)0x00, (UWORD8)0x11, (UWORD8)0x27, (UWORD8)0x2F,
431 (UWORD8)0x11, (UWORD8)0x15, (UWORD8)0x00, (UWORD8)0x11, (UWORD8)0x15,
432 (UWORD8)0x00, (UWORD8)0x00, (UWORD8)0x01, (UWORD8)0x2F, (UWORD8)0x00,
433 (UWORD8)0x15, (UWORD8)0x2F, (UWORD8)0x11, (UWORD8)0x2F, (UWORD8)0x11,
434 (UWORD8)0x11, (UWORD8)0x11, (UWORD8)0x11, (UWORD8)0x15, (UWORD8)0x00,
435 (UWORD8)0x11, (UWORD8)0x2F, (UWORD8)0x11, (UWORD8)0x2F, (UWORD8)0x11,
436 (UWORD8)0x01, (UWORD8)0x11, (UWORD8)0x2F, (UWORD8)0x11, (UWORD8)0x2F,
437 (UWORD8)0x11, (UWORD8)0x2F, (UWORD8)0x11, (UWORD8)0x11, (UWORD8)0x2F,
438 (UWORD8)0x11, (UWORD8)0x2F, (UWORD8)0x15, (UWORD8)0x17, (UWORD8)0x11,
439 (UWORD8)0x27, (UWORD8)0x11, (UWORD8)0x11, (UWORD8)0x11, (UWORD8)0x2F,
440 (UWORD8)0x11, (UWORD8)0x2F, (UWORD8)0x11, (UWORD8)0x11, (UWORD8)0x2F,
441 (UWORD8)0x2F, (UWORD8)0x17, (UWORD8)0x15, (UWORD8)0x17, (UWORD8)0x27,
442 (UWORD8)0x27, (UWORD8)0x17, (UWORD8)0x2F, (UWORD8)0x27, (UWORD8)0x2F,
443 (UWORD8)0x2F, (UWORD8)0x27, (UWORD8)0x17, (UWORD8)0x2F, (UWORD8)0x27,
444 (UWORD8)0x17, (UWORD8)0x2F, (UWORD8)0x27, (UWORD8)0x2F, (UWORD8)0x2F,
445 (UWORD8)0x27, (UWORD8)0x2F, (UWORD8)0x2F, (UWORD8)0x27, (UWORD8)0x17,
446 (UWORD8)0x2F, (UWORD8)0x27, (UWORD8)0x17, (UWORD8)0x2F, (UWORD8)0x27,
447 (UWORD8)0x17, (UWORD8)0x2F, (UWORD8)0x27, (UWORD8)0x27, (UWORD8)0x2B,
448 (UWORD8)0x17, (UWORD8)0x27, (UWORD8)0x2F, (UWORD8)0x27, (UWORD8)0x17,
449 (UWORD8)0x2B, (UWORD8)0x2F, (UWORD8)0x2F, (UWORD8)0x27, (UWORD8)0x01,
450 (UWORD8)0x00, (UWORD8)0x15, (UWORD8)0x00, (UWORD8)0x11, (UWORD8)0x00,
451 (UWORD8)0x27, (UWORD8)0x00, (UWORD8)0x15, (UWORD8)0x17, (UWORD8)0x17,
452 (UWORD8)0x15, (UWORD8)0x17, (UWORD8)0x27, (UWORD8)0x17, (UWORD8)0x17,
453 (UWORD8)0x17, (UWORD8)0x17, (UWORD8)0x27, (UWORD8)0x27, (UWORD8)0x27,
454 (UWORD8)0x15, (UWORD8)0x2F, (UWORD8)0x27, (UWORD8)0x2F, (UWORD8)0x27,
455 (UWORD8)0x2F, (UWORD8)0x15, (UWORD8)0x2F, (UWORD8)0x27, (UWORD8)0x2F,
456 (UWORD8)0x27, (UWORD8)0x17, (UWORD8)0x27, (UWORD8)0x17, (UWORD8)0x27,
457 (UWORD8)0x2F, (UWORD8)0x27, (UWORD8)0x17, (UWORD8)0x17, (UWORD8)0x17,
458 (UWORD8)0x15, (UWORD8)0x00};
459
460 static const UWORD16 ixheaacd_ari_cf_m[64][17] = {
461 {708, 706, 579, 569, 568, 567, 479, 469, 297, 138, 97, 91, 72, 52, 38, 34,
462 0},
463 {7619, 6917, 6519, 6412, 5514, 5003, 4683, 4563, 3907, 3297, 3125, 3060,
464 2904, 2718, 2631, 2590, 0},
465 {7263, 4888, 4810, 4803, 1889, 415, 335, 327, 195, 72, 52, 49, 36, 20, 15,
466 14, 0},
467 {3626, 2197, 2188, 2187, 582, 57, 47, 46, 30, 12, 9, 8, 6, 4, 3, 2, 0},
468 {7806, 5541, 5451, 5441, 2720, 834, 691, 674, 487, 243, 179, 167, 139, 98,
469 77, 70, 0},
470 {6684, 4101, 4058, 4055, 1748, 426, 368, 364, 322, 257, 235, 232, 228, 222,
471 217, 215, 0},
472 {9162, 5964, 5831, 5819, 3269, 866, 658, 638, 535, 348, 258, 244, 234, 214,
473 195, 186, 0},
474 {10638, 8491, 8365, 8351, 4418, 2067, 1859, 1834, 1190, 601, 495, 478, 356,
475 217, 174, 164, 0},
476 {13389, 10514, 10032, 9961, 7166, 3488, 2655, 2524, 2015, 1140, 760, 672,
477 585, 426, 325, 283, 0},
478 {14861, 12788, 12115, 11952, 9987, 6657, 5323, 4984, 4324, 3001, 2205, 1943,
479 1764, 1394, 1115, 978, 0},
480 {12876, 10004, 9661, 9610, 7107, 3435, 2711, 2595, 2257, 1508, 1059, 952,
481 893, 753, 609, 538, 0},
482 {15125, 13591, 13049, 12874, 11192, 8543, 7406, 7023, 6291, 4922, 4104,
483 3769, 3465, 2890, 2486, 2275, 0},
484 {14574, 13106, 12731, 12638, 10453, 7947, 7233, 7037, 6031, 4618, 4081,
485 3906, 3465, 2802, 2476, 2349, 0},
486 {15070, 13179, 12517, 12351, 10742, 7657, 6200, 5825, 5264, 3998, 3014,
487 2662, 2510, 2153, 1799, 1564, 0},
488 {15542, 14466, 14007, 13844, 12489, 10409, 9481, 9132, 8305, 6940, 6193,
489 5867, 5458, 4743, 4291, 4047, 0},
490 {15165, 14384, 14084, 13934, 12911, 11485, 10844, 10513, 10002, 8993, 8380,
491 8051, 7711, 7036, 6514, 6233, 0},
492 {15642, 14279, 13625, 13393, 12348, 9971, 8405, 7858, 7335, 6119, 4918,
493 4376, 4185, 3719, 3231, 2860, 0},
494 {13408, 13407, 11471, 11218, 11217, 11216, 9473, 9216, 6480, 3689, 2857,
495 2690, 2256, 1732, 1405, 1302, 0},
496 {16098, 15584, 15191, 14931, 14514, 13578, 12703, 12103, 11830, 11172,
497 10475, 9867, 9695, 9281, 8825, 8389, 0},
498 {15844, 14873, 14277, 13996, 13230, 11535, 10205, 9543, 9107, 8086, 7085,
499 6419, 6214, 5713, 5195, 4731, 0},
500 {16131, 15720, 15443, 15276, 14848, 13971, 13314, 12910, 12591, 11874,
501 11225, 10788, 10573, 10077, 9585, 9209, 0},
502 {16331, 16330, 12283, 11435, 11434, 11433, 8725, 8049, 6065, 4138, 3187,
503 2842, 2529, 2171, 1907, 1745, 0},
504 {16011, 15292, 14782, 14528, 14008, 12767, 11556, 10921, 10591, 9759, 8813,
505 8043, 7855, 7383, 6863, 6282, 0},
506 {16380, 16379, 15159, 14610, 14609, 14608, 12859, 12111, 11046, 9536, 8348,
507 7713, 7216, 6533, 5964, 5546, 0},
508 {16367, 16333, 16294, 16253, 16222, 16143, 16048, 15947, 15915, 15832,
509 15731, 15619, 15589, 15512, 15416, 15310, 0},
510 {15967, 15319, 14937, 14753, 14010, 12638, 11787, 11360, 10805, 9706, 8934,
511 8515, 8166, 7456, 6911, 6575, 0},
512 {4906, 3005, 2985, 2984, 875, 102, 83, 81, 47, 17, 12, 11, 8, 5, 4, 3, 0},
513 {7217, 4346, 4269, 4264, 1924, 428, 340, 332, 280, 203, 179, 175, 171, 164,
514 159, 157, 0},
515 {16010, 15415, 15032, 14805, 14228, 13043, 12168, 11634, 11265, 10419, 9645,
516 9110, 8892, 8378, 7850, 7437, 0},
517 {8573, 5218, 5046, 5032, 2787, 771, 555, 533, 443, 286, 218, 205, 197, 181,
518 168, 162, 0},
519 {11474, 8095, 7822, 7796, 4632, 1443, 1046, 1004, 748, 351, 218, 194, 167,
520 121, 93, 83, 0},
521 {16152, 15764, 15463, 15264, 14925, 14189, 13536, 13070, 12846, 12314,
522 11763, 11277, 11131, 10777, 10383, 10011, 0},
523 {14187, 11654, 11043, 10919, 8498, 4885, 3778, 3552, 2947, 1835, 1283, 1134,
524 998, 749, 585, 514, 0},
525 {14162, 11527, 10759, 10557, 8601, 5417, 4105, 3753, 3286, 2353, 1708, 1473,
526 1370, 1148, 959, 840, 0},
527 {16205, 15902, 15669, 15498, 15213, 14601, 14068, 13674, 13463, 12970,
528 12471, 12061, 11916, 11564, 11183, 10841, 0},
529 {15043, 12972, 12092, 11792, 10265, 7446, 5934, 5379, 4883, 3825, 3036,
530 2647, 2507, 2185, 1901, 1699, 0},
531 {15320, 13694, 12782, 12352, 11191, 8936, 7433, 6671, 6255, 5366, 4622,
532 4158, 4020, 3712, 3420, 3198, 0},
533 {16255, 16020, 15768, 15600, 15416, 14963, 14440, 14006, 13875, 13534,
534 13137, 12697, 12602, 12364, 12084, 11781, 0},
535 {15627, 14503, 13906, 13622, 12557, 10527, 9269, 8661, 8117, 6933, 5994,
536 5474, 5222, 4664, 4166, 3841, 0},
537 {16366, 16365, 14547, 14160, 14159, 14158, 11969, 11473, 8735, 6147, 4911,
538 4530, 3865, 3180, 2710, 2473, 0},
539 {16257, 16038, 15871, 15754, 15536, 15071, 14673, 14390, 14230, 13842,
540 13452, 13136, 13021, 12745, 12434, 12154, 0},
541 {15855, 14971, 14338, 13939, 13239, 11782, 10585, 9805, 9444, 8623, 7846,
542 7254, 7079, 6673, 6262, 5923, 0},
543 {9492, 6318, 6197, 6189, 3004, 652, 489, 477, 333, 143, 96, 90, 78, 60, 50,
544 47, 0},
545 {16313, 16191, 16063, 15968, 15851, 15590, 15303, 15082, 14968, 14704,
546 14427, 14177, 14095, 13899, 13674, 13457, 0},
547 {8485, 5473, 5389, 5383, 2411, 494, 386, 377, 278, 150, 117, 112, 103, 89,
548 81, 78, 0},
549 {10497, 7154, 6959, 6943, 3788, 1004, 734, 709, 517, 238, 152, 138, 120, 90,
550 72, 66, 0},
551 {16317, 16226, 16127, 16040, 15955, 15762, 15547, 15345, 15277, 15111,
552 14922, 14723, 14671, 14546, 14396, 14239, 0},
553 {16382, 16381, 15858, 15540, 15539, 15538, 14704, 14168, 13768, 13092,
554 12452, 11925, 11683, 11268, 10841, 10460, 0},
555 {5974, 3798, 3758, 3755, 1275, 205, 166, 162, 95, 35, 26, 24, 18, 11, 8, 7,
556 0},
557 {3532, 2258, 2246, 2244, 731, 135, 118, 115, 87, 45, 36, 34, 29, 21, 17, 16,
558 0},
559 {7466, 4882, 4821, 4811, 2476, 886, 788, 771, 688, 531, 469, 457, 437, 400,
560 369, 361, 0},
561 {9580, 5772, 5291, 5216, 3444, 1496, 1025, 928, 806, 578, 433, 384, 366,
562 331, 296, 273, 0},
563 {10692, 7730, 7543, 7521, 4679, 1746, 1391, 1346, 1128, 692, 495, 458, 424,
564 353, 291, 268, 0},
565 {11040, 7132, 6549, 6452, 4377, 1875, 1253, 1130, 958, 631, 431, 370, 346,
566 296, 253, 227, 0},
567 {12687, 9332, 8701, 8585, 6266, 3093, 2182, 2004, 1683, 1072, 712, 608, 559,
568 458, 373, 323, 0},
569 {13429, 9853, 8860, 8584, 6806, 4039, 2862, 2478, 2239, 1764, 1409, 1224,
570 1178, 1077, 979, 903, 0},
571 {14685, 12163, 11061, 10668, 9101, 6345, 4871, 4263, 3908, 3200, 2668, 2368,
572 2285, 2106, 1942, 1819, 0},
573 {13295, 11302, 10999, 10945, 7947, 5036, 4490, 4385, 3391, 2185, 1836, 1757,
574 1424, 998, 833, 785, 0},
575 {4992, 2993, 2972, 2970, 1269, 575, 552, 549, 530, 505, 497, 495, 493, 489,
576 486, 485, 0},
577 {15419, 13862, 13104, 12819, 11429, 8753, 7220, 6651, 6020, 4667, 3663,
578 3220, 2995, 2511, 2107, 1871, 0},
579 {12468, 9263, 8912, 8873, 5758, 2193, 1625, 1556, 1187, 589, 371, 330, 283,
580 200, 149, 131, 0},
581 {15870, 15076, 14615, 14369, 13586, 12034, 10990, 10423, 9953, 8908, 8031,
582 7488, 7233, 6648, 6101, 5712, 0},
583 {1693, 978, 976, 975, 194, 18, 16, 15, 11, 7, 6, 5, 4, 3, 2, 1, 0},
584 {7992, 5218, 5147, 5143, 2152, 366, 282, 276, 173, 59, 38, 35, 27, 16, 11,
585 10, 0}};
586
587 typedef struct { WORD32 low, high, value; } state_arith;
588
589 const WORD32 ixheaacd_table_frac[7] = {
590 638450709, 759250126, 902905651, 1073741824,
591 1276901417, 1518500250, 1805811302,
592 };
593
594 const WORD64 ixheaacd_table_exp[32] = {
595 1, 2, 4, 8, 16, 32, 64,
596 128, 256, 512, 1024, 2048, 4096, 8192,
597 16384, 32768, 65536, 131072, 262144, 524288, 1048576,
598 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728,
599 268435456, 536870912, 1073741824, 2147483648};
600
601 static const WORD32 ixheaacd_pow_14_3[8] = {0, 3251, 4096, 5161,
602 6502, 8192, 10321, 13004};
603
604 const WORD32 ixheaacd_pow_table_Q13[1025] = {0,
605 131072 >> 4,
606 330281 >> 4,
607 567116 >> 4,
608 832256 >> 4,
609 1120650 >> 4,
610 1429042 >> 4,
611 1755122 >> 4,
612 2097152 >> 4,
613 2453767 >> 4,
614 2823861 >> 4,
615 3206517 >> 4,
616 3600960 >> 4,
617 4006524 >> 4,
618 4422631 >> 4,
619 4848770 >> 4,
620 5284492 >> 4,
621 5729392 >> 4,
622 6183105 >> 4,
623 6645302 >> 4,
624 7115683 >> 4,
625 7593972 >> 4,
626 8079916 >> 4,
627 8573281 >> 4,
628 9073850 >> 4,
629 9581422 >> 4,
630 10095808 >> 4,
631 10616832 >> 4,
632 11144330 >> 4,
633 11678147 >> 4,
634 12218136 >> 4,
635 12764159 >> 4,
636 13316085 >> 4,
637 13873792 >> 4,
638 14437162 >> 4,
639 15006082 >> 4,
640 15580448 >> 4,
641 16160157 >> 4,
642 16745112 >> 4,
643 17335222 >> 4,
644 17930398 >> 4,
645 18530554 >> 4,
646 19135610 >> 4,
647 19745488 >> 4,
648 20360112 >> 4,
649 20979411 >> 4,
650 21603314 >> 4,
651 22231755 >> 4,
652 22864669 >> 4,
653 23501994 >> 4,
654 24143669 >> 4,
655 24789637 >> 4,
656 25439841 >> 4,
657 26094226 >> 4,
658 26752740 >> 4,
659 27415332 >> 4,
660 28081952 >> 4,
661 28752552 >> 4,
662 29427086 >> 4,
663 30105507 >> 4,
664 30787772 >> 4,
665 31473838 >> 4,
666 32163664 >> 4,
667 32857208 >> 4,
668 33554432 >> 4,
669 34255297 >> 4,
670 34959765 >> 4,
671 35667801 >> 4,
672 36379368 >> 4,
673 37094431 >> 4,
674 37812958 >> 4,
675 38534914 >> 4,
676 39260268 >> 4,
677 39988988 >> 4,
678 40721043 >> 4,
679 41456403 >> 4,
680 42195038 >> 4,
681 42936921 >> 4,
682 43682022 >> 4,
683 44430314 >> 4,
684 45181770 >> 4,
685 45936364 >> 4,
686 46694070 >> 4,
687 47454862 >> 4,
688 48218716 >> 4,
689 48985607 >> 4,
690 49755512 >> 4,
691 50528406 >> 4,
692 51304267 >> 4,
693 52083073 >> 4,
694 52864802 >> 4,
695 53649431 >> 4,
696 54436939 >> 4,
697 55227306 >> 4,
698 56020511 >> 4,
699 56816534 >> 4,
700 57615355 >> 4,
701 58416954 >> 4,
702 59221313 >> 4,
703 60028412 >> 4,
704 60838233 >> 4,
705 61650759 >> 4,
706 62465970 >> 4,
707 63283850 >> 4,
708 64104381 >> 4,
709 64927547 >> 4,
710 65753329 >> 4,
711 66581713 >> 4,
712 67412681 >> 4,
713 68246218 >> 4,
714 69082308 >> 4,
715 69920936 >> 4,
716 70762086 >> 4,
717 71605743 >> 4,
718 72451892 >> 4,
719 73300519 >> 4,
720 74151609 >> 4,
721 75005149 >> 4,
722 75861124 >> 4,
723 76719520 >> 4,
724 77580324 >> 4,
725 78443523 >> 4,
726 79309103 >> 4,
727 80177051 >> 4,
728 81047354 >> 4,
729 81920000 >> 4,
730 82794977 >> 4,
731 83672271 >> 4,
732 84551871 >> 4,
733 5339610,
734 5394871,
735 5450274,
736 5505818,
737 5561502,
738 5617327,
739 5673290,
740 5729391,
741 5785631,
742 5842007,
743 5898519,
744 5955168,
745 6011951,
746 6068869,
747 6125920,
748 6183105,
749 6240422,
750 6297871,
751 6355451,
752 6413162,
753 6471004,
754 6528974,
755 6587074,
756 6645302,
757 6703658,
758 6762141,
759 6820751,
760 6879487,
761 6938349,
762 6997336,
763 7056447,
764 7115683,
765 7175042,
766 7234524,
767 7294129,
768 7353855,
769 7413703,
770 7473672,
771 7533762,
772 7593972,
773 7654301,
774 7714750,
775 7775317,
776 7836002,
777 7896805,
778 7957725,
779 8018762,
780 8079916,
781 8141185,
782 8202570,
783 8264070,
784 8325685,
785 8387413,
786 8449256,
787 8511212,
788 8573281,
789 8635462,
790 8697756,
791 8760161,
792 8822678,
793 8885305,
794 8948043,
795 9010892,
796 9073850,
797 9136917,
798 9200094,
799 9263379,
800 9326772,
801 9390274,
802 9453882,
803 9517598,
804 9581421,
805 9645351,
806 9709386,
807 9773527,
808 9837774,
809 9902125,
810 9966582,
811 10031143,
812 10095807,
813 10160576,
814 10225448,
815 10290423,
816 10355500,
817 10420681,
818 10485963,
819 10551347,
820 10616832,
821 10682419,
822 10748106,
823 10813894,
824 10879782,
825 10945770,
826 11011857,
827 11078044,
828 11144330,
829 11210715,
830 11277198,
831 11343779,
832 11410458,
833 11477234,
834 11544108,
835 11611079,
836 11678147,
837 11745311,
838 11812571,
839 11879927,
840 11947378,
841 12014925,
842 12082567,
843 12150304,
844 12218135,
845 12286061,
846 12354081,
847 12422194,
848 12490401,
849 12558701,
850 12627094,
851 12695580,
852 12764158,
853 12832829,
854 12901592,
855 12970446,
856 13039392,
857 13108429,
858 13177557,
859 13246776,
860 13316085,
861 13385485,
862 13454975,
863 13524554,
864 13594224,
865 13663982,
866 13733830,
867 13803767,
868 13873792,
869 13943906,
870 14014108,
871 14084398,
872 14154776,
873 14225242,
874 14295794,
875 14366435,
876 14437162,
877 14507975,
878 14578876,
879 14649862,
880 14720935,
881 14792093,
882 14863337,
883 14934667,
884 15006082,
885 15077582,
886 15149167,
887 15220837,
888 15292591,
889 15364429,
890 15436351,
891 15508358,
892 15580448,
893 15652621,
894 15724878,
895 15797217,
896 15869640,
897 15942146,
898 16014734,
899 16087404,
900 16160156,
901 16232991,
902 16305907,
903 16378905,
904 16451984,
905 16525145,
906 16598386,
907 16671709,
908 16745112,
909 16818596,
910 16892160,
911 16965804,
912 17039528,
913 17113332,
914 17187216,
915 17261179,
916 17335222,
917 17409343,
918 17483544,
919 17557824,
920 17632182,
921 17706618,
922 17781133,
923 17855726,
924 17930397,
925 18005146,
926 18079973,
927 18154877,
928 18229858,
929 18304917,
930 18380052,
931 18455265,
932 18530554,
933 18605920,
934 18681362,
935 18756880,
936 18832475,
937 18908145,
938 18983891,
939 19059713,
940 19135610,
941 19211583,
942 19287630,
943 19363753,
944 19439951,
945 19516223,
946 19592571,
947 19668992,
948 19745488,
949 19822058,
950 19898702,
951 19975420,
952 20052211,
953 20129076,
954 20206015,
955 20283027,
956 20360112,
957 20437270,
958 20514501,
959 20591805,
960 20669181,
961 20746630,
962 20824151,
963 20901745,
964 20979410,
965 21057148,
966 21134957,
967 21212838,
968 21290791,
969 21368815,
970 21446910,
971 21525076,
972 21603314,
973 21681622,
974 21760001,
975 21838451,
976 21916971,
977 21995561,
978 22074222,
979 22152953,
980 22231754,
981 22310625,
982 22389566,
983 22468576,
984 22547656,
985 22626806,
986 22706024,
987 22785312,
988 22864669,
989 22944094,
990 23023589,
991 23103152,
992 23182783,
993 23262484,
994 23342252,
995 23422089,
996 23501993,
997 23581966,
998 23662007,
999 23742115,
1000 23822291,
1001 23902534,
1002 23982845,
1003 24063223,
1004 24143669,
1005 24224181,
1006 24304761,
1007 24385407,
1008 24466120,
1009 24546899,
1010 24627745,
1011 24708658,
1012 24789637,
1013 24870682,
1014 24951793,
1015 25032970,
1016 25114213,
1017 25195521,
1018 25276895,
1019 25358335,
1020 25439841,
1021 25521411,
1022 25603047,
1023 25684748,
1024 25766514,
1025 25848345,
1026 25930241,
1027 26012201,
1028 26094226,
1029 26176316,
1030 26258469,
1031 26340688,
1032 26422970,
1033 26505317,
1034 26587727,
1035 26670202,
1036 26752740,
1037 26835342,
1038 26918008,
1039 27000737,
1040 27083530,
1041 27166386,
1042 27249305,
1043 27332287,
1044 27415332,
1045 27498440,
1046 27581611,
1047 27664845,
1048 27748142,
1049 27831501,
1050 27914922,
1051 27998406,
1052 28081952,
1053 28165561,
1054 28249231,
1055 28332963,
1056 28416758,
1057 28500614,
1058 28584532,
1059 28668511,
1060 28752552,
1061 28836655,
1062 28920819,
1063 29005044,
1064 29089330,
1065 29173677,
1066 29258086,
1067 29342555,
1068 29427086,
1069 29511676,
1070 29596328,
1071 29681040,
1072 29765813,
1073 29850646,
1074 29935539,
1075 30020493,
1076 30105507,
1077 30190581,
1078 30275714,
1079 30360908,
1080 30446162,
1081 30531475,
1082 30616848,
1083 30702280,
1084 30787772,
1085 30873323,
1086 30958934,
1087 31044604,
1088 31130332,
1089 31216120,
1090 31301967,
1091 31387873,
1092 31473838,
1093 31559862,
1094 31645944,
1095 31732084,
1096 31818284,
1097 31904541,
1098 31990857,
1099 32077231,
1100 32163664,
1101 32250154,
1102 32336703,
1103 32423309,
1104 32509974,
1105 32596696,
1106 32683476,
1107 32770313,
1108 32857208,
1109 32944161,
1110 33031171,
1111 33118238,
1112 33205363,
1113 33292544,
1114 33379783,
1115 33467079,
1116 33554432,
1117 33641842,
1118 33729308,
1119 33816832,
1120 33904412,
1121 33992048,
1122 34079741,
1123 34167491,
1124 34255297,
1125 34343159,
1126 34431078,
1127 34519052,
1128 34607083,
1129 34695170,
1130 34783312,
1131 34871511,
1132 34959765,
1133 35048075,
1134 35136441,
1135 35224862,
1136 35313339,
1137 35401872,
1138 35490459,
1139 35579102,
1140 35667801,
1141 35756554,
1142 35845363,
1143 35934226,
1144 36023145,
1145 36112118,
1146 36201147,
1147 36290230,
1148 36379367,
1149 36468560,
1150 36557807,
1151 36647108,
1152 36736464,
1153 36825875,
1154 36915339,
1155 37004858,
1156 37094431,
1157 37184058,
1158 37273739,
1159 37363474,
1160 37453263,
1161 37543106,
1162 37633003,
1163 37722953,
1164 37812957,
1165 37903015,
1166 37993126,
1167 38083291,
1168 38173509,
1169 38263780,
1170 38354105,
1171 38444483,
1172 38534914,
1173 38625398,
1174 38715935,
1175 38806525,
1176 38897168,
1177 38987864,
1178 39078612,
1179 39169414,
1180 39260268,
1181 39351174,
1182 39442133,
1183 39533145,
1184 39624209,
1185 39715325,
1186 39806494,
1187 39897714,
1188 39988987,
1189 40080312,
1190 40171690,
1191 40263119,
1192 40354600,
1193 40446133,
1194 40537718,
1195 40629354,
1196 40721042,
1197 40812782,
1198 40904574,
1199 40996417,
1200 41088311,
1201 41180257,
1202 41272254,
1203 41364303,
1204 41456402,
1205 41548553,
1206 41640755,
1207 41733008,
1208 41825313,
1209 41917668,
1210 42010074,
1211 42102530,
1212 42195038,
1213 42287596,
1214 42380205,
1215 42472865,
1216 42565575,
1217 42658336,
1218 42751147,
1219 42844009,
1220 42936921,
1221 43029883,
1222 43122895,
1223 43215958,
1224 43309071,
1225 43402233,
1226 43495446,
1227 43588709,
1228 43682022,
1229 43775384,
1230 43868797,
1231 43962259,
1232 44055771,
1233 44149332,
1234 44242943,
1235 44336604,
1236 44430314,
1237 44524073,
1238 44617882,
1239 44711741,
1240 44805648,
1241 44899605,
1242 44993611,
1243 45087666,
1244 45181770,
1245 45275923,
1246 45370126,
1247 45464377,
1248 45558677,
1249 45653025,
1250 45747423,
1251 45841869,
1252 45936364,
1253 46030908,
1254 46125500,
1255 46220141,
1256 46314830,
1257 46409567,
1258 46504353,
1259 46599187,
1260 46694070,
1261 46789001,
1262 46883980,
1263 46979007,
1264 47074082,
1265 47169205,
1266 47264376,
1267 47359595,
1268 47454862,
1269 47550177,
1270 47645540,
1271 47740950,
1272 47836408,
1273 47931914,
1274 48027467,
1275 48123068,
1276 48218716,
1277 48314412,
1278 48410155,
1279 48505945,
1280 48601783,
1281 48697668,
1282 48793601,
1283 48889580,
1284 48985607,
1285 49081681,
1286 49177802,
1287 49273969,
1288 49370184,
1289 49466446,
1290 49562754,
1291 49659109,
1292 49755511,
1293 49851960,
1294 49948456,
1295 50044998,
1296 50141586,
1297 50238222,
1298 50334903,
1299 50431631,
1300 50528406,
1301 50625227,
1302 50722094,
1303 50819007,
1304 50915967,
1305 51012973,
1306 51110025,
1307 51207123,
1308 51304267,
1309 51401457,
1310 51498694,
1311 51595976,
1312 51693304,
1313 51790677,
1314 51888097,
1315 51985562,
1316 52083073,
1317 52180630,
1318 52278232,
1319 52375880,
1320 52473573,
1321 52571312,
1322 52669097,
1323 52766926,
1324 52864801,
1325 52962722,
1326 53060688,
1327 53158699,
1328 53256755,
1329 53354856,
1330 53453002,
1331 53551194,
1332 53649430,
1333 53747712,
1334 53846038,
1335 53944410,
1336 54042826,
1337 54141287,
1338 54239793,
1339 54338344,
1340 54436939,
1341 54535579,
1342 54634263,
1343 54732993,
1344 54831766,
1345 54930585,
1346 55029447,
1347 55128354,
1348 55227306,
1349 55326302,
1350 55425342,
1351 55524426,
1352 55623555,
1353 55722728,
1354 55821945,
1355 55921206,
1356 56020511,
1357 56119860,
1358 56219253,
1359 56318690,
1360 56418171,
1361 56517696,
1362 56617265,
1363 56716877,
1364 56816534,
1365 56916234,
1366 57015977,
1367 57115765,
1368 57215595,
1369 57315470,
1370 57415388,
1371 57515349,
1372 57615354,
1373 57715403,
1374 57815494,
1375 57915629,
1376 58015808,
1377 58116030,
1378 58216294,
1379 58316602,
1380 58416954,
1381 58517348,
1382 58617785,
1383 58718266,
1384 58818789,
1385 58919356,
1386 59019965,
1387 59120617,
1388 59221312,
1389 59322050,
1390 59422831,
1391 59523654,
1392 59624521,
1393 59725429,
1394 59826381,
1395 59927375,
1396 60028412,
1397 60129491,
1398 60230613,
1399 60331777,
1400 60432983,
1401 60534232,
1402 60635524,
1403 60736857,
1404 60838233,
1405 60939651,
1406 61041112,
1407 61142614,
1408 61244159,
1409 61345746,
1410 61447375,
1411 61549046,
1412 61650759,
1413 61752513,
1414 61854310,
1415 61956149,
1416 62058030,
1417 62159952,
1418 62261916,
1419 62363922,
1420 62465970,
1421 62568059,
1422 62670191,
1423 62772363,
1424 62874578,
1425 62976833,
1426 63079131,
1427 63181470,
1428 63283850,
1429 63386272,
1430 63488735,
1431 63591239,
1432 63693785,
1433 63796372,
1434 63899001,
1435 64001670,
1436 64104381,
1437 64207133,
1438 64309926,
1439 64412760,
1440 64515636,
1441 64618552,
1442 64721509,
1443 64824507,
1444 64927546,
1445 65030627,
1446 65133747,
1447 65236909,
1448 65340112,
1449 65443355,
1450 65546639,
1451 65649964,
1452 65753329,
1453 65856735,
1454 65960182,
1455 66063669,
1456 66167197,
1457 66270765,
1458 66374374,
1459 66478023,
1460 66581713,
1461 66685443,
1462 66789213,
1463 66893024,
1464 66996875,
1465 67100766,
1466 67204698,
1467 67308669,
1468 67412681,
1469 67516733,
1470 67620825,
1471 67724957,
1472 67829130,
1473 67933342,
1474 68037594,
1475 68141886,
1476 68246218,
1477 68350590,
1478 68455002,
1479 68559454,
1480 68663945,
1481 68768476,
1482 68873047,
1483 68977658,
1484 69082308,
1485 69186998,
1486 69291728,
1487 69396497,
1488 69501306,
1489 69606154,
1490 69711042,
1491 69815969,
1492 69920936,
1493 70025942,
1494 70130987,
1495 70236072,
1496 70341196,
1497 70446360,
1498 70551562,
1499 70656804,
1500 70762085,
1501 70867406,
1502 70972765,
1503 71078164,
1504 71183601,
1505 71289078,
1506 71394594,
1507 71500149,
1508 71605742,
1509 71711375,
1510 71817046,
1511 71922757,
1512 72028506,
1513 72134294,
1514 72240121,
1515 72345987,
1516 72451892,
1517 72557835,
1518 72663817,
1519 72769837,
1520 72875896,
1521 72981994,
1522 73088130,
1523 73194305,
1524 73300519,
1525 73406770,
1526 73513061,
1527 73619390,
1528 73725757,
1529 73832162,
1530 73938606,
1531 74045088,
1532 74151609,
1533 74258168,
1534 74364765,
1535 74471400,
1536 74578073,
1537 74684785,
1538 74791535,
1539 74898323,
1540 75005149,
1541 75112012,
1542 75218914,
1543 75325854,
1544 75432832,
1545 75539848,
1546 75646902,
1547 75753994,
1548 75861123,
1549 75968291,
1550 76075496,
1551 76182739,
1552 76290020,
1553 76397338,
1554 76504694,
1555 76612088,
1556 76719520,
1557 76826989,
1558 76934495,
1559 77042040,
1560 77149622,
1561 77257241,
1562 77364898,
1563 77472592,
1564 77580324,
1565 77688093,
1566 77795899,
1567 77903743,
1568 78011625,
1569 78119543,
1570 78227499,
1571 78335492,
1572 78443522,
1573 78551590,
1574 78659695,
1575 78767836,
1576 78876015,
1577 78984232,
1578 79092485,
1579 79200775,
1580 79309102,
1581 79417467,
1582 79525868,
1583 79634306,
1584 79742781,
1585 79851293,
1586 79959842,
1587 80068428,
1588 80177050,
1589 80285710,
1590 80394406,
1591 80503139,
1592 80611908,
1593 80720715,
1594 80829558,
1595 80938438,
1596 81047354,
1597 81156307,
1598 81265296,
1599 81374322,
1600 81483385,
1601 81592484,
1602 81701620,
1603 81810792,
1604 81920000,
1605 82029245,
1606 82138526,
1607 82247844,
1608 82357198,
1609 82466588,
1610 82576014,
1611 82685477,
1612 82794976,
1613 82904512,
1614 83014083,
1615 83123691,
1616 83233334,
1617 83343014,
1618 83452730,
1619 83562482,
1620 83672271,
1621 83782095,
1622 83891955,
1623 84001851,
1624 84111783,
1625 84221751,
1626 84331755,
1627 84441795,
1628 84551870};
1629
1630 static const WORD32 ixheaacd_esc_nb_offset[8] = {
1631 0, 131072, 262144, 393216, 524288, 655360, 786432, 917504};
1632
ixheaacd_arith_map_context(WORD32 pres_n,WORD32 prev_n,WORD8 * c_prev,WORD8 * c,WORD32 arith_reset_flag,WORD8 * ptr_scratch)1633 static void ixheaacd_arith_map_context(WORD32 pres_n, WORD32 prev_n,
1634 WORD8 *c_prev, WORD8 *c,
1635 WORD32 arith_reset_flag,
1636 WORD8 *ptr_scratch) {
1637 WORD32 i, k;
1638 FLOAT32 ratio;
1639 WORD8 *c_prev_tmp = ptr_scratch;
1640 WORD8 *c_tmp = ptr_scratch + 516;
1641
1642 if (arith_reset_flag) {
1643 for (i = 0; i < (1024 / 2) + 4; i++) {
1644 c_prev[i] = 0;
1645 c[i] = 0;
1646 }
1647
1648 } else {
1649 for (i = 2; i < (prev_n / 2 + 4); i++) {
1650 c_prev_tmp[i] = c_prev[i];
1651 c_tmp[i] = c[i];
1652 }
1653
1654 ratio = (FLOAT32)(prev_n) / (FLOAT32)(pres_n);
1655 for (i = 0; i < (pres_n / 2); i++) {
1656 k = (WORD32)((FLOAT32)(i)*ratio);
1657 c_prev[2 + i] = c_prev_tmp[2 + k];
1658 c[2 + i] = c_tmp[2 + k];
1659 }
1660 c_prev[(pres_n / 2) + 2] = c_prev_tmp[(prev_n / 2) + 2];
1661 c[(pres_n / 2) + 3] = c_tmp[(prev_n / 2) + 3];
1662 }
1663 }
1664
ixheaacd_copy_to_bitbuff(ia_bit_buf_struct * it_bit_buff_src,ia_bit_buf_struct * it_bit_buff_dst)1665 VOID ixheaacd_copy_to_bitbuff(ia_bit_buf_struct *it_bit_buff_src,
1666 ia_bit_buf_struct *it_bit_buff_dst) {
1667 *it_bit_buff_dst = *it_bit_buff_src;
1668 }
1669
ixheaacd_arith_get_context(WORD8 * c_prev,WORD8 * c_pres,WORD32 * c,WORD32 i)1670 static WORD32 ixheaacd_arith_get_context(WORD8 *c_prev, WORD8 *c_pres,
1671 WORD32 *c, WORD32 i) {
1672 WORD32 tmp = (WORD32)c_prev[1] << 12;
1673
1674 *c = *c >> 4;
1675 *c = *c + tmp;
1676 *c = (*c & 0xFFF0) + c_pres[-1];
1677
1678 if (i > 3) {
1679 if ((c_pres[-1] + c_pres[-2] + c_pres[-3]) < 5) {
1680 return (*c + 0x10000);
1681 }
1682 }
1683
1684 return (*c);
1685 }
1686
ixheaacd_arith_first_symbol(ia_bit_buf_struct * it_bit_buff,state_arith * s)1687 static WORD32 ixheaacd_arith_first_symbol(ia_bit_buf_struct *it_bit_buff,
1688 state_arith *s) {
1689 register WORD32 val;
1690
1691 WORD32 bit_count = 16;
1692
1693 val = 0;
1694 if (it_bit_buff->cnt_bits < 16) {
1695 WORD32 shift_value = 16 - it_bit_buff->cnt_bits;
1696 val = ixheaacd_read_bits_buf(it_bit_buff, it_bit_buff->cnt_bits);
1697 val <<= shift_value;
1698 } else {
1699 val = ixheaacd_read_bits_buf(it_bit_buff, 16);
1700 }
1701
1702 s->low = 0;
1703 s->high = 65535;
1704 s->value = val;
1705
1706 return bit_count;
1707 }
1708
ixheaacd_arith_get_pk(UWORD32 c)1709 static UWORD32 ixheaacd_arith_get_pk(UWORD32 c) {
1710 UWORD32 j;
1711 WORD32 i, i_min, i_max;
1712
1713 i_min = -1;
1714 i = i_min;
1715 i_max = 742 - 1;
1716 while ((i_max - i_min) > 1) {
1717 i = i_min + ((i_max - i_min) >> 1);
1718 j = ixheaacd_ari_hash_m[i];
1719 if (c < j)
1720 i_max = i;
1721 else if (c > j)
1722 i_min = i;
1723 else
1724 return (UWORD32)ixheaacd_ari_hash_m_1[i];
1725 }
1726
1727 return (ixheaacd_ari_lookup_m[i_max]);
1728 }
1729
ixheaacd_arith_decode(ia_bit_buf_struct * it_bit_buff,WORD32 bit_count,WORD32 * m,state_arith * s,UWORD16 const * cum_freq,WORD32 cfl)1730 static WORD32 ixheaacd_arith_decode(ia_bit_buf_struct *it_bit_buff,
1731 WORD32 bit_count, WORD32 *m, state_arith *s,
1732 UWORD16 const *cum_freq, WORD32 cfl) {
1733 register WORD32 symbol;
1734 register WORD32 low, high, range, value;
1735 register WORD32 cumulative;
1736 register UWORD16 const *p;
1737 register UWORD16 const *q;
1738
1739 low = s->low;
1740 high = s->high;
1741 value = s->value;
1742
1743 range = high - low + 1;
1744 cumulative = ((((WORD32)(value - low + 1)) << 14) - ((WORD32)1)) / ((WORD32)range);
1745
1746 if (it_bit_buff->cnt_bits == 0)
1747 if (cumulative <= 0) {
1748 longjmp(*(it_bit_buff->xaac_jmp_buf), IA_XHEAAC_DEC_EXE_NONFATAL_INSUFFICIENT_INPUT_BYTES);
1749 }
1750 p = cum_freq - 1;
1751
1752 do {
1753 q = p + (cfl >> 1);
1754
1755 if (*q > cumulative) {
1756 p = q;
1757 cfl++;
1758 }
1759 cfl >>= 1;
1760 } while (cfl > 1);
1761
1762 symbol = (WORD32)(p - cum_freq + 1);
1763
1764 if (symbol) high = low + ((range * cum_freq[symbol - 1]) >> 14) - 1;
1765
1766 low += ((range * cum_freq[symbol]) >> 14);
1767
1768 for (;;) {
1769 if (high < 32768) {
1770 } else if (low >= 32768) {
1771 value -= 32768;
1772 low -= 32768;
1773 high -= 32768;
1774 } else if (low >= 16384 && high < 49152) {
1775 value -= 16384;
1776 low -= 16384;
1777 high -= 16384;
1778 } else
1779 break;
1780
1781 low += low;
1782 high += high + 1;
1783
1784 if (it_bit_buff->cnt_bits > 0)
1785 value = (value << 1) | ixheaacd_read_bits_buf(it_bit_buff, 1);
1786 else
1787 value = (value << 1);
1788
1789 bit_count++;
1790 }
1791
1792 s->low = low;
1793 s->high = high;
1794 s->value = value;
1795
1796 *m = symbol;
1797
1798 return bit_count;
1799 }
1800
ixheaacd_arth_decoding_level2(ia_bit_buf_struct * it_bit_buff,WORD8 * c_prev,WORD8 * c_pres,WORD32 n,WORD32 pres_n,WORD32 * quant)1801 VOID ixheaacd_arth_decoding_level2(ia_bit_buf_struct *it_bit_buff, WORD8 *c_prev, WORD8 *c_pres,
1802 WORD32 n, WORD32 pres_n, WORD32 *quant) {
1803 state_arith as;
1804 WORD32 a, b;
1805 WORD32 i, j, lev, pki, esc_nb;
1806 WORD32 m;
1807 WORD32 c = 0;
1808 struct ia_bit_buf_struct it_bit_buff_temp = {0};
1809 WORD32 bit_count = 0;
1810 WORD32 s1;
1811 WORD32 temp;
1812 WORD32 bit_count_5;
1813 ixheaacd_copy_to_bitbuff(it_bit_buff, &it_bit_buff_temp);
1814
1815 for (i = 0; i < pres_n; i++) {
1816 c_prev[i] = c_pres[i];
1817 c_pres[i] = 1;
1818 }
1819
1820 bit_count = ixheaacd_arith_first_symbol(&it_bit_buff_temp, &as);
1821
1822 c = (WORD32)c_prev[0] << 12;
1823 lev = 0;
1824
1825 for (i = 0; i < n; i++) {
1826 s1 = ixheaacd_arith_get_context(c_prev + i, c_pres + i, &c, i);
1827
1828 for (lev = esc_nb = 0;;) {
1829 pki = ixheaacd_arith_get_pk(s1 + ixheaacd_esc_nb_offset[esc_nb]);
1830 bit_count = ixheaacd_arith_decode(&it_bit_buff_temp, bit_count, &m, &as,
1831 ixheaacd_ari_cf_m[pki], 17);
1832 if (bit_count == -1) {
1833 longjmp(*(it_bit_buff->xaac_jmp_buf),
1834 IA_XHEAAC_DEC_EXE_NONFATAL_INSUFFICIENT_INPUT_BYTES);
1835 }
1836
1837 if (m < ARITH_ESCAPE) {
1838 break;
1839 }
1840
1841 lev += 1;
1842 esc_nb = lev;
1843
1844 if (esc_nb > 7) {
1845 esc_nb = 7;
1846 }
1847 }
1848
1849 if (m == 0) {
1850 if (esc_nb > 0) break;
1851
1852 quant[2 * i + 0] = 0;
1853 quant[2 * i + 1] = 0;
1854 c_pres[i] = 1;
1855 } else {
1856 b = m >> 2;
1857 a = m & 0x3;
1858
1859 for (j = 0; j < lev; j++) {
1860 WORD32 lsbidx = (a == 0) ? 1 : ((b == 0) ? 0 : 2);
1861 bit_count = ixheaacd_arith_decode(&it_bit_buff_temp, bit_count, &m, &as,
1862 ixheaacd_ari_cf_r[lsbidx], 4);
1863 if (bit_count == -1) {
1864 longjmp(*(it_bit_buff->xaac_jmp_buf),
1865 IA_XHEAAC_DEC_EXE_NONFATAL_INSUFFICIENT_INPUT_BYTES);
1866 }
1867 a = (a << 1) | (m & 1);
1868 b = (b << 1) | ((m >> 1) & 1);
1869 }
1870 if ((a > (8183)) || (b > (8183))) {
1871 longjmp(*(it_bit_buff->xaac_jmp_buf),
1872 IA_XHEAAC_DEC_EXE_NONFATAL_INSUFFICIENT_INPUT_BYTES);
1873 }
1874 if ((a < (-8183)) || (b < (-8183))) {
1875 longjmp(*(it_bit_buff->xaac_jmp_buf),
1876 IA_XHEAAC_DEC_EXE_NONFATAL_INSUFFICIENT_INPUT_BYTES);
1877 }
1878 quant[2 * i + 0] = a;
1879 quant[2 * i + 1] = b;
1880 temp = a + b + 1;
1881 c_pres[i] = (WORD8)temp;
1882 if (temp > 0xF) {
1883 c_pres[i] = 0xF;
1884 }
1885 }
1886 }
1887
1888 bit_count -= 16 - 2;
1889 if (bit_count > it_bit_buff->cnt_bits) {
1890 longjmp(*(it_bit_buff->xaac_jmp_buf), IA_XHEAAC_DEC_EXE_NONFATAL_INSUFFICIENT_INPUT_BYTES);
1891 }
1892
1893 if (bit_count > 0) {
1894 bit_count_5 = bit_count >> 5;
1895 bit_count_5 = (bit_count_5 * 32) + (bit_count & 31);
1896 ixheaacd_skip_bits_buf(it_bit_buff, bit_count_5);
1897 }
1898
1899 for (i = 0; i < pres_n; i++) {
1900 WORD32 temp0 = quant[0];
1901 WORD32 temp1 = quant[1];
1902 if (temp0) {
1903 m = ixheaacd_read_bits_buf(it_bit_buff, 1);
1904 bit_count++;
1905
1906 m = (m << 1) * temp0;
1907 temp0 = m - (temp0);
1908 }
1909
1910 if (temp1) {
1911 m = ixheaacd_read_bits_buf(it_bit_buff, 1);
1912 bit_count++;
1913
1914 m = (m << 1) * temp1;
1915 temp1 = m - (temp1);
1916 }
1917 if ((temp0 > (8183)) || (temp1 > (8183))) {
1918 longjmp(*(it_bit_buff->xaac_jmp_buf), IA_XHEAAC_DEC_EXE_NONFATAL_INSUFFICIENT_INPUT_BYTES);
1919 }
1920 if ((temp0 < (-8183)) || (temp1 < (-8183))) {
1921 longjmp(*(it_bit_buff->xaac_jmp_buf), IA_XHEAAC_DEC_EXE_NONFATAL_INSUFFICIENT_INPUT_BYTES);
1922 }
1923 *quant++ = temp0;
1924 *quant++ = temp1;
1925 }
1926 return;
1927 }
1928
ixheaacd_randomsign_fix(UWORD32 * seed)1929 static WORD32 ixheaacd_randomsign_fix(UWORD32 *seed) {
1930 WORD32 sign = 0;
1931 *seed = (UWORD32)(((UWORD64)(*seed) * (UWORD64)69069) + 5);
1932 if (((*seed) & 0x10000) > 0) {
1933 sign = -1;
1934 } else {
1935 sign = +1;
1936 }
1937 return sign;
1938 }
1939
ixheaacd_esc_iquant(WORD32 * q,WORD32 * coef,WORD32 noise_level,WORD32 with_noise,UWORD32 * seed_value,WORD32 length,WORD64 fac_fix)1940 static VOID ixheaacd_esc_iquant(WORD32 *q, WORD32 *coef, WORD32 noise_level,
1941 WORD32 with_noise, UWORD32 *seed_value,
1942 WORD32 length, WORD64 fac_fix) {
1943 WORD32 q1 = 0;
1944 WORD64 temp;
1945 WORD16 interp;
1946 WORD32 i;
1947 WORD16 flag;
1948
1949 for (i = 0; i < length; i++) {
1950 flag = 1;
1951
1952 if (with_noise) {
1953 if (q[i] == 0) {
1954 coef[i] = (ixheaacd_randomsign_fix(seed_value) * noise_level);
1955 temp = (fac_fix * coef[i]);
1956 coef[i] = (WORD32)(temp >> 25);
1957 continue;
1958 }
1959 }
1960
1961 if (q[i] < 0) {
1962 flag = -1;
1963 q[i] = -q[i];
1964 }
1965
1966 if (q[i] >= 8192) {
1967 q[i] = 8191;
1968 }
1969
1970 if (q[i] < 1024) {
1971 coef[i] = flag * ixheaacd_pow_table_Q13[q[i]];
1972 } else {
1973 q1 = (q[i]) >> 3;
1974
1975 interp = q[i] - (q1 << 3);
1976
1977 coef[i] = ixheaacd_pow_table_Q13[q1 + 1] - ixheaacd_pow_table_Q13[q1];
1978
1979 coef[i] = (WORD32)(coef[i] * (WORD32)interp);
1980
1981 coef[i] = coef[i] + (ixheaacd_pow_table_Q13[q1] << 3);
1982
1983 coef[i] = flag * (coef[i] << 1);
1984 }
1985 temp = ixheaacd_mult64_sat(fac_fix, (WORD64)coef[i]);
1986
1987 coef[i] = (WORD32)(temp >> 22);
1988 }
1989
1990 return;
1991 }
1992
ixheaacd_apply_scfs_and_nf(WORD32 noise_filling,ia_usac_data_struct * usac_data,WORD32 * quant,WORD32 noise_level,WORD32 noise_offset,UWORD8 max_sfb,WORD32 ch)1993 static void ixheaacd_apply_scfs_and_nf(WORD32 noise_filling,
1994 ia_usac_data_struct *usac_data,
1995 WORD32 *quant, WORD32 noise_level,
1996 WORD32 noise_offset, UWORD8 max_sfb,
1997 WORD32 ch) {
1998 WORD32 grp = 0, win_tot = 0, sfb = 0;
1999 WORD32 noise_filling_start_offset = 0;
2000 WORD32 fac = 0, length = 0;
2001 WORD64 fac_fix;
2002 WORD32 noise_level_fix = 0;
2003 ia_sfb_info_struct *pstr_sfb_info = usac_data->pstr_sfb_info[ch];
2004 WORD32 *coef = &usac_data->coef_fix[ch][0];
2005 WORD16 *factors = usac_data->factors[ch];
2006 UWORD32 *seed_value = &usac_data->seed_value[ch];
2007
2008 if (noise_filling) {
2009 noise_level_fix = ixheaacd_pow_14_3[noise_level];
2010 noise_filling_start_offset = (usac_data->ccfl == 768)
2011 ? (pstr_sfb_info->islong ? 120 : 15)
2012 : (pstr_sfb_info->islong ? 160 : 20);
2013 }
2014
2015 for (grp = 0; grp < pstr_sfb_info->num_groups; grp++) {
2016 WORD32 grp_win = 0;
2017 for (sfb = 0; sfb < (WORD32)max_sfb; sfb++) {
2018 WORD32 noise_filling_present = 0;
2019 WORD32 band_quantized_to_zero = 1;
2020
2021 WORD32 sfb_offset = win_tot * pstr_sfb_info->sfb_per_sbk;
2022 fac = (WORD32)(factors[sfb_offset + sfb] - SF_OFFSET);
2023
2024 if (noise_filling) {
2025 for (grp_win = 0; grp_win < pstr_sfb_info->group_len[grp]; grp_win++) {
2026 WORD32 win = grp_win + win_tot;
2027 WORD32 ixheaacd_drc_offset = win * pstr_sfb_info->bins_per_sbk;
2028 WORD32 start = (sfb == 0) ? 0 : pstr_sfb_info->ptr_sfb_tbl[sfb - 1];
2029 WORD32 idx = 0;
2030 for (idx = start; idx < pstr_sfb_info->ptr_sfb_tbl[sfb]; idx++) {
2031 if (quant[ixheaacd_drc_offset + idx] != 0) {
2032 band_quantized_to_zero = 0;
2033 break;
2034 }
2035 if (!band_quantized_to_zero) break;
2036 }
2037 }
2038 }
2039
2040 if (band_quantized_to_zero && noise_filling) fac += (noise_offset - 16);
2041 {
2042 WORD16 exp, frac;
2043
2044 exp = fac >> 2;
2045 frac = fac & 3;
2046
2047 if (exp > 31) exp = 31;
2048
2049 if (fac < 0)
2050 fac_fix = 0;
2051 else {
2052 fac_fix = (WORD64)((WORD64)ixheaacd_table_frac[3 + frac] *
2053 (WORD64)ixheaacd_table_exp[exp]);
2054 fac_fix >>= 15;
2055 }
2056 }
2057
2058 for (grp_win = 0; grp_win < pstr_sfb_info->group_len[grp]; grp_win++) {
2059 WORD32 win = win_tot + grp_win;
2060 WORD32 start = (sfb == 0) ? 0 : pstr_sfb_info->ptr_sfb_tbl[sfb - 1];
2061 WORD32 ixheaacd_drc_offset = win * pstr_sfb_info->bins_per_sbk;
2062
2063 if (noise_filling) {
2064 noise_filling_present =
2065 (start >= noise_filling_start_offset) & noise_filling;
2066 }
2067
2068 length = pstr_sfb_info->ptr_sfb_tbl[sfb] - start;
2069
2070 ixheaacd_esc_iquant(&quant[ixheaacd_drc_offset + start],
2071 &coef[ixheaacd_drc_offset + start], noise_level_fix,
2072 noise_filling_present, seed_value, length, fac_fix);
2073 }
2074 }
2075
2076 win_tot += pstr_sfb_info->group_len[grp];
2077 }
2078
2079 return;
2080 }
2081
ixheaacd_ac_spectral_data(ia_usac_data_struct * usac_data,WORD32 max_spec_coefficients,WORD32 noise_level,WORD32 noise_offset,WORD32 arith_pres_n,ia_bit_buf_struct * it_bit_buff,UWORD8 max_sfb,WORD32 arith_reset_flag,WORD32 noise_filling,WORD32 ch)2082 WORD32 ixheaacd_ac_spectral_data(ia_usac_data_struct *usac_data,
2083 WORD32 max_spec_coefficients,
2084 WORD32 noise_level, WORD32 noise_offset,
2085 WORD32 arith_pres_n,
2086 ia_bit_buf_struct *it_bit_buff, UWORD8 max_sfb,
2087 WORD32 arith_reset_flag, WORD32 noise_filling,
2088 WORD32 ch) {
2089 WORD32 i;
2090
2091 WORD32 *x_ac_dec = usac_data->x_ac_dec;
2092 WORD32 sbk;
2093
2094 const WORD32 max_win_len = usac_data->pstr_sfb_info[ch]->max_win_len;
2095 WORD8 *c_prev = &usac_data->c_prev[ch][0];
2096 WORD8 *c_pres = &usac_data->c[ch][0];
2097
2098 WORD8 *ptr_scratch_buf = (WORD8 *)&usac_data->scratch_buffer[0];
2099
2100 memset(x_ac_dec, 0, 1024 * sizeof(WORD32));
2101
2102 ixheaacd_arith_map_context(arith_pres_n, usac_data->arith_prev_n[ch], c_prev,
2103 c_pres, arith_reset_flag, ptr_scratch_buf);
2104
2105 usac_data->arith_prev_n[ch] = arith_pres_n;
2106
2107 if (max_spec_coefficients > 0) {
2108 for (sbk = 0; sbk < max_win_len; sbk++) {
2109 ixheaacd_arth_decoding_level2(it_bit_buff, c_prev + 2, c_pres + 2,
2110 max_spec_coefficients / 2, arith_pres_n / 2,
2111 &x_ac_dec[sbk * arith_pres_n]);
2112
2113 for (i = max_spec_coefficients / 2; i < arith_pres_n / 2; i++) {
2114 x_ac_dec[sbk * arith_pres_n + 2 * i + 0] = 0;
2115 x_ac_dec[sbk * arith_pres_n + 2 * i + 1] = 0;
2116 }
2117 }
2118 } else {
2119 for (i = 0; i < (arith_pres_n / 2); i++) {
2120 c_pres[i + 2] = 1;
2121 }
2122 }
2123
2124 ixheaacd_apply_scfs_and_nf(noise_filling, usac_data, x_ac_dec, noise_level,
2125 noise_offset, max_sfb, ch);
2126
2127 return 0;
2128 }
2129
ixheaacd_arith_data(ia_td_frame_data_struct * pstr_td_frame_data,WORD32 * x_ac_dec,ia_usac_data_struct * usac_data,ia_bit_buf_struct * it_bit_buff,WORD32 first_tcx_flag,WORD32 k)2130 VOID ixheaacd_arith_data(ia_td_frame_data_struct *pstr_td_frame_data,
2131 WORD32 *x_ac_dec, ia_usac_data_struct *usac_data,
2132 ia_bit_buf_struct *it_bit_buff,
2133 WORD32 first_tcx_flag, WORD32 k) {
2134 WORD32 *arith_prev_n = &usac_data->arith_prev_n[usac_data->present_chan];
2135 WORD32 arith_reset_flag =
2136 first_tcx_flag && pstr_td_frame_data->arith_reset_flag;
2137 WORD32 tcx_size = pstr_td_frame_data->tcx_lg[k];
2138 WORD8 *c_prev = usac_data->c_prev[usac_data->present_chan];
2139 WORD8 *c_pres = usac_data->c[usac_data->present_chan];
2140
2141 WORD8 *ptr_scratch_buf = (WORD8 *)&usac_data->scratch_buffer[0];
2142
2143 memset(x_ac_dec, 0, tcx_size * sizeof(WORD32));
2144
2145 ixheaacd_arith_map_context(tcx_size, *arith_prev_n, c_prev, c_pres,
2146 arith_reset_flag, ptr_scratch_buf);
2147
2148 *arith_prev_n = tcx_size;
2149
2150 ixheaacd_arth_decoding_level2(it_bit_buff, c_prev + 2, c_pres + 2, tcx_size / 2, tcx_size / 2,
2151 x_ac_dec);
2152
2153 return;
2154 }
2155