mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-28 02:12:28 +00:00
avfilter/avf_showcwt: add fm frequency scaler
This commit is contained in:
parent
409b29d3f9
commit
49719d3cb5
@ -30842,6 +30842,7 @@ Set the frequency scale used. Allowed values are:
|
||||
@item sqrt
|
||||
@item cbrt
|
||||
@item qdrt
|
||||
@item fm
|
||||
@end table
|
||||
Default value is @code{linear}.
|
||||
|
||||
|
@ -45,6 +45,7 @@ enum FrequencyScale {
|
||||
FSCALE_SQRT,
|
||||
FSCALE_CBRT,
|
||||
FSCALE_QDRT,
|
||||
FSCALE_FM,
|
||||
NB_FSCALE
|
||||
};
|
||||
|
||||
@ -144,6 +145,7 @@ static const AVOption showcwt_options[] = {
|
||||
{ "sqrt", "sqrt", 0, AV_OPT_TYPE_CONST,{.i64=FSCALE_SQRT}, 0, 0, FLAGS, "scale" },
|
||||
{ "cbrt", "cbrt", 0, AV_OPT_TYPE_CONST,{.i64=FSCALE_CBRT}, 0, 0, FLAGS, "scale" },
|
||||
{ "qdrt", "qdrt", 0, AV_OPT_TYPE_CONST,{.i64=FSCALE_QDRT}, 0, 0, FLAGS, "scale" },
|
||||
{ "fm", "fm", 0, AV_OPT_TYPE_CONST,{.i64=FSCALE_FM}, 0, 0, FLAGS, "scale" },
|
||||
{ "iscale", "set intensity scale", OFFSET(intensity_scale),AV_OPT_TYPE_INT, {.i64=0}, 0, NB_ISCALE-1, FLAGS, "iscale" },
|
||||
{ "linear", "linear", 0, AV_OPT_TYPE_CONST,{.i64=ISCALE_LINEAR}, 0, 0, FLAGS, "iscale" },
|
||||
{ "log", "logarithmic", 0, AV_OPT_TYPE_CONST,{.i64=ISCALE_LOG}, 0, 0, FLAGS, "iscale" },
|
||||
@ -292,6 +294,10 @@ static float frequency_band(float *frequency_band,
|
||||
frequency = frequency * frequency * frequency * frequency;
|
||||
frequency_derivative *= 4.f * powf(frequency, 3.f / 4.f);
|
||||
break;
|
||||
case FSCALE_FM:
|
||||
frequency = 2.f * powf(frequency, 3.f / 2.f) / 3.f;
|
||||
frequency_derivative *= sqrtf(frequency);
|
||||
break;
|
||||
}
|
||||
|
||||
frequency_band[y*2 ] = frequency;
|
||||
@ -788,7 +794,8 @@ static int config_output(AVFilterLink *outlink)
|
||||
AVFilterContext *ctx = outlink->src;
|
||||
AVFilterLink *inlink = ctx->inputs[0];
|
||||
ShowCWTContext *s = ctx->priv;
|
||||
float maximum_frequency = fminf(s->maximum_frequency, inlink->sample_rate * 0.5f);
|
||||
const float limit_frequency = inlink->sample_rate * 0.5f;
|
||||
float maximum_frequency = fminf(s->maximum_frequency, limit_frequency);
|
||||
float minimum_frequency = s->minimum_frequency;
|
||||
float scale = 1.f, factor;
|
||||
int ret;
|
||||
@ -847,6 +854,10 @@ static int config_output(AVFilterLink *outlink)
|
||||
minimum_frequency = powf(minimum_frequency, 0.25f);
|
||||
maximum_frequency = powf(maximum_frequency, 0.25f);
|
||||
break;
|
||||
case FSCALE_FM:
|
||||
minimum_frequency = powf(9.f * (minimum_frequency * minimum_frequency) / 4.f, 1.f / 3.f);
|
||||
maximum_frequency = powf(9.f * (maximum_frequency * maximum_frequency) / 4.f, 1.f / 3.f);
|
||||
break;
|
||||
}
|
||||
|
||||
s->frequency_band = av_calloc(s->frequency_band_count,
|
||||
|
Loading…
Reference in New Issue
Block a user