diff options
Diffstat (limited to 'audio/filter/af_drc.c')
-rw-r--r-- | audio/filter/af_drc.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/audio/filter/af_drc.c b/audio/filter/af_drc.c index fad34ba500..3bcd368d4d 100644 --- a/audio/filter/af_drc.c +++ b/audio/filter/af_drc.c @@ -70,8 +70,8 @@ typedef struct af_volume_s // method 2 int idx; struct { - float avg; // average level of the sample - int len; // sample size (weight) + float avg; // average level of the sample + int len; // sample size (weight) } mem[NSAMPLES]; // "Ideal" level float mid_s16; @@ -100,8 +100,8 @@ static int control(struct af_instance* af, int cmd, void* arg) static void method1_int16(af_drc_t *s, struct mp_audio *c) { register int i = 0; - int16_t *data = (int16_t*)c->planes[0]; // Audio data - int len = c->samples*c->nch; // Number of samples + int16_t *data = (int16_t*)c->planes[0]; // Audio data + int len = c->samples*c->nch; // Number of samples float curavg = 0.0, newavg, neededmul; int tmp; @@ -142,8 +142,8 @@ static void method1_int16(af_drc_t *s, struct mp_audio *c) static void method1_float(af_drc_t *s, struct mp_audio *c) { register int i = 0; - float *data = (float*)c->planes[0]; // Audio data - int len = c->samples*c->nch; // Number of samples + float *data = (float*)c->planes[0]; // Audio data + int len = c->samples*c->nch; // Number of samples float curavg = 0.0, newavg, neededmul, tmp; for (i = 0; i < len; i++) @@ -179,8 +179,8 @@ static void method1_float(af_drc_t *s, struct mp_audio *c) static void method2_int16(af_drc_t *s, struct mp_audio *c) { register int i = 0; - int16_t *data = (int16_t*)c->planes[0]; // Audio data - int len = c->samples*c->nch; // Number of samples + int16_t *data = (int16_t*)c->planes[0]; // Audio data + int len = c->samples*c->nch; // Number of samples float curavg = 0.0, newavg, avg = 0.0; int tmp, totallen = 0; @@ -204,8 +204,8 @@ static void method2_int16(af_drc_t *s, struct mp_audio *c) avg /= (float)totallen; if (avg >= SIL_S16) { - s->mul = s->mid_s16 / avg; - s->mul = MPCLAMP(s->mul, MUL_MIN, MUL_MAX); + s->mul = s->mid_s16 / avg; + s->mul = MPCLAMP(s->mul, MUL_MIN, MUL_MAX); } } @@ -229,8 +229,8 @@ static void method2_int16(af_drc_t *s, struct mp_audio *c) static void method2_float(af_drc_t *s, struct mp_audio *c) { register int i = 0; - float *data = (float*)c->planes[0]; // Audio data - int len = c->samples*c->nch; // Number of samples + float *data = (float*)c->planes[0]; // Audio data + int len = c->samples*c->nch; // Number of samples float curavg = 0.0, newavg, avg = 0.0, tmp; int totallen = 0; @@ -254,8 +254,8 @@ static void method2_float(af_drc_t *s, struct mp_audio *c) avg /= (float)totallen; if (avg >= SIL_FLOAT) { - s->mul = s->mid_float / avg; - s->mul = MPCLAMP(s->mul, MUL_MIN, MUL_MAX); + s->mul = s->mid_float / avg; + s->mul = MPCLAMP(s->mul, MUL_MIN, MUL_MAX); } } @@ -279,16 +279,16 @@ static int filter(struct af_instance* af, struct mp_audio* data, int flags) if(af->data->format == (AF_FORMAT_S16)) { if (s->method == 2) - method2_int16(s, data); + method2_int16(s, data); else - method1_int16(s, data); + method1_int16(s, data); } else if(af->data->format == (AF_FORMAT_FLOAT)) { if (s->method == 2) - method2_float(s, data); + method2_float(s, data); else - method1_float(s, data); + method1_float(s, data); } return 0; } |