bowen liu
/
mbed-os-example-blinky
ex
Fork of mbed-os-example-mbed5-blinky by
Embed:
(wiki syntax)
Show/hide line numbers
arch.h
Go to the documentation of this file.
00001 /* Copyright (C) 2003 Jean-Marc Valin */ 00002 /** 00003 @file arch.h 00004 @brief Various architecture definitions Speex 00005 */ 00006 /* 00007 Redistribution and use in source and binary forms, with or without 00008 modification, are permitted provided that the following conditions 00009 are met: 00010 00011 - Redistributions of source code must retain the above copyright 00012 notice, this list of conditions and the following disclaimer. 00013 00014 - Redistributions in binary form must reproduce the above copyright 00015 notice, this list of conditions and the following disclaimer in the 00016 documentation and/or other materials provided with the distribution. 00017 00018 - Neither the name of the Xiph.org Foundation nor the names of its 00019 contributors may be used to endorse or promote products derived from 00020 this software without specific prior written permission. 00021 00022 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00023 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00024 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00025 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR 00026 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00027 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00028 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00029 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00030 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00031 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00032 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00033 */ 00034 00035 #ifndef ARCH_H 00036 #define ARCH_H 00037 00038 #ifndef OUTSIDE_SPEEX 00039 #include "speex/speex_types.h" 00040 #endif 00041 00042 #define ABS(x) ((x) < 0 ? (-(x)) : (x)) /**< Absolute integer value. */ 00043 #define ABS16(x) ((x) < 0 ? (-(x)) : (x)) /**< Absolute 16-bit value. */ 00044 #define MIN16(a,b) ((a) < (b) ? (a) : (b)) /**< Maximum 16-bit value. */ 00045 #define MAX16(a,b) ((a) > (b) ? (a) : (b)) /**< Maximum 16-bit value. */ 00046 #define ABS32(x) ((x) < 0 ? (-(x)) : (x)) /**< Absolute 32-bit value. */ 00047 #define MIN32(a,b) ((a) < (b) ? (a) : (b)) /**< Maximum 32-bit value. */ 00048 #define MAX32(a,b) ((a) > (b) ? (a) : (b)) /**< Maximum 32-bit value. */ 00049 00050 #ifdef FIXED_POINT 00051 00052 typedef spx_int16_t spx_word16_t; 00053 typedef spx_int32_t spx_word32_t; 00054 typedef spx_word32_t spx_mem_t; 00055 typedef spx_word16_t spx_coef_t; 00056 typedef spx_word16_t spx_lsp_t; 00057 typedef spx_word32_t spx_sig_t; 00058 00059 #define Q15ONE 32767 00060 00061 #define LPC_SCALING 8192 00062 #define SIG_SCALING 16384 00063 #define LSP_SCALING 8192. 00064 #define GAMMA_SCALING 32768. 00065 #define GAIN_SCALING 64 00066 #define GAIN_SCALING_1 0.015625 00067 00068 #define LPC_SHIFT 13 00069 #define LSP_SHIFT 13 00070 #define SIG_SHIFT 14 00071 00072 #define VERY_SMALL 0 00073 #define VERY_LARGE32 ((spx_word32_t)2147483647) 00074 #define VERY_LARGE16 ((spx_word16_t)32767) 00075 #define Q15_ONE ((spx_word16_t)32767) 00076 00077 00078 #ifdef FIXED_DEBUG 00079 #include "fixed_debug.h" 00080 #else 00081 00082 #include "fixed_generic.h" 00083 00084 #ifdef ARM5E_ASM 00085 #include "fixed_arm5e.h" 00086 #elif defined (ARM4_ASM) 00087 #include "fixed_arm4.h" 00088 #elif defined (ARM5E_ASM) 00089 #include "fixed_arm5e.h" 00090 #elif defined (BFIN_ASM) 00091 #include "fixed_bfin.h" 00092 #endif 00093 00094 #endif 00095 00096 00097 #else 00098 00099 typedef float spx_mem_t; 00100 typedef float spx_coef_t; 00101 typedef float spx_lsp_t; 00102 typedef float spx_sig_t; 00103 typedef float spx_word16_t; 00104 typedef float spx_word32_t; 00105 00106 #define Q15ONE 1.0f 00107 #define LPC_SCALING 1.f 00108 #define SIG_SCALING 1.f 00109 #define LSP_SCALING 1.f 00110 #define GAMMA_SCALING 1.f 00111 #define GAIN_SCALING 1.f 00112 #define GAIN_SCALING_1 1.f 00113 00114 #define LPC_SHIFT 0 00115 #define LSP_SHIFT 0 00116 #define SIG_SHIFT 0 00117 00118 #define VERY_SMALL 1e-15f 00119 #define VERY_LARGE32 1e15f 00120 #define VERY_LARGE16 1e15f 00121 #define Q15_ONE ((spx_word16_t)1.f) 00122 00123 #define QCONST16(x,bits) (x) 00124 #define QCONST32(x,bits) (x) 00125 00126 #define NEG16(x) (-(x)) 00127 #define NEG32(x) (-(x)) 00128 #define EXTRACT16(x) (x) 00129 #define EXTEND32(x) (x) 00130 #define SHR16(a,shift) (a) 00131 #define SHL16(a,shift) (a) 00132 #define SHR32(a,shift) (a) 00133 #define SHL32(a,shift) (a) 00134 #define PSHR16(a,shift) (a) 00135 #define PSHR32(a,shift) (a) 00136 #define VSHR32(a,shift) (a) 00137 #define SATURATE16(x,a) (x) 00138 #define SATURATE32(x,a) (x) 00139 00140 #define PSHR(a,shift) (a) 00141 #define SHR(a,shift) (a) 00142 #define SHL(a,shift) (a) 00143 #define SATURATE(x,a) (x) 00144 00145 #define ADD16(a,b) ((a)+(b)) 00146 #define SUB16(a,b) ((a)-(b)) 00147 #define ADD32(a,b) ((a)+(b)) 00148 #define SUB32(a,b) ((a)-(b)) 00149 #define MULT16_16_16(a,b) ((a)*(b)) 00150 #define MULT16_16(a,b) ((spx_word32_t)(a)*(spx_word32_t)(b)) 00151 #define MAC16_16(c,a,b) ((c)+(spx_word32_t)(a)*(spx_word32_t)(b)) 00152 00153 #define MULT16_32_Q11(a,b) ((a)*(b)) 00154 #define MULT16_32_Q13(a,b) ((a)*(b)) 00155 #define MULT16_32_Q14(a,b) ((a)*(b)) 00156 #define MULT16_32_Q15(a,b) ((a)*(b)) 00157 #define MULT16_32_P15(a,b) ((a)*(b)) 00158 00159 #define MAC16_32_Q11(c,a,b) ((c)+(a)*(b)) 00160 #define MAC16_32_Q15(c,a,b) ((c)+(a)*(b)) 00161 00162 #define MAC16_16_Q11(c,a,b) ((c)+(a)*(b)) 00163 #define MAC16_16_Q13(c,a,b) ((c)+(a)*(b)) 00164 #define MAC16_16_P13(c,a,b) ((c)+(a)*(b)) 00165 #define MULT16_16_Q11_32(a,b) ((a)*(b)) 00166 #define MULT16_16_Q13(a,b) ((a)*(b)) 00167 #define MULT16_16_Q14(a,b) ((a)*(b)) 00168 #define MULT16_16_Q15(a,b) ((a)*(b)) 00169 #define MULT16_16_P15(a,b) ((a)*(b)) 00170 #define MULT16_16_P13(a,b) ((a)*(b)) 00171 #define MULT16_16_P14(a,b) ((a)*(b)) 00172 00173 #define DIV32_16(a,b) (((spx_word32_t)(a))/(spx_word16_t)(b)) 00174 #define PDIV32_16(a,b) (((spx_word32_t)(a))/(spx_word16_t)(b)) 00175 #define DIV32(a,b) (((spx_word32_t)(a))/(spx_word32_t)(b)) 00176 #define PDIV32(a,b) (((spx_word32_t)(a))/(spx_word32_t)(b)) 00177 00178 00179 #endif 00180 00181 00182 #if defined (CONFIG_TI_C54X) || defined (CONFIG_TI_C55X) 00183 00184 /* 2 on TI C5x DSP */ 00185 #define BYTES_PER_CHAR 2 00186 #define BITS_PER_CHAR 16 00187 #define LOG2_BITS_PER_CHAR 4 00188 00189 #else 00190 00191 #define BYTES_PER_CHAR 1 00192 #define BITS_PER_CHAR 8 00193 #define LOG2_BITS_PER_CHAR 3 00194 00195 #endif 00196 00197 #endif
Generated on Tue Jul 12 2022 16:28:52 by 1.7.2