OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 int32_t xrQ16, xiQ16, yrQ16, yiQ16; | 125 int32_t xrQ16, xiQ16, yrQ16, yiQ16; |
126 int32_t tmpInRe, tmpInIm, tmpInRe2, tmpInIm2; | 126 int32_t tmpInRe, tmpInIm, tmpInRe2, tmpInIm2; |
127 int16_t factQ11; | 127 int16_t factQ11; |
128 int16_t sh; | 128 int16_t sh; |
129 | 129 |
130 for (k = 0; k < FRAMESAMPLES/4; k++) { | 130 for (k = 0; k < FRAMESAMPLES/4; k++) { |
131 /* Move zero in time to beginning of frames */ | 131 /* Move zero in time to beginning of frames */ |
132 tmp1rQ14 = -WebRtcIsacfix_kSinTab2[FRAMESAMPLES/4 - 1 - k]; | 132 tmp1rQ14 = -WebRtcIsacfix_kSinTab2[FRAMESAMPLES/4 - 1 - k]; |
133 tmp1iQ14 = WebRtcIsacfix_kSinTab2[k]; | 133 tmp1iQ14 = WebRtcIsacfix_kSinTab2[k]; |
134 | 134 |
135 tmpInRe = inreQ7[k] << 9; // Q7 -> Q16 | 135 tmpInRe = inreQ7[k] * (1 << 9); // Q7 -> Q16 |
136 tmpInIm = inimQ7[k] << 9; // Q7 -> Q16 | 136 tmpInIm = inimQ7[k] * (1 << 9); // Q7 -> Q16 |
137 tmpInRe2 = inreQ7[FRAMESAMPLES / 2 - 1 - k] << 9; // Q7 -> Q16 | 137 tmpInRe2 = inreQ7[FRAMESAMPLES / 2 - 1 - k] * (1 << 9); // Q7 -> Q16 |
138 tmpInIm2 = inimQ7[FRAMESAMPLES / 2 - 1 - k] << 9; // Q7 -> Q16 | 138 tmpInIm2 = inimQ7[FRAMESAMPLES / 2 - 1 - k] * (1 << 9); // Q7 -> Q16 |
139 | 139 |
140 xrQ16 = WEBRTC_SPL_MUL_16_32_RSFT14(tmp1rQ14, tmpInRe) + WEBRTC_SPL_MUL_16_3
2_RSFT14(tmp1iQ14, tmpInIm); | 140 xrQ16 = WEBRTC_SPL_MUL_16_32_RSFT14(tmp1rQ14, tmpInRe) + WEBRTC_SPL_MUL_16_3
2_RSFT14(tmp1iQ14, tmpInIm); |
141 xiQ16 = WEBRTC_SPL_MUL_16_32_RSFT14(tmp1rQ14, tmpInIm) - WEBRTC_SPL_MUL_16_3
2_RSFT14(tmp1iQ14, tmpInRe); | 141 xiQ16 = WEBRTC_SPL_MUL_16_32_RSFT14(tmp1rQ14, tmpInIm) - WEBRTC_SPL_MUL_16_3
2_RSFT14(tmp1iQ14, tmpInRe); |
142 yrQ16 = -WEBRTC_SPL_MUL_16_32_RSFT14(tmp1rQ14, tmpInIm2) - WEBRTC_SPL_MUL_16
_32_RSFT14(tmp1iQ14, tmpInRe2); | 142 yrQ16 = -WEBRTC_SPL_MUL_16_32_RSFT14(tmp1rQ14, tmpInIm2) - WEBRTC_SPL_MUL_16
_32_RSFT14(tmp1iQ14, tmpInRe2); |
143 yiQ16 = -WEBRTC_SPL_MUL_16_32_RSFT14(tmp1rQ14, tmpInRe2) + WEBRTC_SPL_MUL_16
_32_RSFT14(tmp1iQ14, tmpInIm2); | 143 yiQ16 = -WEBRTC_SPL_MUL_16_32_RSFT14(tmp1rQ14, tmpInRe2) + WEBRTC_SPL_MUL_16
_32_RSFT14(tmp1iQ14, tmpInIm2); |
144 | 144 |
145 /* Combine into one vector, z = x + j * y */ | 145 /* Combine into one vector, z = x + j * y */ |
146 outre1Q16[k] = xrQ16 - yiQ16; | 146 outre1Q16[k] = xrQ16 - yiQ16; |
147 outre1Q16[FRAMESAMPLES/2 - 1 - k] = xrQ16 + yiQ16; | 147 outre1Q16[FRAMESAMPLES/2 - 1 - k] = xrQ16 + yiQ16; |
148 outre2Q16[k] = xiQ16 + yrQ16; | 148 outre2Q16[k] = xiQ16 + yrQ16; |
(...skipping 28 matching lines...) Expand all Loading... |
177 WebRtcIsacfix_FftRadix16Fastest(inreQ7, inimQ7, 1); // real call | 177 WebRtcIsacfix_FftRadix16Fastest(inreQ7, inimQ7, 1); // real call |
178 | 178 |
179 //"Fastest" vectors | 179 //"Fastest" vectors |
180 if (sh>=0) { | 180 if (sh>=0) { |
181 for (k=0; k<240; k++) { | 181 for (k=0; k<240; k++) { |
182 outre1Q16[k] = inreQ7[k] >> sh; // Q(16+sh) -> Q16 | 182 outre1Q16[k] = inreQ7[k] >> sh; // Q(16+sh) -> Q16 |
183 outre2Q16[k] = inimQ7[k] >> sh; // Q(16+sh) -> Q16 | 183 outre2Q16[k] = inimQ7[k] >> sh; // Q(16+sh) -> Q16 |
184 } | 184 } |
185 } else { | 185 } else { |
186 for (k=0; k<240; k++) { | 186 for (k=0; k<240; k++) { |
187 outre1Q16[k] = inreQ7[k] << -sh; // Q(16+sh) -> Q16 | 187 outre1Q16[k] = inreQ7[k] * (1 << -sh); // Q(16+sh) -> Q16 |
188 outre2Q16[k] = inimQ7[k] << -sh; // Q(16+sh) -> Q16 | 188 outre2Q16[k] = inimQ7[k] * (1 << -sh); // Q(16+sh) -> Q16 |
189 } | 189 } |
190 } | 190 } |
191 | 191 |
192 /* Divide through by the normalizing constant: */ | 192 /* Divide through by the normalizing constant: */ |
193 /* scale all values with 1/240, i.e. with 273 in Q16 */ | 193 /* scale all values with 1/240, i.e. with 273 in Q16 */ |
194 /* 273/65536 ~= 0.0041656 */ | 194 /* 273/65536 ~= 0.0041656 */ |
195 /* 1/240 ~= 0.0041666 */ | 195 /* 1/240 ~= 0.0041666 */ |
196 for (k=0; k<240; k++) { | 196 for (k=0; k<240; k++) { |
197 outre1Q16[k] = WEBRTC_SPL_MUL_16_32_RSFT16(273, outre1Q16[k]); | 197 outre1Q16[k] = WEBRTC_SPL_MUL_16_32_RSFT16(273, outre1Q16[k]); |
198 outre2Q16[k] = WEBRTC_SPL_MUL_16_32_RSFT16(273, outre2Q16[k]); | 198 outre2Q16[k] = WEBRTC_SPL_MUL_16_32_RSFT16(273, outre2Q16[k]); |
199 } | 199 } |
200 | 200 |
201 /* Demodulate and separate */ | 201 /* Demodulate and separate */ |
202 factQ11 = 31727; // sqrt(240) in Q11 is round(15.49193338482967*2048) = 31727 | 202 factQ11 = 31727; // sqrt(240) in Q11 is round(15.49193338482967*2048) = 31727 |
203 for (k = 0; k < FRAMESAMPLES/2; k++) { | 203 for (k = 0; k < FRAMESAMPLES/2; k++) { |
204 tmp1rQ14 = WebRtcIsacfix_kCosTab1[k]; | 204 tmp1rQ14 = WebRtcIsacfix_kCosTab1[k]; |
205 tmp1iQ14 = WebRtcIsacfix_kSinTab1[k]; | 205 tmp1iQ14 = WebRtcIsacfix_kSinTab1[k]; |
206 xrQ16 = WEBRTC_SPL_MUL_16_32_RSFT14(tmp1rQ14, outre1Q16[k]) - WEBRTC_SPL_MUL
_16_32_RSFT14(tmp1iQ14, outre2Q16[k]); | 206 xrQ16 = WEBRTC_SPL_MUL_16_32_RSFT14(tmp1rQ14, outre1Q16[k]) - WEBRTC_SPL_MUL
_16_32_RSFT14(tmp1iQ14, outre2Q16[k]); |
207 xiQ16 = WEBRTC_SPL_MUL_16_32_RSFT14(tmp1rQ14, outre2Q16[k]) + WEBRTC_SPL_MUL
_16_32_RSFT14(tmp1iQ14, outre1Q16[k]); | 207 xiQ16 = WEBRTC_SPL_MUL_16_32_RSFT14(tmp1rQ14, outre2Q16[k]) + WEBRTC_SPL_MUL
_16_32_RSFT14(tmp1iQ14, outre1Q16[k]); |
208 xrQ16 = WEBRTC_SPL_MUL_16_32_RSFT11(factQ11, xrQ16); | 208 xrQ16 = WEBRTC_SPL_MUL_16_32_RSFT11(factQ11, xrQ16); |
209 xiQ16 = WEBRTC_SPL_MUL_16_32_RSFT11(factQ11, xiQ16); | 209 xiQ16 = WEBRTC_SPL_MUL_16_32_RSFT11(factQ11, xiQ16); |
210 outre2Q16[k] = xiQ16; | 210 outre2Q16[k] = xiQ16; |
211 outre1Q16[k] = xrQ16; | 211 outre1Q16[k] = xrQ16; |
212 } | 212 } |
213 } | 213 } |
OLD | NEW |