summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcoen Hirschberg <marcoen@gmail.com>2005-02-17 09:08:18 +0000
committerMarcoen Hirschberg <marcoen@gmail.com>2005-02-17 09:08:18 +0000
commit99d2599b79649fd5a7df13b4e43383c428cc5657 (patch)
tree5512330f8ad66d5bae14a0ed990601e3bf29f520
parente3e116d3c732c99d95fe11f11726ed8a5b587fc4 (diff)
downloadrockbox-99d2599b79649fd5a7df13b4e43383c428cc5657.tar.gz
rockbox-99d2599b79649fd5a7df13b4e43383c428cc5657.zip
Initial commit of the the Ogg Vorbis 'Tremor' integer playback codec
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5996 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/codecs/Tremor/CHANGELOG19
-rw-r--r--apps/codecs/Tremor/COPYING28
-rw-r--r--apps/codecs/Tremor/Makefile43
-rw-r--r--apps/codecs/Tremor/README46
-rw-r--r--apps/codecs/Tremor/README.rockbox17
-rw-r--r--apps/codecs/Tremor/SOURCES14
-rw-r--r--apps/codecs/Tremor/asm_arm.h243
-rw-r--r--apps/codecs/Tremor/backends.h130
-rw-r--r--apps/codecs/Tremor/bitwise.c265
-rw-r--r--apps/codecs/Tremor/block.c453
-rw-r--r--apps/codecs/Tremor/codebook.c350
-rw-r--r--apps/codecs/Tremor/codebook.h102
-rw-r--r--apps/codecs/Tremor/codec_internal.h92
-rw-r--r--apps/codecs/Tremor/config.h25
-rw-r--r--apps/codecs/Tremor/config_types.h25
-rw-r--r--apps/codecs/Tremor/floor0.c436
-rw-r--r--apps/codecs/Tremor/floor1.c438
-rw-r--r--apps/codecs/Tremor/framing.c1126
-rw-r--r--apps/codecs/Tremor/info.c354
-rw-r--r--apps/codecs/Tremor/ivorbiscodec.h202
-rw-r--r--apps/codecs/Tremor/ivorbisfile.h130
-rw-r--r--apps/codecs/Tremor/ivorbisfile_example.c86
-rw-r--r--apps/codecs/Tremor/lsp_lookup.h136
-rw-r--r--apps/codecs/Tremor/mapping0.c322
-rw-r--r--apps/codecs/Tremor/mdct.c510
-rw-r--r--apps/codecs/Tremor/mdct.h52
-rw-r--r--apps/codecs/Tremor/mdct_lookup.h540
-rw-r--r--apps/codecs/Tremor/misc.h241
-rw-r--r--apps/codecs/Tremor/ogg.h206
-rw-r--r--apps/codecs/Tremor/os.h62
-rw-r--r--apps/codecs/Tremor/os_types.h40
-rw-r--r--apps/codecs/Tremor/os_types.h.bak88
-rw-r--r--apps/codecs/Tremor/registry.c50
-rw-r--r--apps/codecs/Tremor/registry.h40
-rw-r--r--apps/codecs/Tremor/res012.c334
-rw-r--r--apps/codecs/Tremor/sharedbook.c443
-rw-r--r--apps/codecs/Tremor/synthesis.c113
-rw-r--r--apps/codecs/Tremor/vorbisfile.c1592
-rw-r--r--apps/codecs/Tremor/window.c84
-rw-r--r--apps/codecs/Tremor/window.h27
-rw-r--r--apps/codecs/Tremor/window_lookup.h2084
41 files changed, 11588 insertions, 0 deletions
diff --git a/apps/codecs/Tremor/CHANGELOG b/apps/codecs/Tremor/CHANGELOG
new file mode 100644
index 0000000000..53f23351e2
--- /dev/null
+++ b/apps/codecs/Tremor/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/Tremor/COPYING b/apps/codecs/Tremor/COPYING
new file mode 100644
index 0000000000..6111c6c5a6
--- /dev/null
+++ b/apps/codecs/Tremor/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/Tremor/Makefile b/apps/codecs/Tremor/Makefile
new file mode 100644
index 0000000000..b28cce04f9
--- /dev/null
+++ b/apps/codecs/Tremor/Makefile
@@ -0,0 +1,43 @@
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
12
13ifdef APPEXTRA
14INCLUDES += -I$(APPSDIR)/$(APPEXTRA)
15endif
16
17TREMOROPTS =
18CFLAGS = $(GCCOPTS) $(TREMOROPTS) $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) -DMEM=${MEMORYSIZE}
19
20SRC := $(shell cat SOURCES | $(CC) -DMEMORYSIZE=$(MEMORYSIZE) $(INCLUDES) $(TARGET) $(DEFINES) -E -P -include "config.h" - )
21SOURCES = $(SRC)
22OBJS := $(SRC:%.c=$(OBJDIR)/Tremor/%.o)
23DEPFILE = $(OBJDIR)/dep-tremor
24DIRS =
25
26OUTPUT = $(OBJDIR)/tremor.a
27
28all: $(OUTPUT)
29
30$(OUTPUT): $(OBJS)
31 @echo "AR $@"
32 @$(AR) ruv $@ $+ >/dev/null 2>&1
33
34$(OBJDIR)/Tremor/%.o: $(APPSDIR)/codecs/Tremor/%.c
35 @$(CC) -c -O2 $(CFLAGS) -I$(APPSDIR)/codecs/Tremor/ $< -o $@
36
37include $(TOOLSDIR)/make.inc
38
39clean:
40 @echo "cleaning Tremor"
41 @rm -f $(OBJS) $(OUTPUT) $(DEPFILE)
42
43-include $(DEPFILE)
diff --git a/apps/codecs/Tremor/README b/apps/codecs/Tremor/README
new file mode 100644
index 0000000000..1321175322
--- /dev/null
+++ b/apps/codecs/Tremor/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/Tremor/README.rockbox b/apps/codecs/Tremor/README.rockbox
new file mode 100644
index 0000000000..92db1f01f4
--- /dev/null
+++ b/apps/codecs/Tremor/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 and encoding 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
12
13IMPORT DETAILS
14
15The base version first imported into Rockbox was the SVN version of
16Tremor-1.0.2 which was checked out on 2005-02-16.
17
diff --git a/apps/codecs/Tremor/SOURCES b/apps/codecs/Tremor/SOURCES
new file mode 100644
index 0000000000..dabb5ebf8b
--- /dev/null
+++ b/apps/codecs/Tremor/SOURCES
@@ -0,0 +1,14 @@
1bitwise.c
2block.c
3codebook.c
4floor0.c
5floor1.c
6framing.c
7info.c
8mapping0.c
9mdct.c
10registry.c
11res012.c
12sharedbook.c
13synthesis.c
14window.c
diff --git a/apps/codecs/Tremor/asm_arm.h b/apps/codecs/Tremor/asm_arm.h
new file mode 100644
index 0000000000..3a3716df1f
--- /dev/null
+++ b/apps/codecs/Tremor/asm_arm.h
@@ -0,0 +1,243 @@
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
49static inline void XPROD32(ogg_int32_t a, ogg_int32_t b,
50 ogg_int32_t t, ogg_int32_t v,
51 ogg_int32_t *x, ogg_int32_t *y)
52{
53 int x1, y1, l;
54 asm( "smull %0, %1, %4, %6\n\t"
55 "smlal %0, %1, %5, %7\n\t"
56 "rsb %3, %4, #0\n\t"
57 "smull %0, %2, %5, %6\n\t"
58 "smlal %0, %2, %3, %7"
59 : "=&r" (l), "=&r" (x1), "=&r" (y1), "=r" (a)
60 : "3" (a), "r" (b), "r" (t), "r" (v)
61 : "cc" );
62 *x = x1;
63 MB();
64 *y = y1;
65}
66
67static inline void XPROD31(ogg_int32_t a, ogg_int32_t b,
68 ogg_int32_t t, ogg_int32_t v,
69 ogg_int32_t *x, ogg_int32_t *y)
70{
71 int x1, y1, l;
72 asm( "smull %0, %1, %4, %6\n\t"
73 "smlal %0, %1, %5, %7\n\t"
74 "rsb %3, %4, #0\n\t"
75 "smull %0, %2, %5, %6\n\t"
76 "smlal %0, %2, %3, %7"
77 : "=&r" (l), "=&r" (x1), "=&r" (y1), "=r" (a)
78 : "3" (a), "r" (b), "r" (t), "r" (v)
79 : "cc" );
80 *x = x1 << 1;
81 MB();
82 *y = y1 << 1;
83}
84
85static inline void XNPROD31(ogg_int32_t a, ogg_int32_t b,
86 ogg_int32_t t, ogg_int32_t v,
87 ogg_int32_t *x, ogg_int32_t *y)
88{
89 int x1, y1, l;
90 asm( "rsb %2, %4, #0\n\t"
91 "smull %0, %1, %3, %5\n\t"
92 "smlal %0, %1, %2, %6\n\t"
93 "smull %0, %2, %4, %5\n\t"
94 "smlal %0, %2, %3, %6"
95 : "=&r" (l), "=&r" (x1), "=&r" (y1)
96 : "r" (a), "r" (b), "r" (t), "r" (v)
97 : "cc" );
98 *x = x1 << 1;
99 MB();
100 *y = y1 << 1;
101}
102
103#endif
104
105#ifndef _V_CLIP_MATH
106#define _V_CLIP_MATH
107
108static inline ogg_int32_t CLIP_TO_15(ogg_int32_t x) {
109 int tmp;
110 asm volatile("subs %1, %0, #32768\n\t"
111 "movpl %0, #0x7f00\n\t"
112 "orrpl %0, %0, #0xff\n"
113 "adds %1, %0, #32768\n\t"
114 "movmi %0, #0x8000"
115 : "+r"(x),"=r"(tmp)
116 :
117 : "cc");
118 return(x);
119}
120
121#endif
122
123#ifndef _V_LSP_MATH_ASM
124#define _V_LSP_MATH_ASM
125
126static inline void lsp_loop_asm(ogg_uint32_t *qip,ogg_uint32_t *pip,
127 ogg_int32_t *qexpp,
128 ogg_int32_t *ilsp,ogg_int32_t wi,
129 ogg_int32_t m){
130
131 ogg_uint32_t qi=*qip,pi=*pip;
132 ogg_int32_t qexp=*qexpp;
133
134 asm("mov r0,%3;"
135 "mov r1,%5,asr#1;"
136 "add r0,r0,r1,lsl#3;"
137 "1:"
138
139 "ldmdb r0!,{r1,r3};"
140 "subs r1,r1,%4;" //ilsp[j]-wi
141 "rsbmi r1,r1,#0;" //labs(ilsp[j]-wi)
142 "umull %0,r2,r1,%0;" //qi*=labs(ilsp[j]-wi)
143
144 "subs r1,r3,%4;" //ilsp[j+1]-wi
145 "rsbmi r1,r1,#0;" //labs(ilsp[j+1]-wi)
146 "umull %1,r3,r1,%1;" //pi*=labs(ilsp[j+1]-wi)
147
148 "cmn r2,r3;" // shift down 16?
149 "beq 0f;"
150 "add %2,%2,#16;"
151 "mov %0,%0,lsr #16;"
152 "orr %0,%0,r2,lsl #16;"
153 "mov %1,%1,lsr #16;"
154 "orr %1,%1,r3,lsl #16;"
155 "0:"
156 "cmp r0,%3;\n"
157 "bhi 1b;\n"
158
159 // odd filter assymetry
160 "ands r0,%5,#1;\n"
161 "beq 2f;\n"
162 "add r0,%3,%5,lsl#2;\n"
163
164 "ldr r1,[r0,#-4];\n"
165 "mov r0,#0x4000;\n"
166
167 "subs r1,r1,%4;\n" //ilsp[j]-wi
168 "rsbmi r1,r1,#0;\n" //labs(ilsp[j]-wi)
169 "umull %0,r2,r1,%0;\n" //qi*=labs(ilsp[j]-wi)
170 "umull %1,r3,r0,%1;\n" //pi*=labs(ilsp[j+1]-wi)
171
172 "cmn r2,r3;\n" // shift down 16?
173 "beq 2f;\n"
174 "add %2,%2,#16;\n"
175 "mov %0,%0,lsr #16;\n"
176 "orr %0,%0,r2,lsl #16;\n"
177 "mov %1,%1,lsr #16;\n"
178 "orr %1,%1,r3,lsl #16;\n"
179
180 //qi=(pi>>shift)*labs(ilsp[j]-wi);
181 //pi=(qi>>shift)*labs(ilsp[j+1]-wi);
182 //qexp+=shift;
183
184 //}
185
186 /* normalize to max 16 sig figs */
187 "2:"
188 "mov r2,#0;"
189 "orr r1,%0,%1;"
190 "tst r1,#0xff000000;"
191 "addne r2,r2,#8;"
192 "movne r1,r1,lsr #8;"
193 "tst r1,#0x00f00000;"
194 "addne r2,r2,#4;"
195 "movne r1,r1,lsr #4;"
196 "tst r1,#0x000c0000;"
197 "addne r2,r2,#2;"
198 "movne r1,r1,lsr #2;"
199 "tst r1,#0x00020000;"
200 "addne r2,r2,#1;"
201 "movne r1,r1,lsr #1;"
202 "tst r1,#0x00010000;"
203 "addne r2,r2,#1;"
204 "mov %0,%0,lsr r2;"
205 "mov %1,%1,lsr r2;"
206 "add %2,%2,r2;"
207
208 : "+r"(qi),"+r"(pi),"+r"(qexp)
209 : "r"(ilsp),"r"(wi),"r"(m)
210 : "r0","r1","r2","r3","cc");
211
212 *qip=qi;
213 *pip=pi;
214 *qexpp=qexp;
215}
216
217static inline void lsp_norm_asm(ogg_uint32_t *qip,ogg_int32_t *qexpp){
218
219 ogg_uint32_t qi=*qip;
220 ogg_int32_t qexp=*qexpp;
221
222 asm("tst %0,#0x0000ff00;"
223 "moveq %0,%0,lsl #8;"
224 "subeq %1,%1,#8;"
225 "tst %0,#0x0000f000;"
226 "moveq %0,%0,lsl #4;"
227 "subeq %1,%1,#4;"
228 "tst %0,#0x0000c000;"
229 "moveq %0,%0,lsl #2;"
230 "subeq %1,%1,#2;"
231 "tst %0,#0x00008000;"
232 "moveq %0,%0,lsl #1;"
233 "subeq %1,%1,#1;"
234 : "+r"(qi),"+r"(qexp)
235 :
236 : "cc");
237 *qip=qi;
238 *qexpp=qexp;
239}
240
241#endif
242#endif
243
diff --git a/apps/codecs/Tremor/backends.h b/apps/codecs/Tremor/backends.h
new file mode 100644
index 0000000000..50c1c45cfd
--- /dev/null
+++ b/apps/codecs/Tremor/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/Tremor/bitwise.c b/apps/codecs/Tremor/bitwise.c
new file mode 100644
index 0000000000..ccb82b0f3f
--- /dev/null
+++ b/apps/codecs/Tremor/bitwise.c
@@ -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-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 <string.h>
22#include <stdlib.h>
23#include "ogg.h"
24
25static unsigned long mask[]=
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
34/* mark read process as having run off the end */
35static void _adv_halt(oggpack_buffer *b){
36 b->headptr=b->head->buffer->data+b->head->begin+b->head->length;
37 b->headend=-1;
38 b->headbit=0;
39}
40
41/* spans forward, skipping as many bytes as headend is negative; if
42 headend is zero, simply finds next byte. If we're up to the end
43 of the buffer, leaves headend at zero. If we've read past the end,
44 halt the decode process. */
45static void _span(oggpack_buffer *b){
46 while(b->headend<1){
47 if(b->head->next){
48 b->count+=b->head->length;
49 b->head=b->head->next;
50 b->headptr=b->head->buffer->data+b->head->begin-b->headend;
51 b->headend+=b->head->length;
52 }else{
53 /* we've either met the end of decode, or gone past it. halt
54 only if we're past */
55 if(b->headend<0 || b->headbit)
56 /* read has fallen off the end */
57 _adv_halt(b);
58
59 break;
60 }
61 }
62}
63
64void oggpack_readinit(oggpack_buffer *b,ogg_reference *r){
65 memset(b,0,sizeof(*b));
66
67 b->tail=b->head=r;
68 b->count=0;
69 b->headptr=b->head->buffer->data+b->head->begin;
70 b->headend=b->head->length;
71 _span(b);
72}
73
74#define _lookspan() while(!end){\
75 head=head->next;\
76 if(!head) return -1;\
77 ptr=head->buffer->data + head->begin;\
78 end=head->length;\
79 }
80
81/* Read in bits without advancing the bitptr; bits <= 32 */
82long oggpack_look(oggpack_buffer *b,int bits){
83 unsigned long m=mask[bits];
84 unsigned long ret;
85
86 bits+=b->headbit;
87
88 if(bits >= b->headend<<3){
89 int end=b->headend;
90 unsigned char *ptr=b->headptr;
91 ogg_reference *head=b->head;
92
93 if(end<0)return -1;
94
95 if(bits){
96 _lookspan();
97 ret=*ptr++>>b->headbit;
98 if(bits>8){
99 --end;
100 _lookspan();
101 ret|=*ptr++<<(8-b->headbit);
102 if(bits>16){
103 --end;
104 _lookspan();
105 ret|=*ptr++<<(16-b->headbit);
106 if(bits>24){
107 --end;
108 _lookspan();
109 ret|=*ptr++<<(24-b->headbit);
110 if(bits>32 && b->headbit){
111 --end;
112 _lookspan();
113 ret|=*ptr<<(32-b->headbit);
114 }
115 }
116 }
117 }
118 }
119
120 }else{
121
122 /* make this a switch jump-table */
123 ret=b->headptr[0]>>b->headbit;
124 if(bits>8){
125 ret|=b->headptr[1]<<(8-b->headbit);
126 if(bits>16){
127 ret|=b->headptr[2]<<(16-b->headbit);
128 if(bits>24){
129 ret|=b->headptr[3]<<(24-b->headbit);
130 if(bits>32 && b->headbit)
131 ret|=b->headptr[4]<<(32-b->headbit);
132 }
133 }
134 }
135 }
136
137 ret&=m;
138 return ret;
139}
140
141/* limited to 32 at a time */
142void oggpack_adv(oggpack_buffer *b,int bits){
143 bits+=b->headbit;
144 b->headbit=bits&7;
145 b->headptr+=bits/8;
146 if((b->headend-=bits/8)<1)_span(b);
147}
148
149/* spans forward and finds next byte. Never halts */
150static void _span_one(oggpack_buffer *b){
151 while(b->headend<1){
152 if(b->head->next){
153 b->count+=b->head->length;
154 b->head=b->head->next;
155 b->headptr=b->head->buffer->data+b->head->begin;
156 b->headend=b->head->length;
157 }else
158 break;
159 }
160}
161
162static int _halt_one(oggpack_buffer *b){
163 if(b->headend<1){
164 _adv_halt(b);
165 return -1;
166 }
167 return 0;
168}
169
170int oggpack_eop(oggpack_buffer *b){
171 if(b->headend<0)return -1;
172 return 0;
173}
174
175/* bits <= 32 */
176long oggpack_read(oggpack_buffer *b,int bits){
177 unsigned long m=mask[bits];
178 ogg_uint32_t ret;
179
180 bits+=b->headbit;
181
182 if(bits >= b->headend<<3){
183
184 if(b->headend<0)return -1;
185
186 if(bits){
187 if (_halt_one(b)) return -1;
188 ret=*b->headptr>>b->headbit;
189
190 if(bits>=8){
191 ++b->headptr;
192 --b->headend;
193 _span_one(b);
194 if(bits>8){
195 if (_halt_one(b)) return -1;
196 ret|=*b->headptr<<(8-b->headbit);
197
198 if(bits>=16){
199 ++b->headptr;
200 --b->headend;
201 _span_one(b);
202 if(bits>16){
203 if (_halt_one(b)) return -1;
204 ret|=*b->headptr<<(16-b->headbit);
205
206 if(bits>=24){
207 ++b->headptr;
208 --b->headend;
209 _span_one(b);
210 if(bits>24){
211 if (_halt_one(b)) return -1;
212 ret|=*b->headptr<<(24-b->headbit);
213
214 if(bits>=32){
215 ++b->headptr;
216 --b->headend;
217 _span_one(b);
218 if(bits>32){
219 if (_halt_one(b)) return -1;
220 if(b->headbit)ret|=*b->headptr<<(32-b->headbit);
221
222 }
223 }
224 }
225 }
226 }
227 }
228 }
229 }
230 }
231 }else{
232
233 ret=b->headptr[0]>>b->headbit;
234 if(bits>8){
235 ret|=b->headptr[1]<<(8-b->headbit);
236 if(bits>16){
237 ret|=b->headptr[2]<<(16-b->headbit);
238 if(bits>24){
239 ret|=b->headptr[3]<<(24-b->headbit);
240 if(bits>32 && b->headbit){
241 ret|=b->headptr[4]<<(32-b->headbit);
242 }
243 }
244 }
245 }
246
247 b->headptr+=bits/8;
248 b->headend-=bits/8;
249 }
250
251 ret&=m;
252 b->headbit=bits&7;
253 return ret;
254}
255
256long oggpack_bytes(oggpack_buffer *b){
257 return(b->count+b->headptr-b->head->buffer->data-b->head->begin+
258 (b->headbit+7)/8);
259}
260
261long oggpack_bits(oggpack_buffer *b){
262 return((b->count+b->headptr-b->head->buffer->data-b->head->begin)*8+
263 b->headbit);
264}
265
diff --git a/apps/codecs/Tremor/block.c b/apps/codecs/Tremor/block.c
new file mode 100644
index 0000000000..8949253a16
--- /dev/null
+++ b/apps/codecs/Tremor/block.c
@@ -0,0 +1,453 @@
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 <stdio.h>
19#include <stdlib.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->pcmret=(ogg_int32_t **)_ogg_malloc(vi->channels*sizeof(*v->pcmret));
175 for(i=0;i<vi->channels;i++)
176 v->pcm[i]=(ogg_int32_t *)_ogg_calloc(v->pcm_storage,sizeof(*v->pcm[i]));
177
178 /* all 1 (large block) or 0 (small block) */
179 /* explicitly set for the sake of clarity */
180 v->lW=0; /* previous window size */
181 v->W=0; /* current window size */
182
183 /* initialize all the mapping/backend lookups */
184 b->mode=(vorbis_look_mapping **)_ogg_calloc(ci->modes,sizeof(*b->mode));
185 for(i=0;i<ci->modes;i++){
186 int mapnum=ci->mode_param[i]->mapping;
187 int maptype=ci->map_type[mapnum];
188 b->mode[i]=_mapping_P[maptype]->look(v,ci->mode_param[i],
189 ci->map_param[mapnum]);
190 }
191 return(0);
192}
193
194int vorbis_synthesis_restart(vorbis_dsp_state *v){
195 vorbis_info *vi=v->vi;
196 codec_setup_info *ci;
197
198 if(!v->backend_state)return -1;
199 if(!vi)return -1;
200 ci=vi->codec_setup;
201 if(!ci)return -1;
202
203 v->centerW=ci->blocksizes[1]/2;
204 v->pcm_current=v->centerW;
205
206 v->pcm_returned=-1;
207 v->granulepos=-1;
208 v->sequence=-1;
209 ((private_state *)(v->backend_state))->sample_count=-1;
210
211 return(0);
212}
213
214int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi){
215 _vds_init(v,vi);
216 vorbis_synthesis_restart(v);
217
218 return(0);
219}
220
221void vorbis_dsp_clear(vorbis_dsp_state *v){
222 int i;
223 if(v){
224 vorbis_info *vi=v->vi;
225 codec_setup_info *ci=(codec_setup_info *)(vi?vi->codec_setup:NULL);
226 private_state *b=(private_state *)v->backend_state;
227
228 if(v->pcm){
229 for(i=0;i<vi->channels;i++)
230 if(v->pcm[i])_ogg_free(v->pcm[i]);
231 _ogg_free(v->pcm);
232 if(v->pcmret)_ogg_free(v->pcmret);
233 }
234
235 /* free mode lookups; these are actually vorbis_look_mapping structs */
236 if(ci){
237 for(i=0;i<ci->modes;i++){
238 int mapnum=ci->mode_param[i]->mapping;
239 int maptype=ci->map_type[mapnum];
240 if(b && b->mode)_mapping_P[maptype]->free_look(b->mode[i]);
241 }
242 }
243
244 if(b){
245 if(b->mode)_ogg_free(b->mode);
246 _ogg_free(b);
247 }
248
249 memset(v,0,sizeof(*v));
250 }
251}
252
253/* Unlike in analysis, the window is only partially applied for each
254 block. The time domain envelope is not yet handled at the point of
255 calling (as it relies on the previous block). */
256
257int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){
258 vorbis_info *vi=v->vi;
259 codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
260 private_state *b=v->backend_state;
261 int i,j;
262
263 if(v->pcm_current>v->pcm_returned && v->pcm_returned!=-1)return(OV_EINVAL);
264
265 v->lW=v->W;
266 v->W=vb->W;
267 v->nW=-1;
268
269 if((v->sequence==-1)||
270 (v->sequence+1 != vb->sequence)){
271 v->granulepos=-1; /* out of sequence; lose count */
272 b->sample_count=-1;
273 }
274
275 v->sequence=vb->sequence;
276
277 if(vb->pcm){ /* no pcm to process if vorbis_synthesis_trackonly
278 was called on block */
279 int n=ci->blocksizes[v->W]/2;
280 int n0=ci->blocksizes[0]/2;
281 int n1=ci->blocksizes[1]/2;
282
283 int thisCenter;
284 int prevCenter;
285
286 if(v->centerW){
287 thisCenter=n1;
288 prevCenter=0;
289 }else{
290 thisCenter=0;
291 prevCenter=n1;
292 }
293
294 /* v->pcm is now used like a two-stage double buffer. We don't want
295 to have to constantly shift *or* adjust memory usage. Don't
296 accept a new block until the old is shifted out */
297
298 /* overlap/add PCM */
299
300 for(j=0;j<vi->channels;j++){
301 /* the overlap/add section */
302 if(v->lW){
303 if(v->W){
304 /* large/large */
305 ogg_int32_t *pcm=v->pcm[j]+prevCenter;
306 ogg_int32_t *p=vb->pcm[j];
307 for(i=0;i<n1;i++)
308 pcm[i]+=p[i];
309 }else{
310 /* large/small */
311 ogg_int32_t *pcm=v->pcm[j]+prevCenter+n1/2-n0/2;
312 ogg_int32_t *p=vb->pcm[j];
313 for(i=0;i<n0;i++)
314 pcm[i]+=p[i];
315 }
316 }else{
317 if(v->W){
318 /* small/large */
319 ogg_int32_t *pcm=v->pcm[j]+prevCenter;
320 ogg_int32_t *p=vb->pcm[j]+n1/2-n0/2;
321 for(i=0;i<n0;i++)
322 pcm[i]+=p[i];
323 for(;i<n1/2+n0/2;i++)
324 pcm[i]=p[i];
325 }else{
326 /* small/small */
327 ogg_int32_t *pcm=v->pcm[j]+prevCenter;
328 ogg_int32_t *p=vb->pcm[j];
329 for(i=0;i<n0;i++)
330 pcm[i]+=p[i];
331 }
332 }
333
334 /* the copy section */
335 {
336 ogg_int32_t *pcm=v->pcm[j]+thisCenter;
337 ogg_int32_t *p=vb->pcm[j]+n;
338 for(i=0;i<n;i++)
339 pcm[i]=p[i];
340 }
341 }
342
343 if(v->centerW)
344 v->centerW=0;
345 else
346 v->centerW=n1;
347
348 /* deal with initial packet state; we do this using the explicit
349 pcm_returned==-1 flag otherwise we're sensitive to first block
350 being short or long */
351
352 if(v->pcm_returned==-1){
353 v->pcm_returned=thisCenter;
354 v->pcm_current=thisCenter;
355 }else{
356 v->pcm_returned=prevCenter;
357 v->pcm_current=prevCenter+
358 ci->blocksizes[v->lW]/4+
359 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){
435 vorbis_info *vi=v->vi;
436 if(v->pcm_returned>-1 && v->pcm_returned<v->pcm_current){
437 if(pcm){
438 int i;
439 for(i=0;i<vi->channels;i++)
440 v->pcmret[i]=v->pcm[i]+v->pcm_returned;
441 *pcm=v->pcmret;
442 }
443 return(v->pcm_current-v->pcm_returned);
444 }
445 return(0);
446}
447
448int vorbis_synthesis_read(vorbis_dsp_state *v,int bytes){
449 if(bytes && v->pcm_returned+bytes>v->pcm_current)return(OV_EINVAL);
450 v->pcm_returned+=bytes;
451 return(0);
452}
453
diff --git a/apps/codecs/Tremor/codebook.c b/apps/codecs/Tremor/codebook.c
new file mode 100644
index 0000000000..5da8957232
--- /dev/null
+++ b/apps/codecs/Tremor/codebook.c
@@ -0,0 +1,350 @@
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 <stdlib.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 ogg_uint32_t bitreverse(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
151static inline 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 (lok >= 0) {
158 long entry = book->dec_firsttable[lok];
159 if(entry&0x80000000UL){
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 if(lok<0)return -1;
176
177 /* bisect search for the codeword in the ordered list */
178 {
179 ogg_uint32_t testword=bitreverse((ogg_uint32_t)lok);
180
181 while(hi-lo>1){
182 long p=(hi-lo)>>1;
183 long test=book->codelist[lo+p]>testword;
184 lo+=p&(test-1);
185 hi-=p&(-test);
186 }
187
188 if(book->dec_codelengths[lo]<=read){
189 oggpack_adv(b, book->dec_codelengths[lo]);
190 return(lo);
191 }
192 }
193
194 oggpack_adv(b, read);
195 return(-1);
196}
197
198/* Decode side is specced and easier, because we don't need to find
199 matches using different criteria; we simply read and map. There are
200 two things we need to do 'depending':
201
202 We may need to support interleave. We don't really, but it's
203 convenient to do it here rather than rebuild the vector later.
204
205 Cascades may be additive or multiplicitive; this is not inherent in
206 the codebook, but set in the code using the codebook. Like
207 interleaving, it's easiest to do it here.
208 addmul==0 -> declarative (set the value)
209 addmul==1 -> additive
210 addmul==2 -> multiplicitive */
211
212/* returns the [original, not compacted] entry number or -1 on eof *********/
213long vorbis_book_decode(codebook *book, oggpack_buffer *b){
214 long packed_entry=decode_packed_entry_number(book,b);
215 if(packed_entry>=0)
216 return(book->dec_index[packed_entry]);
217
218 /* if there's no dec_index, the codebook unpacking isn't collapsed */
219 return(packed_entry);
220}
221
222/* returns 0 on OK or -1 on eof *************************************/
223long vorbis_book_decodevs_add(codebook *book,ogg_int32_t *a,
224 oggpack_buffer *b,int n,int point){
225 int step=n/book->dim;
226 long *entry = (long *)alloca(sizeof(*entry)*step);
227 ogg_int32_t **t = (ogg_int32_t **)alloca(sizeof(*t)*step);
228 int i,j,o;
229 int shift=point-book->binarypoint;
230
231 if(shift>=0){
232 for (i = 0; i < step; i++) {
233 entry[i]=decode_packed_entry_number(book,b);
234 if(entry[i]==-1)return(-1);
235 t[i] = book->valuelist+entry[i]*book->dim;
236 }
237 for(i=0,o=0;i<book->dim;i++,o+=step)
238 for (j=0;j<step;j++)
239 a[o+j]+=t[j][i]>>shift;
240 }else{
241 for (i = 0; i < step; i++) {
242 entry[i]=decode_packed_entry_number(book,b);
243 if(entry[i]==-1)return(-1);
244 t[i] = book->valuelist+entry[i]*book->dim;
245 }
246 for(i=0,o=0;i<book->dim;i++,o+=step)
247 for (j=0;j<step;j++)
248 a[o+j]+=t[j][i]<<-shift;
249 }
250 return(0);
251}
252
253long vorbis_book_decodev_add(codebook *book,ogg_int32_t *a,
254 oggpack_buffer *b,int n,int point){
255 int i,j,entry;
256 ogg_int32_t *t;
257 int shift=point-book->binarypoint;
258
259 if(shift>=0){
260 for(i=0;i<n;){
261 entry = decode_packed_entry_number(book,b);
262 if(entry==-1)return(-1);
263 t = book->valuelist+entry*book->dim;
264 for (j=0;j<book->dim;)
265 a[i++]+=t[j++]>>shift;
266 }
267 }else{
268 for(i=0;i<n;){
269 entry = decode_packed_entry_number(book,b);
270 if(entry==-1)return(-1);
271 t = book->valuelist+entry*book->dim;
272 for (j=0;j<book->dim;)
273 a[i++]+=t[j++]<<-shift;
274 }
275 }
276 return(0);
277}
278
279long vorbis_book_decodev_set(codebook *book,ogg_int32_t *a,
280 oggpack_buffer *b,int n,int point){
281 int i,j,entry;
282 ogg_int32_t *t;
283 int shift=point-book->binarypoint;
284
285 if(shift>=0){
286
287 for(i=0;i<n;){
288 entry = decode_packed_entry_number(book,b);
289 if(entry==-1)return(-1);
290 t = book->valuelist+entry*book->dim;
291 for (j=0;j<book->dim;){
292 a[i++]=t[j++]>>shift;
293 }
294 }
295 }else{
296
297 for(i=0;i<n;){
298 entry = decode_packed_entry_number(book,b);
299 if(entry==-1)return(-1);
300 t = book->valuelist+entry*book->dim;
301 for (j=0;j<book->dim;){
302 a[i++]=t[j++]<<-shift;
303 }
304 }
305 }
306 return(0);
307}
308
309long vorbis_book_decodevv_add(codebook *book,ogg_int32_t **a,\
310 long offset,int ch,
311 oggpack_buffer *b,int n,int point){
312 long i,j,entry;
313 int chptr=0;
314 int shift=point-book->binarypoint;
315
316 if(shift>=0){
317
318 for(i=offset;i<offset+n;){
319 entry = decode_packed_entry_number(book,b);
320 if(entry==-1)return(-1);
321 {
322 const ogg_int32_t *t = book->valuelist+entry*book->dim;
323 for (j=0;j<book->dim;j++){
324 a[chptr++][i]+=t[j]>>shift;
325 if(chptr==ch){
326 chptr=0;
327 i++;
328 }
329 }
330 }
331 }
332 }else{
333
334 for(i=offset;i<offset+n;){
335 entry = decode_packed_entry_number(book,b);
336 if(entry==-1)return(-1);
337 {
338 const ogg_int32_t *t = book->valuelist+entry*book->dim;
339 for (j=0;j<book->dim;j++){
340 a[chptr++][i]+=t[j]<<-shift;
341 if(chptr==ch){
342 chptr=0;
343 i++;
344 }
345 }
346 }
347 }
348 }
349 return(0);
350}
diff --git a/apps/codecs/Tremor/codebook.h b/apps/codecs/Tremor/codebook.h
new file mode 100644
index 0000000000..14f65382dd
--- /dev/null
+++ b/apps/codecs/Tremor/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/Tremor/codec_internal.h b/apps/codecs/Tremor/codec_internal.h
new file mode 100644
index 0000000000..3ca7f54724
--- /dev/null
+++ b/apps/codecs/Tremor/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/Tremor/config.h b/apps/codecs/Tremor/config.h
new file mode 100644
index 0000000000..950412234a
--- /dev/null
+++ b/apps/codecs/Tremor/config.h
@@ -0,0 +1,25 @@
1/* a52dec profiling */
2/* #undef A52DEC_GPROF */
3
4/* Define to 1 if you have the `memalign' function. */
5/* #undef HAVE_MEMALIGN 1 */
6
7/* liba52 djbfft support */
8/* #undef LIBA52_DJBFFT */
9
10/* a52 sample precision */
11/* #undef LIBA52_DOUBLE */
12
13/* use fixed-point arithmetic */
14#define LIBA52_FIXED
15
16
17/* Define to 1 if your processor stores words with the most significant byte
18 first (like Motorola and SPARC, unlike Intel and VAX). */
19
20/* Used in bitstream.h */
21#define BYTE_ORDER 1
22#define BIG_ENDIAN 1
23#define LITTLE_ENDIAN 0
24
25#define WORDS_BIGENDIAN 1
diff --git a/apps/codecs/Tremor/config_types.h b/apps/codecs/Tremor/config_types.h
new file mode 100644
index 0000000000..1fdcb27fe7
--- /dev/null
+++ b/apps/codecs/Tremor/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/Tremor/floor0.c b/apps/codecs/Tremor/floor0.c
new file mode 100644
index 0000000000..3ed57a561a
--- /dev/null
+++ b/apps/codecs/Tremor/floor0.c
@@ -0,0 +1,436 @@
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 <stdlib.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 long ADJUST_SQRT2[2]={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]={
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]={
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]={
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]={0,1,2,2,3,3,3,3};
135
136void 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 /* 0 <= m < 256 */
143
144 /* set up for using all int later */
145 int i;
146 int ampoffseti=ampoffset*4096;
147 int ampi=amp;
148 ogg_int32_t *ilsp=(ogg_int32_t *)alloca(m*sizeof(*ilsp));
149 /* lsp is in 8.24, range 0 to PI; coslook wants it in .16 0 to 1*/
150 for(i=0;i<m;i++){
151#ifndef _LOW_ACCURACY_
152 ogg_int32_t val=MULT32(lsp[i],0x517cc2);
153#else
154 ogg_int32_t val=((lsp[i]>>10)*0x517d)>>14;
155#endif
156
157 /* safeguard against a malicious stream */
158 if(val<0 || (val>>COS_LOOKUP_I_SHIFT)>=COS_LOOKUP_I_SZ){
159 memset(curve,0,sizeof(*curve)*n);
160 return;
161 }
162
163 ilsp[i]=vorbis_coslook_i(val);
164 }
165
166 i=0;
167 while(i<n){
168 int j,k=map[i];
169 ogg_uint32_t pi=46341; /* 2**-.5 in 0.16 */
170 ogg_uint32_t qi=46341;
171 ogg_int32_t qexp=0,shift;
172 ogg_int32_t wi=icos[k];
173
174#ifdef _V_LSP_MATH_ASM
175 lsp_loop_asm(&qi,&pi,&qexp,ilsp,wi,m);
176
177 pi=((pi*pi)>>16);
178 qi=((qi*qi)>>16);
179
180 if(m&1){
181 qexp= qexp*2-28*((m+1)>>1)+m;
182 pi*=(1<<14)-((wi*wi)>>14);
183 qi+=pi>>14;
184 }else{
185 qexp= qexp*2-13*m;
186
187 pi*=(1<<14)-wi;
188 qi*=(1<<14)+wi;
189
190 qi=(qi+pi)>>14;
191 }
192
193 if(qi&0xffff0000){ /* checks for 1.xxxxxxxxxxxxxxxx */
194 qi>>=1; qexp++;
195 }else
196 lsp_norm_asm(&qi,&qexp);
197
198#else
199
200 qi*=labs(ilsp[0]-wi);
201 pi*=labs(ilsp[1]-wi);
202
203 for(j=3;j<m;j+=2){
204 if(!(shift=MLOOP_1[(pi|qi)>>25]))
205 if(!(shift=MLOOP_2[(pi|qi)>>19]))
206 shift=MLOOP_3[(pi|qi)>>16];
207 qi=(qi>>shift)*labs(ilsp[j-1]-wi);
208 pi=(pi>>shift)*labs(ilsp[j]-wi);
209 qexp+=shift;
210 }
211 if(!(shift=MLOOP_1[(pi|qi)>>25]))
212 if(!(shift=MLOOP_2[(pi|qi)>>19]))
213 shift=MLOOP_3[(pi|qi)>>16];
214
215 /* pi,qi normalized collectively, both tracked using qexp */
216
217 if(m&1){
218 /* odd order filter; slightly assymetric */
219 /* the last coefficient */
220 qi=(qi>>shift)*labs(ilsp[j-1]-wi);
221 pi=(pi>>shift)<<14;
222 qexp+=shift;
223
224 if(!(shift=MLOOP_1[(pi|qi)>>25]))
225 if(!(shift=MLOOP_2[(pi|qi)>>19]))
226 shift=MLOOP_3[(pi|qi)>>16];
227
228 pi>>=shift;
229 qi>>=shift;
230 qexp+=shift-14*((m+1)>>1);
231
232 pi=((pi*pi)>>16);
233 qi=((qi*qi)>>16);
234 qexp=qexp*2+m;
235
236 pi*=(1<<14)-((wi*wi)>>14);
237 qi+=pi>>14;
238
239 }else{
240 /* even order filter; still symmetric */
241
242 /* p*=p(1-w), q*=q(1+w), let normalization drift because it isn't
243 worth tracking step by step */
244
245 pi>>=shift;
246 qi>>=shift;
247 qexp+=shift-7*m;
248
249 pi=((pi*pi)>>16);
250 qi=((qi*qi)>>16);
251 qexp=qexp*2+m;
252
253 pi*=(1<<14)-wi;
254 qi*=(1<<14)+wi;
255 qi=(qi+pi)>>14;
256
257 }
258
259
260 /* we've let the normalization drift because it wasn't important;
261 however, for the lookup, things must be normalized again. We
262 need at most one right shift or a number of left shifts */
263
264 if(qi&0xffff0000){ /* checks for 1.xxxxxxxxxxxxxxxx */
265 qi>>=1; qexp++;
266 }else
267 while(qi && !(qi&0x8000)){ /* checks for 0.0xxxxxxxxxxxxxxx or less*/
268 qi<<=1; qexp--;
269 }
270
271#endif
272
273 amp=vorbis_fromdBlook_i(ampi* /* n.4 */
274 vorbis_invsqlook_i(qi,qexp)-
275 /* m.8, m+n<=8 */
276 ampoffseti); /* 8.12[0] */
277
278#ifdef _LOW_ACCURACY_
279 amp>>=9;
280#endif
281 curve[i]= MULT31_SHIFT15(curve[i],amp);
282 while(map[++i]==k) curve[i]= MULT31_SHIFT15(curve[i],amp);
283 }
284}
285
286/*************** vorbis decode glue ************/
287
288static void floor0_free_info(vorbis_info_floor *i){
289 vorbis_info_floor0 *info=(vorbis_info_floor0 *)i;
290 if(info){
291 memset(info,0,sizeof(*info));
292 _ogg_free(info);
293 }
294}
295
296static void floor0_free_look(vorbis_look_floor *i){
297 vorbis_look_floor0 *look=(vorbis_look_floor0 *)i;
298 if(look){
299
300 if(look->linearmap)_ogg_free(look->linearmap);
301 if(look->lsp_look)_ogg_free(look->lsp_look);
302 memset(look,0,sizeof(*look));
303 _ogg_free(look);
304 }
305}
306
307static vorbis_info_floor *floor0_unpack (vorbis_info *vi,oggpack_buffer *opb){
308 codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
309 int j;
310
311 vorbis_info_floor0 *info=(vorbis_info_floor0 *)_ogg_malloc(sizeof(*info));
312 info->order=oggpack_read(opb,8);
313 info->rate=oggpack_read(opb,16);
314 info->barkmap=oggpack_read(opb,16);
315 info->ampbits=oggpack_read(opb,6);
316 info->ampdB=oggpack_read(opb,8);
317 info->numbooks=oggpack_read(opb,4)+1;
318
319 if(info->order<1)goto err_out;
320 if(info->rate<1)goto err_out;
321 if(info->barkmap<1)goto err_out;
322 if(info->numbooks<1)goto err_out;
323
324 for(j=0;j<info->numbooks;j++){
325 info->books[j]=oggpack_read(opb,8);
326 if(info->books[j]<0 || info->books[j]>=ci->books)goto err_out;
327 }
328 return(info);
329
330 err_out:
331 floor0_free_info(info);
332 return(NULL);
333}
334
335/* initialize Bark scale and normalization lookups. We could do this
336 with static tables, but Vorbis allows a number of possible
337 combinations, so it's best to do it computationally.
338
339 The below is authoritative in terms of defining scale mapping.
340 Note that the scale depends on the sampling rate as well as the
341 linear block and mapping sizes */
342
343static vorbis_look_floor *floor0_look (vorbis_dsp_state *vd,vorbis_info_mode *mi,
344 vorbis_info_floor *i){
345 int j;
346 ogg_int32_t scale;
347 vorbis_info *vi=vd->vi;
348 codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
349 vorbis_info_floor0 *info=(vorbis_info_floor0 *)i;
350 vorbis_look_floor0 *look=(vorbis_look_floor0 *)_ogg_calloc(1,sizeof(*look));
351 look->m=info->order;
352 look->n=ci->blocksizes[mi->blockflag]/2;
353 look->ln=info->barkmap;
354 look->vi=info;
355
356 /* the mapping from a linear scale to a smaller bark scale is
357 straightforward. We do *not* make sure that the linear mapping
358 does not skip bark-scale bins; the decoder simply skips them and
359 the encoder may do what it wishes in filling them. They're
360 necessary in some mapping combinations to keep the scale spacing
361 accurate */
362 look->linearmap=(int *)_ogg_malloc((look->n+1)*sizeof(*look->linearmap));
363 for(j=0;j<look->n;j++){
364
365 int val=(look->ln*
366 ((toBARK(info->rate/2*j/look->n)<<11)/toBARK(info->rate/2)))>>11;
367
368 if(val>=look->ln)val=look->ln-1; /* guard against the approximation */
369 look->linearmap[j]=val;
370 }
371 look->linearmap[j]=-1;
372
373 look->lsp_look=(ogg_int32_t *)_ogg_malloc(look->ln*sizeof(*look->lsp_look));
374 for(j=0;j<look->ln;j++)
375 look->lsp_look[j]=vorbis_coslook2_i(0x10000*j/look->ln);
376
377 return look;
378}
379
380static void *floor0_inverse1(vorbis_block *vb,vorbis_look_floor *i){
381 vorbis_look_floor0 *look=(vorbis_look_floor0 *)i;
382 vorbis_info_floor0 *info=look->vi;
383 int j,k;
384
385 int ampraw=oggpack_read(&vb->opb,info->ampbits);
386 if(ampraw>0){ /* also handles the -1 out of data case */
387 long maxval=(1<<info->ampbits)-1;
388 int amp=((ampraw*info->ampdB)<<4)/maxval;
389 int booknum=oggpack_read(&vb->opb,_ilog(info->numbooks));
390
391 if(booknum!=-1 && booknum<info->numbooks){ /* be paranoid */
392 codec_setup_info *ci=(codec_setup_info *)vb->vd->vi->codec_setup;
393 codebook *b=ci->fullbooks+info->books[booknum];
394 ogg_int32_t last=0;
395 ogg_int32_t *lsp=(ogg_int32_t *)_vorbis_block_alloc(vb,sizeof(*lsp)*(look->m+1));
396
397 for(j=0;j<look->m;j+=b->dim)
398 if(vorbis_book_decodev_set(b,lsp+j,&vb->opb,b->dim,-24)==-1)goto eop;
399 for(j=0;j<look->m;){
400 for(k=0;k<b->dim;k++,j++)lsp[j]+=last;
401 last=lsp[j-1];
402 }
403
404 lsp[look->m]=amp;
405 return(lsp);
406 }
407 }
408 eop:
409 return(NULL);
410}
411
412static int floor0_inverse2(vorbis_block *vb,vorbis_look_floor *i,
413 void *memo,ogg_int32_t *out){
414 vorbis_look_floor0 *look=(vorbis_look_floor0 *)i;
415 vorbis_info_floor0 *info=look->vi;
416
417 if(memo){
418 ogg_int32_t *lsp=(ogg_int32_t *)memo;
419 ogg_int32_t amp=lsp[look->m];
420
421 /* take the coefficients back to a spectral envelope curve */
422 vorbis_lsp_to_curve(out,look->linearmap,look->n,look->ln,
423 lsp,look->m,amp,info->ampdB,look->lsp_look);
424 return(1);
425 }
426 memset(out,0,sizeof(*out)*look->n);
427 return(0);
428}
429
430/* export hooks */
431vorbis_func_floor floor0_exportbundle={
432 &floor0_unpack,&floor0_look,&floor0_free_info,
433 &floor0_free_look,&floor0_inverse1,&floor0_inverse2
434};
435
436
diff --git a/apps/codecs/Tremor/floor1.c b/apps/codecs/Tremor/floor1.c
new file mode 100644
index 0000000000..21dd5bef79
--- /dev/null
+++ b/apps/codecs/Tremor/floor1.c
@@ -0,0 +1,438 @@
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 <stdlib.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 int ilog(unsigned int v){
62 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 look->vi=info;
133 look->n=info->postlist[1];
134
135 /* we drop each position value in-between already decoded values,
136 and use linear interpolation to predict each new value past the
137 edges. The positions are read in the order of the position
138 list... we precompute the bounding positions in the lookup. Of
139 course, the neighbors can change (if a position is declined), but
140 this is an initial mapping */
141
142 for(i=0;i<info->partitions;i++)n+=info->class_dim[info->partitionclass[i]];
143 n+=2;
144 look->posts=n;
145
146 /* also store a sorted position index */
147 for(i=0;i<n;i++)sortpointer[i]=info->postlist+i;
148 qsort(sortpointer,n,sizeof(*sortpointer),icomp);
149
150 /* points from sort order back to range number */
151 for(i=0;i<n;i++)look->forward_index[i]=sortpointer[i]-info->postlist;
152
153 /* quantize values to multiplier spec */
154 switch(info->mult){
155 case 1: /* 1024 -> 256 */
156 look->quant_q=256;
157 break;
158 case 2: /* 1024 -> 128 */
159 look->quant_q=128;
160 break;
161 case 3: /* 1024 -> 86 */
162 look->quant_q=86;
163 break;
164 case 4: /* 1024 -> 64 */
165 look->quant_q=64;
166 break;
167 }
168
169 /* discover our neighbors for decode where we don't use fit flags
170 (that would push the neighbors outward) */
171 for(i=0;i<n-2;i++){
172 int lo=0;
173 int hi=1;
174 int lx=0;
175 int hx=look->n;
176 int currentx=info->postlist[i+2];
177 for(j=0;j<i+2;j++){
178 int x=info->postlist[j];
179 if(x>lx && x<currentx){
180 lo=j;
181 lx=x;
182 }
183 if(x<hx && x>currentx){
184 hi=j;
185 hx=x;
186 }
187 }
188 look->loneighbor[i]=lo;
189 look->hineighbor[i]=hi;
190 }
191
192 return(look);
193}
194
195static int render_point(int x0,int x1,int y0,int y1,int x){
196 y0&=0x7fff; /* mask off flag */
197 y1&=0x7fff;
198
199 {
200 int dy=y1-y0;
201 int adx=x1-x0;
202 int ady=abs(dy);
203 int err=ady*(x-x0);
204
205 int off=err/adx;
206 if(dy<0)return(y0-off);
207 return(y0+off);
208 }
209}
210
211#ifdef _LOW_ACCURACY_
212# define XdB(n) ((((n)>>8)+1)>>1)
213#else
214# define XdB(n) (n)
215#endif
216
217static const ogg_int32_t FLOOR_fromdB_LOOKUP[256]={
218 XdB(0x000000e5), XdB(0x000000f4), XdB(0x00000103), XdB(0x00000114),
219 XdB(0x00000126), XdB(0x00000139), XdB(0x0000014e), XdB(0x00000163),
220 XdB(0x0000017a), XdB(0x00000193), XdB(0x000001ad), XdB(0x000001c9),
221 XdB(0x000001e7), XdB(0x00000206), XdB(0x00000228), XdB(0x0000024c),
222 XdB(0x00000272), XdB(0x0000029b), XdB(0x000002c6), XdB(0x000002f4),
223 XdB(0x00000326), XdB(0x0000035a), XdB(0x00000392), XdB(0x000003cd),
224 XdB(0x0000040c), XdB(0x00000450), XdB(0x00000497), XdB(0x000004e4),
225 XdB(0x00000535), XdB(0x0000058c), XdB(0x000005e8), XdB(0x0000064a),
226 XdB(0x000006b3), XdB(0x00000722), XdB(0x00000799), XdB(0x00000818),
227 XdB(0x0000089e), XdB(0x0000092e), XdB(0x000009c6), XdB(0x00000a69),
228 XdB(0x00000b16), XdB(0x00000bcf), XdB(0x00000c93), XdB(0x00000d64),
229 XdB(0x00000e43), XdB(0x00000f30), XdB(0x0000102d), XdB(0x0000113a),
230 XdB(0x00001258), XdB(0x0000138a), XdB(0x000014cf), XdB(0x00001629),
231 XdB(0x0000179a), XdB(0x00001922), XdB(0x00001ac4), XdB(0x00001c82),
232 XdB(0x00001e5c), XdB(0x00002055), XdB(0x0000226f), XdB(0x000024ac),
233 XdB(0x0000270e), XdB(0x00002997), XdB(0x00002c4b), XdB(0x00002f2c),
234 XdB(0x0000323d), XdB(0x00003581), XdB(0x000038fb), XdB(0x00003caf),
235 XdB(0x000040a0), XdB(0x000044d3), XdB(0x0000494c), XdB(0x00004e10),
236 XdB(0x00005323), XdB(0x0000588a), XdB(0x00005e4b), XdB(0x0000646b),
237 XdB(0x00006af2), XdB(0x000071e5), XdB(0x0000794c), XdB(0x0000812e),
238 XdB(0x00008993), XdB(0x00009283), XdB(0x00009c09), XdB(0x0000a62d),
239 XdB(0x0000b0f9), XdB(0x0000bc79), XdB(0x0000c8b9), XdB(0x0000d5c4),
240 XdB(0x0000e3a9), XdB(0x0000f274), XdB(0x00010235), XdB(0x000112fd),
241 XdB(0x000124dc), XdB(0x000137e4), XdB(0x00014c29), XdB(0x000161bf),
242 XdB(0x000178bc), XdB(0x00019137), XdB(0x0001ab4a), XdB(0x0001c70e),
243 XdB(0x0001e4a1), XdB(0x0002041f), XdB(0x000225aa), XdB(0x00024962),
244 XdB(0x00026f6d), XdB(0x000297f0), XdB(0x0002c316), XdB(0x0002f109),
245 XdB(0x000321f9), XdB(0x00035616), XdB(0x00038d97), XdB(0x0003c8b4),
246 XdB(0x000407a7), XdB(0x00044ab2), XdB(0x00049218), XdB(0x0004de23),
247 XdB(0x00052f1e), XdB(0x0005855c), XdB(0x0005e135), XdB(0x00064306),
248 XdB(0x0006ab33), XdB(0x00071a24), XdB(0x0007904b), XdB(0x00080e20),
249 XdB(0x00089422), XdB(0x000922da), XdB(0x0009bad8), XdB(0x000a5cb6),
250 XdB(0x000b091a), XdB(0x000bc0b1), XdB(0x000c8436), XdB(0x000d5471),
251 XdB(0x000e3233), XdB(0x000f1e5f), XdB(0x001019e4), XdB(0x001125c1),
252 XdB(0x00124306), XdB(0x001372d5), XdB(0x0014b663), XdB(0x00160ef7),
253 XdB(0x00177df0), XdB(0x001904c1), XdB(0x001aa4f9), XdB(0x001c603d),
254 XdB(0x001e384f), XdB(0x00202f0f), XdB(0x0022467a), XdB(0x002480b1),
255 XdB(0x0026dff7), XdB(0x002966b3), XdB(0x002c1776), XdB(0x002ef4fc),
256 XdB(0x0032022d), XdB(0x00354222), XdB(0x0038b828), XdB(0x003c67c2),
257 XdB(0x004054ae), XdB(0x004482e8), XdB(0x0048f6af), XdB(0x004db488),
258 XdB(0x0052c142), XdB(0x005821ff), XdB(0x005ddc33), XdB(0x0063f5b0),
259 XdB(0x006a74a7), XdB(0x00715faf), XdB(0x0078bdce), XdB(0x0080967f),
260 XdB(0x0088f1ba), XdB(0x0091d7f9), XdB(0x009b5247), XdB(0x00a56a41),
261 XdB(0x00b02a27), XdB(0x00bb9ce2), XdB(0x00c7ce12), XdB(0x00d4ca17),
262 XdB(0x00e29e20), XdB(0x00f15835), XdB(0x0101074b), XdB(0x0111bb4e),
263 XdB(0x01238531), XdB(0x01367704), XdB(0x014aa402), XdB(0x016020a7),
264 XdB(0x017702c3), XdB(0x018f6190), XdB(0x01a955cb), XdB(0x01c4f9cf),
265 XdB(0x01e269a8), XdB(0x0201c33b), XdB(0x0223265a), XdB(0x0246b4ea),
266 XdB(0x026c9302), XdB(0x0294e716), XdB(0x02bfda13), XdB(0x02ed9793),
267 XdB(0x031e4e09), XdB(0x03522ee4), XdB(0x03896ed0), XdB(0x03c445e2),
268 XdB(0x0402efd6), XdB(0x0445ac4b), XdB(0x048cbefc), XdB(0x04d87013),
269 XdB(0x05290c67), XdB(0x057ee5ca), XdB(0x05da5364), XdB(0x063bb204),
270 XdB(0x06a36485), XdB(0x0711d42b), XdB(0x0787710e), XdB(0x0804b299),
271 XdB(0x088a17ef), XdB(0x0918287e), XdB(0x09af747c), XdB(0x0a50957e),
272 XdB(0x0afc2f19), XdB(0x0bb2ef7f), XdB(0x0c759034), XdB(0x0d44d6ca),
273 XdB(0x0e2195bc), XdB(0x0f0cad0d), XdB(0x10070b62), XdB(0x1111aeea),
274 XdB(0x122da66c), XdB(0x135c120f), XdB(0x149e24d9), XdB(0x15f525b1),
275 XdB(0x176270e3), XdB(0x18e7794b), XdB(0x1a85c9ae), XdB(0x1c3f06d1),
276 XdB(0x1e14f07d), XdB(0x200963d7), XdB(0x221e5ccd), XdB(0x2455f870),
277 XdB(0x26b2770b), XdB(0x29363e2b), XdB(0x2be3db5c), XdB(0x2ebe06b6),
278 XdB(0x31c7a55b), XdB(0x3503ccd4), XdB(0x3875c5aa), XdB(0x3c210f44),
279 XdB(0x4009632b), XdB(0x4432b8cf), XdB(0x48a149bc), XdB(0x4d59959e),
280 XdB(0x52606733), XdB(0x57bad899), XdB(0x5d6e593a), XdB(0x6380b298),
281 XdB(0x69f80e9a), XdB(0x70dafda8), XdB(0x78307d76), XdB(0x7fffffff),
282};
283
284static void render_line(int x0,int x1,int y0,int y1,ogg_int32_t *d){
285 int dy=y1-y0;
286 int adx=x1-x0;
287 int ady=abs(dy);
288 int base=dy/adx;
289 int sy=(dy<0?base-1:base+1);
290 int x=x0;
291 int y=y0;
292 int err=0;
293
294 ady-=abs(base*adx);
295
296 d[x]= MULT31_SHIFT15(d[x],FLOOR_fromdB_LOOKUP[y]);
297
298 while(++x<x1){
299 err=err+ady;
300 if(err>=adx){
301 err-=adx;
302 y+=sy;
303 }else{
304 y+=base;
305 }
306 d[x]= MULT31_SHIFT15(d[x],FLOOR_fromdB_LOOKUP[y]);
307 }
308}
309
310static void *floor1_inverse1(vorbis_block *vb,vorbis_look_floor *in){
311 vorbis_look_floor1 *look=(vorbis_look_floor1 *)in;
312 vorbis_info_floor1 *info=look->vi;
313 codec_setup_info *ci=(codec_setup_info *)vb->vd->vi->codec_setup;
314
315 int i,j,k;
316 codebook *books=ci->fullbooks;
317
318 /* unpack wrapped/predicted values from stream */
319 if(oggpack_read(&vb->opb,1)==1){
320 int *fit_value=(int *)_vorbis_block_alloc(vb,(look->posts)*sizeof(*fit_value));
321
322 fit_value[0]=oggpack_read(&vb->opb,ilog(look->quant_q-1));
323 fit_value[1]=oggpack_read(&vb->opb,ilog(look->quant_q-1));
324
325 /* partition by partition */
326 /* partition by partition */
327 for(i=0,j=2;i<info->partitions;i++){
328 int classv=info->partitionclass[i];
329 int cdim=info->class_dim[classv];
330 int csubbits=info->class_subs[classv];
331 int csub=1<<csubbits;
332 int cval=0;
333
334 /* decode the partition's first stage cascade value */
335 if(csubbits){
336 cval=vorbis_book_decode(books+info->class_book[classv],&vb->opb);
337
338 if(cval==-1)goto eop;
339 }
340
341 for(k=0;k<cdim;k++){
342 int book=info->class_subbook[classv][cval&(csub-1)];
343 cval>>=csubbits;
344 if(book>=0){
345 if((fit_value[j+k]=vorbis_book_decode(books+book,&vb->opb))==-1)
346 goto eop;
347 }else{
348 fit_value[j+k]=0;
349 }
350 }
351 j+=cdim;
352 }
353
354 /* unwrap positive values and reconsitute via linear interpolation */
355 for(i=2;i<look->posts;i++){
356 int predicted=render_point(info->postlist[look->loneighbor[i-2]],
357 info->postlist[look->hineighbor[i-2]],
358 fit_value[look->loneighbor[i-2]],
359 fit_value[look->hineighbor[i-2]],
360 info->postlist[i]);
361 int hiroom=look->quant_q-predicted;
362 int loroom=predicted;
363 int room=(hiroom<loroom?hiroom:loroom)<<1;
364 int val=fit_value[i];
365
366 if(val){
367 if(val>=room){
368 if(hiroom>loroom){
369 val = val-loroom;
370 }else{
371 val = -1-(val-hiroom);
372 }
373 }else{
374 if(val&1){
375 val= -((val+1)>>1);
376 }else{
377 val>>=1;
378 }
379 }
380
381 fit_value[i]=val+predicted;
382 fit_value[look->loneighbor[i-2]]&=0x7fff;
383 fit_value[look->hineighbor[i-2]]&=0x7fff;
384
385 }else{
386 fit_value[i]=predicted|0x8000;
387 }
388
389 }
390
391 return(fit_value);
392 }
393 eop:
394 return(NULL);
395}
396
397static int floor1_inverse2(vorbis_block *vb,vorbis_look_floor *in,void *memo,
398 ogg_int32_t *out){
399 vorbis_look_floor1 *look=(vorbis_look_floor1 *)in;
400 vorbis_info_floor1 *info=look->vi;
401
402 codec_setup_info *ci=(codec_setup_info *)vb->vd->vi->codec_setup;
403 int n=ci->blocksizes[vb->W]/2;
404 int j;
405
406 if(memo){
407 /* render the lines */
408 int *fit_value=(int *)memo;
409 int hx=0;
410 int lx=0;
411 int ly=fit_value[0]*info->mult;
412 for(j=1;j<look->posts;j++){
413 int current=look->forward_index[j];
414 int hy=fit_value[current]&0x7fff;
415 if(hy==fit_value[current]){
416
417 hy*=info->mult;
418 hx=info->postlist[current];
419
420 render_line(lx,hx,ly,hy,out);
421
422 lx=hx;
423 ly=hy;
424 }
425 }
426 for(j=hx;j<n;j++)out[j]*=ly; /* be certain */
427 return(1);
428 }
429 memset(out,0,sizeof(*out)*n);
430 return(0);
431}
432
433/* export hooks */
434vorbis_func_floor floor1_exportbundle={
435 &floor1_unpack,&floor1_look,&floor1_free_info,
436 &floor1_free_look,&floor1_inverse1,&floor1_inverse2
437};
438
diff --git a/apps/codecs/Tremor/framing.c b/apps/codecs/Tremor/framing.c
new file mode 100644
index 0000000000..48ea6c1943
--- /dev/null
+++ b/apps/codecs/Tremor/framing.c
@@ -0,0 +1,1126 @@
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 <stdlib.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 if(!bs->outstanding){
57 _ogg_free(bs);
58 return;
59 }
60
61 while(bt){
62 ogg_buffer *b=bt;
63 bt=b->ptr.next;
64 if(b->data)_ogg_free(b->data);
65 _ogg_free(b);
66 }
67 bs->unused_buffers=0;
68 while(rt){
69 ogg_reference *r=rt;
70 rt=r->next;
71 _ogg_free(r);
72 }
73 bs->unused_references=0;
74 }
75}
76
77static void ogg_buffer_destroy(ogg_buffer_state *bs){
78 bs->shutdown=1;
79 _ogg_buffer_destroy(bs);
80}
81
82static ogg_buffer *_fetch_buffer(ogg_buffer_state *bs,long bytes){
83 ogg_buffer *ob;
84 bs->outstanding++;
85
86 /* do we have an unused buffer sitting in the pool? */
87 if(bs->unused_buffers){
88 ob=bs->unused_buffers;
89 bs->unused_buffers=ob->ptr.next;
90
91 /* if the unused buffer is too small, grow it */
92 if(ob->size<bytes){
93 ob->data=_ogg_realloc(ob->data,bytes);
94 ob->size=bytes;
95 }
96 }else{
97 /* allocate a new buffer */
98 ob=_ogg_malloc(sizeof(*ob));
99 ob->data=_ogg_malloc(bytes<16?16:bytes);
100 ob->size=bytes;
101 }
102
103 ob->refcount=1;
104 ob->ptr.owner=bs;
105 return ob;
106}
107
108static ogg_reference *_fetch_ref(ogg_buffer_state *bs){
109 ogg_reference *or;
110 bs->outstanding++;
111
112 /* do we have an unused reference sitting in the pool? */
113 if(bs->unused_references){
114 or=bs->unused_references;
115 bs->unused_references=or->next;
116 }else{
117 /* allocate a new reference */
118 or=_ogg_malloc(sizeof(*or));
119 }
120
121 or->begin=0;
122 or->length=0;
123 or->next=0;
124 return or;
125}
126
127/* fetch a reference pointing to a fresh, initially continguous buffer
128 of at least [bytes] length */
129static ogg_reference *ogg_buffer_alloc(ogg_buffer_state *bs,long bytes){
130 ogg_buffer *ob=_fetch_buffer(bs,bytes);
131 ogg_reference *or=_fetch_ref(bs);
132 or->buffer=ob;
133 return or;
134}
135
136/* enlarge the data buffer in the current link */
137static void ogg_buffer_realloc(ogg_reference *or,long bytes){
138 ogg_buffer *ob=or->buffer;
139
140 /* if the unused buffer is too small, grow it */
141 if(ob->size<bytes){
142 ob->data=_ogg_realloc(ob->data,bytes);
143 ob->size=bytes;
144 }
145}
146
147static void _ogg_buffer_mark_one(ogg_reference *or){
148 or->buffer->refcount++;
149}
150
151/* increase the refcount of the buffers to which the reference points */
152static void ogg_buffer_mark(ogg_reference *or){
153 while(or){
154 _ogg_buffer_mark_one(or);
155 or=or->next;
156 }
157}
158
159/* duplicate a reference (pointing to the same actual buffer memory)
160 and increment buffer refcount. If the desired segment begins out
161 of range, NULL is returned; if the desired segment is simply zero
162 length, a zero length ref is returned. Partial range overlap
163 returns the overlap of the ranges */
164static ogg_reference *ogg_buffer_sub(ogg_reference *or,long begin,long length){
165 ogg_reference *ret=0,*head=0;
166
167 /* walk past any preceeding fragments we don't want */
168 while(or && begin>=or->length){
169 begin-=or->length;
170 or=or->next;
171 }
172
173 /* duplicate the reference chain; increment refcounts */
174 while(or && length){
175 ogg_reference *temp=_fetch_ref(or->buffer->ptr.owner);
176 if(head)
177 head->next=temp;
178 else
179 ret=temp;
180 head=temp;
181 head->buffer=or->buffer;
182 head->begin=or->begin+begin;
183 head->length=length;
184 if(head->length>or->length-begin)
185 head->length=or->length-begin;
186
187 begin=0;
188 length-=head->length;
189 or=or->next;
190 }
191
192 ogg_buffer_mark(ret);
193 return ret;
194}
195
196ogg_reference *ogg_buffer_dup(ogg_reference *or){
197 ogg_reference *ret=0,*head=0;
198 /* duplicate the reference chain; increment refcounts */
199 while(or){
200 ogg_reference *temp=_fetch_ref(or->buffer->ptr.owner);
201 if(head)
202 head->next=temp;
203 else
204 ret=temp;
205 head=temp;
206 head->buffer=or->buffer;
207 head->begin=or->begin;
208 head->length=or->length;
209 or=or->next;
210 }
211
212 ogg_buffer_mark(ret);
213 return ret;
214}
215
216/* split a reference into two references; 'return' is a reference to
217 the buffer preceeding pos and 'head'/'tail' are the buffer past the
218 split. If pos is at or past the end of the passed in segment,
219 'head/tail' are NULL */
220static ogg_reference *ogg_buffer_split(ogg_reference **tail,
221 ogg_reference **head,long pos){
222
223 /* walk past any preceeding fragments to one of:
224 a) the exact boundary that seps two fragments
225 b) the fragment that needs split somewhere in the middle */
226 ogg_reference *ret=*tail;
227 ogg_reference *or=*tail;
228
229 while(or && pos>or->length){
230 pos-=or->length;
231 or=or->next;
232 }
233
234 if(!or || pos==0){
235
236 return 0;
237
238 }else{
239
240 if(pos>=or->length){
241 /* exact split, or off the end? */
242 if(or->next){
243
244 /* a split */
245 *tail=or->next;
246 or->next=0;
247
248 }else{
249
250 /* off or at the end */
251 *tail=*head=0;
252
253 }
254 }else{
255
256 /* split within a fragment */
257 long lengthA=pos;
258 long beginB=or->begin+pos;
259 long lengthB=or->length-pos;
260
261 /* make a new reference to tail the second piece */
262 *tail=_fetch_ref(or->buffer->ptr.owner);
263
264 (*tail)->buffer=or->buffer;
265 (*tail)->begin=beginB;
266 (*tail)->length=lengthB;
267 (*tail)->next=or->next;
268 _ogg_buffer_mark_one(*tail);
269 if(head && or==*head)*head=*tail;
270
271 /* update the first piece */
272 or->next=0;
273 or->length=lengthA;
274
275 }
276 }
277 return ret;
278}
279
280static void ogg_buffer_release_one(ogg_reference *or){
281 ogg_buffer *ob=or->buffer;
282 ogg_buffer_state *bs=ob->ptr.owner;
283
284 ob->refcount--;
285 if(ob->refcount==0){
286 bs->outstanding--; /* for the returned buffer */
287 ob->ptr.next=bs->unused_buffers;
288 bs->unused_buffers=ob;
289 }
290
291 bs->outstanding--; /* for the returned reference */
292 or->next=bs->unused_references;
293 bs->unused_references=or;
294
295 _ogg_buffer_destroy(bs); /* lazy cleanup (if needed) */
296
297}
298
299/* release the references, decrease the refcounts of buffers to which
300 they point, release any buffers with a refcount that drops to zero */
301static void ogg_buffer_release(ogg_reference *or){
302 while(or){
303 ogg_reference *next=or->next;
304 ogg_buffer_release_one(or);
305 or=next;
306 }
307}
308
309static ogg_reference *ogg_buffer_pretruncate(ogg_reference *or,long pos){
310 /* release preceeding fragments we don't want */
311 while(or && pos>=or->length){
312 ogg_reference *next=or->next;
313 pos-=or->length;
314 ogg_buffer_release_one(or);
315 or=next;
316 }
317 if (or) {
318 or->begin+=pos;
319 or->length-=pos;
320 }
321 return or;
322}
323
324static ogg_reference *ogg_buffer_walk(ogg_reference *or){
325 if(!or)return NULL;
326 while(or->next){
327 or=or->next;
328 }
329 return(or);
330}
331
332/* *head is appended to the front end (head) of *tail; both continue to
333 be valid pointers, with *tail at the tail and *head at the head */
334static ogg_reference *ogg_buffer_cat(ogg_reference *tail, ogg_reference *head){
335 if(!tail)return head;
336
337 while(tail->next){
338 tail=tail->next;
339 }
340 tail->next=head;
341 return ogg_buffer_walk(head);
342}
343
344static void _positionB(oggbyte_buffer *b,int pos){
345 if(pos<b->pos){
346 /* start at beginning, scan forward */
347 b->ref=b->baseref;
348 b->pos=0;
349 b->end=b->pos+b->ref->length;
350 b->ptr=b->ref->buffer->data+b->ref->begin;
351 }
352}
353
354static void _positionF(oggbyte_buffer *b,int pos){
355 /* scan forward for position */
356 while(pos>=b->end){
357 /* just seek forward */
358 b->pos+=b->ref->length;
359 b->ref=b->ref->next;
360 b->end=b->ref->length+b->pos;
361 b->ptr=b->ref->buffer->data+b->ref->begin;
362 }
363}
364
365static int oggbyte_init(oggbyte_buffer *b,ogg_reference *or){
366 memset(b,0,sizeof(*b));
367 if(or){
368 b->ref=b->baseref=or;
369 b->pos=0;
370 b->end=b->ref->length;
371 b->ptr=b->ref->buffer->data+b->ref->begin;
372 return 0;
373 }else
374 return -1;
375}
376
377static void oggbyte_set4(oggbyte_buffer *b,ogg_uint32_t val,int pos){
378 int i;
379 _positionB(b,pos);
380 for(i=0;i<4;i++){
381 _positionF(b,pos);
382 b->ptr[pos-b->pos]=val;
383 val>>=8;
384 ++pos;
385 }
386}
387
388static unsigned char oggbyte_read1(oggbyte_buffer *b,int pos){
389 _positionB(b,pos);
390 _positionF(b,pos);
391 return b->ptr[pos-b->pos];
392}
393
394static ogg_uint32_t oggbyte_read4(oggbyte_buffer *b,int pos){
395 ogg_uint32_t ret;
396 _positionB(b,pos);
397 _positionF(b,pos);
398 ret=b->ptr[pos-b->pos];
399 _positionF(b,++pos);
400 ret|=b->ptr[pos-b->pos]<<8;
401 _positionF(b,++pos);
402 ret|=b->ptr[pos-b->pos]<<16;
403 _positionF(b,++pos);
404 ret|=b->ptr[pos-b->pos]<<24;
405 return ret;
406}
407
408static ogg_int64_t oggbyte_read8(oggbyte_buffer *b,int pos){
409 ogg_int64_t ret;
410 unsigned char t[7];
411 int i;
412 _positionB(b,pos);
413 for(i=0;i<7;i++){
414 _positionF(b,pos);
415 t[i]=b->ptr[pos++ -b->pos];
416 }
417
418 _positionF(b,pos);
419 ret=b->ptr[pos-b->pos];
420
421 for(i=6;i>=0;--i)
422 ret= ret<<8 | t[i];
423
424 return ret;
425}
426
427/* Now we get to the actual framing code */
428
429int ogg_page_version(ogg_page *og){
430 oggbyte_buffer ob;
431 oggbyte_init(&ob,og->header);
432 return oggbyte_read1(&ob,4);
433}
434
435int ogg_page_continued(ogg_page *og){
436 oggbyte_buffer ob;
437 oggbyte_init(&ob,og->header);
438 return oggbyte_read1(&ob,5)&0x01;
439}
440
441int ogg_page_bos(ogg_page *og){
442 oggbyte_buffer ob;
443 oggbyte_init(&ob,og->header);
444 return oggbyte_read1(&ob,5)&0x02;
445}
446
447int ogg_page_eos(ogg_page *og){
448 oggbyte_buffer ob;
449 oggbyte_init(&ob,og->header);
450 return oggbyte_read1(&ob,5)&0x04;
451}
452
453ogg_int64_t ogg_page_granulepos(ogg_page *og){
454 oggbyte_buffer ob;
455 oggbyte_init(&ob,og->header);
456 return oggbyte_read8(&ob,6);
457}
458
459ogg_uint32_t ogg_page_serialno(ogg_page *og){
460 oggbyte_buffer ob;
461 oggbyte_init(&ob,og->header);
462 return oggbyte_read4(&ob,14);
463}
464
465ogg_uint32_t ogg_page_pageno(ogg_page *og){
466 oggbyte_buffer ob;
467 oggbyte_init(&ob,og->header);
468 return oggbyte_read4(&ob,18);
469}
470
471/* returns the number of packets that are completed on this page (if
472 the leading packet is begun on a previous page, but ends on this
473 page, it's counted */
474
475/* NOTE:
476If a page consists of a packet begun on a previous page, and a new
477packet begun (but not completed) on this page, the return will be:
478 ogg_page_packets(page) ==1,
479 ogg_page_continued(page) !=0
480
481If a page happens to be a single packet that was begun on a
482previous page, and spans to the next page (in the case of a three or
483more page packet), the return will be:
484 ogg_page_packets(page) ==0,
485 ogg_page_continued(page) !=0
486*/
487
488int ogg_page_packets(ogg_page *og){
489 int i;
490 int n;
491 int count=0;
492 oggbyte_buffer ob;
493 oggbyte_init(&ob,og->header);
494
495 n=oggbyte_read1(&ob,26);
496 for(i=0;i<n;i++)
497 if(oggbyte_read1(&ob,27+i)<255)count++;
498 return(count);
499}
500
501/* Static CRC calculation table. See older code in CVS for dead
502 run-time initialization code. */
503
504static ogg_uint32_t crc_lookup[256]={
505 0x00000000,0x04c11db7,0x09823b6e,0x0d4326d9,
506 0x130476dc,0x17c56b6b,0x1a864db2,0x1e475005,
507 0x2608edb8,0x22c9f00f,0x2f8ad6d6,0x2b4bcb61,
508 0x350c9b64,0x31cd86d3,0x3c8ea00a,0x384fbdbd,
509 0x4c11db70,0x48d0c6c7,0x4593e01e,0x4152fda9,
510 0x5f15adac,0x5bd4b01b,0x569796c2,0x52568b75,
511 0x6a1936c8,0x6ed82b7f,0x639b0da6,0x675a1011,
512 0x791d4014,0x7ddc5da3,0x709f7b7a,0x745e66cd,
513 0x9823b6e0,0x9ce2ab57,0x91a18d8e,0x95609039,
514 0x8b27c03c,0x8fe6dd8b,0x82a5fb52,0x8664e6e5,
515 0xbe2b5b58,0xbaea46ef,0xb7a96036,0xb3687d81,
516 0xad2f2d84,0xa9ee3033,0xa4ad16ea,0xa06c0b5d,
517 0xd4326d90,0xd0f37027,0xddb056fe,0xd9714b49,
518 0xc7361b4c,0xc3f706fb,0xceb42022,0xca753d95,
519 0xf23a8028,0xf6fb9d9f,0xfbb8bb46,0xff79a6f1,
520 0xe13ef6f4,0xe5ffeb43,0xe8bccd9a,0xec7dd02d,
521 0x34867077,0x30476dc0,0x3d044b19,0x39c556ae,
522 0x278206ab,0x23431b1c,0x2e003dc5,0x2ac12072,
523 0x128e9dcf,0x164f8078,0x1b0ca6a1,0x1fcdbb16,
524 0x018aeb13,0x054bf6a4,0x0808d07d,0x0cc9cdca,
525 0x7897ab07,0x7c56b6b0,0x71159069,0x75d48dde,
526 0x6b93dddb,0x6f52c06c,0x6211e6b5,0x66d0fb02,
527 0x5e9f46bf,0x5a5e5b08,0x571d7dd1,0x53dc6066,
528 0x4d9b3063,0x495a2dd4,0x44190b0d,0x40d816ba,
529 0xaca5c697,0xa864db20,0xa527fdf9,0xa1e6e04e,
530 0xbfa1b04b,0xbb60adfc,0xb6238b25,0xb2e29692,
531 0x8aad2b2f,0x8e6c3698,0x832f1041,0x87ee0df6,
532 0x99a95df3,0x9d684044,0x902b669d,0x94ea7b2a,
533 0xe0b41de7,0xe4750050,0xe9362689,0xedf73b3e,
534 0xf3b06b3b,0xf771768c,0xfa325055,0xfef34de2,
535 0xc6bcf05f,0xc27dede8,0xcf3ecb31,0xcbffd686,
536 0xd5b88683,0xd1799b34,0xdc3abded,0xd8fba05a,
537 0x690ce0ee,0x6dcdfd59,0x608edb80,0x644fc637,
538 0x7a089632,0x7ec98b85,0x738aad5c,0x774bb0eb,
539 0x4f040d56,0x4bc510e1,0x46863638,0x42472b8f,
540 0x5c007b8a,0x58c1663d,0x558240e4,0x51435d53,
541 0x251d3b9e,0x21dc2629,0x2c9f00f0,0x285e1d47,
542 0x36194d42,0x32d850f5,0x3f9b762c,0x3b5a6b9b,
543 0x0315d626,0x07d4cb91,0x0a97ed48,0x0e56f0ff,
544 0x1011a0fa,0x14d0bd4d,0x19939b94,0x1d528623,
545 0xf12f560e,0xf5ee4bb9,0xf8ad6d60,0xfc6c70d7,
546 0xe22b20d2,0xe6ea3d65,0xeba91bbc,0xef68060b,
547 0xd727bbb6,0xd3e6a601,0xdea580d8,0xda649d6f,
548 0xc423cd6a,0xc0e2d0dd,0xcda1f604,0xc960ebb3,
549 0xbd3e8d7e,0xb9ff90c9,0xb4bcb610,0xb07daba7,
550 0xae3afba2,0xaafbe615,0xa7b8c0cc,0xa379dd7b,
551 0x9b3660c6,0x9ff77d71,0x92b45ba8,0x9675461f,
552 0x8832161a,0x8cf30bad,0x81b02d74,0x857130c3,
553 0x5d8a9099,0x594b8d2e,0x5408abf7,0x50c9b640,
554 0x4e8ee645,0x4a4ffbf2,0x470cdd2b,0x43cdc09c,
555 0x7b827d21,0x7f436096,0x7200464f,0x76c15bf8,
556 0x68860bfd,0x6c47164a,0x61043093,0x65c52d24,
557 0x119b4be9,0x155a565e,0x18197087,0x1cd86d30,
558 0x029f3d35,0x065e2082,0x0b1d065b,0x0fdc1bec,
559 0x3793a651,0x3352bbe6,0x3e119d3f,0x3ad08088,
560 0x2497d08d,0x2056cd3a,0x2d15ebe3,0x29d4f654,
561 0xc5a92679,0xc1683bce,0xcc2b1d17,0xc8ea00a0,
562 0xd6ad50a5,0xd26c4d12,0xdf2f6bcb,0xdbee767c,
563 0xe3a1cbc1,0xe760d676,0xea23f0af,0xeee2ed18,
564 0xf0a5bd1d,0xf464a0aa,0xf9278673,0xfde69bc4,
565 0x89b8fd09,0x8d79e0be,0x803ac667,0x84fbdbd0,
566 0x9abc8bd5,0x9e7d9662,0x933eb0bb,0x97ffad0c,
567 0xafb010b1,0xab710d06,0xa6322bdf,0xa2f33668,
568 0xbcb4666d,0xb8757bda,0xb5365d03,0xb1f740b4};
569
570ogg_sync_state *ogg_sync_create(void){
571 ogg_sync_state *oy=_ogg_calloc(1,sizeof(*oy));
572 memset(oy,0,sizeof(*oy));
573 oy->bufferpool=ogg_buffer_create();
574 return oy;
575}
576
577int ogg_sync_destroy(ogg_sync_state *oy){
578 if(oy){
579 ogg_sync_reset(oy);
580 ogg_buffer_destroy(oy->bufferpool);
581 memset(oy,0,sizeof(*oy));
582 _ogg_free(oy);
583 }
584 return OGG_SUCCESS;
585}
586
587unsigned char *ogg_sync_bufferin(ogg_sync_state *oy, long bytes){
588
589 /* [allocate and] expose a buffer for data submission.
590
591 If there is no head fragment
592 allocate one and expose it
593 else
594 if the current head fragment has sufficient unused space
595 expose it
596 else
597 if the current head fragment is unused
598 resize and expose it
599 else
600 allocate new fragment and expose it
601 */
602
603 /* base case; fifo uninitialized */
604 if(!oy->fifo_head){
605 oy->fifo_head=oy->fifo_tail=ogg_buffer_alloc(oy->bufferpool,bytes);
606 return oy->fifo_head->buffer->data;
607 }
608
609 /* space left in current fragment case */
610 if(oy->fifo_head->buffer->size-
611 oy->fifo_head->length-
612 oy->fifo_head->begin >= bytes)
613 return oy->fifo_head->buffer->data+
614 oy->fifo_head->length+oy->fifo_head->begin;
615
616 /* current fragment is unused, but too small */
617 if(!oy->fifo_head->length){
618 ogg_buffer_realloc(oy->fifo_head,bytes);
619 return oy->fifo_head->buffer->data+oy->fifo_head->begin;
620 }
621
622 /* current fragment used/full; get new fragment */
623 {
624 ogg_reference *new=ogg_buffer_alloc(oy->bufferpool,bytes);
625 oy->fifo_head->next=new;
626 oy->fifo_head=new;
627 }
628 return oy->fifo_head->buffer->data;
629}
630
631int ogg_sync_wrote(ogg_sync_state *oy, long bytes){
632 if(!oy->fifo_head)return OGG_EINVAL;
633 if(oy->fifo_head->buffer->size-oy->fifo_head->length-oy->fifo_head->begin <
634 bytes)return OGG_EINVAL;
635 oy->fifo_head->length+=bytes;
636 oy->fifo_fill+=bytes;
637 return OGG_SUCCESS;
638}
639
640static ogg_uint32_t _checksum(ogg_reference *or, int bytes){
641 ogg_uint32_t crc_reg=0;
642 int j,post;
643
644 while(or){
645 unsigned char *data=or->buffer->data+or->begin;
646 post=(bytes<or->length?bytes:or->length);
647 for(j=0;j<post;++j)
648 crc_reg=(crc_reg<<8)^crc_lookup[((crc_reg >> 24)&0xff)^data[j]];
649 bytes-=j;
650 or=or->next;
651 }
652
653 return crc_reg;
654}
655
656
657/* sync the stream. This is meant to be useful for finding page
658 boundaries.
659
660 return values for this:
661 -n) skipped n bytes
662 0) page not ready; more data (no bytes skipped)
663 n) page synced at current location; page length n bytes
664
665*/
666
667long ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og){
668 oggbyte_buffer page;
669 long bytes,ret=0;
670
671 ogg_page_release(og);
672
673 bytes=oy->fifo_fill;
674 oggbyte_init(&page,oy->fifo_tail);
675
676 if(oy->headerbytes==0){
677 if(bytes<27)goto sync_out; /* not enough for even a minimal header */
678
679 /* verify capture pattern */
680 if(oggbyte_read1(&page,0)!=(int)'O' ||
681 oggbyte_read1(&page,1)!=(int)'g' ||
682 oggbyte_read1(&page,2)!=(int)'g' ||
683 oggbyte_read1(&page,3)!=(int)'S' ) goto sync_fail;
684
685 oy->headerbytes=oggbyte_read1(&page,26)+27;
686 }
687 if(bytes<oy->headerbytes)goto sync_out; /* not enough for header +
688 seg table */
689 if(oy->bodybytes==0){
690 int i;
691 /* count up body length in the segment table */
692 for(i=0;i<oy->headerbytes-27;i++)
693 oy->bodybytes+=oggbyte_read1(&page,27+i);
694 }
695
696 if(oy->bodybytes+oy->headerbytes>bytes)goto sync_out;
697
698 /* we have what appears to be a complete page; last test: verify
699 checksum */
700 {
701 ogg_uint32_t chksum=oggbyte_read4(&page,22);
702 oggbyte_set4(&page,0,22);
703
704 /* Compare checksums; memory continues to be common access */
705 if(chksum!=_checksum(oy->fifo_tail,oy->bodybytes+oy->headerbytes)){
706
707 /* D'oh. Mismatch! Corrupt page (or miscapture and not a page
708 at all). replace the computed checksum with the one actually
709 read in; remember all the memory is common access */
710
711 oggbyte_set4(&page,chksum,22);
712 goto sync_fail;
713 }
714 oggbyte_set4(&page,chksum,22);
715 }
716
717 /* We have a page. Set up page return. */
718 if(og){
719 /* set up page output */
720 og->header=ogg_buffer_split(&oy->fifo_tail,&oy->fifo_head,oy->headerbytes);
721 og->header_len=oy->headerbytes;
722 og->body=ogg_buffer_split(&oy->fifo_tail,&oy->fifo_head,oy->bodybytes);
723 og->body_len=oy->bodybytes;
724 }else{
725 /* simply advance */
726 oy->fifo_tail=
727 ogg_buffer_pretruncate(oy->fifo_tail,oy->headerbytes+oy->bodybytes);
728 if(!oy->fifo_tail)oy->fifo_head=0;
729 }
730
731 ret=oy->headerbytes+oy->bodybytes;
732 oy->unsynced=0;
733 oy->headerbytes=0;
734 oy->bodybytes=0;
735 oy->fifo_fill-=ret;
736
737 return ret;
738
739 sync_fail:
740
741 oy->headerbytes=0;
742 oy->bodybytes=0;
743 oy->fifo_tail=ogg_buffer_pretruncate(oy->fifo_tail,1);
744 ret--;
745
746 /* search forward through fragments for possible capture */
747 while(oy->fifo_tail){
748 /* invariant: fifo_cursor points to a position in fifo_tail */
749 unsigned char *now=oy->fifo_tail->buffer->data+oy->fifo_tail->begin;
750 unsigned char *next=memchr(now, 'O', oy->fifo_tail->length);
751
752 if(next){
753 /* possible capture in this segment */
754 long bytes=next-now;
755 oy->fifo_tail=ogg_buffer_pretruncate(oy->fifo_tail,bytes);
756 ret-=bytes;
757 break;
758 }else{
759 /* no capture. advance to next segment */
760 long bytes=oy->fifo_tail->length;
761 ret-=bytes;
762 oy->fifo_tail=ogg_buffer_pretruncate(oy->fifo_tail,bytes);
763 }
764 }
765 if(!oy->fifo_tail)oy->fifo_head=0;
766 oy->fifo_fill+=ret;
767
768 sync_out:
769 return ret;
770}
771
772/* sync the stream and get a page. Keep trying until we find a page.
773 Supress 'sync errors' after reporting the first.
774
775 return values:
776 OGG_HOLE) recapture (hole in data)
777 0) need more data
778 1) page returned
779
780 Returns pointers into buffered data; invalidated by next call to
781 _stream, _clear, _init, or _buffer */
782
783int ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og){
784
785 /* all we need to do is verify a page at the head of the stream
786 buffer. If it doesn't verify, we look for the next potential
787 frame */
788
789 while(1){
790 long ret=ogg_sync_pageseek(oy,og);
791 if(ret>0){
792 /* have a page */
793 return 1;
794 }
795 if(ret==0){
796 /* need more data */
797 return 0;
798 }
799
800 /* head did not start a synced page... skipped some bytes */
801 if(!oy->unsynced){
802 oy->unsynced=1;
803 return OGG_HOLE;
804 }
805
806 /* loop. keep looking */
807
808 }
809}
810
811/* clear things to an initial state. Good to call, eg, before seeking */
812int ogg_sync_reset(ogg_sync_state *oy){
813
814 ogg_buffer_release(oy->fifo_tail);
815 oy->fifo_tail=0;
816 oy->fifo_head=0;
817 oy->fifo_fill=0;
818
819 oy->unsynced=0;
820 oy->headerbytes=0;
821 oy->bodybytes=0;
822 return OGG_SUCCESS;
823}
824
825ogg_stream_state *ogg_stream_create(int serialno){
826 ogg_stream_state *os=_ogg_calloc(1,sizeof(*os));
827 os->serialno=serialno;
828 os->pageno=-1;
829 return os;
830}
831
832int ogg_stream_destroy(ogg_stream_state *os){
833 if(os){
834 ogg_buffer_release(os->header_tail);
835 ogg_buffer_release(os->body_tail);
836 memset(os,0,sizeof(*os));
837 }
838 return OGG_SUCCESS;
839}
840
841
842#define FINFLAG 0x80000000UL
843#define FINMASK 0x7fffffffUL
844
845static void _next_lace(oggbyte_buffer *ob,ogg_stream_state *os){
846 /* search ahead one lace */
847 os->body_fill_next=0;
848 while(os->laceptr<os->lacing_fill){
849 int val=oggbyte_read1(ob,27+os->laceptr++);
850 os->body_fill_next+=val;
851 if(val<255){
852 os->body_fill_next|=FINFLAG;
853 os->clearflag=1;
854 break;
855 }
856 }
857}
858
859static void _span_queued_page(ogg_stream_state *os){
860 while( !(os->body_fill&FINFLAG) ){
861
862 if(!os->header_tail)break;
863
864 /* first flush out preceeding page header (if any). Body is
865 flushed as it's consumed, so that's not done here. */
866
867 if(os->lacing_fill>=0)
868 os->header_tail=ogg_buffer_pretruncate(os->header_tail,
869 os->lacing_fill+27);
870 os->lacing_fill=0;
871 os->laceptr=0;
872 os->clearflag=0;
873
874 if(!os->header_tail){
875 os->header_head=0;
876 break;
877 }else{
878
879 /* process/prepare next page, if any */
880
881 long pageno;
882 oggbyte_buffer ob;
883 ogg_page og; /* only for parsing header values */
884 og.header=os->header_tail; /* only for parsing header values */
885 pageno=ogg_page_pageno(&og);
886
887 oggbyte_init(&ob,os->header_tail);
888 os->lacing_fill=oggbyte_read1(&ob,26);
889
890 /* are we in sequence? */
891 if(pageno!=os->pageno){
892 if(os->pageno==-1) /* indicates seek or reset */
893 os->holeflag=1; /* set for internal use */
894 else
895 os->holeflag=2; /* set for external reporting */
896
897 os->body_tail=ogg_buffer_pretruncate(os->body_tail,
898 os->body_fill);
899 if(os->body_tail==0)os->body_head=0;
900 os->body_fill=0;
901
902 }
903
904 if(ogg_page_continued(&og)){
905 if(os->body_fill==0){
906 /* continued packet, but no preceeding data to continue */
907 /* dump the first partial packet on the page */
908 _next_lace(&ob,os);
909 os->body_tail=
910 ogg_buffer_pretruncate(os->body_tail,os->body_fill_next&FINMASK);
911 if(os->body_tail==0)os->body_head=0;
912 /* set span flag */
913 if(!os->spanflag && !os->holeflag)os->spanflag=2;
914 }
915 }else{
916 if(os->body_fill>0){
917 /* preceeding data to continue, but not a continued page */
918 /* dump body_fill */
919 os->body_tail=ogg_buffer_pretruncate(os->body_tail,
920 os->body_fill);
921 if(os->body_tail==0)os->body_head=0;
922 os->body_fill=0;
923
924 /* set espan flag */
925 if(!os->spanflag && !os->holeflag)os->spanflag=2;
926 }
927 }
928
929 if(os->laceptr<os->lacing_fill){
930 os->granulepos=ogg_page_granulepos(&og);
931
932 /* get current packet size & flag */
933 _next_lace(&ob,os);
934 os->body_fill+=os->body_fill_next; /* addition handles the flag fine;
935 unsigned on purpose */
936 /* ...and next packet size & flag */
937 _next_lace(&ob,os);
938
939 }
940
941 os->pageno=pageno+1;
942 os->e_o_s=ogg_page_eos(&og);
943 os->b_o_s=ogg_page_bos(&og);
944
945 }
946 }
947}
948
949/* add the incoming page to the stream state; we decompose the page
950 into packet segments here as well. */
951
952int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og){
953
954 int serialno=ogg_page_serialno(og);
955 int version=ogg_page_version(og);
956
957 /* check the serial number */
958 if(serialno!=os->serialno){
959 ogg_page_release(og);
960 return OGG_ESERIAL;
961 }
962 if(version>0){
963 ogg_page_release(og);
964 return OGG_EVERSION;
965 }
966
967 /* add to fifos */
968 if(!os->body_tail){
969 os->body_tail=og->body;
970 os->body_head=ogg_buffer_walk(og->body);
971 }else{
972 os->body_head=ogg_buffer_cat(os->body_head,og->body);
973 }
974 if(!os->header_tail){
975 os->header_tail=og->header;
976 os->header_head=ogg_buffer_walk(og->header);
977 os->lacing_fill=-27;
978 }else{
979 os->header_head=ogg_buffer_cat(os->header_head,og->header);
980 }
981
982 memset(og,0,sizeof(*og));
983 return OGG_SUCCESS;
984}
985
986int ogg_stream_reset(ogg_stream_state *os){
987
988 ogg_buffer_release(os->header_tail);
989 ogg_buffer_release(os->body_tail);
990 os->header_tail=os->header_head=0;
991 os->body_tail=os->body_head=0;
992
993 os->e_o_s=0;
994 os->b_o_s=0;
995 os->pageno=-1;
996 os->packetno=0;
997 os->granulepos=0;
998
999 os->body_fill=0;
1000 os->lacing_fill=0;
1001
1002 os->holeflag=0;
1003 os->spanflag=0;
1004 os->clearflag=0;
1005 os->laceptr=0;
1006 os->body_fill_next=0;
1007
1008 return OGG_SUCCESS;
1009}
1010
1011int ogg_stream_reset_serialno(ogg_stream_state *os,int serialno){
1012 ogg_stream_reset(os);
1013 os->serialno=serialno;
1014 return OGG_SUCCESS;
1015}
1016
1017static int _packetout(ogg_stream_state *os,ogg_packet *op,int adv){
1018
1019 ogg_packet_release(op);
1020 _span_queued_page(os);
1021
1022 if(os->holeflag){
1023 int temp=os->holeflag;
1024 if(os->clearflag)
1025 os->holeflag=0;
1026 else
1027 os->holeflag=1;
1028 if(temp==2){
1029 os->packetno++;
1030 return OGG_HOLE;
1031 }
1032 }
1033 if(os->spanflag){
1034 int temp=os->spanflag;
1035 if(os->clearflag)
1036 os->spanflag=0;
1037 else
1038 os->spanflag=1;
1039 if(temp==2){
1040 os->packetno++;
1041 return OGG_SPAN;
1042 }
1043 }
1044
1045 if(!(os->body_fill&FINFLAG)) return 0;
1046 if(!op && !adv)return 1; /* just using peek as an inexpensive way
1047 to ask if there's a whole packet
1048 waiting */
1049 if(op){
1050 op->b_o_s=os->b_o_s;
1051 if(os->e_o_s && os->body_fill_next==0)
1052 op->e_o_s=os->e_o_s;
1053 else
1054 op->e_o_s=0;
1055 if( (os->body_fill&FINFLAG) && !(os->body_fill_next&FINFLAG) )
1056 op->granulepos=os->granulepos;
1057 else
1058 op->granulepos=-1;
1059 op->packetno=os->packetno;
1060 }
1061
1062 if(adv){
1063 oggbyte_buffer ob;
1064 oggbyte_init(&ob,os->header_tail);
1065
1066 /* split the body contents off */
1067 if(op){
1068 op->packet=ogg_buffer_split(&os->body_tail,&os->body_head,
1069 os->body_fill&FINMASK);
1070 op->bytes=os->body_fill&FINMASK;
1071 }else{
1072 os->body_tail=ogg_buffer_pretruncate(os->body_tail,
1073 os->body_fill&FINMASK);
1074 if(os->body_tail==0)os->body_head=0;
1075 }
1076
1077 /* update lacing pointers */
1078 os->body_fill=os->body_fill_next;
1079 _next_lace(&ob,os);
1080 }else{
1081 if(op){
1082 op->packet=ogg_buffer_sub(os->body_tail,0,os->body_fill&FINMASK);
1083 op->bytes=os->body_fill&FINMASK;
1084 }
1085 }
1086
1087 if(adv){
1088 os->packetno++;
1089 os->b_o_s=0;
1090 }
1091
1092 return 1;
1093}
1094
1095int ogg_stream_packetout(ogg_stream_state *os,ogg_packet *op){
1096 return _packetout(os,op,1);
1097}
1098
1099int ogg_stream_packetpeek(ogg_stream_state *os,ogg_packet *op){
1100 return _packetout(os,op,0);
1101}
1102
1103int ogg_packet_release(ogg_packet *op) {
1104 if(op){
1105 ogg_buffer_release(op->packet);
1106 memset(op, 0, sizeof(*op));
1107 }
1108 return OGG_SUCCESS;
1109}
1110
1111int ogg_page_release(ogg_page *og) {
1112 if(og){
1113 ogg_buffer_release(og->header);
1114 ogg_buffer_release(og->body);
1115 memset(og, 0, sizeof(*og));
1116 }
1117 return OGG_SUCCESS;
1118}
1119
1120void ogg_page_dup(ogg_page *dup,ogg_page *orig){
1121 dup->header_len=orig->header_len;
1122 dup->body_len=orig->body_len;
1123 dup->header=ogg_buffer_dup(orig->header);
1124 dup->body=ogg_buffer_dup(orig->body);
1125}
1126
diff --git a/apps/codecs/Tremor/info.c b/apps/codecs/Tremor/info.c
new file mode 100644
index 0000000000..941695ea8e
--- /dev/null
+++ b/apps/codecs/Tremor/info.c
@@ -0,0 +1,354 @@
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 <stdlib.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
44/* This is more or less the same as strncasecmp - but that doesn't exist
45 * everywhere, and this is a fairly trivial function, so we include it */
46static int tagcompare(const char *s1, const char *s2, int n){
47 int c=0;
48 while(c < n){
49 if(toupper(s1[c]) != toupper(s2[c]))
50 return !0;
51 c++;
52 }
53 return 0;
54}
55
56char *vorbis_comment_query(vorbis_comment *vc, char *tag, int count){
57 long i;
58 int found = 0;
59 int taglen = strlen(tag)+1; /* +1 for the = we append */
60 char *fulltag = (char *)alloca(taglen+ 1);
61
62 strcpy(fulltag, tag);
63 strcat(fulltag, "=");
64
65 for(i=0;i<vc->comments;i++){
66 if(!tagcompare(vc->user_comments[i], fulltag, taglen)){
67 if(count == found)
68 /* We return a pointer to the data, not a copy */
69 return vc->user_comments[i] + taglen;
70 else
71 found++;
72 }
73 }
74 return NULL; /* didn't find anything */
75}
76
77int vorbis_comment_query_count(vorbis_comment *vc, char *tag){
78 int i,count=0;
79 int taglen = strlen(tag)+1; /* +1 for the = we append */
80 char *fulltag = (char *)alloca(taglen+1);
81 strcpy(fulltag,tag);
82 strcat(fulltag, "=");
83
84 for(i=0;i<vc->comments;i++){
85 if(!tagcompare(vc->user_comments[i], fulltag, taglen))
86 count++;
87 }
88
89 return count;
90}
91
92void vorbis_comment_clear(vorbis_comment *vc){
93 if(vc){
94 long i;
95 for(i=0;i<vc->comments;i++)
96 if(vc->user_comments[i])_ogg_free(vc->user_comments[i]);
97 if(vc->user_comments)_ogg_free(vc->user_comments);
98 if(vc->comment_lengths)_ogg_free(vc->comment_lengths);
99 if(vc->vendor)_ogg_free(vc->vendor);
100 }
101 memset(vc,0,sizeof(*vc));
102}
103
104/* blocksize 0 is guaranteed to be short, 1 is guarantted to be long.
105 They may be equal, but short will never ge greater than long */
106int vorbis_info_blocksize(vorbis_info *vi,int zo){
107 codec_setup_info *ci = (codec_setup_info *)vi->codec_setup;
108 return ci ? ci->blocksizes[zo] : -1;
109}
110
111/* used by synthesis, which has a full, alloced vi */
112void vorbis_info_init(vorbis_info *vi){
113 memset(vi,0,sizeof(*vi));
114 vi->codec_setup=(codec_setup_info *)_ogg_calloc(1,sizeof(codec_setup_info));
115}
116
117void vorbis_info_clear(vorbis_info *vi){
118 codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
119 int i;
120
121 if(ci){
122
123 for(i=0;i<ci->modes;i++)
124 if(ci->mode_param[i])_ogg_free(ci->mode_param[i]);
125
126 for(i=0;i<ci->maps;i++) /* unpack does the range checking */
127 _mapping_P[ci->map_type[i]]->free_info(ci->map_param[i]);
128
129 for(i=0;i<ci->floors;i++) /* unpack does the range checking */
130 _floor_P[ci->floor_type[i]]->free_info(ci->floor_param[i]);
131
132 for(i=0;i<ci->residues;i++) /* unpack does the range checking */
133 _residue_P[ci->residue_type[i]]->free_info(ci->residue_param[i]);
134
135 for(i=0;i<ci->books;i++){
136 if(ci->book_param[i]){
137 /* knows if the book was not alloced */
138 vorbis_staticbook_destroy(ci->book_param[i]);
139 }
140 if(ci->fullbooks)
141 vorbis_book_clear(ci->fullbooks+i);
142 }
143 if(ci->fullbooks)
144 _ogg_free(ci->fullbooks);
145
146 _ogg_free(ci);
147 }
148
149 memset(vi,0,sizeof(*vi));
150}
151
152/* Header packing/unpacking ********************************************/
153
154static int _vorbis_unpack_info(vorbis_info *vi,oggpack_buffer *opb){
155 codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
156 if(!ci)return(OV_EFAULT);
157
158 vi->version=oggpack_read(opb,32);
159 if(vi->version!=0)return(OV_EVERSION);
160
161 vi->channels=oggpack_read(opb,8);
162 vi->rate=oggpack_read(opb,32);
163
164 vi->bitrate_upper=oggpack_read(opb,32);
165 vi->bitrate_nominal=oggpack_read(opb,32);
166 vi->bitrate_lower=oggpack_read(opb,32);
167
168 ci->blocksizes[0]=1<<oggpack_read(opb,4);
169 ci->blocksizes[1]=1<<oggpack_read(opb,4);
170
171 if(vi->rate<1)goto err_out;
172 if(vi->channels<1)goto err_out;
173 if(ci->blocksizes[0]<64)goto err_out;
174 if(ci->blocksizes[1]<ci->blocksizes[0])goto err_out;
175 if(ci->blocksizes[1]>8192)goto err_out;
176
177 if(oggpack_read(opb,1)!=1)goto err_out; /* EOP check */
178
179 return(0);
180 err_out:
181 vorbis_info_clear(vi);
182 return(OV_EBADHEADER);
183}
184
185static int _vorbis_unpack_comment(vorbis_comment *vc,oggpack_buffer *opb){
186 int i;
187 int vendorlen=oggpack_read(opb,32);
188 if(vendorlen<0)goto err_out;
189 vc->vendor=(char *)_ogg_calloc(vendorlen+1,1);
190 _v_readstring(opb,vc->vendor,vendorlen);
191 vc->comments=oggpack_read(opb,32);
192 if(vc->comments<0)goto err_out;
193 vc->user_comments=(char **)_ogg_calloc(vc->comments+1,sizeof(*vc->user_comments));
194 vc->comment_lengths=(int *)_ogg_calloc(vc->comments+1, sizeof(*vc->comment_lengths));
195
196 for(i=0;i<vc->comments;i++){
197 int len=oggpack_read(opb,32);
198 if(len<0)goto err_out;
199 vc->comment_lengths[i]=len;
200 vc->user_comments[i]=(char *)_ogg_calloc(len+1,1);
201 _v_readstring(opb,vc->user_comments[i],len);
202 }
203 if(oggpack_read(opb,1)!=1)goto err_out; /* EOP check */
204
205 return(0);
206 err_out:
207 vorbis_comment_clear(vc);
208 return(OV_EBADHEADER);
209}
210
211/* all of the real encoding details are here. The modes, books,
212 everything */
213static int _vorbis_unpack_books(vorbis_info *vi,oggpack_buffer *opb){
214 codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
215 int i;
216 if(!ci)return(OV_EFAULT);
217
218 /* codebooks */
219 ci->books=oggpack_read(opb,8)+1;
220 /*ci->book_param=_ogg_calloc(ci->books,sizeof(*ci->book_param));*/
221 for(i=0;i<ci->books;i++){
222 ci->book_param[i]=(static_codebook *)_ogg_calloc(1,sizeof(*ci->book_param[i]));
223 if(vorbis_staticbook_unpack(opb,ci->book_param[i]))goto err_out;
224 }
225
226 /* time backend settings */
227 ci->times=oggpack_read(opb,6)+1;
228 /*ci->time_type=_ogg_malloc(ci->times*sizeof(*ci->time_type));*/
229 /*ci->time_param=_ogg_calloc(ci->times,sizeof(void *));*/
230 for(i=0;i<ci->times;i++){
231 ci->time_type[i]=oggpack_read(opb,16);
232 if(ci->time_type[i]<0 || ci->time_type[i]>=VI_TIMEB)goto err_out;
233 /* ci->time_param[i]=_time_P[ci->time_type[i]]->unpack(vi,opb);
234 Vorbis I has no time backend */
235 /*if(!ci->time_param[i])goto err_out;*/
236 }
237
238 /* floor backend settings */
239 ci->floors=oggpack_read(opb,6)+1;
240 /*ci->floor_type=_ogg_malloc(ci->floors*sizeof(*ci->floor_type));*/
241 /*ci->floor_param=_ogg_calloc(ci->floors,sizeof(void *));*/
242 for(i=0;i<ci->floors;i++){
243 ci->floor_type[i]=oggpack_read(opb,16);
244 if(ci->floor_type[i]<0 || ci->floor_type[i]>=VI_FLOORB)goto err_out;
245 ci->floor_param[i]=_floor_P[ci->floor_type[i]]->unpack(vi,opb);
246 if(!ci->floor_param[i])goto err_out;
247 }
248
249 /* residue backend settings */
250 ci->residues=oggpack_read(opb,6)+1;
251 /*ci->residue_type=_ogg_malloc(ci->residues*sizeof(*ci->residue_type));*/
252 /*ci->residue_param=_ogg_calloc(ci->residues,sizeof(void *));*/
253 for(i=0;i<ci->residues;i++){
254 ci->residue_type[i]=oggpack_read(opb,16);
255 if(ci->residue_type[i]<0 || ci->residue_type[i]>=VI_RESB)goto err_out;
256 ci->residue_param[i]=_residue_P[ci->residue_type[i]]->unpack(vi,opb);
257 if(!ci->residue_param[i])goto err_out;
258 }
259
260 /* map backend settings */
261 ci->maps=oggpack_read(opb,6)+1;
262 /*ci->map_type=_ogg_malloc(ci->maps*sizeof(*ci->map_type));*/
263 /*ci->map_param=_ogg_calloc(ci->maps,sizeof(void *));*/
264 for(i=0;i<ci->maps;i++){
265 ci->map_type[i]=oggpack_read(opb,16);
266 if(ci->map_type[i]<0 || ci->map_type[i]>=VI_MAPB)goto err_out;
267 ci->map_param[i]=_mapping_P[ci->map_type[i]]->unpack(vi,opb);
268 if(!ci->map_param[i])goto err_out;
269 }
270
271 /* mode settings */
272 ci->modes=oggpack_read(opb,6)+1;
273 /*vi->mode_param=_ogg_calloc(vi->modes,sizeof(void *));*/
274 for(i=0;i<ci->modes;i++){
275 ci->mode_param[i]=(vorbis_info_mode *)_ogg_calloc(1,sizeof(*ci->mode_param[i]));
276 ci->mode_param[i]->blockflag=oggpack_read(opb,1);
277 ci->mode_param[i]->windowtype=oggpack_read(opb,16);
278 ci->mode_param[i]->transformtype=oggpack_read(opb,16);
279 ci->mode_param[i]->mapping=oggpack_read(opb,8);
280
281 if(ci->mode_param[i]->windowtype>=VI_WINDOWB)goto err_out;
282 if(ci->mode_param[i]->transformtype>=VI_WINDOWB)goto err_out;
283 if(ci->mode_param[i]->mapping>=ci->maps)goto err_out;
284 }
285
286 if(oggpack_read(opb,1)!=1)goto err_out; /* top level EOP check */
287
288 return(0);
289 err_out:
290 vorbis_info_clear(vi);
291 return(OV_EBADHEADER);
292}
293
294/* The Vorbis header is in three packets; the initial small packet in
295 the first page that identifies basic parameters, a second packet
296 with bitstream comments and a third packet that holds the
297 codebook. */
298
299int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,ogg_packet *op){
300 oggpack_buffer opb;
301
302 if(op){
303 oggpack_readinit(&opb,op->packet);
304
305 /* Which of the three types of header is this? */
306 /* Also verify header-ness, vorbis */
307 {
308 char buffer[6];
309 int packtype=oggpack_read(&opb,8);
310 memset(buffer,0,6);
311 _v_readstring(&opb,buffer,6);
312 if(memcmp(buffer,"vorbis",6)){
313 /* not a vorbis header */
314 return(OV_ENOTVORBIS);
315 }
316 switch(packtype){
317 case 0x01: /* least significant *bit* is read first */
318 if(!op->b_o_s){
319 /* Not the initial packet */
320 return(OV_EBADHEADER);
321 }
322 if(vi->rate!=0){
323 /* previously initialized info header */
324 return(OV_EBADHEADER);
325 }
326
327 return(_vorbis_unpack_info(vi,&opb));
328
329 case 0x03: /* least significant *bit* is read first */
330 if(vi->rate==0){
331 /* um... we didn't get the initial header */
332 return(OV_EBADHEADER);
333 }
334
335 return(_vorbis_unpack_comment(vc,&opb));
336
337 case 0x05: /* least significant *bit* is read first */
338 if(vi->rate==0 || vc->vendor==NULL){
339 /* um... we didn;t get the initial header or comments yet */
340 return(OV_EBADHEADER);
341 }
342
343 return(_vorbis_unpack_books(vi,&opb));
344
345 default:
346 /* Not a valid vorbis header type */
347 return(OV_EBADHEADER);
348 break;
349 }
350 }
351 }
352 return(OV_EBADHEADER);
353}
354
diff --git a/apps/codecs/Tremor/ivorbiscodec.h b/apps/codecs/Tremor/ivorbiscodec.h
new file mode 100644
index 0000000000..d4de1fd344
--- /dev/null
+++ b/apps/codecs/Tremor/ivorbiscodec.h
@@ -0,0 +1,202 @@
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 long bitrate_window;
52
53 void *codec_setup;
54} vorbis_info;
55
56/* vorbis_dsp_state buffers the current vorbis audio
57 analysis/synthesis state. The DSP state belongs to a specific
58 logical bitstream ****************************************************/
59typedef struct vorbis_dsp_state{
60 int analysisp;
61 vorbis_info *vi;
62
63 ogg_int32_t **pcm;
64 ogg_int32_t **pcmret;
65 int pcm_storage;
66 int pcm_current;
67 int pcm_returned;
68
69 int preextrapolate;
70 int eofflag;
71
72 long lW;
73 long W;
74 long nW;
75 long centerW;
76
77 ogg_int64_t granulepos;
78 ogg_int64_t sequence;
79
80 void *backend_state;
81} vorbis_dsp_state;
82
83typedef struct vorbis_block{
84 /* necessary stream state for linking to the framing abstraction */
85 ogg_int32_t **pcm; /* this is a pointer into local storage */
86 oggpack_buffer opb;
87
88 long lW;
89 long W;
90 long nW;
91 int pcmend;
92 int mode;
93
94 int eofflag;
95 ogg_int64_t granulepos;
96 ogg_int64_t sequence;
97 vorbis_dsp_state *vd; /* For read-only access of configuration */
98
99 /* local storage to avoid remallocing; it's up to the mapping to
100 structure it */
101 void *localstore;
102 long localtop;
103 long localalloc;
104 long totaluse;
105 struct alloc_chain *reap;
106
107} vorbis_block;
108
109/* vorbis_block is a single block of data to be processed as part of
110the analysis/synthesis stream; it belongs to a specific logical
111bitstream, but is independant from other vorbis_blocks belonging to
112that logical bitstream. *************************************************/
113
114struct alloc_chain{
115 void *ptr;
116 struct alloc_chain *next;
117};
118
119/* vorbis_info contains all the setup information specific to the
120 specific compression/decompression mode in progress (eg,
121 psychoacoustic settings, channel setup, options, codebook
122 etc). vorbis_info and substructures are in backends.h.
123*********************************************************************/
124
125/* the comments are not part of vorbis_info so that vorbis_info can be
126 static storage */
127typedef struct vorbis_comment{
128 /* unlimited user comment fields. libvorbis writes 'libvorbis'
129 whatever vendor is set to in encode */
130 char **user_comments;
131 int *comment_lengths;
132 int comments;
133 char *vendor;
134
135} vorbis_comment;
136
137
138/* libvorbis encodes in two abstraction layers; first we perform DSP
139 and produce a packet (see docs/analysis.txt). The packet is then
140 coded into a framed OggSquish bitstream by the second layer (see
141 docs/framing.txt). Decode is the reverse process; we sync/frame
142 the bitstream and extract individual packets, then decode the
143 packet back into PCM audio.
144
145 The extra framing/packetizing is used in streaming formats, such as
146 files. Over the net (such as with UDP), the framing and
147 packetization aren't necessary as they're provided by the transport
148 and the streaming layer is not used */
149
150/* Vorbis PRIMITIVES: general ***************************************/
151
152extern void vorbis_info_init(vorbis_info *vi);
153extern void vorbis_info_clear(vorbis_info *vi);
154extern int vorbis_info_blocksize(vorbis_info *vi,int zo);
155extern void vorbis_comment_init(vorbis_comment *vc);
156extern void vorbis_comment_add(vorbis_comment *vc, char *comment);
157extern void vorbis_comment_add_tag(vorbis_comment *vc,
158 char *tag, char *contents);
159extern char *vorbis_comment_query(vorbis_comment *vc, char *tag, int count);
160extern int vorbis_comment_query_count(vorbis_comment *vc, char *tag);
161extern void vorbis_comment_clear(vorbis_comment *vc);
162
163extern int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb);
164extern int vorbis_block_clear(vorbis_block *vb);
165extern void vorbis_dsp_clear(vorbis_dsp_state *v);
166
167/* Vorbis PRIMITIVES: synthesis layer *******************************/
168extern int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,
169 ogg_packet *op);
170
171extern int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi);
172extern int vorbis_synthesis_restart(vorbis_dsp_state *v);
173extern int vorbis_synthesis(vorbis_block *vb,ogg_packet *op,int decodep);
174extern int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb);
175extern int vorbis_synthesis_pcmout(vorbis_dsp_state *v,ogg_int32_t ***pcm);
176extern int vorbis_synthesis_read(vorbis_dsp_state *v,int samples);
177extern long vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op);
178
179/* Vorbis ERRORS and return codes ***********************************/
180
181#define OV_FALSE -1
182#define OV_EOF -2
183#define OV_HOLE -3
184
185#define OV_EREAD -128
186#define OV_EFAULT -129
187#define OV_EIMPL -130
188#define OV_EINVAL -131
189#define OV_ENOTVORBIS -132
190#define OV_EBADHEADER -133
191#define OV_EVERSION -134
192#define OV_ENOTAUDIO -135
193#define OV_EBADPACKET -136
194#define OV_EBADLINK -137
195#define OV_ENOSEEK -138
196
197#ifdef __cplusplus
198}
199#endif /* __cplusplus */
200
201#endif
202
diff --git a/apps/codecs/Tremor/ivorbisfile.h b/apps/codecs/Tremor/ivorbisfile.h
new file mode 100644
index 0000000000..dd773788a1
--- /dev/null
+++ b/apps/codecs/Tremor/ivorbisfile.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: 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#define CHUNKSIZE 1024
30/* The function prototypes for the callbacks are basically the same as for
31 * the stdio functions fread, fseek, fclose, ftell.
32 * The one difference is that the FILE * arguments have been replaced with
33 * a void * - this is to be used as a pointer to whatever internal data these
34 * functions might need. In the stdio case, it's just a FILE * cast to a void *
35 *
36 * If you use other functions, check the docs for these functions and return
37 * the right values. For seek_func(), you *MUST* return -1 if the stream is
38 * unseekable
39 */
40typedef struct {
41 size_t (*read_func) (void *ptr, size_t size, size_t nmemb, void *datasource);
42 int (*seek_func) (void *datasource, ogg_int64_t offset, int whence);
43 int (*close_func) (void *datasource);
44 long (*tell_func) (void *datasource);
45} ov_callbacks;
46
47#define NOTOPEN 0
48#define PARTOPEN 1
49#define OPENED 2
50#define STREAMSET 3
51#define INITSET 4
52
53typedef struct OggVorbis_File {
54 void *datasource; /* Pointer to a FILE *, etc. */
55 int seekable;
56 ogg_int64_t offset;
57 ogg_int64_t end;
58 ogg_sync_state *oy;
59
60 /* If the FILE handle isn't seekable (eg, a pipe), only the current
61 stream appears */
62 int links;
63 ogg_int64_t *offsets;
64 ogg_int64_t *dataoffsets;
65 ogg_uint32_t *serialnos;
66 ogg_int64_t *pcmlengths;
67 vorbis_info *vi;
68 vorbis_comment *vc;
69
70 /* Decoding working state local storage */
71 ogg_int64_t pcm_offset;
72 int ready_state;
73 ogg_uint32_t current_serialno;
74 int current_link;
75
76 ogg_int64_t bittrack;
77 ogg_int64_t samptrack;
78
79 ogg_stream_state *os; /* take physical pages, weld into a logical
80 stream of packets */
81 vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */
82 vorbis_block vb; /* local working space for packet->PCM decode */
83
84 ov_callbacks callbacks;
85
86} OggVorbis_File;
87
88extern int ov_clear(OggVorbis_File *vf);
89extern int ov_open(FILE *f,OggVorbis_File *vf,char *initial,long ibytes);
90extern int ov_open_callbacks(void *datasource, OggVorbis_File *vf,
91 char *initial, long ibytes, ov_callbacks callbacks);
92
93extern int ov_test(FILE *f,OggVorbis_File *vf,char *initial,long ibytes);
94extern int ov_test_callbacks(void *datasource, OggVorbis_File *vf,
95 char *initial, long ibytes, ov_callbacks callbacks);
96extern int ov_test_open(OggVorbis_File *vf);
97
98extern long ov_bitrate(OggVorbis_File *vf,int i);
99extern long ov_bitrate_instant(OggVorbis_File *vf);
100extern long ov_streams(OggVorbis_File *vf);
101extern long ov_seekable(OggVorbis_File *vf);
102extern long ov_serialnumber(OggVorbis_File *vf,int i);
103
104extern ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i);
105extern ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i);
106extern ogg_int64_t ov_time_total(OggVorbis_File *vf,int i);
107
108extern int ov_raw_seek(OggVorbis_File *vf,ogg_int64_t pos);
109extern int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos);
110extern int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos);
111extern int ov_time_seek(OggVorbis_File *vf,ogg_int64_t pos);
112extern int ov_time_seek_page(OggVorbis_File *vf,ogg_int64_t pos);
113
114extern ogg_int64_t ov_raw_tell(OggVorbis_File *vf);
115extern ogg_int64_t ov_pcm_tell(OggVorbis_File *vf);
116extern ogg_int64_t ov_time_tell(OggVorbis_File *vf);
117
118extern vorbis_info *ov_info(OggVorbis_File *vf,int link);
119extern vorbis_comment *ov_comment(OggVorbis_File *vf,int link);
120
121extern long ov_read(OggVorbis_File *vf,char *buffer,int length,
122 int *bitstream);
123
124#ifdef __cplusplus
125}
126#endif /* __cplusplus */
127
128#endif
129
130
diff --git a/apps/codecs/Tremor/ivorbisfile_example.c b/apps/codecs/Tremor/ivorbisfile_example.c
new file mode 100644
index 0000000000..1854fc465a
--- /dev/null
+++ b/apps/codecs/Tremor/ivorbisfile_example.c
@@ -0,0 +1,86 @@
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: simple example decoder using vorbisidec
15
16 ********************************************************************/
17
18/* Takes a vorbis bitstream from stdin and writes raw stereo PCM to
19 stdout using vorbisfile. Using vorbisfile is much simpler than
20 dealing with libvorbis. */
21
22#include <stdio.h>
23#include <stdlib.h>
24#include <vorbis/ivorbiscodec.h>
25#include <vorbis/ivorbisfile.h>
26
27#ifdef _WIN32 /* We need the following two to set stdin/stdout to binary */
28#include <io.h>
29#include <fcntl.h>
30#endif
31
32char pcmout[4096]; /* take 4k out of the data segment, not the stack */
33
34int main(){
35 OggVorbis_File vf;
36 int eof=0;
37 int current_section;
38
39#ifdef _WIN32 /* We need to set stdin/stdout to binary mode. Damn windows. */
40 /* Beware the evil ifdef. We avoid these where we can, but this one we
41 cannot. Don't add any more, you'll probably go to hell if you do. */
42 _setmode( _fileno( stdin ), _O_BINARY );
43 _setmode( _fileno( stdout ), _O_BINARY );
44#endif
45
46 if(ov_open(stdin, &vf, NULL, 0) < 0) {
47 fprintf(stderr,"Input does not appear to be an Ogg bitstream.\n");
48 exit(1);
49 }
50
51 /* Throw the comments plus a few lines about the bitstream we're
52 decoding */
53 {
54 char **ptr=ov_comment(&vf,-1)->user_comments;
55 vorbis_info *vi=ov_info(&vf,-1);
56 while(*ptr){
57 fprintf(stderr,"%s\n",*ptr);
58 ++ptr;
59 }
60 fprintf(stderr,"\nBitstream is %d channel, %ldHz\n",vi->channels,vi->rate);
61 fprintf(stderr,"\nDecoded length: %ld samples\n",
62 (long)ov_pcm_total(&vf,-1));
63 fprintf(stderr,"Encoded by: %s\n\n",ov_comment(&vf,-1)->vendor);
64 }
65
66 while(!eof){
67 long ret=ov_read(&vf,pcmout,sizeof(pcmout),&current_section);
68 if (ret == 0) {
69 /* EOF */
70 eof=1;
71 } else if (ret < 0) {
72 /* error in the stream. Not a problem, just reporting it in
73 case we (the app) cares. In this case, we don't. */
74 } else {
75 /* we don't bother dealing with sample rate changes, etc, but
76 you'll have to*/
77 fwrite(pcmout,1,ret,stdout);
78 }
79 }
80
81 /* cleanup */
82 ov_clear(&vf);
83
84 fprintf(stderr,"Done.\n");
85 return(0);
86}
diff --git a/apps/codecs/Tremor/lsp_lookup.h b/apps/codecs/Tremor/lsp_lookup.h
new file mode 100644
index 0000000000..fa84851887
--- /dev/null
+++ b/apps/codecs/Tremor/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]={
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]={
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]={
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]={
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]={
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/Tremor/mapping0.c b/apps/codecs/Tremor/mapping0.c
new file mode 100644
index 0000000000..c54c896a99
--- /dev/null
+++ b/apps/codecs/Tremor/mapping0.c
@@ -0,0 +1,322 @@
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 <stdlib.h>
19#include <stdio.h>
20#include <string.h>
21#include <math.h>
22#include "ogg.h"
23#include "ivorbiscodec.h"
24#include "mdct.h"
25#include "codec_internal.h"
26#include "codebook.h"
27#include "window.h"
28#include "registry.h"
29#include "misc.h"
30
31/* simplistic, wasteful way of doing this (unique lookup for each
32 mode/submapping); there should be a central repository for
33 identical lookups. That will require minor work, so I'm putting it
34 off as low priority.
35
36 Why a lookup for each backend in a given mode? Because the
37 blocksize is set by the mode, and low backend lookups may require
38 parameters from other areas of the mode/mapping */
39
40typedef struct {
41 vorbis_info_mode *mode;
42 vorbis_info_mapping0 *map;
43
44 vorbis_look_floor **floor_look;
45
46 vorbis_look_residue **residue_look;
47
48 vorbis_func_floor **floor_func;
49 vorbis_func_residue **residue_func;
50
51 int ch;
52 long lastframe; /* if a different mode is called, we need to
53 invalidate decay */
54} vorbis_look_mapping0;
55
56static void mapping0_free_info(vorbis_info_mapping *i){
57 vorbis_info_mapping0 *info=(vorbis_info_mapping0 *)i;
58 if(info){
59 memset(info,0,sizeof(*info));
60 _ogg_free(info);
61 }
62}
63
64static void mapping0_free_look(vorbis_look_mapping *look){
65 int i;
66 vorbis_look_mapping0 *l=(vorbis_look_mapping0 *)look;
67 if(l){
68
69 for(i=0;i<l->map->submaps;i++){
70 l->floor_func[i]->free_look(l->floor_look[i]);
71 l->residue_func[i]->free_look(l->residue_look[i]);
72 }
73
74 _ogg_free(l->floor_func);
75 _ogg_free(l->residue_func);
76 _ogg_free(l->floor_look);
77 _ogg_free(l->residue_look);
78 memset(l,0,sizeof(*l));
79 _ogg_free(l);
80 }
81}
82
83static vorbis_look_mapping *mapping0_look(vorbis_dsp_state *vd,vorbis_info_mode *vm,
84 vorbis_info_mapping *m){
85 int i;
86 vorbis_info *vi=vd->vi;
87 codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
88 vorbis_look_mapping0 *look=(vorbis_look_mapping0 *)_ogg_calloc(1,sizeof(*look));
89 vorbis_info_mapping0 *info=look->map=(vorbis_info_mapping0 *)m;
90 look->mode=vm;
91
92 look->floor_look=(vorbis_look_floor **)_ogg_calloc(info->submaps,sizeof(*look->floor_look));
93
94 look->residue_look=(vorbis_look_residue **)_ogg_calloc(info->submaps,sizeof(*look->residue_look));
95
96 look->floor_func=(vorbis_func_floor **)_ogg_calloc(info->submaps,sizeof(*look->floor_func));
97 look->residue_func=(vorbis_func_residue **)_ogg_calloc(info->submaps,sizeof(*look->residue_func));
98
99 for(i=0;i<info->submaps;i++){
100 int floornum=info->floorsubmap[i];
101 int resnum=info->residuesubmap[i];
102
103 look->floor_func[i]=_floor_P[ci->floor_type[floornum]];
104 look->floor_look[i]=look->floor_func[i]->
105 look(vd,vm,ci->floor_param[floornum]);
106 look->residue_func[i]=_residue_P[ci->residue_type[resnum]];
107 look->residue_look[i]=look->residue_func[i]->
108 look(vd,vm,ci->residue_param[resnum]);
109
110 }
111
112 look->ch=vi->channels;
113
114 return(look);
115}
116
117static int ilog(unsigned int v){
118 int ret=0;
119 if(v)--v;
120 while(v){
121 ret++;
122 v>>=1;
123 }
124 return(ret);
125}
126
127/* also responsible for range checking */
128static vorbis_info_mapping *mapping0_unpack(vorbis_info *vi,oggpack_buffer *opb){
129 int i;
130 vorbis_info_mapping0 *info=(vorbis_info_mapping0 *)_ogg_calloc(1,sizeof(*info));
131 codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
132 memset(info,0,sizeof(*info));
133
134 if(oggpack_read(opb,1))
135 info->submaps=oggpack_read(opb,4)+1;
136 else
137 info->submaps=1;
138
139 if(oggpack_read(opb,1)){
140 info->coupling_steps=oggpack_read(opb,8)+1;
141
142 for(i=0;i<info->coupling_steps;i++){
143 int testM=info->coupling_mag[i]=oggpack_read(opb,ilog(vi->channels));
144 int testA=info->coupling_ang[i]=oggpack_read(opb,ilog(vi->channels));
145
146 if(testM<0 ||
147 testA<0 ||
148 testM==testA ||
149 testM>=vi->channels ||
150 testA>=vi->channels) goto err_out;
151 }
152
153 }
154
155 if(oggpack_read(opb,2)>0)goto err_out; /* 2,3:reserved */
156
157 if(info->submaps>1){
158 for(i=0;i<vi->channels;i++){
159 info->chmuxlist[i]=oggpack_read(opb,4);
160 if(info->chmuxlist[i]>=info->submaps)goto err_out;
161 }
162 }
163 for(i=0;i<info->submaps;i++){
164 int temp=oggpack_read(opb,8);
165 if(temp>=ci->times)goto err_out;
166 info->floorsubmap[i]=oggpack_read(opb,8);
167 if(info->floorsubmap[i]>=ci->floors)goto err_out;
168 info->residuesubmap[i]=oggpack_read(opb,8);
169 if(info->residuesubmap[i]>=ci->residues)goto err_out;
170 }
171
172 return info;
173
174 err_out:
175 mapping0_free_info(info);
176 return(NULL);
177}
178
179static int seq=0;
180static int mapping0_inverse(vorbis_block *vb,vorbis_look_mapping *l){
181 vorbis_dsp_state *vd=vb->vd;
182 vorbis_info *vi=vd->vi;
183 codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
184 private_state *b=(private_state *)vd->backend_state;
185 vorbis_look_mapping0 *look=(vorbis_look_mapping0 *)l;
186 vorbis_info_mapping0 *info=look->map;
187
188 int i,j;
189 long n=vb->pcmend=ci->blocksizes[vb->W];
190
191 ogg_int32_t **pcmbundle=(ogg_int32_t **)alloca(sizeof(*pcmbundle)*vi->channels);
192 int *zerobundle=(int *)alloca(sizeof(*zerobundle)*vi->channels);
193
194 int *nonzero =(int *)alloca(sizeof(*nonzero)*vi->channels);
195 void **floormemo=(void **)alloca(sizeof(*floormemo)*vi->channels);
196
197 /* time domain information decode (note that applying the
198 information would have to happen later; we'll probably add a
199 function entry to the harness for that later */
200 /* NOT IMPLEMENTED */
201
202 /* recover the spectral envelope; store it in the PCM vector for now */
203 for(i=0;i<vi->channels;i++){
204 int submap=info->chmuxlist[i];
205 floormemo[i]=look->floor_func[submap]->
206 inverse1(vb,look->floor_look[submap]);
207 if(floormemo[i])
208 nonzero[i]=1;
209 else
210 nonzero[i]=0;
211 memset(vb->pcm[i],0,sizeof(*vb->pcm[i])*n/2);
212 }
213
214 /* channel coupling can 'dirty' the nonzero listing */
215 for(i=0;i<info->coupling_steps;i++){
216 if(nonzero[info->coupling_mag[i]] ||
217 nonzero[info->coupling_ang[i]]){
218 nonzero[info->coupling_mag[i]]=1;
219 nonzero[info->coupling_ang[i]]=1;
220 }
221 }
222
223 /* recover the residue into our working vectors */
224 for(i=0;i<info->submaps;i++){
225 int ch_in_bundle=0;
226 for(j=0;j<vi->channels;j++){
227 if(info->chmuxlist[j]==i){
228 if(nonzero[j])
229 zerobundle[ch_in_bundle]=1;
230 else
231 zerobundle[ch_in_bundle]=0;
232 pcmbundle[ch_in_bundle++]=vb->pcm[j];
233 }
234 }
235
236 look->residue_func[i]->inverse(vb,look->residue_look[i],
237 pcmbundle,zerobundle,ch_in_bundle);
238 }
239
240 //for(j=0;j<vi->channels;j++)
241 //_analysis_output("coupled",seq+j,vb->pcm[j],-8,n/2,0,0);
242
243
244 /* channel coupling */
245 for(i=info->coupling_steps-1;i>=0;i--){
246 ogg_int32_t *pcmM=vb->pcm[info->coupling_mag[i]];
247 ogg_int32_t *pcmA=vb->pcm[info->coupling_ang[i]];
248
249 for(j=0;j<n/2;j++){
250 ogg_int32_t mag=pcmM[j];
251 ogg_int32_t ang=pcmA[j];
252
253 if(mag>0)
254 if(ang>0){
255 pcmM[j]=mag;
256 pcmA[j]=mag-ang;
257 }else{
258 pcmA[j]=mag;
259 pcmM[j]=mag+ang;
260 }
261 else
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 }
270 }
271
272 //for(j=0;j<vi->channels;j++)
273 //_analysis_output("residue",seq+j,vb->pcm[j],-8,n/2,0,0);
274
275 /* compute and apply spectral envelope */
276 for(i=0;i<vi->channels;i++){
277 ogg_int32_t *pcm=vb->pcm[i];
278 int submap=info->chmuxlist[i];
279 look->floor_func[submap]->
280 inverse2(vb,look->floor_look[submap],floormemo[i],pcm);
281 }
282
283 //for(j=0;j<vi->channels;j++)
284 //_analysis_output("mdct",seq+j,vb->pcm[j],-24,n/2,0,1);
285
286 /* transform the PCM data; takes PCM vector, vb; modifies PCM vector */
287 /* only MDCT right now.... */
288 for(i=0;i<vi->channels;i++){
289 ogg_int32_t *pcm=vb->pcm[i];
290 mdct_backward(n,pcm,pcm);
291 }
292
293 //for(j=0;j<vi->channels;j++)
294 //_analysis_output("imdct",seq+j,vb->pcm[j],-24,n,0,0);
295
296 /* window the data */
297 for(i=0;i<vi->channels;i++){
298 ogg_int32_t *pcm=vb->pcm[i];
299 if(nonzero[i])
300 _vorbis_apply_window(pcm,b->window,ci->blocksizes,vb->lW,vb->W,vb->nW);
301 else
302 for(j=0;j<n;j++)
303 pcm[j]=0;
304
305 }
306
307 //for(j=0;j<vi->channels;j++)
308 //_analysis_output("window",seq+j,vb->pcm[j],-24,n,0,0);
309
310 seq+=vi->channels;
311 /* all done! */
312 return(0);
313}
314
315/* export hooks */
316vorbis_func_mapping mapping0_exportbundle={
317 &mapping0_unpack,
318 &mapping0_look,
319 &mapping0_free_info,
320 &mapping0_free_look,
321 &mapping0_inverse
322};
diff --git a/apps/codecs/Tremor/mdct.c b/apps/codecs/Tremor/mdct.c
new file mode 100644
index 0000000000..cc201b2106
--- /dev/null
+++ b/apps/codecs/Tremor/mdct.c
@@ -0,0 +1,510 @@
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: normalized modified discrete cosine transform
15 power of two length transform only [64 <= n ]
16 last mod: $Id$
17
18 Original algorithm adapted long ago from _The use of multirate filter
19 banks for coding of high quality digital audio_, by T. Sporer,
20 K. Brandenburg and B. Edler, collection of the European Signal
21 Processing Conference (EUSIPCO), Amsterdam, June 1992, Vol.1, pp
22 211-214
23
24 The below code implements an algorithm that no longer looks much like
25 that presented in the paper, but the basic structure remains if you
26 dig deep enough to see it.
27
28 This module DOES NOT INCLUDE code to generate/apply the window
29 function. Everybody has their own weird favorite including me... I
30 happen to like the properties of y=sin(.5PI*sin^2(x)), but others may
31 vehemently disagree.
32
33 ********************************************************************/
34
35#include "ivorbiscodec.h"
36#include "os.h"
37#include "misc.h"
38#include "mdct.h"
39#include "mdct_lookup.h"
40
41
42/* 8 point butterfly (in place) */
43STIN void mdct_butterfly_8(DATA_TYPE *x){
44
45 REG_TYPE r0 = x[4] + x[0];
46 REG_TYPE r1 = x[4] - x[0];
47 REG_TYPE r2 = x[5] + x[1];
48 REG_TYPE r3 = x[5] - x[1];
49 REG_TYPE r4 = x[6] + x[2];
50 REG_TYPE r5 = x[6] - x[2];
51 REG_TYPE r6 = x[7] + x[3];
52 REG_TYPE r7 = x[7] - x[3];
53
54 x[0] = r5 + r3;
55 x[1] = r7 - r1;
56 x[2] = r5 - r3;
57 x[3] = r7 + r1;
58 x[4] = r4 - r0;
59 x[5] = r6 - r2;
60 x[6] = r4 + r0;
61 x[7] = r6 + r2;
62 MB();
63}
64
65/* 16 point butterfly (in place, 4 register) */
66STIN void mdct_butterfly_16(DATA_TYPE *x){
67
68 REG_TYPE r0, r1;
69
70 r0 = x[ 0] - x[ 8]; x[ 8] += x[ 0];
71 r1 = x[ 1] - x[ 9]; x[ 9] += x[ 1];
72 x[ 0] = MULT31((r0 + r1) , cPI2_8);
73 x[ 1] = MULT31((r1 - r0) , cPI2_8);
74 MB();
75
76 r0 = x[10] - x[ 2]; x[10] += x[ 2];
77 r1 = x[ 3] - x[11]; x[11] += x[ 3];
78 x[ 2] = r1; x[ 3] = r0;
79 MB();
80
81 r0 = x[12] - x[ 4]; x[12] += x[ 4];
82 r1 = x[13] - x[ 5]; x[13] += x[ 5];
83 x[ 4] = MULT31((r0 - r1) , cPI2_8);
84 x[ 5] = MULT31((r0 + r1) , cPI2_8);
85 MB();
86
87 r0 = x[14] - x[ 6]; x[14] += x[ 6];
88 r1 = x[15] - x[ 7]; x[15] += x[ 7];
89 x[ 6] = r0; x[ 7] = r1;
90 MB();
91
92 mdct_butterfly_8(x);
93 mdct_butterfly_8(x+8);
94}
95
96/* 32 point butterfly (in place, 4 register) */
97STIN void mdct_butterfly_32(DATA_TYPE *x){
98
99 REG_TYPE r0, r1;
100
101 r0 = x[30] - x[14]; x[30] += x[14];
102 r1 = x[31] - x[15]; x[31] += x[15];
103 x[14] = r0; x[15] = r1;
104 MB();
105
106 r0 = x[28] - x[12]; x[28] += x[12];
107 r1 = x[29] - x[13]; x[29] += x[13];
108 XNPROD31( r0, r1, cPI1_8, cPI3_8, &x[12], &x[13] );
109 MB();
110
111 r0 = x[26] - x[10]; x[26] += x[10];
112 r1 = x[27] - x[11]; x[27] += x[11];
113 x[10] = MULT31((r0 - r1) , cPI2_8);
114 x[11] = MULT31((r0 + r1) , cPI2_8);
115 MB();
116
117 r0 = x[24] - x[ 8]; x[24] += x[ 8];
118 r1 = x[25] - x[ 9]; x[25] += x[ 9];
119 XNPROD31( r0, r1, cPI3_8, cPI1_8, &x[ 8], &x[ 9] );
120 MB();
121
122 r0 = x[22] - x[ 6]; x[22] += x[ 6];
123 r1 = x[ 7] - x[23]; x[23] += x[ 7];
124 x[ 6] = r1; x[ 7] = r0;
125 MB();
126
127 r0 = x[ 4] - x[20]; x[20] += x[ 4];
128 r1 = x[ 5] - x[21]; x[21] += x[ 5];
129 XPROD31 ( r0, r1, cPI3_8, cPI1_8, &x[ 4], &x[ 5] );
130 MB();
131
132 r0 = x[ 2] - x[18]; x[18] += x[ 2];
133 r1 = x[ 3] - x[19]; x[19] += x[ 3];
134 x[ 2] = MULT31((r1 + r0) , cPI2_8);
135 x[ 3] = MULT31((r1 - r0) , cPI2_8);
136 MB();
137
138 r0 = x[ 0] - x[16]; x[16] += x[ 0];
139 r1 = x[ 1] - x[17]; x[17] += x[ 1];
140 XPROD31 ( r0, r1, cPI1_8, cPI3_8, &x[ 0], &x[ 1] );
141 MB();
142
143 mdct_butterfly_16(x);
144 mdct_butterfly_16(x+16);
145}
146
147/* N/stage point generic N stage butterfly (in place, 2 register) */
148STIN void mdct_butterfly_generic(DATA_TYPE *x,int points,int step){
149
150 LOOKUP_T *T = sincos_lookup0;
151 DATA_TYPE *x1 = x + points - 8;
152 DATA_TYPE *x2 = x + (points>>1) - 8;
153 REG_TYPE r0;
154 REG_TYPE r1;
155
156 do{
157 r0 = x1[6] - x2[6]; x1[6] += x2[6];
158 r1 = x2[7] - x1[7]; x1[7] += x2[7];
159 XPROD31( r1, r0, T[0], T[1], &x2[6], &x2[7] ); T+=step;
160
161 r0 = x1[4] - x2[4]; x1[4] += x2[4];
162 r1 = x2[5] - x1[5]; x1[5] += x2[5];
163 XPROD31( r1, r0, T[0], T[1], &x2[4], &x2[5] ); T+=step;
164
165 r0 = x1[2] - x2[2]; x1[2] += x2[2];
166 r1 = x2[3] - x1[3]; x1[3] += x2[3];
167 XPROD31( r1, r0, T[0], T[1], &x2[2], &x2[3] ); T+=step;
168
169 r0 = x1[0] - x2[0]; x1[0] += x2[0];
170 r1 = x2[1] - x1[1]; x1[1] += x2[1];
171 XPROD31( r1, r0, T[0], T[1], &x2[0], &x2[1] ); T+=step;
172
173 x1-=8; x2-=8;
174 }while(T<sincos_lookup0+1024);
175 do{
176 r0 = x1[6] - x2[6]; x1[6] += x2[6];
177 r1 = x1[7] - x2[7]; x1[7] += x2[7];
178 XNPROD31( r0, r1, T[0], T[1], &x2[6], &x2[7] ); T-=step;
179
180 r0 = x1[4] - x2[4]; x1[4] += x2[4];
181 r1 = x1[5] - x2[5]; x1[5] += x2[5];
182 XNPROD31( r0, r1, T[0], T[1], &x2[4], &x2[5] ); T-=step;
183
184 r0 = x1[2] - x2[2]; x1[2] += x2[2];
185 r1 = x1[3] - x2[3]; x1[3] += x2[3];
186 XNPROD31( r0, r1, T[0], T[1], &x2[2], &x2[3] ); T-=step;
187
188 r0 = x1[0] - x2[0]; x1[0] += x2[0];
189 r1 = x1[1] - x2[1]; x1[1] += x2[1];
190 XNPROD31( r0, r1, T[0], T[1], &x2[0], &x2[1] ); T-=step;
191
192 x1-=8; x2-=8;
193 }while(T>sincos_lookup0);
194 do{
195 r0 = x2[6] - x1[6]; x1[6] += x2[6];
196 r1 = x2[7] - x1[7]; x1[7] += x2[7];
197 XPROD31( r0, r1, T[0], T[1], &x2[6], &x2[7] ); T+=step;
198
199 r0 = x2[4] - x1[4]; x1[4] += x2[4];
200 r1 = x2[5] - x1[5]; x1[5] += x2[5];
201 XPROD31( r0, r1, T[0], T[1], &x2[4], &x2[5] ); T+=step;
202
203 r0 = x2[2] - x1[2]; x1[2] += x2[2];
204 r1 = x2[3] - x1[3]; x1[3] += x2[3];
205 XPROD31( r0, r1, T[0], T[1], &x2[2], &x2[3] ); T+=step;
206
207 r0 = x2[0] - x1[0]; x1[0] += x2[0];
208 r1 = x2[1] - x1[1]; x1[1] += x2[1];
209 XPROD31( r0, r1, T[0], T[1], &x2[0], &x2[1] ); T+=step;
210
211 x1-=8; x2-=8;
212 }while(T<sincos_lookup0+1024);
213 do{
214 r0 = x1[6] - x2[6]; x1[6] += x2[6];
215 r1 = x2[7] - x1[7]; x1[7] += x2[7];
216 XNPROD31( r1, r0, T[0], T[1], &x2[6], &x2[7] ); T-=step;
217
218 r0 = x1[4] - x2[4]; x1[4] += x2[4];
219 r1 = x2[5] - x1[5]; x1[5] += x2[5];
220 XNPROD31( r1, r0, T[0], T[1], &x2[4], &x2[5] ); T-=step;
221
222 r0 = x1[2] - x2[2]; x1[2] += x2[2];
223 r1 = x2[3] - x1[3]; x1[3] += x2[3];
224 XNPROD31( r1, r0, T[0], T[1], &x2[2], &x2[3] ); T-=step;
225
226 r0 = x1[0] - x2[0]; x1[0] += x2[0];
227 r1 = x2[1] - x1[1]; x1[1] += x2[1];
228 XNPROD31( r1, r0, T[0], T[1], &x2[0], &x2[1] ); T-=step;
229
230 x1-=8; x2-=8;
231 }while(T>sincos_lookup0);
232}
233
234STIN void mdct_butterflies(DATA_TYPE *x,int points,int shift){
235
236 int stages=8-shift;
237 int i,j;
238
239 for(i=0;--stages>0;i++){
240 for(j=0;j<(1<<i);j++)
241 mdct_butterfly_generic(x+(points>>i)*j,points>>i,4<<(i+shift));
242 }
243
244 for(j=0;j<points;j+=32)
245 mdct_butterfly_32(x+j);
246
247}
248
249static unsigned char bitrev[16]={0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15};
250
251STIN int bitrev12(int x){
252 return bitrev[x>>8]|(bitrev[(x&0x0f0)>>4]<<4)|(((int)bitrev[x&0x00f])<<8);
253}
254
255STIN void mdct_bitreverse(DATA_TYPE *x,int n,int step,int shift){
256
257 int bit = 0;
258 DATA_TYPE *w0 = x;
259 DATA_TYPE *w1 = x = w0+(n>>1);
260 LOOKUP_T *T = (step>=4)?(sincos_lookup0+(step>>1)):sincos_lookup1;
261 LOOKUP_T *Ttop = T+1024;
262 DATA_TYPE r2;
263
264 do{
265 DATA_TYPE r3 = bitrev12(bit++);
266 DATA_TYPE *x0 = x + ((r3 ^ 0xfff)>>shift) -1;
267 DATA_TYPE *x1 = x + (r3>>shift);
268
269 REG_TYPE r0 = x0[0] + x1[0];
270 REG_TYPE r1 = x1[1] - x0[1];
271
272 XPROD32( r0, r1, T[1], T[0], &r2, &r3 ); T+=step;
273
274 w1 -= 4;
275
276 r0 = (x0[1] + x1[1])>>1;
277 r1 = (x0[0] - x1[0])>>1;
278 w0[0] = r0 + r2;
279 w0[1] = r1 + r3;
280 w1[2] = r0 - r2;
281 w1[3] = r3 - r1;
282
283 r3 = bitrev12(bit++);
284 x0 = x + ((r3 ^ 0xfff)>>shift) -1;
285 x1 = x + (r3>>shift);
286
287 r0 = x0[0] + x1[0];
288 r1 = x1[1] - x0[1];
289
290 XPROD32( r0, r1, T[1], T[0], &r2, &r3 ); T+=step;
291
292 r0 = (x0[1] + x1[1])>>1;
293 r1 = (x0[0] - x1[0])>>1;
294 w0[2] = r0 + r2;
295 w0[3] = r1 + r3;
296 w1[0] = r0 - r2;
297 w1[1] = r3 - r1;
298
299 w0 += 4;
300 }while(T<Ttop);
301 do{
302 DATA_TYPE r3 = bitrev12(bit++);
303 DATA_TYPE *x0 = x + ((r3 ^ 0xfff)>>shift) -1;
304 DATA_TYPE *x1 = x + (r3>>shift);
305
306 REG_TYPE r0 = x0[0] + x1[0];
307 REG_TYPE r1 = x1[1] - x0[1];
308
309 T-=step; XPROD32( r0, r1, T[0], T[1], &r2, &r3 );
310
311 w1 -= 4;
312
313 r0 = (x0[1] + x1[1])>>1;
314 r1 = (x0[0] - x1[0])>>1;
315 w0[0] = r0 + r2;
316 w0[1] = r1 + r3;
317 w1[2] = r0 - r2;
318 w1[3] = r3 - r1;
319
320 r3 = bitrev12(bit++);
321 x0 = x + ((r3 ^ 0xfff)>>shift) -1;
322 x1 = x + (r3>>shift);
323
324 r0 = x0[0] + x1[0];
325 r1 = x1[1] - x0[1];
326
327 T-=step; XPROD32( r0, r1, T[0], T[1], &r2, &r3 );
328
329 r0 = (x0[1] + x1[1])>>1;
330 r1 = (x0[0] - x1[0])>>1;
331 w0[2] = r0 + r2;
332 w0[3] = r1 + r3;
333 w1[0] = r0 - r2;
334 w1[1] = r3 - r1;
335
336 w0 += 4;
337 }while(w0<w1);
338}
339
340void mdct_backward(int n, DATA_TYPE *in, DATA_TYPE *out){
341 int n2=n>>1;
342 int n4=n>>2;
343 DATA_TYPE *iX;
344 DATA_TYPE *oX;
345 LOOKUP_T *T;
346 LOOKUP_T *V;
347 int shift;
348 int step;
349
350 for (shift=6;!(n&(1<<shift));shift++);
351 shift=13-shift;
352 step=2<<shift;
353
354 /* rotate */
355
356 iX = in+n2-7;
357 oX = out+n2+n4;
358 T = sincos_lookup0;
359
360 do{
361 oX-=4;
362 XPROD31( iX[4], iX[6], T[0], T[1], &oX[2], &oX[3] ); T+=step;
363 XPROD31( iX[0], iX[2], T[0], T[1], &oX[0], &oX[1] ); T+=step;
364 iX-=8;
365 }while(iX>=in+n4);
366 do{
367 oX-=4;
368 XPROD31( iX[4], iX[6], T[1], T[0], &oX[2], &oX[3] ); T-=step;
369 XPROD31( iX[0], iX[2], T[1], T[0], &oX[0], &oX[1] ); T-=step;
370 iX-=8;
371 }while(iX>=in);
372
373 iX = in+n2-8;
374 oX = out+n2+n4;
375 T = sincos_lookup0;
376
377 do{
378 T+=step; XNPROD31( iX[6], iX[4], T[0], T[1], &oX[0], &oX[1] );
379 T+=step; XNPROD31( iX[2], iX[0], T[0], T[1], &oX[2], &oX[3] );
380 iX-=8;
381 oX+=4;
382 }while(iX>=in+n4);
383 do{
384 T-=step; XNPROD31( iX[6], iX[4], T[1], T[0], &oX[0], &oX[1] );
385 T-=step; XNPROD31( iX[2], iX[0], T[1], T[0], &oX[2], &oX[3] );
386 iX-=8;
387 oX+=4;
388 }while(iX>=in);
389
390 mdct_butterflies(out+n2,n2,shift);
391 mdct_bitreverse(out,n,step,shift);
392
393 /* rotate + window */
394
395 step>>=2;
396 {
397 DATA_TYPE *oX1=out+n2+n4;
398 DATA_TYPE *oX2=out+n2+n4;
399 DATA_TYPE *iX =out;
400
401 switch(step) {
402 default: {
403 T=(step>=4)?(sincos_lookup0+(step>>1)):sincos_lookup1;
404 do{
405 oX1-=4;
406 XPROD31( iX[0], -iX[1], T[0], T[1], &oX1[3], &oX2[0] ); T+=step;
407 XPROD31( iX[2], -iX[3], T[0], T[1], &oX1[2], &oX2[1] ); T+=step;
408 XPROD31( iX[4], -iX[5], T[0], T[1], &oX1[1], &oX2[2] ); T+=step;
409 XPROD31( iX[6], -iX[7], T[0], T[1], &oX1[0], &oX2[3] ); T+=step;
410 oX2+=4;
411 iX+=8;
412 }while(iX<oX1);
413 break;
414 }
415
416 case 1: {
417 /* linear interpolation between table values: offset=0.5, step=1 */
418 REG_TYPE t0,t1,v0,v1;
419 T = sincos_lookup0;
420 V = sincos_lookup1;
421 t0 = (*T++)>>1;
422 t1 = (*T++)>>1;
423 do{
424 oX1-=4;
425
426 t0 += (v0 = (*V++)>>1);
427 t1 += (v1 = (*V++)>>1);
428 XPROD31( iX[0], -iX[1], t0, t1, &oX1[3], &oX2[0] );
429 v0 += (t0 = (*T++)>>1);
430 v1 += (t1 = (*T++)>>1);
431 XPROD31( iX[2], -iX[3], v0, v1, &oX1[2], &oX2[1] );
432 t0 += (v0 = (*V++)>>1);
433 t1 += (v1 = (*V++)>>1);
434 XPROD31( iX[4], -iX[5], t0, t1, &oX1[1], &oX2[2] );
435 v0 += (t0 = (*T++)>>1);
436 v1 += (t1 = (*T++)>>1);
437 XPROD31( iX[6], -iX[7], v0, v1, &oX1[0], &oX2[3] );
438
439 oX2+=4;
440 iX+=8;
441 }while(iX<oX1);
442 break;
443 }
444
445 case 0: {
446 /* linear interpolation between table values: offset=0.25, step=0.5 */
447 REG_TYPE t0,t1,v0,v1,q0,q1;
448 T = sincos_lookup0;
449 V = sincos_lookup1;
450 t0 = *T++;
451 t1 = *T++;
452 do{
453 oX1-=4;
454
455 v0 = *V++;
456 v1 = *V++;
457 t0 += (q0 = (v0-t0)>>2);
458 t1 += (q1 = (v1-t1)>>2);
459 XPROD31( iX[0], -iX[1], t0, t1, &oX1[3], &oX2[0] );
460 t0 = v0-q0;
461 t1 = v1-q1;
462 XPROD31( iX[2], -iX[3], t0, t1, &oX1[2], &oX2[1] );
463
464 t0 = *T++;
465 t1 = *T++;
466 v0 += (q0 = (t0-v0)>>2);
467 v1 += (q1 = (t1-v1)>>2);
468 XPROD31( iX[4], -iX[5], v0, v1, &oX1[1], &oX2[2] );
469 v0 = t0-q0;
470 v1 = t1-q1;
471 XPROD31( iX[6], -iX[7], v0, v1, &oX1[0], &oX2[3] );
472
473 oX2+=4;
474 iX+=8;
475 }while(iX<oX1);
476 break;
477 }
478 }
479
480 iX=out+n2+n4;
481 oX1=out+n4;
482 oX2=oX1;
483
484 do{
485 oX1-=4;
486 iX-=4;
487
488 oX2[0] = -(oX1[3] = iX[3]);
489 oX2[1] = -(oX1[2] = iX[2]);
490 oX2[2] = -(oX1[1] = iX[1]);
491 oX2[3] = -(oX1[0] = iX[0]);
492
493 oX2+=4;
494 }while(oX2<iX);
495
496 iX=out+n2+n4;
497 oX1=out+n2+n4;
498 oX2=out+n2;
499
500 do{
501 oX1-=4;
502 oX1[0]= iX[3];
503 oX1[1]= iX[2];
504 oX1[2]= iX[1];
505 oX1[3]= iX[0];
506 iX+=4;
507 }while(oX1>oX2);
508 }
509}
510
diff --git a/apps/codecs/Tremor/mdct.h b/apps/codecs/Tremor/mdct.h
new file mode 100644
index 0000000000..6d8890720c
--- /dev/null
+++ b/apps/codecs/Tremor/mdct.h
@@ -0,0 +1,52 @@
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: modified discrete cosine transform prototypes
15
16 ********************************************************************/
17
18#ifndef _OGG_mdct_H_
19#define _OGG_mdct_H_
20
21#include "ivorbiscodec.h"
22#include "misc.h"
23
24#define DATA_TYPE ogg_int32_t
25#define REG_TYPE register ogg_int32_t
26
27#ifdef _LOW_ACCURACY_
28#define cPI3_8 (0x0062)
29#define cPI2_8 (0x00b5)
30#define cPI1_8 (0x00ed)
31#else
32#define cPI3_8 (0x30fbc54d)
33#define cPI2_8 (0x5a82799a)
34#define cPI1_8 (0x7641af3d)
35#endif
36
37extern void mdct_forward(int n, DATA_TYPE *in, DATA_TYPE *out);
38extern void mdct_backward(int n, DATA_TYPE *in, DATA_TYPE *out);
39
40#endif
41
42
43
44
45
46
47
48
49
50
51
52
diff --git a/apps/codecs/Tremor/mdct_lookup.h b/apps/codecs/Tremor/mdct_lookup.h
new file mode 100644
index 0000000000..970e199f7f
--- /dev/null
+++ b/apps/codecs/Tremor/mdct_lookup.h
@@ -0,0 +1,540 @@
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: sin,cos lookup tables
15
16 ********************************************************************/
17
18#include "os_types.h"
19
20/* {sin(2*i*PI/4096), cos(2*i*PI/4096)}, with i = 0 to 512 */
21static LOOKUP_T sincos_lookup0[1026] = {
22 X(0x00000000), X(0x7fffffff), X(0x003243f5), X(0x7ffff621),
23 X(0x006487e3), X(0x7fffd886), X(0x0096cbc1), X(0x7fffa72c),
24 X(0x00c90f88), X(0x7fff6216), X(0x00fb5330), X(0x7fff0943),
25 X(0x012d96b1), X(0x7ffe9cb2), X(0x015fda03), X(0x7ffe1c65),
26 X(0x01921d20), X(0x7ffd885a), X(0x01c45ffe), X(0x7ffce093),
27 X(0x01f6a297), X(0x7ffc250f), X(0x0228e4e2), X(0x7ffb55ce),
28 X(0x025b26d7), X(0x7ffa72d1), X(0x028d6870), X(0x7ff97c18),
29 X(0x02bfa9a4), X(0x7ff871a2), X(0x02f1ea6c), X(0x7ff75370),
30 X(0x03242abf), X(0x7ff62182), X(0x03566a96), X(0x7ff4dbd9),
31 X(0x0388a9ea), X(0x7ff38274), X(0x03bae8b2), X(0x7ff21553),
32 X(0x03ed26e6), X(0x7ff09478), X(0x041f6480), X(0x7feeffe1),
33 X(0x0451a177), X(0x7fed5791), X(0x0483ddc3), X(0x7feb9b85),
34 X(0x04b6195d), X(0x7fe9cbc0), X(0x04e8543e), X(0x7fe7e841),
35 X(0x051a8e5c), X(0x7fe5f108), X(0x054cc7b1), X(0x7fe3e616),
36 X(0x057f0035), X(0x7fe1c76b), X(0x05b137df), X(0x7fdf9508),
37 X(0x05e36ea9), X(0x7fdd4eec), X(0x0615a48b), X(0x7fdaf519),
38 X(0x0647d97c), X(0x7fd8878e), X(0x067a0d76), X(0x7fd6064c),
39 X(0x06ac406f), X(0x7fd37153), X(0x06de7262), X(0x7fd0c8a3),
40 X(0x0710a345), X(0x7fce0c3e), X(0x0742d311), X(0x7fcb3c23),
41 X(0x077501be), X(0x7fc85854), X(0x07a72f45), X(0x7fc560cf),
42 X(0x07d95b9e), X(0x7fc25596), X(0x080b86c2), X(0x7fbf36aa),
43 X(0x083db0a7), X(0x7fbc040a), X(0x086fd947), X(0x7fb8bdb8),
44 X(0x08a2009a), X(0x7fb563b3), X(0x08d42699), X(0x7fb1f5fc),
45 X(0x09064b3a), X(0x7fae7495), X(0x09386e78), X(0x7faadf7c),
46 X(0x096a9049), X(0x7fa736b4), X(0x099cb0a7), X(0x7fa37a3c),
47 X(0x09cecf89), X(0x7f9faa15), X(0x0a00ece8), X(0x7f9bc640),
48 X(0x0a3308bd), X(0x7f97cebd), X(0x0a6522fe), X(0x7f93c38c),
49 X(0x0a973ba5), X(0x7f8fa4b0), X(0x0ac952aa), X(0x7f8b7227),
50 X(0x0afb6805), X(0x7f872bf3), X(0x0b2d7baf), X(0x7f82d214),
51 X(0x0b5f8d9f), X(0x7f7e648c), X(0x0b919dcf), X(0x7f79e35a),
52 X(0x0bc3ac35), X(0x7f754e80), X(0x0bf5b8cb), X(0x7f70a5fe),
53 X(0x0c27c389), X(0x7f6be9d4), X(0x0c59cc68), X(0x7f671a05),
54 X(0x0c8bd35e), X(0x7f62368f), X(0x0cbdd865), X(0x7f5d3f75),
55 X(0x0cefdb76), X(0x7f5834b7), X(0x0d21dc87), X(0x7f531655),
56 X(0x0d53db92), X(0x7f4de451), X(0x0d85d88f), X(0x7f489eaa),
57 X(0x0db7d376), X(0x7f434563), X(0x0de9cc40), X(0x7f3dd87c),
58 X(0x0e1bc2e4), X(0x7f3857f6), X(0x0e4db75b), X(0x7f32c3d1),
59 X(0x0e7fa99e), X(0x7f2d1c0e), X(0x0eb199a4), X(0x7f2760af),
60 X(0x0ee38766), X(0x7f2191b4), X(0x0f1572dc), X(0x7f1baf1e),
61 X(0x0f475bff), X(0x7f15b8ee), X(0x0f7942c7), X(0x7f0faf25),
62 X(0x0fab272b), X(0x7f0991c4), X(0x0fdd0926), X(0x7f0360cb),
63 X(0x100ee8ad), X(0x7efd1c3c), X(0x1040c5bb), X(0x7ef6c418),
64 X(0x1072a048), X(0x7ef05860), X(0x10a4784b), X(0x7ee9d914),
65 X(0x10d64dbd), X(0x7ee34636), X(0x11082096), X(0x7edc9fc6),
66 X(0x1139f0cf), X(0x7ed5e5c6), X(0x116bbe60), X(0x7ecf1837),
67 X(0x119d8941), X(0x7ec8371a), X(0x11cf516a), X(0x7ec14270),
68 X(0x120116d5), X(0x7eba3a39), X(0x1232d979), X(0x7eb31e78),
69 X(0x1264994e), X(0x7eabef2c), X(0x1296564d), X(0x7ea4ac58),
70 X(0x12c8106f), X(0x7e9d55fc), X(0x12f9c7aa), X(0x7e95ec1a),
71 X(0x132b7bf9), X(0x7e8e6eb2), X(0x135d2d53), X(0x7e86ddc6),
72 X(0x138edbb1), X(0x7e7f3957), X(0x13c0870a), X(0x7e778166),
73 X(0x13f22f58), X(0x7e6fb5f4), X(0x1423d492), X(0x7e67d703),
74 X(0x145576b1), X(0x7e5fe493), X(0x148715ae), X(0x7e57dea7),
75 X(0x14b8b17f), X(0x7e4fc53e), X(0x14ea4a1f), X(0x7e47985b),
76 X(0x151bdf86), X(0x7e3f57ff), X(0x154d71aa), X(0x7e37042a),
77 X(0x157f0086), X(0x7e2e9cdf), X(0x15b08c12), X(0x7e26221f),
78 X(0x15e21445), X(0x7e1d93ea), X(0x16139918), X(0x7e14f242),
79 X(0x16451a83), X(0x7e0c3d29), X(0x1676987f), X(0x7e0374a0),
80 X(0x16a81305), X(0x7dfa98a8), X(0x16d98a0c), X(0x7df1a942),
81 X(0x170afd8d), X(0x7de8a670), X(0x173c6d80), X(0x7ddf9034),
82 X(0x176dd9de), X(0x7dd6668f), X(0x179f429f), X(0x7dcd2981),
83 X(0x17d0a7bc), X(0x7dc3d90d), X(0x1802092c), X(0x7dba7534),
84 X(0x183366e9), X(0x7db0fdf8), X(0x1864c0ea), X(0x7da77359),
85 X(0x18961728), X(0x7d9dd55a), X(0x18c7699b), X(0x7d9423fc),
86 X(0x18f8b83c), X(0x7d8a5f40), X(0x192a0304), X(0x7d808728),
87 X(0x195b49ea), X(0x7d769bb5), X(0x198c8ce7), X(0x7d6c9ce9),
88 X(0x19bdcbf3), X(0x7d628ac6), X(0x19ef0707), X(0x7d58654d),
89 X(0x1a203e1b), X(0x7d4e2c7f), X(0x1a517128), X(0x7d43e05e),
90 X(0x1a82a026), X(0x7d3980ec), X(0x1ab3cb0d), X(0x7d2f0e2b),
91 X(0x1ae4f1d6), X(0x7d24881b), X(0x1b161479), X(0x7d19eebf),
92 X(0x1b4732ef), X(0x7d0f4218), X(0x1b784d30), X(0x7d048228),
93 X(0x1ba96335), X(0x7cf9aef0), X(0x1bda74f6), X(0x7ceec873),
94 X(0x1c0b826a), X(0x7ce3ceb2), X(0x1c3c8b8c), X(0x7cd8c1ae),
95 X(0x1c6d9053), X(0x7ccda169), X(0x1c9e90b8), X(0x7cc26de5),
96 X(0x1ccf8cb3), X(0x7cb72724), X(0x1d00843d), X(0x7cabcd28),
97 X(0x1d31774d), X(0x7ca05ff1), X(0x1d6265dd), X(0x7c94df83),
98 X(0x1d934fe5), X(0x7c894bde), X(0x1dc4355e), X(0x7c7da505),
99 X(0x1df5163f), X(0x7c71eaf9), X(0x1e25f282), X(0x7c661dbc),
100 X(0x1e56ca1e), X(0x7c5a3d50), X(0x1e879d0d), X(0x7c4e49b7),
101 X(0x1eb86b46), X(0x7c4242f2), X(0x1ee934c3), X(0x7c362904),
102 X(0x1f19f97b), X(0x7c29fbee), X(0x1f4ab968), X(0x7c1dbbb3),
103 X(0x1f7b7481), X(0x7c116853), X(0x1fac2abf), X(0x7c0501d2),
104 X(0x1fdcdc1b), X(0x7bf88830), X(0x200d888d), X(0x7bebfb70),
105 X(0x203e300d), X(0x7bdf5b94), X(0x206ed295), X(0x7bd2a89e),
106 X(0x209f701c), X(0x7bc5e290), X(0x20d0089c), X(0x7bb9096b),
107 X(0x21009c0c), X(0x7bac1d31), X(0x21312a65), X(0x7b9f1de6),
108 X(0x2161b3a0), X(0x7b920b89), X(0x219237b5), X(0x7b84e61f),
109 X(0x21c2b69c), X(0x7b77ada8), X(0x21f3304f), X(0x7b6a6227),
110 X(0x2223a4c5), X(0x7b5d039e), X(0x225413f8), X(0x7b4f920e),
111 X(0x22847de0), X(0x7b420d7a), X(0x22b4e274), X(0x7b3475e5),
112 X(0x22e541af), X(0x7b26cb4f), X(0x23159b88), X(0x7b190dbc),
113 X(0x2345eff8), X(0x7b0b3d2c), X(0x23763ef7), X(0x7afd59a4),
114 X(0x23a6887f), X(0x7aef6323), X(0x23d6cc87), X(0x7ae159ae),
115 X(0x24070b08), X(0x7ad33d45), X(0x243743fa), X(0x7ac50dec),
116 X(0x24677758), X(0x7ab6cba4), X(0x2497a517), X(0x7aa8766f),
117 X(0x24c7cd33), X(0x7a9a0e50), X(0x24f7efa2), X(0x7a8b9348),
118 X(0x25280c5e), X(0x7a7d055b), X(0x2558235f), X(0x7a6e648a),
119 X(0x2588349d), X(0x7a5fb0d8), X(0x25b84012), X(0x7a50ea47),
120 X(0x25e845b6), X(0x7a4210d8), X(0x26184581), X(0x7a332490),
121 X(0x26483f6c), X(0x7a24256f), X(0x26783370), X(0x7a151378),
122 X(0x26a82186), X(0x7a05eead), X(0x26d809a5), X(0x79f6b711),
123 X(0x2707ebc7), X(0x79e76ca7), X(0x2737c7e3), X(0x79d80f6f),
124 X(0x27679df4), X(0x79c89f6e), X(0x27976df1), X(0x79b91ca4),
125 X(0x27c737d3), X(0x79a98715), X(0x27f6fb92), X(0x7999dec4),
126 X(0x2826b928), X(0x798a23b1), X(0x2856708d), X(0x797a55e0),
127 X(0x288621b9), X(0x796a7554), X(0x28b5cca5), X(0x795a820e),
128 X(0x28e5714b), X(0x794a7c12), X(0x29150fa1), X(0x793a6361),
129 X(0x2944a7a2), X(0x792a37fe), X(0x29743946), X(0x7919f9ec),
130 X(0x29a3c485), X(0x7909a92d), X(0x29d34958), X(0x78f945c3),
131 X(0x2a02c7b8), X(0x78e8cfb2), X(0x2a323f9e), X(0x78d846fb),
132 X(0x2a61b101), X(0x78c7aba2), X(0x2a911bdc), X(0x78b6fda8),
133 X(0x2ac08026), X(0x78a63d11), X(0x2aefddd8), X(0x789569df),
134 X(0x2b1f34eb), X(0x78848414), X(0x2b4e8558), X(0x78738bb3),
135 X(0x2b7dcf17), X(0x786280bf), X(0x2bad1221), X(0x7851633b),
136 X(0x2bdc4e6f), X(0x78403329), X(0x2c0b83fa), X(0x782ef08b),
137 X(0x2c3ab2b9), X(0x781d9b65), X(0x2c69daa6), X(0x780c33b8),
138 X(0x2c98fbba), X(0x77fab989), X(0x2cc815ee), X(0x77e92cd9),
139 X(0x2cf72939), X(0x77d78daa), X(0x2d263596), X(0x77c5dc01),
140 X(0x2d553afc), X(0x77b417df), X(0x2d843964), X(0x77a24148),
141 X(0x2db330c7), X(0x7790583e), X(0x2de2211e), X(0x777e5cc3),
142 X(0x2e110a62), X(0x776c4edb), X(0x2e3fec8b), X(0x775a2e89),
143 X(0x2e6ec792), X(0x7747fbce), X(0x2e9d9b70), X(0x7735b6af),
144 X(0x2ecc681e), X(0x77235f2d), X(0x2efb2d95), X(0x7710f54c),
145 X(0x2f29ebcc), X(0x76fe790e), X(0x2f58a2be), X(0x76ebea77),
146 X(0x2f875262), X(0x76d94989), X(0x2fb5fab2), X(0x76c69647),
147 X(0x2fe49ba7), X(0x76b3d0b4), X(0x30133539), X(0x76a0f8d2),
148 X(0x3041c761), X(0x768e0ea6), X(0x30705217), X(0x767b1231),
149 X(0x309ed556), X(0x76680376), X(0x30cd5115), X(0x7654e279),
150 X(0x30fbc54d), X(0x7641af3d), X(0x312a31f8), X(0x762e69c4),
151 X(0x3158970e), X(0x761b1211), X(0x3186f487), X(0x7607a828),
152 X(0x31b54a5e), X(0x75f42c0b), X(0x31e39889), X(0x75e09dbd),
153 X(0x3211df04), X(0x75ccfd42), X(0x32401dc6), X(0x75b94a9c),
154 X(0x326e54c7), X(0x75a585cf), X(0x329c8402), X(0x7591aedd),
155 X(0x32caab6f), X(0x757dc5ca), X(0x32f8cb07), X(0x7569ca99),
156 X(0x3326e2c3), X(0x7555bd4c), X(0x3354f29b), X(0x75419de7),
157 X(0x3382fa88), X(0x752d6c6c), X(0x33b0fa84), X(0x751928e0),
158 X(0x33def287), X(0x7504d345), X(0x340ce28b), X(0x74f06b9e),
159 X(0x343aca87), X(0x74dbf1ef), X(0x3468aa76), X(0x74c7663a),
160 X(0x34968250), X(0x74b2c884), X(0x34c4520d), X(0x749e18cd),
161 X(0x34f219a8), X(0x7489571c), X(0x351fd918), X(0x74748371),
162 X(0x354d9057), X(0x745f9dd1), X(0x357b3f5d), X(0x744aa63f),
163 X(0x35a8e625), X(0x74359cbd), X(0x35d684a6), X(0x74208150),
164 X(0x36041ad9), X(0x740b53fb), X(0x3631a8b8), X(0x73f614c0),
165 X(0x365f2e3b), X(0x73e0c3a3), X(0x368cab5c), X(0x73cb60a8),
166 X(0x36ba2014), X(0x73b5ebd1), X(0x36e78c5b), X(0x73a06522),
167 X(0x3714f02a), X(0x738acc9e), X(0x37424b7b), X(0x73752249),
168 X(0x376f9e46), X(0x735f6626), X(0x379ce885), X(0x73499838),
169 X(0x37ca2a30), X(0x7333b883), X(0x37f76341), X(0x731dc70a),
170 X(0x382493b0), X(0x7307c3d0), X(0x3851bb77), X(0x72f1aed9),
171 X(0x387eda8e), X(0x72db8828), X(0x38abf0ef), X(0x72c54fc1),
172 X(0x38d8fe93), X(0x72af05a7), X(0x39060373), X(0x7298a9dd),
173 X(0x3932ff87), X(0x72823c67), X(0x395ff2c9), X(0x726bbd48),
174 X(0x398cdd32), X(0x72552c85), X(0x39b9bebc), X(0x723e8a20),
175 X(0x39e6975e), X(0x7227d61c), X(0x3a136712), X(0x7211107e),
176 X(0x3a402dd2), X(0x71fa3949), X(0x3a6ceb96), X(0x71e35080),
177 X(0x3a99a057), X(0x71cc5626), X(0x3ac64c0f), X(0x71b54a41),
178 X(0x3af2eeb7), X(0x719e2cd2), X(0x3b1f8848), X(0x7186fdde),
179 X(0x3b4c18ba), X(0x716fbd68), X(0x3b78a007), X(0x71586b74),
180 X(0x3ba51e29), X(0x71410805), X(0x3bd19318), X(0x7129931f),
181 X(0x3bfdfecd), X(0x71120cc5), X(0x3c2a6142), X(0x70fa74fc),
182 X(0x3c56ba70), X(0x70e2cbc6), X(0x3c830a50), X(0x70cb1128),
183 X(0x3caf50da), X(0x70b34525), X(0x3cdb8e09), X(0x709b67c0),
184 X(0x3d07c1d6), X(0x708378ff), X(0x3d33ec39), X(0x706b78e3),
185 X(0x3d600d2c), X(0x70536771), X(0x3d8c24a8), X(0x703b44ad),
186 X(0x3db832a6), X(0x7023109a), X(0x3de4371f), X(0x700acb3c),
187 X(0x3e10320d), X(0x6ff27497), X(0x3e3c2369), X(0x6fda0cae),
188 X(0x3e680b2c), X(0x6fc19385), X(0x3e93e950), X(0x6fa90921),
189 X(0x3ebfbdcd), X(0x6f906d84), X(0x3eeb889c), X(0x6f77c0b3),
190 X(0x3f1749b8), X(0x6f5f02b2), X(0x3f430119), X(0x6f463383),
191 X(0x3f6eaeb8), X(0x6f2d532c), X(0x3f9a5290), X(0x6f1461b0),
192 X(0x3fc5ec98), X(0x6efb5f12), X(0x3ff17cca), X(0x6ee24b57),
193 X(0x401d0321), X(0x6ec92683), X(0x40487f94), X(0x6eaff099),
194 X(0x4073f21d), X(0x6e96a99d), X(0x409f5ab6), X(0x6e7d5193),
195 X(0x40cab958), X(0x6e63e87f), X(0x40f60dfb), X(0x6e4a6e66),
196 X(0x4121589b), X(0x6e30e34a), X(0x414c992f), X(0x6e174730),
197 X(0x4177cfb1), X(0x6dfd9a1c), X(0x41a2fc1a), X(0x6de3dc11),
198 X(0x41ce1e65), X(0x6dca0d14), X(0x41f93689), X(0x6db02d29),
199 X(0x42244481), X(0x6d963c54), X(0x424f4845), X(0x6d7c3a98),
200 X(0x427a41d0), X(0x6d6227fa), X(0x42a5311b), X(0x6d48047e),
201 X(0x42d0161e), X(0x6d2dd027), X(0x42faf0d4), X(0x6d138afb),
202 X(0x4325c135), X(0x6cf934fc), X(0x4350873c), X(0x6cdece2f),
203 X(0x437b42e1), X(0x6cc45698), X(0x43a5f41e), X(0x6ca9ce3b),
204 X(0x43d09aed), X(0x6c8f351c), X(0x43fb3746), X(0x6c748b3f),
205 X(0x4425c923), X(0x6c59d0a9), X(0x4450507e), X(0x6c3f055d),
206 X(0x447acd50), X(0x6c242960), X(0x44a53f93), X(0x6c093cb6),
207 X(0x44cfa740), X(0x6bee3f62), X(0x44fa0450), X(0x6bd3316a),
208 X(0x452456bd), X(0x6bb812d1), X(0x454e9e80), X(0x6b9ce39b),
209 X(0x4578db93), X(0x6b81a3cd), X(0x45a30df0), X(0x6b66536b),
210 X(0x45cd358f), X(0x6b4af279), X(0x45f7526b), X(0x6b2f80fb),
211 X(0x4621647d), X(0x6b13fef5), X(0x464b6bbe), X(0x6af86c6c),
212 X(0x46756828), X(0x6adcc964), X(0x469f59b4), X(0x6ac115e2),
213 X(0x46c9405c), X(0x6aa551e9), X(0x46f31c1a), X(0x6a897d7d),
214 X(0x471cece7), X(0x6a6d98a4), X(0x4746b2bc), X(0x6a51a361),
215 X(0x47706d93), X(0x6a359db9), X(0x479a1d67), X(0x6a1987b0),
216 X(0x47c3c22f), X(0x69fd614a), X(0x47ed5be6), X(0x69e12a8c),
217 X(0x4816ea86), X(0x69c4e37a), X(0x48406e08), X(0x69a88c19),
218 X(0x4869e665), X(0x698c246c), X(0x48935397), X(0x696fac78),
219 X(0x48bcb599), X(0x69532442), X(0x48e60c62), X(0x69368bce),
220 X(0x490f57ee), X(0x6919e320), X(0x49389836), X(0x68fd2a3d),
221 X(0x4961cd33), X(0x68e06129), X(0x498af6df), X(0x68c387e9),
222 X(0x49b41533), X(0x68a69e81), X(0x49dd282a), X(0x6889a4f6),
223 X(0x4a062fbd), X(0x686c9b4b), X(0x4a2f2be6), X(0x684f8186),
224 X(0x4a581c9e), X(0x683257ab), X(0x4a8101de), X(0x68151dbe),
225 X(0x4aa9dba2), X(0x67f7d3c5), X(0x4ad2a9e2), X(0x67da79c3),
226 X(0x4afb6c98), X(0x67bd0fbd), X(0x4b2423be), X(0x679f95b7),
227 X(0x4b4ccf4d), X(0x67820bb7), X(0x4b756f40), X(0x676471c0),
228 X(0x4b9e0390), X(0x6746c7d8), X(0x4bc68c36), X(0x67290e02),
229 X(0x4bef092d), X(0x670b4444), X(0x4c177a6e), X(0x66ed6aa1),
230 X(0x4c3fdff4), X(0x66cf8120), X(0x4c6839b7), X(0x66b187c3),
231 X(0x4c9087b1), X(0x66937e91), X(0x4cb8c9dd), X(0x6675658c),
232 X(0x4ce10034), X(0x66573cbb), X(0x4d092ab0), X(0x66390422),
233 X(0x4d31494b), X(0x661abbc5), X(0x4d595bfe), X(0x65fc63a9),
234 X(0x4d8162c4), X(0x65ddfbd3), X(0x4da95d96), X(0x65bf8447),
235 X(0x4dd14c6e), X(0x65a0fd0b), X(0x4df92f46), X(0x65826622),
236 X(0x4e210617), X(0x6563bf92), X(0x4e48d0dd), X(0x6545095f),
237 X(0x4e708f8f), X(0x6526438f), X(0x4e984229), X(0x65076e25),
238 X(0x4ebfe8a5), X(0x64e88926), X(0x4ee782fb), X(0x64c99498),
239 X(0x4f0f1126), X(0x64aa907f), X(0x4f369320), X(0x648b7ce0),
240 X(0x4f5e08e3), X(0x646c59bf), X(0x4f857269), X(0x644d2722),
241 X(0x4faccfab), X(0x642de50d), X(0x4fd420a4), X(0x640e9386),
242 X(0x4ffb654d), X(0x63ef3290), X(0x50229da1), X(0x63cfc231),
243 X(0x5049c999), X(0x63b0426d), X(0x5070e92f), X(0x6390b34a),
244 X(0x5097fc5e), X(0x637114cc), X(0x50bf031f), X(0x635166f9),
245 X(0x50e5fd6d), X(0x6331a9d4), X(0x510ceb40), X(0x6311dd64),
246 X(0x5133cc94), X(0x62f201ac), X(0x515aa162), X(0x62d216b3),
247 X(0x518169a5), X(0x62b21c7b), X(0x51a82555), X(0x6292130c),
248 X(0x51ced46e), X(0x6271fa69), X(0x51f576ea), X(0x6251d298),
249 X(0x521c0cc2), X(0x62319b9d), X(0x524295f0), X(0x6211557e),
250 X(0x5269126e), X(0x61f1003f), X(0x528f8238), X(0x61d09be5),
251 X(0x52b5e546), X(0x61b02876), X(0x52dc3b92), X(0x618fa5f7),
252 X(0x53028518), X(0x616f146c), X(0x5328c1d0), X(0x614e73da),
253 X(0x534ef1b5), X(0x612dc447), X(0x537514c2), X(0x610d05b7),
254 X(0x539b2af0), X(0x60ec3830), X(0x53c13439), X(0x60cb5bb7),
255 X(0x53e73097), X(0x60aa7050), X(0x540d2005), X(0x60897601),
256 X(0x5433027d), X(0x60686ccf), X(0x5458d7f9), X(0x604754bf),
257 X(0x547ea073), X(0x60262dd6), X(0x54a45be6), X(0x6004f819),
258 X(0x54ca0a4b), X(0x5fe3b38d), X(0x54efab9c), X(0x5fc26038),
259 X(0x55153fd4), X(0x5fa0fe1f), X(0x553ac6ee), X(0x5f7f8d46),
260 X(0x556040e2), X(0x5f5e0db3), X(0x5585adad), X(0x5f3c7f6b),
261 X(0x55ab0d46), X(0x5f1ae274), X(0x55d05faa), X(0x5ef936d1),
262 X(0x55f5a4d2), X(0x5ed77c8a), X(0x561adcb9), X(0x5eb5b3a2),
263 X(0x56400758), X(0x5e93dc1f), X(0x566524aa), X(0x5e71f606),
264 X(0x568a34a9), X(0x5e50015d), X(0x56af3750), X(0x5e2dfe29),
265 X(0x56d42c99), X(0x5e0bec6e), X(0x56f9147e), X(0x5de9cc33),
266 X(0x571deefa), X(0x5dc79d7c), X(0x5742bc06), X(0x5da5604f),
267 X(0x57677b9d), X(0x5d8314b1), X(0x578c2dba), X(0x5d60baa7),
268 X(0x57b0d256), X(0x5d3e5237), X(0x57d5696d), X(0x5d1bdb65),
269 X(0x57f9f2f8), X(0x5cf95638), X(0x581e6ef1), X(0x5cd6c2b5),
270 X(0x5842dd54), X(0x5cb420e0), X(0x58673e1b), X(0x5c9170bf),
271 X(0x588b9140), X(0x5c6eb258), X(0x58afd6bd), X(0x5c4be5b0),
272 X(0x58d40e8c), X(0x5c290acc), X(0x58f838a9), X(0x5c0621b2),
273 X(0x591c550e), X(0x5be32a67), X(0x594063b5), X(0x5bc024f0),
274 X(0x59646498), X(0x5b9d1154), X(0x598857b2), X(0x5b79ef96),
275 X(0x59ac3cfd), X(0x5b56bfbd), X(0x59d01475), X(0x5b3381ce),
276 X(0x59f3de12), X(0x5b1035cf), X(0x5a1799d1), X(0x5aecdbc5),
277 X(0x5a3b47ab), X(0x5ac973b5), X(0x5a5ee79a), X(0x5aa5fda5),
278 X(0x5a82799a), X(0x5a82799a)
279 };
280
281 /* {sin((2*i+1)*PI/4096), cos((2*i+1)*PI/4096)}, with i = 0 to 511 */
282static LOOKUP_T sincos_lookup1[1024] = {
283 X(0x001921fb), X(0x7ffffd88), X(0x004b65ee), X(0x7fffe9cb),
284 X(0x007da9d4), X(0x7fffc251), X(0x00afeda8), X(0x7fff8719),
285 X(0x00e23160), X(0x7fff3824), X(0x011474f6), X(0x7ffed572),
286 X(0x0146b860), X(0x7ffe5f03), X(0x0178fb99), X(0x7ffdd4d7),
287 X(0x01ab3e97), X(0x7ffd36ee), X(0x01dd8154), X(0x7ffc8549),
288 X(0x020fc3c6), X(0x7ffbbfe6), X(0x024205e8), X(0x7ffae6c7),
289 X(0x027447b0), X(0x7ff9f9ec), X(0x02a68917), X(0x7ff8f954),
290 X(0x02d8ca16), X(0x7ff7e500), X(0x030b0aa4), X(0x7ff6bcf0),
291 X(0x033d4abb), X(0x7ff58125), X(0x036f8a51), X(0x7ff4319d),
292 X(0x03a1c960), X(0x7ff2ce5b), X(0x03d407df), X(0x7ff1575d),
293 X(0x040645c7), X(0x7fefcca4), X(0x04388310), X(0x7fee2e30),
294 X(0x046abfb3), X(0x7fec7c02), X(0x049cfba7), X(0x7feab61a),
295 X(0x04cf36e5), X(0x7fe8dc78), X(0x05017165), X(0x7fe6ef1c),
296 X(0x0533ab20), X(0x7fe4ee06), X(0x0565e40d), X(0x7fe2d938),
297 X(0x05981c26), X(0x7fe0b0b1), X(0x05ca5361), X(0x7fde7471),
298 X(0x05fc89b8), X(0x7fdc247a), X(0x062ebf22), X(0x7fd9c0ca),
299 X(0x0660f398), X(0x7fd74964), X(0x06932713), X(0x7fd4be46),
300 X(0x06c5598a), X(0x7fd21f72), X(0x06f78af6), X(0x7fcf6ce8),
301 X(0x0729bb4e), X(0x7fcca6a7), X(0x075bea8c), X(0x7fc9ccb2),
302 X(0x078e18a7), X(0x7fc6df08), X(0x07c04598), X(0x7fc3dda9),
303 X(0x07f27157), X(0x7fc0c896), X(0x08249bdd), X(0x7fbd9fd0),
304 X(0x0856c520), X(0x7fba6357), X(0x0888ed1b), X(0x7fb7132b),
305 X(0x08bb13c5), X(0x7fb3af4e), X(0x08ed3916), X(0x7fb037bf),
306 X(0x091f5d06), X(0x7facac7f), X(0x09517f8f), X(0x7fa90d8e),
307 X(0x0983a0a7), X(0x7fa55aee), X(0x09b5c048), X(0x7fa1949e),
308 X(0x09e7de6a), X(0x7f9dbaa0), X(0x0a19fb04), X(0x7f99ccf4),
309 X(0x0a4c1610), X(0x7f95cb9a), X(0x0a7e2f85), X(0x7f91b694),
310 X(0x0ab0475c), X(0x7f8d8de1), X(0x0ae25d8d), X(0x7f895182),
311 X(0x0b147211), X(0x7f850179), X(0x0b4684df), X(0x7f809dc5),
312 X(0x0b7895f0), X(0x7f7c2668), X(0x0baaa53b), X(0x7f779b62),
313 X(0x0bdcb2bb), X(0x7f72fcb4), X(0x0c0ebe66), X(0x7f6e4a5e),
314 X(0x0c40c835), X(0x7f698461), X(0x0c72d020), X(0x7f64aabf),
315 X(0x0ca4d620), X(0x7f5fbd77), X(0x0cd6da2d), X(0x7f5abc8a),
316 X(0x0d08dc3f), X(0x7f55a7fa), X(0x0d3adc4e), X(0x7f507fc7),
317 X(0x0d6cda53), X(0x7f4b43f2), X(0x0d9ed646), X(0x7f45f47b),
318 X(0x0dd0d01f), X(0x7f409164), X(0x0e02c7d7), X(0x7f3b1aad),
319 X(0x0e34bd66), X(0x7f359057), X(0x0e66b0c3), X(0x7f2ff263),
320 X(0x0e98a1e9), X(0x7f2a40d2), X(0x0eca90ce), X(0x7f247ba5),
321 X(0x0efc7d6b), X(0x7f1ea2dc), X(0x0f2e67b8), X(0x7f18b679),
322 X(0x0f604faf), X(0x7f12b67c), X(0x0f923546), X(0x7f0ca2e7),
323 X(0x0fc41876), X(0x7f067bba), X(0x0ff5f938), X(0x7f0040f6),
324 X(0x1027d784), X(0x7ef9f29d), X(0x1059b352), X(0x7ef390ae),
325 X(0x108b8c9b), X(0x7eed1b2c), X(0x10bd6356), X(0x7ee69217),
326 X(0x10ef377d), X(0x7edff570), X(0x11210907), X(0x7ed94538),
327 X(0x1152d7ed), X(0x7ed28171), X(0x1184a427), X(0x7ecbaa1a),
328 X(0x11b66dad), X(0x7ec4bf36), X(0x11e83478), X(0x7ebdc0c6),
329 X(0x1219f880), X(0x7eb6aeca), X(0x124bb9be), X(0x7eaf8943),
330 X(0x127d7829), X(0x7ea85033), X(0x12af33ba), X(0x7ea1039b),
331 X(0x12e0ec6a), X(0x7e99a37c), X(0x1312a230), X(0x7e922fd6),
332 X(0x13445505), X(0x7e8aa8ac), X(0x137604e2), X(0x7e830dff),
333 X(0x13a7b1bf), X(0x7e7b5fce), X(0x13d95b93), X(0x7e739e1d),
334 X(0x140b0258), X(0x7e6bc8eb), X(0x143ca605), X(0x7e63e03b),
335 X(0x146e4694), X(0x7e5be40c), X(0x149fe3fc), X(0x7e53d462),
336 X(0x14d17e36), X(0x7e4bb13c), X(0x1503153a), X(0x7e437a9c),
337 X(0x1534a901), X(0x7e3b3083), X(0x15663982), X(0x7e32d2f4),
338 X(0x1597c6b7), X(0x7e2a61ed), X(0x15c95097), X(0x7e21dd73),
339 X(0x15fad71b), X(0x7e194584), X(0x162c5a3b), X(0x7e109a24),
340 X(0x165dd9f0), X(0x7e07db52), X(0x168f5632), X(0x7dff0911),
341 X(0x16c0cef9), X(0x7df62362), X(0x16f2443e), X(0x7ded2a47),
342 X(0x1723b5f9), X(0x7de41dc0), X(0x17552422), X(0x7ddafdce),
343 X(0x17868eb3), X(0x7dd1ca75), X(0x17b7f5a3), X(0x7dc883b4),
344 X(0x17e958ea), X(0x7dbf298d), X(0x181ab881), X(0x7db5bc02),
345 X(0x184c1461), X(0x7dac3b15), X(0x187d6c82), X(0x7da2a6c6),
346 X(0x18aec0db), X(0x7d98ff17), X(0x18e01167), X(0x7d8f4409),
347 X(0x19115e1c), X(0x7d85759f), X(0x1942a6f3), X(0x7d7b93da),
348 X(0x1973ebe6), X(0x7d719eba), X(0x19a52ceb), X(0x7d679642),
349 X(0x19d669fc), X(0x7d5d7a74), X(0x1a07a311), X(0x7d534b50),
350 X(0x1a38d823), X(0x7d4908d9), X(0x1a6a0929), X(0x7d3eb30f),
351 X(0x1a9b361d), X(0x7d3449f5), X(0x1acc5ef6), X(0x7d29cd8c),
352 X(0x1afd83ad), X(0x7d1f3dd6), X(0x1b2ea43a), X(0x7d149ad5),
353 X(0x1b5fc097), X(0x7d09e489), X(0x1b90d8bb), X(0x7cff1af5),
354 X(0x1bc1ec9e), X(0x7cf43e1a), X(0x1bf2fc3a), X(0x7ce94dfb),
355 X(0x1c240786), X(0x7cde4a98), X(0x1c550e7c), X(0x7cd333f3),
356 X(0x1c861113), X(0x7cc80a0f), X(0x1cb70f43), X(0x7cbcccec),
357 X(0x1ce80906), X(0x7cb17c8d), X(0x1d18fe54), X(0x7ca618f3),
358 X(0x1d49ef26), X(0x7c9aa221), X(0x1d7adb73), X(0x7c8f1817),
359 X(0x1dabc334), X(0x7c837ad8), X(0x1ddca662), X(0x7c77ca65),
360 X(0x1e0d84f5), X(0x7c6c06c0), X(0x1e3e5ee5), X(0x7c602fec),
361 X(0x1e6f342c), X(0x7c5445e9), X(0x1ea004c1), X(0x7c4848ba),
362 X(0x1ed0d09d), X(0x7c3c3860), X(0x1f0197b8), X(0x7c3014de),
363 X(0x1f325a0b), X(0x7c23de35), X(0x1f63178f), X(0x7c179467),
364 X(0x1f93d03c), X(0x7c0b3777), X(0x1fc4840a), X(0x7bfec765),
365 X(0x1ff532f2), X(0x7bf24434), X(0x2025dcec), X(0x7be5ade6),
366 X(0x205681f1), X(0x7bd9047c), X(0x208721f9), X(0x7bcc47fa),
367 X(0x20b7bcfe), X(0x7bbf7860), X(0x20e852f6), X(0x7bb295b0),
368 X(0x2118e3dc), X(0x7ba59fee), X(0x21496fa7), X(0x7b989719),
369 X(0x2179f64f), X(0x7b8b7b36), X(0x21aa77cf), X(0x7b7e4c45),
370 X(0x21daf41d), X(0x7b710a49), X(0x220b6b32), X(0x7b63b543),
371 X(0x223bdd08), X(0x7b564d36), X(0x226c4996), X(0x7b48d225),
372 X(0x229cb0d5), X(0x7b3b4410), X(0x22cd12bd), X(0x7b2da2fa),
373 X(0x22fd6f48), X(0x7b1feee5), X(0x232dc66d), X(0x7b1227d3),
374 X(0x235e1826), X(0x7b044dc7), X(0x238e646a), X(0x7af660c2),
375 X(0x23beab33), X(0x7ae860c7), X(0x23eeec78), X(0x7ada4dd8),
376 X(0x241f2833), X(0x7acc27f7), X(0x244f5e5c), X(0x7abdef25),
377 X(0x247f8eec), X(0x7aafa367), X(0x24afb9da), X(0x7aa144bc),
378 X(0x24dfdf20), X(0x7a92d329), X(0x250ffeb7), X(0x7a844eae),
379 X(0x25401896), X(0x7a75b74f), X(0x25702cb7), X(0x7a670d0d),
380 X(0x25a03b11), X(0x7a584feb), X(0x25d0439f), X(0x7a497feb),
381 X(0x26004657), X(0x7a3a9d0f), X(0x26304333), X(0x7a2ba75a),
382 X(0x26603a2c), X(0x7a1c9ece), X(0x26902b39), X(0x7a0d836d),
383 X(0x26c01655), X(0x79fe5539), X(0x26effb76), X(0x79ef1436),
384 X(0x271fda96), X(0x79dfc064), X(0x274fb3ae), X(0x79d059c8),
385 X(0x277f86b5), X(0x79c0e062), X(0x27af53a6), X(0x79b15435),
386 X(0x27df1a77), X(0x79a1b545), X(0x280edb23), X(0x79920392),
387 X(0x283e95a1), X(0x79823f20), X(0x286e49ea), X(0x797267f2),
388 X(0x289df7f8), X(0x79627e08), X(0x28cd9fc1), X(0x79528167),
389 X(0x28fd4140), X(0x79427210), X(0x292cdc6d), X(0x79325006),
390 X(0x295c7140), X(0x79221b4b), X(0x298bffb2), X(0x7911d3e2),
391 X(0x29bb87bc), X(0x790179cd), X(0x29eb0957), X(0x78f10d0f),
392 X(0x2a1a847b), X(0x78e08dab), X(0x2a49f920), X(0x78cffba3),
393 X(0x2a796740), X(0x78bf56f9), X(0x2aa8ced3), X(0x78ae9fb0),
394 X(0x2ad82fd2), X(0x789dd5cb), X(0x2b078a36), X(0x788cf94c),
395 X(0x2b36ddf7), X(0x787c0a36), X(0x2b662b0e), X(0x786b088c),
396 X(0x2b957173), X(0x7859f44f), X(0x2bc4b120), X(0x7848cd83),
397 X(0x2bf3ea0d), X(0x7837942b), X(0x2c231c33), X(0x78264849),
398 X(0x2c52478a), X(0x7814e9df), X(0x2c816c0c), X(0x780378f1),
399 X(0x2cb089b1), X(0x77f1f581), X(0x2cdfa071), X(0x77e05f91),
400 X(0x2d0eb046), X(0x77ceb725), X(0x2d3db928), X(0x77bcfc3f),
401 X(0x2d6cbb10), X(0x77ab2ee2), X(0x2d9bb5f6), X(0x77994f11),
402 X(0x2dcaa9d5), X(0x77875cce), X(0x2df996a3), X(0x7775581d),
403 X(0x2e287c5a), X(0x776340ff), X(0x2e575af3), X(0x77511778),
404 X(0x2e863267), X(0x773edb8b), X(0x2eb502ae), X(0x772c8d3a),
405 X(0x2ee3cbc1), X(0x771a2c88), X(0x2f128d99), X(0x7707b979),
406 X(0x2f41482e), X(0x76f5340e), X(0x2f6ffb7a), X(0x76e29c4b),
407 X(0x2f9ea775), X(0x76cff232), X(0x2fcd4c19), X(0x76bd35c7),
408 X(0x2ffbe95d), X(0x76aa670d), X(0x302a7f3a), X(0x76978605),
409 X(0x30590dab), X(0x768492b4), X(0x308794a6), X(0x76718d1c),
410 X(0x30b61426), X(0x765e7540), X(0x30e48c22), X(0x764b4b23),
411 X(0x3112fc95), X(0x76380ec8), X(0x31416576), X(0x7624c031),
412 X(0x316fc6be), X(0x76115f63), X(0x319e2067), X(0x75fdec60),
413 X(0x31cc7269), X(0x75ea672a), X(0x31fabcbd), X(0x75d6cfc5),
414 X(0x3228ff5c), X(0x75c32634), X(0x32573a3f), X(0x75af6a7b),
415 X(0x32856d5e), X(0x759b9c9b), X(0x32b398b3), X(0x7587bc98),
416 X(0x32e1bc36), X(0x7573ca75), X(0x330fd7e1), X(0x755fc635),
417 X(0x333debab), X(0x754bafdc), X(0x336bf78f), X(0x7537876c),
418 X(0x3399fb85), X(0x75234ce8), X(0x33c7f785), X(0x750f0054),
419 X(0x33f5eb89), X(0x74faa1b3), X(0x3423d78a), X(0x74e63108),
420 X(0x3451bb81), X(0x74d1ae55), X(0x347f9766), X(0x74bd199f),
421 X(0x34ad6b32), X(0x74a872e8), X(0x34db36df), X(0x7493ba34),
422 X(0x3508fa66), X(0x747eef85), X(0x3536b5be), X(0x746a12df),
423 X(0x356468e2), X(0x74552446), X(0x359213c9), X(0x744023bc),
424 X(0x35bfb66e), X(0x742b1144), X(0x35ed50c9), X(0x7415ece2),
425 X(0x361ae2d3), X(0x7400b69a), X(0x36486c86), X(0x73eb6e6e),
426 X(0x3675edd9), X(0x73d61461), X(0x36a366c6), X(0x73c0a878),
427 X(0x36d0d746), X(0x73ab2ab4), X(0x36fe3f52), X(0x73959b1b),
428 X(0x372b9ee3), X(0x737ff9ae), X(0x3758f5f2), X(0x736a4671),
429 X(0x37864477), X(0x73548168), X(0x37b38a6d), X(0x733eaa96),
430 X(0x37e0c7cc), X(0x7328c1ff), X(0x380dfc8d), X(0x7312c7a5),
431 X(0x383b28a9), X(0x72fcbb8c), X(0x38684c19), X(0x72e69db7),
432 X(0x389566d6), X(0x72d06e2b), X(0x38c278d9), X(0x72ba2cea),
433 X(0x38ef821c), X(0x72a3d9f7), X(0x391c8297), X(0x728d7557),
434 X(0x39497a43), X(0x7276ff0d), X(0x39766919), X(0x7260771b),
435 X(0x39a34f13), X(0x7249dd86), X(0x39d02c2a), X(0x72333251),
436 X(0x39fd0056), X(0x721c7580), X(0x3a29cb91), X(0x7205a716),
437 X(0x3a568dd4), X(0x71eec716), X(0x3a834717), X(0x71d7d585),
438 X(0x3aaff755), X(0x71c0d265), X(0x3adc9e86), X(0x71a9bdba),
439 X(0x3b093ca3), X(0x71929789), X(0x3b35d1a5), X(0x717b5fd3),
440 X(0x3b625d86), X(0x7164169d), X(0x3b8ee03e), X(0x714cbbeb),
441 X(0x3bbb59c7), X(0x71354fc0), X(0x3be7ca1a), X(0x711dd220),
442 X(0x3c143130), X(0x7106430e), X(0x3c408f03), X(0x70eea28e),
443 X(0x3c6ce38a), X(0x70d6f0a4), X(0x3c992ec0), X(0x70bf2d53),
444 X(0x3cc5709e), X(0x70a7589f), X(0x3cf1a91c), X(0x708f728b),
445 X(0x3d1dd835), X(0x70777b1c), X(0x3d49fde1), X(0x705f7255),
446 X(0x3d761a19), X(0x70475839), X(0x3da22cd7), X(0x702f2ccd),
447 X(0x3dce3614), X(0x7016f014), X(0x3dfa35c8), X(0x6ffea212),
448 X(0x3e262bee), X(0x6fe642ca), X(0x3e52187f), X(0x6fcdd241),
449 X(0x3e7dfb73), X(0x6fb5507a), X(0x3ea9d4c3), X(0x6f9cbd79),
450 X(0x3ed5a46b), X(0x6f841942), X(0x3f016a61), X(0x6f6b63d8),
451 X(0x3f2d26a0), X(0x6f529d40), X(0x3f58d921), X(0x6f39c57d),
452 X(0x3f8481dd), X(0x6f20dc92), X(0x3fb020ce), X(0x6f07e285),
453 X(0x3fdbb5ec), X(0x6eeed758), X(0x40074132), X(0x6ed5bb10),
454 X(0x4032c297), X(0x6ebc8db0), X(0x405e3a16), X(0x6ea34f3d),
455 X(0x4089a7a8), X(0x6e89ffb9), X(0x40b50b46), X(0x6e709f2a),
456 X(0x40e064ea), X(0x6e572d93), X(0x410bb48c), X(0x6e3daaf8),
457 X(0x4136fa27), X(0x6e24175c), X(0x416235b2), X(0x6e0a72c5),
458 X(0x418d6729), X(0x6df0bd35), X(0x41b88e84), X(0x6dd6f6b1),
459 X(0x41e3abbc), X(0x6dbd1f3c), X(0x420ebecb), X(0x6da336dc),
460 X(0x4239c7aa), X(0x6d893d93), X(0x4264c653), X(0x6d6f3365),
461 X(0x428fbabe), X(0x6d551858), X(0x42baa4e6), X(0x6d3aec6e),
462 X(0x42e584c3), X(0x6d20afac), X(0x43105a50), X(0x6d066215),
463 X(0x433b2585), X(0x6cec03af), X(0x4365e65b), X(0x6cd1947c),
464 X(0x43909ccd), X(0x6cb71482), X(0x43bb48d4), X(0x6c9c83c3),
465 X(0x43e5ea68), X(0x6c81e245), X(0x44108184), X(0x6c67300b),
466 X(0x443b0e21), X(0x6c4c6d1a), X(0x44659039), X(0x6c319975),
467 X(0x449007c4), X(0x6c16b521), X(0x44ba74bd), X(0x6bfbc021),
468 X(0x44e4d71c), X(0x6be0ba7b), X(0x450f2edb), X(0x6bc5a431),
469 X(0x45397bf4), X(0x6baa7d49), X(0x4563be60), X(0x6b8f45c7),
470 X(0x458df619), X(0x6b73fdae), X(0x45b82318), X(0x6b58a503),
471 X(0x45e24556), X(0x6b3d3bcb), X(0x460c5cce), X(0x6b21c208),
472 X(0x46366978), X(0x6b0637c1), X(0x46606b4e), X(0x6aea9cf8),
473 X(0x468a624a), X(0x6acef1b2), X(0x46b44e65), X(0x6ab335f4),
474 X(0x46de2f99), X(0x6a9769c1), X(0x470805df), X(0x6a7b8d1e),
475 X(0x4731d131), X(0x6a5fa010), X(0x475b9188), X(0x6a43a29a),
476 X(0x478546de), X(0x6a2794c1), X(0x47aef12c), X(0x6a0b7689),
477 X(0x47d8906d), X(0x69ef47f6), X(0x48022499), X(0x69d3090e),
478 X(0x482badab), X(0x69b6b9d3), X(0x48552b9b), X(0x699a5a4c),
479 X(0x487e9e64), X(0x697dea7b), X(0x48a805ff), X(0x69616a65),
480 X(0x48d16265), X(0x6944da10), X(0x48fab391), X(0x6928397e),
481 X(0x4923f97b), X(0x690b88b5), X(0x494d341e), X(0x68eec7b9),
482 X(0x49766373), X(0x68d1f68f), X(0x499f8774), X(0x68b5153a),
483 X(0x49c8a01b), X(0x689823bf), X(0x49f1ad61), X(0x687b2224),
484 X(0x4a1aaf3f), X(0x685e106c), X(0x4a43a5b0), X(0x6840ee9b),
485 X(0x4a6c90ad), X(0x6823bcb7), X(0x4a957030), X(0x68067ac3),
486 X(0x4abe4433), X(0x67e928c5), X(0x4ae70caf), X(0x67cbc6c0),
487 X(0x4b0fc99d), X(0x67ae54ba), X(0x4b387af9), X(0x6790d2b6),
488 X(0x4b6120bb), X(0x677340ba), X(0x4b89badd), X(0x67559eca),
489 X(0x4bb24958), X(0x6737ecea), X(0x4bdacc28), X(0x671a2b20),
490 X(0x4c034345), X(0x66fc596f), X(0x4c2baea9), X(0x66de77dc),
491 X(0x4c540e4e), X(0x66c0866d), X(0x4c7c622d), X(0x66a28524),
492 X(0x4ca4aa41), X(0x66847408), X(0x4ccce684), X(0x6666531d),
493 X(0x4cf516ee), X(0x66482267), X(0x4d1d3b7a), X(0x6629e1ec),
494 X(0x4d455422), X(0x660b91af), X(0x4d6d60df), X(0x65ed31b5),
495 X(0x4d9561ac), X(0x65cec204), X(0x4dbd5682), X(0x65b0429f),
496 X(0x4de53f5a), X(0x6591b38c), X(0x4e0d1c30), X(0x657314cf),
497 X(0x4e34ecfc), X(0x6554666d), X(0x4e5cb1b9), X(0x6535a86b),
498 X(0x4e846a60), X(0x6516dacd), X(0x4eac16eb), X(0x64f7fd98),
499 X(0x4ed3b755), X(0x64d910d1), X(0x4efb4b96), X(0x64ba147d),
500 X(0x4f22d3aa), X(0x649b08a0), X(0x4f4a4f89), X(0x647bed3f),
501 X(0x4f71bf2e), X(0x645cc260), X(0x4f992293), X(0x643d8806),
502 X(0x4fc079b1), X(0x641e3e38), X(0x4fe7c483), X(0x63fee4f8),
503 X(0x500f0302), X(0x63df7c4d), X(0x50363529), X(0x63c0043b),
504 X(0x505d5af1), X(0x63a07cc7), X(0x50847454), X(0x6380e5f6),
505 X(0x50ab814d), X(0x63613fcd), X(0x50d281d5), X(0x63418a50),
506 X(0x50f975e6), X(0x6321c585), X(0x51205d7b), X(0x6301f171),
507 X(0x5147388c), X(0x62e20e17), X(0x516e0715), X(0x62c21b7e),
508 X(0x5194c910), X(0x62a219aa), X(0x51bb7e75), X(0x628208a1),
509 X(0x51e22740), X(0x6261e866), X(0x5208c36a), X(0x6241b8ff),
510 X(0x522f52ee), X(0x62217a72), X(0x5255d5c5), X(0x62012cc2),
511 X(0x527c4bea), X(0x61e0cff5), X(0x52a2b556), X(0x61c06410),
512 X(0x52c91204), X(0x619fe918), X(0x52ef61ee), X(0x617f5f12),
513 X(0x5315a50e), X(0x615ec603), X(0x533bdb5d), X(0x613e1df0),
514 X(0x536204d7), X(0x611d66de), X(0x53882175), X(0x60fca0d2),
515 X(0x53ae3131), X(0x60dbcbd1), X(0x53d43406), X(0x60bae7e1),
516 X(0x53fa29ed), X(0x6099f505), X(0x542012e1), X(0x6078f344),
517 X(0x5445eedb), X(0x6057e2a2), X(0x546bbdd7), X(0x6036c325),
518 X(0x54917fce), X(0x601594d1), X(0x54b734ba), X(0x5ff457ad),
519 X(0x54dcdc96), X(0x5fd30bbc), X(0x5502775c), X(0x5fb1b104),
520 X(0x55280505), X(0x5f90478a), X(0x554d858d), X(0x5f6ecf53),
521 X(0x5572f8ed), X(0x5f4d4865), X(0x55985f20), X(0x5f2bb2c5),
522 X(0x55bdb81f), X(0x5f0a0e77), X(0x55e303e6), X(0x5ee85b82),
523 X(0x5608426e), X(0x5ec699e9), X(0x562d73b2), X(0x5ea4c9b3),
524 X(0x565297ab), X(0x5e82eae5), X(0x5677ae54), X(0x5e60fd84),
525 X(0x569cb7a8), X(0x5e3f0194), X(0x56c1b3a1), X(0x5e1cf71c),
526 X(0x56e6a239), X(0x5dfade20), X(0x570b8369), X(0x5dd8b6a7),
527 X(0x5730572e), X(0x5db680b4), X(0x57551d80), X(0x5d943c4e),
528 X(0x5779d65b), X(0x5d71e979), X(0x579e81b8), X(0x5d4f883b),
529 X(0x57c31f92), X(0x5d2d189a), X(0x57e7afe4), X(0x5d0a9a9a),
530 X(0x580c32a7), X(0x5ce80e41), X(0x5830a7d6), X(0x5cc57394),
531 X(0x58550f6c), X(0x5ca2ca99), X(0x58796962), X(0x5c801354),
532 X(0x589db5b3), X(0x5c5d4dcc), X(0x58c1f45b), X(0x5c3a7a05),
533 X(0x58e62552), X(0x5c179806), X(0x590a4893), X(0x5bf4a7d2),
534 X(0x592e5e19), X(0x5bd1a971), X(0x595265df), X(0x5bae9ce7),
535 X(0x59765fde), X(0x5b8b8239), X(0x599a4c12), X(0x5b68596d),
536 X(0x59be2a74), X(0x5b452288), X(0x59e1faff), X(0x5b21dd90),
537 X(0x5a05bdae), X(0x5afe8a8b), X(0x5a29727b), X(0x5adb297d),
538 X(0x5a4d1960), X(0x5ab7ba6c), X(0x5a70b258), X(0x5a943d5e),
539};
540
diff --git a/apps/codecs/Tremor/misc.h b/apps/codecs/Tremor/misc.h
new file mode 100644
index 0000000000..ffa9c42f1b
--- /dev/null
+++ b/apps/codecs/Tremor/misc.h
@@ -0,0 +1,241 @@
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.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
27#ifndef _V_WIDE_MATH
28#define _V_WIDE_MATH
29
30#ifndef _LOW_ACCURACY_
31/* 64 bit multiply */
32
33//#include <sys/types.h>
34
35#if BYTE_ORDER==LITTLE_ENDIAN
36union magic {
37 struct {
38 ogg_int32_t lo;
39 ogg_int32_t hi;
40 } halves;
41 ogg_int64_t whole;
42};
43#endif
44
45#if BYTE_ORDER==BIG_ENDIAN
46union magic {
47 struct {
48 ogg_int32_t hi;
49 ogg_int32_t lo;
50 } halves;
51 ogg_int64_t whole;
52};
53#endif
54
55static inline ogg_int32_t MULT32(ogg_int32_t x, ogg_int32_t y) {
56 union magic magic;
57 magic.whole = (ogg_int64_t)x * y;
58 return magic.halves.hi;
59}
60
61static inline ogg_int32_t MULT31(ogg_int32_t x, ogg_int32_t y) {
62 return MULT32(x,y)<<1;
63}
64
65static inline ogg_int32_t MULT31_SHIFT15(ogg_int32_t x, ogg_int32_t y) {
66 union magic magic;
67 magic.whole = (ogg_int64_t)x * y;
68 return ((ogg_uint32_t)(magic.halves.lo)>>15) | ((magic.halves.hi)<<17);
69}
70
71#else
72/* 32 bit multiply, more portable but less accurate */
73
74/*
75 * Note: Precision is biased towards the first argument therefore ordering
76 * is important. Shift values were chosen for the best sound quality after
77 * many listening tests.
78 */
79
80/*
81 * For MULT32 and MULT31: The second argument is always a lookup table
82 * value already preshifted from 31 to 8 bits. We therefore take the
83 * opportunity to save on text space and use unsigned char for those
84 * tables in this case.
85 */
86
87static inline ogg_int32_t MULT32(ogg_int32_t x, ogg_int32_t y) {
88 return (x >> 9) * y; /* y preshifted >>23 */
89}
90
91static inline ogg_int32_t MULT31(ogg_int32_t x, ogg_int32_t y) {
92 return (x >> 8) * y; /* y preshifted >>23 */
93}
94
95static inline ogg_int32_t MULT31_SHIFT15(ogg_int32_t x, ogg_int32_t y) {
96 return (x >> 6) * y; /* y preshifted >>9 */
97}
98
99#endif
100
101/*
102 * This should be used as a memory barrier, forcing all cached values in
103 * registers to wr writen back to memory. Might or might not be beneficial
104 * depending on the architecture and compiler.
105 */
106#define MB()
107
108/*
109 * The XPROD functions are meant to optimize the cross products found all
110 * over the place in mdct.c by forcing memory operation ordering to avoid
111 * unnecessary register reloads as soon as memory is being written to.
112 * However this is only beneficial on CPUs with a sane number of general
113 * purpose registers which exclude the Intel x86. On Intel, better let the
114 * compiler actually reload registers directly from original memory by using
115 * macros.
116 */
117
118#ifdef __i386__
119
120#define XPROD32(_a, _b, _t, _v, _x, _y) \
121 { *(_x)=MULT32(_a,_t)+MULT32(_b,_v); \
122 *(_y)=MULT32(_b,_t)-MULT32(_a,_v); }
123#define XPROD31(_a, _b, _t, _v, _x, _y) \
124 { *(_x)=MULT31(_a,_t)+MULT31(_b,_v); \
125 *(_y)=MULT31(_b,_t)-MULT31(_a,_v); }
126#define XNPROD31(_a, _b, _t, _v, _x, _y) \
127 { *(_x)=MULT31(_a,_t)-MULT31(_b,_v); \
128 *(_y)=MULT31(_b,_t)+MULT31(_a,_v); }
129
130#else
131
132static inline void XPROD32(ogg_int32_t a, ogg_int32_t b,
133 ogg_int32_t t, ogg_int32_t v,
134 ogg_int32_t *x, ogg_int32_t *y)
135{
136 *x = MULT32(a, t) + MULT32(b, v);
137 *y = MULT32(b, t) - MULT32(a, v);
138}
139
140static inline void XPROD31(ogg_int32_t a, ogg_int32_t b,
141 ogg_int32_t t, ogg_int32_t v,
142 ogg_int32_t *x, ogg_int32_t *y)
143{
144 *x = MULT31(a, t) + MULT31(b, v);
145 *y = MULT31(b, t) - MULT31(a, v);
146}
147
148static inline void XNPROD31(ogg_int32_t a, ogg_int32_t b,
149 ogg_int32_t t, ogg_int32_t v,
150 ogg_int32_t *x, ogg_int32_t *y)
151{
152 *x = MULT31(a, t) - MULT31(b, v);
153 *y = MULT31(b, t) + MULT31(a, v);
154}
155
156#endif
157
158#endif
159
160#ifndef _V_CLIP_MATH
161#define _V_CLIP_MATH
162
163static inline ogg_int32_t CLIP_TO_15(ogg_int32_t x) {
164 int ret=x;
165 ret-= ((x<=32767)-1)&(x-32767);
166 ret-= ((x>=-32768)-1)&(x+32768);
167 return(ret);
168}
169
170#endif
171
172static inline ogg_int32_t VFLOAT_MULT(ogg_int32_t a,ogg_int32_t ap,
173 ogg_int32_t b,ogg_int32_t bp,
174 ogg_int32_t *p){
175 if(a && b){
176#ifndef _LOW_ACCURACY_
177 *p=ap+bp+32;
178 return MULT32(a,b);
179#else
180 *p=ap+bp+31;
181 return (a>>15)*(b>>16);
182#endif
183 }else
184 return 0;
185}
186
187static inline ogg_int32_t VFLOAT_MULTI(ogg_int32_t a,ogg_int32_t ap,
188 ogg_int32_t i,
189 ogg_int32_t *p){
190
191 int ip=_ilog(abs(i))-31;
192 return VFLOAT_MULT(a,ap,i<<-ip,ip,p);
193}
194
195static inline ogg_int32_t VFLOAT_ADD(ogg_int32_t a,ogg_int32_t ap,
196 ogg_int32_t b,ogg_int32_t bp,
197 ogg_int32_t *p){
198
199 if(!a){
200 *p=bp;
201 return b;
202 }else if(!b){
203 *p=ap;
204 return a;
205 }
206
207 /* yes, this can leak a bit. */
208 if(ap>bp){
209 int shift=ap-bp+1;
210 *p=ap+1;
211 a>>=1;
212 if(shift<32){
213 b=(b+(1<<(shift-1)))>>shift;
214 }else{
215 b=0;
216 }
217 }else{
218 int shift=bp-ap+1;
219 *p=bp+1;
220 b>>=1;
221 if(shift<32){
222 a=(a+(1<<(shift-1)))>>shift;
223 }else{
224 a=0;
225 }
226 }
227
228 a+=b;
229 if((a&0xc0000000)==0xc0000000 ||
230 (a&0xc0000000)==0){
231 a<<=1;
232 (*p)--;
233 }
234 return(a);
235}
236
237#endif
238
239
240
241
diff --git a/apps/codecs/Tremor/ogg.h b/apps/codecs/Tremor/ogg.h
new file mode 100644
index 0000000000..85cb41b64a
--- /dev/null
+++ b/apps/codecs/Tremor/ogg.h
@@ -0,0 +1,206 @@
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(oggpack_buffer *b,int bits);
145extern void oggpack_adv(oggpack_buffer *b,int bits);
146extern long oggpack_read(oggpack_buffer *b,int bits);
147extern long oggpack_bytes(oggpack_buffer *b);
148extern long oggpack_bits(oggpack_buffer *b);
149extern int oggpack_eop(oggpack_buffer *b);
150
151/* Ogg BITSTREAM PRIMITIVES: decoding **************************/
152
153extern ogg_sync_state *ogg_sync_create(void);
154extern int ogg_sync_destroy(ogg_sync_state *oy);
155extern int ogg_sync_reset(ogg_sync_state *oy);
156
157extern unsigned char *ogg_sync_bufferin(ogg_sync_state *oy, long size);
158extern int ogg_sync_wrote(ogg_sync_state *oy, long bytes);
159extern long ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og);
160extern int ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og);
161extern int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og);
162extern int ogg_stream_packetout(ogg_stream_state *os,ogg_packet *op);
163extern int ogg_stream_packetpeek(ogg_stream_state *os,ogg_packet *op);
164
165/* Ogg BITSTREAM PRIMITIVES: general ***************************/
166
167extern ogg_stream_state *ogg_stream_create(int serialno);
168extern int ogg_stream_destroy(ogg_stream_state *os);
169extern int ogg_stream_reset(ogg_stream_state *os);
170extern int ogg_stream_reset_serialno(ogg_stream_state *os,int serialno);
171extern int ogg_stream_eos(ogg_stream_state *os);
172
173extern int ogg_page_checksum_set(ogg_page *og);
174
175extern int ogg_page_version(ogg_page *og);
176extern int ogg_page_continued(ogg_page *og);
177extern int ogg_page_bos(ogg_page *og);
178extern int ogg_page_eos(ogg_page *og);
179extern ogg_int64_t ogg_page_granulepos(ogg_page *og);
180extern ogg_uint32_t ogg_page_serialno(ogg_page *og);
181extern ogg_uint32_t ogg_page_pageno(ogg_page *og);
182extern int ogg_page_packets(ogg_page *og);
183extern int ogg_page_getbuffer(ogg_page *og, unsigned char **buffer);
184
185extern int ogg_packet_release(ogg_packet *op);
186extern int ogg_page_release(ogg_page *og);
187
188extern void ogg_page_dup(ogg_page *d, ogg_page *s);
189
190/* Ogg BITSTREAM PRIMITIVES: return codes ***************************/
191
192#define OGG_SUCCESS 0
193
194#define OGG_HOLE -10
195#define OGG_SPAN -11
196#define OGG_EVERSION -12
197#define OGG_ESERIAL -13
198#define OGG_EINVAL -14
199#define OGG_EEOS -15
200
201
202#ifdef __cplusplus
203}
204#endif
205
206#endif /* _OGG_H */
diff --git a/apps/codecs/Tremor/os.h b/apps/codecs/Tremor/os.h
new file mode 100644
index 0000000000..65a4992ffc
--- /dev/null
+++ b/apps/codecs/Tremor/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
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/Tremor/os_types.h b/apps/codecs/Tremor/os_types.h
new file mode 100644
index 0000000000..5db5197107
--- /dev/null
+++ b/apps/codecs/Tremor/os_types.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: #ifdef jail to whip a few platforms into the UNIX ideal.
15
16 ********************************************************************/
17#ifndef _OS_TYPES_H
18#define _OS_TYPES_H
19
20#ifdef _LOW_ACCURACY_
21# define X(n) (((((n)>>22)+1)>>1) - ((((n)>>22)+1)>>9))
22# define LOOKUP_T const unsigned char
23#else
24# define X(n) (n)
25# define LOOKUP_T const ogg_int32_t
26#endif
27
28/* make it easy on the folks that want to compile the libs with a
29 different malloc than stdlib */
30#define _ogg_malloc malloc
31#define _ogg_calloc calloc
32#define _ogg_realloc realloc
33#define _ogg_free free
34
35 typedef short ogg_int16_t;
36 typedef int ogg_int32_t;
37 typedef unsigned int ogg_uint32_t;
38 typedef long long ogg_int64_t;
39
40#endif /* _OS_TYPES_H */
diff --git a/apps/codecs/Tremor/os_types.h.bak b/apps/codecs/Tremor/os_types.h.bak
new file mode 100644
index 0000000000..f33402efc1
--- /dev/null
+++ b/apps/codecs/Tremor/os_types.h.bak
@@ -0,0 +1,88 @@
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_TYPES_H
18#define _OS_TYPES_H
19
20#ifdef _LOW_ACCURACY_
21# define X(n) (((((n)>>22)+1)>>1) - ((((n)>>22)+1)>>9))
22# define LOOKUP_T const unsigned char
23#else
24# define X(n) (n)
25# define LOOKUP_T const ogg_int32_t
26#endif
27
28/* make it easy on the folks that want to compile the libs with a
29 different malloc than stdlib */
30#define _ogg_malloc malloc
31#define _ogg_calloc calloc
32#define _ogg_realloc realloc
33#define _ogg_free free
34
35#ifdef _WIN32
36
37# ifndef __GNUC__
38 /* MSVC/Borland */
39 typedef __int64 ogg_int64_t;
40 typedef __int32 ogg_int32_t;
41 typedef unsigned __int32 ogg_uint32_t;
42 typedef __int16 ogg_int16_t;
43# else
44 /* Cygwin */
45 #include <_G_config.h>
46 typedef _G_int64_t ogg_int64_t;
47 typedef _G_int32_t ogg_int32_t;
48 typedef _G_uint32_t ogg_uint32_t;
49 typedef _G_int16_t ogg_int16_t;
50# endif
51
52#elif defined(__MACOS__)
53
54# include <sys/types.h>
55 typedef SInt16 ogg_int16_t;
56 typedef SInt32 ogg_int32_t;
57 typedef UInt32 ogg_uint32_t;
58 typedef SInt64 ogg_int64_t;
59
60#elif defined(__MACOSX__) /* MacOS X Framework build */
61
62# include <sys/types.h>
63 typedef int16_t ogg_int16_t;
64 typedef int32_t ogg_int32_t;
65 typedef u_int32_t ogg_uint32_t;
66 typedef int64_t ogg_int64_t;
67
68#elif defined(__BEOS__)
69
70 /* Be */
71# include <inttypes.h>
72
73#elif defined (__EMX__)
74
75 /* OS/2 GCC */
76 typedef short ogg_int16_t;
77 typedef int ogg_int32_t;
78 typedef unsigned int ogg_uint32_t;
79 typedef long long ogg_int64_t;
80
81#else
82
83# include <sys/types.h>
84# include "config_types.h"
85
86#endif
87
88#endif /* _OS_TYPES_H */
diff --git a/apps/codecs/Tremor/registry.c b/apps/codecs/Tremor/registry.c
new file mode 100644
index 0000000000..c0b5fec0cc
--- /dev/null
+++ b/apps/codecs/Tremor/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[]={
35 &floor0_exportbundle,
36 &floor1_exportbundle,
37};
38
39vorbis_func_residue *_residue_P[]={
40 &residue0_exportbundle,
41 &residue1_exportbundle,
42 &residue2_exportbundle,
43};
44
45vorbis_func_mapping *_mapping_P[]={
46 &mapping0_exportbundle,
47};
48
49
50
diff --git a/apps/codecs/Tremor/registry.h b/apps/codecs/Tremor/registry.h
new file mode 100644
index 0000000000..2bc8068f69
--- /dev/null
+++ b/apps/codecs/Tremor/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/Tremor/res012.c b/apps/codecs/Tremor/res012.c
new file mode 100644
index 0000000000..56e98f3c70
--- /dev/null
+++ b/apps/codecs/Tremor/res012.c
@@ -0,0 +1,334 @@
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 <stdlib.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
44void 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
52void 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 */
89vorbis_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
121vorbis_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
176/* a truncated packet here just means 'stop working'; it's not an error */
177static int _01inverse(vorbis_block *vb,vorbis_look_residue *vl,
178 ogg_int32_t **in,int ch,
179 long (*decodepart)(codebook *, ogg_int32_t *,
180 oggpack_buffer *,int,int)){
181
182 long i,j,k,l,s;
183 vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl;
184 vorbis_info_residue0 *info=look->info;
185
186 /* move all this setup out later */
187 int samples_per_partition=info->grouping;
188 int partitions_per_word=look->phrasebook->dim;
189 int n=info->end-info->begin;
190
191 int partvals=n/samples_per_partition;
192 int partwords=(partvals+partitions_per_word-1)/partitions_per_word;
193 int ***partword=(int ***)alloca(ch*sizeof(*partword));
194
195 for(j=0;j<ch;j++)
196 partword[j]=(int **)_vorbis_block_alloc(vb,partwords*sizeof(*partword[j]));
197
198 for(s=0;s<look->stages;s++){
199
200 /* each loop decodes on partition codeword containing
201 partitions_pre_word partitions */
202 for(i=0,l=0;i<partvals;l++){
203 if(s==0){
204 /* fetch the partition word for each channel */
205 for(j=0;j<ch;j++){
206 int temp=vorbis_book_decode(look->phrasebook,&vb->opb);
207 if(temp==-1)goto eopbreak;
208 partword[j][l]=look->decodemap[temp];
209 if(partword[j][l]==NULL)goto errout;
210 }
211 }
212
213 /* now we decode residual values for the partitions */
214 for(k=0;k<partitions_per_word && i<partvals;k++,i++)
215 for(j=0;j<ch;j++){
216 long offset=info->begin+i*samples_per_partition;
217 if(info->secondstages[partword[j][l][k]]&(1<<s)){
218 codebook *stagebook=look->partbooks[partword[j][l][k]][s];
219 if(stagebook){
220 if(decodepart(stagebook,in[j]+offset,&vb->opb,
221 samples_per_partition,-8)==-1)goto eopbreak;
222 }
223 }
224 }
225 }
226 }
227
228 errout:
229 eopbreak:
230 return(0);
231}
232
233int res0_inverse(vorbis_block *vb,vorbis_look_residue *vl,
234 ogg_int32_t **in,int *nonzero,int ch){
235 int i,used=0;
236 for(i=0;i<ch;i++)
237 if(nonzero[i])
238 in[used++]=in[i];
239 if(used)
240 return(_01inverse(vb,vl,in,used,vorbis_book_decodevs_add));
241 else
242 return(0);
243}
244
245int res1_inverse(vorbis_block *vb,vorbis_look_residue *vl,
246 ogg_int32_t **in,int *nonzero,int ch){
247 int i,used=0;
248 for(i=0;i<ch;i++)
249 if(nonzero[i])
250 in[used++]=in[i];
251 if(used)
252 return(_01inverse(vb,vl,in,used,vorbis_book_decodev_add));
253 else
254 return(0);
255}
256
257/* duplicate code here as speed is somewhat more important */
258int res2_inverse(vorbis_block *vb,vorbis_look_residue *vl,
259 ogg_int32_t **in,int *nonzero,int ch){
260 long i,k,l,s;
261 vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl;
262 vorbis_info_residue0 *info=look->info;
263
264 /* move all this setup out later */
265 int samples_per_partition=info->grouping;
266 int partitions_per_word=look->phrasebook->dim;
267 int n=info->end-info->begin;
268
269 int partvals=n/samples_per_partition;
270 int partwords=(partvals+partitions_per_word-1)/partitions_per_word;
271 int **partword=(int **)_vorbis_block_alloc(vb,partwords*sizeof(*partword));
272 int beginoff=info->begin/ch;
273
274 for(i=0;i<ch;i++)if(nonzero[i])break;
275 if(i==ch)return(0); /* no nonzero vectors */
276
277 samples_per_partition/=ch;
278
279 for(s=0;s<look->stages;s++){
280 for(i=0,l=0;i<partvals;l++){
281
282 if(s==0){
283 /* fetch the partition word */
284 int temp=vorbis_book_decode(look->phrasebook,&vb->opb);
285 if(temp==-1)goto eopbreak;
286 partword[l]=look->decodemap[temp];
287 if(partword[l]==NULL)goto errout;
288 }
289
290 /* now we decode residual values for the partitions */
291 for(k=0;k<partitions_per_word && i<partvals;k++,i++)
292 if(info->secondstages[partword[l][k]]&(1<<s)){
293 codebook *stagebook=look->partbooks[partword[l][k]][s];
294
295 if(stagebook){
296 if(vorbis_book_decodevv_add(stagebook,in,
297 i*samples_per_partition+beginoff,ch,
298 &vb->opb,
299 samples_per_partition,-8)==-1)
300 goto eopbreak;
301 }
302 }
303 }
304 }
305
306 errout:
307 eopbreak:
308 return(0);
309}
310
311
312vorbis_func_residue residue0_exportbundle={
313 &res0_unpack,
314 &res0_look,
315 &res0_free_info,
316 &res0_free_look,
317 &res0_inverse
318};
319
320vorbis_func_residue residue1_exportbundle={
321 &res0_unpack,
322 &res0_look,
323 &res0_free_info,
324 &res0_free_look,
325 &res1_inverse
326};
327
328vorbis_func_residue residue2_exportbundle={
329 &res0_unpack,
330 &res0_look,
331 &res0_free_info,
332 &res0_free_look,
333 &res2_inverse
334};
diff --git a/apps/codecs/Tremor/sharedbook.c b/apps/codecs/Tremor/sharedbook.c
new file mode 100644
index 0000000000..a62211eed6
--- /dev/null
+++ b/apps/codecs/Tremor/sharedbook.c
@@ -0,0 +1,443 @@
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 <stdlib.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) */
71ogg_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_malloc((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
182ogg_int32_t *_book_unquantize(const static_codebook *b,int n,int *sparsemap,
183 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_calloc(n*b->dim,sizeof(*rp));
192
193 *maxpoint=minpoint;
194
195 /* maptype 1 and 2 both use a quantized value vector, but
196 different sizes */
197 switch(b->maptype){
198 case 1:
199 /* most of the time, entries%dimensions == 0, but we need to be
200 well defined. We define that the possible vales at each
201 scalar is values == entries/dim. If entries%dim != 0, we'll
202 have 'too few' values (values*dim<entries), which means that
203 we'll have 'left over' entries; left over entries use zeroed
204 values (and are wasted). So don't generate codebooks like
205 that */
206 quantvals=_book_maptype1_quantvals(b);
207 for(j=0;j<b->entries;j++){
208 if((sparsemap && b->lengthlist[j]) || !sparsemap){
209 ogg_int32_t last=0;
210 int lastpoint=0;
211 int indexdiv=1;
212 for(k=0;k<b->dim;k++){
213 int index= (j/indexdiv)%quantvals;
214 int point;
215 int val=VFLOAT_MULTI(delta,delpoint,
216 abs(b->quantlist[index]),&point);
217
218 val=VFLOAT_ADD(mindel,minpoint,val,point,&point);
219 val=VFLOAT_ADD(last,lastpoint,val,point,&point);
220
221 if(b->q_sequencep){
222 last=val;
223 lastpoint=point;
224 }
225
226 if(sparsemap){
227 r[sparsemap[count]*b->dim+k]=val;
228 rp[sparsemap[count]*b->dim+k]=point;
229 }else{
230 r[count*b->dim+k]=val;
231 rp[count*b->dim+k]=point;
232 }
233 if(*maxpoint<point)*maxpoint=point;
234 indexdiv*=quantvals;
235 }
236 count++;
237 }
238
239 }
240 break;
241 case 2:
242 for(j=0;j<b->entries;j++){
243 if((sparsemap && b->lengthlist[j]) || !sparsemap){
244 ogg_int32_t last=0;
245 int lastpoint=0;
246
247 for(k=0;k<b->dim;k++){
248 int point;
249 int val=VFLOAT_MULTI(delta,delpoint,
250 abs(b->quantlist[j*b->dim+k]),&point);
251
252 val=VFLOAT_ADD(mindel,minpoint,val,point,&point);
253 val=VFLOAT_ADD(last,lastpoint,val,point,&point);
254
255 if(b->q_sequencep){
256 last=val;
257 lastpoint=point;
258 }
259
260 if(sparsemap){
261 r[sparsemap[count]*b->dim+k]=val;
262 rp[sparsemap[count]*b->dim+k]=point;
263 }else{
264 r[count*b->dim+k]=val;
265 rp[count*b->dim+k]=point;
266 }
267 if(*maxpoint<point)*maxpoint=point;
268 }
269 count++;
270 }
271 }
272 break;
273 }
274
275 for(j=0;j<n*b->dim;j++)
276 if(rp[j]<*maxpoint)
277 r[j]>>=*maxpoint-rp[j];
278
279 _ogg_free(rp);
280 return(r);
281 }
282 return(NULL);
283}
284
285void vorbis_staticbook_clear(static_codebook *b){
286 if(b->quantlist)_ogg_free(b->quantlist);
287 if(b->lengthlist)_ogg_free(b->lengthlist);
288 memset(b,0,sizeof(*b));
289
290}
291
292void vorbis_staticbook_destroy(static_codebook *b){
293 vorbis_staticbook_clear(b);
294 _ogg_free(b);
295}
296
297void vorbis_book_clear(codebook *b){
298 /* static book is not cleared; we're likely called on the lookup and
299 the static codebook belongs to the info struct */
300 if(b->valuelist)_ogg_free(b->valuelist);
301 if(b->codelist)_ogg_free(b->codelist);
302
303 if(b->dec_index)_ogg_free(b->dec_index);
304 if(b->dec_codelengths)_ogg_free(b->dec_codelengths);
305 if(b->dec_firsttable)_ogg_free(b->dec_firsttable);
306
307 memset(b,0,sizeof(*b));
308}
309
310static ogg_uint32_t bitreverse(ogg_uint32_t x){
311 x= ((x>>16)&0x0000ffffUL) | ((x<<16)&0xffff0000UL);
312 x= ((x>> 8)&0x00ff00ffUL) | ((x<< 8)&0xff00ff00UL);
313 x= ((x>> 4)&0x0f0f0f0fUL) | ((x<< 4)&0xf0f0f0f0UL);
314 x= ((x>> 2)&0x33333333UL) | ((x<< 2)&0xccccccccUL);
315 return((x>> 1)&0x55555555UL) | ((x<< 1)&0xaaaaaaaaUL);
316}
317
318static int sort32a(const void *a,const void *b){
319 return (**(ogg_uint32_t **)a>**(ogg_uint32_t **)b)-
320 (**(ogg_uint32_t **)a<**(ogg_uint32_t **)b);
321}
322
323/* decode codebook arrangement is more heavily optimized than encode */
324int vorbis_book_init_decode(codebook *c,const static_codebook *s){
325 int i,j,n=0,tabn;
326 int *sortindex;
327 memset(c,0,sizeof(*c));
328
329 /* count actually used entries */
330 for(i=0;i<s->entries;i++)
331 if(s->lengthlist[i]>0)
332 n++;
333
334 c->entries=s->entries;
335 c->used_entries=n;
336 c->dim=s->dim;
337
338 c->q_min=s->q_min;
339 c->q_delta=s->q_delta;
340
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 {
352 /* perform sort */
353 ogg_uint32_t *codes=_make_words(s->lengthlist,s->entries,c->used_entries);
354 ogg_uint32_t **codep=(ogg_uint32_t **)alloca(sizeof(*codep)*n);
355
356 if(codes==NULL)goto err_out;
357
358 for(i=0;i<n;i++){
359 codes[i]=bitreverse(codes[i]);
360 codep[i]=codes+i;
361 }
362
363 qsort(codep,n,sizeof(*codep),sort32a);
364
365 sortindex=(int *)alloca(n*sizeof(*sortindex));
366 c->codelist=(ogg_uint32_t *)_ogg_malloc(n*sizeof(*c->codelist));
367 /* the index is a reverse index */
368 for(i=0;i<n;i++){
369 int position=codep[i]-codes;
370 sortindex[position]=i;
371 }
372
373 for(i=0;i<n;i++)
374 c->codelist[sortindex[i]]=codes[i];
375 _ogg_free(codes);
376 }
377
378
379 c->valuelist=_book_unquantize(s,n,sortindex,&c->binarypoint);
380 c->dec_index=(int *)_ogg_malloc(n*sizeof(*c->dec_index));
381
382 for(n=0,i=0;i<s->entries;i++)
383 if(s->lengthlist[i]>0)
384 c->dec_index[sortindex[n++]]=i;
385
386 c->dec_codelengths=(char *)_ogg_malloc(n*sizeof(*c->dec_codelengths));
387 for(n=0,i=0;i<s->entries;i++)
388 if(s->lengthlist[i]>0)
389 c->dec_codelengths[sortindex[n++]]=s->lengthlist[i];
390
391 c->dec_firsttablen=_ilog(c->used_entries)-4; /* this is magic */
392 if(c->dec_firsttablen<5)c->dec_firsttablen=5;
393 if(c->dec_firsttablen>8)c->dec_firsttablen=8;
394
395 tabn=1<<c->dec_firsttablen;
396 c->dec_firsttable=(ogg_uint32_t *)_ogg_calloc(tabn,sizeof(*c->dec_firsttable));
397 c->dec_maxlength=0;
398
399 for(i=0;i<n;i++){
400 if(c->dec_maxlength<c->dec_codelengths[i])
401 c->dec_maxlength=c->dec_codelengths[i];
402 if(c->dec_codelengths[i]<=c->dec_firsttablen){
403 ogg_uint32_t orig=bitreverse(c->codelist[i]);
404 for(j=0;j<(1<<(c->dec_firsttablen-c->dec_codelengths[i]));j++)
405 c->dec_firsttable[orig|(j<<c->dec_codelengths[i])]=i+1;
406 }
407 }
408
409 /* now fill in 'unused' entries in the firsttable with hi/lo search
410 hints for the non-direct-hits */
411 {
412 ogg_uint32_t mask=0xfffffffeUL<<(31-c->dec_firsttablen);
413 long lo=0,hi=0;
414
415 for(i=0;i<tabn;i++){
416 ogg_uint32_t word=i<<(32-c->dec_firsttablen);
417 if(c->dec_firsttable[bitreverse(word)]==0){
418 while((lo+1)<n && c->codelist[lo+1]<=word)lo++;
419 while( hi<n && word>=(c->codelist[hi]&mask))hi++;
420
421 /* we only actually have 15 bits per hint to play with here.
422 In order to overflow gracefully (nothing breaks, efficiency
423 just drops), encode as the difference from the extremes. */
424 {
425 unsigned long loval=lo;
426 unsigned long hival=n-hi;
427
428 if(loval>0x7fff)loval=0x7fff;
429 if(hival>0x7fff)hival=0x7fff;
430 c->dec_firsttable[bitreverse(word)]=
431 0x80000000UL | (loval<<15) | hival;
432 }
433 }
434 }
435 }
436
437
438 return(0);
439 err_out:
440 vorbis_book_clear(c);
441 return(-1);
442}
443
diff --git a/apps/codecs/Tremor/synthesis.c b/apps/codecs/Tremor/synthesis.c
new file mode 100644
index 0000000000..0b93fee0ac
--- /dev/null
+++ b/apps/codecs/Tremor/synthesis.c
@@ -0,0 +1,113 @@
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
27int vorbis_synthesis(vorbis_block *vb,ogg_packet *op,int decodep){
28 vorbis_dsp_state *vd=vb->vd;
29 private_state *b=(private_state *)vd->backend_state;
30 vorbis_info *vi=vd->vi;
31 codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
32 oggpack_buffer *opb=&vb->opb;
33 int type,mode,i;
34
35 /* first things first. Make sure decode is ready */
36 _vorbis_block_ripcord(vb);
37 oggpack_readinit(opb,op->packet);
38
39 /* Check the packet type */
40 if(oggpack_read(opb,1)!=0){
41 /* Oops. This is not an audio data packet */
42 return(OV_ENOTAUDIO);
43 }
44
45 /* read our mode and pre/post windowsize */
46 mode=oggpack_read(opb,b->modebits);
47 if(mode==-1)return(OV_EBADPACKET);
48
49 vb->mode=mode;
50 vb->W=ci->mode_param[mode]->blockflag;
51 if(vb->W){
52 vb->lW=oggpack_read(opb,1);
53 vb->nW=oggpack_read(opb,1);
54 if(vb->nW==-1) return(OV_EBADPACKET);
55 }else{
56 vb->lW=0;
57 vb->nW=0;
58 }
59
60 /* more setup */
61 vb->granulepos=op->granulepos;
62 vb->sequence=op->packetno-3; /* first block is third packet */
63 vb->eofflag=op->e_o_s;
64
65 if(decodep){
66 /* alloc pcm passback storage */
67 vb->pcmend=ci->blocksizes[vb->W];
68 vb->pcm=(ogg_int32_t **)_vorbis_block_alloc(vb,sizeof(*vb->pcm)*vi->channels);
69 for(i=0;i<vi->channels;i++)
70 vb->pcm[i]=(ogg_int32_t *)_vorbis_block_alloc(vb,vb->pcmend*sizeof(*vb->pcm[i]));
71
72 /* unpack_header enforces range checking */
73 type=ci->map_type[ci->mode_param[mode]->mapping];
74
75 return(_mapping_P[type]->inverse(vb,b->mode[mode]));
76 }else{
77 /* no pcm */
78 vb->pcmend=0;
79 vb->pcm=NULL;
80
81 return(0);
82 }
83}
84
85long vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op){
86 codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
87 oggpack_buffer opb;
88 int mode;
89
90 oggpack_readinit(&opb,op->packet);
91
92 /* Check the packet type */
93 if(oggpack_read(&opb,1)!=0){
94 /* Oops. This is not an audio data packet */
95 return(OV_ENOTAUDIO);
96 }
97
98 {
99 int modebits=0;
100 int v=ci->modes;
101 while(v>1){
102 modebits++;
103 v>>=1;
104 }
105
106 /* read our mode and pre/post windowsize */
107 mode=oggpack_read(&opb,modebits);
108 }
109 if(mode==-1)return(OV_EBADPACKET);
110 return(ci->blocksizes[ci->mode_param[mode]->blockflag]);
111}
112
113
diff --git a/apps/codecs/Tremor/vorbisfile.c b/apps/codecs/Tremor/vorbisfile.c
new file mode 100644
index 0000000000..7448b1ed1d
--- /dev/null
+++ b/apps/codecs/Tremor/vorbisfile.c
@@ -0,0 +1,1592 @@
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 <stdlib.h>
20#include <stdio.h>
21#include <errno.h>
22#include <string.h>
23#include <math.h>
24
25#include "ivorbiscodec.h"
26#include "ivorbisfile.h"
27
28#include "os.h"
29#include "misc.h"
30
31/* A 'chained bitstream' is a Vorbis bitstream that contains more than
32 one logical bitstream arranged end to end (the only form of Ogg
33 multiplexing allowed in a Vorbis bitstream; grouping [parallel
34 multiplexing] is not allowed in Vorbis) */
35
36/* A Vorbis file can be played beginning to end (streamed) without
37 worrying ahead of time about chaining (see decoder_example.c). If
38 we have the whole file, however, and want random access
39 (seeking/scrubbing) or desire to know the total length/time of a
40 file, we need to account for the possibility of chaining. */
41
42/* We can handle things a number of ways; we can determine the entire
43 bitstream structure right off the bat, or find pieces on demand.
44 This example determines and caches structure for the entire
45 bitstream, but builds a virtual decoder on the fly when moving
46 between links in the chain. */
47
48/* There are also different ways to implement seeking. Enough
49 information exists in an Ogg bitstream to seek to
50 sample-granularity positions in the output. Or, one can seek by
51 picking some portion of the stream roughly in the desired area if
52 we only want coarse navigation through the stream. */
53
54/*************************************************************************
55 * Many, many internal helpers. The intention is not to be confusing;
56 * rampant duplication and monolithic function implementation would be
57 * harder to understand anyway. The high level functions are last. Begin
58 * grokking near the end of the file */
59
60
61/* read a little more data from the file/pipe into the ogg_sync framer */
62static long _get_data(OggVorbis_File *vf){
63 errno=0;
64 if(vf->datasource){
65 char *buffer=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 if(bytes==0 && errno)return(-1);
69 return(bytes);
70 }else
71 return(0);
72}
73
74/* save a tiny smidge of verbosity to make the code more readable */
75static void _seek_helper(OggVorbis_File *vf,ogg_int64_t offset){
76 if(vf->datasource){
77 (vf->callbacks.seek_func)(vf->datasource, offset, SEEK_SET);
78 vf->offset=offset;
79 ogg_sync_reset(vf->oy);
80 }else{
81 /* shouldn't happen unless someone writes a broken callback */
82 return;
83 }
84}
85
86/* The read/seek functions track absolute position within the stream */
87
88/* from the head of the stream, get the next page. boundary specifies
89 if the function is allowed to fetch more data from the stream (and
90 how much) or only use internally buffered data.
91
92 boundary: -1) unbounded search
93 0) read no additional data; use cached only
94 n) search for a new page beginning for n bytes
95
96 return: <0) did not find a page (OV_FALSE, OV_EOF, OV_EREAD)
97 n) found a page at absolute offset n
98
99 produces a refcounted page */
100
101static ogg_int64_t _get_next_page(OggVorbis_File *vf,ogg_page *og,
102 ogg_int64_t boundary){
103 if(boundary>0)boundary+=vf->offset;
104 while(1){
105 long more;
106
107 if(boundary>0 && vf->offset>=boundary)return(OV_FALSE);
108 more=ogg_sync_pageseek(vf->oy,og);
109
110 if(more<0){
111 /* skipped n bytes */
112 vf->offset-=more;
113 }else{
114 if(more==0){
115 /* send more paramedics */
116 if(!boundary)return(OV_FALSE);
117 {
118 long ret=_get_data(vf);
119 if(ret==0)return(OV_EOF);
120 if(ret<0)return(OV_EREAD);
121 }
122 }else{
123 /* got a page. Return the offset at the page beginning,
124 advance the internal offset past the page end */
125 ogg_int64_t ret=vf->offset;
126 vf->offset+=more;
127 return(ret);
128
129 }
130 }
131 }
132}
133
134/* find the latest page beginning before the current stream cursor
135 position. Much dirtier than the above as Ogg doesn't have any
136 backward search linkage. no 'readp' as it will certainly have to
137 read. */
138/* returns offset or OV_EREAD, OV_FAULT and produces a refcounted page */
139
140static ogg_int64_t _get_prev_page(OggVorbis_File *vf,ogg_page *og){
141 ogg_int64_t begin=vf->offset;
142 ogg_int64_t end=begin;
143 ogg_int64_t ret;
144 ogg_int64_t offset=-1;
145
146 while(offset==-1){
147 begin-=CHUNKSIZE;
148 if(begin<0)
149 begin=0;
150 _seek_helper(vf,begin);
151 while(vf->offset<end){
152 ret=_get_next_page(vf,og,end-vf->offset);
153 if(ret==OV_EREAD)return(OV_EREAD);
154 if(ret<0){
155 break;
156 }else{
157 offset=ret;
158 }
159 }
160 }
161
162 /* we have the offset. Actually snork and hold the page now */
163 _seek_helper(vf,offset);
164 ret=_get_next_page(vf,og,CHUNKSIZE);
165 if(ret<0)
166 /* this shouldn't be possible */
167 return(OV_EFAULT);
168
169 return(offset);
170}
171
172/* finds each bitstream link one at a time using a bisection search
173 (has to begin by knowing the offset of the lb's initial page).
174 Recurses for each link so it can alloc the link storage after
175 finding them all, then unroll and fill the cache at the same time */
176static int _bisect_forward_serialno(OggVorbis_File *vf,
177 ogg_int64_t begin,
178 ogg_int64_t searched,
179 ogg_int64_t end,
180 ogg_uint32_t currentno,
181 long m){
182 ogg_int64_t endsearched=end;
183 ogg_int64_t next=end;
184 ogg_page og={0,0,0,0};
185 ogg_int64_t ret;
186
187 /* the below guards against garbage seperating the last and
188 first pages of two links. */
189 while(searched<endsearched){
190 ogg_int64_t bisect;
191
192 if(endsearched-searched<CHUNKSIZE){
193 bisect=searched;
194 }else{
195 bisect=(searched+endsearched)/2;
196 }
197
198 _seek_helper(vf,bisect);
199 ret=_get_next_page(vf,&og,-1);
200 if(ret==OV_EREAD)return(OV_EREAD);
201 if(ret<0 || ogg_page_serialno(&og)!=currentno){
202 endsearched=bisect;
203 if(ret>=0)next=ret;
204 }else{
205 searched=ret+og.header_len+og.body_len;
206 }
207 ogg_page_release(&og);
208 }
209
210 _seek_helper(vf,next);
211 ret=_get_next_page(vf,&og,-1);
212 if(ret==OV_EREAD)return(OV_EREAD);
213
214 if(searched>=end || ret<0){
215 ogg_page_release(&og);
216 vf->links=m+1;
217 vf->offsets=_ogg_malloc((vf->links+1)*sizeof(*vf->offsets));
218 vf->serialnos=_ogg_malloc(vf->links*sizeof(*vf->serialnos));
219 vf->offsets[m+1]=searched;
220 }else{
221 ret=_bisect_forward_serialno(vf,next,vf->offset,
222 end,ogg_page_serialno(&og),m+1);
223 ogg_page_release(&og);
224 if(ret==OV_EREAD)return(OV_EREAD);
225 }
226
227 vf->offsets[m]=begin;
228 vf->serialnos[m]=currentno;
229 return(0);
230}
231
232/* uses the local ogg_stream storage in vf; this is important for
233 non-streaming input sources */
234/* consumes the page that's passed in (if any) */
235
236static int _fetch_headers(OggVorbis_File *vf,
237 vorbis_info *vi,
238 vorbis_comment *vc,
239 ogg_uint32_t *serialno,
240 ogg_page *og_ptr){
241 ogg_page og={0,0,0,0};
242 ogg_packet op={0,0,0,0,0,0};
243 int i,ret;
244
245 if(!og_ptr){
246 ogg_int64_t llret=_get_next_page(vf,&og,CHUNKSIZE);
247 if(llret==OV_EREAD)return(OV_EREAD);
248 if(llret<0)return OV_ENOTVORBIS;
249 og_ptr=&og;
250 }
251
252 ogg_stream_reset_serialno(vf->os,ogg_page_serialno(og_ptr));
253 if(serialno)*serialno=vf->os->serialno;
254 vf->ready_state=STREAMSET;
255
256 /* extract the initial header from the first page and verify that the
257 Ogg bitstream is in fact Vorbis data */
258
259 vorbis_info_init(vi);
260 vorbis_comment_init(vc);
261
262 i=0;
263 while(i<3){
264 ogg_stream_pagein(vf->os,og_ptr);
265 while(i<3){
266 int result=ogg_stream_packetout(vf->os,&op);
267 if(result==0)break;
268 if(result==-1){
269 ret=OV_EBADHEADER;
270 goto bail_header;
271 }
272 if((ret=vorbis_synthesis_headerin(vi,vc,&op))){
273 goto bail_header;
274 }
275 i++;
276 }
277 if(i<3)
278 if(_get_next_page(vf,og_ptr,CHUNKSIZE)<0){
279 ret=OV_EBADHEADER;
280 goto bail_header;
281 }
282 }
283
284 ogg_packet_release(&op);
285 ogg_page_release(&og);
286 return 0;
287
288 bail_header:
289 ogg_packet_release(&op);
290 ogg_page_release(&og);
291 vorbis_info_clear(vi);
292 vorbis_comment_clear(vc);
293 vf->ready_state=OPENED;
294
295 return ret;
296}
297
298/* last step of the OggVorbis_File initialization; get all the
299 vorbis_info structs and PCM positions. Only called by the seekable
300 initialization (local stream storage is hacked slightly; pay
301 attention to how that's done) */
302
303/* this is void and does not propogate errors up because we want to be
304 able to open and use damaged bitstreams as well as we can. Just
305 watch out for missing information for links in the OggVorbis_File
306 struct */
307static void _prefetch_all_headers(OggVorbis_File *vf, ogg_int64_t dataoffset){
308 ogg_page og={0,0,0,0};
309 int i;
310 ogg_int64_t ret;
311
312 vf->vi=_ogg_realloc(vf->vi,vf->links*sizeof(*vf->vi));
313 vf->vc=_ogg_realloc(vf->vc,vf->links*sizeof(*vf->vc));
314 vf->dataoffsets=_ogg_malloc(vf->links*sizeof(*vf->dataoffsets));
315 vf->pcmlengths=_ogg_malloc(vf->links*2*sizeof(*vf->pcmlengths));
316
317 for(i=0;i<vf->links;i++){
318 if(i==0){
319 /* we already grabbed the initial header earlier. Just set the offset */
320 vf->dataoffsets[i]=dataoffset;
321 _seek_helper(vf,dataoffset);
322
323 }else{
324
325 /* seek to the location of the initial header */
326
327 _seek_helper(vf,vf->offsets[i]);
328 if(_fetch_headers(vf,vf->vi+i,vf->vc+i,NULL,NULL)<0){
329 vf->dataoffsets[i]=-1;
330 }else{
331 vf->dataoffsets[i]=vf->offset;
332 }
333 }
334
335 /* fetch beginning PCM offset */
336
337 if(vf->dataoffsets[i]!=-1){
338 ogg_int64_t accumulated=0,pos;
339 long lastblock=-1;
340 int result;
341
342 ogg_stream_reset_serialno(vf->os,vf->serialnos[i]);
343
344 while(1){
345 ogg_packet op={0,0,0,0,0,0};
346
347 ret=_get_next_page(vf,&og,-1);
348 if(ret<0)
349 /* this should not be possible unless the file is
350 truncated/mangled */
351 break;
352
353 if(ogg_page_serialno(&og)!=vf->serialnos[i])
354 break;
355
356 pos=ogg_page_granulepos(&og);
357
358 /* count blocksizes of all frames in the page */
359 ogg_stream_pagein(vf->os,&og);
360 while((result=ogg_stream_packetout(vf->os,&op))){
361 if(result>0){ /* ignore holes */
362 long thisblock=vorbis_packet_blocksize(vf->vi+i,&op);
363 if(lastblock!=-1)
364 accumulated+=(lastblock+thisblock)>>2;
365 lastblock=thisblock;
366 }
367 }
368 ogg_packet_release(&op);
369
370 if(pos!=-1){
371 /* pcm offset of last packet on the first audio page */
372 accumulated= pos-accumulated;
373 break;
374 }
375 }
376
377 /* less than zero? This is a stream with samples trimmed off
378 the beginning, a normal occurrence; set the offset to zero */
379 if(accumulated<0)accumulated=0;
380
381 vf->pcmlengths[i*2]=accumulated;
382 }
383
384 /* get the PCM length of this link. To do this,
385 get the last page of the stream */
386 {
387 ogg_int64_t end=vf->offsets[i+1];
388 _seek_helper(vf,end);
389
390 while(1){
391 ret=_get_prev_page(vf,&og);
392 if(ret<0){
393 /* this should not be possible */
394 vorbis_info_clear(vf->vi+i);
395 vorbis_comment_clear(vf->vc+i);
396 break;
397 }
398 if(ogg_page_granulepos(&og)!=-1){
399 vf->pcmlengths[i*2+1]=ogg_page_granulepos(&og)-vf->pcmlengths[i*2];
400 break;
401 }
402 vf->offset=ret;
403 }
404 }
405 }
406 ogg_page_release(&og);
407}
408
409static void _make_decode_ready(OggVorbis_File *vf){
410 if(vf->ready_state!=STREAMSET)return;
411 if(vf->seekable){
412 vorbis_synthesis_init(&vf->vd,vf->vi+vf->current_link);
413 }else{
414 vorbis_synthesis_init(&vf->vd,vf->vi);
415 }
416 vorbis_block_init(&vf->vd,&vf->vb);
417 vf->ready_state=INITSET;
418 vf->bittrack=0;
419 vf->samptrack=0;
420 return;
421}
422
423static int _open_seekable2(OggVorbis_File *vf){
424 ogg_uint32_t serialno=vf->current_serialno;
425 ogg_uint32_t tempserialno;
426 ogg_int64_t dataoffset=vf->offset, end;
427 ogg_page og={0,0,0,0};
428
429 /* we're partially open and have a first link header state in
430 storage in vf */
431 /* we can seek, so set out learning all about this file */
432 (vf->callbacks.seek_func)(vf->datasource,0,SEEK_END);
433 vf->offset=vf->end=(vf->callbacks.tell_func)(vf->datasource);
434
435 /* We get the offset for the last page of the physical bitstream.
436 Most OggVorbis files will contain a single logical bitstream */
437 end=_get_prev_page(vf,&og);
438 if(end<0)return(end);
439
440 /* more than one logical bitstream? */
441 tempserialno=ogg_page_serialno(&og);
442 ogg_page_release(&og);
443
444 if(tempserialno!=serialno){
445
446 /* Chained bitstream. Bisect-search each logical bitstream
447 section. Do so based on serial number only */
448 if(_bisect_forward_serialno(vf,0,0,end+1,serialno,0)<0)return(OV_EREAD);
449
450 }else{
451
452 /* Only one logical bitstream */
453 if(_bisect_forward_serialno(vf,0,end,end+1,serialno,0))return(OV_EREAD);
454
455 }
456
457 /* the initial header memory is referenced by vf after; don't free it */
458 _prefetch_all_headers(vf,dataoffset);
459 return(ov_raw_seek(vf,0));
460}
461
462/* clear out the current logical bitstream decoder */
463static void _decode_clear(OggVorbis_File *vf){
464 vorbis_dsp_clear(&vf->vd);
465 vorbis_block_clear(&vf->vb);
466 vf->ready_state=OPENED;
467}
468
469/* fetch and process a packet. Handles the case where we're at a
470 bitstream boundary and dumps the decoding machine. If the decoding
471 machine is unloaded, it loads it. It also keeps pcm_offset up to
472 date (seek and read both use this. seek uses a special hack with
473 readp).
474
475 return: <0) error, OV_HOLE (lost packet) or OV_EOF
476 0) need more data (only if readp==0)
477 1) got a packet
478*/
479
480static int _fetch_and_process_packet(OggVorbis_File *vf,
481 int readp,
482 int spanp){
483 ogg_page og={0,0,0,0};
484 ogg_packet op={0,0,0,0,0,0};
485 int ret=0;
486
487 /* handle one packet. Try to fetch it from current stream state */
488 /* extract packets from page */
489 while(1){
490
491 /* process a packet if we can. If the machine isn't loaded,
492 neither is a page */
493 if(vf->ready_state==INITSET){
494 while(1) {
495 int result=ogg_stream_packetout(vf->os,&op);
496 ogg_int64_t granulepos;
497
498 if(result<0){
499 ret=OV_HOLE; /* hole in the data. */
500 goto cleanup;
501 }
502 if(result>0){
503 /* got a packet. process it */
504 granulepos=op.granulepos;
505 if(!vorbis_synthesis(&vf->vb,&op,1)){ /* lazy check for lazy
506 header handling. The
507 header packets aren't
508 audio, so if/when we
509 submit them,
510 vorbis_synthesis will
511 reject them */
512
513 /* suck in the synthesis data and track bitrate */
514 {
515 int oldsamples=vorbis_synthesis_pcmout(&vf->vd,NULL);
516 /* for proper use of libvorbis within libvorbisfile,
517 oldsamples will always be zero. */
518 if(oldsamples){
519 ret=OV_EFAULT;
520 goto cleanup;
521 }
522
523 vorbis_synthesis_blockin(&vf->vd,&vf->vb);
524 vf->samptrack+=vorbis_synthesis_pcmout(&vf->vd,NULL)-oldsamples;
525 vf->bittrack+=op.bytes*8;
526 }
527
528 /* update the pcm offset. */
529 if(granulepos!=-1 && !op.e_o_s){
530 int link=(vf->seekable?vf->current_link:0);
531 int i,samples;
532
533 /* this packet has a pcm_offset on it (the last packet
534 completed on a page carries the offset) After processing
535 (above), we know the pcm position of the *last* sample
536 ready to be returned. Find the offset of the *first*
537
538 As an aside, this trick is inaccurate if we begin
539 reading anew right at the last page; the end-of-stream
540 granulepos declares the last frame in the stream, and the
541 last packet of the last page may be a partial frame.
542 So, we need a previous granulepos from an in-sequence page
543 to have a reference point. Thus the !op.e_o_s clause
544 above */
545
546 if(vf->seekable && link>0)
547 granulepos-=vf->pcmlengths[link*2];
548 if(granulepos<0)granulepos=0; /* actually, this
549 shouldn't be possible
550 here unless the stream
551 is very broken */
552
553 samples=vorbis_synthesis_pcmout(&vf->vd,NULL);
554
555 granulepos-=samples;
556 for(i=0;i<link;i++)
557 granulepos+=vf->pcmlengths[i*2+1];
558 vf->pcm_offset=granulepos;
559 }
560 ret=1;
561 goto cleanup;
562 }
563 }
564 else
565 break;
566 }
567 }
568
569 if(vf->ready_state>=OPENED){
570 int ret;
571 if(!readp){
572 ret=0;
573 goto cleanup;
574 }
575 if((ret=_get_next_page(vf,&og,-1))<0){
576 ret=OV_EOF; /* eof. leave unitialized */
577 goto cleanup;
578 }
579
580 /* bitrate tracking; add the header's bytes here, the body bytes
581 are done by packet above */
582 vf->bittrack+=og.header_len*8;
583
584 /* has our decoding just traversed a bitstream boundary? */
585 if(vf->ready_state==INITSET){
586 if(vf->current_serialno!=ogg_page_serialno(&og)){
587 if(!spanp){
588 ret=OV_EOF;
589 goto cleanup;
590 }
591
592 _decode_clear(vf);
593
594 if(!vf->seekable){
595 vorbis_info_clear(vf->vi);
596 vorbis_comment_clear(vf->vc);
597 }
598 }
599 }
600 }
601
602 /* Do we need to load a new machine before submitting the page? */
603 /* This is different in the seekable and non-seekable cases.
604
605 In the seekable case, we already have all the header
606 information loaded and cached; we just initialize the machine
607 with it and continue on our merry way.
608
609 In the non-seekable (streaming) case, we'll only be at a
610 boundary if we just left the previous logical bitstream and
611 we're now nominally at the header of the next bitstream
612 */
613
614 if(vf->ready_state!=INITSET){
615 int link;
616
617 if(vf->ready_state<STREAMSET){
618 if(vf->seekable){
619 vf->current_serialno=ogg_page_serialno(&og);
620
621 /* match the serialno to bitstream section. We use this rather than
622 offset positions to avoid problems near logical bitstream
623 boundaries */
624 for(link=0;link<vf->links;link++)
625 if(vf->serialnos[link]==vf->current_serialno)break;
626 if(link==vf->links){
627 ret=OV_EBADLINK; /* sign of a bogus stream. error out,
628 leave machine uninitialized */
629 goto cleanup;
630 }
631
632 vf->current_link=link;
633
634 ogg_stream_reset_serialno(vf->os,vf->current_serialno);
635 vf->ready_state=STREAMSET;
636
637 }else{
638 /* we're streaming */
639 /* fetch the three header packets, build the info struct */
640
641 int ret=_fetch_headers(vf,vf->vi,vf->vc,&vf->current_serialno,&og);
642 if(ret) goto cleanup;
643 vf->current_link++;
644 link=0;
645 }
646 }
647
648 _make_decode_ready(vf);
649 }
650 ogg_stream_pagein(vf->os,&og);
651 }
652 cleanup:
653 ogg_packet_release(&op);
654 ogg_page_release(&og);
655 return ret;
656}
657
658/* if, eg, 64 bit stdio is configured by default, this will build with
659 fseek64 */
660static int _fseek64_wrap(FILE *f,ogg_int64_t off,int whence){
661 if(f==NULL)return(-1);
662 return fseek(f,off,whence);
663}
664
665static int _ov_open1(void *f,OggVorbis_File *vf,char *initial,
666 long ibytes, ov_callbacks callbacks){
667 int offsettest=(f?callbacks.seek_func(f,0,SEEK_CUR):-1);
668 int ret;
669
670 memset(vf,0,sizeof(*vf));
671 vf->datasource=f;
672 vf->callbacks = callbacks;
673
674 /* init the framing state */
675 vf->oy=ogg_sync_create();
676
677 /* perhaps some data was previously read into a buffer for testing
678 against other stream types. Allow initialization from this
679 previously read data (as we may be reading from a non-seekable
680 stream) */
681 if(initial){
682 char *buffer=ogg_sync_bufferin(vf->oy,ibytes);
683 memcpy(buffer,initial,ibytes);
684 ogg_sync_wrote(vf->oy,ibytes);
685 }
686
687 /* can we seek? Stevens suggests the seek test was portable */
688 if(offsettest!=-1)vf->seekable=1;
689
690 /* No seeking yet; Set up a 'single' (current) logical bitstream
691 entry for partial open */
692 vf->links=1;
693 vf->vi=_ogg_calloc(vf->links,sizeof(*vf->vi));
694 vf->vc=_ogg_calloc(vf->links,sizeof(*vf->vc));
695 vf->os=ogg_stream_create(-1); /* fill in the serialno later */
696
697 /* Try to fetch the headers, maintaining all the storage */
698 if((ret=_fetch_headers(vf,vf->vi,vf->vc,&vf->current_serialno,NULL))<0){
699 vf->datasource=NULL;
700 ov_clear(vf);
701 }else if(vf->ready_state < PARTOPEN)
702 vf->ready_state=PARTOPEN;
703 return(ret);
704}
705
706static int _ov_open2(OggVorbis_File *vf){
707 if(vf->ready_state < OPENED)
708 vf->ready_state=OPENED;
709 if(vf->seekable){
710 int ret=_open_seekable2(vf);
711 if(ret){
712 vf->datasource=NULL;
713 ov_clear(vf);
714 }
715 return(ret);
716 }
717 return 0;
718}
719
720
721/* clear out the OggVorbis_File struct */
722int ov_clear(OggVorbis_File *vf){
723 if(vf){
724 vorbis_block_clear(&vf->vb);
725 vorbis_dsp_clear(&vf->vd);
726 ogg_stream_destroy(vf->os);
727
728 if(vf->vi && vf->links){
729 int i;
730 for(i=0;i<vf->links;i++){
731 vorbis_info_clear(vf->vi+i);
732 vorbis_comment_clear(vf->vc+i);
733 }
734 _ogg_free(vf->vi);
735 _ogg_free(vf->vc);
736 }
737 if(vf->dataoffsets)_ogg_free(vf->dataoffsets);
738 if(vf->pcmlengths)_ogg_free(vf->pcmlengths);
739 if(vf->serialnos)_ogg_free(vf->serialnos);
740 if(vf->offsets)_ogg_free(vf->offsets);
741 ogg_sync_destroy(vf->oy);
742
743 if(vf->datasource)(vf->callbacks.close_func)(vf->datasource);
744 memset(vf,0,sizeof(*vf));
745 }
746#ifdef DEBUG_LEAKS
747 _VDBG_dump();
748#endif
749 return(0);
750}
751
752/* inspects the OggVorbis file and finds/documents all the logical
753 bitstreams contained in it. Tries to be tolerant of logical
754 bitstream sections that are truncated/woogie.
755
756 return: -1) error
757 0) OK
758*/
759
760int ov_open_callbacks(void *f,OggVorbis_File *vf,char *initial,long ibytes,
761 ov_callbacks callbacks){
762 int ret=_ov_open1(f,vf,initial,ibytes,callbacks);
763 if(ret)return ret;
764 return _ov_open2(vf);
765}
766
767int ov_open(FILE *f,OggVorbis_File *vf,char *initial,long ibytes){
768 ov_callbacks callbacks = {
769 (size_t (*)(void *, size_t, size_t, void *)) fread,
770 (int (*)(void *, ogg_int64_t, int)) _fseek64_wrap,
771 (int (*)(void *)) fclose,
772 (long (*)(void *)) ftell
773 };
774
775 return ov_open_callbacks((void *)f, vf, initial, ibytes, callbacks);
776}
777
778/* Only partially open the vorbis file; test for Vorbisness, and load
779 the headers for the first chain. Do not seek (although test for
780 seekability). Use ov_test_open to finish opening the file, else
781 ov_clear to close/free it. Same return codes as open. */
782
783int ov_test_callbacks(void *f,OggVorbis_File *vf,char *initial,long ibytes,
784 ov_callbacks callbacks)
785{
786 return _ov_open1(f,vf,initial,ibytes,callbacks);
787}
788
789int ov_test(FILE *f,OggVorbis_File *vf,char *initial,long ibytes){
790 ov_callbacks callbacks = {
791 (size_t (*)(void *, size_t, size_t, void *)) fread,
792 (int (*)(void *, ogg_int64_t, int)) _fseek64_wrap,
793 (int (*)(void *)) fclose,
794 (long (*)(void *)) ftell
795 };
796
797 return ov_test_callbacks((void *)f, vf, initial, ibytes, callbacks);
798}
799
800int ov_test_open(OggVorbis_File *vf){
801 if(vf->ready_state!=PARTOPEN)return(OV_EINVAL);
802 return _ov_open2(vf);
803}
804
805/* How many logical bitstreams in this physical bitstream? */
806long ov_streams(OggVorbis_File *vf){
807 return vf->links;
808}
809
810/* Is the FILE * associated with vf seekable? */
811long ov_seekable(OggVorbis_File *vf){
812 return vf->seekable;
813}
814
815/* returns the bitrate for a given logical bitstream or the entire
816 physical bitstream. If the file is open for random access, it will
817 find the *actual* average bitrate. If the file is streaming, it
818 returns the nominal bitrate (if set) else the average of the
819 upper/lower bounds (if set) else -1 (unset).
820
821 If you want the actual bitrate field settings, get them from the
822 vorbis_info structs */
823
824long ov_bitrate(OggVorbis_File *vf,int i){
825 if(vf->ready_state<OPENED)return(OV_EINVAL);
826 if(i>=vf->links)return(OV_EINVAL);
827 if(!vf->seekable && i!=0)return(ov_bitrate(vf,0));
828 if(i<0){
829 ogg_int64_t bits=0;
830 int i;
831 for(i=0;i<vf->links;i++)
832 bits+=(vf->offsets[i+1]-vf->dataoffsets[i])*8;
833 /* This once read: return(rint(bits/ov_time_total(vf,-1)));
834 * gcc 3.x on x86 miscompiled this at optimisation level 2 and above,
835 * so this is slightly transformed to make it work.
836 */
837 return(bits*1000/ov_time_total(vf,-1));
838 }else{
839 if(vf->seekable){
840 /* return the actual bitrate */
841 return((vf->offsets[i+1]-vf->dataoffsets[i])*8000/ov_time_total(vf,i));
842 }else{
843 /* return nominal if set */
844 if(vf->vi[i].bitrate_nominal>0){
845 return vf->vi[i].bitrate_nominal;
846 }else{
847 if(vf->vi[i].bitrate_upper>0){
848 if(vf->vi[i].bitrate_lower>0){
849 return (vf->vi[i].bitrate_upper+vf->vi[i].bitrate_lower)/2;
850 }else{
851 return vf->vi[i].bitrate_upper;
852 }
853 }
854 return(OV_FALSE);
855 }
856 }
857 }
858}
859
860/* returns the actual bitrate since last call. returns -1 if no
861 additional data to offer since last call (or at beginning of stream),
862 EINVAL if stream is only partially open
863*/
864long ov_bitrate_instant(OggVorbis_File *vf){
865 int link=(vf->seekable?vf->current_link:0);
866 long ret;
867 if(vf->ready_state<OPENED)return(OV_EINVAL);
868 if(vf->samptrack==0)return(OV_FALSE);
869 ret=vf->bittrack/vf->samptrack*vf->vi[link].rate;
870 vf->bittrack=0;
871 vf->samptrack=0;
872 return(ret);
873}
874
875/* Guess */
876long ov_serialnumber(OggVorbis_File *vf,int i){
877 if(i>=vf->links)return(ov_serialnumber(vf,vf->links-1));
878 if(!vf->seekable && i>=0)return(ov_serialnumber(vf,-1));
879 if(i<0){
880 return(vf->current_serialno);
881 }else{
882 return(vf->serialnos[i]);
883 }
884}
885
886/* returns: total raw (compressed) length of content if i==-1
887 raw (compressed) length of that logical bitstream for i==0 to n
888 OV_EINVAL if the stream is not seekable (we can't know the length)
889 or if stream is only partially open
890*/
891ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i){
892 if(vf->ready_state<OPENED)return(OV_EINVAL);
893 if(!vf->seekable || i>=vf->links)return(OV_EINVAL);
894 if(i<0){
895 ogg_int64_t acc=0;
896 int i;
897 for(i=0;i<vf->links;i++)
898 acc+=ov_raw_total(vf,i);
899 return(acc);
900 }else{
901 return(vf->offsets[i+1]-vf->offsets[i]);
902 }
903}
904
905/* returns: total PCM length (samples) of content if i==-1 PCM length
906 (samples) of that logical bitstream for i==0 to n
907 OV_EINVAL if the stream is not seekable (we can't know the
908 length) or only partially open
909*/
910ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i){
911 if(vf->ready_state<OPENED)return(OV_EINVAL);
912 if(!vf->seekable || i>=vf->links)return(OV_EINVAL);
913 if(i<0){
914 ogg_int64_t acc=0;
915 int i;
916 for(i=0;i<vf->links;i++)
917 acc+=ov_pcm_total(vf,i);
918 return(acc);
919 }else{
920 return(vf->pcmlengths[i*2+1]);
921 }
922}
923
924/* returns: total milliseconds of content if i==-1
925 milliseconds in that logical bitstream for i==0 to n
926 OV_EINVAL if the stream is not seekable (we can't know the
927 length) or only partially open
928*/
929ogg_int64_t ov_time_total(OggVorbis_File *vf,int i){
930 if(vf->ready_state<OPENED)return(OV_EINVAL);
931 if(!vf->seekable || i>=vf->links)return(OV_EINVAL);
932 if(i<0){
933 ogg_int64_t acc=0;
934 int i;
935 for(i=0;i<vf->links;i++)
936 acc+=ov_time_total(vf,i);
937 return(acc);
938 }else{
939 return(((ogg_int64_t)vf->pcmlengths[i*2+1])*1000/vf->vi[i].rate);
940 }
941}
942
943/* seek to an offset relative to the *compressed* data. This also
944 scans packets to update the PCM cursor. It will cross a logical
945 bitstream boundary, but only if it can't get any packets out of the
946 tail of the bitstream we seek to (so no surprises).
947
948 returns zero on success, nonzero on failure */
949
950int ov_raw_seek(OggVorbis_File *vf,ogg_int64_t pos){
951 ogg_stream_state *work_os=NULL;
952 ogg_page og={0,0,0,0};
953 ogg_packet op={0,0,0,0,0,0};
954
955 if(vf->ready_state<OPENED)return(OV_EINVAL);
956 if(!vf->seekable)
957 return(OV_ENOSEEK); /* don't dump machine if we can't seek */
958
959 if(pos<0 || pos>vf->end)return(OV_EINVAL);
960
961 /* don't yet clear out decoding machine (if it's initialized), in
962 the case we're in the same link. Restart the decode lapping, and
963 let _fetch_and_process_packet deal with a potential bitstream
964 boundary */
965 vf->pcm_offset=-1;
966 ogg_stream_reset_serialno(vf->os,
967 vf->current_serialno); /* must set serialno */
968 vorbis_synthesis_restart(&vf->vd);
969
970 _seek_helper(vf,pos);
971
972 /* we need to make sure the pcm_offset is set, but we don't want to
973 advance the raw cursor past good packets just to get to the first
974 with a granulepos. That's not equivalent behavior to beginning
975 decoding as immediately after the seek position as possible.
976
977 So, a hack. We use two stream states; a local scratch state and
978 the shared vf->os stream state. We use the local state to
979 scan, and the shared state as a buffer for later decode.
980
981 Unfortuantely, on the last page we still advance to last packet
982 because the granulepos on the last page is not necessarily on a
983 packet boundary, and we need to make sure the granpos is
984 correct.
985 */
986
987 {
988 int lastblock=0;
989 int accblock=0;
990 int thisblock;
991 int eosflag;
992
993 work_os=ogg_stream_create(vf->current_serialno); /* get the memory ready */
994 while(1){
995 if(vf->ready_state>=STREAMSET){
996 /* snarf/scan a packet if we can */
997 int result=ogg_stream_packetout(work_os,&op);
998
999 if(result>0){
1000
1001 if(vf->vi[vf->current_link].codec_setup){
1002 thisblock=vorbis_packet_blocksize(vf->vi+vf->current_link,&op);
1003 if(thisblock<0){
1004 ogg_stream_packetout(vf->os,NULL);
1005 thisblock=0;
1006 }else{
1007
1008 if(eosflag)
1009 ogg_stream_packetout(vf->os,NULL);
1010 else
1011 if(lastblock)accblock+=(lastblock+thisblock)>>2;
1012 }
1013
1014 if(op.granulepos!=-1){
1015 int i,link=vf->current_link;
1016 ogg_int64_t granulepos=op.granulepos-vf->pcmlengths[link*2];
1017 if(granulepos<0)granulepos=0;
1018
1019 for(i=0;i<link;i++)
1020 granulepos+=vf->pcmlengths[i*2+1];
1021 vf->pcm_offset=granulepos-accblock;
1022 break;
1023 }
1024 lastblock=thisblock;
1025 continue;
1026 }else
1027 ogg_stream_packetout(vf->os,NULL);
1028 }
1029 }
1030
1031 if(!lastblock){
1032 if(_get_next_page(vf,&og,-1)<0){
1033 vf->pcm_offset=ov_pcm_total(vf,-1);
1034 break;
1035 }
1036 }else{
1037 /* huh? Bogus stream with packets but no granulepos */
1038 vf->pcm_offset=-1;
1039 break;
1040 }
1041
1042 /* has our decoding just traversed a bitstream boundary? */
1043 if(vf->ready_state>=STREAMSET)
1044 if(vf->current_serialno!=ogg_page_serialno(&og)){
1045 _decode_clear(vf); /* clear out stream state */
1046 ogg_stream_destroy(work_os);
1047 }
1048
1049 if(vf->ready_state<STREAMSET){
1050 int link;
1051
1052 vf->current_serialno=ogg_page_serialno(&og);
1053 for(link=0;link<vf->links;link++)
1054 if(vf->serialnos[link]==vf->current_serialno)break;
1055 if(link==vf->links)
1056 goto seek_error; /* sign of a bogus stream. error out,
1057 leave machine uninitialized */
1058
1059 vf->current_link=link;
1060
1061 ogg_stream_reset_serialno(vf->os,vf->current_serialno);
1062 ogg_stream_reset_serialno(work_os,vf->current_serialno);
1063 vf->ready_state=STREAMSET;
1064
1065 }
1066
1067 {
1068 ogg_page dup;
1069 ogg_page_dup(&dup,&og);
1070 eosflag=ogg_page_eos(&og);
1071 ogg_stream_pagein(vf->os,&og);
1072 ogg_stream_pagein(work_os,&dup);
1073 }
1074 }
1075 }
1076
1077 ogg_packet_release(&op);
1078 ogg_page_release(&og);
1079 ogg_stream_destroy(work_os);
1080 vf->bittrack=0;
1081 vf->samptrack=0;
1082 return(0);
1083
1084 seek_error:
1085 ogg_packet_release(&op);
1086 ogg_page_release(&og);
1087
1088 /* dump the machine so we're in a known state */
1089 vf->pcm_offset=-1;
1090 ogg_stream_destroy(work_os);
1091 _decode_clear(vf);
1092 return OV_EBADLINK;
1093}
1094
1095/* Page granularity seek (faster than sample granularity because we
1096 don't do the last bit of decode to find a specific sample).
1097
1098 Seek to the last [granule marked] page preceeding the specified pos
1099 location, such that decoding past the returned point will quickly
1100 arrive at the requested position. */
1101int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos){
1102 int link=-1;
1103 ogg_int64_t result=0;
1104 ogg_int64_t total=ov_pcm_total(vf,-1);
1105 ogg_page og={0,0,0,0};
1106 ogg_packet op={0,0,0,0,0,0};
1107
1108 if(vf->ready_state<OPENED)return(OV_EINVAL);
1109 if(!vf->seekable)return(OV_ENOSEEK);
1110 if(pos<0 || pos>total)return(OV_EINVAL);
1111
1112 /* which bitstream section does this pcm offset occur in? */
1113 for(link=vf->links-1;link>=0;link--){
1114 total-=vf->pcmlengths[link*2+1];
1115 if(pos>=total)break;
1116 }
1117
1118 /* search within the logical bitstream for the page with the highest
1119 pcm_pos preceeding (or equal to) pos. There is a danger here;
1120 missing pages or incorrect frame number information in the
1121 bitstream could make our task impossible. Account for that (it
1122 would be an error condition) */
1123
1124 /* new search algorithm by HB (Nicholas Vinen) */
1125 {
1126 ogg_int64_t end=vf->offsets[link+1];
1127 ogg_int64_t begin=vf->offsets[link];
1128 ogg_int64_t begintime = vf->pcmlengths[link*2];
1129 ogg_int64_t endtime = vf->pcmlengths[link*2+1]+begintime;
1130 ogg_int64_t target=pos-total+begintime;
1131 ogg_int64_t best=begin;
1132
1133 while(begin<end){
1134 ogg_int64_t bisect;
1135
1136 if(end-begin<CHUNKSIZE){
1137 bisect=begin;
1138 }else{
1139 /* take a (pretty decent) guess. */
1140 bisect=begin +
1141 (target-begintime)*(end-begin)/(endtime-begintime) - CHUNKSIZE;
1142 if(bisect<=begin)
1143 bisect=begin+1;
1144 }
1145
1146 _seek_helper(vf,bisect);
1147
1148 while(begin<end){
1149 result=_get_next_page(vf,&og,end-vf->offset);
1150 if(result==OV_EREAD) goto seek_error;
1151 if(result<0){
1152 if(bisect<=begin+1)
1153 end=begin; /* found it */
1154 else{
1155 if(bisect==0) goto seek_error;
1156 bisect-=CHUNKSIZE;
1157 if(bisect<=begin)bisect=begin+1;
1158 _seek_helper(vf,bisect);
1159 }
1160 }else{
1161 ogg_int64_t granulepos=ogg_page_granulepos(&og);
1162 if(granulepos==-1)continue;
1163 if(granulepos<target){
1164 best=result; /* raw offset of packet with granulepos */
1165 begin=vf->offset; /* raw offset of next page */
1166 begintime=granulepos;
1167
1168 if(target-begintime>44100)break;
1169 bisect=begin; /* *not* begin + 1 */
1170 }else{
1171 if(bisect<=begin+1)
1172 end=begin; /* found it */
1173 else{
1174 if(end==vf->offset){ /* we're pretty close - we'd be stuck in */
1175 end=result;
1176 bisect-=CHUNKSIZE; /* an endless loop otherwise. */
1177 if(bisect<=begin)bisect=begin+1;
1178 _seek_helper(vf,bisect);
1179 }else{
1180 end=result;
1181 endtime=granulepos;
1182 break;
1183 }
1184 }
1185 }
1186 }
1187 }
1188 }
1189
1190 /* found our page. seek to it, update pcm offset. Easier case than
1191 raw_seek, don't keep packets preceeding granulepos. */
1192 {
1193
1194 /* seek */
1195 _seek_helper(vf,best);
1196 vf->pcm_offset=-1;
1197
1198 if(_get_next_page(vf,&og,-1)<0){
1199 ogg_page_release(&og);
1200 return(OV_EOF); /* shouldn't happen */
1201 }
1202
1203 if(link!=vf->current_link){
1204 /* Different link; dump entire decode machine */
1205 _decode_clear(vf);
1206
1207 vf->current_link=link;
1208 vf->current_serialno=ogg_page_serialno(&og);
1209 vf->ready_state=STREAMSET;
1210
1211 }else{
1212 vorbis_synthesis_restart(&vf->vd);
1213 }
1214
1215 ogg_stream_reset_serialno(vf->os,vf->current_serialno);
1216 ogg_stream_pagein(vf->os,&og);
1217
1218 /* pull out all but last packet; the one with granulepos */
1219 while(1){
1220 result=ogg_stream_packetpeek(vf->os,&op);
1221 if(result==0){
1222 /* !!! the packet finishing this page originated on a
1223 preceeding page. Keep fetching previous pages until we
1224 get one with a granulepos or without the 'continued' flag
1225 set. Then just use raw_seek for simplicity. */
1226
1227 _seek_helper(vf,best);
1228
1229 while(1){
1230 result=_get_prev_page(vf,&og);
1231 if(result<0) goto seek_error;
1232 if(ogg_page_granulepos(&og)>-1 ||
1233 !ogg_page_continued(&og)){
1234 return ov_raw_seek(vf,result);
1235 }
1236 vf->offset=result;
1237 }
1238 }
1239 if(result<0){
1240 result = OV_EBADPACKET;
1241 goto seek_error;
1242 }
1243 if(op.granulepos!=-1){
1244 vf->pcm_offset=op.granulepos-vf->pcmlengths[vf->current_link*2];
1245 if(vf->pcm_offset<0)vf->pcm_offset=0;
1246 vf->pcm_offset+=total;
1247 break;
1248 }else
1249 result=ogg_stream_packetout(vf->os,NULL);
1250 }
1251 }
1252 }
1253
1254 /* verify result */
1255 if(vf->pcm_offset>pos || pos>ov_pcm_total(vf,-1)){
1256 result=OV_EFAULT;
1257 goto seek_error;
1258 }
1259 vf->bittrack=0;
1260 vf->samptrack=0;
1261
1262 ogg_page_release(&og);
1263 ogg_packet_release(&op);
1264 return(0);
1265
1266 seek_error:
1267
1268 ogg_page_release(&og);
1269 ogg_packet_release(&op);
1270
1271 /* dump machine so we're in a known state */
1272 vf->pcm_offset=-1;
1273 _decode_clear(vf);
1274 return (int)result;
1275}
1276
1277/* seek to a sample offset relative to the decompressed pcm stream
1278 returns zero on success, nonzero on failure */
1279
1280int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos){
1281 ogg_packet op={0,0,0,0,0,0};
1282 ogg_page og={0,0,0,0};
1283 int thisblock,lastblock=0;
1284 int ret=ov_pcm_seek_page(vf,pos);
1285 if(ret<0)return(ret);
1286 _make_decode_ready(vf);
1287
1288 /* discard leading packets we don't need for the lapping of the
1289 position we want; don't decode them */
1290
1291 while(1){
1292
1293 int ret=ogg_stream_packetpeek(vf->os,&op);
1294 if(ret>0){
1295 thisblock=vorbis_packet_blocksize(vf->vi+vf->current_link,&op);
1296 if(thisblock<0){
1297 ogg_stream_packetout(vf->os,NULL);
1298 continue; /* non audio packet */
1299 }
1300 if(lastblock)vf->pcm_offset+=(lastblock+thisblock)>>2;
1301
1302 if(vf->pcm_offset+((thisblock+
1303 vorbis_info_blocksize(vf->vi,1))>>2)>=pos)break;
1304
1305 /* remove the packet from packet queue and track its granulepos */
1306 ogg_stream_packetout(vf->os,NULL);
1307 vorbis_synthesis(&vf->vb,&op,0); /* set up a vb with
1308 only tracking, no
1309 pcm_decode */
1310 vorbis_synthesis_blockin(&vf->vd,&vf->vb);
1311
1312 /* end of logical stream case is hard, especially with exact
1313 length positioning. */
1314
1315 if(op.granulepos>-1){
1316 int i;
1317 /* always believe the stream markers */
1318 vf->pcm_offset=op.granulepos-vf->pcmlengths[vf->current_link*2];
1319 if(vf->pcm_offset<0)vf->pcm_offset=0;
1320 for(i=0;i<vf->current_link;i++)
1321 vf->pcm_offset+=vf->pcmlengths[i*2+1];
1322 }
1323
1324 lastblock=thisblock;
1325
1326 }else{
1327 if(ret<0 && ret!=OV_HOLE)break;
1328
1329 /* suck in a new page */
1330 if(_get_next_page(vf,&og,-1)<0)break;
1331 if(vf->current_serialno!=ogg_page_serialno(&og))_decode_clear(vf);
1332
1333 if(vf->ready_state<STREAMSET){
1334 int link;
1335
1336 vf->current_serialno=ogg_page_serialno(&og);
1337 for(link=0;link<vf->links;link++)
1338 if(vf->serialnos[link]==vf->current_serialno)break;
1339 if(link==vf->links){
1340 ogg_page_release(&og);
1341 ogg_packet_release(&op);
1342 return(OV_EBADLINK);
1343 }
1344 vf->current_link=link;
1345
1346 ogg_stream_reset_serialno(vf->os,vf->current_serialno);
1347 vf->ready_state=STREAMSET;
1348 _make_decode_ready(vf);
1349 lastblock=0;
1350 }
1351
1352 ogg_stream_pagein(vf->os,&og);
1353 }
1354 }
1355
1356 vf->bittrack=0;
1357 vf->samptrack=0;
1358 /* discard samples until we reach the desired position. Crossing a
1359 logical bitstream boundary with abandon is OK. */
1360 while(vf->pcm_offset<pos){
1361 ogg_int64_t target=pos-vf->pcm_offset;
1362 long samples=vorbis_synthesis_pcmout(&vf->vd,NULL);
1363
1364 if(samples>target)samples=target;
1365 vorbis_synthesis_read(&vf->vd,samples);
1366 vf->pcm_offset+=samples;
1367
1368 if(samples<target)
1369 if(_fetch_and_process_packet(vf,1,1)<=0)
1370 vf->pcm_offset=ov_pcm_total(vf,-1); /* eof */
1371 }
1372
1373 ogg_page_release(&og);
1374 ogg_packet_release(&op);
1375 return 0;
1376}
1377
1378/* seek to a playback time relative to the decompressed pcm stream
1379 returns zero on success, nonzero on failure */
1380int ov_time_seek(OggVorbis_File *vf,ogg_int64_t milliseconds){
1381 /* translate time to PCM position and call ov_pcm_seek */
1382
1383 int link=-1;
1384 ogg_int64_t pcm_total=ov_pcm_total(vf,-1);
1385 ogg_int64_t time_total=ov_time_total(vf,-1);
1386
1387 if(vf->ready_state<OPENED)return(OV_EINVAL);
1388 if(!vf->seekable)return(OV_ENOSEEK);
1389 if(milliseconds<0 || milliseconds>time_total)return(OV_EINVAL);
1390
1391 /* which bitstream section does this time offset occur in? */
1392 for(link=vf->links-1;link>=0;link--){
1393 pcm_total-=vf->pcmlengths[link*2+1];
1394 time_total-=ov_time_total(vf,link);
1395 if(milliseconds>=time_total)break;
1396 }
1397
1398 /* enough information to convert time offset to pcm offset */
1399 {
1400 ogg_int64_t target=pcm_total+(milliseconds-time_total)*vf->vi[link].rate/1000;
1401 return(ov_pcm_seek(vf,target));
1402 }
1403}
1404
1405/* page-granularity version of ov_time_seek
1406 returns zero on success, nonzero on failure */
1407int ov_time_seek_page(OggVorbis_File *vf,ogg_int64_t milliseconds){
1408 /* translate time to PCM position and call ov_pcm_seek */
1409
1410 int link=-1;
1411 ogg_int64_t pcm_total=ov_pcm_total(vf,-1);
1412 ogg_int64_t time_total=ov_time_total(vf,-1);
1413
1414 if(vf->ready_state<OPENED)return(OV_EINVAL);
1415 if(!vf->seekable)return(OV_ENOSEEK);
1416 if(milliseconds<0 || milliseconds>time_total)return(OV_EINVAL);
1417
1418 /* which bitstream section does this time offset occur in? */
1419 for(link=vf->links-1;link>=0;link--){
1420 pcm_total-=vf->pcmlengths[link*2+1];
1421 time_total-=ov_time_total(vf,link);
1422 if(milliseconds>=time_total)break;
1423 }
1424
1425 /* enough information to convert time offset to pcm offset */
1426 {
1427 ogg_int64_t target=pcm_total+(milliseconds-time_total)*vf->vi[link].rate/1000;
1428 return(ov_pcm_seek_page(vf,target));
1429 }
1430}
1431
1432/* tell the current stream offset cursor. Note that seek followed by
1433 tell will likely not give the set offset due to caching */
1434ogg_int64_t ov_raw_tell(OggVorbis_File *vf){
1435 if(vf->ready_state<OPENED)return(OV_EINVAL);
1436 return(vf->offset);
1437}
1438
1439/* return PCM offset (sample) of next PCM sample to be read */
1440ogg_int64_t ov_pcm_tell(OggVorbis_File *vf){
1441 if(vf->ready_state<OPENED)return(OV_EINVAL);
1442 return(vf->pcm_offset);
1443}
1444
1445/* return time offset (milliseconds) of next PCM sample to be read */
1446ogg_int64_t ov_time_tell(OggVorbis_File *vf){
1447 int link=0;
1448 ogg_int64_t pcm_total=0;
1449 ogg_int64_t time_total=0;
1450
1451 if(vf->ready_state<OPENED)return(OV_EINVAL);
1452 if(vf->seekable){
1453 pcm_total=ov_pcm_total(vf,-1);
1454 time_total=ov_time_total(vf,-1);
1455
1456 /* which bitstream section does this time offset occur in? */
1457 for(link=vf->links-1;link>=0;link--){
1458 pcm_total-=vf->pcmlengths[link*2+1];
1459 time_total-=ov_time_total(vf,link);
1460 if(vf->pcm_offset>=pcm_total)break;
1461 }
1462 }
1463
1464 return(time_total+(1000*vf->pcm_offset-pcm_total)/vf->vi[link].rate);
1465}
1466
1467/* link: -1) return the vorbis_info struct for the bitstream section
1468 currently being decoded
1469 0-n) to request information for a specific bitstream section
1470
1471 In the case of a non-seekable bitstream, any call returns the
1472 current bitstream. NULL in the case that the machine is not
1473 initialized */
1474
1475vorbis_info *ov_info(OggVorbis_File *vf,int link){
1476 if(vf->seekable){
1477 if(link<0)
1478 if(vf->ready_state>=STREAMSET)
1479 return vf->vi+vf->current_link;
1480 else
1481 return vf->vi;
1482 else
1483 if(link>=vf->links)
1484 return NULL;
1485 else
1486 return vf->vi+link;
1487 }else{
1488 return vf->vi;
1489 }
1490}
1491
1492/* grr, strong typing, grr, no templates/inheritence, grr */
1493vorbis_comment *ov_comment(OggVorbis_File *vf,int link){
1494 if(vf->seekable){
1495 if(link<0)
1496 if(vf->ready_state>=STREAMSET)
1497 return vf->vc+vf->current_link;
1498 else
1499 return vf->vc;
1500 else
1501 if(link>=vf->links)
1502 return NULL;
1503 else
1504 return vf->vc+link;
1505 }else{
1506 return vf->vc;
1507 }
1508}
1509
1510/* up to this point, everything could more or less hide the multiple
1511 logical bitstream nature of chaining from the toplevel application
1512 if the toplevel application didn't particularly care. However, at
1513 the point that we actually read audio back, the multiple-section
1514 nature must surface: Multiple bitstream sections do not necessarily
1515 have to have the same number of channels or sampling rate.
1516
1517 ov_read returns the sequential logical bitstream number currently
1518 being decoded along with the PCM data in order that the toplevel
1519 application can take action on channel/sample rate changes. This
1520 number will be incremented even for streamed (non-seekable) streams
1521 (for seekable streams, it represents the actual logical bitstream
1522 index within the physical bitstream. Note that the accessor
1523 functions above are aware of this dichotomy).
1524
1525 input values: buffer) a buffer to hold packed PCM data for return
1526 length) the byte length requested to be placed into buffer
1527
1528 return values: <0) error/hole in data (OV_HOLE), partial open (OV_EINVAL)
1529 0) EOF
1530 n) number of bytes of PCM actually returned. The
1531 below works on a packet-by-packet basis, so the
1532 return length is not related to the 'length' passed
1533 in, just guaranteed to fit.
1534
1535 *section) set to the logical bitstream number */
1536
1537long ov_read(OggVorbis_File *vf,char *buffer,int bytes_req,int *bitstream){
1538 int i,j;
1539
1540 ogg_int32_t **pcm;
1541 long samples;
1542
1543 if(vf->ready_state<OPENED)return(OV_EINVAL);
1544
1545 while(1){
1546 if(vf->ready_state==INITSET){
1547 samples=vorbis_synthesis_pcmout(&vf->vd,&pcm);
1548 if(samples)break;
1549 }
1550
1551 /* suck in another packet */
1552 {
1553 int ret=_fetch_and_process_packet(vf,1,1);
1554 if(ret==OV_EOF)
1555 return(0);
1556 if(ret<=0)
1557 return(ret);
1558 }
1559
1560 }
1561
1562 if(samples>0){
1563
1564 /* yay! proceed to pack data into the byte buffer */
1565
1566 long channels=ov_info(vf,-1)->channels;
1567
1568 if(channels==1){
1569 if(samples>(bytes_req/2))
1570 samples=bytes_req/2;
1571 }else{
1572 if(samples>(bytes_req/4))
1573 samples=bytes_req/4;
1574 }
1575
1576 for(i=0;i<channels;i++) { /* It's faster in this order */
1577 ogg_int32_t *src=pcm[i];
1578 short *dest=((short *)buffer)+i;
1579 for(j=0;j<samples;j++) {
1580 *dest=CLIP_TO_15(src[j]>>9);
1581 dest+=channels;
1582 }
1583 }
1584
1585 vorbis_synthesis_read(&vf->vd,samples);
1586 vf->pcm_offset+=samples;
1587 if(bitstream)*bitstream=vf->current_link;
1588 return(samples*2*channels);
1589 }else{
1590 return(samples);
1591 }
1592}
diff --git a/apps/codecs/Tremor/window.c b/apps/codecs/Tremor/window.c
new file mode 100644
index 0000000000..4d6e79e81d
--- /dev/null
+++ b/apps/codecs/Tremor/window.c
@@ -0,0 +1,84 @@
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 <stdlib.h>
19#include <math.h>
20#include "os.h"
21#include "misc.h"
22#include "window.h"
23#include "window_lookup.h"
24
25const void *_vorbis_window(int type, int left){
26
27 switch(type){
28 case 0:
29
30 switch(left){
31 case 32:
32 return vwin64;
33 case 64:
34 return vwin128;
35 case 128:
36 return vwin256;
37 case 256:
38 return vwin512;
39 case 512:
40 return vwin1024;
41 case 1024:
42 return vwin2048;
43 case 2048:
44 return vwin4096;
45 case 4096:
46 return vwin8192;
47 default:
48 return(0);
49 }
50 break;
51 default:
52 return(0);
53 }
54}
55
56void _vorbis_apply_window(ogg_int32_t *d,const void *window_p[2],
57 long *blocksizes,
58 int lW,int W,int nW){
59
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 int i,p;
72
73 for(i=0;i<leftbegin;i++)
74 d[i]=0;
75
76 for(p=0;i<leftend;i++,p++)
77 d[i]=MULT31(d[i],window[lW][p]);
78
79 for(i=rightbegin,p=rn/2-1;i<rightend;i++,p--)
80 d[i]=MULT31(d[i],window[nW][p]);
81
82 for(;i<n;i++)
83 d[i]=0;
84}
diff --git a/apps/codecs/Tremor/window.h b/apps/codecs/Tremor/window.h
new file mode 100644
index 0000000000..27647fe62e
--- /dev/null
+++ b/apps/codecs/Tremor/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/Tremor/window_lookup.h b/apps/codecs/Tremor/window_lookup.h
new file mode 100644
index 0000000000..b24fc37772
--- /dev/null
+++ b/apps/codecs/Tremor/window_lookup.h
@@ -0,0 +1,2084 @@
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
21static LOOKUP_T vwin64[32] = {
22 X(0x001f0003), X(0x01168c98), X(0x030333c8), X(0x05dfe3a4),
23 X(0x09a49562), X(0x0e45df18), X(0x13b47ef2), X(0x19dcf676),
24 X(0x20a74d83), X(0x27f7137c), X(0x2fabb05a), X(0x37a1105a),
25 X(0x3fb0ab28), X(0x47b2dcd1), X(0x4f807bc6), X(0x56f48e70),
26 X(0x5dedfc79), X(0x64511653), X(0x6a08cfff), X(0x6f079328),
27 X(0x734796f4), X(0x76cab7f2), X(0x7999d6e8), X(0x7bc3cf9f),
28 X(0x7d5c20c1), X(0x7e7961df), X(0x7f33a567), X(0x7fa2e1d0),
29 X(0x7fdd78a5), X(0x7ff6ec6d), X(0x7ffed0e9), X(0x7ffffc3f),
30};
31
32static LOOKUP_T vwin128[64] = {
33 X(0x0007c04d), X(0x0045bb89), X(0x00c18b87), X(0x017ae294),
34 X(0x02714a4e), X(0x03a4217a), X(0x05129952), X(0x06bbb24f),
35 X(0x089e38a1), X(0x0ab8c073), X(0x0d09a228), X(0x0f8ef6bd),
36 X(0x12469488), X(0x152e0c7a), X(0x1842a81c), X(0x1b81686d),
37 X(0x1ee705d9), X(0x226ff15d), X(0x26185705), X(0x29dc21cc),
38 X(0x2db700fe), X(0x31a46f08), X(0x359fb9c1), X(0x39a40c0c),
39 X(0x3dac78b6), X(0x41b40674), X(0x45b5bcb0), X(0x49acb109),
40 X(0x4d94152b), X(0x516744bd), X(0x5521d320), X(0x58bf98a5),
41 X(0x5c3cbef4), X(0x5f95cc5d), X(0x62c7add7), X(0x65cfbf64),
42 X(0x68abd2ba), X(0x6b5a3405), X(0x6dd9acab), X(0x7029840d),
43 X(0x72497e38), X(0x7439d8ac), X(0x75fb4532), X(0x778ee30a),
44 X(0x78f6367e), X(0x7a331f1a), X(0x7b47cccd), X(0x7c36b416),
45 X(0x7d028192), X(0x7dae0d18), X(0x7e3c4caa), X(0x7eb04763),
46 X(0x7f0d08a7), X(0x7f5593b7), X(0x7f8cd7d5), X(0x7fb5a513),
47 X(0x7fd2a1fc), X(0x7fe64212), X(0x7ff2bd4c), X(0x7ffa0890),
48 X(0x7ffdcf39), X(0x7fff6dac), X(0x7fffed01), X(0x7fffffc4),
49};
50
51static LOOKUP_T vwin256[128] = {
52 X(0x0001f018), X(0x00117066), X(0x00306e9e), X(0x005ee5f1),
53 X(0x009ccf26), X(0x00ea208b), X(0x0146cdea), X(0x01b2c87f),
54 X(0x022dfedf), X(0x02b85ced), X(0x0351cbbd), X(0x03fa317f),
55 X(0x04b17167), X(0x05776b90), X(0x064bfcdc), X(0x072efedd),
56 X(0x082047b4), X(0x091fa9f1), X(0x0a2cf477), X(0x0b47f25d),
57 X(0x0c706ad2), X(0x0da620ff), X(0x0ee8d3ef), X(0x10383e75),
58 X(0x11941716), X(0x12fc0ff6), X(0x146fd6c8), X(0x15ef14c2),
59 X(0x17796e8e), X(0x190e844f), X(0x1aadf196), X(0x1c574d6e),
60 X(0x1e0a2a62), X(0x1fc61688), X(0x218a9b9c), X(0x23573f12),
61 X(0x252b823d), X(0x2706e269), X(0x28e8d913), X(0x2ad0dc0e),
62 X(0x2cbe5dc1), X(0x2eb0cd60), X(0x30a79733), X(0x32a224d5),
63 X(0x349fdd8b), X(0x36a02690), X(0x38a2636f), X(0x3aa5f65e),
64 X(0x3caa409e), X(0x3eaea2df), X(0x40b27da6), X(0x42b531b8),
65 X(0x44b62086), X(0x46b4ac99), X(0x48b03a05), X(0x4aa82ed5),
66 X(0x4c9bf37d), X(0x4e8af349), X(0x50749ccb), X(0x52586246),
67 X(0x5435ba1c), X(0x560c1f31), X(0x57db1152), X(0x59a21591),
68 X(0x5b60b6a3), X(0x5d168535), X(0x5ec31839), X(0x60660d36),
69 X(0x61ff0886), X(0x638db595), X(0x6511c717), X(0x668af734),
70 X(0x67f907b0), X(0x695bc207), X(0x6ab2f787), X(0x6bfe815a),
71 X(0x6d3e4090), X(0x6e721e16), X(0x6f9a0ab5), X(0x70b5fef8),
72 X(0x71c5fb16), X(0x72ca06cd), X(0x73c2313d), X(0x74ae90b2),
73 X(0x758f4275), X(0x76646a85), X(0x772e335c), X(0x77eccda0),
74 X(0x78a06fd7), X(0x79495613), X(0x79e7c19c), X(0x7a7bf894),
75 X(0x7b064596), X(0x7b86f757), X(0x7bfe6044), X(0x7c6cd615),
76 X(0x7cd2b16e), X(0x7d304d71), X(0x7d860756), X(0x7dd43e06),
77 X(0x7e1b51ad), X(0x7e5ba355), X(0x7e95947e), X(0x7ec986bb),
78 X(0x7ef7db4a), X(0x7f20f2b9), X(0x7f452c7f), X(0x7f64e6a7),
79 X(0x7f807d71), X(0x7f984aff), X(0x7faca700), X(0x7fbde662),
80 X(0x7fcc5b04), X(0x7fd85372), X(0x7fe21a99), X(0x7fe9f791),
81 X(0x7ff02d58), X(0x7ff4fa9e), X(0x7ff89990), X(0x7ffb3faa),
82 X(0x7ffd1d8b), X(0x7ffe5ecc), X(0x7fff29e0), X(0x7fff9ff3),
83 X(0x7fffdcd2), X(0x7ffff6d6), X(0x7ffffed0), X(0x7ffffffc),
84};
85
86static LOOKUP_T vwin512[256] = {
87 X(0x00007c06), X(0x00045c32), X(0x000c1c62), X(0x0017bc4c),
88 X(0x00273b7a), X(0x003a9955), X(0x0051d51c), X(0x006cede7),
89 X(0x008be2a9), X(0x00aeb22a), X(0x00d55b0d), X(0x00ffdbcc),
90 X(0x012e32b6), X(0x01605df5), X(0x01965b85), X(0x01d02939),
91 X(0x020dc4ba), X(0x024f2b83), X(0x02945ae6), X(0x02dd5004),
92 X(0x032a07d3), X(0x037a7f19), X(0x03ceb26e), X(0x04269e37),
93 X(0x04823eab), X(0x04e18fcc), X(0x05448d6d), X(0x05ab3329),
94 X(0x06157c68), X(0x0683645e), X(0x06f4e607), X(0x0769fc25),
95 X(0x07e2a146), X(0x085ecfbc), X(0x08de819f), X(0x0961b0cc),
96 X(0x09e856e3), X(0x0a726d46), X(0x0affed1d), X(0x0b90cf4c),
97 X(0x0c250c79), X(0x0cbc9d0b), X(0x0d577926), X(0x0df598aa),
98 X(0x0e96f337), X(0x0f3b8026), X(0x0fe3368f), X(0x108e0d42),
99 X(0x113bfaca), X(0x11ecf56b), X(0x12a0f324), X(0x1357e9ac),
100 X(0x1411ce70), X(0x14ce9698), X(0x158e3702), X(0x1650a444),
101 X(0x1715d2aa), X(0x17ddb638), X(0x18a842aa), X(0x19756b72),
102 X(0x1a4523b9), X(0x1b175e62), X(0x1bec0e04), X(0x1cc324f0),
103 X(0x1d9c9532), X(0x1e78508a), X(0x1f564876), X(0x20366e2e),
104 X(0x2118b2a2), X(0x21fd0681), X(0x22e35a37), X(0x23cb9dee),
105 X(0x24b5c18e), X(0x25a1b4c0), X(0x268f66f1), X(0x277ec74e),
106 X(0x286fc4cc), X(0x29624e23), X(0x2a5651d7), X(0x2b4bbe34),
107 X(0x2c428150), X(0x2d3a8913), X(0x2e33c332), X(0x2f2e1d35),
108 X(0x30298478), X(0x3125e62d), X(0x32232f61), X(0x33214cfc),
109 X(0x34202bc2), X(0x351fb85a), X(0x361fdf4f), X(0x37208d10),
110 X(0x3821adf7), X(0x39232e49), X(0x3a24fa3c), X(0x3b26fdf6),
111 X(0x3c292593), X(0x3d2b5d29), X(0x3e2d90c8), X(0x3f2fac7f),
112 X(0x40319c5f), X(0x41334c81), X(0x4234a905), X(0x43359e16),
113 X(0x443617f3), X(0x453602eb), X(0x46354b65), X(0x4733dde1),
114 X(0x4831a6ff), X(0x492e937f), X(0x4a2a9045), X(0x4b258a5f),
115 X(0x4c1f6f06), X(0x4d182ba2), X(0x4e0fadce), X(0x4f05e35b),
116 X(0x4ffaba53), X(0x50ee20fd), X(0x51e005e1), X(0x52d057ca),
117 X(0x53bf05ca), X(0x54abff3b), X(0x559733c7), X(0x56809365),
118 X(0x57680e62), X(0x584d955d), X(0x59311952), X(0x5a128b96),
119 X(0x5af1dddd), X(0x5bcf023a), X(0x5ca9eb27), X(0x5d828b81),
120 X(0x5e58d68d), X(0x5f2cbffc), X(0x5ffe3be9), X(0x60cd3edf),
121 X(0x6199bdda), X(0x6263ae45), X(0x632b0602), X(0x63efbb66),
122 X(0x64b1c53f), X(0x65711ad0), X(0x662db3d7), X(0x66e7888d),
123 X(0x679e91a5), X(0x6852c84e), X(0x69042635), X(0x69b2a582),
124 X(0x6a5e40dd), X(0x6b06f36c), X(0x6bacb8d2), X(0x6c4f8d30),
125 X(0x6cef6d26), X(0x6d8c55d4), X(0x6e2644d4), X(0x6ebd3840),
126 X(0x6f512ead), X(0x6fe2272e), X(0x7070214f), X(0x70fb1d17),
127 X(0x71831b06), X(0x72081c16), X(0x728a21b5), X(0x73092dc8),
128 X(0x738542a6), X(0x73fe631b), X(0x74749261), X(0x74e7d421),
129 X(0x75582c72), X(0x75c59fd5), X(0x76303333), X(0x7697ebdd),
130 X(0x76fccf85), X(0x775ee443), X(0x77be308a), X(0x781abb2e),
131 X(0x78748b59), X(0x78cba88e), X(0x79201aa7), X(0x7971e9cd),
132 X(0x79c11e79), X(0x7a0dc170), X(0x7a57dbc2), X(0x7a9f76c1),
133 X(0x7ae49c07), X(0x7b27556b), X(0x7b67ad02), X(0x7ba5ad1b),
134 X(0x7be1603a), X(0x7c1ad118), X(0x7c520a9e), X(0x7c8717e1),
135 X(0x7cba0421), X(0x7ceadac3), X(0x7d19a74f), X(0x7d46756e),
136 X(0x7d7150e5), X(0x7d9a4592), X(0x7dc15f69), X(0x7de6aa71),
137 X(0x7e0a32c0), X(0x7e2c0479), X(0x7e4c2bc7), X(0x7e6ab4db),
138 X(0x7e87abe9), X(0x7ea31d24), X(0x7ebd14be), X(0x7ed59edd),
139 X(0x7eecc7a3), X(0x7f029b21), X(0x7f17255a), X(0x7f2a723f),
140 X(0x7f3c8daa), X(0x7f4d835d), X(0x7f5d5f00), X(0x7f6c2c1b),
141 X(0x7f79f617), X(0x7f86c83a), X(0x7f92ada2), X(0x7f9db146),
142 X(0x7fa7ddf3), X(0x7fb13e46), X(0x7fb9dcb0), X(0x7fc1c36c),
143 X(0x7fc8fc83), X(0x7fcf91c7), X(0x7fd58cd2), X(0x7fdaf702),
144 X(0x7fdfd979), X(0x7fe43d1c), X(0x7fe82a8b), X(0x7febaa29),
145 X(0x7feec412), X(0x7ff1801c), X(0x7ff3e5d6), X(0x7ff5fc86),
146 X(0x7ff7cb29), X(0x7ff9586f), X(0x7ffaaaba), X(0x7ffbc81e),
147 X(0x7ffcb660), X(0x7ffd7af3), X(0x7ffe1afa), X(0x7ffe9b42),
148 X(0x7fff0047), X(0x7fff4e2f), X(0x7fff88c9), X(0x7fffb390),
149 X(0x7fffd1a6), X(0x7fffe5d7), X(0x7ffff296), X(0x7ffff9fd),
150 X(0x7ffffdcd), X(0x7fffff6d), X(0x7fffffed), X(0x7fffffff),
151};
152
153static LOOKUP_T vwin1024[512] = {
154 X(0x00001f02), X(0x0001170e), X(0x00030724), X(0x0005ef40),
155 X(0x0009cf59), X(0x000ea767), X(0x0014775e), X(0x001b3f2e),
156 X(0x0022fec8), X(0x002bb618), X(0x00356508), X(0x00400b81),
157 X(0x004ba968), X(0x00583ea0), X(0x0065cb0a), X(0x00744e84),
158 X(0x0083c8ea), X(0x00943a14), X(0x00a5a1da), X(0x00b80010),
159 X(0x00cb5488), X(0x00df9f10), X(0x00f4df76), X(0x010b1584),
160 X(0x01224101), X(0x013a61b2), X(0x01537759), X(0x016d81b6),
161 X(0x01888087), X(0x01a47385), X(0x01c15a69), X(0x01df34e6),
162 X(0x01fe02b1), X(0x021dc377), X(0x023e76e7), X(0x02601ca9),
163 X(0x0282b466), X(0x02a63dc1), X(0x02cab85d), X(0x02f023d6),
164 X(0x03167fcb), X(0x033dcbd3), X(0x03660783), X(0x038f3270),
165 X(0x03b94c29), X(0x03e4543a), X(0x04104a2e), X(0x043d2d8b),
166 X(0x046afdd5), X(0x0499ba8c), X(0x04c9632d), X(0x04f9f734),
167 X(0x052b7615), X(0x055ddf46), X(0x05913237), X(0x05c56e53),
168 X(0x05fa9306), X(0x06309fb6), X(0x066793c5), X(0x069f6e93),
169 X(0x06d82f7c), X(0x0711d5d9), X(0x074c60fe), X(0x0787d03d),
170 X(0x07c422e4), X(0x0801583e), X(0x083f6f91), X(0x087e681f),
171 X(0x08be4129), X(0x08fef9ea), X(0x0940919a), X(0x0983076d),
172 X(0x09c65a92), X(0x0a0a8a38), X(0x0a4f9585), X(0x0a957b9f),
173 X(0x0adc3ba7), X(0x0b23d4b9), X(0x0b6c45ee), X(0x0bb58e5a),
174 X(0x0bffad0f), X(0x0c4aa11a), X(0x0c966982), X(0x0ce3054d),
175 X(0x0d30737b), X(0x0d7eb308), X(0x0dcdc2eb), X(0x0e1da21a),
176 X(0x0e6e4f83), X(0x0ebfca11), X(0x0f1210ad), X(0x0f652238),
177 X(0x0fb8fd91), X(0x100da192), X(0x10630d11), X(0x10b93ee0),
178 X(0x111035cb), X(0x1167f09a), X(0x11c06e13), X(0x1219acf5),
179 X(0x1273abfb), X(0x12ce69db), X(0x1329e54a), X(0x13861cf3),
180 X(0x13e30f80), X(0x1440bb97), X(0x149f1fd8), X(0x14fe3ade),
181 X(0x155e0b40), X(0x15be8f92), X(0x161fc662), X(0x1681ae38),
182 X(0x16e4459b), X(0x17478b0b), X(0x17ab7d03), X(0x181019fb),
183 X(0x18756067), X(0x18db4eb3), X(0x1941e34a), X(0x19a91c92),
184 X(0x1a10f8ea), X(0x1a7976af), X(0x1ae29439), X(0x1b4c4fda),
185 X(0x1bb6a7e2), X(0x1c219a9a), X(0x1c8d2649), X(0x1cf9492e),
186 X(0x1d660188), X(0x1dd34d8e), X(0x1e412b74), X(0x1eaf996a),
187 X(0x1f1e959b), X(0x1f8e1e2f), X(0x1ffe3146), X(0x206ecd01),
188 X(0x20dfef78), X(0x215196c2), X(0x21c3c0f0), X(0x22366c10),
189 X(0x22a9962a), X(0x231d3d45), X(0x23915f60), X(0x2405fa7a),
190 X(0x247b0c8c), X(0x24f09389), X(0x25668d65), X(0x25dcf80c),
191 X(0x2653d167), X(0x26cb175e), X(0x2742c7d0), X(0x27bae09e),
192 X(0x28335fa2), X(0x28ac42b3), X(0x292587a5), X(0x299f2c48),
193 X(0x2a192e69), X(0x2a938bd1), X(0x2b0e4247), X(0x2b894f8d),
194 X(0x2c04b164), X(0x2c806588), X(0x2cfc69b2), X(0x2d78bb9a),
195 X(0x2df558f4), X(0x2e723f6f), X(0x2eef6cbb), X(0x2f6cde83),
196 X(0x2fea9270), X(0x30688627), X(0x30e6b74e), X(0x31652385),
197 X(0x31e3c86b), X(0x3262a39e), X(0x32e1b2b8), X(0x3360f352),
198 X(0x33e06303), X(0x345fff5e), X(0x34dfc5f8), X(0x355fb462),
199 X(0x35dfc82a), X(0x365ffee0), X(0x36e0560f), X(0x3760cb43),
200 X(0x37e15c05), X(0x386205df), X(0x38e2c657), X(0x39639af5),
201 X(0x39e4813e), X(0x3a6576b6), X(0x3ae678e3), X(0x3b678547),
202 X(0x3be89965), X(0x3c69b2c1), X(0x3ceacedc), X(0x3d6beb37),
203 X(0x3ded0557), X(0x3e6e1abb), X(0x3eef28e6), X(0x3f702d5a),
204 X(0x3ff1259a), X(0x40720f29), X(0x40f2e789), X(0x4173ac3f),
205 X(0x41f45ad0), X(0x4274f0c2), X(0x42f56b9a), X(0x4375c8e0),
206 X(0x43f6061d), X(0x447620db), X(0x44f616a5), X(0x4575e509),
207 X(0x45f58994), X(0x467501d6), X(0x46f44b62), X(0x477363cb),
208 X(0x47f248a6), X(0x4870f78e), X(0x48ef6e1a), X(0x496da9e8),
209 X(0x49eba897), X(0x4a6967c8), X(0x4ae6e521), X(0x4b641e47),
210 X(0x4be110e5), X(0x4c5dbaa7), X(0x4cda193f), X(0x4d562a5f),
211 X(0x4dd1ebbd), X(0x4e4d5b15), X(0x4ec87623), X(0x4f433aa9),
212 X(0x4fbda66c), X(0x5037b734), X(0x50b16acf), X(0x512abf0e),
213 X(0x51a3b1c5), X(0x521c40ce), X(0x52946a06), X(0x530c2b50),
214 X(0x53838292), X(0x53fa6db8), X(0x5470eab3), X(0x54e6f776),
215 X(0x555c91fc), X(0x55d1b844), X(0x56466851), X(0x56baa02f),
216 X(0x572e5deb), X(0x57a19f98), X(0x58146352), X(0x5886a737),
217 X(0x58f8696d), X(0x5969a81c), X(0x59da6177), X(0x5a4a93b4),
218 X(0x5aba3d0f), X(0x5b295bcb), X(0x5b97ee30), X(0x5c05f28d),
219 X(0x5c736738), X(0x5ce04a8d), X(0x5d4c9aed), X(0x5db856c1),
220 X(0x5e237c78), X(0x5e8e0a89), X(0x5ef7ff6f), X(0x5f6159b0),
221 X(0x5fca17d4), X(0x6032386e), X(0x6099ba15), X(0x61009b69),
222 X(0x6166db11), X(0x61cc77b9), X(0x62317017), X(0x6295c2e7),
223 X(0x62f96eec), X(0x635c72f1), X(0x63becdc8), X(0x64207e4b),
224 X(0x6481835a), X(0x64e1dbde), X(0x654186c8), X(0x65a0830e),
225 X(0x65fecfb1), X(0x665c6bb7), X(0x66b95630), X(0x67158e30),
226 X(0x677112d7), X(0x67cbe34b), X(0x6825feb9), X(0x687f6456),
227 X(0x68d81361), X(0x69300b1e), X(0x69874ada), X(0x69ddd1ea),
228 X(0x6a339fab), X(0x6a88b382), X(0x6add0cdb), X(0x6b30ab2a),
229 X(0x6b838dec), X(0x6bd5b4a6), X(0x6c271ee2), X(0x6c77cc36),
230 X(0x6cc7bc3d), X(0x6d16ee9b), X(0x6d6562fb), X(0x6db31911),
231 X(0x6e001099), X(0x6e4c4955), X(0x6e97c311), X(0x6ee27d9f),
232 X(0x6f2c78d9), X(0x6f75b4a2), X(0x6fbe30e4), X(0x7005ed91),
233 X(0x704ceaa1), X(0x70932816), X(0x70d8a5f8), X(0x711d6457),
234 X(0x7161634b), X(0x71a4a2f3), X(0x71e72375), X(0x7228e500),
235 X(0x7269e7c8), X(0x72aa2c0a), X(0x72e9b209), X(0x73287a12),
236 X(0x73668476), X(0x73a3d18f), X(0x73e061bc), X(0x741c3566),
237 X(0x74574cfa), X(0x7491a8ee), X(0x74cb49be), X(0x75042fec),
238 X(0x753c5c03), X(0x7573ce92), X(0x75aa882f), X(0x75e08979),
239 X(0x7615d313), X(0x764a65a7), X(0x767e41e5), X(0x76b16884),
240 X(0x76e3da40), X(0x771597dc), X(0x7746a221), X(0x7776f9dd),
241 X(0x77a69fe6), X(0x77d59514), X(0x7803da49), X(0x7831706a),
242 X(0x785e5861), X(0x788a9320), X(0x78b6219c), X(0x78e104cf),
243 X(0x790b3dbb), X(0x7934cd64), X(0x795db4d5), X(0x7985f51d),
244 X(0x79ad8f50), X(0x79d48486), X(0x79fad5de), X(0x7a208478),
245 X(0x7a45917b), X(0x7a69fe12), X(0x7a8dcb6c), X(0x7ab0fabb),
246 X(0x7ad38d36), X(0x7af5841a), X(0x7b16e0a3), X(0x7b37a416),
247 X(0x7b57cfb8), X(0x7b7764d4), X(0x7b9664b6), X(0x7bb4d0b0),
248 X(0x7bd2aa14), X(0x7beff23b), X(0x7c0caa7f), X(0x7c28d43c),
249 X(0x7c4470d2), X(0x7c5f81a5), X(0x7c7a081a), X(0x7c940598),
250 X(0x7cad7b8b), X(0x7cc66b5e), X(0x7cded680), X(0x7cf6be64),
251 X(0x7d0e247b), X(0x7d250a3c), X(0x7d3b711c), X(0x7d515a95),
252 X(0x7d66c822), X(0x7d7bbb3c), X(0x7d903563), X(0x7da43814),
253 X(0x7db7c4d0), X(0x7dcadd16), X(0x7ddd826a), X(0x7defb64d),
254 X(0x7e017a44), X(0x7e12cfd3), X(0x7e23b87f), X(0x7e3435cc),
255 X(0x7e444943), X(0x7e53f467), X(0x7e6338c0), X(0x7e7217d5),
256 X(0x7e80932b), X(0x7e8eac49), X(0x7e9c64b7), X(0x7ea9bdf8),
257 X(0x7eb6b994), X(0x7ec35910), X(0x7ecf9def), X(0x7edb89b6),
258 X(0x7ee71de9), X(0x7ef25c09), X(0x7efd4598), X(0x7f07dc16),
259 X(0x7f122103), X(0x7f1c15dc), X(0x7f25bc1f), X(0x7f2f1547),
260 X(0x7f3822cd), X(0x7f40e62b), X(0x7f4960d6), X(0x7f519443),
261 X(0x7f5981e7), X(0x7f612b31), X(0x7f689191), X(0x7f6fb674),
262 X(0x7f769b45), X(0x7f7d416c), X(0x7f83aa51), X(0x7f89d757),
263 X(0x7f8fc9df), X(0x7f958348), X(0x7f9b04ef), X(0x7fa0502e),
264 X(0x7fa56659), X(0x7faa48c7), X(0x7faef8c7), X(0x7fb377a7),
265 X(0x7fb7c6b3), X(0x7fbbe732), X(0x7fbfda67), X(0x7fc3a196),
266 X(0x7fc73dfa), X(0x7fcab0ce), X(0x7fcdfb4a), X(0x7fd11ea0),
267 X(0x7fd41c00), X(0x7fd6f496), X(0x7fd9a989), X(0x7fdc3bff),
268 X(0x7fdead17), X(0x7fe0fdee), X(0x7fe32f9d), X(0x7fe54337),
269 X(0x7fe739ce), X(0x7fe9146c), X(0x7fead41b), X(0x7fec79dd),
270 X(0x7fee06b2), X(0x7fef7b94), X(0x7ff0d97b), X(0x7ff22158),
271 X(0x7ff35417), X(0x7ff472a3), X(0x7ff57de0), X(0x7ff676ac),
272 X(0x7ff75de3), X(0x7ff8345a), X(0x7ff8fae4), X(0x7ff9b24b),
273 X(0x7ffa5b58), X(0x7ffaf6cd), X(0x7ffb8568), X(0x7ffc07e2),
274 X(0x7ffc7eed), X(0x7ffceb38), X(0x7ffd4d6d), X(0x7ffda631),
275 X(0x7ffdf621), X(0x7ffe3dd8), X(0x7ffe7dea), X(0x7ffeb6e7),
276 X(0x7ffee959), X(0x7fff15c4), X(0x7fff3ca9), X(0x7fff5e80),
277 X(0x7fff7bc0), X(0x7fff94d6), X(0x7fffaa2d), X(0x7fffbc29),
278 X(0x7fffcb29), X(0x7fffd786), X(0x7fffe195), X(0x7fffe9a3),
279 X(0x7fffeffa), X(0x7ffff4dd), X(0x7ffff889), X(0x7ffffb37),
280 X(0x7ffffd1a), X(0x7ffffe5d), X(0x7fffff29), X(0x7fffffa0),
281 X(0x7fffffdd), X(0x7ffffff7), X(0x7fffffff), X(0x7fffffff),
282};
283
284static LOOKUP_T vwin2048[1024] = {
285 X(0x000007c0), X(0x000045c4), X(0x0000c1ca), X(0x00017bd3),
286 X(0x000273de), X(0x0003a9eb), X(0x00051df9), X(0x0006d007),
287 X(0x0008c014), X(0x000aee1e), X(0x000d5a25), X(0x00100428),
288 X(0x0012ec23), X(0x00161216), X(0x001975fe), X(0x001d17da),
289 X(0x0020f7a8), X(0x00251564), X(0x0029710c), X(0x002e0a9e),
290 X(0x0032e217), X(0x0037f773), X(0x003d4ab0), X(0x0042dbca),
291 X(0x0048aabe), X(0x004eb788), X(0x00550224), X(0x005b8a8f),
292 X(0x006250c5), X(0x006954c1), X(0x0070967e), X(0x007815f9),
293 X(0x007fd32c), X(0x0087ce13), X(0x009006a9), X(0x00987ce9),
294 X(0x00a130cc), X(0x00aa224f), X(0x00b3516b), X(0x00bcbe1a),
295 X(0x00c66856), X(0x00d0501a), X(0x00da755f), X(0x00e4d81f),
296 X(0x00ef7853), X(0x00fa55f4), X(0x010570fc), X(0x0110c963),
297 X(0x011c5f22), X(0x01283232), X(0x0134428c), X(0x01409027),
298 X(0x014d1afb), X(0x0159e302), X(0x0166e831), X(0x01742a82),
299 X(0x0181a9ec), X(0x018f6665), X(0x019d5fe5), X(0x01ab9663),
300 X(0x01ba09d6), X(0x01c8ba34), X(0x01d7a775), X(0x01e6d18d),
301 X(0x01f63873), X(0x0205dc1e), X(0x0215bc82), X(0x0225d997),
302 X(0x02363350), X(0x0246c9a3), X(0x02579c86), X(0x0268abed),
303 X(0x0279f7cc), X(0x028b801a), X(0x029d44c9), X(0x02af45ce),
304 X(0x02c1831d), X(0x02d3fcaa), X(0x02e6b269), X(0x02f9a44c),
305 X(0x030cd248), X(0x03203c4f), X(0x0333e255), X(0x0347c44b),
306 X(0x035be225), X(0x03703bd5), X(0x0384d14d), X(0x0399a280),
307 X(0x03aeaf5e), X(0x03c3f7d9), X(0x03d97be4), X(0x03ef3b6e),
308 X(0x0405366a), X(0x041b6cc8), X(0x0431de78), X(0x04488b6c),
309 X(0x045f7393), X(0x047696dd), X(0x048df53b), X(0x04a58e9b),
310 X(0x04bd62ee), X(0x04d57223), X(0x04edbc28), X(0x050640ed),
311 X(0x051f0060), X(0x0537fa70), X(0x05512f0a), X(0x056a9e1e),
312 X(0x05844798), X(0x059e2b67), X(0x05b84978), X(0x05d2a1b8),
313 X(0x05ed3414), X(0x06080079), X(0x062306d3), X(0x063e470f),
314 X(0x0659c119), X(0x067574dd), X(0x06916247), X(0x06ad8941),
315 X(0x06c9e9b8), X(0x06e68397), X(0x070356c8), X(0x07206336),
316 X(0x073da8cb), X(0x075b2772), X(0x0778df15), X(0x0796cf9c),
317 X(0x07b4f8f3), X(0x07d35b01), X(0x07f1f5b1), X(0x0810c8eb),
318 X(0x082fd497), X(0x084f189e), X(0x086e94e9), X(0x088e495e),
319 X(0x08ae35e6), X(0x08ce5a68), X(0x08eeb6cc), X(0x090f4af8),
320 X(0x093016d3), X(0x09511a44), X(0x09725530), X(0x0993c77f),
321 X(0x09b57115), X(0x09d751d8), X(0x09f969ae), X(0x0a1bb87c),
322 X(0x0a3e3e26), X(0x0a60fa91), X(0x0a83eda2), X(0x0aa7173c),
323 X(0x0aca7743), X(0x0aee0d9b), X(0x0b11da28), X(0x0b35dccc),
324 X(0x0b5a156a), X(0x0b7e83e5), X(0x0ba3281f), X(0x0bc801fa),
325 X(0x0bed1159), X(0x0c12561c), X(0x0c37d025), X(0x0c5d7f55),
326 X(0x0c83638d), X(0x0ca97cae), X(0x0ccfca97), X(0x0cf64d2a),
327 X(0x0d1d0444), X(0x0d43efc7), X(0x0d6b0f92), X(0x0d926383),
328 X(0x0db9eb79), X(0x0de1a752), X(0x0e0996ee), X(0x0e31ba29),
329 X(0x0e5a10e2), X(0x0e829af6), X(0x0eab5841), X(0x0ed448a2),
330 X(0x0efd6bf4), X(0x0f26c214), X(0x0f504ade), X(0x0f7a062e),
331 X(0x0fa3f3df), X(0x0fce13cd), X(0x0ff865d2), X(0x1022e9ca),
332 X(0x104d9f8e), X(0x107886f9), X(0x10a39fe5), X(0x10ceea2c),
333 X(0x10fa65a6), X(0x1126122d), X(0x1151ef9a), X(0x117dfdc5),
334 X(0x11aa3c87), X(0x11d6abb6), X(0x12034b2c), X(0x12301ac0),
335 X(0x125d1a48), X(0x128a499b), X(0x12b7a891), X(0x12e536ff),
336 X(0x1312f4bb), X(0x1340e19c), X(0x136efd75), X(0x139d481e),
337 X(0x13cbc16a), X(0x13fa692f), X(0x14293f40), X(0x14584371),
338 X(0x14877597), X(0x14b6d585), X(0x14e6630d), X(0x15161e04),
339 X(0x1546063b), X(0x15761b85), X(0x15a65db3), X(0x15d6cc99),
340 X(0x16076806), X(0x16382fcd), X(0x166923bf), X(0x169a43ab),
341 X(0x16cb8f62), X(0x16fd06b5), X(0x172ea973), X(0x1760776b),
342 X(0x1792706e), X(0x17c49449), X(0x17f6e2cb), X(0x18295bc3),
343 X(0x185bfeff), X(0x188ecc4c), X(0x18c1c379), X(0x18f4e452),
344 X(0x19282ea4), X(0x195ba23c), X(0x198f3ee6), X(0x19c3046e),
345 X(0x19f6f2a1), X(0x1a2b094a), X(0x1a5f4833), X(0x1a93af28),
346 X(0x1ac83df3), X(0x1afcf460), X(0x1b31d237), X(0x1b66d744),
347 X(0x1b9c034e), X(0x1bd15621), X(0x1c06cf84), X(0x1c3c6f40),
348 X(0x1c72351e), X(0x1ca820e6), X(0x1cde3260), X(0x1d146953),
349 X(0x1d4ac587), X(0x1d8146c3), X(0x1db7eccd), X(0x1deeb76c),
350 X(0x1e25a667), X(0x1e5cb982), X(0x1e93f085), X(0x1ecb4b33),
351 X(0x1f02c953), X(0x1f3a6aaa), X(0x1f722efb), X(0x1faa160b),
352 X(0x1fe21f9e), X(0x201a4b79), X(0x2052995d), X(0x208b0910),
353 X(0x20c39a53), X(0x20fc4cea), X(0x21352097), X(0x216e151c),
354 X(0x21a72a3a), X(0x21e05fb5), X(0x2219b54d), X(0x22532ac3),
355 X(0x228cbfd8), X(0x22c6744d), X(0x230047e2), X(0x233a3a58),
356 X(0x23744b6d), X(0x23ae7ae3), X(0x23e8c878), X(0x242333ec),
357 X(0x245dbcfd), X(0x24986369), X(0x24d326f1), X(0x250e0750),
358 X(0x25490446), X(0x25841d90), X(0x25bf52ec), X(0x25faa417),
359 X(0x263610cd), X(0x267198cc), X(0x26ad3bcf), X(0x26e8f994),
360 X(0x2724d1d6), X(0x2760c451), X(0x279cd0c0), X(0x27d8f6e0),
361 X(0x2815366a), X(0x28518f1b), X(0x288e00ac), X(0x28ca8ad8),
362 X(0x29072d5a), X(0x2943e7eb), X(0x2980ba45), X(0x29bda422),
363 X(0x29faa53c), X(0x2a37bd4a), X(0x2a74ec07), X(0x2ab2312b),
364 X(0x2aef8c6f), X(0x2b2cfd8b), X(0x2b6a8437), X(0x2ba8202c),
365 X(0x2be5d120), X(0x2c2396cc), X(0x2c6170e7), X(0x2c9f5f29),
366 X(0x2cdd6147), X(0x2d1b76fa), X(0x2d599ff7), X(0x2d97dbf5),
367 X(0x2dd62aab), X(0x2e148bcf), X(0x2e52ff16), X(0x2e918436),
368 X(0x2ed01ae5), X(0x2f0ec2d9), X(0x2f4d7bc6), X(0x2f8c4562),
369 X(0x2fcb1f62), X(0x300a097a), X(0x3049035f), X(0x30880cc6),
370 X(0x30c72563), X(0x31064cea), X(0x3145830f), X(0x3184c786),
371 X(0x31c41a03), X(0x32037a39), X(0x3242e7dc), X(0x3282629f),
372 X(0x32c1ea36), X(0x33017e53), X(0x33411ea9), X(0x3380caec),
373 X(0x33c082ce), X(0x34004602), X(0x34401439), X(0x347fed27),
374 X(0x34bfd07e), X(0x34ffbdf0), X(0x353fb52e), X(0x357fb5ec),
375 X(0x35bfbfda), X(0x35ffd2aa), X(0x363fee0f), X(0x368011b9),
376 X(0x36c03d5a), X(0x370070a4), X(0x3740ab48), X(0x3780ecf7),
377 X(0x37c13562), X(0x3801843a), X(0x3841d931), X(0x388233f7),
378 X(0x38c2943d), X(0x3902f9b4), X(0x3943640d), X(0x3983d2f8),
379 X(0x39c44626), X(0x3a04bd48), X(0x3a45380e), X(0x3a85b62a),
380 X(0x3ac6374a), X(0x3b06bb20), X(0x3b47415c), X(0x3b87c9ae),
381 X(0x3bc853c7), X(0x3c08df57), X(0x3c496c0f), X(0x3c89f99f),
382 X(0x3cca87b6), X(0x3d0b1605), X(0x3d4ba43d), X(0x3d8c320e),
383 X(0x3dccbf27), X(0x3e0d4b3a), X(0x3e4dd5f6), X(0x3e8e5f0c),
384 X(0x3ecee62b), X(0x3f0f6b05), X(0x3f4fed49), X(0x3f906ca8),
385 X(0x3fd0e8d2), X(0x40116177), X(0x4051d648), X(0x409246f6),
386 X(0x40d2b330), X(0x41131aa7), X(0x41537d0c), X(0x4193da10),
387 X(0x41d43162), X(0x421482b4), X(0x4254cdb7), X(0x4295121b),
388 X(0x42d54f91), X(0x431585ca), X(0x4355b477), X(0x4395db49),
389 X(0x43d5f9f1), X(0x44161021), X(0x44561d8a), X(0x449621dd),
390 X(0x44d61ccc), X(0x45160e08), X(0x4555f544), X(0x4595d230),
391 X(0x45d5a47f), X(0x46156be3), X(0x4655280e), X(0x4694d8b2),
392 X(0x46d47d82), X(0x4714162f), X(0x4753a26d), X(0x479321ef),
393 X(0x47d29466), X(0x4811f987), X(0x48515104), X(0x48909a91),
394 X(0x48cfd5e1), X(0x490f02a7), X(0x494e2098), X(0x498d2f66),
395 X(0x49cc2ec7), X(0x4a0b1e6f), X(0x4a49fe11), X(0x4a88cd62),
396 X(0x4ac78c18), X(0x4b0639e6), X(0x4b44d683), X(0x4b8361a2),
397 X(0x4bc1dafa), X(0x4c004241), X(0x4c3e972c), X(0x4c7cd970),
398 X(0x4cbb08c5), X(0x4cf924e1), X(0x4d372d7a), X(0x4d752247),
399 X(0x4db30300), X(0x4df0cf5a), X(0x4e2e870f), X(0x4e6c29d6),
400 X(0x4ea9b766), X(0x4ee72f78), X(0x4f2491c4), X(0x4f61de02),
401 X(0x4f9f13ec), X(0x4fdc333b), X(0x50193ba8), X(0x50562ced),
402 X(0x509306c3), X(0x50cfc8e5), X(0x510c730d), X(0x514904f6),
403 X(0x51857e5a), X(0x51c1def5), X(0x51fe2682), X(0x523a54bc),
404 X(0x52766961), X(0x52b2642c), X(0x52ee44d9), X(0x532a0b26),
405 X(0x5365b6d0), X(0x53a14793), X(0x53dcbd2f), X(0x54181760),
406 X(0x545355e5), X(0x548e787d), X(0x54c97ee6), X(0x550468e1),
407 X(0x553f362c), X(0x5579e687), X(0x55b479b3), X(0x55eeef70),
408 X(0x5629477f), X(0x566381a1), X(0x569d9d97), X(0x56d79b24),
409 X(0x57117a0a), X(0x574b3a0a), X(0x5784dae9), X(0x57be5c69),
410 X(0x57f7be4d), X(0x5831005a), X(0x586a2254), X(0x58a32400),
411 X(0x58dc0522), X(0x5914c57f), X(0x594d64de), X(0x5985e305),
412 X(0x59be3fba), X(0x59f67ac3), X(0x5a2e93e9), X(0x5a668af2),
413 X(0x5a9e5fa6), X(0x5ad611ce), X(0x5b0da133), X(0x5b450d9d),
414 X(0x5b7c56d7), X(0x5bb37ca9), X(0x5bea7ede), X(0x5c215d41),
415 X(0x5c58179d), X(0x5c8eadbe), X(0x5cc51f6f), X(0x5cfb6c7c),
416 X(0x5d3194b2), X(0x5d6797de), X(0x5d9d75cf), X(0x5dd32e51),
417 X(0x5e08c132), X(0x5e3e2e43), X(0x5e737551), X(0x5ea8962d),
418 X(0x5edd90a7), X(0x5f12648e), X(0x5f4711b4), X(0x5f7b97ea),
419 X(0x5faff702), X(0x5fe42ece), X(0x60183f20), X(0x604c27cc),
420 X(0x607fe8a6), X(0x60b38180), X(0x60e6f22f), X(0x611a3a89),
421 X(0x614d5a62), X(0x61805190), X(0x61b31fe9), X(0x61e5c545),
422 X(0x62184179), X(0x624a945d), X(0x627cbdca), X(0x62aebd98),
423 X(0x62e0939f), X(0x63123fba), X(0x6343c1c1), X(0x6375198f),
424 X(0x63a646ff), X(0x63d749ec), X(0x64082232), X(0x6438cfad),
425 X(0x64695238), X(0x6499a9b3), X(0x64c9d5f9), X(0x64f9d6ea),
426 X(0x6529ac63), X(0x65595643), X(0x6588d46a), X(0x65b826b8),
427 X(0x65e74d0e), X(0x6616474b), X(0x66451552), X(0x6673b704),
428 X(0x66a22c44), X(0x66d074f4), X(0x66fe90f8), X(0x672c8033),
429 X(0x675a428a), X(0x6787d7e1), X(0x67b5401f), X(0x67e27b27),
430 X(0x680f88e1), X(0x683c6934), X(0x68691c05), X(0x6895a13e),
431 X(0x68c1f8c7), X(0x68ee2287), X(0x691a1e68), X(0x6945ec54),
432 X(0x69718c35), X(0x699cfdf5), X(0x69c8417f), X(0x69f356c0),
433 X(0x6a1e3da3), X(0x6a48f615), X(0x6a738002), X(0x6a9ddb5a),
434 X(0x6ac80808), X(0x6af205fd), X(0x6b1bd526), X(0x6b457575),
435 X(0x6b6ee6d8), X(0x6b982940), X(0x6bc13c9f), X(0x6bea20e5),
436 X(0x6c12d605), X(0x6c3b5bf1), X(0x6c63b29c), X(0x6c8bd9fb),
437 X(0x6cb3d200), X(0x6cdb9aa0), X(0x6d0333d0), X(0x6d2a9d86),
438 X(0x6d51d7b7), X(0x6d78e25a), X(0x6d9fbd67), X(0x6dc668d3),
439 X(0x6dece498), X(0x6e1330ad), X(0x6e394d0c), X(0x6e5f39ae),
440 X(0x6e84f68d), X(0x6eaa83a2), X(0x6ecfe0ea), X(0x6ef50e5e),
441 X(0x6f1a0bfc), X(0x6f3ed9bf), X(0x6f6377a4), X(0x6f87e5a8),
442 X(0x6fac23c9), X(0x6fd03206), X(0x6ff4105c), X(0x7017becc),
443 X(0x703b3d54), X(0x705e8bf5), X(0x7081aaaf), X(0x70a49984),
444 X(0x70c75874), X(0x70e9e783), X(0x710c46b2), X(0x712e7605),
445 X(0x7150757f), X(0x71724523), X(0x7193e4f6), X(0x71b554fd),
446 X(0x71d6953e), X(0x71f7a5bd), X(0x72188681), X(0x72393792),
447 X(0x7259b8f5), X(0x727a0ab2), X(0x729a2cd2), X(0x72ba1f5d),
448 X(0x72d9e25c), X(0x72f975d8), X(0x7318d9db), X(0x73380e6f),
449 X(0x735713a0), X(0x7375e978), X(0x73949003), X(0x73b3074c),
450 X(0x73d14f61), X(0x73ef684f), X(0x740d5222), X(0x742b0ce9),
451 X(0x744898b1), X(0x7465f589), X(0x74832381), X(0x74a022a8),
452 X(0x74bcf30e), X(0x74d994c3), X(0x74f607d8), X(0x75124c5f),
453 X(0x752e6268), X(0x754a4a05), X(0x7566034b), X(0x75818e4a),
454 X(0x759ceb16), X(0x75b819c4), X(0x75d31a66), X(0x75eded12),
455 X(0x760891dc), X(0x762308da), X(0x763d5221), X(0x76576dc8),
456 X(0x76715be4), X(0x768b1c8c), X(0x76a4afd9), X(0x76be15e0),
457 X(0x76d74ebb), X(0x76f05a82), X(0x7709394d), X(0x7721eb35),
458 X(0x773a7054), X(0x7752c8c4), X(0x776af49f), X(0x7782f400),
459 X(0x779ac701), X(0x77b26dbd), X(0x77c9e851), X(0x77e136d8),
460 X(0x77f8596f), X(0x780f5032), X(0x78261b3f), X(0x783cbab2),
461 X(0x78532eaa), X(0x78697745), X(0x787f94a0), X(0x789586db),
462 X(0x78ab4e15), X(0x78c0ea6d), X(0x78d65c03), X(0x78eba2f7),
463 X(0x7900bf68), X(0x7915b179), X(0x792a7949), X(0x793f16fb),
464 X(0x79538aaf), X(0x7967d488), X(0x797bf4a8), X(0x798feb31),
465 X(0x79a3b846), X(0x79b75c0a), X(0x79cad6a1), X(0x79de282e),
466 X(0x79f150d5), X(0x7a0450bb), X(0x7a172803), X(0x7a29d6d3),
467 X(0x7a3c5d50), X(0x7a4ebb9f), X(0x7a60f1e6), X(0x7a73004a),
468 X(0x7a84e6f2), X(0x7a96a604), X(0x7aa83da7), X(0x7ab9ae01),
469 X(0x7acaf73a), X(0x7adc1979), X(0x7aed14e6), X(0x7afde9a8),
470 X(0x7b0e97e8), X(0x7b1f1fcd), X(0x7b2f8182), X(0x7b3fbd2d),
471 X(0x7b4fd2f9), X(0x7b5fc30f), X(0x7b6f8d98), X(0x7b7f32bd),
472 X(0x7b8eb2a9), X(0x7b9e0d85), X(0x7bad437d), X(0x7bbc54b9),
473 X(0x7bcb4166), X(0x7bda09ae), X(0x7be8adbc), X(0x7bf72dbc),
474 X(0x7c0589d8), X(0x7c13c23d), X(0x7c21d716), X(0x7c2fc88f),
475 X(0x7c3d96d5), X(0x7c4b4214), X(0x7c58ca78), X(0x7c66302d),
476 X(0x7c737362), X(0x7c809443), X(0x7c8d92fc), X(0x7c9a6fbc),
477 X(0x7ca72aaf), X(0x7cb3c404), X(0x7cc03be8), X(0x7ccc9288),
478 X(0x7cd8c814), X(0x7ce4dcb9), X(0x7cf0d0a5), X(0x7cfca406),
479 X(0x7d08570c), X(0x7d13e9e5), X(0x7d1f5cbf), X(0x7d2aafca),
480 X(0x7d35e335), X(0x7d40f72e), X(0x7d4bebe4), X(0x7d56c188),
481 X(0x7d617848), X(0x7d6c1054), X(0x7d7689db), X(0x7d80e50e),
482 X(0x7d8b221b), X(0x7d954133), X(0x7d9f4286), X(0x7da92643),
483 X(0x7db2ec9b), X(0x7dbc95bd), X(0x7dc621da), X(0x7dcf9123),
484 X(0x7dd8e3c6), X(0x7de219f6), X(0x7deb33e2), X(0x7df431ba),
485 X(0x7dfd13af), X(0x7e05d9f2), X(0x7e0e84b4), X(0x7e171424),
486 X(0x7e1f8874), X(0x7e27e1d4), X(0x7e302074), X(0x7e384487),
487 X(0x7e404e3c), X(0x7e483dc4), X(0x7e501350), X(0x7e57cf11),
488 X(0x7e5f7138), X(0x7e66f9f4), X(0x7e6e6979), X(0x7e75bff5),
489 X(0x7e7cfd9a), X(0x7e842298), X(0x7e8b2f22), X(0x7e922366),
490 X(0x7e98ff97), X(0x7e9fc3e4), X(0x7ea6707f), X(0x7ead0598),
491 X(0x7eb38360), X(0x7eb9ea07), X(0x7ec039bf), X(0x7ec672b7),
492 X(0x7ecc9521), X(0x7ed2a12c), X(0x7ed8970a), X(0x7ede76ea),
493 X(0x7ee440fd), X(0x7ee9f573), X(0x7eef947d), X(0x7ef51e4b),
494 X(0x7efa930d), X(0x7efff2f2), X(0x7f053e2b), X(0x7f0a74e8),
495 X(0x7f0f9758), X(0x7f14a5ac), X(0x7f19a013), X(0x7f1e86bc),
496 X(0x7f2359d8), X(0x7f281995), X(0x7f2cc623), X(0x7f315fb1),
497 X(0x7f35e66e), X(0x7f3a5a8a), X(0x7f3ebc33), X(0x7f430b98),
498 X(0x7f4748e7), X(0x7f4b7450), X(0x7f4f8e01), X(0x7f539629),
499 X(0x7f578cf5), X(0x7f5b7293), X(0x7f5f4732), X(0x7f630b00),
500 X(0x7f66be2b), X(0x7f6a60df), X(0x7f6df34b), X(0x7f71759b),
501 X(0x7f74e7fe), X(0x7f784aa0), X(0x7f7b9daf), X(0x7f7ee156),
502 X(0x7f8215c3), X(0x7f853b22), X(0x7f88519f), X(0x7f8b5967),
503 X(0x7f8e52a6), X(0x7f913d87), X(0x7f941a36), X(0x7f96e8df),
504 X(0x7f99a9ad), X(0x7f9c5ccb), X(0x7f9f0265), X(0x7fa19aa5),
505 X(0x7fa425b5), X(0x7fa6a3c1), X(0x7fa914f3), X(0x7fab7974),
506 X(0x7fadd16f), X(0x7fb01d0d), X(0x7fb25c78), X(0x7fb48fd9),
507 X(0x7fb6b75a), X(0x7fb8d323), X(0x7fbae35d), X(0x7fbce831),
508 X(0x7fbee1c7), X(0x7fc0d047), X(0x7fc2b3d9), X(0x7fc48ca5),
509 X(0x7fc65ad3), X(0x7fc81e88), X(0x7fc9d7ee), X(0x7fcb872a),
510 X(0x7fcd2c63), X(0x7fcec7bf), X(0x7fd05966), X(0x7fd1e17c),
511 X(0x7fd36027), X(0x7fd4d58d), X(0x7fd641d3), X(0x7fd7a51e),
512 X(0x7fd8ff94), X(0x7fda5157), X(0x7fdb9a8e), X(0x7fdcdb5b),
513 X(0x7fde13e2), X(0x7fdf4448), X(0x7fe06caf), X(0x7fe18d3b),
514 X(0x7fe2a60e), X(0x7fe3b74b), X(0x7fe4c114), X(0x7fe5c38b),
515 X(0x7fe6bed2), X(0x7fe7b30a), X(0x7fe8a055), X(0x7fe986d4),
516 X(0x7fea66a7), X(0x7feb3ff0), X(0x7fec12cd), X(0x7fecdf5f),
517 X(0x7feda5c5), X(0x7fee6620), X(0x7fef208d), X(0x7fefd52c),
518 X(0x7ff0841c), X(0x7ff12d7a), X(0x7ff1d164), X(0x7ff26ff9),
519 X(0x7ff30955), X(0x7ff39d96), X(0x7ff42cd9), X(0x7ff4b739),
520 X(0x7ff53cd4), X(0x7ff5bdc5), X(0x7ff63a28), X(0x7ff6b217),
521 X(0x7ff725af), X(0x7ff7950a), X(0x7ff80043), X(0x7ff86773),
522 X(0x7ff8cab4), X(0x7ff92a21), X(0x7ff985d1), X(0x7ff9dddf),
523 X(0x7ffa3262), X(0x7ffa8374), X(0x7ffad12c), X(0x7ffb1ba1),
524 X(0x7ffb62ec), X(0x7ffba723), X(0x7ffbe85c), X(0x7ffc26b0),
525 X(0x7ffc6233), X(0x7ffc9afb), X(0x7ffcd11e), X(0x7ffd04b1),
526 X(0x7ffd35c9), X(0x7ffd647b), X(0x7ffd90da), X(0x7ffdbafa),
527 X(0x7ffde2f0), X(0x7ffe08ce), X(0x7ffe2ca7), X(0x7ffe4e8e),
528 X(0x7ffe6e95), X(0x7ffe8cce), X(0x7ffea94a), X(0x7ffec41b),
529 X(0x7ffedd52), X(0x7ffef4ff), X(0x7fff0b33), X(0x7fff1ffd),
530 X(0x7fff336e), X(0x7fff4593), X(0x7fff567d), X(0x7fff663a),
531 X(0x7fff74d8), X(0x7fff8265), X(0x7fff8eee), X(0x7fff9a81),
532 X(0x7fffa52b), X(0x7fffaef8), X(0x7fffb7f5), X(0x7fffc02d),
533 X(0x7fffc7ab), X(0x7fffce7c), X(0x7fffd4a9), X(0x7fffda3e),
534 X(0x7fffdf44), X(0x7fffe3c6), X(0x7fffe7cc), X(0x7fffeb60),
535 X(0x7fffee8a), X(0x7ffff153), X(0x7ffff3c4), X(0x7ffff5e3),
536 X(0x7ffff7b8), X(0x7ffff94b), X(0x7ffffaa1), X(0x7ffffbc1),
537 X(0x7ffffcb2), X(0x7ffffd78), X(0x7ffffe19), X(0x7ffffe9a),
538 X(0x7ffffeff), X(0x7fffff4e), X(0x7fffff89), X(0x7fffffb3),
539 X(0x7fffffd2), X(0x7fffffe6), X(0x7ffffff3), X(0x7ffffffa),
540 X(0x7ffffffe), X(0x7fffffff), X(0x7fffffff), X(0x7fffffff),
541};
542
543static LOOKUP_T vwin4096[2048] = {
544 X(0x000001f0), X(0x00001171), X(0x00003072), X(0x00005ef5),
545 X(0x00009cf8), X(0x0000ea7c), X(0x00014780), X(0x0001b405),
546 X(0x0002300b), X(0x0002bb91), X(0x00035698), X(0x0004011e),
547 X(0x0004bb25), X(0x000584ac), X(0x00065db3), X(0x0007463a),
548 X(0x00083e41), X(0x000945c7), X(0x000a5ccc), X(0x000b8350),
549 X(0x000cb954), X(0x000dfed7), X(0x000f53d8), X(0x0010b857),
550 X(0x00122c55), X(0x0013afd1), X(0x001542ca), X(0x0016e541),
551 X(0x00189735), X(0x001a58a7), X(0x001c2995), X(0x001e09ff),
552 X(0x001ff9e6), X(0x0021f948), X(0x00240826), X(0x00262680),
553 X(0x00285454), X(0x002a91a3), X(0x002cde6c), X(0x002f3aaf),
554 X(0x0031a66b), X(0x003421a0), X(0x0036ac4f), X(0x00394675),
555 X(0x003bf014), X(0x003ea92a), X(0x004171b7), X(0x004449bb),
556 X(0x00473135), X(0x004a2824), X(0x004d2e8a), X(0x00504463),
557 X(0x005369b2), X(0x00569e74), X(0x0059e2aa), X(0x005d3652),
558 X(0x0060996d), X(0x00640bf9), X(0x00678df7), X(0x006b1f66),
559 X(0x006ec045), X(0x00727093), X(0x00763051), X(0x0079ff7d),
560 X(0x007dde16), X(0x0081cc1d), X(0x0085c991), X(0x0089d671),
561 X(0x008df2bc), X(0x00921e71), X(0x00965991), X(0x009aa41a),
562 X(0x009efe0c), X(0x00a36766), X(0x00a7e028), X(0x00ac6850),
563 X(0x00b0ffde), X(0x00b5a6d1), X(0x00ba5d28), X(0x00bf22e4),
564 X(0x00c3f802), X(0x00c8dc83), X(0x00cdd065), X(0x00d2d3a8),
565 X(0x00d7e64a), X(0x00dd084c), X(0x00e239ac), X(0x00e77a69),
566 X(0x00ecca83), X(0x00f229f9), X(0x00f798ca), X(0x00fd16f5),
567 X(0x0102a479), X(0x01084155), X(0x010ded89), X(0x0113a913),
568 X(0x011973f3), X(0x011f4e27), X(0x012537af), X(0x012b308a),
569 X(0x013138b7), X(0x01375035), X(0x013d7702), X(0x0143ad1f),
570 X(0x0149f289), X(0x01504741), X(0x0156ab44), X(0x015d1e92),
571 X(0x0163a12a), X(0x016a330b), X(0x0170d433), X(0x017784a3),
572 X(0x017e4458), X(0x01851351), X(0x018bf18e), X(0x0192df0d),
573 X(0x0199dbcd), X(0x01a0e7cd), X(0x01a8030c), X(0x01af2d89),
574 X(0x01b66743), X(0x01bdb038), X(0x01c50867), X(0x01cc6fd0),
575 X(0x01d3e670), X(0x01db6c47), X(0x01e30153), X(0x01eaa593),
576 X(0x01f25907), X(0x01fa1bac), X(0x0201ed81), X(0x0209ce86),
577 X(0x0211beb8), X(0x0219be17), X(0x0221cca2), X(0x0229ea56),
578 X(0x02321733), X(0x023a5337), X(0x02429e60), X(0x024af8af),
579 X(0x02536220), X(0x025bdab3), X(0x02646267), X(0x026cf93a),
580 X(0x02759f2a), X(0x027e5436), X(0x0287185d), X(0x028feb9d),
581 X(0x0298cdf4), X(0x02a1bf62), X(0x02aabfe5), X(0x02b3cf7b),
582 X(0x02bcee23), X(0x02c61bdb), X(0x02cf58a2), X(0x02d8a475),
583 X(0x02e1ff55), X(0x02eb693e), X(0x02f4e230), X(0x02fe6a29),
584 X(0x03080127), X(0x0311a729), X(0x031b5c2d), X(0x03252031),
585 X(0x032ef334), X(0x0338d534), X(0x0342c630), X(0x034cc625),
586 X(0x0356d512), X(0x0360f2f6), X(0x036b1fce), X(0x03755b99),
587 X(0x037fa655), X(0x038a0001), X(0x0394689a), X(0x039ee020),
588 X(0x03a9668f), X(0x03b3fbe6), X(0x03bea024), X(0x03c95347),
589 X(0x03d4154d), X(0x03dee633), X(0x03e9c5f9), X(0x03f4b49b),
590 X(0x03ffb219), X(0x040abe71), X(0x0415d9a0), X(0x042103a5),
591 X(0x042c3c7d), X(0x04378428), X(0x0442daa2), X(0x044e3fea),
592 X(0x0459b3fd), X(0x046536db), X(0x0470c880), X(0x047c68eb),
593 X(0x0488181a), X(0x0493d60b), X(0x049fa2bc), X(0x04ab7e2a),
594 X(0x04b76854), X(0x04c36137), X(0x04cf68d1), X(0x04db7f21),
595 X(0x04e7a424), X(0x04f3d7d8), X(0x05001a3b), X(0x050c6b4a),
596 X(0x0518cb04), X(0x05253966), X(0x0531b66e), X(0x053e421a),
597 X(0x054adc68), X(0x05578555), X(0x05643cdf), X(0x05710304),
598 X(0x057dd7c1), X(0x058abb15), X(0x0597acfd), X(0x05a4ad76),
599 X(0x05b1bc7f), X(0x05beda14), X(0x05cc0635), X(0x05d940dd),
600 X(0x05e68a0b), X(0x05f3e1bd), X(0x060147f0), X(0x060ebca1),
601 X(0x061c3fcf), X(0x0629d176), X(0x06377194), X(0x06452027),
602 X(0x0652dd2c), X(0x0660a8a2), X(0x066e8284), X(0x067c6ad1),
603 X(0x068a6186), X(0x069866a1), X(0x06a67a1e), X(0x06b49bfc),
604 X(0x06c2cc38), X(0x06d10acf), X(0x06df57bf), X(0x06edb304),
605 X(0x06fc1c9d), X(0x070a9487), X(0x07191abe), X(0x0727af40),
606 X(0x0736520b), X(0x0745031c), X(0x0753c270), X(0x07629004),
607 X(0x07716bd6), X(0x078055e2), X(0x078f4e26), X(0x079e549f),
608 X(0x07ad694b), X(0x07bc8c26), X(0x07cbbd2e), X(0x07dafc5f),
609 X(0x07ea49b7), X(0x07f9a533), X(0x08090ed1), X(0x0818868c),
610 X(0x08280c62), X(0x0837a051), X(0x08474255), X(0x0856f26b),
611 X(0x0866b091), X(0x08767cc3), X(0x088656fe), X(0x08963f3f),
612 X(0x08a63584), X(0x08b639c8), X(0x08c64c0a), X(0x08d66c45),
613 X(0x08e69a77), X(0x08f6d69d), X(0x090720b3), X(0x091778b7),
614 X(0x0927dea5), X(0x0938527a), X(0x0948d433), X(0x095963cc),
615 X(0x096a0143), X(0x097aac94), X(0x098b65bb), X(0x099c2cb6),
616 X(0x09ad0182), X(0x09bde41a), X(0x09ced47d), X(0x09dfd2a5),
617 X(0x09f0de90), X(0x0a01f83b), X(0x0a131fa3), X(0x0a2454c3),
618 X(0x0a359798), X(0x0a46e820), X(0x0a584656), X(0x0a69b237),
619 X(0x0a7b2bc0), X(0x0a8cb2ec), X(0x0a9e47ba), X(0x0aafea24),
620 X(0x0ac19a29), X(0x0ad357c3), X(0x0ae522ef), X(0x0af6fbab),
621 X(0x0b08e1f1), X(0x0b1ad5c0), X(0x0b2cd712), X(0x0b3ee5e5),
622 X(0x0b510234), X(0x0b632bfd), X(0x0b75633b), X(0x0b87a7eb),
623 X(0x0b99fa08), X(0x0bac5990), X(0x0bbec67e), X(0x0bd140cf),
624 X(0x0be3c87e), X(0x0bf65d89), X(0x0c08ffeb), X(0x0c1bafa1),
625 X(0x0c2e6ca6), X(0x0c4136f6), X(0x0c540e8f), X(0x0c66f36c),
626 X(0x0c79e588), X(0x0c8ce4e1), X(0x0c9ff172), X(0x0cb30b37),
627 X(0x0cc6322c), X(0x0cd9664d), X(0x0ceca797), X(0x0cfff605),
628 X(0x0d135193), X(0x0d26ba3d), X(0x0d3a2fff), X(0x0d4db2d5),
629 X(0x0d6142ba), X(0x0d74dfac), X(0x0d8889a5), X(0x0d9c40a1),
630 X(0x0db0049d), X(0x0dc3d593), X(0x0dd7b380), X(0x0deb9e60),
631 X(0x0dff962f), X(0x0e139ae7), X(0x0e27ac85), X(0x0e3bcb05),
632 X(0x0e4ff662), X(0x0e642e98), X(0x0e7873a2), X(0x0e8cc57d),
633 X(0x0ea12423), X(0x0eb58f91), X(0x0eca07c2), X(0x0ede8cb1),
634 X(0x0ef31e5b), X(0x0f07bcba), X(0x0f1c67cb), X(0x0f311f88),
635 X(0x0f45e3ee), X(0x0f5ab4f7), X(0x0f6f92a0), X(0x0f847ce3),
636 X(0x0f9973bc), X(0x0fae7726), X(0x0fc3871e), X(0x0fd8a39d),
637 X(0x0fedcca1), X(0x10030223), X(0x1018441f), X(0x102d9291),
638 X(0x1042ed74), X(0x105854c3), X(0x106dc879), X(0x10834892),
639 X(0x1098d508), X(0x10ae6dd8), X(0x10c412fc), X(0x10d9c46f),
640 X(0x10ef822d), X(0x11054c30), X(0x111b2274), X(0x113104f5),
641 X(0x1146f3ac), X(0x115cee95), X(0x1172f5ab), X(0x118908e9),
642 X(0x119f284a), X(0x11b553ca), X(0x11cb8b62), X(0x11e1cf0f),
643 X(0x11f81ecb), X(0x120e7a90), X(0x1224e25a), X(0x123b5624),
644 X(0x1251d5e9), X(0x126861a3), X(0x127ef94e), X(0x12959ce3),
645 X(0x12ac4c5f), X(0x12c307bb), X(0x12d9cef2), X(0x12f0a200),
646 X(0x130780df), X(0x131e6b8a), X(0x133561fa), X(0x134c642c),
647 X(0x1363721a), X(0x137a8bbe), X(0x1391b113), X(0x13a8e214),
648 X(0x13c01eba), X(0x13d76702), X(0x13eebae5), X(0x14061a5e),
649 X(0x141d8567), X(0x1434fbfb), X(0x144c7e14), X(0x14640bae),
650 X(0x147ba4c1), X(0x14934949), X(0x14aaf941), X(0x14c2b4a2),
651 X(0x14da7b67), X(0x14f24d8a), X(0x150a2b06), X(0x152213d5),
652 X(0x153a07f1), X(0x15520755), X(0x156a11fb), X(0x158227dd),
653 X(0x159a48f5), X(0x15b2753d), X(0x15caacb1), X(0x15e2ef49),
654 X(0x15fb3d01), X(0x161395d2), X(0x162bf9b6), X(0x164468a8),
655 X(0x165ce2a1), X(0x1675679c), X(0x168df793), X(0x16a69280),
656 X(0x16bf385c), X(0x16d7e922), X(0x16f0a4cc), X(0x17096b54),
657 X(0x17223cb4), X(0x173b18e5), X(0x1753ffe2), X(0x176cf1a5),
658 X(0x1785ee27), X(0x179ef562), X(0x17b80750), X(0x17d123eb),
659 X(0x17ea4b2d), X(0x18037d10), X(0x181cb98d), X(0x1836009e),
660 X(0x184f523c), X(0x1868ae63), X(0x1882150a), X(0x189b862c),
661 X(0x18b501c4), X(0x18ce87c9), X(0x18e81836), X(0x1901b305),
662 X(0x191b582f), X(0x193507ad), X(0x194ec17a), X(0x1968858f),
663 X(0x198253e5), X(0x199c2c75), X(0x19b60f3a), X(0x19cffc2d),
664 X(0x19e9f347), X(0x1a03f482), X(0x1a1dffd7), X(0x1a381540),
665 X(0x1a5234b5), X(0x1a6c5e31), X(0x1a8691ac), X(0x1aa0cf21),
666 X(0x1abb1687), X(0x1ad567da), X(0x1aefc311), X(0x1b0a2826),
667 X(0x1b249712), X(0x1b3f0fd0), X(0x1b599257), X(0x1b741ea1),
668 X(0x1b8eb4a7), X(0x1ba95462), X(0x1bc3fdcd), X(0x1bdeb0de),
669 X(0x1bf96d91), X(0x1c1433dd), X(0x1c2f03bc), X(0x1c49dd27),
670 X(0x1c64c017), X(0x1c7fac85), X(0x1c9aa269), X(0x1cb5a1be),
671 X(0x1cd0aa7c), X(0x1cebbc9c), X(0x1d06d816), X(0x1d21fce4),
672 X(0x1d3d2aff), X(0x1d586260), X(0x1d73a2fe), X(0x1d8eecd4),
673 X(0x1daa3fda), X(0x1dc59c09), X(0x1de1015a), X(0x1dfc6fc5),
674 X(0x1e17e743), X(0x1e3367cd), X(0x1e4ef15b), X(0x1e6a83e7),
675 X(0x1e861f6a), X(0x1ea1c3da), X(0x1ebd7133), X(0x1ed9276b),
676 X(0x1ef4e67c), X(0x1f10ae5e), X(0x1f2c7f0a), X(0x1f485879),
677 X(0x1f643aa2), X(0x1f80257f), X(0x1f9c1908), X(0x1fb81536),
678 X(0x1fd41a00), X(0x1ff02761), X(0x200c3d4f), X(0x20285bc3),
679 X(0x204482b7), X(0x2060b221), X(0x207ce9fb), X(0x20992a3e),
680 X(0x20b572e0), X(0x20d1c3dc), X(0x20ee1d28), X(0x210a7ebe),
681 X(0x2126e895), X(0x21435aa6), X(0x215fd4ea), X(0x217c5757),
682 X(0x2198e1e8), X(0x21b57493), X(0x21d20f51), X(0x21eeb21b),
683 X(0x220b5ce7), X(0x22280fb0), X(0x2244ca6c), X(0x22618d13),
684 X(0x227e579f), X(0x229b2a06), X(0x22b80442), X(0x22d4e649),
685 X(0x22f1d015), X(0x230ec19d), X(0x232bbad9), X(0x2348bbc1),
686 X(0x2365c44c), X(0x2382d474), X(0x239fec30), X(0x23bd0b78),
687 X(0x23da3244), X(0x23f7608b), X(0x24149646), X(0x2431d36c),
688 X(0x244f17f5), X(0x246c63da), X(0x2489b711), X(0x24a71193),
689 X(0x24c47358), X(0x24e1dc57), X(0x24ff4c88), X(0x251cc3e2),
690 X(0x253a425e), X(0x2557c7f4), X(0x2575549a), X(0x2592e848),
691 X(0x25b082f7), X(0x25ce249e), X(0x25ebcd34), X(0x26097cb2),
692 X(0x2627330e), X(0x2644f040), X(0x2662b441), X(0x26807f07),
693 X(0x269e5089), X(0x26bc28c1), X(0x26da07a4), X(0x26f7ed2b),
694 X(0x2715d94d), X(0x2733cc02), X(0x2751c540), X(0x276fc500),
695 X(0x278dcb39), X(0x27abd7e2), X(0x27c9eaf3), X(0x27e80463),
696 X(0x28062429), X(0x28244a3e), X(0x28427697), X(0x2860a92d),
697 X(0x287ee1f7), X(0x289d20eb), X(0x28bb6603), X(0x28d9b134),
698 X(0x28f80275), X(0x291659c0), X(0x2934b709), X(0x29531a49),
699 X(0x29718378), X(0x298ff28b), X(0x29ae677b), X(0x29cce23e),
700 X(0x29eb62cb), X(0x2a09e91b), X(0x2a287523), X(0x2a4706dc),
701 X(0x2a659e3c), X(0x2a843b39), X(0x2aa2ddcd), X(0x2ac185ec),
702 X(0x2ae0338f), X(0x2afee6ad), X(0x2b1d9f3c), X(0x2b3c5d33),
703 X(0x2b5b208b), X(0x2b79e939), X(0x2b98b734), X(0x2bb78a74),
704 X(0x2bd662ef), X(0x2bf5409d), X(0x2c142374), X(0x2c330b6b),
705 X(0x2c51f87a), X(0x2c70ea97), X(0x2c8fe1b9), X(0x2caeddd6),
706 X(0x2ccddee7), X(0x2cece4e1), X(0x2d0befbb), X(0x2d2aff6d),
707 X(0x2d4a13ec), X(0x2d692d31), X(0x2d884b32), X(0x2da76de4),
708 X(0x2dc69540), X(0x2de5c13d), X(0x2e04f1d0), X(0x2e2426f0),
709 X(0x2e436095), X(0x2e629eb4), X(0x2e81e146), X(0x2ea1283f),
710 X(0x2ec07398), X(0x2edfc347), X(0x2eff1742), X(0x2f1e6f80),
711 X(0x2f3dcbf8), X(0x2f5d2ca0), X(0x2f7c916f), X(0x2f9bfa5c),
712 X(0x2fbb675d), X(0x2fdad869), X(0x2ffa4d76), X(0x3019c67b),
713 X(0x3039436f), X(0x3058c448), X(0x307848fc), X(0x3097d183),
714 X(0x30b75dd3), X(0x30d6ede2), X(0x30f681a6), X(0x31161917),
715 X(0x3135b42b), X(0x315552d8), X(0x3174f514), X(0x31949ad7),
716 X(0x31b44417), X(0x31d3f0ca), X(0x31f3a0e6), X(0x32135462),
717 X(0x32330b35), X(0x3252c555), X(0x327282b7), X(0x32924354),
718 X(0x32b20720), X(0x32d1ce13), X(0x32f19823), X(0x33116546),
719 X(0x33313573), X(0x3351089f), X(0x3370dec2), X(0x3390b7d1),
720 X(0x33b093c3), X(0x33d0728f), X(0x33f05429), X(0x3410388a),
721 X(0x34301fa7), X(0x34500977), X(0x346ff5ef), X(0x348fe506),
722 X(0x34afd6b3), X(0x34cfcaeb), X(0x34efc1a5), X(0x350fbad7),
723 X(0x352fb678), X(0x354fb47d), X(0x356fb4dd), X(0x358fb78e),
724 X(0x35afbc86), X(0x35cfc3bc), X(0x35efcd25), X(0x360fd8b8),
725 X(0x362fe66c), X(0x364ff636), X(0x3670080c), X(0x36901be5),
726 X(0x36b031b7), X(0x36d04978), X(0x36f0631e), X(0x37107ea0),
727 X(0x37309bf3), X(0x3750bb0e), X(0x3770dbe6), X(0x3790fe73),
728 X(0x37b122aa), X(0x37d14881), X(0x37f16fee), X(0x381198e8),
729 X(0x3831c365), X(0x3851ef5a), X(0x38721cbe), X(0x38924b87),
730 X(0x38b27bac), X(0x38d2ad21), X(0x38f2dfde), X(0x391313d8),
731 X(0x39334906), X(0x39537f5d), X(0x3973b6d4), X(0x3993ef60),
732 X(0x39b428f9), X(0x39d46393), X(0x39f49f25), X(0x3a14dba6),
733 X(0x3a35190a), X(0x3a555748), X(0x3a759657), X(0x3a95d62c),
734 X(0x3ab616be), X(0x3ad65801), X(0x3af699ed), X(0x3b16dc78),
735 X(0x3b371f97), X(0x3b576341), X(0x3b77a76c), X(0x3b97ec0d),
736 X(0x3bb8311b), X(0x3bd8768b), X(0x3bf8bc55), X(0x3c19026d),
737 X(0x3c3948ca), X(0x3c598f62), X(0x3c79d62b), X(0x3c9a1d1b),
738 X(0x3cba6428), X(0x3cdaab48), X(0x3cfaf271), X(0x3d1b3999),
739 X(0x3d3b80b6), X(0x3d5bc7be), X(0x3d7c0ea8), X(0x3d9c5569),
740 X(0x3dbc9bf7), X(0x3ddce248), X(0x3dfd2852), X(0x3e1d6e0c),
741 X(0x3e3db36c), X(0x3e5df866), X(0x3e7e3cf2), X(0x3e9e8106),
742 X(0x3ebec497), X(0x3edf079b), X(0x3eff4a09), X(0x3f1f8bd7),
743 X(0x3f3fccfa), X(0x3f600d69), X(0x3f804d1a), X(0x3fa08c02),
744 X(0x3fc0ca19), X(0x3fe10753), X(0x400143a7), X(0x40217f0a),
745 X(0x4041b974), X(0x4061f2da), X(0x40822b32), X(0x40a26272),
746 X(0x40c29891), X(0x40e2cd83), X(0x41030140), X(0x412333bd),
747 X(0x414364f1), X(0x416394d2), X(0x4183c355), X(0x41a3f070),
748 X(0x41c41c1b), X(0x41e4464a), X(0x42046ef4), X(0x42249610),
749 X(0x4244bb92), X(0x4264df72), X(0x428501a5), X(0x42a52222),
750 X(0x42c540de), X(0x42e55dd0), X(0x430578ed), X(0x4325922d),
751 X(0x4345a985), X(0x4365beeb), X(0x4385d255), X(0x43a5e3ba),
752 X(0x43c5f30f), X(0x43e6004b), X(0x44060b65), X(0x44261451),
753 X(0x44461b07), X(0x44661f7c), X(0x448621a7), X(0x44a6217d),
754 X(0x44c61ef6), X(0x44e61a07), X(0x450612a6), X(0x452608ca),
755 X(0x4545fc69), X(0x4565ed79), X(0x4585dbf1), X(0x45a5c7c6),
756 X(0x45c5b0ef), X(0x45e59761), X(0x46057b15), X(0x46255bfe),
757 X(0x46453a15), X(0x4665154f), X(0x4684eda2), X(0x46a4c305),
758 X(0x46c4956e), X(0x46e464d3), X(0x4704312b), X(0x4723fa6c),
759 X(0x4743c08d), X(0x47638382), X(0x47834344), X(0x47a2ffc9),
760 X(0x47c2b906), X(0x47e26ef2), X(0x48022183), X(0x4821d0b1),
761 X(0x48417c71), X(0x486124b9), X(0x4880c981), X(0x48a06abe),
762 X(0x48c00867), X(0x48dfa272), X(0x48ff38d6), X(0x491ecb8a),
763 X(0x493e5a84), X(0x495de5b9), X(0x497d6d22), X(0x499cf0b4),
764 X(0x49bc7066), X(0x49dbec2e), X(0x49fb6402), X(0x4a1ad7db),
765 X(0x4a3a47ad), X(0x4a59b370), X(0x4a791b1a), X(0x4a987ea1),
766 X(0x4ab7ddfd), X(0x4ad73924), X(0x4af6900c), X(0x4b15e2ad),
767 X(0x4b3530fc), X(0x4b547af1), X(0x4b73c082), X(0x4b9301a6),
768 X(0x4bb23e53), X(0x4bd17681), X(0x4bf0aa25), X(0x4c0fd937),
769 X(0x4c2f03ae), X(0x4c4e297f), X(0x4c6d4aa3), X(0x4c8c670f),
770 X(0x4cab7eba), X(0x4cca919c), X(0x4ce99fab), X(0x4d08a8de),
771 X(0x4d27ad2c), X(0x4d46ac8b), X(0x4d65a6f3), X(0x4d849c5a),
772 X(0x4da38cb7), X(0x4dc27802), X(0x4de15e31), X(0x4e003f3a),
773 X(0x4e1f1b16), X(0x4e3df1ba), X(0x4e5cc31e), X(0x4e7b8f3a),
774 X(0x4e9a5603), X(0x4eb91771), X(0x4ed7d37b), X(0x4ef68a18),
775 X(0x4f153b3f), X(0x4f33e6e7), X(0x4f528d08), X(0x4f712d97),
776 X(0x4f8fc88e), X(0x4fae5de1), X(0x4fcced8a), X(0x4feb777f),
777 X(0x5009fbb6), X(0x50287a28), X(0x5046f2cc), X(0x50656598),
778 X(0x5083d284), X(0x50a23988), X(0x50c09a9a), X(0x50def5b1),
779 X(0x50fd4ac7), X(0x511b99d0), X(0x5139e2c5), X(0x5158259e),
780 X(0x51766251), X(0x519498d6), X(0x51b2c925), X(0x51d0f334),
781 X(0x51ef16fb), X(0x520d3473), X(0x522b4b91), X(0x52495c4e),
782 X(0x526766a2), X(0x52856a83), X(0x52a367e9), X(0x52c15ecd),
783 X(0x52df4f24), X(0x52fd38e8), X(0x531b1c10), X(0x5338f892),
784 X(0x5356ce68), X(0x53749d89), X(0x539265eb), X(0x53b02788),
785 X(0x53cde257), X(0x53eb964f), X(0x54094369), X(0x5426e99c),
786 X(0x544488df), X(0x5462212c), X(0x547fb279), X(0x549d3cbe),
787 X(0x54babff4), X(0x54d83c12), X(0x54f5b110), X(0x55131ee7),
788 X(0x5530858d), X(0x554de4fc), X(0x556b3d2a), X(0x55888e11),
789 X(0x55a5d7a8), X(0x55c319e7), X(0x55e054c7), X(0x55fd883f),
790 X(0x561ab447), X(0x5637d8d8), X(0x5654f5ea), X(0x56720b75),
791 X(0x568f1971), X(0x56ac1fd7), X(0x56c91e9e), X(0x56e615c0),
792 X(0x57030534), X(0x571fecf2), X(0x573cccf3), X(0x5759a530),
793 X(0x577675a0), X(0x57933e3c), X(0x57affefd), X(0x57ccb7db),
794 X(0x57e968ce), X(0x580611cf), X(0x5822b2d6), X(0x583f4bdd),
795 X(0x585bdcdb), X(0x587865c9), X(0x5894e69f), X(0x58b15f57),
796 X(0x58cdcfe9), X(0x58ea384e), X(0x5906987d), X(0x5922f071),
797 X(0x593f4022), X(0x595b8788), X(0x5977c69c), X(0x5993fd57),
798 X(0x59b02bb2), X(0x59cc51a6), X(0x59e86f2c), X(0x5a04843c),
799 X(0x5a2090d0), X(0x5a3c94e0), X(0x5a589065), X(0x5a748359),
800 X(0x5a906db4), X(0x5aac4f70), X(0x5ac82884), X(0x5ae3f8ec),
801 X(0x5affc09f), X(0x5b1b7f97), X(0x5b3735cd), X(0x5b52e33a),
802 X(0x5b6e87d8), X(0x5b8a239f), X(0x5ba5b689), X(0x5bc1408f),
803 X(0x5bdcc1aa), X(0x5bf839d5), X(0x5c13a907), X(0x5c2f0f3b),
804 X(0x5c4a6c6a), X(0x5c65c08d), X(0x5c810b9e), X(0x5c9c4d97),
805 X(0x5cb78670), X(0x5cd2b623), X(0x5ceddcaa), X(0x5d08f9ff),
806 X(0x5d240e1b), X(0x5d3f18f8), X(0x5d5a1a8f), X(0x5d7512da),
807 X(0x5d9001d3), X(0x5daae773), X(0x5dc5c3b5), X(0x5de09692),
808 X(0x5dfb6004), X(0x5e162004), X(0x5e30d68d), X(0x5e4b8399),
809 X(0x5e662721), X(0x5e80c11f), X(0x5e9b518e), X(0x5eb5d867),
810 X(0x5ed055a4), X(0x5eeac940), X(0x5f053334), X(0x5f1f937b),
811 X(0x5f39ea0f), X(0x5f5436ea), X(0x5f6e7a06), X(0x5f88b35d),
812 X(0x5fa2e2e9), X(0x5fbd08a6), X(0x5fd7248d), X(0x5ff13698),
813 X(0x600b3ec2), X(0x60253d05), X(0x603f315b), X(0x60591bc0),
814 X(0x6072fc2d), X(0x608cd29e), X(0x60a69f0b), X(0x60c06171),
815 X(0x60da19ca), X(0x60f3c80f), X(0x610d6c3d), X(0x6127064d),
816 X(0x6140963a), X(0x615a1bff), X(0x61739797), X(0x618d08fc),
817 X(0x61a67029), X(0x61bfcd1a), X(0x61d91fc8), X(0x61f2682f),
818 X(0x620ba64a), X(0x6224da13), X(0x623e0386), X(0x6257229d),
819 X(0x62703754), X(0x628941a6), X(0x62a2418e), X(0x62bb3706),
820 X(0x62d4220a), X(0x62ed0296), X(0x6305d8a3), X(0x631ea42f),
821 X(0x63376533), X(0x63501bab), X(0x6368c793), X(0x638168e5),
822 X(0x6399ff9e), X(0x63b28bb8), X(0x63cb0d2f), X(0x63e383ff),
823 X(0x63fbf022), X(0x64145195), X(0x642ca853), X(0x6444f457),
824 X(0x645d359e), X(0x64756c22), X(0x648d97e0), X(0x64a5b8d3),
825 X(0x64bdcef6), X(0x64d5da47), X(0x64eddabf), X(0x6505d05c),
826 X(0x651dbb19), X(0x65359af2), X(0x654d6fe3), X(0x656539e7),
827 X(0x657cf8fb), X(0x6594ad1b), X(0x65ac5643), X(0x65c3f46e),
828 X(0x65db8799), X(0x65f30fc0), X(0x660a8ce0), X(0x6621fef3),
829 X(0x663965f7), X(0x6650c1e7), X(0x666812c1), X(0x667f5880),
830 X(0x66969320), X(0x66adc29e), X(0x66c4e6f7), X(0x66dc0026),
831 X(0x66f30e28), X(0x670a10fa), X(0x67210898), X(0x6737f4ff),
832 X(0x674ed62b), X(0x6765ac19), X(0x677c76c5), X(0x6793362c),
833 X(0x67a9ea4b), X(0x67c0931f), X(0x67d730a3), X(0x67edc2d6),
834 X(0x680449b3), X(0x681ac538), X(0x68313562), X(0x68479a2d),
835 X(0x685df396), X(0x6874419b), X(0x688a8438), X(0x68a0bb6a),
836 X(0x68b6e72e), X(0x68cd0782), X(0x68e31c63), X(0x68f925cd),
837 X(0x690f23be), X(0x69251633), X(0x693afd29), X(0x6950d89e),
838 X(0x6966a88f), X(0x697c6cf8), X(0x699225d9), X(0x69a7d32d),
839 X(0x69bd74f3), X(0x69d30b27), X(0x69e895c8), X(0x69fe14d2),
840 X(0x6a138844), X(0x6a28f01b), X(0x6a3e4c54), X(0x6a539ced),
841 X(0x6a68e1e4), X(0x6a7e1b37), X(0x6a9348e3), X(0x6aa86ae6),
842 X(0x6abd813d), X(0x6ad28be7), X(0x6ae78ae2), X(0x6afc7e2b),
843 X(0x6b1165c0), X(0x6b26419f), X(0x6b3b11c7), X(0x6b4fd634),
844 X(0x6b648ee6), X(0x6b793bda), X(0x6b8ddd0e), X(0x6ba27281),
845 X(0x6bb6fc31), X(0x6bcb7a1b), X(0x6bdfec3e), X(0x6bf45299),
846 X(0x6c08ad29), X(0x6c1cfbed), X(0x6c313ee4), X(0x6c45760a),
847 X(0x6c59a160), X(0x6c6dc0e4), X(0x6c81d493), X(0x6c95dc6d),
848 X(0x6ca9d86f), X(0x6cbdc899), X(0x6cd1acea), X(0x6ce5855f),
849 X(0x6cf951f7), X(0x6d0d12b1), X(0x6d20c78c), X(0x6d347087),
850 X(0x6d480da0), X(0x6d5b9ed6), X(0x6d6f2427), X(0x6d829d94),
851 X(0x6d960b1a), X(0x6da96cb9), X(0x6dbcc270), X(0x6dd00c3c),
852 X(0x6de34a1f), X(0x6df67c16), X(0x6e09a221), X(0x6e1cbc3f),
853 X(0x6e2fca6e), X(0x6e42ccaf), X(0x6e55c300), X(0x6e68ad60),
854 X(0x6e7b8bd0), X(0x6e8e5e4d), X(0x6ea124d8), X(0x6eb3df70),
855 X(0x6ec68e13), X(0x6ed930c3), X(0x6eebc77d), X(0x6efe5242),
856 X(0x6f10d111), X(0x6f2343e9), X(0x6f35aacb), X(0x6f4805b5),
857 X(0x6f5a54a8), X(0x6f6c97a2), X(0x6f7ecea4), X(0x6f90f9ae),
858 X(0x6fa318be), X(0x6fb52bd6), X(0x6fc732f4), X(0x6fd92e19),
859 X(0x6feb1d44), X(0x6ffd0076), X(0x700ed7ad), X(0x7020a2eb),
860 X(0x7032622f), X(0x7044157a), X(0x7055bcca), X(0x70675821),
861 X(0x7078e77e), X(0x708a6ae2), X(0x709be24c), X(0x70ad4dbd),
862 X(0x70bead36), X(0x70d000b5), X(0x70e1483d), X(0x70f283cc),
863 X(0x7103b363), X(0x7114d704), X(0x7125eead), X(0x7136fa60),
864 X(0x7147fa1c), X(0x7158ede4), X(0x7169d5b6), X(0x717ab193),
865 X(0x718b817d), X(0x719c4573), X(0x71acfd76), X(0x71bda988),
866 X(0x71ce49a8), X(0x71deddd7), X(0x71ef6617), X(0x71ffe267),
867 X(0x721052ca), X(0x7220b73e), X(0x72310fc6), X(0x72415c62),
868 X(0x72519d14), X(0x7261d1db), X(0x7271faba), X(0x728217b1),
869 X(0x729228c0), X(0x72a22dea), X(0x72b22730), X(0x72c21491),
870 X(0x72d1f611), X(0x72e1cbaf), X(0x72f1956c), X(0x7301534c),
871 X(0x7311054d), X(0x7320ab72), X(0x733045bc), X(0x733fd42d),
872 X(0x734f56c5), X(0x735ecd86), X(0x736e3872), X(0x737d9789),
873 X(0x738ceacf), X(0x739c3243), X(0x73ab6de7), X(0x73ba9dbe),
874 X(0x73c9c1c8), X(0x73d8da08), X(0x73e7e67f), X(0x73f6e72e),
875 X(0x7405dc17), X(0x7414c53c), X(0x7423a29f), X(0x74327442),
876 X(0x74413a26), X(0x744ff44d), X(0x745ea2b9), X(0x746d456c),
877 X(0x747bdc68), X(0x748a67ae), X(0x7498e741), X(0x74a75b23),
878 X(0x74b5c356), X(0x74c41fdb), X(0x74d270b6), X(0x74e0b5e7),
879 X(0x74eeef71), X(0x74fd1d57), X(0x750b3f9a), X(0x7519563c),
880 X(0x75276140), X(0x753560a8), X(0x75435477), X(0x75513cae),
881 X(0x755f1951), X(0x756cea60), X(0x757aafdf), X(0x758869d1),
882 X(0x75961837), X(0x75a3bb14), X(0x75b1526a), X(0x75bede3c),
883 X(0x75cc5e8d), X(0x75d9d35f), X(0x75e73cb5), X(0x75f49a91),
884 X(0x7601ecf6), X(0x760f33e6), X(0x761c6f65), X(0x76299f74),
885 X(0x7636c417), X(0x7643dd51), X(0x7650eb24), X(0x765ded93),
886 X(0x766ae4a0), X(0x7677d050), X(0x7684b0a4), X(0x7691859f),
887 X(0x769e4f45), X(0x76ab0d98), X(0x76b7c09c), X(0x76c46852),
888 X(0x76d104bf), X(0x76dd95e6), X(0x76ea1bc9), X(0x76f6966b),
889 X(0x770305d0), X(0x770f69fb), X(0x771bc2ef), X(0x772810af),
890 X(0x7734533e), X(0x77408aa0), X(0x774cb6d7), X(0x7758d7e8),
891 X(0x7764edd5), X(0x7770f8a2), X(0x777cf852), X(0x7788ece8),
892 X(0x7794d668), X(0x77a0b4d5), X(0x77ac8833), X(0x77b85085),
893 X(0x77c40dce), X(0x77cfc013), X(0x77db6756), X(0x77e7039b),
894 X(0x77f294e6), X(0x77fe1b3b), X(0x7809969c), X(0x7815070e),
895 X(0x78206c93), X(0x782bc731), X(0x783716ea), X(0x78425bc3),
896 X(0x784d95be), X(0x7858c4e1), X(0x7863e92d), X(0x786f02a8),
897 X(0x787a1156), X(0x78851539), X(0x78900e56), X(0x789afcb1),
898 X(0x78a5e04d), X(0x78b0b92f), X(0x78bb875b), X(0x78c64ad4),
899 X(0x78d1039e), X(0x78dbb1be), X(0x78e65537), X(0x78f0ee0e),
900 X(0x78fb7c46), X(0x7905ffe4), X(0x791078ec), X(0x791ae762),
901 X(0x79254b4a), X(0x792fa4a7), X(0x7939f380), X(0x794437d7),
902 X(0x794e71b0), X(0x7958a111), X(0x7962c5fd), X(0x796ce078),
903 X(0x7976f087), X(0x7980f62f), X(0x798af173), X(0x7994e258),
904 X(0x799ec8e2), X(0x79a8a515), X(0x79b276f7), X(0x79bc3e8b),
905 X(0x79c5fbd6), X(0x79cfaedc), X(0x79d957a2), X(0x79e2f62c),
906 X(0x79ec8a7f), X(0x79f6149f), X(0x79ff9492), X(0x7a090a5a),
907 X(0x7a1275fe), X(0x7a1bd781), X(0x7a252ee9), X(0x7a2e7c39),
908 X(0x7a37bf77), X(0x7a40f8a7), X(0x7a4a27ce), X(0x7a534cf0),
909 X(0x7a5c6813), X(0x7a65793b), X(0x7a6e806d), X(0x7a777dad),
910 X(0x7a807100), X(0x7a895a6b), X(0x7a9239f4), X(0x7a9b0f9e),
911 X(0x7aa3db6f), X(0x7aac9d6b), X(0x7ab55597), X(0x7abe03f9),
912 X(0x7ac6a895), X(0x7acf4370), X(0x7ad7d48f), X(0x7ae05bf6),
913 X(0x7ae8d9ac), X(0x7af14db5), X(0x7af9b815), X(0x7b0218d2),
914 X(0x7b0a6ff2), X(0x7b12bd78), X(0x7b1b016a), X(0x7b233bce),
915 X(0x7b2b6ca7), X(0x7b3393fc), X(0x7b3bb1d1), X(0x7b43c62c),
916 X(0x7b4bd111), X(0x7b53d286), X(0x7b5bca90), X(0x7b63b935),
917 X(0x7b6b9e78), X(0x7b737a61), X(0x7b7b4cf3), X(0x7b831634),
918 X(0x7b8ad629), X(0x7b928cd8), X(0x7b9a3a45), X(0x7ba1de77),
919 X(0x7ba97972), X(0x7bb10b3c), X(0x7bb893d9), X(0x7bc01350),
920 X(0x7bc789a6), X(0x7bcef6e0), X(0x7bd65b03), X(0x7bddb616),
921 X(0x7be5081c), X(0x7bec511c), X(0x7bf3911b), X(0x7bfac81f),
922 X(0x7c01f62c), X(0x7c091b49), X(0x7c10377b), X(0x7c174ac7),
923 X(0x7c1e5532), X(0x7c2556c4), X(0x7c2c4f80), X(0x7c333f6c),
924 X(0x7c3a268e), X(0x7c4104ec), X(0x7c47da8a), X(0x7c4ea76f),
925 X(0x7c556ba1), X(0x7c5c2724), X(0x7c62d9fe), X(0x7c698435),
926 X(0x7c7025cf), X(0x7c76bed0), X(0x7c7d4f40), X(0x7c83d723),
927 X(0x7c8a567f), X(0x7c90cd5a), X(0x7c973bb9), X(0x7c9da1a2),
928 X(0x7ca3ff1b), X(0x7caa542a), X(0x7cb0a0d3), X(0x7cb6e51e),
929 X(0x7cbd210f), X(0x7cc354ac), X(0x7cc97ffc), X(0x7ccfa304),
930 X(0x7cd5bdc9), X(0x7cdbd051), X(0x7ce1daa3), X(0x7ce7dcc3),
931 X(0x7cedd6b8), X(0x7cf3c888), X(0x7cf9b238), X(0x7cff93cf),
932 X(0x7d056d51), X(0x7d0b3ec5), X(0x7d110830), X(0x7d16c99a),
933 X(0x7d1c8306), X(0x7d22347c), X(0x7d27de00), X(0x7d2d7f9a),
934 X(0x7d33194f), X(0x7d38ab24), X(0x7d3e351f), X(0x7d43b748),
935 X(0x7d4931a2), X(0x7d4ea435), X(0x7d540f06), X(0x7d59721b),
936 X(0x7d5ecd7b), X(0x7d64212a), X(0x7d696d2f), X(0x7d6eb190),
937 X(0x7d73ee53), X(0x7d79237e), X(0x7d7e5117), X(0x7d837723),
938 X(0x7d8895a9), X(0x7d8dacae), X(0x7d92bc3a), X(0x7d97c451),
939 X(0x7d9cc4f9), X(0x7da1be39), X(0x7da6b017), X(0x7dab9a99),
940 X(0x7db07dc4), X(0x7db5599e), X(0x7dba2e2f), X(0x7dbefb7b),
941 X(0x7dc3c189), X(0x7dc8805e), X(0x7dcd3802), X(0x7dd1e879),
942 X(0x7dd691ca), X(0x7ddb33fb), X(0x7ddfcf12), X(0x7de46315),
943 X(0x7de8f00a), X(0x7ded75f8), X(0x7df1f4e3), X(0x7df66cd3),
944 X(0x7dfaddcd), X(0x7dff47d7), X(0x7e03aaf8), X(0x7e080735),
945 X(0x7e0c5c95), X(0x7e10ab1e), X(0x7e14f2d5), X(0x7e1933c1),
946 X(0x7e1d6de8), X(0x7e21a150), X(0x7e25cdff), X(0x7e29f3fc),
947 X(0x7e2e134c), X(0x7e322bf5), X(0x7e363dfd), X(0x7e3a496b),
948 X(0x7e3e4e45), X(0x7e424c90), X(0x7e464454), X(0x7e4a3595),
949 X(0x7e4e205a), X(0x7e5204aa), X(0x7e55e289), X(0x7e59b9ff),
950 X(0x7e5d8b12), X(0x7e6155c7), X(0x7e651a24), X(0x7e68d831),
951 X(0x7e6c8ff2), X(0x7e70416e), X(0x7e73ecac), X(0x7e7791b0),
952 X(0x7e7b3082), X(0x7e7ec927), X(0x7e825ba6), X(0x7e85e804),
953 X(0x7e896e48), X(0x7e8cee77), X(0x7e906899), X(0x7e93dcb2),
954 X(0x7e974aca), X(0x7e9ab2e5), X(0x7e9e150b), X(0x7ea17141),
955 X(0x7ea4c78e), X(0x7ea817f7), X(0x7eab6283), X(0x7eaea737),
956 X(0x7eb1e61a), X(0x7eb51f33), X(0x7eb85285), X(0x7ebb8019),
957 X(0x7ebea7f4), X(0x7ec1ca1d), X(0x7ec4e698), X(0x7ec7fd6d),
958 X(0x7ecb0ea1), X(0x7ece1a3a), X(0x7ed1203f), X(0x7ed420b6),
959 X(0x7ed71ba4), X(0x7eda110f), X(0x7edd00ff), X(0x7edfeb78),
960 X(0x7ee2d081), X(0x7ee5b01f), X(0x7ee88a5a), X(0x7eeb5f36),
961 X(0x7eee2eba), X(0x7ef0f8ed), X(0x7ef3bdd3), X(0x7ef67d73),
962 X(0x7ef937d3), X(0x7efbecf9), X(0x7efe9ceb), X(0x7f0147ae),
963 X(0x7f03ed4a), X(0x7f068dc4), X(0x7f092922), X(0x7f0bbf69),
964 X(0x7f0e50a1), X(0x7f10dcce), X(0x7f1363f7), X(0x7f15e622),
965 X(0x7f186355), X(0x7f1adb95), X(0x7f1d4ee9), X(0x7f1fbd57),
966 X(0x7f2226e4), X(0x7f248b96), X(0x7f26eb74), X(0x7f294683),
967 X(0x7f2b9cc9), X(0x7f2dee4d), X(0x7f303b13), X(0x7f328322),
968 X(0x7f34c680), X(0x7f370533), X(0x7f393f40), X(0x7f3b74ad),
969 X(0x7f3da581), X(0x7f3fd1c1), X(0x7f41f972), X(0x7f441c9c),
970 X(0x7f463b43), X(0x7f48556d), X(0x7f4a6b21), X(0x7f4c7c64),
971 X(0x7f4e893c), X(0x7f5091ae), X(0x7f5295c1), X(0x7f54957a),
972 X(0x7f5690e0), X(0x7f5887f7), X(0x7f5a7ac5), X(0x7f5c6951),
973 X(0x7f5e53a0), X(0x7f6039b8), X(0x7f621b9e), X(0x7f63f958),
974 X(0x7f65d2ed), X(0x7f67a861), X(0x7f6979ba), X(0x7f6b46ff),
975 X(0x7f6d1034), X(0x7f6ed560), X(0x7f709687), X(0x7f7253b1),
976 X(0x7f740ce1), X(0x7f75c21f), X(0x7f777370), X(0x7f7920d8),
977 X(0x7f7aca5f), X(0x7f7c7008), X(0x7f7e11db), X(0x7f7fafdd),
978 X(0x7f814a13), X(0x7f82e082), X(0x7f847331), X(0x7f860224),
979 X(0x7f878d62), X(0x7f8914f0), X(0x7f8a98d4), X(0x7f8c1912),
980 X(0x7f8d95b0), X(0x7f8f0eb5), X(0x7f908425), X(0x7f91f605),
981 X(0x7f93645c), X(0x7f94cf2f), X(0x7f963683), X(0x7f979a5d),
982 X(0x7f98fac4), X(0x7f9a57bb), X(0x7f9bb14a), X(0x7f9d0775),
983 X(0x7f9e5a41), X(0x7f9fa9b4), X(0x7fa0f5d3), X(0x7fa23ea4),
984 X(0x7fa3842b), X(0x7fa4c66f), X(0x7fa60575), X(0x7fa74141),
985 X(0x7fa879d9), X(0x7fa9af42), X(0x7faae182), X(0x7fac109e),
986 X(0x7fad3c9a), X(0x7fae657d), X(0x7faf8b4c), X(0x7fb0ae0b),
987 X(0x7fb1cdc0), X(0x7fb2ea70), X(0x7fb40420), X(0x7fb51ad5),
988 X(0x7fb62e95), X(0x7fb73f64), X(0x7fb84d48), X(0x7fb95846),
989 X(0x7fba6062), X(0x7fbb65a2), X(0x7fbc680c), X(0x7fbd67a3),
990 X(0x7fbe646d), X(0x7fbf5e70), X(0x7fc055af), X(0x7fc14a31),
991 X(0x7fc23bf9), X(0x7fc32b0d), X(0x7fc41773), X(0x7fc5012e),
992 X(0x7fc5e844), X(0x7fc6ccba), X(0x7fc7ae94), X(0x7fc88dd8),
993 X(0x7fc96a8a), X(0x7fca44af), X(0x7fcb1c4c), X(0x7fcbf167),
994 X(0x7fccc403), X(0x7fcd9425), X(0x7fce61d3), X(0x7fcf2d11),
995 X(0x7fcff5e3), X(0x7fd0bc4f), X(0x7fd1805a), X(0x7fd24207),
996 X(0x7fd3015c), X(0x7fd3be5d), X(0x7fd47910), X(0x7fd53178),
997 X(0x7fd5e79b), X(0x7fd69b7c), X(0x7fd74d21), X(0x7fd7fc8e),
998 X(0x7fd8a9c8), X(0x7fd954d4), X(0x7fd9fdb5), X(0x7fdaa471),
999 X(0x7fdb490b), X(0x7fdbeb89), X(0x7fdc8bef), X(0x7fdd2a42),
1000 X(0x7fddc685), X(0x7fde60be), X(0x7fdef8f0), X(0x7fdf8f20),
1001 X(0x7fe02353), X(0x7fe0b58d), X(0x7fe145d3), X(0x7fe1d428),
1002 X(0x7fe26091), X(0x7fe2eb12), X(0x7fe373b0), X(0x7fe3fa6f),
1003 X(0x7fe47f53), X(0x7fe50260), X(0x7fe5839b), X(0x7fe60308),
1004 X(0x7fe680ab), X(0x7fe6fc88), X(0x7fe776a4), X(0x7fe7ef02),
1005 X(0x7fe865a7), X(0x7fe8da97), X(0x7fe94dd6), X(0x7fe9bf68),
1006 X(0x7fea2f51), X(0x7fea9d95), X(0x7feb0a39), X(0x7feb7540),
1007 X(0x7febdeae), X(0x7fec4687), X(0x7fecaccf), X(0x7fed118b),
1008 X(0x7fed74be), X(0x7fedd66c), X(0x7fee3698), X(0x7fee9548),
1009 X(0x7feef27e), X(0x7fef4e3f), X(0x7fefa88e), X(0x7ff0016f),
1010 X(0x7ff058e7), X(0x7ff0aef8), X(0x7ff103a6), X(0x7ff156f6),
1011 X(0x7ff1a8eb), X(0x7ff1f988), X(0x7ff248d2), X(0x7ff296cc),
1012 X(0x7ff2e37a), X(0x7ff32edf), X(0x7ff378ff), X(0x7ff3c1de),
1013 X(0x7ff4097e), X(0x7ff44fe5), X(0x7ff49515), X(0x7ff4d911),
1014 X(0x7ff51bde), X(0x7ff55d7f), X(0x7ff59df7), X(0x7ff5dd4a),
1015 X(0x7ff61b7b), X(0x7ff6588d), X(0x7ff69485), X(0x7ff6cf65),
1016 X(0x7ff70930), X(0x7ff741eb), X(0x7ff77998), X(0x7ff7b03b),
1017 X(0x7ff7e5d7), X(0x7ff81a6f), X(0x7ff84e06), X(0x7ff880a1),
1018 X(0x7ff8b241), X(0x7ff8e2ea), X(0x7ff912a0), X(0x7ff94165),
1019 X(0x7ff96f3d), X(0x7ff99c2b), X(0x7ff9c831), X(0x7ff9f354),
1020 X(0x7ffa1d95), X(0x7ffa46f9), X(0x7ffa6f81), X(0x7ffa9731),
1021 X(0x7ffabe0d), X(0x7ffae416), X(0x7ffb0951), X(0x7ffb2dbf),
1022 X(0x7ffb5164), X(0x7ffb7442), X(0x7ffb965d), X(0x7ffbb7b8),
1023 X(0x7ffbd854), X(0x7ffbf836), X(0x7ffc175f), X(0x7ffc35d3),
1024 X(0x7ffc5394), X(0x7ffc70a5), X(0x7ffc8d09), X(0x7ffca8c2),
1025 X(0x7ffcc3d4), X(0x7ffcde3f), X(0x7ffcf809), X(0x7ffd1132),
1026 X(0x7ffd29be), X(0x7ffd41ae), X(0x7ffd5907), X(0x7ffd6fc9),
1027 X(0x7ffd85f9), X(0x7ffd9b97), X(0x7ffdb0a7), X(0x7ffdc52b),
1028 X(0x7ffdd926), X(0x7ffdec99), X(0x7ffdff88), X(0x7ffe11f4),
1029 X(0x7ffe23e0), X(0x7ffe354f), X(0x7ffe4642), X(0x7ffe56bc),
1030 X(0x7ffe66bf), X(0x7ffe764e), X(0x7ffe856a), X(0x7ffe9416),
1031 X(0x7ffea254), X(0x7ffeb026), X(0x7ffebd8e), X(0x7ffeca8f),
1032 X(0x7ffed72a), X(0x7ffee362), X(0x7ffeef38), X(0x7ffefaaf),
1033 X(0x7fff05c9), X(0x7fff1087), X(0x7fff1aec), X(0x7fff24f9),
1034 X(0x7fff2eb1), X(0x7fff3816), X(0x7fff4128), X(0x7fff49eb),
1035 X(0x7fff5260), X(0x7fff5a88), X(0x7fff6266), X(0x7fff69fc),
1036 X(0x7fff714b), X(0x7fff7854), X(0x7fff7f1a), X(0x7fff859f),
1037 X(0x7fff8be3), X(0x7fff91ea), X(0x7fff97b3), X(0x7fff9d41),
1038 X(0x7fffa296), X(0x7fffa7b3), X(0x7fffac99), X(0x7fffb14b),
1039 X(0x7fffb5c9), X(0x7fffba15), X(0x7fffbe31), X(0x7fffc21d),
1040 X(0x7fffc5dc), X(0x7fffc96f), X(0x7fffccd8), X(0x7fffd016),
1041 X(0x7fffd32d), X(0x7fffd61c), X(0x7fffd8e7), X(0x7fffdb8d),
1042 X(0x7fffde0f), X(0x7fffe071), X(0x7fffe2b1), X(0x7fffe4d2),
1043 X(0x7fffe6d5), X(0x7fffe8bb), X(0x7fffea85), X(0x7fffec34),
1044 X(0x7fffedc9), X(0x7fffef45), X(0x7ffff0aa), X(0x7ffff1f7),
1045 X(0x7ffff330), X(0x7ffff453), X(0x7ffff562), X(0x7ffff65f),
1046 X(0x7ffff749), X(0x7ffff823), X(0x7ffff8ec), X(0x7ffff9a6),
1047 X(0x7ffffa51), X(0x7ffffaee), X(0x7ffffb7e), X(0x7ffffc02),
1048 X(0x7ffffc7a), X(0x7ffffce7), X(0x7ffffd4a), X(0x7ffffda3),
1049 X(0x7ffffdf4), X(0x7ffffe3c), X(0x7ffffe7c), X(0x7ffffeb6),
1050 X(0x7ffffee8), X(0x7fffff15), X(0x7fffff3c), X(0x7fffff5e),
1051 X(0x7fffff7b), X(0x7fffff95), X(0x7fffffaa), X(0x7fffffbc),
1052 X(0x7fffffcb), X(0x7fffffd7), X(0x7fffffe2), X(0x7fffffea),
1053 X(0x7ffffff0), X(0x7ffffff5), X(0x7ffffff9), X(0x7ffffffb),
1054 X(0x7ffffffd), X(0x7ffffffe), X(0x7fffffff), X(0x7fffffff),
1055 X(0x7fffffff), X(0x7fffffff), X(0x7fffffff), X(0x7fffffff),
1056};
1057
1058static LOOKUP_T vwin8192[4096] = {
1059 X(0x0000007c), X(0x0000045c), X(0x00000c1d), X(0x000017bd),
1060 X(0x0000273e), X(0x00003a9f), X(0x000051e0), X(0x00006d02),
1061 X(0x00008c03), X(0x0000aee5), X(0x0000d5a7), X(0x00010049),
1062 X(0x00012ecb), X(0x0001612d), X(0x00019770), X(0x0001d193),
1063 X(0x00020f96), X(0x00025178), X(0x0002973c), X(0x0002e0df),
1064 X(0x00032e62), X(0x00037fc5), X(0x0003d509), X(0x00042e2c),
1065 X(0x00048b30), X(0x0004ec13), X(0x000550d7), X(0x0005b97a),
1066 X(0x000625fe), X(0x00069661), X(0x00070aa4), X(0x000782c8),
1067 X(0x0007fecb), X(0x00087eae), X(0x00090271), X(0x00098a14),
1068 X(0x000a1597), X(0x000aa4f9), X(0x000b383b), X(0x000bcf5d),
1069 X(0x000c6a5f), X(0x000d0941), X(0x000dac02), X(0x000e52a3),
1070 X(0x000efd23), X(0x000fab84), X(0x00105dc3), X(0x001113e3),
1071 X(0x0011cde2), X(0x00128bc0), X(0x00134d7e), X(0x0014131b),
1072 X(0x0014dc98), X(0x0015a9f4), X(0x00167b30), X(0x0017504a),
1073 X(0x00182945), X(0x0019061e), X(0x0019e6d7), X(0x001acb6f),
1074 X(0x001bb3e6), X(0x001ca03c), X(0x001d9071), X(0x001e8485),
1075 X(0x001f7c79), X(0x0020784b), X(0x002177fc), X(0x00227b8c),
1076 X(0x002382fb), X(0x00248e49), X(0x00259d76), X(0x0026b081),
1077 X(0x0027c76b), X(0x0028e234), X(0x002a00dc), X(0x002b2361),
1078 X(0x002c49c6), X(0x002d7409), X(0x002ea22a), X(0x002fd42a),
1079 X(0x00310a08), X(0x003243c5), X(0x00338160), X(0x0034c2d9),
1080 X(0x00360830), X(0x00375165), X(0x00389e78), X(0x0039ef6a),
1081 X(0x003b4439), X(0x003c9ce6), X(0x003df971), X(0x003f59da),
1082 X(0x0040be20), X(0x00422645), X(0x00439247), X(0x00450226),
1083 X(0x004675e3), X(0x0047ed7e), X(0x004968f5), X(0x004ae84b),
1084 X(0x004c6b7d), X(0x004df28d), X(0x004f7d7a), X(0x00510c44),
1085 X(0x00529eeb), X(0x00543570), X(0x0055cfd1), X(0x00576e0f),
1086 X(0x00591029), X(0x005ab621), X(0x005c5ff5), X(0x005e0da6),
1087 X(0x005fbf33), X(0x0061749d), X(0x00632de4), X(0x0064eb06),
1088 X(0x0066ac05), X(0x006870e0), X(0x006a3998), X(0x006c062b),
1089 X(0x006dd69b), X(0x006faae6), X(0x0071830d), X(0x00735f10),
1090 X(0x00753eef), X(0x007722a9), X(0x00790a3f), X(0x007af5b1),
1091 X(0x007ce4fe), X(0x007ed826), X(0x0080cf29), X(0x0082ca08),
1092 X(0x0084c8c2), X(0x0086cb57), X(0x0088d1c7), X(0x008adc11),
1093 X(0x008cea37), X(0x008efc37), X(0x00911212), X(0x00932bc7),
1094 X(0x00954957), X(0x00976ac2), X(0x00999006), X(0x009bb925),
1095 X(0x009de61e), X(0x00a016f1), X(0x00a24b9e), X(0x00a48425),
1096 X(0x00a6c086), X(0x00a900c0), X(0x00ab44d4), X(0x00ad8cc2),
1097 X(0x00afd889), X(0x00b22829), X(0x00b47ba2), X(0x00b6d2f5),
1098 X(0x00b92e21), X(0x00bb8d26), X(0x00bdf004), X(0x00c056ba),
1099 X(0x00c2c149), X(0x00c52fb1), X(0x00c7a1f1), X(0x00ca180a),
1100 X(0x00cc91fb), X(0x00cf0fc5), X(0x00d19166), X(0x00d416df),
1101 X(0x00d6a031), X(0x00d92d5a), X(0x00dbbe5b), X(0x00de5333),
1102 X(0x00e0ebe3), X(0x00e3886b), X(0x00e628c9), X(0x00e8ccff),
1103 X(0x00eb750c), X(0x00ee20f0), X(0x00f0d0ab), X(0x00f3843d),
1104 X(0x00f63ba5), X(0x00f8f6e4), X(0x00fbb5fa), X(0x00fe78e5),
1105 X(0x01013fa7), X(0x01040a3f), X(0x0106d8ae), X(0x0109aaf2),
1106 X(0x010c810c), X(0x010f5afb), X(0x011238c0), X(0x01151a5b),
1107 X(0x0117ffcb), X(0x011ae910), X(0x011dd62a), X(0x0120c719),
1108 X(0x0123bbdd), X(0x0126b476), X(0x0129b0e4), X(0x012cb126),
1109 X(0x012fb53c), X(0x0132bd27), X(0x0135c8e6), X(0x0138d879),
1110 X(0x013bebdf), X(0x013f031a), X(0x01421e28), X(0x01453d0a),
1111 X(0x01485fbf), X(0x014b8648), X(0x014eb0a4), X(0x0151ded2),
1112 X(0x015510d4), X(0x015846a8), X(0x015b8050), X(0x015ebdc9),
1113 X(0x0161ff15), X(0x01654434), X(0x01688d24), X(0x016bd9e6),
1114 X(0x016f2a7b), X(0x01727ee1), X(0x0175d718), X(0x01793321),
1115 X(0x017c92fc), X(0x017ff6a7), X(0x01835e24), X(0x0186c972),
1116 X(0x018a3890), X(0x018dab7f), X(0x0191223f), X(0x01949ccf),
1117 X(0x01981b2f), X(0x019b9d5f), X(0x019f235f), X(0x01a2ad2f),
1118 X(0x01a63acf), X(0x01a9cc3e), X(0x01ad617c), X(0x01b0fa8a),
1119 X(0x01b49767), X(0x01b83813), X(0x01bbdc8d), X(0x01bf84d6),
1120 X(0x01c330ee), X(0x01c6e0d4), X(0x01ca9488), X(0x01ce4c0b),
1121 X(0x01d2075b), X(0x01d5c679), X(0x01d98964), X(0x01dd501d),
1122 X(0x01e11aa3), X(0x01e4e8f6), X(0x01e8bb17), X(0x01ec9104),
1123 X(0x01f06abd), X(0x01f44844), X(0x01f82996), X(0x01fc0eb5),
1124 X(0x01fff7a0), X(0x0203e456), X(0x0207d4d9), X(0x020bc926),
1125 X(0x020fc140), X(0x0213bd24), X(0x0217bcd4), X(0x021bc04e),
1126 X(0x021fc793), X(0x0223d2a3), X(0x0227e17d), X(0x022bf421),
1127 X(0x02300a90), X(0x023424c8), X(0x023842ca), X(0x023c6495),
1128 X(0x02408a2a), X(0x0244b389), X(0x0248e0b0), X(0x024d11a0),
1129 X(0x02514659), X(0x02557eda), X(0x0259bb24), X(0x025dfb35),
1130 X(0x02623f0f), X(0x026686b1), X(0x026ad21a), X(0x026f214b),
1131 X(0x02737443), X(0x0277cb02), X(0x027c2588), X(0x028083d5),
1132 X(0x0284e5e9), X(0x02894bc2), X(0x028db562), X(0x029222c8),
1133 X(0x029693f4), X(0x029b08e6), X(0x029f819d), X(0x02a3fe19),
1134 X(0x02a87e5b), X(0x02ad0261), X(0x02b18a2c), X(0x02b615bb),
1135 X(0x02baa50f), X(0x02bf3827), X(0x02c3cf03), X(0x02c869a3),
1136 X(0x02cd0807), X(0x02d1aa2d), X(0x02d65017), X(0x02daf9c4),
1137 X(0x02dfa734), X(0x02e45866), X(0x02e90d5b), X(0x02edc612),
1138 X(0x02f2828b), X(0x02f742c6), X(0x02fc06c3), X(0x0300ce80),
1139 X(0x030599ff), X(0x030a6940), X(0x030f3c40), X(0x03141302),
1140 X(0x0318ed84), X(0x031dcbc6), X(0x0322adc8), X(0x0327938a),
1141 X(0x032c7d0c), X(0x03316a4c), X(0x03365b4d), X(0x033b500c),
1142 X(0x03404889), X(0x034544c6), X(0x034a44c0), X(0x034f4879),
1143 X(0x03544ff0), X(0x03595b24), X(0x035e6a16), X(0x03637cc5),
1144 X(0x03689331), X(0x036dad5a), X(0x0372cb40), X(0x0377ece2),
1145 X(0x037d1240), X(0x03823b5a), X(0x03876830), X(0x038c98c1),
1146 X(0x0391cd0e), X(0x03970516), X(0x039c40d8), X(0x03a18055),
1147 X(0x03a6c38d), X(0x03ac0a7f), X(0x03b1552b), X(0x03b6a390),
1148 X(0x03bbf5af), X(0x03c14b88), X(0x03c6a519), X(0x03cc0263),
1149 X(0x03d16366), X(0x03d6c821), X(0x03dc3094), X(0x03e19cc0),
1150 X(0x03e70ca2), X(0x03ec803d), X(0x03f1f78e), X(0x03f77296),
1151 X(0x03fcf155), X(0x040273cb), X(0x0407f9f7), X(0x040d83d9),
1152 X(0x04131170), X(0x0418a2bd), X(0x041e37c0), X(0x0423d077),
1153 X(0x04296ce4), X(0x042f0d04), X(0x0434b0da), X(0x043a5863),
1154 X(0x044003a0), X(0x0445b290), X(0x044b6534), X(0x04511b8b),
1155 X(0x0456d595), X(0x045c9352), X(0x046254c1), X(0x046819e1),
1156 X(0x046de2b4), X(0x0473af39), X(0x04797f6e), X(0x047f5355),
1157 X(0x04852aec), X(0x048b0635), X(0x0490e52d), X(0x0496c7d6),
1158 X(0x049cae2e), X(0x04a29836), X(0x04a885ed), X(0x04ae7753),
1159 X(0x04b46c68), X(0x04ba652b), X(0x04c0619d), X(0x04c661bc),
1160 X(0x04cc658a), X(0x04d26d04), X(0x04d8782c), X(0x04de8701),
1161 X(0x04e49983), X(0x04eaafb0), X(0x04f0c98a), X(0x04f6e710),
1162 X(0x04fd0842), X(0x05032d1e), X(0x050955a6), X(0x050f81d8),
1163 X(0x0515b1b5), X(0x051be53d), X(0x05221c6e), X(0x05285748),
1164 X(0x052e95cd), X(0x0534d7fa), X(0x053b1dd0), X(0x0541674e),
1165 X(0x0547b475), X(0x054e0544), X(0x055459bb), X(0x055ab1d9),
1166 X(0x05610d9e), X(0x05676d0a), X(0x056dd01c), X(0x057436d5),
1167 X(0x057aa134), X(0x05810f38), X(0x058780e2), X(0x058df631),
1168 X(0x05946f25), X(0x059aebbe), X(0x05a16bfa), X(0x05a7efdb),
1169 X(0x05ae775f), X(0x05b50287), X(0x05bb9152), X(0x05c223c0),
1170 X(0x05c8b9d0), X(0x05cf5382), X(0x05d5f0d6), X(0x05dc91cc),
1171 X(0x05e33663), X(0x05e9de9c), X(0x05f08a75), X(0x05f739ee),
1172 X(0x05fded07), X(0x0604a3c0), X(0x060b5e19), X(0x06121c11),
1173 X(0x0618dda8), X(0x061fa2dd), X(0x06266bb1), X(0x062d3822),
1174 X(0x06340831), X(0x063adbde), X(0x0641b328), X(0x06488e0e),
1175 X(0x064f6c91), X(0x06564eaf), X(0x065d346a), X(0x06641dc0),
1176 X(0x066b0ab1), X(0x0671fb3d), X(0x0678ef64), X(0x067fe724),
1177 X(0x0686e27f), X(0x068de173), X(0x0694e400), X(0x069bea27),
1178 X(0x06a2f3e6), X(0x06aa013d), X(0x06b1122c), X(0x06b826b3),
1179 X(0x06bf3ed1), X(0x06c65a86), X(0x06cd79d1), X(0x06d49cb3),
1180 X(0x06dbc32b), X(0x06e2ed38), X(0x06ea1adb), X(0x06f14c13),
1181 X(0x06f880df), X(0x06ffb940), X(0x0706f535), X(0x070e34bd),
1182 X(0x071577d9), X(0x071cbe88), X(0x072408c9), X(0x072b569d),
1183 X(0x0732a802), X(0x0739fcf9), X(0x07415582), X(0x0748b19b),
1184 X(0x07501145), X(0x0757747f), X(0x075edb49), X(0x076645a3),
1185 X(0x076db38c), X(0x07752503), X(0x077c9a09), X(0x0784129e),
1186 X(0x078b8ec0), X(0x07930e70), X(0x079a91ac), X(0x07a21876),
1187 X(0x07a9a2cc), X(0x07b130ad), X(0x07b8c21b), X(0x07c05714),
1188 X(0x07c7ef98), X(0x07cf8ba6), X(0x07d72b3f), X(0x07dece62),
1189 X(0x07e6750e), X(0x07ee1f43), X(0x07f5cd01), X(0x07fd7e48),
1190 X(0x08053316), X(0x080ceb6d), X(0x0814a74a), X(0x081c66af),
1191 X(0x0824299a), X(0x082bf00c), X(0x0833ba03), X(0x083b8780),
1192 X(0x08435882), X(0x084b2d09), X(0x08530514), X(0x085ae0a3),
1193 X(0x0862bfb6), X(0x086aa24c), X(0x08728865), X(0x087a7201),
1194 X(0x08825f1e), X(0x088a4fbe), X(0x089243de), X(0x089a3b80),
1195 X(0x08a236a2), X(0x08aa3545), X(0x08b23767), X(0x08ba3d09),
1196 X(0x08c2462a), X(0x08ca52c9), X(0x08d262e7), X(0x08da7682),
1197 X(0x08e28d9c), X(0x08eaa832), X(0x08f2c645), X(0x08fae7d4),
1198 X(0x09030cdf), X(0x090b3566), X(0x09136168), X(0x091b90e5),
1199 X(0x0923c3dc), X(0x092bfa4d), X(0x09343437), X(0x093c719b),
1200 X(0x0944b277), X(0x094cf6cc), X(0x09553e99), X(0x095d89dd),
1201 X(0x0965d899), X(0x096e2acb), X(0x09768073), X(0x097ed991),
1202 X(0x09873625), X(0x098f962e), X(0x0997f9ac), X(0x09a0609e),
1203 X(0x09a8cb04), X(0x09b138dd), X(0x09b9aa29), X(0x09c21ee8),
1204 X(0x09ca9719), X(0x09d312bc), X(0x09db91d0), X(0x09e41456),
1205 X(0x09ec9a4b), X(0x09f523b1), X(0x09fdb087), X(0x0a0640cc),
1206 X(0x0a0ed47f), X(0x0a176ba2), X(0x0a200632), X(0x0a28a42f),
1207 X(0x0a31459a), X(0x0a39ea72), X(0x0a4292b5), X(0x0a4b3e65),
1208 X(0x0a53ed80), X(0x0a5ca006), X(0x0a6555f7), X(0x0a6e0f51),
1209 X(0x0a76cc16), X(0x0a7f8c44), X(0x0a884fda), X(0x0a9116d9),
1210 X(0x0a99e140), X(0x0aa2af0e), X(0x0aab8043), X(0x0ab454df),
1211 X(0x0abd2ce1), X(0x0ac60849), X(0x0acee716), X(0x0ad7c948),
1212 X(0x0ae0aedf), X(0x0ae997d9), X(0x0af28437), X(0x0afb73f7),
1213 X(0x0b04671b), X(0x0b0d5da0), X(0x0b165788), X(0x0b1f54d0),
1214 X(0x0b285579), X(0x0b315983), X(0x0b3a60ec), X(0x0b436bb5),
1215 X(0x0b4c79dd), X(0x0b558b63), X(0x0b5ea048), X(0x0b67b88a),
1216 X(0x0b70d429), X(0x0b79f324), X(0x0b83157c), X(0x0b8c3b30),
1217 X(0x0b95643f), X(0x0b9e90a8), X(0x0ba7c06c), X(0x0bb0f38a),
1218 X(0x0bba2a01), X(0x0bc363d1), X(0x0bcca0f9), X(0x0bd5e17a),
1219 X(0x0bdf2552), X(0x0be86c81), X(0x0bf1b706), X(0x0bfb04e2),
1220 X(0x0c045613), X(0x0c0daa99), X(0x0c170274), X(0x0c205da3),
1221 X(0x0c29bc25), X(0x0c331dfb), X(0x0c3c8323), X(0x0c45eb9e),
1222 X(0x0c4f576a), X(0x0c58c688), X(0x0c6238f6), X(0x0c6baeb5),
1223 X(0x0c7527c3), X(0x0c7ea421), X(0x0c8823cd), X(0x0c91a6c8),
1224 X(0x0c9b2d10), X(0x0ca4b6a6), X(0x0cae4389), X(0x0cb7d3b8),
1225 X(0x0cc16732), X(0x0ccafdf8), X(0x0cd49809), X(0x0cde3564),
1226 X(0x0ce7d609), X(0x0cf179f7), X(0x0cfb212e), X(0x0d04cbad),
1227 X(0x0d0e7974), X(0x0d182a83), X(0x0d21ded8), X(0x0d2b9673),
1228 X(0x0d355154), X(0x0d3f0f7b), X(0x0d48d0e6), X(0x0d529595),
1229 X(0x0d5c5d88), X(0x0d6628be), X(0x0d6ff737), X(0x0d79c8f2),
1230 X(0x0d839dee), X(0x0d8d762c), X(0x0d9751aa), X(0x0da13068),
1231 X(0x0dab1266), X(0x0db4f7a3), X(0x0dbee01e), X(0x0dc8cbd8),
1232 X(0x0dd2bace), X(0x0ddcad02), X(0x0de6a272), X(0x0df09b1e),
1233 X(0x0dfa9705), X(0x0e049627), X(0x0e0e9883), X(0x0e189e19),
1234 X(0x0e22a6e8), X(0x0e2cb2f0), X(0x0e36c230), X(0x0e40d4a8),
1235 X(0x0e4aea56), X(0x0e55033b), X(0x0e5f1f56), X(0x0e693ea7),
1236 X(0x0e73612c), X(0x0e7d86e5), X(0x0e87afd3), X(0x0e91dbf3),
1237 X(0x0e9c0b47), X(0x0ea63dcc), X(0x0eb07383), X(0x0ebaac6b),
1238 X(0x0ec4e883), X(0x0ecf27cc), X(0x0ed96a44), X(0x0ee3afea),
1239 X(0x0eedf8bf), X(0x0ef844c2), X(0x0f0293f2), X(0x0f0ce64e),
1240 X(0x0f173bd6), X(0x0f21948a), X(0x0f2bf069), X(0x0f364f72),
1241 X(0x0f40b1a5), X(0x0f4b1701), X(0x0f557f86), X(0x0f5feb32),
1242 X(0x0f6a5a07), X(0x0f74cc02), X(0x0f7f4124), X(0x0f89b96b),
1243 X(0x0f9434d8), X(0x0f9eb369), X(0x0fa9351e), X(0x0fb3b9f7),
1244 X(0x0fbe41f3), X(0x0fc8cd11), X(0x0fd35b51), X(0x0fddecb2),
1245 X(0x0fe88134), X(0x0ff318d6), X(0x0ffdb397), X(0x10085177),
1246 X(0x1012f275), X(0x101d9691), X(0x10283dca), X(0x1032e81f),
1247 X(0x103d9591), X(0x1048461e), X(0x1052f9c5), X(0x105db087),
1248 X(0x10686a62), X(0x10732756), X(0x107de763), X(0x1088aa87),
1249 X(0x109370c2), X(0x109e3a14), X(0x10a9067c), X(0x10b3d5f9),
1250 X(0x10bea88b), X(0x10c97e31), X(0x10d456eb), X(0x10df32b8),
1251 X(0x10ea1197), X(0x10f4f387), X(0x10ffd889), X(0x110ac09b),
1252 X(0x1115abbe), X(0x112099ef), X(0x112b8b2f), X(0x11367f7d),
1253 X(0x114176d9), X(0x114c7141), X(0x11576eb6), X(0x11626f36),
1254 X(0x116d72c1), X(0x11787957), X(0x118382f6), X(0x118e8f9e),
1255 X(0x11999f4f), X(0x11a4b208), X(0x11afc7c7), X(0x11bae08e),
1256 X(0x11c5fc5a), X(0x11d11b2c), X(0x11dc3d02), X(0x11e761dd),
1257 X(0x11f289ba), X(0x11fdb49b), X(0x1208e27e), X(0x12141362),
1258 X(0x121f4748), X(0x122a7e2d), X(0x1235b812), X(0x1240f4f6),
1259 X(0x124c34d9), X(0x125777b9), X(0x1262bd96), X(0x126e0670),
1260 X(0x12795245), X(0x1284a115), X(0x128ff2e0), X(0x129b47a5),
1261 X(0x12a69f63), X(0x12b1fa19), X(0x12bd57c7), X(0x12c8b86c),
1262 X(0x12d41c08), X(0x12df829a), X(0x12eaec21), X(0x12f6589d),
1263 X(0x1301c80c), X(0x130d3a6f), X(0x1318afc4), X(0x1324280b),
1264 X(0x132fa344), X(0x133b216d), X(0x1346a286), X(0x1352268e),
1265 X(0x135dad85), X(0x1369376a), X(0x1374c43c), X(0x138053fb),
1266 X(0x138be6a5), X(0x13977c3b), X(0x13a314bc), X(0x13aeb026),
1267 X(0x13ba4e79), X(0x13c5efb5), X(0x13d193d9), X(0x13dd3ae4),
1268 X(0x13e8e4d6), X(0x13f491ad), X(0x1400416a), X(0x140bf40b),
1269 X(0x1417a98f), X(0x142361f7), X(0x142f1d41), X(0x143adb6d),
1270 X(0x14469c7a), X(0x14526067), X(0x145e2734), X(0x1469f0df),
1271 X(0x1475bd69), X(0x14818cd0), X(0x148d5f15), X(0x14993435),
1272 X(0x14a50c31), X(0x14b0e708), X(0x14bcc4b8), X(0x14c8a542),
1273 X(0x14d488a5), X(0x14e06edf), X(0x14ec57f1), X(0x14f843d9),
1274 X(0x15043297), X(0x1510242b), X(0x151c1892), X(0x15280fcd),
1275 X(0x153409dc), X(0x154006bc), X(0x154c066e), X(0x155808f1),
1276 X(0x15640e44), X(0x15701666), X(0x157c2157), X(0x15882f16),
1277 X(0x15943fa2), X(0x15a052fb), X(0x15ac691f), X(0x15b8820f),
1278 X(0x15c49dc8), X(0x15d0bc4c), X(0x15dcdd98), X(0x15e901ad),
1279 X(0x15f52888), X(0x1601522b), X(0x160d7e93), X(0x1619adc1),
1280 X(0x1625dfb3), X(0x16321469), X(0x163e4be2), X(0x164a861d),
1281 X(0x1656c31a), X(0x166302d8), X(0x166f4555), X(0x167b8a92),
1282 X(0x1687d28e), X(0x16941d47), X(0x16a06abe), X(0x16acbaf0),
1283 X(0x16b90ddf), X(0x16c56388), X(0x16d1bbeb), X(0x16de1708),
1284 X(0x16ea74dd), X(0x16f6d56a), X(0x170338ae), X(0x170f9ea8),
1285 X(0x171c0758), X(0x172872bd), X(0x1734e0d6), X(0x174151a2),
1286 X(0x174dc520), X(0x175a3b51), X(0x1766b432), X(0x17732fc4),
1287 X(0x177fae05), X(0x178c2ef4), X(0x1798b292), X(0x17a538dd),
1288 X(0x17b1c1d4), X(0x17be4d77), X(0x17cadbc5), X(0x17d76cbc),
1289 X(0x17e4005e), X(0x17f096a7), X(0x17fd2f98), X(0x1809cb31),
1290 X(0x1816696f), X(0x18230a53), X(0x182faddc), X(0x183c5408),
1291 X(0x1848fcd8), X(0x1855a849), X(0x1862565d), X(0x186f0711),
1292 X(0x187bba64), X(0x18887057), X(0x189528e9), X(0x18a1e418),
1293 X(0x18aea1e3), X(0x18bb624b), X(0x18c8254e), X(0x18d4eaeb),
1294 X(0x18e1b321), X(0x18ee7df1), X(0x18fb4b58), X(0x19081b57),
1295 X(0x1914edec), X(0x1921c317), X(0x192e9ad6), X(0x193b7529),
1296 X(0x19485210), X(0x19553189), X(0x19621393), X(0x196ef82e),
1297 X(0x197bdf59), X(0x1988c913), X(0x1995b55c), X(0x19a2a432),
1298 X(0x19af9595), X(0x19bc8983), X(0x19c97ffd), X(0x19d67900),
1299 X(0x19e3748e), X(0x19f072a3), X(0x19fd7341), X(0x1a0a7665),
1300 X(0x1a177c10), X(0x1a248440), X(0x1a318ef4), X(0x1a3e9c2c),
1301 X(0x1a4babe7), X(0x1a58be24), X(0x1a65d2e2), X(0x1a72ea20),
1302 X(0x1a8003de), X(0x1a8d201a), X(0x1a9a3ed5), X(0x1aa7600c),
1303 X(0x1ab483bf), X(0x1ac1a9ee), X(0x1aced297), X(0x1adbfdba),
1304 X(0x1ae92b56), X(0x1af65b69), X(0x1b038df4), X(0x1b10c2f5),
1305 X(0x1b1dfa6b), X(0x1b2b3456), X(0x1b3870b5), X(0x1b45af87),
1306 X(0x1b52f0ca), X(0x1b60347f), X(0x1b6d7aa4), X(0x1b7ac339),
1307 X(0x1b880e3c), X(0x1b955bad), X(0x1ba2ab8b), X(0x1baffdd5),
1308 X(0x1bbd528a), X(0x1bcaa9a9), X(0x1bd80332), X(0x1be55f24),
1309 X(0x1bf2bd7d), X(0x1c001e3d), X(0x1c0d8164), X(0x1c1ae6ef),
1310 X(0x1c284edf), X(0x1c35b932), X(0x1c4325e7), X(0x1c5094fe),
1311 X(0x1c5e0677), X(0x1c6b7a4f), X(0x1c78f086), X(0x1c86691b),
1312 X(0x1c93e40d), X(0x1ca1615c), X(0x1caee107), X(0x1cbc630c),
1313 X(0x1cc9e76b), X(0x1cd76e23), X(0x1ce4f733), X(0x1cf2829a),
1314 X(0x1d001057), X(0x1d0da06a), X(0x1d1b32d1), X(0x1d28c78c),
1315 X(0x1d365e9a), X(0x1d43f7f9), X(0x1d5193a9), X(0x1d5f31aa),
1316 X(0x1d6cd1f9), X(0x1d7a7497), X(0x1d881982), X(0x1d95c0ba),
1317 X(0x1da36a3d), X(0x1db1160a), X(0x1dbec422), X(0x1dcc7482),
1318 X(0x1dda272b), X(0x1de7dc1a), X(0x1df59350), X(0x1e034ccb),
1319 X(0x1e11088a), X(0x1e1ec68c), X(0x1e2c86d1), X(0x1e3a4958),
1320 X(0x1e480e20), X(0x1e55d527), X(0x1e639e6d), X(0x1e7169f1),
1321 X(0x1e7f37b2), X(0x1e8d07b0), X(0x1e9ad9e8), X(0x1ea8ae5b),
1322 X(0x1eb68507), X(0x1ec45dec), X(0x1ed23908), X(0x1ee0165b),
1323 X(0x1eedf5e4), X(0x1efbd7a1), X(0x1f09bb92), X(0x1f17a1b6),
1324 X(0x1f258a0d), X(0x1f337494), X(0x1f41614b), X(0x1f4f5032),
1325 X(0x1f5d4147), X(0x1f6b3489), X(0x1f7929f7), X(0x1f872192),
1326 X(0x1f951b56), X(0x1fa31744), X(0x1fb1155b), X(0x1fbf159a),
1327 X(0x1fcd17ff), X(0x1fdb1c8b), X(0x1fe9233b), X(0x1ff72c0f),
1328 X(0x20053706), X(0x20134420), X(0x2021535a), X(0x202f64b4),
1329 X(0x203d782e), X(0x204b8dc6), X(0x2059a57c), X(0x2067bf4e),
1330 X(0x2075db3b), X(0x2083f943), X(0x20921964), X(0x20a03b9e),
1331 X(0x20ae5fef), X(0x20bc8657), X(0x20caaed5), X(0x20d8d967),
1332 X(0x20e7060e), X(0x20f534c7), X(0x21036592), X(0x2111986e),
1333 X(0x211fcd59), X(0x212e0454), X(0x213c3d5d), X(0x214a7873),
1334 X(0x2158b594), X(0x2166f4c1), X(0x217535f8), X(0x21837938),
1335 X(0x2191be81), X(0x21a005d0), X(0x21ae4f26), X(0x21bc9a81),
1336 X(0x21cae7e0), X(0x21d93743), X(0x21e788a8), X(0x21f5dc0e),
1337 X(0x22043174), X(0x221288da), X(0x2220e23e), X(0x222f3da0),
1338 X(0x223d9afe), X(0x224bfa58), X(0x225a5bac), X(0x2268bef9),
1339 X(0x2277243f), X(0x22858b7d), X(0x2293f4b0), X(0x22a25fda),
1340 X(0x22b0ccf8), X(0x22bf3c09), X(0x22cdad0d), X(0x22dc2002),
1341 X(0x22ea94e8), X(0x22f90bbe), X(0x23078482), X(0x2315ff33),
1342 X(0x23247bd1), X(0x2332fa5b), X(0x23417acf), X(0x234ffd2c),
1343 X(0x235e8173), X(0x236d07a0), X(0x237b8fb4), X(0x238a19ae),
1344 X(0x2398a58c), X(0x23a7334d), X(0x23b5c2f1), X(0x23c45477),
1345 X(0x23d2e7dd), X(0x23e17d22), X(0x23f01446), X(0x23fead47),
1346 X(0x240d4825), X(0x241be4dd), X(0x242a8371), X(0x243923dd),
1347 X(0x2447c622), X(0x24566a3e), X(0x24651031), X(0x2473b7f8),
1348 X(0x24826194), X(0x24910d03), X(0x249fba44), X(0x24ae6957),
1349 X(0x24bd1a39), X(0x24cbccea), X(0x24da816a), X(0x24e937b7),
1350 X(0x24f7efcf), X(0x2506a9b3), X(0x25156560), X(0x252422d6),
1351 X(0x2532e215), X(0x2541a31a), X(0x255065e4), X(0x255f2a74),
1352 X(0x256df0c7), X(0x257cb8dd), X(0x258b82b4), X(0x259a4e4c),
1353 X(0x25a91ba4), X(0x25b7eaba), X(0x25c6bb8e), X(0x25d58e1e),
1354 X(0x25e46269), X(0x25f3386e), X(0x2602102d), X(0x2610e9a4),
1355 X(0x261fc4d3), X(0x262ea1b7), X(0x263d8050), X(0x264c609e),
1356 X(0x265b429e), X(0x266a2650), X(0x26790bb3), X(0x2687f2c6),
1357 X(0x2696db88), X(0x26a5c5f7), X(0x26b4b213), X(0x26c39fda),
1358 X(0x26d28f4c), X(0x26e18067), X(0x26f0732b), X(0x26ff6796),
1359 X(0x270e5da7), X(0x271d555d), X(0x272c4eb7), X(0x273b49b5),
1360 X(0x274a4654), X(0x27594495), X(0x27684475), X(0x277745f4),
1361 X(0x27864910), X(0x27954dc9), X(0x27a4541e), X(0x27b35c0d),
1362 X(0x27c26596), X(0x27d170b7), X(0x27e07d6f), X(0x27ef8bbd),
1363 X(0x27fe9ba0), X(0x280dad18), X(0x281cc022), X(0x282bd4be),
1364 X(0x283aeaeb), X(0x284a02a7), X(0x28591bf2), X(0x286836cb),
1365 X(0x28775330), X(0x28867120), X(0x2895909b), X(0x28a4b19e),
1366 X(0x28b3d42a), X(0x28c2f83d), X(0x28d21dd5), X(0x28e144f3),
1367 X(0x28f06d94), X(0x28ff97b8), X(0x290ec35d), X(0x291df082),
1368 X(0x292d1f27), X(0x293c4f4a), X(0x294b80eb), X(0x295ab407),
1369 X(0x2969e89e), X(0x29791eaf), X(0x29885639), X(0x29978f3b),
1370 X(0x29a6c9b3), X(0x29b605a0), X(0x29c54302), X(0x29d481d7),
1371 X(0x29e3c21e), X(0x29f303d6), X(0x2a0246fd), X(0x2a118b94),
1372 X(0x2a20d198), X(0x2a301909), X(0x2a3f61e6), X(0x2a4eac2c),
1373 X(0x2a5df7dc), X(0x2a6d44f4), X(0x2a7c9374), X(0x2a8be359),
1374 X(0x2a9b34a2), X(0x2aaa8750), X(0x2ab9db60), X(0x2ac930d1),
1375 X(0x2ad887a3), X(0x2ae7dfd3), X(0x2af73962), X(0x2b06944e),
1376 X(0x2b15f096), X(0x2b254e38), X(0x2b34ad34), X(0x2b440d89),
1377 X(0x2b536f34), X(0x2b62d236), X(0x2b72368d), X(0x2b819c38),
1378 X(0x2b910336), X(0x2ba06b86), X(0x2bafd526), X(0x2bbf4015),
1379 X(0x2bceac53), X(0x2bde19de), X(0x2bed88b5), X(0x2bfcf8d7),
1380 X(0x2c0c6a43), X(0x2c1bdcf7), X(0x2c2b50f3), X(0x2c3ac635),
1381 X(0x2c4a3cbd), X(0x2c59b488), X(0x2c692d97), X(0x2c78a7e7),
1382 X(0x2c882378), X(0x2c97a049), X(0x2ca71e58), X(0x2cb69da4),
1383 X(0x2cc61e2c), X(0x2cd59ff0), X(0x2ce522ed), X(0x2cf4a723),
1384 X(0x2d042c90), X(0x2d13b334), X(0x2d233b0d), X(0x2d32c41a),
1385 X(0x2d424e5a), X(0x2d51d9cc), X(0x2d61666e), X(0x2d70f440),
1386 X(0x2d808340), X(0x2d90136e), X(0x2d9fa4c7), X(0x2daf374c),
1387 X(0x2dbecafa), X(0x2dce5fd1), X(0x2dddf5cf), X(0x2ded8cf4),
1388 X(0x2dfd253d), X(0x2e0cbeab), X(0x2e1c593b), X(0x2e2bf4ed),
1389 X(0x2e3b91c0), X(0x2e4b2fb1), X(0x2e5acec1), X(0x2e6a6eee),
1390 X(0x2e7a1037), X(0x2e89b29b), X(0x2e995618), X(0x2ea8faad),
1391 X(0x2eb8a05a), X(0x2ec8471c), X(0x2ed7eef4), X(0x2ee797df),
1392 X(0x2ef741dc), X(0x2f06eceb), X(0x2f16990a), X(0x2f264639),
1393 X(0x2f35f475), X(0x2f45a3bd), X(0x2f555412), X(0x2f650570),
1394 X(0x2f74b7d8), X(0x2f846b48), X(0x2f941fbe), X(0x2fa3d53a),
1395 X(0x2fb38bbb), X(0x2fc3433f), X(0x2fd2fbc5), X(0x2fe2b54c),
1396 X(0x2ff26fd3), X(0x30022b58), X(0x3011e7db), X(0x3021a55a),
1397 X(0x303163d4), X(0x30412348), X(0x3050e3b5), X(0x3060a519),
1398 X(0x30706773), X(0x30802ac3), X(0x308fef06), X(0x309fb43d),
1399 X(0x30af7a65), X(0x30bf417d), X(0x30cf0985), X(0x30ded27a),
1400 X(0x30ee9c5d), X(0x30fe672b), X(0x310e32e3), X(0x311dff85),
1401 X(0x312dcd0f), X(0x313d9b80), X(0x314d6ad7), X(0x315d3b12),
1402 X(0x316d0c30), X(0x317cde31), X(0x318cb113), X(0x319c84d4),
1403 X(0x31ac5974), X(0x31bc2ef1), X(0x31cc054b), X(0x31dbdc7f),
1404 X(0x31ebb48e), X(0x31fb8d74), X(0x320b6733), X(0x321b41c7),
1405 X(0x322b1d31), X(0x323af96e), X(0x324ad67e), X(0x325ab45f),
1406 X(0x326a9311), X(0x327a7291), X(0x328a52e0), X(0x329a33fb),
1407 X(0x32aa15e1), X(0x32b9f892), X(0x32c9dc0c), X(0x32d9c04d),
1408 X(0x32e9a555), X(0x32f98b22), X(0x330971b4), X(0x33195909),
1409 X(0x3329411f), X(0x333929f6), X(0x3349138c), X(0x3358fde1),
1410 X(0x3368e8f2), X(0x3378d4c0), X(0x3388c147), X(0x3398ae89),
1411 X(0x33a89c82), X(0x33b88b32), X(0x33c87a98), X(0x33d86ab2),
1412 X(0x33e85b80), X(0x33f84d00), X(0x34083f30), X(0x34183210),
1413 X(0x3428259f), X(0x343819db), X(0x34480ec3), X(0x34580455),
1414 X(0x3467fa92), X(0x3477f176), X(0x3487e902), X(0x3497e134),
1415 X(0x34a7da0a), X(0x34b7d384), X(0x34c7cda0), X(0x34d7c85e),
1416 X(0x34e7c3bb), X(0x34f7bfb7), X(0x3507bc50), X(0x3517b985),
1417 X(0x3527b756), X(0x3537b5c0), X(0x3547b4c3), X(0x3557b45d),
1418 X(0x3567b48d), X(0x3577b552), X(0x3587b6aa), X(0x3597b895),
1419 X(0x35a7bb12), X(0x35b7be1e), X(0x35c7c1b9), X(0x35d7c5e1),
1420 X(0x35e7ca96), X(0x35f7cfd6), X(0x3607d5a0), X(0x3617dbf3),
1421 X(0x3627e2cd), X(0x3637ea2d), X(0x3647f212), X(0x3657fa7b),
1422 X(0x36680366), X(0x36780cd2), X(0x368816bf), X(0x3698212b),
1423 X(0x36a82c14), X(0x36b83779), X(0x36c8435a), X(0x36d84fb4),
1424 X(0x36e85c88), X(0x36f869d2), X(0x37087793), X(0x371885c9),
1425 X(0x37289473), X(0x3738a38f), X(0x3748b31d), X(0x3758c31a),
1426 X(0x3768d387), X(0x3778e461), X(0x3788f5a7), X(0x37990759),
1427 X(0x37a91975), X(0x37b92bf9), X(0x37c93ee4), X(0x37d95236),
1428 X(0x37e965ed), X(0x37f97a08), X(0x38098e85), X(0x3819a363),
1429 X(0x3829b8a2), X(0x3839ce3f), X(0x3849e43a), X(0x3859fa91),
1430 X(0x386a1143), X(0x387a284f), X(0x388a3fb4), X(0x389a5770),
1431 X(0x38aa6f83), X(0x38ba87ea), X(0x38caa0a5), X(0x38dab9b2),
1432 X(0x38ead311), X(0x38faecbf), X(0x390b06bc), X(0x391b2107),
1433 X(0x392b3b9e), X(0x393b5680), X(0x394b71ac), X(0x395b8d20),
1434 X(0x396ba8dc), X(0x397bc4dd), X(0x398be124), X(0x399bfdae),
1435 X(0x39ac1a7a), X(0x39bc3788), X(0x39cc54d5), X(0x39dc7261),
1436 X(0x39ec902a), X(0x39fcae2f), X(0x3a0ccc70), X(0x3a1ceaea),
1437 X(0x3a2d099c), X(0x3a3d2885), X(0x3a4d47a5), X(0x3a5d66f9),
1438 X(0x3a6d8680), X(0x3a7da63a), X(0x3a8dc625), X(0x3a9de63f),
1439 X(0x3aae0688), X(0x3abe26fe), X(0x3ace47a0), X(0x3ade686d),
1440 X(0x3aee8963), X(0x3afeaa82), X(0x3b0ecbc7), X(0x3b1eed32),
1441 X(0x3b2f0ec2), X(0x3b3f3075), X(0x3b4f524a), X(0x3b5f7440),
1442 X(0x3b6f9656), X(0x3b7fb889), X(0x3b8fdada), X(0x3b9ffd46),
1443 X(0x3bb01fce), X(0x3bc0426e), X(0x3bd06526), X(0x3be087f6),
1444 X(0x3bf0aada), X(0x3c00cdd4), X(0x3c10f0e0), X(0x3c2113fe),
1445 X(0x3c31372d), X(0x3c415a6b), X(0x3c517db7), X(0x3c61a110),
1446 X(0x3c71c475), X(0x3c81e7e4), X(0x3c920b5c), X(0x3ca22edc),
1447 X(0x3cb25262), X(0x3cc275ee), X(0x3cd2997e), X(0x3ce2bd11),
1448 X(0x3cf2e0a6), X(0x3d03043b), X(0x3d1327cf), X(0x3d234b61),
1449 X(0x3d336ef0), X(0x3d43927a), X(0x3d53b5ff), X(0x3d63d97c),
1450 X(0x3d73fcf1), X(0x3d84205c), X(0x3d9443bd), X(0x3da46711),
1451 X(0x3db48a58), X(0x3dc4ad91), X(0x3dd4d0ba), X(0x3de4f3d1),
1452 X(0x3df516d7), X(0x3e0539c9), X(0x3e155ca6), X(0x3e257f6d),
1453 X(0x3e35a21d), X(0x3e45c4b4), X(0x3e55e731), X(0x3e660994),
1454 X(0x3e762bda), X(0x3e864e03), X(0x3e96700d), X(0x3ea691f7),
1455 X(0x3eb6b3bf), X(0x3ec6d565), X(0x3ed6f6e8), X(0x3ee71845),
1456 X(0x3ef7397c), X(0x3f075a8c), X(0x3f177b73), X(0x3f279c30),
1457 X(0x3f37bcc2), X(0x3f47dd27), X(0x3f57fd5f), X(0x3f681d68),
1458 X(0x3f783d40), X(0x3f885ce7), X(0x3f987c5c), X(0x3fa89b9c),
1459 X(0x3fb8baa7), X(0x3fc8d97c), X(0x3fd8f819), X(0x3fe9167e),
1460 X(0x3ff934a8), X(0x40095296), X(0x40197049), X(0x40298dbd),
1461 X(0x4039aaf2), X(0x4049c7e7), X(0x4059e49a), X(0x406a010a),
1462 X(0x407a1d36), X(0x408a391d), X(0x409a54bd), X(0x40aa7015),
1463 X(0x40ba8b25), X(0x40caa5ea), X(0x40dac063), X(0x40eada90),
1464 X(0x40faf46e), X(0x410b0dfe), X(0x411b273d), X(0x412b402a),
1465 X(0x413b58c4), X(0x414b710a), X(0x415b88fa), X(0x416ba093),
1466 X(0x417bb7d5), X(0x418bcebe), X(0x419be54c), X(0x41abfb7e),
1467 X(0x41bc1153), X(0x41cc26ca), X(0x41dc3be2), X(0x41ec5099),
1468 X(0x41fc64ef), X(0x420c78e1), X(0x421c8c6f), X(0x422c9f97),
1469 X(0x423cb258), X(0x424cc4b2), X(0x425cd6a2), X(0x426ce827),
1470 X(0x427cf941), X(0x428d09ee), X(0x429d1a2c), X(0x42ad29fb),
1471 X(0x42bd3959), X(0x42cd4846), X(0x42dd56bf), X(0x42ed64c3),
1472 X(0x42fd7252), X(0x430d7f6a), X(0x431d8c0a), X(0x432d9831),
1473 X(0x433da3dd), X(0x434daf0d), X(0x435db9c0), X(0x436dc3f5),
1474 X(0x437dcdab), X(0x438dd6df), X(0x439ddf92), X(0x43ade7c1),
1475 X(0x43bdef6c), X(0x43cdf691), X(0x43ddfd2f), X(0x43ee0345),
1476 X(0x43fe08d2), X(0x440e0dd4), X(0x441e124b), X(0x442e1634),
1477 X(0x443e198f), X(0x444e1c5a), X(0x445e1e95), X(0x446e203e),
1478 X(0x447e2153), X(0x448e21d5), X(0x449e21c0), X(0x44ae2115),
1479 X(0x44be1fd1), X(0x44ce1df4), X(0x44de1b7d), X(0x44ee186a),
1480 X(0x44fe14ba), X(0x450e106b), X(0x451e0b7e), X(0x452e05ef),
1481 X(0x453dffbf), X(0x454df8eb), X(0x455df173), X(0x456de956),
1482 X(0x457de092), X(0x458dd726), X(0x459dcd10), X(0x45adc251),
1483 X(0x45bdb6e5), X(0x45cdaacd), X(0x45dd9e06), X(0x45ed9091),
1484 X(0x45fd826a), X(0x460d7392), X(0x461d6407), X(0x462d53c8),
1485 X(0x463d42d4), X(0x464d3129), X(0x465d1ec6), X(0x466d0baa),
1486 X(0x467cf7d3), X(0x468ce342), X(0x469ccdf3), X(0x46acb7e7),
1487 X(0x46bca11c), X(0x46cc8990), X(0x46dc7143), X(0x46ec5833),
1488 X(0x46fc3e5f), X(0x470c23c6), X(0x471c0867), X(0x472bec40),
1489 X(0x473bcf50), X(0x474bb196), X(0x475b9311), X(0x476b73c0),
1490 X(0x477b53a1), X(0x478b32b4), X(0x479b10f6), X(0x47aaee67),
1491 X(0x47bacb06), X(0x47caa6d1), X(0x47da81c7), X(0x47ea5be7),
1492 X(0x47fa3530), X(0x480a0da1), X(0x4819e537), X(0x4829bbf3),
1493 X(0x483991d3), X(0x484966d6), X(0x48593afb), X(0x48690e3f),
1494 X(0x4878e0a3), X(0x4888b225), X(0x489882c4), X(0x48a8527e),
1495 X(0x48b82153), X(0x48c7ef41), X(0x48d7bc47), X(0x48e78863),
1496 X(0x48f75396), X(0x49071ddc), X(0x4916e736), X(0x4926afa2),
1497 X(0x4936771f), X(0x49463dac), X(0x49560347), X(0x4965c7ef),
1498 X(0x49758ba4), X(0x49854e63), X(0x4995102c), X(0x49a4d0fe),
1499 X(0x49b490d7), X(0x49c44fb6), X(0x49d40d9a), X(0x49e3ca82),
1500 X(0x49f3866c), X(0x4a034159), X(0x4a12fb45), X(0x4a22b430),
1501 X(0x4a326c19), X(0x4a4222ff), X(0x4a51d8e1), X(0x4a618dbd),
1502 X(0x4a714192), X(0x4a80f45f), X(0x4a90a623), X(0x4aa056dd),
1503 X(0x4ab0068b), X(0x4abfb52c), X(0x4acf62c0), X(0x4adf0f44),
1504 X(0x4aeebab9), X(0x4afe651c), X(0x4b0e0e6c), X(0x4b1db6a9),
1505 X(0x4b2d5dd1), X(0x4b3d03e2), X(0x4b4ca8dd), X(0x4b5c4cbf),
1506 X(0x4b6bef88), X(0x4b7b9136), X(0x4b8b31c8), X(0x4b9ad13d),
1507 X(0x4baa6f93), X(0x4bba0ccb), X(0x4bc9a8e2), X(0x4bd943d7),
1508 X(0x4be8dda9), X(0x4bf87658), X(0x4c080de1), X(0x4c17a444),
1509 X(0x4c27397f), X(0x4c36cd92), X(0x4c46607b), X(0x4c55f239),
1510 X(0x4c6582cb), X(0x4c75122f), X(0x4c84a065), X(0x4c942d6c),
1511 X(0x4ca3b942), X(0x4cb343e6), X(0x4cc2cd57), X(0x4cd25594),
1512 X(0x4ce1dc9c), X(0x4cf1626d), X(0x4d00e707), X(0x4d106a68),
1513 X(0x4d1fec8f), X(0x4d2f6d7a), X(0x4d3eed2a), X(0x4d4e6b9d),
1514 X(0x4d5de8d1), X(0x4d6d64c5), X(0x4d7cdf79), X(0x4d8c58eb),
1515 X(0x4d9bd11a), X(0x4dab4804), X(0x4dbabdaa), X(0x4dca3209),
1516 X(0x4dd9a520), X(0x4de916ef), X(0x4df88774), X(0x4e07f6ae),
1517 X(0x4e17649c), X(0x4e26d13c), X(0x4e363c8f), X(0x4e45a692),
1518 X(0x4e550f44), X(0x4e6476a4), X(0x4e73dcb2), X(0x4e83416c),
1519 X(0x4e92a4d1), X(0x4ea206df), X(0x4eb16796), X(0x4ec0c6f5),
1520 X(0x4ed024fa), X(0x4edf81a5), X(0x4eeedcf3), X(0x4efe36e5),
1521 X(0x4f0d8f79), X(0x4f1ce6ad), X(0x4f2c3c82), X(0x4f3b90f4),
1522 X(0x4f4ae405), X(0x4f5a35b1), X(0x4f6985fa), X(0x4f78d4dc),
1523 X(0x4f882257), X(0x4f976e6a), X(0x4fa6b914), X(0x4fb60254),
1524 X(0x4fc54a28), X(0x4fd49090), X(0x4fe3d58b), X(0x4ff31917),
1525 X(0x50025b33), X(0x50119bde), X(0x5020db17), X(0x503018dd),
1526 X(0x503f552f), X(0x504e900b), X(0x505dc971), X(0x506d0160),
1527 X(0x507c37d7), X(0x508b6cd3), X(0x509aa055), X(0x50a9d25b),
1528 X(0x50b902e4), X(0x50c831ef), X(0x50d75f7b), X(0x50e68b87),
1529 X(0x50f5b612), X(0x5104df1a), X(0x5114069f), X(0x51232ca0),
1530 X(0x5132511a), X(0x5141740f), X(0x5150957b), X(0x515fb55f),
1531 X(0x516ed3b8), X(0x517df087), X(0x518d0bca), X(0x519c257f),
1532 X(0x51ab3da7), X(0x51ba543f), X(0x51c96947), X(0x51d87cbd),
1533 X(0x51e78ea1), X(0x51f69ef1), X(0x5205adad), X(0x5214bad3),
1534 X(0x5223c662), X(0x5232d05a), X(0x5241d8b9), X(0x5250df7d),
1535 X(0x525fe4a7), X(0x526ee835), X(0x527dea26), X(0x528cea78),
1536 X(0x529be92c), X(0x52aae63f), X(0x52b9e1b0), X(0x52c8db80),
1537 X(0x52d7d3ac), X(0x52e6ca33), X(0x52f5bf15), X(0x5304b251),
1538 X(0x5313a3e5), X(0x532293d0), X(0x53318212), X(0x53406ea8),
1539 X(0x534f5993), X(0x535e42d2), X(0x536d2a62), X(0x537c1043),
1540 X(0x538af475), X(0x5399d6f6), X(0x53a8b7c4), X(0x53b796e0),
1541 X(0x53c67447), X(0x53d54ffa), X(0x53e429f6), X(0x53f3023b),
1542 X(0x5401d8c8), X(0x5410ad9c), X(0x541f80b5), X(0x542e5213),
1543 X(0x543d21b5), X(0x544bef9a), X(0x545abbc0), X(0x54698627),
1544 X(0x54784ece), X(0x548715b3), X(0x5495dad6), X(0x54a49e35),
1545 X(0x54b35fd0), X(0x54c21fa6), X(0x54d0ddb5), X(0x54df99fd),
1546 X(0x54ee547c), X(0x54fd0d32), X(0x550bc41d), X(0x551a793d),
1547 X(0x55292c91), X(0x5537de16), X(0x55468dce), X(0x55553bb6),
1548 X(0x5563e7cd), X(0x55729213), X(0x55813a87), X(0x558fe127),
1549 X(0x559e85f2), X(0x55ad28e9), X(0x55bbca08), X(0x55ca6950),
1550 X(0x55d906c0), X(0x55e7a257), X(0x55f63c13), X(0x5604d3f4),
1551 X(0x561369f8), X(0x5621fe1f), X(0x56309067), X(0x563f20d1),
1552 X(0x564daf5a), X(0x565c3c02), X(0x566ac6c7), X(0x56794faa),
1553 X(0x5687d6a8), X(0x56965bc1), X(0x56a4def4), X(0x56b36040),
1554 X(0x56c1dfa4), X(0x56d05d1f), X(0x56ded8af), X(0x56ed5255),
1555 X(0x56fbca0f), X(0x570a3fdc), X(0x5718b3bc), X(0x572725ac),
1556 X(0x573595ad), X(0x574403bd), X(0x57526fdb), X(0x5760da07),
1557 X(0x576f423f), X(0x577da883), X(0x578c0cd1), X(0x579a6f29),
1558 X(0x57a8cf8a), X(0x57b72df2), X(0x57c58a61), X(0x57d3e4d6),
1559 X(0x57e23d50), X(0x57f093cd), X(0x57fee84e), X(0x580d3ad1),
1560 X(0x581b8b54), X(0x5829d9d8), X(0x5838265c), X(0x584670dd),
1561 X(0x5854b95c), X(0x5862ffd8), X(0x5871444f), X(0x587f86c1),
1562 X(0x588dc72c), X(0x589c0591), X(0x58aa41ed), X(0x58b87c40),
1563 X(0x58c6b489), X(0x58d4eac7), X(0x58e31ef9), X(0x58f1511f),
1564 X(0x58ff8137), X(0x590daf40), X(0x591bdb3a), X(0x592a0524),
1565 X(0x59382cfc), X(0x594652c2), X(0x59547675), X(0x59629815),
1566 X(0x5970b79f), X(0x597ed513), X(0x598cf071), X(0x599b09b7),
1567 X(0x59a920e5), X(0x59b735f9), X(0x59c548f4), X(0x59d359d2),
1568 X(0x59e16895), X(0x59ef753b), X(0x59fd7fc4), X(0x5a0b882d),
1569 X(0x5a198e77), X(0x5a2792a0), X(0x5a3594a9), X(0x5a43948e),
1570 X(0x5a519251), X(0x5a5f8df0), X(0x5a6d876a), X(0x5a7b7ebe),
1571 X(0x5a8973ec), X(0x5a9766f2), X(0x5aa557d0), X(0x5ab34685),
1572 X(0x5ac1330f), X(0x5acf1d6f), X(0x5add05a3), X(0x5aeaebaa),
1573 X(0x5af8cf84), X(0x5b06b12f), X(0x5b1490ab), X(0x5b226df7),
1574 X(0x5b304912), X(0x5b3e21fc), X(0x5b4bf8b2), X(0x5b59cd35),
1575 X(0x5b679f84), X(0x5b756f9e), X(0x5b833d82), X(0x5b91092e),
1576 X(0x5b9ed2a3), X(0x5bac99e0), X(0x5bba5ee3), X(0x5bc821ac),
1577 X(0x5bd5e23a), X(0x5be3a08c), X(0x5bf15ca1), X(0x5bff1679),
1578 X(0x5c0cce12), X(0x5c1a836c), X(0x5c283686), X(0x5c35e760),
1579 X(0x5c4395f7), X(0x5c51424c), X(0x5c5eec5e), X(0x5c6c942b),
1580 X(0x5c7a39b4), X(0x5c87dcf7), X(0x5c957df3), X(0x5ca31ca8),
1581 X(0x5cb0b915), X(0x5cbe5338), X(0x5ccbeb12), X(0x5cd980a1),
1582 X(0x5ce713e5), X(0x5cf4a4dd), X(0x5d023387), X(0x5d0fbfe4),
1583 X(0x5d1d49f2), X(0x5d2ad1b1), X(0x5d38571f), X(0x5d45da3c),
1584 X(0x5d535b08), X(0x5d60d981), X(0x5d6e55a7), X(0x5d7bcf78),
1585 X(0x5d8946f5), X(0x5d96bc1c), X(0x5da42eec), X(0x5db19f65),
1586 X(0x5dbf0d86), X(0x5dcc794e), X(0x5dd9e2bd), X(0x5de749d1),
1587 X(0x5df4ae8a), X(0x5e0210e7), X(0x5e0f70e7), X(0x5e1cce8a),
1588 X(0x5e2a29ce), X(0x5e3782b4), X(0x5e44d93a), X(0x5e522d5f),
1589 X(0x5e5f7f23), X(0x5e6cce85), X(0x5e7a1b85), X(0x5e876620),
1590 X(0x5e94ae58), X(0x5ea1f42a), X(0x5eaf3797), X(0x5ebc789d),
1591 X(0x5ec9b73c), X(0x5ed6f372), X(0x5ee42d41), X(0x5ef164a5),
1592 X(0x5efe999f), X(0x5f0bcc2f), X(0x5f18fc52), X(0x5f262a09),
1593 X(0x5f335553), X(0x5f407e2f), X(0x5f4da49d), X(0x5f5ac89b),
1594 X(0x5f67ea29), X(0x5f750946), X(0x5f8225f2), X(0x5f8f402b),
1595 X(0x5f9c57f2), X(0x5fa96d44), X(0x5fb68023), X(0x5fc3908c),
1596 X(0x5fd09e7f), X(0x5fdda9fc), X(0x5feab302), X(0x5ff7b990),
1597 X(0x6004bda5), X(0x6011bf40), X(0x601ebe62), X(0x602bbb09),
1598 X(0x6038b534), X(0x6045ace4), X(0x6052a216), X(0x605f94cb),
1599 X(0x606c8502), X(0x607972b9), X(0x60865df2), X(0x609346aa),
1600 X(0x60a02ce1), X(0x60ad1096), X(0x60b9f1c9), X(0x60c6d079),
1601 X(0x60d3aca5), X(0x60e0864d), X(0x60ed5d70), X(0x60fa320d),
1602 X(0x61070424), X(0x6113d3b4), X(0x6120a0bc), X(0x612d6b3c),
1603 X(0x613a3332), X(0x6146f89f), X(0x6153bb82), X(0x61607bd9),
1604 X(0x616d39a5), X(0x6179f4e5), X(0x6186ad98), X(0x619363bd),
1605 X(0x61a01753), X(0x61acc85b), X(0x61b976d3), X(0x61c622bc),
1606 X(0x61d2cc13), X(0x61df72d8), X(0x61ec170c), X(0x61f8b8ad),
1607 X(0x620557ba), X(0x6211f434), X(0x621e8e18), X(0x622b2568),
1608 X(0x6237ba21), X(0x62444c44), X(0x6250dbd0), X(0x625d68c4),
1609 X(0x6269f320), X(0x62767ae2), X(0x6283000b), X(0x628f829a),
1610 X(0x629c028e), X(0x62a87fe6), X(0x62b4faa2), X(0x62c172c2),
1611 X(0x62cde844), X(0x62da5b29), X(0x62e6cb6e), X(0x62f33915),
1612 X(0x62ffa41c), X(0x630c0c83), X(0x63187248), X(0x6324d56d),
1613 X(0x633135ef), X(0x633d93ce), X(0x6349ef0b), X(0x635647a3),
1614 X(0x63629d97), X(0x636ef0e6), X(0x637b418f), X(0x63878f92),
1615 X(0x6393daef), X(0x63a023a4), X(0x63ac69b1), X(0x63b8ad15),
1616 X(0x63c4edd1), X(0x63d12be3), X(0x63dd674b), X(0x63e9a008),
1617 X(0x63f5d61a), X(0x64020980), X(0x640e3a39), X(0x641a6846),
1618 X(0x642693a5), X(0x6432bc56), X(0x643ee258), X(0x644b05ab),
1619 X(0x6457264e), X(0x64634441), X(0x646f5f83), X(0x647b7814),
1620 X(0x64878df3), X(0x6493a120), X(0x649fb199), X(0x64abbf5f),
1621 X(0x64b7ca71), X(0x64c3d2ce), X(0x64cfd877), X(0x64dbdb69),
1622 X(0x64e7dba6), X(0x64f3d92b), X(0x64ffd3fa), X(0x650bcc11),
1623 X(0x6517c16f), X(0x6523b415), X(0x652fa402), X(0x653b9134),
1624 X(0x65477bad), X(0x6553636a), X(0x655f486d), X(0x656b2ab3),
1625 X(0x65770a3d), X(0x6582e70a), X(0x658ec11a), X(0x659a986d),
1626 X(0x65a66d00), X(0x65b23ed5), X(0x65be0deb), X(0x65c9da41),
1627 X(0x65d5a3d7), X(0x65e16aac), X(0x65ed2ebf), X(0x65f8f011),
1628 X(0x6604aea1), X(0x66106a6e), X(0x661c2377), X(0x6627d9be),
1629 X(0x66338d40), X(0x663f3dfd), X(0x664aebf5), X(0x66569728),
1630 X(0x66623f95), X(0x666de53b), X(0x6679881b), X(0x66852833),
1631 X(0x6690c583), X(0x669c600b), X(0x66a7f7ca), X(0x66b38cc0),
1632 X(0x66bf1eec), X(0x66caae4f), X(0x66d63ae6), X(0x66e1c4b3),
1633 X(0x66ed4bb4), X(0x66f8cfea), X(0x67045153), X(0x670fcfef),
1634 X(0x671b4bbe), X(0x6726c4bf), X(0x67323af3), X(0x673dae58),
1635 X(0x67491eee), X(0x67548cb5), X(0x675ff7ab), X(0x676b5fd2),
1636 X(0x6776c528), X(0x678227ad), X(0x678d8761), X(0x6798e443),
1637 X(0x67a43e52), X(0x67af958f), X(0x67bae9f9), X(0x67c63b8f),
1638 X(0x67d18a52), X(0x67dcd640), X(0x67e81f59), X(0x67f3659d),
1639 X(0x67fea90c), X(0x6809e9a5), X(0x68152768), X(0x68206254),
1640 X(0x682b9a68), X(0x6836cfa6), X(0x6842020b), X(0x684d3199),
1641 X(0x68585e4d), X(0x68638829), X(0x686eaf2b), X(0x6879d354),
1642 X(0x6884f4a2), X(0x68901316), X(0x689b2eb0), X(0x68a6476d),
1643 X(0x68b15d50), X(0x68bc7056), X(0x68c78080), X(0x68d28dcd),
1644 X(0x68dd983e), X(0x68e89fd0), X(0x68f3a486), X(0x68fea65d),
1645 X(0x6909a555), X(0x6914a16f), X(0x691f9aa9), X(0x692a9104),
1646 X(0x69358480), X(0x6940751b), X(0x694b62d5), X(0x69564daf),
1647 X(0x696135a7), X(0x696c1abe), X(0x6976fcf3), X(0x6981dc46),
1648 X(0x698cb8b6), X(0x69979243), X(0x69a268ed), X(0x69ad3cb4),
1649 X(0x69b80d97), X(0x69c2db96), X(0x69cda6b0), X(0x69d86ee5),
1650 X(0x69e33436), X(0x69edf6a1), X(0x69f8b626), X(0x6a0372c5),
1651 X(0x6a0e2c7e), X(0x6a18e350), X(0x6a23973c), X(0x6a2e4840),
1652 X(0x6a38f65d), X(0x6a43a191), X(0x6a4e49de), X(0x6a58ef42),
1653 X(0x6a6391be), X(0x6a6e3151), X(0x6a78cdfa), X(0x6a8367ba),
1654 X(0x6a8dfe90), X(0x6a98927c), X(0x6aa3237d), X(0x6aadb194),
1655 X(0x6ab83cc0), X(0x6ac2c500), X(0x6acd4a55), X(0x6ad7ccbf),
1656 X(0x6ae24c3c), X(0x6aecc8cd), X(0x6af74271), X(0x6b01b929),
1657 X(0x6b0c2cf4), X(0x6b169dd1), X(0x6b210bc1), X(0x6b2b76c2),
1658 X(0x6b35ded6), X(0x6b4043fc), X(0x6b4aa632), X(0x6b55057a),
1659 X(0x6b5f61d3), X(0x6b69bb3d), X(0x6b7411b7), X(0x6b7e6541),
1660 X(0x6b88b5db), X(0x6b930385), X(0x6b9d4e3f), X(0x6ba79607),
1661 X(0x6bb1dadf), X(0x6bbc1cc6), X(0x6bc65bbb), X(0x6bd097bf),
1662 X(0x6bdad0d0), X(0x6be506f0), X(0x6bef3a1d), X(0x6bf96a58),
1663 X(0x6c0397a0), X(0x6c0dc1f5), X(0x6c17e957), X(0x6c220dc6),
1664 X(0x6c2c2f41), X(0x6c364dc9), X(0x6c40695c), X(0x6c4a81fc),
1665 X(0x6c5497a7), X(0x6c5eaa5d), X(0x6c68ba1f), X(0x6c72c6eb),
1666 X(0x6c7cd0c3), X(0x6c86d7a6), X(0x6c90db92), X(0x6c9adc8a),
1667 X(0x6ca4da8b), X(0x6caed596), X(0x6cb8cdab), X(0x6cc2c2ca),
1668 X(0x6cccb4f2), X(0x6cd6a424), X(0x6ce0905e), X(0x6cea79a1),
1669 X(0x6cf45fee), X(0x6cfe4342), X(0x6d0823a0), X(0x6d120105),
1670 X(0x6d1bdb73), X(0x6d25b2e8), X(0x6d2f8765), X(0x6d3958ea),
1671 X(0x6d432777), X(0x6d4cf30a), X(0x6d56bba5), X(0x6d608147),
1672 X(0x6d6a43f0), X(0x6d7403a0), X(0x6d7dc056), X(0x6d877a13),
1673 X(0x6d9130d6), X(0x6d9ae4a0), X(0x6da4956f), X(0x6dae4345),
1674 X(0x6db7ee20), X(0x6dc19601), X(0x6dcb3ae7), X(0x6dd4dcd3),
1675 X(0x6dde7bc4), X(0x6de817bb), X(0x6df1b0b6), X(0x6dfb46b7),
1676 X(0x6e04d9bc), X(0x6e0e69c7), X(0x6e17f6d5), X(0x6e2180e9),
1677 X(0x6e2b0801), X(0x6e348c1d), X(0x6e3e0d3d), X(0x6e478b62),
1678 X(0x6e51068a), X(0x6e5a7eb7), X(0x6e63f3e7), X(0x6e6d661b),
1679 X(0x6e76d552), X(0x6e80418e), X(0x6e89aacc), X(0x6e93110f),
1680 X(0x6e9c7454), X(0x6ea5d49d), X(0x6eaf31e9), X(0x6eb88c37),
1681 X(0x6ec1e389), X(0x6ecb37de), X(0x6ed48936), X(0x6eddd790),
1682 X(0x6ee722ee), X(0x6ef06b4d), X(0x6ef9b0b0), X(0x6f02f315),
1683 X(0x6f0c327c), X(0x6f156ee6), X(0x6f1ea852), X(0x6f27dec1),
1684 X(0x6f311232), X(0x6f3a42a5), X(0x6f43701a), X(0x6f4c9a91),
1685 X(0x6f55c20a), X(0x6f5ee686), X(0x6f680803), X(0x6f712682),
1686 X(0x6f7a4203), X(0x6f835a86), X(0x6f8c700b), X(0x6f958291),
1687 X(0x6f9e921a), X(0x6fa79ea4), X(0x6fb0a830), X(0x6fb9aebd),
1688 X(0x6fc2b24c), X(0x6fcbb2dd), X(0x6fd4b06f), X(0x6fddab03),
1689 X(0x6fe6a299), X(0x6fef9730), X(0x6ff888c9), X(0x70017763),
1690 X(0x700a62ff), X(0x70134b9c), X(0x701c313b), X(0x702513dc),
1691 X(0x702df37e), X(0x7036d021), X(0x703fa9c6), X(0x7048806d),
1692 X(0x70515415), X(0x705a24bf), X(0x7062f26b), X(0x706bbd17),
1693 X(0x707484c6), X(0x707d4976), X(0x70860b28), X(0x708ec9dc),
1694 X(0x70978591), X(0x70a03e48), X(0x70a8f400), X(0x70b1a6bb),
1695 X(0x70ba5677), X(0x70c30335), X(0x70cbacf5), X(0x70d453b6),
1696 X(0x70dcf77a), X(0x70e59840), X(0x70ee3607), X(0x70f6d0d1),
1697 X(0x70ff689d), X(0x7107fd6b), X(0x71108f3b), X(0x71191e0d),
1698 X(0x7121a9e2), X(0x712a32b9), X(0x7132b892), X(0x713b3b6e),
1699 X(0x7143bb4c), X(0x714c382d), X(0x7154b211), X(0x715d28f7),
1700 X(0x71659ce0), X(0x716e0dcc), X(0x71767bbb), X(0x717ee6ac),
1701 X(0x71874ea1), X(0x718fb399), X(0x71981594), X(0x71a07493),
1702 X(0x71a8d094), X(0x71b1299a), X(0x71b97fa2), X(0x71c1d2af),
1703 X(0x71ca22bf), X(0x71d26fd2), X(0x71dab9ea), X(0x71e30106),
1704 X(0x71eb4526), X(0x71f3864a), X(0x71fbc472), X(0x7203ff9e),
1705 X(0x720c37cf), X(0x72146d05), X(0x721c9f3f), X(0x7224ce7e),
1706 X(0x722cfac2), X(0x7235240b), X(0x723d4a59), X(0x72456dad),
1707 X(0x724d8e05), X(0x7255ab63), X(0x725dc5c7), X(0x7265dd31),
1708 X(0x726df1a0), X(0x72760315), X(0x727e1191), X(0x72861d12),
1709 X(0x728e259a), X(0x72962b28), X(0x729e2dbd), X(0x72a62d59),
1710 X(0x72ae29fc), X(0x72b623a5), X(0x72be1a56), X(0x72c60e0e),
1711 X(0x72cdfece), X(0x72d5ec95), X(0x72ddd764), X(0x72e5bf3b),
1712 X(0x72eda41a), X(0x72f58601), X(0x72fd64f1), X(0x730540e9),
1713 X(0x730d19e9), X(0x7314eff3), X(0x731cc305), X(0x73249321),
1714 X(0x732c6046), X(0x73342a75), X(0x733bf1ad), X(0x7343b5ef),
1715 X(0x734b773b), X(0x73533591), X(0x735af0f2), X(0x7362a95d),
1716 X(0x736a5ed3), X(0x73721153), X(0x7379c0df), X(0x73816d76),
1717 X(0x73891719), X(0x7390bdc7), X(0x73986181), X(0x73a00247),
1718 X(0x73a7a01a), X(0x73af3af8), X(0x73b6d2e4), X(0x73be67dc),
1719 X(0x73c5f9e1), X(0x73cd88f3), X(0x73d51513), X(0x73dc9e40),
1720 X(0x73e4247c), X(0x73eba7c5), X(0x73f3281c), X(0x73faa582),
1721 X(0x74021ff7), X(0x7409977b), X(0x74110c0d), X(0x74187daf),
1722 X(0x741fec61), X(0x74275822), X(0x742ec0f3), X(0x743626d5),
1723 X(0x743d89c7), X(0x7444e9c9), X(0x744c46dd), X(0x7453a101),
1724 X(0x745af837), X(0x74624c7f), X(0x74699dd8), X(0x7470ec44),
1725 X(0x747837c2), X(0x747f8052), X(0x7486c5f5), X(0x748e08ac),
1726 X(0x74954875), X(0x749c8552), X(0x74a3bf43), X(0x74aaf648),
1727 X(0x74b22a62), X(0x74b95b90), X(0x74c089d2), X(0x74c7b52a),
1728 X(0x74cedd97), X(0x74d6031a), X(0x74dd25b2), X(0x74e44561),
1729 X(0x74eb6226), X(0x74f27c02), X(0x74f992f5), X(0x7500a6ff),
1730 X(0x7507b820), X(0x750ec659), X(0x7515d1aa), X(0x751cda14),
1731 X(0x7523df96), X(0x752ae231), X(0x7531e1e5), X(0x7538deb2),
1732 X(0x753fd89a), X(0x7546cf9b), X(0x754dc3b7), X(0x7554b4ed),
1733 X(0x755ba33e), X(0x75628eaa), X(0x75697732), X(0x75705cd5),
1734 X(0x75773f95), X(0x757e1f71), X(0x7584fc6a), X(0x758bd67f),
1735 X(0x7592adb2), X(0x75998203), X(0x75a05371), X(0x75a721fe),
1736 X(0x75adeda9), X(0x75b4b673), X(0x75bb7c5c), X(0x75c23f65),
1737 X(0x75c8ff8d), X(0x75cfbcd6), X(0x75d6773f), X(0x75dd2ec8),
1738 X(0x75e3e373), X(0x75ea953f), X(0x75f1442d), X(0x75f7f03d),
1739 X(0x75fe996f), X(0x76053fc5), X(0x760be33d), X(0x761283d8),
1740 X(0x76192197), X(0x761fbc7b), X(0x76265482), X(0x762ce9af),
1741 X(0x76337c01), X(0x763a0b78), X(0x76409814), X(0x764721d7),
1742 X(0x764da8c1), X(0x76542cd1), X(0x765aae08), X(0x76612c67),
1743 X(0x7667a7ee), X(0x766e209d), X(0x76749675), X(0x767b0975),
1744 X(0x7681799f), X(0x7687e6f3), X(0x768e5170), X(0x7694b918),
1745 X(0x769b1deb), X(0x76a17fe9), X(0x76a7df13), X(0x76ae3b68),
1746 X(0x76b494ea), X(0x76baeb98), X(0x76c13f74), X(0x76c7907c),
1747 X(0x76cddeb3), X(0x76d42a18), X(0x76da72ab), X(0x76e0b86d),
1748 X(0x76e6fb5e), X(0x76ed3b7f), X(0x76f378d0), X(0x76f9b352),
1749 X(0x76ffeb05), X(0x77061fe8), X(0x770c51fe), X(0x77128145),
1750 X(0x7718adbf), X(0x771ed76c), X(0x7724fe4c), X(0x772b225f),
1751 X(0x773143a7), X(0x77376223), X(0x773d7dd3), X(0x774396ba),
1752 X(0x7749acd5), X(0x774fc027), X(0x7755d0af), X(0x775bde6f),
1753 X(0x7761e965), X(0x7767f193), X(0x776df6fa), X(0x7773f998),
1754 X(0x7779f970), X(0x777ff681), X(0x7785f0cd), X(0x778be852),
1755 X(0x7791dd12), X(0x7797cf0d), X(0x779dbe43), X(0x77a3aab6),
1756 X(0x77a99465), X(0x77af7b50), X(0x77b55f79), X(0x77bb40e0),
1757 X(0x77c11f85), X(0x77c6fb68), X(0x77ccd48a), X(0x77d2aaec),
1758 X(0x77d87e8d), X(0x77de4f6f), X(0x77e41d92), X(0x77e9e8f5),
1759 X(0x77efb19b), X(0x77f57782), X(0x77fb3aad), X(0x7800fb1a),
1760 X(0x7806b8ca), X(0x780c73bf), X(0x78122bf7), X(0x7817e175),
1761 X(0x781d9438), X(0x78234440), X(0x7828f18f), X(0x782e9c25),
1762 X(0x78344401), X(0x7839e925), X(0x783f8b92), X(0x78452b46),
1763 X(0x784ac844), X(0x7850628b), X(0x7855fa1c), X(0x785b8ef8),
1764 X(0x7861211e), X(0x7866b090), X(0x786c3d4d), X(0x7871c757),
1765 X(0x78774ead), X(0x787cd351), X(0x78825543), X(0x7887d483),
1766 X(0x788d5111), X(0x7892caef), X(0x7898421c), X(0x789db69a),
1767 X(0x78a32868), X(0x78a89787), X(0x78ae03f8), X(0x78b36dbb),
1768 X(0x78b8d4d1), X(0x78be393a), X(0x78c39af6), X(0x78c8fa06),
1769 X(0x78ce566c), X(0x78d3b026), X(0x78d90736), X(0x78de5b9c),
1770 X(0x78e3ad58), X(0x78e8fc6c), X(0x78ee48d7), X(0x78f3929b),
1771 X(0x78f8d9b7), X(0x78fe1e2c), X(0x79035ffb), X(0x79089f24),
1772 X(0x790ddba8), X(0x79131587), X(0x79184cc2), X(0x791d8159),
1773 X(0x7922b34d), X(0x7927e29e), X(0x792d0f4d), X(0x7932395a),
1774 X(0x793760c6), X(0x793c8591), X(0x7941a7bd), X(0x7946c749),
1775 X(0x794be435), X(0x7950fe84), X(0x79561634), X(0x795b2b47),
1776 X(0x79603dbc), X(0x79654d96), X(0x796a5ad4), X(0x796f6576),
1777 X(0x79746d7e), X(0x797972eb), X(0x797e75bf), X(0x798375f9),
1778 X(0x7988739b), X(0x798d6ea5), X(0x79926717), X(0x79975cf2),
1779 X(0x799c5037), X(0x79a140e6), X(0x79a62f00), X(0x79ab1a85),
1780 X(0x79b00376), X(0x79b4e9d3), X(0x79b9cd9d), X(0x79beaed4),
1781 X(0x79c38d79), X(0x79c8698d), X(0x79cd4310), X(0x79d21a03),
1782 X(0x79d6ee66), X(0x79dbc03a), X(0x79e08f7f), X(0x79e55c36),
1783 X(0x79ea265f), X(0x79eeedfc), X(0x79f3b30c), X(0x79f87590),
1784 X(0x79fd3589), X(0x7a01f2f7), X(0x7a06addc), X(0x7a0b6636),
1785 X(0x7a101c08), X(0x7a14cf52), X(0x7a198013), X(0x7a1e2e4d),
1786 X(0x7a22da01), X(0x7a27832f), X(0x7a2c29d7), X(0x7a30cdfa),
1787 X(0x7a356f99), X(0x7a3a0eb4), X(0x7a3eab4c), X(0x7a434561),
1788 X(0x7a47dcf5), X(0x7a4c7207), X(0x7a510498), X(0x7a5594a9),
1789 X(0x7a5a223a), X(0x7a5ead4d), X(0x7a6335e0), X(0x7a67bbf6),
1790 X(0x7a6c3f8f), X(0x7a70c0ab), X(0x7a753f4b), X(0x7a79bb6f),
1791 X(0x7a7e3519), X(0x7a82ac48), X(0x7a8720fe), X(0x7a8b933b),
1792 X(0x7a9002ff), X(0x7a94704b), X(0x7a98db20), X(0x7a9d437e),
1793 X(0x7aa1a967), X(0x7aa60cd9), X(0x7aaa6dd7), X(0x7aaecc61),
1794 X(0x7ab32877), X(0x7ab7821b), X(0x7abbd94b), X(0x7ac02e0a),
1795 X(0x7ac48058), X(0x7ac8d035), X(0x7acd1da3), X(0x7ad168a1),
1796 X(0x7ad5b130), X(0x7ad9f751), X(0x7ade3b05), X(0x7ae27c4c),
1797 X(0x7ae6bb27), X(0x7aeaf796), X(0x7aef319a), X(0x7af36934),
1798 X(0x7af79e64), X(0x7afbd12c), X(0x7b00018a), X(0x7b042f81),
1799 X(0x7b085b10), X(0x7b0c8439), X(0x7b10aafc), X(0x7b14cf5a),
1800 X(0x7b18f153), X(0x7b1d10e8), X(0x7b212e1a), X(0x7b2548e9),
1801 X(0x7b296155), X(0x7b2d7761), X(0x7b318b0b), X(0x7b359c55),
1802 X(0x7b39ab3f), X(0x7b3db7cb), X(0x7b41c1f8), X(0x7b45c9c8),
1803 X(0x7b49cf3b), X(0x7b4dd251), X(0x7b51d30b), X(0x7b55d16b),
1804 X(0x7b59cd70), X(0x7b5dc71b), X(0x7b61be6d), X(0x7b65b366),
1805 X(0x7b69a608), X(0x7b6d9653), X(0x7b718447), X(0x7b756fe5),
1806 X(0x7b79592e), X(0x7b7d4022), X(0x7b8124c3), X(0x7b850710),
1807 X(0x7b88e70a), X(0x7b8cc4b3), X(0x7b90a00a), X(0x7b947911),
1808 X(0x7b984fc8), X(0x7b9c242f), X(0x7b9ff648), X(0x7ba3c612),
1809 X(0x7ba79390), X(0x7bab5ec1), X(0x7baf27a5), X(0x7bb2ee3f),
1810 X(0x7bb6b28e), X(0x7bba7493), X(0x7bbe344e), X(0x7bc1f1c1),
1811 X(0x7bc5acec), X(0x7bc965cf), X(0x7bcd1c6c), X(0x7bd0d0c3),
1812 X(0x7bd482d4), X(0x7bd832a1), X(0x7bdbe02a), X(0x7bdf8b70),
1813 X(0x7be33473), X(0x7be6db34), X(0x7bea7fb4), X(0x7bee21f4),
1814 X(0x7bf1c1f3), X(0x7bf55fb3), X(0x7bf8fb35), X(0x7bfc9479),
1815 X(0x7c002b7f), X(0x7c03c04a), X(0x7c0752d8), X(0x7c0ae32b),
1816 X(0x7c0e7144), X(0x7c11fd23), X(0x7c1586c9), X(0x7c190e36),
1817 X(0x7c1c936c), X(0x7c20166b), X(0x7c239733), X(0x7c2715c6),
1818 X(0x7c2a9224), X(0x7c2e0c4e), X(0x7c318444), X(0x7c34fa07),
1819 X(0x7c386d98), X(0x7c3bdef8), X(0x7c3f4e26), X(0x7c42bb25),
1820 X(0x7c4625f4), X(0x7c498e95), X(0x7c4cf507), X(0x7c50594c),
1821 X(0x7c53bb65), X(0x7c571b51), X(0x7c5a7913), X(0x7c5dd4aa),
1822 X(0x7c612e17), X(0x7c64855b), X(0x7c67da76), X(0x7c6b2d6a),
1823 X(0x7c6e7e37), X(0x7c71ccdd), X(0x7c75195e), X(0x7c7863ba),
1824 X(0x7c7babf1), X(0x7c7ef206), X(0x7c8235f7), X(0x7c8577c6),
1825 X(0x7c88b774), X(0x7c8bf502), X(0x7c8f306f), X(0x7c9269bd),
1826 X(0x7c95a0ec), X(0x7c98d5fe), X(0x7c9c08f2), X(0x7c9f39cb),
1827 X(0x7ca26887), X(0x7ca59528), X(0x7ca8bfb0), X(0x7cabe81d),
1828 X(0x7caf0e72), X(0x7cb232af), X(0x7cb554d4), X(0x7cb874e2),
1829 X(0x7cbb92db), X(0x7cbeaebe), X(0x7cc1c88d), X(0x7cc4e047),
1830 X(0x7cc7f5ef), X(0x7ccb0984), X(0x7cce1b08), X(0x7cd12a7b),
1831 X(0x7cd437dd), X(0x7cd74330), X(0x7cda4c74), X(0x7cdd53aa),
1832 X(0x7ce058d3), X(0x7ce35bef), X(0x7ce65cff), X(0x7ce95c04),
1833 X(0x7cec58ff), X(0x7cef53f0), X(0x7cf24cd7), X(0x7cf543b7),
1834 X(0x7cf8388f), X(0x7cfb2b60), X(0x7cfe1c2b), X(0x7d010af1),
1835 X(0x7d03f7b2), X(0x7d06e26f), X(0x7d09cb29), X(0x7d0cb1e0),
1836 X(0x7d0f9696), X(0x7d12794b), X(0x7d1559ff), X(0x7d1838b4),
1837 X(0x7d1b156a), X(0x7d1df022), X(0x7d20c8dd), X(0x7d239f9b),
1838 X(0x7d26745e), X(0x7d294725), X(0x7d2c17f1), X(0x7d2ee6c4),
1839 X(0x7d31b39f), X(0x7d347e81), X(0x7d37476b), X(0x7d3a0e5f),
1840 X(0x7d3cd35d), X(0x7d3f9665), X(0x7d425779), X(0x7d451699),
1841 X(0x7d47d3c6), X(0x7d4a8f01), X(0x7d4d484b), X(0x7d4fffa3),
1842 X(0x7d52b50c), X(0x7d556885), X(0x7d581a0f), X(0x7d5ac9ac),
1843 X(0x7d5d775c), X(0x7d60231f), X(0x7d62ccf6), X(0x7d6574e3),
1844 X(0x7d681ae6), X(0x7d6abeff), X(0x7d6d612f), X(0x7d700178),
1845 X(0x7d729fd9), X(0x7d753c54), X(0x7d77d6e9), X(0x7d7a6f9a),
1846 X(0x7d7d0666), X(0x7d7f9b4f), X(0x7d822e55), X(0x7d84bf79),
1847 X(0x7d874ebc), X(0x7d89dc1e), X(0x7d8c67a1), X(0x7d8ef144),
1848 X(0x7d91790a), X(0x7d93fef2), X(0x7d9682fd), X(0x7d99052d),
1849 X(0x7d9b8581), X(0x7d9e03fb), X(0x7da0809b), X(0x7da2fb62),
1850 X(0x7da57451), X(0x7da7eb68), X(0x7daa60a8), X(0x7dacd413),
1851 X(0x7daf45a9), X(0x7db1b56a), X(0x7db42357), X(0x7db68f71),
1852 X(0x7db8f9b9), X(0x7dbb6230), X(0x7dbdc8d6), X(0x7dc02dac),
1853 X(0x7dc290b3), X(0x7dc4f1eb), X(0x7dc75156), X(0x7dc9aef4),
1854 X(0x7dcc0ac5), X(0x7dce64cc), X(0x7dd0bd07), X(0x7dd31379),
1855 X(0x7dd56821), X(0x7dd7bb01), X(0x7dda0c1a), X(0x7ddc5b6b),
1856 X(0x7ddea8f7), X(0x7de0f4bd), X(0x7de33ebe), X(0x7de586fc),
1857 X(0x7de7cd76), X(0x7dea122e), X(0x7dec5525), X(0x7dee965a),
1858 X(0x7df0d5d0), X(0x7df31386), X(0x7df54f7e), X(0x7df789b8),
1859 X(0x7df9c235), X(0x7dfbf8f5), X(0x7dfe2dfa), X(0x7e006145),
1860 X(0x7e0292d5), X(0x7e04c2ac), X(0x7e06f0cb), X(0x7e091d32),
1861 X(0x7e0b47e1), X(0x7e0d70db), X(0x7e0f981f), X(0x7e11bdaf),
1862 X(0x7e13e18a), X(0x7e1603b3), X(0x7e182429), X(0x7e1a42ed),
1863 X(0x7e1c6001), X(0x7e1e7b64), X(0x7e209518), X(0x7e22ad1d),
1864 X(0x7e24c375), X(0x7e26d81f), X(0x7e28eb1d), X(0x7e2afc70),
1865 X(0x7e2d0c17), X(0x7e2f1a15), X(0x7e31266a), X(0x7e333115),
1866 X(0x7e353a1a), X(0x7e374177), X(0x7e39472e), X(0x7e3b4b3f),
1867 X(0x7e3d4dac), X(0x7e3f4e75), X(0x7e414d9a), X(0x7e434b1e),
1868 X(0x7e4546ff), X(0x7e474140), X(0x7e4939e0), X(0x7e4b30e2),
1869 X(0x7e4d2644), X(0x7e4f1a09), X(0x7e510c30), X(0x7e52fcbc),
1870 X(0x7e54ebab), X(0x7e56d900), X(0x7e58c4bb), X(0x7e5aaedd),
1871 X(0x7e5c9766), X(0x7e5e7e57), X(0x7e6063b2), X(0x7e624776),
1872 X(0x7e6429a5), X(0x7e660a3f), X(0x7e67e945), X(0x7e69c6b8),
1873 X(0x7e6ba299), X(0x7e6d7ce7), X(0x7e6f55a5), X(0x7e712cd3),
1874 X(0x7e730272), X(0x7e74d682), X(0x7e76a904), X(0x7e7879f9),
1875 X(0x7e7a4962), X(0x7e7c173f), X(0x7e7de392), X(0x7e7fae5a),
1876 X(0x7e817799), X(0x7e833f50), X(0x7e85057f), X(0x7e86ca27),
1877 X(0x7e888d49), X(0x7e8a4ee5), X(0x7e8c0efd), X(0x7e8dcd91),
1878 X(0x7e8f8aa1), X(0x7e914630), X(0x7e93003c), X(0x7e94b8c8),
1879 X(0x7e966fd4), X(0x7e982560), X(0x7e99d96e), X(0x7e9b8bfe),
1880 X(0x7e9d3d10), X(0x7e9eeca7), X(0x7ea09ac2), X(0x7ea24762),
1881 X(0x7ea3f288), X(0x7ea59c35), X(0x7ea7446a), X(0x7ea8eb27),
1882 X(0x7eaa906c), X(0x7eac343c), X(0x7eadd696), X(0x7eaf777b),
1883 X(0x7eb116ed), X(0x7eb2b4eb), X(0x7eb45177), X(0x7eb5ec91),
1884 X(0x7eb7863b), X(0x7eb91e74), X(0x7ebab53e), X(0x7ebc4a99),
1885 X(0x7ebdde87), X(0x7ebf7107), X(0x7ec1021b), X(0x7ec291c3),
1886 X(0x7ec42001), X(0x7ec5acd5), X(0x7ec7383f), X(0x7ec8c241),
1887 X(0x7eca4adb), X(0x7ecbd20d), X(0x7ecd57da), X(0x7ecedc41),
1888 X(0x7ed05f44), X(0x7ed1e0e2), X(0x7ed3611d), X(0x7ed4dff6),
1889 X(0x7ed65d6d), X(0x7ed7d983), X(0x7ed95438), X(0x7edacd8f),
1890 X(0x7edc4586), X(0x7eddbc20), X(0x7edf315c), X(0x7ee0a53c),
1891 X(0x7ee217c1), X(0x7ee388ea), X(0x7ee4f8b9), X(0x7ee6672f),
1892 X(0x7ee7d44c), X(0x7ee94012), X(0x7eeaaa80), X(0x7eec1397),
1893 X(0x7eed7b59), X(0x7eeee1c6), X(0x7ef046df), X(0x7ef1aaa5),
1894 X(0x7ef30d18), X(0x7ef46e39), X(0x7ef5ce09), X(0x7ef72c88),
1895 X(0x7ef889b8), X(0x7ef9e599), X(0x7efb402c), X(0x7efc9972),
1896 X(0x7efdf16b), X(0x7eff4818), X(0x7f009d79), X(0x7f01f191),
1897 X(0x7f03445f), X(0x7f0495e4), X(0x7f05e620), X(0x7f073516),
1898 X(0x7f0882c5), X(0x7f09cf2d), X(0x7f0b1a51), X(0x7f0c6430),
1899 X(0x7f0daccc), X(0x7f0ef425), X(0x7f103a3b), X(0x7f117f11),
1900 X(0x7f12c2a5), X(0x7f1404fa), X(0x7f15460f), X(0x7f1685e6),
1901 X(0x7f17c47f), X(0x7f1901db), X(0x7f1a3dfb), X(0x7f1b78e0),
1902 X(0x7f1cb28a), X(0x7f1deafa), X(0x7f1f2231), X(0x7f20582f),
1903 X(0x7f218cf5), X(0x7f22c085), X(0x7f23f2de), X(0x7f252401),
1904 X(0x7f2653f0), X(0x7f2782ab), X(0x7f28b032), X(0x7f29dc87),
1905 X(0x7f2b07aa), X(0x7f2c319c), X(0x7f2d5a5e), X(0x7f2e81f0),
1906 X(0x7f2fa853), X(0x7f30cd88), X(0x7f31f18f), X(0x7f33146a),
1907 X(0x7f343619), X(0x7f35569c), X(0x7f3675f6), X(0x7f379425),
1908 X(0x7f38b12c), X(0x7f39cd0a), X(0x7f3ae7c0), X(0x7f3c0150),
1909 X(0x7f3d19ba), X(0x7f3e30fe), X(0x7f3f471e), X(0x7f405c1a),
1910 X(0x7f416ff3), X(0x7f4282a9), X(0x7f43943e), X(0x7f44a4b2),
1911 X(0x7f45b405), X(0x7f46c239), X(0x7f47cf4e), X(0x7f48db45),
1912 X(0x7f49e61f), X(0x7f4aefdc), X(0x7f4bf87e), X(0x7f4d0004),
1913 X(0x7f4e0670), X(0x7f4f0bc2), X(0x7f500ffb), X(0x7f51131c),
1914 X(0x7f521525), X(0x7f531618), X(0x7f5415f4), X(0x7f5514bb),
1915 X(0x7f56126e), X(0x7f570f0c), X(0x7f580a98), X(0x7f590511),
1916 X(0x7f59fe78), X(0x7f5af6ce), X(0x7f5bee14), X(0x7f5ce44a),
1917 X(0x7f5dd972), X(0x7f5ecd8b), X(0x7f5fc097), X(0x7f60b296),
1918 X(0x7f61a389), X(0x7f629370), X(0x7f63824e), X(0x7f647021),
1919 X(0x7f655ceb), X(0x7f6648ad), X(0x7f673367), X(0x7f681d19),
1920 X(0x7f6905c6), X(0x7f69ed6d), X(0x7f6ad40f), X(0x7f6bb9ad),
1921 X(0x7f6c9e48), X(0x7f6d81e0), X(0x7f6e6475), X(0x7f6f460a),
1922 X(0x7f70269d), X(0x7f710631), X(0x7f71e4c6), X(0x7f72c25c),
1923 X(0x7f739ef4), X(0x7f747a8f), X(0x7f75552e), X(0x7f762ed1),
1924 X(0x7f770779), X(0x7f77df27), X(0x7f78b5db), X(0x7f798b97),
1925 X(0x7f7a605a), X(0x7f7b3425), X(0x7f7c06fa), X(0x7f7cd8d9),
1926 X(0x7f7da9c2), X(0x7f7e79b7), X(0x7f7f48b8), X(0x7f8016c5),
1927 X(0x7f80e3e0), X(0x7f81b009), X(0x7f827b40), X(0x7f834588),
1928 X(0x7f840edf), X(0x7f84d747), X(0x7f859ec1), X(0x7f86654d),
1929 X(0x7f872aec), X(0x7f87ef9e), X(0x7f88b365), X(0x7f897641),
1930 X(0x7f8a3832), X(0x7f8af93a), X(0x7f8bb959), X(0x7f8c7890),
1931 X(0x7f8d36df), X(0x7f8df448), X(0x7f8eb0ca), X(0x7f8f6c67),
1932 X(0x7f90271e), X(0x7f90e0f2), X(0x7f9199e2), X(0x7f9251f0),
1933 X(0x7f93091b), X(0x7f93bf65), X(0x7f9474ce), X(0x7f952958),
1934 X(0x7f95dd01), X(0x7f968fcd), X(0x7f9741ba), X(0x7f97f2ca),
1935 X(0x7f98a2fd), X(0x7f995254), X(0x7f9a00d0), X(0x7f9aae71),
1936 X(0x7f9b5b38), X(0x7f9c0726), X(0x7f9cb23b), X(0x7f9d5c78),
1937 X(0x7f9e05de), X(0x7f9eae6e), X(0x7f9f5627), X(0x7f9ffd0b),
1938 X(0x7fa0a31b), X(0x7fa14856), X(0x7fa1ecbf), X(0x7fa29054),
1939 X(0x7fa33318), X(0x7fa3d50b), X(0x7fa4762c), X(0x7fa5167e),
1940 X(0x7fa5b601), X(0x7fa654b5), X(0x7fa6f29b), X(0x7fa78fb3),
1941 X(0x7fa82bff), X(0x7fa8c77f), X(0x7fa96234), X(0x7fa9fc1e),
1942 X(0x7faa953e), X(0x7fab2d94), X(0x7fabc522), X(0x7fac5be8),
1943 X(0x7facf1e6), X(0x7fad871d), X(0x7fae1b8f), X(0x7faeaf3b),
1944 X(0x7faf4222), X(0x7fafd445), X(0x7fb065a4), X(0x7fb0f641),
1945 X(0x7fb1861b), X(0x7fb21534), X(0x7fb2a38c), X(0x7fb33124),
1946 X(0x7fb3bdfb), X(0x7fb44a14), X(0x7fb4d56f), X(0x7fb5600c),
1947 X(0x7fb5e9ec), X(0x7fb6730f), X(0x7fb6fb76), X(0x7fb78323),
1948 X(0x7fb80a15), X(0x7fb8904d), X(0x7fb915cc), X(0x7fb99a92),
1949 X(0x7fba1ea0), X(0x7fbaa1f7), X(0x7fbb2497), X(0x7fbba681),
1950 X(0x7fbc27b5), X(0x7fbca835), X(0x7fbd2801), X(0x7fbda719),
1951 X(0x7fbe257e), X(0x7fbea331), X(0x7fbf2032), X(0x7fbf9c82),
1952 X(0x7fc01821), X(0x7fc09311), X(0x7fc10d52), X(0x7fc186e4),
1953 X(0x7fc1ffc8), X(0x7fc277ff), X(0x7fc2ef89), X(0x7fc36667),
1954 X(0x7fc3dc9a), X(0x7fc45221), X(0x7fc4c6ff), X(0x7fc53b33),
1955 X(0x7fc5aebe), X(0x7fc621a0), X(0x7fc693db), X(0x7fc7056f),
1956 X(0x7fc7765c), X(0x7fc7e6a3), X(0x7fc85645), X(0x7fc8c542),
1957 X(0x7fc9339b), X(0x7fc9a150), X(0x7fca0e63), X(0x7fca7ad3),
1958 X(0x7fcae6a2), X(0x7fcb51cf), X(0x7fcbbc5c), X(0x7fcc2649),
1959 X(0x7fcc8f97), X(0x7fccf846), X(0x7fcd6058), X(0x7fcdc7cb),
1960 X(0x7fce2ea2), X(0x7fce94dd), X(0x7fcefa7b), X(0x7fcf5f7f),
1961 X(0x7fcfc3e8), X(0x7fd027b7), X(0x7fd08aed), X(0x7fd0ed8b),
1962 X(0x7fd14f90), X(0x7fd1b0fd), X(0x7fd211d4), X(0x7fd27214),
1963 X(0x7fd2d1bf), X(0x7fd330d4), X(0x7fd38f55), X(0x7fd3ed41),
1964 X(0x7fd44a9a), X(0x7fd4a761), X(0x7fd50395), X(0x7fd55f37),
1965 X(0x7fd5ba48), X(0x7fd614c9), X(0x7fd66eba), X(0x7fd6c81b),
1966 X(0x7fd720ed), X(0x7fd77932), X(0x7fd7d0e8), X(0x7fd82812),
1967 X(0x7fd87eae), X(0x7fd8d4bf), X(0x7fd92a45), X(0x7fd97f40),
1968 X(0x7fd9d3b0), X(0x7fda2797), X(0x7fda7af5), X(0x7fdacdca),
1969 X(0x7fdb2018), X(0x7fdb71dd), X(0x7fdbc31c), X(0x7fdc13d5),
1970 X(0x7fdc6408), X(0x7fdcb3b6), X(0x7fdd02df), X(0x7fdd5184),
1971 X(0x7fdd9fa5), X(0x7fdded44), X(0x7fde3a60), X(0x7fde86fb),
1972 X(0x7fded314), X(0x7fdf1eac), X(0x7fdf69c4), X(0x7fdfb45d),
1973 X(0x7fdffe76), X(0x7fe04811), X(0x7fe0912e), X(0x7fe0d9ce),
1974 X(0x7fe121f0), X(0x7fe16996), X(0x7fe1b0c1), X(0x7fe1f770),
1975 X(0x7fe23da4), X(0x7fe2835f), X(0x7fe2c89f), X(0x7fe30d67),
1976 X(0x7fe351b5), X(0x7fe3958c), X(0x7fe3d8ec), X(0x7fe41bd4),
1977 X(0x7fe45e46), X(0x7fe4a042), X(0x7fe4e1c8), X(0x7fe522da),
1978 X(0x7fe56378), X(0x7fe5a3a1), X(0x7fe5e358), X(0x7fe6229b),
1979 X(0x7fe6616d), X(0x7fe69fcc), X(0x7fe6ddbb), X(0x7fe71b39),
1980 X(0x7fe75847), X(0x7fe794e5), X(0x7fe7d114), X(0x7fe80cd5),
1981 X(0x7fe84827), X(0x7fe8830c), X(0x7fe8bd84), X(0x7fe8f78f),
1982 X(0x7fe9312f), X(0x7fe96a62), X(0x7fe9a32b), X(0x7fe9db8a),
1983 X(0x7fea137e), X(0x7fea4b09), X(0x7fea822b), X(0x7feab8e5),
1984 X(0x7feaef37), X(0x7feb2521), X(0x7feb5aa4), X(0x7feb8fc1),
1985 X(0x7febc478), X(0x7febf8ca), X(0x7fec2cb6), X(0x7fec603e),
1986 X(0x7fec9363), X(0x7fecc623), X(0x7fecf881), X(0x7fed2a7c),
1987 X(0x7fed5c16), X(0x7fed8d4e), X(0x7fedbe24), X(0x7fedee9b),
1988 X(0x7fee1eb1), X(0x7fee4e68), X(0x7fee7dc0), X(0x7feeacb9),
1989 X(0x7feedb54), X(0x7fef0991), X(0x7fef3771), X(0x7fef64f5),
1990 X(0x7fef921d), X(0x7fefbee8), X(0x7fefeb59), X(0x7ff0176f),
1991 X(0x7ff0432a), X(0x7ff06e8c), X(0x7ff09995), X(0x7ff0c444),
1992 X(0x7ff0ee9c), X(0x7ff1189b), X(0x7ff14243), X(0x7ff16b94),
1993 X(0x7ff1948e), X(0x7ff1bd32), X(0x7ff1e581), X(0x7ff20d7b),
1994 X(0x7ff2351f), X(0x7ff25c70), X(0x7ff2836d), X(0x7ff2aa17),
1995 X(0x7ff2d06d), X(0x7ff2f672), X(0x7ff31c24), X(0x7ff34185),
1996 X(0x7ff36695), X(0x7ff38b55), X(0x7ff3afc4), X(0x7ff3d3e4),
1997 X(0x7ff3f7b4), X(0x7ff41b35), X(0x7ff43e69), X(0x7ff4614e),
1998 X(0x7ff483e6), X(0x7ff4a631), X(0x7ff4c82f), X(0x7ff4e9e1),
1999 X(0x7ff50b47), X(0x7ff52c62), X(0x7ff54d33), X(0x7ff56db9),
2000 X(0x7ff58df5), X(0x7ff5ade7), X(0x7ff5cd90), X(0x7ff5ecf1),
2001 X(0x7ff60c09), X(0x7ff62ada), X(0x7ff64963), X(0x7ff667a5),
2002 X(0x7ff685a1), X(0x7ff6a357), X(0x7ff6c0c7), X(0x7ff6ddf1),
2003 X(0x7ff6fad7), X(0x7ff71778), X(0x7ff733d6), X(0x7ff74fef),
2004 X(0x7ff76bc6), X(0x7ff78759), X(0x7ff7a2ab), X(0x7ff7bdba),
2005 X(0x7ff7d888), X(0x7ff7f315), X(0x7ff80d61), X(0x7ff8276c),
2006 X(0x7ff84138), X(0x7ff85ac4), X(0x7ff87412), X(0x7ff88d20),
2007 X(0x7ff8a5f0), X(0x7ff8be82), X(0x7ff8d6d7), X(0x7ff8eeef),
2008 X(0x7ff906c9), X(0x7ff91e68), X(0x7ff935cb), X(0x7ff94cf2),
2009 X(0x7ff963dd), X(0x7ff97a8f), X(0x7ff99105), X(0x7ff9a742),
2010 X(0x7ff9bd45), X(0x7ff9d30f), X(0x7ff9e8a0), X(0x7ff9fdf9),
2011 X(0x7ffa131a), X(0x7ffa2803), X(0x7ffa3cb4), X(0x7ffa512f),
2012 X(0x7ffa6573), X(0x7ffa7981), X(0x7ffa8d59), X(0x7ffaa0fc),
2013 X(0x7ffab46a), X(0x7ffac7a3), X(0x7ffadaa8), X(0x7ffaed78),
2014 X(0x7ffb0015), X(0x7ffb127f), X(0x7ffb24b6), X(0x7ffb36bb),
2015 X(0x7ffb488d), X(0x7ffb5a2e), X(0x7ffb6b9d), X(0x7ffb7cdb),
2016 X(0x7ffb8de9), X(0x7ffb9ec6), X(0x7ffbaf73), X(0x7ffbbff1),
2017 X(0x7ffbd03f), X(0x7ffbe05e), X(0x7ffbf04f), X(0x7ffc0012),
2018 X(0x7ffc0fa6), X(0x7ffc1f0d), X(0x7ffc2e47), X(0x7ffc3d54),
2019 X(0x7ffc4c35), X(0x7ffc5ae9), X(0x7ffc6971), X(0x7ffc77ce),
2020 X(0x7ffc8600), X(0x7ffc9407), X(0x7ffca1e4), X(0x7ffcaf96),
2021 X(0x7ffcbd1f), X(0x7ffcca7e), X(0x7ffcd7b4), X(0x7ffce4c1),
2022 X(0x7ffcf1a5), X(0x7ffcfe62), X(0x7ffd0af6), X(0x7ffd1763),
2023 X(0x7ffd23a9), X(0x7ffd2fc8), X(0x7ffd3bc1), X(0x7ffd4793),
2024 X(0x7ffd533f), X(0x7ffd5ec5), X(0x7ffd6a27), X(0x7ffd7563),
2025 X(0x7ffd807a), X(0x7ffd8b6e), X(0x7ffd963d), X(0x7ffda0e8),
2026 X(0x7ffdab70), X(0x7ffdb5d5), X(0x7ffdc017), X(0x7ffdca36),
2027 X(0x7ffdd434), X(0x7ffdde0f), X(0x7ffde7c9), X(0x7ffdf161),
2028 X(0x7ffdfad8), X(0x7ffe042f), X(0x7ffe0d65), X(0x7ffe167b),
2029 X(0x7ffe1f71), X(0x7ffe2848), X(0x7ffe30ff), X(0x7ffe3997),
2030 X(0x7ffe4211), X(0x7ffe4a6c), X(0x7ffe52a9), X(0x7ffe5ac8),
2031 X(0x7ffe62c9), X(0x7ffe6aae), X(0x7ffe7275), X(0x7ffe7a1f),
2032 X(0x7ffe81ad), X(0x7ffe891f), X(0x7ffe9075), X(0x7ffe97b0),
2033 X(0x7ffe9ece), X(0x7ffea5d2), X(0x7ffeacbb), X(0x7ffeb38a),
2034 X(0x7ffeba3e), X(0x7ffec0d8), X(0x7ffec758), X(0x7ffecdbf),
2035 X(0x7ffed40d), X(0x7ffeda41), X(0x7ffee05d), X(0x7ffee660),
2036 X(0x7ffeec4b), X(0x7ffef21f), X(0x7ffef7da), X(0x7ffefd7e),
2037 X(0x7fff030b), X(0x7fff0881), X(0x7fff0de0), X(0x7fff1328),
2038 X(0x7fff185b), X(0x7fff1d77), X(0x7fff227e), X(0x7fff276f),
2039 X(0x7fff2c4b), X(0x7fff3112), X(0x7fff35c4), X(0x7fff3a62),
2040 X(0x7fff3eeb), X(0x7fff4360), X(0x7fff47c2), X(0x7fff4c0f),
2041 X(0x7fff504a), X(0x7fff5471), X(0x7fff5885), X(0x7fff5c87),
2042 X(0x7fff6076), X(0x7fff6452), X(0x7fff681d), X(0x7fff6bd6),
2043 X(0x7fff6f7d), X(0x7fff7313), X(0x7fff7698), X(0x7fff7a0c),
2044 X(0x7fff7d6f), X(0x7fff80c2), X(0x7fff8404), X(0x7fff8736),
2045 X(0x7fff8a58), X(0x7fff8d6b), X(0x7fff906e), X(0x7fff9362),
2046 X(0x7fff9646), X(0x7fff991c), X(0x7fff9be3), X(0x7fff9e9c),
2047 X(0x7fffa146), X(0x7fffa3e2), X(0x7fffa671), X(0x7fffa8f1),
2048 X(0x7fffab65), X(0x7fffadca), X(0x7fffb023), X(0x7fffb26f),
2049 X(0x7fffb4ae), X(0x7fffb6e0), X(0x7fffb906), X(0x7fffbb20),
2050 X(0x7fffbd2e), X(0x7fffbf30), X(0x7fffc126), X(0x7fffc311),
2051 X(0x7fffc4f1), X(0x7fffc6c5), X(0x7fffc88f), X(0x7fffca4d),
2052 X(0x7fffcc01), X(0x7fffcdab), X(0x7fffcf4a), X(0x7fffd0e0),
2053 X(0x7fffd26b), X(0x7fffd3ec), X(0x7fffd564), X(0x7fffd6d2),
2054 X(0x7fffd838), X(0x7fffd993), X(0x7fffdae6), X(0x7fffdc31),
2055 X(0x7fffdd72), X(0x7fffdeab), X(0x7fffdfdb), X(0x7fffe104),
2056 X(0x7fffe224), X(0x7fffe33c), X(0x7fffe44d), X(0x7fffe556),
2057 X(0x7fffe657), X(0x7fffe751), X(0x7fffe844), X(0x7fffe930),
2058 X(0x7fffea15), X(0x7fffeaf3), X(0x7fffebca), X(0x7fffec9b),
2059 X(0x7fffed66), X(0x7fffee2a), X(0x7fffeee8), X(0x7fffefa0),
2060 X(0x7ffff053), X(0x7ffff0ff), X(0x7ffff1a6), X(0x7ffff247),
2061 X(0x7ffff2e4), X(0x7ffff37a), X(0x7ffff40c), X(0x7ffff499),
2062 X(0x7ffff520), X(0x7ffff5a3), X(0x7ffff621), X(0x7ffff69b),
2063 X(0x7ffff710), X(0x7ffff781), X(0x7ffff7ee), X(0x7ffff857),
2064 X(0x7ffff8bb), X(0x7ffff91c), X(0x7ffff979), X(0x7ffff9d2),
2065 X(0x7ffffa27), X(0x7ffffa79), X(0x7ffffac8), X(0x7ffffb13),
2066 X(0x7ffffb5b), X(0x7ffffba0), X(0x7ffffbe2), X(0x7ffffc21),
2067 X(0x7ffffc5d), X(0x7ffffc96), X(0x7ffffccd), X(0x7ffffd01),
2068 X(0x7ffffd32), X(0x7ffffd61), X(0x7ffffd8e), X(0x7ffffdb8),
2069 X(0x7ffffde0), X(0x7ffffe07), X(0x7ffffe2b), X(0x7ffffe4d),
2070 X(0x7ffffe6d), X(0x7ffffe8b), X(0x7ffffea8), X(0x7ffffec3),
2071 X(0x7ffffedc), X(0x7ffffef4), X(0x7fffff0a), X(0x7fffff1f),
2072 X(0x7fffff33), X(0x7fffff45), X(0x7fffff56), X(0x7fffff66),
2073 X(0x7fffff75), X(0x7fffff82), X(0x7fffff8f), X(0x7fffff9a),
2074 X(0x7fffffa5), X(0x7fffffaf), X(0x7fffffb8), X(0x7fffffc0),
2075 X(0x7fffffc8), X(0x7fffffce), X(0x7fffffd5), X(0x7fffffda),
2076 X(0x7fffffdf), X(0x7fffffe4), X(0x7fffffe8), X(0x7fffffeb),
2077 X(0x7fffffef), X(0x7ffffff1), X(0x7ffffff4), X(0x7ffffff6),
2078 X(0x7ffffff8), X(0x7ffffff9), X(0x7ffffffb), X(0x7ffffffc),
2079 X(0x7ffffffd), X(0x7ffffffd), X(0x7ffffffe), X(0x7fffffff),
2080 X(0x7fffffff), X(0x7fffffff), X(0x7fffffff), X(0x7fffffff),
2081 X(0x7fffffff), X(0x7fffffff), X(0x7fffffff), X(0x7fffffff),
2082 X(0x7fffffff), X(0x7fffffff), X(0x7fffffff), X(0x7fffffff),
2083};
2084