Unified · Split
| @@ -120,7 +120,8 @@ typedef struct BiquadsContext { · 119 unmodified lines | ||
| 120 | 120 | |
| 121 | 121 | void (*filter)(struct BiquadsContext *s, const void *ibuf, void *obuf, int len, |
| 122 | 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 | 125 | } BiquadsContext; |
| 125 | 126 | |
| 126 | 127 | static av_cold int init(AVFilterContext *ctx) |
| @@ -177,7 +178,8 @@ static void biquad_## name (BiquadsContext *s, \ · 50 unmodified lines | ||
| 177 | 178 | double *in1, double *in2, \ |
| 178 | 179 | double *out1, double *out2, \ |
| 179 | 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 | 184 | const type *ibuf = input; \ |
| 183 | 185 | type *obuf = output; \ |
| @@ -192,7 +194,9 @@ static void biquad_## name (BiquadsContext *s, \ · 8 unmodified lines | ||
| 192 | 194 | for (i = 0; i+1 < len; i++) { \ |
| 193 | 195 | o2 = i2 * b2 + i1 * b1 + ibuf[i] * b0 + o2 * a2 + o1 * a1; \ |
| 194 | 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 | 200 | (*clippings)++; \ |
| 197 | 201 | obuf[i] = min; \ |
| 198 | 202 | } else if (need_clipping && o2 > max) { \ |
| @@ -204,7 +208,9 @@ static void biquad_## name (BiquadsContext *s, \ · 5 unmodified lines | ||
| 204 | 208 | i++; \ |
| 205 | 209 | o1 = i1 * b2 + i2 * b1 + ibuf[i] * b0 + o1 * a2 + o2 * a1; \ |
| 206 | 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 | 214 | (*clippings)++; \ |
| 209 | 215 | obuf[i] = min; \ |
| 210 | 216 | } else if (need_clipping && o1 > max) { \ |
| @@ -220,7 +226,9 @@ static void biquad_## name (BiquadsContext *s, \ · 9 unmodified lines | ||
| 220 | 226 | i1 = ibuf[i]; \ |
| 221 | 227 | o2 = o1; \ |
| 222 | 228 | o1 = o0; \ |
| 223 | − if (need_clipping && o0 < min) { \ | |
| 229 | + if (disabled) { \ | |
| 230 | + obuf[i] = i1; \ | |
| 231 | + } else if (need_clipping && o0 < min) { \ | |
| 224 | 232 | (*clippings)++; \ |
| 225 | 233 | obuf[i] = min; \ |
| 226 | 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 | 451 | s->filter(s, buf->extended_data[ch], out_buf->extended_data[ch], buf->nb_samples, |
| 444 | 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 | 456 | return 0; |
| @@ -653,7 +661,7 @@ AVFilter ff_af_##name_ = { \ · 204 unmodified lines | ||
| 653 | 661 | .outputs = outputs, \ |
| 654 | 662 | .priv_class = &name_##_class, \ |
| 655 | 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 | 667 | #if CONFIG_EQUALIZER_FILTER |