OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2017 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 // | | | 42 // | | |
43 // | | | 43 // | | |
44 // | | | 44 // | | |
45 // | P|__________ | 45 // | P|__________ |
46 // |---------------> bandwidth | 46 // |---------------> bandwidth |
47 ThresholdCurve(const Point& left, const Point& right) | 47 ThresholdCurve(const Point& left, const Point& right) |
48 : a(GetPoint(left, right, true)), | 48 : a(GetPoint(left, right, true)), |
49 b(GetPoint(left, right, false)), | 49 b(GetPoint(left, right, false)), |
50 slope(b.x - a.x == 0.0f ? 0.0f : (b.y - a.y) / (b.x - a.x)), | 50 slope(b.x - a.x == 0.0f ? 0.0f : (b.y - a.y) / (b.x - a.x)), |
51 offset(a.y - slope * a.x) { | 51 offset(a.y - slope * a.x) { |
52 // TODO(elad.alon): We might want to introduce some numerical validations. | 52 // TODO(eladalon): We might want to introduce some numerical validations. |
53 } | 53 } |
54 | 54 |
55 ThresholdCurve(float a_x, float a_y, float b_x, float b_y) | 55 ThresholdCurve(float a_x, float a_y, float b_x, float b_y) |
56 : ThresholdCurve(Point{a_x, a_y}, Point{b_x, b_y}) {} | 56 : ThresholdCurve(Point{a_x, a_y}, Point{b_x, b_y}) {} |
57 | 57 |
58 // Checks if a point is strictly below the curve. | 58 // Checks if a point is strictly below the curve. |
59 bool IsBelowCurve(const Point& p) const { | 59 bool IsBelowCurve(const Point& p) const { |
60 if (p.x < a.x) { | 60 if (p.x < a.x) { |
61 return true; | 61 return true; |
62 } else if (p.x == a.x) { | 62 } else if (p.x == a.x) { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 | 109 |
110 const Point a; | 110 const Point a; |
111 const Point b; | 111 const Point b; |
112 const float slope; | 112 const float slope; |
113 const float offset; | 113 const float offset; |
114 }; | 114 }; |
115 | 115 |
116 } // namespace webrtc | 116 } // namespace webrtc |
117 | 117 |
118 #endif // WEBRTC_MODULES_AUDIO_CODING_AUDIO_NETWORK_ADAPTOR_UTIL_THRESHOLD_CURV
E_H_ | 118 #endif // WEBRTC_MODULES_AUDIO_CODING_AUDIO_NETWORK_ADAPTOR_UTIL_THRESHOLD_CURV
E_H_ |
OLD | NEW |