Skip to content

Commit

Permalink
gpu-next: add support for --dither-depth=auto
Browse files Browse the repository at this point in the history
On supported APIs.
Fixes: mpv-player#11862
  • Loading branch information
kasper93 authored and sfan5 committed Mar 17, 2024
1 parent 16e3d7d commit 7265bde
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions video/out/vo_gpu_next.c
Original file line number Diff line number Diff line change
Expand Up @@ -838,10 +838,15 @@ static void apply_target_options(struct priv *p, struct pl_frame *target)
container = pl_raw_primaries_get(target->color.primaries);
target->color.hdr.prim = pl_primaries_clip(gamut, container);
}
if (opts->dither_depth > 0) {
int dither_depth = opts->dither_depth;
if (dither_depth == 0) {
struct ra_swapchain *sw = p->ra_ctx->swapchain;
dither_depth = sw->fns->color_depth ? sw->fns->color_depth(sw) : 0;
}
if (dither_depth > 0) {
struct pl_bit_encoding *tbits = &target->repr.bits;
tbits->color_depth += opts->dither_depth - tbits->sample_depth;
tbits->sample_depth = opts->dither_depth;
tbits->color_depth += dither_depth - tbits->sample_depth;
tbits->sample_depth = dither_depth;
}

if (opts->icc_opts->icc_use_luma) {
Expand Down

0 comments on commit 7265bde

Please sign in to comment.