| 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 <stddef.h> |    13 #include <stddef.h> | 
|    14 #include <stdlib.h> |    14 #include <stdlib.h> | 
|    15  |    15  | 
|    16 extern "C" { |    16 extern "C" { | 
|    17 #include "webrtc/common_audio/ring_buffer.h" |    17 #include "webrtc/common_audio/ring_buffer.h" | 
|    18 #include "webrtc/common_audio/signal_processing/include/real_fft.h" |    18 #include "webrtc/common_audio/signal_processing/include/real_fft.h" | 
|    19 } |    19 } | 
|    20 #include "webrtc/modules/audio_processing/aecm/echo_control_mobile.h" |    20 #include "webrtc/modules/audio_processing/aecm/echo_control_mobile.h" | 
|    21 #include "webrtc/modules/audio_processing/utility/delay_estimator_wrapper.h" |    21 #include "webrtc/modules/audio_processing/utility/delay_estimator_wrapper.h" | 
|    22 extern "C" { |    22 extern "C" { | 
|    23 #include "webrtc/system_wrappers/include/cpu_features_wrapper.h" |    23 #include "webrtc/system_wrappers/include/cpu_features_wrapper.h" | 
|    24 } |    24 } | 
|    25  |    25  | 
|    26 #include "webrtc/rtc_base/checks.h" |    26 #include "webrtc/rtc_base/checks.h" | 
 |    27 #include "webrtc/rtc_base/safe_conversions.h" | 
|    27 #include "webrtc/typedefs.h" |    28 #include "webrtc/typedefs.h" | 
|    28  |    29  | 
|    29 #ifdef AEC_DEBUG |    30 #ifdef AEC_DEBUG | 
|    30 FILE *dfile; |    31 FILE *dfile; | 
|    31 FILE *testfile; |    32 FILE *testfile; | 
|    32 #endif |    33 #endif | 
|    33  |    34  | 
|    34 const int16_t WebRtcAecm_kCosTable[] = { |    35 const int16_t WebRtcAecm_kCosTable[] = { | 
|    35     8192,  8190,  8187,  8180,  8172,  8160,  8147,  8130,  8112, |    36     8192,  8190,  8187,  8180,  8172,  8160,  8147,  8130,  8112, | 
|    36     8091,  8067,  8041,  8012,  7982,  7948,  7912,  7874,  7834, |    37     8091,  8067,  8041,  8012,  7982,  7948,  7912,  7874,  7834, | 
| (...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   920             if (zerosCh + zerosFar > 31) |   921             if (zerosCh + zerosFar > 31) | 
|   921             { |   922             { | 
|   922                 // Multiplication is safe |   923                 // Multiplication is safe | 
|   923                 tmpU32no1 = WEBRTC_SPL_UMUL_32_16(aecm->channelAdapt32[i], |   924                 tmpU32no1 = WEBRTC_SPL_UMUL_32_16(aecm->channelAdapt32[i], | 
|   924                         far_spectrum[i]); |   925                         far_spectrum[i]); | 
|   925                 shiftChFar = 0; |   926                 shiftChFar = 0; | 
|   926             } else |   927             } else | 
|   927             { |   928             { | 
|   928                 // We need to shift down before multiplication |   929                 // We need to shift down before multiplication | 
|   929                 shiftChFar = 32 - zerosCh - zerosFar; |   930                 shiftChFar = 32 - zerosCh - zerosFar; | 
|   930                 tmpU32no1 = (aecm->channelAdapt32[i] >> shiftChFar) * |   931                 tmpU32no1 = rtc::dchecked_cast<uint32_t>( | 
|   931                     far_spectrum[i]; |   932                     aecm->channelAdapt32[i] >> shiftChFar) * far_spectrum[i]; | 
|   932             } |   933             } | 
|   933             // Determine Q-domain of numerator |   934             // Determine Q-domain of numerator | 
|   934             zerosNum = WebRtcSpl_NormU32(tmpU32no1); |   935             zerosNum = WebRtcSpl_NormU32(tmpU32no1); | 
|   935             if (dfa[i]) |   936             if (dfa[i]) | 
|   936             { |   937             { | 
|   937                 zerosDfa = WebRtcSpl_NormU32((uint32_t)dfa[i]); |   938                 zerosDfa = WebRtcSpl_NormU32((uint32_t)dfa[i]); | 
|   938             } else |   939             } else | 
|   939             { |   940             { | 
|   940                 zerosDfa = 32; |   941                 zerosDfa = 32; | 
|   941             } |   942             } | 
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1222         memcpy(farend + readPos, aecm->farBuf + aecm->farBufReadPos, |  1223         memcpy(farend + readPos, aecm->farBuf + aecm->farBufReadPos, | 
|  1223                sizeof(int16_t) * readLen); |  1224                sizeof(int16_t) * readLen); | 
|  1224         aecm->farBufReadPos = 0; |  1225         aecm->farBufReadPos = 0; | 
|  1225         readPos = readLen; |  1226         readPos = readLen; | 
|  1226         readLen = farLen - readLen; |  1227         readLen = farLen - readLen; | 
|  1227     } |  1228     } | 
|  1228     memcpy(farend + readPos, aecm->farBuf + aecm->farBufReadPos, |  1229     memcpy(farend + readPos, aecm->farBuf + aecm->farBufReadPos, | 
|  1229            sizeof(int16_t) * readLen); |  1230            sizeof(int16_t) * readLen); | 
|  1230     aecm->farBufReadPos += readLen; |  1231     aecm->farBufReadPos += readLen; | 
|  1231 } |  1232 } | 
| OLD | NEW |