Skip to content

Instantly share code, notes, and snippets.

@hpux735
Created May 25, 2012 00:07
Show Gist options
  • Save hpux735/2785005 to your computer and use it in GitHub Desktop.
Save hpux735/2785005 to your computer and use it in GitHub Desktop.
fir
// The output at time 0 is the sum of the
// previous num_taps samples times the taps
int j;
for(j = 0; j < num_taps; j++) {
float2 sample = 0;
int sample_index = i - (num_taps - 1);
if (sample_index < 0) {
sample = lastBlock[2048+sample_index];
} else {
sample = input[sample_index];
}
output[i] += sample * (float2)taps[j];
}
// Copy the input to the last block,
// this ensures continuity
lastBlock[i] = input[i];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment