mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-28 20:53:54 +02:00
avfilter/avf_showcwt: add sqrt frequency scale
This commit is contained in:
parent
7357012bb5
commit
7f23b72dde
@ -30709,6 +30709,7 @@ Set the frequency scale used. Allowed values are:
|
|||||||
@item bark
|
@item bark
|
||||||
@item mel
|
@item mel
|
||||||
@item erbs
|
@item erbs
|
||||||
|
@item sqrt
|
||||||
@end table
|
@end table
|
||||||
Default value is @code{linear}.
|
Default value is @code{linear}.
|
||||||
|
|
||||||
|
@ -40,6 +40,7 @@ enum FrequencyScale {
|
|||||||
FSCALE_BARK,
|
FSCALE_BARK,
|
||||||
FSCALE_MEL,
|
FSCALE_MEL,
|
||||||
FSCALE_ERBS,
|
FSCALE_ERBS,
|
||||||
|
FSCALE_SQRT,
|
||||||
NB_FSCALE
|
NB_FSCALE
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -127,6 +128,7 @@ static const AVOption showcwt_options[] = {
|
|||||||
{ "bark", "bark", 0, AV_OPT_TYPE_CONST,{.i64=FSCALE_BARK}, 0, 0, FLAGS, "scale" },
|
{ "bark", "bark", 0, AV_OPT_TYPE_CONST,{.i64=FSCALE_BARK}, 0, 0, FLAGS, "scale" },
|
||||||
{ "mel", "mel", 0, AV_OPT_TYPE_CONST,{.i64=FSCALE_MEL}, 0, 0, FLAGS, "scale" },
|
{ "mel", "mel", 0, AV_OPT_TYPE_CONST,{.i64=FSCALE_MEL}, 0, 0, FLAGS, "scale" },
|
||||||
{ "erbs", "erbs", 0, AV_OPT_TYPE_CONST,{.i64=FSCALE_ERBS}, 0, 0, FLAGS, "scale" },
|
{ "erbs", "erbs", 0, AV_OPT_TYPE_CONST,{.i64=FSCALE_ERBS}, 0, 0, FLAGS, "scale" },
|
||||||
|
{ "sqrt", "sqrt", 0, AV_OPT_TYPE_CONST,{.i64=FSCALE_SQRT}, 0, 0, FLAGS, "scale" },
|
||||||
{ "min", "set minimum frequency", OFFSET(minimum_frequency), AV_OPT_TYPE_FLOAT, {.dbl = 20.}, 1, 2000, FLAGS },
|
{ "min", "set minimum frequency", OFFSET(minimum_frequency), AV_OPT_TYPE_FLOAT, {.dbl = 20.}, 1, 2000, FLAGS },
|
||||||
{ "max", "set maximum frequency", OFFSET(maximum_frequency), AV_OPT_TYPE_FLOAT, {.dbl = 20000.}, 0, 192000, FLAGS },
|
{ "max", "set maximum frequency", OFFSET(maximum_frequency), AV_OPT_TYPE_FLOAT, {.dbl = 20000.}, 0, 192000, FLAGS },
|
||||||
{ "logb", "set logarithmic basis", OFFSET(logarithmic_basis), AV_OPT_TYPE_FLOAT, {.dbl = 0.0001}, 0, 1, FLAGS },
|
{ "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,
|
|||||||
frequency = 676170.4f / (47.06538f - expf(frequency * 0.08950404f)) - 14678.49f;
|
frequency = 676170.4f / (47.06538f - expf(frequency * 0.08950404f)) - 14678.49f;
|
||||||
frequency_derivative *= (frequency * frequency + 14990.4 * frequency + 4577850.f) / 160514.f;
|
frequency_derivative *= (frequency * frequency + 14990.4 * frequency + 4577850.f) / 160514.f;
|
||||||
break;
|
break;
|
||||||
|
case FSCALE_SQRT:
|
||||||
|
frequency = frequency * frequency;
|
||||||
|
frequency_derivative *= 2.f * sqrtf(frequency);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
frequency_band[y*2 ] = frequency;
|
frequency_band[y*2 ] = frequency;
|
||||||
@ -680,6 +686,10 @@ static int config_output(AVFilterLink *outlink)
|
|||||||
minimum_frequency = 11.17268f * log(1.f + (46.06538f * minimum_frequency) / (minimum_frequency + 14678.49f));
|
minimum_frequency = 11.17268f * log(1.f + (46.06538f * minimum_frequency) / (minimum_frequency + 14678.49f));
|
||||||
maximum_frequency = 11.17268f * log(1.f + (46.06538f * maximum_frequency) / (maximum_frequency + 14678.49f));
|
maximum_frequency = 11.17268f * log(1.f + (46.06538f * maximum_frequency) / (maximum_frequency + 14678.49f));
|
||||||
break;
|
break;
|
||||||
|
case FSCALE_SQRT:
|
||||||
|
minimum_frequency = sqrtf(minimum_frequency);
|
||||||
|
maximum_frequency = sqrtf(maximum_frequency);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
frequency_band(s->frequency_band,
|
frequency_band(s->frequency_band,
|
||||||
|
Loading…
Reference in New Issue
Block a user