| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
#ifndef ARCH_H |
| 36 |
#define ARCH_H |
| 37 |
|
| 38 |
#include "speex/speex_types.h" |
| 39 |
|
| 40 |
#define ABS(x) ((x) < 0 ? (-(x)) : (x)) |
| 41 |
|
| 42 |
#ifdef FIXED_POINT |
| 43 |
|
| 44 |
typedef spx_int16_t spx_word16_t; |
| 45 |
typedef spx_int32_t spx_word32_t; |
| 46 |
#ifdef _MSC_VER |
| 47 |
typedef __int64 spx_word64_t; |
| 48 |
#else |
| 49 |
typedef long long spx_word64_t; |
| 50 |
#endif |
| 51 |
typedef spx_word32_t spx_mem_t; |
| 52 |
typedef spx_word16_t spx_coef_t; |
| 53 |
typedef spx_word16_t spx_lsp_t; |
| 54 |
typedef spx_word32_t spx_sig_t; |
| 55 |
|
| 56 |
#define LPC_SCALING 8192 |
| 57 |
#define SIG_SCALING 16384 |
| 58 |
#define LSP_SCALING 8192. |
| 59 |
#define GAMMA_SCALING 32768. |
| 60 |
#define GAIN_SCALING 64 |
| 61 |
#define GAIN_SCALING_1 0.015625 |
| 62 |
|
| 63 |
#define LPC_SHIFT 13 |
| 64 |
#define SIG_SHIFT 14 |
| 65 |
|
| 66 |
#define VERY_SMALL 0 |
| 67 |
|
| 68 |
|
| 69 |
#ifdef ARM5E_ASM |
| 70 |
#include "fixed_arm5e.h" |
| 71 |
#elif defined (ARM4_ASM) |
| 72 |
#include "fixed_arm4.h" |
| 73 |
#elif defined (FIXED_DEBUG) |
| 74 |
#include "fixed_debug.h" |
| 75 |
#else |
| 76 |
#include "fixed_generic.h" |
| 77 |
#endif |
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
#else |
| 82 |
|
| 83 |
typedef float spx_mem_t; |
| 84 |
typedef float spx_coef_t; |
| 85 |
typedef float spx_lsp_t; |
| 86 |
typedef float spx_sig_t; |
| 87 |
typedef float spx_word16_t; |
| 88 |
typedef float spx_word32_t; |
| 89 |
typedef float spx_word64_t; |
| 90 |
|
| 91 |
#define LPC_SCALING 1. |
| 92 |
#define SIG_SCALING 1. |
| 93 |
#define LSP_SCALING 1. |
| 94 |
#define GAMMA_SCALING 1. |
| 95 |
#define GAIN_SCALING 1. |
| 96 |
#define GAIN_SCALING_1 1. |
| 97 |
|
| 98 |
#define LPC_SHIFT 0 |
| 99 |
#define SIG_SHIFT 0 |
| 100 |
|
| 101 |
#define VERY_SMALL 1e-15 |
| 102 |
|
| 103 |
#define NEG16(x) (-(x)) |
| 104 |
#define NEG32(x) (-(x)) |
| 105 |
#define EXTRACT16(x) (x) |
| 106 |
#define EXTEND32(x) (x) |
| 107 |
#define SHR16(a,shift) (a) |
| 108 |
#define SHL16(a,shift) (a) |
| 109 |
#define SHR32(a,shift) (a) |
| 110 |
#define SHL32(a,shift) (a) |
| 111 |
#define PSHR16(a,shift) (a) |
| 112 |
#define PSHR32(a,shift) (a) |
| 113 |
#define SATURATE16(x,a) (x) |
| 114 |
#define SATURATE32(x,a) (x) |
| 115 |
|
| 116 |
#define PSHR(a,shift) (a) |
| 117 |
#define SHR(a,shift) (a) |
| 118 |
#define SHL(a,shift) (a) |
| 119 |
#define SATURATE(x,a) (x) |
| 120 |
|
| 121 |
#define ADD16(a,b) ((a)+(b)) |
| 122 |
#define SUB16(a,b) ((a)-(b)) |
| 123 |
#define ADD32(a,b) ((a)+(b)) |
| 124 |
#define SUB32(a,b) ((a)-(b)) |
| 125 |
#define ADD64(a,b) ((a)+(b)) |
| 126 |
#define MULT16_16_16(a,b) ((a)*(b)) |
| 127 |
#define MULT16_16(a,b) ((spx_word32_t)(a)*(spx_word32_t)(b)) |
| 128 |
#define MAC16_16(c,a,b) ((c)+(spx_word32_t)(a)*(spx_word32_t)(b)) |
| 129 |
|
| 130 |
#define MULT16_32_Q11(a,b) ((a)*(b)) |
| 131 |
#define MULT16_32_Q13(a,b) ((a)*(b)) |
| 132 |
#define MULT16_32_Q14(a,b) ((a)*(b)) |
| 133 |
#define MULT16_32_Q15(a,b) ((a)*(b)) |
| 134 |
|
| 135 |
#define MAC16_32_Q11(c,a,b) ((c)+(a)*(b)) |
| 136 |
#define MAC16_32_Q15(c,a,b) ((c)+(a)*(b)) |
| 137 |
|
| 138 |
#define MAC16_16_Q11(c,a,b) ((c)+(a)*(b)) |
| 139 |
#define MAC16_16_Q13(c,a,b) ((c)+(a)*(b)) |
| 140 |
#define MULT16_16_Q11_32(a,b) ((a)*(b)) |
| 141 |
#define MULT16_16_Q13(a,b) ((a)*(b)) |
| 142 |
#define MULT16_16_Q14(a,b) ((a)*(b)) |
| 143 |
#define MULT16_16_Q15(a,b) ((a)*(b)) |
| 144 |
#define MULT16_16_P15(a,b) ((a)*(b)) |
| 145 |
|
| 146 |
#define DIV32_16(a,b) ((a)/(b)) |
| 147 |
#define DIV32(a,b) ((a)/(b)) |
| 148 |
|
| 149 |
|
| 150 |
#endif |
| 151 |
|
| 152 |
|
| 153 |
#ifdef CONFIG_TI_C55X |
| 154 |
|
| 155 |
|
| 156 |
#define BYTES_PER_CHAR 2 |
| 157 |
#define BITS_PER_CHAR 16 |
| 158 |
#define LOG2_BITS_PER_CHAR 4 |
| 159 |
|
| 160 |
#else |
| 161 |
|
| 162 |
#define BYTES_PER_CHAR 1 |
| 163 |
#define BITS_PER_CHAR 8 |
| 164 |
#define LOG2_BITS_PER_CHAR 3 |
| 165 |
|
| 166 |
#endif |
| 167 |
|
| 168 |
#endif |