History

avfilter/avf_showcwt: add sqrt frequency scale

Paul B Mahol committed 3 years ago

Commit 7f23b721 parent 73570122 files · +11 −0Browse files

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

Unified · Split

libavfilter/avf_showcwt.c+10−0
@@ -40,6 +40,7 @@ enum FrequencyScale { · 39 unmodified lines
40 FSCALE_BARK,40 FSCALE_BARK,
41 FSCALE_MEL,41 FSCALE_MEL,
42 FSCALE_ERBS,42 FSCALE_ERBS,
43 FSCALE_SQRT,
43 NB_FSCALE44 NB_FSCALE
44};45};
45 46
@@ -127,6 +128,7 @@ static const AVOption showcwt_options[] = { · 81 unmodified lines
127 { "bark", "bark", 0, AV_OPT_TYPE_CONST,{.i64=FSCALE_BARK}, 0, 0, FLAGS, "scale" },128 { "bark", "bark", 0, AV_OPT_TYPE_CONST,{.i64=FSCALE_BARK}, 0, 0, FLAGS, "scale" },
128 { "mel", "mel", 0, AV_OPT_TYPE_CONST,{.i64=FSCALE_MEL}, 0, 0, FLAGS, "scale" },129 { "mel", "mel", 0, AV_OPT_TYPE_CONST,{.i64=FSCALE_MEL}, 0, 0, FLAGS, "scale" },
129 { "erbs", "erbs", 0, AV_OPT_TYPE_CONST,{.i64=FSCALE_ERBS}, 0, 0, FLAGS, "scale" },130 { "erbs", "erbs", 0, AV_OPT_TYPE_CONST,{.i64=FSCALE_ERBS}, 0, 0, FLAGS, "scale" },
131 { "sqrt", "sqrt", 0, AV_OPT_TYPE_CONST,{.i64=FSCALE_SQRT}, 0, 0, FLAGS, "scale" },
130 { "min", "set minimum frequency", OFFSET(minimum_frequency), AV_OPT_TYPE_FLOAT, {.dbl = 20.}, 1, 2000, FLAGS },132 { "min", "set minimum frequency", OFFSET(minimum_frequency), AV_OPT_TYPE_FLOAT, {.dbl = 20.}, 1, 2000, FLAGS },
131 { "max", "set maximum frequency", OFFSET(maximum_frequency), AV_OPT_TYPE_FLOAT, {.dbl = 20000.}, 0, 192000, FLAGS },133 { "max", "set maximum frequency", OFFSET(maximum_frequency), AV_OPT_TYPE_FLOAT, {.dbl = 20000.}, 0, 192000, FLAGS },
132 { "logb", "set logarithmic basis", OFFSET(logarithmic_basis), AV_OPT_TYPE_FLOAT, {.dbl = 0.0001}, 0, 1, FLAGS },134 { "logb", "set logarithmic basis", OFFSET(logarithmic_basis), AV_OPT_TYPE_FLOAT, {.dbl = 0.0001}, 0, 1, FLAGS },
@@ -241,6 +243,10 @@ static void frequency_band(float *frequency_band, · 108 unmodified lines
241 frequency = 676170.4f / (47.06538f - expf(frequency * 0.08950404f)) - 14678.49f;243 frequency = 676170.4f / (47.06538f - expf(frequency * 0.08950404f)) - 14678.49f;
242 frequency_derivative *= (frequency * frequency + 14990.4 * frequency + 4577850.f) / 160514.f;244 frequency_derivative *= (frequency * frequency + 14990.4 * frequency + 4577850.f) / 160514.f;
243 break;245 break;
246 case FSCALE_SQRT:
247 frequency = frequency * frequency;
248 frequency_derivative *= 2.f * sqrtf(frequency);
249 break;
244 }250 }
245 251
246 frequency_band[y*2 ] = frequency;252 frequency_band[y*2 ] = frequency;
@@ -680,6 +686,10 @@ static int config_output(AVFilterLink *outlink) · 433 unmodified lines
680 minimum_frequency = 11.17268f * log(1.f + (46.06538f * minimum_frequency) / (minimum_frequency + 14678.49f));686 minimum_frequency = 11.17268f * log(1.f + (46.06538f * minimum_frequency) / (minimum_frequency + 14678.49f));
681 maximum_frequency = 11.17268f * log(1.f + (46.06538f * maximum_frequency) / (maximum_frequency + 14678.49f));687 maximum_frequency = 11.17268f * log(1.f + (46.06538f * maximum_frequency) / (maximum_frequency + 14678.49f));
682 break;688 break;
689 case FSCALE_SQRT:
690 minimum_frequency = sqrtf(minimum_frequency);
691 maximum_frequency = sqrtf(maximum_frequency);
692 break;
683 }693 }
684 694
685 frequency_band(s->frequency_band,695 frequency_band(s->frequency_band,

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