| OLD | NEW |
| 1 /* Copyright (c) 2003-2008 Jean-Marc Valin | 1 /* Copyright (c) 2003-2008 Jean-Marc Valin |
| 2 Copyright (c) 2007-2008 CSIRO | 2 Copyright (c) 2007-2008 CSIRO |
| 3 Copyright (c) 2007-2009 Xiph.Org Foundation | 3 Copyright (c) 2007-2009 Xiph.Org Foundation |
| 4 Written by Jean-Marc Valin */ | 4 Written by Jean-Marc Valin */ |
| 5 /** | 5 /** |
| 6 @file arch.h | 6 @file arch.h |
| 7 @brief Various architecture definitions for CELT | 7 @brief Various architecture definitions for CELT |
| 8 */ | 8 */ |
| 9 /* | 9 /* |
| 10 Redistribution and use in source and binary forms, with or without | 10 Redistribution and use in source and binary forms, with or without |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 93 |
| 94 #define Q15ONE 32767 | 94 #define Q15ONE 32767 |
| 95 | 95 |
| 96 #define SIG_SHIFT 12 | 96 #define SIG_SHIFT 12 |
| 97 | 97 |
| 98 #define NORM_SCALING 16384 | 98 #define NORM_SCALING 16384 |
| 99 | 99 |
| 100 #define DB_SHIFT 10 | 100 #define DB_SHIFT 10 |
| 101 | 101 |
| 102 #define EPSILON 1 | 102 #define EPSILON 1 |
| 103 #define VERY_SMALL 0 |
| 103 #define VERY_LARGE16 ((opus_val16)32767) | 104 #define VERY_LARGE16 ((opus_val16)32767) |
| 104 #define Q15_ONE ((opus_val16)32767) | 105 #define Q15_ONE ((opus_val16)32767) |
| 105 | 106 |
| 106 #define SCALEIN(a) (a) | 107 #define SCALEIN(a) (a) |
| 107 #define SCALEOUT(a) (a) | 108 #define SCALEOUT(a) (a) |
| 108 | 109 |
| 109 #ifdef FIXED_DEBUG | 110 #ifdef FIXED_DEBUG |
| 110 #include "fixed_debug.h" | 111 #include "fixed_debug.h" |
| 111 #else | 112 #else |
| 112 | 113 |
| 113 #include "fixed_generic.h" | 114 #include "fixed_generic.h" |
| 114 | 115 |
| 115 #ifdef ARM5E_ASM | 116 #ifdef ARMv5E_ASM |
| 116 #include "fixed_arm5e.h" | 117 #include "arm/fixed_armv5e.h" |
| 117 #elif defined (ARM4_ASM) | 118 #elif defined (ARMv4_ASM) |
| 118 #include "fixed_arm4.h" | 119 #include "arm/fixed_armv4.h" |
| 119 #elif defined (BFIN_ASM) | 120 #elif defined (BFIN_ASM) |
| 120 #include "fixed_bfin.h" | 121 #include "fixed_bfin.h" |
| 121 #elif defined (TI_C5X_ASM) | 122 #elif defined (TI_C5X_ASM) |
| 122 #include "fixed_c5x.h" | 123 #include "fixed_c5x.h" |
| 123 #elif defined (TI_C6X_ASM) | 124 #elif defined (TI_C6X_ASM) |
| 124 #include "fixed_c6x.h" | 125 #include "fixed_c6x.h" |
| 125 #endif | 126 #endif |
| 126 | 127 |
| 127 #endif | 128 #endif |
| 128 | 129 |
| 129 #else /* FIXED_POINT */ | 130 #else /* FIXED_POINT */ |
| 130 | 131 |
| 131 typedef float opus_val16; | 132 typedef float opus_val16; |
| 132 typedef float opus_val32; | 133 typedef float opus_val32; |
| 133 | 134 |
| 134 typedef float celt_sig; | 135 typedef float celt_sig; |
| 135 typedef float celt_norm; | 136 typedef float celt_norm; |
| 136 typedef float celt_ener; | 137 typedef float celt_ener; |
| 137 | 138 |
| 138 #define Q15ONE 1.0f | 139 #define Q15ONE 1.0f |
| 139 | 140 |
| 140 #define NORM_SCALING 1.f | 141 #define NORM_SCALING 1.f |
| 141 | 142 |
| 142 #define EPSILON 1e-15f | 143 #define EPSILON 1e-15f |
| 144 #define VERY_SMALL 1e-30f |
| 143 #define VERY_LARGE16 1e15f | 145 #define VERY_LARGE16 1e15f |
| 144 #define Q15_ONE ((opus_val16)1.f) | 146 #define Q15_ONE ((opus_val16)1.f) |
| 145 | 147 |
| 146 #define QCONST16(x,bits) (x) | 148 #define QCONST16(x,bits) (x) |
| 147 #define QCONST32(x,bits) (x) | 149 #define QCONST32(x,bits) (x) |
| 148 | 150 |
| 149 #define NEG16(x) (-(x)) | 151 #define NEG16(x) (-(x)) |
| 150 #define NEG32(x) (-(x)) | 152 #define NEG32(x) (-(x)) |
| 151 #define EXTRACT16(x) (x) | 153 #define EXTRACT16(x) (x) |
| 152 #define EXTEND32(x) (x) | 154 #define EXTEND32(x) (x) |
| 153 #define SHR16(a,shift) (a) | 155 #define SHR16(a,shift) (a) |
| 154 #define SHL16(a,shift) (a) | 156 #define SHL16(a,shift) (a) |
| 155 #define SHR32(a,shift) (a) | 157 #define SHR32(a,shift) (a) |
| 156 #define SHL32(a,shift) (a) | 158 #define SHL32(a,shift) (a) |
| 157 #define PSHR32(a,shift) (a) | 159 #define PSHR32(a,shift) (a) |
| 158 #define VSHR32(a,shift) (a) | 160 #define VSHR32(a,shift) (a) |
| 159 | 161 |
| 160 #define PSHR(a,shift) (a) | 162 #define PSHR(a,shift) (a) |
| 161 #define SHR(a,shift) (a) | 163 #define SHR(a,shift) (a) |
| 162 #define SHL(a,shift) (a) | 164 #define SHL(a,shift) (a) |
| 163 #define SATURATE(x,a) (x) | 165 #define SATURATE(x,a) (x) |
| 166 #define SATURATE16(x) (x) |
| 164 | 167 |
| 165 #define ROUND16(a,shift) (a) | 168 #define ROUND16(a,shift) (a) |
| 166 #define HALF16(x) (.5f*(x)) | 169 #define HALF16(x) (.5f*(x)) |
| 167 #define HALF32(x) (.5f*(x)) | 170 #define HALF32(x) (.5f*(x)) |
| 168 | 171 |
| 169 #define ADD16(a,b) ((a)+(b)) | 172 #define ADD16(a,b) ((a)+(b)) |
| 170 #define SUB16(a,b) ((a)-(b)) | 173 #define SUB16(a,b) ((a)-(b)) |
| 171 #define ADD32(a,b) ((a)+(b)) | 174 #define ADD32(a,b) ((a)+(b)) |
| 172 #define SUB32(a,b) ((a)-(b)) | 175 #define SUB32(a,b) ((a)-(b)) |
| 173 #define MULT16_16_16(a,b) ((a)*(b)) | 176 #define MULT16_16_16(a,b) ((a)*(b)) |
| 174 #define MULT16_16(a,b) ((opus_val32)(a)*(opus_val32)(b)) | 177 #define MULT16_16(a,b) ((opus_val32)(a)*(opus_val32)(b)) |
| 175 #define MAC16_16(c,a,b) ((c)+(opus_val32)(a)*(opus_val32)(b)) | 178 #define MAC16_16(c,a,b) ((c)+(opus_val32)(a)*(opus_val32)(b)) |
| 176 | 179 |
| 177 #define MULT16_32_Q15(a,b) ((a)*(b)) | 180 #define MULT16_32_Q15(a,b) ((a)*(b)) |
| 178 #define MULT16_32_Q16(a,b) ((a)*(b)) | 181 #define MULT16_32_Q16(a,b) ((a)*(b)) |
| 179 | 182 |
| 180 #define MULT32_32_Q31(a,b) ((a)*(b)) | 183 #define MULT32_32_Q31(a,b) ((a)*(b)) |
| 181 | 184 |
| 182 #define MAC16_32_Q15(c,a,b) ((c)+(a)*(b)) | 185 #define MAC16_32_Q15(c,a,b) ((c)+(a)*(b)) |
| 183 | 186 |
| 184 #define MULT16_16_Q11_32(a,b) ((a)*(b)) | 187 #define MULT16_16_Q11_32(a,b) ((a)*(b)) |
| 188 #define MULT16_16_Q11(a,b) ((a)*(b)) |
| 185 #define MULT16_16_Q13(a,b) ((a)*(b)) | 189 #define MULT16_16_Q13(a,b) ((a)*(b)) |
| 186 #define MULT16_16_Q14(a,b) ((a)*(b)) | 190 #define MULT16_16_Q14(a,b) ((a)*(b)) |
| 187 #define MULT16_16_Q15(a,b) ((a)*(b)) | 191 #define MULT16_16_Q15(a,b) ((a)*(b)) |
| 188 #define MULT16_16_P15(a,b) ((a)*(b)) | 192 #define MULT16_16_P15(a,b) ((a)*(b)) |
| 189 #define MULT16_16_P13(a,b) ((a)*(b)) | 193 #define MULT16_16_P13(a,b) ((a)*(b)) |
| 190 #define MULT16_16_P14(a,b) ((a)*(b)) | 194 #define MULT16_16_P14(a,b) ((a)*(b)) |
| 191 #define MULT16_32_P16(a,b) ((a)*(b)) | 195 #define MULT16_32_P16(a,b) ((a)*(b)) |
| 192 | 196 |
| 193 #define DIV32_16(a,b) (((opus_val32)(a))/(opus_val16)(b)) | 197 #define DIV32_16(a,b) (((opus_val32)(a))/(opus_val16)(b)) |
| 194 #define DIV32(a,b) (((opus_val32)(a))/(opus_val32)(b)) | 198 #define DIV32(a,b) (((opus_val32)(a))/(opus_val32)(b)) |
| 195 | 199 |
| 196 #define SCALEIN(a) ((a)*CELT_SIG_SCALE) | 200 #define SCALEIN(a) ((a)*CELT_SIG_SCALE) |
| 197 #define SCALEOUT(a) ((a)*(1/CELT_SIG_SCALE)) | 201 #define SCALEOUT(a) ((a)*(1/CELT_SIG_SCALE)) |
| 198 | 202 |
| 199 #endif /* !FIXED_POINT */ | 203 #endif /* !FIXED_POINT */ |
| 200 | 204 |
| 201 #ifndef GLOBAL_STACK_SIZE | 205 #ifndef GLOBAL_STACK_SIZE |
| 202 #ifdef FIXED_POINT | 206 #ifdef FIXED_POINT |
| 203 #define GLOBAL_STACK_SIZE 100000 | 207 #define GLOBAL_STACK_SIZE 100000 |
| 204 #else | 208 #else |
| 205 #define GLOBAL_STACK_SIZE 100000 | 209 #define GLOBAL_STACK_SIZE 100000 |
| 206 #endif | 210 #endif |
| 207 #endif | 211 #endif |
| 208 | 212 |
| 209 #endif /* ARCH_H */ | 213 #endif /* ARCH_H */ |
| OLD | NEW |