Created
May 25, 2012 00:07
-
-
Save hpux735/2785005 to your computer and use it in GitHub Desktop.
fir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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