History

avfilter/af_biquads: add timeline support

Paul B Mahol committed 7 years ago

Commit 255feec1 parent 01204c01 file · +15 −7Browse files

Unified · Split

libavfilter/af_biquads.c+15−7
@@ -120,7 +120,8 @@ typedef struct BiquadsContext { · 119 unmodified lines
120120
121121 void (*filter)(struct BiquadsContext *s, const void *ibuf, void *obuf, int len,
122122 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);
124125 } BiquadsContext;
125126
126127 static av_cold int init(AVFilterContext *ctx)
@@ -177,7 +178,8 @@ static void biquad_## name (BiquadsContext *s, \ · 50 unmodified lines
177178 double *in1, double *in2, \
178179 double *out1, double *out2, \
179180 double b0, double b1, double b2, \
180− double a1, double a2, int *clippings) \
181+ double a1, double a2, int *clippings, \
182+ int disabled) \
181183 { \
182184 const type *ibuf = input; \
183185 type *obuf = output; \
@@ -192,7 +194,9 @@ static void biquad_## name (BiquadsContext *s, \ · 8 unmodified lines
192194 for (i = 0; i+1 < len; i++) { \
193195 o2 = i2 * b2 + i1 * b1 + ibuf[i] * b0 + o2 * a2 + o1 * a1; \
194196 i2 = ibuf[i]; \
195− if (need_clipping && o2 < min) { \
197+ if (disabled) { \
198+ obuf[i] = i2; \
199+ } else if (need_clipping && o2 < min) { \
196200 (*clippings)++; \
197201 obuf[i] = min; \
198202 } else if (need_clipping && o2 > max) { \
@@ -204,7 +208,9 @@ static void biquad_## name (BiquadsContext *s, \ · 5 unmodified lines
204208 i++; \
205209 o1 = i1 * b2 + i2 * b1 + ibuf[i] * b0 + o1 * a2 + o2 * a1; \
206210 i1 = ibuf[i]; \
207− if (need_clipping && o1 < min) { \
211+ if (disabled) { \
212+ obuf[i] = i1; \
213+ } else if (need_clipping && o1 < min) { \
208214 (*clippings)++; \
209215 obuf[i] = min; \
210216 } else if (need_clipping && o1 > max) { \
@@ -220,7 +226,9 @@ static void biquad_## name (BiquadsContext *s, \ · 9 unmodified lines
220226 i1 = ibuf[i]; \
221227 o2 = o1; \
222228 o1 = o0; \
223− if (need_clipping && o0 < min) { \
229+ if (disabled) { \
230+ obuf[i] = i1; \
231+ } else if (need_clipping && o0 < min) { \
224232 (*clippings)++; \
225233 obuf[i] = min; \
226234 } 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
442450
443451 s->filter(s, buf->extended_data[ch], out_buf->extended_data[ch], buf->nb_samples,
444452 &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);
446454 }
447455
448456 return 0;
@@ -653,7 +661,7 @@ AVFilter ff_af_##name_ = { \ · 204 unmodified lines
653661 .outputs = outputs, \
654662 .priv_class = &name_##_class, \
655663 .process_command = process_command, \
656− .flags = AVFILTER_FLAG_SLICE_THREADS, \
664+ .flags = AVFILTER_FLAG_SLICE_THREADS | AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, \
657665 }
658666
659667 #if CONFIG_EQUALIZER_FILTER

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t