Main Page | Class List | Directories | File List | Class Members | File Members

arch.h

Go to the documentation of this file.
00001 /* Copyright (C) 2003 Jean-Marc Valin */
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 #define ABS(x) ((x) < 0 ? (-(x)) : (x))
00039 
00040 #ifdef FIXED_POINT
00041 
00042 typedef signed short spx_word16_t;
00043 typedef signed int   spx_word32_t;
00044 typedef long long    spx_word64_t;
00045 typedef spx_word32_t spx_mem_t;
00046 typedef spx_word16_t spx_coef_t;
00047 typedef spx_word16_t spx_lsp_t;
00048 typedef spx_word32_t spx_sig_t;
00049 
00050 #define LPC_SCALING  8192
00051 #define SIG_SCALING  16384
00052 #define LSP_SCALING  8192.
00053 #define GAMMA_SCALING 32768.
00054 #define GAIN_SCALING 64
00055 #define GAIN_SCALING_1 0.015625
00056 
00057 #define LPC_SHIFT    13
00058 #define SIG_SHIFT    14
00059 
00060 #define VERY_SMALL 0
00061 
00062 
00063 #ifdef ARM_ASM
00064 #include "fixed_arm.h"
00065 #elif defined (FIXED_DEBUG)
00066 #include "fixed_debug.h"
00067 #else
00068 #include "fixed_generic.h"
00069 #endif
00070 
00071 
00072 
00073 #else
00074 
00075 typedef float spx_mem_t;
00076 typedef float spx_coef_t;
00077 typedef float spx_lsp_t;
00078 typedef float spx_sig_t;
00079 typedef float spx_word16_t;
00080 typedef float spx_word32_t;
00081 typedef float spx_word64_t;
00082 
00083 #define LPC_SCALING  1.
00084 #define SIG_SCALING  1.
00085 #define LSP_SCALING  1.
00086 #define GAMMA_SCALING 1.
00087 #define GAIN_SCALING 1.
00088 #define GAIN_SCALING_1 1.
00089 
00090 #define LPC_SHIFT    0
00091 #define SIG_SHIFT    0
00092 
00093 #define VERY_SMALL 1e-30
00094 
00095 #define PSHR(a,shift)       (a)
00096 #define SHR(a,shift)       (a)
00097 #define SHL(a,shift)       (a)
00098 #define SATURATE(x,a) (x)
00099 
00100 #define ADD16(a,b) ((a)+(b))
00101 #define SUB16(a,b) ((a)-(b))
00102 #define ADD32(a,b) ((a)+(b))
00103 #define SUB32(a,b) ((a)-(b))
00104 #define ADD64(a,b) ((a)+(b))
00105 #define MULT16_16_16(a,b)     ((a)*(b))
00106 #define MULT16_16(a,b)     ((a)*(b))
00107 #define MAC16_16(c,a,b)     ((c)+(a)*(b))
00108 
00109 #define MULT16_32_Q11(a,b)     ((a)*(b))
00110 #define MULT16_32_Q13(a,b)     ((a)*(b))
00111 #define MULT16_32_Q14(a,b)     ((a)*(b))
00112 #define MULT16_32_Q15(a,b)     ((a)*(b))
00113 
00114 #define MAC16_32_Q11(c,a,b)     ((c)+(a)*(b))
00115 #define MAC16_32_Q15(c,a,b)     ((c)+(a)*(b))
00116 
00117 #define MAC16_16_Q11(c,a,b)     ((c)+(a)*(b))
00118 #define MULT16_16_Q11(a,b)     ((a)*(b))
00119 #define MULT16_16_Q13(a,b)     ((a)*(b))
00120 #define MULT16_16_Q14(a,b)     ((a)*(b))
00121 #define MULT16_16_Q15(a,b)     ((a)*(b))
00122 
00123 #define DIV32_16(a,b)     ((a)/(b))
00124 #define DIV32(a,b)     ((a)/(b))
00125 
00126 
00127 #endif
00128 
00129 
00130 
00131 #endif

Generated on Tue May 17 12:46:54 2005 for speex by  doxygen 1.4.2