ref: 00e38f8a6564fa92cc93e30b4ff8726312b1c95e
dir: /src/rate_filters.h/
/* Effect: change sample rate Copyright (c) 2008 robs@users.sourceforge.net * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or (at * your option) any later version. * * This library 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 Lesser * General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /* Generated by m4 */ static const sample_t half_fir_coefs_25[] = { 4.9866643051942178e-001, 3.1333582318860204e-001, 1.2567743716165585e-003, -9.2035726038137103e-002, -1.0507348255277846e-003, 4.2764945027796687e-002, 7.7661461450703555e-004, -2.0673365323361139e-002, -5.0429677622613805e-004, 9.4223774565849357e-003, 2.8491539998284476e-004, -3.8562347294894628e-003, -1.3803431143314762e-004, 1.3634218103234187e-003, 5.6110366313398705e-005, -3.9872042837864422e-004, -1.8501044952475473e-005, 9.0580351350892191e-005, 4.6764104835321042e-006, -1.4284332593063177e-005, -8.1340436298087893e-007, 1.1833367010222812e-006, 7.3979325233687461e-008, }; static const sample_t half_fir_coefs_low[] = { 4.2759802493108773e-001, 3.0939308096100709e-001, 6.9285325719540158e-002, -8.0642059355533674e-002, -6.0528749718348158e-002, 2.5228940037788555e-002, 4.7756850372993369e-002, 8.7463256642532057e-004, -3.3208422093026498e-002, -1.3425983316344854e-002, 1.9188320662637096e-002, 1.7478840713827052e-002, -7.5527851809344612e-003, -1.6145235261724403e-002, -6.3013968965413430e-004, 1.1965551091184719e-002, 5.1714613100614501e-003, -6.9898749683755968e-003, -6.6150222806158742e-003, 2.6394681964090937e-003, 5.9365183404658526e-003, 3.5567920638016650e-004, -4.2031898513566123e-003, -1.8738555289555877e-003, 2.2991238738122328e-003, 2.2058519188488186e-003, -7.7796582498205363e-004, -1.8212814627239918e-003, -1.4964619042558244e-004, 1.1706370821176716e-003, 5.3082071395224866e-004, -5.6771020453353900e-004, -5.4472363026668942e-004, 1.5914542178505357e-004, 3.8911127354338085e-004, 4.2076035174603683e-005, -2.1015548483049000e-004, -9.5381290156278399e-005, 8.0903081108059553e-005, 7.5812875822003258e-005, -1.5004304266040688e-005, -3.9149443482028750e-005, -6.0893901283459912e-006, 1.4040363940567877e-005, 4.9834316581482789e-006, }; #define FUNCTION half_sample_25 #define CONVOLVE _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ #define COEFS half_fir_coefs_25 assert_static(!((array_length(COEFS)- 1) & 1), HALF_FIR_LENGTH_25 ); #include "rate_half_fir.h" #define FUNCTION half_sample_low #define CONVOLVE _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ #define COEFS half_fir_coefs_low assert_static(!((array_length(COEFS)- 1) & 1), HALF_FIR_LENGTH_low); #include "rate_half_fir.h" #define d100_l 16 #define poly_fir_convolve_d100 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ #define FUNCTION d100_0 #define FIR_LENGTH d100_l #define CONVOLVE poly_fir_convolve_d100 #include "rate_poly_fir0.h" #define FUNCTION d100_1 #define COEF_INTERP 1 #define PHASE_BITS 9 #define FIR_LENGTH d100_l #define CONVOLVE poly_fir_convolve_d100 #include "rate_poly_fir.h" #define d100_1_b 9 #define FUNCTION d100_2 #define COEF_INTERP 2 #define PHASE_BITS 7 #define FIR_LENGTH d100_l #define CONVOLVE poly_fir_convolve_d100 #include "rate_poly_fir.h" #define d100_2_b 7 #define FUNCTION d100_3 #define COEF_INTERP 3 #define PHASE_BITS 6 #define FIR_LENGTH d100_l #define CONVOLVE poly_fir_convolve_d100 #include "rate_poly_fir.h" #define d100_3_b 6 #define d120_l 30 #define poly_fir_convolve_d120 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ #define FUNCTION d120_0 #define FIR_LENGTH d120_l #define CONVOLVE poly_fir_convolve_d120 #include "rate_poly_fir0.h" #define FUNCTION d120_1 #define COEF_INTERP 1 #define PHASE_BITS 10 #define FIR_LENGTH d120_l #define CONVOLVE poly_fir_convolve_d120 #include "rate_poly_fir.h" #define d120_1_b 10 #define FUNCTION d120_2 #define COEF_INTERP 2 #define PHASE_BITS 9 #define FIR_LENGTH d120_l #define CONVOLVE poly_fir_convolve_d120 #include "rate_poly_fir.h" #define d120_2_b 9 #define FUNCTION d120_3 #define COEF_INTERP 3 #define PHASE_BITS 7 #define FIR_LENGTH d120_l #define CONVOLVE poly_fir_convolve_d120 #include "rate_poly_fir.h" #define d120_3_b 7 #define d150_l 38 #define poly_fir_convolve_d150 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ #define FUNCTION d150_0 #define FIR_LENGTH d150_l #define CONVOLVE poly_fir_convolve_d150 #include "rate_poly_fir0.h" #define FUNCTION d150_1 #define COEF_INTERP 1 #define PHASE_BITS 12 #define FIR_LENGTH d150_l #define CONVOLVE poly_fir_convolve_d150 #include "rate_poly_fir.h" #define d150_1_b 12 #define FUNCTION d150_2 #define COEF_INTERP 2 #define PHASE_BITS 10 #define FIR_LENGTH d150_l #define CONVOLVE poly_fir_convolve_d150 #include "rate_poly_fir.h" #define d150_2_b 10 #define FUNCTION d150_3 #define COEF_INTERP 3 #define PHASE_BITS 8 #define FIR_LENGTH d150_l #define CONVOLVE poly_fir_convolve_d150 #include "rate_poly_fir.h" #define d150_3_b 8 #define U100_l 42 #define poly_fir_convolve_U100 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ #define FUNCTION U100_0 #define FIR_LENGTH U100_l #define CONVOLVE poly_fir_convolve_U100 #include "rate_poly_fir0.h" #define FUNCTION U100_1 #define COEF_INTERP 1 #define PHASE_BITS 10 #define FIR_LENGTH U100_l #define CONVOLVE poly_fir_convolve_U100 #include "rate_poly_fir.h" #define U100_1_b 10 #define FUNCTION U100_2 #define COEF_INTERP 2 #define PHASE_BITS 8 #define FIR_LENGTH U100_l #define CONVOLVE poly_fir_convolve_U100 #include "rate_poly_fir.h" #define U100_2_b 8 #define FUNCTION U100_3 #define COEF_INTERP 3 #define PHASE_BITS 6 #define FIR_LENGTH U100_l #define CONVOLVE poly_fir_convolve_U100 #include "rate_poly_fir.h" #define U100_3_b 6 #define u100_l 10 #define poly_fir_convolve_u100 _ _ _ _ _ _ _ _ _ _ #define FUNCTION u100_0 #define FIR_LENGTH u100_l #define CONVOLVE poly_fir_convolve_u100 #include "rate_poly_fir0.h" #define FUNCTION u100_1 #define COEF_INTERP 1 #define PHASE_BITS 9 #define FIR_LENGTH u100_l #define CONVOLVE poly_fir_convolve_u100 #include "rate_poly_fir.h" #define u100_1_b 9 #define FUNCTION u100_2 #define COEF_INTERP 2 #define PHASE_BITS 7 #define FIR_LENGTH u100_l #define CONVOLVE poly_fir_convolve_u100 #include "rate_poly_fir.h" #define u100_2_b 7 #define FUNCTION u100_3 #define COEF_INTERP 3 #define PHASE_BITS 6 #define FIR_LENGTH u100_l #define CONVOLVE poly_fir_convolve_u100 #include "rate_poly_fir.h" #define u100_3_b 6 #define u120_l 14 #define poly_fir_convolve_u120 _ _ _ _ _ _ _ _ _ _ _ _ _ _ #define FUNCTION u120_0 #define FIR_LENGTH u120_l #define CONVOLVE poly_fir_convolve_u120 #include "rate_poly_fir0.h" #define FUNCTION u120_1 #define COEF_INTERP 1 #define PHASE_BITS 10 #define FIR_LENGTH u120_l #define CONVOLVE poly_fir_convolve_u120 #include "rate_poly_fir.h" #define u120_1_b 10 #define FUNCTION u120_2 #define COEF_INTERP 2 #define PHASE_BITS 8 #define FIR_LENGTH u120_l #define CONVOLVE poly_fir_convolve_u120 #include "rate_poly_fir.h" #define u120_2_b 8 #define FUNCTION u120_3 #define COEF_INTERP 3 #define PHASE_BITS 6 #define FIR_LENGTH u120_l #define CONVOLVE poly_fir_convolve_u120 #include "rate_poly_fir.h" #define u120_3_b 6 #define u150_l 20 #define poly_fir_convolve_u150 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ #define FUNCTION u150_0 #define FIR_LENGTH u150_l #define CONVOLVE poly_fir_convolve_u150 #include "rate_poly_fir0.h" #define FUNCTION u150_1 #define COEF_INTERP 1 #define PHASE_BITS 11 #define FIR_LENGTH u150_l #define CONVOLVE poly_fir_convolve_u150 #include "rate_poly_fir.h" #define u150_1_b 11 #define FUNCTION u150_2 #define COEF_INTERP 2 #define PHASE_BITS 9 #define FIR_LENGTH u150_l #define CONVOLVE poly_fir_convolve_u150 #include "rate_poly_fir.h" #define u150_2_b 9 #define FUNCTION u150_3 #define COEF_INTERP 3 #define PHASE_BITS 7 #define FIR_LENGTH u150_l #define CONVOLVE poly_fir_convolve_u150 #include "rate_poly_fir.h" #define u150_3_b 7 typedef struct {int phase_bits; stage_fn_t fn;} poly_fir1_t; typedef struct {int num_coefs; double pass, stop, att; poly_fir1_t interp[4];} poly_fir_t; static poly_fir_t const poly_firs[] = { {d100_l, .75,1.5, 108, {{0, d100_0}, {d100_1_b, d100_1}, {d100_2_b, d100_2}, {d100_3_b, d100_3}}}, {d120_l, 1, 1.5, 133, {{0, d120_0}, {d120_1_b, d120_1}, {d120_2_b, d120_2}, {d120_3_b, d120_3}}}, {d150_l, 1, 1.5, 165, {{0, d150_0}, {d150_1_b, d150_1}, {d150_2_b, d150_2}, {d150_3_b, d150_3}}}, {U100_l, .724, 1, 105, {{0, U100_0}, {U100_1_b, U100_1}, {U100_2_b, U100_2}, {U100_3_b, U100_3}}}, {u100_l, .3, 1.5, 107, {{0, u100_0}, {u100_1_b, u100_1}, {u100_2_b, u100_2}, {u100_3_b, u100_3}}}, {u120_l, .5, 1.5, 125, {{0, u120_0}, {u120_1_b, u120_1}, {u120_2_b, u120_2}, {u120_3_b, u120_3}}}, {u150_l, .5, 1.5, 174, {{0, u150_0}, {u150_1_b, u150_1}, {u150_2_b, u150_2}, {u150_3_b, u150_3}}}, };