[Mplayer-cvslog] CVS: main/libaf af.h,1.13,1.14 af_comp.c,1.2,1.3 af_gate.c,1.2,1.3 af_tools.c,1.2,1.3 af_pan.c,1.1,1.2
Anders Johansson CVS
anders at mplayerhq.hu
Tue Dec 31 06:42:30 CET 2002
Update of /cvsroot/mplayer/main/libaf
In directory mail:/var/tmp.root/cvs-serv23367
Modified Files:
af.h af_comp.c af_gate.c af_tools.c af_pan.c
Log Message:
10l memory leak + bug fixes in ms to sample time conversion
Index: af.h
===================================================================
RCS file: /cvsroot/mplayer/main/libaf/af.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- af.h 28 Dec 2002 13:59:53 -0000 1.13
+++ af.h 31 Dec 2002 05:42:20 -0000 1.14
@@ -187,9 +187,9 @@
AF_OK if of and AF_ERROR if fail */
int af_to_dB(int n, float* in, float* out, float k);
/* Helper function used to convert from ms to sample time*/
-int af_from_ms(int n, float* in, float* out, int rate, float mi, float ma);
+int af_from_ms(int n, float* in, int* out, int rate, float mi, float ma);
/* Helper function used to convert from sample time to ms */
-int af_to_ms(int n, float* in, float* out, int rate);
+int af_to_ms(int n, int* in, float* out, int rate);
/* Helper function for testing the output format */
int af_test_output(struct af_instance_s* af, af_data_t* out);
Index: af_comp.c
===================================================================
RCS file: /cvsroot/mplayer/main/libaf/af_comp.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- af_comp.c 28 Dec 2002 18:50:56 -0000 1.2
+++ af_comp.c 31 Dec 2002 05:42:20 -0000 1.3
@@ -26,8 +26,8 @@
float time[AF_NCH]; // Forgetting factor for power estimate
float pow[AF_NCH]; // Estimated power level [dB]
float tresh[AF_NCH]; // Threshold [dB]
- float attack[AF_NCH]; // Attack time [ms]
- float release[AF_NCH]; // Release time [ms]
+ int attack[AF_NCH]; // Attack time [ms]
+ int release[AF_NCH]; // Release time [ms]
float ratio[AF_NCH]; // Compression ratio
}af_comp_t;
Index: af_gate.c
===================================================================
RCS file: /cvsroot/mplayer/main/libaf/af_gate.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- af_gate.c 28 Dec 2002 18:50:56 -0000 1.2
+++ af_gate.c 31 Dec 2002 05:42:20 -0000 1.3
@@ -26,8 +26,8 @@
float time[AF_NCH]; // Forgetting factor for power estimate
float pow[AF_NCH]; // Estimated power level [dB]
float tresh[AF_NCH]; // Threshold [dB]
- float attack[AF_NCH]; // Attack time [ms]
- float release[AF_NCH]; // Release time [ms]
+ int attack[AF_NCH]; // Attack time [ms]
+ int release[AF_NCH]; // Release time [ms]
float range[AF_NCH]; // Range level [dB]
}af_gate_t;
Index: af_tools.c
===================================================================
RCS file: /cvsroot/mplayer/main/libaf/af_tools.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- af_tools.c 28 Dec 2002 18:50:56 -0000 1.2
+++ af_tools.c 31 Dec 2002 05:42:20 -0000 1.3
@@ -29,7 +29,7 @@
if(!in || !out)
return AF_ERROR;
- for(i=0;i<AF_NCH;i++){
+ for(i=0;i<n;i++){
if(in[i] == 0.0)
out[i]=-200.0;
else
@@ -38,30 +38,30 @@
return AF_OK;
}
-/* Convert from ms to sample time*/
-inline int af_from_ms(int n, float* in, float* out, int rate, float mi, float ma)
+/* Convert from ms to sample time */
+inline int af_from_ms(int n, float* in, int* out, int rate, float mi, float ma)
{
int i = 0;
// Sanity check
if(!in || !out)
return AF_ERROR;
- for(i=0;i<AF_NCH;i++)
- out[i]=clamp(in[i],ma,mi);
+ for(i=0;i<n;i++)
+ out[i]=(int)((float)rate * clamp(in[i],mi,ma)/1000.0);
return AF_OK;
}
/* Convert from sample time to ms */
-inline int af_to_ms(int n, float* in, float* out, int rate)
+inline int af_to_ms(int n, int* in, float* out, int rate)
{
int i = 0;
// Sanity check
- if(!in || !out)
+ if(!in || !out || !rate)
return AF_ERROR;
- for(i=0;i<AF_NCH;i++)
- out[i]=in[i];
+ for(i=0;i<n;i++)
+ out[i]=1000.0 * (float)in[i]/((float)rate);
return AF_OK;
}
Index: af_pan.c
===================================================================
RCS file: /cvsroot/mplayer/main/libaf/af_pan.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- af_pan.c 28 Dec 2002 13:59:53 -0000 1.1
+++ af_pan.c 31 Dec 2002 05:42:20 -0000 1.2
@@ -113,6 +113,8 @@
// Deallocate memory
static void uninit(struct af_instance_s* af)
{
+ if(af->data->audio)
+ free(af->data->audio);
if(af->data)
free(af->data);
if(af->setup)
More information about the MPlayer-cvslog
mailing list