Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- WYKONAŁA: MARTA TRZASKA 171632
- TELEKOMUNIKACJA 1, SEMESTR 6
- */
- #include <dsplib.h>
- //częstotliwosc graniczna filtru dolnoprzepustowego: fc=1320
- //długoć filtru N = 57
- #define NUM_SAMPLES 5000
- int samples[NUM_SAMPLES];
- #define N 57
- const short filtr_fir[] = {-30, -32, -36, -41, -46, -51, -53, -50, -41,
- -23, 6, 49, 106, 178, 267,372, 492, 624, 766, 914, 1064, 1212, 1353,
- 1482, 1594, 1687, 1755, 1797, 1811, 1797,1755, 1687, 1594, 1482, 1353,
- 1212, 1064, 914, 766, 624, 492, 372, 267, 178, 106,49, 6, -23, -41
- , -50, -53, -51, -46, -41, -36, -32, -30}; //suma współczynników = 32441; 32441/2^15 = 0,990021 (przemnożenie przez 0.99 przed zaokrągleniem)
- short white_noise[NUM_SAMPLES];
- int pila[NUM_SAMPLES];
- short wynik[NUM_SAMPLES];
- short bufor[N]; //int (?)
- int indeks = 0;
- void blockfir(short* input, const short* filter, short* output, int numSamples, int numFilter){
- int i;
- int j;
- for(j = 0; j < numSamples; j++){
- long y = 0;
- for(i = 0; i < N; i++){
- y = _smaci(y, input[i], filter[i]);
- }
- output[j] = (short)(_sround(y) >> 15);
- }
- }
- void main(void) {
- rand16init();
- rand16((DATA*)white_noise, NUM_SAMPLES);
- blockfir(white_noise, filtr_fir, wynik, NUM_SAMPLES, N);
- while (1); // do not exit
- }
Advertisement
Add Comment
Please, Sign In to add comment