Skip to content

Commit

Permalink
rework iir filter
Browse files Browse the repository at this point in the history
  • Loading branch information
jordens committed Jan 4, 2024
1 parent 2169cb9 commit 31ab7e6
Show file tree
Hide file tree
Showing 4 changed files with 521 additions and 114 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

* `hbf` FIRs, symmetric FIRs, half band filters, HBF decimators and interpolators
* `iir::PidBuilder` a builder for PID coefficients
* `iir::Biquad::{hold, proportional, identity}`

### Removed

* `iir::Vec5` type alias has been removed.

### Changed

* `iir`: The biquad IIR filter API has been reworked. `IIR -> Biquad` renamed.

## [0.10.0](https://github.com/quartiq/idsp/compare/v0.9.2..v0.10.0) - 2023-07-20

Expand Down
12 changes: 6 additions & 6 deletions benches/micro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,20 @@ fn iir_int_bench() {
}

fn iir_f32_bench() {
let dut = iir::IIR::<f32>::default();
let mut xy = iir::Vec5::default();
let dut = iir::Biquad::<f32>::default();
let mut xy = [0.0; 5];
println!(
"int::IIR::<f32>::update(s, x): {}",
bench_env(0.32241, |x| dut.update(&mut xy, *x, true))
bench_env(0.32241, |x| dut.update(&mut xy, *x))
);
}

fn iir_f64_bench() {
let dut = iir::IIR::<f64>::default();
let mut xy = iir::Vec5::default();
let dut = iir::Biquad::<f64>::default();
let mut xy = [0.0; 5];
println!(
"int::IIR::<f64>::update(s, x): {}",
bench_env(0.32241, |x| dut.update(&mut xy, *x, true))
bench_env(0.32241, |x| dut.update(&mut xy, *x))
);
}

Expand Down
4 changes: 2 additions & 2 deletions src/complex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ impl ComplexExt<i32, u32> for Complex<i32> {
/// ```
/// use idsp::{Complex, ComplexExt};
/// Complex::<i32>::from_angle(0);
/// Complex::<i32>::from_angle(1 << 30); // pi/2
/// Complex::<i32>::from_angle(-1 << 30); // -pi/2
/// Complex::<i32>::from_angle(1 << 30); // pi/2
/// Complex::<i32>::from_angle(-1 << 30); // -pi/2
/// ```
fn from_angle(angle: i32) -> Self {
let (c, s) = cossin(angle);
Expand Down
Loading

0 comments on commit 31ab7e6

Please sign in to comment.