Skip to content

Commit

Permalink
video: make csp equalizer params float
Browse files Browse the repository at this point in the history
This allows more precise adjustments.

Fixes mpv-player#11316
  • Loading branch information
t-8ch authored and sfan5 committed Feb 24, 2023
1 parent 0d991eb commit fb48722
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
2 changes: 2 additions & 0 deletions DOCS/interface-changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
Expand Down
14 changes: 7 additions & 7 deletions video/csputils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions video/csputils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit fb48722

Please sign in to comment.