]> git.sesse.net Git - ffmpeg/blob - libavfilter/avf_showfreqs.c
Merge commit '2c6811397bdf13d43ca206e48d6d6da9c2cd47c6'
[ffmpeg] / libavfilter / avf_showfreqs.c
1 /*
2  * Copyright (c) 2015 Paul B Mahol
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20
21 #include <math.h>
22
23 #include "libavcodec/avfft.h"
24 #include "libavutil/audio_fifo.h"
25 #include "libavutil/avassert.h"
26 #include "libavutil/avstring.h"
27 #include "libavutil/channel_layout.h"
28 #include "libavutil/intreadwrite.h"
29 #include "libavutil/opt.h"
30 #include "libavutil/parseutils.h"
31 #include "audio.h"
32 #include "video.h"
33 #include "avfilter.h"
34 #include "internal.h"
35 #include "window_func.h"
36
37 enum DisplayMode    { LINE, BAR, DOT, NB_MODES };
38 enum ChannelMode    { COMBINED, SEPARATE, NB_CMODES };
39 enum FrequencyScale { FS_LINEAR, FS_LOG, FS_RLOG, NB_FSCALES };
40 enum AmplitudeScale { AS_LINEAR, AS_SQRT, AS_CBRT, AS_LOG, NB_ASCALES };
41
42 typedef struct ShowFreqsContext {
43     const AVClass *class;
44     int w, h;
45     int mode;
46     int cmode;
47     int fft_bits;
48     int ascale, fscale;
49     int avg;
50     int win_func;
51     FFTContext *fft;
52     FFTComplex **fft_data;
53     float **avg_data;
54     float *window_func_lut;
55     float overlap;
56     int skip_samples;
57     int nb_channels;
58     int nb_freq;
59     int win_size;
60     float scale;
61     char *colors;
62     AVAudioFifo *fifo;
63     int64_t pts;
64 } ShowFreqsContext;
65
66 #define OFFSET(x) offsetof(ShowFreqsContext, x)
67 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
68
69 static const AVOption showfreqs_options[] = {
70     { "size", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str = "1024x512"}, 0, 0, FLAGS },
71     { "s",    "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str = "1024x512"}, 0, 0, FLAGS },
72     { "mode", "set display mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=BAR}, 0, NB_MODES-1, FLAGS, "mode" },
73         { "line", "show lines",  0, AV_OPT_TYPE_CONST, {.i64=LINE},   0, 0, FLAGS, "mode" },
74         { "bar",  "show bars",   0, AV_OPT_TYPE_CONST, {.i64=BAR},    0, 0, FLAGS, "mode" },
75         { "dot",  "show dots",   0, AV_OPT_TYPE_CONST, {.i64=DOT},    0, 0, FLAGS, "mode" },
76     { "ascale", "set amplitude scale", OFFSET(ascale), AV_OPT_TYPE_INT, {.i64=AS_LOG}, 0, NB_ASCALES-1, FLAGS, "ascale" },
77         { "lin",  "linear",      0, AV_OPT_TYPE_CONST, {.i64=AS_LINEAR}, 0, 0, FLAGS, "ascale" },
78         { "sqrt", "square root", 0, AV_OPT_TYPE_CONST, {.i64=AS_SQRT},   0, 0, FLAGS, "ascale" },
79         { "cbrt", "cubic root",  0, AV_OPT_TYPE_CONST, {.i64=AS_CBRT},   0, 0, FLAGS, "ascale" },
80         { "log",  "logarithmic", 0, AV_OPT_TYPE_CONST, {.i64=AS_LOG},    0, 0, FLAGS, "ascale" },
81     { "fscale", "set frequency scale", OFFSET(fscale), AV_OPT_TYPE_INT, {.i64=FS_LINEAR}, 0, NB_FSCALES-1, FLAGS, "fscale" },
82         { "lin",  "linear",              0, AV_OPT_TYPE_CONST, {.i64=FS_LINEAR}, 0, 0, FLAGS, "fscale" },
83         { "log",  "logarithmic",         0, AV_OPT_TYPE_CONST, {.i64=FS_LOG},    0, 0, FLAGS, "fscale" },
84         { "rlog", "reverse logarithmic", 0, AV_OPT_TYPE_CONST, {.i64=FS_RLOG},   0, 0, FLAGS, "fscale" },
85     { "win_size", "set window size", OFFSET(fft_bits), AV_OPT_TYPE_INT, {.i64=11}, 4, 16, FLAGS, "fft" },
86         { "w16",    0, 0, AV_OPT_TYPE_CONST, {.i64=4},  0, 0, FLAGS, "fft" },
87         { "w32",    0, 0, AV_OPT_TYPE_CONST, {.i64=5},  0, 0, FLAGS, "fft" },
88         { "w64",    0, 0, AV_OPT_TYPE_CONST, {.i64=6},  0, 0, FLAGS, "fft" },
89         { "w128",   0, 0, AV_OPT_TYPE_CONST, {.i64=7},  0, 0, FLAGS, "fft" },
90         { "w256",   0, 0, AV_OPT_TYPE_CONST, {.i64=8},  0, 0, FLAGS, "fft" },
91         { "w512",   0, 0, AV_OPT_TYPE_CONST, {.i64=9},  0, 0, FLAGS, "fft" },
92         { "w1024",  0, 0, AV_OPT_TYPE_CONST, {.i64=10}, 0, 0, FLAGS, "fft" },
93         { "w2048",  0, 0, AV_OPT_TYPE_CONST, {.i64=11}, 0, 0, FLAGS, "fft" },
94         { "w4096",  0, 0, AV_OPT_TYPE_CONST, {.i64=12}, 0, 0, FLAGS, "fft" },
95         { "w8192",  0, 0, AV_OPT_TYPE_CONST, {.i64=13}, 0, 0, FLAGS, "fft" },
96         { "w16384", 0, 0, AV_OPT_TYPE_CONST, {.i64=14}, 0, 0, FLAGS, "fft" },
97         { "w32768", 0, 0, AV_OPT_TYPE_CONST, {.i64=15}, 0, 0, FLAGS, "fft" },
98         { "w65536", 0, 0, AV_OPT_TYPE_CONST, {.i64=16}, 0, 0, FLAGS, "fft" },
99     { "win_func", "set window function", OFFSET(win_func), AV_OPT_TYPE_INT, {.i64=WFUNC_HANNING}, 0, NB_WFUNC-1, FLAGS, "win_func" },
100         { "rect",     "Rectangular",      0, AV_OPT_TYPE_CONST, {.i64=WFUNC_RECT},     0, 0, FLAGS, "win_func" },
101         { "bartlett", "Bartlett",         0, AV_OPT_TYPE_CONST, {.i64=WFUNC_BARTLETT}, 0, 0, FLAGS, "win_func" },
102         { "hanning",  "Hanning",          0, AV_OPT_TYPE_CONST, {.i64=WFUNC_HANNING},  0, 0, FLAGS, "win_func" },
103         { "hamming",  "Hamming",          0, AV_OPT_TYPE_CONST, {.i64=WFUNC_HAMMING},  0, 0, FLAGS, "win_func" },
104         { "blackman", "Blackman",         0, AV_OPT_TYPE_CONST, {.i64=WFUNC_BLACKMAN}, 0, 0, FLAGS, "win_func" },
105         { "welch",    "Welch",            0, AV_OPT_TYPE_CONST, {.i64=WFUNC_WELCH},    0, 0, FLAGS, "win_func" },
106         { "flattop",  "Flat-top",         0, AV_OPT_TYPE_CONST, {.i64=WFUNC_FLATTOP},  0, 0, FLAGS, "win_func" },
107         { "bharris",  "Blackman-Harris",  0, AV_OPT_TYPE_CONST, {.i64=WFUNC_BHARRIS},  0, 0, FLAGS, "win_func" },
108         { "bnuttall", "Blackman-Nuttall", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_BNUTTALL}, 0, 0, FLAGS, "win_func" },
109         { "bhann",    "Bartlett-Hann",    0, AV_OPT_TYPE_CONST, {.i64=WFUNC_BHANN},    0, 0, FLAGS, "win_func" },
110         { "sine",     "Sine",             0, AV_OPT_TYPE_CONST, {.i64=WFUNC_SINE},     0, 0, FLAGS, "win_func" },
111         { "nuttall",  "Nuttall",          0, AV_OPT_TYPE_CONST, {.i64=WFUNC_NUTTALL},  0, 0, FLAGS, "win_func" },
112         { "lanczos",  "Lanczos",          0, AV_OPT_TYPE_CONST, {.i64=WFUNC_LANCZOS},  0, 0, FLAGS, "win_func" },
113         { "gauss",    "Gauss",            0, AV_OPT_TYPE_CONST, {.i64=WFUNC_GAUSS},    0, 0, FLAGS, "win_func" },
114     { "overlap",  "set window overlap", OFFSET(overlap), AV_OPT_TYPE_FLOAT, {.dbl=1.}, 0., 1., FLAGS },
115     { "averaging", "set time averaging", OFFSET(avg), AV_OPT_TYPE_INT, {.i64=1}, 0, INT32_MAX, FLAGS },
116     { "colors", "set channels colors", OFFSET(colors), AV_OPT_TYPE_STRING, {.str = "red|green|blue|yellow|orange|lime|pink|magenta|brown" }, 0, 0, FLAGS },
117     { "cmode", "set channel mode", OFFSET(cmode), AV_OPT_TYPE_INT, {.i64=COMBINED}, 0, NB_CMODES-1, FLAGS, "cmode" },
118         { "combined", "show all channels in same window",  0, AV_OPT_TYPE_CONST, {.i64=COMBINED}, 0, 0, FLAGS, "cmode" },
119         { "separate", "show each channel in own window",   0, AV_OPT_TYPE_CONST, {.i64=SEPARATE}, 0, 0, FLAGS, "cmode" },
120     { NULL }
121 };
122
123 AVFILTER_DEFINE_CLASS(showfreqs);
124
125 static int query_formats(AVFilterContext *ctx)
126 {
127     AVFilterFormats *formats = NULL;
128     AVFilterChannelLayouts *layouts = NULL;
129     AVFilterLink *inlink = ctx->inputs[0];
130     AVFilterLink *outlink = ctx->outputs[0];
131     static const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE };
132     static const enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_RGBA, AV_PIX_FMT_NONE };
133     int ret;
134
135     /* set input audio formats */
136     formats = ff_make_format_list(sample_fmts);
137     if ((ret = ff_formats_ref(formats, &inlink->out_formats)) < 0)
138         return ret;
139
140     layouts = ff_all_channel_layouts();
141     if ((ret = ff_channel_layouts_ref(layouts, &inlink->out_channel_layouts)) < 0)
142         return ret;
143
144     formats = ff_all_samplerates();
145     if ((ret = ff_formats_ref(formats, &inlink->out_samplerates)) < 0)
146         return ret;
147
148     /* set output video format */
149     formats = ff_make_format_list(pix_fmts);
150     if ((ret = ff_formats_ref(formats, &outlink->in_formats)) < 0)
151         return ret;
152
153     return 0;
154 }
155
156 static int config_output(AVFilterLink *outlink)
157 {
158     AVFilterContext *ctx = outlink->src;
159     AVFilterLink *inlink = ctx->inputs[0];
160     ShowFreqsContext *s = ctx->priv;
161     float overlap;
162     int i;
163
164     s->nb_freq = 1 << (s->fft_bits - 1);
165     s->win_size = s->nb_freq << 1;
166     av_audio_fifo_free(s->fifo);
167     av_fft_end(s->fft);
168     s->fft = av_fft_init(s->fft_bits, 0);
169     if (!s->fft) {
170         av_log(ctx, AV_LOG_ERROR, "Unable to create FFT context. "
171                "The window size might be too high.\n");
172         return AVERROR(ENOMEM);
173     }
174
175     /* FFT buffers: x2 for each (display) channel buffer.
176      * Note: we use free and malloc instead of a realloc-like function to
177      * make sure the buffer is aligned in memory for the FFT functions. */
178     for (i = 0; i < s->nb_channels; i++) {
179         av_freep(&s->fft_data[i]);
180         av_freep(&s->avg_data[i]);
181     }
182     av_freep(&s->fft_data);
183     av_freep(&s->avg_data);
184     s->nb_channels = inlink->channels;
185
186     s->fft_data = av_calloc(s->nb_channels, sizeof(*s->fft_data));
187     if (!s->fft_data)
188         return AVERROR(ENOMEM);
189     s->avg_data = av_calloc(s->nb_channels, sizeof(*s->avg_data));
190     if (!s->fft_data)
191         return AVERROR(ENOMEM);
192     for (i = 0; i < s->nb_channels; i++) {
193         s->fft_data[i] = av_calloc(s->win_size, sizeof(**s->fft_data));
194         s->avg_data[i] = av_calloc(s->nb_freq, sizeof(**s->avg_data));
195         if (!s->fft_data[i] || !s->avg_data[i])
196             return AVERROR(ENOMEM);
197     }
198
199     /* pre-calc windowing function */
200     s->window_func_lut = av_realloc_f(s->window_func_lut, s->win_size,
201                                       sizeof(*s->window_func_lut));
202     if (!s->window_func_lut)
203         return AVERROR(ENOMEM);
204     ff_generate_window_func(s->window_func_lut, s->win_size, s->win_func, &overlap);
205     if (s->overlap == 1.)
206         s->overlap = overlap;
207     s->skip_samples = (1. - s->overlap) * s->win_size;
208     if (s->skip_samples < 1) {
209         av_log(ctx, AV_LOG_ERROR, "overlap %f too big\n", s->overlap);
210         return AVERROR(EINVAL);
211     }
212
213     for (s->scale = 0, i = 0; i < s->win_size; i++) {
214         s->scale += s->window_func_lut[i] * s->window_func_lut[i];
215     }
216
217     outlink->frame_rate = av_make_q(inlink->sample_rate, s->win_size * (1.-s->overlap));
218     outlink->sample_aspect_ratio = (AVRational){1,1};
219     outlink->w = s->w;
220     outlink->h = s->h;
221
222     s->fifo = av_audio_fifo_alloc(inlink->format, inlink->channels, s->win_size);
223     if (!s->fifo)
224         return AVERROR(ENOMEM);
225     return 0;
226 }
227
228 static inline void draw_dot(AVFrame *out, int x, int y, uint8_t fg[4])
229 {
230
231     uint32_t color = AV_RL32(out->data[0] + y * out->linesize[0] + x * 4);
232
233     if ((color & 0xffffff) != 0)
234         AV_WL32(out->data[0] + y * out->linesize[0] + x * 4, AV_RL32(fg) | color);
235     else
236         AV_WL32(out->data[0] + y * out->linesize[0] + x * 4, AV_RL32(fg));
237 }
238
239 static int get_sx(ShowFreqsContext *s, int f)
240 {
241     switch (s->fscale) {
242     case FS_LINEAR:
243         return (s->w/(float)s->nb_freq)*f;
244     case FS_LOG:
245         return s->w-pow(s->w, (s->nb_freq-f-1)/(s->nb_freq-1.));
246     case FS_RLOG:
247         return pow(s->w, f/(s->nb_freq-1.));
248     }
249
250     return 0;
251 }
252
253 static float get_bsize(ShowFreqsContext *s, int f)
254 {
255     switch (s->fscale) {
256     case FS_LINEAR:
257         return s->w/(float)s->nb_freq;
258     case FS_LOG:
259         return pow(s->w, (s->nb_freq-f-1)/(s->nb_freq-1.))-
260                pow(s->w, (s->nb_freq-f-2)/(s->nb_freq-1.));
261     case FS_RLOG:
262         return pow(s->w, (f+1)/(s->nb_freq-1.))-
263                pow(s->w,  f   /(s->nb_freq-1.));
264     }
265
266     return 1.;
267 }
268
269 static inline void plot_freq(ShowFreqsContext *s, int ch,
270                              double a, int f, uint8_t fg[4], int *prev_y,
271                              AVFrame *out, AVFilterLink *outlink)
272 {
273     const int w = s->w;
274     const float avg = s->avg_data[ch][f];
275     const float bsize = get_bsize(s, f);
276     const int sx = get_sx(s, f);
277     int end = outlink->h;
278     int x, y, i;
279
280     switch(s->ascale) {
281     case AS_SQRT:
282         a = 1.0 - sqrt(a);
283         break;
284     case AS_CBRT:
285         a = 1.0 - cbrt(a);
286         break;
287     case AS_LOG:
288         a = log(av_clipd(a, 1e-6, 1)) / log(1e-6);
289         break;
290     case AS_LINEAR:
291         a = 1.0 - a;
292         break;
293     }
294
295     switch (s->cmode) {
296     case COMBINED:
297         y = a * outlink->h - 1;
298         break;
299     case SEPARATE:
300         end = (outlink->h / s->nb_channels) * (ch + 1);
301         y = (outlink->h / s->nb_channels) * ch + a * (outlink->h / s->nb_channels) - 1;
302         break;
303     }
304     if (y < 0)
305         return;
306
307     switch (s->avg) {
308     case 0:
309         y = s->avg_data[ch][f] = !outlink->frame_count ? y : FFMIN(avg, y);
310         break;
311     case 1:
312         break;
313     default:
314         s->avg_data[ch][f] = avg + y * (y - avg) / (FFMIN(outlink->frame_count + 1, s->avg) * y);
315         y = s->avg_data[ch][f];
316         break;
317     }
318
319     switch(s->mode) {
320     case LINE:
321         if (*prev_y == -1) {
322             *prev_y = y;
323         }
324         if (y <= *prev_y) {
325             for (x = sx + 1; x < sx + bsize && x < w; x++)
326                 draw_dot(out, x, y, fg);
327             for (i = y; i <= *prev_y; i++)
328                 draw_dot(out, sx, i, fg);
329         } else {
330             for (i = *prev_y; i <= y; i++)
331                 draw_dot(out, sx, i, fg);
332             for (x = sx + 1; x < sx + bsize && x < w; x++)
333                 draw_dot(out, x, i - 1, fg);
334         }
335         *prev_y = y;
336         break;
337     case BAR:
338         for (x = sx; x < sx + bsize && x < w; x++)
339             for (i = y; i < end; i++)
340                 draw_dot(out, x, i, fg);
341         break;
342     case DOT:
343         for (x = sx; x < sx + bsize && x < w; x++)
344             draw_dot(out, x, y, fg);
345         break;
346     }
347 }
348
349 static int plot_freqs(AVFilterLink *inlink, AVFrame *in)
350 {
351     AVFilterContext *ctx = inlink->dst;
352     AVFilterLink *outlink = ctx->outputs[0];
353     ShowFreqsContext *s = ctx->priv;
354     const int win_size = s->win_size;
355     char *colors, *color, *saveptr = NULL;
356     AVFrame *out;
357     int ch, n;
358
359     out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
360     if (!out)
361         return AVERROR(ENOMEM);
362
363     for (n = 0; n < outlink->h; n++)
364         memset(out->data[0] + out->linesize[0] * n, 0, outlink->w * 4);
365
366     /* fill FFT input with the number of samples available */
367     for (ch = 0; ch < s->nb_channels; ch++) {
368         const float *p = (float *)in->extended_data[ch];
369
370         for (n = 0; n < in->nb_samples; n++) {
371             s->fft_data[ch][n].re = p[n] * s->window_func_lut[n];
372             s->fft_data[ch][n].im = 0;
373         }
374         for (; n < win_size; n++) {
375             s->fft_data[ch][n].re = 0;
376             s->fft_data[ch][n].im = 0;
377         }
378     }
379
380     /* run FFT on each samples set */
381     for (ch = 0; ch < s->nb_channels; ch++) {
382         av_fft_permute(s->fft, s->fft_data[ch]);
383         av_fft_calc(s->fft, s->fft_data[ch]);
384     }
385
386 #define RE(x, ch) s->fft_data[ch][x].re
387 #define IM(x, ch) s->fft_data[ch][x].im
388 #define M(a, b) (sqrt((a) * (a) + (b) * (b)))
389
390     colors = av_strdup(s->colors);
391     if (!colors) {
392         av_frame_free(&out);
393         return AVERROR(ENOMEM);
394     }
395
396     for (ch = 0; ch < s->nb_channels; ch++) {
397         uint8_t fg[4] = { 0xff, 0xff, 0xff, 0xff };
398         int prev_y = -1, f;
399         double a;
400
401         color = av_strtok(ch == 0 ? colors : NULL, " |", &saveptr);
402         if (color)
403             av_parse_color(fg, color, -1, ctx);
404
405         a = av_clipd(M(RE(0, ch), 0) / s->scale, 0, 1);
406         plot_freq(s, ch, a, 0, fg, &prev_y, out, outlink);
407
408         for (f = 1; f < s->nb_freq; f++) {
409             a = av_clipd(M(RE(f, ch), IM(f, ch)) / s->scale, 0, 1);
410
411             plot_freq(s, ch, a, f, fg, &prev_y, out, outlink);
412         }
413     }
414
415     av_free(colors);
416     out->pts = in->pts;
417     return ff_filter_frame(outlink, out);
418 }
419
420 static int filter_frame(AVFilterLink *inlink, AVFrame *in)
421 {
422     AVFilterContext *ctx = inlink->dst;
423     ShowFreqsContext *s = ctx->priv;
424     AVFrame *fin = NULL;
425     int ret = 0;
426
427     av_audio_fifo_write(s->fifo, (void **)in->extended_data, in->nb_samples);
428     while (av_audio_fifo_size(s->fifo) >= s->win_size) {
429         fin = ff_get_audio_buffer(inlink, s->win_size);
430         if (!fin) {
431             ret = AVERROR(ENOMEM);
432             goto fail;
433         }
434
435         fin->pts = s->pts;
436         s->pts += s->skip_samples;
437         ret = av_audio_fifo_peek(s->fifo, (void **)fin->extended_data, s->win_size);
438         if (ret < 0)
439             goto fail;
440
441         ret = plot_freqs(inlink, fin);
442         av_frame_free(&fin);
443         av_audio_fifo_drain(s->fifo, s->skip_samples);
444         if (ret < 0)
445             goto fail;
446     }
447
448 fail:
449     av_frame_free(&fin);
450     av_frame_free(&in);
451     return ret;
452 }
453
454 static av_cold void uninit(AVFilterContext *ctx)
455 {
456     ShowFreqsContext *s = ctx->priv;
457     int i;
458
459     av_fft_end(s->fft);
460     for (i = 0; i < s->nb_channels; i++) {
461         av_freep(&s->fft_data[i]);
462         av_freep(&s->avg_data[i]);
463     }
464     av_freep(&s->fft_data);
465     av_freep(&s->avg_data);
466     av_freep(&s->window_func_lut);
467     av_audio_fifo_free(s->fifo);
468 }
469
470 static const AVFilterPad showfreqs_inputs[] = {
471     {
472         .name         = "default",
473         .type         = AVMEDIA_TYPE_AUDIO,
474         .filter_frame = filter_frame,
475     },
476     { NULL }
477 };
478
479 static const AVFilterPad showfreqs_outputs[] = {
480     {
481         .name          = "default",
482         .type          = AVMEDIA_TYPE_VIDEO,
483         .config_props  = config_output,
484     },
485     { NULL }
486 };
487
488 AVFilter ff_avf_showfreqs = {
489     .name          = "showfreqs",
490     .description   = NULL_IF_CONFIG_SMALL("Convert input audio to a frequencies video output."),
491     .uninit        = uninit,
492     .query_formats = query_formats,
493     .priv_size     = sizeof(ShowFreqsContext),
494     .inputs        = showfreqs_inputs,
495     .outputs       = showfreqs_outputs,
496     .priv_class    = &showfreqs_class,
497 };