Browse Source

avfilter/af_compand: do not clip; allow >0dB curve points

Do not clip output samples, so that clipping can be handled by other filters.
Alow setting curve points above 0dB. This is useful when operating with floats.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
tags/n3.0
Paul B Mahol 10 years ago
parent
commit
b2517b02d9
1 changed files with 5 additions and 7 deletions
  1. +5
    -7
      libavfilter/af_compand.c

+ 5
- 7
libavfilter/af_compand.c View File

@@ -205,7 +205,7 @@ static int compand_nodelay(AVFilterContext *ctx, AVFrame *frame)
for (i = 0; i < nb_samples; i++) {
update_volume(cp, fabs(src[i]));

dst[i] = av_clipd(src[i] * get_volume(s, cp->volume), -1, 1);
dst[i] = src[i] * get_volume(s, cp->volume);
}
}

@@ -266,8 +266,7 @@ static int compand_delay(AVFilterContext *ctx, AVFrame *frame)
}

dst = (double *)out_frame->extended_data[chan];
dst[oindex++] = av_clipd(dbuf[dindex] *
get_volume(s, cp->volume), -1, 1);
dst[oindex++] = dbuf[dindex] * get_volume(s, cp->volume);
} else {
count++;
}
@@ -315,8 +314,7 @@ static int compand_drain(AVFilterLink *outlink)

dindex = s->delay_index;
for (i = 0; i < frame->nb_samples; i++) {
dst[i] = av_clipd(dbuf[dindex] * get_volume(s, cp->volume),
-1, 1);
dst[i] = dbuf[dindex] * get_volume(s, cp->volume);
dindex = MOD(dindex + 1, s->delay_samples);
}
}
@@ -450,14 +448,14 @@ static int config_output(AVFilterLink *outlink)
S(j) = S(j + 1);
}

for (i = 0; !i || s->segments[i - 2].x; i += 2) {
for (i = 0; i < s->nb_segments; i += 2) {
s->segments[i].y += s->gain_dB;
s->segments[i].x *= M_LN10 / 20;
s->segments[i].y *= M_LN10 / 20;
}

#define L(x) s->segments[i - (x)]
for (i = 4; s->segments[i - 2].x; i += 2) {
for (i = 4; i < s->nb_segments; i += 2) {
double x, y, cx, cy, in1, in2, out1, out2, theta, len, r;

L(4).a = 0;


Loading…
Cancel
Save