eDSP
0.0.1
A cross-platform DSP library written in C++.
|
Functions | |
template<typename InputIt , typename OutputIt , typename Numeric > | |
constexpr void | amplifier (InputIt first, InputIt last, OutputIt d_first, Numeric factor) |
Amplifies or attenuates the elements in the range [first, last) and stores the result in another range, beginning at d_first. More... | |
template<typename InputIt , typename OutputIt , typename Numeric > | |
constexpr void | amplifier (InputIt first, InputIt last, OutputIt d_first, Numeric factor, Numeric min, Numeric max) |
Amplifies the signal in the range [first, last) and stores the result in another range, beginning at d_first. More... | |
template<typename ForwardIt > | |
constexpr ForwardIt | binary_search (ForwardIt first, ForwardIt last, const meta::value_type_t< ForwardIt > &value) |
Checks if an element equivalent to value appears within the range [first, last). More... | |
template<typename InputIt , typename OutputIt > | |
constexpr void | ceil (InputIt first, InputIt last, OutputIt d_first) |
For each element in the range [first, last) computes the smallest integer value not less than the element's value and stores the result in another range, beginning at d_first. More... | |
template<typename InputItr , typename OutputIt , typename Numeric > | |
constexpr void | clipper (InputItr first, InputItr last, OutputIt d_first, Numeric min, Numeric max) |
Limits the values of the elements in the range [first, last) once it exceeds a threshold [min, max], and stores the result in another range, beginning at d_first. More... | |
template<typename InputIt , typename OutputIt > | |
constexpr void | concatenate (InputIt first1, InputIt last1, InputIt first2, InputIt last2, OutputIt d_first) |
Concatenates the elements defined in the range [firs1, last1) and [first2, last2), and stores the result in another range, beginning at d_first. More... | |
template<typename InputItr , typename OutputIt , typename Numeric > | |
constexpr void | derivative (InputItr first, InputItr last, OutputIt d_first) |
Computes the first order derivative of the elements in the range [first, last), and stores the result in another range, beginning at d_first. More... | |
template<typename ForwardIt1 , typename ForwardIt2 , typename BinaryPredicate > | |
constexpr bool | equal (ForwardIt1 first1, ForwardIt2 last1, ForwardIt2 first2, ForwardIt2 last2, BinaryPredicate p) |
Returns true if the range [first1, last1) is equal to the range [first2, last2), and false otherwise. More... | |
template<typename ForwardIt1 , typename ForwardIt2 > | |
constexpr bool | equal (ForwardIt1 first1, ForwardIt2 last1, ForwardIt2 first2, ForwardIt2 last2) |
Returns true if the range [first1, last1) is equal to the range [first2, last2), and false otherwise. More... | |
template<typename InputIt , typename OutputIt > | |
constexpr void | fix (InputIt first, InputIt last, OutputIt d_first) |
For each element in the range [first, last) computes the nearest integer not greater in magnitude than the element's value and stores the result in another range, beginning at d_first. More... | |
template<typename InputIt , typename OutputIt > | |
constexpr void | floor (InputIt first, InputIt last, OutputIt d_first) |
For each element in the range [first, last) computes the largest integer value not greater than the element's value and stores the result in another range, beginning at d_first. More... | |
template<typename ForwardIt > | |
constexpr std::int32_t | indexof (ForwardIt first, ForwardIt last, const typename std::iterator_traits< ForwardIt >::value_type &value) |
Searches for an element equivalent to value in the range [first, last) and returns its position. More... | |
template<typename ForwardIt , class UnaryPredicate > | |
constexpr ForwardIt | binary_search (ForwardIt first, ForwardIt last, UnaryPredicate p) |
Searches for an element for which predicate p returns true in the range [first, last). More... | |
template<typename OutputIt , typename Numeric > | |
constexpr void | linspace (OutputIt d_first, Numeric N, meta::value_type_t< OutputIt > x1, meta::value_type_t< OutputIt > x2) |
Generate N linearly spaced values between the range [x1,x2] and stores the result in another range, beginning at d_first. More... | |
template<typename OutputIt , typename Numeric > | |
constexpr void | logspace (OutputIt d_first, Numeric N, meta::value_type_t< OutputIt > x1, meta::value_type_t< OutputIt > x2) |
Generate N logarithmic spaced values between the range [x1,x2] and stores the result in another range, beginning at d_first. More... | |
template<typename InputIt , typename OutputIt > | |
constexpr void | normalize (InputIt first, InputIt last, OutputIt d_first) |
Normalizes the elements in the range [first, last) and stores the result in another range, beginning at d_first. More... | |
template<typename InputIt , typename OutputIt > | |
constexpr void | normalize_rms (InputIt first, InputIt last, OutputIt d_first) |
Normalizes the elements in the range [first, last) and stores the result in another range, beginning at d_first. More... | |
template<typename InputIt , typename OutputIt > | |
constexpr void | padder (InputIt first, InputIt last, OutputIt d_first, OutputIt d_last) |
Extends the signal defined in the range [first, last) with zeros and stores the result in the range [d_first, d_last]. More... | |
template<typename InputIt , typename OutputIt > | |
constexpr void | rectify (InputIt first, InputIt last, OutputIt d_first) |
For each element in the range [first, last) computes the absolute value not and stores the result in another range, beginning at d_first. More... | |
template<typename InputIt , typename OutputIt > | |
constexpr void | round (InputIt first, InputIt last, OutputIt d_first) |
For each element in the range [first, last) computes the nearest integer value to the element's value rounding halfway cases away from zero, and stores the result in another range, beginning at d_first. More... | |
template<typename InputIt , typename OutputIt , typename Numeric > | |
constexpr bool | silence (InputIt first, InputIt last, Numeric threshold) |
Checks if the elements in the range [first, last) are a silenced frame. More... | |
constexpr void edsp::algorithm::amplifier | ( | InputIt | first, |
InputIt | last, | ||
OutputIt | d_first, | ||
Numeric | factor | ||
) |
Amplifies or attenuates the elements in the range [first, last) and stores the result in another range, beginning at d_first.
This function increases the amplitude of the input signal defined in the range [first, last). The output signal is a proportionally amplitude signal dependent of the scale factor ( \( \alpha \)):
\[ y(n) = \alpha x(n) \]
first | Input iterator defining the beginning of the input range. |
last | Input iterator defining the ending of the input range. |
d_first | Output iterator defining the beginning of the destination range. |
factor | Scale factor ( \( \alpha \)). |
constexpr void edsp::algorithm::amplifier | ( | InputIt | first, |
InputIt | last, | ||
OutputIt | d_first, | ||
Numeric | factor, | ||
Numeric | min, | ||
Numeric | max | ||
) |
Amplifies the signal in the range [first, last) and stores the result in another range, beginning at d_first.
This function increases the amplitude of the input signal defined in the range [first, last). The output signal is a proportionally amplitude signal dependent of the scale factor ( \( \alpha \)):
\[ y(n) = \alpha x(n) \]
The output signal is then clipped to avoid exceding the threshold defined in the range [min, max].
first | Input iterator defining the beginning of the input range. |
last | Input iterator defining the ending of the input range. |
d_first | Output iterator defining the beginning of the destination range. |
factor | Scale factor ( \( \alpha \)). |
min | Minimum threshold value. |
max | Maximum threshold value. |
constexpr ForwardIt edsp::algorithm::binary_search | ( | ForwardIt | first, |
ForwardIt | last, | ||
const meta::value_type_t< ForwardIt > & | value | ||
) |
Checks if an element equivalent to value appears within the range [first, last).
Searches for an element equivalent to value in the range [first, last).
For binary_search to succeed, the range [first, last) must be ordered.
first | Forward iterator defining the begin of the range to examine. |
last | Forward iterator defining the end of the range to examine. |
value | Value to compare the elements to. |
first | Forward iterator defining the begin of the range to examine. |
last | Forward iterator defining the end of the range to examine. |
value | Value to UnaryPredicate the elements to. |
constexpr ForwardIt edsp::algorithm::binary_search | ( | ForwardIt | first, |
ForwardIt | last, | ||
UnaryPredicate | p | ||
) |
Searches for an element for which predicate p returns true in the range [first, last).
first | Forward iterator defining the begin of the range to examine. |
last | Forward iterator defining the end of the range to examine. |
p | Binary predicate which returns true for the required element. . |
constexpr void edsp::algorithm::ceil | ( | InputIt | first, |
InputIt | last, | ||
OutputIt | d_first | ||
) |
For each element in the range [first, last) computes the smallest integer value not less than the element's value and stores the result in another range, beginning at d_first.
first | Forward iterator defining the begin of the range to examine. |
last | Forward iterator defining the end of the range to examine. |
d_first | Output iterator defining the beginning of the destination range. |
constexpr void edsp::algorithm::clipper | ( | InputItr | first, |
InputItr | last, | ||
OutputIt | d_first, | ||
Numeric | min, | ||
Numeric | max | ||
) |
Limits the values of the elements in the range [first, last) once it exceeds a threshold [min, max], and stores the result in another range, beginning at d_first.
first | Forward iterator defining the begin of the range to examine. |
last | Forward iterator defining the end of the range to examine. |
d_first | Output iterator defining the beginning of the destination range. |
min | Minimum threshold value. |
max | Maximum threshold value. |
constexpr void edsp::algorithm::concatenate | ( | InputIt | first1, |
InputIt | last1, | ||
InputIt | first2, | ||
InputIt | last2, | ||
OutputIt | d_first | ||
) |
Concatenates the elements defined in the range [firs1, last1) and [first2, last2), and stores the result in another range, beginning at d_first.
first1 | Forward iterator defining the begin of the first range. |
last1 | Forward iterator defining the end of the first range. |
first2 | Forward iterator defining the begin of the second range. |
last2 | Forward iterator defining the end of the second range. |
d_first | Output iterator defining the beginning of the destination range. |
constexpr void edsp::algorithm::derivative | ( | InputItr | first, |
InputItr | last, | ||
OutputIt | d_first | ||
) |
Computes the first order derivative of the elements in the range [first, last), and stores the result in another range, beginning at d_first.
The definition of the first order derivative derivative is:
\[ y(n) = x(n) - x(n - 1) \]
first | Forward iterator defining the begin of the range to examine. |
last | Forward iterator defining the end of the range to examine. |
d_first | Output iterator defining the beginning of the destination range. |
constexpr bool edsp::algorithm::equal | ( | ForwardIt1 | first1, |
ForwardIt2 | last1, | ||
ForwardIt2 | first2, | ||
ForwardIt2 | last2, | ||
BinaryPredicate | p | ||
) |
Returns true if the range [first1, last1) is equal to the range [first2, last2), and false otherwise.
first1 | Forward iterator defining the begin of the first range. |
last1 | Forward iterator defining the end of the first range. |
first2 | Forward iterator defining the begin of the second range. |
last2 | Forward iterator defining the end of the second range. |
p | Binary predicate which returns true if the elements should be treated as equal. |
constexpr bool edsp::algorithm::equal | ( | ForwardIt1 | first1, |
ForwardIt2 | last1, | ||
ForwardIt2 | first2, | ||
ForwardIt2 | last2 | ||
) |
Returns true if the range [first1, last1) is equal to the range [first2, last2), and false otherwise.
first1 | Forward iterator defining the begin of the first range. |
last1 | Forward iterator defining the end of the first range. |
first2 | Forward iterator defining the begin of the second range. |
last2 | Forward iterator defining the end of the second range. |
constexpr void edsp::algorithm::fix | ( | InputIt | first, |
InputIt | last, | ||
OutputIt | d_first | ||
) |
For each element in the range [first, last) computes the nearest integer not greater in magnitude than the element's value and stores the result in another range, beginning at d_first.
first | Forward iterator defining the begin of the range to examine. |
last | Forward iterator defining the end of the range to examine. |
d_first | Output iterator defining the beginning of the destination range. |
constexpr void edsp::algorithm::floor | ( | InputIt | first, |
InputIt | last, | ||
OutputIt | d_first | ||
) |
For each element in the range [first, last) computes the largest integer value not greater than the element's value and stores the result in another range, beginning at d_first.
first | Forward iterator defining the begin of the range to examine. |
last | Forward iterator defining the end of the range to examine. |
d_first | Output iterator defining the beginning of the destination range. |
constexpr std::int32_t edsp::algorithm::indexof | ( | ForwardIt | first, |
ForwardIt | last, | ||
const typename std::iterator_traits< ForwardIt >::value_type & | value | ||
) |
Searches for an element equivalent to value in the range [first, last) and returns its position.
first | Forward iterator defining the begin of the range to examine. |
last | Forward iterator defining the end of the range to examine. |
value | Element to be found. |
constexpr void edsp::algorithm::linspace | ( | OutputIt | d_first, |
Numeric | N, | ||
meta::value_type_t< OutputIt > | x1, | ||
meta::value_type_t< OutputIt > | x2 | ||
) |
Generate N linearly spaced values between the range [x1,x2] and stores the result in another range, beginning at d_first.
x1 | Defines the beginning of the interval over which linspace generates points. |
x2 | Defines the ending of the interval over which linspace generates points. |
N | Number of points to generate. |
d_first | The beginning of the destination range |
constexpr void edsp::algorithm::logspace | ( | OutputIt | d_first, |
Numeric | N, | ||
meta::value_type_t< OutputIt > | x1, | ||
meta::value_type_t< OutputIt > | x2 | ||
) |
Generate N logarithmic spaced values between the range [x1,x2] and stores the result in another range, beginning at d_first.
x1 | Defines the beginning of the interval over which linspace generates points. |
x2 | Defines the ending of the interval over which linspace generates points. |
N | Number of points to generate. |
d_first | The beginning of the destination range |
constexpr void edsp::algorithm::normalize | ( | InputIt | first, |
InputIt | last, | ||
OutputIt | d_first | ||
) |
Normalizes the elements in the range [first, last) and stores the result in another range, beginning at d_first.
The denominator is the maximum absolute value of the signal.
\[ y = \frac{x}{\frac{\sum_{n=1}^{N}x(n)}{N}} \]
first | Input iterator defining the beginning of the input range. |
last | Input iterator defining the ending of the input range. |
d_first | Output iterator defining the beginning of the destination range. |
constexpr void edsp::algorithm::normalize_rms | ( | InputIt | first, |
InputIt | last, | ||
OutputIt | d_first | ||
) |
Normalizes the elements in the range [first, last) and stores the result in another range, beginning at d_first.
The denominator is the RMS value of the signal.
\[ y = \frac{x}{\sqrt{\frac{\sum_{n=1}^{N}\left|x(n)^2\right|}{N}}} \]
first | Input iterator defining the beginning of the input range. |
last | Input iterator defining the ending of the input range. |
d_first | Output iterator defining the beginning of the destination range. |
constexpr void edsp::algorithm::padder | ( | InputIt | first, |
InputIt | last, | ||
OutputIt | d_first, | ||
OutputIt | d_last | ||
) |
Extends the signal defined in the range [first, last) with zeros and stores the result in the range [d_first, d_last].
\[ y(n) = \left\{\begin{matrix} x(n) & 0 <= n < N \\ 0 & N <= n < M \end{matrix}\right. \]
where N is the size of the input range and M the size of the output range.
first | Forward iterator defining the begin of the range to examine. |
last | Forward iterator defining the end of the range to examine. |
d_first | Forward iterator defining the begin of the output range. |
d_last | Forward iterator defining the end of the output range. |
constexpr void edsp::algorithm::rectify | ( | InputIt | first, |
InputIt | last, | ||
OutputIt | d_first | ||
) |
For each element in the range [first, last) computes the absolute value not and stores the result in another range, beginning at d_first.
first | Forward iterator defining the begin of the range to examine. |
last | Forward iterator defining the end of the range to examine. |
d_first | Output iterator defining the beginning of the destination range. |
constexpr void edsp::algorithm::round | ( | InputIt | first, |
InputIt | last, | ||
OutputIt | d_first | ||
) |
For each element in the range [first, last) computes the nearest integer value to the element's value rounding halfway cases away from zero, and stores the result in another range, beginning at d_first.
first | Forward iterator defining the begin of the range to examine. |
last | Forward iterator defining the end of the range to examine. |
d_first | Output iterator defining the beginning of the destination range. |
constexpr bool edsp::algorithm::silence | ( | InputIt | first, |
InputIt | last, | ||
Numeric | threshold | ||
) |
Checks if the elements in the range [first, last) are a silenced frame.
A silenced frame is a frame with an instant power up to a threshold.
first | Input iterator defining the beginning of the input range. |
last | Input iterator defining the ending of the input range. |
threshold | Threshold . |