Debian Codegraph @

src/filters.h

raw
1 /*
2 filters: parse filter specifications
3
4 A specification of a set of filters is a string of coefficients
5 of each filter (including a_0=1 as sanity check, which is verfied
6 by syn123 on filter createion), separated with : from the coefficiets
7 of the next filter:
8
9 b_0,...,b_N,a_0,...,a_N:b_0,...,b_N,a_0,...,a_N
10
11 This code verifies such a string and prepares the data to hand over
12 to the syn123 library.
13
14 copyright 2020 by the mpg123 project - free software under the terms of the LGPL 2.1
15 see COPYING and AUTHORS files in distribution or http://mpg123.org
16 initially written by Thomas Orgis
17 */
18
19 #ifndef MPG123_FILTERS_H
20 #define MPG123_FILTERS_H
21
22 #include "compat/compat.h"
23
24 struct filter
25 {
26 unsigned int order;
27 double *b;
28 double *a;
29 };
30
31 struct filterlist
32 {
33 size_t count;
34 size_t coeff_total;
35 double *coeff; // all coefficients in one block of memory
36 struct filter *f;
37 };
38
39
40 // Parse given spec string and allocate filters data structure.
41 struct filterlist* parse_filterspec(const char *spec);
42 // Free all memory in the filter list and the list struct itself.
43 void free_filterlist(struct filterlist *filters);
44
45 #endif