af_scaletempo: overlap is a factor not a percentage

This commit is contained in:
Christoph Heinrich 2023-10-07 01:26:09 +02:00 committed by Dudemanguy
parent 7798881360
commit ef4a510128
2 changed files with 6 additions and 6 deletions

View File

@ -116,8 +116,8 @@ Available filters are:
cause noticeable skips at high scale amounts and an echo at low scale cause noticeable skips at high scale amounts and an echo at low scale
amounts. Very low values will alter pitch. Increasing improves amounts. Very low values will alter pitch. Increasing improves
performance. (default: 60) performance. (default: 60)
``overlap=<percent>`` ``overlap=<factor>``
Percentage of stride to overlap. Decreasing improves performance. Factor of stride to overlap. Decreasing improves performance.
(default: .20) (default: .20)
``search=<amount>`` ``search=<amount>``
Length in milliseconds to search for best overlap position. Decreasing Length in milliseconds to search for best overlap position. Decreasing

View File

@ -48,7 +48,7 @@ struct f_opts {
float scale_nominal; float scale_nominal;
float ms_stride; float ms_stride;
float ms_search; float ms_search;
float percent_overlap; float factor_overlap;
#define SCALE_TEMPO 1 #define SCALE_TEMPO 1
#define SCALE_PITCH 2 #define SCALE_PITCH 2
int speed_opt; int speed_opt;
@ -400,7 +400,7 @@ static bool reinit(struct mp_filter *f)
update_speed(s, s->speed); update_speed(s, s->speed);
int frames_overlap = s->frames_stride * s->opts->percent_overlap; int frames_overlap = s->frames_stride * s->opts->factor_overlap;
if (frames_overlap <= 0) { if (frames_overlap <= 0) {
s->bytes_standing = s->bytes_stride; s->bytes_standing = s->bytes_stride;
s->samples_standing = s->bytes_standing / bps; s->samples_standing = s->bytes_standing / bps;
@ -604,7 +604,7 @@ const struct mp_user_filter_entry af_scaletempo = {
.priv_size = sizeof(OPT_BASE_STRUCT), .priv_size = sizeof(OPT_BASE_STRUCT),
.priv_defaults = &(const OPT_BASE_STRUCT) { .priv_defaults = &(const OPT_BASE_STRUCT) {
.ms_stride = 60, .ms_stride = 60,
.percent_overlap = .20, .factor_overlap = .20,
.ms_search = 14, .ms_search = 14,
.speed_opt = SCALE_TEMPO, .speed_opt = SCALE_TEMPO,
.scale_nominal = 1.0, .scale_nominal = 1.0,
@ -612,7 +612,7 @@ const struct mp_user_filter_entry af_scaletempo = {
.options = (const struct m_option[]) { .options = (const struct m_option[]) {
{"scale", OPT_FLOAT(scale_nominal), M_RANGE(0.01, DBL_MAX)}, {"scale", OPT_FLOAT(scale_nominal), M_RANGE(0.01, DBL_MAX)},
{"stride", OPT_FLOAT(ms_stride), M_RANGE(0.01, DBL_MAX)}, {"stride", OPT_FLOAT(ms_stride), M_RANGE(0.01, DBL_MAX)},
{"overlap", OPT_FLOAT(percent_overlap), M_RANGE(0, 1)}, {"overlap", OPT_FLOAT(factor_overlap), M_RANGE(0, 1)},
{"search", OPT_FLOAT(ms_search), M_RANGE(0, DBL_MAX)}, {"search", OPT_FLOAT(ms_search), M_RANGE(0, DBL_MAX)},
{"speed", OPT_CHOICE(speed_opt, {"speed", OPT_CHOICE(speed_opt,
{"pitch", SCALE_PITCH}, {"pitch", SCALE_PITCH},