History

avfilter/avf_showfreqs: make selecting window size simpler

The previous solution was very bad.

Paul B Mahol committed 7 years ago

Commit 74d4fd01 parent 57a26882 files · +5 −32Browse files

Unified · Split

2 files
  1. doc/filters.texi +2 −18
  2. libavfilter/avf_showfreqs.c +3 −14
doc/filters.texi+2−18
@@ -22346,25 +22346,9 @@ Reverse logarithmic scale. · 22345 unmodified lines
22346Default is @code{lin}.22346Default is @code{lin}.
22347 22347
22348@item win_size22348@item win_size
22349Set window size.22349Set window size. Allowed range is from 16 to 65536.
22350 22350
22351It accepts the following values:22351Default is @code{2048}
22352@table @samp
22353@item w16
22354@item w32
22355@item w64
22356@item w128
22357@item w256
22358@item w512
22359@item w1024
22360@item w2048
22361@item w4096
22362@item w8192
22363@item w16384
22364@item w32768
22365@item w65536
22366@end table
22367Default is @code{w2048}
22368 22352
22369@item win_func22353@item win_func
22370Set windowing function.22354Set windowing function.
libavfilter/avf_showfreqs.c+3−14
@@ -46,6 +46,7 @@ typedef struct ShowFreqsContext { · 45 unmodified lines
46 int w, h;46 int w, h;
47 int mode;47 int mode;
48 int cmode;48 int cmode;
49 int fft_size;
49 int fft_bits;50 int fft_bits;
50 int ascale, fscale;51 int ascale, fscale;
51 int avg;52 int avg;
@@ -85,20 +86,7 @@ static const AVOption showfreqs_options[] = { · 33 unmodified lines
85 { "lin", "linear", 0, AV_OPT_TYPE_CONST, {.i64=FS_LINEAR}, 0, 0, FLAGS, "fscale" },86 { "lin", "linear", 0, AV_OPT_TYPE_CONST, {.i64=FS_LINEAR}, 0, 0, FLAGS, "fscale" },
86 { "log", "logarithmic", 0, AV_OPT_TYPE_CONST, {.i64=FS_LOG}, 0, 0, FLAGS, "fscale" },87 { "log", "logarithmic", 0, AV_OPT_TYPE_CONST, {.i64=FS_LOG}, 0, 0, FLAGS, "fscale" },
87 { "rlog", "reverse logarithmic", 0, AV_OPT_TYPE_CONST, {.i64=FS_RLOG}, 0, 0, FLAGS, "fscale" },88 { "rlog", "reverse logarithmic", 0, AV_OPT_TYPE_CONST, {.i64=FS_RLOG}, 0, 0, FLAGS, "fscale" },
88 { "win_size", "set window size", OFFSET(fft_bits), AV_OPT_TYPE_INT, {.i64=11}, 4, 16, FLAGS, "fft" },89 { "win_size", "set window size", OFFSET(fft_size), AV_OPT_TYPE_INT, {.i64=2048}, 16, 65536, FLAGS },
89 { "w16", 0, 0, AV_OPT_TYPE_CONST, {.i64=4}, 0, 0, FLAGS, "fft" },
90 { "w32", 0, 0, AV_OPT_TYPE_CONST, {.i64=5}, 0, 0, FLAGS, "fft" },
91 { "w64", 0, 0, AV_OPT_TYPE_CONST, {.i64=6}, 0, 0, FLAGS, "fft" },
92 { "w128", 0, 0, AV_OPT_TYPE_CONST, {.i64=7}, 0, 0, FLAGS, "fft" },
93 { "w256", 0, 0, AV_OPT_TYPE_CONST, {.i64=8}, 0, 0, FLAGS, "fft" },
94 { "w512", 0, 0, AV_OPT_TYPE_CONST, {.i64=9}, 0, 0, FLAGS, "fft" },
95 { "w1024", 0, 0, AV_OPT_TYPE_CONST, {.i64=10}, 0, 0, FLAGS, "fft" },
96 { "w2048", 0, 0, AV_OPT_TYPE_CONST, {.i64=11}, 0, 0, FLAGS, "fft" },
97 { "w4096", 0, 0, AV_OPT_TYPE_CONST, {.i64=12}, 0, 0, FLAGS, "fft" },
98 { "w8192", 0, 0, AV_OPT_TYPE_CONST, {.i64=13}, 0, 0, FLAGS, "fft" },
99 { "w16384", 0, 0, AV_OPT_TYPE_CONST, {.i64=14}, 0, 0, FLAGS, "fft" },
100 { "w32768", 0, 0, AV_OPT_TYPE_CONST, {.i64=15}, 0, 0, FLAGS, "fft" },
101 { "w65536", 0, 0, AV_OPT_TYPE_CONST, {.i64=16}, 0, 0, FLAGS, "fft" },
102 { "win_func", "set window function", OFFSET(win_func), AV_OPT_TYPE_INT, {.i64=WFUNC_HANNING}, 0, NB_WFUNC-1, FLAGS, "win_func" },90 { "win_func", "set window function", OFFSET(win_func), AV_OPT_TYPE_INT, {.i64=WFUNC_HANNING}, 0, NB_WFUNC-1, FLAGS, "win_func" },
103 { "rect", "Rectangular", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_RECT}, 0, 0, FLAGS, "win_func" },91 { "rect", "Rectangular", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_RECT}, 0, 0, FLAGS, "win_func" },
104 { "bartlett", "Bartlett", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_BARTLETT}, 0, 0, FLAGS, "win_func" },92 { "bartlett", "Bartlett", 0, AV_OPT_TYPE_CONST, {.i64=WFUNC_BARTLETT}, 0, 0, FLAGS, "win_func" },
@@ -180,6 +168,7 @@ static int config_output(AVFilterLink *outlink) · 75 unmodified lines
180 float overlap;168 float overlap;
181 int i;169 int i;
182 170
171 s->fft_bits = av_log2(s->fft_size);
183 s->nb_freq = 1 << (s->fft_bits - 1);172 s->nb_freq = 1 << (s->fft_bits - 1);
184 s->win_size = s->nb_freq << 1;173 s->win_size = s->nb_freq << 1;
185 av_audio_fifo_free(s->fifo);174 av_audio_fifo_free(s->fifo);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t