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

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

Issue 1227213002: Update audio code to use size_t more correctly, webrtc/modules/audio_processing/ (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Resync Created 5 years, 4 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 * - agcInst : AGC instance. 59 * - agcInst : AGC instance.
60 * - inFar : Far-end input speech vector 60 * - inFar : Far-end input speech vector
61 * - samples : Number of samples in input vector 61 * - samples : Number of samples in input vector
62 * 62 *
63 * Return value: 63 * Return value:
64 * : 0 - Normal operation. 64 * : 0 - Normal operation.
65 * : -1 - Error 65 * : -1 - Error
66 */ 66 */
67 int WebRtcAgc_AddFarend(void* agcInst, 67 int WebRtcAgc_AddFarend(void* agcInst,
68 const int16_t* inFar, 68 const int16_t* inFar,
69 int16_t samples); 69 size_t samples);
70 70
71 /* 71 /*
72 * This function processes a 10 ms frame of microphone speech to determine 72 * This function processes a 10 ms frame of microphone speech to determine
73 * if there is active speech. The length of the input speech vector must be 73 * if there is active speech. The length of the input speech vector must be
74 * given in samples (80 when FS=8000, and 160 when FS=16000, FS=32000 or 74 * given in samples (80 when FS=8000, and 160 when FS=16000, FS=32000 or
75 * FS=48000). For very low input levels, the input signal is increased in level 75 * FS=48000). For very low input levels, the input signal is increased in level
76 * by multiplying and overwriting the samples in inMic[]. 76 * by multiplying and overwriting the samples in inMic[].
77 * 77 *
78 * This function should be called before any further processing of the 78 * This function should be called before any further processing of the
79 * near-end microphone signal. 79 * near-end microphone signal.
80 * 80 *
81 * Input: 81 * Input:
82 * - agcInst : AGC instance. 82 * - agcInst : AGC instance.
83 * - inMic : Microphone input speech vector for each band 83 * - inMic : Microphone input speech vector for each band
84 * - num_bands : Number of bands in input vector 84 * - num_bands : Number of bands in input vector
85 * - samples : Number of samples in input vector 85 * - samples : Number of samples in input vector
86 * 86 *
87 * Return value: 87 * Return value:
88 * : 0 - Normal operation. 88 * : 0 - Normal operation.
89 * : -1 - Error 89 * : -1 - Error
90 */ 90 */
91 int WebRtcAgc_AddMic(void* agcInst, 91 int WebRtcAgc_AddMic(void* agcInst,
92 int16_t* const* inMic, 92 int16_t* const* inMic,
93 int16_t num_bands, 93 size_t num_bands,
94 int16_t samples); 94 size_t samples);
95 95
96 /* 96 /*
97 * This function replaces the analog microphone with a virtual one. 97 * This function replaces the analog microphone with a virtual one.
98 * It is a digital gain applied to the input signal and is used in the 98 * It is a digital gain applied to the input signal and is used in the
99 * agcAdaptiveDigital mode where no microphone level is adjustable. The length 99 * agcAdaptiveDigital mode where no microphone level is adjustable. The length
100 * of the input speech vector must be given in samples (80 when FS=8000, and 160 100 * of the input speech vector must be given in samples (80 when FS=8000, and 160
101 * when FS=16000, FS=32000 or FS=48000). 101 * when FS=16000, FS=32000 or FS=48000).
102 * 102 *
103 * Input: 103 * Input:
104 * - agcInst : AGC instance. 104 * - agcInst : AGC instance.
105 * - inMic : Microphone input speech vector for each band 105 * - inMic : Microphone input speech vector for each band
106 * - num_bands : Number of bands in input vector 106 * - num_bands : Number of bands in input vector
107 * - samples : Number of samples in input vector 107 * - samples : Number of samples in input vector
108 * - micLevelIn : Input level of microphone (static) 108 * - micLevelIn : Input level of microphone (static)
109 * 109 *
110 * Output: 110 * Output:
111 * - inMic : Microphone output after processing (L band) 111 * - inMic : Microphone output after processing (L band)
112 * - inMic_H : Microphone output after processing (H band) 112 * - inMic_H : Microphone output after processing (H band)
113 * - micLevelOut : Adjusted microphone level after processing 113 * - micLevelOut : Adjusted microphone level after processing
114 * 114 *
115 * Return value: 115 * Return value:
116 * : 0 - Normal operation. 116 * : 0 - Normal operation.
117 * : -1 - Error 117 * : -1 - Error
118 */ 118 */
119 int WebRtcAgc_VirtualMic(void* agcInst, 119 int WebRtcAgc_VirtualMic(void* agcInst,
120 int16_t* const* inMic, 120 int16_t* const* inMic,
121 int16_t num_bands, 121 size_t num_bands,
122 int16_t samples, 122 size_t samples,
123 int32_t micLevelIn, 123 int32_t micLevelIn,
124 int32_t* micLevelOut); 124 int32_t* micLevelOut);
125 125
126 /* 126 /*
127 * This function processes a 10 ms frame and adjusts (normalizes) the gain both 127 * This function processes a 10 ms frame and adjusts (normalizes) the gain both
128 * analog and digitally. The gain adjustments are done only during active 128 * analog and digitally. The gain adjustments are done only during active
129 * periods of speech. The length of the speech vectors must be given in samples 129 * periods of speech. The length of the speech vectors must be given in samples
130 * (80 when FS=8000, and 160 when FS=16000, FS=32000 or FS=48000). The echo 130 * (80 when FS=8000, and 160 when FS=16000, FS=32000 or FS=48000). The echo
131 * parameter can be used to ensure the AGC will not adjust upward in the 131 * parameter can be used to ensure the AGC will not adjust upward in the
132 * presence of echo. 132 * presence of echo.
(...skipping 19 matching lines...) Expand all
152 * - saturationWarning : A returned value of 1 indicates a saturation event 152 * - saturationWarning : A returned value of 1 indicates a saturation event
153 * has occurred and the volume cannot be further 153 * has occurred and the volume cannot be further
154 * reduced. Otherwise will be set to 0. 154 * reduced. Otherwise will be set to 0.
155 * 155 *
156 * Return value: 156 * Return value:
157 * : 0 - Normal operation. 157 * : 0 - Normal operation.
158 * : -1 - Error 158 * : -1 - Error
159 */ 159 */
160 int WebRtcAgc_Process(void* agcInst, 160 int WebRtcAgc_Process(void* agcInst,
161 const int16_t* const* inNear, 161 const int16_t* const* inNear,
162 int16_t num_bands, 162 size_t num_bands,
163 int16_t samples, 163 size_t samples,
164 int16_t* const* out, 164 int16_t* const* out,
165 int32_t inMicLevel, 165 int32_t inMicLevel,
166 int32_t* outMicLevel, 166 int32_t* outMicLevel,
167 int16_t echo, 167 int16_t echo,
168 uint8_t* saturationWarning); 168 uint8_t* saturationWarning);
169 169
170 /* 170 /*
171 * This function sets the config parameters (targetLevelDbfs, 171 * This function sets the config parameters (targetLevelDbfs,
172 * compressionGaindB and limiterEnable). 172 * compressionGaindB and limiterEnable).
173 * 173 *
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 int32_t minLevel, 233 int32_t minLevel,
234 int32_t maxLevel, 234 int32_t maxLevel,
235 int16_t agcMode, 235 int16_t agcMode,
236 uint32_t fs); 236 uint32_t fs);
237 237
238 #if defined(__cplusplus) 238 #if defined(__cplusplus)
239 } 239 }
240 #endif 240 #endif
241 241
242 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AGC_LEGACY_GAIN_CONTROL_H_ 242 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AGC_LEGACY_GAIN_CONTROL_H_
OLDNEW
« no previous file with comments | « webrtc/modules/audio_processing/agc/legacy/digital_agc.c ('k') | webrtc/modules/audio_processing/agc/mock_agc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698