summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Weißschuh <thomas@t-8ch.de>2023-02-15 21:01:50 +0000
committersfan5 <sfan5@live.de>2023-02-24 13:55:29 +0100
commitfb48722234e94539c269d2f0034be8a87ca32ccb (patch)
tree6b8d47723f4b1b92f9b84c1e427eaf60f57e5132
parent0d991eba7242f1f7df6d62151305939c57956fe4 (diff)
downloadmpv-fb48722234e94539c269d2f0034be8a87ca32ccb.tar.bz2
mpv-fb48722234e94539c269d2f0034be8a87ca32ccb.tar.xz
video: make csp equalizer params float
This allows more precise adjustments. Fixes #11316
-rw-r--r--DOCS/interface-changes.rst2
-rw-r--r--video/csputils.c14
-rw-r--r--video/csputils.h8
3 files changed, 13 insertions, 11 deletions
diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst
index 2c94f37cdc..bff74cd16c 100644
--- a/DOCS/interface-changes.rst
+++ b/DOCS/interface-changes.rst
@@ -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`,
diff --git a/video/csputils.c b/video/csputils.c
index ea9f280205..75575280d7 100644
--- a/video/csputils.c
+++ b/video/csputils.c
@@ -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,
diff --git a/video/csputils.h b/video/csputils.h
index 323468260f..49b61c4963 100644
--- a/video/csputils.h
+++ b/video/csputils.h
@@ -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,