OLD | NEW |
1 /*Copyright (c) 2003-2004, Mark Borgerding | 1 /*Copyright (c) 2003-2004, Mark Borgerding |
2 | 2 |
3 All rights reserved. | 3 All rights reserved. |
4 | 4 |
5 Redistribution and use in source and binary forms, with or without | 5 Redistribution and use in source and binary forms, with or without |
6 modification, are permitted provided that the following conditions are met: | 6 modification, are permitted provided that the following conditions are met: |
7 | 7 |
8 * Redistributions of source code must retain the above copyright notice, | 8 * Redistributions of source code must retain the above copyright notice, |
9 this list of conditions and the following disclaimer. | 9 this list of conditions and the following disclaimer. |
10 * Redistributions in binary form must reproduce the above copyright notice, | 10 * Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 #define SAMP_MAX 2147483647 | 51 #define SAMP_MAX 2147483647 |
52 #define TWID_MAX 32767 | 52 #define TWID_MAX 32767 |
53 #define TRIG_UPSCALE 1 | 53 #define TRIG_UPSCALE 1 |
54 | 54 |
55 #define SAMP_MIN -SAMP_MAX | 55 #define SAMP_MIN -SAMP_MAX |
56 | 56 |
57 | 57 |
58 # define S_MUL(a,b) MULT16_32_Q15(b, a) | 58 # define S_MUL(a,b) MULT16_32_Q15(b, a) |
59 | 59 |
60 # define C_MUL(m,a,b) \ | 60 # define C_MUL(m,a,b) \ |
61 do{ (m).r = SUB32(S_MUL((a).r,(b).r) , S_MUL((a).i,(b).i)); \ | 61 do{ (m).r = SUB32_ovflw(S_MUL((a).r,(b).r) , S_MUL((a).i,(b).i)); \ |
62 (m).i = ADD32(S_MUL((a).r,(b).i) , S_MUL((a).i,(b).r)); }while(0) | 62 (m).i = ADD32_ovflw(S_MUL((a).r,(b).i) , S_MUL((a).i,(b).r)); }while(0
) |
63 | 63 |
64 # define C_MULC(m,a,b) \ | 64 # define C_MULC(m,a,b) \ |
65 do{ (m).r = ADD32(S_MUL((a).r,(b).r) , S_MUL((a).i,(b).i)); \ | 65 do{ (m).r = ADD32_ovflw(S_MUL((a).r,(b).r) , S_MUL((a).i,(b).i)); \ |
66 (m).i = SUB32(S_MUL((a).i,(b).r) , S_MUL((a).r,(b).i)); }while(0) | 66 (m).i = SUB32_ovflw(S_MUL((a).i,(b).r) , S_MUL((a).r,(b).i)); }while(0
) |
67 | 67 |
68 # define C_MULBYSCALAR( c, s ) \ | 68 # define C_MULBYSCALAR( c, s ) \ |
69 do{ (c).r = S_MUL( (c).r , s ) ;\ | 69 do{ (c).r = S_MUL( (c).r , s ) ;\ |
70 (c).i = S_MUL( (c).i , s ) ; }while(0) | 70 (c).i = S_MUL( (c).i , s ) ; }while(0) |
71 | 71 |
72 # define DIVSCALAR(x,k) \ | 72 # define DIVSCALAR(x,k) \ |
73 (x) = S_MUL( x, (TWID_MAX-((k)>>1))/(k)+1 ) | 73 (x) = S_MUL( x, (TWID_MAX-((k)>>1))/(k)+1 ) |
74 | 74 |
75 # define C_FIXDIV(c,div) \ | 75 # define C_FIXDIV(c,div) \ |
76 do { DIVSCALAR( (c).r , div); \ | 76 do { DIVSCALAR( (c).r , div); \ |
77 DIVSCALAR( (c).i , div); }while (0) | 77 DIVSCALAR( (c).i , div); }while (0) |
78 | 78 |
79 #define C_ADD( res, a,b)\ | 79 #define C_ADD( res, a,b)\ |
80 do {(res).r=ADD32((a).r,(b).r); (res).i=ADD32((a).i,(b).i); \ | 80 do {(res).r=ADD32_ovflw((a).r,(b).r); (res).i=ADD32_ovflw((a).i,(b).i); \ |
81 }while(0) | 81 }while(0) |
82 #define C_SUB( res, a,b)\ | 82 #define C_SUB( res, a,b)\ |
83 do {(res).r=SUB32((a).r,(b).r); (res).i=SUB32((a).i,(b).i); \ | 83 do {(res).r=SUB32_ovflw((a).r,(b).r); (res).i=SUB32_ovflw((a).i,(b).i); \ |
84 }while(0) | 84 }while(0) |
85 #define C_ADDTO( res , a)\ | 85 #define C_ADDTO( res , a)\ |
86 do {(res).r = ADD32((res).r, (a).r); (res).i = ADD32((res).i,(a).i);\ | 86 do {(res).r = ADD32_ovflw((res).r, (a).r); (res).i = ADD32_ovflw((res).i,(a
).i);\ |
87 }while(0) | 87 }while(0) |
88 | 88 |
89 #define C_SUBFROM( res , a)\ | 89 #define C_SUBFROM( res , a)\ |
90 do {(res).r = ADD32((res).r,(a).r); (res).i = SUB32((res).i,(a).i); \ | 90 do {(res).r = ADD32_ovflw((res).r,(a).r); (res).i = SUB32_ovflw((res).i,(a)
.i); \ |
91 }while(0) | 91 }while(0) |
92 | 92 |
93 #if defined(OPUS_ARM_INLINE_ASM) | 93 #if defined(OPUS_ARM_INLINE_ASM) |
94 #include "arm/kiss_fft_armv4.h" | 94 #include "arm/kiss_fft_armv4.h" |
95 #endif | 95 #endif |
96 | 96 |
97 #if defined(OPUS_ARM_INLINE_EDSP) | 97 #if defined(OPUS_ARM_INLINE_EDSP) |
98 #include "arm/kiss_fft_armv5e.h" | 98 #include "arm/kiss_fft_armv5e.h" |
99 #endif | 99 #endif |
100 #if defined(MIPSr1_ASM) | 100 #if defined(MIPSr1_ASM) |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 (x)->i = KISS_FFT_SIN(phase);\ | 173 (x)->i = KISS_FFT_SIN(phase);\ |
174 }while(0) | 174 }while(0) |
175 | 175 |
176 #define kf_cexp2(x,phase) \ | 176 #define kf_cexp2(x,phase) \ |
177 do{ \ | 177 do{ \ |
178 (x)->r = TRIG_UPSCALE*celt_cos_norm((phase));\ | 178 (x)->r = TRIG_UPSCALE*celt_cos_norm((phase));\ |
179 (x)->i = TRIG_UPSCALE*celt_cos_norm((phase)-32768);\ | 179 (x)->i = TRIG_UPSCALE*celt_cos_norm((phase)-32768);\ |
180 }while(0) | 180 }while(0) |
181 | 181 |
182 #endif /* KISS_FFT_GUTS_H */ | 182 #endif /* KISS_FFT_GUTS_H */ |
OLD | NEW |