[Mplayer-cvslog] CVS: main/libaf af.c,1.16,1.17 af_channels.c,1.6,1.7 af_delay.c,1.5,1.6 af_format.c,1.5,1.6 af_resample.c,1.11,1.12

Anders Johansson anders at mplayerhq.hu
Thu Oct 31 12:06:23 CET 2002


Update of /cvsroot/mplayer/main/libaf
In directory mail:/var/tmp.root/cvs-serv16891/libaf

Modified Files:
	af.c af_channels.c af_delay.c af_format.c af_resample.c 
Log Message:
Adding commandline options for filters and fixing stupid bug in cfg

Index: af.c
===================================================================
RCS file: /cvsroot/mplayer/main/libaf/af.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- af.c	31 Oct 2002 08:03:35 -0000	1.16
+++ af.c	31 Oct 2002 11:06:19 -0000	1.17
@@ -63,6 +63,7 @@
 {
   char* cmdline = name;
   char* delim   = "=";
+
   // Allocate space for the new filter and reset all pointers
   af_instance_t* new=malloc(sizeof(af_instance_t));
   if(!new){

Index: af_channels.c
===================================================================
RCS file: /cvsroot/mplayer/main/libaf/af_channels.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- af_channels.c	30 Oct 2002 09:05:02 -0000	1.6
+++ af_channels.c	31 Oct 2002 11:06:19 -0000	1.7
@@ -89,6 +89,11 @@
     af->mul.n        = af->data->nch;
     af->mul.d	     = ((af_data_t*)arg)->nch;
     return AF_OK;
+  case AF_CONTROL_COMMAND_LINE:{
+    int nch = 0;
+    sscanf((char*)arg,"%i",&nch);
+    return af->control(af,AF_CONTROL_CHANNELS,&nch);
+  }  
   case AF_CONTROL_CHANNELS: 
     // Reinit must be called after this function has been called
     

Index: af_delay.c
===================================================================
RCS file: /cvsroot/mplayer/main/libaf/af_delay.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- af_delay.c	16 Oct 2002 01:49:40 -0000	1.5
+++ af_delay.c	31 Oct 2002 11:06:19 -0000	1.6
@@ -32,6 +32,11 @@
     
     return af->control(af,AF_CONTROL_DELAY_SET_LEN,&((af_delay_t*)af->setup)->tlen);
   }
+  case AF_CONTROL_COMMAND_LINE:{
+    float d = 0;
+    sscanf((char*)arg,"%f",&d);
+    return af->control(af,AF_CONTROL_DELAY_SET_LEN,&d);
+  }  
   case AF_CONTROL_DELAY_SET_LEN:{
     af_delay_t* s  = (af_delay_t*)af->setup;
     void*       bt = s->buf; // Old buffer

Index: af_format.c
===================================================================
RCS file: /cvsroot/mplayer/main/libaf/af_format.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- af_format.c	12 Oct 2002 20:02:01 -0000	1.5
+++ af_format.c	31 Oct 2002 11:06:19 -0000	1.6
@@ -88,6 +88,11 @@
     af->mul.n      = af->data->bps;
     af->mul.d      = ((af_data_t*)arg)->bps;
     return AF_OK;
+  case AF_CONTROL_COMMAND_LINE:{
+    af_data_t d;
+    sscanf((char*)arg,"%i:%i",&(d.format),&(d.bps));
+    return af->control(af,AF_CONTROL_FORMAT,&d);
+  }  
   case AF_CONTROL_FORMAT:
     // Reinit must be called after this function has been called
     

Index: af_resample.c
===================================================================
RCS file: /cvsroot/mplayer/main/libaf/af_resample.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- af_resample.c	24 Oct 2002 17:34:01 -0000	1.11
+++ af_resample.c	31 Oct 2002 11:06:19 -0000	1.12
@@ -69,6 +69,8 @@
   uint32_t	i; 	// Number of new samples to put in x queue
   uint32_t  	dn;     // Down sampling factor
   uint32_t	up;	// Up sampling factor 
+  int		sloppy;	// Enable sloppy resampling to reduce memory usage
+  int		fast;	// Enable linear interpolation instead of filtering
 } af_resample_t;
 
 // Euclids algorithm for calculating Greatest Common Divisor GCD(a,b)
@@ -222,6 +224,19 @@
     // Calculate up and down sampling factors
     d=gcd(af->data->rate,n->rate);
 
+    // If sloppy resampling is enabled limit the upsampling factor
+    if(s->sloppy && (af->data->rate/d > 5000)){
+      int up=af->data->rate/2;
+      int dn=n->rate/2;
+      int m=2;
+      while(af->data->rate/(d*m) > 5000){
+	d=gcd(up,dn); 
+	up/=2; dn/=2; m*=2;
+      }
+      d*=m;
+    }
+    printf("\n%i %i %i\n",d,af->data->rate/d,n->rate/d);
+
     // Check if the the design needs to be redone
     if(s->up != af->data->rate/d || s->dn != n->rate/d){
       float* w;
@@ -263,6 +278,12 @@
     af->mul.n = s->up;
     af->mul.d = s->dn;
     return rv;
+  }
+  case AF_CONTROL_COMMAND_LINE:{
+    af_resample_t* s   = (af_resample_t*)af->setup; 
+    int rate=0;
+    sscanf((char*)arg,"%i:%i:%i",&rate,&(s->sloppy), &(s->fast));
+    return af->control(af,AF_CONTROL_RESAMPLE,&rate);
   }
   case AF_CONTROL_RESAMPLE: 
     // Reinit must be called after this function has been called




More information about the MPlayer-cvslog mailing list