65 #include "config_components.h"
177 switch (
s->precision) {
191 sample_fmts_list = auto_sample_fmts;
201 #define BIQUAD_FILTER(name, type, ftype, min, max, need_clipping) \
202 static void biquad_## name (BiquadsContext *s, \
203 const void *input, void *output, int len, \
204 void *cache, int *clippings, int disabled) \
206 const type *ibuf = input; \
207 type *obuf = output; \
208 ftype *fcache = cache; \
209 ftype i1 = fcache[0], i2 = fcache[1], o1 = fcache[2], o2 = fcache[3]; \
210 ftype *a = s->a_##ftype; \
211 ftype *b = s->b_##ftype; \
217 ftype wet = s->mix; \
218 ftype dry = 1. - wet; \
222 for (i = 0; i+1 < len; i++) { \
223 o2 = i2 * b2 + i1 * b1 + ibuf[i] * b0 + o2 * a2 + o1 * a1; \
225 out = o2 * wet + i2 * dry; \
228 } else if (need_clipping && out < min) { \
231 } else if (need_clipping && out > max) { \
238 o1 = i1 * b2 + i2 * b1 + ibuf[i] * b0 + o1 * a2 + o2 * a1; \
240 out = o1 * wet + i1 * dry; \
243 } else if (need_clipping && out < min) { \
246 } else if (need_clipping && out > max) { \
254 ftype o0 = ibuf[i] * b0 + i1 * b1 + i2 * b2 + o1 * a1 + o2 * a2; \
259 out = o0 * wet + i1 * dry; \
262 } else if (need_clipping && out < min) { \
265 } else if (need_clipping && out > max) { \
283 #define BIQUAD_DII_FILTER(name, type, ftype, min, max, need_clipping) \
284 static void biquad_dii_## name (BiquadsContext *s, \
285 const void *input, void *output, int len, \
286 void *cache, int *clippings, int disabled) \
288 const type *ibuf = input; \
289 type *obuf = output; \
290 ftype *fcache = cache; \
291 ftype *a = s->a_##ftype; \
292 ftype *b = s->b_##ftype; \
298 ftype w1 = fcache[0]; \
299 ftype w2 = fcache[1]; \
300 ftype wet = s->mix; \
301 ftype dry = 1. - wet; \
304 for (int i = 0; i < len; i++) { \
306 w0 = in + a1 * w1 + a2 * w2; \
307 out = b0 * w0 + b1 * w1 + b2 * w2; \
310 out = out * wet + in * dry; \
313 } else if (need_clipping && out < min) { \
316 } else if (need_clipping && out > max) { \
332 #define BIQUAD_TDI_FILTER(name, type, ftype, min, max, need_clipping) \
333 static void biquad_tdi_## name (BiquadsContext *s, \
334 const void *input, void *output, int len, \
335 void *cache, int *clippings, int disabled) \
337 const type *ibuf = input; \
338 type *obuf = output; \
339 ftype *fcache = cache; \
340 ftype *a = s->a_##ftype; \
341 ftype *b = s->b_##ftype; \
347 ftype s1 = fcache[0]; \
348 ftype s2 = fcache[1]; \
349 ftype s3 = fcache[2]; \
350 ftype s4 = fcache[3]; \
351 ftype wet = s->mix; \
352 ftype dry = 1. - wet; \
355 for (int i = 0; i < len; i++) { \
356 ftype t1, t2, t3, t4; \
362 out = b0 * in + s3; \
363 out = out * wet + in * dry; \
364 s1 = t1; s2 = t2; s3 = t3; s4 = t4; \
367 } else if (need_clipping && out < min) { \
370 } else if (need_clipping && out > max) { \
389 #define BIQUAD_TDII_FILTER(name, type, ftype, min, max, need_clipping) \
390 static void biquad_tdii_## name (BiquadsContext *s, \
391 const void *input, void *output, int len, \
392 void *cache, int *clippings, int disabled) \
394 const type *ibuf = input; \
395 type *obuf = output; \
396 ftype *fcache = cache; \
397 ftype *a = s->a_##ftype; \
398 ftype *b = s->b_##ftype; \
404 ftype w1 = fcache[0]; \
405 ftype w2 = fcache[1]; \
406 ftype wet = s->mix; \
407 ftype dry = 1. - wet; \
410 for (int i = 0; i < len; i++) { \
412 out = b0 * in + w1; \
413 w1 = b1 * in + w2 + a1 * out; \
414 w2 = b2 * in + a2 * out; \
415 out = out * wet + in * dry; \
418 } else if (need_clipping && out < min) { \
421 } else if (need_clipping && out > max) { \
437 #define BIQUAD_LATT_FILTER(name, type, ftype, min, max, need_clipping) \
438 static void biquad_latt_## name (BiquadsContext *s, \
439 const void *input, void *output, int len, \
440 void *cache, int *clippings, int disabled) \
442 const type *ibuf = input; \
443 type *obuf = output; \
444 ftype *fcache = cache; \
445 ftype *a = s->a_##ftype; \
446 ftype *b = s->b_##ftype; \
452 ftype s0 = fcache[0]; \
453 ftype s1 = fcache[1]; \
454 ftype wet = s->mix; \
455 ftype dry = 1. - wet; \
459 for (int i = 0; i < len; i++) { \
474 out = out * wet + in * dry; \
477 } else if (need_clipping && out < min) { \
480 } else if (need_clipping && out > max) { \
496 #define BIQUAD_SVF_FILTER(name, type, ftype, min, max, need_clipping) \
497 static void biquad_svf_## name (BiquadsContext *s, \
498 const void *input, void *output, int len, \
499 void *cache, int *clippings, int disabled) \
501 const type *ibuf = input; \
502 type *obuf = output; \
503 ftype *fcache = cache; \
504 ftype *a = s->a_##ftype; \
505 ftype *b = s->b_##ftype; \
511 ftype s0 = fcache[0]; \
512 ftype s1 = fcache[1]; \
513 ftype wet = s->mix; \
514 ftype dry = 1. - wet; \
518 for (int i = 0; i < len; i++) { \
520 out = b2 * in + s0; \
521 t0 = b0 * in + a1 * s0 + s1; \
522 t1 = b1 * in + a2 * s0; \
526 out = out * wet + in * dry; \
529 } else if (need_clipping && out < min) { \
532 } else if (need_clipping && out > max) { \
548 #define BIQUAD_ZDF_FILTER(name, type, ftype, min, max, need_clipping, two) \
549 static void biquad_zdf_## name (BiquadsContext *s, \
550 const void *input, void *output, int len, \
551 void *cache, int *clippings, int disabled) \
553 const type *ibuf = input; \
554 type *obuf = output; \
555 ftype *fcache = cache; \
556 ftype *a = s->a_##ftype; \
557 ftype *b = s->b_##ftype; \
564 ftype b0 = fcache[0]; \
565 ftype b1 = fcache[1]; \
566 ftype wet = s->mix; \
567 ftype dry = 1. - wet; \
570 for (int i = 0; i < len; i++) { \
571 const ftype in = ibuf[i]; \
572 const ftype v0 = in; \
573 const ftype v3 = v0 - b1; \
574 const ftype v1 = a0 * b0 + a1 * v3; \
575 const ftype v2 = b1 + a1 * b0 + a2 * v3; \
577 b0 = two * v1 - b0; \
578 b1 = two * v2 - b1; \
580 out = m0 * v0 + m1 * v1 + m2 * v2; \
581 out = out * wet + in * dry; \
584 } else if (need_clipping && out < min) { \
587 } else if (need_clipping && out > max) { \
605 double k0, k1, v0, v1, v2;
608 k0 =
s->a_double[1] / (1. + k1);
610 v1 =
s->b_double[1] - v2 *
s->a_double[1];
611 v0 =
s->b_double[0] - v1 * k0 - v2 * k1;
625 a[0] = -
s->a_double[1];
626 a[1] = -
s->a_double[2];
627 b[0] =
s->b_double[1] -
s->a_double[1] *
s->b_double[0];
628 b[1] =
s->b_double[2] -
s->a_double[2] *
s->b_double[0];
629 b[2] =
s->b_double[0];
631 s->a_double[1] =
a[0];
632 s->a_double[2] =
a[1];
633 s->b_double[0] =
b[0];
634 s->b_double[1] =
b[1];
635 s->b_double[2] =
b[2];
660 ret = 1. / (2. * sinh(
log(2.) / 2. *
width * w0 / sin(w0)));
663 ret = 1. / sqrt((
A + 1. /
A) * (1. /
width - 1.) + 2.);
680 switch (
s->filter_type) {
691 g = tan(
M_PI *
s->frequency / sample_rate);
693 a[0] = 1. / (1. +
g * (
g + k));
697 m[1] = k * (
A *
A - 1.);
703 g = tan(
M_PI *
s->frequency / sample_rate) / sqrt(
A);
705 a[0] = 1. / (1. +
g * (
g + k));
714 g = tan(
M_PI *
s->frequency / sample_rate) / sqrt(
A);
716 a[0] = 1. / (1. +
g * (
g + k));
720 m[1] = k * (
A - 1.) /
A;
721 m[2] = (
A *
A - 1.) /
A;
726 g = tan(
M_PI *
s->frequency / sample_rate) * sqrt(
A);
728 a[0] = 1. / (1. +
g * (
g + k));
732 m[1] = k * (1. -
A) *
A;
736 g = tan(
M_PI *
s->frequency / sample_rate);
738 a[0] = 1. / (1. +
g * (
g + k));
742 m[1] =
s->csg ? 1. : k;
746 g = tan(
M_PI *
s->frequency / sample_rate);
748 a[0] = 1. / (1. +
g * (
g + k));
756 g = tan(
M_PI *
s->frequency / sample_rate);
758 a[0] = 1. / (1. +
g * (
g + k));
766 g = tan(
M_PI *
s->frequency / sample_rate);
768 a[0] = 1. / (1. +
g * (
g + k));
776 g = tan(
M_PI *
s->frequency / sample_rate);
778 a[0] = 1. / (1. +
g * (
g + k));
789 s->a_double[0] =
a[0];
790 s->a_double[1] =
a[1];
791 s->a_double[2] =
a[2];
792 s->b_double[0] = m[0];
793 s->b_double[1] = m[1];
794 s->b_double[2] = m[2];
804 double w0 = 2 *
M_PI *
s->frequency /
inlink->sample_rate;
805 double K = tan(w0 / 2.);
808 s->bypass = (((w0 >
M_PI || w0 <= 0.) && reset) || (
s->width <= 0.)) && (
s->filter_type !=
biquad);
814 if ((w0 >
M_PI || w0 <= 0.) && (
s->filter_type !=
biquad))
817 switch (
s->width_type) {
822 alpha = sin(w0) / (2 *
s->frequency /
s->width);
825 alpha = sin(w0) / (2 *
s->frequency / (
s->width * 1000));
828 alpha = sin(w0) * sinh(
log(2.) / 2 *
s->width * w0 / sin(w0));
831 alpha = sin(w0) / (2 *
s->width);
834 alpha = sin(w0) / 2 * sqrt((
A + 1 /
A) * (1 /
s->width - 1) + 2);
842 switch (
s->filter_type) {
844 s->a_double[0] =
s->oa[0];
845 s->a_double[1] =
s->oa[1];
846 s->a_double[2] =
s->oa[2];
847 s->b_double[0] =
s->ob[0];
848 s->b_double[1] =
s->ob[1];
849 s->b_double[2] =
s->ob[2];
852 s->a_double[0] = 1 +
alpha /
A;
853 s->a_double[1] = -2 * cos(w0);
854 s->a_double[2] = 1 -
alpha /
A;
855 s->b_double[0] = 1 +
alpha *
A;
856 s->b_double[1] = -2 * cos(w0);
857 s->b_double[2] = 1 -
alpha *
A;
860 beta = sqrt((
A *
A + 1) - (
A - 1) * (
A - 1));
866 double ro = -sin(w0 / 2. -
M_PI_4) / sin(w0 / 2. +
M_PI_4);
867 double n = (
A + 1) / (
A - 1);
868 double alpha1 =
A == 1. ? 0. : n -
FFSIGN(n) * sqrt(n * n - 1);
869 double beta0 = ((1 +
A) + (1 -
A) * alpha1) * 0.5;
870 double beta1 = ((1 -
A) + (1 +
A) * alpha1) * 0.5;
872 s->a_double[0] = 1 + ro * alpha1;
873 s->a_double[1] = -ro - alpha1;
875 s->b_double[0] = beta0 + ro * beta1;
876 s->b_double[1] = -beta1 - ro * beta0;
879 s->a_double[0] = (
A + 1) + (
A - 1) * cos(w0) + beta *
alpha;
880 s->a_double[1] = -2 * ((
A - 1) + (
A + 1) * cos(w0));
881 s->a_double[2] = (
A + 1) + (
A - 1) * cos(w0) - beta *
alpha;
882 s->b_double[0] =
A * ((
A + 1) - (
A - 1) * cos(w0) + beta *
alpha);
883 s->b_double[1] = 2 *
A * ((
A - 1) - (
A + 1) * cos(w0));
884 s->b_double[2] =
A * ((
A + 1) - (
A - 1) * cos(w0) - beta *
alpha);
888 beta = sqrt((
A *
A + 1) - (
A - 1) * (
A - 1));
893 double ro = sin(w0 / 2. -
M_PI_4) / sin(w0 / 2. +
M_PI_4);
894 double n = (
A + 1) / (
A - 1);
895 double alpha1 =
A == 1. ? 0. : n -
FFSIGN(n) * sqrt(n * n - 1);
896 double beta0 = ((1 +
A) + (1 -
A) * alpha1) * 0.5;
897 double beta1 = ((1 -
A) + (1 +
A) * alpha1) * 0.5;
899 s->a_double[0] = 1 + ro * alpha1;
900 s->a_double[1] = ro + alpha1;
902 s->b_double[0] = beta0 + ro * beta1;
903 s->b_double[1] = beta1 + ro * beta0;
906 s->a_double[0] = (
A + 1) - (
A - 1) * cos(w0) + beta *
alpha;
907 s->a_double[1] = 2 * ((
A - 1) - (
A + 1) * cos(w0));
908 s->a_double[2] = (
A + 1) - (
A - 1) * cos(w0) - beta *
alpha;
909 s->b_double[0] =
A * ((
A + 1) + (
A - 1) * cos(w0) + beta *
alpha);
910 s->b_double[1] =-2 *
A * ((
A - 1) + (
A + 1) * cos(w0));
911 s->b_double[2] =
A * ((
A + 1) + (
A - 1) * cos(w0) - beta *
alpha);
916 s->a_double[0] = 1 +
alpha;
917 s->a_double[1] = -2 * cos(w0);
918 s->a_double[2] = 1 -
alpha;
919 s->b_double[0] = sin(w0) / 2;
921 s->b_double[2] = -sin(w0) / 2;
923 s->a_double[0] = 1 +
alpha;
924 s->a_double[1] = -2 * cos(w0);
925 s->a_double[2] = 1 -
alpha;
932 s->a_double[0] = 1 +
alpha;
933 s->a_double[1] = -2 * cos(w0);
934 s->a_double[2] = 1 -
alpha;
936 s->b_double[1] = -2 * cos(w0);
942 s->a_double[1] = -
exp(-w0);
944 s->b_double[0] = 1 +
s->a_double[1];
948 s->a_double[0] = 1 +
alpha;
949 s->a_double[1] = -2 * cos(w0);
950 s->a_double[2] = 1 -
alpha;
951 s->b_double[0] = (1 - cos(w0)) / 2;
952 s->b_double[1] = 1 - cos(w0);
953 s->b_double[2] = (1 - cos(w0)) / 2;
959 s->a_double[1] = -
exp(-w0);
961 s->b_double[0] = (1 -
s->a_double[1]) / 2;
962 s->b_double[1] = -
s->b_double[0];
965 s->a_double[0] = 1 +
alpha;
966 s->a_double[1] = -2 * cos(w0);
967 s->a_double[2] = 1 -
alpha;
968 s->b_double[0] = (1 + cos(w0)) / 2;
969 s->b_double[1] = -(1 + cos(w0));
970 s->b_double[2] = (1 + cos(w0)) / 2;
977 s->a_double[1] = -(1. -
K) / (1. +
K);
979 s->b_double[0] =
s->a_double[1];
980 s->b_double[1] =
s->a_double[0];
984 s->a_double[0] = 1 +
alpha;
985 s->a_double[1] = -2 * cos(w0);
986 s->a_double[2] = 1 -
alpha;
987 s->b_double[0] = 1 -
alpha;
988 s->b_double[1] = -2 * cos(w0);
989 s->b_double[2] = 1 +
alpha;
998 s->a_double[0],
s->a_double[1],
s->a_double[2],
999 s->b_double[0],
s->b_double[1],
s->b_double[2]);
1001 s->a_double[1] /=
s->a_double[0];
1002 s->a_double[2] /=
s->a_double[0];
1003 s->b_double[0] /=
s->a_double[0];
1004 s->b_double[1] /=
s->a_double[0];
1005 s->b_double[2] /=
s->a_double[0];
1006 s->a_double[0] /=
s->a_double[0];
1008 if (
s->normalize &&
fabs(
s->b_double[0] +
s->b_double[1] +
s->b_double[2]) > 1e-6) {
1009 double factor = (
s->a_double[0] +
s->a_double[1] +
s->a_double[2]) /
1010 (
s->b_double[0] +
s->b_double[1] +
s->b_double[2]);
1017 switch (
s->filter_type) {
1019 s->b_double[0] /=
A;
1020 s->b_double[1] /=
A;
1021 s->b_double[2] /=
A;
1029 if (!
s->cache[0] || !
s->clip)
1033 s->cache[0]->ch_layout.nb_channels,
s->cache[0]->format);
1036 if (reset &&
s->block_samples > 0) {
1042 s->cache[1]->ch_layout.nb_channels,
s->cache[1]->format);
1043 for (
int i = 0;
i < 3;
i++) {
1049 s->block[
i]->ch_layout.nb_channels,
s->block[
i]->format);
1053 switch (
s->transform_type) {
1055 switch (
inlink->format) {
1057 s->filter = biquad_s16;
1060 s->filter = biquad_s32;
1063 s->filter = biquad_flt;
1066 s->filter = biquad_dbl;
1072 switch (
inlink->format) {
1074 s->filter = biquad_dii_s16;
1077 s->filter = biquad_dii_s32;
1080 s->filter = biquad_dii_flt;
1083 s->filter = biquad_dii_dbl;
1089 switch (
inlink->format) {
1091 s->filter = biquad_tdi_s16;
1094 s->filter = biquad_tdi_s32;
1097 s->filter = biquad_tdi_flt;
1100 s->filter = biquad_tdi_dbl;
1106 switch (
inlink->format) {
1108 s->filter = biquad_tdii_s16;
1111 s->filter = biquad_tdii_s32;
1114 s->filter = biquad_tdii_flt;
1117 s->filter = biquad_tdii_dbl;
1123 switch (
inlink->format) {
1125 s->filter = biquad_latt_s16;
1128 s->filter = biquad_latt_s32;
1131 s->filter = biquad_latt_flt;
1134 s->filter = biquad_latt_dbl;
1140 switch (
inlink->format) {
1142 s->filter = biquad_svf_s16;
1145 s->filter = biquad_svf_s32;
1148 s->filter = biquad_svf_flt;
1151 s->filter = biquad_svf_dbl;
1157 switch (
inlink->format) {
1159 s->filter = biquad_zdf_s16;
1162 s->filter = biquad_zdf_s32;
1165 s->filter = biquad_zdf_flt;
1168 s->filter = biquad_zdf_dbl;
1179 if (
s->transform_type ==
LATT)
1181 else if (
s->transform_type ==
SVF)
1183 else if (
s->transform_type ==
ZDF)
1186 s->a_float[0] =
s->a_double[0];
1187 s->a_float[1] =
s->a_double[1];
1188 s->a_float[2] =
s->a_double[2];
1189 s->b_float[0] =
s->b_double[0];
1190 s->b_float[1] =
s->b_double[1];
1191 s->b_float[2] =
s->b_double[2];
1207 int oo,
int io,
int nb_samples)
1209 switch (
out->format) {
1212 int16_t *
dst = ((int16_t *)
out->extended_data[
p]) + oo;
1213 for (
int i = 0, j = nb_samples - 1;
i < nb_samples;
i++, j--)
1220 for (
int i = 0, j = nb_samples - 1;
i < nb_samples;
i++, j--)
1226 float *
dst = ((
float *)
out->extended_data[
p]) + oo;
1227 for (
int i = 0, j = nb_samples - 1;
i < nb_samples;
i++, j--)
1233 double *
dst = ((
double *)
out->extended_data[
p]) + oo;
1234 for (
int i = 0, j = nb_samples - 1;
i < nb_samples;
i++, j--)
1252 for (ch = start; ch < end; ch++) {
1262 if (!
s->block_samples) {
1264 s->cache[0]->extended_data[ch],
s->clip+ch,
ctx->is_disabled);
1265 }
else if (td->
eof) {
1266 memcpy(out_buf->
extended_data[ch],
s->block[1]->extended_data[ch] +
s->block_align *
s->block_samples,
1267 s->nb_samples *
s->block_align);
1269 memcpy(
s->block[0]->extended_data[ch] +
s->block_align *
s->block_samples, buf->
extended_data[ch],
1271 memset(
s->block[0]->extended_data[ch] +
s->block_align * (
s->block_samples + buf->
nb_samples),
1272 0, (
s->block_samples - buf->
nb_samples) *
s->block_align);
1273 s->filter(
s,
s->block[0]->extended_data[ch],
s->block[1]->extended_data[ch],
s->block_samples,
1274 s->cache[0]->extended_data[ch],
s->clip+ch,
ctx->is_disabled);
1276 s->cache[0]->nb_samples,
s->cache[0]->ch_layout.nb_channels,
1277 s->cache[0]->format);
1278 s->filter(
s,
s->block[0]->extended_data[ch] +
s->block_samples *
s->block_align,
1279 s->block[1]->extended_data[ch] +
s->block_samples *
s->block_align,
1280 s->block_samples,
s->cache[1]->extended_data[ch],
s->clip+ch,
1284 s->cache[1]->ch_layout.nb_channels,
s->cache[1]->format);
1285 s->filter(
s,
s->block[2]->extended_data[ch],
s->block[2]->extended_data[ch], 2 *
s->block_samples,
1286 s->cache[1]->extended_data[ch],
s->clip+ch,
ctx->is_disabled);
1288 memcpy(out_buf->
extended_data[ch],
s->block[1]->extended_data[ch],
1289 s->block_samples *
s->block_align);
1290 memmove(
s->block[0]->extended_data[ch],
s->block[0]->extended_data[ch] +
s->block_align *
s->block_samples,
1291 s->block_samples *
s->block_align);
1305 int ch,
ret, drop = 0;
1315 if (strcmp(
s->ch_layout_str,
"all"))
1339 if (
s->clip[ch] > 0)
1345 if (
s->block_samples > 0) {
1349 out_buf->
pts =
s->pts;
1352 s->nb_samples = nb_samples;
1379 if (
s->block_samples > 0) {
1395 if (
s->block_samples > 0) {
1414 char *res,
int res_len,
int flags)
1430 for (
int i = 0;
i < 3;
i++)
1446 #define OFFSET(x) offsetof(BiquadsContext, x)
1447 #define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
1448 #define AF AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
1450 #define DEFINE_BIQUAD_FILTER_2(name_, description_, priv_class_) \
1451 static av_cold int name_##_init(AVFilterContext *ctx) \
1453 BiquadsContext *s = ctx->priv; \
1454 s->filter_type = name_; \
1455 s->pts = AV_NOPTS_VALUE; \
1459 const FFFilter ff_af_##name_ = { \
1461 .p.description = NULL_IF_CONFIG_SMALL(description_), \
1462 .p.priv_class = &priv_class_##_class, \
1463 .p.flags = AVFILTER_FLAG_SLICE_THREADS | \
1464 AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, \
1465 .priv_size = sizeof(BiquadsContext), \
1466 .init = name_##_init, \
1467 .activate = activate, \
1469 FILTER_INPUTS(ff_audio_default_filterpad), \
1470 FILTER_OUTPUTS(outputs), \
1471 FILTER_QUERY_FUNC2(query_formats), \
1472 .process_command = process_command, \
1475 #define DEFINE_BIQUAD_FILTER(name, description) \
1476 AVFILTER_DEFINE_CLASS(name); \
1477 DEFINE_BIQUAD_FILTER_2(name, description, name)
1479 #define WIDTH_OPTION(x) \
1480 {"width", "set width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=x}, 0, 99999, FLAGS}, \
1481 {"w", "set width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=x}, 0, 99999, FLAGS}
1483 #define WIDTH_TYPE_OPTION(x) \
1484 {"width_type", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=x}, HERTZ, NB_WTYPE-1, FLAGS, .unit = "width_type"}, \
1485 {"t", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=x}, HERTZ, NB_WTYPE-1, FLAGS, .unit = "width_type"}, \
1486 {"h", "Hz", 0, AV_OPT_TYPE_CONST, {.i64=HERTZ}, 0, 0, FLAGS, .unit = "width_type"}, \
1487 {"q", "Q-Factor", 0, AV_OPT_TYPE_CONST, {.i64=QFACTOR}, 0, 0, FLAGS, .unit = "width_type"}, \
1488 {"o", "octave", 0, AV_OPT_TYPE_CONST, {.i64=OCTAVE}, 0, 0, FLAGS, .unit = "width_type"}, \
1489 {"s", "slope", 0, AV_OPT_TYPE_CONST, {.i64=SLOPE}, 0, 0, FLAGS, .unit = "width_type"}, \
1490 {"k", "kHz", 0, AV_OPT_TYPE_CONST, {.i64=KHERTZ}, 0, 0, FLAGS, .unit = "width_type"}
1492 #define MIX_CHANNELS_NORMALIZE_OPTION(x, y, z) \
1493 {"mix", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=x}, 0, 1, FLAGS}, \
1494 {"m", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=x}, 0, 1, FLAGS}, \
1495 {"channels", "set channels to filter", OFFSET(ch_layout_str), AV_OPT_TYPE_STRING, {.str=y}, 0, 0, FLAGS}, \
1496 {"c", "set channels to filter", OFFSET(ch_layout_str), AV_OPT_TYPE_STRING, {.str=y}, 0, 0, FLAGS}, \
1497 {"normalize", "normalize coefficients", OFFSET(normalize), AV_OPT_TYPE_BOOL, {.i64=z}, 0, 1, FLAGS}, \
1498 {"n", "normalize coefficients", OFFSET(normalize), AV_OPT_TYPE_BOOL, {.i64=z}, 0, 1, FLAGS}
1500 #define TRANSFORM_OPTION(x) \
1501 {"transform", "set transform type", OFFSET(transform_type), AV_OPT_TYPE_INT, {.i64=x}, 0, NB_TTYPE-1, AF, .unit = "transform_type"}, \
1502 {"a", "set transform type", OFFSET(transform_type), AV_OPT_TYPE_INT, {.i64=x}, 0, NB_TTYPE-1, AF, .unit = "transform_type"}, \
1503 {"di", "direct form I", 0, AV_OPT_TYPE_CONST, {.i64=DI}, 0, 0, AF, .unit = "transform_type"}, \
1504 {"dii", "direct form II", 0, AV_OPT_TYPE_CONST, {.i64=DII}, 0, 0, AF, .unit = "transform_type"}, \
1505 {"tdi", "transposed direct form I", 0, AV_OPT_TYPE_CONST, {.i64=TDI}, 0, 0, AF, .unit = "transform_type"}, \
1506 {"tdii", "transposed direct form II", 0, AV_OPT_TYPE_CONST, {.i64=TDII}, 0, 0, AF, .unit = "transform_type"}, \
1507 {"latt", "lattice-ladder form", 0, AV_OPT_TYPE_CONST, {.i64=LATT}, 0, 0, AF, .unit = "transform_type"}, \
1508 {"svf", "state variable filter form", 0, AV_OPT_TYPE_CONST, {.i64=SVF}, 0, 0, AF, .unit = "transform_type"}, \
1509 {"zdf", "zero-delay filter form", 0, AV_OPT_TYPE_CONST, {.i64=ZDF}, 0, 0, AF, .unit = "transform_type"}
1511 #define PRECISION_OPTION(x) \
1512 {"precision", "set filtering precision", OFFSET(precision), AV_OPT_TYPE_INT, {.i64=x}, -1, 3, AF, .unit = "precision"}, \
1513 {"r", "set filtering precision", OFFSET(precision), AV_OPT_TYPE_INT, {.i64=x}, -1, 3, AF, .unit = "precision"}, \
1514 {"auto", "automatic", 0, AV_OPT_TYPE_CONST, {.i64=-1}, 0, 0, AF, .unit = "precision"}, \
1515 {"s16", "signed 16-bit", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, AF, .unit = "precision"}, \
1516 {"s32", "signed 32-bit", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, AF, .unit = "precision"}, \
1517 {"f32", "floating-point single", 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, AF, .unit = "precision"}, \
1518 {"f64", "floating-point double", 0, AV_OPT_TYPE_CONST, {.i64=3}, 0, 0, AF, .unit = "precision"}
1520 #define BLOCKSIZE_OPTION(x) \
1521 {"blocksize", "set the block size", OFFSET(block_samples), AV_OPT_TYPE_INT, {.i64=x}, 0, 32768, AF}, \
1522 {"b", "set the block size", OFFSET(block_samples), AV_OPT_TYPE_INT, {.i64=x}, 0, 32768, AF}
1524 #if CONFIG_EQUALIZER_FILTER
1525 static const AVOption equalizer_options[] = {
1541 #if CONFIG_BASS_FILTER || CONFIG_LOWSHELF_FILTER
1542 static const AVOption bass_lowshelf_options[] = {
1559 #if CONFIG_BASS_FILTER
1563 #if CONFIG_LOWSHELF_FILTER
1567 #if CONFIG_TREBLE_FILTER || CONFIG_HIGHSHELF_FILTER || CONFIG_TILTSHELF_FILTER
1568 static const AVOption treble_highshelf_options[] = {
1585 treble_highshelf_options);
1587 #if CONFIG_TREBLE_FILTER
1591 #if CONFIG_HIGHSHELF_FILTER
1595 #if CONFIG_TILTSHELF_FILTER
1600 #if CONFIG_BANDPASS_FILTER
1601 static const AVOption bandpass_options[] = {
1616 #if CONFIG_BANDREJECT_FILTER
1617 static const AVOption bandreject_options[] = {
1631 #if CONFIG_LOWPASS_FILTER
1632 static const AVOption lowpass_options[] = {
1648 #if CONFIG_HIGHPASS_FILTER
1649 static const AVOption highpass_options[] = {
1665 #if CONFIG_ALLPASS_FILTER
1666 static const AVOption allpass_options[] = {
1681 #if CONFIG_BIQUAD_FILTER
1682 static const AVOption biquad_options[] = {