mirror of
https://github.com/cmosher01/Epple-II.git
synced 2024-06-09 23:29:39 +00:00
45 lines
1.5 KiB
C++
45 lines
1.5 KiB
C++
/*
|
|
epple2
|
|
Copyright (C) 2008 by Christopher A. Mosher <cmosher01@gmail.com>
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY, without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
#include "filterluma.h"
|
|
|
|
/*
|
|
Generated by the utility at http://www-users.cs.york.ac.uk/~fisher/mkfilter
|
|
3rd order low-pass Butterworth filter at 4500000 Hz with extra zero at 3500000 Hz.
|
|
(sample rate 14318182 Hz)
|
|
*/
|
|
|
|
#define GAIN 6.715664173
|
|
|
|
FilterLuma::FilterLuma() {
|
|
xv[0]=xv[1]=xv[2]=xv[3]=xv[4]=xv[5]=0;
|
|
yv[0]=yv[1]=yv[2]=yv[3]=0;
|
|
}
|
|
|
|
FilterLuma::~FilterLuma() {
|
|
}
|
|
|
|
float FilterLuma::next(const float v) {
|
|
xv[0] = xv[1]; xv[1] = xv[2]; xv[2] = xv[3]; xv[3] = xv[4]; xv[4] = xv[5];
|
|
xv[5] = v / GAIN;
|
|
yv[0] = yv[1]; yv[1] = yv[2]; yv[2] = yv[3];
|
|
yv[3] = (xv[0] + xv[5]) + 2.9302009676 * (xv[1] + xv[4]) + 3.7906029028 * (xv[2] + xv[3])
|
|
+ ( -0.0757751449 * yv[0]) + ( -0.4803383261 * yv[1])
|
|
+ ( -0.7432283875 * yv[2]);
|
|
return yv[3];
|
|
}
|