Skip to content

Commit

Permalink
vo_gpu_next: don't rotate gamut visualization
Browse files Browse the repository at this point in the history
Causes bad performance with interpolation because the changing hue angle
invalidates the mixing cache, as a result of libplacebo implementations
(specifically, the fact that this graph is drawn during the color
management process, instead of as a separate overlay).

Fix it by just hard-coding a particular, relatively interesting plane
(pi/4 approximately maps onto the red-blue axis).
  • Loading branch information
haasn committed Sep 2, 2023
1 parent e6afc53 commit 67368ac
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions video/out/vo_gpu_next.c
Original file line number Diff line number Diff line change
Expand Up @@ -913,8 +913,7 @@ 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)
const struct pl_frame *target)
{
if (!params->visualize_lut)
return;
Expand All @@ -930,9 +929,8 @@ static void update_tm_viz(struct pl_color_map_params *params,
.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;
// Visualize red-blue plane
params->visualize_hue = M_PI / 4.0;
}

static void draw_frame(struct vo *vo, struct vo_frame *frame)
Expand Down Expand Up @@ -1023,6 +1021,7 @@ static void draw_frame(struct vo *vo, struct vo_frame *frame)
(frame->current && opts->blend_subs) ? OSD_DRAW_OSD_ONLY : 0,
PL_OVERLAY_COORDS_DST_FRAME, &p->osd_state, &target);
apply_crop(&target, p->dst, swframe.fbo->params.w, swframe.fbo->params.h);
update_tm_viz(&pars->color_map_params, &target);

struct pl_frame_mix mix = {0};
if (frame->current) {
Expand All @@ -1038,7 +1037,6 @@ static void draw_frame(struct vo *vo, struct vo_frame *frame)
// initialization, but pl_queue does not like these. Hard-clamp as
// a simple work-around.
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)) {
case PL_QUEUE_ERR:
Expand Down Expand Up @@ -1348,7 +1346,7 @@ static void video_screenshot(struct vo *vo, struct voctrl_screenshot *args)

apply_crop(&image, src, mpi->params.w, mpi->params.h);
apply_crop(&target, dst, fbo->params.w, fbo->params.h);
update_tm_viz(&pars->color_map_params, &target, p->last_pts);
update_tm_viz(&pars->color_map_params, &target);

int osd_flags = 0;
if (!args->subs)
Expand Down

0 comments on commit 67368ac

Please sign in to comment.