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/vad/vad_audio_proc.h" | 11 #include "webrtc/modules/audio_processing/vad/vad_audio_proc.h" |
12 | 12 |
13 #include <math.h> | 13 #include <math.h> |
14 #include <stdio.h> | 14 #include <stdio.h> |
15 | 15 |
16 #include "webrtc/common_audio/fft4g.h" | 16 #include "webrtc/common_audio/fft4g.h" |
17 #include "webrtc/modules/audio_processing/vad/vad_audio_proc_internal.h" | 17 #include "webrtc/modules/audio_processing/vad/vad_audio_proc_internal.h" |
18 #include "webrtc/modules/audio_processing/vad/pitch_internal.h" | 18 #include "webrtc/modules/audio_processing/vad/pitch_internal.h" |
19 #include "webrtc/modules/audio_processing/vad/pole_zero_filter.h" | 19 #include "webrtc/modules/audio_processing/vad/pole_zero_filter.h" |
20 extern "C" { | 20 extern "C" { |
21 #include "webrtc/modules/audio_coding/codecs/isac/main/source/codec.h" | 21 #include "webrtc/modules/audio_coding/codecs/isac/main/source/codec.h" |
22 #include "webrtc/modules/audio_coding/codecs/isac/main/source/lpc_analysis.h" | 22 #include "webrtc/modules/audio_coding/codecs/isac/main/source/lpc_analysis.h" |
23 #include "webrtc/modules/audio_coding/codecs/isac/main/source/pitch_estimator.h" | 23 #include "webrtc/modules/audio_coding/codecs/isac/main/source/pitch_estimator.h" |
24 #include "webrtc/modules/audio_coding/codecs/isac/main/source/structs.h" | 24 #include "webrtc/modules/audio_coding/codecs/isac/main/source/structs.h" |
25 } | 25 } |
26 #include "webrtc/modules/interface/module_common_types.h" | 26 #include "webrtc/modules/include/module_common_types.h" |
27 | 27 |
28 namespace webrtc { | 28 namespace webrtc { |
29 | 29 |
30 // The following structures are declared anonymous in iSAC's structs.h. To | 30 // The following structures are declared anonymous in iSAC's structs.h. To |
31 // forward declare them, we use this derived class trick. | 31 // forward declare them, we use this derived class trick. |
32 struct VadAudioProc::PitchAnalysisStruct : public ::PitchAnalysisStruct {}; | 32 struct VadAudioProc::PitchAnalysisStruct : public ::PitchAnalysisStruct {}; |
33 struct VadAudioProc::PreFiltBankstr : public ::PreFiltBankstr {}; | 33 struct VadAudioProc::PreFiltBankstr : public ::PreFiltBankstr {}; |
34 | 34 |
35 static const float kFrequencyResolution = | 35 static const float kFrequencyResolution = |
36 kSampleRateHz / static_cast<float>(VadAudioProc::kDftSize); | 36 kSampleRateHz / static_cast<float>(VadAudioProc::kDftSize); |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 size_t offset = kNumPastSignalSamples; | 266 size_t offset = kNumPastSignalSamples; |
267 for (size_t i = 0; i < kNum10msSubframes; i++) { | 267 for (size_t i = 0; i < kNum10msSubframes; i++) { |
268 rms[i] = 0; | 268 rms[i] = 0; |
269 for (size_t n = 0; n < kNumSubframeSamples; n++, offset++) | 269 for (size_t n = 0; n < kNumSubframeSamples; n++, offset++) |
270 rms[i] += audio_buffer_[offset] * audio_buffer_[offset]; | 270 rms[i] += audio_buffer_[offset] * audio_buffer_[offset]; |
271 rms[i] = sqrt(rms[i] / kNumSubframeSamples); | 271 rms[i] = sqrt(rms[i] / kNumSubframeSamples); |
272 } | 272 } |
273 } | 273 } |
274 | 274 |
275 } // namespace webrtc | 275 } // namespace webrtc |
OLD | NEW |