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

Side by Side Diff: webrtc/modules/audio_processing/vad/standalone_vad.h

Issue 1230503003: Update a ton of audio code to use size_t more correctly and in general reduce (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Resync Created 5 years, 3 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
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
(...skipping 23 matching lines...) Expand all
34 // 0: in success. 34 // 0: in success.
35 // In case of error the content of |activity| is unchanged. 35 // In case of error the content of |activity| is unchanged.
36 // 36 //
37 // Note that due to a high false-positive (VAD decision is active while the 37 // Note that due to a high false-positive (VAD decision is active while the
38 // processed audio is just background noise) rate, stand-alone VAD is used as 38 // processed audio is just background noise) rate, stand-alone VAD is used as
39 // a one-sided indicator. The activity probability is 0.5 if the frame is 39 // a one-sided indicator. The activity probability is 0.5 if the frame is
40 // classified as active, and the probability is 0.01 if the audio is 40 // classified as active, and the probability is 0.01 if the audio is
41 // classified as passive. In this way, when probabilities are combined, the 41 // classified as passive. In this way, when probabilities are combined, the
42 // effect of the stand-alone VAD is neutral if the input is classified as 42 // effect of the stand-alone VAD is neutral if the input is classified as
43 // active. 43 // active.
44 int GetActivity(double* p, int length_p); 44 int GetActivity(double* p, size_t length_p);
45 45
46 // Expecting 10 ms of 16 kHz audio to be pushed in. 46 // Expecting 10 ms of 16 kHz audio to be pushed in.
47 int AddAudio(const int16_t* data, int length); 47 int AddAudio(const int16_t* data, size_t length);
48 48
49 // Set aggressiveness of VAD, 0 is the least aggressive and 3 is the most 49 // Set aggressiveness of VAD, 0 is the least aggressive and 3 is the most
50 // aggressive mode. Returns -1 if the input is less than 0 or larger than 3, 50 // aggressive mode. Returns -1 if the input is less than 0 or larger than 3,
51 // otherwise 0 is returned. 51 // otherwise 0 is returned.
52 int set_mode(int mode); 52 int set_mode(int mode);
53 // Get the agressiveness of the current VAD. 53 // Get the agressiveness of the current VAD.
54 int mode() const { return mode_; } 54 int mode() const { return mode_; }
55 55
56 private: 56 private:
57 explicit StandaloneVad(VadInst* vad); 57 explicit StandaloneVad(VadInst* vad);
58 58
59 static const int kMaxNum10msFrames = 3; 59 static const size_t kMaxNum10msFrames = 3;
60 60
61 // TODO(turajs): Is there a way to use scoped-pointer here? 61 // TODO(turajs): Is there a way to use scoped-pointer here?
62 VadInst* vad_; 62 VadInst* vad_;
63 int16_t buffer_[kMaxNum10msFrames * kLength10Ms]; 63 int16_t buffer_[kMaxNum10msFrames * kLength10Ms];
64 int index_; 64 size_t index_;
65 int mode_; 65 int mode_;
66 }; 66 };
67 67
68 } // namespace webrtc 68 } // namespace webrtc
69 69
70 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AGC_STANDALONE_VAD_H_ 70 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AGC_STANDALONE_VAD_H_
OLDNEW
« no previous file with comments | « webrtc/modules/audio_processing/vad/pole_zero_filter.cc ('k') | webrtc/modules/audio_processing/vad/standalone_vad.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698