Skip to content

Commit

Permalink
attempt at fixing output filter
Browse files Browse the repository at this point in the history
  • Loading branch information
jpcima committed Jul 20, 2019
1 parent 543cd7e commit 971a7a8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions bbd_line.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ BBD_Line::BBD_Line(double fs, unsigned ns, const BBD_Filter_Spec &fsin, const BB
unsigned Mout = fout.M;
Xin_.reset(new cdouble[Min]);
Xout_.reset(new cdouble[Mout]);
Xout_mem_.reset(new cdouble[Mout]);
Gin_.reset(new cdouble[Min]);
Gout_.reset(new cdouble[Mout]);

Expand All @@ -44,6 +45,7 @@ void BBD_Line::clear()
unsigned Mout = fout_->M;
std::fill(&Xin_[0], &Xin_[Min], 0);
std::fill(&Xout_[0], &Xout_[Mout], 0);
std::fill(&Xout_mem_[0], &Xout_mem_[Mout], 0);
}

void BBD_Line::process(unsigned n, float *inout, const float *clock)
Expand All @@ -58,6 +60,7 @@ void BBD_Line::process(unsigned n, float *inout, const float *clock)
const BBD_Filter_Coef &fin = *fin_, &fout = *fout_;
unsigned Min = fin.M, Mout = fout.M;
cdouble *Xin = Xin_.get(), *Xout = Xout_.get();
cdouble *Xout_mem = Xout_mem_.get();
cdouble *Gin = Gin_.get(), *Gout = Gout_.get();
const cdouble *Pin = fin.P.get(), *Pout = fout.P.get();

Expand Down Expand Up @@ -97,9 +100,9 @@ void BBD_Line::process(unsigned n, float *inout, const float *clock)

cdouble y = fout.H * ybbd_old;
for (unsigned m = 0; m < Mout; ++m) {
cdouble xout = Xout[m];
cdouble xout = Pout[m] * Xout_mem[m] + Xout[m];
Xout_mem[m] = xout;
y += xout;
Xout[m] = xout * Pout[m];
}

inout[i] = y.real();
Expand Down
1 change: 1 addition & 0 deletions bbd_line.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class BBD_Line {
const BBD_Filter_Coef *fout_;
std::unique_ptr<cdouble[]> Xin_;
std::unique_ptr<cdouble[]> Xout_;
std::unique_ptr<cdouble[]> Xout_mem_; // sample memory of output filter
std::unique_ptr<cdouble[]> Gin_;
std::unique_ptr<cdouble[]> Gout_;
};

0 comments on commit 971a7a8

Please sign in to comment.