aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2011-10-10 19:34:18 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2011-10-10 19:34:18 +0000
commitb95c9bd09245efe50741b806ca8ae7d7970b221a (patch)
tree126cc96ce9d32edaeec783b18e4576d21ff168b9 /src
parent831419a680bc3d4ca28f53eb11d14964d5f23cea (diff)
downloadqmmp-b95c9bd09245efe50741b806ca8ae7d7970b221a.tar.gz
qmmp-b95c9bd09245efe50741b806ca8ae7d7970b221a.tar.bz2
qmmp-b95c9bd09245efe50741b806ca8ae7d7970b221a.zip
equalizer update
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@2389 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src')
-rw-r--r--src/qmmp/equ/iir_fpu.c53
-rw-r--r--src/qmmp/equ/iir_fpu.h4
2 files changed, 27 insertions, 30 deletions
diff --git a/src/qmmp/equ/iir_fpu.c b/src/qmmp/equ/iir_fpu.c
index ae0051fdf..eb39681dc 100644
--- a/src/qmmp/equ/iir_fpu.c
+++ b/src/qmmp/equ/iir_fpu.c
@@ -1,7 +1,7 @@
/*
* PCM time-domain equalizer
*
- * Copyright (C) 2002-2005 Felipe Rivera <liebremx at users sourceforge net>
+ * Copyright (C) 2002-2006 Felipe Rivera <liebremx at users sourceforge net>
*
* 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
@@ -17,14 +17,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: iir_fpu.c,v 1.3 2005/11/13 20:02:58 lisanet Exp $
+ * $Id: iir_fpu.c,v 1.4 2006/01/15 00:26:32 liebremx Exp $
*/
-#include <strings.h>
#include <stdlib.h>
-//#include <glib.h>
-#include "iir.h"
+#include <string.h>
#include "iir_fpu.h"
+#include "iir.h"
static sXYData data_history[EQ_MAX_BANDS][EQ_CHANNELS] __attribute__((aligned));
static sXYData data_history2[EQ_MAX_BANDS][EQ_CHANNELS] __attribute__((aligned));
@@ -54,31 +53,29 @@ void clean_history()
__inline__ int iir(void * d, int length, int nch)
{
-/* FTZ_ON; */
+// FTZ_ON;
short *data = (short *) d;
/* Indexes for the history arrays
* These have to be kept between calls to this function
* hence they are static */
- static int i = 2, j = 1, k = 0;
+ static int i = 2, j = 1, k = 0;
int index, band, channel;
int tempgint, halflength;
sample_t out[EQ_CHANNELS], pcm[EQ_CHANNELS];
-#if 0
- /* Load the correct filter table according to the sampling rate if needed */
- if (srate != rate)
+ // Load the correct filter table according to the sampling rate if needed
+ /*if (srate != rate)
{
band_count = eqcfg.band_num;
rate = srate;
iir_cf = get_coeffs(&band_count, rate, eqcfg.use_xmms_original_freqs);
clean_history();
- }
-#endif
+ }*/
#ifdef BENCHMARK
start_counter();
-#endif /* BENCHMARK */
+#endif //BENCHMARK
/**
* IIR filter equation is
@@ -99,21 +96,21 @@ __inline__ int iir(void * d, int length, int nch)
/* For each channel */
for (channel = 0; channel < nch; channel++)
{
- pcm[channel] = data[index+channel] * 4;
+ pcm[channel] = data[index+channel];
/* Preamp gain */
- pcm[channel] *= (preamp[channel] / 2);
-
+ pcm[channel] *= preamp[channel];
+
/* add random noise */
pcm[channel] += dither[di];
- out[channel] = 0.0;
+ out[channel] = 0.;
/* For each band */
for (band = 0; band < band_count; band++)
{
/* Store Xi(n) */
data_history[band][channel].x[i] = pcm[channel];
/* Calculate and store Yi(n) */
- data_history[band][channel].y[i] =
+ data_history[band][channel].y[i] =
(
/* = alpha * [x(n)-x(n-2)] */
iir_cf[band].alpha * ( data_history[band][channel].x[i]
@@ -123,14 +120,14 @@ __inline__ int iir(void * d, int length, int nch)
/* - beta * y(n-2) */
- iir_cf[band].beta * data_history[band][channel].y[k]
);
- /*
+ /*
* The multiplication by 2.0 was 'moved' into the coefficients to save
* CPU cycles here */
/* Apply the gain */
- out[channel] += data_history[band][channel].y[i]*gain[band][channel]; /* * 2.0; */
+ out[channel] += data_history[band][channel].y[i]*gain[band][channel]; // * 2.0;
} /* For each band */
- //if (cfg.eq_extra_filtering)
+ //if (eqcfg.extra_filtering)
{
/* Filter the sample again */
for (band = 0; band < band_count; band++)
@@ -138,7 +135,7 @@ __inline__ int iir(void * d, int length, int nch)
/* Store Xi(n) */
data_history2[band][channel].x[i] = out[channel];
/* Calculate and store Yi(n) */
- data_history2[band][channel].y[i] =
+ data_history2[band][channel].y[i] =
(
/* y(n) = alpha * [x(n)-x(n-2)] */
iir_cf[band].alpha * (data_history2[band][channel].x[i]
@@ -154,13 +151,13 @@ __inline__ int iir(void * d, int length, int nch)
}
/* Volume stuff
- Scale down original PCM sample and add it to the filters
+ Scale down original PCM sample and add it to the filters
output. This substitutes the multiplication by 0.25
Go back to use the floating point multiplication before the
conversion to give more dynamic range
*/
out[channel] += pcm[channel]*0.25;
-
+
/* remove random noise */
out[channel] -= dither[di]*0.25;
@@ -180,10 +177,10 @@ __inline__ int iir(void * d, int length, int nch)
data[index+channel] = -32768;
else if (tempgint > 32767)
data[index+channel] = 32767;
- else
+ else
data[index+channel] = tempgint;
} /* For each channel */
-
+
/* Wrap around the indexes */
i = (i+1)%3;
j = (j+1)%3;
@@ -203,8 +200,8 @@ __inline__ int iir(void * d, int length, int nch)
timex = 0.;
count = 0;
}
-#endif /* BENCHMARK */
+#endif // BENCHMARK
-/* FTZ_OFF; */
+// FTZ_OFF;
return length;
}
diff --git a/src/qmmp/equ/iir_fpu.h b/src/qmmp/equ/iir_fpu.h
index 990eebf97..755f71075 100644
--- a/src/qmmp/equ/iir_fpu.h
+++ b/src/qmmp/equ/iir_fpu.h
@@ -1,7 +1,7 @@
/*
* PCM time-domain equalizer
*
- * Copyright (C) 2002-2005 Felipe Rivera <liebremx at users.sourceforge.net>
+ * Copyright (C) 2002-2006 Felipe Rivera <liebremx at users.sourceforge.net>
*
* 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
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: iir_fpu.h,v 1.2 2005/11/01 15:59:20 lisanet Exp $$
+ * $Id: iir_fpu.h,v 1.3 2006/01/15 00:26:32 liebremx Exp $$
*/
#ifndef IIR_FPU_H
#define IIR_FPU_H