chromium/third_party/webrtc/modules/audio_processing/agc2/noise_level_estimator_unittest.cc

/*
 *  Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
 *
 *  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.
 */

#include "modules/audio_processing/agc2/noise_level_estimator.h"

#include <array>
#include <cmath>
#include <functional>
#include <limits>

#include "api/audio/audio_view.h"
#include "api/function_view.h"
#include "modules/audio_processing/agc2/agc2_testing_common.h"
#include "modules/audio_processing/agc2/vector_float_frame.h"
#include "modules/audio_processing/logging/apm_data_dumper.h"
#include "rtc_base/gunit.h"

namespace webrtc {
namespace {

constexpr int kNumIterations =;
constexpr int kFramesPerSecond =;

// Runs the noise estimator on audio generated by 'sample_generator'
// for kNumIterations. Returns the last noise level estimate.
float RunEstimator(rtc::FunctionView<float()> sample_generator,
                   NoiseLevelEstimator& estimator,
                   int sample_rate_hz) {}

class NoiseEstimatorParametrization : public ::testing::TestWithParam<int> {};

// Checks that full scale white noise maps to about -5.5 dBFS.
TEST_P(NoiseEstimatorParametrization, NoiseFloorEstimatorWithRandomNoise) {}

// Checks that a full scale sine wave maps to about -3 dBFS.
TEST_P(NoiseEstimatorParametrization, NoiseFloorEstimatorWithSineTone) {}

// Check that sufficiently spaced periodic pulses do not raise the estimated
// noise floor, which is determined by the amplitude of the non-pulse samples.
TEST_P(NoiseEstimatorParametrization, NoiseFloorEstimatorWithPulseTone) {}

INSTANTIATE_TEST_SUITE_P();

}  // namespace
}  // namespace webrtc