Skip to content

Commit

Permalink
Merge pull request #1 from daschuer/bessel_freq_corners
Browse files Browse the repository at this point in the history
replace memmove with direct assignments, saves ~ 10 % CPU time
  • Loading branch information
badescunicu committed Jul 17, 2014
2 parents 9e48811 + 086ce2a commit 594f2c0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/engine/enginefilteriir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ EngineFilterIIR::~EngineFilterIIR() {

inline double _processLowpass(double* coef, double* buf, register double val) {
register double tmp, fir, iir;
tmp = buf[0]; memmove(buf, buf + 1, 3 * sizeof(double));
tmp = buf[0]; buf[0] = buf[1]; buf[1] = buf[2]; buf[2] = buf[3];
iir = val * coef[0];
iir -= coef[1] * tmp; fir = tmp;
iir -= coef[2] * buf[0]; fir += buf[0] + buf[0];
Expand All @@ -58,7 +58,8 @@ inline double _processLowpass(double* coef, double* buf, register double val) {

inline double _processBandpass(double* coef, double* buf, register double val) {
register double tmp, fir, iir;
tmp = buf[0]; memmove(buf, buf + 1, 7 * sizeof(double));
tmp = buf[0]; buf[0] = buf[1]; buf[1] = buf[2]; buf[2] = buf[3];
buf[3] = buf[4]; buf[4] = buf[5]; buf[5] = buf[6]; buf[6] = buf[7];
iir = val * coef[0];
iir -= coef[1] * tmp; fir = tmp;
iir -= coef[2] * buf[0]; fir += -buf[0] - buf[0];
Expand All @@ -84,7 +85,7 @@ inline double _processBandpass(double* coef, double* buf, register double val) {

inline double _processHighpass(double* coef, double* buf, register double val) {
register double tmp, fir, iir;
tmp = buf[0]; memmove(buf, buf + 1, 3 * sizeof(double));
tmp = buf[0]; buf[0] = buf[1]; buf[1] = buf[2]; buf[2] = buf[3];
iir= val * coef[0];
iir -= coef[1] * tmp; fir = tmp;
iir -= coef[2] * buf[0]; fir += -buf[0] - buf[0];
Expand Down

0 comments on commit 594f2c0

Please sign in to comment.