44#error You cannot compile as floating point and fixed point at the same time
47#error SSE is only for floating-point
49#if ((defined (ARM4_ASM)||defined (ARM4_ASM)) && defined(BFIN_ASM)) || (defined (ARM4_ASM)&&defined(ARM5E_ASM))
50#error Make up your mind. What CPU do you have?
53#error Vorbis-psy model currently not implemented in fixed-point
59#error You now need to define either FIXED_POINT or FLOATING_POINT
61#if defined (ARM4_ASM) || defined(ARM5E_ASM) || defined(BFIN_ASM)
62#error I suppose you can have a [ARM4/ARM5E/Blackfin] that has float instructions?
64#ifdef FIXED_POINT_DEBUG
65#error "Don't you think enabling fixed-point is a good thing to do if you want to debug that?"
72#include "speex/speexdsp_types.h"
75#define ABS(x) ((x) < 0 ? (-(x)) : (x))
76#define ABS16(x) ((x) < 0 ? (-(x)) : (x))
77#define MIN16(a,b) ((a) < (b) ? (a) : (b))
78#define MAX16(a,b) ((a) > (b) ? (a) : (b))
79#define ABS32(x) ((x) < 0 ? (-(x)) : (x))
80#define MIN32(a,b) ((a) < (b) ? (a) : (b))
81#define MAX32(a,b) ((a) > (b) ? (a) : (b))
94#define LPC_SCALING 8192
95#define SIG_SCALING 16384
96#define LSP_SCALING 8192.
97#define GAMMA_SCALING 32768.
98#define GAIN_SCALING 64
99#define GAIN_SCALING_1 0.015625
107#define VERY_LARGE32 ((spx_word32_t)2147483647)
108#define VERY_LARGE16 ((spx_word16_t)32767)
109#define Q15_ONE ((spx_word16_t)32767)
113#include "fixed_debug.h"
119#include "fixed_arm5e.h"
120#elif defined (ARM4_ASM)
121#include "fixed_arm4.h"
122#elif defined (BFIN_ASM)
123#include "fixed_bfin.h"
139#define LPC_SCALING 1.f
140#define SIG_SCALING 1.f
141#define LSP_SCALING 1.f
142#define GAMMA_SCALING 1.f
143#define GAIN_SCALING 1.f
144#define GAIN_SCALING_1 1.f
147#define VERY_SMALL 1e-15f
148#define VERY_LARGE32 1e15f
149#define VERY_LARGE16 1e15f
150#define Q15_ONE ((spx_word16_t)1.f)
152#define QCONST16(x,bits) (x)
153#define QCONST32(x,bits) (x)
155#define NEG16(x) (-(x))
156#define NEG32(x) (-(x))
157#define EXTRACT16(x) (x)
158#define EXTEND32(x) (x)
159#define SHR16(a,shift) (a)
160#define SHL16(a,shift) (a)
161#define SHR32(a,shift) (a)
162#define SHL32(a,shift) (a)
163#define PSHR16(a,shift) (a)
164#define PSHR32(a,shift) (a)
165#define VSHR32(a,shift) (a)
166#define SATURATE16(x,a) (x)
167#define SATURATE32(x,a) (x)
168#define SATURATE32PSHR(x,shift,a) (x)
170#define PSHR(a,shift) (a)
171#define SHR(a,shift) (a)
172#define SHL(a,shift) (a)
173#define SATURATE(x,a) (x)
175#define ADD16(a,b) ((a)+(b))
176#define SUB16(a,b) ((a)-(b))
177#define ADD32(a,b) ((a)+(b))
178#define SUB32(a,b) ((a)-(b))
179#define MULT16_16_16(a,b) ((a)*(b))
180#define MULT16_16(a,b) ((spx_word32_t)(a)*(spx_word32_t)(b))
181#define MAC16_16(c,a,b) ((c)+(spx_word32_t)(a)*(spx_word32_t)(b))
183#define MULT16_32_Q11(a,b) ((a)*(b))
184#define MULT16_32_Q13(a,b) ((a)*(b))
185#define MULT16_32_Q14(a,b) ((a)*(b))
186#define MULT16_32_Q15(a,b) ((a)*(b))
187#define MULT16_32_P15(a,b) ((a)*(b))
189#define MAC16_32_Q11(c,a,b) ((c)+(a)*(b))
190#define MAC16_32_Q15(c,a,b) ((c)+(a)*(b))
192#define MAC16_16_Q11(c,a,b) ((c)+(a)*(b))
193#define MAC16_16_Q13(c,a,b) ((c)+(a)*(b))
194#define MAC16_16_P13(c,a,b) ((c)+(a)*(b))
195#define MULT16_16_Q11_32(a,b) ((a)*(b))
196#define MULT16_16_Q13(a,b) ((a)*(b))
197#define MULT16_16_Q14(a,b) ((a)*(b))
198#define MULT16_16_Q15(a,b) ((a)*(b))
199#define MULT16_16_P15(a,b) ((a)*(b))
200#define MULT16_16_P13(a,b) ((a)*(b))
201#define MULT16_16_P14(a,b) ((a)*(b))
203#define DIV32_16(a,b) (((spx_word32_t)(a))/(spx_word16_t)(b))
204#define PDIV32_16(a,b) (((spx_word32_t)(a))/(spx_word16_t)(b))
205#define DIV32(a,b) (((spx_word32_t)(a))/(spx_word32_t)(b))
206#define PDIV32(a,b) (((spx_word32_t)(a))/(spx_word32_t)(b))
212#if defined (CONFIG_TI_C54X) || defined (CONFIG_TI_C55X)
215#define BYTES_PER_CHAR 2
216#define BITS_PER_CHAR 16
217#define LOG2_BITS_PER_CHAR 4
221#define BYTES_PER_CHAR 1
222#define BITS_PER_CHAR 8
223#define LOG2_BITS_PER_CHAR 3
230extern long long spx_mips;
Generic fixed-point operations.