porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/arch.h
Go to the documentation of this file.
1 /* Copyright (C) 2003 Jean-Marc Valin */
6 /*
7  Redistribution and use in source and binary forms, with or without
8  modification, are permitted provided that the following conditions
9  are met:
10 
11  - Redistributions of source code must retain the above copyright
12  notice, this list of conditions and the following disclaimer.
13 
14  - Redistributions in binary form must reproduce the above copyright
15  notice, this list of conditions and the following disclaimer in the
16  documentation and/or other materials provided with the distribution.
17 
18  - Neither the name of the Xiph.org Foundation nor the names of its
19  contributors may be used to endorse or promote products derived from
20  this software without specific prior written permission.
21 
22  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
26  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
27  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
28  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
29  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
30  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34 
35 #ifndef ARCH_H
36 #define ARCH_H
37 
38 /* A couple test to catch stupid option combinations */
39 #ifdef FIXED_POINT
40 
41 #if ((defined (ARM4_ASM)||defined (ARM4_ASM)) && defined(BFIN_ASM)) || (defined (ARM4_ASM)&&defined(ARM5E_ASM))
42 #error Make up your mind. What CPU do you have?
43 #endif
44 
45 #else
46 
47 #if defined (ARM4_ASM) || defined(ARM5E_ASM) || defined(BFIN_ASM)
48 #error I suppose you can have a [ARM4/ARM5E/Blackfin] that has float instructions?
49 #endif
50 
51 #endif
52 
53 #ifndef OUTSIDE_SPEEX
54 #include "speex/speexdsp_types.h"
55 #endif
56 
57 #define ABS(x) ((x) < 0 ? (-(x)) : (x))
58 #define ABS16(x) ((x) < 0 ? (-(x)) : (x))
59 #define MIN16(a,b) ((a) < (b) ? (a) : (b))
60 #define MAX16(a,b) ((a) > (b) ? (a) : (b))
61 #define ABS32(x) ((x) < 0 ? (-(x)) : (x))
62 #define MIN32(a,b) ((a) < (b) ? (a) : (b))
63 #define MAX32(a,b) ((a) > (b) ? (a) : (b))
65 #ifdef FIXED_POINT
66 
67 typedef spx_int16_t spx_word16_t;
68 typedef spx_int32_t spx_word32_t;
69 typedef spx_word32_t spx_mem_t;
70 typedef spx_word16_t spx_coef_t;
71 typedef spx_word16_t spx_lsp_t;
72 typedef spx_word32_t spx_sig_t;
73 
74 #define Q15ONE 32767
75 
76 #define LPC_SCALING 8192
77 #define SIG_SCALING 16384
78 #define LSP_SCALING 8192.
79 #define GAMMA_SCALING 32768.
80 #define GAIN_SCALING 64
81 #define GAIN_SCALING_1 0.015625
82 
83 #define LPC_SHIFT 13
84 #define LSP_SHIFT 13
85 #define SIG_SHIFT 14
86 #define GAIN_SHIFT 6
87 
88 #define WORD2INT(x) ((x) < -32767 ? -32768 : ((x) > 32766 ? 32767 : (x)))
89 
90 #define VERY_SMALL 0
91 #define VERY_LARGE32 ((spx_word32_t)2147483647)
92 #define VERY_LARGE16 ((spx_word16_t)32767)
93 #define Q15_ONE ((spx_word16_t)32767)
94 
95 
96 #ifdef FIXED_DEBUG
97 #include "fixed_debug.h"
98 #else
99 
100 #include "fixed_generic.h"
101 
102 #ifdef ARM5E_ASM
103 #include "fixed_arm5e.h"
104 #elif defined (ARM4_ASM)
105 #include "fixed_arm4.h"
106 #elif defined (BFIN_ASM)
107 #include "fixed_bfin.h"
108 #endif
109 
110 #endif
111 
112 
113 #else
114 
115 typedef float spx_mem_t;
116 typedef float spx_coef_t;
117 typedef float spx_lsp_t;
118 typedef float spx_sig_t;
119 typedef float spx_word16_t;
120 typedef float spx_word32_t;
121 
122 #define Q15ONE 1.0f
123 #define LPC_SCALING 1.f
124 #define SIG_SCALING 1.f
125 #define LSP_SCALING 1.f
126 #define GAMMA_SCALING 1.f
127 #define GAIN_SCALING 1.f
128 #define GAIN_SCALING_1 1.f
129 
130 
131 #define VERY_SMALL 1e-15f
132 #define VERY_LARGE32 1e15f
133 #define VERY_LARGE16 1e15f
134 #define Q15_ONE ((spx_word16_t)1.f)
135 
136 #define QCONST16(x,bits) (x)
137 #define QCONST32(x,bits) (x)
138 
139 #define NEG16(x) (-(x))
140 #define NEG32(x) (-(x))
141 #define EXTRACT16(x) (x)
142 #define EXTEND32(x) (x)
143 #define SHR16(a,shift) (a)
144 #define SHL16(a,shift) (a)
145 #define SHR32(a,shift) (a)
146 #define SHL32(a,shift) (a)
147 #define PSHR16(a,shift) (a)
148 #define PSHR32(a,shift) (a)
149 #define VSHR32(a,shift) (a)
150 #define SATURATE16(x,a) (x)
151 #define SATURATE32(x,a) (x)
152 #define SATURATE32PSHR(x,shift,a) (x)
153 
154 #define PSHR(a,shift) (a)
155 #define SHR(a,shift) (a)
156 #define SHL(a,shift) (a)
157 #define SATURATE(x,a) (x)
158 
159 #define ADD16(a,b) ((a)+(b))
160 #define SUB16(a,b) ((a)-(b))
161 #define ADD32(a,b) ((a)+(b))
162 #define SUB32(a,b) ((a)-(b))
163 #define MULT16_16_16(a,b) ((a)*(b))
164 #define MULT16_16(a,b) ((spx_word32_t)(a)*(spx_word32_t)(b))
165 #define MAC16_16(c,a,b) ((c)+(spx_word32_t)(a)*(spx_word32_t)(b))
166 
167 #define MULT16_32_Q11(a,b) ((a)*(b))
168 #define MULT16_32_Q13(a,b) ((a)*(b))
169 #define MULT16_32_Q14(a,b) ((a)*(b))
170 #define MULT16_32_Q15(a,b) ((a)*(b))
171 #define MULT16_32_P15(a,b) ((a)*(b))
172 
173 #define MAC16_32_Q11(c,a,b) ((c)+(a)*(b))
174 #define MAC16_32_Q15(c,a,b) ((c)+(a)*(b))
175 
176 #define MAC16_16_Q11(c,a,b) ((c)+(a)*(b))
177 #define MAC16_16_Q13(c,a,b) ((c)+(a)*(b))
178 #define MAC16_16_P13(c,a,b) ((c)+(a)*(b))
179 #define MULT16_16_Q11_32(a,b) ((a)*(b))
180 #define MULT16_16_Q13(a,b) ((a)*(b))
181 #define MULT16_16_Q14(a,b) ((a)*(b))
182 #define MULT16_16_Q15(a,b) ((a)*(b))
183 #define MULT16_16_P15(a,b) ((a)*(b))
184 #define MULT16_16_P13(a,b) ((a)*(b))
185 #define MULT16_16_P14(a,b) ((a)*(b))
186 
187 #define DIV32_16(a,b) (((spx_word32_t)(a))/(spx_word16_t)(b))
188 #define PDIV32_16(a,b) (((spx_word32_t)(a))/(spx_word16_t)(b))
189 #define DIV32(a,b) (((spx_word32_t)(a))/(spx_word32_t)(b))
190 #define PDIV32(a,b) (((spx_word32_t)(a))/(spx_word32_t)(b))
191 
192 #define WORD2INT(x) ((x) < -32767.5f ? -32768 : \
193  ((x) > 32766.5f ? 32767 : (spx_int16_t)floor(.5 + (x))))
194 #endif
195 
196 
197 #if defined (CONFIG_TI_C54X) || defined (CONFIG_TI_C55X)
198 
199 /* 2 on TI C5x DSP */
200 #define BYTES_PER_CHAR 2
201 #define BITS_PER_CHAR 16
202 #define LOG2_BITS_PER_CHAR 4
203 
204 #else
205 
206 #define BYTES_PER_CHAR 1
207 #define BITS_PER_CHAR 8
208 #define LOG2_BITS_PER_CHAR 3
209 
210 #endif
211 
212 
213 
214 #ifdef FIXED_DEBUG
215 extern long long spx_mips;
216 #endif
217 
218 
219 #endif
spx_coef_t
float spx_coef_t
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/arch.h:116
spx_sig_t
float spx_sig_t
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/arch.h:118
spx_lsp_t
float spx_lsp_t
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/arch.h:117
spx_mem_t
float spx_mem_t
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/arch.h:115
spx_word16_t
float spx_word16_t
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/arch.h:119
spx_word32_t
float spx_word32_t
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/arch.h:120


picovoice_driver
Author(s):
autogenerated on Fri Apr 1 2022 02:13:47