diff options
author | Kacper Michajłow <kasper93@gmail.com> | 2024-03-06 05:43:06 +0100 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2024-03-17 14:28:00 +0100 |
commit | 7265bde26a21448bbc9e7251bf47a6ec2c8ffbe7 (patch) | |
tree | 2c7f50a71f03e9d240edd5b811e2df99d76b579f | |
parent | 16e3d7dca69bb2a8c0fb6a9ff527d036349d07fc (diff) | |
download | mpv-7265bde26a21448bbc9e7251bf47a6ec2c8ffbe7.tar.bz2 mpv-7265bde26a21448bbc9e7251bf47a6ec2c8ffbe7.tar.xz |
gpu-next: add support for --dither-depth=auto
On supported APIs.
Fixes: https://github.com/mpv-player/mpv/issues/11862
-rw-r--r-- | video/out/vo_gpu_next.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/video/out/vo_gpu_next.c b/video/out/vo_gpu_next.c index 17fdb1a98a..bb512c7b8f 100644 --- a/video/out/vo_gpu_next.c +++ b/video/out/vo_gpu_next.c @@ -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) { |