Alex Loiko | a05ee82 | 2018-02-20 15:58:36 +0100 | [diff] [blame] | 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 | #include "modules/audio_processing/agc2/agc2_testing_common.h" |
| 12 | |
| 13 | #include "rtc_base/checks.h" |
| 14 | |
| 15 | namespace webrtc { |
| 16 | |
| 17 | namespace test { |
| 18 | |
| 19 | std::vector<double> LinSpace(const double l, |
| 20 | const double r, |
| 21 | size_t num_points) { |
| 22 | RTC_CHECK(num_points >= 2); |
| 23 | std::vector<double> points(num_points); |
| 24 | const double step = (r - l) / (num_points - 1.0); |
| 25 | points[0] = l; |
| 26 | for (size_t i = 1; i < num_points - 1; i++) { |
| 27 | points[i] = static_cast<double>(l) + i * step; |
| 28 | } |
| 29 | points[num_points - 1] = r; |
| 30 | return points; |
| 31 | } |
| 32 | } // namespace test |
| 33 | } // namespace webrtc |