diff libaf/af_equalizer.c @ 29263:0f1b5b68af32

whitespace cosmetics: Remove all trailing whitespace.
author diego
date Wed, 13 May 2009 02:58:57 +0000
parents 8c706ce21c6f
children 32725ca88fed
line wrap: on
line diff
--- a/libaf/af_equalizer.c	Tue May 12 19:25:35 2009 +0000
+++ b/libaf/af_equalizer.c	Wed May 13 02:58:57 2009 +0000
@@ -32,13 +32,13 @@
 #include "af.h"
 
 #define L   	2      // Storage for filter taps
-#define KM  	10     // Max number of bands 
+#define KM  	10     // Max number of bands
 
 #define Q   1.2247449 /* Q value for band-pass filters 1.2247=(3/2)^(1/2)
 			 gives 4dB suppression @ Fc*2 and Fc/2 */
 
 /* Center frequencies for band-pass filters
-   The different frequency bands are:	
+   The different frequency bands are:
    nr.    	center frequency
    0  	31.25 Hz
    1 	62.50 Hz
@@ -55,7 +55,7 @@
 
 // Maximum and minimum gain for the bands
 #define G_MAX	+12.0
-#define G_MIN	-12.0	
+#define G_MIN	-12.0
 
 // Data for specific instances of this filter
 typedef struct af_equalizer_s
@@ -76,7 +76,7 @@
 
   a[0] = (1.0 + C) * cos(th);
   a[1] = -1 * C;
-  
+
   b[0] = (1.0 - C)/2.0;
   b[1] = -1.0050;
 }
@@ -84,30 +84,30 @@
 // Initialization and runtime control
 static int control(struct af_instance_s* af, int cmd, void* arg)
 {
-  af_equalizer_t* s   = (af_equalizer_t*)af->setup; 
+  af_equalizer_t* s   = (af_equalizer_t*)af->setup;
 
   switch(cmd){
   case AF_CONTROL_REINIT:{
     int k =0, i =0;
     float F[KM] = CF;
-    
+
     s->gain_factor=0.0;
 
     // Sanity check
     if(!arg) return AF_ERROR;
-    
+
     af->data->rate   = ((af_data_t*)arg)->rate;
     af->data->nch    = ((af_data_t*)arg)->nch;
     af->data->format = AF_FORMAT_FLOAT_NE;
     af->data->bps    = 4;
-    
+
     // Calculate number of active filters
     s->K=KM;
     while(F[s->K-1] > (float)af->data->rate/2.2)
       s->K--;
-    
+
     if(s->K != KM)
-      mp_msg(MSGT_AFILTER, MSGL_INFO, "[equalizer] Limiting the number of filters to" 
+      mp_msg(MSGT_AFILTER, MSGL_INFO, "[equalizer] Limiting the number of filters to"
 	     " %i due to low sample rate.\n",s->K);
 
     // Generate filter taps
@@ -116,7 +116,7 @@
 
     // Calculate how much this plugin adds to the overall time delay
     af->delay = 2 * af->data->nch * af->data->bps;
-    
+
     // Calculate gain factor to prevent clipping at output
     for(k=0;k<AF_NCH;k++)
     {
@@ -127,24 +127,24 @@
     }
 
     s->gain_factor=log10(s->gain_factor + 1.0) * 20.0;
-	 
+
     if(s->gain_factor > 0.0)
     {
         s->gain_factor=0.1+(s->gain_factor/12.0);
     }else{
         s->gain_factor=1;
     }
-	
+
     return af_test_output(af,arg);
   }
   case AF_CONTROL_COMMAND_LINE:{
     float g[10]={0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0};
     int i,j;
-    sscanf((char*)arg,"%f:%f:%f:%f:%f:%f:%f:%f:%f:%f", &g[0], &g[1], 
+    sscanf((char*)arg,"%f:%f:%f:%f:%f:%f:%f:%f:%f:%f", &g[0], &g[1],
 	   &g[2], &g[3], &g[4], &g[5], &g[6], &g[7], &g[8] ,&g[9]);
     for(i=0;i<AF_NCH;i++){
       for(j=0;j<KM;j++){
-	((af_equalizer_t*)af->setup)->g[i][j] = 
+	((af_equalizer_t*)af->setup)->g[i][j] =
 	  pow(10.0,clamp(g[j],G_MIN,G_MAX)/20.0)-1.0;
       }
     }
@@ -178,7 +178,7 @@
   return AF_UNKNOWN;
 }
 
-// Deallocate memory 
+// Deallocate memory
 static void uninit(struct af_instance_s* af)
 {
   if(af->data)
@@ -191,12 +191,12 @@
 static af_data_t* play(struct af_instance_s* af, af_data_t* data)
 {
   af_data_t*       c 	= data;			    	// Current working data
-  af_equalizer_t*  s 	= (af_equalizer_t*)af->setup; 	// Setup 
+  af_equalizer_t*  s 	= (af_equalizer_t*)af->setup; 	// Setup
   uint32_t  	   ci  	= af->data->nch; 	    	// Index for channels
   uint32_t	   nch 	= af->data->nch;   	    	// Number of channels
 
   while(ci--){
-    float*	g   = s->g[ci];      // Gain factor 
+    float*	g   = s->g[ci];      // Gain factor
     float*	in  = ((float*)c->audio)+ci;
     float*	out = ((float*)c->audio)+ci;
     float* 	end = in + c->len/4; // Block loop end
@@ -205,7 +205,7 @@
       register int	k  = 0;		// Frequency band index
       register float 	yt = *in; 	// Current input sample
       in+=nch;
-      
+
       // Run the filters
       for(;k<s->K;k++){
  	// Pointer to circular buffer wq
@@ -218,7 +218,7 @@
  	wq[1] = wq[0];
 	wq[0] = w;
       }
-      // Calculate output 
+      // Calculate output
       *out=yt*s->gain_factor;
       out+=nch;
     }