[MPlayer-cvslog] r36493 - in trunk/libaf: af_volume.c control.h
reimar
subversion at mplayerhq.hu
Sat Oct 26 12:23:03 CEST 2013
Author: reimar
Date: Sat Oct 26 12:23:03 2013
New Revision: 36493
Log:
Remove unused per-channel enable.
It makes it hard to vectorize or otherwise optimize the code.
Modified:
trunk/libaf/af_volume.c
trunk/libaf/control.h
Modified: trunk/libaf/af_volume.c
==============================================================================
--- trunk/libaf/af_volume.c Sat Oct 26 12:16:09 2013 (r36492)
+++ trunk/libaf/af_volume.c Sat Oct 26 12:23:03 2013 (r36493)
@@ -43,7 +43,6 @@
// Data for specific instances of this filter
typedef struct af_volume_s
{
- int enable[AF_NCH]; // Enable/disable / channel
float max[AF_NCH]; // Max Power level [dB]
float level[AF_NCH]; // Gain level for each channel
int soft; // Enable/disable soft clipping
@@ -84,12 +83,6 @@ static int control(struct af_instance_s*
s->fast = ((((af_cfg_t*)arg)->force & AF_INIT_FORMAT_MASK) ==
AF_INIT_FLOAT) ? 0 : 1;
return AF_OK;
- case AF_CONTROL_VOLUME_ON_OFF | AF_CONTROL_SET:
- memcpy(s->enable,(int*)arg,AF_NCH*sizeof(int));
- return AF_OK;
- case AF_CONTROL_VOLUME_ON_OFF | AF_CONTROL_GET:
- memcpy((int*)arg,s->enable,AF_NCH*sizeof(int));
- return AF_OK;
case AF_CONTROL_VOLUME_SOFTCLIP | AF_CONTROL_SET:
s->soft = *(int*)arg;
return AF_OK;
@@ -136,13 +129,11 @@ static af_data_t* play(struct af_instanc
int16_t* a = (int16_t*)c->audio; // Audio data
int len = c->len/2; // Number of samples
for(ch = 0; ch < nch ; ch++){
- if(s->enable[ch]){
register int vol = (int)(255.0 * s->level[ch]);
for(i=ch;i<len;i+=nch){
register int x = (a[i] * vol) >> 8;
a[i]=av_clip_int16(x);
}
- }
}
}
// Machine is fast and data is floating point
@@ -151,7 +142,6 @@ static af_data_t* play(struct af_instanc
int len = c->len/4; // Number of samples
for(ch = 0; ch < nch ; ch++){
// Volume control (fader)
- if(s->enable[ch]){
for(i=ch;i<len;i+=nch){
register float x = a[i];
register float pow = x*x;
@@ -169,7 +159,6 @@ static af_data_t* play(struct af_instanc
x=av_clipf(x,-1.0,1.0);
a[i] = x;
}
- }
}
}
return c;
@@ -188,7 +177,6 @@ static int af_open(af_instance_t* af){
return AF_ERROR;
// Enable volume control and set initial volume to 0dB.
for(i=0;i<AF_NCH;i++){
- ((af_volume_t*)af->setup)->enable[i] = 1;
((af_volume_t*)af->setup)->level[i] = 1.0;
}
return AF_OK;
Modified: trunk/libaf/control.h
==============================================================================
--- trunk/libaf/control.h Sat Oct 26 12:16:09 2013 (r36492)
+++ trunk/libaf/control.h Sat Oct 26 12:23:03 2013 (r36493)
@@ -156,9 +156,6 @@ typedef struct af_control_ext_s{
// Volume
-// Turn volume control on and off, arg is int*
-#define AF_CONTROL_VOLUME_ON_OFF 0x00000B00 | AF_CONTROL_FILTER_SPECIFIC
-
// Turn soft clipping of the volume on and off, arg is binary
#define AF_CONTROL_VOLUME_SOFTCLIP 0x00000C00 | AF_CONTROL_FILTER_SPECIFIC
More information about the MPlayer-cvslog
mailing list