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) {
693 a[0] = 1. / (1. +
g * (
g + k));
697 m[1] = k * (
A *
A - 1.);
705 a[0] = 1. / (1. +
g * (
g + k));
716 a[0] = 1. / (1. +
g * (
g + k));
720 m[1] = k * (
A - 1.) /
A;
721 m[2] = (
A *
A - 1.) /
A;
728 a[0] = 1. / (1. +
g * (
g + k));
732 m[1] = k * (1. -
A) *
A;
738 a[0] = 1. / (1. +
g * (
g + k));
742 m[1] =
s->csg ? 1. : k;
748 a[0] = 1. / (1. +
g * (
g + k));
758 a[0] = 1. / (1. +
g * (
g + k));
768 a[0] = 1. / (1. +
g * (
g + k));
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));
865 double ro = -sin(w0 / 2. -
M_PI_4) / sin(w0 / 2. +
M_PI_4);
866 double n = (
A + 1) / (
A - 1);
867 double alpha1 =
A == 1. ? 0. : n -
FFSIGN(n) * sqrt(n * n - 1);
868 double beta0 = ((1 +
A) + (1 -
A) * alpha1) * 0.5;
869 double beta1 = ((1 -
A) + (1 +
A) * alpha1) * 0.5;
871 s->a_double[0] = 1 + ro * alpha1;
872 s->a_double[1] = -ro - alpha1;
874 s->b_double[0] = beta0 + ro * beta1;
875 s->b_double[1] = -beta1 - ro * beta0;
878 s->a_double[0] = (
A + 1) + (
A - 1) * cos(w0) + beta *
alpha;
879 s->a_double[1] = -2 * ((
A - 1) + (
A + 1) * cos(w0));
880 s->a_double[2] = (
A + 1) + (
A - 1) * cos(w0) - beta *
alpha;
881 s->b_double[0] =
A * ((
A + 1) - (
A - 1) * cos(w0) + beta *
alpha);
882 s->b_double[1] = 2 *
A * ((
A - 1) - (
A + 1) * cos(w0));
883 s->b_double[2] =
A * ((
A + 1) - (
A - 1) * cos(w0) - beta *
alpha);
887 beta = sqrt((
A *
A + 1) - (
A - 1) * (
A - 1));
891 double ro = sin(w0 / 2. -
M_PI_4) / sin(w0 / 2. +
M_PI_4);
892 double n = (
A + 1) / (
A - 1);
893 double alpha1 =
A == 1. ? 0. : n -
FFSIGN(n) * sqrt(n * n - 1);
894 double beta0 = ((1 +
A) + (1 -
A) * alpha1) * 0.5;
895 double beta1 = ((1 -
A) + (1 +
A) * alpha1) * 0.5;
897 s->a_double[0] = 1 + ro * alpha1;
898 s->a_double[1] = ro + alpha1;
900 s->b_double[0] = beta0 + ro * beta1;
901 s->b_double[1] = beta1 + ro * beta0;
904 s->a_double[0] = (
A + 1) - (
A - 1) * cos(w0) + beta *
alpha;
905 s->a_double[1] = 2 * ((
A - 1) - (
A + 1) * cos(w0));
906 s->a_double[2] = (
A + 1) - (
A - 1) * cos(w0) - beta *
alpha;
907 s->b_double[0] =
A * ((
A + 1) + (
A - 1) * cos(w0) + beta *
alpha);
908 s->b_double[1] =-2 *
A * ((
A - 1) + (
A + 1) * cos(w0));
909 s->b_double[2] =
A * ((
A + 1) + (
A - 1) * cos(w0) - beta *
alpha);
914 s->a_double[0] = 1 +
alpha;
915 s->a_double[1] = -2 * cos(w0);
916 s->a_double[2] = 1 -
alpha;
917 s->b_double[0] = sin(w0) / 2;
919 s->b_double[2] = -sin(w0) / 2;
921 s->a_double[0] = 1 +
alpha;
922 s->a_double[1] = -2 * cos(w0);
923 s->a_double[2] = 1 -
alpha;
930 s->a_double[0] = 1 +
alpha;
931 s->a_double[1] = -2 * cos(w0);
932 s->a_double[2] = 1 -
alpha;
934 s->b_double[1] = -2 * cos(w0);
940 s->a_double[1] = -
exp(-w0);
942 s->b_double[0] = 1 +
s->a_double[1];
946 s->a_double[0] = 1 +
alpha;
947 s->a_double[1] = -2 * cos(w0);
948 s->a_double[2] = 1 -
alpha;
949 s->b_double[0] = (1 - cos(w0)) / 2;
950 s->b_double[1] = 1 - cos(w0);
951 s->b_double[2] = (1 - cos(w0)) / 2;
957 s->a_double[1] = -
exp(-w0);
959 s->b_double[0] = (1 -
s->a_double[1]) / 2;
960 s->b_double[1] = -
s->b_double[0];
963 s->a_double[0] = 1 +
alpha;
964 s->a_double[1] = -2 * cos(w0);
965 s->a_double[2] = 1 -
alpha;
966 s->b_double[0] = (1 + cos(w0)) / 2;
967 s->b_double[1] = -(1 + cos(w0));
968 s->b_double[2] = (1 + cos(w0)) / 2;
975 s->a_double[1] = -(1. -
K) / (1. +
K);
977 s->b_double[0] =
s->a_double[1];
978 s->b_double[1] =
s->a_double[0];
982 s->a_double[0] = 1 +
alpha;
983 s->a_double[1] = -2 * cos(w0);
984 s->a_double[2] = 1 -
alpha;
985 s->b_double[0] = 1 -
alpha;
986 s->b_double[1] = -2 * cos(w0);
987 s->b_double[2] = 1 +
alpha;
996 s->a_double[0],
s->a_double[1],
s->a_double[2],
997 s->b_double[0],
s->b_double[1],
s->b_double[2]);
999 s->a_double[1] /=
s->a_double[0];
1000 s->a_double[2] /=
s->a_double[0];
1001 s->b_double[0] /=
s->a_double[0];
1002 s->b_double[1] /=
s->a_double[0];
1003 s->b_double[2] /=
s->a_double[0];
1004 s->a_double[0] /=
s->a_double[0];
1006 if (
s->normalize &&
fabs(
s->b_double[0] +
s->b_double[1] +
s->b_double[2]) > 1e-6) {
1007 double factor = (
s->a_double[0] +
s->a_double[1] +
s->a_double[2]) /
1008 (
s->b_double[0] +
s->b_double[1] +
s->b_double[2]);
1015 switch (
s->filter_type) {
1017 s->b_double[0] /=
A;
1018 s->b_double[1] /=
A;
1019 s->b_double[2] /=
A;
1027 if (!
s->cache[0] || !
s->clip)
1031 s->cache[0]->ch_layout.nb_channels,
s->cache[0]->format);
1034 if (reset &&
s->block_samples > 0) {
1040 s->cache[1]->ch_layout.nb_channels,
s->cache[1]->format);
1041 for (
int i = 0;
i < 3;
i++) {
1047 s->block[
i]->ch_layout.nb_channels,
s->block[
i]->format);
1051 switch (
s->transform_type) {
1053 switch (
inlink->format) {
1055 s->filter = biquad_s16;
1058 s->filter = biquad_s32;
1061 s->filter = biquad_flt;
1064 s->filter = biquad_dbl;
1070 switch (
inlink->format) {
1072 s->filter = biquad_dii_s16;
1075 s->filter = biquad_dii_s32;
1078 s->filter = biquad_dii_flt;
1081 s->filter = biquad_dii_dbl;
1087 switch (
inlink->format) {
1089 s->filter = biquad_tdi_s16;
1092 s->filter = biquad_tdi_s32;
1095 s->filter = biquad_tdi_flt;
1098 s->filter = biquad_tdi_dbl;
1104 switch (
inlink->format) {
1106 s->filter = biquad_tdii_s16;
1109 s->filter = biquad_tdii_s32;
1112 s->filter = biquad_tdii_flt;
1115 s->filter = biquad_tdii_dbl;
1121 switch (
inlink->format) {
1123 s->filter = biquad_latt_s16;
1126 s->filter = biquad_latt_s32;
1129 s->filter = biquad_latt_flt;
1132 s->filter = biquad_latt_dbl;
1138 switch (
inlink->format) {
1140 s->filter = biquad_svf_s16;
1143 s->filter = biquad_svf_s32;
1146 s->filter = biquad_svf_flt;
1149 s->filter = biquad_svf_dbl;
1155 switch (
inlink->format) {
1157 s->filter = biquad_zdf_s16;
1160 s->filter = biquad_zdf_s32;
1163 s->filter = biquad_zdf_flt;
1166 s->filter = biquad_zdf_dbl;
1177 if (
s->transform_type ==
LATT)
1179 else if (
s->transform_type ==
SVF)
1181 else if (
s->transform_type ==
ZDF)
1184 s->a_float[0] =
s->a_double[0];
1185 s->a_float[1] =
s->a_double[1];
1186 s->a_float[2] =
s->a_double[2];
1187 s->b_float[0] =
s->b_double[0];
1188 s->b_float[1] =
s->b_double[1];
1189 s->b_float[2] =
s->b_double[2];
1205 int oo,
int io,
int nb_samples)
1207 switch (
out->format) {
1210 int16_t *dst = ((int16_t *)
out->extended_data[p]) + oo;
1211 for (
int i = 0, j = nb_samples - 1;
i < nb_samples;
i++, j--)
1218 for (
int i = 0, j = nb_samples - 1;
i < nb_samples;
i++, j--)
1224 float *dst = ((
float *)
out->extended_data[p]) + oo;
1225 for (
int i = 0, j = nb_samples - 1;
i < nb_samples;
i++, j--)
1231 double *dst = ((
double *)
out->extended_data[p]) + oo;
1232 for (
int i = 0, j = nb_samples - 1;
i < nb_samples;
i++, j--)
1250 for (ch = start; ch < end; ch++) {
1260 if (!
s->block_samples) {
1262 s->cache[0]->extended_data[ch],
s->clip+ch,
ctx->is_disabled);
1263 }
else if (
td->eof) {
1264 memcpy(out_buf->
extended_data[ch],
s->block[1]->extended_data[ch] +
s->block_align *
s->block_samples,
1265 s->nb_samples *
s->block_align);
1267 memcpy(
s->block[0]->extended_data[ch] +
s->block_align *
s->block_samples, buf->
extended_data[ch],
1269 memset(
s->block[0]->extended_data[ch] +
s->block_align * (
s->block_samples + buf->
nb_samples),
1270 0, (
s->block_samples - buf->
nb_samples) *
s->block_align);
1271 s->filter(
s,
s->block[0]->extended_data[ch],
s->block[1]->extended_data[ch],
s->block_samples,
1272 s->cache[0]->extended_data[ch],
s->clip+ch,
ctx->is_disabled);
1274 s->cache[0]->nb_samples,
s->cache[0]->ch_layout.nb_channels,
1275 s->cache[0]->format);
1276 s->filter(
s,
s->block[0]->extended_data[ch] +
s->block_samples *
s->block_align,
1277 s->block[1]->extended_data[ch] +
s->block_samples *
s->block_align,
1278 s->block_samples,
s->cache[1]->extended_data[ch],
s->clip+ch,
1282 s->cache[1]->ch_layout.nb_channels,
s->cache[1]->format);
1283 s->filter(
s,
s->block[2]->extended_data[ch],
s->block[2]->extended_data[ch], 2 *
s->block_samples,
1284 s->cache[1]->extended_data[ch],
s->clip+ch,
ctx->is_disabled);
1286 memcpy(out_buf->
extended_data[ch],
s->block[1]->extended_data[ch],
1287 s->block_samples *
s->block_align);
1288 memmove(
s->block[0]->extended_data[ch],
s->block[0]->extended_data[ch] +
s->block_align *
s->block_samples,
1289 s->block_samples *
s->block_align);
1303 int ch,
ret, drop = 0;
1313 if (strcmp(
s->ch_layout_str,
"all"))
1337 if (
s->clip[ch] > 0)
1343 if (
s->block_samples > 0) {
1347 out_buf->
pts =
s->pts;
1350 s->nb_samples = nb_samples;
1377 if (
s->block_samples > 0) {
1393 if (
s->block_samples > 0) {
1412 char *res,
int res_len,
int flags)
1428 for (
int i = 0;
i < 3;
i++)
1444 #define OFFSET(x) offsetof(BiquadsContext, x)
1445 #define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
1446 #define AF AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
1448 #define DEFINE_BIQUAD_FILTER_2(name_, description_, priv_class_) \
1449 static av_cold int name_##_init(AVFilterContext *ctx) \
1451 BiquadsContext *s = ctx->priv; \
1452 s->filter_type = name_; \
1453 s->pts = AV_NOPTS_VALUE; \
1457 const AVFilter ff_af_##name_ = { \
1459 .description = NULL_IF_CONFIG_SMALL(description_), \
1460 .priv_class = &priv_class_##_class, \
1461 .priv_size = sizeof(BiquadsContext), \
1462 .init = name_##_init, \
1463 .activate = activate, \
1465 FILTER_INPUTS(ff_audio_default_filterpad), \
1466 FILTER_OUTPUTS(outputs), \
1467 FILTER_QUERY_FUNC(query_formats), \
1468 .process_command = process_command, \
1469 .flags = AVFILTER_FLAG_SLICE_THREADS | AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL, \
1472 #define DEFINE_BIQUAD_FILTER(name, description) \
1473 AVFILTER_DEFINE_CLASS(name); \
1474 DEFINE_BIQUAD_FILTER_2(name, description, name)
1476 #define WIDTH_OPTION(x) \
1477 {"width", "set width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=x}, 0, 99999, FLAGS}, \
1478 {"w", "set width", OFFSET(width), AV_OPT_TYPE_DOUBLE, {.dbl=x}, 0, 99999, FLAGS}
1480 #define WIDTH_TYPE_OPTION(x) \
1481 {"width_type", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=x}, HERTZ, NB_WTYPE-1, FLAGS, .unit = "width_type"}, \
1482 {"t", "set filter-width type", OFFSET(width_type), AV_OPT_TYPE_INT, {.i64=x}, HERTZ, NB_WTYPE-1, FLAGS, .unit = "width_type"}, \
1483 {"h", "Hz", 0, AV_OPT_TYPE_CONST, {.i64=HERTZ}, 0, 0, FLAGS, .unit = "width_type"}, \
1484 {"q", "Q-Factor", 0, AV_OPT_TYPE_CONST, {.i64=QFACTOR}, 0, 0, FLAGS, .unit = "width_type"}, \
1485 {"o", "octave", 0, AV_OPT_TYPE_CONST, {.i64=OCTAVE}, 0, 0, FLAGS, .unit = "width_type"}, \
1486 {"s", "slope", 0, AV_OPT_TYPE_CONST, {.i64=SLOPE}, 0, 0, FLAGS, .unit = "width_type"}, \
1487 {"k", "kHz", 0, AV_OPT_TYPE_CONST, {.i64=KHERTZ}, 0, 0, FLAGS, .unit = "width_type"}
1489 #define MIX_CHANNELS_NORMALIZE_OPTION(x, y, z) \
1490 {"mix", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=x}, 0, 1, FLAGS}, \
1491 {"m", "set mix", OFFSET(mix), AV_OPT_TYPE_DOUBLE, {.dbl=x}, 0, 1, FLAGS}, \
1492 {"channels", "set channels to filter", OFFSET(ch_layout_str), AV_OPT_TYPE_STRING, {.str=y}, 0, 0, FLAGS}, \
1493 {"c", "set channels to filter", OFFSET(ch_layout_str), AV_OPT_TYPE_STRING, {.str=y}, 0, 0, FLAGS}, \
1494 {"normalize", "normalize coefficients", OFFSET(normalize), AV_OPT_TYPE_BOOL, {.i64=z}, 0, 1, FLAGS}, \
1495 {"n", "normalize coefficients", OFFSET(normalize), AV_OPT_TYPE_BOOL, {.i64=z}, 0, 1, FLAGS}
1497 #define TRANSFORM_OPTION(x) \
1498 {"transform", "set transform type", OFFSET(transform_type), AV_OPT_TYPE_INT, {.i64=x}, 0, NB_TTYPE-1, AF, .unit = "transform_type"}, \
1499 {"a", "set transform type", OFFSET(transform_type), AV_OPT_TYPE_INT, {.i64=x}, 0, NB_TTYPE-1, AF, .unit = "transform_type"}, \
1500 {"di", "direct form I", 0, AV_OPT_TYPE_CONST, {.i64=DI}, 0, 0, AF, .unit = "transform_type"}, \
1501 {"dii", "direct form II", 0, AV_OPT_TYPE_CONST, {.i64=DII}, 0, 0, AF, .unit = "transform_type"}, \
1502 {"tdi", "transposed direct form I", 0, AV_OPT_TYPE_CONST, {.i64=TDI}, 0, 0, AF, .unit = "transform_type"}, \
1503 {"tdii", "transposed direct form II", 0, AV_OPT_TYPE_CONST, {.i64=TDII}, 0, 0, AF, .unit = "transform_type"}, \
1504 {"latt", "lattice-ladder form", 0, AV_OPT_TYPE_CONST, {.i64=LATT}, 0, 0, AF, .unit = "transform_type"}, \
1505 {"svf", "state variable filter form", 0, AV_OPT_TYPE_CONST, {.i64=SVF}, 0, 0, AF, .unit = "transform_type"}, \
1506 {"zdf", "zero-delay filter form", 0, AV_OPT_TYPE_CONST, {.i64=ZDF}, 0, 0, AF, .unit = "transform_type"}
1508 #define PRECISION_OPTION(x) \
1509 {"precision", "set filtering precision", OFFSET(precision), AV_OPT_TYPE_INT, {.i64=x}, -1, 3, AF, .unit = "precision"}, \
1510 {"r", "set filtering precision", OFFSET(precision), AV_OPT_TYPE_INT, {.i64=x}, -1, 3, AF, .unit = "precision"}, \
1511 {"auto", "automatic", 0, AV_OPT_TYPE_CONST, {.i64=-1}, 0, 0, AF, .unit = "precision"}, \
1512 {"s16", "signed 16-bit", 0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, AF, .unit = "precision"}, \
1513 {"s32", "signed 32-bit", 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, AF, .unit = "precision"}, \
1514 {"f32", "floating-point single", 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, AF, .unit = "precision"}, \
1515 {"f64", "floating-point double", 0, AV_OPT_TYPE_CONST, {.i64=3}, 0, 0, AF, .unit = "precision"}
1517 #define BLOCKSIZE_OPTION(x) \
1518 {"blocksize", "set the block size", OFFSET(block_samples), AV_OPT_TYPE_INT, {.i64=x}, 0, 32768, AF}, \
1519 {"b", "set the block size", OFFSET(block_samples), AV_OPT_TYPE_INT, {.i64=x}, 0, 32768, AF}
1521 #if CONFIG_EQUALIZER_FILTER
1522 static const AVOption equalizer_options[] = {
1538 #if CONFIG_BASS_FILTER || CONFIG_LOWSHELF_FILTER
1539 static const AVOption bass_lowshelf_options[] = {
1556 #if CONFIG_BASS_FILTER
1560 #if CONFIG_LOWSHELF_FILTER
1564 #if CONFIG_TREBLE_FILTER || CONFIG_HIGHSHELF_FILTER || CONFIG_TILTSHELF_FILTER
1565 static const AVOption treble_highshelf_options[] = {
1582 treble_highshelf_options);
1584 #if CONFIG_TREBLE_FILTER
1588 #if CONFIG_HIGHSHELF_FILTER
1592 #if CONFIG_TILTSHELF_FILTER
1597 #if CONFIG_BANDPASS_FILTER
1598 static const AVOption bandpass_options[] = {
1613 #if CONFIG_BANDREJECT_FILTER
1614 static const AVOption bandreject_options[] = {
1628 #if CONFIG_LOWPASS_FILTER
1629 static const AVOption lowpass_options[] = {
1645 #if CONFIG_HIGHPASS_FILTER
1646 static const AVOption highpass_options[] = {
1662 #if CONFIG_ALLPASS_FILTER
1663 static const AVOption allpass_options[] = {
1678 #if CONFIG_BIQUAD_FILTER
1679 static const AVOption biquad_options[] = {