1 /* SoX Resampler Library      Copyright (c) 2007-13 robs@users.sourceforge.net
2  * Licence for this file: LGPL v2.1                  See LICENCE for details. */
3 
4 #if !defined soxr_filter_included
5 #define soxr_filter_included
6 
7 #include "aliases.h"
8 
9 double lsx_bessel_I_0(double x);
10 void lsx_init_fft_cache(void);
11 void lsx_clear_fft_cache(void);
12 void lsx_init_fft_cache_f(void);
13 void lsx_clear_fft_cache_f(void);
14 #define lsx_is_power_of_2(x) !(x < 2 || (x & (x - 1)))
15 void lsx_safe_rdft(int len, int type, double * d);
16 void lsx_safe_cdft(int len, int type, double * d);
17 void lsx_safe_rdft_f(int len, int type, float * d);
18 void lsx_safe_cdft_f(int len, int type, float * d);
19 void lsx_ordered_convolve(int n, void * not_used, double * a, const double * b);
20 void lsx_ordered_convolve_f(int n, void * not_used, float * a, const float * b);
21 void lsx_ordered_partial_convolve(int n, double * a, const double * b);
22 void lsx_ordered_partial_convolve_f(int n, float * a, const float * b);
23 
24 double lsx_kaiser_beta(double att, double tr_bw);
25 double * lsx_make_lpf(int num_taps, double Fc, double beta, double rho,
26     double scale);
27 void lsx_kaiser_params(double att, double Fc, double tr_bw, double * beta, int * num_taps);
28 double * lsx_design_lpf(
29     double Fp,      /* End of pass-band */
30     double Fs,      /* Start of stop-band */
31     double Fn,      /* Nyquist freq; e.g. 0.5, 1, PI; < 0: dummy run */
32     double att,     /* Stop-band attenuation in dB */
33     int * num_taps, /* 0: value will be estimated */
34     int k,          /* >0: number of phases; <0: num_taps = 1 (mod -k) */
35     double beta);   /* <0: value will be estimated */
36 
37 void lsx_fir_to_phase(double * * h, int * len,
38     int * post_len, double phase0);
39 
40 double lsx_f_resp(double t, double a);
41 double lsx_inv_f_resp(double drop, double a);
42 #define lsx_to_3dB(a) (1 - lsx_inv_f_resp(-3., a))
43 
44 #endif
45