annotate libac3/tables.h @ 182:3ccd74a91074 libavcodec

minor brightness/contrast bugfix / moved some global vars into ppMode non mmx compilation bugfix
author michael
date Fri, 28 Dec 2001 13:56:04 +0000
parents 986e461dc072
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
986e461dc072 Initial revision
glantau
parents:
diff changeset
1 /*
986e461dc072 Initial revision
glantau
parents:
diff changeset
2 * parse.c
986e461dc072 Initial revision
glantau
parents:
diff changeset
3 *
986e461dc072 Initial revision
glantau
parents:
diff changeset
4 * Copyright (C) Aaron Holtzman - May 1999
986e461dc072 Initial revision
glantau
parents:
diff changeset
5 *
986e461dc072 Initial revision
glantau
parents:
diff changeset
6 * This file is part of ac3dec, a free Dolby AC-3 stream decoder.
986e461dc072 Initial revision
glantau
parents:
diff changeset
7 *
986e461dc072 Initial revision
glantau
parents:
diff changeset
8 * ac3dec is free software; you can redistribute it and/or modify
986e461dc072 Initial revision
glantau
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
986e461dc072 Initial revision
glantau
parents:
diff changeset
10 * the Free Software Foundation; either version 2, or (at your option)
986e461dc072 Initial revision
glantau
parents:
diff changeset
11 * any later version.
986e461dc072 Initial revision
glantau
parents:
diff changeset
12 *
986e461dc072 Initial revision
glantau
parents:
diff changeset
13 * ac3dec is distributed in the hope that it will be useful,
986e461dc072 Initial revision
glantau
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
986e461dc072 Initial revision
glantau
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
986e461dc072 Initial revision
glantau
parents:
diff changeset
16 * GNU General Public License for more details.
986e461dc072 Initial revision
glantau
parents:
diff changeset
17 *
986e461dc072 Initial revision
glantau
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
986e461dc072 Initial revision
glantau
parents:
diff changeset
19 * along with GNU Make; see the file COPYING. If not, write to
986e461dc072 Initial revision
glantau
parents:
diff changeset
20 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
986e461dc072 Initial revision
glantau
parents:
diff changeset
21 *
986e461dc072 Initial revision
glantau
parents:
diff changeset
22 *
986e461dc072 Initial revision
glantau
parents:
diff changeset
23 */
986e461dc072 Initial revision
glantau
parents:
diff changeset
24
986e461dc072 Initial revision
glantau
parents:
diff changeset
25 static int8_t exp_1[128] = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
26 -2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,
986e461dc072 Initial revision
glantau
parents:
diff changeset
27 -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
986e461dc072 Initial revision
glantau
parents:
diff changeset
28 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
986e461dc072 Initial revision
glantau
parents:
diff changeset
29 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
986e461dc072 Initial revision
glantau
parents:
diff changeset
30 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
986e461dc072 Initial revision
glantau
parents:
diff changeset
31 25,25,25
986e461dc072 Initial revision
glantau
parents:
diff changeset
32 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
33 static int8_t exp_2[128] = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
34 -2,-2,-2,-2,-2,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
986e461dc072 Initial revision
glantau
parents:
diff changeset
35 -2,-2,-2,-2,-2,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
986e461dc072 Initial revision
glantau
parents:
diff changeset
36 -2,-2,-2,-2,-2,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
986e461dc072 Initial revision
glantau
parents:
diff changeset
37 -2,-2,-2,-2,-2,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
986e461dc072 Initial revision
glantau
parents:
diff changeset
38 -2,-2,-2,-2,-2,-1,-1,-1,-1,-1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
986e461dc072 Initial revision
glantau
parents:
diff changeset
39 25,25,25
986e461dc072 Initial revision
glantau
parents:
diff changeset
40 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
41 static int8_t exp_3[128] = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
42 -2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,
986e461dc072 Initial revision
glantau
parents:
diff changeset
43 -2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,
986e461dc072 Initial revision
glantau
parents:
diff changeset
44 -2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,
986e461dc072 Initial revision
glantau
parents:
diff changeset
45 -2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,
986e461dc072 Initial revision
glantau
parents:
diff changeset
46 -2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,-2,-1, 0, 1, 2,
986e461dc072 Initial revision
glantau
parents:
diff changeset
47 25,25,25
986e461dc072 Initial revision
glantau
parents:
diff changeset
48 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
49
986e461dc072 Initial revision
glantau
parents:
diff changeset
50 #define Q0 ((-2 << 15) / 3.0)
986e461dc072 Initial revision
glantau
parents:
diff changeset
51 #define Q1 (0)
986e461dc072 Initial revision
glantau
parents:
diff changeset
52 #define Q2 ((2 << 15) / 3.0)
986e461dc072 Initial revision
glantau
parents:
diff changeset
53
986e461dc072 Initial revision
glantau
parents:
diff changeset
54 static const float q_1_0[ 32 ] = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
55 Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,
986e461dc072 Initial revision
glantau
parents:
diff changeset
56 Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,
986e461dc072 Initial revision
glantau
parents:
diff changeset
57 Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,
986e461dc072 Initial revision
glantau
parents:
diff changeset
58 0,0,0,0,0
986e461dc072 Initial revision
glantau
parents:
diff changeset
59 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
60
986e461dc072 Initial revision
glantau
parents:
diff changeset
61 static const float q_1_1[ 32 ] = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
62 Q0,Q0,Q0,Q1,Q1,Q1,Q2,Q2,Q2,
986e461dc072 Initial revision
glantau
parents:
diff changeset
63 Q0,Q0,Q0,Q1,Q1,Q1,Q2,Q2,Q2,
986e461dc072 Initial revision
glantau
parents:
diff changeset
64 Q0,Q0,Q0,Q1,Q1,Q1,Q2,Q2,Q2,
986e461dc072 Initial revision
glantau
parents:
diff changeset
65 0,0,0,0,0
986e461dc072 Initial revision
glantau
parents:
diff changeset
66 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
67
986e461dc072 Initial revision
glantau
parents:
diff changeset
68 static const float q_1_2[ 32 ] = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
69 Q0,Q1,Q2,Q0,Q1,Q2,Q0,Q1,Q2,
986e461dc072 Initial revision
glantau
parents:
diff changeset
70 Q0,Q1,Q2,Q0,Q1,Q2,Q0,Q1,Q2,
986e461dc072 Initial revision
glantau
parents:
diff changeset
71 Q0,Q1,Q2,Q0,Q1,Q2,Q0,Q1,Q2,
986e461dc072 Initial revision
glantau
parents:
diff changeset
72 0,0,0,0,0
986e461dc072 Initial revision
glantau
parents:
diff changeset
73 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
74
986e461dc072 Initial revision
glantau
parents:
diff changeset
75 #undef Q0
986e461dc072 Initial revision
glantau
parents:
diff changeset
76 #undef Q1
986e461dc072 Initial revision
glantau
parents:
diff changeset
77 #undef Q2
986e461dc072 Initial revision
glantau
parents:
diff changeset
78
986e461dc072 Initial revision
glantau
parents:
diff changeset
79 #define Q0 ((-4 << 15) / 5.0)
986e461dc072 Initial revision
glantau
parents:
diff changeset
80 #define Q1 ((-2 << 15) / 5.0)
986e461dc072 Initial revision
glantau
parents:
diff changeset
81 #define Q2 (0)
986e461dc072 Initial revision
glantau
parents:
diff changeset
82 #define Q3 ((2 << 15) / 5.0)
986e461dc072 Initial revision
glantau
parents:
diff changeset
83 #define Q4 ((4 << 15) / 5.0)
986e461dc072 Initial revision
glantau
parents:
diff changeset
84
986e461dc072 Initial revision
glantau
parents:
diff changeset
85 static const float q_2_0[ 128 ] = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
86 Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,Q0,
986e461dc072 Initial revision
glantau
parents:
diff changeset
87 Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,Q1,
986e461dc072 Initial revision
glantau
parents:
diff changeset
88 Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,Q2,
986e461dc072 Initial revision
glantau
parents:
diff changeset
89 Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,Q3,
986e461dc072 Initial revision
glantau
parents:
diff changeset
90 Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,Q4,
986e461dc072 Initial revision
glantau
parents:
diff changeset
91 0,0,0
986e461dc072 Initial revision
glantau
parents:
diff changeset
92 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
93
986e461dc072 Initial revision
glantau
parents:
diff changeset
94 static const float q_2_1[ 128 ] = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
95 Q0,Q0,Q0,Q0,Q0,Q1,Q1,Q1,Q1,Q1,Q2,Q2,Q2,Q2,Q2,Q3,Q3,Q3,Q3,Q3,Q4,Q4,Q4,Q4,Q4,
986e461dc072 Initial revision
glantau
parents:
diff changeset
96 Q0,Q0,Q0,Q0,Q0,Q1,Q1,Q1,Q1,Q1,Q2,Q2,Q2,Q2,Q2,Q3,Q3,Q3,Q3,Q3,Q4,Q4,Q4,Q4,Q4,
986e461dc072 Initial revision
glantau
parents:
diff changeset
97 Q0,Q0,Q0,Q0,Q0,Q1,Q1,Q1,Q1,Q1,Q2,Q2,Q2,Q2,Q2,Q3,Q3,Q3,Q3,Q3,Q4,Q4,Q4,Q4,Q4,
986e461dc072 Initial revision
glantau
parents:
diff changeset
98 Q0,Q0,Q0,Q0,Q0,Q1,Q1,Q1,Q1,Q1,Q2,Q2,Q2,Q2,Q2,Q3,Q3,Q3,Q3,Q3,Q4,Q4,Q4,Q4,Q4,
986e461dc072 Initial revision
glantau
parents:
diff changeset
99 Q0,Q0,Q0,Q0,Q0,Q1,Q1,Q1,Q1,Q1,Q2,Q2,Q2,Q2,Q2,Q3,Q3,Q3,Q3,Q3,Q4,Q4,Q4,Q4,Q4,
986e461dc072 Initial revision
glantau
parents:
diff changeset
100 0,0,0
986e461dc072 Initial revision
glantau
parents:
diff changeset
101 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
102
986e461dc072 Initial revision
glantau
parents:
diff changeset
103 static const float q_2_2[ 128 ] = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
104 Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,
986e461dc072 Initial revision
glantau
parents:
diff changeset
105 Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,
986e461dc072 Initial revision
glantau
parents:
diff changeset
106 Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,
986e461dc072 Initial revision
glantau
parents:
diff changeset
107 Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,
986e461dc072 Initial revision
glantau
parents:
diff changeset
108 Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,Q0,Q1,Q2,Q3,Q4,
986e461dc072 Initial revision
glantau
parents:
diff changeset
109 0,0,0
986e461dc072 Initial revision
glantau
parents:
diff changeset
110 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
111
986e461dc072 Initial revision
glantau
parents:
diff changeset
112 #undef Q0
986e461dc072 Initial revision
glantau
parents:
diff changeset
113 #undef Q1
986e461dc072 Initial revision
glantau
parents:
diff changeset
114 #undef Q2
986e461dc072 Initial revision
glantau
parents:
diff changeset
115 #undef Q3
986e461dc072 Initial revision
glantau
parents:
diff changeset
116 #undef Q4
986e461dc072 Initial revision
glantau
parents:
diff changeset
117
986e461dc072 Initial revision
glantau
parents:
diff changeset
118 static const float q_3[8] = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
119 (-6 << 15)/7.0, (-4 << 15)/7.0, (-2 << 15)/7.0, 0,
986e461dc072 Initial revision
glantau
parents:
diff changeset
120 ( 2 << 15)/7.0, ( 4 << 15)/7.0, ( 6 << 15)/7.0, 0
986e461dc072 Initial revision
glantau
parents:
diff changeset
121 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
122
986e461dc072 Initial revision
glantau
parents:
diff changeset
123 #define Q0 ((-10 << 15) / 11.0)
986e461dc072 Initial revision
glantau
parents:
diff changeset
124 #define Q1 ((-8 << 15) / 11.0)
986e461dc072 Initial revision
glantau
parents:
diff changeset
125 #define Q2 ((-6 << 15) / 11.0)
986e461dc072 Initial revision
glantau
parents:
diff changeset
126 #define Q3 ((-4 << 15) / 11.0)
986e461dc072 Initial revision
glantau
parents:
diff changeset
127 #define Q4 ((-2 << 15) / 11.0)
986e461dc072 Initial revision
glantau
parents:
diff changeset
128 #define Q5 (0)
986e461dc072 Initial revision
glantau
parents:
diff changeset
129 #define Q6 ((2 << 15) / 11.0)
986e461dc072 Initial revision
glantau
parents:
diff changeset
130 #define Q7 ((4 << 15) / 11.0)
986e461dc072 Initial revision
glantau
parents:
diff changeset
131 #define Q8 ((6 << 15) / 11.0)
986e461dc072 Initial revision
glantau
parents:
diff changeset
132 #define Q9 ((8 << 15) / 11.0)
986e461dc072 Initial revision
glantau
parents:
diff changeset
133 #define QA ((10 << 15) / 11.0)
986e461dc072 Initial revision
glantau
parents:
diff changeset
134
986e461dc072 Initial revision
glantau
parents:
diff changeset
135 static const float q_4_0[ 128 ] = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
136 Q0, Q0, Q0, Q0, Q0, Q0, Q0, Q0, Q0, Q0, Q0,
986e461dc072 Initial revision
glantau
parents:
diff changeset
137 Q1, Q1, Q1, Q1, Q1, Q1, Q1, Q1, Q1, Q1, Q1,
986e461dc072 Initial revision
glantau
parents:
diff changeset
138 Q2, Q2, Q2, Q2, Q2, Q2, Q2, Q2, Q2, Q2, Q2,
986e461dc072 Initial revision
glantau
parents:
diff changeset
139 Q3, Q3, Q3, Q3, Q3, Q3, Q3, Q3, Q3, Q3, Q3,
986e461dc072 Initial revision
glantau
parents:
diff changeset
140 Q4, Q4, Q4, Q4, Q4, Q4, Q4, Q4, Q4, Q4, Q4,
986e461dc072 Initial revision
glantau
parents:
diff changeset
141 Q5, Q5, Q5, Q5, Q5, Q5, Q5, Q5, Q5, Q5, Q5,
986e461dc072 Initial revision
glantau
parents:
diff changeset
142 Q6, Q6, Q6, Q6, Q6, Q6, Q6, Q6, Q6, Q6, Q6,
986e461dc072 Initial revision
glantau
parents:
diff changeset
143 Q7, Q7, Q7, Q7, Q7, Q7, Q7, Q7, Q7, Q7, Q7,
986e461dc072 Initial revision
glantau
parents:
diff changeset
144 Q8, Q8, Q8, Q8, Q8, Q8, Q8, Q8, Q8, Q8, Q8,
986e461dc072 Initial revision
glantau
parents:
diff changeset
145 Q9, Q9, Q9, Q9, Q9, Q9, Q9, Q9, Q9, Q9, Q9,
986e461dc072 Initial revision
glantau
parents:
diff changeset
146 QA, QA, QA, QA, QA, QA, QA, QA, QA, QA, QA,
986e461dc072 Initial revision
glantau
parents:
diff changeset
147 0, 0, 0, 0, 0, 0, 0
986e461dc072 Initial revision
glantau
parents:
diff changeset
148 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
149
986e461dc072 Initial revision
glantau
parents:
diff changeset
150 static const float q_4_1[ 128 ] = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
151 Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, QA,
986e461dc072 Initial revision
glantau
parents:
diff changeset
152 Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, QA,
986e461dc072 Initial revision
glantau
parents:
diff changeset
153 Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, QA,
986e461dc072 Initial revision
glantau
parents:
diff changeset
154 Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, QA,
986e461dc072 Initial revision
glantau
parents:
diff changeset
155 Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, QA,
986e461dc072 Initial revision
glantau
parents:
diff changeset
156 Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, QA,
986e461dc072 Initial revision
glantau
parents:
diff changeset
157 Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, QA,
986e461dc072 Initial revision
glantau
parents:
diff changeset
158 Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, QA,
986e461dc072 Initial revision
glantau
parents:
diff changeset
159 Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, QA,
986e461dc072 Initial revision
glantau
parents:
diff changeset
160 Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, QA,
986e461dc072 Initial revision
glantau
parents:
diff changeset
161 Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, Q9, QA,
986e461dc072 Initial revision
glantau
parents:
diff changeset
162 0, 0, 0, 0, 0, 0, 0
986e461dc072 Initial revision
glantau
parents:
diff changeset
163 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
164
986e461dc072 Initial revision
glantau
parents:
diff changeset
165 #undef Q0
986e461dc072 Initial revision
glantau
parents:
diff changeset
166 #undef Q1
986e461dc072 Initial revision
glantau
parents:
diff changeset
167 #undef Q2
986e461dc072 Initial revision
glantau
parents:
diff changeset
168 #undef Q3
986e461dc072 Initial revision
glantau
parents:
diff changeset
169 #undef Q4
986e461dc072 Initial revision
glantau
parents:
diff changeset
170 #undef Q5
986e461dc072 Initial revision
glantau
parents:
diff changeset
171 #undef Q6
986e461dc072 Initial revision
glantau
parents:
diff changeset
172 #undef Q7
986e461dc072 Initial revision
glantau
parents:
diff changeset
173 #undef Q8
986e461dc072 Initial revision
glantau
parents:
diff changeset
174 #undef Q9
986e461dc072 Initial revision
glantau
parents:
diff changeset
175 #undef QA
986e461dc072 Initial revision
glantau
parents:
diff changeset
176
986e461dc072 Initial revision
glantau
parents:
diff changeset
177 static const float q_5[16] = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
178 (-14 << 15)/15.0,(-12 << 15)/15.0,(-10 << 15)/15.0,
986e461dc072 Initial revision
glantau
parents:
diff changeset
179 ( -8 << 15)/15.0,( -6 << 15)/15.0,( -4 << 15)/15.0,
986e461dc072 Initial revision
glantau
parents:
diff changeset
180 ( -2 << 15)/15.0, 0 ,( 2 << 15)/15.0,
986e461dc072 Initial revision
glantau
parents:
diff changeset
181 ( 4 << 15)/15.0,( 6 << 15)/15.0,( 8 << 15)/15.0,
986e461dc072 Initial revision
glantau
parents:
diff changeset
182 ( 10 << 15)/15.0,( 12 << 15)/15.0,( 14 << 15)/15.0,
986e461dc072 Initial revision
glantau
parents:
diff changeset
183 0
986e461dc072 Initial revision
glantau
parents:
diff changeset
184 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
185
986e461dc072 Initial revision
glantau
parents:
diff changeset
186 static const uint32_t u32_scale_factors[25] =
986e461dc072 Initial revision
glantau
parents:
diff changeset
187 {
986e461dc072 Initial revision
glantau
parents:
diff changeset
188 0x38000000, //2 ^ -(0 + 15)
986e461dc072 Initial revision
glantau
parents:
diff changeset
189 0x37800000, //2 ^ -(1 + 15)
986e461dc072 Initial revision
glantau
parents:
diff changeset
190 0x37000000, //2 ^ -(2 + 15)
986e461dc072 Initial revision
glantau
parents:
diff changeset
191 0x36800000, //2 ^ -(3 + 15)
986e461dc072 Initial revision
glantau
parents:
diff changeset
192 0x36000000, //2 ^ -(4 + 15)
986e461dc072 Initial revision
glantau
parents:
diff changeset
193 0x35800000, //2 ^ -(5 + 15)
986e461dc072 Initial revision
glantau
parents:
diff changeset
194 0x35000000, //2 ^ -(6 + 15)
986e461dc072 Initial revision
glantau
parents:
diff changeset
195 0x34800000, //2 ^ -(7 + 15)
986e461dc072 Initial revision
glantau
parents:
diff changeset
196 0x34000000, //2 ^ -(8 + 15)
986e461dc072 Initial revision
glantau
parents:
diff changeset
197 0x33800000, //2 ^ -(9 + 15)
986e461dc072 Initial revision
glantau
parents:
diff changeset
198 0x33000000, //2 ^ -(10 + 15)
986e461dc072 Initial revision
glantau
parents:
diff changeset
199 0x32800000, //2 ^ -(11 + 15)
986e461dc072 Initial revision
glantau
parents:
diff changeset
200 0x32000000, //2 ^ -(12 + 15)
986e461dc072 Initial revision
glantau
parents:
diff changeset
201 0x31800000, //2 ^ -(13 + 15)
986e461dc072 Initial revision
glantau
parents:
diff changeset
202 0x31000000, //2 ^ -(14 + 15)
986e461dc072 Initial revision
glantau
parents:
diff changeset
203 0x30800000, //2 ^ -(15 + 15)
986e461dc072 Initial revision
glantau
parents:
diff changeset
204 0x30000000, //2 ^ -(16 + 15)
986e461dc072 Initial revision
glantau
parents:
diff changeset
205 0x2f800000, //2 ^ -(17 + 15)
986e461dc072 Initial revision
glantau
parents:
diff changeset
206 0x2f000000, //2 ^ -(18 + 15)
986e461dc072 Initial revision
glantau
parents:
diff changeset
207 0x2e800000, //2 ^ -(19 + 15)
986e461dc072 Initial revision
glantau
parents:
diff changeset
208 0x2e000000, //2 ^ -(20 + 15)
986e461dc072 Initial revision
glantau
parents:
diff changeset
209 0x2d800000, //2 ^ -(21 + 15)
986e461dc072 Initial revision
glantau
parents:
diff changeset
210 0x2d000000, //2 ^ -(22 + 15)
986e461dc072 Initial revision
glantau
parents:
diff changeset
211 0x2c800000, //2 ^ -(23 + 15)
986e461dc072 Initial revision
glantau
parents:
diff changeset
212 0x2c000000 //2 ^ -(24 + 15)
986e461dc072 Initial revision
glantau
parents:
diff changeset
213 };
986e461dc072 Initial revision
glantau
parents:
diff changeset
214
986e461dc072 Initial revision
glantau
parents:
diff changeset
215 static float * scale_factor = (float *) u32_scale_factors;
986e461dc072 Initial revision
glantau
parents:
diff changeset
216
986e461dc072 Initial revision
glantau
parents:
diff changeset
217 static const uint16_t dither_lut[256] = {
986e461dc072 Initial revision
glantau
parents:
diff changeset
218 0x0000, 0xa011, 0xe033, 0x4022, 0x6077, 0xc066, 0x8044, 0x2055,
986e461dc072 Initial revision
glantau
parents:
diff changeset
219 0xc0ee, 0x60ff, 0x20dd, 0x80cc, 0xa099, 0x0088, 0x40aa, 0xe0bb,
986e461dc072 Initial revision
glantau
parents:
diff changeset
220 0x21cd, 0x81dc, 0xc1fe, 0x61ef, 0x41ba, 0xe1ab, 0xa189, 0x0198,
986e461dc072 Initial revision
glantau
parents:
diff changeset
221 0xe123, 0x4132, 0x0110, 0xa101, 0x8154, 0x2145, 0x6167, 0xc176,
986e461dc072 Initial revision
glantau
parents:
diff changeset
222 0x439a, 0xe38b, 0xa3a9, 0x03b8, 0x23ed, 0x83fc, 0xc3de, 0x63cf,
986e461dc072 Initial revision
glantau
parents:
diff changeset
223 0x8374, 0x2365, 0x6347, 0xc356, 0xe303, 0x4312, 0x0330, 0xa321,
986e461dc072 Initial revision
glantau
parents:
diff changeset
224 0x6257, 0xc246, 0x8264, 0x2275, 0x0220, 0xa231, 0xe213, 0x4202,
986e461dc072 Initial revision
glantau
parents:
diff changeset
225 0xa2b9, 0x02a8, 0x428a, 0xe29b, 0xc2ce, 0x62df, 0x22fd, 0x82ec,
986e461dc072 Initial revision
glantau
parents:
diff changeset
226 0x8734, 0x2725, 0x6707, 0xc716, 0xe743, 0x4752, 0x0770, 0xa761,
986e461dc072 Initial revision
glantau
parents:
diff changeset
227 0x47da, 0xe7cb, 0xa7e9, 0x07f8, 0x27ad, 0x87bc, 0xc79e, 0x678f,
986e461dc072 Initial revision
glantau
parents:
diff changeset
228 0xa6f9, 0x06e8, 0x46ca, 0xe6db, 0xc68e, 0x669f, 0x26bd, 0x86ac,
986e461dc072 Initial revision
glantau
parents:
diff changeset
229 0x6617, 0xc606, 0x8624, 0x2635, 0x0660, 0xa671, 0xe653, 0x4642,
986e461dc072 Initial revision
glantau
parents:
diff changeset
230 0xc4ae, 0x64bf, 0x249d, 0x848c, 0xa4d9, 0x04c8, 0x44ea, 0xe4fb,
986e461dc072 Initial revision
glantau
parents:
diff changeset
231 0x0440, 0xa451, 0xe473, 0x4462, 0x6437, 0xc426, 0x8404, 0x2415,
986e461dc072 Initial revision
glantau
parents:
diff changeset
232 0xe563, 0x4572, 0x0550, 0xa541, 0x8514, 0x2505, 0x6527, 0xc536,
986e461dc072 Initial revision
glantau
parents:
diff changeset
233 0x258d, 0x859c, 0xc5be, 0x65af, 0x45fa, 0xe5eb, 0xa5c9, 0x05d8,
986e461dc072 Initial revision
glantau
parents:
diff changeset
234 0xae79, 0x0e68, 0x4e4a, 0xee5b, 0xce0e, 0x6e1f, 0x2e3d, 0x8e2c,
986e461dc072 Initial revision
glantau
parents:
diff changeset
235 0x6e97, 0xce86, 0x8ea4, 0x2eb5, 0x0ee0, 0xaef1, 0xeed3, 0x4ec2,
986e461dc072 Initial revision
glantau
parents:
diff changeset
236 0x8fb4, 0x2fa5, 0x6f87, 0xcf96, 0xefc3, 0x4fd2, 0x0ff0, 0xafe1,
986e461dc072 Initial revision
glantau
parents:
diff changeset
237 0x4f5a, 0xef4b, 0xaf69, 0x0f78, 0x2f2d, 0x8f3c, 0xcf1e, 0x6f0f,
986e461dc072 Initial revision
glantau
parents:
diff changeset
238 0xede3, 0x4df2, 0x0dd0, 0xadc1, 0x8d94, 0x2d85, 0x6da7, 0xcdb6,
986e461dc072 Initial revision
glantau
parents:
diff changeset
239 0x2d0d, 0x8d1c, 0xcd3e, 0x6d2f, 0x4d7a, 0xed6b, 0xad49, 0x0d58,
986e461dc072 Initial revision
glantau
parents:
diff changeset
240 0xcc2e, 0x6c3f, 0x2c1d, 0x8c0c, 0xac59, 0x0c48, 0x4c6a, 0xec7b,
986e461dc072 Initial revision
glantau
parents:
diff changeset
241 0x0cc0, 0xacd1, 0xecf3, 0x4ce2, 0x6cb7, 0xcca6, 0x8c84, 0x2c95,
986e461dc072 Initial revision
glantau
parents:
diff changeset
242 0x294d, 0x895c, 0xc97e, 0x696f, 0x493a, 0xe92b, 0xa909, 0x0918,
986e461dc072 Initial revision
glantau
parents:
diff changeset
243 0xe9a3, 0x49b2, 0x0990, 0xa981, 0x89d4, 0x29c5, 0x69e7, 0xc9f6,
986e461dc072 Initial revision
glantau
parents:
diff changeset
244 0x0880, 0xa891, 0xe8b3, 0x48a2, 0x68f7, 0xc8e6, 0x88c4, 0x28d5,
986e461dc072 Initial revision
glantau
parents:
diff changeset
245 0xc86e, 0x687f, 0x285d, 0x884c, 0xa819, 0x0808, 0x482a, 0xe83b,
986e461dc072 Initial revision
glantau
parents:
diff changeset
246 0x6ad7, 0xcac6, 0x8ae4, 0x2af5, 0x0aa0, 0xaab1, 0xea93, 0x4a82,
986e461dc072 Initial revision
glantau
parents:
diff changeset
247 0xaa39, 0x0a28, 0x4a0a, 0xea1b, 0xca4e, 0x6a5f, 0x2a7d, 0x8a6c,
986e461dc072 Initial revision
glantau
parents:
diff changeset
248 0x4b1a, 0xeb0b, 0xab29, 0x0b38, 0x2b6d, 0x8b7c, 0xcb5e, 0x6b4f,
986e461dc072 Initial revision
glantau
parents:
diff changeset
249 0x8bf4, 0x2be5, 0x6bc7, 0xcbd6, 0xeb83, 0x4b92, 0x0bb0, 0xaba1
986e461dc072 Initial revision
glantau
parents:
diff changeset
250 };