mirror of https://github.com/mpv-player/mpv
vo_gpu_next: improve --tonemapping-visualize
Pick a smarter rect, limit it to right half of screen (to allow more easily using it simultaneously with stats), and also auto-rotate through the hue plane by default (wrapping once every 10 seconds of playback). I briefly considered making it based on wallclock time instead of pts, but this has the rather unfortunate downside of only being updated sporadically as the user moves the mouse over OSC elements. (Of course, we could also forcibly redraw the screen continously to avoid it, but I'd rather not make such an invasive change for no real reason) This design also allows you to pause and focus on (via framestepping) individual parts of the hue graph that you're interested in.
This commit is contained in:
parent
15ada7c41c
commit
67d31a8266
|
@ -912,6 +912,29 @@ static void apply_crop(struct pl_frame *frame, struct mp_rect crop,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void update_tm_viz(struct pl_color_map_params *params,
|
||||||
|
const struct pl_frame *target,
|
||||||
|
double pts)
|
||||||
|
{
|
||||||
|
if (!params->visualize_lut)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Use right half of sceen for TM visualization, constrain to 1:1 AR
|
||||||
|
const float out_w = fabsf(pl_rect_w(target->crop));
|
||||||
|
const float out_h = fabsf(pl_rect_h(target->crop));
|
||||||
|
const float size = MPMIN(out_w / 2.0f, out_h);
|
||||||
|
params->visualize_rect = (pl_rect2df) {
|
||||||
|
.x0 = 1.0f - size / out_w,
|
||||||
|
.x1 = 1.0f,
|
||||||
|
.y0 = 0.0f,
|
||||||
|
.y1 = size / out_h,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Complete one full rotation of the hue plane every 10 seconds
|
||||||
|
const float tm_period = 10.0;
|
||||||
|
params->visualize_hue = 2 * M_PI * pts / tm_period;
|
||||||
|
}
|
||||||
|
|
||||||
static void draw_frame(struct vo *vo, struct vo_frame *frame)
|
static void draw_frame(struct vo *vo, struct vo_frame *frame)
|
||||||
{
|
{
|
||||||
struct priv *p = vo->priv;
|
struct priv *p = vo->priv;
|
||||||
|
@ -1015,6 +1038,7 @@ static void draw_frame(struct vo *vo, struct vo_frame *frame)
|
||||||
// initialization, but pl_queue does not like these. Hard-clamp as
|
// initialization, but pl_queue does not like these. Hard-clamp as
|
||||||
// a simple work-around.
|
// a simple work-around.
|
||||||
qparams.pts = p->last_pts = MPMAX(qparams.pts, p->last_pts);
|
qparams.pts = p->last_pts = MPMAX(qparams.pts, p->last_pts);
|
||||||
|
update_tm_viz(&pars->color_map_params, &target, qparams.pts);
|
||||||
|
|
||||||
switch (pl_queue_update(p->queue, &mix, &qparams)) {
|
switch (pl_queue_update(p->queue, &mix, &qparams)) {
|
||||||
case PL_QUEUE_ERR:
|
case PL_QUEUE_ERR:
|
||||||
|
@ -1324,6 +1348,7 @@ static void video_screenshot(struct vo *vo, struct voctrl_screenshot *args)
|
||||||
|
|
||||||
apply_crop(&image, src, mpi->params.w, mpi->params.h);
|
apply_crop(&image, src, mpi->params.w, mpi->params.h);
|
||||||
apply_crop(&target, dst, fbo->params.w, fbo->params.h);
|
apply_crop(&target, dst, fbo->params.w, fbo->params.h);
|
||||||
|
update_tm_viz(&pars->color_map_params, &target, p->last_pts);
|
||||||
|
|
||||||
int osd_flags = 0;
|
int osd_flags = 0;
|
||||||
if (!args->subs)
|
if (!args->subs)
|
||||||
|
|
Loading…
Reference in New Issue