• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
3  *
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
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #ifndef MODULES_AUDIO_PROCESSING_AGC2_COMPUTE_INTERPOLATED_GAIN_CURVE_H_
12 #define MODULES_AUDIO_PROCESSING_AGC2_COMPUTE_INTERPOLATED_GAIN_CURVE_H_
13 
14 #include <array>
15 
16 #include "modules/audio_processing/agc2/agc2_common.h"
17 
18 namespace webrtc {
19 
20 namespace test {
21 
22 // Parameters for interpolated gain curve using under-approximation to
23 // avoid saturation.
24 //
25 // The saturation gain is defined in order to let hard-clipping occur for
26 // those samples having a level that falls in the saturation region. It is an
27 // upper bound of the actual gain to apply - i.e., that returned by the
28 // limiter.
29 
30 // Knee and beyond-knee regions approximation parameters.
31 // The gain curve is approximated as a piece-wise linear function.
32 // |approx_params_x_| are the boundaries between adjacent linear pieces,
33 // |approx_params_m_| and |approx_params_q_| are the slope and the y-intercept
34 // values of each piece.
35 struct InterpolatedParameters {
36   std::array<float, kInterpolatedGainCurveTotalPoints>
37       computed_approximation_params_x;
38   std::array<float, kInterpolatedGainCurveTotalPoints>
39       computed_approximation_params_m;
40   std::array<float, kInterpolatedGainCurveTotalPoints>
41       computed_approximation_params_q;
42 };
43 
44 InterpolatedParameters ComputeInterpolatedGainCurveApproximationParams();
45 }  // namespace test
46 }  // namespace webrtc
47 
48 #endif  // MODULES_AUDIO_PROCESSING_AGC2_COMPUTE_INTERPOLATED_GAIN_CURVE_H_
49