65 #define OFFSET(x) offsetof(ShowSpectrumContext, x)
66 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
97 { 0.13, .03587126228984074, .1573300977624594, -.02548747583751842 },
98 { 0.30, .18572281794568020, .1772436246393981, .17475554840414750 },
99 { 0.60, .28184980583656130, -.1593064119945782, .47132074554608920 },
100 { 0.73, .65830621175547810, -.3716070802232764, .24352759331252930 },
101 { 0.78, .76318535758242900, -.4307467689263783, .16866496622310430 },
102 { 0.91, .95336363636363640, -.2045454545454546, .03313636363636363 },
159 int i, rdft_bits, win_size, h;
168 for (rdft_bits = 1; 1 << rdft_bits < 2 * h; rdft_bits++);
169 win_size = 1 << rdft_bits;
173 size_t rdft_size, rdft_listsize;
192 win_size, &rdft_size) < 0)
212 for (i = 0; i < win_size; i++)
216 for (i = 0; i < win_size; i++)
220 for (i = 0; i < win_size; i++)
224 for (i = 0; i < win_size; i++)
239 for (i = 0; i < outlink->
h; i++) {
240 memset(outpicref->
data[0] + i * outpicref->
linesize[0], 0, outlink->
w);
241 memset(outpicref->
data[1] + i * outpicref->
linesize[1], 128, outlink->
w);
242 memset(outpicref->
data[2] + i * outpicref->
linesize[2], 128, outlink->
w);
246 if (s->
xpos >= outlink->
w)
254 s->
w, s->
h, win_size);
263 if (s->
xpos >= outlink->
w)
297 const int nb_freq = 1 << (s->
rdft_bits - 1);
298 const int win_size = nb_freq << 1;
299 const double w = 1. / (sqrt(nb_freq) * 32768.);
303 const int add_samples =
FFMIN(win_size - start, nb_samples);
310 for (n = 0; n < add_samples; n++)
316 if (s->
filled == win_size) {
326 #define RE(y, ch) s->rdft_data[ch][2 * (y) + 0]
327 #define IM(y, ch) s->rdft_data[ch][2 * (y) + 1]
328 #define MAGNITUDE(y, ch) hypot(RE(y, ch), IM(y, ch))
331 for (y = 0; y < outlink->
h; y++) {
383 for (y = 0; y < h; y++) {
401 a = 1 - log(
FFMAX(
FFMIN(1, a), 1e-6)) / log(1e-6);
427 float lerpfrac = (a -
start) / (end - start);
449 for (plane = 0; plane < 3; plane++) {
450 for (y = 0; y < outlink->
h; y++) {
453 memmove(p, p + 1, outlink->
w - 1);
456 s->
xpos = outlink->
w - 1;
458 for (plane = 0; plane < 3; plane++) {
460 (outlink->
h - 1) * outpicref->
linesize[plane] +
462 for (y = 0; y < outlink->
h; y++) {
468 outpicref->
pts = insamples->
pts +
487 while (left_samples) {
519 .
name =
"showspectrum",
524 .
inputs = showspectrum_inputs,
525 .
outputs = showspectrum_outputs,
526 .priv_class = &showspectrum_class,