shithub: sox

ref: d9b41147ef5125bf5fb646546caf475bc3d02f62
dir: /src/rate_filters.h/

View raw version
/* 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.9622034521467345e-001, 3.1227031280072459e-001, 3.5198986166898451e-003,
  -8.9221427418232149e-002, -2.8372758530229671e-003, 3.9139593785072563e-002,
  1.9671926007707326e-003, -1.7250462144826118e-002, -1.1596954982514773e-003,
  6.8588796907120527e-003, 5.7031347966698574e-004, -2.3044720814877507e-003,
  -2.2679857326247756e-004, 6.0962502224911946e-004, 6.9133289864740816e-005,
  -1.1323492804087647e-004, -1.4554678571602767e-005, 1.1197369453748703e-005,
  1.6171529855434563e-006,
};
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 8
#define FIR_LENGTH d100_l
#define CONVOLVE poly_fir_convolve_d100
#include "rate_poly_fir.h"
#define d100_1_b 8
#define FUNCTION d100_2
#define COEF_INTERP 2
#define PHASE_BITS 6
#define FIR_LENGTH d100_l
#define CONVOLVE poly_fir_convolve_d100
#include "rate_poly_fir.h"
#define d100_2_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 7
#define FIR_LENGTH d120_l
#define CONVOLVE poly_fir_convolve_d120
#include "rate_poly_fir.h"
#define d120_2_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 11
#define FIR_LENGTH d150_l
#define CONVOLVE poly_fir_convolve_d150
#include "rate_poly_fir.h"
#define d150_1_b 11
#define FUNCTION d150_2
#define COEF_INTERP 2
#define PHASE_BITS 8
#define FIR_LENGTH d150_l
#define CONVOLVE poly_fir_convolve_d150
#include "rate_poly_fir.h"
#define d150_2_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 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 6
#define FIR_LENGTH U100_l
#define CONVOLVE poly_fir_convolve_U100
#include "rate_poly_fir.h"
#define U100_2_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 7
#define FIR_LENGTH u100_l
#define CONVOLVE poly_fir_convolve_u100
#include "rate_poly_fir.h"
#define u100_1_b 7
#define FUNCTION u100_2
#define COEF_INTERP 2
#define PHASE_BITS 5
#define FIR_LENGTH u100_l
#define CONVOLVE poly_fir_convolve_u100
#include "rate_poly_fir.h"
#define u100_2_b 5
#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 8
#define FIR_LENGTH u120_l
#define CONVOLVE poly_fir_convolve_u120
#include "rate_poly_fir.h"
#define u120_1_b 8
#define FUNCTION u120_2
#define COEF_INTERP 2
#define PHASE_BITS 6
#define FIR_LENGTH u120_l
#define CONVOLVE poly_fir_convolve_u120
#include "rate_poly_fir.h"
#define u120_2_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 10
#define FIR_LENGTH u150_l
#define CONVOLVE poly_fir_convolve_u150
#include "rate_poly_fir.h"
#define u150_1_b 10
#define FUNCTION u150_2
#define COEF_INTERP 2
#define PHASE_BITS 7
#define FIR_LENGTH u150_l
#define CONVOLVE poly_fir_convolve_u150
#include "rate_poly_fir.h"
#define u150_2_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[3];} 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}}},
  {d120_l,  1, 1.5, 133, {{0, d120_0}, {d120_1_b, d120_1}, {d120_2_b, d120_2}}},
  {d150_l,  1, 1.5, 165, {{0, d150_0}, {d150_1_b, d150_1}, {d150_2_b, d150_2}}},
  {U100_l, .724, 1, 105, {{0, U100_0}, {U100_1_b, U100_1}, {U100_2_b, U100_2}}},
  {u100_l, .3, 1.5, 107, {{0, u100_0}, {u100_1_b, u100_1}, {u100_2_b, u100_2}}},
  {u120_l, .5, 1.5, 125, {{0, u120_0}, {u120_1_b, u120_1}, {u120_2_b, u120_2}}},
  {u150_l, .5, 1.5, 174, {{0, u150_0}, {u150_1_b, u150_1}, {u150_2_b, u150_2}}},
};