Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Side by Side Diff: webrtc/modules/audio_processing/agc/agc.h

Issue 1192863006: Revert "Pull the Voice Activity Detector out from the AGC" (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/modules/audio_processing/BUILD.gn ('k') | webrtc/modules/audio_processing/agc/agc.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AGC_AGC_H_ 11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AGC_AGC_H_
12 #define WEBRTC_MODULES_AUDIO_PROCESSING_AGC_AGC_H_ 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_AGC_AGC_H_
13 13
14 #include "webrtc/base/scoped_ptr.h" 14 #include "webrtc/base/scoped_ptr.h"
15 #include "webrtc/modules/audio_processing/vad/voice_activity_detector.h"
16 #include "webrtc/typedefs.h" 15 #include "webrtc/typedefs.h"
17 16
18 namespace webrtc { 17 namespace webrtc {
19 18
20 class AudioFrame; 19 class AudioFrame;
20 class AgcAudioProc;
21 class Histogram; 21 class Histogram;
22 class PitchBasedVad;
23 class Resampler;
24 class StandaloneVad;
22 25
23 class Agc { 26 class Agc {
24 public: 27 public:
25 Agc(); 28 Agc();
26 virtual ~Agc(); 29 virtual ~Agc();
27 30
28 // Returns the proportion of samples in the buffer which are at full-scale 31 // Returns the proportion of samples in the buffer which are at full-scale
29 // (and presumably clipped). 32 // (and presumably clipped).
30 virtual float AnalyzePreproc(const int16_t* audio, int length); 33 virtual float AnalyzePreproc(const int16_t* audio, int length);
31 // |audio| must be mono; in a multi-channel stream, provide the first (usually 34 // |audio| must be mono; in a multi-channel stream, provide the first (usually
32 // left) channel. 35 // left) channel.
33 virtual int Process(const int16_t* audio, int length, int sample_rate_hz); 36 virtual int Process(const int16_t* audio, int length, int sample_rate_hz);
34 37
35 // Retrieves the difference between the target RMS level and the current 38 // Retrieves the difference between the target RMS level and the current
36 // signal RMS level in dB. Returns true if an update is available and false 39 // signal RMS level in dB. Returns true if an update is available and false
37 // otherwise, in which case |error| should be ignored and no action taken. 40 // otherwise, in which case |error| should be ignored and no action taken.
38 virtual bool GetRmsErrorDb(int* error); 41 virtual bool GetRmsErrorDb(int* error);
39 virtual void Reset(); 42 virtual void Reset();
40 43
41 virtual int set_target_level_dbfs(int level); 44 virtual int set_target_level_dbfs(int level);
42 virtual int target_level_dbfs() const { return target_level_dbfs_; } 45 virtual int target_level_dbfs() const { return target_level_dbfs_; }
43 46
44 virtual float voice_probability() const { 47 virtual void EnableStandaloneVad(bool enable);
45 return vad_.last_voice_probability(); 48 virtual bool standalone_vad_enabled() const {
49 return standalone_vad_enabled_;
46 } 50 }
47 51
52 virtual double voice_probability() const { return last_voice_probability_; }
53
48 private: 54 private:
49 double target_level_loudness_; 55 double target_level_loudness_;
56 double last_voice_probability_;
50 int target_level_dbfs_; 57 int target_level_dbfs_;
58 bool standalone_vad_enabled_;
51 rtc::scoped_ptr<Histogram> histogram_; 59 rtc::scoped_ptr<Histogram> histogram_;
52 rtc::scoped_ptr<Histogram> inactive_histogram_; 60 rtc::scoped_ptr<Histogram> inactive_histogram_;
53 VoiceActivityDetector vad_; 61 rtc::scoped_ptr<AgcAudioProc> audio_processing_;
62 rtc::scoped_ptr<PitchBasedVad> pitch_based_vad_;
63 rtc::scoped_ptr<StandaloneVad> standalone_vad_;
64 rtc::scoped_ptr<Resampler> resampler_;
54 }; 65 };
55 66
56 } // namespace webrtc 67 } // namespace webrtc
57 68
58 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AGC_AGC_H_ 69 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AGC_AGC_H_
OLDNEW
« no previous file with comments | « webrtc/modules/audio_processing/BUILD.gn ('k') | webrtc/modules/audio_processing/agc/agc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698