From f914947dda421aa5903084cf1813412c8bacb003 Mon Sep 17 00:00:00 2001 From: llyyr Date: Wed, 6 Mar 2024 15:49:01 +0530 Subject: vo_gpu_next: make `dither-depth=auto` mean 8 bpc for non-d3d11 SDR Fixes the issue described in https://github.com/mpv-player/mpv/issues/11862 for SDR files for non-d3d11 gpu-api. We currently don't have a smarter way to get the real on-the-wire bpc for other APIs, so this is the best that can be done. --- DOCS/man/options.rst | 6 ++++-- video/out/vo_gpu_next.c | 6 +++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index d3380f3c22..aedd4488e9 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -5554,8 +5554,10 @@ them. no Disable any dithering done by mpv. auto - Automatic selection. If output bit depth cannot be detected, 8 bits per - component are assumed. + Automatic selection. + On ``vo=gpu``: if output bit depth cannot be detected, 8 bpc is assumed. + On ``vo=gpu-next``: with ``gpu-api=d3d11``, real on-the-wire bpc is used. + For other ``gpu-api``, 8 bpc is used for SDR content. 8 Dither to 8 bit output. diff --git a/video/out/vo_gpu_next.c b/video/out/vo_gpu_next.c index 3c5f558473..0faf811733 100644 --- a/video/out/vo_gpu_next.c +++ b/video/out/vo_gpu_next.c @@ -841,7 +841,11 @@ static void apply_target_options(struct priv *p, struct pl_frame *target) 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 (sw->fns->color_depth) { + dither_depth = sw->fns->color_depth(sw); + } else if (!pl_color_transfer_is_hdr(target->color.transfer)) { + dither_depth = 8; + } } if (dither_depth > 0) { struct pl_bit_encoding *tbits = &target->repr.bits; -- cgit v1.2.3