summaryrefslogtreecommitdiff
path: root/libavfilter/af_compand.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2015-12-01 20:09:08 +0100
committerPaul B Mahol <onemda@gmail.com>2015-12-02 23:41:26 +0100
commitb2517b02d99054b18398427ba890fee582a8c7bf (patch)
tree3bb34b9c73227571a5f5d02ff90779902255db6a /libavfilter/af_compand.c
parent259c71c199e9b4ea89bf4cb90ed0e207ddc9dff7 (diff)
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>
Diffstat (limited to 'libavfilter/af_compand.c')
-rw-r--r--libavfilter/af_compand.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/libavfilter/af_compand.c b/libavfilter/af_compand.c
index a64778e5ec..68b1fae81e 100644
--- a/libavfilter/af_compand.c
+++ b/libavfilter/af_compand.c
@@ -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;