65 #include "config_components.h"
176 switch (
s->precision) {
190 sample_fmts_list = auto_sample_fmts;
200 #define BIQUAD_FILTER(name, type, ftype, min, max, need_clipping) \
201 static void biquad_## name (BiquadsContext *s, \
202 const void *input, void *output, int len, \
203 void *cache, int *clippings, int disabled) \
205 const type *ibuf = input; \
206 type *obuf = output; \
207 ftype *fcache = cache; \
208 ftype i1 = fcache[0], i2 = fcache[1], o1 = fcache[2], o2 = fcache[3]; \
209 ftype *a = s->a_##ftype; \
210 ftype *b = s->b_##ftype; \
216 ftype wet = s->mix; \
217 ftype dry = 1. - wet; \
221 for (i = 0; i+1 < len; i++) { \
222 o2 = i2 * b2 + i1 * b1 + ibuf[i] * b0 + o2 * a2 + o1 * a1; \
224 out = o2 * wet + i2 * dry; \
227 } else if (need_clipping && out < min) { \
230 } else if (need_clipping && out > max) { \
237 o1 = i1 * b2 + i2 * b1 + ibuf[i] * b0 + o1 * a2 + o2 * a1; \
239 out = o1 * wet + i1 * dry; \
242 } else if (need_clipping && out < min) { \
245 } else if (need_clipping && out > max) { \
253 ftype o0 = ibuf[i] * b0 + i1 * b1 + i2 * b2 + o1 * a1 + o2 * a2; \
258 out = o0 * wet + i1 * dry; \
261 } else if (need_clipping && out < min) { \
264 } else if (need_clipping && out > max) { \
282 #define BIQUAD_DII_FILTER(name, type, ftype, min, max, need_clipping) \
283 static void biquad_dii_## name (BiquadsContext *s, \
284 const void *input, void *output, int len, \
285 void *cache, int *clippings, int disabled) \
287 const type *ibuf = input; \
288 type *obuf = output; \
289 ftype *fcache = cache; \
290 ftype *a = s->a_##ftype; \
291 ftype *b = s->b_##ftype; \
297 ftype w1 = fcache[0]; \
298 ftype w2 = fcache[1]; \
299 ftype wet = s->mix; \
300 ftype dry = 1. - wet; \
303 for (int i = 0; i < len; i++) { \
305 w0 = in + a1 * w1 + a2 * w2; \
306 out = b0 * w0 + b1 * w1 + b2 * w2; \
309 out = out * wet + in * dry; \
312 } else if (need_clipping && out < min) { \
315 } else if (need_clipping && out > max) { \
331 #define BIQUAD_TDI_FILTER(name, type, ftype, min, max, need_clipping) \
332 static void biquad_tdi_## name (BiquadsContext *s, \
333 const void *input, void *output, int len, \
334 void *cache, int *clippings, int disabled) \
336 const type *ibuf = input; \
337 type *obuf = output; \
338 ftype *fcache = cache; \
339 ftype *a = s->a_##ftype; \
340 ftype *b = s->b_##ftype; \
346 ftype s1 = fcache[0]; \
347 ftype s2 = fcache[1]; \
348 ftype s3 = fcache[2]; \
349 ftype s4 = fcache[3]; \
350 ftype wet = s->mix; \
351 ftype dry = 1. - wet; \
354 for (int i = 0; i < len; i++) { \
355 ftype t1, t2, t3, t4; \
361 out = b0 * in + s3; \
362 out = out * wet + in * dry; \
363 s1 = t1; s2 = t2; s3 = t3; s4 = t4; \
366 } else if (need_clipping && out < min) { \
369 } else if (need_clipping && out > max) { \
388 #define BIQUAD_TDII_FILTER(name, type, ftype, min, max, need_clipping) \
389 static void biquad_tdii_## name (BiquadsContext *s, \
390 const void *input, void *output, int len, \
391 void *cache, int *clippings, int disabled) \
393 const type *ibuf = input; \
394 type *obuf = output; \
395 ftype *fcache = cache; \
396 ftype *a = s->a_##ftype; \
397 ftype *b = s->b_##ftype; \
403 ftype w1 = fcache[0]; \
404 ftype w2 = fcache[1]; \
405 ftype wet = s->mix; \
406 ftype dry = 1. - wet; \
409 for (int i = 0; i < len; i++) { \
411 out = b0 * in + w1; \
412 w1 = b1 * in + w2 + a1 * out; \
413 w2 = b2 * in + a2 * out; \
414 out = out * wet + in * dry; \
417 } else if (need_clipping && out < min) { \
420 } else if (need_clipping && out > max) { \
436 #define BIQUAD_LATT_FILTER(name, type, ftype, min, max, need_clipping) \
437 static void biquad_latt_## name (BiquadsContext *s, \
438 const void *input, void *output, int len, \
439 void *cache, int *clippings, int disabled) \
441 const type *ibuf = input; \
442 type *obuf = output; \
443 ftype *fcache = cache; \
444 ftype *a = s->a_##ftype; \
445 ftype *b = s->b_##ftype; \
451 ftype s0 = fcache[0]; \
452 ftype s1 = fcache[1]; \
453 ftype wet = s->mix; \
454 ftype dry = 1. - wet; \
458 for (int i = 0; i < len; i++) { \
473 out = out * wet + in * dry; \
476 } else if (need_clipping && out < min) { \
479 } else if (need_clipping && out > max) { \
495 #define BIQUAD_SVF_FILTER(name, type, ftype, min, max, need_clipping) \
496 static void biquad_svf_## name (BiquadsContext *s, \
497 const void *input, void *output, int len, \
498 void *cache, int *clippings, int disabled) \
500 const type *ibuf = input; \
501 type *obuf = output; \
502 ftype *fcache = cache; \
503 ftype *a = s->a_##ftype; \
504 ftype *b = s->b_##ftype; \
510 ftype s0 = fcache[0]; \
511 ftype s1 = fcache[1]; \
512 ftype wet = s->mix; \
513 ftype dry = 1. - wet; \
517 for (int i = 0; i < len; i++) { \
519 out = b2 * in + s0; \
520 t0 = b0 * in + a1 * s0 + s1; \
521 t1 = b1 * in + a2 * s0; \
525 out = out * wet + in * dry; \
528 } else if (need_clipping && out < min) { \
531 } else if (need_clipping && out > max) { \
547 #define BIQUAD_ZDF_FILTER(name, type, ftype, min, max, need_clipping, two) \
548 static void biquad_zdf_## name (BiquadsContext *s, \
549 const void *input, void *output, int len, \
550 void *cache, int *clippings, int disabled) \
552 const type *ibuf = input; \
553 type *obuf = output; \
554 ftype *fcache = cache; \
555 ftype *a = s->a_##ftype; \
556 ftype *b = s->b_##ftype; \
563 ftype b0 = fcache[0]; \
564 ftype b1 = fcache[1]; \
565 ftype wet = s->mix; \
566 ftype dry = 1. - wet; \
569 for (int i = 0; i < len; i++) { \
570 const ftype in = ibuf[i]; \
571 const ftype v0 = in; \
572 const ftype v3 = v0 - b1; \
573 const ftype v1 = a0 * b0 + a1 * v3; \
574 const ftype v2 = b1 + a1 * b0 + a2 * v3; \
576 b0 = two * v1 - b0; \
577 b1 = two * v2 - b1; \
579 out = m0 * v0 + m1 * v1 + m2 * v2; \
580 out = out * wet + in * dry; \
583 } else if (need_clipping && out < min) { \
586 } else if (need_clipping && out > max) { \
604 double k0, k1,
v0, v1, v2;
607 k0 =
s->a_double[1] / (1. + k1);
609 v1 =
s->b_double[1] - v2 *
s->a_double[1];
610 v0 =
s->b_double[0] - v1 * k0 - v2 * k1;
624 a[0] = -
s->a_double[1];
625 a[1] = -
s->a_double[2];
626 b[0] =
s->b_double[1] -
s->a_double[1] *
s->b_double[0];
627 b[1] =
s->b_double[2] -
s->a_double[2] *
s->b_double[0];
628 b[2] =
s->b_double[0];
630 s->a_double[1] =
a[0];
631 s->a_double[2] =
a[1];
632 s->b_double[0] =
b[0];
633 s->b_double[1] =
b[1];
634 s->b_double[2] =
b[2];
659 ret = 1. / (2. * sinh(
log(2.) / 2. *
width * w0 / sin(w0)));
662 ret = 1. / sqrt((
A + 1. /
A) * (1. /
width - 1.) + 2.);
679 switch (
s->filter_type) {
692 a[0] = 1. / (1. +
g * (
g + k));
696 m[1] = k * (
A *
A - 1.);
704 a[0] = 1. / (1. +
g * (
g + k));
715 a[0] = 1. / (1. +
g * (
g + k));
719 m[1] = k * (
A - 1.) /
A;
720 m[2] = (
A *
A - 1.) /
A;
727 a[0] = 1. / (1. +
g * (
g + k));
731 m[1] = k * (1. -
A) *
A;
737 a[0] = 1. / (1. +
g * (
g + k));
741 m[1] =
s->csg ? 1. : k;
747 a[0] = 1. / (1. +
g * (
g + k));
757 a[0] = 1. / (1. +
g * (
g + k));
767 a[0] = 1. / (1. +
g * (
g + k));
777 a[0] = 1. / (1. +
g * (
g + k));
788 s->a_double[0] =
a[0];
789 s->a_double[1] =
a[1];
790 s->a_double[2] =
a[2];
791 s->b_double[0] = m[0];
792 s->b_double[1] = m[1];
793 s->b_double[2] = m[2];
803 double w0 = 2 *
M_PI *
s->frequency /
inlink->sample_rate;
804 double K = tan(w0 / 2.);
807 s->bypass = (((w0 >
M_PI || w0 <= 0.) && reset) || (
s->width <= 0.)) && (
s->filter_type !=
biquad);
813 if ((w0 >
M_PI || w0 <= 0.) && (
s->filter_type !=
biquad))
816 switch (
s->width_type) {
821 alpha = sin(w0) / (2 *
s->frequency /
s->width);
824 alpha = sin(w0) / (2 *
s->frequency / (
s->width * 1000));
827 alpha = sin(w0) * sinh(
log(2.) / 2 *
s->width * w0 / sin(w0));
830 alpha = sin(w0) / (2 *
s->width);
833 alpha = sin(w0) / 2 * sqrt((
A + 1 /
A) * (1 /
s->width - 1) + 2);
841 switch (
s->filter_type) {
843 s->a_double[0] =
s->oa[0];
844 s->a_double[1] =
s->oa[1];
845 s->a_double[2] =
s->oa[2];
846 s->b_double[0] =
s->ob[0];
847 s->b_double[1] =
s->ob[1];
848 s->b_double[2] =
s->ob[2];
851 s->a_double[0] = 1 +
alpha /
A;
852 s->a_double[1] = -2 * cos(w0);
853 s->a_double[2] = 1 -
alpha /
A;
854 s->b_double[0] = 1 +
alpha *
A;
855 s->b_double[1] = -2 * cos(w0);
856 s->b_double[2] = 1 -
alpha *
A;
859 beta = sqrt((
A *
A + 1) - (
A - 1) * (
A - 1));
864 double ro = -sin(w0 / 2. -
M_PI_4) / sin(w0 / 2. +
M_PI_4);
865 double n = (
A + 1) / (
A - 1);
866 double alpha1 =
A == 1. ? 0. : n -
FFSIGN(n) * sqrt(n * n - 1);
867 double beta0 = ((1 +
A) + (1 -
A) * alpha1) * 0.5;
868 double beta1 = ((1 -
A) + (1 +
A) * alpha1) * 0.5;
870 s->a_double[0] = 1 + ro * alpha1;
871 s->a_double[1] = -ro - alpha1;
873 s->b_double[0] = beta0 + ro * beta1;
874 s->b_double[1] = -beta1 - ro * beta0;
877 s->a_double[0] = (
A + 1) + (
A - 1) * cos(w0) + beta *
alpha;
878 s->a_double[1] = -2 * ((
A - 1) + (
A + 1) * cos(w0));
879 s->a_double[2] = (
A + 1) + (
A - 1) * cos(w0) - beta *
alpha;
880 s->b_double[0] =
A * ((
A + 1) - (
A - 1) * cos(w0) + beta *
alpha);
881 s->b_double[1] = 2 *
A * ((
A - 1) - (
A + 1) * cos(w0));
882 s->b_double[2] =
A * ((
A + 1) - (
A - 1) * cos(w0) - beta *
alpha);
886 beta = sqrt((
A *
A + 1) - (
A - 1) * (
A - 1));
890 double ro = sin(w0 / 2. -
M_PI_4) / sin(w0 / 2. +
M_PI_4);
891 double n = (
A + 1) / (
A - 1);
892 double alpha1 =
A == 1. ? 0. : n -
FFSIGN(n) * sqrt(n * n - 1);
893 double beta0 = ((1 +
A) + (1 -
A) * alpha1) * 0.5;
894 double beta1 = ((1 -
A) + (1 +
A) * alpha1) * 0.5;
896 s->a_double[0] = 1 + ro * alpha1;
897 s->a_double[1] = ro + alpha1;
899 s->b_double[0] = beta0 + ro * beta1;
900 s->b_double[1] = beta1 + ro * beta0;
903 s->a_double[0] = (
A + 1) - (
A - 1) * cos(w0) + beta *
alpha;
904 s->a_double[1] = 2 * ((
A - 1) - (
A + 1) * cos(w0));
905 s->a_double[2] = (
A + 1) - (
A - 1) * cos(w0) - beta *
alpha;
906 s->b_double[0] =
A * ((
A + 1) + (
A - 1) * cos(w0) + beta *
alpha);
907 s->b_double[1] =-2 *
A * ((
A - 1) + (
A + 1) * cos(w0));
908 s->b_double[2] =
A * ((
A + 1) + (
A - 1) * cos(w0) - beta *
alpha);
913 s->a_double[0] = 1 +
alpha;
914 s->a_double[1] = -2 * cos(w0);
915 s->a_double[2] = 1 -
alpha;
916 s->b_double[0] = sin(w0) / 2;
918 s->b_double[2] = -sin(w0) / 2;
920 s->a_double[0] = 1 +
alpha;
921 s->a_double[1] = -2 * cos(w0);
922 s->a_double[2] = 1 -
alpha;
929 s->a_double[0] = 1 +
alpha;
930 s->a_double[1] = -2 * cos(w0);
931 s->a_double[2] = 1 -
alpha;
933 s->b_double[1] = -2 * cos(w0);
939 s->a_double[1] = -
exp(-w0);
941 s->b_double[0] = 1 +
s->a_double[1];
945 s->a_double[0] = 1 +
alpha;
946 s->a_double[1] = -2 * cos(w0);
947 s->a_double[2] = 1 -
alpha;
948 s->b_double[0] = (1 - cos(w0)) / 2;
949 s->b_double[1] = 1 - cos(w0);
950 s->b_double[2] = (1 - cos(w0)) / 2;
956 s->a_double[1] = -
exp(-w0);
958 s->b_double[0] = (1 -
s->a_double[1]) / 2;
959 s->b_double[1] = -
s->b_double[0];
962 s->a_double[0] = 1 +
alpha;
963 s->a_double[1] = -2 * cos(w0);
964 s->a_double[2] = 1 -
alpha;
965 s->b_double[0] = (1 + cos(w0)) / 2;
966 s->b_double[1] = -(1 + cos(w0));
967 s->b_double[2] = (1 + cos(w0)) / 2;
974 s->a_double[1] = -(1. -
K) / (1. +
K);
976 s->b_double[0] =
s->a_double[1];
977 s->b_double[1] =
s->a_double[0];
981 s->a_double[0] = 1 +
alpha;
982 s->a_double[1] = -2 * cos(w0);
983 s->a_double[2] = 1 -
alpha;
984 s->b_double[0] = 1 -
alpha;
985 s->b_double[1] = -2 * cos(w0);
986 s->b_double[2] = 1 +
alpha;
995 s->a_double[0],
s->a_double[1],
s->a_double[2],
996 s->b_double[0],
s->b_double[1],
s->b_double[2]);
998 s->a_double[1] /=
s->a_double[0];
999 s->a_double[2] /=
s->a_double[0];
1000 s->b_double[0] /=
s->a_double[0];
1001 s->b_double[1] /=
s->a_double[0];
1002 s->b_double[2] /=
s->a_double[0];
1003 s->a_double[0] /=
s->a_double[0];
1005 if (
s->normalize &&
fabs(
s->b_double[0] +
s->b_double[1] +
s->b_double[2]) > 1e-6) {
1006 double factor = (
s->a_double[0] +
s->a_double[1] +
s->a_double[2]) /
1007 (
s->b_double[0] +
s->b_double[1] +
s->b_double[2]);
1014 switch (
s->filter_type) {
1016 s->b_double[0] /=
A;
1017 s->b_double[1] /=
A;
1018 s->b_double[2] /=
A;
1026 if (!
s->cache[0] || !
s->clip)
1030 s->cache[0]->ch_layout.nb_channels,
s->cache[0]->format);
1033 if (reset &&
s->block_samples > 0) {
1039 s->cache[1]->ch_layout.nb_channels,
s->cache[1]->format);
1040 for (
int i = 0;
i < 3;
i++) {
1046 s->block[
i]->ch_layout.nb_channels,
s->block[
i]->format);
1050 switch (
s->transform_type) {
1052 switch (
inlink->format) {
1054 s->filter = biquad_s16;
1057 s->filter = biquad_s32;
1060 s->filter = biquad_flt;
1063 s->filter = biquad_dbl;
1069 switch (
inlink->format) {
1071 s->filter = biquad_dii_s16;
1074 s->filter = biquad_dii_s32;
1077 s->filter = biquad_dii_flt;
1080 s->filter = biquad_dii_dbl;
1086 switch (
inlink->format) {
1088 s->filter = biquad_tdi_s16;
1091 s->filter = biquad_tdi_s32;
1094 s->filter = biquad_tdi_flt;
1097 s->filter = biquad_tdi_dbl;
1103 switch (
inlink->format) {
1105 s->filter = biquad_tdii_s16;
1108 s->filter = biquad_tdii_s32;
1111 s->filter = biquad_tdii_flt;
1114 s->filter = biquad_tdii_dbl;
1120 switch (
inlink->format) {
1122 s->filter = biquad_latt_s16;
1125 s->filter = biquad_latt_s32;
1128 s->filter = biquad_latt_flt;
1131 s->filter = biquad_latt_dbl;
1137 switch (
inlink->format) {
1139 s->filter = biquad_svf_s16;
1142 s->filter = biquad_svf_s32;
1145 s->filter = biquad_svf_flt;
1148 s->filter = biquad_svf_dbl;
1154 switch (
inlink->format) {
1156 s->filter = biquad_zdf_s16;
1159 s->filter = biquad_zdf_s32;
1162 s->filter = biquad_zdf_flt;
1165 s->filter = biquad_zdf_dbl;
1176 if (
s->transform_type ==
LATT)
1178 else if (
s->transform_type ==
SVF)
1180 else if (
s->transform_type ==
ZDF)
1183 s->a_float[0] =
s->a_double[0];
1184 s->a_float[1] =
s->a_double[1];
1185 s->a_float[2] =
s->a_double[2];
1186 s->b_float[0] =
s->b_double[0];
1187 s->b_float[1] =
s->b_double[1];
1188 s->b_float[2] =
s->b_double[2];
1204 int oo,
int io,
int nb_samples)
1206 switch (
out->format) {
1209 int16_t *dst = ((int16_t *)
out->extended_data[p]) + oo;
1210 for (
int i = 0, j = nb_samples - 1;
i < nb_samples;
i++, j--)
1217 for (
int i = 0, j = nb_samples - 1;
i < nb_samples;
i++, j--)
1223 float *dst = ((
float *)
out->extended_data[p]) + oo;
1224 for (
int i = 0, j = nb_samples - 1;
i < nb_samples;
i++, j--)
1230 double *dst = ((
double *)
out->extended_data[p]) + oo;
1231 for (
int i = 0, j = nb_samples - 1;
i < nb_samples;
i++, j--)
1249 for (ch = start; ch < end; ch++) {
1259 if (!
s->block_samples) {
1261 s->cache[0]->extended_data[ch],
s->clip+ch,
ctx->is_disabled);
1262 }
else if (
td->eof) {
1263 memcpy(out_buf->
extended_data[ch],
s->block[1]->extended_data[ch] +
s->block_align *
s->block_samples,
1264 s->nb_samples *
s->block_align);
1266 memcpy(
s->block[0]->extended_data[ch] +
s->block_align *
s->block_samples, buf->
extended_data[ch],
1268 memset(
s->block[0]->extended_data[ch] +
s->block_align * (
s->block_samples + buf->
nb_samples),
1269 0, (
s->block_samples - buf->
nb_samples) *
s->block_align);
1270 s->filter(
s,
s->block[0]->extended_data[ch],
s->block[1]->extended_data[ch],
s->block_samples,
1271 s->cache[0]->extended_data[ch],
s->clip+ch,
ctx->is_disabled);
1273 s->cache[0]->nb_samples,
s->cache[0]->ch_layout.nb_channels,
1274 s->cache[0]->format);
1275 s->filter(
s,
s->block[0]->extended_data[ch] +
s->block_samples *
s->block_align,
1276 s->block[1]->extended_data[ch] +
s->block_samples *
s->block_align,
1277 s->block_samples,
s->cache[1]->extended_data[ch],
s->clip+ch,
1281 s->cache[1]->ch_layout.nb_channels,
s->cache[1]->format);
1282 s->filter(
s,
s->block[2]->extended_data[ch],
s->block[2]->extended_data[ch], 2 *
s->block_samples,
1283 s->cache[1]->extended_data[ch],
s->clip+ch,
ctx->is_disabled);
1285 memcpy(out_buf->
extended_data[ch],
s->block[1]->extended_data[ch],
1286 s->block_samples *
s->block_align);
1287 memmove(
s->block[0]->extended_data[ch],
s->block[0]->extended_data[ch] +
s->block_align *
s->block_samples,
1288 s->block_samples *
s->block_align);
1302 int ch,
ret, drop = 0;
1312 if (strcmp(
s->ch_layout_str,
"all"))
1336 if (
s->clip[ch] > 0)
1342 if (
s->block_samples > 0) {
1346 out_buf->
pts =
s->pts;
1349 s->nb_samples = nb_samples;
1376 if (
s->block_samples > 0) {
1392 if (
s->block_samples > 0) {
1411 char *res,
int res_len,
int flags)
1427 for (
int i = 0;
i < 3;
i++)
1443 #define OFFSET(x) offsetof(BiquadsContext, x)
1444 #define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
1445 #define AF AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
1447 #define DEFINE_BIQUAD_FILTER_2(name_, description_, priv_class_) \
1448 static av_cold int name_##_init(AVFilterContext *ctx) \
1450 BiquadsContext *s = ctx->priv; \
1451 s->filter_type = name_; \
1452 s->pts = AV_NOPTS_VALUE; \
1456 const AVFilter ff_af_##name_ = { \
1458 .description = NULL_IF_CONFIG_SMALL(description_), \
1459 .priv_class = &priv_class_##_class, \
1460 .priv_size = sizeof(BiquadsContext), \
1461 .init = name_##_init, \
1462 .activate = activate, \
1464 FILTER_INPUTS(ff_audio_default_filterpad), \
1465 FILTER_OUTPUTS(outputs), \
1466 FILTER_QUERY_FUNC(query_formats), \
1467 .process_command = process_command, \
1468 .flags = AVFILTER_FLAG_SLICE_THREADS | AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, \
1471 #define DEFINE_BIQUAD_FILTER(name, description) \
1472 AVFILTER_DEFINE_CLASS(name); \
1473 DEFINE_BIQUAD_FILTER_2(name, description, name)
1475 #define WIDTH_OPTION(x) \
1476 {"width", "set width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=x}, 0, 99999, FLAGS}, \
1477 {"w", "set width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=x}, 0, 99999, FLAGS}
1479 #define WIDTH_TYPE_OPTION(x) \
1480 {"width_type", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=x}, HERTZ, NB_WTYPE-1, FLAGS, "width_type"}, \
1481 {"t", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=x}, HERTZ, NB_WTYPE-1, FLAGS, "width_type"}, \
1482 {"h", "Hz", 0, AV_OPT_TYPE_CONST, {.i64=HERTZ}, 0, 0, FLAGS, "width_type"}, \
1483 {"q", "Q-Factor", 0, AV_OPT_TYPE_CONST, {.i64=QFACTOR}, 0, 0, FLAGS, "width_type"}, \
1484 {"o", "octave", 0, AV_OPT_TYPE_CONST, {.i64=OCTAVE}, 0, 0, FLAGS, "width_type"}, \
1485 {"s", "slope", 0, AV_OPT_TYPE_CONST, {.i64=SLOPE}, 0, 0, FLAGS, "width_type"}, \
1486 {"k", "kHz", 0, AV_OPT_TYPE_CONST, {.i64=KHERTZ}, 0, 0, FLAGS, "width_type"}
1488 #define MIX_CHANNELS_NORMALIZE_OPTION(x, y, z) \
1489 {"mix", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=x}, 0, 1, FLAGS}, \
1490 {"m", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=x}, 0, 1, FLAGS}, \
1491 {"channels", "set channels to filter", OFFSET(ch_layout_str), AV_OPT_TYPE_STRING, {.str=y}, 0, 0, FLAGS}, \
1492 {"c", "set channels to filter", OFFSET(ch_layout_str), AV_OPT_TYPE_STRING, {.str=y}, 0, 0, FLAGS}, \
1493 {"normalize", "normalize coefficients", OFFSET(normalize), AV_OPT_TYPE_BOOL, {.i64=z}, 0, 1, FLAGS}, \
1494 {"n", "normalize coefficients", OFFSET(normalize), AV_OPT_TYPE_BOOL, {.i64=z}, 0, 1, FLAGS}
1496 #define TRANSFORM_OPTION(x) \
1497 {"transform", "set transform type", OFFSET(transform_type), AV_OPT_TYPE_INT, {.i64=x}, 0, NB_TTYPE-1, AF, "transform_type"}, \
1498 {"a", "set transform type", OFFSET(transform_type), AV_OPT_TYPE_INT, {.i64=x}, 0, NB_TTYPE-1, AF, "transform_type"}, \
1499 {"di", "direct form I", 0, AV_OPT_TYPE_CONST, {.i64=DI}, 0, 0, AF, "transform_type"}, \
1500 {"dii", "direct form II", 0, AV_OPT_TYPE_CONST, {.i64=DII}, 0, 0, AF, "transform_type"}, \
1501 {"tdi", "transposed direct form I", 0, AV_OPT_TYPE_CONST, {.i64=TDI}, 0, 0, AF, "transform_type"}, \
1502 {"tdii", "transposed direct form II", 0, AV_OPT_TYPE_CONST, {.i64=TDII}, 0, 0, AF, "transform_type"}, \
1503 {"latt", "lattice-ladder form", 0, AV_OPT_TYPE_CONST, {.i64=LATT}, 0, 0, AF, "transform_type"}, \
1504 {"svf", "state variable filter form", 0, AV_OPT_TYPE_CONST, {.i64=SVF}, 0, 0, AF, "transform_type"}, \
1505 {"zdf", "zero-delay filter form", 0, AV_OPT_TYPE_CONST, {.i64=ZDF}, 0, 0, AF, "transform_type"}
1507 #define PRECISION_OPTION(x) \
1508 {"precision", "set filtering precision", OFFSET(precision), AV_OPT_TYPE_INT, {.i64=x}, -1, 3, AF, "precision"}, \
1509 {"r", "set filtering precision", OFFSET(precision), AV_OPT_TYPE_INT, {.i64=x}, -1, 3, AF, "precision"}, \
1510 {"auto", "automatic", 0, AV_OPT_TYPE_CONST, {.i64=-1}, 0, 0, AF, "precision"}, \
1511 {"s16", "signed 16-bit", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, AF, "precision"}, \
1512 {"s32", "signed 32-bit", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, AF, "precision"}, \
1513 {"f32", "floating-point single", 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, AF, "precision"}, \
1514 {"f64", "floating-point double", 0, AV_OPT_TYPE_CONST, {.i64=3}, 0, 0, AF, "precision"}
1516 #define BLOCKSIZE_OPTION(x) \
1517 {"blocksize", "set the block size", OFFSET(block_samples), AV_OPT_TYPE_INT, {.i64=x}, 0, 32768, AF}, \
1518 {"b", "set the block size", OFFSET(block_samples), AV_OPT_TYPE_INT, {.i64=x}, 0, 32768, AF}
1520 #if CONFIG_EQUALIZER_FILTER
1521 static const AVOption equalizer_options[] = {
1537 #if CONFIG_BASS_FILTER || CONFIG_LOWSHELF_FILTER
1538 static const AVOption bass_lowshelf_options[] = {
1555 #if CONFIG_BASS_FILTER
1559 #if CONFIG_LOWSHELF_FILTER
1563 #if CONFIG_TREBLE_FILTER || CONFIG_HIGHSHELF_FILTER || CONFIG_TILTSHELF_FILTER
1564 static const AVOption treble_highshelf_options[] = {
1581 treble_highshelf_options);
1583 #if CONFIG_TREBLE_FILTER
1587 #if CONFIG_HIGHSHELF_FILTER
1591 #if CONFIG_TILTSHELF_FILTER
1596 #if CONFIG_BANDPASS_FILTER
1597 static const AVOption bandpass_options[] = {
1612 #if CONFIG_BANDREJECT_FILTER
1613 static const AVOption bandreject_options[] = {
1627 #if CONFIG_LOWPASS_FILTER
1628 static const AVOption lowpass_options[] = {
1644 #if CONFIG_HIGHPASS_FILTER
1645 static const AVOption highpass_options[] = {
1661 #if CONFIG_ALLPASS_FILTER
1662 static const AVOption allpass_options[] = {
1677 #if CONFIG_BIQUAD_FILTER
1678 static const AVOption biquad_options[] = {