shithub: libsamplerate

Download patch

ref: 72257eecb05a0f63f5fbb978ab39ee5cc7fd973f
parent: d981d317f7b04c3b0ec0214e7fb4072fbbb6af41
author: Erik de Castro Lopo <erikd@miles>
date: Mon Nov 8 05:36:43 EST 2004

Move FIR/IIR/Polynomial stuff to its own branch.

--- a/FIR-POLY/Makefile
+++ /dev/null
@@ -1,40 +1,0 @@
-TARGETS = fir_interp
-
-CXX = g++
-CXXFLAGS = -g -O3 -Wall -W -Werror -Wstrict-prototypes -Wmissing-prototypes
-
-GMATH_INC = $(shell pkg-config --cflags GMath)
-GMATH_LIB = $(shell pkg-config --libs GMath)
-
-FFTW_INC = $(shell pkg-config --cflags fftw3)
-FFTW_LIB = $(shell pkg-config --libs fftw3)
-
-
-
-all: $(TARGETS)
-
-clean:
-	rm -f $(TARGETS) *.o
-
-check: $(TARGETS)
-	./fir_interp
-
-fir_interp: fir_interp.o mag_spectrum.o demin.o
-	$(CXX) $(CXXFLAGS) $+ $(GMATH_LIB) $(FFTW_LIB) -o $@
-
-#---------------------------------------------------------------------
-
-fir_interp.o : fir_interp.cc mag_spectrum.hh
-	$(CXX) $(CXXFLAGS) $(GMATH_INC) -c fir_interp.cc -o $@
-
-mag_spectrum.o : mag_spectrum.cc mag_spectrum.hh
-	$(CXX) $(CXXFLAGS) $(FFTW_INC) -c mag_spectrum.cc -o $@
-
-demin.o : demin.cc
-	$(CXX) $(CXXFLAGS) $(GMATH_INC) -c $+ -o $@
-
-# Do not edit or modify anything in this comment block.
-# The arch-tag line is a file identity tag for the GNU Arch
-# revision control system.
-#
-# arch-tag: 34b6b183-dca1-4085-9089-c8b7d5b09099
--- a/FIR-POLY/demin.cc
+++ /dev/null
@@ -1,270 +1,0 @@
-/*
-** Copyright (C) 1998-2004 Erik de Castro Lopo <erikd@mega-nerd.com>
-**
-** The copyright above and this notice must be preserved in all
-** copies of this source code. The copyright above does not
-** evidence any actual or intended publication of this source code.
-**
-** This is unpublished proprietary trade secret of Erik de Castro
-** Lopo.  This source code may not be copied, disclosed,
-** distributed, demonstrated or licensed except as authorized by
-** Erik de Castro Lopo.
-**
-** No part of this program or publication may be reproduced,
-** transmitted, transcribed, stored in a retrieval system,
-** or translated into any language or computer language in any
-** form or by any means, electronic, mechanical, magnetic,
-** optical, chemical, manual, or otherwise, without the prior
-** written permission of Erik de Castro Lopo.
-*/
-
-#include	<stdio.h>
-#include	<unistd.h>
-
-#include	<Minimize.hh>
-#include	<PsuedoRand.hh>
-
-class	DEmin
-{	private :
-		u_int		PopSize, FuncCalcs, Generations ;
-
-		PsuedoRand	Rand ;
-
-		GMatrix		*MainVector, *Vector2 ;
-		double		*MainCost, *Cost2 ;
-		double		*ScaleFactor, *ScaleFactor2 ;
-		double		*Crossover, *Crossover2 ;
-
-		MinFunc		Function ;
-
-	public :
-				DEmin	(void) ;
-				~DEmin	(void) ;
-
-		void	Setup	(MinFunc func, const GMatrix& start, u_int popsize, double range, u_long seed) ;
-
-		GMatrix	Minimize (double tol, u_int maxgen) ;
-
-		void	PrintStats	(void) ;
-
-} ; // class DEmin
-
-//======================================================================================
-
-inline
-void	Swap	(GMatrix **a, GMatrix **b)
-{	GMatrix *temp ;
-	temp = *a ; *a = *b ; *b = temp ;
-} ; //
-
-inline void
-Swap	(double **a, double **b)
-{	double *temp ;
-	temp = *a ; *a = *b ; *b = temp ;
-} ; // Swap
-
-inline double
-Max	(double a, double b)
-{	return (a > b) ? a : b ;
-} ; // Max
-
-inline double
-Min	(double a, double b)
-{	return (a < b) ? a : b ;
-} ; // Max
-
-//======================================================================================
-
-double
-MinDiffEvol (MinFunc Function, GMatrix& start, double Ftol, double range, u_long seedval)
-{	DEmin		*pfmin ;
-	u_int		dimensions ;
-
-	dimensions = start.GetElements () ;
-	if (dimensions < 20)
-		dimensions = 20 ;
-
-	pfmin = new DEmin ;
-
-	pfmin -> Setup (Function, start, dimensions * 5, range, seedval) ;
-
-	Ftol = (Ftol < 1e-8) ? 1e-8 : Ftol ;
-
-	start = pfmin -> Minimize (Ftol, dimensions * 5000) ;
-
-	delete	pfmin ;
-
-	return Function (start) ;
-} ; // MinDiffEvol
-
-
-//======================================================================================
-
-DEmin::DEmin	(void)
-{	PopSize		= 0 ;
-	FuncCalcs	= 0 ;
-	Generations	= 0 ;
-	MainVector	= NULL ;
-	MainCost	= NULL ;
-	ScaleFactor	= NULL ;
-	Crossover	= NULL ;
-	Vector2		= NULL ;
-	Cost2		= NULL ;
-	ScaleFactor2 = NULL ;
-	Crossover2	= NULL ;
-} ; // DEmin constructor
-
-DEmin::~DEmin	(void)
-{	if (PopSize)
-	{	delete [] MainVector ;
-		delete MainCost ;
-		delete ScaleFactor ;
-		delete Crossover ;
-		delete [] Vector2 ;
-		delete Cost2 ;
-		delete ScaleFactor2 ;
-		delete Crossover2 ;
-		} ;
-	PopSize = 0 ;
-} ; // DEmin destructor
-
-void
-DEmin::Setup (MinFunc func, const GMatrix& start, u_int popsize, double range, u_long seed)
-{	u_int		k ;
-	u_short		rows, cols ;
-
-	Generations = 0 ;
-	Function = func ;
-
-	PopSize = (popsize < 2) ? popsize + 2 : popsize ;
-
-	MainVector	= new GMatrix [PopSize] ;
-	MainCost	= new double [PopSize] ;
-	ScaleFactor	= new double [PopSize] ;
-	Crossover	= new double [PopSize] ;
-	Vector2		= new GMatrix [PopSize] ;
-	Cost2		= new double [PopSize] ;
-	ScaleFactor2 = new double [PopSize] ;
-	Crossover2	= new double [PopSize] ;
-
-	Rand.Seed (seed + 1234567) ;
-
-	rows = start.GetRows () ;
-	cols = start.GetCols () ;
-
-	GMatrix::PsuedoRandSeed (123123) ;
-
-	if (IsComplex (start))
-		for (k = 0 ; k < PopSize ; k++)
-		{	MainVector [k].SetSizeComplex (rows, cols) ;
-			MainVector [k].PsuedoRandomize () ;
-			MainVector [k] = (2.0 * range) * (MainVector [k] - Complex (0.5, 0.5)) ;
-			}
-	else
-		for (k = 0 ; k < PopSize ; k++)
-		{	MainVector [k].SetSizeDouble (rows, cols) ;
-			MainVector [k].PsuedoRandomize () ;
-			MainVector [k] = (2.0 * range) * (MainVector [k] - 0.5) ;
-			} ;
-
-	MainVector [0] = start ;	// Must include given vector.
-
-	for (k = 0 ; k < PopSize ; k++)
-	{	MainCost [k] = Function (MainVector [k]) ;
-		FuncCalcs ++ ;
-		ScaleFactor [k] = 1.2 * Rand.UDDouble () ;
-		Crossover [k] = Rand.UDDouble () ;
-		} ;
-
-	return ;
-} ; // DEmin::Setup
-
-GMatrix
-DEmin::Minimize (double Ftol, u_int maxgen)
-{	u_int		k, a, b, c ;
-	GMatrix		temp ;
-	double		scalefactor, crossover, cost, improvement, best ;
-
-	improvement = 100 * Ftol ;
-	best = 10e10 ;
-
-	while (Generations < maxgen && best > Ftol)
-	{	Swap (&MainVector, &Vector2) ;
-		Swap (&MainCost, &Cost2) ;
-		Swap (&ScaleFactor, &ScaleFactor2) ;
-		Swap (&Crossover, &Crossover2) ;
-
-		improvement = 0.0 ;
-
-		for (k = 0 ; k < PopSize ; k++)
-		{	do
-				a = u_int (double (PopSize) * Rand.UDDouble ()) ;
-			while 	(a == k || a >= PopSize) ;
-			do
-				b = u_int (double (PopSize) * Rand.UDDouble ()) ;
-			while	(b == k || b == a || b >= PopSize) ;
-			do
-				c = u_int (double (PopSize) * Rand.UDDouble ()) ;
-			while	(c == k || c == a || c == b || c >= PopSize) ;
-
-if (a >= PopSize)	{	printf ("a - very bad (%u, %u).\n", a, PopSize) ;	exit (0) ; } ;
-if (b >= PopSize)	{	printf ("b - very bad (%u, %u).\n", b, PopSize) ;	exit (0) ; } ;
-if (c >= PopSize)	{	printf ("c - very bad (%u, %u).\n", c, PopSize) ;	exit (0) ; } ;
-
-			scalefactor = 0.5 * (ScaleFactor2 [b] + ScaleFactor2 [c]) ;
-
-			temp = Vector2 [a] + scalefactor * (Vector2 [b] - Vector2 [c]) ;
-
-			crossover = 0.5 * (Crossover2 [k] + Crossover2 [a]) ;
-
-			temp.CrossOver (Vector2 [k], crossover) ;
-
-			cost = Function (temp) ;
-			FuncCalcs ++ ;
-
-			if (cost < Cost2 [k])
-			{	MainVector	[k] = temp ;
-				MainCost	[k] = cost ;
-				ScaleFactor [k] = scalefactor ;
-				Crossover	[k] = crossover ;
-				improvement = 0.5 * (improvement + Max (improvement, Cost2 [k] - cost)) ;
-				best = Min (best, cost) ;
-				}
-			else
-			{	MainVector	[k] = Vector2 [k] ;
-				MainCost	[k] = Cost2 [k] ;
-				ScaleFactor	[k] = ScaleFactor2 [k] ;
-				Crossover	[k] = Crossover2 [k] ;
-				} ;	// if
-			} ; // for k
-
-		Generations ++ ;
-		} ; // while
-
-	// Now find best vector.
-
-	for (a = 0, k = 1 ; k < PopSize ; k++)
-		if (MainCost [k] < MainCost [a])
-			a = k ;
-	temp = MainVector [a] ;
-
-	return temp ;
-} ; // DEmin::Minimize
-
-void
-DEmin::PrintStats (void)
-{	printf ("Generations          : %8d\n", Generations) ;
-	printf ("Function evaluations : %8d\n", FuncCalcs) ;
-	putchar ('\n') ;
-} ; // DEmin::PrintStats
-
-//======================================================================================
-
-
-
-// Do not edit or modify anything in this comment block.
-// The arch-tag line is a file identity tag for the GNU Arch
-// revision control system.
-//
-// arch-tag: e874ad11-7294-4757-9370-fd1e6e1261d0
-
--- a/FIR-POLY/fir_interp.cc
+++ /dev/null
@@ -1,457 +1,0 @@
-/*
-** Copyright (C) 2004 Erik de Castro Lopo <erikd@mega-nerd.com>
-**
-** The copyright above and this notice must be preserved in all
-** copies of this source code. The copyright above does not
-** evidence any actual or intended publication of this source code.
-**
-** This is unpublished proprietary trade secret of Erik de Castro
-** Lopo.  This source code may not be copied, disclosed,
-** distributed, demonstrated or licensed except as authorized by
-** Erik de Castro Lopo.
-**
-** No part of this program or publication may be reproduced,
-** transmitted, transcribed, stored in a retrieval system,
-** or translated into any language or computer language in any
-** form or by any means, electronic, mechanical, magnetic,
-** optical, chemical, manual, or otherwise, without the prior
-** written permission of Erik de Castro Lopo.
-*/
-
-
-#include <cstdio>
-#include <cstdlib>
-#include <unistd.h>
-#include <ctime>
-#include <cstring>
-#include <complex>
-
-#include <GMatrix.hh>
-#include <Minimize.hh>
-
-#include "mag_spectrum.hh"
-
-#define	UPSAMPLE_RATIO	2
-#define	ARRAY_LEN(x)	(sizeof (x) / sizeof ((x) [0]))
-
-#define	INTERP_LEN	1600
-/*
-** Number of half cycles of impulse response to the left and right
-** of the center.
-**		left_half_offset <= right_len
-*/
-
-static int left_len = 150 ;
-static int right_len = 750 ;
-
-
-typedef struct
-{
-	/* Window coefficients (all in range [0, 1]). */
-	double y_left [10], y_right [10] ;
-
-	double sinc_time_fudge ;
-
-} FIR_PARAMS ;
-
-typedef struct
-{
-	union
-	{	FIR_PARAMS fir_params ;
-		double data [30] ;
-	} ;
-
-	unsigned middle, total_len ;
-
-	double left_window_poly [20] ;
-	double right_window_poly [20] ;
-
-	double sinc [INTERP_LEN] ;
-	double window [INTERP_LEN] ;
-	double filter [INTERP_LEN] ;
-	double mag [INTERP_LEN / 2] ;
-	double logmag [INTERP_LEN / 2] ;
-	double phase [INTERP_LEN / 2] ;
-} FIR_INTERP ;
-
-static double fir_error (const GMatrix& gm) ;
-static int calc_window (FIR_INTERP *interp, double * error) ;
-static void calc_sinc (FIR_INTERP *interp) ;
-static void calc_filter (FIR_INTERP *interp) ;
-
-static void oct_save (const FIR_INTERP *interp) ;
-static void randomize_data (FIR_INTERP *interp) ;
-
-static double evaluate_filter (FIR_INTERP *interp) ;
-
-int
-main (void)
-{	FIR_INTERP interp ;
-	GMatrix gm_start ;
-	double error ;
-	int param_count ;
-
-	puts ("Running ........") ;
-	param_count = sizeof (FIR_PARAMS) / sizeof (double) ;
-
-	randomize_data (&interp) ;
-
-	gm_start = GMatrix (param_count, 1, interp.data) ;
-
-	fir_error (gm_start) ;
-
-	do
-		error = MinDiffEvol (fir_error, gm_start, 1e-15, 2.0, random ()) ;
-	while (error > 10.0) ;
-
-	printf ("error : %f\n", error) ;
-
-	return 0 ;
-} /* main */
-
-/*==============================================================================
-*/
-
-static inline double
-poly_evaluate (int order, const double *coeff, double x)
-{	double result ;
-	int	k ;
-
-	/*
-	** Use Horner's Rule for evaluating the value of
-	** the polynomial at x.
-	*/
-	result = coeff [order] ;
-	for (k = order - 1 ; k >= 0 ; k--)
-		result = result * x + coeff [k] ;
-
-	return result ;
-} /* poly_evaluate */
-
-static double
-evaluate_filter (FIR_INTERP *interp)
-{	double error = 0.0, temp, stop_max = 0.0, stop_sum = 0.0 ;
-	unsigned k ;
-
-	mag_spectrum (interp->filter, ARRAY_LEN (interp->filter), interp->mag, interp->logmag, interp->phase) ;
-	
-	for (k = ARRAY_LEN (interp->logmag) / UPSAMPLE_RATIO ; k < ARRAY_LEN (interp->logmag) ; k++)
-	{	temp = interp->logmag [k] + 150.0 ;
-		if (temp > stop_max)
-			stop_max = temp ;
-		if (temp > 0.0)
-			stop_sum += temp ;
-		} ;
-
-	error = stop_max * stop_sum ;
-	return error ;
-} /* evaluate_filter */
-
-static double
-fir_error (const GMatrix& gm)
-{	static FIR_INTERP interp ;
-	static int test_count = 0 ;
-	static double best_error = 1e200 ;
-	double error = 0.0 ;
-	unsigned param_count ;
-
-	memset (&interp, 0, sizeof (interp)) ;
-
-	param_count = sizeof (FIR_PARAMS) / sizeof (double) ;
-
-	if (ARRAY_LEN (interp.data) < param_count)
-	{	printf ("\n\nError : ARRAY_LEN (interp.data) < param_count.\n\n") ;
-		exit (1) ;
-		} ;
-
-	if (gm.GetData	(param_count, interp.data) != param_count)
-	{	printf ("\n\nError : GetData should return %d.\n\n", param_count) ;
-		exit (1) ;
-		} ;
-
-	/* Eval error in sinc_time_fudge. */
-	if (fabs (interp.fir_params.sinc_time_fudge - 1.0) > 0.5)
-		return 1e30 * (fabs (interp.fir_params.sinc_time_fudge - 1.0)) ;
-
-
-	interp.middle = left_len ;
-	interp.total_len = left_len + right_len ;
-
-	if (interp.total_len > ARRAY_LEN (interp.sinc))
-	{	printf ("\n\nError : interp.total_len > ARRAY_LEN (interp.sinc).\n") ;
-		exit (1) ;
-		} ;
-
-	if (calc_window (&interp, &error))
-		return error ;
-
-	calc_sinc (&interp) ;
-	calc_filter (&interp) ;
-
-	error = evaluate_filter (&interp) ;
-
-	test_count ++ ;
-// 	printf ("%s %d : exit\n", __func__, __LINE__) ;
-// 	exit (1) ;
-
-	if (error < best_error)
-	{	oct_save (&interp) ;
-		best_error = error ;
-		printf ("%12d    best : %f\n", test_count, best_error) ;
-		} ;
-
-	return error ;
-} /* fir_error */
-
-static int
-calc_window (FIR_INTERP *interp, double * returned_error)
-{	unsigned k ;
-	double error, temp, x ;
-
-	/* Make sure left poly params are in range [0, 1]. */
-	error = 0.0 ;
-	for (k = 0 ; k < ARRAY_LEN (interp->fir_params.y_left) ; k++)
-	{	temp = fabs (interp->fir_params.y_left [k] - 0.5) ;
-		if (temp > 0.5 && temp > error)
-			error = temp ;
-		} ;
-
-	if (error > 0.0)
-	{	*returned_error = 1e20 * error ;
-		return 1 ;
-		} ;
-
-	/* Make sure right poly params are in range [0, 1]. */
-	error = 0.0 ;
-	for (k = 0 ; k < ARRAY_LEN (interp->fir_params.y_right) ; k++)
-	{	temp = fabs (interp->fir_params.y_right [k] - 0.5) ;
-		if (temp > 0.5 && temp > error)
-			error = temp ;
-		} ;
-
-	if (error > 0.0)
-	{	*returned_error = 1e18 * error ;
-		return 1 ;
-		} ;
-
-	/* Generate polynomial for left side of window. */
-	interp->left_window_poly [0] = interp->fir_params.y_left [0] ;
-	interp->left_window_poly [1] = 12.4166666667 - 12.4166666667 * interp->fir_params.y_left [0] + 31.25 * interp->fir_params.y_left [1] - 41.6666666667 * interp->fir_params.y_left [2] + 41.6666666667 * interp->fir_params.y_left [3] - 31.25 * interp->fir_params.y_left [4] ;
-	interp->left_window_poly [2] = -140.756944444 + 58.2916666667 * interp->fir_params.y_left [0] - 231.770833333 * interp->fir_params.y_left [1] + 413.194444444 * interp->fir_params.y_left [2] - 447.916666667 * interp->fir_params.y_left [3] + 348.958333333 * interp->fir_params.y_left [4] ;
-	interp->left_window_poly [3] = 571.614583333 - 135.416666667 * interp->fir_params.y_left [0] + 662.760416667 * interp->fir_params.y_left [1] - 1395.83333333 * interp->fir_params.y_left [2] + 1682.29166667 * interp->fir_params.y_left [3] - 1385.41666667 * interp->fir_params.y_left [4] ;
-	interp->left_window_poly [4] = -1062.93402778 + 166.666666667 * interp->fir_params.y_left [0] - 917.96875 * interp->fir_params.y_left [1] + 2152.77777778 * interp->fir_params.y_left [2] - 2838.54166667 * interp->fir_params.y_left [3] + 2500. * interp->fir_params.y_left [4] ;
-	interp->left_window_poly [5] = 917.96875 - 104.166666667 * interp->fir_params.y_left [0] + 618.489583333 * interp->fir_params.y_left [1] - 1562.5 * interp->fir_params.y_left [2] + 2213.54166667 * interp->fir_params.y_left [3] - 2083.33333333 * interp->fir_params.y_left [4] ;
-	interp->left_window_poly [6] = -297.309027778 + 26.0416666667 * interp->fir_params.y_left [0] - 162.760416667 * interp->fir_params.y_left [1] + 434.027777778 * interp->fir_params.y_left [2] - 651.041666667 * interp->fir_params.y_left [3] + 651.041666667 * interp->fir_params.y_left [4] ;
-
-	/* Generate left side of window. */
-	error = 0.0 ;
-	for (k = 0 ; k < interp->middle ; k++)
-	{	x = k / (interp->middle * 1.0) ;
-		interp->window [k] = poly_evaluate (ARRAY_LEN (interp->left_window_poly) - 1, interp->left_window_poly, x) ;
-		} ;
-
-	/* Ensure start value in range [0, 0,2]. */
-	if (fabs (interp->window [0] - 0.1) > 0.1)
-	{	*returned_error = 1e16 * fabs (interp->window [0] - 0.1) ;
-		return 1 ;
-		} ;
-
-	/* Generate polynomial for right side of window. */
-	interp->right_window_poly [0] = 1 ;
-	interp->right_window_poly [1] = 0 ;
-	interp->right_window_poly [2] = -83.4652777778 + 125. * interp->fir_params.y_right [0] - 62.5 * interp->fir_params.y_right [1] + 27.7777777778 * interp->fir_params.y_right [2] - 7.8125 * interp->fir_params.y_right [3] + interp->fir_params.y_right [4] ;
-	interp->right_window_poly [3] = 446.614583333 - 802.083333333 * interp->fir_params.y_right [0] + 557.291666667 * interp->fir_params.y_right [1] - 270.833333333 * interp->fir_params.y_right [2] + 79.4270833333 * interp->fir_params.y_right [3] - 10.4166666667 * interp->fir_params.y_right [4] ;
-	interp->right_window_poly [4] = -932.725694444 + 1848.95833333 * interp->fir_params.y_right [0] - 1536.45833333 * interp->fir_params.y_right [1] + 850.694444444 * interp->fir_params.y_right [2] - 266.927083333 * interp->fir_params.y_right [3] + 36.4583333333 * interp->fir_params.y_right [4] ;
-	interp->right_window_poly [5] = 865.885416667 - 1822.91666667 * interp->fir_params.y_right [0] + 1692.70833333 * interp->fir_params.y_right [1] - 1041.66666667 * interp->fir_params.y_right [2] + 358.072916667 * interp->fir_params.y_right [3] - 52.0833333333 * interp->fir_params.y_right [4] ;
-	interp->right_window_poly [6] = -297.309027778 + 651.041666667 * interp->fir_params.y_right [0] - 651.041666667 * interp->fir_params.y_right [1] + 434.027777778 * interp->fir_params.y_right [2] - 162.760416667 * interp->fir_params.y_right [3] + 26.0416666667 * interp->fir_params.y_right [4] ;
-
-	/* Generate right side of window. */
-	error = 0.0 ;
-	for (k = interp->middle ; k < interp->total_len ; k++)
-	{	x = (k - interp->middle) / (1.0 * (interp->total_len - interp->middle)) ;
-		interp->window [k] = poly_evaluate (ARRAY_LEN (interp->right_window_poly) - 1, interp->right_window_poly, x) ;
-		} ;
-
-	/* Ensure end value in range [0, 0,4]. */
-	k = interp->total_len - 1 ;
-	if (fabs (interp->window [k] - 0.1) > 0.1)
-	{	*returned_error = 1e16 * fabs (interp->window [k] - 0.1) ;
-		return 1 ;
-		} ;
-
-	/* Ensure whole window is in [0, 1] range. */
-	error = 0.0 ;
-	for (k = 0 ; k < interp->total_len ; k++)
-	{	temp = fabs (interp->window [k] - 0.5) ;
-		if (temp > 0.5 && temp > error)
-			error = temp ;
-		} ;
-
-	if (error > 0.0)
-	{	*returned_error = 1e16 * error ;
-		return 1 ;
-		} ;
-
-	/* Monotonicity of left side of window. */
-	error = 0.0 ;
-	for (k = 1 ; k < interp->middle ; k++)
-	{	temp = (interp->window [k - 1] - interp->window [k]) ;
-		if (temp > 0.0)
-			error += temp ;
-		} ;
-
-	if (error > 0.0)
-	{	*returned_error = 1e14 * error ;
-		return 1 ;
-		} ;
-
-	/* Monotonicity of right side of window. */
-	error = 0.0 ;
-	for (k = interp->middle + 1 ; k < interp->total_len ; k++)
-	{	temp = (interp->window [k] - interp->window [k - 1]) ;
-		if (temp > 0.0)
-			error += temp ;
-		} ;
-
-	if (error > 0.0)
-	{	*returned_error = 1e14 * error ;
-		return 1 ;
-		} ;
-
-	return 0 ;
-} /* calc_window */
-
-static void
-calc_sinc (FIR_INTERP *interp)
-{	unsigned k ;
-	double x ;
-
-	for (k = 0 ; k < interp->middle ; k++)
-	{	x = M_PI * (interp->middle - k) * interp->fir_params.sinc_time_fudge / UPSAMPLE_RATIO ;
-		interp->sinc [k] = sin (x) / x ;
-		} ;
-	interp->sinc [interp->middle] = 1.0 ;
-
-	for (k = interp->middle + 1 ; k < interp->total_len ; k++)
-	{	x = M_PI * (k - interp->middle) * interp->fir_params.sinc_time_fudge / UPSAMPLE_RATIO ;
-		interp->sinc [k] = sin (x) / x ;
-		} ;
-
-} /* calc_sinc */
-
-static void
-calc_filter (FIR_INTERP *interp)
-{	unsigned k ;
-	double sum = 0.0 ;
-
-	for (k = 0 ; k < interp->total_len ; k++)
-	{	interp->filter [k] = interp->sinc [k] * interp->window [k] ;
-		sum += interp->filter [k] ;
-		} ;
-
-	/* Now normalize. */
-	for (k = 0 ; k < interp->total_len ; k++)
-		interp->filter [k] /= sum ;
-
-} /* calc_filter */
-
-static void
-oct_save (const FIR_INTERP *interp)
-{	const char * filename = "a.mat" ;
-	FILE * file ;
-	unsigned k ;
-
-	unlink (filename) ;
-
-	if ((file = fopen (filename, "w")) == NULL)
-	{	printf ("\nError : fopen failed.\n") ;
-		exit (1) ;
-		} ;
-
-	fprintf (file, "# Not created by Octave\n") ;
-
-	fprintf (file, "# name: sinc_time_fudge\n") ;
-	fprintf (file, "# type: scalar\n%16.14f\n", interp->fir_params.sinc_time_fudge) ;
-
-	fprintf (file, "# name: middle\n") ;
-	fprintf (file, "# type: scalar\n%d\n", interp->middle) ;
-
-	fprintf (file, "# name: total_len\n") ;
-	fprintf (file, "# type: scalar\n%d\n", interp->total_len) ;
-
-	fprintf (file, "# name: sinc\n") ;
-	fprintf (file, "# type: matrix\n") ;
-	fprintf (file, "# rows: %d\n", interp->total_len) ;
-	fprintf (file, "# columns: 1\n") ;
-
-	for (k = 0 ; k < interp->total_len ; k++)
-		fprintf (file, "% f\n", interp->sinc [k]) ;
-
-	fprintf (file, "# name: win\n") ;
-	fprintf (file, "# type: matrix\n") ;
-	fprintf (file, "# rows: %d\n", interp->total_len) ;
-	fprintf (file, "# columns: 1\n") ;
-
-	for (k = 0 ; k < interp->total_len ; k++)
-		fprintf (file, "% f\n", interp->window [k]) ;
-
-	fprintf (file, "# name: filt\n") ;
-	fprintf (file, "# type: matrix\n") ;
-	fprintf (file, "# rows: %d\n", interp->total_len) ;
-	fprintf (file, "# columns: 1\n") ;
-
-	for (k = 0 ; k < interp->total_len ; k++)
-		fprintf (file, "% f\n", interp->filter [k] * UPSAMPLE_RATIO) ;
-
-	fprintf (file, "# name: mag\n") ;
-	fprintf (file, "# type: matrix\n") ;
-	fprintf (file, "# rows: %d\n", ARRAY_LEN (interp->mag)) ;
-	fprintf (file, "# columns: 1\n") ;
-
-	for (k = 0 ; k < ARRAY_LEN (interp->mag) ; k++)
-		fprintf (file, "% f\n", interp->mag [k]) ;
-
-	fprintf (file, "# name: logmag\n") ;
-	fprintf (file, "# type: matrix\n") ;
-	fprintf (file, "# rows: %d\n", ARRAY_LEN (interp->logmag)) ;
-	fprintf (file, "# columns: 1\n") ;
-
-	for (k = 0 ; k < ARRAY_LEN (interp->logmag) ; k++)
-		fprintf (file, "% f\n", interp->logmag [k]) ;
-
-	fprintf (file, "# name: phase\n") ;
-	fprintf (file, "# type: matrix\n") ;
-	fprintf (file, "# rows: %d\n", ARRAY_LEN (interp->phase)) ;
-	fprintf (file, "# columns: 1\n") ;
-
-	for (k = 0 ; k < ARRAY_LEN (interp->phase) ; k++)
-		fprintf (file, "% f\n", interp->phase [k]) ;
-
-	fclose (file) ;
-} /* oct_save */
-
-static void
-randomize_data (FIR_INTERP *interp)
-{	FILE * file ;
-	unsigned k, param_count, seed ;
-
-	file = fopen ("/dev/urandom", "r") ;
-	fread (&seed, 1, sizeof (seed), file) ;
-	fclose (file) ;
-
-	srandom (seed) ;
-
-	param_count = sizeof (FIR_PARAMS) / sizeof (double) ;
-
-	for (k = 0 ; k < param_count ; k++)
-		interp->data [k] = 3.0 * ((1.0 * random ()) / INT_MAX - 0.5) ;
-
-} /* randomize_data */
-
-/*
-** Do not edit or modify anything in this comment block.
-** The following line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: 3ce7ca6f-394e-432c-aeaa-f228afc05afd
-*/
--- a/FIR-POLY/mag_spectrum.cc
+++ /dev/null
@@ -1,84 +1,0 @@
-/*
-** Copyright (C) 2004 Erik de Castro Lopo <erikd@mega-nerd.com>
-**
-** The copyright above and this notice must be preserved in all
-** copies of this source code. The copyright above does not
-** evidence any actual or intended publication of this source code.
-**
-** This is unpublished proprietary trade secret of Erik de Castro
-** Lopo.  This source code may not be copied, disclosed,
-** distributed, demonstrated or licensed except as authorized by
-** Erik de Castro Lopo.
-**
-** No part of this program or publication may be reproduced,
-** transmitted, transcribed, stored in a retrieval system,
-** or translated into any language or computer language in any
-** form or by any means, electronic, mechanical, magnetic,
-** optical, chemical, manual, or otherwise, without the prior
-** written permission of Erik de Castro Lopo.
-*/
-
-#include <cstdio>
-#include <cstdlib>
-#include <cstring>
-#include <cmath>
-
-#include <fftw3.h>
-
-void
-mag_spectrum (double *input, int len, double *magnitude, double *logmag, double *phase)
-{	static fftw_plan plan = NULL ;
-	static int saved_len = -1 ;
-	static double *fft_data = NULL ;
-
-	double	maxval ;
-	int		k, pi_factor ;
-
-	if (input == NULL || magnitude == NULL || phase == NULL)
-	{	printf ("%s %d : input == NULL || magnitude == NULL || phase == NULL\n", __func__, __LINE__) ;
-		exit (1) ;
-		} ;
-
-	if (saved_len > 0 && saved_len != len)
-	{	printf ("%s %d : saved_len != len.\n", __func__, __LINE__) ;
-		exit (1) ;
-		} ;
-
-	if (fft_data == NULL)
-		fft_data = (double *) calloc (sizeof (double), len) ;
-
-	if (plan == NULL)
-	{	plan = fftw_plan_r2r_1d (len, input, fft_data, FFTW_R2HC, FFTW_ESTIMATE | FFTW_PRESERVE_INPUT) ;
-		if (plan == NULL)
-		{	printf ("%s %d : create plan failed.\n", __func__, __LINE__) ;
-			exit (1) ;
-			} ;
-		} ;
-
-	fftw_execute (plan) ;
-
-	/* (k < N/2 rounded up) */
-	maxval = 0.0 ;
-	for (k = 0 ; k < len / 2 ; k++)
-	{	magnitude [k] = sqrt (fft_data [k] * fft_data [k] + fft_data [len - k - 1] * fft_data [len - k - 1]) ;
-		logmag [k] = (magnitude [k] < 1e-10) ? -200.0 : 20 * log10 (magnitude [k]) ;
-		phase [k] = atan2 (fft_data [len - k - 1], fft_data [k]) ;
-		} ;
-
-	pi_factor = 0 ;
-	for (k = 1 ; k < len / 2 ; k++)
-	{	phase [k] -= pi_factor * M_PI ;
-		if (fabs (phase [k] - phase [k - 1]) > 3.0)
-		{	phase [k] -= 2 * M_PI ;
-			pi_factor += 2 ;
-			}
-		} ;
-
-	return ;
-} /* mag_spectrum */
-
-// Do not edit or modify anything in this comment block.
-// The following line is a file identity tag for the GNU Arch
-// revision control system.
-//
-// arch-tag: 58aa43ee-b8e1-4178-8861-7621399fa049
--- a/FIR-POLY/mag_spectrum.hh
+++ /dev/null
@@ -1,27 +1,0 @@
-/*
-** Copyright (C) 2004 Erik de Castro Lopo <erikd@mega-nerd.com>
-**
-** The copyright above and this notice must be preserved in all
-** copies of this source code. The copyright above does not
-** evidence any actual or intended publication of this source code.
-**
-** This is unpublished proprietary trade secret of Erik de Castro
-** Lopo.  This source code may not be copied, disclosed,
-** distributed, demonstrated or licensed except as authorized by
-** Erik de Castro Lopo.
-**
-** No part of this program or publication may be reproduced,
-** transmitted, transcribed, stored in a retrieval system,
-** or translated into any language or computer language in any
-** form or by any means, electronic, mechanical, magnetic,
-** optical, chemical, manual, or otherwise, without the prior
-** written permission of Erik de Castro Lopo.
-*/
-
-void mag_spectrum (double *input, int len, double *magnitude, double *logmag, double *phase) ;
-
-// Do not edit or modify anything in this comment block.
-// The following line is a file identity tag for the GNU Arch
-// revision control system.
-//
-// arch-tag: cc5db1c8-4c67-49f7-9c2f-6c5021a69970
--- a/FIR-POLY/timeline.m
+++ /dev/null
@@ -1,50 +1,0 @@
-function [t, mt, w] = timeline (len, stretch)
-
-
-if (stretch < 0 || stretch > 1)
-	error ("stretch out of range [0, 1].\n");
-	endif
-
-# Mofified time
-
-x_w = 0.2 ;
-x = [-0.5 -0.2 0.2 0.5];
-y = [-0.5 -0.4 -0.1 0.5];
-
-p = polyfit (x, y, 4);
-
-t = linspace (-0.5, 0.5, 100);
-y = polyval (p,t);
-plot (t, y)
-return
-
-mt = ((1 - stretch) * t + stretch  * t.^2) - 0.5 ;
-
-
-# Basically a Nuttall window
-ak = [0.42323 0.49755 0.07922] ;
-
-w = zeros (1, len) ;
-
-k = 0 ;
-for a = ak,
-	w = w + a * cos (2 * pi * k * mt) ;
-	k += 1 ;
-	endfor
-
-w = fliplr (w / len) ;
-
-# Linear t
-
-t = linspace (-(len-2)/2, (len-2)/2, len) / len ;
-
-
-end
-
-# Do not edit or modify anything in this comment block.
-# The following line is a file identity tag for the GNU Arch
-# revision control system.
-#
-# arch-tag: 830f701e-5e9c-478a-a929-609513d4b1a6
-
-
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -11,8 +11,7 @@
 
 noinst_HEADERS = common.h float_cast.h $(COEFF_HDRS)
 
-SRC_SOURCES = samplerate.c src_sinc.c $(COEFF_HDRS) src_zoh.c src_linear.c \
-		src_fir_iir_poly.c
+SRC_SOURCES = samplerate.c src_sinc.c $(COEFF_HDRS) src_zoh.c src_linear.c
 
 # MinGW requires -no-undefined if a DLL is to be built.
 libsamplerate_la_LDFLAGS = -no-undefined version-info @SHARED_VERSION_INFO@ @SHLIB_VERSION_ARG@
--- a/src/common.h
+++ b/src/common.h
@@ -116,12 +116,6 @@
 
 int zoh_set_converter (SRC_PRIVATE *psrc, int src_enum) ;
 
-/* In src_fir_iir_poly.c */
-const char* fip_get_name (int src_enum) ;
-const char* fip_get_description (int src_enum) ;
-
-int fip_set_converter (SRC_PRIVATE *psrc, int src_enum) ;
-
 #endif	/* COMMON_H_INCLUDED */
 
 /*
--- a/src/fip_best.h
+++ /dev/null
@@ -1,43 +1,0 @@
-/*
-** Copyright (C) 2004 Erik de Castro Lopo <erikd@mega-nerd.com>
-**
-** This program 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
-** (at your option) any later version.
-**
-** This program 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 this program; if not, write to the Free Software
-** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
-*/
-
-
-static const float fip_best_coeffs [250] =
-{	0.0, 1.2, 2.3
-} ;
-
-/* FIP_COEFF_SET needs to be defined before this header is included. */
-static const FIP_COEFF_SET fip_best =
-{
-	/* count */
-	ARRAY_LEN (fip_best_coeffs),
-
-	/* increment */
-	1,
-
-	/* c */
-	fip_best_coeffs
-} ;
-
-/*
-** Do not edit or modify anything in this comment block.
-** The following line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: 86739f0c-c446-45f9-8ad0-35b6903c6135
-*/
--- a/src/samplerate.c
+++ b/src/samplerate.c
@@ -313,9 +313,6 @@
 	if ((desc = linear_get_name (converter_type)) != NULL)
 		return desc ;
 
-	if ((desc = fip_get_name (converter_type)) != NULL)
-		return desc ;
-
 	return NULL ;
 } /* src_get_name */
 
@@ -332,9 +329,6 @@
 	if ((desc = linear_get_description (converter_type)) != NULL)
 		return desc ;
 
-	if ((desc = fip_get_description (converter_type)) != NULL)
-		return desc ;
-
 	return NULL ;
 } /* src_get_description */
 
@@ -486,9 +480,6 @@
 		return SRC_ERR_NO_ERROR ;
 
 	if (linear_set_converter (psrc, converter_type) == SRC_ERR_NO_ERROR)
-		return SRC_ERR_NO_ERROR ;
-
-	if (fip_set_converter (psrc, converter_type) == SRC_ERR_NO_ERROR)
 		return SRC_ERR_NO_ERROR ;
 
 	return SRC_ERR_BAD_CONVERTER ;
--- a/src/src_fir_iir_poly.c
+++ /dev/null
@@ -1,356 +1,0 @@
-/*
-** Copyright (C) 2004 Erik de Castro Lopo <erikd@mega-nerd.com>
-**
-** This program 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
-** (at your option) any later version.
-**
-** This program 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 this program; if not, write to the Free Software
-** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "config.h"
-#include "float_cast.h"
-#include "common.h"
-
-#define	FIP_MAGIC_MARKER	MAKE_MAGIC ('F', '/', 'I', '/', 'P', ' ')
-
-#define BUFFER_LEN	1024
-
-typedef struct
-{	int count ;
-	int increment ;
-	const float *c ;
-} FIP_COEFF_SET ;
-
-#include "fip_best.h"
-
-typedef struct
-{	int		fip_magic_marker ;
-
-	int		channels ;
-	long	in_count, in_used ;
-	long	out_count, out_gen ;
-
-	double	src_ratio, input_index ;
-
-	/* The raw coeff set for this converter. */
-	const	FIP_COEFF_SET *coeff_set ;
-
-	/* The current FIR coefficents for the times 2 upsampler. */
-	float 	*coeffs0, * coeffs1 ;
-	int		max_half_coeff_len, half_coeff_len ;
-
-	/* Buffer definitions. */
-	float	*input_buffer ;
-	int		in_buf_len, in_current ;
-
-	float	*fir_out ;
-	int		fir_out_len, fir_start, fir_end ;
-
-	float	*iir_out ;
-	int		iir_out_len, iir_start, iir_end ;
-
-	float	dummy [1] ;
-} FIR_IIR_POLY ;
-
-static void fip_reset (SRC_PRIVATE *psrc) ;
-static int fip_process (SRC_PRIVATE *psrc, SRC_DATA *data) ;
-
-static int fip_process_var_down (FIR_IIR_POLY * fip, SRC_DATA * data) ;
-static int fip_process_const_down (FIR_IIR_POLY * fip, SRC_DATA * data) ;
-static int fip_process_var_up (FIR_IIR_POLY * fip, SRC_DATA * data) ;
-static int fip_process_const_up (FIR_IIR_POLY * fip, SRC_DATA * data) ;
-
-
-const char*
-fip_get_name (int src_enum)
-{
-	switch (src_enum)
-	{	case SRC_FIR_IIR_POLY_BEST :
-			return "Best FIR/IIR/Polynomial Interpolator" ;
-#if 0
-		case SRC_FIR_IIR_POLY_MEDIUM :
-			return "Medium FIR/IIR/Polynomial Interpolator" ;
-
-		case SRC_FIR_IIR_POLY_FASTEST :
-			return "Fastest FIR/IIR/Polynomial Interpolator" ;
-#endif
-		} ;
-
-	return NULL ;
-} /* fip_get_descrition */
-
-const char*
-fip_get_description (int src_enum)
-{
-	switch (src_enum)
-	{	case SRC_FIR_IIR_POLY_BEST :
-			return "Three stage FIR/IIR/Polynomial Interpolator, best quality, XXdb SNR, XX% BW." ;
-#if 0
-		case SRC_FIR_IIR_POLY_MEDIUM :
-			return "Three stage FIR/IIR/Polynomial Interpolator, medium quality, XXdb SNR, XX% BW." ;
-
-		case SRC_FIR_IIR_POLY_FASTEST :
-			return "Three stage FIR/IIR/Polynomial Interpolator, fastest, XXdb SNR, XX% BW." ;
-#endif
-		} ;
-
-	return NULL ;
-} /* fip_get_descrition */
-
-int
-fip_set_converter (SRC_PRIVATE *psrc, int src_enum)
-{	FIR_IIR_POLY *fip = NULL, temp_fip ;
-	int buffer_total ;
-
-	if (psrc->private_data != NULL)
-	{	fip = (FIR_IIR_POLY *) psrc->private_data ;
-		if (fip->fip_magic_marker != FIP_MAGIC_MARKER)
-		{	free (psrc->private_data) ;
-			psrc->private_data = NULL ;
-			} ;
-		} ;
-
-	memset (&temp_fip, 0, sizeof (temp_fip)) ;
-
-	if ((OFFSETOF (FIR_IIR_POLY, dummy) & 0xF) != 0)
-	{	printf ("(OFFSETOF (FIR_IIR_POLY, dummy) & 0xF) != 0\n") ;
-		exit (1) ;
-		} ;
-
-	temp_fip.fip_magic_marker = FIP_MAGIC_MARKER ;
-	temp_fip.channels = psrc->channels ;
-
-	psrc->reset = fip_reset ;
-	psrc->process = fip_process ;
-
-	switch (src_enum)
-	{	case SRC_FIR_IIR_POLY_BEST :
-				temp_fip.coeff_set = &fip_best ;
-				break ;
-#if 0
-		case SRC_FIR_IIR_POLY_MEDIUM :
-				temp_fip.coeff_set = &fip_medium ;
-				break ;
-
-		case SRC_FIR_IIR_POLY_FASTEST :
-				temp_fip.coeff_set = &fip_fastest ;
-				break ;
-#endif
-		default :
-				return SRC_ERR_BAD_CONVERTER ;
-		} ;
-
-	temp_fip.max_half_coeff_len = SRC_MAX_RATIO * temp_fip.coeff_set->count / temp_fip.coeff_set->increment ;
-	temp_fip.in_buf_len = temp_fip.channels * 2 * temp_fip.max_half_coeff_len ;
-
-	temp_fip.fir_out_len = BUFFER_LEN ;
-	temp_fip.iir_out_len = 2 * BUFFER_LEN ;
-
-	buffer_total = 4 + temp_fip.max_half_coeff_len + psrc->channels * (temp_fip.in_buf_len + temp_fip.fir_out_len + temp_fip.iir_out_len) ;
-
-	if ((fip = calloc (1, sizeof (FIR_IIR_POLY) + sizeof (fip->dummy [0]) * buffer_total)) == NULL)
-		return SRC_ERR_MALLOC_FAILED ;
-
-	*fip = temp_fip ;
-	memset (&temp_fip, 0xEE, sizeof (temp_fip)) ;
-
-	psrc->private_data = fip ;
-
-	/* Allocate buffers. */
-	fip->coeffs0 = fip->dummy ;
-	while ((((unsigned long) fip->coeffs0) & 0xF) > 0)
-		fip->coeffs0 ++ ;
-
-	fip->coeffs1 = fip->coeffs0 + fip->max_half_coeff_len ;
-	fip->input_buffer = fip->coeffs1 + fip->max_half_coeff_len ;
-
-	fip->fir_out = fip->input_buffer + fip->channels * fip->in_buf_len ;
-	fip->iir_out = fip->fir_out + fip->channels * fip->fir_out_len ;
-
-	printf ("total : %d / %d\n", (fip->iir_out + fip->iir_out_len) - fip->dummy, buffer_total) ;
-
-	fip_reset (psrc) ;
-
-	return SRC_ERR_NO_ERROR ;
-} /* fip_set_converter */
-
-static void
-fip_reset (SRC_PRIVATE *psrc)
-{	FIR_IIR_POLY *fip ;
-
-	fip = (FIR_IIR_POLY *) psrc->private_data ;
-	if (fip == NULL)
-		return ;
-
-	memset (fip->input_buffer, 0, fip->channels * fip->in_buf_len * sizeof (fip->dummy [0])) ;
-	memset (fip->fir_out, 0, fip->channels * fip->fir_out_len * sizeof (fip->dummy [0])) ;
-	memset (fip->iir_out, 0, fip->channels * fip->iir_out_len * sizeof (fip->dummy [0])) ;
-
-	fip->in_current = 0 ;
-	fip->fir_start = 0 ;
-	fip->iir_start = fip->iir_end = 0 ;
-
-	fip->src_ratio = fip->input_index = 0.0 ;
-
-	fip->half_coeff_len = 0 ;
-
-	return ;
-} /* fip_reset */
-
-/*========================================================================================
-*/
-
-static int
-fip_process (SRC_PRIVATE *psrc, SRC_DATA *data)
-{	FIR_IIR_POLY *fip ;
-	int error ;
-
-	if (psrc->private_data == NULL)
-		return SRC_ERR_NO_PRIVATE ;
-
-	fip = (FIR_IIR_POLY*) psrc->private_data ;
-
-	/* If there is not a problem, this will be optimised out. */
-	if (sizeof (fip->dummy [0]) != sizeof (data->data_in [0]))
-		return SRC_ERR_SIZE_INCOMPATIBILITY ;
-
-	/* Just after an fip_reset(), the src_ratio field is invalid. */
-	if (fip->src_ratio < 1.0 / SRC_MAX_RATIO)
-		fip->src_ratio = data->src_ratio ;
-
-	fip->in_count = data->input_frames * fip->channels ;
-	fip->out_count = data->output_frames * fip->channels ;
-	fip->in_used = fip->out_gen = 0 ;
-
-	/* Choose a more specialised process() function. */
-	if (fip->src_ratio < 1.0 || data->src_ratio < 1.0)
-	{	if (fabs (fip->src_ratio - data->src_ratio) > 1e-20)
-			error = fip_process_var_down (fip, data) ;
-		else
-			error = fip_process_const_down (fip, data) ;
-		}
-	else if (fabs (fip->src_ratio - data->src_ratio) > 1e-20)
-		error = fip_process_var_up (fip, data) ;
-	else
-		error = fip_process_const_up (fip, data) ;
-
-	data->input_frames_used = fip->in_used / fip->channels ;
-	data->output_frames_gen = fip->out_gen / fip->channels ;
-
-	return error ;
-} /* fip_process */
-
-/*----------------------------------------------------------------------------------------
-*/
-
-static void
-fip_generate_fir_current_coeffs (FIR_IIR_POLY * fip)
-{	int k ;
-
-	if (fip->src_ratio >= 1.0)
-	{	fip->half_coeff_len = fip->coeff_set->count / fip->coeff_set->increment / 2 ;
-
-		for (k = 0 ; k < fip->half_coeff_len ; k++)
-		{	fip->coeffs0 [k] = fip->coeff_set->c [fip->coeff_set->increment * k] ;
-			fip->coeffs1 [k] = fip->coeff_set->c [fip->coeff_set->increment * k + fip->coeff_set->increment / 2] ;
-			} ;
-
-		/* Round it up to a multiple of 4. */
-		while (fip->half_coeff_len & 3)
-		{	fip->coeffs0 [fip->half_coeff_len] = 0.0 ;
-			fip->coeffs1 [fip->half_coeff_len] = 0.0 ;
-			fip->half_coeff_len ++ ;
-			} ;
-
-		return ;
-		} ;
-
-	printf ("%s : not implemented yet.\n", __func__) ;
-	exit (1) ;
-} /* fip_generate_fir_current_coeffs */
-
-static int
-fip_process_var_down (FIR_IIR_POLY * fip, SRC_DATA * data)
-{	fip = NULL ;
-	data = NULL ;
-	printf ("%s : not implemented yet.\n", __func__) ;
-	return SRC_ERR_NO_ERROR ;
-} /* fip_process_var_down */
-
-static int
-fip_process_const_down (FIR_IIR_POLY * fip, SRC_DATA * data)
-{
-	if (fip->half_coeff_len == 0)
-		fip_generate_fir_current_coeffs (fip) ;
-
-	data = NULL ;
-	printf ("%s : not implemented yet.\n", __func__) ;
-	return SRC_ERR_NO_ERROR ;
-} /* fip_process_const_down */
-
-static int
-fip_process_var_up (FIR_IIR_POLY * fip, SRC_DATA * data)
-{
-	if (fip->half_coeff_len == 0)
-		fip_generate_fir_current_coeffs (fip) ;
-
-	data = NULL ;
-	printf ("%s : not implemented yet.\n", __func__) ;
-	return SRC_ERR_NO_ERROR ;
-} /* fip_process_var_up */
-
-static int
-fip_process_const_up (FIR_IIR_POLY * fip, SRC_DATA * data)
-{	long max_in_used ;
-	int ch, indx ;
-
-	/* If we don't yet have the coeffs, generate them. */
-	if (fip->half_coeff_len == 0)
-		fip_generate_fir_current_coeffs (fip) ;
-
-	max_in_used = lrintf (fip->in_count / fip->src_ratio - 0.5) ;
-	max_in_used -= max_in_used & 1 ;
-
-	if (fip->channels != 1)
-	{	printf ("%s : fip->channels != 1\n", __func__) ;
-		exit (1) ;
-		}
-
-	/* Main processing loop. */
-	while (fip->out_gen < fip->out_count && fip->in_used < max_in_used)
-	{
-		for (ch = 0 ; ch < fip->channels ; ch ++)
-		{	indx = (fip->in_current + fip->half_coeff_len + ch) % fip->in_buf_len ;
-			fip->input_buffer [indx] = data->data_in [fip->in_used ++] ;
-			} ;
-
-
-
-
-		fip->in_current = (fip->in_current + 1) % fip->in_buf_len ;
-		} ;
-
-	return SRC_ERR_NO_ERROR ;
-} /* fip_process_const_up */
-
-
-/*
-** Do not edit or modify anything in this comment block.
-** The arch-tag line is a file identity tag for the GNU Arch
-** revision control system.
-**
-** arch-tag: a6c8bad4-740c-4e4f-99f1-e274174ab540
-*/