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

Implemented decimating FIR filter #186

Merged
merged 1 commit into from
Jul 7, 2015
Merged

Conversation

shimshir
Copy link
Contributor

@shimshir shimshir commented Jul 6, 2015

I didn't understand what is mean by "This function retains the address of the delay filter memory containing the previous delayed values to allow consecutive processing of blocks."

I didn't understand what is mean by "This function retains the address of the delay filter memory containing the previous delayed values to allow consecutive processing of blocks."
@aolofsson
Copy link
Member

The question is whether the function retains state.

aolofsson added a commit that referenced this pull request Jul 7, 2015
Implemented decimating FIR filter
@aolofsson aolofsson merged commit 0dfbbd3 into parallella:master Jul 7, 2015
@shimshir
Copy link
Contributor Author

shimshir commented Jul 7, 2015

State of what exactly, the state of the taps?! If so then there are (nh + 1) * nx different states, what should be done with them? I would be happy to implement additional behavior I just need a more detailed explanation of the requirements.

@lfochamon
Copy link
Contributor

@shimshir The idea is to internally retain the last buffer used in the calculations, in this case nh*df last elements from x. However, I think a better option would be to initialize the delay line instead of saving the last state. Keeping an internal state would make it very hard for a user to filter two different buffers sequentially.

I've been thinking that maybe a better solution would be to only return values with a full delay line, ignoring the initial transient. The output of the filter function would be nx-nh+1 (instead of nx) and the initial state would be the first nh elements of x. Since the length of r is smaller than the length of x, in-place filtering is possible (although there would be nh-1 "garbage values" at the end of the output array). Still, I think it would be a good trade off.

@aolofsson What do you think?

@shimshir
Copy link
Contributor Author

shimshir commented Jul 7, 2015

@lchamon Having the option to initialize the delay line would be a good solution, but wouldn't the function signature have to be changed/extended by the initialization vector. As far as I understand it you want something similar to the Python lfilter function of the scipy package, particularly the zi vector, am I right?

@lfochamon
Copy link
Contributor

The idea is that the "initialization" would already be contained in x: the first nh elements of x. In your implementation, it would be equivalent to removing the first loop and adjusting the indexing of r.

And you are right: the idea is that the function keeps zi/zf from scipy internally (I believe it's similar to the *dbuf from the TI DSP library that @aolofsson referenced in #158).

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.

3 participants