File: filter.h

package info (click to toggle)
lysdr 1.0~git20141206+dfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 832 kB
  • ctags: 1,685
  • sloc: python: 11,659; ansic: 1,335; makefile: 24
file content (58 lines) | stat: -rw-r--r-- 1,536 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*  lysdr Software Defined Radio
	(C) 2010-2011 Gordon JC Pearce MM0YEQ and others
	
	filter.h
	
	This file is part of lysdr.

	lysdr is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 2 of the License, or
	any later version.

	lysdr is distributed in the hope that it will be useful, but
	WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with lysdr.  If not, see <http://www.gnu.org/licenses/>.
*/

#include <math.h>
#include <complex.h>
#include "sdr.h"

#ifndef __FILTER_H
#define __FILTER_H

// IIR filter defs
typedef struct {
	// coefficients
	gfloat alpha, w0, b0, b1, b2, a0, a1, a2;
	// taps
	gfloat x1, x2, y1, y2;
	gint size;
} filter_iir_t;
    

// FIR filter defs
typedef struct {
	double complex *impulse;
	double *buf_I;
	double *buf_Q;
	double *imp_I;
	double *imp_Q;
	int index;
	int size;
	int taps;
} filter_fir_t;

filter_fir_t *filter_fir_new(int taps, int size);
void filter_fir_destroy(filter_fir_t *filter);
void filter_fir_set_response(filter_fir_t *filter, int sample_rate, float bw, float centre);
void filter_fir_process(filter_fir_t *filter, double complex *samples);
void filter_hilbert(gint phase, double complex *samples, gint taps);
#endif

/* vim: set noexpandtab ai ts=4 sw=4 tw=4: */