mirror of
https://github.com/aicodix/dsp.git
synced 2026-04-27 14:30:36 +00:00
be able to normalize at construction
This commit is contained in:
parent
76f1590f1a
commit
2d8cedbd66
1 changed files with 5 additions and 1 deletions
|
|
@ -8,7 +8,7 @@ Copyright 2018 Ahmet Inan <inan@aicodix.de>
|
|||
|
||||
namespace DSP {
|
||||
|
||||
template <int TAPS, typename TYPE>
|
||||
template <int TAPS, typename TYPE, bool NORMALIZE = false>
|
||||
class Coeffs
|
||||
{
|
||||
TYPE w[TAPS];
|
||||
|
|
@ -18,12 +18,16 @@ public:
|
|||
{
|
||||
for (int n = 0; n < TAPS; ++n)
|
||||
w[n] = (*func)(n, TAPS);
|
||||
if (NORMALIZE)
|
||||
normalize();
|
||||
}
|
||||
template <typename FUNC0, typename FUNC1>
|
||||
Coeffs(FUNC0 *func0, FUNC1 *func1)
|
||||
{
|
||||
for (int n = 0; n < TAPS; ++n)
|
||||
w[n] = (*func0)(n, TAPS) * (*func1)(n, TAPS);
|
||||
if (NORMALIZE)
|
||||
normalize();
|
||||
}
|
||||
void normalize(TYPE divisor = 1)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue