History

avfilter/avf_showfreqs: add group delay data mode

Paul B Mahol committed 5 years ago

Commit a01b0371 parent f3891432 files · +13 −1Browse files

Showing the changes to libavfilter (1 of 2 files). Show all

Unified · Split

libavfilter/avf_showfreqs.c+12−1
@@ -36,7 +36,7 @@ · 35 unmodified lines
3636 #include "internal.h"
3737 #include "window_func.h"
3838
39−enum DataMode { MAGNITUDE, PHASE, NB_DATA };
39+enum DataMode { MAGNITUDE, PHASE, DELAY, NB_DATA };
4040 enum DisplayMode { LINE, BAR, DOT, NB_MODES };
4141 enum ChannelMode { COMBINED, SEPARATE, NB_CMODES };
4242 enum FrequencyScale { FS_LINEAR, FS_LOG, FS_RLOG, NB_FSCALES };
@@ -120,6 +120,7 @@ static const AVOption showfreqs_options[] = { · 77 unmodified lines
120120 { "data", "set data mode", OFFSET(data_mode), AV_OPT_TYPE_INT, {.i64=MAGNITUDE}, 0, NB_DATA-1, FLAGS, "data" },
121121 { "magnitude", "show magnitude", 0, AV_OPT_TYPE_CONST, {.i64=MAGNITUDE}, 0, 0, FLAGS, "data" },
122122 { "phase", "show phase", 0, AV_OPT_TYPE_CONST, {.i64=PHASE}, 0, 0, FLAGS, "data" },
123+ { "delay", "show group delay",0, AV_OPT_TYPE_CONST, {.i64=DELAY}, 0, 0, FLAGS, "data" },
123124 { NULL }
124125 };
125126
@@ -440,6 +441,16 @@ static int plot_freqs(AVFilterLink *inlink, AVFrame *in) · 314 unmodified lines
440441 plot_freq(s, ch, a, f, fg, &prev_y, out, outlink);
441442 }
442443 break;
444+ case DELAY:
445+ plot_freq(s, ch, 0, 0, fg, &prev_y, out, outlink);
446+
447+ for (f = 1; f < s->nb_freq; f++) {
448+ a = av_clipd((M_PI - P(IM(f, ch) * RE(f-1, ch) - IM(f-1, ch) * RE(f, ch),
449+ RE(f, ch) * RE(f-1, ch) + IM(f, ch) * IM(f-1, ch))) / (2. * M_PI), 0, 1);
450+
451+ plot_freq(s, ch, a, f, fg, &prev_y, out, outlink);
452+ }
453+ break;
443454 }
444455 }
445456

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