2011-07-07 08:21:25 +00:00
|
|
|
/*
|
2012-01-30 09:39:08 +00:00
|
|
|
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
|
2011-07-07 08:21:25 +00:00
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#ifndef MODULES_AUDIO_PROCESSING_NOISE_SUPPRESSION_IMPL_H_
|
|
|
|
|
#define MODULES_AUDIO_PROCESSING_NOISE_SUPPRESSION_IMPL_H_
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2016-02-19 07:04:49 -08:00
|
|
|
#include <memory>
|
2016-02-09 11:24:32 -08:00
|
|
|
#include <vector>
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#include "modules/audio_processing/include/audio_processing.h"
|
|
|
|
|
#include "rtc_base/constructormagic.h"
|
|
|
|
|
#include "rtc_base/criticalsection.h"
|
2011-07-07 08:21:25 +00:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
2014-02-27 22:23:17 +00:00
|
|
|
|
2011-07-07 08:21:25 +00:00
|
|
|
class AudioBuffer;
|
|
|
|
|
|
2015-12-08 13:22:33 -08:00
|
|
|
class NoiseSuppressionImpl : public NoiseSuppression {
|
2011-07-07 08:21:25 +00:00
|
|
|
public:
|
2015-12-08 13:22:33 -08:00
|
|
|
explicit NoiseSuppressionImpl(rtc::CriticalSection* crit);
|
|
|
|
|
~NoiseSuppressionImpl() override;
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2015-12-08 13:22:33 -08:00
|
|
|
// TODO(peah): Fold into ctor, once public API is removed.
|
Convert channel counts to size_t.
IIRC, this was originally requested by ajm during review of the other size_t conversions I did over the past year, and I agreed it made sense, but wanted to do it separately since those changes were already gargantuan.
BUG=chromium:81439
TEST=none
R=henrik.lundin@webrtc.org, henrika@webrtc.org, kjellander@webrtc.org, minyue@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org
Review URL: https://codereview.webrtc.org/1316523002 .
Cr-Commit-Position: refs/heads/master@{#11229}
2016-01-12 16:26:35 -08:00
|
|
|
void Initialize(size_t channels, int sample_rate_hz);
|
2015-12-16 01:18:15 -08:00
|
|
|
void AnalyzeCaptureAudio(AudioBuffer* audio);
|
|
|
|
|
void ProcessCaptureAudio(AudioBuffer* audio);
|
2011-07-07 08:21:25 +00:00
|
|
|
|
|
|
|
|
// NoiseSuppression implementation.
|
2015-12-08 13:22:33 -08:00
|
|
|
int Enable(bool enable) override;
|
2015-03-04 12:58:35 +00:00
|
|
|
bool is_enabled() const override;
|
2015-12-08 13:22:33 -08:00
|
|
|
int set_level(Level level) override;
|
2015-10-03 00:39:14 +02:00
|
|
|
Level level() const override;
|
2015-12-08 13:22:33 -08:00
|
|
|
float speech_probability() const override;
|
2016-02-09 11:24:32 -08:00
|
|
|
std::vector<float> NoiseEstimate() override;
|
2016-03-09 16:24:34 +01:00
|
|
|
static size_t num_noise_bins();
|
2011-07-07 08:21:25 +00:00
|
|
|
|
|
|
|
|
private:
|
2015-12-08 13:22:33 -08:00
|
|
|
class Suppressor;
|
2015-11-28 12:35:15 -08:00
|
|
|
rtc::CriticalSection* const crit_;
|
2017-09-07 07:53:45 -07:00
|
|
|
bool enabled_ RTC_GUARDED_BY(crit_) = false;
|
|
|
|
|
Level level_ RTC_GUARDED_BY(crit_) = kModerate;
|
|
|
|
|
size_t channels_ RTC_GUARDED_BY(crit_) = 0;
|
|
|
|
|
int sample_rate_hz_ RTC_GUARDED_BY(crit_) = 0;
|
|
|
|
|
std::vector<std::unique_ptr<Suppressor>> suppressors_ RTC_GUARDED_BY(crit_);
|
2015-12-08 13:22:33 -08:00
|
|
|
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(NoiseSuppressionImpl);
|
2011-07-07 08:21:25 +00:00
|
|
|
};
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
2017-09-15 06:47:31 +02:00
|
|
|
#endif // MODULES_AUDIO_PROCESSING_NOISE_SUPPRESSION_IMPL_H_
|