| 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 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 size_t subframe_index); | 43 size_t subframe_index); |
| 44 void GetLpcPolynomials(double* lpc, size_t length_lpc); | 44 void GetLpcPolynomials(double* lpc, size_t length_lpc); |
| 45 void FindFirstSpectralPeaks(double* f_peak, size_t length_f_peak); | 45 void FindFirstSpectralPeaks(double* f_peak, size_t length_f_peak); |
| 46 void Rms(double* rms, size_t length_rms); | 46 void Rms(double* rms, size_t length_rms); |
| 47 void ResetBuffer(); | 47 void ResetBuffer(); |
| 48 | 48 |
| 49 // To compute spectral peak we perform LPC analysis to get spectral envelope. | 49 // To compute spectral peak we perform LPC analysis to get spectral envelope. |
| 50 // For every 30 ms we compute 3 spectral peak there for 3 LPC analysis. | 50 // For every 30 ms we compute 3 spectral peak there for 3 LPC analysis. |
| 51 // LPC is computed over 15 ms of windowed audio. For every 10 ms sub-frame | 51 // LPC is computed over 15 ms of windowed audio. For every 10 ms sub-frame |
| 52 // we need 5 ms of past signal to create the input of LPC analysis. | 52 // we need 5 ms of past signal to create the input of LPC analysis. |
| 53 static const size_t kNumPastSignalSamples = | 53 enum : size_t { |
| 54 static_cast<size_t>(kSampleRateHz / 200); | 54 kNumPastSignalSamples = static_cast<size_t>(kSampleRateHz / 200) |
| 55 }; |
| 55 | 56 |
| 56 // TODO(turajs): maybe defining this at a higher level (maybe enum) so that | 57 // TODO(turajs): maybe defining this at a higher level (maybe enum) so that |
| 57 // all the code recognize it as "no-error." | 58 // all the code recognize it as "no-error." |
| 58 static const int kNoError = 0; | 59 enum : int { kNoError = 0 }; |
| 59 | 60 |
| 60 static const size_t kNum10msSubframes = 3; | 61 enum : size_t { kNum10msSubframes = 3 }; |
| 61 static const size_t kNumSubframeSamples = | 62 enum : size_t { |
| 62 static_cast<size_t>(kSampleRateHz / 100); | 63 kNumSubframeSamples = static_cast<size_t>(kSampleRateHz / 100) |
| 63 static const size_t kNumSamplesToProcess = | 64 }; |
| 64 kNum10msSubframes * | 65 enum : size_t { |
| 65 kNumSubframeSamples; // Samples in 30 ms @ given sampling rate. | 66 // Samples in 30 ms @ given sampling rate. |
| 66 static const size_t kBufferLength = | 67 kNumSamplesToProcess = kNum10msSubframes * kNumSubframeSamples |
| 67 kNumPastSignalSamples + kNumSamplesToProcess; | 68 }; |
| 68 static const size_t kIpLength = kDftSize >> 1; | 69 enum : size_t { |
| 69 static const size_t kWLength = kDftSize >> 1; | 70 kBufferLength = kNumPastSignalSamples + kNumSamplesToProcess |
| 70 | 71 }; |
| 71 static const size_t kLpcOrder = 16; | 72 enum : size_t { kIpLength = kDftSize >> 1 }; |
| 73 enum : size_t { kWLength = kDftSize >> 1 }; |
| 74 enum : size_t { kLpcOrder = 16 }; |
| 72 | 75 |
| 73 size_t ip_[kIpLength]; | 76 size_t ip_[kIpLength]; |
| 74 float w_fft_[kWLength]; | 77 float w_fft_[kWLength]; |
| 75 | 78 |
| 76 // A buffer of 5 ms (past audio) + 30 ms (one iSAC frame ). | 79 // A buffer of 5 ms (past audio) + 30 ms (one iSAC frame ). |
| 77 float audio_buffer_[kBufferLength]; | 80 float audio_buffer_[kBufferLength]; |
| 78 size_t num_buffer_samples_; | 81 size_t num_buffer_samples_; |
| 79 | 82 |
| 80 double log_old_gain_; | 83 double log_old_gain_; |
| 81 double old_lag_; | 84 double old_lag_; |
| 82 | 85 |
| 83 std::unique_ptr<PitchAnalysisStruct> pitch_analysis_handle_; | 86 std::unique_ptr<PitchAnalysisStruct> pitch_analysis_handle_; |
| 84 std::unique_ptr<PreFiltBankstr> pre_filter_handle_; | 87 std::unique_ptr<PreFiltBankstr> pre_filter_handle_; |
| 85 std::unique_ptr<PoleZeroFilter> high_pass_filter_; | 88 std::unique_ptr<PoleZeroFilter> high_pass_filter_; |
| 86 }; | 89 }; |
| 87 | 90 |
| 88 } // namespace webrtc | 91 } // namespace webrtc |
| 89 | 92 |
| 90 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_VAD_VAD_AUDIO_PROC_H_ | 93 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_VAD_VAD_AUDIO_PROC_H_ |
| OLD | NEW |