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

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

Issue 1234463003: Integrate Intelligibility with APM (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressed comments Created 5 years, 5 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 115
116 // Use to enable 48kHz support in audio processing. Must be provided through the 116 // Use to enable 48kHz support in audio processing. Must be provided through the
117 // constructor. It will have no impact if used with 117 // constructor. It will have no impact if used with
118 // AudioProcessing::SetExtraOptions(). 118 // AudioProcessing::SetExtraOptions().
119 struct AudioProcessing48kHzSupport { 119 struct AudioProcessing48kHzSupport {
120 AudioProcessing48kHzSupport() : enabled(true) {} 120 AudioProcessing48kHzSupport() : enabled(true) {}
121 explicit AudioProcessing48kHzSupport(bool enabled) : enabled(enabled) {} 121 explicit AudioProcessing48kHzSupport(bool enabled) : enabled(enabled) {}
122 bool enabled; 122 bool enabled;
123 }; 123 };
124 124
125 // Use to enable intelligibility enhancer in audio processing. Must be provided
126 // though the constructor. It will have no impact if used with
127 // AudioProcessing::SetExtraOptions().
128 struct Intelligibility {
129 Intelligibility() : enabled(false) {}
130 explicit Intelligibility(bool enabled) : enabled(enabled) {}
131 bool enabled;
132 };
133
125 static const int kAudioProcMaxNativeSampleRateHz = 32000; 134 static const int kAudioProcMaxNativeSampleRateHz = 32000;
126 135
127 // The Audio Processing Module (APM) provides a collection of voice processing 136 // The Audio Processing Module (APM) provides a collection of voice processing
128 // components designed for real-time communications software. 137 // components designed for real-time communications software.
129 // 138 //
130 // APM operates on two audio streams on a frame-by-frame basis. Frames of the 139 // APM operates on two audio streams on a frame-by-frame basis. Frames of the
131 // primary stream, on which all processing is applied, are passed to 140 // primary stream, on which all processing is applied, are passed to
132 // |ProcessStream()|. Frames of the reverse direction stream, which are used for 141 // |ProcessStream()|. Frames of the reverse direction stream, which are used for
133 // analysis by some components, are passed to |AnalyzeReverseStream()|. On the 142 // analysis by some components, are passed to |AnalyzeReverseStream()|. On the
134 // client-side, this will typically be the near-end (capture) and far-end 143 // client-side, this will typically be the near-end (capture) and far-end
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 // members of |frame| must be valid. |sample_rate_hz_| must correspond to 325 // members of |frame| must be valid. |sample_rate_hz_| must correspond to
317 // |input_sample_rate_hz()| 326 // |input_sample_rate_hz()|
318 // 327 //
319 // TODO(ajm): add const to input; requires an implementation fix. 328 // TODO(ajm): add const to input; requires an implementation fix.
320 virtual int AnalyzeReverseStream(AudioFrame* frame) = 0; 329 virtual int AnalyzeReverseStream(AudioFrame* frame) = 0;
321 330
322 // Accepts deinterleaved float audio with the range [-1, 1]. Each element 331 // Accepts deinterleaved float audio with the range [-1, 1]. Each element
323 // of |data| points to a channel buffer, arranged according to |layout|. 332 // of |data| points to a channel buffer, arranged according to |layout|.
324 virtual int AnalyzeReverseStream(const float* const* data, 333 virtual int AnalyzeReverseStream(const float* const* data,
325 int samples_per_channel, 334 int samples_per_channel,
326 int sample_rate_hz, 335 int rev_sample_rate_hz,
336 ChannelLayout layout) = 0;
337
338 // Same as AnalyzeReverseStream, but may modify |data| if intelligibility
339 // is enabled.
340 virtual int ProcessReverseStream(float* const* data,
341 int samples_per_channel,
342 int rev_sample_rate_hz,
327 ChannelLayout layout) = 0; 343 ChannelLayout layout) = 0;
328 344
329 // This must be called if and only if echo processing is enabled. 345 // This must be called if and only if echo processing is enabled.
330 // 346 //
331 // Sets the |delay| in ms between AnalyzeReverseStream() receiving a far-end 347 // Sets the |delay| in ms between AnalyzeReverseStream() receiving a far-end
332 // frame and ProcessStream() receiving a near-end frame containing the 348 // frame and ProcessStream() receiving a near-end frame containing the
333 // corresponding echo. On the client-side this can be expressed as 349 // corresponding echo. On the client-side this can be expressed as
334 // delay = (t_render - t_analyze) + (t_process - t_capture) 350 // delay = (t_render - t_analyze) + (t_process - t_capture)
335 // where, 351 // where,
336 // - t_analyze is the time a frame is passed to AnalyzeReverseStream() and 352 // - t_analyze is the time a frame is passed to AnalyzeReverseStream() and
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 // This does not impact the size of frames passed to |ProcessStream()|. 803 // This does not impact the size of frames passed to |ProcessStream()|.
788 virtual int set_frame_size_ms(int size) = 0; 804 virtual int set_frame_size_ms(int size) = 0;
789 virtual int frame_size_ms() const = 0; 805 virtual int frame_size_ms() const = 0;
790 806
791 protected: 807 protected:
792 virtual ~VoiceDetection() {} 808 virtual ~VoiceDetection() {}
793 }; 809 };
794 } // namespace webrtc 810 } // namespace webrtc
795 811
796 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_ 812 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698