| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 |
| 11 #include "webrtc/modules/audio_processing/aecm/aecm_core.h" | 11 #include "webrtc/modules/audio_processing/aecm/aecm_core.h" |
| 12 | 12 |
| 13 #include <assert.h> | |
| 14 #include <stddef.h> | 13 #include <stddef.h> |
| 15 #include <stdlib.h> | 14 #include <stdlib.h> |
| 16 | 15 |
| 17 extern "C" { | 16 extern "C" { |
| 18 #include "webrtc/common_audio/ring_buffer.h" | 17 #include "webrtc/common_audio/ring_buffer.h" |
| 19 #include "webrtc/common_audio/signal_processing/include/real_fft.h" | 18 #include "webrtc/common_audio/signal_processing/include/real_fft.h" |
| 20 } | 19 } |
| 21 #include "webrtc/modules/audio_processing/aecm/echo_control_mobile.h" | 20 #include "webrtc/modules/audio_processing/aecm/echo_control_mobile.h" |
| 22 #include "webrtc/modules/audio_processing/utility/delay_estimator_wrapper.h" | 21 #include "webrtc/modules/audio_processing/utility/delay_estimator_wrapper.h" |
| 23 extern "C" { | 22 extern "C" { |
| 24 #include "webrtc/system_wrappers/include/cpu_features_wrapper.h" | 23 #include "webrtc/system_wrappers/include/cpu_features_wrapper.h" |
| 25 } | 24 } |
| 26 | 25 |
| 26 #include "webrtc/base/checks.h" |
| 27 #include "webrtc/typedefs.h" | 27 #include "webrtc/typedefs.h" |
| 28 | 28 |
| 29 #ifdef AEC_DEBUG | 29 #ifdef AEC_DEBUG |
| 30 FILE *dfile; | 30 FILE *dfile; |
| 31 FILE *testfile; | 31 FILE *testfile; |
| 32 #endif | 32 #endif |
| 33 | 33 |
| 34 const int16_t WebRtcAecm_kCosTable[] = { | 34 const int16_t WebRtcAecm_kCosTable[] = { |
| 35 8192, 8190, 8187, 8180, 8172, 8160, 8147, 8130, 8112, | 35 8192, 8190, 8187, 8180, 8172, 8160, 8147, 8130, 8112, |
| 36 8091, 8067, 8041, 8012, 7982, 7948, 7912, 7874, 7834, | 36 8091, 8067, 8041, 8012, 7982, 7948, 7912, 7874, 7834, |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 // - far_q : The Q-domain of the aligned far end spectrum | 186 // - far_q : The Q-domain of the aligned far end spectrum |
| 187 // | 187 // |
| 188 // Return value: | 188 // Return value: |
| 189 // - far_spectrum : Pointer to the aligned far end spectrum | 189 // - far_spectrum : Pointer to the aligned far end spectrum |
| 190 // NULL - Error | 190 // NULL - Error |
| 191 // | 191 // |
| 192 const uint16_t* WebRtcAecm_AlignedFarend(AecmCore* self, | 192 const uint16_t* WebRtcAecm_AlignedFarend(AecmCore* self, |
| 193 int* far_q, | 193 int* far_q, |
| 194 int delay) { | 194 int delay) { |
| 195 int buffer_position = 0; | 195 int buffer_position = 0; |
| 196 assert(self != NULL); | 196 RTC_DCHECK(self); |
| 197 buffer_position = self->far_history_pos - delay; | 197 buffer_position = self->far_history_pos - delay; |
| 198 | 198 |
| 199 // Check buffer position | 199 // Check buffer position |
| 200 if (buffer_position < 0) { | 200 if (buffer_position < 0) { |
| 201 buffer_position += MAX_DELAY; | 201 buffer_position += MAX_DELAY; |
| 202 } | 202 } |
| 203 // Get Q-domain | 203 // Get Q-domain |
| 204 *far_q = self->far_q_domains[buffer_position]; | 204 *far_q = self->far_q_domains[buffer_position]; |
| 205 // Return far end spectrum | 205 // Return far end spectrum |
| 206 return &(self->far_history[buffer_position * PART_LEN1]); | 206 return &(self->far_history[buffer_position * PART_LEN1]); |
| (...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1222 memcpy(farend + readPos, aecm->farBuf + aecm->farBufReadPos, | 1222 memcpy(farend + readPos, aecm->farBuf + aecm->farBufReadPos, |
| 1223 sizeof(int16_t) * readLen); | 1223 sizeof(int16_t) * readLen); |
| 1224 aecm->farBufReadPos = 0; | 1224 aecm->farBufReadPos = 0; |
| 1225 readPos = readLen; | 1225 readPos = readLen; |
| 1226 readLen = farLen - readLen; | 1226 readLen = farLen - readLen; |
| 1227 } | 1227 } |
| 1228 memcpy(farend + readPos, aecm->farBuf + aecm->farBufReadPos, | 1228 memcpy(farend + readPos, aecm->farBuf + aecm->farBufReadPos, |
| 1229 sizeof(int16_t) * readLen); | 1229 sizeof(int16_t) * readLen); |
| 1230 aecm->farBufReadPos += readLen; | 1230 aecm->farBufReadPos += readLen; |
| 1231 } | 1231 } |
| OLD | NEW |