summaryrefslogtreecommitdiff
path: root/src/post/audio
diff options
context:
space:
mode:
Diffstat (limited to 'src/post/audio')
-rw-r--r--src/post/audio/audio_filters.c10
-rw-r--r--src/post/audio/audio_filters.h8
-rw-r--r--src/post/audio/dsp.h4
-rw-r--r--src/post/audio/filter.c66
-rw-r--r--src/post/audio/filter.h6
-rw-r--r--src/post/audio/stretch.c194
-rw-r--r--src/post/audio/upmix.c44
-rw-r--r--src/post/audio/upmix_mono.c56
-rw-r--r--src/post/audio/volnorm.c44
-rw-r--r--src/post/audio/window.c26
-rw-r--r--src/post/audio/window.h2
11 files changed, 230 insertions, 230 deletions
diff --git a/src/post/audio/audio_filters.c b/src/post/audio/audio_filters.c
index 448353b52..78f495ca6 100644
--- a/src/post/audio/audio_filters.c
+++ b/src/post/audio/audio_filters.c
@@ -1,18 +1,18 @@
/*
* Copyright (C) 2000-2004 the xine project
- *
+ *
* This file is part of xine, a free video player.
- *
+ *
* xine 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.
- *
+ *
* xine 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
@@ -38,7 +38,7 @@ static const post_info_t volnorm_special_info = { XINE_POST_TYPE_AUDIO_FILTER
const plugin_info_t xine_plugin_info[] EXPORTED = {
- /* type, API, "name", version, special_info, init_function */
+ /* type, API, "name", version, special_info, init_function */
{ PLUGIN_POST, 10, "upmix", XINE_VERSION_CODE, &upmix_special_info, &upmix_init_plugin },
{ PLUGIN_POST, 10, "upmix_mono", XINE_VERSION_CODE, &upmix_mono_special_info, &upmix_mono_init_plugin },
{ PLUGIN_POST, 10, "stretch", XINE_VERSION_CODE, &stretch_special_info, &stretch_init_plugin },
diff --git a/src/post/audio/audio_filters.h b/src/post/audio/audio_filters.h
index 8a0202751..144e85836 100644
--- a/src/post/audio/audio_filters.h
+++ b/src/post/audio/audio_filters.h
@@ -1,18 +1,18 @@
/*
* Copyright (C) 2000-2004 the xine project
- *
+ *
* This file is part of xine, a free video player.
- *
+ *
* xine 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.
- *
+ *
* xine 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
diff --git a/src/post/audio/dsp.h b/src/post/audio/dsp.h
index 237640283..8dabe4f36 100644
--- a/src/post/audio/dsp.h
+++ b/src/post/audio/dsp.h
@@ -1,5 +1,5 @@
/*=============================================================================
- *
+ *
* This software has been released under the terms of the GNU Public
* license. See http://www.gnu.org/copyleft/gpl.html for details.
*
@@ -9,7 +9,7 @@
*/
#ifndef _DSP_H
-#define _DSP_H 1
+#define _DSP_H 1
/* Implementation of routines used for DSP */
diff --git a/src/post/audio/filter.c b/src/post/audio/filter.c
index 55d75e1e4..f41d880fc 100644
--- a/src/post/audio/filter.c
+++ b/src/post/audio/filter.c
@@ -1,5 +1,5 @@
/*=============================================================================
- *
+ *
* This software has been released under the terms of the GNU Public
* license. See http://www.gnu.org/copyleft/gpl.html for details.
*
@@ -25,12 +25,12 @@
*
* n number of filter taps, where mod(n,4)==0
* w filter taps
- * x input signal must be a circular buffer which is indexed backwards
+ * x input signal must be a circular buffer which is indexed backwards
*/
inline _ftype_t fir(register unsigned int n, _ftype_t* w, _ftype_t* x)
{
register _ftype_t y; /* Output */
- y = 0.0;
+ y = 0.0;
do{
n--;
y+=w[n]*x[n];
@@ -44,7 +44,7 @@ inline _ftype_t fir(register unsigned int n, _ftype_t* w, _ftype_t* x)
* d number of filters
* xi current index in xq
* w filter taps k by n big
- * x input signal must be a circular buffers which are indexed backwards
+ * x input signal must be a circular buffers which are indexed backwards
* y output buffer
* s output buffer stride
*/
@@ -67,11 +67,11 @@ inline _ftype_t* pfir(unsigned int n, unsigned int d, unsigned int xi, _ftype_t*
at the new samples, xi current index in xq and n the length of the
filter. xq must be n*2 by k big, s is the index for in.
*/
-inline int updatepq(unsigned int n, unsigned int d, unsigned int xi, _ftype_t** xq, _ftype_t* in, unsigned int s)
+inline int updatepq(unsigned int n, unsigned int d, unsigned int xi, _ftype_t** xq, _ftype_t* in, unsigned int s)
{
register _ftype_t* txq = *xq + xi;
register int nt = n*2;
-
+
while(d-- >0){
*txq= *(txq+n) = *in;
txq+=nt;
@@ -88,26 +88,26 @@ inline int updatepq(unsigned int n, unsigned int d, unsigned int xi, _ftype_t**
n filter length must be odd for HP and BS filters
w buffer for the filter taps (must be n long)
- fc cutoff frequencies (1 for LP and HP, 2 for BP and BS)
+ fc cutoff frequencies (1 for LP and HP, 2 for BP and BS)
0 < fc < 1 where 1 <=> Fs/2
flags window and filter type as defined in filter.h
- variables are ored together: i.e. LP|HAMMING will give a
- low pass filter designed using a hamming window
+ variables are ored together: i.e. LP|HAMMING will give a
+ low pass filter designed using a hamming window
opt beta constant used only when designing using kaiser windows
-
+
returns 0 if OK, -1 if fail
*/
int design_fir(unsigned int n, _ftype_t* w, _ftype_t* fc, unsigned int flags, _ftype_t opt)
{
- unsigned int o = n & 1; /* Indicator for odd filter length */
+ unsigned int o = n & 1; /* Indicator for odd filter length */
unsigned int end = ((n + 1) >> 1) - o; /* Loop end */
unsigned int i; /* Loop index */
_ftype_t k1 = 2 * M_PI; /* 2*pi*fc1 */
_ftype_t k2 = 0.5 * (_ftype_t)(1 - o);/* Constant used if the filter has even length */
_ftype_t k3; /* 2*pi*fc2 Constant used in BP and BS design */
- _ftype_t g = 0.0; /* Gain */
- _ftype_t t1,t2,t3; /* Temporary variables */
+ _ftype_t g = 0.0; /* Gain */
+ _ftype_t t1,t2,t3; /* Temporary variables */
_ftype_t fc1,fc2; /* Cutoff frequencies */
/* Sanity check */
@@ -130,10 +130,10 @@ int design_fir(unsigned int n, _ftype_t* w, _ftype_t* fc, unsigned int flags, _f
case(KAISER):
kaiser(n,w,opt); break;
default:
- return -1;
+ return -1;
}
- if(flags & (LP | HP)){
+ if(flags & (LP | HP)){
fc1=*fc;
/* Cutoff frequency must be < 0.5 where 0.5 <=> Fs/2 */
fc1 = ((fc1 <= 1.0) && (fc1 > 0.0)) ? fc1/2 : 0.25;
@@ -143,7 +143,7 @@ int design_fir(unsigned int n, _ftype_t* w, _ftype_t* fc, unsigned int flags, _f
/*
* If the filter length is odd, there is one point which is exactly
- * in the middle. The value at this point is 2*fCutoff*sin(x)/x,
+ * in the middle. The value at this point is 2*fCutoff*sin(x)/x,
* where x is zero. To make sure nothing strange happens, we set this
* value separately.
*/
@@ -196,9 +196,9 @@ int design_fir(unsigned int n, _ftype_t* w, _ftype_t* fc, unsigned int flags, _f
t2 = sin(k3 * t1)/(M_PI * t1); /* Sinc fc2 */
t3 = sin(k1 * t1)/(M_PI * t1); /* Sinc fc1 */
g += w[end-i-1] * (t3 + t2); /* Total gain in filter */
- w[end-i-1] = w[n-end+i] = w[end-i-1] * (t2 - t3);
+ w[end-i-1] = w[n-end+i] = w[end-i-1] * (t2 - t3);
}
- }
+ }
else{ /* Band stop */
if (!o) /* Band stop filters must have odd length */
return -1;
@@ -210,7 +210,7 @@ int design_fir(unsigned int n, _ftype_t* w, _ftype_t* fc, unsigned int flags, _f
t1 = (_ftype_t)(i+1);
t2 = sin(k1 * t1)/(M_PI * t1); /* Sinc fc1 */
t3 = sin(k3 * t1)/(M_PI * t1); /* Sinc fc2 */
- w[end-i-1] = w[n-end+i] = w[end-i-1] * (t2 - t3);
+ w[end-i-1] = w[n-end+i] = w[end-i-1] * (t2 - t3);
g += 2*w[end-i-1]; /* Total gain in filter */
}
}
@@ -218,9 +218,9 @@ int design_fir(unsigned int n, _ftype_t* w, _ftype_t* fc, unsigned int flags, _f
/* Normalize gain */
g=1/g;
- for (i=0; i<n; i++)
+ for (i=0; i<n; i++)
w[i] *= g;
-
+
return 0;
}
@@ -229,7 +229,7 @@ int design_fir(unsigned int n, _ftype_t* w, _ftype_t* fc, unsigned int flags, _f
* n length of prototype filter
* k number of polyphase components
* w prototype filter taps
- * pw Parallel FIR filter
+ * pw Parallel FIR filter
* g Filter gain
* flags FWD forward indexing
* REW reverse indexing
@@ -240,10 +240,10 @@ int design_fir(unsigned int n, _ftype_t* w, _ftype_t* fc, unsigned int flags, _f
int design_pfir(unsigned int n, unsigned int k, _ftype_t* w, _ftype_t** pw, _ftype_t g, unsigned int flags)
{
int l = (int)n/k; /* Length of individual FIR filters */
- int i; /* Counters */
+ int i; /* Counters */
int j;
_ftype_t t; /* g * w[i] */
-
+
/* Sanity check */
if(l<1 || k<1 || !w || !pw)
return -1;
@@ -276,7 +276,7 @@ int design_pfir(unsigned int n, unsigned int k, _ftype_t* w, _ftype_t** pw, _fty
/* Pre-warp the coefficients of a numerator or denominator.
* Note that a0 is assumed to be 1, so there is no wrapping
- * of it.
+ * of it.
*/
void prewarp(_ftype_t* a, _ftype_t fc, _ftype_t fs)
{
@@ -303,12 +303,12 @@ void prewarp(_ftype_t* a, _ftype_t fc, _ftype_t fs)
* Arguments:
* a - s-domain numerator coefficients
* b - s-domain denominator coefficients
- * k - filter gain factor. Initially set to 1 and modified by each
+ * k - filter gain factor. Initially set to 1 and modified by each
* biquad section in such a way, as to make it the
* coefficient by which to multiply the overall filter gain
* in order to achieve a desired overall filter gain,
- * specified in initial value of k.
- * fs - sampling rate (Hz)
+ * specified in initial value of k.
+ * fs - sampling rate (Hz)
* coef - array of z-domain coefficients to be filled in.
*
* Return: On return, set coef z-domain coefficients and k to the gain
@@ -342,7 +342,7 @@ void bilinear(_ftype_t* a, _ftype_t* b, _ftype_t* k, _ftype_t fs, _ftype_t *coef
* create a filter fill in a, b, Q and fs and make space for coef and k.
*
*
- * Example Butterworth design:
+ * Example Butterworth design:
*
* Below are Butterworth polynomials, arranged as a series of 2nd
* order sections:
@@ -398,12 +398,12 @@ void bilinear(_ftype_t* a, _ftype_t* b, _ftype_t* k, _ftype_t fs, _ftype_t *coef
* a - s-domain numerator coefficients, a[1] is always assumed to be 1.0
* b - s-domain denominator coefficients
* Q - Q value for the filter
- * k - filter gain factor. Initially set to 1 and modified by each
+ * k - filter gain factor. Initially set to 1 and modified by each
* biquad section in such a way, as to make it the
* coefficient by which to multiply the overall filter gain
* in order to achieve a desired overall filter gain,
- * specified in initial value of k.
- * fs - sampling rate (Hz)
+ * specified in initial value of k.
+ * fs - sampling rate (Hz)
* coef - array of z-domain coefficients to be filled in.
*
* Note: Upon return from each call, the k argument will be set to a
@@ -419,7 +419,7 @@ int szxform(const _ftype_t* a, const _ftype_t* b, _ftype_t Q, _ftype_t fc, _ftyp
_ftype_t at[3];
_ftype_t bt[3];
- if(!a || !b || !k || !coef || (Q>1000.0 || Q< 1.0))
+ if(!a || !b || !k || !coef || (Q>1000.0 || Q< 1.0))
return -1;
memcpy(at,a,3*sizeof(_ftype_t));
diff --git a/src/post/audio/filter.h b/src/post/audio/filter.h
index 0e08aa2b9..4d756a618 100644
--- a/src/post/audio/filter.h
+++ b/src/post/audio/filter.h
@@ -1,5 +1,5 @@
/*=============================================================================
- *
+ *
* This software has been released under the terms of the GNU Public
* license. See http://www.gnu.org/copyleft/gpl.html for details.
*
@@ -37,7 +37,7 @@
#define WINDOW_MASK 0x0000001F
/* Parallel filter design */
-#define FWD 0x00000001 /* Forward indexing of polyphase filter */
+#define FWD 0x00000001 /* Forward indexing of polyphase filter */
#define REW 0x00000002 /* Reverse indexing of polyphase filter */
#define ODD 0x00000010 /* Make filter HP */
@@ -60,7 +60,7 @@ extern int szxform(const _ftype_t* a, const _ftype_t* b, _ftype_t Q, _ftype_t fc
/* Add new data to circular queue designed to be used with a FIR
* filter. xq is the circular queue, in pointing at the new sample, xi
* current index for xq and n the length of the filter. xq must be n*2
- * long.
+ * long.
*/
#define updateq(n,xi,xq,in)\
xq[xi]=(xq)[(xi)+(n)]=*(in);\
diff --git a/src/post/audio/stretch.c b/src/post/audio/stretch.c
index 36ac18dd6..7397844b4 100644
--- a/src/post/audio/stretch.c
+++ b/src/post/audio/stretch.c
@@ -1,18 +1,18 @@
/*
* Copyright (C) 2000-2004 the xine project
- *
+ *
* This file is part of xine, a free video player.
- *
+ *
* xine 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.
- *
+ *
* xine 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
@@ -70,19 +70,19 @@ static void stretchscr_set_pivot (stretchscr_t *this) {
struct timeval tv;
int64_t pts;
- double pts_calc;
+ double pts_calc;
xine_monotonic_clock(&tv, NULL);
pts_calc = (tv.tv_sec - this->cur_time.tv_sec) * this->speed_factor;
pts_calc += (tv.tv_usec - this->cur_time.tv_usec) * this->speed_factor / 1e6;
pts = this->cur_pts + pts_calc;
-/* This next part introduces a one off inaccuracy
- * to the scr due to rounding tv to pts.
+/* This next part introduces a one off inaccuracy
+ * to the scr due to rounding tv to pts.
*/
this->cur_time.tv_sec=tv.tv_sec;
this->cur_time.tv_usec=tv.tv_usec;
- this->cur_pts=pts;
+ this->cur_pts=pts;
return ;
}
@@ -94,7 +94,7 @@ static int stretchscr_set_speed (scr_plugin_t *scr, int speed) {
stretchscr_set_pivot( this );
this->xine_speed = speed;
- this->speed_factor = (double) speed * 90000.0 / XINE_FINE_SPEED_NORMAL /
+ this->speed_factor = (double) speed * 90000.0 / XINE_FINE_SPEED_NORMAL /
(*this->stretch_factor);
pthread_mutex_unlock (&this->lock);
@@ -125,7 +125,7 @@ static void stretchscr_start (scr_plugin_t *scr, int64_t start_vpts) {
this->cur_pts = start_vpts;
pthread_mutex_unlock (&this->lock);
-
+
stretchscr_set_speed (&this->scr, XINE_FINE_SPEED_NORMAL);
}
@@ -134,16 +134,16 @@ static int64_t stretchscr_get_current (scr_plugin_t *scr) {
struct timeval tv;
int64_t pts;
- double pts_calc;
+ double pts_calc;
pthread_mutex_lock (&this->lock);
xine_monotonic_clock(&tv, NULL);
-
+
pts_calc = (tv.tv_sec - this->cur_time.tv_sec) * this->speed_factor;
pts_calc += (tv.tv_usec - this->cur_time.tv_usec) * this->speed_factor / 1e6;
pts = this->cur_pts + pts_calc;
-
+
pthread_mutex_unlock (&this->lock);
return pts;
@@ -168,9 +168,9 @@ static stretchscr_t *XINE_MALLOC stretchscr_init (double *stretch_factor) {
this->scr.start = stretchscr_start;
this->scr.get_current = stretchscr_get_current;
this->scr.exit = stretchscr_exit;
-
+
pthread_mutex_init (&this->lock, NULL);
-
+
this->stretch_factor = stretch_factor;
stretchscr_set_speed (&this->scr, XINE_SPEED_PAUSE);
@@ -202,21 +202,21 @@ typedef struct stretch_parameters_s {
START_PARAM_DESCR( stretch_parameters_t )
PARAM_ITEM( POST_PARAM_TYPE_BOOL, preserve_pitch, NULL, 0, 1, 0,
"Preserve pitch" )
-PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, factor, NULL, 0.5, 1.5, 0,
+PARAM_ITEM( POST_PARAM_TYPE_DOUBLE, factor, NULL, 0.5, 1.5, 0,
"Time stretch factor (<1.0 shorten duration)" )
END_PARAM_DESCR( param_descr )
/* plugin structure */
struct post_plugin_stretch_s {
post_plugin_t post;
-
+
stretchscr_t* scr;
/* private data */
stretch_parameters_t params;
xine_post_in_t params_input;
int params_changed;
-
+
int channels;
int bytes_per_frame;
@@ -228,9 +228,9 @@ struct post_plugin_stretch_s {
int num_frames; /* current # of frames on audiofrag */
int16_t last_sample[RESAMPLE_MAX_CHANNELS];
-
+
int64_t pts; /* pts for audiofrag */
-
+
pthread_mutex_t lock;
};
@@ -290,16 +290,16 @@ static int stretch_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream,
post_audio_port_t *port = (post_audio_port_t *)port_gen;
post_plugin_stretch_t *this = (post_plugin_stretch_t *)port->post;
int64_t time;
-
+
_x_post_rewire(&this->post);
_x_post_inc_usage(port);
-
+
port->stream = stream;
port->bits = bits;
port->rate = rate;
port->mode = mode;
-
- /* register our own scr provider */
+
+ /* register our own scr provider */
time = port->stream->xine->clock->get_current_time(port->stream->xine->clock);
this->scr = stretchscr_init(&this->params.factor);
this->scr->scr.start(&this->scr->scr, time);
@@ -307,7 +307,7 @@ static int stretch_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream,
/* force updating on stretch_port_put_buffer */
this->params_changed = 1;
-
+
return (port->original_port->open) (port->original_port, stream, bits, rate, mode);
}
@@ -320,34 +320,34 @@ static void stretch_port_close(xine_audio_port_t *port_gen, xine_stream_t *strea
port->stream->xine->clock->unregister_scr(port->stream->xine->clock, &this->scr->scr);
this->scr->scr.exit(&this->scr->scr);
}
-
+
if(this->audiofrag) {
free(this->audiofrag);
this->audiofrag = NULL;
}
-
+
if(this->outfrag) {
free(this->outfrag);
this->outfrag = NULL;
}
-
+
if(this->w) {
free(this->w);
this->w = NULL;
}
-
+
port->stream = NULL;
port->original_port->close(port->original_port, stream );
-
+
_x_post_dec_usage(port);
}
-static void stretch_process_fragment( post_audio_port_t *port,
+static void stretch_process_fragment( post_audio_port_t *port,
xine_stream_t *stream, extra_info_t *extra_info )
{
post_plugin_stretch_t *this = (post_plugin_stretch_t *)port->post;
-
+
audio_buffer_t *outbuf;
int16_t *data_out = this->outfrag;
int num_frames_in = this->num_frames;
@@ -374,52 +374,52 @@ static void stretch_process_fragment( post_audio_port_t *port,
* input chunk has two halves, A and B.
* output chunk is composed as follow:
* - some frames copied directly from A
- * - some frames copied from A merged with frames from B
+ * - some frames copied from A merged with frames from B
* weighted by an increasing factor (0 -> 1.0)
* - frames from A weighted by a decreasing factor (1.0 -> 0)
* merged with frames copied from B
* - some frames copied directly from B
*/
-
+
int merge_frames = num_frames_in - num_frames_out;
int copy_frames;
int16_t *src = this->audiofrag;
int16_t *dst = this->outfrag;
int i, j;
-
+
if( merge_frames > num_frames_out )
merge_frames = num_frames_out;
copy_frames = num_frames_out - merge_frames;
-
+
memcpy(dst, src, copy_frames/2 * this->bytes_per_frame);
dst += copy_frames/2 * this->channels;
src += copy_frames/2 * this->channels;
-
+
for( i = 0; i < merge_frames/2; i++ )
{
for( j = 0; j < this->channels; j++, src++, dst++ ) {
-
+
int32_t s = (int32_t) ((_ftype_t) src[0] +
src[merge_frames * this->channels] * this->w[i]);
*dst = CLIP_INT16(s);
}
}
-
+
for( ; i < merge_frames; i++ )
{
for( j = 0; j < this->channels; j++, src++, dst++ ) {
-
+
int32_t s = (int32_t) ((_ftype_t) src[0] * this->w[i] +
src[merge_frames * this->channels]);
*dst = CLIP_INT16(s);
}
}
-
+
src += merge_frames * this->channels;
-
+
memcpy(dst, src, (copy_frames - copy_frames/2) *
this->bytes_per_frame);
-
+
} else {
/*
* time expansion strategy
@@ -427,13 +427,13 @@ static void stretch_process_fragment( post_audio_port_t *port,
* output chunk is composed of two versions of the
* input chunk:
* - first part copied directly from input, and then
- * merged with the second (delayed) part using a
+ * merged with the second (delayed) part using a
* decreasing factor (1.0 -> 0)
* - the delayed version of the input is merged with
- * an increasing factor (0 -> 1.0) and then (when
- * factor reaches 1.0) just copied until the end.
+ * an increasing factor (0 -> 1.0) and then (when
+ * factor reaches 1.0) just copied until the end.
*/
-
+
int merge_frames = num_frames_out - num_frames_in;
int copy_frames = num_frames_out - merge_frames;
int16_t *src1 = this->audiofrag;
@@ -449,67 +449,67 @@ static void stretch_process_fragment( post_audio_port_t *port,
for( i = 0; i < merge_frames/2; i++ )
{
for( j = 0; j < this->channels; j++, src1++, src2++, dst++ ) {
-
+
int32_t s = (int32_t) ((_ftype_t) *src1 +
*src2 * this->w[i]);
*dst = CLIP_INT16(s);
}
}
-
+
for( ; i < merge_frames; i++ )
{
for( j = 0; j < this->channels; j++, src1++, src2++, dst++ ) {
-
+
int32_t s = (int32_t) ((_ftype_t) *src1 * this->w[i] +
*src2);
*dst = CLIP_INT16(s);
}
}
-
+
memcpy(dst, src2, (copy_frames - copy_frames/2) *
this->bytes_per_frame);
}
}
-
+
/* copy processed fragment into multiple audio buffers, if needed */
while( num_frames_out ) {
- outbuf = port->original_port->get_buffer(port->original_port);
-
+ outbuf = port->original_port->get_buffer(port->original_port);
+
outbuf->num_frames = outbuf->mem_size / this->bytes_per_frame;
if( outbuf->num_frames > num_frames_out )
outbuf->num_frames = num_frames_out;
-
- memcpy( outbuf->mem, data_out,
+
+ memcpy( outbuf->mem, data_out,
outbuf->num_frames * this->bytes_per_frame );
num_frames_out -= outbuf->num_frames;
data_out = (uint16_t *)((uint8_t *)data_out + outbuf->num_frames * this->bytes_per_frame);
-
+
outbuf->vpts = this->pts;
this->pts = 0;
outbuf->stream = stream;
outbuf->format.bits = port->bits;
outbuf->format.rate = port->rate;
outbuf->format.mode = port->mode;
-
+
_x_extra_info_merge( outbuf->extra_info, extra_info );
-
- port->original_port->put_buffer(port->original_port, outbuf, stream );
+
+ port->original_port->put_buffer(port->original_port, outbuf, stream );
}
-
+
this->num_frames = 0;
}
-static void stretch_port_put_buffer (xine_audio_port_t *port_gen,
+static void stretch_port_put_buffer (xine_audio_port_t *port_gen,
audio_buffer_t *buf, xine_stream_t *stream) {
-
+
post_audio_port_t *port = (post_audio_port_t *)port_gen;
post_plugin_stretch_t *this = (post_plugin_stretch_t *)port->post;
int16_t *data_in;
-
+
pthread_mutex_lock (&this->lock);
-
+
if( this->params_changed ) {
int64_t audio_step;
@@ -517,40 +517,40 @@ static void stretch_port_put_buffer (xine_audio_port_t *port_gen,
/* output whatever we have before changing parameters */
stretch_process_fragment( port, stream, buf->extra_info );
}
-
+
this->channels = _x_ao_mode2channels(port->mode);
this->bytes_per_frame = port->bits / 8 * this->channels;
-
+
audio_step = ((int64_t)90000 * (int64_t)32768) / (int64_t)port->rate;
audio_step = (int64_t) ((double)audio_step / this->params.factor);
stream->metronom->set_audio_rate(stream->metronom, audio_step);
stretchscr_set_speed(&this->scr->scr, this->scr->xine_speed);
-
+
if(this->audiofrag) {
free(this->audiofrag);
this->audiofrag = NULL;
}
-
+
if(this->outfrag) {
free(this->outfrag);
this->outfrag = NULL;
}
-
+
if(this->w) {
free(this->w);
this->w = NULL;
}
-
+
this->frames_per_frag = port->rate * AUDIO_FRAGMENT;
this->frames_per_outfrag = (int) ((double)this->params.factor * this->frames_per_frag);
if( this->frames_per_frag != this->frames_per_outfrag ) {
int wsize;
-
- this->audiofrag = malloc( this->frames_per_frag * this->bytes_per_frame );
- this->outfrag = malloc( this->frames_per_outfrag * this->bytes_per_frame );
-
+
+ this->audiofrag = malloc( this->frames_per_frag * this->bytes_per_frame );
+ this->outfrag = malloc( this->frames_per_outfrag * this->bytes_per_frame );
+
if( this->frames_per_frag > this->frames_per_outfrag )
wsize = this->frames_per_frag - this->frames_per_outfrag;
else
@@ -559,41 +559,41 @@ static void stretch_port_put_buffer (xine_audio_port_t *port_gen,
this->w = (_ftype_t*) malloc( wsize * sizeof(_ftype_t) );
triang(wsize, this->w);
}
-
+
this->num_frames = 0;
this->pts = 0;
-
+
this->params_changed = 0;
}
-
+
pthread_mutex_unlock (&this->lock);
/* just pass data through if we have nothing to do */
if( this->frames_per_frag == this->frames_per_outfrag ||
/* FIXME: we only handle 1 or 2 channels, 16 bits for now */
- (this->channels != 1 && this->channels != 2) ||
+ (this->channels != 1 && this->channels != 2) ||
port->bits != 16 ) {
-
- port->original_port->put_buffer(port->original_port, buf, stream );
-
+
+ port->original_port->put_buffer(port->original_port, buf, stream );
+
return;
}
-
+
/* update pts for our current audio fragment */
if( buf->vpts )
this->pts = buf->vpts - (this->num_frames * 90000 / port->rate);
-
+
data_in = buf->mem;
while( buf->num_frames ) {
int frames_to_copy = this->frames_per_frag - this->num_frames;
-
+
if( frames_to_copy > buf->num_frames )
frames_to_copy = buf->num_frames;
/* copy up to one fragment from input buf to our buffer */
memcpy( (uint8_t *)this->audiofrag + this->num_frames * this->bytes_per_frame,
data_in, frames_to_copy * this->bytes_per_frame );
-
+
data_in = (uint16_t *)((uint8_t *)data_in + frames_to_copy * this->bytes_per_frame);
this->num_frames += frames_to_copy;
buf->num_frames -= frames_to_copy;
@@ -603,10 +603,10 @@ static void stretch_port_put_buffer (xine_audio_port_t *port_gen,
stretch_process_fragment( port, stream, buf->extra_info );
}
}
-
+
buf->num_frames=0; /* UNDOCUMENTED, but hey, it works! Force old audio_out buffer free. */
- port->original_port->put_buffer(port->original_port, buf, stream );
-
+ port->original_port->put_buffer(port->original_port, buf, stream );
+
return;
}
@@ -630,21 +630,21 @@ static post_plugin_t *stretch_open_plugin(post_class_t *class_gen, int inputs,
xine_post_in_t *input_api;
post_audio_port_t *port;
stretch_parameters_t init_params;
-
+
if (!this || !audio_target || !audio_target[0] ) {
free(this);
return NULL;
}
-
+
_x_post_init(&this->post, 1, 0);
init_params.preserve_pitch = 1;
init_params.factor = 0.80;
-
+
pthread_mutex_init (&this->lock, NULL);
set_parameters ((xine_post_t *)&this->post, &init_params);
-
+
port = _x_post_intercept_audio_port(&this->post, audio_target[0], &input, &output);
port->new_port.open = stretch_port_open;
port->new_port.close = stretch_port_close;
@@ -667,16 +667,16 @@ static post_plugin_t *stretch_open_plugin(post_class_t *class_gen, int inputs,
void *stretch_init_plugin(xine_t *xine, void *data)
{
post_class_stretch_t *class = (post_class_stretch_t *)xine_xmalloc(sizeof(post_class_stretch_t));
-
+
if (!class)
return NULL;
-
+
class->post_class.open_plugin = stretch_open_plugin;
class->post_class.identifier = "stretch";
class->post_class.description = N_("Time stretch by a given factor, optionally preserving pitch");
class->post_class.dispose = default_post_class_dispose;
-
+
class->xine = xine;
-
+
return class;
}
diff --git a/src/post/audio/upmix.c b/src/post/audio/upmix.c
index 24df657d0..c8f7c0121 100644
--- a/src/post/audio/upmix.c
+++ b/src/post/audio/upmix.c
@@ -1,18 +1,18 @@
/*
* Copyright (C) 2000-2004 the xine project
- *
+ *
* This file is part of xine, a free video player.
- *
+ *
* xine 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.
- *
+ *
* xine 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
@@ -167,13 +167,13 @@ static int upmix_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream,
_x_post_rewire(&this->post);
_x_post_inc_usage(port);
-
+
port->stream = stream;
port->bits = bits;
port->rate = rate;
port->mode = mode;
capabilities = port->original_port->get_capabilities(port->original_port);
-
+
this->channels = _x_ao_mode2channels(mode);
/* FIXME: Handle all desired output formats */
if ((capabilities & AO_CAP_MODE_5_1CHANNEL) && (capabilities & AO_CAP_FLOAT32)) {
@@ -232,7 +232,7 @@ static int upmix_frames_2to51_any_to_float( uint8_t *dst8, uint8_t *src8, int nu
float right;
float sum;
int frame;
- int src_units_per_sample=1;
+ int src_units_per_sample=1;
if (step_channel_in == 3) src_units_per_sample=step_channel_in; /* Special handling for 24 bit 3byte input */
for (frame=0;frame < num_frames; frame++) {
@@ -297,9 +297,9 @@ static int upmix_frames_2to51_any_to_float( uint8_t *dst8, uint8_t *src8, int nu
return frame;
}
-static void upmix_port_put_buffer (xine_audio_port_t *port_gen,
+static void upmix_port_put_buffer (xine_audio_port_t *port_gen,
audio_buffer_t *buf, xine_stream_t *stream) {
-
+
post_audio_port_t *port = (post_audio_port_t *)port_gen;
post_plugin_upmix_t *this = (post_plugin_upmix_t *)port->post;
int src_step_frame;
@@ -315,7 +315,7 @@ static void upmix_port_put_buffer (xine_audio_port_t *port_gen,
if ((this->channels==2) && (this->channels_out==6)) {
while (num_frames_processed < buf->num_frames) {
- this->buf = port->original_port->get_buffer(port->original_port);
+ this->buf = port->original_port->get_buffer(port->original_port);
/* this->buf->num_frames is handled after the upmix */
this->buf->vpts = buf->vpts;
if (num_frames_processed != 0) this->buf->vpts = 0;
@@ -327,7 +327,7 @@ static void upmix_port_put_buffer (xine_audio_port_t *port_gen,
this->buf->format.bits = 32; /* Upmix to floats */
this->buf->format.rate = port->rate;
this->buf->format.mode = AO_CAP_MODE_5_1CHANNEL;
- _x_extra_info_merge( this->buf->extra_info, buf->extra_info);
+ _x_extra_info_merge( this->buf->extra_info, buf->extra_info);
step_channel_in = port->bits>>3;
step_channel_out = this->buf->format.bits>>3;
dst_step_frame = this->channels_out*step_channel_out;
@@ -353,18 +353,18 @@ static void upmix_port_put_buffer (xine_audio_port_t *port_gen,
}
}
pthread_mutex_unlock (&this->lock);
-
+
num_frames_done = upmix_frames_2to51_any_to_float(data8dst, data8src, num_frames, step_channel_in, this->sub);
this->buf->num_frames = num_frames_done;
num_frames_processed+= num_frames_done;
/* pass data to original port */
- port->original_port->put_buffer(port->original_port, this->buf, stream );
+ port->original_port->put_buffer(port->original_port, this->buf, stream );
}
/* free data from origial buffer */
buf->num_frames=0; /* UNDOCUMENTED, but hey, it works! Force old audio_out buffer free. */
}
- port->original_port->put_buffer(port->original_port, buf, stream );
-
+ port->original_port->put_buffer(port->original_port, buf, stream );
+
return;
}
@@ -388,16 +388,16 @@ static post_plugin_t *upmix_open_plugin(post_class_t *class_gen, int inputs,
post_out_t *output;
xine_post_in_t *input_api;
post_audio_port_t *port;
-
+
if (!this || !audio_target || !audio_target[0] ) {
free(this);
return NULL;
}
-
+
_x_post_init(&this->post, 1, 0);
this->params.cut_off_freq = 100;
-
+
port = _x_post_intercept_audio_port(&this->post, audio_target[0], &input, &output);
port->new_port.open = upmix_port_open;
#if 0
@@ -422,16 +422,16 @@ static post_plugin_t *upmix_open_plugin(post_class_t *class_gen, int inputs,
void *upmix_init_plugin(xine_t *xine, void *data)
{
post_class_upmix_t *class = (post_class_upmix_t *)xine_xmalloc(sizeof(post_class_upmix_t));
-
+
if (!class)
return NULL;
-
+
class->post_class.open_plugin = upmix_open_plugin;
class->post_class.identifier = "upmix";
class->post_class.description = N_("upmix");
class->post_class.dispose = default_post_class_dispose;
-
+
class->xine = xine;
-
+
return class;
}
diff --git a/src/post/audio/upmix_mono.c b/src/post/audio/upmix_mono.c
index c59638be4..499856e69 100644
--- a/src/post/audio/upmix_mono.c
+++ b/src/post/audio/upmix_mono.c
@@ -1,18 +1,18 @@
/*
* Copyright (C) 2000-2004 the xine project
- *
+ *
* This file is part of xine, a free video player.
- *
+ *
* xine 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.
- *
+ *
* xine 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
@@ -68,11 +68,11 @@ struct post_plugin_upmix_mono_s {
/* private data */
int channels;
-
+
upmix_mono_parameters_t params;
xine_post_in_t params_input;
int params_changed;
-
+
pthread_mutex_t lock;
};
@@ -134,7 +134,7 @@ static int upmix_mono_port_open(xine_audio_port_t *port_gen, xine_stream_t *stre
_x_post_rewire(&this->post);
_x_post_inc_usage(port);
-
+
port->stream = stream;
port->bits = bits;
port->rate = rate;
@@ -142,7 +142,7 @@ static int upmix_mono_port_open(xine_audio_port_t *port_gen, xine_stream_t *stre
this->channels = _x_ao_mode2channels(mode);
capabilities = port->original_port->get_capabilities(port->original_port);
-
+
if (this->channels == 1 && (capabilities & AO_CAP_MODE_STEREO)) {
xprintf(stream->xine, XINE_VERBOSITY_LOG,
_(LOG_MODULE ": upmixing Mono to Stereo.\n"));
@@ -151,7 +151,7 @@ static int upmix_mono_port_open(xine_audio_port_t *port_gen, xine_stream_t *stre
if ( this->channels != 1)
xprintf(stream->xine, XINE_VERBOSITY_LOG,
ngettext(LOG_MODULE ": upmixing a single channel from original %d channel stream.\n",
- LOG_MODULE ": upmixing a single channel from original %d channels stream.\n",
+ LOG_MODULE ": upmixing a single channel from original %d channels stream.\n",
this->channels), this->channels);
else {
xprintf(stream->xine, XINE_VERBOSITY_LOG,
@@ -163,15 +163,15 @@ static int upmix_mono_port_open(xine_audio_port_t *port_gen, xine_stream_t *stre
return (port->original_port->open) (port->original_port, stream, bits, rate, mode);
}
-static void upmix_mono_port_put_buffer(xine_audio_port_t *port_gen,
+static void upmix_mono_port_put_buffer(xine_audio_port_t *port_gen,
audio_buffer_t *buf, xine_stream_t *stream) {
-
+
post_audio_port_t *port = (post_audio_port_t *)port_gen;
post_plugin_upmix_mono_t *this = (post_plugin_upmix_mono_t *)port->post;
-
+
pthread_mutex_lock (&this->lock);
- if (this->channels == 1)
+ if (this->channels == 1)
{
audio_buffer_t *buf0 = port->original_port->get_buffer(port->original_port);
audio_buffer_t *buf1 = port->original_port->get_buffer(port->original_port);
@@ -232,7 +232,7 @@ static void upmix_mono_port_put_buffer(xine_audio_port_t *port_gen,
/* free data from origial buffer */
buf->num_frames = 0; /* UNDOCUMENTED, but hey, it works! Force old audio_out buffer free. */
}
- else if (this->channels && this->params.channel >= 0)
+ else if (this->channels && this->params.channel >= 0)
{
audio_buffer_t *buf0 = port->original_port->get_buffer(port->original_port);
buf0->num_frames = buf->num_frames;
@@ -253,12 +253,12 @@ static void upmix_mono_port_put_buffer(xine_audio_port_t *port_gen,
uint8_t *dst0 = (uint8_t *)buf0->mem;
int cur_channel = this->params.channel;
int i, j;
-
+
if( cur_channel >= this->channels )
cur_channel = this->channels-1;
src += cur_channel * step;
-
+
for (i = 0; i < buf->num_frames; i++)
{
for (j = 0; j < this->channels; j++ )
@@ -276,11 +276,11 @@ static void upmix_mono_port_put_buffer(xine_audio_port_t *port_gen,
/* free data from origial buffer */
buf->num_frames = 0; /* UNDOCUMENTED, but hey, it works! Force old audio_out buffer free. */
}
-
+
pthread_mutex_unlock (&this->lock);
-
+
port->original_port->put_buffer(port->original_port, buf, stream);
-
+
return;
}
@@ -303,24 +303,24 @@ static post_plugin_t *upmix_mono_open_plugin(post_class_t *class_gen, int inputs
xine_post_in_t *input_api;
post_audio_port_t *port;
upmix_mono_parameters_t init_params;
-
+
if (!this || !audio_target || !audio_target[0]) {
free(this);
return NULL;
}
-
+
_x_post_init(&this->post, 1, 0);
init_params.channel = -1;
-
+
pthread_mutex_init (&this->lock, NULL);
set_parameters ((xine_post_t *)&this->post, &init_params);
-
+
port = _x_post_intercept_audio_port(&this->post, audio_target[0], &input, &output);
port->new_port.open = upmix_mono_port_open;
port->new_port.put_buffer = upmix_mono_port_put_buffer;
-
+
input_api = &this->params_input;
input_api->name = "parameters";
input_api->type = XINE_POST_DATA_PARAMETERS;
@@ -337,17 +337,17 @@ static post_plugin_t *upmix_mono_open_plugin(post_class_t *class_gen, int inputs
void *upmix_mono_init_plugin(xine_t *xine, void *data)
{
post_class_upmix_mono_t *class = (post_class_upmix_mono_t *)xine_xmalloc(sizeof(post_class_upmix_mono_t));
-
+
if (!class)
return NULL;
-
+
class->post_class.open_plugin = upmix_mono_open_plugin;
class->post_class.identifier = "upmix_mono";
class->post_class.description = N_("converts Mono into Stereo");
class->post_class.dispose = default_post_class_dispose;
-
+
class->xine = xine;
-
+
return class;
}
diff --git a/src/post/audio/volnorm.c b/src/post/audio/volnorm.c
index e473d6a09..dda38fa5f 100644
--- a/src/post/audio/volnorm.c
+++ b/src/post/audio/volnorm.c
@@ -1,24 +1,24 @@
/*
* Copyright (C) 2000-2008 the xine project
- *
+ *
* This file is part of xine, a free video player.
- *
+ *
* xine 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.
- *
+ *
* xine 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*
* Volume normalization audio filter for xine. Ported by Jason Tackaberry
- * from MPlayer's af_volnorm, which is copyright 2004 by Alex Beregszaszi
+ * from MPlayer's af_volnorm, which is copyright 2004 by Alex Beregszaszi
* & Pierre Lombard.
*/
@@ -117,7 +117,7 @@ struct post_plugin_volnorm_s {
/**************************************************************************
* volnorm parameters functions
*************************************************************************/
-static int set_parameters (xine_post_t *this_gen, void *param_gen)
+static int set_parameters (xine_post_t *this_gen, void *param_gen)
{
post_plugin_volnorm_t *this = (post_plugin_volnorm_t *)this_gen;
volnorm_parameters_t *param = (volnorm_parameters_t *)param_gen;
@@ -129,7 +129,7 @@ static int set_parameters (xine_post_t *this_gen, void *param_gen)
return 1;
}
-static int get_parameters (xine_post_t *this_gen, void *param_gen)
+static int get_parameters (xine_post_t *this_gen, void *param_gen)
{
post_plugin_volnorm_t *this = (post_plugin_volnorm_t *)this_gen;
volnorm_parameters_t *param = (volnorm_parameters_t *)param_gen;
@@ -141,12 +141,12 @@ static int get_parameters (xine_post_t *this_gen, void *param_gen)
return 1;
}
-static xine_post_api_descr_t * get_param_descr (void)
+static xine_post_api_descr_t * get_param_descr (void)
{
return &param_descr;
}
-static char * get_help (void)
+static char * get_help (void)
{
return _("Normalizes audio by maximizing the volume without distorting "
"the sound.\n"
@@ -172,14 +172,14 @@ static xine_post_api_t post_api = {
*************************************************************************/
static int volnorm_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream,
- uint32_t bits, uint32_t rate, int mode)
+ uint32_t bits, uint32_t rate, int mode)
{
post_audio_port_t *port = (post_audio_port_t *)port_gen;
post_plugin_volnorm_t *this = (post_plugin_volnorm_t *)port->post;
_x_post_rewire(&this->post);
_x_post_inc_usage(port);
-
+
port->stream = stream;
port->bits = bits;
port->rate = rate;
@@ -373,10 +373,10 @@ static void method2_float(post_plugin_volnorm_t *this, audio_buffer_t *buf)
}
-static void volnorm_port_put_buffer (xine_audio_port_t *port_gen,
- audio_buffer_t *buf, xine_stream_t *stream)
+static void volnorm_port_put_buffer (xine_audio_port_t *port_gen,
+ audio_buffer_t *buf, xine_stream_t *stream)
{
-
+
post_audio_port_t *port = (post_audio_port_t *)port_gen;
post_plugin_volnorm_t *this = (post_plugin_volnorm_t *)port->post;
@@ -391,8 +391,8 @@ static void volnorm_port_put_buffer (xine_audio_port_t *port_gen,
else if (buf->format.bits == 32)
method2_float(this, buf);
}
- port->original_port->put_buffer(port->original_port, buf, stream );
-
+ port->original_port->put_buffer(port->original_port, buf, stream );
+
return;
}
@@ -416,12 +416,12 @@ static post_plugin_t *volnorm_open_plugin(post_class_t *class_gen, int inputs,
post_out_t *output;
xine_post_in_t *input_api;
post_audio_port_t *port;
-
+
if (!this || !audio_target || !audio_target[0] ) {
free(this);
return NULL;
}
-
+
_x_post_init(&this->post, 1, 0);
pthread_mutex_init (&this->lock, NULL);
@@ -453,16 +453,16 @@ static post_plugin_t *volnorm_open_plugin(post_class_t *class_gen, int inputs,
void *volnorm_init_plugin(xine_t *xine, void *data)
{
post_class_volnorm_t *class = (post_class_volnorm_t *)xine_xmalloc(sizeof(post_class_volnorm_t));
-
+
if (!class)
return NULL;
-
+
class->post_class.open_plugin = volnorm_open_plugin;
class->post_class.identifier = "volnorm";
class->post_class.description = N_("Normalize volume");
class->post_class.dispose = default_post_class_dispose;
-
+
class->xine = xine;
-
+
return class;
}
diff --git a/src/post/audio/window.c b/src/post/audio/window.c
index fdea90590..ca58152d5 100644
--- a/src/post/audio/window.c
+++ b/src/post/audio/window.c
@@ -1,5 +1,5 @@
/*=============================================================================
- *
+ *
* This software has been released under the terms of the GNU Public
* license. See http://www.gnu.org/copyleft/gpl.html for details.
*
@@ -39,7 +39,7 @@ void boxcar(int n, _ftype_t* w)
/*
* Triang a.k.a Bartlett
*
- * | (N-1)|
+ * | (N-1)|
* 2 * |k - -----|
* | 2 |
* w = 1.0 - ---------------
@@ -53,7 +53,7 @@ void triang(int n, _ftype_t* w)
_ftype_t k2 = 1/((_ftype_t)n + k1);
int end = (n + 1) >> 1;
int i;
-
+
/* Calculate window coefficients */
for (i=0 ; i<end ; i++)
w[i] = w[n-i-1] = (2.0*((_ftype_t)(i+1))-(1.0-k1))*k2;
@@ -72,7 +72,7 @@ void hanning(int n, _ftype_t* w)
{
int i;
_ftype_t k = 2*M_PI/((_ftype_t)(n+1)); /* 2*pi/(N+1) */
-
+
/* Calculate window coefficients */
for (i=0; i<n; i++)
*w++ = 0.5*(1.0 - cos(k*(_ftype_t)(i+1)));
@@ -131,22 +131,22 @@ void flattop(int n,_ftype_t* w)
int i;
_ftype_t k1 = 2*M_PI/((_ftype_t)(n-1)); /* 2*pi/(N-1) */
_ftype_t k2 = 2*k1; /* 4*pi/(N-1) */
-
+
/* Calculate window coefficients */
for (i=0; i<n; i++)
*w++ = 0.2810638602 - 0.5208971735*cos(k1*(_ftype_t)i) + 0.1980389663*cos(k2*(_ftype_t)i);
}
-/* Computes the 0th order modified Bessel function of the first kind.
- * (Needed to compute Kaiser window)
- *
+/* Computes the 0th order modified Bessel function of the first kind.
+ * (Needed to compute Kaiser window)
+ *
* y = sum( (x/(2*n))^2 )
* n
*/
#define BIZ_EPSILON 1E-21 /* Max error acceptable */
static _ftype_t besselizero(_ftype_t x)
-{
+{
_ftype_t temp;
_ftype_t sum = 1.0;
_ftype_t u = 1.0;
@@ -175,10 +175,10 @@ static _ftype_t besselizero(_ftype_t x)
* Gold (Theory and Application of DSP) under Kaiser windows for more
* about Beta. The following table from Rabiner and Gold gives some
* feel for the effect of Beta:
- *
+ *
* All ripples in dB, width of transition band = D*N where N = window
* length
- *
+ *
* BETA D PB RIP SB RIP
* 2.120 1.50 +-0.27 -30
* 3.384 2.23 0.0864 -40
@@ -195,8 +195,8 @@ void kaiser(int n, _ftype_t* w, _ftype_t b)
_ftype_t k1 = 1.0/besselizero(b);
int k2 = 1 - (n & 1);
int end = (n + 1) >> 1;
- int i;
-
+ int i;
+
/* Calculate window coefficients */
for (i=0 ; i<end ; i++){
tmp = (_ftype_t)(2*i + k2) / ((_ftype_t)n - 1.0);
diff --git a/src/post/audio/window.h b/src/post/audio/window.h
index d0a7446eb..638707809 100644
--- a/src/post/audio/window.h
+++ b/src/post/audio/window.h
@@ -1,5 +1,5 @@
/*=============================================================================
- *
+ *
* This software has been released under the terms of the GNU Public
* license. See http://www.gnu.org/copyleft/gpl.html for details.
*