Skip to content

Commit

Permalink
transposed direct form 2
Browse files Browse the repository at this point in the history
  • Loading branch information
derselbst committed Jun 26, 2024
1 parent f8549e2 commit e51a527
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/rvoice/fluid_iir_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ fluid_iir_filter_apply(fluid_iir_filter_t *iir_filter,
* doesn't change.
*/

if(dsp_filter_coeff_incr_count > 0)
if(0)
{
fluid_real_t dsp_a1_incr = iir_filter->a1_incr;
fluid_real_t dsp_a2_incr = iir_filter->a2_incr;
Expand Down Expand Up @@ -123,10 +123,16 @@ fluid_iir_filter_apply(fluid_iir_filter_t *iir_filter,
for(dsp_i = 0; dsp_i < count; dsp_i++)
{
/* The filter is implemented in Direct-II form. */
dsp_centernode = dsp_buf[dsp_i] - dsp_a1 * dsp_hist1 - dsp_a2 * dsp_hist2;
dsp_buf[dsp_i] = dsp_b02 * (dsp_centernode + dsp_hist2) + dsp_b1 * dsp_hist1;
dsp_hist2 = dsp_hist1;
dsp_hist1 = dsp_centernode;
//dsp_centernode = dsp_buf[dsp_i] - dsp_a1 * dsp_hist1 - dsp_a2 * dsp_hist2;
//dsp_buf[dsp_i] = dsp_b02 * (dsp_centernode + dsp_hist2) + dsp_b1 * dsp_hist1;
//dsp_hist2 = dsp_hist1;
//dsp_hist1 = dsp_centernode;

/* The filter is implemented in Transposed Direct Form II */
fluid_real_t dsp_input = dsp_buf[dsp_i];
dsp_buf[dsp_i] = dsp_b02 * dsp_input + dsp_hist1;
dsp_hist1 = dsp_b1 * dsp_input - dsp_a1 * dsp_buf[dsp_i] + dsp_hist2;
dsp_hist2 = dsp_b02 * dsp_input - dsp_a2 * dsp_buf[dsp_i];
}
}

Expand Down

0 comments on commit e51a527

Please sign in to comment.