diff options
Diffstat (limited to 'host/include')
-rw-r--r-- | host/include/uhd/cal/CMakeLists.txt | 1 | ||||
-rw-r--r-- | host/include/uhd/cal/interpolation.hpp | 16 | ||||
-rw-r--r-- | host/include/uhd/cal/iq_cal.hpp | 4 | ||||
-rw-r--r-- | host/include/uhd/utils/CMakeLists.txt | 1 | ||||
-rw-r--r-- | host/include/uhd/utils/interpolation.hpp | 16 | ||||
-rw-r--r-- | host/include/uhd/utils/math.hpp | 25 |
6 files changed, 25 insertions, 38 deletions
diff --git a/host/include/uhd/cal/CMakeLists.txt b/host/include/uhd/cal/CMakeLists.txt index 2aba1a91c..8d8dfa11e 100644 --- a/host/include/uhd/cal/CMakeLists.txt +++ b/host/include/uhd/cal/CMakeLists.txt @@ -7,7 +7,6 @@ UHD_INSTALL(FILES database.hpp container.hpp - interpolation.hpp iq_cal.hpp iq_cal_generated.h DESTINATION ${INCLUDE_DIR}/uhd/cal diff --git a/host/include/uhd/cal/interpolation.hpp b/host/include/uhd/cal/interpolation.hpp deleted file mode 100644 index 5cdbcfa54..000000000 --- a/host/include/uhd/cal/interpolation.hpp +++ /dev/null @@ -1,16 +0,0 @@ -// -// Copyright 2020 Ettus Research, a National Instruments Brand -// -// SPDX-License-Identifier: GPL-3.0-or-later -// - -#ifndef INCLUDED_LIBUHD_CAL_INTERP_HPP -#define INCLUDED_LIBUHD_CAL_INTERP_HPP - -namespace uhd { namespace usrp { namespace cal { - -enum class interp_mode { NEAREST_NEIGHBOR, LINEAR }; - -}}} // namespace uhd::usrp::cal - -#endif /* INCLUDED_LIBUHD_CAL_INTERP_HPP */ diff --git a/host/include/uhd/cal/iq_cal.hpp b/host/include/uhd/cal/iq_cal.hpp index ded082698..78f1c9177 100644 --- a/host/include/uhd/cal/iq_cal.hpp +++ b/host/include/uhd/cal/iq_cal.hpp @@ -8,8 +8,8 @@ #define INCLUDED_LIBUHD_CAL_IQ_DATA_HPP #include <uhd/cal/container.hpp> -#include <uhd/cal/interpolation.hpp> #include <uhd/config.hpp> +#include <uhd/utils/interpolation.hpp> #include <complex> #include <memory> #include <string> @@ -35,7 +35,7 @@ public: // \param interp The new interpolation mode // \throws uhd::value_error if the given interpolation mode is not // supported. - virtual void set_interp_mode(const interp_mode interp) = 0; + virtual void set_interp_mode(const uhd::math::interp_mode interp) = 0; //! Return a calibration coefficient for a given frequency // diff --git a/host/include/uhd/utils/CMakeLists.txt b/host/include/uhd/utils/CMakeLists.txt index b70de86ba..17d5b2380 100644 --- a/host/include/uhd/utils/CMakeLists.txt +++ b/host/include/uhd/utils/CMakeLists.txt @@ -18,6 +18,7 @@ UHD_INSTALL(FILES fp_compare_epsilon.ipp gain_group.hpp graph_utils.hpp + interpolation.hpp log.hpp log_add.hpp math.hpp diff --git a/host/include/uhd/utils/interpolation.hpp b/host/include/uhd/utils/interpolation.hpp new file mode 100644 index 000000000..42a7d8fb1 --- /dev/null +++ b/host/include/uhd/utils/interpolation.hpp @@ -0,0 +1,16 @@ +// +// Copyright 2020 Ettus Research, a National Instruments Brand +// +// SPDX-License-Identifier: GPL-3.0-or-later +// + +#ifndef INCLUDED_UHD_INTERP_HPP +#define INCLUDED_UHD_INTERP_HPP + +namespace uhd { namespace math { + +enum class interp_mode { NEAREST_NEIGHBOR, LINEAR }; + +}} // namespace uhd::math + +#endif /* INCLUDED_UHD_INTERP_HPP */ diff --git a/host/include/uhd/utils/math.hpp b/host/include/uhd/utils/math.hpp index bb721d3af..f5aef5ea1 100644 --- a/host/include/uhd/utils/math.hpp +++ b/host/include/uhd/utils/math.hpp @@ -1,4 +1,9 @@ - +// +// Copyright 2014-2015 Ettus Research LLC +// Copyright 2018 Ettus Research, a National Instruments Company +// +// SPDX-License-Identifier: GPL-3.0-or-later +// #ifndef INCLUDED_UHD_UTILS_MATH_HPP #define INCLUDED_UHD_UTILS_MATH_HPP @@ -246,24 +251,6 @@ inline IntegerType gcd(IntegerType x, IntegerType y) return _bmint::gcd<IntegerType>(x, y); } -//! Linearly interpolate f(x) given f(x0) = y0 and f(x1) = y1 -// -// This draws a line through the coordinates x0/y0 and x1/y1, and then returns -// the y-value for the given x-value on said line. -// -// \throws uhd::runtime_error if x0 == x1, since that doesn't allow us to -// interpolate. -template <typename InterpType> -inline InterpType linear_interp( - InterpType x, InterpType x0, InterpType y0, InterpType x1, InterpType y1) -{ - if (x0 == x1) { - throw uhd::runtime_error("linear_interp(): x0 and x1 must differ!"); - } - return y0 + (x - x0) * (y1 - y0) / (x1 - x0); -} - - } // namespace math } // namespace uhd |