OLD | NEW |
1 /* Copyright (c) 2009-2010 Xiph.Org Foundation | 1 /* Copyright (c) 2009-2010 Xiph.Org Foundation |
2 Written by Jean-Marc Valin */ | 2 Written by Jean-Marc Valin */ |
3 /* | 3 /* |
4 Redistribution and use in source and binary forms, with or without | 4 Redistribution and use in source and binary forms, with or without |
5 modification, are permitted provided that the following conditions | 5 modification, are permitted provided that the following conditions |
6 are met: | 6 are met: |
7 | 7 |
8 - Redistributions of source code must retain the above copyright | 8 - Redistributions of source code must retain the above copyright |
9 notice, this list of conditions and the following disclaimer. | 9 notice, this list of conditions and the following disclaimer. |
10 | 10 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 break; | 81 break; |
82 #endif | 82 #endif |
83 } | 83 } |
84 } | 84 } |
85 #ifdef FIXED_POINT | 85 #ifdef FIXED_POINT |
86 for (i=0;i<p;i++) | 86 for (i=0;i<p;i++) |
87 _lpc[i] = ROUND16(lpc[i],16); | 87 _lpc[i] = ROUND16(lpc[i],16); |
88 #endif | 88 #endif |
89 } | 89 } |
90 | 90 |
91 void celt_fir(const opus_val16 *_x, | 91 |
| 92 void celt_fir_c( |
| 93 const opus_val16 *_x, |
92 const opus_val16 *num, | 94 const opus_val16 *num, |
93 opus_val16 *_y, | 95 opus_val16 *_y, |
94 int N, | 96 int N, |
95 int ord, | 97 int ord, |
96 opus_val16 *mem) | 98 opus_val16 *mem, |
| 99 int arch) |
97 { | 100 { |
98 int i,j; | 101 int i,j; |
99 VARDECL(opus_val16, rnum); | 102 VARDECL(opus_val16, rnum); |
100 VARDECL(opus_val16, x); | 103 VARDECL(opus_val16, x); |
101 SAVE_STACK; | 104 SAVE_STACK; |
102 | 105 |
103 ALLOC(rnum, ord, opus_val16); | 106 ALLOC(rnum, ord, opus_val16); |
104 ALLOC(x, N+ord, opus_val16); | 107 ALLOC(x, N+ord, opus_val16); |
105 for(i=0;i<ord;i++) | 108 for(i=0;i<ord;i++) |
106 rnum[i] = num[ord-i-1]; | 109 rnum[i] = num[ord-i-1]; |
107 for(i=0;i<ord;i++) | 110 for(i=0;i<ord;i++) |
108 x[i] = mem[ord-i-1]; | 111 x[i] = mem[ord-i-1]; |
109 for (i=0;i<N;i++) | 112 for (i=0;i<N;i++) |
110 x[i+ord]=_x[i]; | 113 x[i+ord]=_x[i]; |
111 for(i=0;i<ord;i++) | 114 for(i=0;i<ord;i++) |
112 mem[i] = _x[N-i-1]; | 115 mem[i] = _x[N-i-1]; |
113 #ifdef SMALL_FOOTPRINT | 116 #ifdef SMALL_FOOTPRINT |
| 117 (void)arch; |
114 for (i=0;i<N;i++) | 118 for (i=0;i<N;i++) |
115 { | 119 { |
116 opus_val32 sum = SHL32(EXTEND32(_x[i]), SIG_SHIFT); | 120 opus_val32 sum = SHL32(EXTEND32(_x[i]), SIG_SHIFT); |
117 for (j=0;j<ord;j++) | 121 for (j=0;j<ord;j++) |
118 { | 122 { |
119 sum = MAC16_16(sum,rnum[j],x[i+j]); | 123 sum = MAC16_16(sum,rnum[j],x[i+j]); |
120 } | 124 } |
121 _y[i] = SATURATE16(PSHR32(sum, SIG_SHIFT)); | 125 _y[i] = SATURATE16(PSHR32(sum, SIG_SHIFT)); |
122 } | 126 } |
123 #else | 127 #else |
124 for (i=0;i<N-3;i+=4) | 128 for (i=0;i<N-3;i+=4) |
125 { | 129 { |
126 opus_val32 sum[4]={0,0,0,0}; | 130 opus_val32 sum[4]={0,0,0,0}; |
127 xcorr_kernel(rnum, x+i, sum, ord); | 131 xcorr_kernel(rnum, x+i, sum, ord, arch); |
128 _y[i ] = SATURATE16(ADD32(EXTEND32(_x[i ]), PSHR32(sum[0], SIG_SHIFT))); | 132 _y[i ] = SATURATE16(ADD32(EXTEND32(_x[i ]), PSHR32(sum[0], SIG_SHIFT))); |
129 _y[i+1] = SATURATE16(ADD32(EXTEND32(_x[i+1]), PSHR32(sum[1], SIG_SHIFT))); | 133 _y[i+1] = SATURATE16(ADD32(EXTEND32(_x[i+1]), PSHR32(sum[1], SIG_SHIFT))); |
130 _y[i+2] = SATURATE16(ADD32(EXTEND32(_x[i+2]), PSHR32(sum[2], SIG_SHIFT))); | 134 _y[i+2] = SATURATE16(ADD32(EXTEND32(_x[i+2]), PSHR32(sum[2], SIG_SHIFT))); |
131 _y[i+3] = SATURATE16(ADD32(EXTEND32(_x[i+3]), PSHR32(sum[3], SIG_SHIFT))); | 135 _y[i+3] = SATURATE16(ADD32(EXTEND32(_x[i+3]), PSHR32(sum[3], SIG_SHIFT))); |
132 } | 136 } |
133 for (;i<N;i++) | 137 for (;i<N;i++) |
134 { | 138 { |
135 opus_val32 sum = 0; | 139 opus_val32 sum = 0; |
136 for (j=0;j<ord;j++) | 140 for (j=0;j<ord;j++) |
137 sum = MAC16_16(sum,rnum[j],x[i+j]); | 141 sum = MAC16_16(sum,rnum[j],x[i+j]); |
138 _y[i] = SATURATE16(ADD32(EXTEND32(_x[i]), PSHR32(sum, SIG_SHIFT))); | 142 _y[i] = SATURATE16(ADD32(EXTEND32(_x[i]), PSHR32(sum, SIG_SHIFT))); |
139 } | 143 } |
140 #endif | 144 #endif |
141 RESTORE_STACK; | 145 RESTORE_STACK; |
142 } | 146 } |
143 | 147 |
144 void celt_iir(const opus_val32 *_x, | 148 void celt_iir(const opus_val32 *_x, |
145 const opus_val16 *den, | 149 const opus_val16 *den, |
146 opus_val32 *_y, | 150 opus_val32 *_y, |
147 int N, | 151 int N, |
148 int ord, | 152 int ord, |
149 opus_val16 *mem) | 153 opus_val16 *mem, |
| 154 int arch) |
150 { | 155 { |
151 #ifdef SMALL_FOOTPRINT | 156 #ifdef SMALL_FOOTPRINT |
152 int i,j; | 157 int i,j; |
| 158 (void)arch; |
153 for (i=0;i<N;i++) | 159 for (i=0;i<N;i++) |
154 { | 160 { |
155 opus_val32 sum = _x[i]; | 161 opus_val32 sum = _x[i]; |
156 for (j=0;j<ord;j++) | 162 for (j=0;j<ord;j++) |
157 { | 163 { |
158 sum -= MULT16_16(den[j],mem[j]); | 164 sum -= MULT16_16(den[j],mem[j]); |
159 } | 165 } |
160 for (j=ord-1;j>=1;j--) | 166 for (j=ord-1;j>=1;j--) |
161 { | 167 { |
162 mem[j]=mem[j-1]; | 168 mem[j]=mem[j-1]; |
(...skipping 17 matching lines...) Expand all Loading... |
180 for(;i<N+ord;i++) | 186 for(;i<N+ord;i++) |
181 y[i]=0; | 187 y[i]=0; |
182 for (i=0;i<N-3;i+=4) | 188 for (i=0;i<N-3;i+=4) |
183 { | 189 { |
184 /* Unroll by 4 as if it were an FIR filter */ | 190 /* Unroll by 4 as if it were an FIR filter */ |
185 opus_val32 sum[4]; | 191 opus_val32 sum[4]; |
186 sum[0]=_x[i]; | 192 sum[0]=_x[i]; |
187 sum[1]=_x[i+1]; | 193 sum[1]=_x[i+1]; |
188 sum[2]=_x[i+2]; | 194 sum[2]=_x[i+2]; |
189 sum[3]=_x[i+3]; | 195 sum[3]=_x[i+3]; |
190 xcorr_kernel(rden, y+i, sum, ord); | 196 xcorr_kernel(rden, y+i, sum, ord, arch); |
191 | 197 |
192 /* Patch up the result to compensate for the fact that this is an IIR */ | 198 /* Patch up the result to compensate for the fact that this is an IIR */ |
193 y[i+ord ] = -ROUND16(sum[0],SIG_SHIFT); | 199 y[i+ord ] = -ROUND16(sum[0],SIG_SHIFT); |
194 _y[i ] = sum[0]; | 200 _y[i ] = sum[0]; |
195 sum[1] = MAC16_16(sum[1], y[i+ord ], den[0]); | 201 sum[1] = MAC16_16(sum[1], y[i+ord ], den[0]); |
196 y[i+ord+1] = -ROUND16(sum[1],SIG_SHIFT); | 202 y[i+ord+1] = -ROUND16(sum[1],SIG_SHIFT); |
197 _y[i+1] = sum[1]; | 203 _y[i+1] = sum[1]; |
198 sum[2] = MAC16_16(sum[2], y[i+ord+1], den[0]); | 204 sum[2] = MAC16_16(sum[2], y[i+ord+1], den[0]); |
199 sum[2] = MAC16_16(sum[2], y[i+ord ], den[1]); | 205 sum[2] = MAC16_16(sum[2], y[i+ord ], den[1]); |
200 y[i+ord+2] = -ROUND16(sum[2],SIG_SHIFT); | 206 y[i+ord+2] = -ROUND16(sum[2],SIG_SHIFT); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 shift2++; | 306 shift2++; |
301 for (i=0;i<=lag;i++) | 307 for (i=0;i<=lag;i++) |
302 ac[i] = SHR32(ac[i], shift2); | 308 ac[i] = SHR32(ac[i], shift2); |
303 shift += shift2; | 309 shift += shift2; |
304 } | 310 } |
305 #endif | 311 #endif |
306 | 312 |
307 RESTORE_STACK; | 313 RESTORE_STACK; |
308 return shift; | 314 return shift; |
309 } | 315 } |
OLD | NEW |