Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove deprecated option --gamma-auto #15561

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions DOCS/client-api-changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ API changes

::

--- mpv 0.41.0 ---
2.6 - Remove MPV_RENDER_PARAM_AMBIENT_LIGHT
--- mpv 0.40.0 ---
2.5 - Deprecate MPV_RENDER_PARAM_AMBIENT_LIGHT. no replacement.
--- mpv 0.39.0 ---
Expand Down
1 change: 1 addition & 0 deletions DOCS/interface-changes/gamma-auto.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
remove deprecated `--gamma-auto` option
8 changes: 0 additions & 8 deletions DOCS/man/options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6832,14 +6832,6 @@ them.
other ways (like with the ``--gamma`` option or key bindings and the
``gamma`` property), the value is multiplied with the other gamma value.

``--gamma-auto``
Automatically corrects the gamma value depending on ambient lighting
conditions (adding a gamma boost for bright rooms).

This option is deprecated and may be removed in the future.

NOTE: Only implemented on macOS and ``--vo=gpu``.

``--image-lut=<file>``
Specifies a custom LUT file (in Adobe .cube format) to apply to the colors
during image decoding. The exact interpretation of the LUT depends on
Expand Down
2 changes: 1 addition & 1 deletion libmpv/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ extern "C" {
* relational operators (<, >, <=, >=).
*/
#define MPV_MAKE_VERSION(major, minor) (((major) << 16) | (minor) | 0UL)
#define MPV_CLIENT_API_VERSION MPV_MAKE_VERSION(2, 5)
#define MPV_CLIENT_API_VERSION MPV_MAKE_VERSION(2, 6)

/**
* The API user is allowed to "#define MPV_ENABLE_DEPRECATED 0" before
Expand Down
7 changes: 0 additions & 7 deletions libmpv/render.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,6 @@ typedef enum mpv_render_param_type {
* option is not enabled, the ICC data will not be used.)
*/
MPV_RENDER_PARAM_ICC_PROFILE = 6,
/**
* Deprecated
* Ambient light in lux. Valid for mpv_render_context_set_parameter().
* Type: int*
* This can be used for automatic gamma correction.
*/
MPV_RENDER_PARAM_AMBIENT_LIGHT = 7,
/**
* X11 Display, sometimes used for hwdec. Valid for
* mpv_render_context_create(). The Display must stay valid for the lifetime
Expand Down
25 changes: 0 additions & 25 deletions test/gl_video.c

This file was deleted.

7 changes: 0 additions & 7 deletions test/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,6 @@ chmap = executable('chmap', 'chmap.c', include_directories: incdir,
link_with: test_utils)
test('chmap', chmap)

gl_video_objects = libmpv.extract_objects('video/out/gpu/ra.c',
'video/out/gpu/utils.c')
gl_video = executable('gl-video', 'gl_video.c', objects: gl_video_objects,
dependencies: [libavutil, libplacebo], include_directories: incdir,
link_with: [img_utils, test_utils])
test('gl-video', gl_video)

json = executable('json', 'json.c', include_directories: incdir, link_with: test_utils)
test('json', json)

Expand Down
7 changes: 0 additions & 7 deletions video/out/gpu/libmpv_gpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,6 @@ static int set_parameter(struct render_backend *ctx, mpv_render_param param)
gl_video_set_icc_profile(p->renderer, bstrdup(NULL, (bstr){data->data, data->size}));
return 0;
}
case MPV_RENDER_PARAM_AMBIENT_LIGHT: {
MP_WARN(ctx, "MPV_RENDER_PARAM_AMBIENT_LIGHT is deprecated and might be "
"removed in the future (replacement: gamma-auto.lua)\n");
int lux = *(int *)param.data;
gl_video_set_ambient_lux(p->renderer, (double)lux);
return 0;
}
default:
return MPV_ERROR_NOT_IMPLEMENTED;
}
Expand Down
15 changes: 0 additions & 15 deletions video/out/gpu/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,6 @@ void gl_transform_ortho_fbo(struct gl_transform *t, const struct ra_fbo *fbo)
gl_transform_ortho(t, 0, fbo->tex->params.w, 0, fbo->tex->params.h * y_dir);
}

double gl_video_scale_ambient_lux(float lmin, float lmax,
float rmin, float rmax, double lux)
{
assert(lmax > lmin);

double num = (rmax - rmin) * (log10(lux) - log10(lmin));
double den = log10(lmax) - log10(lmin);
double result = num / den + rmin;

// clamp the result
float max = MPMAX(rmax, rmin);
float min = MPMIN(rmax, rmin);
return MPMAX(MPMIN(result, max), min);
}

void ra_buf_pool_uninit(struct ra *ra, struct ra_buf_pool *pool)
{
for (int i = 0; i < pool->num_buffers; i++)
Expand Down
3 changes: 0 additions & 3 deletions video/out/gpu/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ void gl_transform_trans(struct gl_transform t, struct gl_transform *x);

void gl_transform_ortho_fbo(struct gl_transform *t, const struct ra_fbo *fbo);

double gl_video_scale_ambient_lux(float lmin, float lmax,
float rmin, float rmax, double lux);

// A pool of buffers, which can grow as needed
struct ra_buf_pool {
struct ra_buf_params current_params;
Expand Down
18 changes: 1 addition & 17 deletions video/out/gpu/video.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,7 @@ const struct m_sub_options gl_video_conf = {
{"gpu-dumb-mode", OPT_CHOICE(dumb_mode,
{"auto", 0}, {"yes", 1}, {"no", -1})},
{"gamma-factor", OPT_FLOAT(gamma), M_RANGE(0.1, 2.0)},
{"gamma-auto", OPT_BOOL(gamma_auto),
.deprecation_message = "replacement: gamma-auto.lua"},
{"gamma-auto", OPT_REMOVED("Replaced by gamma-auto.lua")},
{"target-prim", OPT_CHOICE_C(target_prim, pl_csp_prim_names)},
{"target-trc", OPT_CHOICE_C(target_trc, pl_csp_trc_names)},
{"target-peak", OPT_CHOICE(target_peak, {"auto", 0}),
Expand Down Expand Up @@ -669,11 +668,6 @@ static void uninit_rendering(struct gl_video *p)
gl_sc_reset_error(p->sc);
}

bool gl_video_gamma_auto_enabled(struct gl_video *p)
{
return p->opts.gamma_auto;
}

// Warning: profile.start must point to a ta allocation, and the function
// takes over ownership.
void gl_video_set_icc_profile(struct gl_video *p, bstr icc_data)
Expand Down Expand Up @@ -3956,7 +3950,6 @@ static void check_gl_features(struct gl_video *p)
},
},
.gamma = p->opts.gamma,
.gamma_auto = p->opts.gamma_auto,
.pbo = p->opts.pbo,
.fbo_format = p->opts.fbo_format,
.background = p->opts.background,
Expand Down Expand Up @@ -4271,15 +4264,6 @@ static int validate_error_diffusion_opt(struct mp_log *log, const m_option_t *op
return r;
}

void gl_video_set_ambient_lux(struct gl_video *p, double lux)
{
if (p->opts.gamma_auto) {
p->opts.gamma = gl_video_scale_ambient_lux(16.0, 256.0, 1.0, 1.2, lux);
MP_TRACE(p, "ambient light changed: %f lux (gamma: %f)\n", lux,
p->opts.gamma);
}
}

static void *gl_video_dr_alloc_buffer(struct gl_video *p, size_t size)
{
struct ra_buf_params params = {
Expand Down
5 changes: 0 additions & 5 deletions video/out/gpu/video.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ struct gl_video_opts {
int dumb_mode;
struct scaler_config scaler[4];
float gamma;
bool gamma_auto;
int target_prim;
int target_trc;
int target_peak;
Expand Down Expand Up @@ -209,12 +208,8 @@ bool gl_video_check_osd_change(struct gl_video *p, struct mp_osd_res *osd,
void gl_video_screenshot(struct gl_video *p, struct vo_frame *frame,
struct voctrl_screenshot *args);

double gl_video_scale_ambient_lux(float lmin, float lmax,
float rmin, float rmax, double lux);
void gl_video_set_ambient_lux(struct gl_video *p, double lux);
void gl_video_set_icc_profile(struct gl_video *p, bstr icc_data);
bool gl_video_icc_auto_enabled(struct gl_video *p);
bool gl_video_gamma_auto_enabled(struct gl_video *p);

void gl_video_reset(struct gl_video *p);
bool gl_video_showing_interpolated_frame(struct gl_video *p);
Expand Down
17 changes: 0 additions & 17 deletions video/out/vo_gpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,19 +160,6 @@ static void get_and_update_icc_profile(struct gpu_priv *p)
}
}

static void get_and_update_ambient_lighting(struct gpu_priv *p)
{
double lux;
int r = p->ctx->fns->control(p->ctx, &p->events, VOCTRL_GET_AMBIENT_LUX, &lux);
if (r == VO_TRUE) {
gl_video_set_ambient_lux(p->renderer, lux);
}
if (r != VO_TRUE && gl_video_gamma_auto_enabled(p->renderer)) {
MP_ERR(p, "gamma_auto option provided, but querying for ambient"
" lighting is not supported on this platform\n");
}
}

static void update_ra_ctx_options(struct vo *vo, struct ra_ctx_opts *ctx_opts)
{
struct gpu_priv *p = vo->priv;
Expand Down Expand Up @@ -234,10 +221,6 @@ static int control(struct vo *vo, uint32_t request, void *data)
get_and_update_icc_profile(p);
vo->want_redraw = true;
}
if (events & VO_EVENT_AMBIENT_LIGHTING_CHANGED) {
get_and_update_ambient_lighting(p);
vo->want_redraw = true;
}
events |= p->events;
p->events = 0;
if (events & VO_EVENT_RESIZE)
Expand Down
Loading