video: make csp equalizer params float

This allows more precise adjustments.

Fixes #11316
This commit is contained in:
Thomas Weißschuh 2023-02-15 21:01:50 +00:00 committed by sfan5
parent 0d991eba72
commit fb48722234
3 changed files with 13 additions and 11 deletions

View File

@ -55,6 +55,8 @@ Interface changes
- add `--tone-mapping=st2094-40` and `--tone-mapping=st2094-10`
- change `--screenshot-jxl-effort` default from `3` to `4`.
- add `--tone-mapping-visualize`
- change type of `--brightness`, `--saturation`, `--contrast`, `--hue` and
`--gamma` to float.
--- mpv 0.35.0 ---
- add the `--vo=gpu-next` video output driver, as well as the options
`--allow-delayed-peak-detect`, `--builtin-scalers`,

View File

@ -879,18 +879,18 @@ bool mp_colorspace_equal(struct mp_colorspace c1, struct mp_colorspace c2)
const struct m_sub_options mp_csp_equalizer_conf = {
.opts = (const m_option_t[]) {
{"brightness", OPT_INT(values[MP_CSP_EQ_BRIGHTNESS]),
{"brightness", OPT_FLOAT(values[MP_CSP_EQ_BRIGHTNESS]),
M_RANGE(-100, 100)},
{"saturation", OPT_INT(values[MP_CSP_EQ_SATURATION]),
{"saturation", OPT_FLOAT(values[MP_CSP_EQ_SATURATION]),
M_RANGE(-100, 100)},
{"contrast", OPT_INT(values[MP_CSP_EQ_CONTRAST]),
{"contrast", OPT_FLOAT(values[MP_CSP_EQ_CONTRAST]),
M_RANGE(-100, 100)},
{"hue", OPT_INT(values[MP_CSP_EQ_HUE]),
{"hue", OPT_FLOAT(values[MP_CSP_EQ_HUE]),
M_RANGE(-100, 100)},
{"gamma", OPT_INT(values[MP_CSP_EQ_GAMMA]),
{"gamma", OPT_FLOAT(values[MP_CSP_EQ_GAMMA]),
M_RANGE(-100, 100)},
{"video-output-levels",
OPT_CHOICE_C(values[MP_CSP_EQ_OUTPUT_LEVELS], mp_csp_levels_names)},
OPT_CHOICE_C(output_levels, mp_csp_levels_names)},
{0}
},
.size = sizeof(struct mp_csp_equalizer_opts),
@ -905,7 +905,7 @@ void mp_csp_copy_equalizer_values(struct mp_csp_params *params,
params->hue = eq->values[MP_CSP_EQ_HUE] / 100.0 * M_PI;
params->saturation = (eq->values[MP_CSP_EQ_SATURATION] + 100) / 100.0;
params->gamma = exp(log(8.0) * eq->values[MP_CSP_EQ_GAMMA] / 100.0);
params->levels_out = eq->values[MP_CSP_EQ_OUTPUT_LEVELS];
params->levels_out = eq->output_levels;
}
struct mp_csp_equalizer_state *mp_csp_equalizer_create(void *ta_parent,

View File

@ -210,15 +210,15 @@ enum mp_csp_equalizer_param {
MP_CSP_EQ_HUE,
MP_CSP_EQ_SATURATION,
MP_CSP_EQ_GAMMA,
MP_CSP_EQ_OUTPUT_LEVELS,
MP_CSP_EQ_COUNT,
};
// Default initialization with 0 is enough, except for the capabilities field
struct mp_csp_equalizer_opts {
// Value for each property is in the range [-100, 100].
// 0 is default, meaning neutral or no change.
int values[MP_CSP_EQ_COUNT];
// Value for each property is in the range [-100.0, 100.0].
// 0.0 is default, meaning neutral or no change.
float values[MP_CSP_EQ_COUNT];
int output_levels;
};
void mp_csp_copy_equalizer_values(struct mp_csp_params *params,