| OLD | NEW |
| (Empty) |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include <limits> | |
| 6 #include <utility> | |
| 7 | |
| 8 #include "mojo/public/cpp/environment/logging.h" | |
| 9 #include "mojo/services/media/common/cpp/linear_function.h" | |
| 10 | |
| 11 namespace mojo { | |
| 12 namespace media { | |
| 13 | |
| 14 // static | |
| 15 int64_t LinearFunction::Apply(int64_t domain_basis, | |
| 16 int64_t range_basis, | |
| 17 const Ratio& slope, // range_delta / domain_delta | |
| 18 int64_t domain_input) { | |
| 19 return slope.Scale(domain_input - domain_basis) + range_basis; | |
| 20 } | |
| 21 | |
| 22 // static | |
| 23 LinearFunction LinearFunction::Compose(const LinearFunction& bc, | |
| 24 const LinearFunction& ab, | |
| 25 bool exact) { | |
| 26 return LinearFunction(ab.domain_basis(), bc.Apply(ab.range_basis()), | |
| 27 Ratio::Product(ab.slope(), bc.slope(), exact)); | |
| 28 } | |
| 29 | |
| 30 } // namespace media | |
| 31 } // namespace mojo | |
| OLD | NEW |