123 #define IIR_CH(name, type, min, max, need_clipping) \ 124 static int iir_ch_## name(AVFilterContext *ctx, void *arg, int ch, int nb_jobs) \ 126 AudioIIRContext *s = ctx->priv; \ 127 const double ig = s->dry_gain; \ 128 const double og = s->wet_gain; \ 129 const double mix = s->mix; \ 130 ThreadData *td = arg; \ 131 AVFrame *in = td->in, *out = td->out; \ 132 const type *src = (const type *)in->extended_data[ch]; \ 133 double *oc = (double *)s->iir[ch].cache[0]; \ 134 double *ic = (double *)s->iir[ch].cache[1]; \ 135 const int nb_a = s->iir[ch].nb_ab[0]; \ 136 const int nb_b = s->iir[ch].nb_ab[1]; \ 137 const double *a = s->iir[ch].ab[0]; \ 138 const double *b = s->iir[ch].ab[1]; \ 139 const double g = s->iir[ch].g; \ 140 int *clippings = &s->iir[ch].clippings; \ 141 type *dst = (type *)out->extended_data[ch]; \ 144 for (n = 0; n < in->nb_samples; n++) { \ 145 double sample = 0.; \ 148 memmove(&ic[1], &ic[0], (nb_b - 1) * sizeof(*ic)); \ 149 memmove(&oc[1], &oc[0], (nb_a - 1) * sizeof(*oc)); \ 150 ic[0] = src[n] * ig; \ 151 for (x = 0; x < nb_b; x++) \ 152 sample += b[x] * ic[x]; \ 154 for (x = 1; x < nb_a; x++) \ 155 sample -= a[x] * oc[x]; \ 159 sample = sample * mix + ic[0] * (1. - mix); \ 160 if (need_clipping && sample < min) { \ 163 } else if (need_clipping && sample > max) { \ 174 IIR_CH(s16p, int16_t, INT16_MIN, INT16_MAX, 1)
176 IIR_CH(fltp,
float, -1., 1., 0)
177 IIR_CH(dblp,
double, -1., 1., 0)
179 #define SERIAL_IIR_CH(name, type, min, max, need_clipping) \ 180 static int iir_ch_serial_## name(AVFilterContext *ctx, void *arg, int ch, int nb_jobs) \ 182 AudioIIRContext *s = ctx->priv; \ 183 const double ig = s->dry_gain; \ 184 const double og = s->wet_gain; \ 185 const double mix = s->mix; \ 186 ThreadData *td = arg; \ 187 AVFrame *in = td->in, *out = td->out; \ 188 const type *src = (const type *)in->extended_data[ch]; \ 189 type *dst = (type *)out->extended_data[ch]; \ 190 IIRChannel *iir = &s->iir[ch]; \ 191 const double g = iir->g; \ 192 int *clippings = &iir->clippings; \ 193 int nb_biquads = (FFMAX(iir->nb_ab[0], iir->nb_ab[1]) + 1) / 2; \ 196 for (i = 0; i < nb_biquads; i++) { \ 197 const double a1 = -iir->biquads[i].a[1]; \ 198 const double a2 = -iir->biquads[i].a[2]; \ 199 const double b0 = iir->biquads[i].b[0]; \ 200 const double b1 = iir->biquads[i].b[1]; \ 201 const double b2 = iir->biquads[i].b[2]; \ 202 double i1 = iir->biquads[i].i1; \ 203 double i2 = iir->biquads[i].i2; \ 204 double o1 = iir->biquads[i].o1; \ 205 double o2 = iir->biquads[i].o2; \ 207 for (n = 0; n < in->nb_samples; n++) { \ 208 double sample = ig * (i ? dst[n] : src[n]); \ 209 double o0 = sample * b0 + i1 * b1 + i2 * b2 + o1 * a1 + o2 * a2; \ 217 o0 = o0 * mix + (1. - mix) * sample; \ 218 if (need_clipping && o0 < min) { \ 221 } else if (need_clipping && o0 > max) { \ 228 iir->biquads[i].i1 = i1; \ 229 iir->biquads[i].i2 = i2; \ 230 iir->biquads[i].o1 = o1; \ 231 iir->biquads[i].o2 = o2; \ 250 for (p = item_str; *p && *p !=
'|'; p++) {
259 char *
p, *
arg, *old_str, *prev_arg =
NULL, *saveptr =
NULL;
265 for (i = 0; i < nb_items; i++) {
266 if (!(arg =
av_strtok(p,
"|", &saveptr)))
275 if (sscanf(arg,
"%lf", &s->
iir[i].
g) != 1) {
291 char *
p, *
arg, *old_str, *saveptr =
NULL;
297 for (i = 0; i < nb_items; i++) {
298 if (!(arg =
av_strtok(p,
" ", &saveptr)))
302 if (sscanf(arg,
"%lf", &dst[i]) != 1) {
316 char *
p, *
arg, *old_str, *saveptr =
NULL;
322 for (i = 0; i < nb_items; i++) {
323 if (!(arg =
av_strtok(p,
" ", &saveptr)))
327 if (sscanf(arg, format, &dst[i*2], &dst[i*2+1]) != 2) {
339 static const char *
format[] = {
"%lf",
"%lf %lfi",
"%lf %lfr",
"%lf %lfd",
"%lf %lfi" };
344 char *
p, *
arg, *old_str, *prev_arg =
NULL, *saveptr =
NULL;
353 if (!(arg =
av_strtok(p,
"|", &saveptr)))
366 if (!iir->
ab[ab] || !iir->
cache[ab]) {
388 static void cmul(
double re,
double im,
double re2,
double im2,
double *
RE,
double *
IM)
390 *RE = re * re2 - im * im2;
391 *IM = re * im2 + re2 *
im;
398 for (
int i = 1;
i <=
n;
i++) {
399 for (
int j = n -
i; j <
n; j++) {
402 cmul(coefs[2 * (j + 1)], coefs[2 * (j + 1) + 1],
403 pz[2 * (
i - 1)], pz[2 * (
i - 1) + 1], &re, &im);
406 coefs[2 * j + 1] -=
im;
410 for (
int i = 0;
i < n + 1;
i++) {
411 if (fabs(coefs[2 *
i + 1]) > FLT_EPSILON) {
412 av_log(ctx,
AV_LOG_ERROR,
"coefs: %f of z^%d is not real; poles/zeros are not complex conjugates.\n",
413 coefs[2 *
i + 1],
i);
430 for (
int i = 0;
i < iir->
nb_ab[1];
i++) {
431 sum_den += iir->
ab[1][
i];
434 if (sum_den > 1e-6) {
435 double factor, sum_num = 0.;
437 for (
int i = 0;
i < iir->
nb_ab[0];
i++) {
438 sum_num += iir->
ab[0][
i];
441 factor = sum_num / sum_den;
443 for (
int i = 0;
i < iir->
nb_ab[1];
i++) {
452 int ch,
i, j, ret = 0;
460 if (!topc || !botc) {
475 for (j = 0, i = iir->
nb_ab[1]; i >= 0; j++, i--) {
476 iir->
ab[1][j] = topc[2 *
i];
480 for (j = 0, i = iir->
nb_ab[0]; i >= 0; j++, i--) {
481 iir->
ab[0][j] = botc[2 *
i];
505 int current_biquad = 0;
511 while (nb_biquads--) {
512 Pair outmost_pole = { -1, -1 };
513 Pair nearest_zero = { -1, -1 };
514 double zeros[4] = { 0 };
515 double poles[4] = { 0 };
518 double min_distance = DBL_MAX;
523 for (i = 0; i < iir->
nb_ab[0]; i++) {
528 mag =
hypot(iir->
ab[0][2 * i], iir->
ab[0][2 * i + 1]);
536 for (i = 0; i < iir->
nb_ab[0]; i++) {
540 if (iir->
ab[0][2 * i ] == iir->
ab[0][2 * outmost_pole.
a ] &&
541 iir->
ab[0][2 * i + 1] == -iir->
ab[0][2 * outmost_pole.
a + 1]) {
549 if (outmost_pole.
a < 0 || outmost_pole.
b < 0)
552 for (i = 0; i < iir->
nb_ab[1]; i++) {
557 distance =
hypot(iir->
ab[0][2 * outmost_pole.
a ] - iir->
ab[1][2 * i ],
558 iir->
ab[0][2 * outmost_pole.
a + 1] - iir->
ab[1][2 * i + 1]);
560 if (distance < min_distance) {
566 for (i = 0; i < iir->
nb_ab[1]; i++) {
570 if (iir->
ab[1][2 * i ] == iir->
ab[1][2 * nearest_zero.
a ] &&
571 iir->
ab[1][2 * i + 1] == -iir->
ab[1][2 * nearest_zero.
a + 1]) {
579 if (nearest_zero.
a < 0 || nearest_zero.
b < 0)
582 poles[0] = iir->
ab[0][2 * outmost_pole.
a ];
583 poles[1] = iir->
ab[0][2 * outmost_pole.
a + 1];
585 zeros[0] = iir->
ab[1][2 * nearest_zero.
a ];
586 zeros[1] = iir->
ab[1][2 * nearest_zero.
a + 1];
588 if (nearest_zero.
a == nearest_zero.
b && outmost_pole.
a == outmost_pole.
b) {
595 poles[2] = iir->
ab[0][2 * outmost_pole.
b ];
596 poles[3] = iir->
ab[0][2 * outmost_pole.
b + 1];
598 zeros[2] = iir->
ab[1][2 * nearest_zero.
b ];
599 zeros[3] = iir->
ab[1][2 * nearest_zero.
b + 1];
602 ret =
expand(ctx, zeros, 2, b);
606 ret =
expand(ctx, poles, 2, a);
610 iir->
ab[0][2 * outmost_pole.
a] = iir->
ab[0][2 * outmost_pole.
a + 1] =
NAN;
611 iir->
ab[0][2 * outmost_pole.
b] = iir->
ab[0][2 * outmost_pole.
b + 1] =
NAN;
612 iir->
ab[1][2 * nearest_zero.
a] = iir->
ab[1][2 * nearest_zero.
a + 1] =
NAN;
613 iir->
ab[1][2 * nearest_zero.
b] = iir->
ab[1][2 * nearest_zero.
b + 1] =
NAN;
615 iir->
biquads[current_biquad].
a[0] = 1.;
616 iir->
biquads[current_biquad].
a[1] = a[2] / a[4];
617 iir->
biquads[current_biquad].
a[2] = a[0] / a[4];
618 iir->
biquads[current_biquad].
b[0] = b[4] / a[4];
619 iir->
biquads[current_biquad].
b[1] = b[2] / a[4];
620 iir->
biquads[current_biquad].
b[2] = b[0] / a[4];
623 fabs(iir->
biquads[current_biquad].
b[0] +
625 iir->
biquads[current_biquad].
b[2]) > 1e-6) {
626 factor = (iir->
biquads[current_biquad].
a[0] +
628 iir->
biquads[current_biquad].
a[2]) /
629 (iir->
biquads[current_biquad].
b[0] +
640 iir->
biquads[current_biquad].
b[0] *= (current_biquad ? 1.0 : iir->
g);
641 iir->
biquads[current_biquad].
b[1] *= (current_biquad ? 1.0 : iir->
g);
642 iir->
biquads[current_biquad].
b[2] *= (current_biquad ? 1.0 : iir->
g);
668 for (n = 0; n < iir->
nb_ab[0]; n++) {
669 double r = iir->
ab[0][2*
n];
670 double angle = iir->
ab[0][2*n+1];
672 iir->
ab[0][2*
n] = r * cos(angle);
673 iir->
ab[0][2*n+1] = r * sin(angle);
676 for (n = 0; n < iir->
nb_ab[1]; n++) {
677 double r = iir->
ab[1][2*
n];
678 double angle = iir->
ab[1][2*n+1];
680 iir->
ab[1][2*
n] = r * cos(angle);
681 iir->
ab[1][2*n+1] = r * sin(angle);
695 for (n = 0; n < iir->
nb_ab[0]; n++) {
696 double sr = iir->
ab[0][2*
n];
697 double si = iir->
ab[0][2*n+1];
698 double snr = 1. + sr;
699 double sdr = 1. - sr;
700 double div = sdr * sdr + si * si;
702 iir->
ab[0][2*
n] = (snr * sdr - si * si) / div;
703 iir->
ab[0][2*n+1] = (sdr * si + snr * si) / div;
706 for (n = 0; n < iir->
nb_ab[1]; n++) {
707 double sr = iir->
ab[1][2*
n];
708 double si = iir->
ab[1][2*n+1];
709 double snr = 1. + sr;
710 double sdr = 1. - sr;
711 double div = sdr * sdr + si * si;
713 iir->
ab[1][2*
n] = (snr * sdr - si * si) / div;
714 iir->
ab[1][2*n+1] = (sdr * si + snr * si) / div;
728 for (n = 0; n < iir->
nb_ab[0]; n++) {
729 double r = iir->
ab[0][2*
n];
730 double angle =
M_PI*iir->
ab[0][2*n+1]/180.;
732 iir->
ab[0][2*
n] = r * cos(angle);
733 iir->
ab[0][2*n+1] = r * sin(angle);
736 for (n = 0; n < iir->
nb_ab[1]; n++) {
737 double r = iir->
ab[1][2*
n];
738 double angle =
M_PI*iir->
ab[1][2*n+1]/180.;
740 iir->
ab[1][2*
n] = r * cos(angle);
741 iir->
ab[1][2*n+1] = r * sin(angle);
754 for (
int n = 0;
n < iir->
nb_ab[0];
n++) {
755 double pr =
hypot(iir->
ab[0][2*
n], iir->
ab[0][2*
n+1]);
773 for (i = 0; txt[
i]; i++) {
777 for (char_y = 0; char_y < font_height; char_y++) {
778 for (mask = 0x80;
mask; mask >>= 1) {
779 if (font[txt[i] * font_height + char_y] & mask)
790 int dx =
FFABS(x1-x0);
791 int dy =
FFABS(y1-y0), sy = y0 < y1 ? 1 : -1;
792 int err = (dx>dy ? dx : -dy) / 2, e2;
797 if (x0 == x1 && y0 == y1)
814 static double distance(
double x0,
double x1,
double y0,
double y1)
816 return hypot(x0 - x1, y0 - y1);
820 const double *
b,
const double *
a,
821 int nb_b,
int nb_a,
double *magnitude,
double *phase)
829 realz = 0., realp = 0.;
830 imagz = 0., imagp = 0.;
831 for (
int x = 0; x < nb_a; x++) {
832 realz += cos(-x * w) * a[x];
833 imagz += sin(-x * w) * a[x];
836 for (
int x = 0; x < nb_b; x++) {
837 realp += cos(-x * w) * b[x];
838 imagp += sin(-x * w) * b[x];
841 div = realp * realp + imagp * imagp;
842 real = (realz * realp + imagz * imagp) / div;
843 imag = (imagz * realp - imagp * realz) / div;
845 *magnitude =
hypot(real, imag);
846 *phase = atan2(imag, real);
848 double p = 1., z = 1.;
851 for (
int x = 0; x < nb_a; x++) {
852 z *=
distance(cos(w), a[2 * x], sin(w), a[2 * x + 1]);
853 acc += atan2(sin(w) - a[2 * x + 1], cos(w) - a[2 * x]);
856 for (
int x = 0; x < nb_b; x++) {
857 p *=
distance(cos(w), b[2 * x], sin(w), b[2 * x + 1]);
858 acc -= atan2(sin(w) - b[2 * x + 1], cos(w) - b[2 * x]);
870 double min_delay = DBL_MAX, max_delay = -DBL_MAX, min_phase, max_phase;
871 int prev_ymag = -1, prev_yphase = -1, prev_ydelay = -1;
881 if (!mag || !phase || !delay || !temp)
885 for (i = 0; i < s->
w; i++) {
886 const double *
b = s->
iir[ch].
ab[0];
887 const double *
a = s->
iir[ch].
ab[1];
888 const int nb_b = s->
iir[ch].
nb_ab[0];
889 const int nb_a = s->
iir[ch].
nb_ab[1];
890 double w = i *
M_PI / (s->
w - 1);
895 mag[
i] = s->
iir[ch].
g *
m;
897 min =
fmin(min, mag[i]);
898 max =
fmax(max, mag[i]);
902 for (i = 0; i < s->
w - 1; i++) {
903 double d = phase[
i] - phase[i + 1];
904 temp[i + 1] = ceil(fabs(d) / (2. *
M_PI)) * 2. *
M_PI * ((d >
M_PI) - (d < -
M_PI));
907 min_phase = phase[0];
908 max_phase = phase[0];
909 for (i = 1; i < s->
w; i++) {
910 temp[
i] += temp[i - 1];
912 min_phase =
fmin(min_phase, phase[i]);
913 max_phase =
fmax(max_phase, phase[i]);
916 for (i = 0; i < s->
w - 1; i++) {
917 double div = s->
w / (double)sample_rate;
919 delay[i + 1] = -(phase[
i] - phase[i + 1]) / div;
920 min_delay =
fmin(min_delay, delay[i + 1]);
921 max_delay =
fmax(max_delay, delay[i + 1]);
925 for (i = 0; i < s->
w; i++) {
926 int ymag = mag[
i] / max * (s->
h - 1);
927 int ydelay = (delay[
i] - min_delay) / (max_delay - min_delay) * (s->
h - 1);
928 int yphase = (phase[
i] - min_phase) / (max_phase - min_phase) * (s->
h - 1);
930 ymag = s->
h - 1 - av_clip(ymag, 0, s->
h - 1);
931 yphase = s->
h - 1 - av_clip(yphase, 0, s->
h - 1);
932 ydelay = s->
h - 1 - av_clip(ydelay, 0, s->
h - 1);
937 prev_yphase = yphase;
939 prev_ydelay = ydelay;
942 draw_line(out, i, yphase,
FFMAX(i - 1, 0), prev_yphase, 0xFF00FF00);
943 draw_line(out, i, ydelay,
FFMAX(i - 1, 0), prev_ydelay, 0xFF00FFFF);
946 prev_yphase = yphase;
947 prev_ydelay = ydelay;
950 if (s->
w > 400 && s->
h > 100) {
951 drawtext(out, 2, 2,
"Max Magnitude:", 0xDDDDDDDD);
952 snprintf(text,
sizeof(text),
"%.2f", max);
953 drawtext(out, 15 * 8 + 2, 2, text, 0xDDDDDDDD);
955 drawtext(out, 2, 12,
"Min Magnitude:", 0xDDDDDDDD);
956 snprintf(text,
sizeof(text),
"%.2f", min);
957 drawtext(out, 15 * 8 + 2, 12, text, 0xDDDDDDDD);
959 drawtext(out, 2, 22,
"Max Phase:", 0xDDDDDDDD);
960 snprintf(text,
sizeof(text),
"%.2f", max_phase);
961 drawtext(out, 15 * 8 + 2, 22, text, 0xDDDDDDDD);
963 drawtext(out, 2, 32,
"Min Phase:", 0xDDDDDDDD);
964 snprintf(text,
sizeof(text),
"%.2f", min_phase);
965 drawtext(out, 15 * 8 + 2, 32, text, 0xDDDDDDDD);
967 drawtext(out, 2, 42,
"Max Delay:", 0xDDDDDDDD);
968 snprintf(text,
sizeof(text),
"%.2f", max_delay);
969 drawtext(out, 11 * 8 + 2, 42, text, 0xDDDDDDDD);
971 drawtext(out, 2, 52,
"Min Delay:", 0xDDDDDDDD);
972 snprintf(text,
sizeof(text),
"%.2f", min_delay);
973 drawtext(out, 11 * 8 + 2, 52, text, 0xDDDDDDDD);
1009 }
else if (s->
format == 3) {
1011 }
else if (s->
format == 4) {
1028 av_log(ctx,
AV_LOG_WARNING,
"tf coefficients format is not recommended for too high number of zeros/poles.\n");
1031 av_log(ctx,
AV_LOG_WARNING,
"Direct processsing is not recommended for zp coefficients format.\n");
1037 av_log(ctx,
AV_LOG_ERROR,
"Serial cascading is not implemented for transfer function.\n");
1051 for (i = 1; i < iir->
nb_ab[0]; i++) {
1052 iir->
ab[0][
i] /= iir->
ab[0][0];
1055 iir->
ab[0][0] = 1.0;
1056 for (i = 0; i < iir->
nb_ab[1]; i++) {
1057 iir->
ab[1][
i] *= iir->
g;
1063 switch (inlink->
format) {
1097 for (ch = 0; ch < outlink->
channels; ch++) {
1112 if (new_pts > old_pts) {
1173 .
name =
"filter_response",
1192 for (ch = 0; ch < s->
channels; ch++) {
1215 #define OFFSET(x) offsetof(AudioIIRContext, x) 1216 #define AF AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM 1217 #define VF AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM 1230 {
"tf",
"digital transfer function", 0,
AV_OPT_TYPE_CONST, {.i64=0}, 0, 0,
AF,
"format" },
1232 {
"pr",
"Z-plane zeros/poles (polar radians)", 0,
AV_OPT_TYPE_CONST, {.i64=2}, 0, 0,
AF,
"format" },
1233 {
"pd",
"Z-plane zeros/poles (polar degrees)", 0,
AV_OPT_TYPE_CONST, {.i64=3}, 0, 0,
AF,
"format" },
1239 {
"precision",
"set filtering precision",
OFFSET(precision),
AV_OPT_TYPE_INT, {.i64=0}, 0, 3,
AF,
"precision" },
1241 {
"dbl",
"double-precision floating-point", 0,
AV_OPT_TYPE_CONST, {.i64=0}, 0, 0,
AF,
"precision" },
1242 {
"flt",
"single-precision floating-point", 0,
AV_OPT_TYPE_CONST, {.i64=1}, 0, 0,
AF,
"precision" },
1249 {
"channel",
"set IR channel to display frequency response",
OFFSET(ir_channel),
AV_OPT_TYPE_INT, {.i64=0}, 0, 1024,
VF },
1259 .description =
NULL_IF_CONFIG_SMALL(
"Apply Infinite Impulse Response filter with supplied coefficients."),
1261 .priv_class = &aiir_class,
static double distance(double x0, double x1, double y0, double y1)
static void cmul(double re, double im, double re2, double im2, double *RE, double *IM)
static const char * format[]
This structure describes decoded (raw) audio or video data.
enum AVSampleFormat sample_format
#define AV_LOG_WARNING
Something somehow does not look correct.
Main libavfilter public API header.
static int config_video(AVFilterLink *outlink)
int h
agreed upon image height
static void convert_pd2zp(AVFilterContext *ctx, int channels)
static void drawtext(AVFrame *pic, int x, int y, const char *txt, uint32_t color)
static int decompose_zp2biquads(AVFilterContext *ctx, int channels)
#define SERIAL_IIR_CH(name, type, min, max, need_clipping)
static void count_coefficients(char *item_str, int *nb_items)
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
static int config_output(AVFilterLink *outlink)
void * av_calloc(size_t nmemb, size_t size)
Non-inlined equivalent of av_mallocz_array().
static void convert_sp2zp(AVFilterContext *ctx, int channels)
const char * name
Pad name.
AVFilterLink ** inputs
array of pointers to input links
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
packed RGB 8:8:8, 32bpp, RGBXRGBX... X=unused/undefined
static av_cold int end(AVCodecContext *avctx)
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
static av_cold int init(AVFilterContext *ctx)
static void normalize_coeffs(AVFilterContext *ctx, int ch)
#define IIR_CH(name, type, min, max, need_clipping)
#define AV_LOG_VERBOSE
Detailed information.
static int read_tf_coefficients(AVFilterContext *ctx, char *item_str, int nb_items, double *dst)
#define AVFILTER_FLAG_DYNAMIC_OUTPUTS
The number of the filter outputs is not determined just by AVFilter.outputs.
static int query_formats(AVFilterContext *ctx)
A filter pad used for either input or output.
static int expand(AVFilterContext *ctx, double *pz, int n, double *coefs)
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
A link between two filters.
#define i(width, name, range_min, range_max)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static void get_response(int channel, int format, double w, const double *b, const double *a, int nb_b, int nb_a, double *magnitude, double *phase)
const uint8_t avpriv_cga_font[2048]
AVRational frame_rate
Frame rate of the stream on the link, or 1/0 if unknown or variable; if left to 0/0, will be automatically copied from the first input of the source filter if it exists.
int sample_rate
samples per second
AVFrame * ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
Request an audio samples buffer with a specific set of permissions.
static int read_channels(AVFilterContext *ctx, int channels, uint8_t *item_str, int ab)
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void * priv
private data for use by the filter
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link...
simple assert() macros that are a bit more flexible than ISO C assert().
AVFilterFormats * in_formats
Lists of formats and channel layouts supported by the input and output filters respectively.
int w
agreed upon image width
static av_const double hypot(double x, double y)
static int convert_zp2tf(AVFilterContext *ctx, int channels)
#define FFABS(a)
Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they are not representable ...
AVFilterContext * src
source filter
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
int format
agreed upon media format
A list of supported channel layouts.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
static int mix(int c0, int c1)
char * av_strdup(const char *s)
Duplicate a string.
AVSampleFormat
Audio sample formats.
int av_frame_is_writable(AVFrame *frame)
Check if the frame data is writable.
Used for passing data between threads.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
double fmax(double, double)
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
Describe the class of an AVClass context structure.
static int read_gains(AVFilterContext *ctx, char *item_str, int nb_items)
static void convert_pr2zp(AVFilterContext *ctx, int channels)
Rational number (pair of numerator and denominator).
offset must point to AVRational
static const int factor[16]
const char * name
Filter name.
static int read_zp_coefficients(AVFilterContext *ctx, char *item_str, int nb_items, double *dst, const char *format)
AVRational sample_aspect_ratio
agreed upon sample aspect ratio
static av_cold void uninit(AVFilterContext *ctx)
offset must point to two consecutive integers
static const AVFilterPad inputs[]
AVFilterLink ** outputs
array of pointers to output links
enum MovChannelLayoutTag * layouts
static enum AVPixelFormat pix_fmts[]
#define flags(name, subs,...)
AVFilterInternal * internal
An opaque struct for libavfilter internal use.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
char * av_strtok(char *s, const char *delim, char **saveptr)
Split the string into several tokens which can be accessed by successive calls to av_strtok()...
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
int(* iir_channel)(AVFilterContext *ctx, void *arg, int ch, int nb_jobs)
static void draw_line(AVFrame *out, int x0, int y0, int x1, int y1, uint32_t color)
static void check_stability(AVFilterContext *ctx, int channels)
channel
Use these values when setting the channel map with ebur128_set_channel().
double fmin(double, double)
int channels
Number of channels.
avfilter_execute_func * execute
AVFilterContext * dst
dest filter
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
static enum AVSampleFormat sample_fmts[]
AVFILTER_DEFINE_CLASS(aiir)
#define av_malloc_array(a, b)
static void draw_response(AVFilterContext *ctx, AVFrame *out, int sample_rate)
static int ff_insert_outpad(AVFilterContext *f, unsigned index, AVFilterPad *p)
Insert a new output pad for the filter.
static void process(NormalizeContext *s, AVFrame *in, AVFrame *out)
AVPixelFormat
Pixel format.
int nb_samples
number of audio samples (per channel) described by this frame
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
static const AVOption aiir_options[]
CGA/EGA/VGA ROM font data.