diff options
Diffstat (limited to 'libavfilter')
-rw-r--r-- | libavfilter/af_biquads.c | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/libavfilter/af_biquads.c b/libavfilter/af_biquads.c index 123d7a2..1f4d635 100644 --- a/libavfilter/af_biquads.c +++ b/libavfilter/af_biquads.c @@ -182,7 +182,32 @@ static void biquad_## name (const void *input, void *output, int len, \ double o2 = *out2; \ int i; \ \ - for (i = 0; i < len; i++) { \ + for (i = 0; i+1 < len; i++) { \ + o2 = i2 * b2 + i1 * b1 + ibuf[i] * b0 - o2 * a2 - o1 * a1; \ + i2 = ibuf[i]; \ + if (o2 < min) { \ + av_log(NULL, AV_LOG_WARNING, "clipping\n"); \ + obuf[i] = min; \ + } else if (o2 > max) { \ + av_log(NULL, AV_LOG_WARNING, "clipping\n"); \ + obuf[i] = max; \ + } else { \ + obuf[i] = o2; \ + } \ + i++; \ + o1 = i1 * b2 + i2 * b1 + ibuf[i] * b0 - o1 * a2 - o2 * a1; \ + i1 = ibuf[i]; \ + if (o1 < min) { \ + av_log(NULL, AV_LOG_WARNING, "clipping\n"); \ + obuf[i] = min; \ + } else if (o1 > max) { \ + av_log(NULL, AV_LOG_WARNING, "clipping\n"); \ + obuf[i] = max; \ + } else { \ + obuf[i] = o1; \ + } \ + } \ + if (i < len) { \ double o0 = ibuf[i] * b0 + i1 * b1 + i2 * b2 - o1 * a1 - o2 * a2; \ i2 = i1; \ i1 = ibuf[i]; \ |