kfr

Fast, modern C++ DSP framework, FFT, Sample Rate Conversion, FIR/IIR/Biquad Filters (SSE, AVX, AVX-512, ARM NEON)
Log | Files | Refs | README

commit 93427af6737b1590160c4076abb89eb33702aa4b
parent aa4b716e9b46f91f6cbb2bcd7fa72fbc1a2e3db7
Author: d.levin256@gmail.com <d.levin256@gmail.com>
Date:   Fri, 12 Aug 2016 09:58:26 +0300

Small improvements and fixes

Diffstat:
Minclude/kfr/base/sin_cos.hpp | 6+++---
Minclude/kfr/cometa.hpp | 4++--
Minclude/kfr/dsp/oscillators.hpp | 20++++++++++----------
3 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/include/kfr/base/sin_cos.hpp b/include/kfr/base/sin_cos.hpp @@ -198,10 +198,10 @@ KFR_SINTRIN vec<T, N> fastsin(const vec<T, N>& x) const vec<T, N> pi = c_pi<T>; - x -= pi; - vec<T, N> y = abs(x); + vec<T, N> xx = x - pi; + vec<T, N> y = abs(xx); y = select(y > c_pi<T, 1, 2>, pi - y, y); - y = y ^ (msk & ~x); + y = y ^ (msk & ~xx); vec<T, N> y2 = y * y; vec<T, N> formula = c6; diff --git a/include/kfr/cometa.hpp b/include/kfr/cometa.hpp @@ -1691,9 +1691,9 @@ inline array_ref<T> make_array_ref(Container& cont) template <typename Container, CMT_ENABLE_IF(has_data_size<Container>::value), typename T = remove_pointer<decltype(std::declval<Container>().data())>> -inline array_ref<T> make_array_ref(const Container& cont) +inline array_ref<const T> make_array_ref(const Container& cont) { - return array_ref<T>(cont.data(), cont.size()); + return array_ref<const T>(cont.data(), cont.size()); } template <typename T> diff --git a/include/kfr/dsp/oscillators.hpp b/include/kfr/dsp/oscillators.hpp @@ -47,17 +47,17 @@ namespace intrinsics template <typename T> KFR_SINTRIN T rawsine(T x) { - return fastsin(x * c_pi<T, 2>); + return intrinsics::fastsin(x * c_pi<T, 2>); } template <typename T> KFR_SINTRIN T sinenorm(T x) { - return rawsine(fract(x)); + return intrinsics::rawsine(fract(x)); } template <typename T> KFR_SINTRIN T sine(T x) { - return sinenorm(c_recip_pi<T, 1, 2> * x); + return intrinsics::sinenorm(c_recip_pi<T, 1, 2> * x); } template <typename T> @@ -68,12 +68,12 @@ KFR_SINTRIN T rawsquare(T x) template <typename T> KFR_SINTRIN T squarenorm(T x) { - return rawsquare(fract(x)); + return intrinsics::rawsquare(fract(x)); } template <typename T> KFR_SINTRIN T square(T x) { - return squarenorm(c_recip_pi<T, 1, 2> * x); + return intrinsics::squarenorm(c_recip_pi<T, 1, 2> * x); } template <typename T> @@ -84,12 +84,12 @@ KFR_SINTRIN T rawsawtooth(T x) template <typename T> KFR_SINTRIN T sawtoothnorm(T x) { - return rawsawtooth(fract(x)); + return intrinsics::rawsawtooth(fract(x)); } template <typename T> KFR_SINTRIN T sawtooth(T x) { - return sawtoothnorm(c_recip_pi<T, 1, 2> * x); + return intrinsics::sawtoothnorm(c_recip_pi<T, 1, 2> * x); } template <typename T> @@ -100,7 +100,7 @@ KFR_SINTRIN T isawtoothnorm(T x) template <typename T> KFR_SINTRIN T isawtooth(T x) { - return isawtoothnorm(c_recip_pi<T, 1, 2> * x); + return intrinsics::isawtoothnorm(c_recip_pi<T, 1, 2> * x); } template <typename T> @@ -111,12 +111,12 @@ KFR_SINTRIN T rawtriangle(T x) template <typename T> KFR_SINTRIN T trianglenorm(T x) { - return rawtriangle(fract(x + 0.25)); + return intrinsics::rawtriangle(fract(x + 0.25)); } template <typename T> KFR_SINTRIN T triangle(T x) { - return trianglenorm(c_recip_pi<T, 1, 2> * x); + return intrinsics::trianglenorm(c_recip_pi<T, 1, 2> * x); } } KFR_I_FN(rawsine)