Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/fir #38

Merged
merged 7 commits into from
Oct 6, 2018
Merged

Feature/fir #38

merged 7 commits into from
Oct 6, 2018

Conversation

garbagetrash
Copy link
Collaborator

Added batch processing mode to FIR filters, sorry this wasn't in the first PR. Hopefully this one shouldn't be too hard to review, it's the same test data, and the new node is only slightly different from the first one. I'll probably merge it with just one persons approval.

garbagetrash and others added 5 commits September 29, 2018 21:05
Includes a sample by sample implementation of an FIR filter.
Provides initial state of filter memory and taps as vec[Complex<i16>]
constructor arguments.

Work remaining:
- Batch implementation.
- Documentation.
- More unit tests.
This commit is in a non-working state, I'm getting a weird macro
error I don't understand.  I think once that is sorted it should
work though.  Looking for assistance on that error.
Added support for batch FIR filtering.  Takes in Vec<Complex<i16>>
and outputs Vec<Complex<i16>>.  Eventually I'd like to support any
PrimInt instead of only i16, but this is fine for now.
Copy link
Owner

@ostrosco ostrosco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall I think this looks pretty good. I just have a couple of questions regarding ergonomics.

Complex::new(6, 5),
Complex::new(4, 3),
Complex::new(2, 1)],
vec![Complex::zero(),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of throwing five Complex::zero() calls into the vector, to me it seems easier to read to use something like vec![Complex::zero(); 5].

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good.

/// Arguments:
/// taps - FIR filter tap Vec[Complex<i16>].
/// state - Initial state for the internal filter state and memory.
pub fn batch_fir(taps: Vec<Complex<i16>>,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this is me misreading the test cases, but would there be a time where the state isn't all zeros? If not, I would say drop the state as an input to fir and batch_fir and just create a zero vector in the call versus having the user pass it in.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that's something I was wondering about last night. I can't think of a reason I'd want the filter preloaded with something, but wasn't sure if I should deny them the ability. I guess I could compromise and just have versions that did and didn't require initial state. Would it be a good idea to like make this an Option type and have the None case automagically fill it with 0's?

- Proper use of vec![x; x] macro.
- Added functions _with_state to allow user defined state vs. the
  common case where we assume an initial state of zeros.
@ostrosco ostrosco self-assigned this Oct 6, 2018
@ostrosco ostrosco merged commit 4095778 into develop Oct 6, 2018
@ostrosco ostrosco deleted the feature/fir branch October 6, 2018 02:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants