iir_int: enable limits and offset

This commit is contained in:
Robert Jördens 2021-06-25 13:23:35 +00:00
parent a4f0746aa9
commit 3a3cbce005
1 changed files with 5 additions and 5 deletions

View File

@ -49,9 +49,9 @@ impl Coeff for Vec5 {
#[derive(Copy, Clone, Default, Debug, MiniconfAtomic, Deserialize)]
pub struct IIR {
pub ba: Vec5,
// pub y_offset: i32,
// pub y_min: i32,
// pub y_max: i32,
pub y_offset: i32,
pub y_min: i32,
pub y_max: i32,
}
impl IIR {
@ -76,9 +76,9 @@ impl IIR {
// Store x0 x0 x1 x2 y1 y2
xy[0] = x0;
// Compute y0 by multiply-accumulate
let y0 = macc_i32(0, xy, &self.ba, IIR::SHIFT);
let y0 = macc_i32(self.y_offset, xy, &self.ba, IIR::SHIFT);
// Limit y0
// let y0 = y0.max(self.y_min).min(self.y_max);
let y0 = y0.max(self.y_min).min(self.y_max);
// Store y0 x0 x1 y0 y1 y2
xy[n / 2] = y0;
y0