Showing the changes to libavfilter (1 of 1 file). Show all
Unified · Split
| @@ -120,7 +120,8 @@ typedef struct BiquadsContext { · 119 unmodified lines | |||
| 120 | 120 | ||
| 121 | void (*filter)(struct BiquadsContext *s, const void *ibuf, void *obuf, int len, | 121 | void (*filter)(struct BiquadsContext *s, const void *ibuf, void *obuf, int len, |
| 122 | double *i1, double *i2, double *o1, double *o2, | 122 | double *i1, double *i2, double *o1, double *o2, |
| 123 | double b0, double b1, double b2, double a1, double a2, int *clippings); | 123 | double b0, double b1, double b2, double a1, double a2, int *clippings, |
| 124 | int disabled); | ||
| 124 | } BiquadsContext; | 125 | } BiquadsContext; |
| 125 | 126 | ||
| 126 | static av_cold int init(AVFilterContext *ctx) | 127 | static av_cold int init(AVFilterContext *ctx) |
| @@ -177,7 +178,8 @@ static void biquad_## name (BiquadsContext *s, \ · 50 unmodified lines | |||
| 177 | double *in1, double *in2, \ | 178 | double *in1, double *in2, \ |
| 178 | double *out1, double *out2, \ | 179 | double *out1, double *out2, \ |
| 179 | double b0, double b1, double b2, \ | 180 | double b0, double b1, double b2, \ |
| 180 | double a1, double a2, int *clippings) \ | 181 | double a1, double a2, int *clippings, \ |
| 182 | int disabled) \ | ||
| 181 | { \ | 183 | { \ |
| 182 | const type *ibuf = input; \ | 184 | const type *ibuf = input; \ |
| 183 | type *obuf = output; \ | 185 | type *obuf = output; \ |
| @@ -192,7 +194,9 @@ static void biquad_## name (BiquadsContext *s, \ · 8 unmodified lines | |||
| 192 | for (i = 0; i+1 < len; i++) { \ | 194 | for (i = 0; i+1 < len; i++) { \ |
| 193 | o2 = i2 * b2 + i1 * b1 + ibuf[i] * b0 + o2 * a2 + o1 * a1; \ | 195 | o2 = i2 * b2 + i1 * b1 + ibuf[i] * b0 + o2 * a2 + o1 * a1; \ |
| 194 | i2 = ibuf[i]; \ | 196 | i2 = ibuf[i]; \ |
| 195 | if (need_clipping && o2 < min) { \ | 197 | if (disabled) { \ |
| 198 | obuf[i] = i2; \ | ||
| 199 | } else if (need_clipping && o2 < min) { \ | ||
| 196 | (*clippings)++; \ | 200 | (*clippings)++; \ |
| 197 | obuf[i] = min; \ | 201 | obuf[i] = min; \ |
| 198 | } else if (need_clipping && o2 > max) { \ | 202 | } else if (need_clipping && o2 > max) { \ |
| @@ -204,7 +208,9 @@ static void biquad_## name (BiquadsContext *s, \ · 5 unmodified lines | |||
| 204 | i++; \ | 208 | i++; \ |
| 205 | o1 = i1 * b2 + i2 * b1 + ibuf[i] * b0 + o1 * a2 + o2 * a1; \ | 209 | o1 = i1 * b2 + i2 * b1 + ibuf[i] * b0 + o1 * a2 + o2 * a1; \ |
| 206 | i1 = ibuf[i]; \ | 210 | i1 = ibuf[i]; \ |
| 207 | if (need_clipping && o1 < min) { \ | 211 | if (disabled) { \ |
| 212 | obuf[i] = i1; \ | ||
| 213 | } else if (need_clipping && o1 < min) { \ | ||
| 208 | (*clippings)++; \ | 214 | (*clippings)++; \ |
| 209 | obuf[i] = min; \ | 215 | obuf[i] = min; \ |
| 210 | } else if (need_clipping && o1 > max) { \ | 216 | } else if (need_clipping && o1 > max) { \ |
| @@ -220,7 +226,9 @@ static void biquad_## name (BiquadsContext *s, \ · 9 unmodified lines | |||
| 220 | i1 = ibuf[i]; \ | 226 | i1 = ibuf[i]; \ |
| 221 | o2 = o1; \ | 227 | o2 = o1; \ |
| 222 | o1 = o0; \ | 228 | o1 = o0; \ |
| 223 | if (need_clipping && o0 < min) { \ | 229 | if (disabled) { \ |
| 230 | obuf[i] = i1; \ | ||
| 231 | } else if (need_clipping && o0 < min) { \ | ||
| 224 | (*clippings)++; \ | 232 | (*clippings)++; \ |
| 225 | obuf[i] = min; \ | 233 | obuf[i] = min; \ |
| 226 | } else if (need_clipping && o0 > max) { \ | 234 | } else if (need_clipping && o0 > max) { \ |
| @@ -442,7 +450,7 @@ static int filter_channel(AVFilterContext *ctx, void *arg, int jobnr, int nb_job · 215 unmodified lines | |||
| 442 | 450 | ||
| 443 | s->filter(s, buf->extended_data[ch], out_buf->extended_data[ch], buf->nb_samples, | 451 | s->filter(s, buf->extended_data[ch], out_buf->extended_data[ch], buf->nb_samples, |
| 444 | &s->cache[ch].i1, &s->cache[ch].i2, &s->cache[ch].o1, &s->cache[ch].o2, | 452 | &s->cache[ch].i1, &s->cache[ch].i2, &s->cache[ch].o1, &s->cache[ch].o2, |
| 445 | s->b0, s->b1, s->b2, s->a1, s->a2, &s->cache[ch].clippings); | 453 | s->b0, s->b1, s->b2, s->a1, s->a2, &s->cache[ch].clippings, ctx->is_disabled); |
| 446 | } | 454 | } |
| 447 | 455 | ||
| 448 | return 0; | 456 | return 0; |
| @@ -653,7 +661,7 @@ AVFilter ff_af_##name_ = { \ · 204 unmodified lines | |||
| 653 | .outputs = outputs, \ | 661 | .outputs = outputs, \ |
| 654 | .priv_class = &name_##_class, \ | 662 | .priv_class = &name_##_class, \ |
| 655 | .process_command = process_command, \ | 663 | .process_command = process_command, \ |
| 656 | .flags = AVFILTER_FLAG_SLICE_THREADS, \ | 664 | .flags = AVFILTER_FLAG_SLICE_THREADS | AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, \ |
| 657 | } | 665 | } |
| 658 | 666 | ||
| 659 | #if CONFIG_EQUALIZER_FILTER | 667 | #if CONFIG_EQUALIZER_FILTER |