summaryrefslogtreecommitdiff
path: root/apps/codecs/libtremor
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/libtremor')
-rw-r--r--apps/codecs/libtremor/CHANGELOG19
-rw-r--r--apps/codecs/libtremor/COPYING28
-rw-r--r--apps/codecs/libtremor/Makefile49
-rw-r--r--apps/codecs/libtremor/README46
-rw-r--r--apps/codecs/libtremor/README.rockbox17
-rw-r--r--apps/codecs/libtremor/SOURCES16
-rw-r--r--apps/codecs/libtremor/asm_arm.h344
-rw-r--r--apps/codecs/libtremor/asm_mcf5249.h327
-rw-r--r--apps/codecs/libtremor/backends.h130
-rw-r--r--apps/codecs/libtremor/bitwise.c214
-rw-r--r--apps/codecs/libtremor/block.c454
-rw-r--r--apps/codecs/libtremor/codebook.c504
-rw-r--r--apps/codecs/libtremor/codebook.h102
-rw-r--r--apps/codecs/libtremor/codec_internal.h92
-rw-r--r--apps/codecs/libtremor/config-tremor.h28
-rw-r--r--apps/codecs/libtremor/config_types.h25
-rw-r--r--apps/codecs/libtremor/ctype.c1
-rw-r--r--apps/codecs/libtremor/floor0.c440
-rw-r--r--apps/codecs/libtremor/floor1.c447
-rw-r--r--apps/codecs/libtremor/framing.c1062
-rw-r--r--apps/codecs/libtremor/info.c309
-rw-r--r--apps/codecs/libtremor/ivorbiscodec.h198
-rw-r--r--apps/codecs/libtremor/ivorbisfile.h133
-rw-r--r--apps/codecs/libtremor/lsp_lookup.h136
-rw-r--r--apps/codecs/libtremor/mapping0.c333
-rw-r--r--apps/codecs/libtremor/misc.h291
-rw-r--r--apps/codecs/libtremor/ogg.h265
-rw-r--r--apps/codecs/libtremor/oggmalloc.c75
-rw-r--r--apps/codecs/libtremor/os.h62
-rw-r--r--apps/codecs/libtremor/os_types.h55
-rw-r--r--apps/codecs/libtremor/registry.c50
-rw-r--r--apps/codecs/libtremor/registry.h40
-rw-r--r--apps/codecs/libtremor/res012.c344
-rw-r--r--apps/codecs/libtremor/sharedbook.c444
-rw-r--r--apps/codecs/libtremor/synthesis.c134
-rw-r--r--apps/codecs/libtremor/vorbisfile.c1362
-rw-r--r--apps/codecs/libtremor/window.c78
-rw-r--r--apps/codecs/libtremor/window.h27
-rw-r--r--apps/codecs/libtremor/window_lookup.h2087
39 files changed, 10768 insertions, 0 deletions
diff --git a/apps/codecs/libtremor/CHANGELOG b/apps/codecs/libtremor/CHANGELOG
new file mode 100644
index 0000000000..53f23351e2
--- /dev/null
+++ b/apps/codecs/libtremor/CHANGELOG
@@ -0,0 +1,19 @@
1*** 20020517: 1.0.2 ***
2
3 Playback bugfix to floor1; mode mistakenly used for sizing instead
4 of blockflag
5
6*** 20020515: 1.0.1 ***
7
8 Added complete API documentation to source tarball. No code
9 changes.
10
11*** 20020412: 1.0.1 ***
12
13 Fixed a clipping bug that affected ARM processors; negative
14 overflows were being properly clipped, but then clobbered to
15 positive by the positive overflow chec (asm_arm.h:CLIP_TO_15)
16
17*** 20020403: 1.0.0 ***
18
19 Initial version \ No newline at end of file
diff --git a/apps/codecs/libtremor/COPYING b/apps/codecs/libtremor/COPYING
new file mode 100644
index 0000000000..6111c6c5a6
--- /dev/null
+++ b/apps/codecs/libtremor/COPYING
@@ -0,0 +1,28 @@
1Copyright (c) 2002, Xiph.org Foundation
2
3Redistribution and use in source and binary forms, with or without
4modification, are permitted provided that the following conditions
5are met:
6
7- Redistributions of source code must retain the above copyright
8notice, this list of conditions and the following disclaimer.
9
10- Redistributions in binary form must reproduce the above copyright
11notice, this list of conditions and the following disclaimer in the
12documentation and/or other materials provided with the distribution.
13
14- Neither the name of the Xiph.org Foundation nor the names of its
15contributors may be used to endorse or promote products derived from
16this software without specific prior written permission.
17
18THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION
22OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/apps/codecs/libtremor/Makefile b/apps/codecs/libtremor/Makefile
new file mode 100644
index 0000000000..674d2ae64c
--- /dev/null
+++ b/apps/codecs/libtremor/Makefile
@@ -0,0 +1,49 @@
1# __________ __ ___.
2# Open \______ \ ____ ____ | | _\_ |__ _______ ___
3# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
6# \/ \/ \/ \/ \/
7# $Id$
8#
9
10INCLUDES=-I$(APPSDIR) -I.. -I. -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
11 -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(BUILDDIR)
12
13ifdef APPEXTRA
14 INCLUDES += $(patsubst %,-I$(APPSDIR)/%,$(subst :, ,$(APPEXTRA)))
15endif
16
17# Tremor is slightly faster on coldfire with -O3
18ifeq ($(CPU),coldfire)
19 TREMOROPTS = -O3
20else
21 TREMOROPTS = -O2
22endif
23
24CFLAGS = $(INCLUDES) $(GCCOPTS) $(TARGET_INC) $(TREMOROPTS) $(TARGET) \
25$(EXTRA_DEFINES) -DMEM=${MEMORYSIZE} ${PROFILE_OPTS}
26
27# This sets up 'SRC' based on the files mentioned in SOURCES
28include $(TOOLSDIR)/makesrc.inc
29
30SOURCES = $(SRC)
31OBJS2 := $(SRC:%.c=$(OBJDIR)/%.o)
32OBJS = $(patsubst %.S, $(OBJDIR)/%.o, $(OBJS2))
33DEPFILE = $(OBJDIR)/dep-libtremor
34DIRS =
35
36all: $(OUTPUT)
37
38$(OUTPUT): $(OBJS)
39 $(call PRINTS,AR+RANLIB $(@F))$(AR) ruv $@ $+ >/dev/null 2>&1
40 $(SILENT)$(RANLIB) $@
41
42include $(TOOLSDIR)/make.inc
43
44clean:
45 $(call PRINTS,cleaning libtremor)rm -f $(OBJS) $(OUTPUT) $(DEPFILE)
46
47ifneq ($(MAKECMDGOALS),clean)
48-include $(DEPFILE)
49endif
diff --git a/apps/codecs/libtremor/README b/apps/codecs/libtremor/README
new file mode 100644
index 0000000000..1321175322
--- /dev/null
+++ b/apps/codecs/libtremor/README
@@ -0,0 +1,46 @@
1This README covers the Ogg Vorbis 'Tremor' integer playback codec
2source as of date 2002 09 02, version 1.0.0.
3
4 ******
5
6The C source in this package will build on any ANSI C compiler and
7function completely and properly on any platform. The included build
8system assumes GNU build system and make tools (m4, automake,
9autoconf, libtool and gmake). GCC is not required, although GCC is
10the most tested compiler. To build using GNU tools, type in the
11source directory:
12
13./autogen.sh
14make
15
16Currently, the source implements playback in pure C on all platforms
17except ARM, where a [currently] small amount of assembly (see
18asm_arm.h) is used to implement 64 bit math operations and fast LSP
19computation. If building on ARM without the benefit of GNU build
20system tools, be sure that '_ARM_ASSEM_' is #defined by the build
21system if this assembly is desired, else the resulting library will
22use whatever 64 bit math builtins the compiler implements.
23
24No math library is required by this source. No floating point
25operations are used at any point in either setup or decode. This
26decoder library will properly decode any past, current or future
27Vorbis I file or stream.
28
29 ********
30
31The build system produces a static and [when supported by the OS]
32dynamic library named 'libvorbisidec'. This library exposes an API
33nearly identical to the BSD reference library's 'libvorbisfile',
34including all the features familiar to users of vorbisfile. This API
35is similar enough that the proper header file to include is named
36'ivorbisfile.h' [included in the source build directory]. Lower level
37libvorbis-style headers and structures are in 'ivorbiscodec.h'
38[included in the source build directory]. A simple example program,
39ivorbisfile_example.c, can be built with 'make example'.
40
41 ********
42
43Detailed Tremor API Documentation begins at doc/index.html
44
45Monty
46xiph.org
diff --git a/apps/codecs/libtremor/README.rockbox b/apps/codecs/libtremor/README.rockbox
new file mode 100644
index 0000000000..a4e141f6b3
--- /dev/null
+++ b/apps/codecs/libtremor/README.rockbox
@@ -0,0 +1,17 @@
1Library: Tremor-1.1.2 (Released 2002-05-17)
2Imported: 2005-02-16 by Marcoen Hirschberg
3
4This directory contains a local version of Tremor for use by Rockbox
5for software decoding of Ogg Vorbis files.
6
7LICENSING INFORMATION
8
9Tremor is distributed under Xiph.Org's BSD-like license - see the file COPYING
10in this directory for details.
11
12IMPORT DETAILS
13
14The base version first imported into Rockbox was the SVN version of
15Tremor-1.0.2 which was checked out on 2005-02-16.
16
17The autoconf/automake files were removed, as well as the doc and debian directories.
diff --git a/apps/codecs/libtremor/SOURCES b/apps/codecs/libtremor/SOURCES
new file mode 100644
index 0000000000..c622699599
--- /dev/null
+++ b/apps/codecs/libtremor/SOURCES
@@ -0,0 +1,16 @@
1bitwise.c
2block.c
3codebook.c
4floor0.c
5floor1.c
6framing.c
7info.c
8mapping0.c
9registry.c
10res012.c
11sharedbook.c
12synthesis.c
13vorbisfile.c
14window.c
15ctype.c
16oggmalloc.c
diff --git a/apps/codecs/libtremor/asm_arm.h b/apps/codecs/libtremor/asm_arm.h
new file mode 100644
index 0000000000..bc09ac5170
--- /dev/null
+++ b/apps/codecs/libtremor/asm_arm.h
@@ -0,0 +1,344 @@
1/********************************************************************
2 * *
3 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
4 * *
5 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
6 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
7 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
8 * *
9 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
10 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
11 * *
12 ********************************************************************
13
14 function: arm7 and later wide math functions
15
16 ********************************************************************/
17
18#ifdef _ARM_ASSEM_
19
20#if !defined(_V_WIDE_MATH) && !defined(_LOW_ACCURACY_)
21#define _V_WIDE_MATH
22
23static inline ogg_int32_t MULT32(ogg_int32_t x, ogg_int32_t y) {
24 int lo,hi;
25 asm volatile("smull\t%0, %1, %2, %3"
26 : "=&r"(lo),"=&r"(hi)
27 : "%r"(x),"r"(y)
28 : "cc");
29 return(hi);
30}
31
32static inline ogg_int32_t MULT31(ogg_int32_t x, ogg_int32_t y) {
33 return MULT32(x,y)<<1;
34}
35
36static inline ogg_int32_t MULT31_SHIFT15(ogg_int32_t x, ogg_int32_t y) {
37 int lo,hi;
38 asm volatile("smull %0, %1, %2, %3\n\t"
39 "movs %0, %0, lsr #15\n\t"
40 "adc %1, %0, %1, lsl #17\n\t"
41 : "=&r"(lo),"=&r"(hi)
42 : "%r"(x),"r"(y)
43 : "cc");
44 return(hi);
45}
46
47#define MB() asm volatile ("" : : : "memory")
48
49#define XPROD32(a, b, t, v, x, y) \
50{ \
51 long l; \
52 asm( "smull %0, %1, %4, %6\n\t" \
53 "smlal %0, %1, %5, %7\n\t" \
54 "rsb %3, %4, #0\n\t" \
55 "smull %0, %2, %5, %6\n\t" \
56 "smlal %0, %2, %3, %7" \
57 : "=&r" (l), "=&r" (x), "=&r" (y), "=r" ((a)) \
58 : "3" ((a)), "r" ((b)), "r" ((t)), "r" ((v)) \
59 : "cc" ); \
60}
61
62static inline void XPROD31(ogg_int32_t a, ogg_int32_t b,
63 ogg_int32_t t, ogg_int32_t v,
64 ogg_int32_t *x, ogg_int32_t *y)
65{
66 int x1, y1, l;
67 asm( "smull %0, %1, %4, %6\n\t"
68 "smlal %0, %1, %5, %7\n\t"
69 "rsb %3, %4, #0\n\t"
70 "smull %0, %2, %5, %6\n\t"
71 "smlal %0, %2, %3, %7"
72 : "=&r" (l), "=&r" (x1), "=&r" (y1), "=r" (a)
73 : "3" (a), "r" (b), "r" (t), "r" (v)
74 : "cc" );
75 *x = x1 << 1;
76 MB();
77 *y = y1 << 1;
78}
79
80static inline void XNPROD31(ogg_int32_t a, ogg_int32_t b,
81 ogg_int32_t t, ogg_int32_t v,
82 ogg_int32_t *x, ogg_int32_t *y)
83{
84 int x1, y1, l;
85 asm( "rsb %2, %4, #0\n\t"
86 "smull %0, %1, %3, %5\n\t"
87 "smlal %0, %1, %2, %6\n\t"
88 "smull %0, %2, %4, %5\n\t"
89 "smlal %0, %2, %3, %6"
90 : "=&r" (l), "=&r" (x1), "=&r" (y1)
91 : "r" (a), "r" (b), "r" (t), "r" (v)
92 : "cc" );
93 *x = x1 << 1;
94 MB();
95 *y = y1 << 1;
96}
97
98#ifndef _V_VECT_OPS
99#define _V_VECT_OPS
100
101/* asm versions of vector operations for block.c, window.c */
102static inline
103void vect_add(ogg_int32_t *x, ogg_int32_t *y, int n)
104{
105 while (n>=4) {
106 asm volatile ("ldmia %[x], {r0, r1, r2, r3};"
107 "ldmia %[y]!, {r4, r5, r6, r7};"
108 "add r0, r0, r4;"
109 "add r1, r1, r5;"
110 "add r2, r2, r6;"
111 "add r3, r3, r7;"
112 "stmia %[x]!, {r0, r1, r2, r3};"
113 : [x] "+r" (x), [y] "+r" (y)
114 : : "r0", "r1", "r2", "r3",
115 "r4", "r5", "r6", "r7",
116 "memory");
117 n -= 4;
118 }
119 /* add final elements */
120 while (n>0) {
121 *x++ += *y++;
122 n--;
123 }
124}
125
126static inline
127void vect_copy(ogg_int32_t *x, ogg_int32_t *y, int n)
128{
129 while (n>=4) {
130 asm volatile ("ldmia %[y]!, {r0, r1, r2, r3};"
131 "stmia %[x]!, {r0, r1, r2, r3};"
132 : [x] "+r" (x), [y] "+r" (y)
133 : : "r0", "r1", "r2", "r3",
134 "memory");
135 n -= 4;
136 }
137 /* copy final elements */
138 while (n>0) {
139 *x++ = *y++;
140 n--;
141 }
142}
143
144static inline
145void vect_mult_fw(ogg_int32_t *data, LOOKUP_T *window, int n)
146{
147 while (n>=4) {
148 asm volatile ("ldmia %[d], {r0, r1, r2, r3};"
149 "ldmia %[w]!, {r4, r5, r6, r7};"
150 "smull r8, r9, r0, r4;"
151 "mov r0, r9, lsl #1;"
152 "smull r8, r9, r1, r5;"
153 "mov r1, r9, lsl #1;"
154 "smull r8, r9, r2, r6;"
155 "mov r2, r9, lsl #1;"
156 "smull r8, r9, r3, r7;"
157 "mov r3, r9, lsl #1;"
158 "stmia %[d]!, {r0, r1, r2, r3};"
159 : [d] "+r" (data), [w] "+r" (window)
160 : : "r0", "r1", "r2", "r3",
161 "r4", "r5", "r6", "r7", "r8", "r9",
162 "memory", "cc");
163 n -= 4;
164 }
165 while(n>0) {
166 *data = MULT31(*data, *window);
167 data++;
168 window++;
169 n--;
170 }
171}
172
173static inline
174void vect_mult_bw(ogg_int32_t *data, LOOKUP_T *window, int n)
175{
176 while (n>=4) {
177 asm volatile ("ldmia %[d], {r0, r1, r2, r3};"
178 "ldmda %[w]!, {r4, r5, r6, r7};"
179 "smull r8, r9, r0, r7;"
180 "mov r0, r9, lsl #1;"
181 "smull r8, r9, r1, r6;"
182 "mov r1, r9, lsl #1;"
183 "smull r8, r9, r2, r5;"
184 "mov r2, r9, lsl #1;"
185 "smull r8, r9, r3, r4;"
186 "mov r3, r9, lsl #1;"
187 "stmia %[d]!, {r0, r1, r2, r3};"
188 : [d] "+r" (data), [w] "+r" (window)
189 : : "r0", "r1", "r2", "r3",
190 "r4", "r5", "r6", "r7", "r8", "r9",
191 "memory", "cc");
192 n -= 4;
193 }
194 while(n>0) {
195 *data = MULT31(*data, *window);
196 data++;
197 window--;
198 n--;
199 }
200}
201
202#endif
203
204#endif
205
206#ifndef _V_CLIP_MATH
207#define _V_CLIP_MATH
208
209static inline ogg_int32_t CLIP_TO_15(ogg_int32_t x) {
210 int tmp;
211 asm volatile("subs %1, %0, #32768\n\t"
212 "movpl %0, #0x7f00\n\t"
213 "orrpl %0, %0, #0xff\n"
214 "adds %1, %0, #32768\n\t"
215 "movmi %0, #0x8000"
216 : "+r"(x),"=r"(tmp)
217 :
218 : "cc");
219 return(x);
220}
221
222#endif
223
224#ifndef _V_LSP_MATH_ASM
225#define _V_LSP_MATH_ASM
226
227static inline void lsp_loop_asm(ogg_uint32_t *qip,ogg_uint32_t *pip,
228 ogg_int32_t *qexpp,
229 ogg_int32_t *ilsp,ogg_int32_t wi,
230 ogg_int32_t m){
231
232 ogg_uint32_t qi=*qip,pi=*pip;
233 ogg_int32_t qexp=*qexpp;
234
235 asm("mov r0,%3;"
236 "mov r1,%5,asr#1;"
237 "add r0,r0,r1,lsl#3;"
238 "1:"
239
240 "ldmdb r0!,{r1,r3};"
241 "subs r1,r1,%4;" //ilsp[j]-wi
242 "rsbmi r1,r1,#0;" //labs(ilsp[j]-wi)
243 "umull %0,r2,r1,%0;" //qi*=labs(ilsp[j]-wi)
244
245 "subs r1,r3,%4;" //ilsp[j+1]-wi
246 "rsbmi r1,r1,#0;" //labs(ilsp[j+1]-wi)
247 "umull %1,r3,r1,%1;" //pi*=labs(ilsp[j+1]-wi)
248
249 "cmn r2,r3;" // shift down 16?
250 "beq 0f;"
251 "add %2,%2,#16;"
252 "mov %0,%0,lsr #16;"
253 "orr %0,%0,r2,lsl #16;"
254 "mov %1,%1,lsr #16;"
255 "orr %1,%1,r3,lsl #16;"
256 "0:"
257 "cmp r0,%3;\n"
258 "bhi 1b;\n"
259
260 // odd filter assymetry
261 "ands r0,%5,#1;\n"
262 "beq 2f;\n"
263 "add r0,%3,%5,lsl#2;\n"
264
265 "ldr r1,[r0,#-4];\n"
266 "mov r0,#0x4000;\n"
267
268 "subs r1,r1,%4;\n" //ilsp[j]-wi
269 "rsbmi r1,r1,#0;\n" //labs(ilsp[j]-wi)
270 "umull %0,r2,r1,%0;\n" //qi*=labs(ilsp[j]-wi)
271 "umull %1,r3,r0,%1;\n" //pi*=labs(ilsp[j+1]-wi)
272
273 "cmn r2,r3;\n" // shift down 16?
274 "beq 2f;\n"
275 "add %2,%2,#16;\n"
276 "mov %0,%0,lsr #16;\n"
277 "orr %0,%0,r2,lsl #16;\n"
278 "mov %1,%1,lsr #16;\n"
279 "orr %1,%1,r3,lsl #16;\n"
280
281 //qi=(pi>>shift)*labs(ilsp[j]-wi);
282 //pi=(qi>>shift)*labs(ilsp[j+1]-wi);
283 //qexp+=shift;
284
285 //}
286
287 /* normalize to max 16 sig figs */
288 "2:"
289 "mov r2,#0;"
290 "orr r1,%0,%1;"
291 "tst r1,#0xff000000;"
292 "addne r2,r2,#8;"
293 "movne r1,r1,lsr #8;"
294 "tst r1,#0x00f00000;"
295 "addne r2,r2,#4;"
296 "movne r1,r1,lsr #4;"
297 "tst r1,#0x000c0000;"
298 "addne r2,r2,#2;"
299 "movne r1,r1,lsr #2;"
300 "tst r1,#0x00020000;"
301 "addne r2,r2,#1;"
302 "movne r1,r1,lsr #1;"
303 "tst r1,#0x00010000;"
304 "addne r2,r2,#1;"
305 "mov %0,%0,lsr r2;"
306 "mov %1,%1,lsr r2;"
307 "add %2,%2,r2;"
308
309 : "+r"(qi),"+r"(pi),"+r"(qexp)
310 : "r"(ilsp),"r"(wi),"r"(m)
311 : "r0","r1","r2","r3","cc");
312
313 *qip=qi;
314 *pip=pi;
315 *qexpp=qexp;
316}
317
318static inline void lsp_norm_asm(ogg_uint32_t *qip,ogg_int32_t *qexpp){
319
320 ogg_uint32_t qi=*qip;
321 ogg_int32_t qexp=*qexpp;
322
323 asm("tst %0,#0x0000ff00;"
324 "moveq %0,%0,lsl #8;"
325 "subeq %1,%1,#8;"
326 "tst %0,#0x0000f000;"
327 "moveq %0,%0,lsl #4;"
328 "subeq %1,%1,#4;"
329 "tst %0,#0x0000c000;"
330 "moveq %0,%0,lsl #2;"
331 "subeq %1,%1,#2;"
332 "tst %0,#0x00008000;"
333 "moveq %0,%0,lsl #1;"
334 "subeq %1,%1,#1;"
335 : "+r"(qi),"+r"(qexp)
336 :
337 : "cc");
338 *qip=qi;
339 *qexpp=qexp;
340}
341
342#endif
343#endif
344
diff --git a/apps/codecs/libtremor/asm_mcf5249.h b/apps/codecs/libtremor/asm_mcf5249.h
new file mode 100644
index 0000000000..64dfb1b785
--- /dev/null
+++ b/apps/codecs/libtremor/asm_mcf5249.h
@@ -0,0 +1,327 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2005 by Pedro Vasconcelos
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
15 *
16 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
17 * KIND, either express or implied.
18 *
19 ****************************************************************************/
20/* asm routines for wide math on the MCF5249 */
21
22#include "os_types.h"
23
24#if defined(CPU_COLDFIRE)
25
26/* attribute for 16-byte alignment */
27#define LINE_ATTR __attribute__ ((aligned (16)))
28
29#ifndef _V_WIDE_MATH
30#define _V_WIDE_MATH
31
32#define MB()
33
34static inline ogg_int32_t MULT32(ogg_int32_t x, ogg_int32_t y) {
35
36 asm volatile ("mac.l %[x], %[y], %%acc0;" /* multiply & shift */
37 "movclr.l %%acc0, %[x];" /* move & clear acc */
38 "asr.l #1, %[x];" /* no overflow test */
39 : [x] "+&d" (x)
40 : [y] "r" (y)
41 : "cc");
42 return x;
43}
44
45static inline ogg_int32_t MULT31(ogg_int32_t x, ogg_int32_t y) {
46
47 asm volatile ("mac.l %[x], %[y], %%acc0;" /* multiply */
48 "movclr.l %%acc0, %[x];" /* move and clear */
49 : [x] "+&r" (x)
50 : [y] "r" (y)
51 : "cc");
52 return x;
53}
54
55
56static inline ogg_int32_t MULT31_SHIFT15(ogg_int32_t x, ogg_int32_t y) {
57 ogg_int32_t r;
58
59 asm volatile ("mac.l %[x], %[y], %%acc0;" /* multiply */
60 "mulu.l %[y], %[x];" /* get lower half, avoid emac stall */
61 "movclr.l %%acc0, %[r];" /* get higher half */
62 "asl.l #8, %[r];" /* hi<<16, plus one free */
63 "asl.l #8, %[r];"
64 "lsr.l #8, %[x];" /* (unsigned)lo >> 15 */
65 "lsr.l #7, %[x];"
66 "or.l %[x], %[r];" /* logical-or results */
67 : [r] "=&d" (r), [x] "+d" (x)
68 : [y] "d" (y)
69 : "cc");
70 return r;
71}
72
73
74static inline
75void XPROD31(ogg_int32_t a, ogg_int32_t b,
76 ogg_int32_t t, ogg_int32_t v,
77 ogg_int32_t *x, ogg_int32_t *y)
78{
79 asm volatile ("mac.l %[a], %[t], %%acc0;"
80 "mac.l %[b], %[v], %%acc0;"
81 "mac.l %[b], %[t], %%acc1;"
82 "msac.l %[a], %[v], %%acc1;"
83 "movclr.l %%acc0, %[a];"
84 "move.l %[a], (%[x]);"
85 "movclr.l %%acc1, %[a];"
86 "move.l %[a], (%[y]);"
87 : [a] "+&r" (a)
88 : [x] "a" (x), [y] "a" (y),
89 [b] "r" (b), [t] "r" (t), [v] "r" (v)
90 : "cc", "memory");
91}
92
93
94static inline
95void XNPROD31(ogg_int32_t a, ogg_int32_t b,
96 ogg_int32_t t, ogg_int32_t v,
97 ogg_int32_t *x, ogg_int32_t *y)
98{
99 asm volatile ("mac.l %[a], %[t], %%acc0;"
100 "msac.l %[b], %[v], %%acc0;"
101 "mac.l %[b], %[t], %%acc1;"
102 "mac.l %[a], %[v], %%acc1;"
103 "movclr.l %%acc0, %[a];"
104 "move.l %[a], (%[x]);"
105 "movclr.l %%acc1, %[a];"
106 "move.l %[a], (%[y]);"
107 : [a] "+&r" (a)
108 : [x] "a" (x), [y] "a" (y),
109 [b] "r" (b), [t] "r" (t), [v] "r" (v)
110 : "cc", "memory");
111}
112
113
114#if 0 /* canonical Tremor definition */
115#define XPROD32(_a, _b, _t, _v, _x, _y) \
116 { (_x)=MULT32(_a,_t)+MULT32(_b,_v); \
117 (_y)=MULT32(_b,_t)-MULT32(_a,_v); }
118#endif
119
120/* this could lose the LSB by overflow, but i don't think it'll ever happen.
121 if anyone think they can hear a bug caused by this, please try the above
122 version. */
123#define XPROD32(_a, _b, _t, _v, _x, _y) \
124 asm volatile ("mac.l %[a], %[t], %%acc0;" \
125 "mac.l %[b], %[v], %%acc0;" \
126 "mac.l %[b], %[t], %%acc1;" \
127 "msac.l %[a], %[v], %%acc1;" \
128 "movclr.l %%acc0, %[x];" \
129 "asr.l #1, %[x];" \
130 "movclr.l %%acc1, %[y];" \
131 "asr.l #1, %[y];" \
132 : [x] "=&d" (_x), [y] "=&d" (_y) \
133 : [a] "r" (_a), [b] "r" (_b), \
134 [t] "r" (_t), [v] "r" (_v) \
135 : "cc");
136
137#ifndef _V_VECT_OPS
138#define _V_VECT_OPS
139
140/* asm versions of vector operations for block.c, window.c */
141/* assumes MAC is initialized & accumulators cleared */
142static inline
143void vect_add(ogg_int32_t *x, ogg_int32_t *y, int n)
144{
145 /* align to 16 bytes */
146 while(n>0 && (int)x&16) {
147 *x++ += *y++;
148 n--;
149 }
150 asm volatile ("bra 1f;"
151 "0:" /* loop start */
152 "movem.l (%[x]), %%d0-%%d3;" /* fetch values */
153 "movem.l (%[y]), %%a0-%%a3;"
154 /* add */
155 "add.l %%a0, %%d0;"
156 "add.l %%a1, %%d1;"
157 "add.l %%a2, %%d2;"
158 "add.l %%a3, %%d3;"
159 /* store and advance */
160 "movem.l %%d0-%%d3, (%[x]);"
161 "lea.l (4*4, %[x]), %[x];"
162 "lea.l (4*4, %[y]), %[y];"
163 "subq.l #4, %[n];" /* done 4 elements */
164 "1: cmpi.l #4, %[n];"
165 "bge 0b;"
166 : [n] "+d" (n), [x] "+a" (x), [y] "+a" (y)
167 : : "%d0", "%d1", "%d2", "%d3", "%a0", "%a1", "%a2", "%a3",
168 "cc", "memory");
169 /* add final elements */
170 while (n>0) {
171 *x++ += *y++;
172 n--;
173 }
174}
175
176static inline
177void vect_copy(ogg_int32_t *x, ogg_int32_t *y, int n)
178{
179 /* align to 16 bytes */
180 while(n>0 && (int)x&16) {
181 *x++ = *y++;
182 n--;
183 }
184 asm volatile ("bra 1f;"
185 "0:" /* loop start */
186 "movem.l (%[y]), %%d0-%%d3;" /* fetch values */
187 "movem.l %%d0-%%d3, (%[x]);" /* store */
188 "lea.l (4*4, %[x]), %[x];" /* advance */
189 "lea.l (4*4, %[y]), %[y];"
190 "subq.l #4, %[n];" /* done 4 elements */
191 "1: cmpi.l #4, %[n];"
192 "bge 0b;"
193 : [n] "+d" (n), [x] "+a" (x), [y] "+a" (y)
194 : : "%d0", "%d1", "%d2", "%d3", "cc", "memory");
195 /* copy final elements */
196 while (n>0) {
197 *x++ = *y++;
198 n--;
199 }
200}
201
202
203static inline
204void vect_mult_fw(ogg_int32_t *data, LOOKUP_T *window, int n)
205{
206 /* ensure data is aligned to 16-bytes */
207 while(n>0 && (int)data%16) {
208 *data = MULT31(*data, *window);
209 data++;
210 window++;
211 n--;
212 }
213 asm volatile ("movem.l (%[d]), %%d0-%%d3;" /* loop start */
214 "movem.l (%[w]), %%a0-%%a3;" /* pre-fetch registers */
215 "lea.l (4*4, %[w]), %[w];"
216 "bra 1f;" /* jump to loop condition */
217 "0:" /* loop body */
218 /* multiply and load next window values */
219 "mac.l %%d0, %%a0, (%[w])+, %%a0, %%acc0;"
220 "mac.l %%d1, %%a1, (%[w])+, %%a1, %%acc1;"
221 "mac.l %%d2, %%a2, (%[w])+, %%a2, %%acc2;"
222 "mac.l %%d3, %%a3, (%[w])+, %%a3, %%acc3;"
223 "movclr.l %%acc0, %%d0;" /* get the products */
224 "movclr.l %%acc1, %%d1;"
225 "movclr.l %%acc2, %%d2;"
226 "movclr.l %%acc3, %%d3;"
227 /* store and advance */
228 "movem.l %%d0-%%d3, (%[d]);"
229 "lea.l (4*4, %[d]), %[d];"
230 "movem.l (%[d]), %%d0-%%d3;"
231 "subq.l #4, %[n];" /* done 4 elements */
232 "1: cmpi.l #4, %[n];"
233 "bge 0b;"
234 /* multiply final elements */
235 "tst.l %[n];"
236 "beq 1f;" /* n=0 */
237 "mac.l %%d0, %%a0, %%acc0;"
238 "movclr.l %%acc0, %%d0;"
239 "move.l %%d0, (%[d])+;"
240 "subq.l #1, %[n];"
241 "beq 1f;" /* n=1 */
242 "mac.l %%d1, %%a1, %%acc0;"
243 "movclr.l %%acc0, %%d1;"
244 "move.l %%d1, (%[d])+;"
245 "subq.l #1, %[n];"
246 "beq 1f;" /* n=2 */
247 /* otherwise n = 3 */
248 "mac.l %%d2, %%a2, %%acc0;"
249 "movclr.l %%acc0, %%d2;"
250 "move.l %%d2, (%[d])+;"
251 "1:"
252 : [n] "+d" (n), [d] "+a" (data), [w] "+a" (window)
253 : : "%d0", "%d1", "%d2", "%d3", "%a0", "%a1", "%a2", "%a3",
254 "cc", "memory");
255}
256
257static inline
258void vect_mult_bw(ogg_int32_t *data, LOOKUP_T *window, int n)
259{
260 /* ensure at least data is aligned to 16-bytes */
261 while(n>0 && (int)data%16) {
262 *data = MULT31(*data, *window);
263 data++;
264 window--;
265 n--;
266 }
267 asm volatile ("lea.l (-3*4, %[w]), %[w];" /* loop start */
268 "movem.l (%[d]), %%d0-%%d3;" /* pre-fetch registers */
269 "movem.l (%[w]), %%a0-%%a3;"
270 "bra 1f;" /* jump to loop condition */
271 "0:" /* loop body */
272 /* multiply and load next window value */
273 "mac.l %%d0, %%a3, -(%[w]), %%a3, %%acc0;"
274 "mac.l %%d1, %%a2, -(%[w]), %%a2, %%acc1;"
275 "mac.l %%d2, %%a1, -(%[w]), %%a1, %%acc2;"
276 "mac.l %%d3, %%a0, -(%[w]), %%a0, %%acc3;"
277 "movclr.l %%acc0, %%d0;" /* get the products */
278 "movclr.l %%acc1, %%d1;"
279 "movclr.l %%acc2, %%d2;"
280 "movclr.l %%acc3, %%d3;"
281 /* store and advance */
282 "movem.l %%d0-%%d3, (%[d]);"
283 "lea.l (4*4, %[d]), %[d];"
284 "movem.l (%[d]), %%d0-%%d3;"
285 "subq.l #4, %[n];" /* done 4 elements */
286 "1: cmpi.l #4, %[n];"
287 "bge 0b;"
288 /* multiply final elements */
289 "tst.l %[n];"
290 "beq 1f;" /* n=0 */
291 "mac.l %%d0, %%a3, %%acc0;"
292 "movclr.l %%acc0, %%d0;"
293 "move.l %%d0, (%[d])+;"
294 "subq.l #1, %[n];"
295 "beq 1f;" /* n=1 */
296 "mac.l %%d1, %%a2, %%acc0;"
297 "movclr.l %%acc0, %%d1;"
298 "move.l %%d1, (%[d])+;"
299 "subq.l #1, %[n];"
300 "beq 1f;" /* n=2 */
301 /* otherwise n = 3 */
302 "mac.l %%d2, %%a1, %%acc0;"
303 "movclr.l %%acc0, %%d2;"
304 "move.l %%d2, (%[d])+;"
305 "1:"
306 : [n] "+d" (n), [d] "+a" (data), [w] "+a" (window)
307 : : "%d0", "%d1", "%d2", "%d3", "%a0", "%a1", "%a2", "%a3",
308 "cc", "memory");
309}
310
311#endif
312
313#endif
314
315#ifndef _V_CLIP_MATH
316#define _V_CLIP_MATH
317
318/* this is portable C and simple; why not use this as default? */
319static inline ogg_int32_t CLIP_TO_15(register ogg_int32_t x) {
320 register ogg_int32_t hi=32767, lo=-32768;
321 return (x>=hi ? hi : (x<=lo ? lo : x));
322}
323
324#endif
325#else
326#define LINE_ATTR
327#endif
diff --git a/apps/codecs/libtremor/backends.h b/apps/codecs/libtremor/backends.h
new file mode 100644
index 0000000000..50c1c45cfd
--- /dev/null
+++ b/apps/codecs/libtremor/backends.h
@@ -0,0 +1,130 @@
1/********************************************************************
2 * *
3 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
4 * *
5 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
6 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
7 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
8 * *
9 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
10 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
11 * *
12 ********************************************************************
13
14 function: backend and mapping structures
15
16 ********************************************************************/
17
18/* this is exposed up here because we need it for static modes.
19 Lookups for each backend aren't exposed because there's no reason
20 to do so */
21
22#ifndef _vorbis_backend_h_
23#define _vorbis_backend_h_
24
25#include "codec_internal.h"
26
27/* this would all be simpler/shorter with templates, but.... */
28/* Transform backend generic *************************************/
29
30/* only mdct right now. Flesh it out more if we ever transcend mdct
31 in the transform domain */
32
33/* Floor backend generic *****************************************/
34typedef struct{
35 vorbis_info_floor *(*unpack)(vorbis_info *,oggpack_buffer *);
36 vorbis_look_floor *(*look) (vorbis_dsp_state *,vorbis_info_mode *,
37 vorbis_info_floor *);
38 void (*free_info) (vorbis_info_floor *);
39 void (*free_look) (vorbis_look_floor *);
40 void *(*inverse1) (struct vorbis_block *,vorbis_look_floor *);
41 int (*inverse2) (struct vorbis_block *,vorbis_look_floor *,
42 void *buffer,ogg_int32_t *);
43} vorbis_func_floor;
44
45typedef struct{
46 int order;
47 long rate;
48 long barkmap;
49
50 int ampbits;
51 int ampdB;
52
53 int numbooks; /* <= 16 */
54 int books[16];
55
56} vorbis_info_floor0;
57
58#define VIF_POSIT 63
59#define VIF_CLASS 16
60#define VIF_PARTS 31
61typedef struct{
62 int partitions; /* 0 to 31 */
63 int partitionclass[VIF_PARTS]; /* 0 to 15 */
64
65 int class_dim[VIF_CLASS]; /* 1 to 8 */
66 int class_subs[VIF_CLASS]; /* 0,1,2,3 (bits: 1<<n poss) */
67 int class_book[VIF_CLASS]; /* subs ^ dim entries */
68 int class_subbook[VIF_CLASS][8]; /* [VIF_CLASS][subs] */
69
70
71 int mult; /* 1 2 3 or 4 */
72 int postlist[VIF_POSIT+2]; /* first two implicit */
73
74} vorbis_info_floor1;
75
76/* Residue backend generic *****************************************/
77typedef struct{
78 vorbis_info_residue *(*unpack)(vorbis_info *,oggpack_buffer *);
79 vorbis_look_residue *(*look) (vorbis_dsp_state *,vorbis_info_mode *,
80 vorbis_info_residue *);
81 void (*free_info) (vorbis_info_residue *);
82 void (*free_look) (vorbis_look_residue *);
83 int (*inverse) (struct vorbis_block *,vorbis_look_residue *,
84 ogg_int32_t **,int *,int);
85} vorbis_func_residue;
86
87typedef struct vorbis_info_residue0{
88/* block-partitioned VQ coded straight residue */
89 long begin;
90 long end;
91
92 /* first stage (lossless partitioning) */
93 int grouping; /* group n vectors per partition */
94 int partitions; /* possible codebooks for a partition */
95 int groupbook; /* huffbook for partitioning */
96 int secondstages[64]; /* expanded out to pointers in lookup */
97 int booklist[256]; /* list of second stage books */
98} vorbis_info_residue0;
99
100/* Mapping backend generic *****************************************/
101typedef struct{
102 vorbis_info_mapping *(*unpack)(vorbis_info *,oggpack_buffer *);
103 vorbis_look_mapping *(*look) (vorbis_dsp_state *,vorbis_info_mode *,
104 vorbis_info_mapping *);
105 void (*free_info) (vorbis_info_mapping *);
106 void (*free_look) (vorbis_look_mapping *);
107 int (*inverse) (struct vorbis_block *vb,vorbis_look_mapping *);
108} vorbis_func_mapping;
109
110typedef struct vorbis_info_mapping0{
111 int submaps; /* <= 16 */
112 int chmuxlist[256]; /* up to 256 channels in a Vorbis stream */
113
114 int floorsubmap[16]; /* [mux] submap to floors */
115 int residuesubmap[16]; /* [mux] submap to residue */
116
117 int psy[2]; /* by blocktype; impulse/padding for short,
118 transition/normal for long */
119
120 int coupling_steps;
121 int coupling_mag[256];
122 int coupling_ang[256];
123} vorbis_info_mapping0;
124
125#endif
126
127
128
129
130
diff --git a/apps/codecs/libtremor/bitwise.c b/apps/codecs/libtremor/bitwise.c
new file mode 100644
index 0000000000..caa42f4277
--- /dev/null
+++ b/apps/codecs/libtremor/bitwise.c
@@ -0,0 +1,214 @@
1/********************************************************************
2 * *
3 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
4 * *
5 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
6 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
7 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
8 * *
9 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
10 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
11 * *
12 ********************************************************************
13
14 function: packing variable sized words into an octet stream
15
16 ********************************************************************/
17
18/* We're 'LSb' endian; if we write a word but read individual bits,
19 then we'll read the lsb first */
20
21#include "config-tremor.h"
22#include <string.h>
23#include "ogg.h"
24
25const unsigned long oggpack_mask[] ICONST_ATTR =
26{0x00000000,0x00000001,0x00000003,0x00000007,0x0000000f,
27 0x0000001f,0x0000003f,0x0000007f,0x000000ff,0x000001ff,
28 0x000003ff,0x000007ff,0x00000fff,0x00001fff,0x00003fff,
29 0x00007fff,0x0000ffff,0x0001ffff,0x0003ffff,0x0007ffff,
30 0x000fffff,0x001fffff,0x003fffff,0x007fffff,0x00ffffff,
31 0x01ffffff,0x03ffffff,0x07ffffff,0x0fffffff,0x1fffffff,
32 0x3fffffff,0x7fffffff,0xffffffff };
33
34void oggpack_readinit(oggpack_buffer *b,ogg_reference *r){
35 memset(b,0,sizeof(*b));
36
37 b->tail=b->head=r;
38 b->count=0;
39 b->headptr=b->head->buffer->data+b->head->begin;
40 b->headend=b->head->length;
41 _span(b);
42}
43
44#define _lookspan() while(!end){\
45 head=head->next;\
46 if(!head) return -1;\
47 ptr=head->buffer->data + head->begin;\
48 end=head->length;\
49 }
50
51/* Read in bits without advancing the bitptr; bits <= 32 */
52long oggpack_look_full(oggpack_buffer *b,int bits) ICODE_ATTR_TREMOR_NOT_MDCT;
53long oggpack_look_full(oggpack_buffer *b,int bits){
54 unsigned long m=oggpack_mask[bits];
55 unsigned long ret=-1;
56
57 bits+=b->headbit;
58
59 if(bits >= b->headend<<3){
60 int end=b->headend;
61 unsigned char *ptr=b->headptr;
62 ogg_reference *head=b->head;
63
64 if(end<0)return -1;
65
66 if(bits){
67 _lookspan();
68 ret=*ptr++>>b->headbit;
69 if(bits>8){
70 --end;
71 _lookspan();
72 ret|=*ptr++<<(8-b->headbit);
73 if(bits>16){
74 --end;
75 _lookspan();
76 ret|=*ptr++<<(16-b->headbit);
77 if(bits>24){
78 --end;
79 _lookspan();
80 ret|=*ptr++<<(24-b->headbit);
81 if(bits>32 && b->headbit){
82 --end;
83 _lookspan();
84 ret|=*ptr<<(32-b->headbit);
85 }
86 }
87 }
88 }
89 }
90
91 }else{
92
93 /* make this a switch jump-table */
94 ret=b->headptr[0]>>b->headbit;
95 if(bits>8){
96 ret|=b->headptr[1]<<(8-b->headbit);
97 if(bits>16){
98 ret|=b->headptr[2]<<(16-b->headbit);
99 if(bits>24){
100 ret|=b->headptr[3]<<(24-b->headbit);
101 if(bits>32 && b->headbit)
102 ret|=b->headptr[4]<<(32-b->headbit);
103 }
104 }
105 }
106 }
107
108 ret&=m;
109 return ret;
110}
111
112/* spans forward and finds next byte. Never halts */
113static void _span_one(oggpack_buffer *b){
114 while(b->headend<1){
115 if(b->head->next){
116 b->count+=b->head->length;
117 b->head=b->head->next;
118 b->headptr=b->head->buffer->data+b->head->begin;
119 b->headend=b->head->length;
120 }else
121 break;
122 }
123}
124
125static int _halt_one(oggpack_buffer *b){
126 if(b->headend<1){
127 _adv_halt(b);
128 return -1;
129 }
130 return 0;
131}
132
133/* bits <= 32 */
134long oggpack_read(oggpack_buffer *b,int bits) ICODE_ATTR_TREMOR_NOT_MDCT;
135long oggpack_read(oggpack_buffer *b,int bits){
136 unsigned long m=oggpack_mask[bits];
137 ogg_uint32_t ret=-1;
138
139 bits+=b->headbit;
140
141 if(bits >= b->headend<<3){
142
143 if(b->headend<0)return -1;
144
145 if(bits){
146 if (_halt_one(b)) return -1;
147 ret=*b->headptr>>b->headbit;
148
149 if(bits>=8){
150 ++b->headptr;
151 --b->headend;
152 _span_one(b);
153 if(bits>8){
154 if (_halt_one(b)) return -1;
155 ret|=*b->headptr<<(8-b->headbit);
156
157 if(bits>=16){
158 ++b->headptr;
159 --b->headend;
160 _span_one(b);
161 if(bits>16){
162 if (_halt_one(b)) return -1;
163 ret|=*b->headptr<<(16-b->headbit);
164
165 if(bits>=24){
166 ++b->headptr;
167 --b->headend;
168 _span_one(b);
169 if(bits>24){
170 if (_halt_one(b)) return -1;
171 ret|=*b->headptr<<(24-b->headbit);
172
173 if(bits>=32){
174 ++b->headptr;
175 --b->headend;
176 _span_one(b);
177 if(bits>32){
178 if (_halt_one(b)) return -1;
179 if(b->headbit)ret|=*b->headptr<<(32-b->headbit);
180
181 }
182 }
183 }
184 }
185 }
186 }
187 }
188 }
189 }
190 }else{
191
192 ret=b->headptr[0]>>b->headbit;
193 if(bits>8){
194 ret|=b->headptr[1]<<(8-b->headbit);
195 if(bits>16){
196 ret|=b->headptr[2]<<(16-b->headbit);
197 if(bits>24){
198 ret|=b->headptr[3]<<(24-b->headbit);
199 if(bits>32 && b->headbit){
200 ret|=b->headptr[4]<<(32-b->headbit);
201 }
202 }
203 }
204 }
205
206 b->headptr+=((unsigned)bits)/8;
207 b->headend-=((unsigned)bits)/8;
208 }
209
210 ret&=m;
211 b->headbit=bits&7;
212 return ret;
213}
214
diff --git a/apps/codecs/libtremor/block.c b/apps/codecs/libtremor/block.c
new file mode 100644
index 0000000000..e609fc44f7
--- /dev/null
+++ b/apps/codecs/libtremor/block.c
@@ -0,0 +1,454 @@
1/********************************************************************
2 * *
3 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
4 * *
5 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
6 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
7 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
8 * *
9 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
10 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
11 * *
12 ********************************************************************
13
14 function: PCM data vector blocking, windowing and dis/reassembly
15
16 ********************************************************************/
17
18#include "config-tremor.h"
19#include <stdio.h>
20#include <string.h>
21#include "ogg.h"
22#include "ivorbiscodec.h"
23#include "codec_internal.h"
24
25#include "window.h"
26#include "registry.h"
27#include "misc.h"
28
29static int ilog(unsigned int v){
30 int ret=0;
31 if(v)--v;
32 while(v){
33 ret++;
34 v>>=1;
35 }
36 return(ret);
37}
38
39/* pcm accumulator examples (not exhaustive):
40
41 <-------------- lW ---------------->
42 <--------------- W ---------------->
43: .....|..... _______________ |
44: .''' | '''_--- | |\ |
45:.....''' |_____--- '''......| | \_______|
46:.................|__________________|_______|__|______|
47 |<------ Sl ------>| > Sr < |endW
48 |beginSl |endSl | |endSr
49 |beginW |endlW |beginSr
50
51
52 |< lW >|
53 <--------------- W ---------------->
54 | | .. ______________ |
55 | | ' `/ | ---_ |
56 |___.'___/`. | ---_____|
57 |_______|__|_______|_________________|
58 | >|Sl|< |<------ Sr ----->|endW
59 | | |endSl |beginSr |endSr
60 |beginW | |endlW
61 mult[0] |beginSl mult[n]
62
63 <-------------- lW ----------------->
64 |<--W-->|
65: .............. ___ | |
66: .''' |`/ \ | |
67:.....''' |/`....\|...|
68:.........................|___|___|___|
69 |Sl |Sr |endW
70 | | |endSr
71 | |beginSr
72 | |endSl
73 |beginSl
74 |beginW
75*/
76
77/* block abstraction setup *********************************************/
78
79#ifndef WORD_ALIGN
80#define WORD_ALIGN 8
81#endif
82
83int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb){
84 memset(vb,0,sizeof(*vb));
85 vb->vd=v;
86 vb->localalloc=0;
87 vb->localstore=NULL;
88
89 return(0);
90}
91
92void *_vorbis_block_alloc(vorbis_block *vb,long bytes){
93 bytes=(bytes+(WORD_ALIGN-1)) & ~(WORD_ALIGN-1);
94 if(bytes+vb->localtop>vb->localalloc){
95 /* can't just _ogg_realloc... there are outstanding pointers */
96 if(vb->localstore){
97 struct alloc_chain *link=(struct alloc_chain *)_ogg_malloc(sizeof(*link));
98 vb->totaluse+=vb->localtop;
99 link->next=vb->reap;
100 link->ptr=vb->localstore;
101 vb->reap=link;
102 }
103 /* highly conservative */
104 vb->localalloc=bytes;
105 vb->localstore=_ogg_malloc(vb->localalloc);
106 vb->localtop=0;
107 }
108 {
109 void *ret=(void *)(((char *)vb->localstore)+vb->localtop);
110 vb->localtop+=bytes;
111 return ret;
112 }
113}
114
115/* reap the chain, pull the ripcord */
116void _vorbis_block_ripcord(vorbis_block *vb){
117 /* reap the chain */
118 struct alloc_chain *reap=vb->reap;
119 while(reap){
120 struct alloc_chain *next=reap->next;
121 _ogg_free(reap->ptr);
122 memset(reap,0,sizeof(*reap));
123 _ogg_free(reap);
124 reap=next;
125 }
126 /* consolidate storage */
127 if(vb->totaluse){
128 vb->localstore=_ogg_realloc(vb->localstore,vb->totaluse+vb->localalloc);
129 vb->localalloc+=vb->totaluse;
130 vb->totaluse=0;
131 }
132
133 /* pull the ripcord */
134 vb->localtop=0;
135 vb->reap=NULL;
136}
137
138int vorbis_block_clear(vorbis_block *vb){
139 _vorbis_block_ripcord(vb);
140 if(vb->localstore)_ogg_free(vb->localstore);
141
142 memset(vb,0,sizeof(*vb));
143 return(0);
144}
145
146static int _vds_init(vorbis_dsp_state *v,vorbis_info *vi){
147 int i;
148 codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
149 private_state *b=NULL;
150
151 memset(v,0,sizeof(*v));
152 b=(private_state *)(v->backend_state=_ogg_calloc(1,sizeof(*b)));
153
154 v->vi=vi;
155 b->modebits=ilog(ci->modes);
156
157 /* Vorbis I uses only window type 0 */
158 b->window[0]=_vorbis_window(0,ci->blocksizes[0]/2);
159 b->window[1]=_vorbis_window(0,ci->blocksizes[1]/2);
160
161 /* finish the codebooks */
162 if(!ci->fullbooks){
163 ci->fullbooks=(codebook *)_ogg_calloc(ci->books,sizeof(*ci->fullbooks));
164 for(i=0;i<ci->books;i++){
165 vorbis_book_init_decode(ci->fullbooks+i,ci->book_param[i]);
166 /* decode codebooks are now standalone after init */
167 vorbis_staticbook_destroy(ci->book_param[i]);
168 ci->book_param[i]=NULL;
169 }
170 }
171
172 v->pcm_storage=ci->blocksizes[1];
173 v->pcm=(ogg_int32_t **)_ogg_malloc(vi->channels*sizeof(*v->pcm));
174 v->pcmb=(ogg_int32_t **)_ogg_malloc(vi->channels*sizeof(*v->pcmb));
175 v->pcmret=(ogg_int32_t **)_ogg_malloc(vi->channels*sizeof(*v->pcmret));
176
177 for(i=0;i<vi->channels;i++)
178 v->pcm[i]=(ogg_int32_t *)_ogg_calloc(v->pcm_storage,sizeof(*v->pcm[i]));
179
180
181 /* all 1 (large block) or 0 (small block) */
182 /* explicitly set for the sake of clarity */
183 v->lW=0; /* previous window size */
184 v->W=0; /* current window size */
185
186 /* initialize all the mapping/backend lookups */
187 b->mode=(vorbis_look_mapping **)_ogg_calloc(ci->modes,sizeof(*b->mode));
188 for(i=0;i<ci->modes;i++){
189 int mapnum=ci->mode_param[i]->mapping;
190 int maptype=ci->map_type[mapnum];
191 b->mode[i]=_mapping_P[maptype]->look(v,ci->mode_param[i],
192 ci->map_param[mapnum]);
193 }
194 return(0);
195}
196
197int vorbis_synthesis_restart(vorbis_dsp_state *v){
198 vorbis_info *vi=v->vi;
199 codec_setup_info *ci;
200
201 if(!v->backend_state)return -1;
202 if(!vi)return -1;
203 ci=vi->codec_setup;
204 if(!ci)return -1;
205
206 v->centerW=ci->blocksizes[1]/2;
207 v->pcm_current=v->centerW;
208
209 v->pcm_returned=-1;
210 v->granulepos=-1;
211 v->sequence=-1;
212 ((private_state *)(v->backend_state))->sample_count=-1;
213
214 return(0);
215}
216
217int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi){
218 _vds_init(v,vi);
219 vorbis_synthesis_restart(v);
220
221 return(0);
222}
223
224void vorbis_dsp_clear(vorbis_dsp_state *v){
225 int i;
226 if(v){
227 vorbis_info *vi=v->vi;
228 codec_setup_info *ci=(codec_setup_info *)(vi?vi->codec_setup:NULL);
229 private_state *b=(private_state *)v->backend_state;
230
231 if(v->pcm){
232 for(i=0;i<vi->channels;i++)
233 if(v->pcm[i])_ogg_free(v->pcm[i]);
234 _ogg_free(v->pcm);
235 if(v->pcmret)_ogg_free(v->pcmret);
236 }
237
238 /* free mode lookups; these are actually vorbis_look_mapping structs */
239 if(ci){
240 for(i=0;i<ci->modes;i++){
241 int mapnum=ci->mode_param[i]->mapping;
242 int maptype=ci->map_type[mapnum];
243 if(b && b->mode)_mapping_P[maptype]->free_look(b->mode[i]);
244 }
245 }
246
247 if(b){
248 if(b->mode)_ogg_free(b->mode);
249 _ogg_free(b);
250 }
251
252 memset(v,0,sizeof(*v));
253 }
254}
255
256/* Unlike in analysis, the window is only partially applied for each
257 block. The time domain envelope is not yet handled at the point of
258 calling (as it relies on the previous block). */
259
260int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb)
261 ICODE_ATTR_TREMOR_NOT_MDCT;
262int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){
263 vorbis_info *vi=v->vi;
264 codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
265 private_state *b=v->backend_state;
266 int j;
267
268 if(v->pcm_current>v->pcm_returned && v->pcm_returned!=-1)return(OV_EINVAL);
269
270 v->lW=v->W;
271 v->W=vb->W;
272 v->nW=-1;
273
274 if((v->sequence==-1)||
275 (v->sequence+1 != vb->sequence)){
276 v->granulepos=-1; /* out of sequence; lose count */
277 b->sample_count=-1;
278 }
279
280 v->sequence=vb->sequence;
281
282 if(vb->pcm){ /* no pcm to process if vorbis_synthesis_trackonly
283 was called on block */
284 int n=ci->blocksizes[v->W]/2;
285 int n0=ci->blocksizes[0]/2;
286 int n1=ci->blocksizes[1]/2;
287
288 int thisCenter;
289 int prevCenter;
290
291 if(v->centerW){
292 thisCenter=n1;
293 prevCenter=0;
294 }else{
295 thisCenter=0;
296 prevCenter=n1;
297 }
298
299 /* v->pcm is now used like a two-stage double buffer. We don't want
300 to have to constantly shift *or* adjust memory usage. Don't
301 accept a new block until the old is shifted out */
302
303 /* overlap/add PCM */
304
305 for(j=0;j<vi->channels;j++){
306 /* the overlap/add section */
307 if(v->lW){
308 if(v->W){
309 /* large/large */
310 ogg_int32_t *pcm=v->pcm[j]+prevCenter;
311 ogg_int32_t *p=vb->pcm[j];
312 vect_add(p, pcm, n1);
313 v->pcmb[j]=p;
314 }else{
315 /* large/small */
316 ogg_int32_t *pcm=v->pcm[j]+prevCenter+n1/2-n0/2;
317 ogg_int32_t *p=vb->pcm[j];
318 vect_add(pcm, p, n0);
319 v->pcmb[j]=v->pcm[j]+prevCenter;
320 }
321 }else{
322 if(v->W){
323 /* small/large */
324 ogg_int32_t *pcm=v->pcm[j]+prevCenter;
325 ogg_int32_t *p=vb->pcm[j]+n1/2-n0/2;
326 vect_add(p, pcm, n0);
327 v->pcmb[j]=p;
328 }else{
329 /* small/small */
330 ogg_int32_t *pcm=v->pcm[j]+prevCenter;
331 ogg_int32_t *p=vb->pcm[j];
332 vect_add(p, pcm, n0);
333 v->pcmb[j]=p;
334 }
335 }
336
337 /* the copy section */
338 {
339 ogg_int32_t *pcm=v->pcm[j]+thisCenter;
340 ogg_int32_t *p=vb->pcm[j]+n;
341 vect_copy(pcm, p, n);
342 }
343 }
344
345 if(v->centerW)
346 v->centerW=0;
347 else
348 v->centerW=n1;
349
350 /* deal with initial packet state; we do this using the explicit
351 pcm_returned==-1 flag otherwise we're sensitive to first block
352 being short or long */
353
354 if(v->pcm_returned==-1){
355 v->pcm_returned=thisCenter;
356 v->pcm_current=thisCenter;
357 }else{
358 v->pcm_returned=0;
359 v->pcm_current=ci->blocksizes[v->lW]/4+ci->blocksizes[v->W]/4;
360 }
361
362 }
363
364 /* track the frame number... This is for convenience, but also
365 making sure our last packet doesn't end with added padding. If
366 the last packet is partial, the number of samples we'll have to
367 return will be past the vb->granulepos.
368
369 This is not foolproof! It will be confused if we begin
370 decoding at the last page after a seek or hole. In that case,
371 we don't have a starting point to judge where the last frame
372 is. For this reason, vorbisfile will always try to make sure
373 it reads the last two marked pages in proper sequence */
374
375 if(b->sample_count==-1){
376 b->sample_count=0;
377 }else{
378 b->sample_count+=ci->blocksizes[v->lW]/4+ci->blocksizes[v->W]/4;
379 }
380
381 if(v->granulepos==-1){
382 if(vb->granulepos!=-1){ /* only set if we have a position to set to */
383
384 v->granulepos=vb->granulepos;
385
386 /* is this a short page? */
387 if(b->sample_count>v->granulepos){
388 /* corner case; if this is both the first and last audio page,
389 then spec says the end is cut, not beginning */
390 if(vb->eofflag){
391 /* trim the end */
392 /* no preceeding granulepos; assume we started at zero (we'd
393 have to in a short single-page stream) */
394 /* granulepos could be -1 due to a seek, but that would result
395 in a long coun`t, not short count */
396
397 v->pcm_current-=(b->sample_count-v->granulepos);
398 }else{
399 /* trim the beginning */
400 v->pcm_returned+=(b->sample_count-v->granulepos);
401 if(v->pcm_returned>v->pcm_current)
402 v->pcm_returned=v->pcm_current;
403 }
404
405 }
406
407 }
408 }else{
409 v->granulepos+=ci->blocksizes[v->lW]/4+ci->blocksizes[v->W]/4;
410 if(vb->granulepos!=-1 && v->granulepos!=vb->granulepos){
411
412 if(v->granulepos>vb->granulepos){
413 long extra=v->granulepos-vb->granulepos;
414
415 if(extra)
416 if(vb->eofflag){
417 /* partial last frame. Strip the extra samples off */
418 v->pcm_current-=extra;
419 } /* else {Shouldn't happen *unless* the bitstream is out of
420 spec. Either way, believe the bitstream } */
421 } /* else {Shouldn't happen *unless* the bitstream is out of
422 spec. Either way, believe the bitstream } */
423 v->granulepos=vb->granulepos;
424 }
425 }
426
427 /* Update, cleanup */
428
429 if(vb->eofflag)v->eofflag=1;
430 return(0);
431}
432
433/* pcm==NULL indicates we just want the pending samples, no more */
434int vorbis_synthesis_pcmout(vorbis_dsp_state *v,ogg_int32_t ***pcm) ICODE_ATTR;
435int vorbis_synthesis_pcmout(vorbis_dsp_state *v,ogg_int32_t ***pcm){
436 vorbis_info *vi=v->vi;
437 if(v->pcm_returned>-1 && v->pcm_returned<v->pcm_current){
438 if(pcm){
439 int i;
440 for(i=0;i<vi->channels;i++)
441 v->pcmret[i]=v->pcmb[i]+v->pcm_returned;
442 *pcm=v->pcmret;
443 }
444 return(v->pcm_current-v->pcm_returned);
445 }
446 return(0);
447}
448
449int vorbis_synthesis_read(vorbis_dsp_state *v,int bytes){
450 if(bytes && v->pcm_returned+bytes>v->pcm_current)return(OV_EINVAL);
451 v->pcm_returned+=bytes;
452 return(0);
453}
454
diff --git a/apps/codecs/libtremor/codebook.c b/apps/codecs/libtremor/codebook.c
new file mode 100644
index 0000000000..8c319ab49e
--- /dev/null
+++ b/apps/codecs/libtremor/codebook.c
@@ -0,0 +1,504 @@
1/********************************************************************
2 * *
3 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
4 * *
5 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
6 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
7 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
8 * *
9 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
10 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
11 * *
12 ********************************************************************
13
14 function: basic codebook pack/unpack/code/decode operations
15
16 ********************************************************************/
17
18#include "config-tremor.h"
19#include <string.h>
20#include <math.h>
21#include "ogg.h"
22#include "ivorbiscodec.h"
23#include "codebook.h"
24#include "misc.h"
25#include "os.h"
26
27/* unpacks a codebook from the packet buffer into the codebook struct,
28 readies the codebook auxiliary structures for decode *************/
29int vorbis_staticbook_unpack(oggpack_buffer *opb,static_codebook *s){
30 long i,j;
31 memset(s,0,sizeof(*s));
32
33 /* make sure alignment is correct */
34 if(oggpack_read(opb,24)!=0x564342)goto _eofout;
35
36 /* first the basic parameters */
37 s->dim=oggpack_read(opb,16);
38 s->entries=oggpack_read(opb,24);
39 if(s->entries==-1)goto _eofout;
40
41 /* codeword ordering.... length ordered or unordered? */
42 switch((int)oggpack_read(opb,1)){
43 case 0:
44 /* unordered */
45 s->lengthlist=(long *)_ogg_malloc(sizeof(*s->lengthlist)*s->entries);
46
47 /* allocated but unused entries? */
48 if(oggpack_read(opb,1)){
49 /* yes, unused entries */
50
51 for(i=0;i<s->entries;i++){
52 if(oggpack_read(opb,1)){
53 long num=oggpack_read(opb,5);
54 if(num==-1)goto _eofout;
55 s->lengthlist[i]=num+1;
56 }else
57 s->lengthlist[i]=0;
58 }
59 }else{
60 /* all entries used; no tagging */
61 for(i=0;i<s->entries;i++){
62 long num=oggpack_read(opb,5);
63 if(num==-1)goto _eofout;
64 s->lengthlist[i]=num+1;
65 }
66 }
67
68 break;
69 case 1:
70 /* ordered */
71 {
72 long length=oggpack_read(opb,5)+1;
73 s->lengthlist=(long *)_ogg_malloc(sizeof(*s->lengthlist)*s->entries);
74
75 for(i=0;i<s->entries;){
76 long num=oggpack_read(opb,_ilog(s->entries-i));
77 if(num==-1)goto _eofout;
78 for(j=0;j<num && i<s->entries;j++,i++)
79 s->lengthlist[i]=length;
80 length++;
81 }
82 }
83 break;
84 default:
85 /* EOF */
86 return(-1);
87 }
88
89 /* Do we have a mapping to unpack? */
90 switch((s->maptype=oggpack_read(opb,4))){
91 case 0:
92 /* no mapping */
93 break;
94 case 1: case 2:
95 /* implicitly populated value mapping */
96 /* explicitly populated value mapping */
97
98 s->q_min=oggpack_read(opb,32);
99 s->q_delta=oggpack_read(opb,32);
100 s->q_quant=oggpack_read(opb,4)+1;
101 s->q_sequencep=oggpack_read(opb,1);
102
103 {
104 int quantvals=0;
105 switch(s->maptype){
106 case 1:
107 quantvals=_book_maptype1_quantvals(s);
108 break;
109 case 2:
110 quantvals=s->entries*s->dim;
111 break;
112 }
113
114 /* quantized values */
115 s->quantlist=(long *)_ogg_malloc(sizeof(*s->quantlist)*quantvals);
116 for(i=0;i<quantvals;i++)
117 s->quantlist[i]=oggpack_read(opb,s->q_quant);
118
119 if(quantvals&&s->quantlist[quantvals-1]==-1)goto _eofout;
120 }
121 break;
122 default:
123 goto _errout;
124 }
125
126 /* all set */
127 return(0);
128
129 _errout:
130 _eofout:
131 vorbis_staticbook_clear(s);
132 return(-1);
133}
134
135/* the 'eliminate the decode tree' optimization actually requires the
136 codewords to be MSb first, not LSb. This is an annoying inelegancy
137 (and one of the first places where carefully thought out design
138 turned out to be wrong; Vorbis II and future Ogg codecs should go
139 to an MSb bitpacker), but not actually the huge hit it appears to
140 be. The first-stage decode table catches most words so that
141 bitreverse is not in the main execution path. */
142
143static inline ogg_uint32_t bitreverse(register ogg_uint32_t x){
144 x= ((x>>16)&0x0000ffff) | ((x<<16)&0xffff0000);
145 x= ((x>> 8)&0x00ff00ff) | ((x<< 8)&0xff00ff00);
146 x= ((x>> 4)&0x0f0f0f0f) | ((x<< 4)&0xf0f0f0f0);
147 x= ((x>> 2)&0x33333333) | ((x<< 2)&0xcccccccc);
148 return((x>> 1)&0x55555555) | ((x<< 1)&0xaaaaaaaa);
149}
150
151STIN long decode_packed_entry_number(codebook *book,
152 oggpack_buffer *b){
153 int read=book->dec_maxlength;
154 long lo,hi;
155 long lok = oggpack_look(b,book->dec_firsttablen);
156
157 if (EXPECT(lok >= 0, 1)) {
158 long entry = book->dec_firsttable[lok];
159 if(EXPECT(entry&0x80000000UL, 0)){
160 lo=(entry>>15)&0x7fff;
161 hi=book->used_entries-(entry&0x7fff);
162 }else{
163 oggpack_adv(b, book->dec_codelengths[entry-1]);
164 return(entry-1);
165 }
166 }else{
167 lo=0;
168 hi=book->used_entries;
169 }
170
171 lok = oggpack_look(b, read);
172
173 while(lok<0 && read>1)
174 lok = oggpack_look(b, --read);
175
176 if(lok<0){
177 oggpack_adv(b,1); /* force eop */
178 return -1;
179 }
180
181 /* bisect search for the codeword in the ordered list */
182 {
183 ogg_uint32_t testword=bitreverse((ogg_uint32_t)lok);
184
185 while(hi-lo>1){
186 long p=(hi-lo)>>1;
187 long test=book->codelist[lo+p]>testword;
188 lo+=p&(test-1);
189 hi-=p&(-test);
190 }
191
192 if(book->dec_codelengths[lo]<=read){
193 oggpack_adv(b, book->dec_codelengths[lo]);
194 return(lo);
195 }
196 }
197
198 oggpack_adv(b, read+1);
199 return(-1);
200}
201
202static long decode_packed_block(codebook *book, oggpack_buffer *b,
203 long *buf, int n){
204 long *bufptr = buf;
205 long *bufend = buf + n;
206
207 while (bufptr<bufend) {
208 if (b->headend > 8) {
209 ogg_uint32_t *ptr;
210 unsigned long bit, bitend;
211 unsigned long adr;
212 ogg_uint32_t cache = 0;
213 int cachesize = 0;
214
215 adr = (unsigned long)b->headptr;
216 bit = (adr&3)*8+b->headbit;
217 ptr = (ogg_uint32_t *)(adr&~3);
218 bitend = ((adr&3)+b->headend)*8;
219 while (bufptr<bufend){
220 long entry, lo, hi;
221 if (EXPECT(cachesize<book->dec_maxlength, 0)) {
222 if (bit-cachesize+32>=bitend)
223 break;
224 bit-=cachesize;
225 cache=letoh32(ptr[bit>>5]) >> (bit&31);
226 if (bit&31)
227 cache|=letoh32(ptr[(bit>>5)+1]) << (32-(bit&31));
228 cachesize=32;
229 bit+=32;
230 }
231
232 entry=book->dec_firsttable[cache&((1<<book->dec_firsttablen)-1)];
233 if(EXPECT(entry&0x80000000UL, 0)){
234 lo=(entry>>15)&0x7fff;
235 hi=book->used_entries-(entry&0x7fff);
236 {
237 ogg_uint32_t testword=bitreverse((ogg_uint32_t)cache);
238
239 while(EXPECT(hi-lo>1, 1)){
240 long p=(hi-lo)>>1;
241 if (book->codelist[lo+p]>testword)
242 hi-=p;
243 else
244 lo+=p;
245 }
246 entry=lo;
247 }
248 }else
249 entry--;
250
251 *bufptr++=entry;
252 {
253 int l=book->dec_codelengths[entry];
254 cachesize-=l;
255 cache>>=l;
256 }
257 }
258
259 adr=(unsigned long)b->headptr;
260 bit-=(adr&3)*8+cachesize;
261 b->headend-=(bit/8);
262 b->headptr+=bit/8;
263 b->headbit=bit%8;
264 } else {
265 long r = decode_packed_entry_number(book, b);
266 if (r == -1) return bufptr-buf;
267 *bufptr++ = r;
268 }
269 }
270 return n;
271}
272
273
274/* Decode side is specced and easier, because we don't need to find
275 matches using different criteria; we simply read and map. There are
276 two things we need to do 'depending':
277
278 We may need to support interleave. We don't really, but it's
279 convenient to do it here rather than rebuild the vector later.
280
281 Cascades may be additive or multiplicitive; this is not inherent in
282 the codebook, but set in the code using the codebook. Like
283 interleaving, it's easiest to do it here.
284 addmul==0 -> declarative (set the value)
285 addmul==1 -> additive
286 addmul==2 -> multiplicitive */
287
288/* returns the [original, not compacted] entry number or -1 on eof *********/
289long vorbis_book_decode(codebook *book, oggpack_buffer *b){
290 if(book->used_entries>0){
291 long packed_entry=decode_packed_entry_number(book,b);
292 if(packed_entry>=0)
293 return(book->dec_index[packed_entry]);
294 }
295
296 /* if there's no dec_index, the codebook unpacking isn't collapsed */
297 return(-1);
298}
299
300/* returns 0 on OK or -1 on eof *************************************/
301long vorbis_book_decodevs_add(codebook *book,ogg_int32_t *a,
302 oggpack_buffer *b,int n,int point){
303 if(book->used_entries>0){
304 int step=n/book->dim;
305 long *entry = (long *)alloca(sizeof(*entry)*step);
306 ogg_int32_t **t = (ogg_int32_t **)alloca(sizeof(*t)*step);
307 int i,j,o;
308 int shift=point-book->binarypoint;
309
310 if(shift>=0){
311 for (i = 0; i < step; i++) {
312 entry[i]=decode_packed_entry_number(book,b);
313 if(entry[i]==-1)return(-1);
314 t[i] = book->valuelist+entry[i]*book->dim;
315 }
316 for(i=0,o=0;i<book->dim;i++,o+=step)
317 for (j=0;j<step;j++)
318 a[o+j]+=t[j][i]>>shift;
319 }else{
320 for (i = 0; i < step; i++) {
321 entry[i]=decode_packed_entry_number(book,b);
322 if(entry[i]==-1)return(-1);
323 t[i] = book->valuelist+entry[i]*book->dim;
324 }
325 for(i=0,o=0;i<book->dim;i++,o+=step)
326 for (j=0;j<step;j++)
327 a[o+j]+=t[j][i]<<-shift;
328 }
329 }
330 return(0);
331}
332
333long vorbis_book_decodev_add(codebook *book,ogg_int32_t *a,
334 oggpack_buffer *b,int n,int point){
335 if(book->used_entries>0){
336 int i,j,entry;
337 ogg_int32_t *t;
338 int shift=point-book->binarypoint;
339
340 if(shift>=0){
341 for(i=0;i<n;){
342 entry = decode_packed_entry_number(book,b);
343 if(entry==-1)return(-1);
344 t = book->valuelist+entry*book->dim;
345 for (j=0;j<book->dim;)
346 a[i++]+=t[j++]>>shift;
347 }
348 }else{
349 shift = -shift;
350 for(i=0;i<n;){
351 entry = decode_packed_entry_number(book,b);
352 if(entry==-1)return(-1);
353 t = book->valuelist+entry*book->dim;
354 for (j=0;j<book->dim;)
355 a[i++]+=t[j++]<<shift;
356 }
357 }
358 }
359 return(0);
360}
361
362long vorbis_book_decodev_set(codebook *book,ogg_int32_t *a,
363 oggpack_buffer *b,int n,int point){
364 if(book->used_entries>0){
365 int i,j,entry;
366 ogg_int32_t *t;
367 int shift=point-book->binarypoint;
368
369 if(shift>=0){
370
371 for(i=0;i<n;){
372 entry = decode_packed_entry_number(book,b);
373 if(entry==-1)return(-1);
374 t = book->valuelist+entry*book->dim;
375 for (j=0;j<book->dim;){
376 a[i++]=t[j++]>>shift;
377 }
378 }
379 }else{
380 shift = -shift;
381 for(i=0;i<n;){
382 entry = decode_packed_entry_number(book,b);
383 if(entry==-1)return(-1);
384 t = book->valuelist+entry*book->dim;
385 for (j=0;j<book->dim;){
386 a[i++]=t[j++]<<shift;
387 }
388 }
389 }
390 }else{
391
392 int i,j;
393 for(i=0;i<n;){
394 for (j=0;j<book->dim;){
395 a[i++]=0;
396 }
397 }
398 }
399 return(0);
400}
401
402static long vorbis_book_decodevv_add_2ch_even(codebook *book,ogg_int32_t **a,
403 long offset,oggpack_buffer *b,
404 int n,int point){
405 long i,k,chunk,read;
406 int shift=point-book->binarypoint;
407 long entries[32];
408 ogg_int32_t *p0 = &(a[0][offset]);
409 ogg_int32_t *p1 = &(a[1][offset]);
410
411 if(shift>=0){
412
413 for(i=0;i<n;){
414 chunk=32;
415 if (chunk*book->dim>(n-i)*2)
416 chunk=((n-i)*2+book->dim-1)/book->dim;
417 read = decode_packed_block(book,b,entries,chunk);
418 for(k=0;k<read;k++){
419 const ogg_int32_t *t = book->valuelist+entries[k]*book->dim;
420 const ogg_int32_t *u = t+book->dim;
421 do{
422 *p0++ += *t++>>shift;
423 *p1++ += *t++>>shift;
424 }while(t<u);
425 }
426 if (read<chunk)return-1;
427 i += read*book->dim/2;
428 }
429 }else{
430 shift = -shift;
431 for(i=0;i<n;){
432 chunk=32;
433 if (chunk*book->dim>(n-i)*2)
434 chunk=((n-i)*2+book->dim-1)/book->dim;
435 read = decode_packed_block(book,b,entries,chunk);
436 for(k=0;k<read;k++){
437 const ogg_int32_t *t = book->valuelist+entries[k]*book->dim;
438 const ogg_int32_t *u = t+book->dim;
439 do{
440 *p0++ += *t++<<shift;
441 *p1++ += *t++<<shift;
442 }while(t<u);
443 }
444 if (read<chunk)return-1;
445 i += read*book->dim/2;
446 }
447 }
448 return(0);
449}
450
451long vorbis_book_decodevv_add(codebook *book,ogg_int32_t **a,
452 long offset,int ch,
453 oggpack_buffer *b,int n,int point){
454 if(book->used_entries>0){
455 long i,j,k,chunk,read;
456 int chptr=0;
457 int shift=point-book->binarypoint;
458 long entries[32];
459
460 if (!(book->dim&1) && ch==2)
461 return vorbis_book_decodevv_add_2ch_even(book,a,offset,b,n,point);
462
463 if(shift>=0){
464
465 for(i=offset;i<offset+n;){
466 chunk=32;
467 if (chunk*book->dim>(offset+n-i)*ch)
468 chunk=((offset+n-i)*ch+book->dim-1)/book->dim;
469 read = decode_packed_block(book,b,entries,chunk);
470 for(k=0;k<read;k++){
471 const ogg_int32_t *t = book->valuelist+entries[k]*book->dim;
472 for (j=0;j<book->dim;j++){
473 a[chptr++][i]+=t[j]>>shift;
474 if(chptr==ch){
475 chptr=0;
476 i++;
477 }
478 }
479 }
480 if (read<chunk)return-1;
481 }
482 }else{
483 shift = -shift;
484 for(i=offset;i<offset+n;){
485 chunk=32;
486 if (chunk*book->dim>(offset+n-i)*ch)
487 chunk=((offset+n-i)*ch+book->dim-1)/book->dim;
488 read = decode_packed_block(book,b,entries,chunk);
489 for(k=0;k<read;k++){
490 const ogg_int32_t *t = book->valuelist+entries[k]*book->dim;
491 for (j=0;j<book->dim;j++){
492 a[chptr++][i]+=t[j]<<shift;
493 if(chptr==ch){
494 chptr=0;
495 i++;
496 }
497 }
498 }
499 if (read<chunk)return-1;
500 }
501 }
502 }
503 return(0);
504}
diff --git a/apps/codecs/libtremor/codebook.h b/apps/codecs/libtremor/codebook.h
new file mode 100644
index 0000000000..14f65382dd
--- /dev/null
+++ b/apps/codecs/libtremor/codebook.h
@@ -0,0 +1,102 @@
1/********************************************************************
2 * *
3 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
4 * *
5 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
6 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
7 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
8 * *
9 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
10 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
11 * *
12 ********************************************************************
13
14 function: basic shared codebook operations
15
16 ********************************************************************/
17
18#ifndef _V_CODEBOOK_H_
19#define _V_CODEBOOK_H_
20
21#include "ogg.h"
22
23/* This structure encapsulates huffman and VQ style encoding books; it
24 doesn't do anything specific to either.
25
26 valuelist/quantlist are nonNULL (and q_* significant) only if
27 there's entry->value mapping to be done.
28
29 If encode-side mapping must be done (and thus the entry needs to be
30 hunted), the auxiliary encode pointer will point to a decision
31 tree. This is true of both VQ and huffman, but is mostly useful
32 with VQ.
33
34*/
35
36typedef struct static_codebook{
37 long dim; /* codebook dimensions (elements per vector) */
38 long entries; /* codebook entries */
39 long *lengthlist; /* codeword lengths in bits */
40
41 /* mapping ***************************************************************/
42 int maptype; /* 0=none
43 1=implicitly populated values from map column
44 2=listed arbitrary values */
45
46 /* The below does a linear, single monotonic sequence mapping. */
47 long q_min; /* packed 32 bit float; quant value 0 maps to minval */
48 long q_delta; /* packed 32 bit float; val 1 - val 0 == delta */
49 int q_quant; /* bits: 0 < quant <= 16 */
50 int q_sequencep; /* bitflag */
51
52 long *quantlist; /* map == 1: (int)(entries^(1/dim)) element column map
53 map == 2: list of dim*entries quantized entry vals
54 */
55} static_codebook;
56
57typedef struct codebook{
58 long dim; /* codebook dimensions (elements per vector) */
59 long entries; /* codebook entries */
60 long used_entries; /* populated codebook entries */
61
62 /* the below are ordered by bitreversed codeword and only used
63 entries are populated */
64 int binarypoint;
65 ogg_int32_t *valuelist; /* list of dim*entries actual entry values */
66 ogg_uint32_t *codelist; /* list of bitstream codewords for each entry */
67
68 int *dec_index;
69 char *dec_codelengths;
70 ogg_uint32_t *dec_firsttable;
71 int dec_firsttablen;
72 int dec_maxlength;
73
74 long q_min; /* packed 32 bit float; quant value 0 maps to minval */
75 long q_delta; /* packed 32 bit float; val 1 - val 0 == delta */
76
77} codebook;
78
79extern void vorbis_staticbook_clear(static_codebook *b);
80extern void vorbis_staticbook_destroy(static_codebook *b);
81extern int vorbis_book_init_decode(codebook *dest,const static_codebook *source);
82
83extern void vorbis_book_clear(codebook *b);
84extern long _book_maptype1_quantvals(const static_codebook *b);
85
86extern int vorbis_staticbook_unpack(oggpack_buffer *b,static_codebook *c);
87
88extern long vorbis_book_decode(codebook *book, oggpack_buffer *b);
89extern long vorbis_book_decodevs_add(codebook *book, ogg_int32_t *a,
90 oggpack_buffer *b,int n,int point);
91extern long vorbis_book_decodev_set(codebook *book, ogg_int32_t *a,
92 oggpack_buffer *b,int n,int point);
93extern long vorbis_book_decodev_add(codebook *book, ogg_int32_t *a,
94 oggpack_buffer *b,int n,int point);
95extern long vorbis_book_decodevv_add(codebook *book, ogg_int32_t **a,
96 long off,int ch,
97 oggpack_buffer *b,int n,int point);
98
99extern int _ilog(unsigned int v);
100
101
102#endif
diff --git a/apps/codecs/libtremor/codec_internal.h b/apps/codecs/libtremor/codec_internal.h
new file mode 100644
index 0000000000..3ca7f54724
--- /dev/null
+++ b/apps/codecs/libtremor/codec_internal.h
@@ -0,0 +1,92 @@
1/********************************************************************
2 * *
3 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
4 * *
5 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
6 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
7 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
8 * *
9 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
10 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
11 * *
12 ********************************************************************
13
14 function: libvorbis codec headers
15
16 ********************************************************************/
17
18#ifndef _V_CODECI_H_
19#define _V_CODECI_H_
20
21#include "codebook.h"
22
23typedef void vorbis_look_mapping;
24typedef void vorbis_look_floor;
25typedef void vorbis_look_residue;
26typedef void vorbis_look_transform;
27
28/* mode ************************************************************/
29typedef struct {
30 int blockflag;
31 int windowtype;
32 int transformtype;
33 int mapping;
34} vorbis_info_mode;
35
36typedef void vorbis_info_floor;
37typedef void vorbis_info_residue;
38typedef void vorbis_info_mapping;
39
40typedef struct private_state {
41 /* local lookup storage */
42 const void *window[2];
43
44 /* backend lookups are tied to the mode, not the backend or naked mapping */
45 int modebits;
46 vorbis_look_mapping **mode;
47
48 ogg_int64_t sample_count;
49
50} private_state;
51
52/* codec_setup_info contains all the setup information specific to the
53 specific compression/decompression mode in progress (eg,
54 psychoacoustic settings, channel setup, options, codebook
55 etc).
56*********************************************************************/
57
58typedef struct codec_setup_info {
59
60 /* Vorbis supports only short and long blocks, but allows the
61 encoder to choose the sizes */
62
63 long blocksizes[2];
64
65 /* modes are the primary means of supporting on-the-fly different
66 blocksizes, different channel mappings (LR or M/A),
67 different residue backends, etc. Each mode consists of a
68 blocksize flag and a mapping (along with the mapping setup */
69
70 int modes;
71 int maps;
72 int times;
73 int floors;
74 int residues;
75 int books;
76
77 vorbis_info_mode *mode_param[64];
78 int map_type[64];
79 vorbis_info_mapping *map_param[64];
80 int time_type[64];
81 int floor_type[64];
82 vorbis_info_floor *floor_param[64];
83 int residue_type[64];
84 vorbis_info_residue *residue_param[64];
85 static_codebook *book_param[256];
86 codebook *fullbooks;
87
88 int passlimit[32]; /* iteration limit per couple/quant pass */
89 int coupling_passes;
90} codec_setup_info;
91
92#endif
diff --git a/apps/codecs/libtremor/config-tremor.h b/apps/codecs/libtremor/config-tremor.h
new file mode 100644
index 0000000000..e1ade700e5
--- /dev/null
+++ b/apps/codecs/libtremor/config-tremor.h
@@ -0,0 +1,28 @@
1#include "../codec.h"
2#ifdef CPU_ARM
3#define _ARM_ASSEM_
4#endif
5
6#ifdef ROCKBOX_BIG_ENDIAN
7#define BIG_ENDIAN 1
8#define LITTLE_ENDIAN 0
9#define BYTE_ORDER BIG_ENDIAN
10#else
11#define BYTE_ORDER LITTLE_ENDIAN
12#define LITTLE_ENDIAN 1
13#define BIG_ENDIAN 0
14#endif
15
16#ifndef ICONST_ATTR_TREMOR_WINDOW
17#define ICONST_ATTR_TREMOR_WINDOW ICONST_ATTR
18#endif
19
20#ifndef ICODE_ATTR_TREMOR_MDCT
21#define ICODE_ATTR_TREMOR_MDCT ICODE_ATTR
22#endif
23
24#ifndef ICODE_ATTR_TREMOR_NOT_MDCT
25#define ICODE_ATTR_TREMOR_NOT_MDCT ICODE_ATTR
26#endif
27
28// #define _LOW_ACCURACY_
diff --git a/apps/codecs/libtremor/config_types.h b/apps/codecs/libtremor/config_types.h
new file mode 100644
index 0000000000..1fdcb27fe7
--- /dev/null
+++ b/apps/codecs/libtremor/config_types.h
@@ -0,0 +1,25 @@
1/********************************************************************
2 * *
3 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
4 * *
5 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
6 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
7 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
8 * *
9 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
10 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
11 * *
12 ********************************************************************
13
14 function: #ifdef jail to whip a few platforms into the UNIX ideal.
15
16 ********************************************************************/
17#ifndef _OS_CVTYPES_H
18#define _OS_CVTYPES_H
19
20typedef long long ogg_int64_t;
21typedef int ogg_int32_t;
22typedef unsigned int ogg_uint32_t;
23typedef short ogg_int16_t;
24
25#endif
diff --git a/apps/codecs/libtremor/ctype.c b/apps/codecs/libtremor/ctype.c
new file mode 100644
index 0000000000..9eb6eef80a
--- /dev/null
+++ b/apps/codecs/libtremor/ctype.c
@@ -0,0 +1 @@
#include "../../../firmware/common/ctype.c"
diff --git a/apps/codecs/libtremor/floor0.c b/apps/codecs/libtremor/floor0.c
new file mode 100644
index 0000000000..81587cad72
--- /dev/null
+++ b/apps/codecs/libtremor/floor0.c
@@ -0,0 +1,440 @@
1/********************************************************************
2 * *
3 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
4 * *
5 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
6 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
7 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
8 * *
9 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
10 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
11 * *
12 ********************************************************************
13
14 function: floor backend 0 implementation
15
16 ********************************************************************/
17
18#include "config-tremor.h"
19#include <string.h>
20#include <math.h>
21#include "ogg.h"
22#include "ivorbiscodec.h"
23#include "codec_internal.h"
24#include "registry.h"
25#include "codebook.h"
26#include "misc.h"
27#include "os.h"
28
29#define LSP_FRACBITS 14
30
31typedef struct {
32 long n;
33 int ln;
34 int m;
35 int *linearmap;
36
37 vorbis_info_floor0 *vi;
38 ogg_int32_t *lsp_look;
39
40} vorbis_look_floor0;
41
42/*************** LSP decode ********************/
43
44#include "lsp_lookup.h"
45
46/* interpolated 1./sqrt(p) where .5 <= a < 1. (.100000... to .111111...) in
47 16.16 format
48 returns in m.8 format */
49
50static const long ADJUST_SQRT2[2] ICONST_ATTR ={8192,5792};
51static inline ogg_int32_t vorbis_invsqlook_i(long a,long e){
52 long i=(a&0x7fff)>>(INVSQ_LOOKUP_I_SHIFT-1);
53 long d=a&INVSQ_LOOKUP_I_MASK; /* 0.10 */
54 long val=INVSQ_LOOKUP_I[i]- /* 1.16 */
55 ((INVSQ_LOOKUP_IDel[i]*d)>>INVSQ_LOOKUP_I_SHIFT); /* result 1.16 */
56 val*=ADJUST_SQRT2[e&1];
57 e=(e>>1)+21;
58 return(val>>e);
59}
60
61/* interpolated lookup based fromdB function, domain -140dB to 0dB only */
62/* a is in n.12 format */
63static inline ogg_int32_t vorbis_fromdBlook_i(long a){
64 int i=(-a)>>(12-FROMdB2_SHIFT);
65 if(i<0) return 0x7fffffff;
66 if(i>=(FROMdB_LOOKUP_SZ<<FROMdB_SHIFT))return 0;
67
68 return FROMdB_LOOKUP[i>>FROMdB_SHIFT] * FROMdB2_LOOKUP[i&FROMdB2_MASK];
69}
70
71/* interpolated lookup based cos function, domain 0 to PI only */
72/* a is in 0.16 format, where 0==0, 2^^16-1==PI, return 0.14 */
73static inline ogg_int32_t vorbis_coslook_i(long a){
74 int i=a>>COS_LOOKUP_I_SHIFT;
75 int d=a&COS_LOOKUP_I_MASK;
76 return COS_LOOKUP_I[i]- ((d*(COS_LOOKUP_I[i]-COS_LOOKUP_I[i+1]))>>
77 COS_LOOKUP_I_SHIFT);
78}
79
80/* interpolated lookup based cos function */
81/* a is in 0.16 format, where 0==0, 2^^16==PI, return .LSP_FRACBITS */
82static inline ogg_int32_t vorbis_coslook2_i(long a){
83 a=a&0x1ffff;
84
85 if(a>0x10000)a=0x20000-a;
86 {
87 int i=a>>COS_LOOKUP_I_SHIFT;
88 int d=a&COS_LOOKUP_I_MASK;
89 a=((COS_LOOKUP_I[i]<<COS_LOOKUP_I_SHIFT)-
90 d*(COS_LOOKUP_I[i]-COS_LOOKUP_I[i+1]))>>
91 (COS_LOOKUP_I_SHIFT-LSP_FRACBITS+14);
92 }
93
94 return(a);
95}
96
97static const int barklook[28] IDATA_ATTR ={
98 0,100,200,301, 405,516,635,766,
99 912,1077,1263,1476, 1720,2003,2333,2721,
100 3184,3742,4428,5285, 6376,7791,9662,12181,
101 15624,20397,27087,36554
102};
103
104/* used in init only; interpolate the long way */
105static inline ogg_int32_t toBARK(int n){
106 int i;
107 for(i=0;i<27;i++)
108 if(n>=barklook[i] && n<barklook[i+1])break;
109
110 if(i==27){
111 return 27<<15;
112 }else{
113 int gap=barklook[i+1]-barklook[i];
114 int del=n-barklook[i];
115
116 return((i<<15)+((del<<15)/gap));
117 }
118}
119
120static const unsigned char MLOOP_1[64] ICONST_ATTR ={
121 0,10,11,11, 12,12,12,12, 13,13,13,13, 13,13,13,13,
122 14,14,14,14, 14,14,14,14, 14,14,14,14, 14,14,14,14,
123 15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15,
124 15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15,
125};
126
127static const unsigned char MLOOP_2[64] ICONST_ATTR ={
128 0,4,5,5, 6,6,6,6, 7,7,7,7, 7,7,7,7,
129 8,8,8,8, 8,8,8,8, 8,8,8,8, 8,8,8,8,
130 9,9,9,9, 9,9,9,9, 9,9,9,9, 9,9,9,9,
131 9,9,9,9, 9,9,9,9, 9,9,9,9, 9,9,9,9,
132};
133
134static const unsigned char MLOOP_3[8] ICONST_ATTR ={0,1,2,2,3,3,3,3};
135
136static void vorbis_lsp_to_curve(ogg_int32_t *curve,int *map,int n,int ln,
137 ogg_int32_t *lsp,int m,
138 ogg_int32_t amp,
139 ogg_int32_t ampoffset,
140 ogg_int32_t *icos){
141
142 (void)ln;
143 /* 0 <= m < 256 */
144
145 /* set up for using all int later */
146 int i;
147 int ampoffseti=ampoffset*4096;
148 int ampi=amp;
149 ogg_int32_t *ilsp=(ogg_int32_t *)alloca(m*sizeof(*ilsp));
150 /* lsp is in 8.24, range 0 to PI; coslook wants it in .16 0 to 1*/
151 for(i=0;i<m;i++){
152#ifndef _LOW_ACCURACY_
153 ogg_int32_t val=MULT32(lsp[i],0x517cc2);
154#else
155 ogg_int32_t val=((lsp[i]>>10)*0x517d)>>14;
156#endif
157
158 /* safeguard against a malicious stream */
159 if(val<0 || (val>>COS_LOOKUP_I_SHIFT)>=COS_LOOKUP_I_SZ){
160 memset(curve,0,sizeof(*curve)*n);
161 return;
162 }
163
164 ilsp[i]=vorbis_coslook_i(val);
165 }
166
167 i=0;
168 while(i<n){
169 int j,k=map[i];
170 ogg_uint32_t pi=46341; /* 2**-.5 in 0.16 */
171 ogg_uint32_t qi=46341;
172 ogg_int32_t qexp=0,shift;
173 ogg_int32_t wi=icos[k];
174
175#ifdef _V_LSP_MATH_ASM
176 (void)shift; /* kill warnings */
177 (void)j;
178 lsp_loop_asm(&qi,&pi,&qexp,ilsp,wi,m);
179
180 pi=((pi*pi)>>16);
181 qi=((qi*qi)>>16);
182
183 if(m&1){
184 qexp= qexp*2-28*((m+1)>>1)+m;
185 pi*=(1<<14)-((wi*wi)>>14);
186 qi+=pi>>14;
187 }else{
188 qexp= qexp*2-13*m;
189
190 pi*=(1<<14)-wi;
191 qi*=(1<<14)+wi;
192
193 qi=(qi+pi)>>14;
194 }
195
196 if(qi&0xffff0000){ /* checks for 1.xxxxxxxxxxxxxxxx */
197 qi>>=1; qexp++;
198 }else
199 lsp_norm_asm(&qi,&qexp);
200
201#else
202
203 qi*=labs(ilsp[0]-wi);
204 pi*=labs(ilsp[1]-wi);
205
206 for(j=3;j<m;j+=2){
207 if(!(shift=MLOOP_1[(pi|qi)>>25]))
208 if(!(shift=MLOOP_2[(pi|qi)>>19]))
209 shift=MLOOP_3[(pi|qi)>>16];
210 qi=(qi>>shift)*labs(ilsp[j-1]-wi);
211 pi=(pi>>shift)*labs(ilsp[j]-wi);
212 qexp+=shift;
213 }
214 if(!(shift=MLOOP_1[(pi|qi)>>25]))
215 if(!(shift=MLOOP_2[(pi|qi)>>19]))
216 shift=MLOOP_3[(pi|qi)>>16];
217
218 /* pi,qi normalized collectively, both tracked using qexp */
219
220 if(m&1){
221 /* odd order filter; slightly assymetric */
222 /* the last coefficient */
223 qi=(qi>>shift)*labs(ilsp[j-1]-wi);
224 pi=(pi>>shift)<<14;
225 qexp+=shift;
226
227 if(!(shift=MLOOP_1[(pi|qi)>>25]))
228 if(!(shift=MLOOP_2[(pi|qi)>>19]))
229 shift=MLOOP_3[(pi|qi)>>16];
230
231 pi>>=shift;
232 qi>>=shift;
233 qexp+=shift-14*((m+1)>>1);
234
235 pi=((pi*pi)>>16);
236 qi=((qi*qi)>>16);
237 qexp=qexp*2+m;
238
239 pi*=(1<<14)-((wi*wi)>>14);
240 qi+=pi>>14;
241
242 }else{
243 /* even order filter; still symmetric */
244
245 /* p*=p(1-w), q*=q(1+w), let normalization drift because it isn't
246 worth tracking step by step */
247
248 pi>>=shift;
249 qi>>=shift;
250 qexp+=shift-7*m;
251
252 pi=((pi*pi)>>16);
253 qi=((qi*qi)>>16);
254 qexp=qexp*2+m;
255
256 pi*=(1<<14)-wi;
257 qi*=(1<<14)+wi;
258 qi=(qi+pi)>>14;
259
260 }
261
262
263 /* we've let the normalization drift because it wasn't important;
264 however, for the lookup, things must be normalized again. We
265 need at most one right shift or a number of left shifts */
266
267 if(qi&0xffff0000){ /* checks for 1.xxxxxxxxxxxxxxxx */
268 qi>>=1; qexp++;
269 }else
270 while(qi && !(qi&0x8000)){ /* checks for 0.0xxxxxxxxxxxxxxx or less*/
271 qi<<=1; qexp--;
272 }
273
274#endif
275
276 amp=vorbis_fromdBlook_i(ampi* /* n.4 */
277 vorbis_invsqlook_i(qi,qexp)-
278 /* m.8, m+n<=8 */
279 ampoffseti); /* 8.12[0] */
280
281#ifdef _LOW_ACCURACY_
282 amp>>=9;
283#endif
284 curve[i]= MULT31_SHIFT15(curve[i],amp);
285 while(map[++i]==k) curve[i]= MULT31_SHIFT15(curve[i],amp);
286 }
287}
288
289/*************** vorbis decode glue ************/
290
291static void floor0_free_info(vorbis_info_floor *i){
292 vorbis_info_floor0 *info=(vorbis_info_floor0 *)i;
293 if(info){
294 memset(info,0,sizeof(*info));
295 _ogg_free(info);
296 }
297}
298
299static void floor0_free_look(vorbis_look_floor *i){
300 vorbis_look_floor0 *look=(vorbis_look_floor0 *)i;
301 if(look){
302
303 if(look->linearmap)_ogg_free(look->linearmap);
304 if(look->lsp_look)_ogg_free(look->lsp_look);
305 memset(look,0,sizeof(*look));
306 _ogg_free(look);
307 }
308}
309
310static vorbis_info_floor *floor0_unpack (vorbis_info *vi,oggpack_buffer *opb){
311 codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
312 int j;
313
314 vorbis_info_floor0 *info=(vorbis_info_floor0 *)_ogg_malloc(sizeof(*info));
315 info->order=oggpack_read(opb,8);
316 info->rate=oggpack_read(opb,16);
317 info->barkmap=oggpack_read(opb,16);
318 info->ampbits=oggpack_read(opb,6);
319 info->ampdB=oggpack_read(opb,8);
320 info->numbooks=oggpack_read(opb,4)+1;
321
322 if(info->order<1)goto err_out;
323 if(info->rate<1)goto err_out;
324 if(info->barkmap<1)goto err_out;
325 if(info->numbooks<1)goto err_out;
326
327 for(j=0;j<info->numbooks;j++){
328 info->books[j]=oggpack_read(opb,8);
329 if(info->books[j]<0 || info->books[j]>=ci->books)goto err_out;
330 }
331 return(info);
332
333 err_out:
334 floor0_free_info(info);
335 return(NULL);
336}
337
338/* initialize Bark scale and normalization lookups. We could do this
339 with static tables, but Vorbis allows a number of possible
340 combinations, so it's best to do it computationally.
341
342 The below is authoritative in terms of defining scale mapping.
343 Note that the scale depends on the sampling rate as well as the
344 linear block and mapping sizes */
345
346static vorbis_look_floor *floor0_look (vorbis_dsp_state *vd,vorbis_info_mode *mi,
347 vorbis_info_floor *i){
348 int j;
349 // ogg_int32_t scale;
350 vorbis_info *vi=vd->vi;
351 codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
352 vorbis_info_floor0 *info=(vorbis_info_floor0 *)i;
353 vorbis_look_floor0 *look=(vorbis_look_floor0 *)_ogg_calloc(1,sizeof(*look));
354 look->m=info->order;
355 look->n=ci->blocksizes[mi->blockflag]/2;
356 look->ln=info->barkmap;
357 look->vi=info;
358
359 /* the mapping from a linear scale to a smaller bark scale is
360 straightforward. We do *not* make sure that the linear mapping
361 does not skip bark-scale bins; the decoder simply skips them and
362 the encoder may do what it wishes in filling them. They're
363 necessary in some mapping combinations to keep the scale spacing
364 accurate */
365 look->linearmap=(int *)_ogg_malloc((look->n+1)*sizeof(*look->linearmap));
366 for(j=0;j<look->n;j++){
367
368 int val=(look->ln*
369 ((toBARK(info->rate/2*j/look->n)<<11)/toBARK(info->rate/2)))>>11;
370
371 if(val>=look->ln)val=look->ln-1; /* guard against the approximation */
372 look->linearmap[j]=val;
373 }
374 look->linearmap[j]=-1;
375
376 look->lsp_look=(ogg_int32_t *)_ogg_malloc(look->ln*sizeof(*look->lsp_look));
377 for(j=0;j<look->ln;j++)
378 look->lsp_look[j]=vorbis_coslook2_i(0x10000*j/look->ln);
379
380 return look;
381}
382
383static void *floor0_inverse1(vorbis_block *vb,vorbis_look_floor *i){
384 vorbis_look_floor0 *look=(vorbis_look_floor0 *)i;
385 vorbis_info_floor0 *info=look->vi;
386 int j,k;
387
388 int ampraw=oggpack_read(&vb->opb,info->ampbits);
389 if(ampraw>0){ /* also handles the -1 out of data case */
390 long maxval=(1<<info->ampbits)-1;
391 int amp=((ampraw*info->ampdB)<<4)/maxval;
392 int booknum=oggpack_read(&vb->opb,_ilog(info->numbooks));
393
394 if(booknum!=-1 && booknum<info->numbooks){ /* be paranoid */
395 codec_setup_info *ci=(codec_setup_info *)vb->vd->vi->codec_setup;
396 codebook *b=ci->fullbooks+info->books[booknum];
397 ogg_int32_t last=0;
398 ogg_int32_t *lsp=(ogg_int32_t *)_vorbis_block_alloc(vb,sizeof(*lsp)*(look->m+1));
399
400 for(j=0;j<look->m;j+=b->dim)
401 if(vorbis_book_decodev_set(b,lsp+j,&vb->opb,b->dim,-24)==-1)goto eop;
402 for(j=0;j<look->m;){
403 for(k=0;k<b->dim;k++,j++)lsp[j]+=last;
404 last=lsp[j-1];
405 }
406
407 lsp[look->m]=amp;
408 return(lsp);
409 }
410 }
411 eop:
412 return(NULL);
413}
414
415static int floor0_inverse2(vorbis_block *vb,vorbis_look_floor *i,
416 void *memo,ogg_int32_t *out){
417 vorbis_look_floor0 *look=(vorbis_look_floor0 *)i;
418 vorbis_info_floor0 *info=look->vi;
419 (void)vb;
420
421 if(memo){
422 ogg_int32_t *lsp=(ogg_int32_t *)memo;
423 ogg_int32_t amp=lsp[look->m];
424
425 /* take the coefficients back to a spectral envelope curve */
426 vorbis_lsp_to_curve(out,look->linearmap,look->n,look->ln,
427 lsp,look->m,amp,info->ampdB,look->lsp_look);
428 return(1);
429 }
430 memset(out,0,sizeof(*out)*look->n);
431 return(0);
432}
433
434/* export hooks */
435const vorbis_func_floor floor0_exportbundle ICONST_ATTR ={
436 &floor0_unpack,&floor0_look,&floor0_free_info,
437 &floor0_free_look,&floor0_inverse1,&floor0_inverse2
438};
439
440
diff --git a/apps/codecs/libtremor/floor1.c b/apps/codecs/libtremor/floor1.c
new file mode 100644
index 0000000000..4ee58c18ca
--- /dev/null
+++ b/apps/codecs/libtremor/floor1.c
@@ -0,0 +1,447 @@
1/********************************************************************
2 * *
3 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
4 * *
5 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
6 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
7 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
8 * *
9 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
10 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
11 * *
12 ********************************************************************
13
14 function: floor backend 1 implementation
15
16 ********************************************************************/
17
18#include "config-tremor.h"
19#include <string.h>
20#include <math.h>
21#include "ogg.h"
22#include "ivorbiscodec.h"
23#include "codec_internal.h"
24#include "registry.h"
25#include "codebook.h"
26#include "misc.h"
27
28#define floor1_rangedB 140 /* floor 1 fixed at -140dB to 0dB range */
29
30typedef struct {
31 int forward_index[VIF_POSIT+2];
32
33 int hineighbor[VIF_POSIT];
34 int loneighbor[VIF_POSIT];
35 int posts;
36
37 int n;
38 int quant_q;
39 vorbis_info_floor1 *vi;
40
41} vorbis_look_floor1;
42
43/***********************************************/
44
45static void floor1_free_info(vorbis_info_floor *i){
46 vorbis_info_floor1 *info=(vorbis_info_floor1 *)i;
47 if(info){
48 //memset(info,0,sizeof(*info));
49 _ogg_free(info);
50 }
51}
52
53static void floor1_free_look(vorbis_look_floor *i){
54 vorbis_look_floor1 *look=(vorbis_look_floor1 *)i;
55 if(look){
56 //memset(look,0,sizeof(*look));
57 _ogg_free(look);
58 }
59}
60
61static inline int ilog(register unsigned int v){
62 register int ret=0;
63 while(v){
64 ret++;
65 v>>=1;
66 }
67 return(ret);
68}
69
70static vorbis_info_floor *floor1_unpack (vorbis_info *vi,oggpack_buffer *opb){
71 codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
72 int j,k,count=0,maxclass=-1,rangebits;
73
74 vorbis_info_floor1 *info=(vorbis_info_floor1 *)_ogg_calloc(1,sizeof(*info));
75 /* read partitions */
76 info->partitions=oggpack_read(opb,5); /* only 0 to 31 legal */
77 for(j=0;j<info->partitions;j++){
78 info->partitionclass[j]=oggpack_read(opb,4); /* only 0 to 15 legal */
79 if(maxclass<info->partitionclass[j])maxclass=info->partitionclass[j];
80 }
81
82 /* read partition classes */
83 for(j=0;j<maxclass+1;j++){
84 info->class_dim[j]=oggpack_read(opb,3)+1; /* 1 to 8 */
85 info->class_subs[j]=oggpack_read(opb,2); /* 0,1,2,3 bits */
86 if(info->class_subs[j]<0)
87 goto err_out;
88 if(info->class_subs[j])info->class_book[j]=oggpack_read(opb,8);
89 if(info->class_book[j]<0 || info->class_book[j]>=ci->books)
90 goto err_out;
91 for(k=0;k<(1<<info->class_subs[j]);k++){
92 info->class_subbook[j][k]=oggpack_read(opb,8)-1;
93 if(info->class_subbook[j][k]<-1 || info->class_subbook[j][k]>=ci->books)
94 goto err_out;
95 }
96 }
97
98 /* read the post list */
99 info->mult=oggpack_read(opb,2)+1; /* only 1,2,3,4 legal now */
100 rangebits=oggpack_read(opb,4);
101
102 for(j=0,k=0;j<info->partitions;j++){
103 count+=info->class_dim[info->partitionclass[j]];
104 for(;k<count;k++){
105 int t=info->postlist[k+2]=oggpack_read(opb,rangebits);
106 if(t<0 || t>=(1<<rangebits))
107 goto err_out;
108 }
109 }
110 info->postlist[0]=0;
111 info->postlist[1]=1<<rangebits;
112
113 return(info);
114
115 err_out:
116 floor1_free_info(info);
117 return(NULL);
118}
119
120static int icomp(const void *a,const void *b){
121 return(**(int **)a-**(int **)b);
122}
123
124static vorbis_look_floor *floor1_look(vorbis_dsp_state *vd,vorbis_info_mode *mi,
125 vorbis_info_floor *in){
126
127 int *sortpointer[VIF_POSIT+2];
128 vorbis_info_floor1 *info=(vorbis_info_floor1 *)in;
129 vorbis_look_floor1 *look=(vorbis_look_floor1 *)_ogg_calloc(1,sizeof(*look));
130 int i,j,n=0;
131
132 (void)vd;
133 (void)mi;
134 look->vi=info;
135 look->n=info->postlist[1];
136
137 /* we drop each position value in-between already decoded values,
138 and use linear interpolation to predict each new value past the
139 edges. The positions are read in the order of the position
140 list... we precompute the bounding positions in the lookup. Of
141 course, the neighbors can change (if a position is declined), but
142 this is an initial mapping */
143
144 for(i=0;i<info->partitions;i++)n+=info->class_dim[info->partitionclass[i]];
145 n+=2;
146 look->posts=n;
147
148 /* also store a sorted position index */
149 for(i=0;i<n;i++)sortpointer[i]=info->postlist+i;
150 qsort(sortpointer,n,sizeof(*sortpointer),icomp);
151
152 /* points from sort order back to range number */
153 for(i=0;i<n;i++)look->forward_index[i]=sortpointer[i]-info->postlist;
154
155 /* quantize values to multiplier spec */
156 switch(info->mult){
157 case 1: /* 1024 -> 256 */
158 look->quant_q=256;
159 break;
160 case 2: /* 1024 -> 128 */
161 look->quant_q=128;
162 break;
163 case 3: /* 1024 -> 86 */
164 look->quant_q=86;
165 break;
166 case 4: /* 1024 -> 64 */
167 look->quant_q=64;
168 break;
169 }
170
171 /* discover our neighbors for decode where we don't use fit flags
172 (that would push the neighbors outward) */
173 for(i=0;i<n-2;i++){
174 int lo=0;
175 int hi=1;
176 int lx=0;
177 int hx=look->n;
178 int currentx=info->postlist[i+2];
179 for(j=0;j<i+2;j++){
180 int x=info->postlist[j];
181 if(x>lx && x<currentx){
182 lo=j;
183 lx=x;
184 }
185 if(x<hx && x>currentx){
186 hi=j;
187 hx=x;
188 }
189 }
190 look->loneighbor[i]=lo;
191 look->hineighbor[i]=hi;
192 }
193
194 return(look);
195}
196
197static int render_point(int x0,int x1,int y0,int y1,int x){
198 y0&=0x7fff; /* mask off flag */
199 y1&=0x7fff;
200#if defined(CPU_COLDFIRE)
201 asm volatile ("sub.l %[x0],%[x];"
202 "sub.l %[y0],%[y1];"
203 "sub.l %[x0],%[x1];"
204 "muls.l %[y1],%[x];"
205 "divs.l %[x1],%[x];"
206 "add.l %[y0],%[x];"
207 : [x] "+d" (x), [x1] "+d" (x1), [y1] "+d" (y1)
208 : [x0] "r" (x0), [y0] "r" (y0) );
209 return x;
210#else
211 return y0+((y1-y0)*(x-x0))/(x1-x0);
212#endif
213}
214
215#ifdef _LOW_ACCURACY_
216# define XdB(n) ((((n)>>8)+1)>>1)
217#else
218# define XdB(n) (n)
219#endif
220
221/* keep the floor lookup table in fast IRAM */
222static const ogg_int32_t FLOOR_fromdB_LOOKUP[256] ICONST_ATTR = {
223 XdB(0x000000e5), XdB(0x000000f4), XdB(0x00000103), XdB(0x00000114),
224 XdB(0x00000126), XdB(0x00000139), XdB(0x0000014e), XdB(0x00000163),
225 XdB(0x0000017a), XdB(0x00000193), XdB(0x000001ad), XdB(0x000001c9),
226 XdB(0x000001e7), XdB(0x00000206), XdB(0x00000228), XdB(0x0000024c),
227 XdB(0x00000272), XdB(0x0000029b), XdB(0x000002c6), XdB(0x000002f4),
228 XdB(0x00000326), XdB(0x0000035a), XdB(0x00000392), XdB(0x000003cd),
229 XdB(0x0000040c), XdB(0x00000450), XdB(0x00000497), XdB(0x000004e4),
230 XdB(0x00000535), XdB(0x0000058c), XdB(0x000005e8), XdB(0x0000064a),
231 XdB(0x000006b3), XdB(0x00000722), XdB(0x00000799), XdB(0x00000818),
232 XdB(0x0000089e), XdB(0x0000092e), XdB(0x000009c6), XdB(0x00000a69),
233 XdB(0x00000b16), XdB(0x00000bcf), XdB(0x00000c93), XdB(0x00000d64),
234 XdB(0x00000e43), XdB(0x00000f30), XdB(0x0000102d), XdB(0x0000113a),
235 XdB(0x00001258), XdB(0x0000138a), XdB(0x000014cf), XdB(0x00001629),
236 XdB(0x0000179a), XdB(0x00001922), XdB(0x00001ac4), XdB(0x00001c82),
237 XdB(0x00001e5c), XdB(0x00002055), XdB(0x0000226f), XdB(0x000024ac),
238 XdB(0x0000270e), XdB(0x00002997), XdB(0x00002c4b), XdB(0x00002f2c),
239 XdB(0x0000323d), XdB(0x00003581), XdB(0x000038fb), XdB(0x00003caf),
240 XdB(0x000040a0), XdB(0x000044d3), XdB(0x0000494c), XdB(0x00004e10),
241 XdB(0x00005323), XdB(0x0000588a), XdB(0x00005e4b), XdB(0x0000646b),
242 XdB(0x00006af2), XdB(0x000071e5), XdB(0x0000794c), XdB(0x0000812e),
243 XdB(0x00008993), XdB(0x00009283), XdB(0x00009c09), XdB(0x0000a62d),
244 XdB(0x0000b0f9), XdB(0x0000bc79), XdB(0x0000c8b9), XdB(0x0000d5c4),
245 XdB(0x0000e3a9), XdB(0x0000f274), XdB(0x00010235), XdB(0x000112fd),
246 XdB(0x000124dc), XdB(0x000137e4), XdB(0x00014c29), XdB(0x000161bf),
247 XdB(0x000178bc), XdB(0x00019137), XdB(0x0001ab4a), XdB(0x0001c70e),
248 XdB(0x0001e4a1), XdB(0x0002041f), XdB(0x000225aa), XdB(0x00024962),
249 XdB(0x00026f6d), XdB(0x000297f0), XdB(0x0002c316), XdB(0x0002f109),
250 XdB(0x000321f9), XdB(0x00035616), XdB(0x00038d97), XdB(0x0003c8b4),
251 XdB(0x000407a7), XdB(0x00044ab2), XdB(0x00049218), XdB(0x0004de23),
252 XdB(0x00052f1e), XdB(0x0005855c), XdB(0x0005e135), XdB(0x00064306),
253 XdB(0x0006ab33), XdB(0x00071a24), XdB(0x0007904b), XdB(0x00080e20),
254 XdB(0x00089422), XdB(0x000922da), XdB(0x0009bad8), XdB(0x000a5cb6),
255 XdB(0x000b091a), XdB(0x000bc0b1), XdB(0x000c8436), XdB(0x000d5471),
256 XdB(0x000e3233), XdB(0x000f1e5f), XdB(0x001019e4), XdB(0x001125c1),
257 XdB(0x00124306), XdB(0x001372d5), XdB(0x0014b663), XdB(0x00160ef7),
258 XdB(0x00177df0), XdB(0x001904c1), XdB(0x001aa4f9), XdB(0x001c603d),
259 XdB(0x001e384f), XdB(0x00202f0f), XdB(0x0022467a), XdB(0x002480b1),
260 XdB(0x0026dff7), XdB(0x002966b3), XdB(0x002c1776), XdB(0x002ef4fc),
261 XdB(0x0032022d), XdB(0x00354222), XdB(0x0038b828), XdB(0x003c67c2),
262 XdB(0x004054ae), XdB(0x004482e8), XdB(0x0048f6af), XdB(0x004db488),
263 XdB(0x0052c142), XdB(0x005821ff), XdB(0x005ddc33), XdB(0x0063f5b0),
264 XdB(0x006a74a7), XdB(0x00715faf), XdB(0x0078bdce), XdB(0x0080967f),
265 XdB(0x0088f1ba), XdB(0x0091d7f9), XdB(0x009b5247), XdB(0x00a56a41),
266 XdB(0x00b02a27), XdB(0x00bb9ce2), XdB(0x00c7ce12), XdB(0x00d4ca17),
267 XdB(0x00e29e20), XdB(0x00f15835), XdB(0x0101074b), XdB(0x0111bb4e),
268 XdB(0x01238531), XdB(0x01367704), XdB(0x014aa402), XdB(0x016020a7),
269 XdB(0x017702c3), XdB(0x018f6190), XdB(0x01a955cb), XdB(0x01c4f9cf),
270 XdB(0x01e269a8), XdB(0x0201c33b), XdB(0x0223265a), XdB(0x0246b4ea),
271 XdB(0x026c9302), XdB(0x0294e716), XdB(0x02bfda13), XdB(0x02ed9793),
272 XdB(0x031e4e09), XdB(0x03522ee4), XdB(0x03896ed0), XdB(0x03c445e2),
273 XdB(0x0402efd6), XdB(0x0445ac4b), XdB(0x048cbefc), XdB(0x04d87013),
274 XdB(0x05290c67), XdB(0x057ee5ca), XdB(0x05da5364), XdB(0x063bb204),
275 XdB(0x06a36485), XdB(0x0711d42b), XdB(0x0787710e), XdB(0x0804b299),
276 XdB(0x088a17ef), XdB(0x0918287e), XdB(0x09af747c), XdB(0x0a50957e),
277 XdB(0x0afc2f19), XdB(0x0bb2ef7f), XdB(0x0c759034), XdB(0x0d44d6ca),
278 XdB(0x0e2195bc), XdB(0x0f0cad0d), XdB(0x10070b62), XdB(0x1111aeea),
279 XdB(0x122da66c), XdB(0x135c120f), XdB(0x149e24d9), XdB(0x15f525b1),
280 XdB(0x176270e3), XdB(0x18e7794b), XdB(0x1a85c9ae), XdB(0x1c3f06d1),
281 XdB(0x1e14f07d), XdB(0x200963d7), XdB(0x221e5ccd), XdB(0x2455f870),
282 XdB(0x26b2770b), XdB(0x29363e2b), XdB(0x2be3db5c), XdB(0x2ebe06b6),
283 XdB(0x31c7a55b), XdB(0x3503ccd4), XdB(0x3875c5aa), XdB(0x3c210f44),
284 XdB(0x4009632b), XdB(0x4432b8cf), XdB(0x48a149bc), XdB(0x4d59959e),
285 XdB(0x52606733), XdB(0x57bad899), XdB(0x5d6e593a), XdB(0x6380b298),
286 XdB(0x69f80e9a), XdB(0x70dafda8), XdB(0x78307d76), XdB(0x7fffffff),
287};
288
289static void render_line(int n, int x0,register int x1,int y0,int y1,ogg_int32_t *d){
290 int dy=y1-y0;
291 register int x=x0;
292 register int y=y0;
293 register int adx=x1-x0;
294 register int ady=abs(dy);
295 register int base=dy/adx;
296 register int sy=(dy<0?base-1:base+1);
297 int err=0;
298
299 if(n>x1)n=x1;
300 ady-=abs(base*adx);
301
302 if(x<n)
303 d[x]= MULT31_SHIFT15(d[x],FLOOR_fromdB_LOOKUP[y]);
304
305 while(++x<n){
306 err=err+ady;
307 if(err>=adx){
308 err-=adx;
309 y+=sy;
310 }else{
311 y+=base;
312 }
313 d[x]= MULT31_SHIFT15(d[x],FLOOR_fromdB_LOOKUP[y]);
314 }
315}
316
317static void *floor1_inverse1(vorbis_block *vb,vorbis_look_floor *in)
318 ICODE_ATTR_TREMOR_NOT_MDCT;
319static void *floor1_inverse1(vorbis_block *vb,vorbis_look_floor *in){
320 vorbis_look_floor1 *look=(vorbis_look_floor1 *)in;
321 vorbis_info_floor1 *info=look->vi;
322 codec_setup_info *ci=(codec_setup_info *)vb->vd->vi->codec_setup;
323 int i,j,k;
324 codebook *books=ci->fullbooks;
325
326 /* unpack wrapped/predicted values from stream */
327 if(oggpack_read(&vb->opb,1)==1){
328 int *fit_value=(int *)_vorbis_block_alloc(vb,(look->posts)*sizeof(*fit_value));
329 int ilg = ilog(look->quant_q-1);
330 fit_value[0]=oggpack_read(&vb->opb,ilg);
331 fit_value[1]=oggpack_read(&vb->opb,ilg);
332
333 /* partition by partition */
334 /* partition by partition */
335 for(i=0,j=2;i<info->partitions;i++){
336 int classv=info->partitionclass[i];
337 int cdim=info->class_dim[classv];
338 int csubbits=info->class_subs[classv];
339 int csub=1<<csubbits;
340 int cval=0;
341
342 /* decode the partition's first stage cascade value */
343 if(csubbits){
344 cval=vorbis_book_decode(books+info->class_book[classv],&vb->opb);
345
346 if(cval==-1)goto eop;
347 }
348
349 for(k=0;k<cdim;k++){
350 int book=info->class_subbook[classv][cval&(csub-1)];
351 cval>>=csubbits;
352 if(book>=0){
353 if((fit_value[j+k]=vorbis_book_decode(books+book,&vb->opb))==-1)
354 goto eop;
355 }else{
356 fit_value[j+k]=0;
357 }
358 }
359 j+=cdim;
360 }
361
362 /* unwrap positive values and reconsitute via linear interpolation */
363 for(i=2;i<look->posts;i++){
364 int predicted=render_point(info->postlist[look->loneighbor[i-2]],
365 info->postlist[look->hineighbor[i-2]],
366 fit_value[look->loneighbor[i-2]],
367 fit_value[look->hineighbor[i-2]],
368 info->postlist[i]);
369 int hiroom=look->quant_q-predicted;
370 int loroom=predicted;
371 int room=(hiroom<loroom?hiroom:loroom)<<1;
372 int val=fit_value[i];
373
374 if(val){
375 if(val>=room){
376 if(hiroom>loroom){
377 val = val-loroom;
378 }else{
379 val = -1-(val-hiroom);
380 }
381 }else{
382 if(val&1){
383 val= -((val+1)>>1);
384 }else{
385 val>>=1;
386 }
387 }
388
389 fit_value[i]=val+predicted;
390 fit_value[look->loneighbor[i-2]]&=0x7fff;
391 fit_value[look->hineighbor[i-2]]&=0x7fff;
392
393 }else{
394 fit_value[i]=predicted|0x8000;
395 }
396 }
397
398 return(fit_value);
399 }
400 eop:
401 return(NULL);
402}
403
404static int floor1_inverse2(vorbis_block *vb,vorbis_look_floor *in,void *memo,
405 ogg_int32_t *out) ICODE_ATTR_TREMOR_NOT_MDCT;
406static int floor1_inverse2(vorbis_block *vb,vorbis_look_floor *in,void *memo,
407 ogg_int32_t *out){
408 vorbis_look_floor1 *look=(vorbis_look_floor1 *)in;
409 vorbis_info_floor1 *info=look->vi;
410
411 codec_setup_info *ci=(codec_setup_info *)vb->vd->vi->codec_setup;
412 int n=ci->blocksizes[vb->W]/2;
413 int j;
414
415 if(memo){
416 /* render the lines */
417 int *fit_value=(int *)memo;
418 int hx=0;
419 int lx=0;
420 int ly=fit_value[0]*info->mult;
421 for(j=1;j<look->posts;j++){
422 int current=look->forward_index[j];
423 int hy=fit_value[current]&0x7fff;
424 if(hy==fit_value[current]){
425
426 hy*=info->mult;
427 hx=info->postlist[current];
428
429 render_line(n,lx,hx,ly,hy,out);
430
431 lx=hx;
432 ly=hy;
433 }
434 }
435 for(j=hx;j<n;j++)out[j]*=ly; /* be certain */
436 return(1);
437 }
438 memset(out,0,sizeof(*out)*n);
439 return(0);
440}
441
442/* export hooks */
443const vorbis_func_floor floor1_exportbundle ICONST_ATTR = {
444 &floor1_unpack,&floor1_look,&floor1_free_info,
445 &floor1_free_look,&floor1_inverse1,&floor1_inverse2
446};
447
diff --git a/apps/codecs/libtremor/framing.c b/apps/codecs/libtremor/framing.c
new file mode 100644
index 0000000000..fb26b02709
--- /dev/null
+++ b/apps/codecs/libtremor/framing.c
@@ -0,0 +1,1062 @@
1/********************************************************************
2 * *
3 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
4 * *
5 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
6 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
7 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
8 * *
9 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2003 *
10 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
11 * *
12 ********************************************************************
13
14 function: decode Ogg streams back into raw packets
15
16 note: The CRC code is directly derived from public domain code by
17 Ross Williams (ross@guest.adelaide.edu.au). See docs/framing.html
18 for details.
19
20 ********************************************************************/
21
22#include "config-tremor.h"
23#include <string.h>
24#include "ogg.h"
25#include "misc.h"
26
27
28/* A complete description of Ogg framing exists in docs/framing.html */
29
30/* basic, centralized Ogg memory management based on linked lists of
31 references to refcounted memory buffers. References and buffers
32 are both recycled. Buffers are passed around and consumed in
33 reference form. */
34
35static ogg_buffer_state *ogg_buffer_create(void){
36 ogg_buffer_state *bs=_ogg_calloc(1,sizeof(*bs));
37 return bs;
38}
39
40/* destruction is 'lazy'; there may be memory references outstanding,
41 and yanking the buffer state out from underneath would be
42 antisocial. Dealloc what is currently unused and have
43 _release_one watch for the stragglers to come in. When they do,
44 finish destruction. */
45
46/* call the helper while holding lock */
47static void _ogg_buffer_destroy(ogg_buffer_state *bs){
48 ogg_buffer *bt;
49 ogg_reference *rt;
50
51 if(bs->shutdown){
52
53 bt=bs->unused_buffers;
54 rt=bs->unused_references;
55
56 while(bt){
57 ogg_buffer *b=bt;
58 bt=b->ptr.next;
59 if(b->data)_ogg_free(b->data);
60 _ogg_free(b);
61 }
62 bs->unused_buffers=0;
63 while(rt){
64 ogg_reference *r=rt;
65 rt=r->next;
66 _ogg_free(r);
67 }
68 bs->unused_references=0;
69
70 if(!bs->outstanding)
71 _ogg_free(bs);
72
73 }
74}
75
76static void ogg_buffer_destroy(ogg_buffer_state *bs){
77 bs->shutdown=1;
78 _ogg_buffer_destroy(bs);
79}
80
81static ogg_buffer *_fetch_buffer(ogg_buffer_state *bs,long bytes){
82 ogg_buffer *ob;
83 bs->outstanding++;
84
85 /* do we have an unused buffer sitting in the pool? */
86 if(bs->unused_buffers){
87 ob=bs->unused_buffers;
88 bs->unused_buffers=ob->ptr.next;
89
90 /* if the unused buffer is too small, grow it */
91 if(ob->size<bytes){
92 ob->data=_ogg_realloc(ob->data,bytes);
93 ob->size=bytes;
94 }
95 }else{
96 /* allocate a new buffer */
97 ob=_ogg_malloc(sizeof(*ob));
98 ob->data=_ogg_malloc(bytes<16?16:bytes);
99 ob->size=bytes;
100 }
101
102 ob->refcount=1;
103 ob->ptr.owner=bs;
104 return ob;
105}
106
107static ogg_reference *_fetch_ref(ogg_buffer_state *bs)
108 ICODE_ATTR_TREMOR_NOT_MDCT;
109static ogg_reference *_fetch_ref(ogg_buffer_state *bs){
110 ogg_reference *or;
111 bs->outstanding++;
112
113 /* do we have an unused reference sitting in the pool? */
114 if(bs->unused_references){
115 or=bs->unused_references;
116 bs->unused_references=or->next;
117 }else{
118 /* allocate a new reference */
119 or=_ogg_malloc(sizeof(*or));
120 }
121
122 or->begin=0;
123 or->length=0;
124 or->next=0;
125 return or;
126}
127
128/* fetch a reference pointing to a fresh, initially continguous buffer
129 of at least [bytes] length */
130static ogg_reference *ogg_buffer_alloc(ogg_buffer_state *bs,long bytes){
131 ogg_buffer *ob=_fetch_buffer(bs,bytes);
132 ogg_reference *or=_fetch_ref(bs);
133 or->buffer=ob;
134 return or;
135}
136
137/* enlarge the data buffer in the current link */
138static void ogg_buffer_realloc(ogg_reference *or,long bytes){
139 ogg_buffer *ob=or->buffer;
140
141 /* if the unused buffer is too small, grow it */
142 if(ob->size<bytes){
143 ob->data=_ogg_realloc(ob->data,bytes);
144 ob->size=bytes;
145 }
146}
147
148static void _ogg_buffer_mark_one(ogg_reference *or){
149 or->buffer->refcount++;
150}
151
152/* increase the refcount of the buffers to which the reference points */
153static void ogg_buffer_mark(ogg_reference *or){
154 while(or){
155 _ogg_buffer_mark_one(or);
156 or=or->next;
157 }
158}
159
160/* duplicate a reference (pointing to the same actual buffer memory)
161 and increment buffer refcount. If the desired segment begins out
162 of range, NULL is returned; if the desired segment is simply zero
163 length, a zero length ref is returned. Partial range overlap
164 returns the overlap of the ranges */
165static ogg_reference *ogg_buffer_sub(ogg_reference *or,long begin,long length){
166 ogg_reference *ret=0,*head=0;
167
168 /* walk past any preceeding fragments we don't want */
169 while(or && begin>=or->length){
170 begin-=or->length;
171 or=or->next;
172 }
173
174 /* duplicate the reference chain; increment refcounts */
175 while(or && length){
176 ogg_reference *temp=_fetch_ref(or->buffer->ptr.owner);
177 if(head)
178 head->next=temp;
179 else
180 ret=temp;
181 head=temp;
182 head->buffer=or->buffer;
183 head->begin=or->begin+begin;
184 head->length=length;
185 if(head->length>or->length-begin)
186 head->length=or->length-begin;
187
188 begin=0;
189 length-=head->length;
190 or=or->next;
191 }
192
193 ogg_buffer_mark(ret);
194 return ret;
195}
196
197static ogg_reference *ogg_buffer_dup(ogg_reference *or){
198 ogg_reference *ret=0,*head=0;
199 /* duplicate the reference chain; increment refcounts */
200 while(or){
201 ogg_reference *temp=_fetch_ref(or->buffer->ptr.owner);
202 if(head)
203 head->next=temp;
204 else
205 ret=temp;
206 head=temp;
207 head->buffer=or->buffer;
208 head->begin=or->begin;
209 head->length=or->length;
210 or=or->next;
211 }
212
213 ogg_buffer_mark(ret);
214 return ret;
215}
216
217/* split a reference into two references; 'return' is a reference to
218 the buffer preceeding pos and 'head'/'tail' are the buffer past the
219 split. If pos is at or past the end of the passed in segment,
220 'head/tail' are NULL */
221static ogg_reference *ogg_buffer_split(ogg_reference **tail,
222 ogg_reference **head,long pos){
223
224 /* walk past any preceeding fragments to one of:
225 a) the exact boundary that seps two fragments
226 b) the fragment that needs split somewhere in the middle */
227 ogg_reference *ret=*tail;
228 ogg_reference *or=*tail;
229
230 while(or && pos>or->length){
231 pos-=or->length;
232 or=or->next;
233 }
234
235 if(!or || pos==0){
236
237 return 0;
238
239 }else{
240
241 if(pos>=or->length){
242 /* exact split, or off the end? */
243 if(or->next){
244
245 /* a split */
246 *tail=or->next;
247 or->next=0;
248
249 }else{
250
251 /* off or at the end */
252 *tail=*head=0;
253
254 }
255 }else{
256
257 /* split within a fragment */
258 long lengthA=pos;
259 long beginB=or->begin+pos;
260 long lengthB=or->length-pos;
261
262 /* make a new reference to tail the second piece */
263 *tail=_fetch_ref(or->buffer->ptr.owner);
264
265 (*tail)->buffer=or->buffer;
266 (*tail)->begin=beginB;
267 (*tail)->length=lengthB;
268 (*tail)->next=or->next;
269 _ogg_buffer_mark_one(*tail);
270 if(head && or==*head)*head=*tail;
271
272 /* update the first piece */
273 or->next=0;
274 or->length=lengthA;
275
276 }
277 }
278 return ret;
279}
280
281static void ogg_buffer_release_one(ogg_reference *or){
282 ogg_buffer *ob=or->buffer;
283 ogg_buffer_state *bs=ob->ptr.owner;
284
285 ob->refcount--;
286 if(ob->refcount==0){
287 bs->outstanding--; /* for the returned buffer */
288 ob->ptr.next=bs->unused_buffers;
289 bs->unused_buffers=ob;
290 }
291
292 bs->outstanding--; /* for the returned reference */
293 or->next=bs->unused_references;
294 bs->unused_references=or;
295
296 _ogg_buffer_destroy(bs); /* lazy cleanup (if needed) */
297
298}
299
300/* release the references, decrease the refcounts of buffers to which
301 they point, release any buffers with a refcount that drops to zero */
302static void ogg_buffer_release(ogg_reference *or){
303 while(or){
304 ogg_reference *next=or->next;
305 ogg_buffer_release_one(or);
306 or=next;
307 }
308}
309
310static ogg_reference *ogg_buffer_pretruncate(ogg_reference *or,long pos){
311 /* release preceeding fragments we don't want */
312 while(or && pos>=or->length){
313 ogg_reference *next=or->next;
314 pos-=or->length;
315 ogg_buffer_release_one(or);
316 or=next;
317 }
318 if (or) {
319 or->begin+=pos;
320 or->length-=pos;
321 }
322 return or;
323}
324
325static ogg_reference *ogg_buffer_walk(ogg_reference *or){
326 if(!or)return NULL;
327 while(or->next){
328 or=or->next;
329 }
330 return(or);
331}
332
333/* *head is appended to the front end (head) of *tail; both continue to
334 be valid pointers, with *tail at the tail and *head at the head */
335static ogg_reference *ogg_buffer_cat(ogg_reference *tail, ogg_reference *head){
336 if(!tail)return head;
337
338 while(tail->next){
339 tail=tail->next;
340 }
341 tail->next=head;
342 return ogg_buffer_walk(head);
343}
344
345static void _positionB(oggbyte_buffer *b,int pos){
346 if(pos<b->pos){
347 /* start at beginning, scan forward */
348 b->ref=b->baseref;
349 b->pos=0;
350 b->end=b->pos+b->ref->length;
351 b->ptr=b->ref->buffer->data+b->ref->begin;
352 }
353}
354
355static void _positionF(oggbyte_buffer *b,int pos){
356 /* scan forward for position */
357 while(pos>=b->end){
358 /* just seek forward */
359 b->pos+=b->ref->length;
360 b->ref=b->ref->next;
361 b->end=b->ref->length+b->pos;
362 b->ptr=b->ref->buffer->data+b->ref->begin;
363 }
364}
365
366static int oggbyte_init(oggbyte_buffer *b,ogg_reference *or){
367 memset(b,0,sizeof(*b));
368 if(or){
369 b->ref=b->baseref=or;
370 b->pos=0;
371 b->end=b->ref->length;
372 b->ptr=b->ref->buffer->data+b->ref->begin;
373 return 0;
374 }else
375 return -1;
376}
377
378static void oggbyte_set4(oggbyte_buffer *b,ogg_uint32_t val,int pos){
379 int i;
380 _positionB(b,pos);
381 for(i=0;i<4;i++){
382 _positionF(b,pos);
383 b->ptr[pos-b->pos]=val;
384 val>>=8;
385 ++pos;
386 }
387}
388
389static unsigned char oggbyte_read1(oggbyte_buffer *b,int pos){
390 _positionB(b,pos);
391 _positionF(b,pos);
392 return b->ptr[pos-b->pos];
393}
394
395static ogg_uint32_t oggbyte_read4(oggbyte_buffer *b,int pos){
396 ogg_uint32_t ret;
397 _positionB(b,pos);
398 _positionF(b,pos);
399 ret=b->ptr[pos-b->pos];
400 _positionF(b,++pos);
401 ret|=b->ptr[pos-b->pos]<<8;
402 _positionF(b,++pos);
403 ret|=b->ptr[pos-b->pos]<<16;
404 _positionF(b,++pos);
405 ret|=b->ptr[pos-b->pos]<<24;
406 return ret;
407}
408
409static ogg_int64_t oggbyte_read8(oggbyte_buffer *b,int pos){
410 ogg_int64_t ret;
411 unsigned char t[7];
412 int i;
413 _positionB(b,pos);
414 for(i=0;i<7;i++){
415 _positionF(b,pos);
416 t[i]=b->ptr[pos++ -b->pos];
417 }
418
419 _positionF(b,pos);
420 ret=b->ptr[pos-b->pos];
421
422 for(i=6;i>=0;--i)
423 ret= ret<<8 | t[i];
424
425 return ret;
426}
427
428/* Now we get to the actual framing code */
429
430int ogg_page_version(ogg_page *og){
431 oggbyte_buffer ob;
432 oggbyte_init(&ob,og->header);
433 return oggbyte_read1(&ob,4);
434}
435
436int ogg_page_continued(ogg_page *og){
437 oggbyte_buffer ob;
438 oggbyte_init(&ob,og->header);
439 return oggbyte_read1(&ob,5)&0x01;
440}
441
442int ogg_page_bos(ogg_page *og){
443 oggbyte_buffer ob;
444 oggbyte_init(&ob,og->header);
445 return oggbyte_read1(&ob,5)&0x02;
446}
447
448int ogg_page_eos(ogg_page *og){
449 oggbyte_buffer ob;
450 oggbyte_init(&ob,og->header);
451 return oggbyte_read1(&ob,5)&0x04;
452}
453
454ogg_int64_t ogg_page_granulepos(ogg_page *og){
455 oggbyte_buffer ob;
456 oggbyte_init(&ob,og->header);
457 return oggbyte_read8(&ob,6);
458}
459
460ogg_uint32_t ogg_page_serialno(ogg_page *og){
461 oggbyte_buffer ob;
462 oggbyte_init(&ob,og->header);
463 return oggbyte_read4(&ob,14);
464}
465
466ogg_uint32_t ogg_page_pageno(ogg_page *og){
467 oggbyte_buffer ob;
468 oggbyte_init(&ob,og->header);
469 return oggbyte_read4(&ob,18);
470}
471
472/* Static CRC calculation table. See older code in CVS for dead
473 run-time initialization code. */
474
475static const ogg_uint32_t crc_lookup[256] ICONST_ATTR = {
476 0x00000000,0x04c11db7,0x09823b6e,0x0d4326d9,
477 0x130476dc,0x17c56b6b,0x1a864db2,0x1e475005,
478 0x2608edb8,0x22c9f00f,0x2f8ad6d6,0x2b4bcb61,
479 0x350c9b64,0x31cd86d3,0x3c8ea00a,0x384fbdbd,
480 0x4c11db70,0x48d0c6c7,0x4593e01e,0x4152fda9,
481 0x5f15adac,0x5bd4b01b,0x569796c2,0x52568b75,
482 0x6a1936c8,0x6ed82b7f,0x639b0da6,0x675a1011,
483 0x791d4014,0x7ddc5da3,0x709f7b7a,0x745e66cd,
484 0x9823b6e0,0x9ce2ab57,0x91a18d8e,0x95609039,
485 0x8b27c03c,0x8fe6dd8b,0x82a5fb52,0x8664e6e5,
486 0xbe2b5b58,0xbaea46ef,0xb7a96036,0xb3687d81,
487 0xad2f2d84,0xa9ee3033,0xa4ad16ea,0xa06c0b5d,
488 0xd4326d90,0xd0f37027,0xddb056fe,0xd9714b49,
489 0xc7361b4c,0xc3f706fb,0xceb42022,0xca753d95,
490 0xf23a8028,0xf6fb9d9f,0xfbb8bb46,0xff79a6f1,
491 0xe13ef6f4,0xe5ffeb43,0xe8bccd9a,0xec7dd02d,
492 0x34867077,0x30476dc0,0x3d044b19,0x39c556ae,
493 0x278206ab,0x23431b1c,0x2e003dc5,0x2ac12072,
494 0x128e9dcf,0x164f8078,0x1b0ca6a1,0x1fcdbb16,
495 0x018aeb13,0x054bf6a4,0x0808d07d,0x0cc9cdca,
496 0x7897ab07,0x7c56b6b0,0x71159069,0x75d48dde,
497 0x6b93dddb,0x6f52c06c,0x6211e6b5,0x66d0fb02,
498 0x5e9f46bf,0x5a5e5b08,0x571d7dd1,0x53dc6066,
499 0x4d9b3063,0x495a2dd4,0x44190b0d,0x40d816ba,
500 0xaca5c697,0xa864db20,0xa527fdf9,0xa1e6e04e,
501 0xbfa1b04b,0xbb60adfc,0xb6238b25,0xb2e29692,
502 0x8aad2b2f,0x8e6c3698,0x832f1041,0x87ee0df6,
503 0x99a95df3,0x9d684044,0x902b669d,0x94ea7b2a,
504 0xe0b41de7,0xe4750050,0xe9362689,0xedf73b3e,
505 0xf3b06b3b,0xf771768c,0xfa325055,0xfef34de2,
506 0xc6bcf05f,0xc27dede8,0xcf3ecb31,0xcbffd686,
507 0xd5b88683,0xd1799b34,0xdc3abded,0xd8fba05a,
508 0x690ce0ee,0x6dcdfd59,0x608edb80,0x644fc637,
509 0x7a089632,0x7ec98b85,0x738aad5c,0x774bb0eb,
510 0x4f040d56,0x4bc510e1,0x46863638,0x42472b8f,
511 0x5c007b8a,0x58c1663d,0x558240e4,0x51435d53,
512 0x251d3b9e,0x21dc2629,0x2c9f00f0,0x285e1d47,
513 0x36194d42,0x32d850f5,0x3f9b762c,0x3b5a6b9b,
514 0x0315d626,0x07d4cb91,0x0a97ed48,0x0e56f0ff,
515 0x1011a0fa,0x14d0bd4d,0x19939b94,0x1d528623,
516 0xf12f560e,0xf5ee4bb9,0xf8ad6d60,0xfc6c70d7,
517 0xe22b20d2,0xe6ea3d65,0xeba91bbc,0xef68060b,
518 0xd727bbb6,0xd3e6a601,0xdea580d8,0xda649d6f,
519 0xc423cd6a,0xc0e2d0dd,0xcda1f604,0xc960ebb3,
520 0xbd3e8d7e,0xb9ff90c9,0xb4bcb610,0xb07daba7,
521 0xae3afba2,0xaafbe615,0xa7b8c0cc,0xa379dd7b,
522 0x9b3660c6,0x9ff77d71,0x92b45ba8,0x9675461f,
523 0x8832161a,0x8cf30bad,0x81b02d74,0x857130c3,
524 0x5d8a9099,0x594b8d2e,0x5408abf7,0x50c9b640,
525 0x4e8ee645,0x4a4ffbf2,0x470cdd2b,0x43cdc09c,
526 0x7b827d21,0x7f436096,0x7200464f,0x76c15bf8,
527 0x68860bfd,0x6c47164a,0x61043093,0x65c52d24,
528 0x119b4be9,0x155a565e,0x18197087,0x1cd86d30,
529 0x029f3d35,0x065e2082,0x0b1d065b,0x0fdc1bec,
530 0x3793a651,0x3352bbe6,0x3e119d3f,0x3ad08088,
531 0x2497d08d,0x2056cd3a,0x2d15ebe3,0x29d4f654,
532 0xc5a92679,0xc1683bce,0xcc2b1d17,0xc8ea00a0,
533 0xd6ad50a5,0xd26c4d12,0xdf2f6bcb,0xdbee767c,
534 0xe3a1cbc1,0xe760d676,0xea23f0af,0xeee2ed18,
535 0xf0a5bd1d,0xf464a0aa,0xf9278673,0xfde69bc4,
536 0x89b8fd09,0x8d79e0be,0x803ac667,0x84fbdbd0,
537 0x9abc8bd5,0x9e7d9662,0x933eb0bb,0x97ffad0c,
538 0xafb010b1,0xab710d06,0xa6322bdf,0xa2f33668,
539 0xbcb4666d,0xb8757bda,0xb5365d03,0xb1f740b4};
540
541ogg_sync_state *ogg_sync_create(void){
542 ogg_sync_state *oy=_ogg_calloc(1,sizeof(*oy));
543 memset(oy,0,sizeof(*oy));
544 oy->bufferpool=ogg_buffer_create();
545 return oy;
546}
547
548int ogg_sync_destroy(ogg_sync_state *oy){
549 if(oy){
550 ogg_sync_reset(oy);
551 ogg_buffer_destroy(oy->bufferpool);
552 memset(oy,0,sizeof(*oy));
553 _ogg_free(oy);
554 }
555 return OGG_SUCCESS;
556}
557
558unsigned char *ogg_sync_bufferin(ogg_sync_state *oy, long bytes){
559
560 /* [allocate and] expose a buffer for data submission.
561
562 If there is no head fragment
563 allocate one and expose it
564 else
565 if the current head fragment has sufficient unused space
566 expose it
567 else
568 if the current head fragment is unused
569 resize and expose it
570 else
571 allocate new fragment and expose it
572 */
573
574 /* base case; fifo uninitialized */
575 if(!oy->fifo_head){
576 oy->fifo_head=oy->fifo_tail=ogg_buffer_alloc(oy->bufferpool,bytes);
577 return oy->fifo_head->buffer->data;
578 }
579
580 /* space left in current fragment case */
581 if(oy->fifo_head->buffer->size-
582 oy->fifo_head->length-
583 oy->fifo_head->begin >= bytes)
584 return oy->fifo_head->buffer->data+
585 oy->fifo_head->length+oy->fifo_head->begin;
586
587 /* current fragment is unused, but too small */
588 if(!oy->fifo_head->length){
589 ogg_buffer_realloc(oy->fifo_head,bytes);
590 return oy->fifo_head->buffer->data+oy->fifo_head->begin;
591 }
592
593 /* current fragment used/full; get new fragment */
594 {
595 ogg_reference *new=ogg_buffer_alloc(oy->bufferpool,bytes);
596 oy->fifo_head->next=new;
597 oy->fifo_head=new;
598 }
599 return oy->fifo_head->buffer->data;
600}
601
602int ogg_sync_wrote(ogg_sync_state *oy, long bytes){
603 if(!oy->fifo_head)return OGG_EINVAL;
604 if(oy->fifo_head->buffer->size-oy->fifo_head->length-oy->fifo_head->begin <
605 bytes)return OGG_EINVAL;
606 oy->fifo_head->length+=bytes;
607 oy->fifo_fill+=bytes;
608 return OGG_SUCCESS;
609}
610
611static ogg_uint32_t _checksum(ogg_reference *or, int bytes){
612 ogg_uint32_t crc_reg=0;
613 int j,post;
614
615 while(or){
616 unsigned char *data=or->buffer->data+or->begin;
617 post=(bytes<or->length?bytes:or->length);
618 for(j=0;j<post;++j)
619 crc_reg=(crc_reg<<8)^crc_lookup[((crc_reg >> 24)&0xff)^data[j]];
620 bytes-=j;
621 or=or->next;
622 }
623
624 return crc_reg;
625}
626
627
628/* sync the stream. This is meant to be useful for finding page
629 boundaries.
630
631 return values for this:
632 -n) skipped n bytes
633 0) page not ready; more data (no bytes skipped)
634 n) page synced at current location; page length n bytes
635
636*/
637
638long ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og){
639 oggbyte_buffer page;
640 long bytes,ret=0;
641
642 ogg_page_release(og);
643
644 bytes=oy->fifo_fill;
645 oggbyte_init(&page,oy->fifo_tail);
646
647 if(oy->headerbytes==0){
648 if(bytes<27)goto sync_out; /* not enough for even a minimal header */
649
650 /* verify capture pattern */
651 if(oggbyte_read1(&page,0)!=(int)'O' ||
652 oggbyte_read1(&page,1)!=(int)'g' ||
653 oggbyte_read1(&page,2)!=(int)'g' ||
654 oggbyte_read1(&page,3)!=(int)'S' ) goto sync_fail;
655
656 oy->headerbytes=oggbyte_read1(&page,26)+27;
657 }
658 if(bytes<oy->headerbytes)goto sync_out; /* not enough for header +
659 seg table */
660 if(oy->bodybytes==0){
661 int i;
662 /* count up body length in the segment table */
663 for(i=0;i<oy->headerbytes-27;i++)
664 oy->bodybytes+=oggbyte_read1(&page,27+i);
665 }
666
667 if(oy->bodybytes+oy->headerbytes>bytes)goto sync_out;
668
669 /* we have what appears to be a complete page; last test: verify
670 checksum */
671 {
672 ogg_uint32_t chksum=oggbyte_read4(&page,22);
673 oggbyte_set4(&page,0,22);
674
675 /* Compare checksums; memory continues to be common access */
676 if(chksum!=_checksum(oy->fifo_tail,oy->bodybytes+oy->headerbytes)){
677
678 /* D'oh. Mismatch! Corrupt page (or miscapture and not a page
679 at all). replace the computed checksum with the one actually
680 read in; remember all the memory is common access */
681
682 oggbyte_set4(&page,chksum,22);
683 goto sync_fail;
684 }
685 oggbyte_set4(&page,chksum,22);
686 }
687
688 /* We have a page. Set up page return. */
689 if(og){
690 /* set up page output */
691 og->header=ogg_buffer_split(&oy->fifo_tail,&oy->fifo_head,oy->headerbytes);
692 og->header_len=oy->headerbytes;
693 og->body=ogg_buffer_split(&oy->fifo_tail,&oy->fifo_head,oy->bodybytes);
694 og->body_len=oy->bodybytes;
695 }else{
696 /* simply advance */
697 oy->fifo_tail=
698 ogg_buffer_pretruncate(oy->fifo_tail,oy->headerbytes+oy->bodybytes);
699 if(!oy->fifo_tail)oy->fifo_head=0;
700 }
701
702 ret=oy->headerbytes+oy->bodybytes;
703 oy->unsynced=0;
704 oy->headerbytes=0;
705 oy->bodybytes=0;
706 oy->fifo_fill-=ret;
707
708 return ret;
709
710 sync_fail:
711
712 oy->headerbytes=0;
713 oy->bodybytes=0;
714 oy->fifo_tail=ogg_buffer_pretruncate(oy->fifo_tail,1);
715 ret--;
716
717 /* search forward through fragments for possible capture */
718 while(oy->fifo_tail){
719 /* invariant: fifo_cursor points to a position in fifo_tail */
720 unsigned char *now=oy->fifo_tail->buffer->data+oy->fifo_tail->begin;
721 unsigned char *next=memchr(now, 'O', oy->fifo_tail->length);
722
723 if(next){
724 /* possible capture in this segment */
725 long bytes=next-now;
726 oy->fifo_tail=ogg_buffer_pretruncate(oy->fifo_tail,bytes);
727 ret-=bytes;
728 break;
729 }else{
730 /* no capture. advance to next segment */
731 long bytes=oy->fifo_tail->length;
732 ret-=bytes;
733 oy->fifo_tail=ogg_buffer_pretruncate(oy->fifo_tail,bytes);
734 }
735 }
736 if(!oy->fifo_tail)oy->fifo_head=0;
737 oy->fifo_fill+=ret;
738
739 sync_out:
740 return ret;
741}
742
743/* clear things to an initial state. Good to call, eg, before seeking */
744int ogg_sync_reset(ogg_sync_state *oy){
745
746 ogg_buffer_release(oy->fifo_tail);
747 oy->fifo_tail=0;
748 oy->fifo_head=0;
749 oy->fifo_fill=0;
750
751 oy->unsynced=0;
752 oy->headerbytes=0;
753 oy->bodybytes=0;
754 return OGG_SUCCESS;
755}
756
757ogg_stream_state *ogg_stream_create(int serialno){
758 ogg_stream_state *os=_ogg_calloc(1,sizeof(*os));
759 os->serialno=serialno;
760 os->pageno=-1;
761 return os;
762}
763
764int ogg_stream_destroy(ogg_stream_state *os){
765 if(os){
766 ogg_buffer_release(os->header_tail);
767 ogg_buffer_release(os->body_tail);
768 memset(os,0,sizeof(*os));
769 _ogg_free(os);
770 }
771 return OGG_SUCCESS;
772}
773
774
775#define FINFLAG 0x80000000UL
776#define FINMASK 0x7fffffffUL
777
778static void _next_lace(oggbyte_buffer *ob,ogg_stream_state *os){
779 /* search ahead one lace */
780 os->body_fill_next=0;
781 while(os->laceptr<os->lacing_fill){
782 int val=oggbyte_read1(ob,27+os->laceptr++);
783 os->body_fill_next+=val;
784 if(val<255){
785 os->body_fill_next|=FINFLAG;
786 os->clearflag=1;
787 break;
788 }
789 }
790}
791
792static void _span_queued_page(ogg_stream_state *os) ICODE_ATTR_TREMOR_NOT_MDCT;
793static void _span_queued_page(ogg_stream_state *os){
794 while( !(os->body_fill&FINFLAG) ){
795
796 if(!os->header_tail)break;
797
798 /* first flush out preceeding page header (if any). Body is
799 flushed as it's consumed, so that's not done here. */
800
801 if(os->lacing_fill>=0)
802 os->header_tail=ogg_buffer_pretruncate(os->header_tail,
803 os->lacing_fill+27);
804 os->lacing_fill=0;
805 os->laceptr=0;
806 os->clearflag=0;
807
808 if(!os->header_tail){
809 os->header_head=0;
810 break;
811 }else{
812
813 /* process/prepare next page, if any */
814
815 long pageno;
816 oggbyte_buffer ob;
817 ogg_page og; /* only for parsing header values */
818 og.header=os->header_tail; /* only for parsing header values */
819 pageno=ogg_page_pageno(&og);
820
821 oggbyte_init(&ob,os->header_tail);
822 os->lacing_fill=oggbyte_read1(&ob,26);
823
824 /* are we in sequence? */
825 if(pageno!=os->pageno){
826 if(os->pageno==-1) /* indicates seek or reset */
827 os->holeflag=1; /* set for internal use */
828 else
829 os->holeflag=2; /* set for external reporting */
830
831 os->body_tail=ogg_buffer_pretruncate(os->body_tail,
832 os->body_fill);
833 if(os->body_tail==0)os->body_head=0;
834 os->body_fill=0;
835
836 }
837
838 if(ogg_page_continued(&og)){
839 if(os->body_fill==0){
840 /* continued packet, but no preceeding data to continue */
841 /* dump the first partial packet on the page */
842 _next_lace(&ob,os);
843 os->body_tail=
844 ogg_buffer_pretruncate(os->body_tail,os->body_fill_next&FINMASK);
845 if(os->body_tail==0)os->body_head=0;
846 /* set span flag */
847 if(!os->spanflag && !os->holeflag)os->spanflag=2;
848 }
849 }else{
850 if(os->body_fill>0){
851 /* preceeding data to continue, but not a continued page */
852 /* dump body_fill */
853 os->body_tail=ogg_buffer_pretruncate(os->body_tail,
854 os->body_fill);
855 if(os->body_tail==0)os->body_head=0;
856 os->body_fill=0;
857
858 /* set espan flag */
859 if(!os->spanflag && !os->holeflag)os->spanflag=2;
860 }
861 }
862
863 if(os->laceptr<os->lacing_fill){
864 os->granulepos=ogg_page_granulepos(&og);
865
866 /* get current packet size & flag */
867 _next_lace(&ob,os);
868 os->body_fill+=os->body_fill_next; /* addition handles the flag fine;
869 unsigned on purpose */
870 /* ...and next packet size & flag */
871 _next_lace(&ob,os);
872
873 }
874
875 os->pageno=pageno+1;
876 os->e_o_s=ogg_page_eos(&og);
877 os->b_o_s=ogg_page_bos(&og);
878
879 }
880 }
881}
882
883/* add the incoming page to the stream state; we decompose the page
884 into packet segments here as well. */
885
886int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og){
887
888 int serialno=ogg_page_serialno(og);
889 int version=ogg_page_version(og);
890
891 /* check the serial number */
892 if(serialno!=os->serialno){
893 ogg_page_release(og);
894 return OGG_ESERIAL;
895 }
896 if(version>0){
897 ogg_page_release(og);
898 return OGG_EVERSION;
899 }
900
901 /* add to fifos */
902 if(!os->body_tail){
903 os->body_tail=og->body;
904 os->body_head=ogg_buffer_walk(og->body);
905 }else{
906 os->body_head=ogg_buffer_cat(os->body_head,og->body);
907 }
908 if(!os->header_tail){
909 os->header_tail=og->header;
910 os->header_head=ogg_buffer_walk(og->header);
911 os->lacing_fill=-27;
912 }else{
913 os->header_head=ogg_buffer_cat(os->header_head,og->header);
914 }
915
916 memset(og,0,sizeof(*og));
917 return OGG_SUCCESS;
918}
919
920int ogg_stream_reset(ogg_stream_state *os){
921
922 ogg_buffer_release(os->header_tail);
923 ogg_buffer_release(os->body_tail);
924 os->header_tail=os->header_head=0;
925 os->body_tail=os->body_head=0;
926
927 os->e_o_s=0;
928 os->b_o_s=0;
929 os->pageno=-1;
930 os->packetno=0;
931 os->granulepos=0;
932
933 os->body_fill=0;
934 os->lacing_fill=0;
935
936 os->holeflag=0;
937 os->spanflag=0;
938 os->clearflag=0;
939 os->laceptr=0;
940 os->body_fill_next=0;
941
942 return OGG_SUCCESS;
943}
944
945int ogg_stream_reset_serialno(ogg_stream_state *os,int serialno){
946 ogg_stream_reset(os);
947 os->serialno=serialno;
948 return OGG_SUCCESS;
949}
950
951static int _packetout(ogg_stream_state *os,ogg_packet *op,int adv)
952 ICODE_ATTR_TREMOR_NOT_MDCT;
953static int _packetout(ogg_stream_state *os,ogg_packet *op,int adv){
954
955 ogg_packet_release(op);
956 _span_queued_page(os);
957
958 if(os->holeflag){
959 int temp=os->holeflag;
960 if(os->clearflag)
961 os->holeflag=0;
962 else
963 os->holeflag=1;
964 if(temp==2){
965 os->packetno++;
966 return OGG_HOLE;
967 }
968 }
969 if(os->spanflag){
970 int temp=os->spanflag;
971 if(os->clearflag)
972 os->spanflag=0;
973 else
974 os->spanflag=1;
975 if(temp==2){
976 os->packetno++;
977 return OGG_SPAN;
978 }
979 }
980
981 if(!(os->body_fill&FINFLAG)) return 0;
982 if(!op && !adv)return 1; /* just using peek as an inexpensive way
983 to ask if there's a whole packet
984 waiting */
985 if(op){
986 op->b_o_s=os->b_o_s;
987 if(os->e_o_s && os->body_fill_next==0)
988 op->e_o_s=os->e_o_s;
989 else
990 op->e_o_s=0;
991 if( (os->body_fill&FINFLAG) && !(os->body_fill_next&FINFLAG) )
992 op->granulepos=os->granulepos;
993 else
994 op->granulepos=-1;
995 op->packetno=os->packetno;
996 }
997
998 if(adv){
999 oggbyte_buffer ob;
1000 oggbyte_init(&ob,os->header_tail);
1001
1002 /* split the body contents off */
1003 if(op){
1004 op->packet=ogg_buffer_split(&os->body_tail,&os->body_head,
1005 os->body_fill&FINMASK);
1006 op->bytes=os->body_fill&FINMASK;
1007 }else{
1008 os->body_tail=ogg_buffer_pretruncate(os->body_tail,
1009 os->body_fill&FINMASK);
1010 if(os->body_tail==0)os->body_head=0;
1011 }
1012
1013 /* update lacing pointers */
1014 os->body_fill=os->body_fill_next;
1015 _next_lace(&ob,os);
1016 }else{
1017 if(op){
1018 op->packet=ogg_buffer_sub(os->body_tail,0,os->body_fill&FINMASK);
1019 op->bytes=os->body_fill&FINMASK;
1020 }
1021 }
1022
1023 if(adv){
1024 os->packetno++;
1025 os->b_o_s=0;
1026 }
1027
1028 return 1;
1029}
1030
1031int ogg_stream_packetout(ogg_stream_state *os,ogg_packet *op){
1032 return _packetout(os,op,1);
1033}
1034
1035int ogg_stream_packetpeek(ogg_stream_state *os,ogg_packet *op){
1036 return _packetout(os,op,0);
1037}
1038
1039int ogg_packet_release(ogg_packet *op) {
1040 if(op){
1041 ogg_buffer_release(op->packet);
1042 memset(op, 0, sizeof(*op));
1043 }
1044 return OGG_SUCCESS;
1045}
1046
1047int ogg_page_release(ogg_page *og) {
1048 if(og){
1049 ogg_buffer_release(og->header);
1050 ogg_buffer_release(og->body);
1051 memset(og, 0, sizeof(*og));
1052 }
1053 return OGG_SUCCESS;
1054}
1055
1056void ogg_page_dup(ogg_page *dup,ogg_page *orig){
1057 dup->header_len=orig->header_len;
1058 dup->body_len=orig->body_len;
1059 dup->header=ogg_buffer_dup(orig->header);
1060 dup->body=ogg_buffer_dup(orig->body);
1061}
1062
diff --git a/apps/codecs/libtremor/info.c b/apps/codecs/libtremor/info.c
new file mode 100644
index 0000000000..c0bd0ae990
--- /dev/null
+++ b/apps/codecs/libtremor/info.c
@@ -0,0 +1,309 @@
1/********************************************************************
2 * *
3 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
4 * *
5 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
6 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
7 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
8 * *
9 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2003 *
10 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
11 * *
12 ********************************************************************
13
14 function: maintain the info structure, info <-> header packets
15
16 ********************************************************************/
17
18/* general handling of the header and the vorbis_info structure (and
19 substructures) */
20
21#include "config-tremor.h"
22#include <string.h>
23#include <ctype.h>
24#include "ogg.h"
25#include "ivorbiscodec.h"
26#include "codec_internal.h"
27#include "codebook.h"
28#include "registry.h"
29#include "window.h"
30#include "misc.h"
31#include "os.h"
32
33/* helpers */
34static void _v_readstring(oggpack_buffer *o,char *buf,int bytes){
35 while(bytes--){
36 *buf++=oggpack_read(o,8);
37 }
38}
39
40void vorbis_comment_init(vorbis_comment *vc){
41 memset(vc,0,sizeof(*vc));
42}
43
44void vorbis_comment_clear(vorbis_comment *vc){
45 if(vc){
46 long i;
47 for(i=0;i<vc->comments;i++)
48 if(vc->user_comments[i])_ogg_free(vc->user_comments[i]);
49 if(vc->user_comments)_ogg_free(vc->user_comments);
50 if(vc->comment_lengths)_ogg_free(vc->comment_lengths);
51 if(vc->vendor)_ogg_free(vc->vendor);
52 memset(vc,0,sizeof(*vc));
53 }
54}
55
56/* blocksize 0 is guaranteed to be short, 1 is guarantted to be long.
57 They may be equal, but short will never ge greater than long */
58int vorbis_info_blocksize(vorbis_info *vi,int zo){
59 codec_setup_info *ci = (codec_setup_info *)vi->codec_setup;
60 return ci ? ci->blocksizes[zo] : -1;
61}
62
63/* used by synthesis, which has a full, alloced vi */
64void vorbis_info_init(vorbis_info *vi){
65 memset(vi,0,sizeof(*vi));
66 vi->codec_setup=(codec_setup_info *)_ogg_calloc(1,sizeof(codec_setup_info));
67}
68
69void vorbis_info_clear(vorbis_info *vi){
70 codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
71 int i;
72
73 if(ci){
74
75 for(i=0;i<ci->modes;i++)
76 if(ci->mode_param[i])_ogg_free(ci->mode_param[i]);
77
78 for(i=0;i<ci->maps;i++) /* unpack does the range checking */
79 if(ci->map_param[i])
80 _mapping_P[ci->map_type[i]]->free_info(ci->map_param[i]);
81
82 for(i=0;i<ci->floors;i++) /* unpack does the range checking */
83 if(ci->floor_param[i])
84 _floor_P[ci->floor_type[i]]->free_info(ci->floor_param[i]);
85
86 for(i=0;i<ci->residues;i++) /* unpack does the range checking */
87 if(ci->residue_param[i])
88 _residue_P[ci->residue_type[i]]->free_info(ci->residue_param[i]);
89
90 for(i=0;i<ci->books;i++){
91 if(ci->book_param[i]){
92 /* knows if the book was not alloced */
93 vorbis_staticbook_destroy(ci->book_param[i]);
94 }
95 if(ci->fullbooks)
96 vorbis_book_clear(ci->fullbooks+i);
97 }
98 if(ci->fullbooks)
99 _ogg_free(ci->fullbooks);
100
101 _ogg_free(ci);
102 }
103
104 memset(vi,0,sizeof(*vi));
105}
106
107/* Header packing/unpacking ********************************************/
108
109static int _vorbis_unpack_info(vorbis_info *vi,oggpack_buffer *opb){
110 codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
111 if(!ci)return(OV_EFAULT);
112
113 vi->version=oggpack_read(opb,32);
114 if(vi->version!=0)return(OV_EVERSION);
115
116 vi->channels=oggpack_read(opb,8);
117 vi->rate=oggpack_read(opb,32);
118
119 vi->bitrate_upper=oggpack_read(opb,32);
120 vi->bitrate_nominal=oggpack_read(opb,32);
121 vi->bitrate_lower=oggpack_read(opb,32);
122
123 ci->blocksizes[0]=1<<oggpack_read(opb,4);
124 ci->blocksizes[1]=1<<oggpack_read(opb,4);
125
126 if(vi->rate<1)goto err_out;
127 if(vi->channels<1)goto err_out;
128 if(ci->blocksizes[0]<64)goto err_out;
129 if(ci->blocksizes[1]<ci->blocksizes[0])goto err_out;
130 if(ci->blocksizes[1]>8192)goto err_out;
131
132 if(oggpack_read(opb,1)!=1)goto err_out; /* EOP check */
133
134 return(0);
135 err_out:
136 vorbis_info_clear(vi);
137 return(OV_EBADHEADER);
138}
139
140static int _vorbis_unpack_comment(vorbis_comment *vc,oggpack_buffer *opb){
141 int i;
142 int vendorlen=oggpack_read(opb,32);
143 if(vendorlen<0)goto err_out;
144 vc->vendor=(char *)_ogg_calloc(vendorlen+1,1);
145 _v_readstring(opb,vc->vendor,vendorlen);
146 vc->comments=oggpack_read(opb,32);
147 if(vc->comments<0)goto err_out;
148 vc->user_comments=(char **)_ogg_calloc(vc->comments+1,sizeof(*vc->user_comments));
149 vc->comment_lengths=(int *)_ogg_calloc(vc->comments+1, sizeof(*vc->comment_lengths));
150
151 for(i=0;i<vc->comments;i++){
152 int len=oggpack_read(opb,32);
153 if(len<0)goto err_out;
154 vc->comment_lengths[i]=len;
155 vc->user_comments[i]=(char *)_ogg_calloc(len+1,1);
156 _v_readstring(opb,vc->user_comments[i],len);
157 }
158 if(oggpack_read(opb,1)!=1)goto err_out; /* EOP check */
159
160 return(0);
161 err_out:
162 vorbis_comment_clear(vc);
163 return(OV_EBADHEADER);
164}
165
166/* all of the real encoding details are here. The modes, books,
167 everything */
168static int _vorbis_unpack_books(vorbis_info *vi,oggpack_buffer *opb){
169 codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
170 int i;
171 if(!ci)return(OV_EFAULT);
172
173 /* codebooks */
174 ci->books=oggpack_read(opb,8)+1;
175 /*ci->book_param=_ogg_calloc(ci->books,sizeof(*ci->book_param));*/
176 for(i=0;i<ci->books;i++){
177 ci->book_param[i]=(static_codebook *)_ogg_calloc(1,sizeof(*ci->book_param[i]));
178 if(vorbis_staticbook_unpack(opb,ci->book_param[i]))goto err_out;
179 }
180
181 /* time backend settings */
182 ci->times=oggpack_read(opb,6)+1;
183 /*ci->time_type=_ogg_malloc(ci->times*sizeof(*ci->time_type));*/
184 /*ci->time_param=_ogg_calloc(ci->times,sizeof(void *));*/
185 for(i=0;i<ci->times;i++){
186 ci->time_type[i]=oggpack_read(opb,16);
187 if(ci->time_type[i]<0 || ci->time_type[i]>=VI_TIMEB)goto err_out;
188 /* ci->time_param[i]=_time_P[ci->time_type[i]]->unpack(vi,opb);
189 Vorbis I has no time backend */
190 /*if(!ci->time_param[i])goto err_out;*/
191 }
192
193 /* floor backend settings */
194 ci->floors=oggpack_read(opb,6)+1;
195 /*ci->floor_type=_ogg_malloc(ci->floors*sizeof(*ci->floor_type));*/
196 /*ci->floor_param=_ogg_calloc(ci->floors,sizeof(void *));*/
197 for(i=0;i<ci->floors;i++){
198 ci->floor_type[i]=oggpack_read(opb,16);
199 if(ci->floor_type[i]<0 || ci->floor_type[i]>=VI_FLOORB)goto err_out;
200 ci->floor_param[i]=_floor_P[ci->floor_type[i]]->unpack(vi,opb);
201 if(!ci->floor_param[i])goto err_out;
202 }
203
204 /* residue backend settings */
205 ci->residues=oggpack_read(opb,6)+1;
206 /*ci->residue_type=_ogg_malloc(ci->residues*sizeof(*ci->residue_type));*/
207 /*ci->residue_param=_ogg_calloc(ci->residues,sizeof(void *));*/
208 for(i=0;i<ci->residues;i++){
209 ci->residue_type[i]=oggpack_read(opb,16);
210 if(ci->residue_type[i]<0 || ci->residue_type[i]>=VI_RESB)goto err_out;
211 ci->residue_param[i]=_residue_P[ci->residue_type[i]]->unpack(vi,opb);
212 if(!ci->residue_param[i])goto err_out;
213 }
214
215 /* map backend settings */
216 ci->maps=oggpack_read(opb,6)+1;
217 /*ci->map_type=_ogg_malloc(ci->maps*sizeof(*ci->map_type));*/
218 /*ci->map_param=_ogg_calloc(ci->maps,sizeof(void *));*/
219 for(i=0;i<ci->maps;i++){
220 ci->map_type[i]=oggpack_read(opb,16);
221 if(ci->map_type[i]<0 || ci->map_type[i]>=VI_MAPB)goto err_out;
222 ci->map_param[i]=_mapping_P[ci->map_type[i]]->unpack(vi,opb);
223 if(!ci->map_param[i])goto err_out;
224 }
225
226 /* mode settings */
227 ci->modes=oggpack_read(opb,6)+1;
228 /*vi->mode_param=_ogg_calloc(vi->modes,sizeof(void *));*/
229 for(i=0;i<ci->modes;i++){
230 ci->mode_param[i]=(vorbis_info_mode *)_ogg_calloc(1,sizeof(*ci->mode_param[i]));
231 ci->mode_param[i]->blockflag=oggpack_read(opb,1);
232 ci->mode_param[i]->windowtype=oggpack_read(opb,16);
233 ci->mode_param[i]->transformtype=oggpack_read(opb,16);
234 ci->mode_param[i]->mapping=oggpack_read(opb,8);
235
236 if(ci->mode_param[i]->windowtype>=VI_WINDOWB)goto err_out;
237 if(ci->mode_param[i]->transformtype>=VI_WINDOWB)goto err_out;
238 if(ci->mode_param[i]->mapping>=ci->maps)goto err_out;
239 }
240
241 if(oggpack_read(opb,1)!=1)goto err_out; /* top level EOP check */
242
243 return(0);
244 err_out:
245 vorbis_info_clear(vi);
246 return(OV_EBADHEADER);
247}
248
249/* The Vorbis header is in three packets; the initial small packet in
250 the first page that identifies basic parameters, a second packet
251 with bitstream comments and a third packet that holds the
252 codebook. */
253
254int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,ogg_packet *op){
255 oggpack_buffer opb;
256
257 if(op){
258 oggpack_readinit(&opb,op->packet);
259
260 /* Which of the three types of header is this? */
261 /* Also verify header-ness, vorbis */
262 {
263 char buffer[6];
264 int packtype=oggpack_read(&opb,8);
265 memset(buffer,0,6);
266 _v_readstring(&opb,buffer,6);
267 if(memcmp(buffer,"vorbis",6)){
268 /* not a vorbis header */
269 return(OV_ENOTVORBIS);
270 }
271 switch(packtype){
272 case 0x01: /* least significant *bit* is read first */
273 if(!op->b_o_s){
274 /* Not the initial packet */
275 return(OV_EBADHEADER);
276 }
277 if(vi->rate!=0){
278 /* previously initialized info header */
279 return(OV_EBADHEADER);
280 }
281
282 return(_vorbis_unpack_info(vi,&opb));
283
284 case 0x03: /* least significant *bit* is read first */
285 if(vi->rate==0){
286 /* um... we didn't get the initial header */
287 return(OV_EBADHEADER);
288 }
289
290 return(_vorbis_unpack_comment(vc,&opb));
291
292 case 0x05: /* least significant *bit* is read first */
293 if(vi->rate==0 || vc->vendor==NULL){
294 /* um... we didn;t get the initial header or comments yet */
295 return(OV_EBADHEADER);
296 }
297
298 return(_vorbis_unpack_books(vi,&opb));
299
300 default:
301 /* Not a valid vorbis header type */
302 return(OV_EBADHEADER);
303 break;
304 }
305 }
306 }
307 return(OV_EBADHEADER);
308}
309
diff --git a/apps/codecs/libtremor/ivorbiscodec.h b/apps/codecs/libtremor/ivorbiscodec.h
new file mode 100644
index 0000000000..2574a11f2a
--- /dev/null
+++ b/apps/codecs/libtremor/ivorbiscodec.h
@@ -0,0 +1,198 @@
1/********************************************************************
2 * *
3 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
4 * *
5 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
6 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
7 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
8 * *
9 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
10 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
11 * *
12 ********************************************************************
13
14 function: libvorbis codec headers
15
16 ********************************************************************/
17
18#ifndef _vorbis_codec_h_
19#define _vorbis_codec_h_
20
21#ifdef __cplusplus
22extern "C"
23{
24#endif /* __cplusplus */
25
26#include "ogg.h"
27
28typedef struct vorbis_info{
29 int version;
30 int channels;
31 long rate;
32
33 /* The below bitrate declarations are *hints*.
34 Combinations of the three values carry the following implications:
35
36 all three set to the same value:
37 implies a fixed rate bitstream
38 only nominal set:
39 implies a VBR stream that averages the nominal bitrate. No hard
40 upper/lower limit
41 upper and or lower set:
42 implies a VBR bitstream that obeys the bitrate limits. nominal
43 may also be set to give a nominal rate.
44 none set:
45 the coder does not care to speculate.
46 */
47
48 long bitrate_upper;
49 long bitrate_nominal;
50 long bitrate_lower;
51
52 void *codec_setup;
53} vorbis_info;
54
55/* vorbis_dsp_state buffers the current vorbis audio
56 analysis/synthesis state. The DSP state belongs to a specific
57 logical bitstream ****************************************************/
58typedef struct vorbis_dsp_state{
59 vorbis_info *vi;
60
61 ogg_int32_t **pcm;
62 ogg_int32_t **pcmb;
63 ogg_int32_t **pcmret;
64 int pcm_storage;
65 int pcm_current;
66 int pcm_returned;
67
68 int eofflag;
69
70 long lW;
71 long W;
72 long nW;
73 long centerW;
74
75 ogg_int64_t granulepos;
76 ogg_int64_t sequence;
77
78 void *backend_state;
79} vorbis_dsp_state;
80
81typedef struct vorbis_block{
82 /* necessary stream state for linking to the framing abstraction */
83 ogg_int32_t **pcm; /* this is a pointer into local storage */
84 oggpack_buffer opb;
85
86 long lW;
87 long W;
88 long nW;
89 int pcmend;
90 int mode;
91
92 int eofflag;
93 ogg_int64_t granulepos;
94 ogg_int64_t sequence;
95 vorbis_dsp_state *vd; /* For read-only access of configuration */
96
97 /* local storage to avoid remallocing; it's up to the mapping to
98 structure it */
99 void *localstore;
100 long localtop;
101 long localalloc;
102 long totaluse;
103 struct alloc_chain *reap;
104
105} vorbis_block;
106
107/* vorbis_block is a single block of data to be processed as part of
108the analysis/synthesis stream; it belongs to a specific logical
109bitstream, but is independant from other vorbis_blocks belonging to
110that logical bitstream. *************************************************/
111
112struct alloc_chain{
113 void *ptr;
114 struct alloc_chain *next;
115};
116
117/* vorbis_info contains all the setup information specific to the
118 specific compression/decompression mode in progress (eg,
119 psychoacoustic settings, channel setup, options, codebook
120 etc). vorbis_info and substructures are in backends.h.
121*********************************************************************/
122
123/* the comments are not part of vorbis_info so that vorbis_info can be
124 static storage */
125typedef struct vorbis_comment{
126 /* unlimited user comment fields. libvorbis writes 'libvorbis'
127 whatever vendor is set to in encode */
128 char **user_comments;
129 int *comment_lengths;
130 int comments;
131 char *vendor;
132
133} vorbis_comment;
134
135
136/* libvorbis encodes in two abstraction layers; first we perform DSP
137 and produce a packet (see docs/analysis.txt). The packet is then
138 coded into a framed OggSquish bitstream by the second layer (see
139 docs/framing.txt). Decode is the reverse process; we sync/frame
140 the bitstream and extract individual packets, then decode the
141 packet back into PCM audio.
142
143 The extra framing/packetizing is used in streaming formats, such as
144 files. Over the net (such as with UDP), the framing and
145 packetization aren't necessary as they're provided by the transport
146 and the streaming layer is not used */
147
148/* Vorbis PRIMITIVES: general ***************************************/
149
150extern void vorbis_info_init(vorbis_info *vi);
151extern void vorbis_info_clear(vorbis_info *vi);
152extern int vorbis_info_blocksize(vorbis_info *vi,int zo);
153extern void vorbis_comment_init(vorbis_comment *vc);
154extern void vorbis_comment_add(vorbis_comment *vc, char *comment);
155extern void vorbis_comment_add_tag(vorbis_comment *vc,
156 char *tag, char *contents);
157extern void vorbis_comment_clear(vorbis_comment *vc);
158
159extern int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb);
160extern int vorbis_block_clear(vorbis_block *vb);
161extern void vorbis_dsp_clear(vorbis_dsp_state *v);
162
163/* Vorbis PRIMITIVES: synthesis layer *******************************/
164extern int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,
165 ogg_packet *op);
166
167extern int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi);
168extern int vorbis_synthesis_restart(vorbis_dsp_state *v);
169extern int vorbis_synthesis(vorbis_block *vb,ogg_packet *op,int decodep);
170extern int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb);
171extern int vorbis_synthesis_pcmout(vorbis_dsp_state *v,ogg_int32_t ***pcm);
172extern int vorbis_synthesis_read(vorbis_dsp_state *v,int samples);
173extern long vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op);
174
175/* Vorbis ERRORS and return codes ***********************************/
176
177#define OV_FALSE -1
178#define OV_EOF -2
179#define OV_HOLE -3
180
181#define OV_EREAD -128
182#define OV_EFAULT -129
183#define OV_EIMPL -130
184#define OV_EINVAL -131
185#define OV_ENOTVORBIS -132
186#define OV_EBADHEADER -133
187#define OV_EVERSION -134
188#define OV_ENOTAUDIO -135
189#define OV_EBADPACKET -136
190#define OV_EBADLINK -137
191#define OV_ENOSEEK -138
192
193#ifdef __cplusplus
194}
195#endif /* __cplusplus */
196
197#endif
198
diff --git a/apps/codecs/libtremor/ivorbisfile.h b/apps/codecs/libtremor/ivorbisfile.h
new file mode 100644
index 0000000000..9ff446ab10
--- /dev/null
+++ b/apps/codecs/libtremor/ivorbisfile.h
@@ -0,0 +1,133 @@
1/********************************************************************
2 * *
3 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
4 * *
5 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
6 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
7 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
8 * *
9 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
10 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
11 * *
12 ********************************************************************
13
14 function: stdio-based convenience library for opening/seeking/decoding
15
16 ********************************************************************/
17
18#ifndef _OV_FILE_H_
19#define _OV_FILE_H_
20
21#ifdef __cplusplus
22extern "C"
23{
24#endif /* __cplusplus */
25
26#include <stdio.h>
27#include "ivorbiscodec.h"
28
29
30#define CHUNKSIZE 1024
31/* The function prototypes for the callbacks are basically the same as for
32 * the stdio functions fread, fseek, fclose, ftell.
33 * The one difference is that the FILE * arguments have been replaced with
34 * a void * - this is to be used as a pointer to whatever internal data these
35 * functions might need. In the stdio case, it's just a FILE * cast to a void *
36 *
37 * If you use other functions, check the docs for these functions and return
38 * the right values. For seek_func(), you *MUST* return -1 if the stream is
39 * unseekable
40 */
41typedef struct {
42 size_t (*read_func) (void *ptr, size_t size, size_t nmemb, void *datasource);
43 int (*seek_func) (void *datasource, ogg_int64_t offset, int whence);
44 int (*close_func) (void *datasource);
45 long (*tell_func) (void *datasource);
46} ov_callbacks;
47
48#define NOTOPEN 0
49#define PARTOPEN 1
50#define OPENED 2
51#define STREAMSET 3
52#define INITSET 4
53
54typedef struct OggVorbis_File {
55 void *datasource; /* Pointer to a FILE *, etc. */
56 int seekable;
57 ogg_int64_t offset;
58 ogg_int64_t end;
59 ogg_sync_state *oy;
60
61 /* If the FILE handle isn't seekable (eg, a pipe), only the current
62 stream appears */
63 int links;
64 ogg_int64_t *offsets;
65 ogg_int64_t *dataoffsets;
66 ogg_uint32_t *serialnos;
67 ogg_int64_t *pcmlengths;
68 vorbis_info *vi;
69 vorbis_comment *vc;
70
71 /* Decoding working state local storage */
72 ogg_int64_t pcm_offset;
73 int ready_state;
74 ogg_uint32_t current_serialno;
75 int current_link;
76
77 ogg_int64_t bittrack;
78 ogg_int64_t samptrack;
79
80 ogg_stream_state *os; /* take physical pages, weld into a logical
81 stream of packets */
82 vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */
83 vorbis_block vb; /* local working space for packet->PCM decode */
84
85 ov_callbacks callbacks;
86
87} OggVorbis_File;
88
89extern int ov_clear(OggVorbis_File *vf);
90 //extern int ov_open(FILE *f,OggVorbis_File *vf,char *initial,long ibytes);
91extern int ov_open_callbacks(void *datasource, OggVorbis_File *vf,
92 char *initial, long ibytes, ov_callbacks callbacks);
93
94 //extern int ov_test(FILE *f,OggVorbis_File *vf,char *initial,long ibytes);
95extern int ov_test_callbacks(void *datasource, OggVorbis_File *vf,
96 char *initial, long ibytes, ov_callbacks callbacks);
97extern int ov_test_open(OggVorbis_File *vf);
98
99extern long ov_bitrate(OggVorbis_File *vf,int i);
100extern long ov_bitrate_instant(OggVorbis_File *vf);
101extern long ov_streams(OggVorbis_File *vf);
102extern long ov_seekable(OggVorbis_File *vf);
103extern long ov_serialnumber(OggVorbis_File *vf,int i);
104
105extern ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i);
106extern ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i);
107extern ogg_int64_t ov_time_total(OggVorbis_File *vf,int i);
108
109extern int ov_raw_seek(OggVorbis_File *vf,ogg_int64_t pos);
110extern int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos);
111extern int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos);
112extern int ov_time_seek(OggVorbis_File *vf,ogg_int64_t pos);
113extern int ov_time_seek_page(OggVorbis_File *vf,ogg_int64_t pos);
114
115extern ogg_int64_t ov_raw_tell(OggVorbis_File *vf);
116extern ogg_int64_t ov_pcm_tell(OggVorbis_File *vf);
117extern ogg_int64_t ov_time_tell(OggVorbis_File *vf);
118
119extern vorbis_info *ov_info(OggVorbis_File *vf,int link);
120extern vorbis_comment *ov_comment(OggVorbis_File *vf,int link);
121
122extern long ov_read(OggVorbis_File *vf,char *buffer,int length,
123 int *bitstream);
124extern long ov_read_fixed(OggVorbis_File *vf,ogg_int32_t ***pcm_channels,
125 int length,int *bitstream);
126
127#ifdef __cplusplus
128}
129#endif /* __cplusplus */
130
131#endif
132
133
diff --git a/apps/codecs/libtremor/lsp_lookup.h b/apps/codecs/libtremor/lsp_lookup.h
new file mode 100644
index 0000000000..8609936542
--- /dev/null
+++ b/apps/codecs/libtremor/lsp_lookup.h
@@ -0,0 +1,136 @@
1/********************************************************************
2 * *
3 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
4 * *
5 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
6 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
7 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
8 * *
9 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
10 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
11 * *
12 ********************************************************************
13
14 function: lookup data
15
16 ********************************************************************/
17
18#ifndef _V_LOOKUP_DATA_H_
19#define _V_LOOKUP_DATA_H_
20
21#include "os_types.h"
22
23#define FROMdB_LOOKUP_SZ 35
24#define FROMdB2_LOOKUP_SZ 32
25#define FROMdB_SHIFT 5
26#define FROMdB2_SHIFT 3
27#define FROMdB2_MASK 31
28
29static const ogg_int32_t FROMdB_LOOKUP[FROMdB_LOOKUP_SZ] ICONST_ATTR ={
30 0x003fffff, 0x0028619b, 0x00197a96, 0x0010137a,
31 0x000a24b0, 0x00066666, 0x000409c3, 0x00028c42,
32 0x00019b8c, 0x000103ab, 0x0000a3d7, 0x00006760,
33 0x0000413a, 0x00002928, 0x000019f8, 0x00001062,
34 0x00000a56, 0x00000686, 0x0000041e, 0x00000299,
35 0x000001a3, 0x00000109, 0x000000a7, 0x00000069,
36 0x00000042, 0x0000002a, 0x0000001a, 0x00000011,
37 0x0000000b, 0x00000007, 0x00000004, 0x00000003,
38 0x00000002, 0x00000001, 0x00000001};
39
40static const ogg_int32_t FROMdB2_LOOKUP[FROMdB2_LOOKUP_SZ] ICONST_ATTR ={
41 0x000001fc, 0x000001f5, 0x000001ee, 0x000001e7,
42 0x000001e0, 0x000001d9, 0x000001d2, 0x000001cc,
43 0x000001c5, 0x000001bf, 0x000001b8, 0x000001b2,
44 0x000001ac, 0x000001a6, 0x000001a0, 0x0000019a,
45 0x00000194, 0x0000018e, 0x00000188, 0x00000183,
46 0x0000017d, 0x00000178, 0x00000172, 0x0000016d,
47 0x00000168, 0x00000163, 0x0000015e, 0x00000159,
48 0x00000154, 0x0000014f, 0x0000014a, 0x00000145,
49};
50
51#define INVSQ_LOOKUP_I_SHIFT 10
52#define INVSQ_LOOKUP_I_MASK 1023
53static const long INVSQ_LOOKUP_I[64+1] ICONST_ATTR ={
54 92682, 91966, 91267, 90583,
55 89915, 89261, 88621, 87995,
56 87381, 86781, 86192, 85616,
57 85051, 84497, 83953, 83420,
58 82897, 82384, 81880, 81385,
59 80899, 80422, 79953, 79492,
60 79039, 78594, 78156, 77726,
61 77302, 76885, 76475, 76072,
62 75674, 75283, 74898, 74519,
63 74146, 73778, 73415, 73058,
64 72706, 72359, 72016, 71679,
65 71347, 71019, 70695, 70376,
66 70061, 69750, 69444, 69141,
67 68842, 68548, 68256, 67969,
68 67685, 67405, 67128, 66855,
69 66585, 66318, 66054, 65794,
70 65536,
71};
72
73static const long INVSQ_LOOKUP_IDel[64] ICONST_ATTR ={
74 716, 699, 684, 668,
75 654, 640, 626, 614,
76 600, 589, 576, 565,
77 554, 544, 533, 523,
78 513, 504, 495, 486,
79 477, 469, 461, 453,
80 445, 438, 430, 424,
81 417, 410, 403, 398,
82 391, 385, 379, 373,
83 368, 363, 357, 352,
84 347, 343, 337, 332,
85 328, 324, 319, 315,
86 311, 306, 303, 299,
87 294, 292, 287, 284,
88 280, 277, 273, 270,
89 267, 264, 260, 258,
90};
91
92#define COS_LOOKUP_I_SHIFT 9
93#define COS_LOOKUP_I_MASK 511
94#define COS_LOOKUP_I_SZ 128
95static const ogg_int32_t COS_LOOKUP_I[COS_LOOKUP_I_SZ+1] ICONST_ATTR ={
96 16384, 16379, 16364, 16340,
97 16305, 16261, 16207, 16143,
98 16069, 15986, 15893, 15791,
99 15679, 15557, 15426, 15286,
100 15137, 14978, 14811, 14635,
101 14449, 14256, 14053, 13842,
102 13623, 13395, 13160, 12916,
103 12665, 12406, 12140, 11866,
104 11585, 11297, 11003, 10702,
105 10394, 10080, 9760, 9434,
106 9102, 8765, 8423, 8076,
107 7723, 7366, 7005, 6639,
108 6270, 5897, 5520, 5139,
109 4756, 4370, 3981, 3590,
110 3196, 2801, 2404, 2006,
111 1606, 1205, 804, 402,
112 0, -401, -803, -1204,
113 -1605, -2005, -2403, -2800,
114 -3195, -3589, -3980, -4369,
115 -4755, -5138, -5519, -5896,
116 -6269, -6638, -7004, -7365,
117 -7722, -8075, -8422, -8764,
118 -9101, -9433, -9759, -10079,
119 -10393, -10701, -11002, -11296,
120 -11584, -11865, -12139, -12405,
121 -12664, -12915, -13159, -13394,
122 -13622, -13841, -14052, -14255,
123 -14448, -14634, -14810, -14977,
124 -15136, -15285, -15425, -15556,
125 -15678, -15790, -15892, -15985,
126 -16068, -16142, -16206, -16260,
127 -16304, -16339, -16363, -16378,
128 -16383,
129};
130
131#endif
132
133
134
135
136
diff --git a/apps/codecs/libtremor/mapping0.c b/apps/codecs/libtremor/mapping0.c
new file mode 100644
index 0000000000..6bcc717d86
--- /dev/null
+++ b/apps/codecs/libtremor/mapping0.c
@@ -0,0 +1,333 @@
1/********************************************************************
2 * *
3 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
4 * *
5 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
6 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
7 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
8 * *
9 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
10 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
11 * *
12 ********************************************************************
13
14 function: channel mapping 0 implementation
15
16 ********************************************************************/
17
18#include "config-tremor.h"
19#include <stdio.h>
20#include <string.h>
21#include <math.h>
22#include "ogg.h"
23#include "ivorbiscodec.h"
24#include <codecs/lib/codeclib.h>
25#include "codec_internal.h"
26#include "codebook.h"
27#include "window.h"
28#include "registry.h"
29#include "misc.h"
30
31
32
33/* simplistic, wasteful way of doing this (unique lookup for each
34 mode/submapping); there should be a central repository for
35 identical lookups. That will require minor work, so I'm putting it
36 off as low priority.
37
38 Why a lookup for each backend in a given mode? Because the
39 blocksize is set by the mode, and low backend lookups may require
40 parameters from other areas of the mode/mapping */
41
42typedef struct {
43 vorbis_info_mode *mode;
44 vorbis_info_mapping0 *map;
45
46 vorbis_look_floor **floor_look;
47
48 vorbis_look_residue **residue_look;
49
50 vorbis_func_floor **floor_func;
51 vorbis_func_residue **residue_func;
52
53 int ch;
54 long lastframe; /* if a different mode is called, we need to
55 invalidate decay */
56} vorbis_look_mapping0;
57
58static void mapping0_free_info(vorbis_info_mapping *i){
59 vorbis_info_mapping0 *info=(vorbis_info_mapping0 *)i;
60 if(info){
61 memset(info,0,sizeof(*info));
62 _ogg_free(info);
63 }
64}
65
66static void mapping0_free_look(vorbis_look_mapping *look){
67 int i;
68 vorbis_look_mapping0 *l=(vorbis_look_mapping0 *)look;
69 if(l){
70
71 for(i=0;i<l->map->submaps;i++){
72 l->floor_func[i]->free_look(l->floor_look[i]);
73 l->residue_func[i]->free_look(l->residue_look[i]);
74 }
75
76 _ogg_free(l->floor_func);
77 _ogg_free(l->residue_func);
78 _ogg_free(l->floor_look);
79 _ogg_free(l->residue_look);
80 memset(l,0,sizeof(*l));
81 _ogg_free(l);
82 }
83}
84
85static vorbis_look_mapping *mapping0_look(vorbis_dsp_state *vd,vorbis_info_mode *vm,
86 vorbis_info_mapping *m){
87 int i;
88 vorbis_info *vi=vd->vi;
89 codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
90 vorbis_look_mapping0 *look=(vorbis_look_mapping0 *)_ogg_calloc(1,sizeof(*look));
91 vorbis_info_mapping0 *info=look->map=(vorbis_info_mapping0 *)m;
92 look->mode=vm;
93
94 look->floor_look=(vorbis_look_floor **)_ogg_calloc(info->submaps,sizeof(*look->floor_look));
95
96 look->residue_look=(vorbis_look_residue **)_ogg_calloc(info->submaps,sizeof(*look->residue_look));
97
98 look->floor_func=(vorbis_func_floor **)_ogg_calloc(info->submaps,sizeof(*look->floor_func));
99 look->residue_func=(vorbis_func_residue **)_ogg_calloc(info->submaps,sizeof(*look->residue_func));
100
101 for(i=0;i<info->submaps;i++){
102 int floornum=info->floorsubmap[i];
103 int resnum=info->residuesubmap[i];
104
105 look->floor_func[i]=_floor_P[ci->floor_type[floornum]];
106 look->floor_look[i]=look->floor_func[i]->
107 look(vd,vm,ci->floor_param[floornum]);
108 look->residue_func[i]=_residue_P[ci->residue_type[resnum]];
109 look->residue_look[i]=look->residue_func[i]->
110 look(vd,vm,ci->residue_param[resnum]);
111
112 }
113
114 look->ch=vi->channels;
115
116 return(look);
117}
118
119static int ilog(unsigned int v){
120 int ret=0;
121 if(v)--v;
122 while(v){
123 ret++;
124 v>>=1;
125 }
126 return(ret);
127}
128
129
130/* also responsible for range checking */
131static vorbis_info_mapping *mapping0_unpack(vorbis_info *vi,oggpack_buffer *opb){
132 int i;
133 vorbis_info_mapping0 *info=(vorbis_info_mapping0 *)_ogg_calloc(1,sizeof(*info));
134 codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
135 memset(info,0,sizeof(*info));
136
137 if(oggpack_read(opb,1))
138 info->submaps=oggpack_read(opb,4)+1;
139 else
140 info->submaps=1;
141
142 if(oggpack_read(opb,1)){
143 info->coupling_steps=oggpack_read(opb,8)+1;
144
145 for(i=0;i<info->coupling_steps;i++){
146 int testM=info->coupling_mag[i]=oggpack_read(opb,ilog(vi->channels));
147 int testA=info->coupling_ang[i]=oggpack_read(opb,ilog(vi->channels));
148
149 if(testM<0 ||
150 testA<0 ||
151 testM==testA ||
152 testM>=vi->channels ||
153 testA>=vi->channels) goto err_out;
154 }
155
156 }
157
158 if(oggpack_read(opb,2)>0)goto err_out; /* 2,3:reserved */
159
160 if(info->submaps>1){
161 for(i=0;i<vi->channels;i++){
162 info->chmuxlist[i]=oggpack_read(opb,4);
163 if(info->chmuxlist[i]>=info->submaps)goto err_out;
164 }
165 }
166 for(i=0;i<info->submaps;i++){
167 int temp=oggpack_read(opb,8);
168 if(temp>=ci->times)goto err_out;
169 info->floorsubmap[i]=oggpack_read(opb,8);
170 if(info->floorsubmap[i]>=ci->floors)goto err_out;
171 info->residuesubmap[i]=oggpack_read(opb,8);
172 if(info->residuesubmap[i]>=ci->residues)goto err_out;
173 }
174
175 return info;
176
177 err_out:
178 mapping0_free_info(info);
179 return(NULL);
180}
181
182
183static int seq = 0;
184
185#define CHANNELS 2 /* max 2 channels on the ihp-1xx (stereo) */
186
187static int mapping0_inverse(vorbis_block *vb,vorbis_look_mapping *l){
188 vorbis_dsp_state *vd=vb->vd;
189 vorbis_info *vi=vd->vi;
190 codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
191 private_state *b=(private_state *)vd->backend_state;
192 vorbis_look_mapping0 *look=(vorbis_look_mapping0 *)l;
193 vorbis_info_mapping0 *info=look->map;
194
195 int i,j;
196 long n=vb->pcmend=ci->blocksizes[vb->W];
197
198 /* bounded mapping arrays instead of using alloca();
199 avoids memory leak; we can only deal with stereo anyway */
200 ogg_int32_t *pcmbundle[CHANNELS];
201 int zerobundle[CHANNELS];
202 int nonzero[CHANNELS];
203 void *floormemo[CHANNELS];
204
205 /* time domain information decode (note that applying the
206 information would have to happen later; we'll probably add a
207 function entry to the harness for that later */
208 /* NOT IMPLEMENTED */
209
210 /* recover the spectral envelope; store it in the PCM vector for now */
211 for(i=0;i<vi->channels;i++){
212 int submap=info->chmuxlist[i];
213 floormemo[i]=look->floor_func[submap]->
214 inverse1(vb,look->floor_look[submap]);
215 if(floormemo[i])
216 nonzero[i]=1;
217 else
218 nonzero[i]=0;
219 memset(vb->pcm[i],0,sizeof(*vb->pcm[i])*n/2);
220 }
221
222 /* channel coupling can 'dirty' the nonzero listing */
223 for(i=0;i<info->coupling_steps;i++){
224 if(nonzero[info->coupling_mag[i]] ||
225 nonzero[info->coupling_ang[i]]){
226 nonzero[info->coupling_mag[i]]=1;
227 nonzero[info->coupling_ang[i]]=1;
228 }
229 }
230
231 /* recover the residue into our working vectors */
232 for(i=0;i<info->submaps;i++){
233 int ch_in_bundle=0;
234 for(j=0;j<vi->channels;j++){
235 if(info->chmuxlist[j]==i){
236 if(nonzero[j])
237 zerobundle[ch_in_bundle]=1;
238 else
239 zerobundle[ch_in_bundle]=0;
240 pcmbundle[ch_in_bundle++]=vb->pcm[j];
241 }
242 }
243
244 look->residue_func[i]->inverse(vb,look->residue_look[i],
245 pcmbundle,zerobundle,ch_in_bundle);
246 }
247
248 //for(j=0;j<vi->channels;j++)
249 //_analysis_output("coupled",seq+j,vb->pcm[j],-8,n/2,0,0);
250
251
252 /* channel coupling */
253 for(i=info->coupling_steps-1;i>=0;i--){
254 ogg_int32_t *pcmM=vb->pcm[info->coupling_mag[i]];
255 ogg_int32_t *pcmA=vb->pcm[info->coupling_ang[i]];
256
257 for(j=0;j<n/2;j++){
258 ogg_int32_t mag=pcmM[j];
259 ogg_int32_t ang=pcmA[j];
260
261 if(mag>0)
262 if(ang>0){
263 pcmM[j]=mag;
264 pcmA[j]=mag-ang;
265 }else{
266 pcmA[j]=mag;
267 pcmM[j]=mag+ang;
268 }
269 else
270 if(ang>0){
271 pcmM[j]=mag;
272 pcmA[j]=mag+ang;
273 }else{
274 pcmA[j]=mag;
275 pcmM[j]=mag-ang;
276 }
277 }
278 }
279
280
281 //for(j=0;j<vi->channels;j++)
282 //_analysis_output("residue",seq+j,vb->pcm[j],-8,n/2,0,0);
283
284 /* compute and apply spectral envelope */
285#if 0
286 for(i=0;i<vi->channels;i++){
287 ogg_int32_t *pcm=vb->pcm[i];
288 int submap=info->chmuxlist[i];
289 look->floor_func[submap]->
290 inverse2(vb,look->floor_look[submap],floormemo[i],pcm);
291 }
292#endif
293 //for(j=0;j<vi->channels;j++)
294 //_analysis_output("mdct",seq+j,vb->pcm[j],-24,n/2,0,1);
295
296 /* transform the PCM data; takes PCM vector, vb; modifies PCM vector */
297 /* only MDCT right now.... */
298
299 for(i=0;i<vi->channels;i++){
300 ogg_int32_t *pcm=vb->pcm[i];
301 int submap=info->chmuxlist[i];
302
303 if(nonzero[i]) {
304 look->floor_func[submap]->
305 inverse2(vb,look->floor_look[submap],floormemo[i],pcm);
306 mdct_backward(n, (int32_t*) pcm, (int32_t*) pcm);
307 /* window the data */
308 _vorbis_apply_window(pcm,b->window,ci->blocksizes,vb->lW,vb->W,vb->nW);
309 }
310 else
311 memset(pcm, 0, sizeof(ogg_int32_t)*n);
312 }
313
314 //for(j=0;j<vi->channels;j++)
315 //_analysis_output("imdct",seq+j,vb->pcm[j],-24,n,0,0);
316
317 //for(j=0;j<vi->channels;j++)
318 //_analysis_output("window",seq+j,vb->pcm[j],-24,n,0,0);
319
320 seq+=vi->channels;
321 /* all done! */
322 return(0);
323}
324
325/* export hooks */
326const vorbis_func_mapping mapping0_exportbundle ICONST_ATTR ={
327 &mapping0_unpack,
328 &mapping0_look,
329 &mapping0_free_info,
330 &mapping0_free_look,
331 &mapping0_inverse
332};
333
diff --git a/apps/codecs/libtremor/misc.h b/apps/codecs/libtremor/misc.h
new file mode 100644
index 0000000000..7d8b846381
--- /dev/null
+++ b/apps/codecs/libtremor/misc.h
@@ -0,0 +1,291 @@
1/********************************************************************
2 * *
3 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
4 * *
5 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
6 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
7 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
8 * *
9 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
10 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
11 * *
12 ********************************************************************
13
14 function: miscellaneous math and prototypes
15
16 ********************************************************************/
17
18#include "config-tremor.h"
19
20#ifndef _V_RANDOM_H_
21#define _V_RANDOM_H_
22#include "ivorbiscodec.h"
23#include "os_types.h"
24
25#include "asm_arm.h"
26#include "asm_mcf5249.h"
27
28
29/* Some prototypes that were not defined elsewhere */
30void *_vorbis_block_alloc(vorbis_block *vb,long bytes);
31void _vorbis_block_ripcord(vorbis_block *vb);
32extern int _ilog(unsigned int v);
33
34#ifndef _V_WIDE_MATH
35#define _V_WIDE_MATH
36
37#ifndef _LOW_ACCURACY_
38/* 64 bit multiply */
39/* #include <sys/types.h> */
40
41#if BYTE_ORDER==LITTLE_ENDIAN
42union magic {
43 struct {
44 ogg_int32_t lo;
45 ogg_int32_t hi;
46 } halves;
47 ogg_int64_t whole;
48};
49#elif BYTE_ORDER==BIG_ENDIAN
50union magic {
51 struct {
52 ogg_int32_t hi;
53 ogg_int32_t lo;
54 } halves;
55 ogg_int64_t whole;
56};
57#endif
58
59static inline ogg_int32_t MULT32(ogg_int32_t x, ogg_int32_t y) {
60 union magic magic;
61 magic.whole = (ogg_int64_t)x * y;
62 return magic.halves.hi;
63}
64static inline ogg_int32_t MULT31(ogg_int32_t x, ogg_int32_t y) {
65 return MULT32(x,y)<<1;
66}
67
68static inline ogg_int32_t MULT31_SHIFT15(ogg_int32_t x, ogg_int32_t y) {
69 union magic magic;
70 magic.whole = (ogg_int64_t)x * y;
71 return ((ogg_uint32_t)(magic.halves.lo)>>15) | ((magic.halves.hi)<<17);
72}
73
74#else
75/* 32 bit multiply, more portable but less accurate */
76
77/*
78 * Note: Precision is biased towards the first argument therefore ordering
79 * is important. Shift values were chosen for the best sound quality after
80 * many listening tests.
81 */
82
83/*
84 * For MULT32 and MULT31: The second argument is always a lookup table
85 * value already preshifted from 31 to 8 bits. We therefore take the
86 * opportunity to save on text space and use unsigned char for those
87 * tables in this case.
88 */
89
90static inline ogg_int32_t MULT32(ogg_int32_t x, ogg_int32_t y) {
91 return (x >> 9) * y; /* y preshifted >>23 */
92}
93
94static inline ogg_int32_t MULT31(ogg_int32_t x, ogg_int32_t y) {
95 return (x >> 8) * y; /* y preshifted >>23 */
96}
97
98static inline ogg_int32_t MULT31_SHIFT15(ogg_int32_t x, ogg_int32_t y) {
99 return (x >> 6) * y; /* y preshifted >>9 */
100}
101#endif
102
103/*
104 * This should be used as a memory barrier, forcing all cached values in
105 * registers to wr writen back to memory. Might or might not be beneficial
106 * depending on the architecture and compiler.
107 */
108#define MB()
109
110/*
111 * The XPROD functions are meant to optimize the cross products found all
112 * over the place in mdct.c by forcing memory operation ordering to avoid
113 * unnecessary register reloads as soon as memory is being written to.
114 * However this is only beneficial on CPUs with a sane number of general
115 * purpose registers which exclude the Intel x86. On Intel, better let the
116 * compiler actually reload registers directly from original memory by using
117 * macros.
118 */
119
120/* replaced XPROD32 with a macro to avoid memory reference
121 _x, _y are the results (must be l-values) */
122#define XPROD32(_a, _b, _t, _v, _x, _y) \
123 { (_x)=MULT32(_a,_t)+MULT32(_b,_v); \
124 (_y)=MULT32(_b,_t)-MULT32(_a,_v); }
125
126
127#ifdef __i386__
128
129#define XPROD31(_a, _b, _t, _v, _x, _y) \
130 { *(_x)=MULT31(_a,_t)+MULT31(_b,_v); \
131 *(_y)=MULT31(_b,_t)-MULT31(_a,_v); }
132#define XNPROD31(_a, _b, _t, _v, _x, _y) \
133 { *(_x)=MULT31(_a,_t)-MULT31(_b,_v); \
134 *(_y)=MULT31(_b,_t)+MULT31(_a,_v); }
135
136#else
137
138static inline void XPROD31(ogg_int32_t a, ogg_int32_t b,
139 ogg_int32_t t, ogg_int32_t v,
140 ogg_int32_t *x, ogg_int32_t *y)
141{
142 *x = MULT31(a, t) + MULT31(b, v);
143 *y = MULT31(b, t) - MULT31(a, v);
144}
145
146static inline void XNPROD31(ogg_int32_t a, ogg_int32_t b,
147 ogg_int32_t t, ogg_int32_t v,
148 ogg_int32_t *x, ogg_int32_t *y)
149{
150 *x = MULT31(a, t) - MULT31(b, v);
151 *y = MULT31(b, t) + MULT31(a, v);
152}
153#endif
154
155#ifndef _V_VECT_OPS
156#define _V_VECT_OPS
157
158static inline
159void vect_add(ogg_int32_t *x, ogg_int32_t *y, int n)
160{
161 while (n>0) {
162 *x++ += *y++;
163 n--;
164 }
165}
166
167static inline
168void vect_copy(ogg_int32_t *x, ogg_int32_t *y, int n)
169{
170 while (n>0) {
171 *x++ = *y++;
172 n--;
173 }
174}
175
176static inline
177void vect_mult_fw(ogg_int32_t *data, LOOKUP_T *window, int n)
178{
179 while(n>0) {
180 *data = MULT31(*data, *window);
181 data++;
182 window++;
183 n--;
184 }
185}
186
187static inline
188void vect_mult_bw(ogg_int32_t *data, LOOKUP_T *window, int n)
189{
190 while(n>0) {
191 *data = MULT31(*data, *window);
192 data++;
193 window--;
194 n--;
195 }
196}
197#endif
198
199#endif
200
201#ifndef _V_CLIP_MATH
202#define _V_CLIP_MATH
203
204static inline ogg_int32_t CLIP_TO_15(ogg_int32_t x) {
205 int ret=x;
206 ret-= ((x<=32767)-1)&(x-32767);
207 ret-= ((x>=-32768)-1)&(x+32768);
208 return(ret);
209}
210
211#endif
212
213static inline ogg_int32_t VFLOAT_MULT(ogg_int32_t a,ogg_int32_t ap,
214 ogg_int32_t b,ogg_int32_t bp,
215 ogg_int32_t *p){
216 if(a && b){
217#ifndef _LOW_ACCURACY_
218 *p=ap+bp+32;
219 return MULT32(a,b);
220#else
221 *p=ap+bp+31;
222 return (a>>15)*(b>>16);
223#endif
224 }else
225 return 0;
226}
227
228static inline ogg_int32_t VFLOAT_MULTI(ogg_int32_t a,ogg_int32_t ap,
229 ogg_int32_t i,
230 ogg_int32_t *p){
231
232 int ip=_ilog(abs(i))-31;
233 return VFLOAT_MULT(a,ap,i<<-ip,ip,p);
234}
235
236static inline ogg_int32_t VFLOAT_ADD(ogg_int32_t a,ogg_int32_t ap,
237 ogg_int32_t b,ogg_int32_t bp,
238 ogg_int32_t *p){
239
240 if(!a){
241 *p=bp;
242 return b;
243 }else if(!b){
244 *p=ap;
245 return a;
246 }
247
248 /* yes, this can leak a bit. */
249 if(ap>bp){
250 int shift=ap-bp+1;
251 *p=ap+1;
252 a>>=1;
253 if(shift<32){
254 b=(b+(1<<(shift-1)))>>shift;
255 }else{
256 b=0;
257 }
258 }else{
259 int shift=bp-ap+1;
260 *p=bp+1;
261 b>>=1;
262 if(shift<32){
263 a=(a+(1<<(shift-1)))>>shift;
264 }else{
265 a=0;
266 }
267 }
268
269 a+=b;
270 if((a&0xc0000000)==0xc0000000 ||
271 (a&0xc0000000)==0){
272 a<<=1;
273 (*p)--;
274 }
275 return(a);
276}
277
278#ifdef __GNUC__
279#if __GNUC__ >= 3
280#define EXPECT(a, b) __builtin_expect((a), (b))
281#else
282#define EXPECT(a, b) (a)
283#endif
284#else
285#define EXPECT(a, b) (a)
286#endif
287
288#endif
289
290
291
diff --git a/apps/codecs/libtremor/ogg.h b/apps/codecs/libtremor/ogg.h
new file mode 100644
index 0000000000..7e2785f117
--- /dev/null
+++ b/apps/codecs/libtremor/ogg.h
@@ -0,0 +1,265 @@
1/********************************************************************
2 * *
3 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
4 * *
5 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
6 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
7 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
8 * *
9 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2003 *
10 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
11 * *
12 ********************************************************************
13
14 function: subsumed libogg includes
15
16 ********************************************************************/
17#ifndef _OGG_H
18#define _OGG_H
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24#include "os_types.h"
25
26typedef struct ogg_buffer_state{
27 struct ogg_buffer *unused_buffers;
28 struct ogg_reference *unused_references;
29 int outstanding;
30 int shutdown;
31} ogg_buffer_state;
32
33typedef struct ogg_buffer {
34 unsigned char *data;
35 long size;
36 int refcount;
37
38 union {
39 ogg_buffer_state *owner;
40 struct ogg_buffer *next;
41 } ptr;
42} ogg_buffer;
43
44typedef struct ogg_reference {
45 ogg_buffer *buffer;
46 long begin;
47 long length;
48
49 struct ogg_reference *next;
50} ogg_reference;
51
52typedef struct oggpack_buffer {
53 int headbit;
54 unsigned char *headptr;
55 long headend;
56
57 /* memory management */
58 ogg_reference *head;
59 ogg_reference *tail;
60
61 /* render the byte/bit counter API constant time */
62 long count; /* doesn't count the tail */
63} oggpack_buffer;
64
65typedef struct oggbyte_buffer {
66 ogg_reference *baseref;
67
68 ogg_reference *ref;
69 unsigned char *ptr;
70 long pos;
71 long end;
72} oggbyte_buffer;
73
74typedef struct ogg_sync_state {
75 /* decode memory management pool */
76 ogg_buffer_state *bufferpool;
77
78 /* stream buffers */
79 ogg_reference *fifo_head;
80 ogg_reference *fifo_tail;
81 long fifo_fill;
82
83 /* stream sync management */
84 int unsynced;
85 int headerbytes;
86 int bodybytes;
87
88} ogg_sync_state;
89
90typedef struct ogg_stream_state {
91 ogg_reference *header_head;
92 ogg_reference *header_tail;
93 ogg_reference *body_head;
94 ogg_reference *body_tail;
95
96 int e_o_s; /* set when we have buffered the last
97 packet in the logical bitstream */
98 int b_o_s; /* set after we've written the initial page
99 of a logical bitstream */
100 long serialno;
101 long pageno;
102 ogg_int64_t packetno; /* sequence number for decode; the framing
103 knows where there's a hole in the data,
104 but we need coupling so that the codec
105 (which is in a seperate abstraction
106 layer) also knows about the gap */
107 ogg_int64_t granulepos;
108
109 int lacing_fill;
110 ogg_uint32_t body_fill;
111
112 /* decode-side state data */
113 int holeflag;
114 int spanflag;
115 int clearflag;
116 int laceptr;
117 ogg_uint32_t body_fill_next;
118
119} ogg_stream_state;
120
121typedef struct {
122 ogg_reference *packet;
123 long bytes;
124 long b_o_s;
125 long e_o_s;
126 ogg_int64_t granulepos;
127 ogg_int64_t packetno; /* sequence number for decode; the framing
128 knows where there's a hole in the data,
129 but we need coupling so that the codec
130 (which is in a seperate abstraction
131 layer) also knows about the gap */
132} ogg_packet;
133
134typedef struct {
135 ogg_reference *header;
136 int header_len;
137 ogg_reference *body;
138 long body_len;
139} ogg_page;
140
141/* Ogg BITSTREAM PRIMITIVES: bitstream ************************/
142
143extern void oggpack_readinit(oggpack_buffer *b,ogg_reference *r);
144extern long oggpack_look_full(oggpack_buffer *b,int bits);
145extern long oggpack_read(oggpack_buffer *b,int bits);
146
147/* Inline a few, often called functions */
148
149/* mark read process as having run off the end */
150static inline void _adv_halt(oggpack_buffer *b){
151 b->headptr=b->head->buffer->data+b->head->begin+b->head->length;
152 b->headend=-1;
153 b->headbit=0;
154}
155
156/* spans forward, skipping as many bytes as headend is negative; if
157 headend is zero, simply finds next byte. If we're up to the end
158 of the buffer, leaves headend at zero. If we've read past the end,
159 halt the decode process. */
160static inline void _span(oggpack_buffer *b){
161 while(b->headend<1){
162 if(b->head->next){
163 b->count+=b->head->length;
164 b->head=b->head->next;
165 b->headptr=b->head->buffer->data+b->head->begin-b->headend;
166 b->headend+=b->head->length;
167 }else{
168 /* we've either met the end of decode, or gone past it. halt
169 only if we're past */
170 if(b->headend<0 || b->headbit)
171 /* read has fallen off the end */
172 _adv_halt(b);
173
174 break;
175 }
176 }
177}
178
179/* limited to 32 at a time */
180static inline void oggpack_adv(oggpack_buffer *b,int bits){
181 bits+=b->headbit;
182 b->headbit=bits&7;
183 b->headptr+=bits/8;
184 if((b->headend-=((unsigned)bits)/8)<1)_span(b);
185}
186
187static inline long oggpack_look(oggpack_buffer *b, int bits){
188 if(bits+b->headbit < b->headend<<3){
189 extern const unsigned long oggpack_mask[];
190 unsigned long m=oggpack_mask[bits];
191 unsigned long ret=-1;
192
193 bits+=b->headbit;
194 ret=b->headptr[0]>>b->headbit;
195 if(bits>8){
196 ret|=b->headptr[1]<<(8-b->headbit);
197 if(bits>16){
198 ret|=b->headptr[2]<<(16-b->headbit);
199 if(bits>24){
200 ret|=b->headptr[3]<<(24-b->headbit);
201 if(bits>32 && b->headbit)
202 ret|=b->headptr[4]<<(32-b->headbit);
203 }
204 }
205 }
206 return ret&m;
207 }else{
208 return oggpack_look_full(b, bits);
209 }
210}
211
212/* Ogg BITSTREAM PRIMITIVES: decoding **************************/
213
214extern ogg_sync_state *ogg_sync_create(void);
215extern int ogg_sync_destroy(ogg_sync_state *oy);
216extern int ogg_sync_reset(ogg_sync_state *oy);
217
218extern unsigned char *ogg_sync_bufferin(ogg_sync_state *oy, long size);
219extern int ogg_sync_wrote(ogg_sync_state *oy, long bytes);
220extern long ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og);
221extern int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og);
222extern int ogg_stream_packetout(ogg_stream_state *os,ogg_packet *op);
223extern int ogg_stream_packetpeek(ogg_stream_state *os,ogg_packet *op);
224
225/* Ogg BITSTREAM PRIMITIVES: general ***************************/
226
227extern ogg_stream_state *ogg_stream_create(int serialno);
228extern int ogg_stream_destroy(ogg_stream_state *os);
229extern int ogg_stream_reset(ogg_stream_state *os);
230extern int ogg_stream_reset_serialno(ogg_stream_state *os,int serialno);
231extern int ogg_stream_eos(ogg_stream_state *os);
232
233extern int ogg_page_checksum_set(ogg_page *og);
234
235extern int ogg_page_version(ogg_page *og);
236extern int ogg_page_continued(ogg_page *og);
237extern int ogg_page_bos(ogg_page *og);
238extern int ogg_page_eos(ogg_page *og);
239extern ogg_int64_t ogg_page_granulepos(ogg_page *og);
240extern ogg_uint32_t ogg_page_serialno(ogg_page *og);
241extern ogg_uint32_t ogg_page_pageno(ogg_page *og);
242extern int ogg_page_getbuffer(ogg_page *og, unsigned char **buffer);
243
244extern int ogg_packet_release(ogg_packet *op);
245extern int ogg_page_release(ogg_page *og);
246
247extern void ogg_page_dup(ogg_page *d, ogg_page *s);
248
249/* Ogg BITSTREAM PRIMITIVES: return codes ***************************/
250
251#define OGG_SUCCESS 0
252
253#define OGG_HOLE -10
254#define OGG_SPAN -11
255#define OGG_EVERSION -12
256#define OGG_ESERIAL -13
257#define OGG_EINVAL -14
258#define OGG_EEOS -15
259
260
261#ifdef __cplusplus
262}
263#endif
264
265#endif /* _OGG_H */
diff --git a/apps/codecs/libtremor/oggmalloc.c b/apps/codecs/libtremor/oggmalloc.c
new file mode 100644
index 0000000000..b11eaa54f5
--- /dev/null
+++ b/apps/codecs/libtremor/oggmalloc.c
@@ -0,0 +1,75 @@
1#include <os_types.h>
2
3static unsigned char *mallocbuf;
4static size_t bufsize, tmp_ptr, mem_ptr;
5
6void ogg_malloc_init(void)
7{
8 mallocbuf = ci->codec_get_buffer(&bufsize);
9 tmp_ptr = bufsize & ~3;
10 mem_ptr = 0;
11}
12
13void *ogg_malloc(size_t size)
14{
15 void* x;
16
17 size = (size + 3) & ~3;
18
19 if (mem_ptr + size > tmp_ptr)
20 return NULL;
21
22 x = &mallocbuf[mem_ptr];
23 mem_ptr += size; /* Keep memory 32-bit aligned */
24
25 return x;
26}
27
28void *ogg_tmpmalloc(size_t size)
29{
30 size = (size + 3) & ~3;
31
32 if (mem_ptr + size > tmp_ptr)
33 return NULL;
34
35 tmp_ptr -= size;
36 return &mallocbuf[tmp_ptr];
37}
38
39void *ogg_calloc(size_t nmemb, size_t size)
40{
41 void *x;
42 x = ogg_malloc(nmemb * size);
43 if (x == NULL)
44 return NULL;
45 ci->memset(x, 0, nmemb * size);
46 return x;
47}
48
49void *ogg_tmpcalloc(size_t nmemb, size_t size)
50{
51 void *x;
52 x = ogg_tmpmalloc(nmemb * size);
53 if (x == NULL)
54 return NULL;
55 ci->memset(x, 0, nmemb * size);
56 return x;
57}
58
59void *ogg_realloc(void *ptr, size_t size)
60{
61 void *x;
62 (void)ptr;
63 x = ogg_malloc(size);
64 return x;
65}
66
67long ogg_tmpmalloc_pos(void)
68{
69 return tmp_ptr;
70}
71
72void ogg_tmpmalloc_free(long pos)
73{
74 tmp_ptr = pos;
75}
diff --git a/apps/codecs/libtremor/os.h b/apps/codecs/libtremor/os.h
new file mode 100644
index 0000000000..bb4b867e3d
--- /dev/null
+++ b/apps/codecs/libtremor/os.h
@@ -0,0 +1,62 @@
1#ifndef _OS_H
2#define _OS_H
3/********************************************************************
4 * *
5 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
6 * *
7 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
8 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
9 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
10 * *
11 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
12 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
13 * *
14 ********************************************************************
15
16 function: #ifdef jail to whip a few platforms into the UNIX ideal.
17
18 ********************************************************************/
19
20#include <math.h>
21#include "os_types.h"
22
23#ifndef _V_IFDEFJAIL_H_
24# define _V_IFDEFJAIL_H_
25
26# ifdef __GNUC__
27# define STIN static inline
28# elif _WIN32
29# define STIN static __inline__
30# endif
31#else
32# define STIN static inline
33#endif
34
35#ifndef M_PI
36# define M_PI (3.1415926536f)
37#endif
38
39#ifdef _WIN32
40# include <malloc.h>
41# define rint(x) (floor((x)+0.5f))
42# define NO_FLOAT_MATH_LIB
43# define FAST_HYPOT(a, b) sqrt((a)*(a) + (b)*(b))
44#endif
45
46#ifdef HAVE_ALLOCA_H
47# include <alloca.h>
48#endif
49
50#ifdef USE_MEMORY_H
51# include <memory.h>
52#endif
53
54#ifndef min
55# define min(x,y) ((x)>(y)?(y):(x))
56#endif
57
58#ifndef max
59# define max(x,y) ((x)<(y)?(y):(x))
60#endif
61
62#endif /* _OS_H */
diff --git a/apps/codecs/libtremor/os_types.h b/apps/codecs/libtremor/os_types.h
new file mode 100644
index 0000000000..5738ef4911
--- /dev/null
+++ b/apps/codecs/libtremor/os_types.h
@@ -0,0 +1,55 @@
1/********************************************************************
2 * *
3 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
4 * *
5 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
6 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
7 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
8 * *
9 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
10 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
11 * *
12 ********************************************************************
13
14 function: #ifdef jail to whip a few platforms into the UNIX ideal.
15
16 ********************************************************************/
17#include "config-tremor.h"
18
19#ifndef _OS_TYPES_H
20#define _OS_TYPES_H
21
22#include <stdlib.h>
23#include <codecs.h>
24
25#ifdef _LOW_ACCURACY_
26# define X(n) (((((n)>>22)+1)>>1) - ((((n)>>22)+1)>>9))
27# define LOOKUP_T const unsigned char
28#else
29# define X(n) (n)
30# define LOOKUP_T const ogg_int32_t
31#endif
32
33/* make it easy on the folks that want to compile the libs with a
34 different malloc than stdlib */
35
36#define _ogg_malloc ogg_malloc
37#define _ogg_calloc ogg_calloc
38#define _ogg_realloc ogg_realloc
39#define _ogg_free(x) do { } while(0)
40
41void ogg_malloc_init(void);
42void *ogg_malloc(size_t size);
43void *ogg_tmpmalloc(size_t size);
44void *ogg_calloc(size_t nmemb, size_t size);
45void *ogg_tmpcalloc(size_t nmemb, size_t size);
46void *ogg_realloc(void *ptr, size_t size);
47long ogg_tmpmalloc_pos(void);
48void ogg_tmpmalloc_free(long pos);
49
50 typedef short ogg_int16_t;
51 typedef int ogg_int32_t;
52 typedef unsigned int ogg_uint32_t;
53 typedef long long ogg_int64_t;
54
55#endif /* _OS_TYPES_H */
diff --git a/apps/codecs/libtremor/registry.c b/apps/codecs/libtremor/registry.c
new file mode 100644
index 0000000000..b1592628a1
--- /dev/null
+++ b/apps/codecs/libtremor/registry.c
@@ -0,0 +1,50 @@
1/********************************************************************
2 * *
3 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
4 * *
5 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
6 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
7 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
8 * *
9 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
10 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
11 * *
12 ********************************************************************
13
14 function: registry for floor, res backends and channel mappings
15
16 ********************************************************************/
17
18#include "ivorbiscodec.h"
19#include "codec_internal.h"
20#include "registry.h"
21#include "misc.h"
22
23
24/* seems like major overkill now; the backend numbers will grow into
25 the infrastructure soon enough */
26
27extern vorbis_func_floor floor0_exportbundle;
28extern vorbis_func_floor floor1_exportbundle;
29extern vorbis_func_residue residue0_exportbundle;
30extern vorbis_func_residue residue1_exportbundle;
31extern vorbis_func_residue residue2_exportbundle;
32extern vorbis_func_mapping mapping0_exportbundle;
33
34vorbis_func_floor *_floor_P[] ICONST_ATTR = {
35 &floor0_exportbundle,
36 &floor1_exportbundle,
37};
38
39vorbis_func_residue *_residue_P[] ICONST_ATTR = {
40 &residue0_exportbundle,
41 &residue1_exportbundle,
42 &residue2_exportbundle,
43};
44
45vorbis_func_mapping *_mapping_P[] ICONST_ATTR = {
46 &mapping0_exportbundle,
47};
48
49
50
diff --git a/apps/codecs/libtremor/registry.h b/apps/codecs/libtremor/registry.h
new file mode 100644
index 0000000000..2bc8068f69
--- /dev/null
+++ b/apps/codecs/libtremor/registry.h
@@ -0,0 +1,40 @@
1/********************************************************************
2 * *
3 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
4 * *
5 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
6 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
7 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
8 * *
9 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
10 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
11 * *
12 ********************************************************************
13
14 function: registry for time, floor, res backends and channel mappings
15
16 ********************************************************************/
17
18#ifndef _V_REG_H_
19#define _V_REG_H_
20
21#define VI_TRANSFORMB 1
22#define VI_WINDOWB 1
23#define VI_TIMEB 1
24#define VI_FLOORB 2
25#define VI_RESB 3
26#define VI_MAPB 1
27
28#include "backends.h"
29
30#if defined(_WIN32) && defined(VORBISDLL_IMPORT)
31# define EXTERN __declspec(dllimport) extern
32#else
33# define EXTERN extern
34#endif
35
36EXTERN vorbis_func_floor *_floor_P[];
37EXTERN vorbis_func_residue *_residue_P[];
38EXTERN vorbis_func_mapping *_mapping_P[];
39
40#endif
diff --git a/apps/codecs/libtremor/res012.c b/apps/codecs/libtremor/res012.c
new file mode 100644
index 0000000000..46b782def1
--- /dev/null
+++ b/apps/codecs/libtremor/res012.c
@@ -0,0 +1,344 @@
1/********************************************************************
2 * *
3 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
4 * *
5 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
6 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
7 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
8 * *
9 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
10 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
11 * *
12 ********************************************************************
13
14 function: residue backend 0, 1 and 2 implementation
15
16 ********************************************************************/
17
18#include "config-tremor.h"
19#include <string.h>
20#include <math.h>
21#include "ogg.h"
22#include "ivorbiscodec.h"
23#include "codec_internal.h"
24#include "registry.h"
25#include "codebook.h"
26#include "misc.h"
27#include "os.h"
28
29typedef struct {
30 vorbis_info_residue0 *info;
31 int map;
32
33 int parts;
34 int stages;
35 codebook *fullbooks;
36 codebook *phrasebook;
37 codebook ***partbooks;
38
39 int partvals;
40 int **decodemap;
41
42} vorbis_look_residue0;
43
44static void res0_free_info(vorbis_info_residue *i){
45 vorbis_info_residue0 *info=(vorbis_info_residue0 *)i;
46 if(info){
47 memset(info,0,sizeof(*info));
48 _ogg_free(info);
49 }
50}
51
52static void res0_free_look(vorbis_look_residue *i){
53 int j;
54 if(i){
55
56 vorbis_look_residue0 *look=(vorbis_look_residue0 *)i;
57
58 for(j=0;j<look->parts;j++)
59 if(look->partbooks[j])_ogg_free(look->partbooks[j]);
60 _ogg_free(look->partbooks);
61 for(j=0;j<look->partvals;j++)
62 _ogg_free(look->decodemap[j]);
63 _ogg_free(look->decodemap);
64
65 memset(look,0,sizeof(*look));
66 _ogg_free(look);
67 }
68}
69
70static int ilog(unsigned int v){
71 int ret=0;
72 while(v){
73 ret++;
74 v>>=1;
75 }
76 return(ret);
77}
78
79static int icount(unsigned int v){
80 int ret=0;
81 while(v){
82 ret+=v&1;
83 v>>=1;
84 }
85 return(ret);
86}
87
88/* vorbis_info is for range checking */
89static vorbis_info_residue *res0_unpack(vorbis_info *vi,oggpack_buffer *opb){
90 int j,acc=0;
91 vorbis_info_residue0 *info=(vorbis_info_residue0 *)_ogg_calloc(1,sizeof(*info));
92 codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
93
94 info->begin=oggpack_read(opb,24);
95 info->end=oggpack_read(opb,24);
96 info->grouping=oggpack_read(opb,24)+1;
97 info->partitions=oggpack_read(opb,6)+1;
98 info->groupbook=oggpack_read(opb,8);
99
100 for(j=0;j<info->partitions;j++){
101 int cascade=oggpack_read(opb,3);
102 if(oggpack_read(opb,1))
103 cascade|=(oggpack_read(opb,5)<<3);
104 info->secondstages[j]=cascade;
105
106 acc+=icount(cascade);
107 }
108 for(j=0;j<acc;j++)
109 info->booklist[j]=oggpack_read(opb,8);
110
111 if(info->groupbook>=ci->books)goto errout;
112 for(j=0;j<acc;j++)
113 if(info->booklist[j]>=ci->books)goto errout;
114
115 return(info);
116 errout:
117 res0_free_info(info);
118 return(NULL);
119}
120
121static vorbis_look_residue *res0_look(vorbis_dsp_state *vd,vorbis_info_mode *vm,
122 vorbis_info_residue *vr){
123 vorbis_info_residue0 *info=(vorbis_info_residue0 *)vr;
124 vorbis_look_residue0 *look=(vorbis_look_residue0 *)_ogg_calloc(1,sizeof(*look));
125 codec_setup_info *ci=(codec_setup_info *)vd->vi->codec_setup;
126
127 int j,k,acc=0;
128 int dim;
129 int maxstage=0;
130 look->info=info;
131 look->map=vm->mapping;
132
133 look->parts=info->partitions;
134 look->fullbooks=ci->fullbooks;
135 look->phrasebook=ci->fullbooks+info->groupbook;
136 dim=look->phrasebook->dim;
137
138 look->partbooks=(codebook ***)_ogg_calloc(look->parts,sizeof(*look->partbooks));
139
140 for(j=0;j<look->parts;j++){
141 int stages=ilog(info->secondstages[j]);
142 if(stages){
143 if(stages>maxstage)maxstage=stages;
144 look->partbooks[j]=(codebook **)_ogg_calloc(stages,sizeof(*look->partbooks[j]));
145 for(k=0;k<stages;k++)
146 if(info->secondstages[j]&(1<<k)){
147 look->partbooks[j][k]=ci->fullbooks+info->booklist[acc++];
148#ifdef TRAIN_RES
149 look->training_data[k][j]=calloc(look->partbooks[j][k]->entries,
150 sizeof(***look->training_data));
151#endif
152 }
153 }
154 }
155
156 look->partvals=look->parts;
157 for(j=1;j<dim;j++)look->partvals*=look->parts;
158 look->stages=maxstage;
159 look->decodemap=(int **)_ogg_malloc(look->partvals*sizeof(*look->decodemap));
160 for(j=0;j<look->partvals;j++){
161 long val=j;
162 long mult=look->partvals/look->parts;
163 look->decodemap[j]=(int *)_ogg_malloc(dim*sizeof(*look->decodemap[j]));
164 for(k=0;k<dim;k++){
165 long deco=val/mult;
166 val-=deco*mult;
167 mult/=look->parts;
168 look->decodemap[j][k]=deco;
169 }
170 }
171
172 return(look);
173}
174
175#define CHANNELS 2
176
177/* a truncated packet here just means 'stop working'; it's not an error */
178static int _01inverse(vorbis_block *vb,vorbis_look_residue *vl,
179 ogg_int32_t **in,int ch,
180 long (*decodepart)(codebook *, ogg_int32_t *,
181 oggpack_buffer *,int,int)){
182
183 long i,j,k,l,s;
184 vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl;
185 vorbis_info_residue0 *info=look->info;
186
187 /* move all this setup out later */
188 int samples_per_partition=info->grouping;
189 int partitions_per_word=look->phrasebook->dim;
190 int max=vb->pcmend>>1;
191 int end=(info->end<max?info->end:max);
192 int n=end-info->begin;
193
194 if(n>0){
195 int partvals=n/samples_per_partition;
196 int partwords=(partvals+partitions_per_word-1)/partitions_per_word;
197 int ***partword=(int ***)alloca(ch*sizeof(*partword));
198
199 for(j=0;j<ch;j++)
200 partword[j]=(int **)_vorbis_block_alloc(vb,partwords*sizeof(*partword[j]));
201
202 for(s=0;s<look->stages;s++){
203
204 /* each loop decodes on partition codeword containing
205 partitions_pre_word partitions */
206 for(i=0,l=0;i<partvals;l++){
207 if(s==0){
208 /* fetch the partition word for each channel */
209 for(j=0;j<ch;j++){
210 int temp=vorbis_book_decode(look->phrasebook,&vb->opb);
211 if(temp==-1)goto eopbreak;
212 partword[j][l]=look->decodemap[temp];
213 if(partword[j][l]==NULL)goto errout;
214 }
215 }
216
217 /* now we decode residual values for the partitions */
218 for(k=0;k<partitions_per_word && i<partvals;k++,i++)
219 for(j=0;j<ch;j++){
220 long offset=info->begin+i*samples_per_partition;
221 if(info->secondstages[partword[j][l][k]]&(1<<s)){
222 codebook *stagebook=look->partbooks[partword[j][l][k]][s];
223 if(stagebook){
224 if(decodepart(stagebook,in[j]+offset,&vb->opb,
225 samples_per_partition,-8)==-1)goto eopbreak;
226 }
227 }
228 }
229 }
230 }
231 }
232 errout:
233 eopbreak:
234 return(0);
235}
236
237static int res0_inverse(vorbis_block *vb,vorbis_look_residue *vl,
238 ogg_int32_t **in,int *nonzero,int ch){
239 int i,used=0;
240 for(i=0;i<ch;i++)
241 if(nonzero[i])
242 in[used++]=in[i];
243 if(used)
244 return(_01inverse(vb,vl,in,used,vorbis_book_decodevs_add));
245 else
246 return(0);
247}
248
249static int res1_inverse(vorbis_block *vb,vorbis_look_residue *vl,
250 ogg_int32_t **in,int *nonzero,int ch){
251 int i,used=0;
252 for(i=0;i<ch;i++)
253 if(nonzero[i])
254 in[used++]=in[i];
255 if(used)
256 return(_01inverse(vb,vl,in,used,vorbis_book_decodev_add));
257 else
258 return(0);
259}
260
261/* duplicate code here as speed is somewhat more important */
262int res2_inverse(vorbis_block *vb,vorbis_look_residue *vl,
263 ogg_int32_t **in,int *nonzero,int ch)
264 ICODE_ATTR_TREMOR_NOT_MDCT;
265int res2_inverse(vorbis_block *vb,vorbis_look_residue *vl,
266 ogg_int32_t **in,int *nonzero,int ch){
267 long i,k,l,s;
268 vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl;
269 vorbis_info_residue0 *info=look->info;
270
271 /* move all this setup out later */
272 int samples_per_partition=info->grouping;
273 int partitions_per_word=look->phrasebook->dim;
274 int max=(vb->pcmend*ch)>>1;
275 int end=(info->end<max?info->end:max);
276 int n=end-info->begin;
277
278 if(n>0){
279
280 int partvals=n/samples_per_partition;
281 int partwords=(partvals+partitions_per_word-1)/partitions_per_word;
282 int **partword=(int **)_vorbis_block_alloc(vb,partwords*sizeof(*partword));
283 int beginoff=info->begin/ch;
284
285 for(i=0;i<ch;i++)if(nonzero[i])break;
286 if(i==ch)return(0); /* no nonzero vectors */
287
288 samples_per_partition/=ch;
289
290 for(s=0;s<look->stages;s++){
291 for(i=0,l=0;i<partvals;l++){
292
293 if(s==0){
294 /* fetch the partition word */
295 int temp=vorbis_book_decode(look->phrasebook,&vb->opb);
296 if(temp==-1)goto eopbreak;
297 partword[l]=look->decodemap[temp];
298 if(partword[l]==NULL)goto errout;
299 }
300
301 /* now we decode residual values for the partitions */
302 for(k=0;k<partitions_per_word && i<partvals;k++,i++)
303 if(info->secondstages[partword[l][k]]&(1<<s)){
304 codebook *stagebook=look->partbooks[partword[l][k]][s];
305 if(stagebook){
306 if(vorbis_book_decodevv_add(stagebook,in,
307 i*samples_per_partition+beginoff,ch,
308 &vb->opb,
309 samples_per_partition,-8)==-1)
310 goto eopbreak;
311 }
312 }
313 }
314 }
315 }
316 errout:
317 eopbreak:
318 return(0);
319}
320
321
322const vorbis_func_residue residue0_exportbundle ICONST_ATTR ={
323 &res0_unpack,
324 &res0_look,
325 &res0_free_info,
326 &res0_free_look,
327 &res0_inverse
328};
329
330const vorbis_func_residue residue1_exportbundle ICONST_ATTR ={
331 &res0_unpack,
332 &res0_look,
333 &res0_free_info,
334 &res0_free_look,
335 &res1_inverse
336};
337
338const vorbis_func_residue residue2_exportbundle ICONST_ATTR ={
339 &res0_unpack,
340 &res0_look,
341 &res0_free_info,
342 &res0_free_look,
343 &res2_inverse
344};
diff --git a/apps/codecs/libtremor/sharedbook.c b/apps/codecs/libtremor/sharedbook.c
new file mode 100644
index 0000000000..edabf3ccb3
--- /dev/null
+++ b/apps/codecs/libtremor/sharedbook.c
@@ -0,0 +1,444 @@
1/********************************************************************
2 * *
3 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
4 * *
5 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
6 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
7 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
8 * *
9 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
10 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
11 * *
12 ********************************************************************
13
14 function: basic shared codebook operations
15
16 ********************************************************************/
17
18#include "config-tremor.h"
19#include <math.h>
20#include <string.h>
21#include "ogg.h"
22#include "os.h"
23#include "misc.h"
24#include "ivorbiscodec.h"
25#include "codebook.h"
26
27/**** pack/unpack helpers ******************************************/
28int _ilog(unsigned int v){
29 int ret=0;
30 while(v){
31 ret++;
32 v>>=1;
33 }
34 return(ret);
35}
36
37/* 32 bit float (not IEEE; nonnormalized mantissa +
38 biased exponent) : neeeeeee eeemmmmm mmmmmmmm mmmmmmmm
39 Why not IEEE? It's just not that important here. */
40
41#define VQ_FEXP 10
42#define VQ_FMAN 21
43#define VQ_FEXP_BIAS 768 /* bias toward values smaller than 1. */
44
45static ogg_int32_t _float32_unpack(long val,int *point){
46 long mant=val&0x1fffff;
47 int sign=val&0x80000000;
48 long exp =(val&0x7fe00000L)>>VQ_FMAN;
49
50 exp-=(VQ_FMAN-1)+VQ_FEXP_BIAS;
51
52 if(mant){
53 while(!(mant&0x40000000)){
54 mant<<=1;
55 exp-=1;
56 }
57
58 if(sign)mant= -mant;
59 }else{
60 sign=0;
61 exp=-9999;
62 }
63
64 *point=exp;
65 return mant;
66}
67
68/* given a list of word lengths, generate a list of codewords. Works
69 for length ordered or unordered, always assigns the lowest valued
70 codewords first. Extended to handle unused entries (length 0) */
71static ogg_uint32_t *_make_words(long *l,long n,long sparsecount){
72 long i,j,count=0;
73 ogg_uint32_t marker[33];
74 ogg_uint32_t *r=(ogg_uint32_t *)ogg_tmpmalloc((sparsecount?sparsecount:n)*sizeof(*r));
75 memset(marker,0,sizeof(marker));
76
77 for(i=0;i<n;i++){
78 long length=l[i];
79 if(length>0){
80 ogg_uint32_t entry=marker[length];
81
82 /* when we claim a node for an entry, we also claim the nodes
83 below it (pruning off the imagined tree that may have dangled
84 from it) as well as blocking the use of any nodes directly
85 above for leaves */
86
87 /* update ourself */
88 if(length<32 && (entry>>length)){
89 /* error condition; the lengths must specify an overpopulated tree */
90 /* _ogg_free(r); */
91 return(NULL);
92 }
93 r[count++]=entry;
94
95 /* Look to see if the next shorter marker points to the node
96 above. if so, update it and repeat. */
97 {
98 for(j=length;j>0;j--){
99
100 if(marker[j]&1){
101 /* have to jump branches */
102 if(j==1)
103 marker[1]++;
104 else
105 marker[j]=marker[j-1]<<1;
106 break; /* invariant says next upper marker would already
107 have been moved if it was on the same path */
108 }
109 marker[j]++;
110 }
111 }
112
113 /* prune the tree; the implicit invariant says all the longer
114 markers were dangling from our just-taken node. Dangle them
115 from our *new* node. */
116 for(j=length+1;j<33;j++)
117 if((marker[j]>>1) == entry){
118 entry=marker[j];
119 marker[j]=marker[j-1]<<1;
120 }else
121 break;
122 }else
123 if(sparsecount==0)count++;
124 }
125
126 /* bitreverse the words because our bitwise packer/unpacker is LSb
127 endian */
128 for(i=0,count=0;i<n;i++){
129 ogg_uint32_t temp=0;
130 for(j=0;j<l[i];j++){
131 temp<<=1;
132 temp|=(r[count]>>j)&1;
133 }
134
135 if(sparsecount){
136 if(l[i])
137 r[count++]=temp;
138 }else
139 r[count++]=temp;
140 }
141
142 return(r);
143}
144
145/* there might be a straightforward one-line way to do the below
146 that's portable and totally safe against roundoff, but I haven't
147 thought of it. Therefore, we opt on the side of caution */
148long _book_maptype1_quantvals(const static_codebook *b){
149 /* get us a starting hint, we'll polish it below */
150 int bits=_ilog(b->entries);
151 int vals=b->entries>>((bits-1)*(b->dim-1)/b->dim);
152
153 while(1){
154 long acc=1;
155 long acc1=1;
156 int i;
157 for(i=0;i<b->dim;i++){
158 acc*=vals;
159 acc1*=vals+1;
160 }
161 if(acc<=b->entries && acc1>b->entries){
162 return(vals);
163 }else{
164 if(acc>b->entries){
165 vals--;
166 }else{
167 vals++;
168 }
169 }
170 }
171}
172
173/* different than what _book_unquantize does for mainline:
174 we repack the book in a fixed point format that shares the same
175 binary point. Upon first use, we can shift point if needed */
176
177/* we need to deal with two map types: in map type 1, the values are
178 generated algorithmically (each column of the vector counts through
179 the values in the quant vector). in map type 2, all the values came
180 in in an explicit list. Both value lists must be unpacked */
181
182static ogg_int32_t *_book_unquantize(const static_codebook *b,int n,
183 int *sparsemap,int *maxpoint){
184 long j,k,count=0;
185 if(b->maptype==1 || b->maptype==2){
186 int quantvals;
187 int minpoint,delpoint;
188 ogg_int32_t mindel=_float32_unpack(b->q_min,&minpoint);
189 ogg_int32_t delta=_float32_unpack(b->q_delta,&delpoint);
190 ogg_int32_t *r=(ogg_int32_t *)_ogg_calloc(n*b->dim,sizeof(*r));
191 int *rp=(int *)ogg_tmpcalloc(n*b->dim,sizeof(*rp));
192
193 memset(rp, 0, n*b->dim*sizeof(*rp));
194 *maxpoint=minpoint;
195
196 /* maptype 1 and 2 both use a quantized value vector, but
197 different sizes */
198 switch(b->maptype){
199 case 1:
200 /* most of the time, entries%dimensions == 0, but we need to be
201 well defined. We define that the possible vales at each
202 scalar is values == entries/dim. If entries%dim != 0, we'll
203 have 'too few' values (values*dim<entries), which means that
204 we'll have 'left over' entries; left over entries use zeroed
205 values (and are wasted). So don't generate codebooks like
206 that */
207 quantvals=_book_maptype1_quantvals(b);
208 for(j=0;j<b->entries;j++){
209 if((sparsemap && b->lengthlist[j]) || !sparsemap){
210 ogg_int32_t last=0;
211 int lastpoint=0;
212 int indexdiv=1;
213 for(k=0;k<b->dim;k++){
214 int index= (j/indexdiv)%quantvals;
215 int point=0;
216 int val=VFLOAT_MULTI(delta,delpoint,
217 abs(b->quantlist[index]),&point);
218
219 val=VFLOAT_ADD(mindel,minpoint,val,point,&point);
220 val=VFLOAT_ADD(last,lastpoint,val,point,&point);
221
222 if(b->q_sequencep){
223 last=val;
224 lastpoint=point;
225 }
226
227 if(sparsemap){
228 r[sparsemap[count]*b->dim+k]=val;
229 rp[sparsemap[count]*b->dim+k]=point;
230 }else{
231 r[count*b->dim+k]=val;
232 rp[count*b->dim+k]=point;
233 }
234 if(*maxpoint<point)*maxpoint=point;
235 indexdiv*=quantvals;
236 }
237 count++;
238 }
239
240 }
241 break;
242 case 2:
243 for(j=0;j<b->entries;j++){
244 if((sparsemap && b->lengthlist[j]) || !sparsemap){
245 ogg_int32_t last=0;
246 int lastpoint=0;
247
248 for(k=0;k<b->dim;k++){
249 int point=0;
250 int val=VFLOAT_MULTI(delta,delpoint,
251 abs(b->quantlist[j*b->dim+k]),&point);
252
253 val=VFLOAT_ADD(mindel,minpoint,val,point,&point);
254 val=VFLOAT_ADD(last,lastpoint,val,point,&point);
255
256 if(b->q_sequencep){
257 last=val;
258 lastpoint=point;
259 }
260
261 if(sparsemap){
262 r[sparsemap[count]*b->dim+k]=val;
263 rp[sparsemap[count]*b->dim+k]=point;
264 }else{
265 r[count*b->dim+k]=val;
266 rp[count*b->dim+k]=point;
267 }
268 if(*maxpoint<point)*maxpoint=point;
269 }
270 count++;
271 }
272 }
273 break;
274 }
275
276 for(j=0;j<n*b->dim;j++)
277 if(rp[j]<*maxpoint)
278 r[j]>>=*maxpoint-rp[j];
279
280 /* _ogg_free(rp); */
281 return(r);
282 }
283 return(NULL);
284}
285
286void vorbis_staticbook_clear(static_codebook *b){
287 if(b->quantlist)_ogg_free(b->quantlist);
288 if(b->lengthlist)_ogg_free(b->lengthlist);
289 memset(b,0,sizeof(*b));
290
291}
292
293void vorbis_staticbook_destroy(static_codebook *b){
294 vorbis_staticbook_clear(b);
295 _ogg_free(b);
296}
297
298void vorbis_book_clear(codebook *b){
299 /* static book is not cleared; we're likely called on the lookup and
300 the static codebook belongs to the info struct */
301 if(b->valuelist)_ogg_free(b->valuelist);
302 if(b->codelist)_ogg_free(b->codelist);
303
304 if(b->dec_index)_ogg_free(b->dec_index);
305 if(b->dec_codelengths)_ogg_free(b->dec_codelengths);
306 if(b->dec_firsttable)_ogg_free(b->dec_firsttable);
307
308 memset(b,0,sizeof(*b));
309}
310
311static ogg_uint32_t bitreverse(ogg_uint32_t x){
312 x= ((x>>16)&0x0000ffffUL) | ((x<<16)&0xffff0000UL);
313 x= ((x>> 8)&0x00ff00ffUL) | ((x<< 8)&0xff00ff00UL);
314 x= ((x>> 4)&0x0f0f0f0fUL) | ((x<< 4)&0xf0f0f0f0UL);
315 x= ((x>> 2)&0x33333333UL) | ((x<< 2)&0xccccccccUL);
316 return((x>> 1)&0x55555555UL) | ((x<< 1)&0xaaaaaaaaUL);
317}
318
319static int sort32a(const void *a,const void *b){
320 return (**(ogg_uint32_t **)a>**(ogg_uint32_t **)b)-
321 (**(ogg_uint32_t **)a<**(ogg_uint32_t **)b);
322}
323
324/* decode codebook arrangement is more heavily optimized than encode */
325int vorbis_book_init_decode(codebook *c,const static_codebook *s){
326 int i,j,n=0,tabn;
327 int *sortindex;
328 long pos = ogg_tmpmalloc_pos();
329 memset(c,0,sizeof(*c));
330
331 /* count actually used entries */
332 for(i=0;i<s->entries;i++)
333 if(s->lengthlist[i]>0)
334 n++;
335
336 c->entries=s->entries;
337 c->used_entries=n;
338 c->dim=s->dim;
339
340 if(n>0){
341 /* two different remappings go on here.
342
343 First, we collapse the likely sparse codebook down only to
344 actually represented values/words. This collapsing needs to be
345 indexed as map-valueless books are used to encode original entry
346 positions as integers.
347
348 Second, we reorder all vectors, including the entry index above,
349 by sorted bitreversed codeword to allow treeless decode. */
350
351 /* perform sort */
352 ogg_uint32_t *codes=_make_words(s->lengthlist,s->entries,c->used_entries);
353 ogg_uint32_t **codep=(ogg_uint32_t **)ogg_tmpmalloc(sizeof(*codep)*n);
354
355 if(codes==NULL||codep==NULL)goto err_out;
356
357 for(i=0;i<n;i++){
358 codes[i]=bitreverse(codes[i]);
359 codep[i]=codes+i;
360 }
361
362 qsort(codep,n,sizeof(*codep),sort32a);
363
364 sortindex=(int *)ogg_tmpmalloc(n*sizeof(*sortindex));
365 c->codelist=(ogg_uint32_t *)_ogg_malloc(n*sizeof(*c->codelist));
366 /* the index is a reverse index */
367 for(i=0;i<n;i++){
368 int position=codep[i]-codes;
369 sortindex[position]=i;
370 }
371
372 for(i=0;i<n;i++)
373 c->codelist[sortindex[i]]=codes[i];
374 /* _ogg_free(codes); */
375
376
377
378 c->valuelist=_book_unquantize(s,n,sortindex,&c->binarypoint);
379 c->dec_index=(int *)_ogg_malloc(n*sizeof(*c->dec_index));
380
381 for(n=0,i=0;i<s->entries;i++)
382 if(s->lengthlist[i]>0)
383 c->dec_index[sortindex[n++]]=i;
384
385 c->dec_codelengths=(char *)_ogg_malloc(n*sizeof(*c->dec_codelengths));
386 for(n=0,i=0;i<s->entries;i++)
387 if(s->lengthlist[i]>0)
388 c->dec_codelengths[sortindex[n++]]=s->lengthlist[i];
389
390 c->dec_firsttablen=_ilog(c->used_entries)-4; /* this is magic */
391 if(c->dec_firsttablen<5)c->dec_firsttablen=5;
392 if(c->dec_firsttablen>8)c->dec_firsttablen=8;
393
394 tabn=1<<c->dec_firsttablen;
395 c->dec_firsttable=(ogg_uint32_t *)_ogg_calloc(tabn,sizeof(*c->dec_firsttable));
396 c->dec_maxlength=0;
397
398 for(i=0;i<n;i++){
399 if(c->dec_maxlength<c->dec_codelengths[i])
400 c->dec_maxlength=c->dec_codelengths[i];
401 if(c->dec_codelengths[i]<=c->dec_firsttablen){
402 ogg_uint32_t orig=bitreverse(c->codelist[i]);
403 for(j=0;j<(1<<(c->dec_firsttablen-c->dec_codelengths[i]));j++)
404 c->dec_firsttable[orig|(j<<c->dec_codelengths[i])]=i+1;
405 }
406 }
407
408 /* now fill in 'unused' entries in the firsttable with hi/lo search
409 hints for the non-direct-hits */
410 {
411 ogg_uint32_t mask=0xfffffffeUL<<(31-c->dec_firsttablen);
412 long lo=0,hi=0;
413
414 for(i=0;i<tabn;i++){
415 ogg_uint32_t word=i<<(32-c->dec_firsttablen);
416 if(c->dec_firsttable[bitreverse(word)]==0){
417 while((lo+1)<n && c->codelist[lo+1]<=word)lo++;
418 while( hi<n && word>=(c->codelist[hi]&mask))hi++;
419
420 /* we only actually have 15 bits per hint to play with here.
421 In order to overflow gracefully (nothing breaks, efficiency
422 just drops), encode as the difference from the extremes. */
423 {
424 unsigned long loval=lo;
425 unsigned long hival=n-hi;
426
427 if(loval>0x7fff)loval=0x7fff;
428 if(hival>0x7fff)hival=0x7fff;
429 c->dec_firsttable[bitreverse(word)]=
430 0x80000000UL | (loval<<15) | hival;
431 }
432 }
433 }
434 }
435 }
436
437 ogg_tmpmalloc_free(pos);
438 return(0);
439 err_out:
440 ogg_tmpmalloc_free(pos);
441 vorbis_book_clear(c);
442 return(-1);
443}
444
diff --git a/apps/codecs/libtremor/synthesis.c b/apps/codecs/libtremor/synthesis.c
new file mode 100644
index 0000000000..cef240e796
--- /dev/null
+++ b/apps/codecs/libtremor/synthesis.c
@@ -0,0 +1,134 @@
1/********************************************************************
2 * *
3 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
4 * *
5 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
6 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
7 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
8 * *
9 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2003 *
10 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
11 * *
12 ********************************************************************
13
14 function: single-block PCM synthesis
15 last mod: $Id$
16
17 ********************************************************************/
18
19#include <stdio.h>
20#include "ogg.h"
21#include "ivorbiscodec.h"
22#include "codec_internal.h"
23#include "registry.h"
24#include "misc.h"
25#include "os.h"
26
27
28/* IRAM buffer keep the block pcm data; only for windows size upto 2048
29 for space restrictions.
30 libVorbis 1.1 Oggenc doesn't use larger windows anyway. */
31/* max 2 channels on the ihp-1xx (stereo), 2048 samples (2*2048*4=16Kb) */
32#define IRAM_PCM_END 2048
33#define CHANNELS 2
34
35static ogg_int32_t *ipcm_vect[CHANNELS] IBSS_ATTR;
36static ogg_int32_t ipcm_buff[CHANNELS*IRAM_PCM_END] IBSS_ATTR LINE_ATTR;
37
38int vorbis_synthesis(vorbis_block *vb,ogg_packet *op,int decodep)
39 ICODE_ATTR_TREMOR_NOT_MDCT;
40int vorbis_synthesis(vorbis_block *vb,ogg_packet *op,int decodep){
41 vorbis_dsp_state *vd=vb->vd;
42 private_state *b=(private_state *)vd->backend_state;
43 vorbis_info *vi=vd->vi;
44 codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
45 oggpack_buffer *opb=&vb->opb;
46 int type,mode,i;
47
48 /* first things first. Make sure decode is ready */
49 _vorbis_block_ripcord(vb);
50 oggpack_readinit(opb,op->packet);
51
52 /* Check the packet type */
53 if(oggpack_read(opb,1)!=0){
54 /* Oops. This is not an audio data packet */
55 return(OV_ENOTAUDIO);
56 }
57
58 /* read our mode and pre/post windowsize */
59 mode=oggpack_read(opb,b->modebits);
60 if(mode==-1)return(OV_EBADPACKET);
61
62 vb->mode=mode;
63 vb->W=ci->mode_param[mode]->blockflag;
64 if(vb->W){
65 vb->lW=oggpack_read(opb,1);
66 vb->nW=oggpack_read(opb,1);
67 if(vb->nW==-1) return(OV_EBADPACKET);
68 }else{
69 vb->lW=0;
70 vb->nW=0;
71 }
72
73 /* more setup */
74 vb->granulepos=op->granulepos;
75 vb->sequence=op->packetno-3; /* first block is third packet */
76 vb->eofflag=op->e_o_s;
77
78 if(decodep && vi->channels<=CHANNELS){
79 /* alloc pcm passback storage */
80 vb->pcmend=ci->blocksizes[vb->W];
81 if (vb->pcmend<=IRAM_PCM_END) {
82 /* use statically allocated iram buffer */
83 vb->pcm = ipcm_vect;
84 for(i=0; i<CHANNELS; i++)
85 vb->pcm[i] = &ipcm_buff[i*IRAM_PCM_END];
86 } else {
87 /* dynamic allocation (slower) */
88 vb->pcm=(ogg_int32_t **)_vorbis_block_alloc(vb,sizeof(*vb->pcm)*vi->channels);
89 for(i=0;i<vi->channels;i++)
90 vb->pcm[i]=(ogg_int32_t *)_vorbis_block_alloc(vb,vb->pcmend*sizeof(*vb->pcm[i]));
91 }
92
93 /* unpack_header enforces range checking */
94 type=ci->map_type[ci->mode_param[mode]->mapping];
95
96 return(_mapping_P[type]->inverse(vb,b->mode[mode]));
97 }else{
98 /* no pcm */
99 vb->pcmend=0;
100 vb->pcm=NULL;
101
102 return(0);
103 }
104}
105
106long vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op){
107 codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
108 oggpack_buffer opb;
109 int mode;
110
111 oggpack_readinit(&opb,op->packet);
112
113 /* Check the packet type */
114 if(oggpack_read(&opb,1)!=0){
115 /* Oops. This is not an audio data packet */
116 return(OV_ENOTAUDIO);
117 }
118
119 {
120 int modebits=0;
121 int v=ci->modes;
122 while(v>1){
123 modebits++;
124 v>>=1;
125 }
126
127 /* read our mode and pre/post windowsize */
128 mode=oggpack_read(&opb,modebits);
129 }
130 if(mode==-1)return(OV_EBADPACKET);
131 return(ci->blocksizes[ci->mode_param[mode]->blockflag]);
132}
133
134
diff --git a/apps/codecs/libtremor/vorbisfile.c b/apps/codecs/libtremor/vorbisfile.c
new file mode 100644
index 0000000000..ca18ecb3f7
--- /dev/null
+++ b/apps/codecs/libtremor/vorbisfile.c
@@ -0,0 +1,1362 @@
1/********************************************************************
2 * *
3 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
4 * *
5 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
6 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
7 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
8 * *
9 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2003 *
10 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
11 * *
12 ********************************************************************
13
14 function: stdio-based convenience library for opening/seeking/decoding
15 last mod: $Id$
16
17 ********************************************************************/
18
19#include "config-tremor.h"
20#include <stdio.h>
21#include <errno.h>
22#include <string.h>
23#include <math.h>
24#include "system.h"
25
26#include "ivorbiscodec.h"
27#include "ivorbisfile.h"
28
29#include "os.h"
30#include "misc.h"
31
32/* A 'chained bitstream' is a Vorbis bitstream that contains more than
33 one logical bitstream arranged end to end (the only form of Ogg
34 multiplexing allowed in a Vorbis bitstream; grouping [parallel
35 multiplexing] is not allowed in Vorbis) */
36
37/* A Vorbis file can be played beginning to end (streamed) without
38 worrying ahead of time about chaining (see decoder_example.c). If
39 we have the whole file, however, and want random access
40 (seeking/scrubbing) or desire to know the total length/time of a
41 file, we need to account for the possibility of chaining. */
42
43/* We can handle things a number of ways; we can determine the entire
44 bitstream structure right off the bat, or find pieces on demand.
45 This example determines and caches structure for the entire
46 bitstream, but builds a virtual decoder on the fly when moving
47 between links in the chain. */
48
49/* There are also different ways to implement seeking. Enough
50 information exists in an Ogg bitstream to seek to
51 sample-granularity positions in the output. Or, one can seek by
52 picking some portion of the stream roughly in the desired area if
53 we only want coarse navigation through the stream. */
54
55/*************************************************************************
56 * Many, many internal helpers. The intention is not to be confusing;
57 * rampant duplication and monolithic function implementation would be
58 * harder to understand anyway. The high level functions are last. Begin
59 * grokking near the end of the file */
60
61
62/* read a little more data from the file/pipe into the ogg_sync framer */
63static long _get_data(OggVorbis_File *vf){
64 if(vf->datasource){
65 char *buffer=(char *)ogg_sync_bufferin(vf->oy,CHUNKSIZE);
66 long bytes=(vf->callbacks.read_func)(buffer,1,CHUNKSIZE,vf->datasource);
67 if(bytes>0)ogg_sync_wrote(vf->oy,bytes);
68 return(bytes);
69 }else
70 return(0);
71}
72
73/* save a tiny smidge of verbosity to make the code more readable */
74static void _seek_helper(OggVorbis_File *vf,ogg_int64_t offset){
75 if(vf->datasource){
76 (vf->callbacks.seek_func)(vf->datasource, offset, SEEK_SET);
77 vf->offset=offset;
78 ogg_sync_reset(vf->oy);
79 }else{
80 /* shouldn't happen unless someone writes a broken callback */
81 return;
82 }
83}
84
85/* The read/seek functions track absolute position within the stream */
86
87/* from the head of the stream, get the next page. boundary specifies
88 if the function is allowed to fetch more data from the stream (and
89 how much) or only use internally buffered data.
90
91 boundary: -1) unbounded search
92 0) read no additional data; use cached only
93 n) search for a new page beginning for n bytes
94
95 return: <0) did not find a page (OV_FALSE, OV_EOF, OV_EREAD)
96 n) found a page at absolute offset n
97
98 produces a refcounted page */
99
100static ogg_int64_t _get_next_page(OggVorbis_File *vf,ogg_page *og,
101 ogg_int64_t boundary){
102 if(boundary>0)boundary+=vf->offset;
103 while(1){
104 long more;
105
106 if(boundary>0 && vf->offset>=boundary)return(OV_FALSE);
107 more=ogg_sync_pageseek(vf->oy,og);
108
109 if(more<0){
110 /* skipped n bytes */
111 vf->offset-=more;
112 }else{
113 if(more==0){
114 /* send more paramedics */
115 if(!boundary)return(OV_FALSE);
116 {
117 long ret=_get_data(vf);
118 if(ret==0)return(OV_EOF);
119 if(ret<0)return(OV_EREAD);
120 }
121 }else{
122 /* got a page. Return the offset at the page beginning,
123 advance the internal offset past the page end */
124 ogg_int64_t ret=vf->offset;
125 vf->offset+=more;
126 return(ret);
127
128 }
129 }
130 }
131}
132
133/* find the latest page beginning before the current stream cursor
134 position. Much dirtier than the above as Ogg doesn't have any
135 backward search linkage. no 'readp' as it will certainly have to
136 read. */
137/* returns offset or OV_EREAD, OV_FAULT and produces a refcounted page */
138
139static ogg_int64_t _get_prev_page(OggVorbis_File *vf,ogg_page *og){
140 ogg_int64_t begin=vf->offset;
141 ogg_int64_t end=begin;
142 ogg_int64_t ret;
143 ogg_int64_t offset=-1;
144
145 while(offset==-1){
146 begin-=CHUNKSIZE;
147 if(begin<0)
148 begin=0;
149 _seek_helper(vf,begin);
150 while(vf->offset<end){
151 ret=_get_next_page(vf,og,end-vf->offset);
152 if(ret==OV_EREAD)return(OV_EREAD);
153 if(ret<0){
154 break;
155 }else{
156 offset=ret;
157 }
158 }
159 }
160
161 /* we have the offset. Actually snork and hold the page now */
162 _seek_helper(vf,offset);
163 ret=_get_next_page(vf,og,CHUNKSIZE);
164 if(ret<0)
165 /* this shouldn't be possible */
166 return(OV_EFAULT);
167
168 return(offset);
169}
170
171/* finds each bitstream link one at a time using a bisection search
172 (has to begin by knowing the offset of the lb's initial page).
173 Recurses for each link so it can alloc the link storage after
174 finding them all, then unroll and fill the cache at the same time */
175static int _bisect_forward_serialno(OggVorbis_File *vf,
176 ogg_int64_t begin,
177 ogg_int64_t searched,
178 ogg_int64_t end,
179 ogg_uint32_t currentno,
180 long m){
181 ogg_int64_t endsearched=end;
182 ogg_int64_t next=end;
183 ogg_page og={0,0,0,0};
184 ogg_int64_t ret;
185
186 /* the below guards against garbage seperating the last and
187 first pages of two links. */
188 while(searched<endsearched){
189 ogg_int64_t bisect;
190
191 if(endsearched-searched<CHUNKSIZE){
192 bisect=searched;
193 }else{
194 bisect=(searched+endsearched)/2;
195 }
196
197 _seek_helper(vf,bisect);
198 ret=_get_next_page(vf,&og,-1);
199 if(ret==OV_EREAD)return(OV_EREAD);
200 if(ret<0 || ogg_page_serialno(&og)!=currentno){
201 endsearched=bisect;
202 if(ret>=0)next=ret;
203 }else{
204 searched=ret+og.header_len+og.body_len;
205 }
206 ogg_page_release(&og);
207 }
208
209 _seek_helper(vf,next);
210 ret=_get_next_page(vf,&og,-1);
211 if(ret==OV_EREAD)return(OV_EREAD);
212
213 if(searched>=end || ret<0){
214 ogg_page_release(&og);
215 vf->links=m+1;
216 vf->offsets=_ogg_malloc((vf->links+1)*sizeof(*vf->offsets));
217 vf->serialnos=_ogg_malloc(vf->links*sizeof(*vf->serialnos));
218 vf->offsets[m+1]=searched;
219 }else{
220 ret=_bisect_forward_serialno(vf,next,vf->offset,
221 end,ogg_page_serialno(&og),m+1);
222 ogg_page_release(&og);
223 if(ret==OV_EREAD)return(OV_EREAD);
224 }
225
226 vf->offsets[m]=begin;
227 vf->serialnos[m]=currentno;
228 return(0);
229}
230
231/* uses the local ogg_stream storage in vf; this is important for
232 non-streaming input sources */
233/* consumes the page that's passed in (if any) */
234
235static int _fetch_headers(OggVorbis_File *vf,
236 vorbis_info *vi,
237 vorbis_comment *vc,
238 ogg_uint32_t *serialno,
239 ogg_page *og_ptr){
240 ogg_page og={0,0,0,0};
241 ogg_packet op={0,0,0,0,0,0};
242 int i,ret;
243
244 if(!og_ptr){
245 ogg_int64_t llret=_get_next_page(vf,&og,CHUNKSIZE);
246 if(llret==OV_EREAD)return(OV_EREAD);
247 if(llret<0)return OV_ENOTVORBIS;
248 og_ptr=&og;
249 }
250
251 ogg_stream_reset_serialno(vf->os,ogg_page_serialno(og_ptr));
252 if(serialno)*serialno=vf->os->serialno;
253 vf->ready_state=STREAMSET;
254
255 /* extract the initial header from the first page and verify that the
256 Ogg bitstream is in fact Vorbis data */
257
258 vorbis_info_init(vi);
259 vorbis_comment_init(vc);
260
261 i=0;
262 while(i<3){
263 ogg_stream_pagein(vf->os,og_ptr);
264 while(i<3){
265 int result=ogg_stream_packetout(vf->os,&op);
266 if(result==0)break;
267 if(result==-1){
268 ret=OV_EBADHEADER;
269 goto bail_header;
270 }
271 if((ret=vorbis_synthesis_headerin(vi,vc,&op))){
272 goto bail_header;
273 }
274 i++;
275 }
276 if(i<3)
277 if(_get_next_page(vf,og_ptr,CHUNKSIZE)<0){
278 ret=OV_EBADHEADER;
279 goto bail_header;
280 }
281 }
282
283 ogg_packet_release(&op);
284 ogg_page_release(&og);
285 return 0;
286
287 bail_header:
288 ogg_packet_release(&op);
289 ogg_page_release(&og);
290 vorbis_info_clear(vi);
291 vorbis_comment_clear(vc);
292 vf->ready_state=OPENED;
293
294 return ret;
295}
296
297/* last step of the OggVorbis_File initialization; get all the
298 vorbis_info structs and PCM positions. Only called by the seekable
299 initialization (local stream storage is hacked slightly; pay
300 attention to how that's done) */
301
302/* this is void and does not propogate errors up because we want to be
303 able to open and use damaged bitstreams as well as we can. Just
304 watch out for missing information for links in the OggVorbis_File
305 struct */
306static void _prefetch_all_headers(OggVorbis_File *vf, ogg_int64_t dataoffset){
307 ogg_page og={0,0,0,0};
308 int i;
309 ogg_int64_t ret;
310
311 vf->vi=_ogg_realloc(vf->vi,vf->links*sizeof(*vf->vi));
312 vf->vc=_ogg_realloc(vf->vc,vf->links*sizeof(*vf->vc));
313 vf->dataoffsets=_ogg_malloc(vf->links*sizeof(*vf->dataoffsets));
314 vf->pcmlengths=_ogg_malloc(vf->links*2*sizeof(*vf->pcmlengths));
315
316 for(i=0;i<vf->links;i++){
317 if(i==0){
318 /* we already grabbed the initial header earlier. Just set the offset */
319 vf->dataoffsets[i]=dataoffset;
320 _seek_helper(vf,dataoffset);
321
322 }else{
323
324 /* seek to the location of the initial header */
325
326 _seek_helper(vf,vf->offsets[i]);
327 if(_fetch_headers(vf,vf->vi+i,vf->vc+i,NULL,NULL)<0){
328 vf->dataoffsets[i]=-1;
329 }else{
330 vf->dataoffsets[i]=vf->offset;
331 }
332 }
333
334 /* fetch beginning PCM offset */
335
336 if(vf->dataoffsets[i]!=-1){
337 ogg_int64_t accumulated=0,pos;
338 long lastblock=-1;
339 int result;
340
341 ogg_stream_reset_serialno(vf->os,vf->serialnos[i]);
342
343 while(1){
344 ogg_packet op={0,0,0,0,0,0};
345
346 ret=_get_next_page(vf,&og,-1);
347 if(ret<0)
348 /* this should not be possible unless the file is
349 truncated/mangled */
350 break;
351
352 if(ogg_page_serialno(&og)!=vf->serialnos[i])
353 break;
354
355 pos=ogg_page_granulepos(&og);
356
357 /* count blocksizes of all frames in the page */
358 ogg_stream_pagein(vf->os,&og);
359 while((result=ogg_stream_packetout(vf->os,&op))){
360 if(result>0){ /* ignore holes */
361 long thisblock=vorbis_packet_blocksize(vf->vi+i,&op);
362 if(lastblock!=-1)
363 accumulated+=(lastblock+thisblock)>>2;
364 lastblock=thisblock;
365 }
366 }
367 ogg_packet_release(&op);
368
369 if(pos!=-1){
370 /* pcm offset of last packet on the first audio page */
371 accumulated= pos-accumulated;
372 break;
373 }
374 }
375
376 /* less than zero? This is a stream with samples trimmed off
377 the beginning, a normal occurrence; set the offset to zero */
378 if(accumulated<0)accumulated=0;
379
380 vf->pcmlengths[i*2]=accumulated;
381 }
382
383 /* get the PCM length of this link. To do this,
384 get the last page of the stream */
385 {
386 ogg_int64_t end=vf->offsets[i+1];
387 _seek_helper(vf,end);
388
389 while(1){
390 ret=_get_prev_page(vf,&og);
391 if(ret<0){
392 /* this should not be possible */
393 vorbis_info_clear(vf->vi+i);
394 vorbis_comment_clear(vf->vc+i);
395 break;
396 }
397 if(ogg_page_granulepos(&og)!=-1){
398 vf->pcmlengths[i*2+1]=ogg_page_granulepos(&og)-vf->pcmlengths[i*2];
399 break;
400 }
401 vf->offset=ret;
402 }
403 }
404 }
405 ogg_page_release(&og);
406}
407
408static void _make_decode_ready(OggVorbis_File *vf){
409 if(vf->ready_state!=STREAMSET)return;
410 if(vf->seekable){
411 vorbis_synthesis_init(&vf->vd,vf->vi+vf->current_link);
412 }else{
413 vorbis_synthesis_init(&vf->vd,vf->vi);
414 }
415 vorbis_block_init(&vf->vd,&vf->vb);
416 vf->ready_state=INITSET;
417 vf->bittrack=0;
418 vf->samptrack=0;
419 return;
420}
421
422static int _open_seekable2(OggVorbis_File *vf){
423 ogg_uint32_t serialno=vf->current_serialno;
424 ogg_uint32_t tempserialno;
425 ogg_int64_t dataoffset=vf->offset, end;
426 ogg_page og={0,0,0,0};
427
428 /* we're partially open and have a first link header state in
429 storage in vf */
430 /* we can seek, so set out learning all about this file */
431 (vf->callbacks.seek_func)(vf->datasource,0,SEEK_END);
432 vf->offset=vf->end=(vf->callbacks.tell_func)(vf->datasource);
433
434 /* We get the offset for the last page of the physical bitstream.
435 Most OggVorbis files will contain a single logical bitstream */
436 end=_get_prev_page(vf,&og);
437 if(end<0)return(end);
438
439 /* more than one logical bitstream? */
440 tempserialno=ogg_page_serialno(&og);
441 ogg_page_release(&og);
442
443 if(tempserialno!=serialno){
444
445 /* Chained bitstream. Bisect-search each logical bitstream
446 section. Do so based on serial number only */
447 if(_bisect_forward_serialno(vf,0,0,end+1,serialno,0)<0)return(OV_EREAD);
448
449 }else{
450
451 /* Only one logical bitstream */
452 if(_bisect_forward_serialno(vf,0,end,end+1,serialno,0))return(OV_EREAD);
453
454 }
455
456 /* the initial header memory is referenced by vf after; don't free it */
457 _prefetch_all_headers(vf,dataoffset);
458 return(ov_raw_seek(vf,0));
459}
460
461/* clear out the current logical bitstream decoder */
462static void _decode_clear(OggVorbis_File *vf){
463 vorbis_dsp_clear(&vf->vd);
464 vorbis_block_clear(&vf->vb);
465 vf->ready_state=OPENED;
466}
467
468/* fetch and process a packet. Handles the case where we're at a
469 bitstream boundary and dumps the decoding machine. If the decoding
470 machine is unloaded, it loads it. It also keeps pcm_offset up to
471 date (seek and read both use this. seek uses a special hack with
472 readp).
473
474 return: <0) error, OV_HOLE (lost packet) or OV_EOF
475 0) need more data (only if readp==0)
476 1) got a packet
477*/
478
479static int _fetch_and_process_packet(OggVorbis_File *vf,
480 int readp,
481 int spanp) ICODE_ATTR_TREMOR_NOT_MDCT;
482static int _fetch_and_process_packet(OggVorbis_File *vf,
483 int readp,
484 int spanp){
485 ogg_page og={0,0,0,0};
486 ogg_packet op={0,0,0,0,0,0};
487 int ret=0;
488
489 /* handle one packet. Try to fetch it from current stream state */
490 /* extract packets from page */
491 while(1){
492
493 /* process a packet if we can. If the machine isn't loaded,
494 neither is a page */
495 if(vf->ready_state==INITSET){
496 while(1) {
497 int result=ogg_stream_packetout(vf->os,&op);
498 ogg_int64_t granulepos;
499
500 if(result<0){
501 ret=OV_HOLE; /* hole in the data. */
502 goto cleanup;
503 }
504 if(result>0){
505 /* got a packet. process it */
506 granulepos=op.granulepos;
507 if(!vorbis_synthesis(&vf->vb,&op,1)){ /* lazy check for lazy
508 header handling. The
509 header packets aren't
510 audio, so if/when we
511 submit them,
512 vorbis_synthesis will
513 reject them */
514
515 /* suck in the synthesis data and track bitrate */
516 {
517 int oldsamples=vorbis_synthesis_pcmout(&vf->vd,NULL);
518 /* for proper use of libvorbis within libvorbisfile,
519 oldsamples will always be zero. */
520 if(oldsamples){
521 ret=OV_EFAULT;
522 goto cleanup;
523 }
524
525 vorbis_synthesis_blockin(&vf->vd,&vf->vb);
526 vf->samptrack+=vorbis_synthesis_pcmout(&vf->vd,NULL)-oldsamples;
527 vf->bittrack+=op.bytes*8;
528 }
529
530 /* update the pcm offset. */
531 if(granulepos!=-1 && !op.e_o_s){
532 int link=(vf->seekable?vf->current_link:0);
533 int i,samples;
534
535 /* this packet has a pcm_offset on it (the last packet
536 completed on a page carries the offset) After processing
537 (above), we know the pcm position of the *last* sample
538 ready to be returned. Find the offset of the *first*
539
540 As an aside, this trick is inaccurate if we begin
541 reading anew right at the last page; the end-of-stream
542 granulepos declares the last frame in the stream, and the
543 last packet of the last page may be a partial frame.
544 So, we need a previous granulepos from an in-sequence page
545 to have a reference point. Thus the !op.e_o_s clause
546 above */
547
548 if(vf->seekable && link>0)
549 granulepos-=vf->pcmlengths[link*2];
550 if(granulepos<0)granulepos=0; /* actually, this
551 shouldn't be possible
552 here unless the stream
553 is very broken */
554
555 samples=vorbis_synthesis_pcmout(&vf->vd,NULL);
556
557 granulepos-=samples;
558 for(i=0;i<link;i++)
559 granulepos+=vf->pcmlengths[i*2+1];
560 vf->pcm_offset=granulepos;
561 }
562 ret=1;
563 goto cleanup;
564 }
565 }
566 else
567 break;
568 }
569 }
570
571 if(vf->ready_state>=OPENED){
572 int ret;
573 if(!readp){
574 ret=0;
575 goto cleanup;
576 }
577 if((ret=_get_next_page(vf,&og,-1))<0){
578 ret=OV_EOF; /* eof. leave unitialized */
579 goto cleanup;
580 }
581
582 /* bitrate tracking; add the header's bytes here, the body bytes
583 are done by packet above */
584 vf->bittrack+=og.header_len*8;
585
586 /* has our decoding just traversed a bitstream boundary? */
587 if(vf->ready_state==INITSET){
588 if(vf->current_serialno!=ogg_page_serialno(&og)){
589 if(!spanp){
590 ret=OV_EOF;
591 goto cleanup;
592 }
593
594 _decode_clear(vf);
595
596 if(!vf->seekable){
597 vorbis_info_clear(vf->vi);
598 vorbis_comment_clear(vf->vc);
599 }
600 }
601 }
602 }
603
604 /* Do we need to load a new machine before submitting the page? */
605 /* This is different in the seekable and non-seekable cases.
606
607 In the seekable case, we already have all the header
608 information loaded and cached; we just initialize the machine
609 with it and continue on our merry way.
610
611 In the non-seekable (streaming) case, we'll only be at a
612 boundary if we just left the previous logical bitstream and
613 we're now nominally at the header of the next bitstream
614 */
615
616 if(vf->ready_state!=INITSET){
617 int link;
618
619 if(vf->ready_state<STREAMSET){
620 if(vf->seekable){
621 vf->current_serialno=ogg_page_serialno(&og);
622
623 /* match the serialno to bitstream section. We use this rather than
624 offset positions to avoid problems near logical bitstream
625 boundaries */
626 for(link=0;link<vf->links;link++)
627 if(vf->serialnos[link]==vf->current_serialno)break;
628 if(link==vf->links){
629 ret=OV_EBADLINK; /* sign of a bogus stream. error out,
630 leave machine uninitialized */
631 goto cleanup;
632 }
633
634 vf->current_link=link;
635
636 ogg_stream_reset_serialno(vf->os,vf->current_serialno);
637 vf->ready_state=STREAMSET;
638
639 }else{
640 /* we're streaming */
641 /* fetch the three header packets, build the info struct */
642
643 int ret=_fetch_headers(vf,vf->vi,vf->vc,&vf->current_serialno,&og);
644 if(ret) goto cleanup;
645 vf->current_link++;
646 link=0;
647 }
648 }
649
650 _make_decode_ready(vf);
651 }
652 ogg_stream_pagein(vf->os,&og);
653 }
654 cleanup:
655 ogg_packet_release(&op);
656 ogg_page_release(&og);
657 return ret;
658}
659
660static int _ov_open1(void *f,OggVorbis_File *vf,char *initial,
661 long ibytes, ov_callbacks callbacks){
662 int offsettest=(f?callbacks.seek_func(f,0,SEEK_CUR):-1);
663 int ret;
664
665 memset(vf,0,sizeof(*vf));
666 vf->datasource=f;
667 vf->callbacks = callbacks;
668
669 /* init the framing state */
670 vf->oy=ogg_sync_create();
671
672 /* perhaps some data was previously read into a buffer for testing
673 against other stream types. Allow initialization from this
674 previously read data (as we may be reading from a non-seekable
675 stream) */
676 if(initial){
677 char *buffer=(char *)ogg_sync_bufferin(vf->oy,ibytes);
678 memcpy(buffer,initial,ibytes);
679 ogg_sync_wrote(vf->oy,ibytes);
680 }
681
682 /* can we seek? Stevens suggests the seek test was portable */
683 if(offsettest!=-1)vf->seekable=1;
684
685 /* No seeking yet; Set up a 'single' (current) logical bitstream
686 entry for partial open */
687 vf->links=1;
688 vf->vi=_ogg_calloc(vf->links,sizeof(*vf->vi));
689 vf->vc=_ogg_calloc(vf->links,sizeof(*vf->vc));
690 vf->os=ogg_stream_create(-1); /* fill in the serialno later */
691
692 /* Try to fetch the headers, maintaining all the storage */
693 if((ret=_fetch_headers(vf,vf->vi,vf->vc,&vf->current_serialno,NULL))<0){
694 vf->datasource=NULL;
695 ov_clear(vf);
696 }else if(vf->ready_state < PARTOPEN)
697 vf->ready_state=PARTOPEN;
698 return(ret);
699}
700
701static int _ov_open2(OggVorbis_File *vf){
702 if(vf->ready_state < OPENED)
703 vf->ready_state=OPENED;
704 if(vf->seekable){
705 int ret=_open_seekable2(vf);
706 if(ret){
707 vf->datasource=NULL;
708 ov_clear(vf);
709 }
710 return(ret);
711 }
712 return 0;
713}
714
715
716/* clear out the OggVorbis_File struct */
717int ov_clear(OggVorbis_File *vf){
718 if(vf){
719 vorbis_block_clear(&vf->vb);
720 vorbis_dsp_clear(&vf->vd);
721 ogg_stream_destroy(vf->os);
722
723 if(vf->vi && vf->links){
724 int i;
725 for(i=0;i<vf->links;i++){
726 vorbis_info_clear(vf->vi+i);
727 vorbis_comment_clear(vf->vc+i);
728 }
729 _ogg_free(vf->vi);
730 _ogg_free(vf->vc);
731 }
732 if(vf->dataoffsets)_ogg_free(vf->dataoffsets);
733 if(vf->pcmlengths)_ogg_free(vf->pcmlengths);
734 if(vf->serialnos)_ogg_free(vf->serialnos);
735 if(vf->offsets)_ogg_free(vf->offsets);
736 ogg_sync_destroy(vf->oy);
737
738 if(vf->datasource)(vf->callbacks.close_func)(vf->datasource);
739 memset(vf,0,sizeof(*vf));
740 }
741#ifdef DEBUG_LEAKS
742 _VDBG_dump();
743#endif
744 return(0);
745}
746
747/* inspects the OggVorbis file and finds/documents all the logical
748 bitstreams contained in it. Tries to be tolerant of logical
749 bitstream sections that are truncated/woogie.
750
751 return: -1) error
752 0) OK
753*/
754
755int ov_open_callbacks(void *f,OggVorbis_File *vf,char *initial,long ibytes,
756 ov_callbacks callbacks){
757 #if defined(CPU_COLDFIRE)
758 /* this seems to be the closest we get to an init function, let's init emac
759 here. rounding is disabled because of MULT31_SHIFT15, which will be
760 inaccurate with rounding in its current incarnation */
761 coldfire_set_macsr(EMAC_FRACTIONAL | EMAC_SATURATE);
762 #endif
763 int ret=_ov_open1(f,vf,initial,ibytes,callbacks);
764 if(ret)return ret;
765 return _ov_open2(vf);
766}
767
768/* returns: total PCM length (samples) of content if i==-1 PCM length
769 (samples) of that logical bitstream for i==0 to n
770 OV_EINVAL if the stream is not seekable (we can't know the
771 length) or only partially open
772*/
773ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i){
774 if(vf->ready_state<OPENED)return(OV_EINVAL);
775 if(!vf->seekable || i>=vf->links)return(OV_EINVAL);
776 if(i<0){
777 ogg_int64_t acc=0;
778 int i;
779 for(i=0;i<vf->links;i++)
780 acc+=ov_pcm_total(vf,i);
781 return(acc);
782 }else{
783 return(vf->pcmlengths[i*2+1]);
784 }
785}
786
787/* returns: total milliseconds of content if i==-1
788 milliseconds in that logical bitstream for i==0 to n
789 OV_EINVAL if the stream is not seekable (we can't know the
790 length) or only partially open
791*/
792ogg_int64_t ov_time_total(OggVorbis_File *vf,int i){
793 if(vf->ready_state<OPENED)return(OV_EINVAL);
794 if(!vf->seekable || i>=vf->links)return(OV_EINVAL);
795 if(i<0){
796 ogg_int64_t acc=0;
797 int i;
798 for(i=0;i<vf->links;i++)
799 acc+=ov_time_total(vf,i);
800 return(acc);
801 }else{
802 return(((ogg_int64_t)vf->pcmlengths[i*2+1])*1000/vf->vi[i].rate);
803 }
804}
805
806/* seek to an offset relative to the *compressed* data. This also
807 scans packets to update the PCM cursor. It will cross a logical
808 bitstream boundary, but only if it can't get any packets out of the
809 tail of the bitstream we seek to (so no surprises).
810
811 returns zero on success, nonzero on failure */
812
813int ov_raw_seek(OggVorbis_File *vf,ogg_int64_t pos){
814 ogg_stream_state *work_os=NULL;
815 ogg_page og={0,0,0,0};
816 ogg_packet op={0,0,0,0,0,0};
817
818 if(vf->ready_state<OPENED)return(OV_EINVAL);
819 if(!vf->seekable)
820 return(OV_ENOSEEK); /* don't dump machine if we can't seek */
821
822 if(pos<0 || pos>vf->end)return(OV_EINVAL);
823
824 /* don't yet clear out decoding machine (if it's initialized), in
825 the case we're in the same link. Restart the decode lapping, and
826 let _fetch_and_process_packet deal with a potential bitstream
827 boundary */
828 vf->pcm_offset=-1;
829 ogg_stream_reset_serialno(vf->os,
830 vf->current_serialno); /* must set serialno */
831 vorbis_synthesis_restart(&vf->vd);
832
833 _seek_helper(vf,pos);
834
835 /* we need to make sure the pcm_offset is set, but we don't want to
836 advance the raw cursor past good packets just to get to the first
837 with a granulepos. That's not equivalent behavior to beginning
838 decoding as immediately after the seek position as possible.
839
840 So, a hack. We use two stream states; a local scratch state and
841 the shared vf->os stream state. We use the local state to
842 scan, and the shared state as a buffer for later decode.
843
844 Unfortuantely, on the last page we still advance to last packet
845 because the granulepos on the last page is not necessarily on a
846 packet boundary, and we need to make sure the granpos is
847 correct.
848 */
849
850 {
851 int lastblock=0;
852 int accblock=0;
853 int thisblock;
854 int eosflag=0;
855
856 work_os=ogg_stream_create(vf->current_serialno); /* get the memory ready */
857 while(1){
858 if(vf->ready_state>=STREAMSET){
859 /* snarf/scan a packet if we can */
860 int result=ogg_stream_packetout(work_os,&op);
861
862 if(result>0){
863
864 if(vf->vi[vf->current_link].codec_setup){
865 thisblock=vorbis_packet_blocksize(vf->vi+vf->current_link,&op);
866 if(thisblock<0){
867 ogg_stream_packetout(vf->os,NULL);
868 thisblock=0;
869 }else{
870
871 if(eosflag)
872 ogg_stream_packetout(vf->os,NULL);
873 else
874 if(lastblock)accblock+=(lastblock+thisblock)>>2;
875 }
876
877 if(op.granulepos!=-1){
878 int i,link=vf->current_link;
879 ogg_int64_t granulepos=op.granulepos-vf->pcmlengths[link*2];
880 if(granulepos<0)granulepos=0;
881
882 for(i=0;i<link;i++)
883 granulepos+=vf->pcmlengths[i*2+1];
884 vf->pcm_offset=granulepos-accblock;
885 break;
886 }
887 lastblock=thisblock;
888 continue;
889 }else
890 ogg_stream_packetout(vf->os,NULL);
891 }
892 }
893
894 if(!lastblock){
895 if(_get_next_page(vf,&og,-1)<0){
896 vf->pcm_offset=ov_pcm_total(vf,-1);
897 break;
898 }
899 }else{
900 /* huh? Bogus stream with packets but no granulepos */
901 vf->pcm_offset=-1;
902 break;
903 }
904
905 /* has our decoding just traversed a bitstream boundary? */
906 if(vf->ready_state>=STREAMSET)
907 if(vf->current_serialno!=ogg_page_serialno(&og)){
908 _decode_clear(vf); /* clear out stream state */
909 ogg_stream_destroy(work_os);
910 }
911
912 if(vf->ready_state<STREAMSET){
913 int link;
914
915 vf->current_serialno=ogg_page_serialno(&og);
916 for(link=0;link<vf->links;link++)
917 if(vf->serialnos[link]==vf->current_serialno)break;
918 if(link==vf->links)
919 goto seek_error; /* sign of a bogus stream. error out,
920 leave machine uninitialized */
921
922 vf->current_link=link;
923
924 ogg_stream_reset_serialno(vf->os,vf->current_serialno);
925 ogg_stream_reset_serialno(work_os,vf->current_serialno);
926 vf->ready_state=STREAMSET;
927
928 }
929
930 {
931 ogg_page dup;
932 ogg_page_dup(&dup,&og);
933 eosflag=ogg_page_eos(&og);
934 ogg_stream_pagein(vf->os,&og);
935 ogg_stream_pagein(work_os,&dup);
936 }
937 }
938 }
939
940 ogg_packet_release(&op);
941 ogg_page_release(&og);
942 ogg_stream_destroy(work_os);
943 vf->bittrack=0;
944 vf->samptrack=0;
945 return(0);
946
947 seek_error:
948 ogg_packet_release(&op);
949 ogg_page_release(&og);
950
951 /* dump the machine so we're in a known state */
952 vf->pcm_offset=-1;
953 ogg_stream_destroy(work_os);
954 _decode_clear(vf);
955 return OV_EBADLINK;
956}
957
958/* Page granularity seek (faster than sample granularity because we
959 don't do the last bit of decode to find a specific sample).
960
961 Seek to the last [granule marked] page preceeding the specified pos
962 location, such that decoding past the returned point will quickly
963 arrive at the requested position. */
964int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos){
965 int link=-1;
966 ogg_int64_t result=0;
967 ogg_int64_t total=ov_pcm_total(vf,-1);
968 ogg_page og={0,0,0,0};
969 ogg_packet op={0,0,0,0,0,0};
970
971 if(vf->ready_state<OPENED)return(OV_EINVAL);
972 if(!vf->seekable)return(OV_ENOSEEK);
973 if(pos<0 || pos>total)return(OV_EINVAL);
974
975 /* which bitstream section does this pcm offset occur in? */
976 for(link=vf->links-1;link>=0;link--){
977 total-=vf->pcmlengths[link*2+1];
978 if(pos>=total)break;
979 }
980
981 /* search within the logical bitstream for the page with the highest
982 pcm_pos preceeding (or equal to) pos. There is a danger here;
983 missing pages or incorrect frame number information in the
984 bitstream could make our task impossible. Account for that (it
985 would be an error condition) */
986
987 /* new search algorithm by HB (Nicholas Vinen) */
988 {
989 ogg_int64_t end=vf->offsets[link+1];
990 ogg_int64_t begin=vf->offsets[link];
991 ogg_int64_t begintime = vf->pcmlengths[link*2];
992 ogg_int64_t endtime = vf->pcmlengths[link*2+1]+begintime;
993 ogg_int64_t target=pos-total+begintime;
994 ogg_int64_t best=begin;
995
996 while(begin<end){
997 ogg_int64_t bisect;
998
999 if(end-begin<CHUNKSIZE){
1000 bisect=begin;
1001 }else{
1002 /* take a (pretty decent) guess. */
1003 bisect=begin +
1004 (target-begintime)*(end-begin)/(endtime-begintime) - CHUNKSIZE;
1005 if(bisect<=begin)
1006 bisect=begin+1;
1007 }
1008
1009 _seek_helper(vf,bisect);
1010
1011 while(begin<end){
1012 result=_get_next_page(vf,&og,end-vf->offset);
1013 if(result==OV_EREAD) goto seek_error;
1014 if(result<0){
1015 if(bisect<=begin+1)
1016 end=begin; /* found it */
1017 else{
1018 if(bisect==0) goto seek_error;
1019 bisect-=CHUNKSIZE;
1020 if(bisect<=begin)bisect=begin+1;
1021 _seek_helper(vf,bisect);
1022 }
1023 }else{
1024 ogg_int64_t granulepos=ogg_page_granulepos(&og);
1025 if(granulepos==-1)continue;
1026 if(granulepos<target){
1027 best=result; /* raw offset of packet with granulepos */
1028 begin=vf->offset; /* raw offset of next page */
1029 begintime=granulepos;
1030
1031 if(target-begintime>44100)break;
1032 bisect=begin; /* *not* begin + 1 */
1033 }else{
1034 if(bisect<=begin+1)
1035 end=begin; /* found it */
1036 else{
1037 if(end==vf->offset){ /* we're pretty close - we'd be stuck in */
1038 end=result;
1039 bisect-=CHUNKSIZE; /* an endless loop otherwise. */
1040 if(bisect<=begin)bisect=begin+1;
1041 _seek_helper(vf,bisect);
1042 }else{
1043 end=result;
1044 endtime=granulepos;
1045 break;
1046 }
1047 }
1048 }
1049 }
1050 }
1051 }
1052
1053 /* found our page. seek to it, update pcm offset. Easier case than
1054 raw_seek, don't keep packets preceeding granulepos. */
1055 {
1056
1057 /* seek */
1058 _seek_helper(vf,best);
1059 vf->pcm_offset=-1;
1060
1061 if(_get_next_page(vf,&og,-1)<0){
1062 ogg_page_release(&og);
1063 return(OV_EOF); /* shouldn't happen */
1064 }
1065
1066 if(link!=vf->current_link){
1067 /* Different link; dump entire decode machine */
1068 _decode_clear(vf);
1069
1070 vf->current_link=link;
1071 vf->current_serialno=ogg_page_serialno(&og);
1072 vf->ready_state=STREAMSET;
1073
1074 }else{
1075 vorbis_synthesis_restart(&vf->vd);
1076 }
1077
1078 ogg_stream_reset_serialno(vf->os,vf->current_serialno);
1079 ogg_stream_pagein(vf->os,&og);
1080
1081 /* pull out all but last packet; the one with granulepos */
1082 while(1){
1083 result=ogg_stream_packetpeek(vf->os,&op);
1084 if(result==0){
1085 /* !!! the packet finishing this page originated on a
1086 preceeding page. Keep fetching previous pages until we
1087 get one with a granulepos or without the 'continued' flag
1088 set. Then just use raw_seek for simplicity. */
1089
1090 _seek_helper(vf,best);
1091
1092 while(1){
1093 result=_get_prev_page(vf,&og);
1094 if(result<0) goto seek_error;
1095 if(ogg_page_granulepos(&og)>-1 ||
1096 !ogg_page_continued(&og)){
1097 return ov_raw_seek(vf,result);
1098 }
1099 vf->offset=result;
1100 }
1101 }
1102 if(result<0){
1103 result = OV_EBADPACKET;
1104 goto seek_error;
1105 }
1106 if(op.granulepos!=-1){
1107 vf->pcm_offset=op.granulepos-vf->pcmlengths[vf->current_link*2];
1108 if(vf->pcm_offset<0)vf->pcm_offset=0;
1109 vf->pcm_offset+=total;
1110 break;
1111 }else
1112 result=ogg_stream_packetout(vf->os,NULL);
1113 }
1114 }
1115 }
1116
1117 /* verify result */
1118 if(vf->pcm_offset>pos || pos>ov_pcm_total(vf,-1)){
1119 result=OV_EFAULT;
1120 goto seek_error;
1121 }
1122 vf->bittrack=0;
1123 vf->samptrack=0;
1124
1125 ogg_page_release(&og);
1126 ogg_packet_release(&op);
1127 return(0);
1128
1129 seek_error:
1130
1131 ogg_page_release(&og);
1132 ogg_packet_release(&op);
1133
1134 /* dump machine so we're in a known state */
1135 vf->pcm_offset=-1;
1136 _decode_clear(vf);
1137 return (int)result;
1138}
1139
1140/* seek to a sample offset relative to the decompressed pcm stream
1141 returns zero on success, nonzero on failure */
1142
1143int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos){
1144 ogg_packet op={0,0,0,0,0,0};
1145 ogg_page og={0,0,0,0};
1146
1147 int thisblock,lastblock=0;
1148 int ret=ov_pcm_seek_page(vf,pos);
1149 if(ret<0)return(ret);
1150 _make_decode_ready(vf);
1151
1152 /* discard leading packets we don't need for the lapping of the
1153 position we want; don't decode them */
1154
1155 while(1){
1156
1157 int ret=ogg_stream_packetpeek(vf->os,&op);
1158 if(ret>0){
1159 thisblock=vorbis_packet_blocksize(vf->vi+vf->current_link,&op);
1160 if(thisblock<0){
1161 ogg_stream_packetout(vf->os,NULL);
1162 continue; /* non audio packet */
1163 }
1164 if(lastblock)vf->pcm_offset+=(lastblock+thisblock)>>2;
1165
1166 if(vf->pcm_offset+((thisblock+
1167 vorbis_info_blocksize(vf->vi,1))>>2)>=pos)break;
1168
1169 /* remove the packet from packet queue and track its granulepos */
1170 ogg_stream_packetout(vf->os,NULL);
1171 vorbis_synthesis(&vf->vb,&op,0); /* set up a vb with
1172 only tracking, no
1173 pcm_decode */
1174 vorbis_synthesis_blockin(&vf->vd,&vf->vb);
1175
1176 /* end of logical stream case is hard, especially with exact
1177 length positioning. */
1178
1179 if(op.granulepos>-1){
1180 int i;
1181 /* always believe the stream markers */
1182 vf->pcm_offset=op.granulepos-vf->pcmlengths[vf->current_link*2];
1183 if(vf->pcm_offset<0)vf->pcm_offset=0;
1184 for(i=0;i<vf->current_link;i++)
1185 vf->pcm_offset+=vf->pcmlengths[i*2+1];
1186 }
1187
1188 lastblock=thisblock;
1189
1190 }else{
1191 if(ret<0 && ret!=OV_HOLE)break;
1192
1193 /* suck in a new page */
1194 if(_get_next_page(vf,&og,-1)<0)break;
1195 if(vf->current_serialno!=ogg_page_serialno(&og))_decode_clear(vf);
1196
1197 if(vf->ready_state<STREAMSET){
1198 int link;
1199
1200 vf->current_serialno=ogg_page_serialno(&og);
1201 for(link=0;link<vf->links;link++)
1202 if(vf->serialnos[link]==vf->current_serialno)break;
1203 if(link==vf->links){
1204 ogg_page_release(&og);
1205 ogg_packet_release(&op);
1206 return(OV_EBADLINK);
1207 }
1208 vf->current_link=link;
1209
1210 ogg_stream_reset_serialno(vf->os,vf->current_serialno);
1211 vf->ready_state=STREAMSET;
1212 _make_decode_ready(vf);
1213 lastblock=0;
1214 }
1215
1216 ogg_stream_pagein(vf->os,&og);
1217 }
1218 }
1219
1220 vf->bittrack=0;
1221 vf->samptrack=0;
1222 /* discard samples until we reach the desired position. Crossing a
1223 logical bitstream boundary with abandon is OK. */
1224 while(vf->pcm_offset<pos){
1225 ogg_int64_t target=pos-vf->pcm_offset;
1226 long samples=vorbis_synthesis_pcmout(&vf->vd,NULL);
1227
1228 if(samples>target)samples=target;
1229 vorbis_synthesis_read(&vf->vd,samples);
1230 vf->pcm_offset+=samples;
1231
1232 if(samples<target)
1233 if(_fetch_and_process_packet(vf,1,1)<=0)
1234 vf->pcm_offset=ov_pcm_total(vf,-1); /* eof */
1235 }
1236
1237 ogg_page_release(&og);
1238 ogg_packet_release(&op);
1239 return 0;
1240}
1241
1242/* seek to a playback time relative to the decompressed pcm stream
1243 returns zero on success, nonzero on failure */
1244int ov_time_seek(OggVorbis_File *vf,ogg_int64_t milliseconds){
1245 /* translate time to PCM position and call ov_pcm_seek */
1246
1247 int link=-1;
1248 ogg_int64_t pcm_total=ov_pcm_total(vf,-1);
1249 ogg_int64_t time_total=ov_time_total(vf,-1);
1250
1251 if(vf->ready_state<OPENED)return(OV_EINVAL);
1252 if(!vf->seekable)return(OV_ENOSEEK);
1253 if(milliseconds<0 || milliseconds>time_total)return(OV_EINVAL);
1254
1255 /* which bitstream section does this time offset occur in? */
1256 for(link=vf->links-1;link>=0;link--){
1257 pcm_total-=vf->pcmlengths[link*2+1];
1258 time_total-=ov_time_total(vf,link);
1259 if(milliseconds>=time_total)break;
1260 }
1261
1262 /* enough information to convert time offset to pcm offset */
1263 {
1264 ogg_int64_t target=pcm_total+(milliseconds-time_total)*vf->vi[link].rate/1000;
1265 return(ov_pcm_seek(vf,target));
1266 }
1267}
1268
1269/* tell the current stream offset cursor. Note that seek followed by
1270 tell will likely not give the set offset due to caching */
1271ogg_int64_t ov_raw_tell(OggVorbis_File *vf){
1272 if(vf->ready_state<OPENED)return(OV_EINVAL);
1273 return(vf->offset);
1274}
1275
1276/* return time offset (milliseconds) of next PCM sample to be read */
1277ogg_int64_t ov_time_tell(OggVorbis_File *vf) ICODE_ATTR_TREMOR_NOT_MDCT;
1278ogg_int64_t ov_time_tell(OggVorbis_File *vf){
1279 int link=0;
1280 ogg_int64_t pcm_total=0;
1281 ogg_int64_t time_total=0;
1282
1283 if(vf->ready_state<OPENED)return(OV_EINVAL);
1284 if(vf->seekable){
1285 pcm_total=ov_pcm_total(vf,-1);
1286 time_total=ov_time_total(vf,-1);
1287
1288 /* which bitstream section does this time offset occur in? */
1289 for(link=vf->links-1;link>=0;link--){
1290 pcm_total-=vf->pcmlengths[link*2+1];
1291 time_total-=ov_time_total(vf,link);
1292 if(vf->pcm_offset>=pcm_total)break;
1293 }
1294 }
1295
1296 return(time_total+(1000*vf->pcm_offset-pcm_total)/vf->vi[link].rate);
1297}
1298
1299/* link: -1) return the vorbis_info struct for the bitstream section
1300 currently being decoded
1301 0-n) to request information for a specific bitstream section
1302
1303 In the case of a non-seekable bitstream, any call returns the
1304 current bitstream. NULL in the case that the machine is not
1305 initialized */
1306
1307vorbis_info *ov_info(OggVorbis_File *vf,int link){
1308 if(vf->seekable){
1309 if(link<0)
1310 if(vf->ready_state>=STREAMSET)
1311 return vf->vi+vf->current_link;
1312 else
1313 return vf->vi;
1314 else
1315 if(link>=vf->links)
1316 return NULL;
1317 else
1318 return vf->vi+link;
1319 }else{
1320 return vf->vi;
1321 }
1322}
1323
1324/* input values: pcm_channels) a float vector per channel of output
1325 length) the sample length being read by the app
1326
1327 return values: <0) error/hole in data (OV_HOLE), partial open (OV_EINVAL)
1328 0) EOF
1329 n) number of samples of PCM actually returned. The
1330 below works on a packet-by-packet basis, so the
1331 return length is not related to the 'length' passed
1332 in, just guaranteed to fit.
1333
1334 *section) set to the logical bitstream number */
1335
1336long ov_read_fixed(OggVorbis_File *vf,ogg_int32_t ***pcm_channels,int length,
1337 int *bitstream){
1338 if(vf->ready_state<OPENED)return(OV_EINVAL);
1339
1340 while(1){
1341 if(vf->ready_state==INITSET){
1342 ogg_int32_t **pcm;
1343 long samples=vorbis_synthesis_pcmout(&vf->vd,&pcm);
1344 if(samples){
1345 if(pcm_channels)*pcm_channels=pcm;
1346 if(samples>length)samples=length;
1347 vorbis_synthesis_read(&vf->vd,samples);
1348 vf->pcm_offset+=samples;
1349 if(bitstream)*bitstream=vf->current_link;
1350 return samples;
1351
1352 }
1353 }
1354
1355 /* suck in another packet */
1356 {
1357 int ret=_fetch_and_process_packet(vf,1,1);
1358 if(ret==OV_EOF)return(0);
1359 if(ret<=0)return(ret);
1360 }
1361 }
1362}
diff --git a/apps/codecs/libtremor/window.c b/apps/codecs/libtremor/window.c
new file mode 100644
index 0000000000..14d97cf6ac
--- /dev/null
+++ b/apps/codecs/libtremor/window.c
@@ -0,0 +1,78 @@
1/********************************************************************
2 * *
3 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
4 * *
5 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
6 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
7 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
8 * *
9 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
10 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
11 * *
12 ********************************************************************
13
14 function: window functions
15
16 ********************************************************************/
17
18#include "config-tremor.h"
19#include <string.h>
20#include <math.h>
21#include "os.h"
22#include "misc.h"
23#include "window.h"
24#include "window_lookup.h"
25
26const void *_vorbis_window(int type, int left){
27
28 switch(type){
29 case 0:
30
31 switch(left){
32 case 32:
33 return vwin64;
34 case 64:
35 return vwin128;
36 case 128:
37 return vwin256;
38 case 256:
39 return vwin512;
40 case 512:
41 return vwin1024;
42 case 1024:
43 return vwin2048;
44 case 2048:
45 return vwin4096;
46 case 4096:
47 return vwin8192;
48 default:
49 return(0);
50 }
51 break;
52 default:
53 return(0);
54 }
55}
56
57void _vorbis_apply_window(ogg_int32_t *d,const void *window_p[2],
58 long *blocksizes,
59 int lW,int W,int nW){
60 LOOKUP_T *window[2]={window_p[0],window_p[1]};
61 long n=blocksizes[W];
62 long ln=blocksizes[lW];
63 long rn=blocksizes[nW];
64
65 long leftbegin=n/4-ln/4;
66 long leftend=leftbegin+ln/2;
67
68 long rightbegin=n/2+n/4-rn/4;
69 long rightend=rightbegin+rn/2;
70
71 memset((void *)&d[0], 0, sizeof(ogg_int32_t)*leftbegin);
72 /* mcf5249_vect_zero(&d[0], leftbegin); */
73 vect_mult_fw(&d[leftbegin], &window[lW][0], leftend-leftbegin);
74 vect_mult_bw(&d[rightbegin], &window[nW][rn/2-1], rightend-rightbegin);
75 memset((void *)&d[rightend], 0, sizeof(ogg_int32_t)*(n-rightend));
76 /* mcf5249_vect_zero(&d[rightend], n-rightend); */
77}
78
diff --git a/apps/codecs/libtremor/window.h b/apps/codecs/libtremor/window.h
new file mode 100644
index 0000000000..27647fe62e
--- /dev/null
+++ b/apps/codecs/libtremor/window.h
@@ -0,0 +1,27 @@
1/********************************************************************
2 * *
3 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
4 * *
5 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
6 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
7 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
8 * *
9 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
10 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
11 * *
12 ********************************************************************
13
14 function: window functions
15
16 ********************************************************************/
17
18#ifndef _V_WINDOW_
19#define _V_WINDOW_
20
21extern const void *_vorbis_window(int type,int left);
22extern void _vorbis_apply_window(ogg_int32_t *d,const void *window[2],
23 long *blocksizes,
24 int lW,int W,int nW);
25
26
27#endif
diff --git a/apps/codecs/libtremor/window_lookup.h b/apps/codecs/libtremor/window_lookup.h
new file mode 100644
index 0000000000..ccf316e227
--- /dev/null
+++ b/apps/codecs/libtremor/window_lookup.h
@@ -0,0 +1,2087 @@
1/********************************************************************
2 * *
3 * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
4 * *
5 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
6 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
7 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
8 * *
9 * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
10 * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
11 * *
12 ********************************************************************
13
14 function: window lookup tables
15
16 ********************************************************************/
17
18
19#include "os_types.h"
20
21/* libvorbis currently only use the window sizes 256 and 2048, so only put
22 * them in fast IRAM.
23 */
24static LOOKUP_T vwin64[32] = {
25 X(0x001f0003), X(0x01168c98), X(0x030333c8), X(0x05dfe3a4),
26 X(0x09a49562), X(0x0e45df18), X(0x13b47ef2), X(0x19dcf676),
27 X(0x20a74d83), X(0x27f7137c), X(0x2fabb05a), X(0x37a1105a),
28 X(0x3fb0ab28), X(0x47b2dcd1), X(0x4f807bc6), X(0x56f48e70),
29 X(0x5dedfc79), X(0x64511653), X(0x6a08cfff), X(0x6f079328),
30 X(0x734796f4), X(0x76cab7f2), X(0x7999d6e8), X(0x7bc3cf9f),
31 X(0x7d5c20c1), X(0x7e7961df), X(0x7f33a567), X(0x7fa2e1d0),
32 X(0x7fdd78a5), X(0x7ff6ec6d), X(0x7ffed0e9), X(0x7ffffc3f),
33};
34
35static LOOKUP_T vwin128[64] = {
36 X(0x0007c04d), X(0x0045bb89), X(0x00c18b87), X(0x017ae294),
37 X(0x02714a4e), X(0x03a4217a), X(0x05129952), X(0x06bbb24f),
38 X(0x089e38a1), X(0x0ab8c073), X(0x0d09a228), X(0x0f8ef6bd),
39 X(0x12469488), X(0x152e0c7a), X(0x1842a81c), X(0x1b81686d),
40 X(0x1ee705d9), X(0x226ff15d), X(0x26185705), X(0x29dc21cc),
41 X(0x2db700fe), X(0x31a46f08), X(0x359fb9c1), X(0x39a40c0c),
42 X(0x3dac78b6), X(0x41b40674), X(0x45b5bcb0), X(0x49acb109),
43 X(0x4d94152b), X(0x516744bd), X(0x5521d320), X(0x58bf98a5),
44 X(0x5c3cbef4), X(0x5f95cc5d), X(0x62c7add7), X(0x65cfbf64),
45 X(0x68abd2ba), X(0x6b5a3405), X(0x6dd9acab), X(0x7029840d),
46 X(0x72497e38), X(0x7439d8ac), X(0x75fb4532), X(0x778ee30a),
47 X(0x78f6367e), X(0x7a331f1a), X(0x7b47cccd), X(0x7c36b416),
48 X(0x7d028192), X(0x7dae0d18), X(0x7e3c4caa), X(0x7eb04763),
49 X(0x7f0d08a7), X(0x7f5593b7), X(0x7f8cd7d5), X(0x7fb5a513),
50 X(0x7fd2a1fc), X(0x7fe64212), X(0x7ff2bd4c), X(0x7ffa0890),
51 X(0x7ffdcf39), X(0x7fff6dac), X(0x7fffed01), X(0x7fffffc4),
52};
53
54static LOOKUP_T vwin256[128] ICONST_ATTR_TREMOR_WINDOW = {
55 X(0x0001f018), X(0x00117066), X(0x00306e9e), X(0x005ee5f1),
56 X(0x009ccf26), X(0x00ea208b), X(0x0146cdea), X(0x01b2c87f),
57 X(0x022dfedf), X(0x02b85ced), X(0x0351cbbd), X(0x03fa317f),
58 X(0x04b17167), X(0x05776b90), X(0x064bfcdc), X(0x072efedd),
59 X(0x082047b4), X(0x091fa9f1), X(0x0a2cf477), X(0x0b47f25d),
60 X(0x0c706ad2), X(0x0da620ff), X(0x0ee8d3ef), X(0x10383e75),
61 X(0x11941716), X(0x12fc0ff6), X(0x146fd6c8), X(0x15ef14c2),
62 X(0x17796e8e), X(0x190e844f), X(0x1aadf196), X(0x1c574d6e),
63 X(0x1e0a2a62), X(0x1fc61688), X(0x218a9b9c), X(0x23573f12),
64 X(0x252b823d), X(0x2706e269), X(0x28e8d913), X(0x2ad0dc0e),
65 X(0x2cbe5dc1), X(0x2eb0cd60), X(0x30a79733), X(0x32a224d5),
66 X(0x349fdd8b), X(0x36a02690), X(0x38a2636f), X(0x3aa5f65e),
67 X(0x3caa409e), X(0x3eaea2df), X(0x40b27da6), X(0x42b531b8),
68 X(0x44b62086), X(0x46b4ac99), X(0x48b03a05), X(0x4aa82ed5),
69 X(0x4c9bf37d), X(0x4e8af349), X(0x50749ccb), X(0x52586246),
70 X(0x5435ba1c), X(0x560c1f31), X(0x57db1152), X(0x59a21591),
71 X(0x5b60b6a3), X(0x5d168535), X(0x5ec31839), X(0x60660d36),
72 X(0x61ff0886), X(0x638db595), X(0x6511c717), X(0x668af734),
73 X(0x67f907b0), X(0x695bc207), X(0x6ab2f787), X(0x6bfe815a),
74 X(0x6d3e4090), X(0x6e721e16), X(0x6f9a0ab5), X(0x70b5fef8),
75 X(0x71c5fb16), X(0x72ca06cd), X(0x73c2313d), X(0x74ae90b2),
76 X(0x758f4275), X(0x76646a85), X(0x772e335c), X(0x77eccda0),
77 X(0x78a06fd7), X(0x79495613), X(0x79e7c19c), X(0x7a7bf894),
78 X(0x7b064596), X(0x7b86f757), X(0x7bfe6044), X(0x7c6cd615),
79 X(0x7cd2b16e), X(0x7d304d71), X(0x7d860756), X(0x7dd43e06),
80 X(0x7e1b51ad), X(0x7e5ba355), X(0x7e95947e), X(0x7ec986bb),
81 X(0x7ef7db4a), X(0x7f20f2b9), X(0x7f452c7f), X(0x7f64e6a7),
82 X(0x7f807d71), X(0x7f984aff), X(0x7faca700), X(0x7fbde662),
83 X(0x7fcc5b04), X(0x7fd85372), X(0x7fe21a99), X(0x7fe9f791),
84 X(0x7ff02d58), X(0x7ff4fa9e), X(0x7ff89990), X(0x7ffb3faa),
85 X(0x7ffd1d8b), X(0x7ffe5ecc), X(0x7fff29e0), X(0x7fff9ff3),
86 X(0x7fffdcd2), X(0x7ffff6d6), X(0x7ffffed0), X(0x7ffffffc),
87};
88
89static LOOKUP_T vwin512[256] = {
90 X(0x00007c06), X(0x00045c32), X(0x000c1c62), X(0x0017bc4c),
91 X(0x00273b7a), X(0x003a9955), X(0x0051d51c), X(0x006cede7),
92 X(0x008be2a9), X(0x00aeb22a), X(0x00d55b0d), X(0x00ffdbcc),
93 X(0x012e32b6), X(0x01605df5), X(0x01965b85), X(0x01d02939),
94 X(0x020dc4ba), X(0x024f2b83), X(0x02945ae6), X(0x02dd5004),
95 X(0x032a07d3), X(0x037a7f19), X(0x03ceb26e), X(0x04269e37),
96 X(0x04823eab), X(0x04e18fcc), X(0x05448d6d), X(0x05ab3329),
97 X(0x06157c68), X(0x0683645e), X(0x06f4e607), X(0x0769fc25),
98 X(0x07e2a146), X(0x085ecfbc), X(0x08de819f), X(0x0961b0cc),
99 X(0x09e856e3), X(0x0a726d46), X(0x0affed1d), X(0x0b90cf4c),
100 X(0x0c250c79), X(0x0cbc9d0b), X(0x0d577926), X(0x0df598aa),
101 X(0x0e96f337), X(0x0f3b8026), X(0x0fe3368f), X(0x108e0d42),
102 X(0x113bfaca), X(0x11ecf56b), X(0x12a0f324), X(0x1357e9ac),
103 X(0x1411ce70), X(0x14ce9698), X(0x158e3702), X(0x1650a444),
104 X(0x1715d2aa), X(0x17ddb638), X(0x18a842aa), X(0x19756b72),
105 X(0x1a4523b9), X(0x1b175e62), X(0x1bec0e04), X(0x1cc324f0),
106 X(0x1d9c9532), X(0x1e78508a), X(0x1f564876), X(0x20366e2e),
107 X(0x2118b2a2), X(0x21fd0681), X(0x22e35a37), X(0x23cb9dee),
108 X(0x24b5c18e), X(0x25a1b4c0), X(0x268f66f1), X(0x277ec74e),
109 X(0x286fc4cc), X(0x29624e23), X(0x2a5651d7), X(0x2b4bbe34),
110 X(0x2c428150), X(0x2d3a8913), X(0x2e33c332), X(0x2f2e1d35),
111 X(0x30298478), X(0x3125e62d), X(0x32232f61), X(0x33214cfc),
112 X(0x34202bc2), X(0x351fb85a), X(0x361fdf4f), X(0x37208d10),
113 X(0x3821adf7), X(0x39232e49), X(0x3a24fa3c), X(0x3b26fdf6),
114 X(0x3c292593), X(0x3d2b5d29), X(0x3e2d90c8), X(0x3f2fac7f),
115 X(0x40319c5f), X(0x41334c81), X(0x4234a905), X(0x43359e16),
116 X(0x443617f3), X(0x453602eb), X(0x46354b65), X(0x4733dde1),
117 X(0x4831a6ff), X(0x492e937f), X(0x4a2a9045), X(0x4b258a5f),
118 X(0x4c1f6f06), X(0x4d182ba2), X(0x4e0fadce), X(0x4f05e35b),
119 X(0x4ffaba53), X(0x50ee20fd), X(0x51e005e1), X(0x52d057ca),
120 X(0x53bf05ca), X(0x54abff3b), X(0x559733c7), X(0x56809365),
121 X(0x57680e62), X(0x584d955d), X(0x59311952), X(0x5a128b96),
122 X(0x5af1dddd), X(0x5bcf023a), X(0x5ca9eb27), X(0x5d828b81),
123 X(0x5e58d68d), X(0x5f2cbffc), X(0x5ffe3be9), X(0x60cd3edf),
124 X(0x6199bdda), X(0x6263ae45), X(0x632b0602), X(0x63efbb66),
125 X(0x64b1c53f), X(0x65711ad0), X(0x662db3d7), X(0x66e7888d),
126 X(0x679e91a5), X(0x6852c84e), X(0x69042635), X(0x69b2a582),
127 X(0x6a5e40dd), X(0x6b06f36c), X(0x6bacb8d2), X(0x6c4f8d30),
128 X(0x6cef6d26), X(0x6d8c55d4), X(0x6e2644d4), X(0x6ebd3840),
129 X(0x6f512ead), X(0x6fe2272e), X(0x7070214f), X(0x70fb1d17),
130 X(0x71831b06), X(0x72081c16), X(0x728a21b5), X(0x73092dc8),
131 X(0x738542a6), X(0x73fe631b), X(0x74749261), X(0x74e7d421),
132 X(0x75582c72), X(0x75c59fd5), X(0x76303333), X(0x7697ebdd),
133 X(0x76fccf85), X(0x775ee443), X(0x77be308a), X(0x781abb2e),
134 X(0x78748b59), X(0x78cba88e), X(0x79201aa7), X(0x7971e9cd),
135 X(0x79c11e79), X(0x7a0dc170), X(0x7a57dbc2), X(0x7a9f76c1),
136 X(0x7ae49c07), X(0x7b27556b), X(0x7b67ad02), X(0x7ba5ad1b),
137 X(0x7be1603a), X(0x7c1ad118), X(0x7c520a9e), X(0x7c8717e1),
138 X(0x7cba0421), X(0x7ceadac3), X(0x7d19a74f), X(0x7d46756e),
139 X(0x7d7150e5), X(0x7d9a4592), X(0x7dc15f69), X(0x7de6aa71),
140 X(0x7e0a32c0), X(0x7e2c0479), X(0x7e4c2bc7), X(0x7e6ab4db),
141 X(0x7e87abe9), X(0x7ea31d24), X(0x7ebd14be), X(0x7ed59edd),
142 X(0x7eecc7a3), X(0x7f029b21), X(0x7f17255a), X(0x7f2a723f),
143 X(0x7f3c8daa), X(0x7f4d835d), X(0x7f5d5f00), X(0x7f6c2c1b),
144 X(0x7f79f617), X(0x7f86c83a), X(0x7f92ada2), X(0x7f9db146),
145 X(0x7fa7ddf3), X(0x7fb13e46), X(0x7fb9dcb0), X(0x7fc1c36c),
146 X(0x7fc8fc83), X(0x7fcf91c7), X(0x7fd58cd2), X(0x7fdaf702),
147 X(0x7fdfd979), X(0x7fe43d1c), X(0x7fe82a8b), X(0x7febaa29),
148 X(0x7feec412), X(0x7ff1801c), X(0x7ff3e5d6), X(0x7ff5fc86),
149 X(0x7ff7cb29), X(0x7ff9586f), X(0x7ffaaaba), X(0x7ffbc81e),
150 X(0x7ffcb660), X(0x7ffd7af3), X(0x7ffe1afa), X(0x7ffe9b42),
151 X(0x7fff0047), X(0x7fff4e2f), X(0x7fff88c9), X(0x7fffb390),
152 X(0x7fffd1a6), X(0x7fffe5d7), X(0x7ffff296), X(0x7ffff9fd),
153 X(0x7ffffdcd), X(0x7fffff6d), X(0x7fffffed), X(0x7fffffff),
154};
155
156static LOOKUP_T vwin1024[512] = {
157 X(0x00001f02), X(0x0001170e), X(0x00030724), X(0x0005ef40),
158 X(0x0009cf59), X(0x000ea767), X(0x0014775e), X(0x001b3f2e),
159 X(0x0022fec8), X(0x002bb618), X(0x00356508), X(0x00400b81),
160 X(0x004ba968), X(0x00583ea0), X(0x0065cb0a), X(0x00744e84),
161 X(0x0083c8ea), X(0x00943a14), X(0x00a5a1da), X(0x00b80010),
162 X(0x00cb5488), X(0x00df9f10), X(0x00f4df76), X(0x010b1584),
163 X(0x01224101), X(0x013a61b2), X(0x01537759), X(0x016d81b6),
164 X(0x01888087), X(0x01a47385), X(0x01c15a69), X(0x01df34e6),
165 X(0x01fe02b1), X(0x021dc377), X(0x023e76e7), X(0x02601ca9),
166 X(0x0282b466), X(0x02a63dc1), X(0x02cab85d), X(0x02f023d6),
167 X(0x03167fcb), X(0x033dcbd3), X(0x03660783), X(0x038f3270),
168 X(0x03b94c29), X(0x03e4543a), X(0x04104a2e), X(0x043d2d8b),
169 X(0x046afdd5), X(0x0499ba8c), X(0x04c9632d), X(0x04f9f734),
170 X(0x052b7615), X(0x055ddf46), X(0x05913237), X(0x05c56e53),
171 X(0x05fa9306), X(0x06309fb6), X(0x066793c5), X(0x069f6e93),
172 X(0x06d82f7c), X(0x0711d5d9), X(0x074c60fe), X(0x0787d03d),
173 X(0x07c422e4), X(0x0801583e), X(0x083f6f91), X(0x087e681f),
174 X(0x08be4129), X(0x08fef9ea), X(0x0940919a), X(0x0983076d),
175 X(0x09c65a92), X(0x0a0a8a38), X(0x0a4f9585), X(0x0a957b9f),
176 X(0x0adc3ba7), X(0x0b23d4b9), X(0x0b6c45ee), X(0x0bb58e5a),
177 X(0x0bffad0f), X(0x0c4aa11a), X(0x0c966982), X(0x0ce3054d),
178 X(0x0d30737b), X(0x0d7eb308), X(0x0dcdc2eb), X(0x0e1da21a),
179 X(0x0e6e4f83), X(0x0ebfca11), X(0x0f1210ad), X(0x0f652238),
180 X(0x0fb8fd91), X(0x100da192), X(0x10630d11), X(0x10b93ee0),
181 X(0x111035cb), X(0x1167f09a), X(0x11c06e13), X(0x1219acf5),
182 X(0x1273abfb), X(0x12ce69db), X(0x1329e54a), X(0x13861cf3),
183 X(0x13e30f80), X(0x1440bb97), X(0x149f1fd8), X(0x14fe3ade),
184 X(0x155e0b40), X(0x15be8f92), X(0x161fc662), X(0x1681ae38),
185 X(0x16e4459b), X(0x17478b0b), X(0x17ab7d03), X(0x181019fb),
186 X(0x18756067), X(0x18db4eb3), X(0x1941e34a), X(0x19a91c92),
187 X(0x1a10f8ea), X(0x1a7976af), X(0x1ae29439), X(0x1b4c4fda),
188 X(0x1bb6a7e2), X(0x1c219a9a), X(0x1c8d2649), X(0x1cf9492e),
189 X(0x1d660188), X(0x1dd34d8e), X(0x1e412b74), X(0x1eaf996a),
190 X(0x1f1e959b), X(0x1f8e1e2f), X(0x1ffe3146), X(0x206ecd01),
191 X(0x20dfef78), X(0x215196c2), X(0x21c3c0f0), X(0x22366c10),
192 X(0x22a9962a), X(0x231d3d45), X(0x23915f60), X(0x2405fa7a),
193 X(0x247b0c8c), X(0x24f09389), X(0x25668d65), X(0x25dcf80c),
194 X(0x2653d167), X(0x26cb175e), X(0x2742c7d0), X(0x27bae09e),
195 X(0x28335fa2), X(0x28ac42b3), X(0x292587a5), X(0x299f2c48),
196 X(0x2a192e69), X(0x2a938bd1), X(0x2b0e4247), X(0x2b894f8d),
197 X(0x2c04b164), X(0x2c806588), X(0x2cfc69b2), X(0x2d78bb9a),
198 X(0x2df558f4), X(0x2e723f6f), X(0x2eef6cbb), X(0x2f6cde83),
199 X(0x2fea9270), X(0x30688627), X(0x30e6b74e), X(0x31652385),
200 X(0x31e3c86b), X(0x3262a39e), X(0x32e1b2b8), X(0x3360f352),
201 X(0x33e06303), X(0x345fff5e), X(0x34dfc5f8), X(0x355fb462),
202 X(0x35dfc82a), X(0x365ffee0), X(0x36e0560f), X(0x3760cb43),
203 X(0x37e15c05), X(0x386205df), X(0x38e2c657), X(0x39639af5),
204 X(0x39e4813e), X(0x3a6576b6), X(0x3ae678e3), X(0x3b678547),
205 X(0x3be89965), X(0x3c69b2c1), X(0x3ceacedc), X(0x3d6beb37),
206 X(0x3ded0557), X(0x3e6e1abb), X(0x3eef28e6), X(0x3f702d5a),
207 X(0x3ff1259a), X(0x40720f29), X(0x40f2e789), X(0x4173ac3f),
208 X(0x41f45ad0), X(0x4274f0c2), X(0x42f56b9a), X(0x4375c8e0),
209 X(0x43f6061d), X(0x447620db), X(0x44f616a5), X(0x4575e509),
210 X(0x45f58994), X(0x467501d6), X(0x46f44b62), X(0x477363cb),
211 X(0x47f248a6), X(0x4870f78e), X(0x48ef6e1a), X(0x496da9e8),
212 X(0x49eba897), X(0x4a6967c8), X(0x4ae6e521), X(0x4b641e47),
213 X(0x4be110e5), X(0x4c5dbaa7), X(0x4cda193f), X(0x4d562a5f),
214 X(0x4dd1ebbd), X(0x4e4d5b15), X(0x4ec87623), X(0x4f433aa9),
215 X(0x4fbda66c), X(0x5037b734), X(0x50b16acf), X(0x512abf0e),
216 X(0x51a3b1c5), X(0x521c40ce), X(0x52946a06), X(0x530c2b50),
217 X(0x53838292), X(0x53fa6db8), X(0x5470eab3), X(0x54e6f776),
218 X(0x555c91fc), X(0x55d1b844), X(0x56466851), X(0x56baa02f),
219 X(0x572e5deb), X(0x57a19f98), X(0x58146352), X(0x5886a737),
220 X(0x58f8696d), X(0x5969a81c), X(0x59da6177), X(0x5a4a93b4),
221 X(0x5aba3d0f), X(0x5b295bcb), X(0x5b97ee30), X(0x5c05f28d),
222 X(0x5c736738), X(0x5ce04a8d), X(0x5d4c9aed), X(0x5db856c1),
223 X(0x5e237c78), X(0x5e8e0a89), X(0x5ef7ff6f), X(0x5f6159b0),
224 X(0x5fca17d4), X(0x6032386e), X(0x6099ba15), X(0x61009b69),
225 X(0x6166db11), X(0x61cc77b9), X(0x62317017), X(0x6295c2e7),
226 X(0x62f96eec), X(0x635c72f1), X(0x63becdc8), X(0x64207e4b),
227 X(0x6481835a), X(0x64e1dbde), X(0x654186c8), X(0x65a0830e),
228 X(0x65fecfb1), X(0x665c6bb7), X(0x66b95630), X(0x67158e30),
229 X(0x677112d7), X(0x67cbe34b), X(0x6825feb9), X(0x687f6456),
230 X(0x68d81361), X(0x69300b1e), X(0x69874ada), X(0x69ddd1ea),
231 X(0x6a339fab), X(0x6a88b382), X(0x6add0cdb), X(0x6b30ab2a),
232 X(0x6b838dec), X(0x6bd5b4a6), X(0x6c271ee2), X(0x6c77cc36),
233 X(0x6cc7bc3d), X(0x6d16ee9b), X(0x6d6562fb), X(0x6db31911),
234 X(0x6e001099), X(0x6e4c4955), X(0x6e97c311), X(0x6ee27d9f),
235 X(0x6f2c78d9), X(0x6f75b4a2), X(0x6fbe30e4), X(0x7005ed91),
236 X(0x704ceaa1), X(0x70932816), X(0x70d8a5f8), X(0x711d6457),
237 X(0x7161634b), X(0x71a4a2f3), X(0x71e72375), X(0x7228e500),
238 X(0x7269e7c8), X(0x72aa2c0a), X(0x72e9b209), X(0x73287a12),
239 X(0x73668476), X(0x73a3d18f), X(0x73e061bc), X(0x741c3566),
240 X(0x74574cfa), X(0x7491a8ee), X(0x74cb49be), X(0x75042fec),
241 X(0x753c5c03), X(0x7573ce92), X(0x75aa882f), X(0x75e08979),
242 X(0x7615d313), X(0x764a65a7), X(0x767e41e5), X(0x76b16884),
243 X(0x76e3da40), X(0x771597dc), X(0x7746a221), X(0x7776f9dd),
244 X(0x77a69fe6), X(0x77d59514), X(0x7803da49), X(0x7831706a),
245 X(0x785e5861), X(0x788a9320), X(0x78b6219c), X(0x78e104cf),
246 X(0x790b3dbb), X(0x7934cd64), X(0x795db4d5), X(0x7985f51d),
247 X(0x79ad8f50), X(0x79d48486), X(0x79fad5de), X(0x7a208478),
248 X(0x7a45917b), X(0x7a69fe12), X(0x7a8dcb6c), X(0x7ab0fabb),
249 X(0x7ad38d36), X(0x7af5841a), X(0x7b16e0a3), X(0x7b37a416),
250 X(0x7b57cfb8), X(0x7b7764d4), X(0x7b9664b6), X(0x7bb4d0b0),
251 X(0x7bd2aa14), X(0x7beff23b), X(0x7c0caa7f), X(0x7c28d43c),
252 X(0x7c4470d2), X(0x7c5f81a5), X(0x7c7a081a), X(0x7c940598),
253 X(0x7cad7b8b), X(0x7cc66b5e), X(0x7cded680), X(0x7cf6be64),
254 X(0x7d0e247b), X(0x7d250a3c), X(0x7d3b711c), X(0x7d515a95),
255 X(0x7d66c822), X(0x7d7bbb3c), X(0x7d903563), X(0x7da43814),
256 X(0x7db7c4d0), X(0x7dcadd16), X(0x7ddd826a), X(0x7defb64d),
257 X(0x7e017a44), X(0x7e12cfd3), X(0x7e23b87f), X(0x7e3435cc),
258 X(0x7e444943), X(0x7e53f467), X(0x7e6338c0), X(0x7e7217d5),
259 X(0x7e80932b), X(0x7e8eac49), X(0x7e9c64b7), X(0x7ea9bdf8),
260 X(0x7eb6b994), X(0x7ec35910), X(0x7ecf9def), X(0x7edb89b6),
261 X(0x7ee71de9), X(0x7ef25c09), X(0x7efd4598), X(0x7f07dc16),
262 X(0x7f122103), X(0x7f1c15dc), X(0x7f25bc1f), X(0x7f2f1547),
263 X(0x7f3822cd), X(0x7f40e62b), X(0x7f4960d6), X(0x7f519443),
264 X(0x7f5981e7), X(0x7f612b31), X(0x7f689191), X(0x7f6fb674),
265 X(0x7f769b45), X(0x7f7d416c), X(0x7f83aa51), X(0x7f89d757),
266 X(0x7f8fc9df), X(0x7f958348), X(0x7f9b04ef), X(0x7fa0502e),
267 X(0x7fa56659), X(0x7faa48c7), X(0x7faef8c7), X(0x7fb377a7),
268 X(0x7fb7c6b3), X(0x7fbbe732), X(0x7fbfda67), X(0x7fc3a196),
269 X(0x7fc73dfa), X(0x7fcab0ce), X(0x7fcdfb4a), X(0x7fd11ea0),
270 X(0x7fd41c00), X(0x7fd6f496), X(0x7fd9a989), X(0x7fdc3bff),
271 X(0x7fdead17), X(0x7fe0fdee), X(0x7fe32f9d), X(0x7fe54337),
272 X(0x7fe739ce), X(0x7fe9146c), X(0x7fead41b), X(0x7fec79dd),
273 X(0x7fee06b2), X(0x7fef7b94), X(0x7ff0d97b), X(0x7ff22158),
274 X(0x7ff35417), X(0x7ff472a3), X(0x7ff57de0), X(0x7ff676ac),
275 X(0x7ff75de3), X(0x7ff8345a), X(0x7ff8fae4), X(0x7ff9b24b),
276 X(0x7ffa5b58), X(0x7ffaf6cd), X(0x7ffb8568), X(0x7ffc07e2),
277 X(0x7ffc7eed), X(0x7ffceb38), X(0x7ffd4d6d), X(0x7ffda631),
278 X(0x7ffdf621), X(0x7ffe3dd8), X(0x7ffe7dea), X(0x7ffeb6e7),
279 X(0x7ffee959), X(0x7fff15c4), X(0x7fff3ca9), X(0x7fff5e80),
280 X(0x7fff7bc0), X(0x7fff94d6), X(0x7fffaa2d), X(0x7fffbc29),
281 X(0x7fffcb29), X(0x7fffd786), X(0x7fffe195), X(0x7fffe9a3),
282 X(0x7fffeffa), X(0x7ffff4dd), X(0x7ffff889), X(0x7ffffb37),
283 X(0x7ffffd1a), X(0x7ffffe5d), X(0x7fffff29), X(0x7fffffa0),
284 X(0x7fffffdd), X(0x7ffffff7), X(0x7fffffff), X(0x7fffffff),
285};
286
287static LOOKUP_T vwin2048[1024] ICONST_ATTR_TREMOR_WINDOW = {
288 X(0x000007c0), X(0x000045c4), X(0x0000c1ca), X(0x00017bd3),
289 X(0x000273de), X(0x0003a9eb), X(0x00051df9), X(0x0006d007),
290 X(0x0008c014), X(0x000aee1e), X(0x000d5a25), X(0x00100428),
291 X(0x0012ec23), X(0x00161216), X(0x001975fe), X(0x001d17da),
292 X(0x0020f7a8), X(0x00251564), X(0x0029710c), X(0x002e0a9e),
293 X(0x0032e217), X(0x0037f773), X(0x003d4ab0), X(0x0042dbca),
294 X(0x0048aabe), X(0x004eb788), X(0x00550224), X(0x005b8a8f),
295 X(0x006250c5), X(0x006954c1), X(0x0070967e), X(0x007815f9),
296 X(0x007fd32c), X(0x0087ce13), X(0x009006a9), X(0x00987ce9),
297 X(0x00a130cc), X(0x00aa224f), X(0x00b3516b), X(0x00bcbe1a),
298 X(0x00c66856), X(0x00d0501a), X(0x00da755f), X(0x00e4d81f),
299 X(0x00ef7853), X(0x00fa55f4), X(0x010570fc), X(0x0110c963),
300 X(0x011c5f22), X(0x01283232), X(0x0134428c), X(0x01409027),
301 X(0x014d1afb), X(0x0159e302), X(0x0166e831), X(0x01742a82),
302 X(0x0181a9ec), X(0x018f6665), X(0x019d5fe5), X(0x01ab9663),
303 X(0x01ba09d6), X(0x01c8ba34), X(0x01d7a775), X(0x01e6d18d),
304 X(0x01f63873), X(0x0205dc1e), X(0x0215bc82), X(0x0225d997),
305 X(0x02363350), X(0x0246c9a3), X(0x02579c86), X(0x0268abed),
306 X(0x0279f7cc), X(0x028b801a), X(0x029d44c9), X(0x02af45ce),
307 X(0x02c1831d), X(0x02d3fcaa), X(0x02e6b269), X(0x02f9a44c),
308 X(0x030cd248), X(0x03203c4f), X(0x0333e255), X(0x0347c44b),
309 X(0x035be225), X(0x03703bd5), X(0x0384d14d), X(0x0399a280),
310 X(0x03aeaf5e), X(0x03c3f7d9), X(0x03d97be4), X(0x03ef3b6e),
311 X(0x0405366a), X(0x041b6cc8), X(0x0431de78), X(0x04488b6c),
312 X(0x045f7393), X(0x047696dd), X(0x048df53b), X(0x04a58e9b),
313 X(0x04bd62ee), X(0x04d57223), X(0x04edbc28), X(0x050640ed),
314 X(0x051f0060), X(0x0537fa70), X(0x05512f0a), X(0x056a9e1e),
315 X(0x05844798), X(0x059e2b67), X(0x05b84978), X(0x05d2a1b8),
316 X(0x05ed3414), X(0x06080079), X(0x062306d3), X(0x063e470f),
317 X(0x0659c119), X(0x067574dd), X(0x06916247), X(0x06ad8941),
318 X(0x06c9e9b8), X(0x06e68397), X(0x070356c8), X(0x07206336),
319 X(0x073da8cb), X(0x075b2772), X(0x0778df15), X(0x0796cf9c),
320 X(0x07b4f8f3), X(0x07d35b01), X(0x07f1f5b1), X(0x0810c8eb),
321 X(0x082fd497), X(0x084f189e), X(0x086e94e9), X(0x088e495e),
322 X(0x08ae35e6), X(0x08ce5a68), X(0x08eeb6cc), X(0x090f4af8),
323 X(0x093016d3), X(0x09511a44), X(0x09725530), X(0x0993c77f),
324 X(0x09b57115), X(0x09d751d8), X(0x09f969ae), X(0x0a1bb87c),
325 X(0x0a3e3e26), X(0x0a60fa91), X(0x0a83eda2), X(0x0aa7173c),
326 X(0x0aca7743), X(0x0aee0d9b), X(0x0b11da28), X(0x0b35dccc),
327 X(0x0b5a156a), X(0x0b7e83e5), X(0x0ba3281f), X(0x0bc801fa),
328 X(0x0bed1159), X(0x0c12561c), X(0x0c37d025), X(0x0c5d7f55),
329 X(0x0c83638d), X(0x0ca97cae), X(0x0ccfca97), X(0x0cf64d2a),
330 X(0x0d1d0444), X(0x0d43efc7), X(0x0d6b0f92), X(0x0d926383),
331 X(0x0db9eb79), X(0x0de1a752), X(0x0e0996ee), X(0x0e31ba29),
332 X(0x0e5a10e2), X(0x0e829af6), X(0x0eab5841), X(0x0ed448a2),
333 X(0x0efd6bf4), X(0x0f26c214), X(0x0f504ade), X(0x0f7a062e),
334 X(0x0fa3f3df), X(0x0fce13cd), X(0x0ff865d2), X(0x1022e9ca),
335 X(0x104d9f8e), X(0x107886f9), X(0x10a39fe5), X(0x10ceea2c),
336 X(0x10fa65a6), X(0x1126122d), X(0x1151ef9a), X(0x117dfdc5),
337 X(0x11aa3c87), X(0x11d6abb6), X(0x12034b2c), X(0x12301ac0),
338 X(0x125d1a48), X(0x128a499b), X(0x12b7a891), X(0x12e536ff),
339 X(0x1312f4bb), X(0x1340e19c), X(0x136efd75), X(0x139d481e),
340 X(0x13cbc16a), X(0x13fa692f), X(0x14293f40), X(0x14584371),
341 X(0x14877597), X(0x14b6d585), X(0x14e6630d), X(0x15161e04),
342 X(0x1546063b), X(0x15761b85), X(0x15a65db3), X(0x15d6cc99),
343 X(0x16076806), X(0x16382fcd), X(0x166923bf), X(0x169a43ab),
344 X(0x16cb8f62), X(0x16fd06b5), X(0x172ea973), X(0x1760776b),
345 X(0x1792706e), X(0x17c49449), X(0x17f6e2cb), X(0x18295bc3),
346 X(0x185bfeff), X(0x188ecc4c), X(0x18c1c379), X(0x18f4e452),
347 X(0x19282ea4), X(0x195ba23c), X(0x198f3ee6), X(0x19c3046e),
348 X(0x19f6f2a1), X(0x1a2b094a), X(0x1a5f4833), X(0x1a93af28),
349 X(0x1ac83df3), X(0x1afcf460), X(0x1b31d237), X(0x1b66d744),
350 X(0x1b9c034e), X(0x1bd15621), X(0x1c06cf84), X(0x1c3c6f40),
351 X(0x1c72351e), X(0x1ca820e6), X(0x1cde3260), X(0x1d146953),
352 X(0x1d4ac587), X(0x1d8146c3), X(0x1db7eccd), X(0x1deeb76c),
353 X(0x1e25a667), X(0x1e5cb982), X(0x1e93f085), X(0x1ecb4b33),
354 X(0x1f02c953), X(0x1f3a6aaa), X(0x1f722efb), X(0x1faa160b),
355 X(0x1fe21f9e), X(0x201a4b79), X(0x2052995d), X(0x208b0910),
356 X(0x20c39a53), X(0x20fc4cea), X(0x21352097), X(0x216e151c),
357 X(0x21a72a3a), X(0x21e05fb5), X(0x2219b54d), X(0x22532ac3),
358 X(0x228cbfd8), X(0x22c6744d), X(0x230047e2), X(0x233a3a58),
359 X(0x23744b6d), X(0x23ae7ae3), X(0x23e8c878), X(0x242333ec),
360 X(0x245dbcfd), X(0x24986369), X(0x24d326f1), X(0x250e0750),
361 X(0x25490446), X(0x25841d90), X(0x25bf52ec), X(0x25faa417),
362 X(0x263610cd), X(0x267198cc), X(0x26ad3bcf), X(0x26e8f994),
363 X(0x2724d1d6), X(0x2760c451), X(0x279cd0c0), X(0x27d8f6e0),
364 X(0x2815366a), X(0x28518f1b), X(0x288e00ac), X(0x28ca8ad8),
365 X(0x29072d5a), X(0x2943e7eb), X(0x2980ba45), X(0x29bda422),
366 X(0x29faa53c), X(0x2a37bd4a), X(0x2a74ec07), X(0x2ab2312b),
367 X(0x2aef8c6f), X(0x2b2cfd8b), X(0x2b6a8437), X(0x2ba8202c),
368 X(0x2be5d120), X(0x2c2396cc), X(0x2c6170e7), X(0x2c9f5f29),
369 X(0x2cdd6147), X(0x2d1b76fa), X(0x2d599ff7), X(0x2d97dbf5),
370 X(0x2dd62aab), X(0x2e148bcf), X(0x2e52ff16), X(0x2e918436),
371 X(0x2ed01ae5), X(0x2f0ec2d9), X(0x2f4d7bc6), X(0x2f8c4562),
372 X(0x2fcb1f62), X(0x300a097a), X(0x3049035f), X(0x30880cc6),
373 X(0x30c72563), X(0x31064cea), X(0x3145830f), X(0x3184c786),
374 X(0x31c41a03), X(0x32037a39), X(0x3242e7dc), X(0x3282629f),
375 X(0x32c1ea36), X(0x33017e53), X(0x33411ea9), X(0x3380caec),
376 X(0x33c082ce), X(0x34004602), X(0x34401439), X(0x347fed27),
377 X(0x34bfd07e), X(0x34ffbdf0), X(0x353fb52e), X(0x357fb5ec),
378 X(0x35bfbfda), X(0x35ffd2aa), X(0x363fee0f), X(0x368011b9),
379 X(0x36c03d5a), X(0x370070a4), X(0x3740ab48), X(0x3780ecf7),
380 X(0x37c13562), X(0x3801843a), X(0x3841d931), X(0x388233f7),
381 X(0x38c2943d), X(0x3902f9b4), X(0x3943640d), X(0x3983d2f8),
382 X(0x39c44626), X(0x3a04bd48), X(0x3a45380e), X(0x3a85b62a),
383 X(0x3ac6374a), X(0x3b06bb20), X(0x3b47415c), X(0x3b87c9ae),
384 X(0x3bc853c7), X(0x3c08df57), X(0x3c496c0f), X(0x3c89f99f),
385 X(0x3cca87b6), X(0x3d0b1605), X(0x3d4ba43d), X(0x3d8c320e),
386 X(0x3dccbf27), X(0x3e0d4b3a), X(0x3e4dd5f6), X(0x3e8e5f0c),
387 X(0x3ecee62b), X(0x3f0f6b05), X(0x3f4fed49), X(0x3f906ca8),
388 X(0x3fd0e8d2), X(0x40116177), X(0x4051d648), X(0x409246f6),
389 X(0x40d2b330), X(0x41131aa7), X(0x41537d0c), X(0x4193da10),
390 X(0x41d43162), X(0x421482b4), X(0x4254cdb7), X(0x4295121b),
391 X(0x42d54f91), X(0x431585ca), X(0x4355b477), X(0x4395db49),
392 X(0x43d5f9f1), X(0x44161021), X(0x44561d8a), X(0x449621dd),
393 X(0x44d61ccc), X(0x45160e08), X(0x4555f544), X(0x4595d230),
394 X(0x45d5a47f), X(0x46156be3), X(0x4655280e), X(0x4694d8b2),
395 X(0x46d47d82), X(0x4714162f), X(0x4753a26d), X(0x479321ef),
396 X(0x47d29466), X(0x4811f987), X(0x48515104), X(0x48909a91),
397 X(0x48cfd5e1), X(0x490f02a7), X(0x494e2098), X(0x498d2f66),
398 X(0x49cc2ec7), X(0x4a0b1e6f), X(0x4a49fe11), X(0x4a88cd62),
399 X(0x4ac78c18), X(0x4b0639e6), X(0x4b44d683), X(0x4b8361a2),
400 X(0x4bc1dafa), X(0x4c004241), X(0x4c3e972c), X(0x4c7cd970),
401 X(0x4cbb08c5), X(0x4cf924e1), X(0x4d372d7a), X(0x4d752247),
402 X(0x4db30300), X(0x4df0cf5a), X(0x4e2e870f), X(0x4e6c29d6),
403 X(0x4ea9b766), X(0x4ee72f78), X(0x4f2491c4), X(0x4f61de02),
404 X(0x4f9f13ec), X(0x4fdc333b), X(0x50193ba8), X(0x50562ced),
405 X(0x509306c3), X(0x50cfc8e5), X(0x510c730d), X(0x514904f6),
406 X(0x51857e5a), X(0x51c1def5), X(0x51fe2682), X(0x523a54bc),
407 X(0x52766961), X(0x52b2642c), X(0x52ee44d9), X(0x532a0b26),
408 X(0x5365b6d0), X(0x53a14793), X(0x53dcbd2f), X(0x54181760),
409 X(0x545355e5), X(0x548e787d), X(0x54c97ee6), X(0x550468e1),
410 X(0x553f362c), X(0x5579e687), X(0x55b479b3), X(0x55eeef70),
411 X(0x5629477f), X(0x566381a1), X(0x569d9d97), X(0x56d79b24),
412 X(0x57117a0a), X(0x574b3a0a), X(0x5784dae9), X(0x57be5c69),
413 X(0x57f7be4d), X(0x5831005a), X(0x586a2254), X(0x58a32400),
414 X(0x58dc0522), X(0x5914c57f), X(0x594d64de), X(0x5985e305),
415 X(0x59be3fba), X(0x59f67ac3), X(0x5a2e93e9), X(0x5a668af2),
416 X(0x5a9e5fa6), X(0x5ad611ce), X(0x5b0da133), X(0x5b450d9d),
417 X(0x5b7c56d7), X(0x5bb37ca9), X(0x5bea7ede), X(0x5c215d41),
418 X(0x5c58179d), X(0x5c8eadbe), X(0x5cc51f6f), X(0x5cfb6c7c),
419 X(0x5d3194b2), X(0x5d6797de), X(0x5d9d75cf), X(0x5dd32e51),
420 X(0x5e08c132), X(0x5e3e2e43), X(0x5e737551), X(0x5ea8962d),
421 X(0x5edd90a7), X(0x5f12648e), X(0x5f4711b4), X(0x5f7b97ea),
422 X(0x5faff702), X(0x5fe42ece), X(0x60183f20), X(0x604c27cc),
423 X(0x607fe8a6), X(0x60b38180), X(0x60e6f22f), X(0x611a3a89),
424 X(0x614d5a62), X(0x61805190), X(0x61b31fe9), X(0x61e5c545),
425 X(0x62184179), X(0x624a945d), X(0x627cbdca), X(0x62aebd98),
426 X(0x62e0939f), X(0x63123fba), X(0x6343c1c1), X(0x6375198f),
427 X(0x63a646ff), X(0x63d749ec), X(0x64082232), X(0x6438cfad),
428 X(0x64695238), X(0x6499a9b3), X(0x64c9d5f9), X(0x64f9d6ea),
429 X(0x6529ac63), X(0x65595643), X(0x6588d46a), X(0x65b826b8),
430 X(0x65e74d0e), X(0x6616474b), X(0x66451552), X(0x6673b704),
431 X(0x66a22c44), X(0x66d074f4), X(0x66fe90f8), X(0x672c8033),
432 X(0x675a428a), X(0x6787d7e1), X(0x67b5401f), X(0x67e27b27),
433 X(0x680f88e1), X(0x683c6934), X(0x68691c05), X(0x6895a13e),
434 X(0x68c1f8c7), X(0x68ee2287), X(0x691a1e68), X(0x6945ec54),
435 X(0x69718c35), X(0x699cfdf5), X(0x69c8417f), X(0x69f356c0),
436 X(0x6a1e3da3), X(0x6a48f615), X(0x6a738002), X(0x6a9ddb5a),
437 X(0x6ac80808), X(0x6af205fd), X(0x6b1bd526), X(0x6b457575),
438 X(0x6b6ee6d8), X(0x6b982940), X(0x6bc13c9f), X(0x6bea20e5),
439 X(0x6c12d605), X(0x6c3b5bf1), X(0x6c63b29c), X(0x6c8bd9fb),
440 X(0x6cb3d200), X(0x6cdb9aa0), X(0x6d0333d0), X(0x6d2a9d86),
441 X(0x6d51d7b7), X(0x6d78e25a), X(0x6d9fbd67), X(0x6dc668d3),
442 X(0x6dece498), X(0x6e1330ad), X(0x6e394d0c), X(0x6e5f39ae),
443 X(0x6e84f68d), X(0x6eaa83a2), X(0x6ecfe0ea), X(0x6ef50e5e),
444 X(0x6f1a0bfc), X(0x6f3ed9bf), X(0x6f6377a4), X(0x6f87e5a8),
445 X(0x6fac23c9), X(0x6fd03206), X(0x6ff4105c), X(0x7017becc),
446 X(0x703b3d54), X(0x705e8bf5), X(0x7081aaaf), X(0x70a49984),
447 X(0x70c75874), X(0x70e9e783), X(0x710c46b2), X(0x712e7605),
448 X(0x7150757f), X(0x71724523), X(0x7193e4f6), X(0x71b554fd),
449 X(0x71d6953e), X(0x71f7a5bd), X(0x72188681), X(0x72393792),
450 X(0x7259b8f5), X(0x727a0ab2), X(0x729a2cd2), X(0x72ba1f5d),
451 X(0x72d9e25c), X(0x72f975d8), X(0x7318d9db), X(0x73380e6f),
452 X(0x735713a0), X(0x7375e978), X(0x73949003), X(0x73b3074c),
453 X(0x73d14f61), X(0x73ef684f), X(0x740d5222), X(0x742b0ce9),
454 X(0x744898b1), X(0x7465f589), X(0x74832381), X(0x74a022a8),
455 X(0x74bcf30e), X(0x74d994c3), X(0x74f607d8), X(0x75124c5f),
456 X(0x752e6268), X(0x754a4a05), X(0x7566034b), X(0x75818e4a),
457 X(0x759ceb16), X(0x75b819c4), X(0x75d31a66), X(0x75eded12),
458 X(0x760891dc), X(0x762308da), X(0x763d5221), X(0x76576dc8),
459 X(0x76715be4), X(0x768b1c8c), X(0x76a4afd9), X(0x76be15e0),
460 X(0x76d74ebb), X(0x76f05a82), X(0x7709394d), X(0x7721eb35),
461 X(0x773a7054), X(0x7752c8c4), X(0x776af49f), X(0x7782f400),
462 X(0x779ac701), X(0x77b26dbd), X(0x77c9e851), X(0x77e136d8),
463 X(0x77f8596f), X(0x780f5032), X(0x78261b3f), X(0x783cbab2),
464 X(0x78532eaa), X(0x78697745), X(0x787f94a0), X(0x789586db),
465 X(0x78ab4e15), X(0x78c0ea6d), X(0x78d65c03), X(0x78eba2f7),
466 X(0x7900bf68), X(0x7915b179), X(0x792a7949), X(0x793f16fb),
467 X(0x79538aaf), X(0x7967d488), X(0x797bf4a8), X(0x798feb31),
468 X(0x79a3b846), X(0x79b75c0a), X(0x79cad6a1), X(0x79de282e),
469 X(0x79f150d5), X(0x7a0450bb), X(0x7a172803), X(0x7a29d6d3),
470 X(0x7a3c5d50), X(0x7a4ebb9f), X(0x7a60f1e6), X(0x7a73004a),
471 X(0x7a84e6f2), X(0x7a96a604), X(0x7aa83da7), X(0x7ab9ae01),
472 X(0x7acaf73a), X(0x7adc1979), X(0x7aed14e6), X(0x7afde9a8),
473 X(0x7b0e97e8), X(0x7b1f1fcd), X(0x7b2f8182), X(0x7b3fbd2d),
474 X(0x7b4fd2f9), X(0x7b5fc30f), X(0x7b6f8d98), X(0x7b7f32bd),
475 X(0x7b8eb2a9), X(0x7b9e0d85), X(0x7bad437d), X(0x7bbc54b9),
476 X(0x7bcb4166), X(0x7bda09ae), X(0x7be8adbc), X(0x7bf72dbc),
477 X(0x7c0589d8), X(0x7c13c23d), X(0x7c21d716), X(0x7c2fc88f),
478 X(0x7c3d96d5), X(0x7c4b4214), X(0x7c58ca78), X(0x7c66302d),
479 X(0x7c737362), X(0x7c809443), X(0x7c8d92fc), X(0x7c9a6fbc),
480 X(0x7ca72aaf), X(0x7cb3c404), X(0x7cc03be8), X(0x7ccc9288),
481 X(0x7cd8c814), X(0x7ce4dcb9), X(0x7cf0d0a5), X(0x7cfca406),
482 X(0x7d08570c), X(0x7d13e9e5), X(0x7d1f5cbf), X(0x7d2aafca),
483 X(0x7d35e335), X(0x7d40f72e), X(0x7d4bebe4), X(0x7d56c188),
484 X(0x7d617848), X(0x7d6c1054), X(0x7d7689db), X(0x7d80e50e),
485 X(0x7d8b221b), X(0x7d954133), X(0x7d9f4286), X(0x7da92643),
486 X(0x7db2ec9b), X(0x7dbc95bd), X(0x7dc621da), X(0x7dcf9123),
487 X(0x7dd8e3c6), X(0x7de219f6), X(0x7deb33e2), X(0x7df431ba),
488 X(0x7dfd13af), X(0x7e05d9f2), X(0x7e0e84b4), X(0x7e171424),
489 X(0x7e1f8874), X(0x7e27e1d4), X(0x7e302074), X(0x7e384487),
490 X(0x7e404e3c), X(0x7e483dc4), X(0x7e501350), X(0x7e57cf11),
491 X(0x7e5f7138), X(0x7e66f9f4), X(0x7e6e6979), X(0x7e75bff5),
492 X(0x7e7cfd9a), X(0x7e842298), X(0x7e8b2f22), X(0x7e922366),
493 X(0x7e98ff97), X(0x7e9fc3e4), X(0x7ea6707f), X(0x7ead0598),
494 X(0x7eb38360), X(0x7eb9ea07), X(0x7ec039bf), X(0x7ec672b7),
495 X(0x7ecc9521), X(0x7ed2a12c), X(0x7ed8970a), X(0x7ede76ea),
496 X(0x7ee440fd), X(0x7ee9f573), X(0x7eef947d), X(0x7ef51e4b),
497 X(0x7efa930d), X(0x7efff2f2), X(0x7f053e2b), X(0x7f0a74e8),
498 X(0x7f0f9758), X(0x7f14a5ac), X(0x7f19a013), X(0x7f1e86bc),
499 X(0x7f2359d8), X(0x7f281995), X(0x7f2cc623), X(0x7f315fb1),
500 X(0x7f35e66e), X(0x7f3a5a8a), X(0x7f3ebc33), X(0x7f430b98),
501 X(0x7f4748e7), X(0x7f4b7450), X(0x7f4f8e01), X(0x7f539629),
502 X(0x7f578cf5), X(0x7f5b7293), X(0x7f5f4732), X(0x7f630b00),
503 X(0x7f66be2b), X(0x7f6a60df), X(0x7f6df34b), X(0x7f71759b),
504 X(0x7f74e7fe), X(0x7f784aa0), X(0x7f7b9daf), X(0x7f7ee156),
505 X(0x7f8215c3), X(0x7f853b22), X(0x7f88519f), X(0x7f8b5967),
506 X(0x7f8e52a6), X(0x7f913d87), X(0x7f941a36), X(0x7f96e8df),
507 X(0x7f99a9ad), X(0x7f9c5ccb), X(0x7f9f0265), X(0x7fa19aa5),
508 X(0x7fa425b5), X(0x7fa6a3c1), X(0x7fa914f3), X(0x7fab7974),
509 X(0x7fadd16f), X(0x7fb01d0d), X(0x7fb25c78), X(0x7fb48fd9),
510 X(0x7fb6b75a), X(0x7fb8d323), X(0x7fbae35d), X(0x7fbce831),
511 X(0x7fbee1c7), X(0x7fc0d047), X(0x7fc2b3d9), X(0x7fc48ca5),
512 X(0x7fc65ad3), X(0x7fc81e88), X(0x7fc9d7ee), X(0x7fcb872a),
513 X(0x7fcd2c63), X(0x7fcec7bf), X(0x7fd05966), X(0x7fd1e17c),
514 X(0x7fd36027), X(0x7fd4d58d), X(0x7fd641d3), X(0x7fd7a51e),
515 X(0x7fd8ff94), X(0x7fda5157), X(0x7fdb9a8e), X(0x7fdcdb5b),
516 X(0x7fde13e2), X(0x7fdf4448), X(0x7fe06caf), X(0x7fe18d3b),
517 X(0x7fe2a60e), X(0x7fe3b74b), X(0x7fe4c114), X(0x7fe5c38b),
518 X(0x7fe6bed2), X(0x7fe7b30a), X(0x7fe8a055), X(0x7fe986d4),
519 X(0x7fea66a7), X(0x7feb3ff0), X(0x7fec12cd), X(0x7fecdf5f),
520 X(0x7feda5c5), X(0x7fee6620), X(0x7fef208d), X(0x7fefd52c),
521 X(0x7ff0841c), X(0x7ff12d7a), X(0x7ff1d164), X(0x7ff26ff9),
522 X(0x7ff30955), X(0x7ff39d96), X(0x7ff42cd9), X(0x7ff4b739),
523 X(0x7ff53cd4), X(0x7ff5bdc5), X(0x7ff63a28), X(0x7ff6b217),
524 X(0x7ff725af), X(0x7ff7950a), X(0x7ff80043), X(0x7ff86773),
525 X(0x7ff8cab4), X(0x7ff92a21), X(0x7ff985d1), X(0x7ff9dddf),
526 X(0x7ffa3262), X(0x7ffa8374), X(0x7ffad12c), X(0x7ffb1ba1),
527 X(0x7ffb62ec), X(0x7ffba723), X(0x7ffbe85c), X(0x7ffc26b0),
528 X(0x7ffc6233), X(0x7ffc9afb), X(0x7ffcd11e), X(0x7ffd04b1),
529 X(0x7ffd35c9), X(0x7ffd647b), X(0x7ffd90da), X(0x7ffdbafa),
530 X(0x7ffde2f0), X(0x7ffe08ce), X(0x7ffe2ca7), X(0x7ffe4e8e),
531 X(0x7ffe6e95), X(0x7ffe8cce), X(0x7ffea94a), X(0x7ffec41b),
532 X(0x7ffedd52), X(0x7ffef4ff), X(0x7fff0b33), X(0x7fff1ffd),
533 X(0x7fff336e), X(0x7fff4593), X(0x7fff567d), X(0x7fff663a),
534 X(0x7fff74d8), X(0x7fff8265), X(0x7fff8eee), X(0x7fff9a81),
535 X(0x7fffa52b), X(0x7fffaef8), X(0x7fffb7f5), X(0x7fffc02d),
536 X(0x7fffc7ab), X(0x7fffce7c), X(0x7fffd4a9), X(0x7fffda3e),
537 X(0x7fffdf44), X(0x7fffe3c6), X(0x7fffe7cc), X(0x7fffeb60),
538 X(0x7fffee8a), X(0x7ffff153), X(0x7ffff3c4), X(0x7ffff5e3),
539 X(0x7ffff7b8), X(0x7ffff94b), X(0x7ffffaa1), X(0x7ffffbc1),
540 X(0x7ffffcb2), X(0x7ffffd78), X(0x7ffffe19), X(0x7ffffe9a),
541 X(0x7ffffeff), X(0x7fffff4e), X(0x7fffff89), X(0x7fffffb3),
542 X(0x7fffffd2), X(0x7fffffe6), X(0x7ffffff3), X(0x7ffffffa),
543 X(0x7ffffffe), X(0x7fffffff), X(0x7fffffff), X(0x7fffffff),
544};
545
546static LOOKUP_T vwin4096[2048] = {
547 X(0x000001f0), X(0x00001171), X(0x00003072), X(0x00005ef5),
548 X(0x00009cf8), X(0x0000ea7c), X(0x00014780), X(0x0001b405),
549 X(0x0002300b), X(0x0002bb91), X(0x00035698), X(0x0004011e),
550 X(0x0004bb25), X(0x000584ac), X(0x00065db3), X(0x0007463a),
551 X(0x00083e41), X(0x000945c7), X(0x000a5ccc), X(0x000b8350),
552 X(0x000cb954), X(0x000dfed7), X(0x000f53d8), X(0x0010b857),
553 X(0x00122c55), X(0x0013afd1), X(0x001542ca), X(0x0016e541),
554 X(0x00189735), X(0x001a58a7), X(0x001c2995), X(0x001e09ff),
555 X(0x001ff9e6), X(0x0021f948), X(0x00240826), X(0x00262680),
556 X(0x00285454), X(0x002a91a3), X(0x002cde6c), X(0x002f3aaf),
557 X(0x0031a66b), X(0x003421a0), X(0x0036ac4f), X(0x00394675),
558 X(0x003bf014), X(0x003ea92a), X(0x004171b7), X(0x004449bb),
559 X(0x00473135), X(0x004a2824), X(0x004d2e8a), X(0x00504463),
560 X(0x005369b2), X(0x00569e74), X(0x0059e2aa), X(0x005d3652),
561 X(0x0060996d), X(0x00640bf9), X(0x00678df7), X(0x006b1f66),
562 X(0x006ec045), X(0x00727093), X(0x00763051), X(0x0079ff7d),
563 X(0x007dde16), X(0x0081cc1d), X(0x0085c991), X(0x0089d671),
564 X(0x008df2bc), X(0x00921e71), X(0x00965991), X(0x009aa41a),
565 X(0x009efe0c), X(0x00a36766), X(0x00a7e028), X(0x00ac6850),
566 X(0x00b0ffde), X(0x00b5a6d1), X(0x00ba5d28), X(0x00bf22e4),
567 X(0x00c3f802), X(0x00c8dc83), X(0x00cdd065), X(0x00d2d3a8),
568 X(0x00d7e64a), X(0x00dd084c), X(0x00e239ac), X(0x00e77a69),
569 X(0x00ecca83), X(0x00f229f9), X(0x00f798ca), X(0x00fd16f5),
570 X(0x0102a479), X(0x01084155), X(0x010ded89), X(0x0113a913),
571 X(0x011973f3), X(0x011f4e27), X(0x012537af), X(0x012b308a),
572 X(0x013138b7), X(0x01375035), X(0x013d7702), X(0x0143ad1f),
573 X(0x0149f289), X(0x01504741), X(0x0156ab44), X(0x015d1e92),
574 X(0x0163a12a), X(0x016a330b), X(0x0170d433), X(0x017784a3),
575 X(0x017e4458), X(0x01851351), X(0x018bf18e), X(0x0192df0d),
576 X(0x0199dbcd), X(0x01a0e7cd), X(0x01a8030c), X(0x01af2d89),
577 X(0x01b66743), X(0x01bdb038), X(0x01c50867), X(0x01cc6fd0),
578 X(0x01d3e670), X(0x01db6c47), X(0x01e30153), X(0x01eaa593),
579 X(0x01f25907), X(0x01fa1bac), X(0x0201ed81), X(0x0209ce86),
580 X(0x0211beb8), X(0x0219be17), X(0x0221cca2), X(0x0229ea56),
581 X(0x02321733), X(0x023a5337), X(0x02429e60), X(0x024af8af),
582 X(0x02536220), X(0x025bdab3), X(0x02646267), X(0x026cf93a),
583 X(0x02759f2a), X(0x027e5436), X(0x0287185d), X(0x028feb9d),
584 X(0x0298cdf4), X(0x02a1bf62), X(0x02aabfe5), X(0x02b3cf7b),
585 X(0x02bcee23), X(0x02c61bdb), X(0x02cf58a2), X(0x02d8a475),
586 X(0x02e1ff55), X(0x02eb693e), X(0x02f4e230), X(0x02fe6a29),
587 X(0x03080127), X(0x0311a729), X(0x031b5c2d), X(0x03252031),
588 X(0x032ef334), X(0x0338d534), X(0x0342c630), X(0x034cc625),
589 X(0x0356d512), X(0x0360f2f6), X(0x036b1fce), X(0x03755b99),
590 X(0x037fa655), X(0x038a0001), X(0x0394689a), X(0x039ee020),
591 X(0x03a9668f), X(0x03b3fbe6), X(0x03bea024), X(0x03c95347),
592 X(0x03d4154d), X(0x03dee633), X(0x03e9c5f9), X(0x03f4b49b),
593 X(0x03ffb219), X(0x040abe71), X(0x0415d9a0), X(0x042103a5),
594 X(0x042c3c7d), X(0x04378428), X(0x0442daa2), X(0x044e3fea),
595 X(0x0459b3fd), X(0x046536db), X(0x0470c880), X(0x047c68eb),
596 X(0x0488181a), X(0x0493d60b), X(0x049fa2bc), X(0x04ab7e2a),
597 X(0x04b76854), X(0x04c36137), X(0x04cf68d1), X(0x04db7f21),
598 X(0x04e7a424), X(0x04f3d7d8), X(0x05001a3b), X(0x050c6b4a),
599 X(0x0518cb04), X(0x05253966), X(0x0531b66e), X(0x053e421a),
600 X(0x054adc68), X(0x05578555), X(0x05643cdf), X(0x05710304),
601 X(0x057dd7c1), X(0x058abb15), X(0x0597acfd), X(0x05a4ad76),
602 X(0x05b1bc7f), X(0x05beda14), X(0x05cc0635), X(0x05d940dd),
603 X(0x05e68a0b), X(0x05f3e1bd), X(0x060147f0), X(0x060ebca1),
604 X(0x061c3fcf), X(0x0629d176), X(0x06377194), X(0x06452027),
605 X(0x0652dd2c), X(0x0660a8a2), X(0x066e8284), X(0x067c6ad1),
606 X(0x068a6186), X(0x069866a1), X(0x06a67a1e), X(0x06b49bfc),
607 X(0x06c2cc38), X(0x06d10acf), X(0x06df57bf), X(0x06edb304),
608 X(0x06fc1c9d), X(0x070a9487), X(0x07191abe), X(0x0727af40),
609 X(0x0736520b), X(0x0745031c), X(0x0753c270), X(0x07629004),
610 X(0x07716bd6), X(0x078055e2), X(0x078f4e26), X(0x079e549f),
611 X(0x07ad694b), X(0x07bc8c26), X(0x07cbbd2e), X(0x07dafc5f),
612 X(0x07ea49b7), X(0x07f9a533), X(0x08090ed1), X(0x0818868c),
613 X(0x08280c62), X(0x0837a051), X(0x08474255), X(0x0856f26b),
614 X(0x0866b091), X(0x08767cc3), X(0x088656fe), X(0x08963f3f),
615 X(0x08a63584), X(0x08b639c8), X(0x08c64c0a), X(0x08d66c45),
616 X(0x08e69a77), X(0x08f6d69d), X(0x090720b3), X(0x091778b7),
617 X(0x0927dea5), X(0x0938527a), X(0x0948d433), X(0x095963cc),
618 X(0x096a0143), X(0x097aac94), X(0x098b65bb), X(0x099c2cb6),
619 X(0x09ad0182), X(0x09bde41a), X(0x09ced47d), X(0x09dfd2a5),
620 X(0x09f0de90), X(0x0a01f83b), X(0x0a131fa3), X(0x0a2454c3),
621 X(0x0a359798), X(0x0a46e820), X(0x0a584656), X(0x0a69b237),
622 X(0x0a7b2bc0), X(0x0a8cb2ec), X(0x0a9e47ba), X(0x0aafea24),
623 X(0x0ac19a29), X(0x0ad357c3), X(0x0ae522ef), X(0x0af6fbab),
624 X(0x0b08e1f1), X(0x0b1ad5c0), X(0x0b2cd712), X(0x0b3ee5e5),
625 X(0x0b510234), X(0x0b632bfd), X(0x0b75633b), X(0x0b87a7eb),
626 X(0x0b99fa08), X(0x0bac5990), X(0x0bbec67e), X(0x0bd140cf),
627 X(0x0be3c87e), X(0x0bf65d89), X(0x0c08ffeb), X(0x0c1bafa1),
628 X(0x0c2e6ca6), X(0x0c4136f6), X(0x0c540e8f), X(0x0c66f36c),
629 X(0x0c79e588), X(0x0c8ce4e1), X(0x0c9ff172), X(0x0cb30b37),
630 X(0x0cc6322c), X(0x0cd9664d), X(0x0ceca797), X(0x0cfff605),
631 X(0x0d135193), X(0x0d26ba3d), X(0x0d3a2fff), X(0x0d4db2d5),
632 X(0x0d6142ba), X(0x0d74dfac), X(0x0d8889a5), X(0x0d9c40a1),
633 X(0x0db0049d), X(0x0dc3d593), X(0x0dd7b380), X(0x0deb9e60),
634 X(0x0dff962f), X(0x0e139ae7), X(0x0e27ac85), X(0x0e3bcb05),
635 X(0x0e4ff662), X(0x0e642e98), X(0x0e7873a2), X(0x0e8cc57d),
636 X(0x0ea12423), X(0x0eb58f91), X(0x0eca07c2), X(0x0ede8cb1),
637 X(0x0ef31e5b), X(0x0f07bcba), X(0x0f1c67cb), X(0x0f311f88),
638 X(0x0f45e3ee), X(0x0f5ab4f7), X(0x0f6f92a0), X(0x0f847ce3),
639 X(0x0f9973bc), X(0x0fae7726), X(0x0fc3871e), X(0x0fd8a39d),
640 X(0x0fedcca1), X(0x10030223), X(0x1018441f), X(0x102d9291),
641 X(0x1042ed74), X(0x105854c3), X(0x106dc879), X(0x10834892),
642 X(0x1098d508), X(0x10ae6dd8), X(0x10c412fc), X(0x10d9c46f),
643 X(0x10ef822d), X(0x11054c30), X(0x111b2274), X(0x113104f5),
644 X(0x1146f3ac), X(0x115cee95), X(0x1172f5ab), X(0x118908e9),
645 X(0x119f284a), X(0x11b553ca), X(0x11cb8b62), X(0x11e1cf0f),
646 X(0x11f81ecb), X(0x120e7a90), X(0x1224e25a), X(0x123b5624),
647 X(0x1251d5e9), X(0x126861a3), X(0x127ef94e), X(0x12959ce3),
648 X(0x12ac4c5f), X(0x12c307bb), X(0x12d9cef2), X(0x12f0a200),
649 X(0x130780df), X(0x131e6b8a), X(0x133561fa), X(0x134c642c),
650 X(0x1363721a), X(0x137a8bbe), X(0x1391b113), X(0x13a8e214),
651 X(0x13c01eba), X(0x13d76702), X(0x13eebae5), X(0x14061a5e),
652 X(0x141d8567), X(0x1434fbfb), X(0x144c7e14), X(0x14640bae),
653 X(0x147ba4c1), X(0x14934949), X(0x14aaf941), X(0x14c2b4a2),
654 X(0x14da7b67), X(0x14f24d8a), X(0x150a2b06), X(0x152213d5),
655 X(0x153a07f1), X(0x15520755), X(0x156a11fb), X(0x158227dd),
656 X(0x159a48f5), X(0x15b2753d), X(0x15caacb1), X(0x15e2ef49),
657 X(0x15fb3d01), X(0x161395d2), X(0x162bf9b6), X(0x164468a8),
658 X(0x165ce2a1), X(0x1675679c), X(0x168df793), X(0x16a69280),
659 X(0x16bf385c), X(0x16d7e922), X(0x16f0a4cc), X(0x17096b54),
660 X(0x17223cb4), X(0x173b18e5), X(0x1753ffe2), X(0x176cf1a5),
661 X(0x1785ee27), X(0x179ef562), X(0x17b80750), X(0x17d123eb),
662 X(0x17ea4b2d), X(0x18037d10), X(0x181cb98d), X(0x1836009e),
663 X(0x184f523c), X(0x1868ae63), X(0x1882150a), X(0x189b862c),
664 X(0x18b501c4), X(0x18ce87c9), X(0x18e81836), X(0x1901b305),
665 X(0x191b582f), X(0x193507ad), X(0x194ec17a), X(0x1968858f),
666 X(0x198253e5), X(0x199c2c75), X(0x19b60f3a), X(0x19cffc2d),
667 X(0x19e9f347), X(0x1a03f482), X(0x1a1dffd7), X(0x1a381540),
668 X(0x1a5234b5), X(0x1a6c5e31), X(0x1a8691ac), X(0x1aa0cf21),
669 X(0x1abb1687), X(0x1ad567da), X(0x1aefc311), X(0x1b0a2826),
670 X(0x1b249712), X(0x1b3f0fd0), X(0x1b599257), X(0x1b741ea1),
671 X(0x1b8eb4a7), X(0x1ba95462), X(0x1bc3fdcd), X(0x1bdeb0de),
672 X(0x1bf96d91), X(0x1c1433dd), X(0x1c2f03bc), X(0x1c49dd27),
673 X(0x1c64c017), X(0x1c7fac85), X(0x1c9aa269), X(0x1cb5a1be),
674 X(0x1cd0aa7c), X(0x1cebbc9c), X(0x1d06d816), X(0x1d21fce4),
675 X(0x1d3d2aff), X(0x1d586260), X(0x1d73a2fe), X(0x1d8eecd4),
676 X(0x1daa3fda), X(0x1dc59c09), X(0x1de1015a), X(0x1dfc6fc5),
677 X(0x1e17e743), X(0x1e3367cd), X(0x1e4ef15b), X(0x1e6a83e7),
678 X(0x1e861f6a), X(0x1ea1c3da), X(0x1ebd7133), X(0x1ed9276b),
679 X(0x1ef4e67c), X(0x1f10ae5e), X(0x1f2c7f0a), X(0x1f485879),
680 X(0x1f643aa2), X(0x1f80257f), X(0x1f9c1908), X(0x1fb81536),
681 X(0x1fd41a00), X(0x1ff02761), X(0x200c3d4f), X(0x20285bc3),
682 X(0x204482b7), X(0x2060b221), X(0x207ce9fb), X(0x20992a3e),
683 X(0x20b572e0), X(0x20d1c3dc), X(0x20ee1d28), X(0x210a7ebe),
684 X(0x2126e895), X(0x21435aa6), X(0x215fd4ea), X(0x217c5757),
685 X(0x2198e1e8), X(0x21b57493), X(0x21d20f51), X(0x21eeb21b),
686 X(0x220b5ce7), X(0x22280fb0), X(0x2244ca6c), X(0x22618d13),
687 X(0x227e579f), X(0x229b2a06), X(0x22b80442), X(0x22d4e649),
688 X(0x22f1d015), X(0x230ec19d), X(0x232bbad9), X(0x2348bbc1),
689 X(0x2365c44c), X(0x2382d474), X(0x239fec30), X(0x23bd0b78),
690 X(0x23da3244), X(0x23f7608b), X(0x24149646), X(0x2431d36c),
691 X(0x244f17f5), X(0x246c63da), X(0x2489b711), X(0x24a71193),
692 X(0x24c47358), X(0x24e1dc57), X(0x24ff4c88), X(0x251cc3e2),
693 X(0x253a425e), X(0x2557c7f4), X(0x2575549a), X(0x2592e848),
694 X(0x25b082f7), X(0x25ce249e), X(0x25ebcd34), X(0x26097cb2),
695 X(0x2627330e), X(0x2644f040), X(0x2662b441), X(0x26807f07),
696 X(0x269e5089), X(0x26bc28c1), X(0x26da07a4), X(0x26f7ed2b),
697 X(0x2715d94d), X(0x2733cc02), X(0x2751c540), X(0x276fc500),
698 X(0x278dcb39), X(0x27abd7e2), X(0x27c9eaf3), X(0x27e80463),
699 X(0x28062429), X(0x28244a3e), X(0x28427697), X(0x2860a92d),
700 X(0x287ee1f7), X(0x289d20eb), X(0x28bb6603), X(0x28d9b134),
701 X(0x28f80275), X(0x291659c0), X(0x2934b709), X(0x29531a49),
702 X(0x29718378), X(0x298ff28b), X(0x29ae677b), X(0x29cce23e),
703 X(0x29eb62cb), X(0x2a09e91b), X(0x2a287523), X(0x2a4706dc),
704 X(0x2a659e3c), X(0x2a843b39), X(0x2aa2ddcd), X(0x2ac185ec),
705 X(0x2ae0338f), X(0x2afee6ad), X(0x2b1d9f3c), X(0x2b3c5d33),
706 X(0x2b5b208b), X(0x2b79e939), X(0x2b98b734), X(0x2bb78a74),
707 X(0x2bd662ef), X(0x2bf5409d), X(0x2c142374), X(0x2c330b6b),
708 X(0x2c51f87a), X(0x2c70ea97), X(0x2c8fe1b9), X(0x2caeddd6),
709 X(0x2ccddee7), X(0x2cece4e1), X(0x2d0befbb), X(0x2d2aff6d),
710 X(0x2d4a13ec), X(0x2d692d31), X(0x2d884b32), X(0x2da76de4),
711 X(0x2dc69540), X(0x2de5c13d), X(0x2e04f1d0), X(0x2e2426f0),
712 X(0x2e436095), X(0x2e629eb4), X(0x2e81e146), X(0x2ea1283f),
713 X(0x2ec07398), X(0x2edfc347), X(0x2eff1742), X(0x2f1e6f80),
714 X(0x2f3dcbf8), X(0x2f5d2ca0), X(0x2f7c916f), X(0x2f9bfa5c),
715 X(0x2fbb675d), X(0x2fdad869), X(0x2ffa4d76), X(0x3019c67b),
716 X(0x3039436f), X(0x3058c448), X(0x307848fc), X(0x3097d183),
717 X(0x30b75dd3), X(0x30d6ede2), X(0x30f681a6), X(0x31161917),
718 X(0x3135b42b), X(0x315552d8), X(0x3174f514), X(0x31949ad7),
719 X(0x31b44417), X(0x31d3f0ca), X(0x31f3a0e6), X(0x32135462),
720 X(0x32330b35), X(0x3252c555), X(0x327282b7), X(0x32924354),
721 X(0x32b20720), X(0x32d1ce13), X(0x32f19823), X(0x33116546),
722 X(0x33313573), X(0x3351089f), X(0x3370dec2), X(0x3390b7d1),
723 X(0x33b093c3), X(0x33d0728f), X(0x33f05429), X(0x3410388a),
724 X(0x34301fa7), X(0x34500977), X(0x346ff5ef), X(0x348fe506),
725 X(0x34afd6b3), X(0x34cfcaeb), X(0x34efc1a5), X(0x350fbad7),
726 X(0x352fb678), X(0x354fb47d), X(0x356fb4dd), X(0x358fb78e),
727 X(0x35afbc86), X(0x35cfc3bc), X(0x35efcd25), X(0x360fd8b8),
728 X(0x362fe66c), X(0x364ff636), X(0x3670080c), X(0x36901be5),
729 X(0x36b031b7), X(0x36d04978), X(0x36f0631e), X(0x37107ea0),
730 X(0x37309bf3), X(0x3750bb0e), X(0x3770dbe6), X(0x3790fe73),
731 X(0x37b122aa), X(0x37d14881), X(0x37f16fee), X(0x381198e8),
732 X(0x3831c365), X(0x3851ef5a), X(0x38721cbe), X(0x38924b87),
733 X(0x38b27bac), X(0x38d2ad21), X(0x38f2dfde), X(0x391313d8),
734 X(0x39334906), X(0x39537f5d), X(0x3973b6d4), X(0x3993ef60),
735 X(0x39b428f9), X(0x39d46393), X(0x39f49f25), X(0x3a14dba6),
736 X(0x3a35190a), X(0x3a555748), X(0x3a759657), X(0x3a95d62c),
737 X(0x3ab616be), X(0x3ad65801), X(0x3af699ed), X(0x3b16dc78),
738 X(0x3b371f97), X(0x3b576341), X(0x3b77a76c), X(0x3b97ec0d),
739 X(0x3bb8311b), X(0x3bd8768b), X(0x3bf8bc55), X(0x3c19026d),
740 X(0x3c3948ca), X(0x3c598f62), X(0x3c79d62b), X(0x3c9a1d1b),
741 X(0x3cba6428), X(0x3cdaab48), X(0x3cfaf271), X(0x3d1b3999),
742 X(0x3d3b80b6), X(0x3d5bc7be), X(0x3d7c0ea8), X(0x3d9c5569),
743 X(0x3dbc9bf7), X(0x3ddce248), X(0x3dfd2852), X(0x3e1d6e0c),
744 X(0x3e3db36c), X(0x3e5df866), X(0x3e7e3cf2), X(0x3e9e8106),
745 X(0x3ebec497), X(0x3edf079b), X(0x3eff4a09), X(0x3f1f8bd7),
746 X(0x3f3fccfa), X(0x3f600d69), X(0x3f804d1a), X(0x3fa08c02),
747 X(0x3fc0ca19), X(0x3fe10753), X(0x400143a7), X(0x40217f0a),
748 X(0x4041b974), X(0x4061f2da), X(0x40822b32), X(0x40a26272),
749 X(0x40c29891), X(0x40e2cd83), X(0x41030140), X(0x412333bd),
750 X(0x414364f1), X(0x416394d2), X(0x4183c355), X(0x41a3f070),
751 X(0x41c41c1b), X(0x41e4464a), X(0x42046ef4), X(0x42249610),
752 X(0x4244bb92), X(0x4264df72), X(0x428501a5), X(0x42a52222),
753 X(0x42c540de), X(0x42e55dd0), X(0x430578ed), X(0x4325922d),
754 X(0x4345a985), X(0x4365beeb), X(0x4385d255), X(0x43a5e3ba),
755 X(0x43c5f30f), X(0x43e6004b), X(0x44060b65), X(0x44261451),
756 X(0x44461b07), X(0x44661f7c), X(0x448621a7), X(0x44a6217d),
757 X(0x44c61ef6), X(0x44e61a07), X(0x450612a6), X(0x452608ca),
758 X(0x4545fc69), X(0x4565ed79), X(0x4585dbf1), X(0x45a5c7c6),
759 X(0x45c5b0ef), X(0x45e59761), X(0x46057b15), X(0x46255bfe),
760 X(0x46453a15), X(0x4665154f), X(0x4684eda2), X(0x46a4c305),
761 X(0x46c4956e), X(0x46e464d3), X(0x4704312b), X(0x4723fa6c),
762 X(0x4743c08d), X(0x47638382), X(0x47834344), X(0x47a2ffc9),
763 X(0x47c2b906), X(0x47e26ef2), X(0x48022183), X(0x4821d0b1),
764 X(0x48417c71), X(0x486124b9), X(0x4880c981), X(0x48a06abe),
765 X(0x48c00867), X(0x48dfa272), X(0x48ff38d6), X(0x491ecb8a),
766 X(0x493e5a84), X(0x495de5b9), X(0x497d6d22), X(0x499cf0b4),
767 X(0x49bc7066), X(0x49dbec2e), X(0x49fb6402), X(0x4a1ad7db),
768 X(0x4a3a47ad), X(0x4a59b370), X(0x4a791b1a), X(0x4a987ea1),
769 X(0x4ab7ddfd), X(0x4ad73924), X(0x4af6900c), X(0x4b15e2ad),
770 X(0x4b3530fc), X(0x4b547af1), X(0x4b73c082), X(0x4b9301a6),
771 X(0x4bb23e53), X(0x4bd17681), X(0x4bf0aa25), X(0x4c0fd937),
772 X(0x4c2f03ae), X(0x4c4e297f), X(0x4c6d4aa3), X(0x4c8c670f),
773 X(0x4cab7eba), X(0x4cca919c), X(0x4ce99fab), X(0x4d08a8de),
774 X(0x4d27ad2c), X(0x4d46ac8b), X(0x4d65a6f3), X(0x4d849c5a),
775 X(0x4da38cb7), X(0x4dc27802), X(0x4de15e31), X(0x4e003f3a),
776 X(0x4e1f1b16), X(0x4e3df1ba), X(0x4e5cc31e), X(0x4e7b8f3a),
777 X(0x4e9a5603), X(0x4eb91771), X(0x4ed7d37b), X(0x4ef68a18),
778 X(0x4f153b3f), X(0x4f33e6e7), X(0x4f528d08), X(0x4f712d97),
779 X(0x4f8fc88e), X(0x4fae5de1), X(0x4fcced8a), X(0x4feb777f),
780 X(0x5009fbb6), X(0x50287a28), X(0x5046f2cc), X(0x50656598),
781 X(0x5083d284), X(0x50a23988), X(0x50c09a9a), X(0x50def5b1),
782 X(0x50fd4ac7), X(0x511b99d0), X(0x5139e2c5), X(0x5158259e),
783 X(0x51766251), X(0x519498d6), X(0x51b2c925), X(0x51d0f334),
784 X(0x51ef16fb), X(0x520d3473), X(0x522b4b91), X(0x52495c4e),
785 X(0x526766a2), X(0x52856a83), X(0x52a367e9), X(0x52c15ecd),
786 X(0x52df4f24), X(0x52fd38e8), X(0x531b1c10), X(0x5338f892),
787 X(0x5356ce68), X(0x53749d89), X(0x539265eb), X(0x53b02788),
788 X(0x53cde257), X(0x53eb964f), X(0x54094369), X(0x5426e99c),
789 X(0x544488df), X(0x5462212c), X(0x547fb279), X(0x549d3cbe),
790 X(0x54babff4), X(0x54d83c12), X(0x54f5b110), X(0x55131ee7),
791 X(0x5530858d), X(0x554de4fc), X(0x556b3d2a), X(0x55888e11),
792 X(0x55a5d7a8), X(0x55c319e7), X(0x55e054c7), X(0x55fd883f),
793 X(0x561ab447), X(0x5637d8d8), X(0x5654f5ea), X(0x56720b75),
794 X(0x568f1971), X(0x56ac1fd7), X(0x56c91e9e), X(0x56e615c0),
795 X(0x57030534), X(0x571fecf2), X(0x573cccf3), X(0x5759a530),
796 X(0x577675a0), X(0x57933e3c), X(0x57affefd), X(0x57ccb7db),
797 X(0x57e968ce), X(0x580611cf), X(0x5822b2d6), X(0x583f4bdd),
798 X(0x585bdcdb), X(0x587865c9), X(0x5894e69f), X(0x58b15f57),
799 X(0x58cdcfe9), X(0x58ea384e), X(0x5906987d), X(0x5922f071),
800 X(0x593f4022), X(0x595b8788), X(0x5977c69c), X(0x5993fd57),
801 X(0x59b02bb2), X(0x59cc51a6), X(0x59e86f2c), X(0x5a04843c),
802 X(0x5a2090d0), X(0x5a3c94e0), X(0x5a589065), X(0x5a748359),
803 X(0x5a906db4), X(0x5aac4f70), X(0x5ac82884), X(0x5ae3f8ec),
804 X(0x5affc09f), X(0x5b1b7f97), X(0x5b3735cd), X(0x5b52e33a),
805 X(0x5b6e87d8), X(0x5b8a239f), X(0x5ba5b689), X(0x5bc1408f),
806 X(0x5bdcc1aa), X(0x5bf839d5), X(0x5c13a907), X(0x5c2f0f3b),
807 X(0x5c4a6c6a), X(0x5c65c08d), X(0x5c810b9e), X(0x5c9c4d97),
808 X(0x5cb78670), X(0x5cd2b623), X(0x5ceddcaa), X(0x5d08f9ff),
809 X(0x5d240e1b), X(0x5d3f18f8), X(0x5d5a1a8f), X(0x5d7512da),
810 X(0x5d9001d3), X(0x5daae773), X(0x5dc5c3b5), X(0x5de09692),
811 X(0x5dfb6004), X(0x5e162004), X(0x5e30d68d), X(0x5e4b8399),
812 X(0x5e662721), X(0x5e80c11f), X(0x5e9b518e), X(0x5eb5d867),
813 X(0x5ed055a4), X(0x5eeac940), X(0x5f053334), X(0x5f1f937b),
814 X(0x5f39ea0f), X(0x5f5436ea), X(0x5f6e7a06), X(0x5f88b35d),
815 X(0x5fa2e2e9), X(0x5fbd08a6), X(0x5fd7248d), X(0x5ff13698),
816 X(0x600b3ec2), X(0x60253d05), X(0x603f315b), X(0x60591bc0),
817 X(0x6072fc2d), X(0x608cd29e), X(0x60a69f0b), X(0x60c06171),
818 X(0x60da19ca), X(0x60f3c80f), X(0x610d6c3d), X(0x6127064d),
819 X(0x6140963a), X(0x615a1bff), X(0x61739797), X(0x618d08fc),
820 X(0x61a67029), X(0x61bfcd1a), X(0x61d91fc8), X(0x61f2682f),
821 X(0x620ba64a), X(0x6224da13), X(0x623e0386), X(0x6257229d),
822 X(0x62703754), X(0x628941a6), X(0x62a2418e), X(0x62bb3706),
823 X(0x62d4220a), X(0x62ed0296), X(0x6305d8a3), X(0x631ea42f),
824 X(0x63376533), X(0x63501bab), X(0x6368c793), X(0x638168e5),
825 X(0x6399ff9e), X(0x63b28bb8), X(0x63cb0d2f), X(0x63e383ff),
826 X(0x63fbf022), X(0x64145195), X(0x642ca853), X(0x6444f457),
827 X(0x645d359e), X(0x64756c22), X(0x648d97e0), X(0x64a5b8d3),
828 X(0x64bdcef6), X(0x64d5da47), X(0x64eddabf), X(0x6505d05c),
829 X(0x651dbb19), X(0x65359af2), X(0x654d6fe3), X(0x656539e7),
830 X(0x657cf8fb), X(0x6594ad1b), X(0x65ac5643), X(0x65c3f46e),
831 X(0x65db8799), X(0x65f30fc0), X(0x660a8ce0), X(0x6621fef3),
832 X(0x663965f7), X(0x6650c1e7), X(0x666812c1), X(0x667f5880),
833 X(0x66969320), X(0x66adc29e), X(0x66c4e6f7), X(0x66dc0026),
834 X(0x66f30e28), X(0x670a10fa), X(0x67210898), X(0x6737f4ff),
835 X(0x674ed62b), X(0x6765ac19), X(0x677c76c5), X(0x6793362c),
836 X(0x67a9ea4b), X(0x67c0931f), X(0x67d730a3), X(0x67edc2d6),
837 X(0x680449b3), X(0x681ac538), X(0x68313562), X(0x68479a2d),
838 X(0x685df396), X(0x6874419b), X(0x688a8438), X(0x68a0bb6a),
839 X(0x68b6e72e), X(0x68cd0782), X(0x68e31c63), X(0x68f925cd),
840 X(0x690f23be), X(0x69251633), X(0x693afd29), X(0x6950d89e),
841 X(0x6966a88f), X(0x697c6cf8), X(0x699225d9), X(0x69a7d32d),
842 X(0x69bd74f3), X(0x69d30b27), X(0x69e895c8), X(0x69fe14d2),
843 X(0x6a138844), X(0x6a28f01b), X(0x6a3e4c54), X(0x6a539ced),
844 X(0x6a68e1e4), X(0x6a7e1b37), X(0x6a9348e3), X(0x6aa86ae6),
845 X(0x6abd813d), X(0x6ad28be7), X(0x6ae78ae2), X(0x6afc7e2b),
846 X(0x6b1165c0), X(0x6b26419f), X(0x6b3b11c7), X(0x6b4fd634),
847 X(0x6b648ee6), X(0x6b793bda), X(0x6b8ddd0e), X(0x6ba27281),
848 X(0x6bb6fc31), X(0x6bcb7a1b), X(0x6bdfec3e), X(0x6bf45299),
849 X(0x6c08ad29), X(0x6c1cfbed), X(0x6c313ee4), X(0x6c45760a),
850 X(0x6c59a160), X(0x6c6dc0e4), X(0x6c81d493), X(0x6c95dc6d),
851 X(0x6ca9d86f), X(0x6cbdc899), X(0x6cd1acea), X(0x6ce5855f),
852 X(0x6cf951f7), X(0x6d0d12b1), X(0x6d20c78c), X(0x6d347087),
853 X(0x6d480da0), X(0x6d5b9ed6), X(0x6d6f2427), X(0x6d829d94),
854 X(0x6d960b1a), X(0x6da96cb9), X(0x6dbcc270), X(0x6dd00c3c),
855 X(0x6de34a1f), X(0x6df67c16), X(0x6e09a221), X(0x6e1cbc3f),
856 X(0x6e2fca6e), X(0x6e42ccaf), X(0x6e55c300), X(0x6e68ad60),
857 X(0x6e7b8bd0), X(0x6e8e5e4d), X(0x6ea124d8), X(0x6eb3df70),
858 X(0x6ec68e13), X(0x6ed930c3), X(0x6eebc77d), X(0x6efe5242),
859 X(0x6f10d111), X(0x6f2343e9), X(0x6f35aacb), X(0x6f4805b5),
860 X(0x6f5a54a8), X(0x6f6c97a2), X(0x6f7ecea4), X(0x6f90f9ae),
861 X(0x6fa318be), X(0x6fb52bd6), X(0x6fc732f4), X(0x6fd92e19),
862 X(0x6feb1d44), X(0x6ffd0076), X(0x700ed7ad), X(0x7020a2eb),
863 X(0x7032622f), X(0x7044157a), X(0x7055bcca), X(0x70675821),
864 X(0x7078e77e), X(0x708a6ae2), X(0x709be24c), X(0x70ad4dbd),
865 X(0x70bead36), X(0x70d000b5), X(0x70e1483d), X(0x70f283cc),
866 X(0x7103b363), X(0x7114d704), X(0x7125eead), X(0x7136fa60),
867 X(0x7147fa1c), X(0x7158ede4), X(0x7169d5b6), X(0x717ab193),
868 X(0x718b817d), X(0x719c4573), X(0x71acfd76), X(0x71bda988),
869 X(0x71ce49a8), X(0x71deddd7), X(0x71ef6617), X(0x71ffe267),
870 X(0x721052ca), X(0x7220b73e), X(0x72310fc6), X(0x72415c62),
871 X(0x72519d14), X(0x7261d1db), X(0x7271faba), X(0x728217b1),
872 X(0x729228c0), X(0x72a22dea), X(0x72b22730), X(0x72c21491),
873 X(0x72d1f611), X(0x72e1cbaf), X(0x72f1956c), X(0x7301534c),
874 X(0x7311054d), X(0x7320ab72), X(0x733045bc), X(0x733fd42d),
875 X(0x734f56c5), X(0x735ecd86), X(0x736e3872), X(0x737d9789),
876 X(0x738ceacf), X(0x739c3243), X(0x73ab6de7), X(0x73ba9dbe),
877 X(0x73c9c1c8), X(0x73d8da08), X(0x73e7e67f), X(0x73f6e72e),
878 X(0x7405dc17), X(0x7414c53c), X(0x7423a29f), X(0x74327442),
879 X(0x74413a26), X(0x744ff44d), X(0x745ea2b9), X(0x746d456c),
880 X(0x747bdc68), X(0x748a67ae), X(0x7498e741), X(0x74a75b23),
881 X(0x74b5c356), X(0x74c41fdb), X(0x74d270b6), X(0x74e0b5e7),
882 X(0x74eeef71), X(0x74fd1d57), X(0x750b3f9a), X(0x7519563c),
883 X(0x75276140), X(0x753560a8), X(0x75435477), X(0x75513cae),
884 X(0x755f1951), X(0x756cea60), X(0x757aafdf), X(0x758869d1),
885 X(0x75961837), X(0x75a3bb14), X(0x75b1526a), X(0x75bede3c),
886 X(0x75cc5e8d), X(0x75d9d35f), X(0x75e73cb5), X(0x75f49a91),
887 X(0x7601ecf6), X(0x760f33e6), X(0x761c6f65), X(0x76299f74),
888 X(0x7636c417), X(0x7643dd51), X(0x7650eb24), X(0x765ded93),
889 X(0x766ae4a0), X(0x7677d050), X(0x7684b0a4), X(0x7691859f),
890 X(0x769e4f45), X(0x76ab0d98), X(0x76b7c09c), X(0x76c46852),
891 X(0x76d104bf), X(0x76dd95e6), X(0x76ea1bc9), X(0x76f6966b),
892 X(0x770305d0), X(0x770f69fb), X(0x771bc2ef), X(0x772810af),
893 X(0x7734533e), X(0x77408aa0), X(0x774cb6d7), X(0x7758d7e8),
894 X(0x7764edd5), X(0x7770f8a2), X(0x777cf852), X(0x7788ece8),
895 X(0x7794d668), X(0x77a0b4d5), X(0x77ac8833), X(0x77b85085),
896 X(0x77c40dce), X(0x77cfc013), X(0x77db6756), X(0x77e7039b),
897 X(0x77f294e6), X(0x77fe1b3b), X(0x7809969c), X(0x7815070e),
898 X(0x78206c93), X(0x782bc731), X(0x783716ea), X(0x78425bc3),
899 X(0x784d95be), X(0x7858c4e1), X(0x7863e92d), X(0x786f02a8),
900 X(0x787a1156), X(0x78851539), X(0x78900e56), X(0x789afcb1),
901 X(0x78a5e04d), X(0x78b0b92f), X(0x78bb875b), X(0x78c64ad4),
902 X(0x78d1039e), X(0x78dbb1be), X(0x78e65537), X(0x78f0ee0e),
903 X(0x78fb7c46), X(0x7905ffe4), X(0x791078ec), X(0x791ae762),
904 X(0x79254b4a), X(0x792fa4a7), X(0x7939f380), X(0x794437d7),
905 X(0x794e71b0), X(0x7958a111), X(0x7962c5fd), X(0x796ce078),
906 X(0x7976f087), X(0x7980f62f), X(0x798af173), X(0x7994e258),
907 X(0x799ec8e2), X(0x79a8a515), X(0x79b276f7), X(0x79bc3e8b),
908 X(0x79c5fbd6), X(0x79cfaedc), X(0x79d957a2), X(0x79e2f62c),
909 X(0x79ec8a7f), X(0x79f6149f), X(0x79ff9492), X(0x7a090a5a),
910 X(0x7a1275fe), X(0x7a1bd781), X(0x7a252ee9), X(0x7a2e7c39),
911 X(0x7a37bf77), X(0x7a40f8a7), X(0x7a4a27ce), X(0x7a534cf0),
912 X(0x7a5c6813), X(0x7a65793b), X(0x7a6e806d), X(0x7a777dad),
913 X(0x7a807100), X(0x7a895a6b), X(0x7a9239f4), X(0x7a9b0f9e),
914 X(0x7aa3db6f), X(0x7aac9d6b), X(0x7ab55597), X(0x7abe03f9),
915 X(0x7ac6a895), X(0x7acf4370), X(0x7ad7d48f), X(0x7ae05bf6),
916 X(0x7ae8d9ac), X(0x7af14db5), X(0x7af9b815), X(0x7b0218d2),
917 X(0x7b0a6ff2), X(0x7b12bd78), X(0x7b1b016a), X(0x7b233bce),
918 X(0x7b2b6ca7), X(0x7b3393fc), X(0x7b3bb1d1), X(0x7b43c62c),
919 X(0x7b4bd111), X(0x7b53d286), X(0x7b5bca90), X(0x7b63b935),
920 X(0x7b6b9e78), X(0x7b737a61), X(0x7b7b4cf3), X(0x7b831634),
921 X(0x7b8ad629), X(0x7b928cd8), X(0x7b9a3a45), X(0x7ba1de77),
922 X(0x7ba97972), X(0x7bb10b3c), X(0x7bb893d9), X(0x7bc01350),
923 X(0x7bc789a6), X(0x7bcef6e0), X(0x7bd65b03), X(0x7bddb616),
924 X(0x7be5081c), X(0x7bec511c), X(0x7bf3911b), X(0x7bfac81f),
925 X(0x7c01f62c), X(0x7c091b49), X(0x7c10377b), X(0x7c174ac7),
926 X(0x7c1e5532), X(0x7c2556c4), X(0x7c2c4f80), X(0x7c333f6c),
927 X(0x7c3a268e), X(0x7c4104ec), X(0x7c47da8a), X(0x7c4ea76f),
928 X(0x7c556ba1), X(0x7c5c2724), X(0x7c62d9fe), X(0x7c698435),
929 X(0x7c7025cf), X(0x7c76bed0), X(0x7c7d4f40), X(0x7c83d723),
930 X(0x7c8a567f), X(0x7c90cd5a), X(0x7c973bb9), X(0x7c9da1a2),
931 X(0x7ca3ff1b), X(0x7caa542a), X(0x7cb0a0d3), X(0x7cb6e51e),
932 X(0x7cbd210f), X(0x7cc354ac), X(0x7cc97ffc), X(0x7ccfa304),
933 X(0x7cd5bdc9), X(0x7cdbd051), X(0x7ce1daa3), X(0x7ce7dcc3),
934 X(0x7cedd6b8), X(0x7cf3c888), X(0x7cf9b238), X(0x7cff93cf),
935 X(0x7d056d51), X(0x7d0b3ec5), X(0x7d110830), X(0x7d16c99a),
936 X(0x7d1c8306), X(0x7d22347c), X(0x7d27de00), X(0x7d2d7f9a),
937 X(0x7d33194f), X(0x7d38ab24), X(0x7d3e351f), X(0x7d43b748),
938 X(0x7d4931a2), X(0x7d4ea435), X(0x7d540f06), X(0x7d59721b),
939 X(0x7d5ecd7b), X(0x7d64212a), X(0x7d696d2f), X(0x7d6eb190),
940 X(0x7d73ee53), X(0x7d79237e), X(0x7d7e5117), X(0x7d837723),
941 X(0x7d8895a9), X(0x7d8dacae), X(0x7d92bc3a), X(0x7d97c451),
942 X(0x7d9cc4f9), X(0x7da1be39), X(0x7da6b017), X(0x7dab9a99),
943 X(0x7db07dc4), X(0x7db5599e), X(0x7dba2e2f), X(0x7dbefb7b),
944 X(0x7dc3c189), X(0x7dc8805e), X(0x7dcd3802), X(0x7dd1e879),
945 X(0x7dd691ca), X(0x7ddb33fb), X(0x7ddfcf12), X(0x7de46315),
946 X(0x7de8f00a), X(0x7ded75f8), X(0x7df1f4e3), X(0x7df66cd3),
947 X(0x7dfaddcd), X(0x7dff47d7), X(0x7e03aaf8), X(0x7e080735),
948 X(0x7e0c5c95), X(0x7e10ab1e), X(0x7e14f2d5), X(0x7e1933c1),
949 X(0x7e1d6de8), X(0x7e21a150), X(0x7e25cdff), X(0x7e29f3fc),
950 X(0x7e2e134c), X(0x7e322bf5), X(0x7e363dfd), X(0x7e3a496b),
951 X(0x7e3e4e45), X(0x7e424c90), X(0x7e464454), X(0x7e4a3595),
952 X(0x7e4e205a), X(0x7e5204aa), X(0x7e55e289), X(0x7e59b9ff),
953 X(0x7e5d8b12), X(0x7e6155c7), X(0x7e651a24), X(0x7e68d831),
954 X(0x7e6c8ff2), X(0x7e70416e), X(0x7e73ecac), X(0x7e7791b0),
955 X(0x7e7b3082), X(0x7e7ec927), X(0x7e825ba6), X(0x7e85e804),
956 X(0x7e896e48), X(0x7e8cee77), X(0x7e906899), X(0x7e93dcb2),
957 X(0x7e974aca), X(0x7e9ab2e5), X(0x7e9e150b), X(0x7ea17141),
958 X(0x7ea4c78e), X(0x7ea817f7), X(0x7eab6283), X(0x7eaea737),
959 X(0x7eb1e61a), X(0x7eb51f33), X(0x7eb85285), X(0x7ebb8019),
960 X(0x7ebea7f4), X(0x7ec1ca1d), X(0x7ec4e698), X(0x7ec7fd6d),
961 X(0x7ecb0ea1), X(0x7ece1a3a), X(0x7ed1203f), X(0x7ed420b6),
962 X(0x7ed71ba4), X(0x7eda110f), X(0x7edd00ff), X(0x7edfeb78),
963 X(0x7ee2d081), X(0x7ee5b01f), X(0x7ee88a5a), X(0x7eeb5f36),
964 X(0x7eee2eba), X(0x7ef0f8ed), X(0x7ef3bdd3), X(0x7ef67d73),
965 X(0x7ef937d3), X(0x7efbecf9), X(0x7efe9ceb), X(0x7f0147ae),
966 X(0x7f03ed4a), X(0x7f068dc4), X(0x7f092922), X(0x7f0bbf69),
967 X(0x7f0e50a1), X(0x7f10dcce), X(0x7f1363f7), X(0x7f15e622),
968 X(0x7f186355), X(0x7f1adb95), X(0x7f1d4ee9), X(0x7f1fbd57),
969 X(0x7f2226e4), X(0x7f248b96), X(0x7f26eb74), X(0x7f294683),
970 X(0x7f2b9cc9), X(0x7f2dee4d), X(0x7f303b13), X(0x7f328322),
971 X(0x7f34c680), X(0x7f370533), X(0x7f393f40), X(0x7f3b74ad),
972 X(0x7f3da581), X(0x7f3fd1c1), X(0x7f41f972), X(0x7f441c9c),
973 X(0x7f463b43), X(0x7f48556d), X(0x7f4a6b21), X(0x7f4c7c64),
974 X(0x7f4e893c), X(0x7f5091ae), X(0x7f5295c1), X(0x7f54957a),
975 X(0x7f5690e0), X(0x7f5887f7), X(0x7f5a7ac5), X(0x7f5c6951),
976 X(0x7f5e53a0), X(0x7f6039b8), X(0x7f621b9e), X(0x7f63f958),
977 X(0x7f65d2ed), X(0x7f67a861), X(0x7f6979ba), X(0x7f6b46ff),
978 X(0x7f6d1034), X(0x7f6ed560), X(0x7f709687), X(0x7f7253b1),
979 X(0x7f740ce1), X(0x7f75c21f), X(0x7f777370), X(0x7f7920d8),
980 X(0x7f7aca5f), X(0x7f7c7008), X(0x7f7e11db), X(0x7f7fafdd),
981 X(0x7f814a13), X(0x7f82e082), X(0x7f847331), X(0x7f860224),
982 X(0x7f878d62), X(0x7f8914f0), X(0x7f8a98d4), X(0x7f8c1912),
983 X(0x7f8d95b0), X(0x7f8f0eb5), X(0x7f908425), X(0x7f91f605),
984 X(0x7f93645c), X(0x7f94cf2f), X(0x7f963683), X(0x7f979a5d),
985 X(0x7f98fac4), X(0x7f9a57bb), X(0x7f9bb14a), X(0x7f9d0775),
986 X(0x7f9e5a41), X(0x7f9fa9b4), X(0x7fa0f5d3), X(0x7fa23ea4),
987 X(0x7fa3842b), X(0x7fa4c66f), X(0x7fa60575), X(0x7fa74141),
988 X(0x7fa879d9), X(0x7fa9af42), X(0x7faae182), X(0x7fac109e),
989 X(0x7fad3c9a), X(0x7fae657d), X(0x7faf8b4c), X(0x7fb0ae0b),
990 X(0x7fb1cdc0), X(0x7fb2ea70), X(0x7fb40420), X(0x7fb51ad5),
991 X(0x7fb62e95), X(0x7fb73f64), X(0x7fb84d48), X(0x7fb95846),
992 X(0x7fba6062), X(0x7fbb65a2), X(0x7fbc680c), X(0x7fbd67a3),
993 X(0x7fbe646d), X(0x7fbf5e70), X(0x7fc055af), X(0x7fc14a31),
994 X(0x7fc23bf9), X(0x7fc32b0d), X(0x7fc41773), X(0x7fc5012e),
995 X(0x7fc5e844), X(0x7fc6ccba), X(0x7fc7ae94), X(0x7fc88dd8),
996 X(0x7fc96a8a), X(0x7fca44af), X(0x7fcb1c4c), X(0x7fcbf167),
997 X(0x7fccc403), X(0x7fcd9425), X(0x7fce61d3), X(0x7fcf2d11),
998 X(0x7fcff5e3), X(0x7fd0bc4f), X(0x7fd1805a), X(0x7fd24207),
999 X(0x7fd3015c), X(0x7fd3be5d), X(0x7fd47910), X(0x7fd53178),
1000 X(0x7fd5e79b), X(0x7fd69b7c), X(0x7fd74d21), X(0x7fd7fc8e),
1001 X(0x7fd8a9c8), X(0x7fd954d4), X(0x7fd9fdb5), X(0x7fdaa471),
1002 X(0x7fdb490b), X(0x7fdbeb89), X(0x7fdc8bef), X(0x7fdd2a42),
1003 X(0x7fddc685), X(0x7fde60be), X(0x7fdef8f0), X(0x7fdf8f20),
1004 X(0x7fe02353), X(0x7fe0b58d), X(0x7fe145d3), X(0x7fe1d428),
1005 X(0x7fe26091), X(0x7fe2eb12), X(0x7fe373b0), X(0x7fe3fa6f),
1006 X(0x7fe47f53), X(0x7fe50260), X(0x7fe5839b), X(0x7fe60308),
1007 X(0x7fe680ab), X(0x7fe6fc88), X(0x7fe776a4), X(0x7fe7ef02),
1008 X(0x7fe865a7), X(0x7fe8da97), X(0x7fe94dd6), X(0x7fe9bf68),
1009 X(0x7fea2f51), X(0x7fea9d95), X(0x7feb0a39), X(0x7feb7540),
1010 X(0x7febdeae), X(0x7fec4687), X(0x7fecaccf), X(0x7fed118b),
1011 X(0x7fed74be), X(0x7fedd66c), X(0x7fee3698), X(0x7fee9548),
1012 X(0x7feef27e), X(0x7fef4e3f), X(0x7fefa88e), X(0x7ff0016f),
1013 X(0x7ff058e7), X(0x7ff0aef8), X(0x7ff103a6), X(0x7ff156f6),
1014 X(0x7ff1a8eb), X(0x7ff1f988), X(0x7ff248d2), X(0x7ff296cc),
1015 X(0x7ff2e37a), X(0x7ff32edf), X(0x7ff378ff), X(0x7ff3c1de),
1016 X(0x7ff4097e), X(0x7ff44fe5), X(0x7ff49515), X(0x7ff4d911),
1017 X(0x7ff51bde), X(0x7ff55d7f), X(0x7ff59df7), X(0x7ff5dd4a),
1018 X(0x7ff61b7b), X(0x7ff6588d), X(0x7ff69485), X(0x7ff6cf65),
1019 X(0x7ff70930), X(0x7ff741eb), X(0x7ff77998), X(0x7ff7b03b),
1020 X(0x7ff7e5d7), X(0x7ff81a6f), X(0x7ff84e06), X(0x7ff880a1),
1021 X(0x7ff8b241), X(0x7ff8e2ea), X(0x7ff912a0), X(0x7ff94165),
1022 X(0x7ff96f3d), X(0x7ff99c2b), X(0x7ff9c831), X(0x7ff9f354),
1023 X(0x7ffa1d95), X(0x7ffa46f9), X(0x7ffa6f81), X(0x7ffa9731),
1024 X(0x7ffabe0d), X(0x7ffae416), X(0x7ffb0951), X(0x7ffb2dbf),
1025 X(0x7ffb5164), X(0x7ffb7442), X(0x7ffb965d), X(0x7ffbb7b8),
1026 X(0x7ffbd854), X(0x7ffbf836), X(0x7ffc175f), X(0x7ffc35d3),
1027 X(0x7ffc5394), X(0x7ffc70a5), X(0x7ffc8d09), X(0x7ffca8c2),
1028 X(0x7ffcc3d4), X(0x7ffcde3f), X(0x7ffcf809), X(0x7ffd1132),
1029 X(0x7ffd29be), X(0x7ffd41ae), X(0x7ffd5907), X(0x7ffd6fc9),
1030 X(0x7ffd85f9), X(0x7ffd9b97), X(0x7ffdb0a7), X(0x7ffdc52b),
1031 X(0x7ffdd926), X(0x7ffdec99), X(0x7ffdff88), X(0x7ffe11f4),
1032 X(0x7ffe23e0), X(0x7ffe354f), X(0x7ffe4642), X(0x7ffe56bc),
1033 X(0x7ffe66bf), X(0x7ffe764e), X(0x7ffe856a), X(0x7ffe9416),
1034 X(0x7ffea254), X(0x7ffeb026), X(0x7ffebd8e), X(0x7ffeca8f),
1035 X(0x7ffed72a), X(0x7ffee362), X(0x7ffeef38), X(0x7ffefaaf),
1036 X(0x7fff05c9), X(0x7fff1087), X(0x7fff1aec), X(0x7fff24f9),
1037 X(0x7fff2eb1), X(0x7fff3816), X(0x7fff4128), X(0x7fff49eb),
1038 X(0x7fff5260), X(0x7fff5a88), X(0x7fff6266), X(0x7fff69fc),
1039 X(0x7fff714b), X(0x7fff7854), X(0x7fff7f1a), X(0x7fff859f),
1040 X(0x7fff8be3), X(0x7fff91ea), X(0x7fff97b3), X(0x7fff9d41),
1041 X(0x7fffa296), X(0x7fffa7b3), X(0x7fffac99), X(0x7fffb14b),
1042 X(0x7fffb5c9), X(0x7fffba15), X(0x7fffbe31), X(0x7fffc21d),
1043 X(0x7fffc5dc), X(0x7fffc96f), X(0x7fffccd8), X(0x7fffd016),
1044 X(0x7fffd32d), X(0x7fffd61c), X(0x7fffd8e7), X(0x7fffdb8d),
1045 X(0x7fffde0f), X(0x7fffe071), X(0x7fffe2b1), X(0x7fffe4d2),
1046 X(0x7fffe6d5), X(0x7fffe8bb), X(0x7fffea85), X(0x7fffec34),
1047 X(0x7fffedc9), X(0x7fffef45), X(0x7ffff0aa), X(0x7ffff1f7),
1048 X(0x7ffff330), X(0x7ffff453), X(0x7ffff562), X(0x7ffff65f),
1049 X(0x7ffff749), X(0x7ffff823), X(0x7ffff8ec), X(0x7ffff9a6),
1050 X(0x7ffffa51), X(0x7ffffaee), X(0x7ffffb7e), X(0x7ffffc02),
1051 X(0x7ffffc7a), X(0x7ffffce7), X(0x7ffffd4a), X(0x7ffffda3),
1052 X(0x7ffffdf4), X(0x7ffffe3c), X(0x7ffffe7c), X(0x7ffffeb6),
1053 X(0x7ffffee8), X(0x7fffff15), X(0x7fffff3c), X(0x7fffff5e),
1054 X(0x7fffff7b), X(0x7fffff95), X(0x7fffffaa), X(0x7fffffbc),
1055 X(0x7fffffcb), X(0x7fffffd7), X(0x7fffffe2), X(0x7fffffea),
1056 X(0x7ffffff0), X(0x7ffffff5), X(0x7ffffff9), X(0x7ffffffb),
1057 X(0x7ffffffd), X(0x7ffffffe), X(0x7fffffff), X(0x7fffffff),
1058 X(0x7fffffff), X(0x7fffffff), X(0x7fffffff), X(0x7fffffff),
1059};
1060
1061static LOOKUP_T vwin8192[4096] = {
1062 X(0x0000007c), X(0x0000045c), X(0x00000c1d), X(0x000017bd),
1063 X(0x0000273e), X(0x00003a9f), X(0x000051e0), X(0x00006d02),
1064 X(0x00008c03), X(0x0000aee5), X(0x0000d5a7), X(0x00010049),
1065 X(0x00012ecb), X(0x0001612d), X(0x00019770), X(0x0001d193),
1066 X(0x00020f96), X(0x00025178), X(0x0002973c), X(0x0002e0df),
1067 X(0x00032e62), X(0x00037fc5), X(0x0003d509), X(0x00042e2c),
1068 X(0x00048b30), X(0x0004ec13), X(0x000550d7), X(0x0005b97a),
1069 X(0x000625fe), X(0x00069661), X(0x00070aa4), X(0x000782c8),
1070 X(0x0007fecb), X(0x00087eae), X(0x00090271), X(0x00098a14),
1071 X(0x000a1597), X(0x000aa4f9), X(0x000b383b), X(0x000bcf5d),
1072 X(0x000c6a5f), X(0x000d0941), X(0x000dac02), X(0x000e52a3),
1073 X(0x000efd23), X(0x000fab84), X(0x00105dc3), X(0x001113e3),
1074 X(0x0011cde2), X(0x00128bc0), X(0x00134d7e), X(0x0014131b),
1075 X(0x0014dc98), X(0x0015a9f4), X(0x00167b30), X(0x0017504a),
1076 X(0x00182945), X(0x0019061e), X(0x0019e6d7), X(0x001acb6f),
1077 X(0x001bb3e6), X(0x001ca03c), X(0x001d9071), X(0x001e8485),
1078 X(0x001f7c79), X(0x0020784b), X(0x002177fc), X(0x00227b8c),
1079 X(0x002382fb), X(0x00248e49), X(0x00259d76), X(0x0026b081),
1080 X(0x0027c76b), X(0x0028e234), X(0x002a00dc), X(0x002b2361),
1081 X(0x002c49c6), X(0x002d7409), X(0x002ea22a), X(0x002fd42a),
1082 X(0x00310a08), X(0x003243c5), X(0x00338160), X(0x0034c2d9),
1083 X(0x00360830), X(0x00375165), X(0x00389e78), X(0x0039ef6a),
1084 X(0x003b4439), X(0x003c9ce6), X(0x003df971), X(0x003f59da),
1085 X(0x0040be20), X(0x00422645), X(0x00439247), X(0x00450226),
1086 X(0x004675e3), X(0x0047ed7e), X(0x004968f5), X(0x004ae84b),
1087 X(0x004c6b7d), X(0x004df28d), X(0x004f7d7a), X(0x00510c44),
1088 X(0x00529eeb), X(0x00543570), X(0x0055cfd1), X(0x00576e0f),
1089 X(0x00591029), X(0x005ab621), X(0x005c5ff5), X(0x005e0da6),
1090 X(0x005fbf33), X(0x0061749d), X(0x00632de4), X(0x0064eb06),
1091 X(0x0066ac05), X(0x006870e0), X(0x006a3998), X(0x006c062b),
1092 X(0x006dd69b), X(0x006faae6), X(0x0071830d), X(0x00735f10),
1093 X(0x00753eef), X(0x007722a9), X(0x00790a3f), X(0x007af5b1),
1094 X(0x007ce4fe), X(0x007ed826), X(0x0080cf29), X(0x0082ca08),
1095 X(0x0084c8c2), X(0x0086cb57), X(0x0088d1c7), X(0x008adc11),
1096 X(0x008cea37), X(0x008efc37), X(0x00911212), X(0x00932bc7),
1097 X(0x00954957), X(0x00976ac2), X(0x00999006), X(0x009bb925),
1098 X(0x009de61e), X(0x00a016f1), X(0x00a24b9e), X(0x00a48425),
1099 X(0x00a6c086), X(0x00a900c0), X(0x00ab44d4), X(0x00ad8cc2),
1100 X(0x00afd889), X(0x00b22829), X(0x00b47ba2), X(0x00b6d2f5),
1101 X(0x00b92e21), X(0x00bb8d26), X(0x00bdf004), X(0x00c056ba),
1102 X(0x00c2c149), X(0x00c52fb1), X(0x00c7a1f1), X(0x00ca180a),
1103 X(0x00cc91fb), X(0x00cf0fc5), X(0x00d19166), X(0x00d416df),
1104 X(0x00d6a031), X(0x00d92d5a), X(0x00dbbe5b), X(0x00de5333),
1105 X(0x00e0ebe3), X(0x00e3886b), X(0x00e628c9), X(0x00e8ccff),
1106 X(0x00eb750c), X(0x00ee20f0), X(0x00f0d0ab), X(0x00f3843d),
1107 X(0x00f63ba5), X(0x00f8f6e4), X(0x00fbb5fa), X(0x00fe78e5),
1108 X(0x01013fa7), X(0x01040a3f), X(0x0106d8ae), X(0x0109aaf2),
1109 X(0x010c810c), X(0x010f5afb), X(0x011238c0), X(0x01151a5b),
1110 X(0x0117ffcb), X(0x011ae910), X(0x011dd62a), X(0x0120c719),
1111 X(0x0123bbdd), X(0x0126b476), X(0x0129b0e4), X(0x012cb126),
1112 X(0x012fb53c), X(0x0132bd27), X(0x0135c8e6), X(0x0138d879),
1113 X(0x013bebdf), X(0x013f031a), X(0x01421e28), X(0x01453d0a),
1114 X(0x01485fbf), X(0x014b8648), X(0x014eb0a4), X(0x0151ded2),
1115 X(0x015510d4), X(0x015846a8), X(0x015b8050), X(0x015ebdc9),
1116 X(0x0161ff15), X(0x01654434), X(0x01688d24), X(0x016bd9e6),
1117 X(0x016f2a7b), X(0x01727ee1), X(0x0175d718), X(0x01793321),
1118 X(0x017c92fc), X(0x017ff6a7), X(0x01835e24), X(0x0186c972),
1119 X(0x018a3890), X(0x018dab7f), X(0x0191223f), X(0x01949ccf),
1120 X(0x01981b2f), X(0x019b9d5f), X(0x019f235f), X(0x01a2ad2f),
1121 X(0x01a63acf), X(0x01a9cc3e), X(0x01ad617c), X(0x01b0fa8a),
1122 X(0x01b49767), X(0x01b83813), X(0x01bbdc8d), X(0x01bf84d6),
1123 X(0x01c330ee), X(0x01c6e0d4), X(0x01ca9488), X(0x01ce4c0b),
1124 X(0x01d2075b), X(0x01d5c679), X(0x01d98964), X(0x01dd501d),
1125 X(0x01e11aa3), X(0x01e4e8f6), X(0x01e8bb17), X(0x01ec9104),
1126 X(0x01f06abd), X(0x01f44844), X(0x01f82996), X(0x01fc0eb5),
1127 X(0x01fff7a0), X(0x0203e456), X(0x0207d4d9), X(0x020bc926),
1128 X(0x020fc140), X(0x0213bd24), X(0x0217bcd4), X(0x021bc04e),
1129 X(0x021fc793), X(0x0223d2a3), X(0x0227e17d), X(0x022bf421),
1130 X(0x02300a90), X(0x023424c8), X(0x023842ca), X(0x023c6495),
1131 X(0x02408a2a), X(0x0244b389), X(0x0248e0b0), X(0x024d11a0),
1132 X(0x02514659), X(0x02557eda), X(0x0259bb24), X(0x025dfb35),
1133 X(0x02623f0f), X(0x026686b1), X(0x026ad21a), X(0x026f214b),
1134 X(0x02737443), X(0x0277cb02), X(0x027c2588), X(0x028083d5),
1135 X(0x0284e5e9), X(0x02894bc2), X(0x028db562), X(0x029222c8),
1136 X(0x029693f4), X(0x029b08e6), X(0x029f819d), X(0x02a3fe19),
1137 X(0x02a87e5b), X(0x02ad0261), X(0x02b18a2c), X(0x02b615bb),
1138 X(0x02baa50f), X(0x02bf3827), X(0x02c3cf03), X(0x02c869a3),
1139 X(0x02cd0807), X(0x02d1aa2d), X(0x02d65017), X(0x02daf9c4),
1140 X(0x02dfa734), X(0x02e45866), X(0x02e90d5b), X(0x02edc612),
1141 X(0x02f2828b), X(0x02f742c6), X(0x02fc06c3), X(0x0300ce80),
1142 X(0x030599ff), X(0x030a6940), X(0x030f3c40), X(0x03141302),
1143 X(0x0318ed84), X(0x031dcbc6), X(0x0322adc8), X(0x0327938a),
1144 X(0x032c7d0c), X(0x03316a4c), X(0x03365b4d), X(0x033b500c),
1145 X(0x03404889), X(0x034544c6), X(0x034a44c0), X(0x034f4879),
1146 X(0x03544ff0), X(0x03595b24), X(0x035e6a16), X(0x03637cc5),
1147 X(0x03689331), X(0x036dad5a), X(0x0372cb40), X(0x0377ece2),
1148 X(0x037d1240), X(0x03823b5a), X(0x03876830), X(0x038c98c1),
1149 X(0x0391cd0e), X(0x03970516), X(0x039c40d8), X(0x03a18055),
1150 X(0x03a6c38d), X(0x03ac0a7f), X(0x03b1552b), X(0x03b6a390),
1151 X(0x03bbf5af), X(0x03c14b88), X(0x03c6a519), X(0x03cc0263),
1152 X(0x03d16366), X(0x03d6c821), X(0x03dc3094), X(0x03e19cc0),
1153 X(0x03e70ca2), X(0x03ec803d), X(0x03f1f78e), X(0x03f77296),
1154 X(0x03fcf155), X(0x040273cb), X(0x0407f9f7), X(0x040d83d9),
1155 X(0x04131170), X(0x0418a2bd), X(0x041e37c0), X(0x0423d077),
1156 X(0x04296ce4), X(0x042f0d04), X(0x0434b0da), X(0x043a5863),
1157 X(0x044003a0), X(0x0445b290), X(0x044b6534), X(0x04511b8b),
1158 X(0x0456d595), X(0x045c9352), X(0x046254c1), X(0x046819e1),
1159 X(0x046de2b4), X(0x0473af39), X(0x04797f6e), X(0x047f5355),
1160 X(0x04852aec), X(0x048b0635), X(0x0490e52d), X(0x0496c7d6),
1161 X(0x049cae2e), X(0x04a29836), X(0x04a885ed), X(0x04ae7753),
1162 X(0x04b46c68), X(0x04ba652b), X(0x04c0619d), X(0x04c661bc),
1163 X(0x04cc658a), X(0x04d26d04), X(0x04d8782c), X(0x04de8701),
1164 X(0x04e49983), X(0x04eaafb0), X(0x04f0c98a), X(0x04f6e710),
1165 X(0x04fd0842), X(0x05032d1e), X(0x050955a6), X(0x050f81d8),
1166 X(0x0515b1b5), X(0x051be53d), X(0x05221c6e), X(0x05285748),
1167 X(0x052e95cd), X(0x0534d7fa), X(0x053b1dd0), X(0x0541674e),
1168 X(0x0547b475), X(0x054e0544), X(0x055459bb), X(0x055ab1d9),
1169 X(0x05610d9e), X(0x05676d0a), X(0x056dd01c), X(0x057436d5),
1170 X(0x057aa134), X(0x05810f38), X(0x058780e2), X(0x058df631),
1171 X(0x05946f25), X(0x059aebbe), X(0x05a16bfa), X(0x05a7efdb),
1172 X(0x05ae775f), X(0x05b50287), X(0x05bb9152), X(0x05c223c0),
1173 X(0x05c8b9d0), X(0x05cf5382), X(0x05d5f0d6), X(0x05dc91cc),
1174 X(0x05e33663), X(0x05e9de9c), X(0x05f08a75), X(0x05f739ee),
1175 X(0x05fded07), X(0x0604a3c0), X(0x060b5e19), X(0x06121c11),
1176 X(0x0618dda8), X(0x061fa2dd), X(0x06266bb1), X(0x062d3822),
1177 X(0x06340831), X(0x063adbde), X(0x0641b328), X(0x06488e0e),
1178 X(0x064f6c91), X(0x06564eaf), X(0x065d346a), X(0x06641dc0),
1179 X(0x066b0ab1), X(0x0671fb3d), X(0x0678ef64), X(0x067fe724),
1180 X(0x0686e27f), X(0x068de173), X(0x0694e400), X(0x069bea27),
1181 X(0x06a2f3e6), X(0x06aa013d), X(0x06b1122c), X(0x06b826b3),
1182 X(0x06bf3ed1), X(0x06c65a86), X(0x06cd79d1), X(0x06d49cb3),
1183 X(0x06dbc32b), X(0x06e2ed38), X(0x06ea1adb), X(0x06f14c13),
1184 X(0x06f880df), X(0x06ffb940), X(0x0706f535), X(0x070e34bd),
1185 X(0x071577d9), X(0x071cbe88), X(0x072408c9), X(0x072b569d),
1186 X(0x0732a802), X(0x0739fcf9), X(0x07415582), X(0x0748b19b),
1187 X(0x07501145), X(0x0757747f), X(0x075edb49), X(0x076645a3),
1188 X(0x076db38c), X(0x07752503), X(0x077c9a09), X(0x0784129e),
1189 X(0x078b8ec0), X(0x07930e70), X(0x079a91ac), X(0x07a21876),
1190 X(0x07a9a2cc), X(0x07b130ad), X(0x07b8c21b), X(0x07c05714),
1191 X(0x07c7ef98), X(0x07cf8ba6), X(0x07d72b3f), X(0x07dece62),
1192 X(0x07e6750e), X(0x07ee1f43), X(0x07f5cd01), X(0x07fd7e48),
1193 X(0x08053316), X(0x080ceb6d), X(0x0814a74a), X(0x081c66af),
1194 X(0x0824299a), X(0x082bf00c), X(0x0833ba03), X(0x083b8780),
1195 X(0x08435882), X(0x084b2d09), X(0x08530514), X(0x085ae0a3),
1196 X(0x0862bfb6), X(0x086aa24c), X(0x08728865), X(0x087a7201),
1197 X(0x08825f1e), X(0x088a4fbe), X(0x089243de), X(0x089a3b80),
1198 X(0x08a236a2), X(0x08aa3545), X(0x08b23767), X(0x08ba3d09),
1199 X(0x08c2462a), X(0x08ca52c9), X(0x08d262e7), X(0x08da7682),
1200 X(0x08e28d9c), X(0x08eaa832), X(0x08f2c645), X(0x08fae7d4),
1201 X(0x09030cdf), X(0x090b3566), X(0x09136168), X(0x091b90e5),
1202 X(0x0923c3dc), X(0x092bfa4d), X(0x09343437), X(0x093c719b),
1203 X(0x0944b277), X(0x094cf6cc), X(0x09553e99), X(0x095d89dd),
1204 X(0x0965d899), X(0x096e2acb), X(0x09768073), X(0x097ed991),
1205 X(0x09873625), X(0x098f962e), X(0x0997f9ac), X(0x09a0609e),
1206 X(0x09a8cb04), X(0x09b138dd), X(0x09b9aa29), X(0x09c21ee8),
1207 X(0x09ca9719), X(0x09d312bc), X(0x09db91d0), X(0x09e41456),
1208 X(0x09ec9a4b), X(0x09f523b1), X(0x09fdb087), X(0x0a0640cc),
1209 X(0x0a0ed47f), X(0x0a176ba2), X(0x0a200632), X(0x0a28a42f),
1210 X(0x0a31459a), X(0x0a39ea72), X(0x0a4292b5), X(0x0a4b3e65),
1211 X(0x0a53ed80), X(0x0a5ca006), X(0x0a6555f7), X(0x0a6e0f51),
1212 X(0x0a76cc16), X(0x0a7f8c44), X(0x0a884fda), X(0x0a9116d9),
1213 X(0x0a99e140), X(0x0aa2af0e), X(0x0aab8043), X(0x0ab454df),
1214 X(0x0abd2ce1), X(0x0ac60849), X(0x0acee716), X(0x0ad7c948),
1215 X(0x0ae0aedf), X(0x0ae997d9), X(0x0af28437), X(0x0afb73f7),
1216 X(0x0b04671b), X(0x0b0d5da0), X(0x0b165788), X(0x0b1f54d0),
1217 X(0x0b285579), X(0x0b315983), X(0x0b3a60ec), X(0x0b436bb5),
1218 X(0x0b4c79dd), X(0x0b558b63), X(0x0b5ea048), X(0x0b67b88a),
1219 X(0x0b70d429), X(0x0b79f324), X(0x0b83157c), X(0x0b8c3b30),
1220 X(0x0b95643f), X(0x0b9e90a8), X(0x0ba7c06c), X(0x0bb0f38a),
1221 X(0x0bba2a01), X(0x0bc363d1), X(0x0bcca0f9), X(0x0bd5e17a),
1222 X(0x0bdf2552), X(0x0be86c81), X(0x0bf1b706), X(0x0bfb04e2),
1223 X(0x0c045613), X(0x0c0daa99), X(0x0c170274), X(0x0c205da3),
1224 X(0x0c29bc25), X(0x0c331dfb), X(0x0c3c8323), X(0x0c45eb9e),
1225 X(0x0c4f576a), X(0x0c58c688), X(0x0c6238f6), X(0x0c6baeb5),
1226 X(0x0c7527c3), X(0x0c7ea421), X(0x0c8823cd), X(0x0c91a6c8),
1227 X(0x0c9b2d10), X(0x0ca4b6a6), X(0x0cae4389), X(0x0cb7d3b8),
1228 X(0x0cc16732), X(0x0ccafdf8), X(0x0cd49809), X(0x0cde3564),
1229 X(0x0ce7d609), X(0x0cf179f7), X(0x0cfb212e), X(0x0d04cbad),
1230 X(0x0d0e7974), X(0x0d182a83), X(0x0d21ded8), X(0x0d2b9673),
1231 X(0x0d355154), X(0x0d3f0f7b), X(0x0d48d0e6), X(0x0d529595),
1232 X(0x0d5c5d88), X(0x0d6628be), X(0x0d6ff737), X(0x0d79c8f2),
1233 X(0x0d839dee), X(0x0d8d762c), X(0x0d9751aa), X(0x0da13068),
1234 X(0x0dab1266), X(0x0db4f7a3), X(0x0dbee01e), X(0x0dc8cbd8),
1235 X(0x0dd2bace), X(0x0ddcad02), X(0x0de6a272), X(0x0df09b1e),
1236 X(0x0dfa9705), X(0x0e049627), X(0x0e0e9883), X(0x0e189e19),
1237 X(0x0e22a6e8), X(0x0e2cb2f0), X(0x0e36c230), X(0x0e40d4a8),
1238 X(0x0e4aea56), X(0x0e55033b), X(0x0e5f1f56), X(0x0e693ea7),
1239 X(0x0e73612c), X(0x0e7d86e5), X(0x0e87afd3), X(0x0e91dbf3),
1240 X(0x0e9c0b47), X(0x0ea63dcc), X(0x0eb07383), X(0x0ebaac6b),
1241 X(0x0ec4e883), X(0x0ecf27cc), X(0x0ed96a44), X(0x0ee3afea),
1242 X(0x0eedf8bf), X(0x0ef844c2), X(0x0f0293f2), X(0x0f0ce64e),
1243 X(0x0f173bd6), X(0x0f21948a), X(0x0f2bf069), X(0x0f364f72),
1244 X(0x0f40b1a5), X(0x0f4b1701), X(0x0f557f86), X(0x0f5feb32),
1245 X(0x0f6a5a07), X(0x0f74cc02), X(0x0f7f4124), X(0x0f89b96b),
1246 X(0x0f9434d8), X(0x0f9eb369), X(0x0fa9351e), X(0x0fb3b9f7),
1247 X(0x0fbe41f3), X(0x0fc8cd11), X(0x0fd35b51), X(0x0fddecb2),
1248 X(0x0fe88134), X(0x0ff318d6), X(0x0ffdb397), X(0x10085177),
1249 X(0x1012f275), X(0x101d9691), X(0x10283dca), X(0x1032e81f),
1250 X(0x103d9591), X(0x1048461e), X(0x1052f9c5), X(0x105db087),
1251 X(0x10686a62), X(0x10732756), X(0x107de763), X(0x1088aa87),
1252 X(0x109370c2), X(0x109e3a14), X(0x10a9067c), X(0x10b3d5f9),
1253 X(0x10bea88b), X(0x10c97e31), X(0x10d456eb), X(0x10df32b8),
1254 X(0x10ea1197), X(0x10f4f387), X(0x10ffd889), X(0x110ac09b),
1255 X(0x1115abbe), X(0x112099ef), X(0x112b8b2f), X(0x11367f7d),
1256 X(0x114176d9), X(0x114c7141), X(0x11576eb6), X(0x11626f36),
1257 X(0x116d72c1), X(0x11787957), X(0x118382f6), X(0x118e8f9e),
1258 X(0x11999f4f), X(0x11a4b208), X(0x11afc7c7), X(0x11bae08e),
1259 X(0x11c5fc5a), X(0x11d11b2c), X(0x11dc3d02), X(0x11e761dd),
1260 X(0x11f289ba), X(0x11fdb49b), X(0x1208e27e), X(0x12141362),
1261 X(0x121f4748), X(0x122a7e2d), X(0x1235b812), X(0x1240f4f6),
1262 X(0x124c34d9), X(0x125777b9), X(0x1262bd96), X(0x126e0670),
1263 X(0x12795245), X(0x1284a115), X(0x128ff2e0), X(0x129b47a5),
1264 X(0x12a69f63), X(0x12b1fa19), X(0x12bd57c7), X(0x12c8b86c),
1265 X(0x12d41c08), X(0x12df829a), X(0x12eaec21), X(0x12f6589d),
1266 X(0x1301c80c), X(0x130d3a6f), X(0x1318afc4), X(0x1324280b),
1267 X(0x132fa344), X(0x133b216d), X(0x1346a286), X(0x1352268e),
1268 X(0x135dad85), X(0x1369376a), X(0x1374c43c), X(0x138053fb),
1269 X(0x138be6a5), X(0x13977c3b), X(0x13a314bc), X(0x13aeb026),
1270 X(0x13ba4e79), X(0x13c5efb5), X(0x13d193d9), X(0x13dd3ae4),
1271 X(0x13e8e4d6), X(0x13f491ad), X(0x1400416a), X(0x140bf40b),
1272 X(0x1417a98f), X(0x142361f7), X(0x142f1d41), X(0x143adb6d),
1273 X(0x14469c7a), X(0x14526067), X(0x145e2734), X(0x1469f0df),
1274 X(0x1475bd69), X(0x14818cd0), X(0x148d5f15), X(0x14993435),
1275 X(0x14a50c31), X(0x14b0e708), X(0x14bcc4b8), X(0x14c8a542),
1276 X(0x14d488a5), X(0x14e06edf), X(0x14ec57f1), X(0x14f843d9),
1277 X(0x15043297), X(0x1510242b), X(0x151c1892), X(0x15280fcd),
1278 X(0x153409dc), X(0x154006bc), X(0x154c066e), X(0x155808f1),
1279 X(0x15640e44), X(0x15701666), X(0x157c2157), X(0x15882f16),
1280 X(0x15943fa2), X(0x15a052fb), X(0x15ac691f), X(0x15b8820f),
1281 X(0x15c49dc8), X(0x15d0bc4c), X(0x15dcdd98), X(0x15e901ad),
1282 X(0x15f52888), X(0x1601522b), X(0x160d7e93), X(0x1619adc1),
1283 X(0x1625dfb3), X(0x16321469), X(0x163e4be2), X(0x164a861d),
1284 X(0x1656c31a), X(0x166302d8), X(0x166f4555), X(0x167b8a92),
1285 X(0x1687d28e), X(0x16941d47), X(0x16a06abe), X(0x16acbaf0),
1286 X(0x16b90ddf), X(0x16c56388), X(0x16d1bbeb), X(0x16de1708),
1287 X(0x16ea74dd), X(0x16f6d56a), X(0x170338ae), X(0x170f9ea8),
1288 X(0x171c0758), X(0x172872bd), X(0x1734e0d6), X(0x174151a2),
1289 X(0x174dc520), X(0x175a3b51), X(0x1766b432), X(0x17732fc4),
1290 X(0x177fae05), X(0x178c2ef4), X(0x1798b292), X(0x17a538dd),
1291 X(0x17b1c1d4), X(0x17be4d77), X(0x17cadbc5), X(0x17d76cbc),
1292 X(0x17e4005e), X(0x17f096a7), X(0x17fd2f98), X(0x1809cb31),
1293 X(0x1816696f), X(0x18230a53), X(0x182faddc), X(0x183c5408),
1294 X(0x1848fcd8), X(0x1855a849), X(0x1862565d), X(0x186f0711),
1295 X(0x187bba64), X(0x18887057), X(0x189528e9), X(0x18a1e418),
1296 X(0x18aea1e3), X(0x18bb624b), X(0x18c8254e), X(0x18d4eaeb),
1297 X(0x18e1b321), X(0x18ee7df1), X(0x18fb4b58), X(0x19081b57),
1298 X(0x1914edec), X(0x1921c317), X(0x192e9ad6), X(0x193b7529),
1299 X(0x19485210), X(0x19553189), X(0x19621393), X(0x196ef82e),
1300 X(0x197bdf59), X(0x1988c913), X(0x1995b55c), X(0x19a2a432),
1301 X(0x19af9595), X(0x19bc8983), X(0x19c97ffd), X(0x19d67900),
1302 X(0x19e3748e), X(0x19f072a3), X(0x19fd7341), X(0x1a0a7665),
1303 X(0x1a177c10), X(0x1a248440), X(0x1a318ef4), X(0x1a3e9c2c),
1304 X(0x1a4babe7), X(0x1a58be24), X(0x1a65d2e2), X(0x1a72ea20),
1305 X(0x1a8003de), X(0x1a8d201a), X(0x1a9a3ed5), X(0x1aa7600c),
1306 X(0x1ab483bf), X(0x1ac1a9ee), X(0x1aced297), X(0x1adbfdba),
1307 X(0x1ae92b56), X(0x1af65b69), X(0x1b038df4), X(0x1b10c2f5),
1308 X(0x1b1dfa6b), X(0x1b2b3456), X(0x1b3870b5), X(0x1b45af87),
1309 X(0x1b52f0ca), X(0x1b60347f), X(0x1b6d7aa4), X(0x1b7ac339),
1310 X(0x1b880e3c), X(0x1b955bad), X(0x1ba2ab8b), X(0x1baffdd5),
1311 X(0x1bbd528a), X(0x1bcaa9a9), X(0x1bd80332), X(0x1be55f24),
1312 X(0x1bf2bd7d), X(0x1c001e3d), X(0x1c0d8164), X(0x1c1ae6ef),
1313 X(0x1c284edf), X(0x1c35b932), X(0x1c4325e7), X(0x1c5094fe),
1314 X(0x1c5e0677), X(0x1c6b7a4f), X(0x1c78f086), X(0x1c86691b),
1315 X(0x1c93e40d), X(0x1ca1615c), X(0x1caee107), X(0x1cbc630c),
1316 X(0x1cc9e76b), X(0x1cd76e23), X(0x1ce4f733), X(0x1cf2829a),
1317 X(0x1d001057), X(0x1d0da06a), X(0x1d1b32d1), X(0x1d28c78c),
1318 X(0x1d365e9a), X(0x1d43f7f9), X(0x1d5193a9), X(0x1d5f31aa),
1319 X(0x1d6cd1f9), X(0x1d7a7497), X(0x1d881982), X(0x1d95c0ba),
1320 X(0x1da36a3d), X(0x1db1160a), X(0x1dbec422), X(0x1dcc7482),
1321 X(0x1dda272b), X(0x1de7dc1a), X(0x1df59350), X(0x1e034ccb),
1322 X(0x1e11088a), X(0x1e1ec68c), X(0x1e2c86d1), X(0x1e3a4958),
1323 X(0x1e480e20), X(0x1e55d527), X(0x1e639e6d), X(0x1e7169f1),
1324 X(0x1e7f37b2), X(0x1e8d07b0), X(0x1e9ad9e8), X(0x1ea8ae5b),
1325 X(0x1eb68507), X(0x1ec45dec), X(0x1ed23908), X(0x1ee0165b),
1326 X(0x1eedf5e4), X(0x1efbd7a1), X(0x1f09bb92), X(0x1f17a1b6),
1327 X(0x1f258a0d), X(0x1f337494), X(0x1f41614b), X(0x1f4f5032),
1328 X(0x1f5d4147), X(0x1f6b3489), X(0x1f7929f7), X(0x1f872192),
1329 X(0x1f951b56), X(0x1fa31744), X(0x1fb1155b), X(0x1fbf159a),
1330 X(0x1fcd17ff), X(0x1fdb1c8b), X(0x1fe9233b), X(0x1ff72c0f),
1331 X(0x20053706), X(0x20134420), X(0x2021535a), X(0x202f64b4),
1332 X(0x203d782e), X(0x204b8dc6), X(0x2059a57c), X(0x2067bf4e),
1333 X(0x2075db3b), X(0x2083f943), X(0x20921964), X(0x20a03b9e),
1334 X(0x20ae5fef), X(0x20bc8657), X(0x20caaed5), X(0x20d8d967),
1335 X(0x20e7060e), X(0x20f534c7), X(0x21036592), X(0x2111986e),
1336 X(0x211fcd59), X(0x212e0454), X(0x213c3d5d), X(0x214a7873),
1337 X(0x2158b594), X(0x2166f4c1), X(0x217535f8), X(0x21837938),
1338 X(0x2191be81), X(0x21a005d0), X(0x21ae4f26), X(0x21bc9a81),
1339 X(0x21cae7e0), X(0x21d93743), X(0x21e788a8), X(0x21f5dc0e),
1340 X(0x22043174), X(0x221288da), X(0x2220e23e), X(0x222f3da0),
1341 X(0x223d9afe), X(0x224bfa58), X(0x225a5bac), X(0x2268bef9),
1342 X(0x2277243f), X(0x22858b7d), X(0x2293f4b0), X(0x22a25fda),
1343 X(0x22b0ccf8), X(0x22bf3c09), X(0x22cdad0d), X(0x22dc2002),
1344 X(0x22ea94e8), X(0x22f90bbe), X(0x23078482), X(0x2315ff33),
1345 X(0x23247bd1), X(0x2332fa5b), X(0x23417acf), X(0x234ffd2c),
1346 X(0x235e8173), X(0x236d07a0), X(0x237b8fb4), X(0x238a19ae),
1347 X(0x2398a58c), X(0x23a7334d), X(0x23b5c2f1), X(0x23c45477),
1348 X(0x23d2e7dd), X(0x23e17d22), X(0x23f01446), X(0x23fead47),
1349 X(0x240d4825), X(0x241be4dd), X(0x242a8371), X(0x243923dd),
1350 X(0x2447c622), X(0x24566a3e), X(0x24651031), X(0x2473b7f8),
1351 X(0x24826194), X(0x24910d03), X(0x249fba44), X(0x24ae6957),
1352 X(0x24bd1a39), X(0x24cbccea), X(0x24da816a), X(0x24e937b7),
1353 X(0x24f7efcf), X(0x2506a9b3), X(0x25156560), X(0x252422d6),
1354 X(0x2532e215), X(0x2541a31a), X(0x255065e4), X(0x255f2a74),
1355 X(0x256df0c7), X(0x257cb8dd), X(0x258b82b4), X(0x259a4e4c),
1356 X(0x25a91ba4), X(0x25b7eaba), X(0x25c6bb8e), X(0x25d58e1e),
1357 X(0x25e46269), X(0x25f3386e), X(0x2602102d), X(0x2610e9a4),
1358 X(0x261fc4d3), X(0x262ea1b7), X(0x263d8050), X(0x264c609e),
1359 X(0x265b429e), X(0x266a2650), X(0x26790bb3), X(0x2687f2c6),
1360 X(0x2696db88), X(0x26a5c5f7), X(0x26b4b213), X(0x26c39fda),
1361 X(0x26d28f4c), X(0x26e18067), X(0x26f0732b), X(0x26ff6796),
1362 X(0x270e5da7), X(0x271d555d), X(0x272c4eb7), X(0x273b49b5),
1363 X(0x274a4654), X(0x27594495), X(0x27684475), X(0x277745f4),
1364 X(0x27864910), X(0x27954dc9), X(0x27a4541e), X(0x27b35c0d),
1365 X(0x27c26596), X(0x27d170b7), X(0x27e07d6f), X(0x27ef8bbd),
1366 X(0x27fe9ba0), X(0x280dad18), X(0x281cc022), X(0x282bd4be),
1367 X(0x283aeaeb), X(0x284a02a7), X(0x28591bf2), X(0x286836cb),
1368 X(0x28775330), X(0x28867120), X(0x2895909b), X(0x28a4b19e),
1369 X(0x28b3d42a), X(0x28c2f83d), X(0x28d21dd5), X(0x28e144f3),
1370 X(0x28f06d94), X(0x28ff97b8), X(0x290ec35d), X(0x291df082),
1371 X(0x292d1f27), X(0x293c4f4a), X(0x294b80eb), X(0x295ab407),
1372 X(0x2969e89e), X(0x29791eaf), X(0x29885639), X(0x29978f3b),
1373 X(0x29a6c9b3), X(0x29b605a0), X(0x29c54302), X(0x29d481d7),
1374 X(0x29e3c21e), X(0x29f303d6), X(0x2a0246fd), X(0x2a118b94),
1375 X(0x2a20d198), X(0x2a301909), X(0x2a3f61e6), X(0x2a4eac2c),
1376 X(0x2a5df7dc), X(0x2a6d44f4), X(0x2a7c9374), X(0x2a8be359),
1377 X(0x2a9b34a2), X(0x2aaa8750), X(0x2ab9db60), X(0x2ac930d1),
1378 X(0x2ad887a3), X(0x2ae7dfd3), X(0x2af73962), X(0x2b06944e),
1379 X(0x2b15f096), X(0x2b254e38), X(0x2b34ad34), X(0x2b440d89),
1380 X(0x2b536f34), X(0x2b62d236), X(0x2b72368d), X(0x2b819c38),
1381 X(0x2b910336), X(0x2ba06b86), X(0x2bafd526), X(0x2bbf4015),
1382 X(0x2bceac53), X(0x2bde19de), X(0x2bed88b5), X(0x2bfcf8d7),
1383 X(0x2c0c6a43), X(0x2c1bdcf7), X(0x2c2b50f3), X(0x2c3ac635),
1384 X(0x2c4a3cbd), X(0x2c59b488), X(0x2c692d97), X(0x2c78a7e7),
1385 X(0x2c882378), X(0x2c97a049), X(0x2ca71e58), X(0x2cb69da4),
1386 X(0x2cc61e2c), X(0x2cd59ff0), X(0x2ce522ed), X(0x2cf4a723),
1387 X(0x2d042c90), X(0x2d13b334), X(0x2d233b0d), X(0x2d32c41a),
1388 X(0x2d424e5a), X(0x2d51d9cc), X(0x2d61666e), X(0x2d70f440),
1389 X(0x2d808340), X(0x2d90136e), X(0x2d9fa4c7), X(0x2daf374c),
1390 X(0x2dbecafa), X(0x2dce5fd1), X(0x2dddf5cf), X(0x2ded8cf4),
1391 X(0x2dfd253d), X(0x2e0cbeab), X(0x2e1c593b), X(0x2e2bf4ed),
1392 X(0x2e3b91c0), X(0x2e4b2fb1), X(0x2e5acec1), X(0x2e6a6eee),
1393 X(0x2e7a1037), X(0x2e89b29b), X(0x2e995618), X(0x2ea8faad),
1394 X(0x2eb8a05a), X(0x2ec8471c), X(0x2ed7eef4), X(0x2ee797df),
1395 X(0x2ef741dc), X(0x2f06eceb), X(0x2f16990a), X(0x2f264639),
1396 X(0x2f35f475), X(0x2f45a3bd), X(0x2f555412), X(0x2f650570),
1397 X(0x2f74b7d8), X(0x2f846b48), X(0x2f941fbe), X(0x2fa3d53a),
1398 X(0x2fb38bbb), X(0x2fc3433f), X(0x2fd2fbc5), X(0x2fe2b54c),
1399 X(0x2ff26fd3), X(0x30022b58), X(0x3011e7db), X(0x3021a55a),
1400 X(0x303163d4), X(0x30412348), X(0x3050e3b5), X(0x3060a519),
1401 X(0x30706773), X(0x30802ac3), X(0x308fef06), X(0x309fb43d),
1402 X(0x30af7a65), X(0x30bf417d), X(0x30cf0985), X(0x30ded27a),
1403 X(0x30ee9c5d), X(0x30fe672b), X(0x310e32e3), X(0x311dff85),
1404 X(0x312dcd0f), X(0x313d9b80), X(0x314d6ad7), X(0x315d3b12),
1405 X(0x316d0c30), X(0x317cde31), X(0x318cb113), X(0x319c84d4),
1406 X(0x31ac5974), X(0x31bc2ef1), X(0x31cc054b), X(0x31dbdc7f),
1407 X(0x31ebb48e), X(0x31fb8d74), X(0x320b6733), X(0x321b41c7),
1408 X(0x322b1d31), X(0x323af96e), X(0x324ad67e), X(0x325ab45f),
1409 X(0x326a9311), X(0x327a7291), X(0x328a52e0), X(0x329a33fb),
1410 X(0x32aa15e1), X(0x32b9f892), X(0x32c9dc0c), X(0x32d9c04d),
1411 X(0x32e9a555), X(0x32f98b22), X(0x330971b4), X(0x33195909),
1412 X(0x3329411f), X(0x333929f6), X(0x3349138c), X(0x3358fde1),
1413 X(0x3368e8f2), X(0x3378d4c0), X(0x3388c147), X(0x3398ae89),
1414 X(0x33a89c82), X(0x33b88b32), X(0x33c87a98), X(0x33d86ab2),
1415 X(0x33e85b80), X(0x33f84d00), X(0x34083f30), X(0x34183210),
1416 X(0x3428259f), X(0x343819db), X(0x34480ec3), X(0x34580455),
1417 X(0x3467fa92), X(0x3477f176), X(0x3487e902), X(0x3497e134),
1418 X(0x34a7da0a), X(0x34b7d384), X(0x34c7cda0), X(0x34d7c85e),
1419 X(0x34e7c3bb), X(0x34f7bfb7), X(0x3507bc50), X(0x3517b985),
1420 X(0x3527b756), X(0x3537b5c0), X(0x3547b4c3), X(0x3557b45d),
1421 X(0x3567b48d), X(0x3577b552), X(0x3587b6aa), X(0x3597b895),
1422 X(0x35a7bb12), X(0x35b7be1e), X(0x35c7c1b9), X(0x35d7c5e1),
1423 X(0x35e7ca96), X(0x35f7cfd6), X(0x3607d5a0), X(0x3617dbf3),
1424 X(0x3627e2cd), X(0x3637ea2d), X(0x3647f212), X(0x3657fa7b),
1425 X(0x36680366), X(0x36780cd2), X(0x368816bf), X(0x3698212b),
1426 X(0x36a82c14), X(0x36b83779), X(0x36c8435a), X(0x36d84fb4),
1427 X(0x36e85c88), X(0x36f869d2), X(0x37087793), X(0x371885c9),
1428 X(0x37289473), X(0x3738a38f), X(0x3748b31d), X(0x3758c31a),
1429 X(0x3768d387), X(0x3778e461), X(0x3788f5a7), X(0x37990759),
1430 X(0x37a91975), X(0x37b92bf9), X(0x37c93ee4), X(0x37d95236),
1431 X(0x37e965ed), X(0x37f97a08), X(0x38098e85), X(0x3819a363),
1432 X(0x3829b8a2), X(0x3839ce3f), X(0x3849e43a), X(0x3859fa91),
1433 X(0x386a1143), X(0x387a284f), X(0x388a3fb4), X(0x389a5770),
1434 X(0x38aa6f83), X(0x38ba87ea), X(0x38caa0a5), X(0x38dab9b2),
1435 X(0x38ead311), X(0x38faecbf), X(0x390b06bc), X(0x391b2107),
1436 X(0x392b3b9e), X(0x393b5680), X(0x394b71ac), X(0x395b8d20),
1437 X(0x396ba8dc), X(0x397bc4dd), X(0x398be124), X(0x399bfdae),
1438 X(0x39ac1a7a), X(0x39bc3788), X(0x39cc54d5), X(0x39dc7261),
1439 X(0x39ec902a), X(0x39fcae2f), X(0x3a0ccc70), X(0x3a1ceaea),
1440 X(0x3a2d099c), X(0x3a3d2885), X(0x3a4d47a5), X(0x3a5d66f9),
1441 X(0x3a6d8680), X(0x3a7da63a), X(0x3a8dc625), X(0x3a9de63f),
1442 X(0x3aae0688), X(0x3abe26fe), X(0x3ace47a0), X(0x3ade686d),
1443 X(0x3aee8963), X(0x3afeaa82), X(0x3b0ecbc7), X(0x3b1eed32),
1444 X(0x3b2f0ec2), X(0x3b3f3075), X(0x3b4f524a), X(0x3b5f7440),
1445 X(0x3b6f9656), X(0x3b7fb889), X(0x3b8fdada), X(0x3b9ffd46),
1446 X(0x3bb01fce), X(0x3bc0426e), X(0x3bd06526), X(0x3be087f6),
1447 X(0x3bf0aada), X(0x3c00cdd4), X(0x3c10f0e0), X(0x3c2113fe),
1448 X(0x3c31372d), X(0x3c415a6b), X(0x3c517db7), X(0x3c61a110),
1449 X(0x3c71c475), X(0x3c81e7e4), X(0x3c920b5c), X(0x3ca22edc),
1450 X(0x3cb25262), X(0x3cc275ee), X(0x3cd2997e), X(0x3ce2bd11),
1451 X(0x3cf2e0a6), X(0x3d03043b), X(0x3d1327cf), X(0x3d234b61),
1452 X(0x3d336ef0), X(0x3d43927a), X(0x3d53b5ff), X(0x3d63d97c),
1453 X(0x3d73fcf1), X(0x3d84205c), X(0x3d9443bd), X(0x3da46711),
1454 X(0x3db48a58), X(0x3dc4ad91), X(0x3dd4d0ba), X(0x3de4f3d1),
1455 X(0x3df516d7), X(0x3e0539c9), X(0x3e155ca6), X(0x3e257f6d),
1456 X(0x3e35a21d), X(0x3e45c4b4), X(0x3e55e731), X(0x3e660994),
1457 X(0x3e762bda), X(0x3e864e03), X(0x3e96700d), X(0x3ea691f7),
1458 X(0x3eb6b3bf), X(0x3ec6d565), X(0x3ed6f6e8), X(0x3ee71845),
1459 X(0x3ef7397c), X(0x3f075a8c), X(0x3f177b73), X(0x3f279c30),
1460 X(0x3f37bcc2), X(0x3f47dd27), X(0x3f57fd5f), X(0x3f681d68),
1461 X(0x3f783d40), X(0x3f885ce7), X(0x3f987c5c), X(0x3fa89b9c),
1462 X(0x3fb8baa7), X(0x3fc8d97c), X(0x3fd8f819), X(0x3fe9167e),
1463 X(0x3ff934a8), X(0x40095296), X(0x40197049), X(0x40298dbd),
1464 X(0x4039aaf2), X(0x4049c7e7), X(0x4059e49a), X(0x406a010a),
1465 X(0x407a1d36), X(0x408a391d), X(0x409a54bd), X(0x40aa7015),
1466 X(0x40ba8b25), X(0x40caa5ea), X(0x40dac063), X(0x40eada90),
1467 X(0x40faf46e), X(0x410b0dfe), X(0x411b273d), X(0x412b402a),
1468 X(0x413b58c4), X(0x414b710a), X(0x415b88fa), X(0x416ba093),
1469 X(0x417bb7d5), X(0x418bcebe), X(0x419be54c), X(0x41abfb7e),
1470 X(0x41bc1153), X(0x41cc26ca), X(0x41dc3be2), X(0x41ec5099),
1471 X(0x41fc64ef), X(0x420c78e1), X(0x421c8c6f), X(0x422c9f97),
1472 X(0x423cb258), X(0x424cc4b2), X(0x425cd6a2), X(0x426ce827),
1473 X(0x427cf941), X(0x428d09ee), X(0x429d1a2c), X(0x42ad29fb),
1474 X(0x42bd3959), X(0x42cd4846), X(0x42dd56bf), X(0x42ed64c3),
1475 X(0x42fd7252), X(0x430d7f6a), X(0x431d8c0a), X(0x432d9831),
1476 X(0x433da3dd), X(0x434daf0d), X(0x435db9c0), X(0x436dc3f5),
1477 X(0x437dcdab), X(0x438dd6df), X(0x439ddf92), X(0x43ade7c1),
1478 X(0x43bdef6c), X(0x43cdf691), X(0x43ddfd2f), X(0x43ee0345),
1479 X(0x43fe08d2), X(0x440e0dd4), X(0x441e124b), X(0x442e1634),
1480 X(0x443e198f), X(0x444e1c5a), X(0x445e1e95), X(0x446e203e),
1481 X(0x447e2153), X(0x448e21d5), X(0x449e21c0), X(0x44ae2115),
1482 X(0x44be1fd1), X(0x44ce1df4), X(0x44de1b7d), X(0x44ee186a),
1483 X(0x44fe14ba), X(0x450e106b), X(0x451e0b7e), X(0x452e05ef),
1484 X(0x453dffbf), X(0x454df8eb), X(0x455df173), X(0x456de956),
1485 X(0x457de092), X(0x458dd726), X(0x459dcd10), X(0x45adc251),
1486 X(0x45bdb6e5), X(0x45cdaacd), X(0x45dd9e06), X(0x45ed9091),
1487 X(0x45fd826a), X(0x460d7392), X(0x461d6407), X(0x462d53c8),
1488 X(0x463d42d4), X(0x464d3129), X(0x465d1ec6), X(0x466d0baa),
1489 X(0x467cf7d3), X(0x468ce342), X(0x469ccdf3), X(0x46acb7e7),
1490 X(0x46bca11c), X(0x46cc8990), X(0x46dc7143), X(0x46ec5833),
1491 X(0x46fc3e5f), X(0x470c23c6), X(0x471c0867), X(0x472bec40),
1492 X(0x473bcf50), X(0x474bb196), X(0x475b9311), X(0x476b73c0),
1493 X(0x477b53a1), X(0x478b32b4), X(0x479b10f6), X(0x47aaee67),
1494 X(0x47bacb06), X(0x47caa6d1), X(0x47da81c7), X(0x47ea5be7),
1495 X(0x47fa3530), X(0x480a0da1), X(0x4819e537), X(0x4829bbf3),
1496 X(0x483991d3), X(0x484966d6), X(0x48593afb), X(0x48690e3f),
1497 X(0x4878e0a3), X(0x4888b225), X(0x489882c4), X(0x48a8527e),
1498 X(0x48b82153), X(0x48c7ef41), X(0x48d7bc47), X(0x48e78863),
1499 X(0x48f75396), X(0x49071ddc), X(0x4916e736), X(0x4926afa2),
1500 X(0x4936771f), X(0x49463dac), X(0x49560347), X(0x4965c7ef),
1501 X(0x49758ba4), X(0x49854e63), X(0x4995102c), X(0x49a4d0fe),
1502 X(0x49b490d7), X(0x49c44fb6), X(0x49d40d9a), X(0x49e3ca82),
1503 X(0x49f3866c), X(0x4a034159), X(0x4a12fb45), X(0x4a22b430),
1504 X(0x4a326c19), X(0x4a4222ff), X(0x4a51d8e1), X(0x4a618dbd),
1505 X(0x4a714192), X(0x4a80f45f), X(0x4a90a623), X(0x4aa056dd),
1506 X(0x4ab0068b), X(0x4abfb52c), X(0x4acf62c0), X(0x4adf0f44),
1507 X(0x4aeebab9), X(0x4afe651c), X(0x4b0e0e6c), X(0x4b1db6a9),
1508 X(0x4b2d5dd1), X(0x4b3d03e2), X(0x4b4ca8dd), X(0x4b5c4cbf),
1509 X(0x4b6bef88), X(0x4b7b9136), X(0x4b8b31c8), X(0x4b9ad13d),
1510 X(0x4baa6f93), X(0x4bba0ccb), X(0x4bc9a8e2), X(0x4bd943d7),
1511 X(0x4be8dda9), X(0x4bf87658), X(0x4c080de1), X(0x4c17a444),
1512 X(0x4c27397f), X(0x4c36cd92), X(0x4c46607b), X(0x4c55f239),
1513 X(0x4c6582cb), X(0x4c75122f), X(0x4c84a065), X(0x4c942d6c),
1514 X(0x4ca3b942), X(0x4cb343e6), X(0x4cc2cd57), X(0x4cd25594),
1515 X(0x4ce1dc9c), X(0x4cf1626d), X(0x4d00e707), X(0x4d106a68),
1516 X(0x4d1fec8f), X(0x4d2f6d7a), X(0x4d3eed2a), X(0x4d4e6b9d),
1517 X(0x4d5de8d1), X(0x4d6d64c5), X(0x4d7cdf79), X(0x4d8c58eb),
1518 X(0x4d9bd11a), X(0x4dab4804), X(0x4dbabdaa), X(0x4dca3209),
1519 X(0x4dd9a520), X(0x4de916ef), X(0x4df88774), X(0x4e07f6ae),
1520 X(0x4e17649c), X(0x4e26d13c), X(0x4e363c8f), X(0x4e45a692),
1521 X(0x4e550f44), X(0x4e6476a4), X(0x4e73dcb2), X(0x4e83416c),
1522 X(0x4e92a4d1), X(0x4ea206df), X(0x4eb16796), X(0x4ec0c6f5),
1523 X(0x4ed024fa), X(0x4edf81a5), X(0x4eeedcf3), X(0x4efe36e5),
1524 X(0x4f0d8f79), X(0x4f1ce6ad), X(0x4f2c3c82), X(0x4f3b90f4),
1525 X(0x4f4ae405), X(0x4f5a35b1), X(0x4f6985fa), X(0x4f78d4dc),
1526 X(0x4f882257), X(0x4f976e6a), X(0x4fa6b914), X(0x4fb60254),
1527 X(0x4fc54a28), X(0x4fd49090), X(0x4fe3d58b), X(0x4ff31917),
1528 X(0x50025b33), X(0x50119bde), X(0x5020db17), X(0x503018dd),
1529 X(0x503f552f), X(0x504e900b), X(0x505dc971), X(0x506d0160),
1530 X(0x507c37d7), X(0x508b6cd3), X(0x509aa055), X(0x50a9d25b),
1531 X(0x50b902e4), X(0x50c831ef), X(0x50d75f7b), X(0x50e68b87),
1532 X(0x50f5b612), X(0x5104df1a), X(0x5114069f), X(0x51232ca0),
1533 X(0x5132511a), X(0x5141740f), X(0x5150957b), X(0x515fb55f),
1534 X(0x516ed3b8), X(0x517df087), X(0x518d0bca), X(0x519c257f),
1535 X(0x51ab3da7), X(0x51ba543f), X(0x51c96947), X(0x51d87cbd),
1536 X(0x51e78ea1), X(0x51f69ef1), X(0x5205adad), X(0x5214bad3),
1537 X(0x5223c662), X(0x5232d05a), X(0x5241d8b9), X(0x5250df7d),
1538 X(0x525fe4a7), X(0x526ee835), X(0x527dea26), X(0x528cea78),
1539 X(0x529be92c), X(0x52aae63f), X(0x52b9e1b0), X(0x52c8db80),
1540 X(0x52d7d3ac), X(0x52e6ca33), X(0x52f5bf15), X(0x5304b251),
1541 X(0x5313a3e5), X(0x532293d0), X(0x53318212), X(0x53406ea8),
1542 X(0x534f5993), X(0x535e42d2), X(0x536d2a62), X(0x537c1043),
1543 X(0x538af475), X(0x5399d6f6), X(0x53a8b7c4), X(0x53b796e0),
1544 X(0x53c67447), X(0x53d54ffa), X(0x53e429f6), X(0x53f3023b),
1545 X(0x5401d8c8), X(0x5410ad9c), X(0x541f80b5), X(0x542e5213),
1546 X(0x543d21b5), X(0x544bef9a), X(0x545abbc0), X(0x54698627),
1547 X(0x54784ece), X(0x548715b3), X(0x5495dad6), X(0x54a49e35),
1548 X(0x54b35fd0), X(0x54c21fa6), X(0x54d0ddb5), X(0x54df99fd),
1549 X(0x54ee547c), X(0x54fd0d32), X(0x550bc41d), X(0x551a793d),
1550 X(0x55292c91), X(0x5537de16), X(0x55468dce), X(0x55553bb6),
1551 X(0x5563e7cd), X(0x55729213), X(0x55813a87), X(0x558fe127),
1552 X(0x559e85f2), X(0x55ad28e9), X(0x55bbca08), X(0x55ca6950),
1553 X(0x55d906c0), X(0x55e7a257), X(0x55f63c13), X(0x5604d3f4),
1554 X(0x561369f8), X(0x5621fe1f), X(0x56309067), X(0x563f20d1),
1555 X(0x564daf5a), X(0x565c3c02), X(0x566ac6c7), X(0x56794faa),
1556 X(0x5687d6a8), X(0x56965bc1), X(0x56a4def4), X(0x56b36040),
1557 X(0x56c1dfa4), X(0x56d05d1f), X(0x56ded8af), X(0x56ed5255),
1558 X(0x56fbca0f), X(0x570a3fdc), X(0x5718b3bc), X(0x572725ac),
1559 X(0x573595ad), X(0x574403bd), X(0x57526fdb), X(0x5760da07),
1560 X(0x576f423f), X(0x577da883), X(0x578c0cd1), X(0x579a6f29),
1561 X(0x57a8cf8a), X(0x57b72df2), X(0x57c58a61), X(0x57d3e4d6),
1562 X(0x57e23d50), X(0x57f093cd), X(0x57fee84e), X(0x580d3ad1),
1563 X(0x581b8b54), X(0x5829d9d8), X(0x5838265c), X(0x584670dd),
1564 X(0x5854b95c), X(0x5862ffd8), X(0x5871444f), X(0x587f86c1),
1565 X(0x588dc72c), X(0x589c0591), X(0x58aa41ed), X(0x58b87c40),
1566 X(0x58c6b489), X(0x58d4eac7), X(0x58e31ef9), X(0x58f1511f),
1567 X(0x58ff8137), X(0x590daf40), X(0x591bdb3a), X(0x592a0524),
1568 X(0x59382cfc), X(0x594652c2), X(0x59547675), X(0x59629815),
1569 X(0x5970b79f), X(0x597ed513), X(0x598cf071), X(0x599b09b7),
1570 X(0x59a920e5), X(0x59b735f9), X(0x59c548f4), X(0x59d359d2),
1571 X(0x59e16895), X(0x59ef753b), X(0x59fd7fc4), X(0x5a0b882d),
1572 X(0x5a198e77), X(0x5a2792a0), X(0x5a3594a9), X(0x5a43948e),
1573 X(0x5a519251), X(0x5a5f8df0), X(0x5a6d876a), X(0x5a7b7ebe),
1574 X(0x5a8973ec), X(0x5a9766f2), X(0x5aa557d0), X(0x5ab34685),
1575 X(0x5ac1330f), X(0x5acf1d6f), X(0x5add05a3), X(0x5aeaebaa),
1576 X(0x5af8cf84), X(0x5b06b12f), X(0x5b1490ab), X(0x5b226df7),
1577 X(0x5b304912), X(0x5b3e21fc), X(0x5b4bf8b2), X(0x5b59cd35),
1578 X(0x5b679f84), X(0x5b756f9e), X(0x5b833d82), X(0x5b91092e),
1579 X(0x5b9ed2a3), X(0x5bac99e0), X(0x5bba5ee3), X(0x5bc821ac),
1580 X(0x5bd5e23a), X(0x5be3a08c), X(0x5bf15ca1), X(0x5bff1679),
1581 X(0x5c0cce12), X(0x5c1a836c), X(0x5c283686), X(0x5c35e760),
1582 X(0x5c4395f7), X(0x5c51424c), X(0x5c5eec5e), X(0x5c6c942b),
1583 X(0x5c7a39b4), X(0x5c87dcf7), X(0x5c957df3), X(0x5ca31ca8),
1584 X(0x5cb0b915), X(0x5cbe5338), X(0x5ccbeb12), X(0x5cd980a1),
1585 X(0x5ce713e5), X(0x5cf4a4dd), X(0x5d023387), X(0x5d0fbfe4),
1586 X(0x5d1d49f2), X(0x5d2ad1b1), X(0x5d38571f), X(0x5d45da3c),
1587 X(0x5d535b08), X(0x5d60d981), X(0x5d6e55a7), X(0x5d7bcf78),
1588 X(0x5d8946f5), X(0x5d96bc1c), X(0x5da42eec), X(0x5db19f65),
1589 X(0x5dbf0d86), X(0x5dcc794e), X(0x5dd9e2bd), X(0x5de749d1),
1590 X(0x5df4ae8a), X(0x5e0210e7), X(0x5e0f70e7), X(0x5e1cce8a),
1591 X(0x5e2a29ce), X(0x5e3782b4), X(0x5e44d93a), X(0x5e522d5f),
1592 X(0x5e5f7f23), X(0x5e6cce85), X(0x5e7a1b85), X(0x5e876620),
1593 X(0x5e94ae58), X(0x5ea1f42a), X(0x5eaf3797), X(0x5ebc789d),
1594 X(0x5ec9b73c), X(0x5ed6f372), X(0x5ee42d41), X(0x5ef164a5),
1595 X(0x5efe999f), X(0x5f0bcc2f), X(0x5f18fc52), X(0x5f262a09),
1596 X(0x5f335553), X(0x5f407e2f), X(0x5f4da49d), X(0x5f5ac89b),
1597 X(0x5f67ea29), X(0x5f750946), X(0x5f8225f2), X(0x5f8f402b),
1598 X(0x5f9c57f2), X(0x5fa96d44), X(0x5fb68023), X(0x5fc3908c),
1599 X(0x5fd09e7f), X(0x5fdda9fc), X(0x5feab302), X(0x5ff7b990),
1600 X(0x6004bda5), X(0x6011bf40), X(0x601ebe62), X(0x602bbb09),
1601 X(0x6038b534), X(0x6045ace4), X(0x6052a216), X(0x605f94cb),
1602 X(0x606c8502), X(0x607972b9), X(0x60865df2), X(0x609346aa),
1603 X(0x60a02ce1), X(0x60ad1096), X(0x60b9f1c9), X(0x60c6d079),
1604 X(0x60d3aca5), X(0x60e0864d), X(0x60ed5d70), X(0x60fa320d),
1605 X(0x61070424), X(0x6113d3b4), X(0x6120a0bc), X(0x612d6b3c),
1606 X(0x613a3332), X(0x6146f89f), X(0x6153bb82), X(0x61607bd9),
1607 X(0x616d39a5), X(0x6179f4e5), X(0x6186ad98), X(0x619363bd),
1608 X(0x61a01753), X(0x61acc85b), X(0x61b976d3), X(0x61c622bc),
1609 X(0x61d2cc13), X(0x61df72d8), X(0x61ec170c), X(0x61f8b8ad),
1610 X(0x620557ba), X(0x6211f434), X(0x621e8e18), X(0x622b2568),
1611 X(0x6237ba21), X(0x62444c44), X(0x6250dbd0), X(0x625d68c4),
1612 X(0x6269f320), X(0x62767ae2), X(0x6283000b), X(0x628f829a),
1613 X(0x629c028e), X(0x62a87fe6), X(0x62b4faa2), X(0x62c172c2),
1614 X(0x62cde844), X(0x62da5b29), X(0x62e6cb6e), X(0x62f33915),
1615 X(0x62ffa41c), X(0x630c0c83), X(0x63187248), X(0x6324d56d),
1616 X(0x633135ef), X(0x633d93ce), X(0x6349ef0b), X(0x635647a3),
1617 X(0x63629d97), X(0x636ef0e6), X(0x637b418f), X(0x63878f92),
1618 X(0x6393daef), X(0x63a023a4), X(0x63ac69b1), X(0x63b8ad15),
1619 X(0x63c4edd1), X(0x63d12be3), X(0x63dd674b), X(0x63e9a008),
1620 X(0x63f5d61a), X(0x64020980), X(0x640e3a39), X(0x641a6846),
1621 X(0x642693a5), X(0x6432bc56), X(0x643ee258), X(0x644b05ab),
1622 X(0x6457264e), X(0x64634441), X(0x646f5f83), X(0x647b7814),
1623 X(0x64878df3), X(0x6493a120), X(0x649fb199), X(0x64abbf5f),
1624 X(0x64b7ca71), X(0x64c3d2ce), X(0x64cfd877), X(0x64dbdb69),
1625 X(0x64e7dba6), X(0x64f3d92b), X(0x64ffd3fa), X(0x650bcc11),
1626 X(0x6517c16f), X(0x6523b415), X(0x652fa402), X(0x653b9134),
1627 X(0x65477bad), X(0x6553636a), X(0x655f486d), X(0x656b2ab3),
1628 X(0x65770a3d), X(0x6582e70a), X(0x658ec11a), X(0x659a986d),
1629 X(0x65a66d00), X(0x65b23ed5), X(0x65be0deb), X(0x65c9da41),
1630 X(0x65d5a3d7), X(0x65e16aac), X(0x65ed2ebf), X(0x65f8f011),
1631 X(0x6604aea1), X(0x66106a6e), X(0x661c2377), X(0x6627d9be),
1632 X(0x66338d40), X(0x663f3dfd), X(0x664aebf5), X(0x66569728),
1633 X(0x66623f95), X(0x666de53b), X(0x6679881b), X(0x66852833),
1634 X(0x6690c583), X(0x669c600b), X(0x66a7f7ca), X(0x66b38cc0),
1635 X(0x66bf1eec), X(0x66caae4f), X(0x66d63ae6), X(0x66e1c4b3),
1636 X(0x66ed4bb4), X(0x66f8cfea), X(0x67045153), X(0x670fcfef),
1637 X(0x671b4bbe), X(0x6726c4bf), X(0x67323af3), X(0x673dae58),
1638 X(0x67491eee), X(0x67548cb5), X(0x675ff7ab), X(0x676b5fd2),
1639 X(0x6776c528), X(0x678227ad), X(0x678d8761), X(0x6798e443),
1640 X(0x67a43e52), X(0x67af958f), X(0x67bae9f9), X(0x67c63b8f),
1641 X(0x67d18a52), X(0x67dcd640), X(0x67e81f59), X(0x67f3659d),
1642 X(0x67fea90c), X(0x6809e9a5), X(0x68152768), X(0x68206254),
1643 X(0x682b9a68), X(0x6836cfa6), X(0x6842020b), X(0x684d3199),
1644 X(0x68585e4d), X(0x68638829), X(0x686eaf2b), X(0x6879d354),
1645 X(0x6884f4a2), X(0x68901316), X(0x689b2eb0), X(0x68a6476d),
1646 X(0x68b15d50), X(0x68bc7056), X(0x68c78080), X(0x68d28dcd),
1647 X(0x68dd983e), X(0x68e89fd0), X(0x68f3a486), X(0x68fea65d),
1648 X(0x6909a555), X(0x6914a16f), X(0x691f9aa9), X(0x692a9104),
1649 X(0x69358480), X(0x6940751b), X(0x694b62d5), X(0x69564daf),
1650 X(0x696135a7), X(0x696c1abe), X(0x6976fcf3), X(0x6981dc46),
1651 X(0x698cb8b6), X(0x69979243), X(0x69a268ed), X(0x69ad3cb4),
1652 X(0x69b80d97), X(0x69c2db96), X(0x69cda6b0), X(0x69d86ee5),
1653 X(0x69e33436), X(0x69edf6a1), X(0x69f8b626), X(0x6a0372c5),
1654 X(0x6a0e2c7e), X(0x6a18e350), X(0x6a23973c), X(0x6a2e4840),
1655 X(0x6a38f65d), X(0x6a43a191), X(0x6a4e49de), X(0x6a58ef42),
1656 X(0x6a6391be), X(0x6a6e3151), X(0x6a78cdfa), X(0x6a8367ba),
1657 X(0x6a8dfe90), X(0x6a98927c), X(0x6aa3237d), X(0x6aadb194),
1658 X(0x6ab83cc0), X(0x6ac2c500), X(0x6acd4a55), X(0x6ad7ccbf),
1659 X(0x6ae24c3c), X(0x6aecc8cd), X(0x6af74271), X(0x6b01b929),
1660 X(0x6b0c2cf4), X(0x6b169dd1), X(0x6b210bc1), X(0x6b2b76c2),
1661 X(0x6b35ded6), X(0x6b4043fc), X(0x6b4aa632), X(0x6b55057a),
1662 X(0x6b5f61d3), X(0x6b69bb3d), X(0x6b7411b7), X(0x6b7e6541),
1663 X(0x6b88b5db), X(0x6b930385), X(0x6b9d4e3f), X(0x6ba79607),
1664 X(0x6bb1dadf), X(0x6bbc1cc6), X(0x6bc65bbb), X(0x6bd097bf),
1665 X(0x6bdad0d0), X(0x6be506f0), X(0x6bef3a1d), X(0x6bf96a58),
1666 X(0x6c0397a0), X(0x6c0dc1f5), X(0x6c17e957), X(0x6c220dc6),
1667 X(0x6c2c2f41), X(0x6c364dc9), X(0x6c40695c), X(0x6c4a81fc),
1668 X(0x6c5497a7), X(0x6c5eaa5d), X(0x6c68ba1f), X(0x6c72c6eb),
1669 X(0x6c7cd0c3), X(0x6c86d7a6), X(0x6c90db92), X(0x6c9adc8a),
1670 X(0x6ca4da8b), X(0x6caed596), X(0x6cb8cdab), X(0x6cc2c2ca),
1671 X(0x6cccb4f2), X(0x6cd6a424), X(0x6ce0905e), X(0x6cea79a1),
1672 X(0x6cf45fee), X(0x6cfe4342), X(0x6d0823a0), X(0x6d120105),
1673 X(0x6d1bdb73), X(0x6d25b2e8), X(0x6d2f8765), X(0x6d3958ea),
1674 X(0x6d432777), X(0x6d4cf30a), X(0x6d56bba5), X(0x6d608147),
1675 X(0x6d6a43f0), X(0x6d7403a0), X(0x6d7dc056), X(0x6d877a13),
1676 X(0x6d9130d6), X(0x6d9ae4a0), X(0x6da4956f), X(0x6dae4345),
1677 X(0x6db7ee20), X(0x6dc19601), X(0x6dcb3ae7), X(0x6dd4dcd3),
1678 X(0x6dde7bc4), X(0x6de817bb), X(0x6df1b0b6), X(0x6dfb46b7),
1679 X(0x6e04d9bc), X(0x6e0e69c7), X(0x6e17f6d5), X(0x6e2180e9),
1680 X(0x6e2b0801), X(0x6e348c1d), X(0x6e3e0d3d), X(0x6e478b62),
1681 X(0x6e51068a), X(0x6e5a7eb7), X(0x6e63f3e7), X(0x6e6d661b),
1682 X(0x6e76d552), X(0x6e80418e), X(0x6e89aacc), X(0x6e93110f),
1683 X(0x6e9c7454), X(0x6ea5d49d), X(0x6eaf31e9), X(0x6eb88c37),
1684 X(0x6ec1e389), X(0x6ecb37de), X(0x6ed48936), X(0x6eddd790),
1685 X(0x6ee722ee), X(0x6ef06b4d), X(0x6ef9b0b0), X(0x6f02f315),
1686 X(0x6f0c327c), X(0x6f156ee6), X(0x6f1ea852), X(0x6f27dec1),
1687 X(0x6f311232), X(0x6f3a42a5), X(0x6f43701a), X(0x6f4c9a91),
1688 X(0x6f55c20a), X(0x6f5ee686), X(0x6f680803), X(0x6f712682),
1689 X(0x6f7a4203), X(0x6f835a86), X(0x6f8c700b), X(0x6f958291),
1690 X(0x6f9e921a), X(0x6fa79ea4), X(0x6fb0a830), X(0x6fb9aebd),
1691 X(0x6fc2b24c), X(0x6fcbb2dd), X(0x6fd4b06f), X(0x6fddab03),
1692 X(0x6fe6a299), X(0x6fef9730), X(0x6ff888c9), X(0x70017763),
1693 X(0x700a62ff), X(0x70134b9c), X(0x701c313b), X(0x702513dc),
1694 X(0x702df37e), X(0x7036d021), X(0x703fa9c6), X(0x7048806d),
1695 X(0x70515415), X(0x705a24bf), X(0x7062f26b), X(0x706bbd17),
1696 X(0x707484c6), X(0x707d4976), X(0x70860b28), X(0x708ec9dc),
1697 X(0x70978591), X(0x70a03e48), X(0x70a8f400), X(0x70b1a6bb),
1698 X(0x70ba5677), X(0x70c30335), X(0x70cbacf5), X(0x70d453b6),
1699 X(0x70dcf77a), X(0x70e59840), X(0x70ee3607), X(0x70f6d0d1),
1700 X(0x70ff689d), X(0x7107fd6b), X(0x71108f3b), X(0x71191e0d),
1701 X(0x7121a9e2), X(0x712a32b9), X(0x7132b892), X(0x713b3b6e),
1702 X(0x7143bb4c), X(0x714c382d), X(0x7154b211), X(0x715d28f7),
1703 X(0x71659ce0), X(0x716e0dcc), X(0x71767bbb), X(0x717ee6ac),
1704 X(0x71874ea1), X(0x718fb399), X(0x71981594), X(0x71a07493),
1705 X(0x71a8d094), X(0x71b1299a), X(0x71b97fa2), X(0x71c1d2af),
1706 X(0x71ca22bf), X(0x71d26fd2), X(0x71dab9ea), X(0x71e30106),
1707 X(0x71eb4526), X(0x71f3864a), X(0x71fbc472), X(0x7203ff9e),
1708 X(0x720c37cf), X(0x72146d05), X(0x721c9f3f), X(0x7224ce7e),
1709 X(0x722cfac2), X(0x7235240b), X(0x723d4a59), X(0x72456dad),
1710 X(0x724d8e05), X(0x7255ab63), X(0x725dc5c7), X(0x7265dd31),
1711 X(0x726df1a0), X(0x72760315), X(0x727e1191), X(0x72861d12),
1712 X(0x728e259a), X(0x72962b28), X(0x729e2dbd), X(0x72a62d59),
1713 X(0x72ae29fc), X(0x72b623a5), X(0x72be1a56), X(0x72c60e0e),
1714 X(0x72cdfece), X(0x72d5ec95), X(0x72ddd764), X(0x72e5bf3b),
1715 X(0x72eda41a), X(0x72f58601), X(0x72fd64f1), X(0x730540e9),
1716 X(0x730d19e9), X(0x7314eff3), X(0x731cc305), X(0x73249321),
1717 X(0x732c6046), X(0x73342a75), X(0x733bf1ad), X(0x7343b5ef),
1718 X(0x734b773b), X(0x73533591), X(0x735af0f2), X(0x7362a95d),
1719 X(0x736a5ed3), X(0x73721153), X(0x7379c0df), X(0x73816d76),
1720 X(0x73891719), X(0x7390bdc7), X(0x73986181), X(0x73a00247),
1721 X(0x73a7a01a), X(0x73af3af8), X(0x73b6d2e4), X(0x73be67dc),
1722 X(0x73c5f9e1), X(0x73cd88f3), X(0x73d51513), X(0x73dc9e40),
1723 X(0x73e4247c), X(0x73eba7c5), X(0x73f3281c), X(0x73faa582),
1724 X(0x74021ff7), X(0x7409977b), X(0x74110c0d), X(0x74187daf),
1725 X(0x741fec61), X(0x74275822), X(0x742ec0f3), X(0x743626d5),
1726 X(0x743d89c7), X(0x7444e9c9), X(0x744c46dd), X(0x7453a101),
1727 X(0x745af837), X(0x74624c7f), X(0x74699dd8), X(0x7470ec44),
1728 X(0x747837c2), X(0x747f8052), X(0x7486c5f5), X(0x748e08ac),
1729 X(0x74954875), X(0x749c8552), X(0x74a3bf43), X(0x74aaf648),
1730 X(0x74b22a62), X(0x74b95b90), X(0x74c089d2), X(0x74c7b52a),
1731 X(0x74cedd97), X(0x74d6031a), X(0x74dd25b2), X(0x74e44561),
1732 X(0x74eb6226), X(0x74f27c02), X(0x74f992f5), X(0x7500a6ff),
1733 X(0x7507b820), X(0x750ec659), X(0x7515d1aa), X(0x751cda14),
1734 X(0x7523df96), X(0x752ae231), X(0x7531e1e5), X(0x7538deb2),
1735 X(0x753fd89a), X(0x7546cf9b), X(0x754dc3b7), X(0x7554b4ed),
1736 X(0x755ba33e), X(0x75628eaa), X(0x75697732), X(0x75705cd5),
1737 X(0x75773f95), X(0x757e1f71), X(0x7584fc6a), X(0x758bd67f),
1738 X(0x7592adb2), X(0x75998203), X(0x75a05371), X(0x75a721fe),
1739 X(0x75adeda9), X(0x75b4b673), X(0x75bb7c5c), X(0x75c23f65),
1740 X(0x75c8ff8d), X(0x75cfbcd6), X(0x75d6773f), X(0x75dd2ec8),
1741 X(0x75e3e373), X(0x75ea953f), X(0x75f1442d), X(0x75f7f03d),
1742 X(0x75fe996f), X(0x76053fc5), X(0x760be33d), X(0x761283d8),
1743 X(0x76192197), X(0x761fbc7b), X(0x76265482), X(0x762ce9af),
1744 X(0x76337c01), X(0x763a0b78), X(0x76409814), X(0x764721d7),
1745 X(0x764da8c1), X(0x76542cd1), X(0x765aae08), X(0x76612c67),
1746 X(0x7667a7ee), X(0x766e209d), X(0x76749675), X(0x767b0975),
1747 X(0x7681799f), X(0x7687e6f3), X(0x768e5170), X(0x7694b918),
1748 X(0x769b1deb), X(0x76a17fe9), X(0x76a7df13), X(0x76ae3b68),
1749 X(0x76b494ea), X(0x76baeb98), X(0x76c13f74), X(0x76c7907c),
1750 X(0x76cddeb3), X(0x76d42a18), X(0x76da72ab), X(0x76e0b86d),
1751 X(0x76e6fb5e), X(0x76ed3b7f), X(0x76f378d0), X(0x76f9b352),
1752 X(0x76ffeb05), X(0x77061fe8), X(0x770c51fe), X(0x77128145),
1753 X(0x7718adbf), X(0x771ed76c), X(0x7724fe4c), X(0x772b225f),
1754 X(0x773143a7), X(0x77376223), X(0x773d7dd3), X(0x774396ba),
1755 X(0x7749acd5), X(0x774fc027), X(0x7755d0af), X(0x775bde6f),
1756 X(0x7761e965), X(0x7767f193), X(0x776df6fa), X(0x7773f998),
1757 X(0x7779f970), X(0x777ff681), X(0x7785f0cd), X(0x778be852),
1758 X(0x7791dd12), X(0x7797cf0d), X(0x779dbe43), X(0x77a3aab6),
1759 X(0x77a99465), X(0x77af7b50), X(0x77b55f79), X(0x77bb40e0),
1760 X(0x77c11f85), X(0x77c6fb68), X(0x77ccd48a), X(0x77d2aaec),
1761 X(0x77d87e8d), X(0x77de4f6f), X(0x77e41d92), X(0x77e9e8f5),
1762 X(0x77efb19b), X(0x77f57782), X(0x77fb3aad), X(0x7800fb1a),
1763 X(0x7806b8ca), X(0x780c73bf), X(0x78122bf7), X(0x7817e175),
1764 X(0x781d9438), X(0x78234440), X(0x7828f18f), X(0x782e9c25),
1765 X(0x78344401), X(0x7839e925), X(0x783f8b92), X(0x78452b46),
1766 X(0x784ac844), X(0x7850628b), X(0x7855fa1c), X(0x785b8ef8),
1767 X(0x7861211e), X(0x7866b090), X(0x786c3d4d), X(0x7871c757),
1768 X(0x78774ead), X(0x787cd351), X(0x78825543), X(0x7887d483),
1769 X(0x788d5111), X(0x7892caef), X(0x7898421c), X(0x789db69a),
1770 X(0x78a32868), X(0x78a89787), X(0x78ae03f8), X(0x78b36dbb),
1771 X(0x78b8d4d1), X(0x78be393a), X(0x78c39af6), X(0x78c8fa06),
1772 X(0x78ce566c), X(0x78d3b026), X(0x78d90736), X(0x78de5b9c),
1773 X(0x78e3ad58), X(0x78e8fc6c), X(0x78ee48d7), X(0x78f3929b),
1774 X(0x78f8d9b7), X(0x78fe1e2c), X(0x79035ffb), X(0x79089f24),
1775 X(0x790ddba8), X(0x79131587), X(0x79184cc2), X(0x791d8159),
1776 X(0x7922b34d), X(0x7927e29e), X(0x792d0f4d), X(0x7932395a),
1777 X(0x793760c6), X(0x793c8591), X(0x7941a7bd), X(0x7946c749),
1778 X(0x794be435), X(0x7950fe84), X(0x79561634), X(0x795b2b47),
1779 X(0x79603dbc), X(0x79654d96), X(0x796a5ad4), X(0x796f6576),
1780 X(0x79746d7e), X(0x797972eb), X(0x797e75bf), X(0x798375f9),
1781 X(0x7988739b), X(0x798d6ea5), X(0x79926717), X(0x79975cf2),
1782 X(0x799c5037), X(0x79a140e6), X(0x79a62f00), X(0x79ab1a85),
1783 X(0x79b00376), X(0x79b4e9d3), X(0x79b9cd9d), X(0x79beaed4),
1784 X(0x79c38d79), X(0x79c8698d), X(0x79cd4310), X(0x79d21a03),
1785 X(0x79d6ee66), X(0x79dbc03a), X(0x79e08f7f), X(0x79e55c36),
1786 X(0x79ea265f), X(0x79eeedfc), X(0x79f3b30c), X(0x79f87590),
1787 X(0x79fd3589), X(0x7a01f2f7), X(0x7a06addc), X(0x7a0b6636),
1788 X(0x7a101c08), X(0x7a14cf52), X(0x7a198013), X(0x7a1e2e4d),
1789 X(0x7a22da01), X(0x7a27832f), X(0x7a2c29d7), X(0x7a30cdfa),
1790 X(0x7a356f99), X(0x7a3a0eb4), X(0x7a3eab4c), X(0x7a434561),
1791 X(0x7a47dcf5), X(0x7a4c7207), X(0x7a510498), X(0x7a5594a9),
1792 X(0x7a5a223a), X(0x7a5ead4d), X(0x7a6335e0), X(0x7a67bbf6),
1793 X(0x7a6c3f8f), X(0x7a70c0ab), X(0x7a753f4b), X(0x7a79bb6f),
1794 X(0x7a7e3519), X(0x7a82ac48), X(0x7a8720fe), X(0x7a8b933b),
1795 X(0x7a9002ff), X(0x7a94704b), X(0x7a98db20), X(0x7a9d437e),
1796 X(0x7aa1a967), X(0x7aa60cd9), X(0x7aaa6dd7), X(0x7aaecc61),
1797 X(0x7ab32877), X(0x7ab7821b), X(0x7abbd94b), X(0x7ac02e0a),
1798 X(0x7ac48058), X(0x7ac8d035), X(0x7acd1da3), X(0x7ad168a1),
1799 X(0x7ad5b130), X(0x7ad9f751), X(0x7ade3b05), X(0x7ae27c4c),
1800 X(0x7ae6bb27), X(0x7aeaf796), X(0x7aef319a), X(0x7af36934),
1801 X(0x7af79e64), X(0x7afbd12c), X(0x7b00018a), X(0x7b042f81),
1802 X(0x7b085b10), X(0x7b0c8439), X(0x7b10aafc), X(0x7b14cf5a),
1803 X(0x7b18f153), X(0x7b1d10e8), X(0x7b212e1a), X(0x7b2548e9),
1804 X(0x7b296155), X(0x7b2d7761), X(0x7b318b0b), X(0x7b359c55),
1805 X(0x7b39ab3f), X(0x7b3db7cb), X(0x7b41c1f8), X(0x7b45c9c8),
1806 X(0x7b49cf3b), X(0x7b4dd251), X(0x7b51d30b), X(0x7b55d16b),
1807 X(0x7b59cd70), X(0x7b5dc71b), X(0x7b61be6d), X(0x7b65b366),
1808 X(0x7b69a608), X(0x7b6d9653), X(0x7b718447), X(0x7b756fe5),
1809 X(0x7b79592e), X(0x7b7d4022), X(0x7b8124c3), X(0x7b850710),
1810 X(0x7b88e70a), X(0x7b8cc4b3), X(0x7b90a00a), X(0x7b947911),
1811 X(0x7b984fc8), X(0x7b9c242f), X(0x7b9ff648), X(0x7ba3c612),
1812 X(0x7ba79390), X(0x7bab5ec1), X(0x7baf27a5), X(0x7bb2ee3f),
1813 X(0x7bb6b28e), X(0x7bba7493), X(0x7bbe344e), X(0x7bc1f1c1),
1814 X(0x7bc5acec), X(0x7bc965cf), X(0x7bcd1c6c), X(0x7bd0d0c3),
1815 X(0x7bd482d4), X(0x7bd832a1), X(0x7bdbe02a), X(0x7bdf8b70),
1816 X(0x7be33473), X(0x7be6db34), X(0x7bea7fb4), X(0x7bee21f4),
1817 X(0x7bf1c1f3), X(0x7bf55fb3), X(0x7bf8fb35), X(0x7bfc9479),
1818 X(0x7c002b7f), X(0x7c03c04a), X(0x7c0752d8), X(0x7c0ae32b),
1819 X(0x7c0e7144), X(0x7c11fd23), X(0x7c1586c9), X(0x7c190e36),
1820 X(0x7c1c936c), X(0x7c20166b), X(0x7c239733), X(0x7c2715c6),
1821 X(0x7c2a9224), X(0x7c2e0c4e), X(0x7c318444), X(0x7c34fa07),
1822 X(0x7c386d98), X(0x7c3bdef8), X(0x7c3f4e26), X(0x7c42bb25),
1823 X(0x7c4625f4), X(0x7c498e95), X(0x7c4cf507), X(0x7c50594c),
1824 X(0x7c53bb65), X(0x7c571b51), X(0x7c5a7913), X(0x7c5dd4aa),
1825 X(0x7c612e17), X(0x7c64855b), X(0x7c67da76), X(0x7c6b2d6a),
1826 X(0x7c6e7e37), X(0x7c71ccdd), X(0x7c75195e), X(0x7c7863ba),
1827 X(0x7c7babf1), X(0x7c7ef206), X(0x7c8235f7), X(0x7c8577c6),
1828 X(0x7c88b774), X(0x7c8bf502), X(0x7c8f306f), X(0x7c9269bd),
1829 X(0x7c95a0ec), X(0x7c98d5fe), X(0x7c9c08f2), X(0x7c9f39cb),
1830 X(0x7ca26887), X(0x7ca59528), X(0x7ca8bfb0), X(0x7cabe81d),
1831 X(0x7caf0e72), X(0x7cb232af), X(0x7cb554d4), X(0x7cb874e2),
1832 X(0x7cbb92db), X(0x7cbeaebe), X(0x7cc1c88d), X(0x7cc4e047),
1833 X(0x7cc7f5ef), X(0x7ccb0984), X(0x7cce1b08), X(0x7cd12a7b),
1834 X(0x7cd437dd), X(0x7cd74330), X(0x7cda4c74), X(0x7cdd53aa),
1835 X(0x7ce058d3), X(0x7ce35bef), X(0x7ce65cff), X(0x7ce95c04),
1836 X(0x7cec58ff), X(0x7cef53f0), X(0x7cf24cd7), X(0x7cf543b7),
1837 X(0x7cf8388f), X(0x7cfb2b60), X(0x7cfe1c2b), X(0x7d010af1),
1838 X(0x7d03f7b2), X(0x7d06e26f), X(0x7d09cb29), X(0x7d0cb1e0),
1839 X(0x7d0f9696), X(0x7d12794b), X(0x7d1559ff), X(0x7d1838b4),
1840 X(0x7d1b156a), X(0x7d1df022), X(0x7d20c8dd), X(0x7d239f9b),
1841 X(0x7d26745e), X(0x7d294725), X(0x7d2c17f1), X(0x7d2ee6c4),
1842 X(0x7d31b39f), X(0x7d347e81), X(0x7d37476b), X(0x7d3a0e5f),
1843 X(0x7d3cd35d), X(0x7d3f9665), X(0x7d425779), X(0x7d451699),
1844 X(0x7d47d3c6), X(0x7d4a8f01), X(0x7d4d484b), X(0x7d4fffa3),
1845 X(0x7d52b50c), X(0x7d556885), X(0x7d581a0f), X(0x7d5ac9ac),
1846 X(0x7d5d775c), X(0x7d60231f), X(0x7d62ccf6), X(0x7d6574e3),
1847 X(0x7d681ae6), X(0x7d6abeff), X(0x7d6d612f), X(0x7d700178),
1848 X(0x7d729fd9), X(0x7d753c54), X(0x7d77d6e9), X(0x7d7a6f9a),
1849 X(0x7d7d0666), X(0x7d7f9b4f), X(0x7d822e55), X(0x7d84bf79),
1850 X(0x7d874ebc), X(0x7d89dc1e), X(0x7d8c67a1), X(0x7d8ef144),
1851 X(0x7d91790a), X(0x7d93fef2), X(0x7d9682fd), X(0x7d99052d),
1852 X(0x7d9b8581), X(0x7d9e03fb), X(0x7da0809b), X(0x7da2fb62),
1853 X(0x7da57451), X(0x7da7eb68), X(0x7daa60a8), X(0x7dacd413),
1854 X(0x7daf45a9), X(0x7db1b56a), X(0x7db42357), X(0x7db68f71),
1855 X(0x7db8f9b9), X(0x7dbb6230), X(0x7dbdc8d6), X(0x7dc02dac),
1856 X(0x7dc290b3), X(0x7dc4f1eb), X(0x7dc75156), X(0x7dc9aef4),
1857 X(0x7dcc0ac5), X(0x7dce64cc), X(0x7dd0bd07), X(0x7dd31379),
1858 X(0x7dd56821), X(0x7dd7bb01), X(0x7dda0c1a), X(0x7ddc5b6b),
1859 X(0x7ddea8f7), X(0x7de0f4bd), X(0x7de33ebe), X(0x7de586fc),
1860 X(0x7de7cd76), X(0x7dea122e), X(0x7dec5525), X(0x7dee965a),
1861 X(0x7df0d5d0), X(0x7df31386), X(0x7df54f7e), X(0x7df789b8),
1862 X(0x7df9c235), X(0x7dfbf8f5), X(0x7dfe2dfa), X(0x7e006145),
1863 X(0x7e0292d5), X(0x7e04c2ac), X(0x7e06f0cb), X(0x7e091d32),
1864 X(0x7e0b47e1), X(0x7e0d70db), X(0x7e0f981f), X(0x7e11bdaf),
1865 X(0x7e13e18a), X(0x7e1603b3), X(0x7e182429), X(0x7e1a42ed),
1866 X(0x7e1c6001), X(0x7e1e7b64), X(0x7e209518), X(0x7e22ad1d),
1867 X(0x7e24c375), X(0x7e26d81f), X(0x7e28eb1d), X(0x7e2afc70),
1868 X(0x7e2d0c17), X(0x7e2f1a15), X(0x7e31266a), X(0x7e333115),
1869 X(0x7e353a1a), X(0x7e374177), X(0x7e39472e), X(0x7e3b4b3f),
1870 X(0x7e3d4dac), X(0x7e3f4e75), X(0x7e414d9a), X(0x7e434b1e),
1871 X(0x7e4546ff), X(0x7e474140), X(0x7e4939e0), X(0x7e4b30e2),
1872 X(0x7e4d2644), X(0x7e4f1a09), X(0x7e510c30), X(0x7e52fcbc),
1873 X(0x7e54ebab), X(0x7e56d900), X(0x7e58c4bb), X(0x7e5aaedd),
1874 X(0x7e5c9766), X(0x7e5e7e57), X(0x7e6063b2), X(0x7e624776),
1875 X(0x7e6429a5), X(0x7e660a3f), X(0x7e67e945), X(0x7e69c6b8),
1876 X(0x7e6ba299), X(0x7e6d7ce7), X(0x7e6f55a5), X(0x7e712cd3),
1877 X(0x7e730272), X(0x7e74d682), X(0x7e76a904), X(0x7e7879f9),
1878 X(0x7e7a4962), X(0x7e7c173f), X(0x7e7de392), X(0x7e7fae5a),
1879 X(0x7e817799), X(0x7e833f50), X(0x7e85057f), X(0x7e86ca27),
1880 X(0x7e888d49), X(0x7e8a4ee5), X(0x7e8c0efd), X(0x7e8dcd91),
1881 X(0x7e8f8aa1), X(0x7e914630), X(0x7e93003c), X(0x7e94b8c8),
1882 X(0x7e966fd4), X(0x7e982560), X(0x7e99d96e), X(0x7e9b8bfe),
1883 X(0x7e9d3d10), X(0x7e9eeca7), X(0x7ea09ac2), X(0x7ea24762),
1884 X(0x7ea3f288), X(0x7ea59c35), X(0x7ea7446a), X(0x7ea8eb27),
1885 X(0x7eaa906c), X(0x7eac343c), X(0x7eadd696), X(0x7eaf777b),
1886 X(0x7eb116ed), X(0x7eb2b4eb), X(0x7eb45177), X(0x7eb5ec91),
1887 X(0x7eb7863b), X(0x7eb91e74), X(0x7ebab53e), X(0x7ebc4a99),
1888 X(0x7ebdde87), X(0x7ebf7107), X(0x7ec1021b), X(0x7ec291c3),
1889 X(0x7ec42001), X(0x7ec5acd5), X(0x7ec7383f), X(0x7ec8c241),
1890 X(0x7eca4adb), X(0x7ecbd20d), X(0x7ecd57da), X(0x7ecedc41),
1891 X(0x7ed05f44), X(0x7ed1e0e2), X(0x7ed3611d), X(0x7ed4dff6),
1892 X(0x7ed65d6d), X(0x7ed7d983), X(0x7ed95438), X(0x7edacd8f),
1893 X(0x7edc4586), X(0x7eddbc20), X(0x7edf315c), X(0x7ee0a53c),
1894 X(0x7ee217c1), X(0x7ee388ea), X(0x7ee4f8b9), X(0x7ee6672f),
1895 X(0x7ee7d44c), X(0x7ee94012), X(0x7eeaaa80), X(0x7eec1397),
1896 X(0x7eed7b59), X(0x7eeee1c6), X(0x7ef046df), X(0x7ef1aaa5),
1897 X(0x7ef30d18), X(0x7ef46e39), X(0x7ef5ce09), X(0x7ef72c88),
1898 X(0x7ef889b8), X(0x7ef9e599), X(0x7efb402c), X(0x7efc9972),
1899 X(0x7efdf16b), X(0x7eff4818), X(0x7f009d79), X(0x7f01f191),
1900 X(0x7f03445f), X(0x7f0495e4), X(0x7f05e620), X(0x7f073516),
1901 X(0x7f0882c5), X(0x7f09cf2d), X(0x7f0b1a51), X(0x7f0c6430),
1902 X(0x7f0daccc), X(0x7f0ef425), X(0x7f103a3b), X(0x7f117f11),
1903 X(0x7f12c2a5), X(0x7f1404fa), X(0x7f15460f), X(0x7f1685e6),
1904 X(0x7f17c47f), X(0x7f1901db), X(0x7f1a3dfb), X(0x7f1b78e0),
1905 X(0x7f1cb28a), X(0x7f1deafa), X(0x7f1f2231), X(0x7f20582f),
1906 X(0x7f218cf5), X(0x7f22c085), X(0x7f23f2de), X(0x7f252401),
1907 X(0x7f2653f0), X(0x7f2782ab), X(0x7f28b032), X(0x7f29dc87),
1908 X(0x7f2b07aa), X(0x7f2c319c), X(0x7f2d5a5e), X(0x7f2e81f0),
1909 X(0x7f2fa853), X(0x7f30cd88), X(0x7f31f18f), X(0x7f33146a),
1910 X(0x7f343619), X(0x7f35569c), X(0x7f3675f6), X(0x7f379425),
1911 X(0x7f38b12c), X(0x7f39cd0a), X(0x7f3ae7c0), X(0x7f3c0150),
1912 X(0x7f3d19ba), X(0x7f3e30fe), X(0x7f3f471e), X(0x7f405c1a),
1913 X(0x7f416ff3), X(0x7f4282a9), X(0x7f43943e), X(0x7f44a4b2),
1914 X(0x7f45b405), X(0x7f46c239), X(0x7f47cf4e), X(0x7f48db45),
1915 X(0x7f49e61f), X(0x7f4aefdc), X(0x7f4bf87e), X(0x7f4d0004),
1916 X(0x7f4e0670), X(0x7f4f0bc2), X(0x7f500ffb), X(0x7f51131c),
1917 X(0x7f521525), X(0x7f531618), X(0x7f5415f4), X(0x7f5514bb),
1918 X(0x7f56126e), X(0x7f570f0c), X(0x7f580a98), X(0x7f590511),
1919 X(0x7f59fe78), X(0x7f5af6ce), X(0x7f5bee14), X(0x7f5ce44a),
1920 X(0x7f5dd972), X(0x7f5ecd8b), X(0x7f5fc097), X(0x7f60b296),
1921 X(0x7f61a389), X(0x7f629370), X(0x7f63824e), X(0x7f647021),
1922 X(0x7f655ceb), X(0x7f6648ad), X(0x7f673367), X(0x7f681d19),
1923 X(0x7f6905c6), X(0x7f69ed6d), X(0x7f6ad40f), X(0x7f6bb9ad),
1924 X(0x7f6c9e48), X(0x7f6d81e0), X(0x7f6e6475), X(0x7f6f460a),
1925 X(0x7f70269d), X(0x7f710631), X(0x7f71e4c6), X(0x7f72c25c),
1926 X(0x7f739ef4), X(0x7f747a8f), X(0x7f75552e), X(0x7f762ed1),
1927 X(0x7f770779), X(0x7f77df27), X(0x7f78b5db), X(0x7f798b97),
1928 X(0x7f7a605a), X(0x7f7b3425), X(0x7f7c06fa), X(0x7f7cd8d9),
1929 X(0x7f7da9c2), X(0x7f7e79b7), X(0x7f7f48b8), X(0x7f8016c5),
1930 X(0x7f80e3e0), X(0x7f81b009), X(0x7f827b40), X(0x7f834588),
1931 X(0x7f840edf), X(0x7f84d747), X(0x7f859ec1), X(0x7f86654d),
1932 X(0x7f872aec), X(0x7f87ef9e), X(0x7f88b365), X(0x7f897641),
1933 X(0x7f8a3832), X(0x7f8af93a), X(0x7f8bb959), X(0x7f8c7890),
1934 X(0x7f8d36df), X(0x7f8df448), X(0x7f8eb0ca), X(0x7f8f6c67),
1935 X(0x7f90271e), X(0x7f90e0f2), X(0x7f9199e2), X(0x7f9251f0),
1936 X(0x7f93091b), X(0x7f93bf65), X(0x7f9474ce), X(0x7f952958),
1937 X(0x7f95dd01), X(0x7f968fcd), X(0x7f9741ba), X(0x7f97f2ca),
1938 X(0x7f98a2fd), X(0x7f995254), X(0x7f9a00d0), X(0x7f9aae71),
1939 X(0x7f9b5b38), X(0x7f9c0726), X(0x7f9cb23b), X(0x7f9d5c78),
1940 X(0x7f9e05de), X(0x7f9eae6e), X(0x7f9f5627), X(0x7f9ffd0b),
1941 X(0x7fa0a31b), X(0x7fa14856), X(0x7fa1ecbf), X(0x7fa29054),
1942 X(0x7fa33318), X(0x7fa3d50b), X(0x7fa4762c), X(0x7fa5167e),
1943 X(0x7fa5b601), X(0x7fa654b5), X(0x7fa6f29b), X(0x7fa78fb3),
1944 X(0x7fa82bff), X(0x7fa8c77f), X(0x7fa96234), X(0x7fa9fc1e),
1945 X(0x7faa953e), X(0x7fab2d94), X(0x7fabc522), X(0x7fac5be8),
1946 X(0x7facf1e6), X(0x7fad871d), X(0x7fae1b8f), X(0x7faeaf3b),
1947 X(0x7faf4222), X(0x7fafd445), X(0x7fb065a4), X(0x7fb0f641),
1948 X(0x7fb1861b), X(0x7fb21534), X(0x7fb2a38c), X(0x7fb33124),
1949 X(0x7fb3bdfb), X(0x7fb44a14), X(0x7fb4d56f), X(0x7fb5600c),
1950 X(0x7fb5e9ec), X(0x7fb6730f), X(0x7fb6fb76), X(0x7fb78323),
1951 X(0x7fb80a15), X(0x7fb8904d), X(0x7fb915cc), X(0x7fb99a92),
1952 X(0x7fba1ea0), X(0x7fbaa1f7), X(0x7fbb2497), X(0x7fbba681),
1953 X(0x7fbc27b5), X(0x7fbca835), X(0x7fbd2801), X(0x7fbda719),
1954 X(0x7fbe257e), X(0x7fbea331), X(0x7fbf2032), X(0x7fbf9c82),
1955 X(0x7fc01821), X(0x7fc09311), X(0x7fc10d52), X(0x7fc186e4),
1956 X(0x7fc1ffc8), X(0x7fc277ff), X(0x7fc2ef89), X(0x7fc36667),
1957 X(0x7fc3dc9a), X(0x7fc45221), X(0x7fc4c6ff), X(0x7fc53b33),
1958 X(0x7fc5aebe), X(0x7fc621a0), X(0x7fc693db), X(0x7fc7056f),
1959 X(0x7fc7765c), X(0x7fc7e6a3), X(0x7fc85645), X(0x7fc8c542),
1960 X(0x7fc9339b), X(0x7fc9a150), X(0x7fca0e63), X(0x7fca7ad3),
1961 X(0x7fcae6a2), X(0x7fcb51cf), X(0x7fcbbc5c), X(0x7fcc2649),
1962 X(0x7fcc8f97), X(0x7fccf846), X(0x7fcd6058), X(0x7fcdc7cb),
1963 X(0x7fce2ea2), X(0x7fce94dd), X(0x7fcefa7b), X(0x7fcf5f7f),
1964 X(0x7fcfc3e8), X(0x7fd027b7), X(0x7fd08aed), X(0x7fd0ed8b),
1965 X(0x7fd14f90), X(0x7fd1b0fd), X(0x7fd211d4), X(0x7fd27214),
1966 X(0x7fd2d1bf), X(0x7fd330d4), X(0x7fd38f55), X(0x7fd3ed41),
1967 X(0x7fd44a9a), X(0x7fd4a761), X(0x7fd50395), X(0x7fd55f37),
1968 X(0x7fd5ba48), X(0x7fd614c9), X(0x7fd66eba), X(0x7fd6c81b),
1969 X(0x7fd720ed), X(0x7fd77932), X(0x7fd7d0e8), X(0x7fd82812),
1970 X(0x7fd87eae), X(0x7fd8d4bf), X(0x7fd92a45), X(0x7fd97f40),
1971 X(0x7fd9d3b0), X(0x7fda2797), X(0x7fda7af5), X(0x7fdacdca),
1972 X(0x7fdb2018), X(0x7fdb71dd), X(0x7fdbc31c), X(0x7fdc13d5),
1973 X(0x7fdc6408), X(0x7fdcb3b6), X(0x7fdd02df), X(0x7fdd5184),
1974 X(0x7fdd9fa5), X(0x7fdded44), X(0x7fde3a60), X(0x7fde86fb),
1975 X(0x7fded314), X(0x7fdf1eac), X(0x7fdf69c4), X(0x7fdfb45d),
1976 X(0x7fdffe76), X(0x7fe04811), X(0x7fe0912e), X(0x7fe0d9ce),
1977 X(0x7fe121f0), X(0x7fe16996), X(0x7fe1b0c1), X(0x7fe1f770),
1978 X(0x7fe23da4), X(0x7fe2835f), X(0x7fe2c89f), X(0x7fe30d67),
1979 X(0x7fe351b5), X(0x7fe3958c), X(0x7fe3d8ec), X(0x7fe41bd4),
1980 X(0x7fe45e46), X(0x7fe4a042), X(0x7fe4e1c8), X(0x7fe522da),
1981 X(0x7fe56378), X(0x7fe5a3a1), X(0x7fe5e358), X(0x7fe6229b),
1982 X(0x7fe6616d), X(0x7fe69fcc), X(0x7fe6ddbb), X(0x7fe71b39),
1983 X(0x7fe75847), X(0x7fe794e5), X(0x7fe7d114), X(0x7fe80cd5),
1984 X(0x7fe84827), X(0x7fe8830c), X(0x7fe8bd84), X(0x7fe8f78f),
1985 X(0x7fe9312f), X(0x7fe96a62), X(0x7fe9a32b), X(0x7fe9db8a),
1986 X(0x7fea137e), X(0x7fea4b09), X(0x7fea822b), X(0x7feab8e5),
1987 X(0x7feaef37), X(0x7feb2521), X(0x7feb5aa4), X(0x7feb8fc1),
1988 X(0x7febc478), X(0x7febf8ca), X(0x7fec2cb6), X(0x7fec603e),
1989 X(0x7fec9363), X(0x7fecc623), X(0x7fecf881), X(0x7fed2a7c),
1990 X(0x7fed5c16), X(0x7fed8d4e), X(0x7fedbe24), X(0x7fedee9b),
1991 X(0x7fee1eb1), X(0x7fee4e68), X(0x7fee7dc0), X(0x7feeacb9),
1992 X(0x7feedb54), X(0x7fef0991), X(0x7fef3771), X(0x7fef64f5),
1993 X(0x7fef921d), X(0x7fefbee8), X(0x7fefeb59), X(0x7ff0176f),
1994 X(0x7ff0432a), X(0x7ff06e8c), X(0x7ff09995), X(0x7ff0c444),
1995 X(0x7ff0ee9c), X(0x7ff1189b), X(0x7ff14243), X(0x7ff16b94),
1996 X(0x7ff1948e), X(0x7ff1bd32), X(0x7ff1e581), X(0x7ff20d7b),
1997 X(0x7ff2351f), X(0x7ff25c70), X(0x7ff2836d), X(0x7ff2aa17),
1998 X(0x7ff2d06d), X(0x7ff2f672), X(0x7ff31c24), X(0x7ff34185),
1999 X(0x7ff36695), X(0x7ff38b55), X(0x7ff3afc4), X(0x7ff3d3e4),
2000 X(0x7ff3f7b4), X(0x7ff41b35), X(0x7ff43e69), X(0x7ff4614e),
2001 X(0x7ff483e6), X(0x7ff4a631), X(0x7ff4c82f), X(0x7ff4e9e1),
2002 X(0x7ff50b47), X(0x7ff52c62), X(0x7ff54d33), X(0x7ff56db9),
2003 X(0x7ff58df5), X(0x7ff5ade7), X(0x7ff5cd90), X(0x7ff5ecf1),
2004 X(0x7ff60c09), X(0x7ff62ada), X(0x7ff64963), X(0x7ff667a5),
2005 X(0x7ff685a1), X(0x7ff6a357), X(0x7ff6c0c7), X(0x7ff6ddf1),
2006 X(0x7ff6fad7), X(0x7ff71778), X(0x7ff733d6), X(0x7ff74fef),
2007 X(0x7ff76bc6), X(0x7ff78759), X(0x7ff7a2ab), X(0x7ff7bdba),
2008 X(0x7ff7d888), X(0x7ff7f315), X(0x7ff80d61), X(0x7ff8276c),
2009 X(0x7ff84138), X(0x7ff85ac4), X(0x7ff87412), X(0x7ff88d20),
2010 X(0x7ff8a5f0), X(0x7ff8be82), X(0x7ff8d6d7), X(0x7ff8eeef),
2011 X(0x7ff906c9), X(0x7ff91e68), X(0x7ff935cb), X(0x7ff94cf2),
2012 X(0x7ff963dd), X(0x7ff97a8f), X(0x7ff99105), X(0x7ff9a742),
2013 X(0x7ff9bd45), X(0x7ff9d30f), X(0x7ff9e8a0), X(0x7ff9fdf9),
2014 X(0x7ffa131a), X(0x7ffa2803), X(0x7ffa3cb4), X(0x7ffa512f),
2015 X(0x7ffa6573), X(0x7ffa7981), X(0x7ffa8d59), X(0x7ffaa0fc),
2016 X(0x7ffab46a), X(0x7ffac7a3), X(0x7ffadaa8), X(0x7ffaed78),
2017 X(0x7ffb0015), X(0x7ffb127f), X(0x7ffb24b6), X(0x7ffb36bb),
2018 X(0x7ffb488d), X(0x7ffb5a2e), X(0x7ffb6b9d), X(0x7ffb7cdb),
2019 X(0x7ffb8de9), X(0x7ffb9ec6), X(0x7ffbaf73), X(0x7ffbbff1),
2020 X(0x7ffbd03f), X(0x7ffbe05e), X(0x7ffbf04f), X(0x7ffc0012),
2021 X(0x7ffc0fa6), X(0x7ffc1f0d), X(0x7ffc2e47), X(0x7ffc3d54),
2022 X(0x7ffc4c35), X(0x7ffc5ae9), X(0x7ffc6971), X(0x7ffc77ce),
2023 X(0x7ffc8600), X(0x7ffc9407), X(0x7ffca1e4), X(0x7ffcaf96),
2024 X(0x7ffcbd1f), X(0x7ffcca7e), X(0x7ffcd7b4), X(0x7ffce4c1),
2025 X(0x7ffcf1a5), X(0x7ffcfe62), X(0x7ffd0af6), X(0x7ffd1763),
2026 X(0x7ffd23a9), X(0x7ffd2fc8), X(0x7ffd3bc1), X(0x7ffd4793),
2027 X(0x7ffd533f), X(0x7ffd5ec5), X(0x7ffd6a27), X(0x7ffd7563),
2028 X(0x7ffd807a), X(0x7ffd8b6e), X(0x7ffd963d), X(0x7ffda0e8),
2029 X(0x7ffdab70), X(0x7ffdb5d5), X(0x7ffdc017), X(0x7ffdca36),
2030 X(0x7ffdd434), X(0x7ffdde0f), X(0x7ffde7c9), X(0x7ffdf161),
2031 X(0x7ffdfad8), X(0x7ffe042f), X(0x7ffe0d65), X(0x7ffe167b),
2032 X(0x7ffe1f71), X(0x7ffe2848), X(0x7ffe30ff), X(0x7ffe3997),
2033 X(0x7ffe4211), X(0x7ffe4a6c), X(0x7ffe52a9), X(0x7ffe5ac8),
2034 X(0x7ffe62c9), X(0x7ffe6aae), X(0x7ffe7275), X(0x7ffe7a1f),
2035 X(0x7ffe81ad), X(0x7ffe891f), X(0x7ffe9075), X(0x7ffe97b0),
2036 X(0x7ffe9ece), X(0x7ffea5d2), X(0x7ffeacbb), X(0x7ffeb38a),
2037 X(0x7ffeba3e), X(0x7ffec0d8), X(0x7ffec758), X(0x7ffecdbf),
2038 X(0x7ffed40d), X(0x7ffeda41), X(0x7ffee05d), X(0x7ffee660),
2039 X(0x7ffeec4b), X(0x7ffef21f), X(0x7ffef7da), X(0x7ffefd7e),
2040 X(0x7fff030b), X(0x7fff0881), X(0x7fff0de0), X(0x7fff1328),
2041 X(0x7fff185b), X(0x7fff1d77), X(0x7fff227e), X(0x7fff276f),
2042 X(0x7fff2c4b), X(0x7fff3112), X(0x7fff35c4), X(0x7fff3a62),
2043 X(0x7fff3eeb), X(0x7fff4360), X(0x7fff47c2), X(0x7fff4c0f),
2044 X(0x7fff504a), X(0x7fff5471), X(0x7fff5885), X(0x7fff5c87),
2045 X(0x7fff6076), X(0x7fff6452), X(0x7fff681d), X(0x7fff6bd6),
2046 X(0x7fff6f7d), X(0x7fff7313), X(0x7fff7698), X(0x7fff7a0c),
2047 X(0x7fff7d6f), X(0x7fff80c2), X(0x7fff8404), X(0x7fff8736),
2048 X(0x7fff8a58), X(0x7fff8d6b), X(0x7fff906e), X(0x7fff9362),
2049 X(0x7fff9646), X(0x7fff991c), X(0x7fff9be3), X(0x7fff9e9c),
2050 X(0x7fffa146), X(0x7fffa3e2), X(0x7fffa671), X(0x7fffa8f1),
2051 X(0x7fffab65), X(0x7fffadca), X(0x7fffb023), X(0x7fffb26f),
2052 X(0x7fffb4ae), X(0x7fffb6e0), X(0x7fffb906), X(0x7fffbb20),
2053 X(0x7fffbd2e), X(0x7fffbf30), X(0x7fffc126), X(0x7fffc311),
2054 X(0x7fffc4f1), X(0x7fffc6c5), X(0x7fffc88f), X(0x7fffca4d),
2055 X(0x7fffcc01), X(0x7fffcdab), X(0x7fffcf4a), X(0x7fffd0e0),
2056 X(0x7fffd26b), X(0x7fffd3ec), X(0x7fffd564), X(0x7fffd6d2),
2057 X(0x7fffd838), X(0x7fffd993), X(0x7fffdae6), X(0x7fffdc31),
2058 X(0x7fffdd72), X(0x7fffdeab), X(0x7fffdfdb), X(0x7fffe104),
2059 X(0x7fffe224), X(0x7fffe33c), X(0x7fffe44d), X(0x7fffe556),
2060 X(0x7fffe657), X(0x7fffe751), X(0x7fffe844), X(0x7fffe930),
2061 X(0x7fffea15), X(0x7fffeaf3), X(0x7fffebca), X(0x7fffec9b),
2062 X(0x7fffed66), X(0x7fffee2a), X(0x7fffeee8), X(0x7fffefa0),
2063 X(0x7ffff053), X(0x7ffff0ff), X(0x7ffff1a6), X(0x7ffff247),
2064 X(0x7ffff2e4), X(0x7ffff37a), X(0x7ffff40c), X(0x7ffff499),
2065 X(0x7ffff520), X(0x7ffff5a3), X(0x7ffff621), X(0x7ffff69b),
2066 X(0x7ffff710), X(0x7ffff781), X(0x7ffff7ee), X(0x7ffff857),
2067 X(0x7ffff8bb), X(0x7ffff91c), X(0x7ffff979), X(0x7ffff9d2),
2068 X(0x7ffffa27), X(0x7ffffa79), X(0x7ffffac8), X(0x7ffffb13),
2069 X(0x7ffffb5b), X(0x7ffffba0), X(0x7ffffbe2), X(0x7ffffc21),
2070 X(0x7ffffc5d), X(0x7ffffc96), X(0x7ffffccd), X(0x7ffffd01),
2071 X(0x7ffffd32), X(0x7ffffd61), X(0x7ffffd8e), X(0x7ffffdb8),
2072 X(0x7ffffde0), X(0x7ffffe07), X(0x7ffffe2b), X(0x7ffffe4d),
2073 X(0x7ffffe6d), X(0x7ffffe8b), X(0x7ffffea8), X(0x7ffffec3),
2074 X(0x7ffffedc), X(0x7ffffef4), X(0x7fffff0a), X(0x7fffff1f),
2075 X(0x7fffff33), X(0x7fffff45), X(0x7fffff56), X(0x7fffff66),
2076 X(0x7fffff75), X(0x7fffff82), X(0x7fffff8f), X(0x7fffff9a),
2077 X(0x7fffffa5), X(0x7fffffaf), X(0x7fffffb8), X(0x7fffffc0),
2078 X(0x7fffffc8), X(0x7fffffce), X(0x7fffffd5), X(0x7fffffda),
2079 X(0x7fffffdf), X(0x7fffffe4), X(0x7fffffe8), X(0x7fffffeb),
2080 X(0x7fffffef), X(0x7ffffff1), X(0x7ffffff4), X(0x7ffffff6),
2081 X(0x7ffffff8), X(0x7ffffff9), X(0x7ffffffb), X(0x7ffffffc),
2082 X(0x7ffffffd), X(0x7ffffffd), X(0x7ffffffe), X(0x7fffffff),
2083 X(0x7fffffff), X(0x7fffffff), X(0x7fffffff), X(0x7fffffff),
2084 X(0x7fffffff), X(0x7fffffff), X(0x7fffffff), X(0x7fffffff),
2085 X(0x7fffffff), X(0x7fffffff), X(0x7fffffff), X(0x7fffffff),
2086};
2087