[FFmpeg-cvslog] avfilter/af_compand: do not clip; allow >0dB curve points
Paul B Mahol
git at videolan.org
Wed Dec 2 23:44:27 CET 2015
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Tue Dec 1 20:09:08 2015 +0100| [b2517b02d99054b18398427ba890fee582a8c7bf] | committer: Paul B Mahol
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 at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b2517b02d99054b18398427ba890fee582a8c7bf
---
libavfilter/af_compand.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/libavfilter/af_compand.c b/libavfilter/af_compand.c
index a64778e..68b1fae 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;
More information about the ffmpeg-cvslog
mailing list