mpv-player / mpv

🎥 Command line video player
https://mpv.io
Other
26.67k stars 2.83k forks source link

vo_gpu_next/d3d11: `--d3d11-output-format=auto` selects the wrong output format #14242

Open norinoriko opened 1 month ago

norinoriko commented 1 month ago

mpv Information

mpv v0.38.0-344-g2fa66b85 Copyright © 2000-2024 mpv/MPlayer/mplayer2 projects
 built on May 25 2024 00:09:40
libplacebo version: v7.349.0 (v6.338.0-133-g9e1257c-dirty)
FFmpeg version: N-115376-gaff24c165
FFmpeg library versions:
   libavutil       59.20.100
   libavcodec      61.5.104
   libavformat     61.3.104
   libswscale      8.2.100
   libavfilter     10.2.102
   libswresample   5.2.100

Other Information

Reproduction Steps

mpv --vo=gpu-next --gpu-api=d3d11 <file>

Expected Behavior

libplacebo selects rgba8 because that's the configured bit depth of the device.

Actual Behavior

libplacebo selects rgb10_a2 instead, which results in the driver having to apply its own dithering in addition to whatever mpv is doing. --d3d11-output-format=rgba8 has to be stated explicitly.

Log File

mpv.log

Sample Files

No response

I carefully read all instruction and confirm that I did the following:

kasper93 commented 1 month ago

--d3d11-output-format options doesn't really have control over libplacebo. Only supported value is --d3d11-output-format=rgba8 and still it is only a hint, to not use 10-bit for sdr.

I guess we can add a output depth check in libplacebo and prefer matching format.

Note that in many cases you will still get dithering in monitor, because while they can accept 8-bit signal, the actual output is another story. This we cannot do anything about.

norinoriko commented 1 month ago

I just assumed it's an issue because d3d11's behavior is inconsistent with vulkan, which does output rgba8 (which seems like the more "correct" thing to do but I dunno honestly).

I also tried opengl, but opengl seems to be broken in its own way, since the log doesn't show a selected format and the stats screen just shows "fbo".

Note that in many cases you will still get dithering in monitor, because while they can accept 8-bit signal, the actual output is another story. This we cannot do anything about.

Setting --d3d11-output-format=rgba8 causes banding on 16-bit color gradients if dither-depth is disabled, so I'm just making the assumption that since rgba10_a2 has no banding, there's some kind of internal dithering being applied.

ruihe774 commented 1 month ago

I also tried opengl, but opengl seems to be broken in its own way, since the log doesn't show a selected format and the stats screen just shows "fbo".

There is [vo/gpu-next/libplacebo] (Re)creating 1920x1080x0 texture with format ... in the log showing the selected format. --fbo-format has no control over the format selection logic in libplacebo.

norinoriko commented 1 month ago

There is [vo/gpu-next/libplacebo] (Re)creating 1920x1080x0 texture with format ... in the log showing the selected format.

This is unrelated to output format. This part of the log shows the depth for the file format and the subsequent fbo-format precision.

--fbo-format has no control over the format selection logic in libplacebo.

I didn't say that it did. I'm just saying that the stats screen fails to display a format and just says "fbo" in plaintext.

This is off-topic to this issue and would need to be its own separate issue. I just made an off-hand comment about how other APIs treat the output format for comparison.

ruihe774 commented 1 month ago

I also tried opengl, but opengl seems to be broken in its own way, since the log doesn't show a selected format and the stats screen just shows "fbo".

https://github.com/haasn/libplacebo/pull/267

lextra2 commented 1 month ago

not this sh*t again... AMDs driver temporal dithers (at all times) to what ever bit depth your display is set to in their driver UI Having MPV output 10bit or 8bit won't matter in that case.

norinoriko commented 1 month ago

See https://github.com/mpv-player/mpv/issues/14242#issuecomment-2132465075

Jules-A commented 1 month ago

not this sh*t again... AMDs driver temporal dithers (at all times) to what ever bit depth your display is set to in their driver UI Having MPV output 10bit or 8bit won't matter in that case.

Huh? I don't think it dithers if the output is already 10bit... If I don't set 10bit manually in MPV the image loses some detail compared to setting to 10bit and ordered in MPV (though it's been about 7 months since I last tested). I assume AMD is using a speed focused algorithm and the more expensive MPV options work out better quality.

lextra2 commented 1 month ago

I assume AMD is using a speed focused algorithm and the more expensive MPV options work out better quality.

That would be correct. Doesn't change the fact that AMDs dithering is always enabled (unless manually disabled with ColorControl)

@norinoriko Manually set MPVs dither-depth to whatever has no banding for you. There won't be a "catch-all" auto setting, especially not for Vulkan, which has no API support to read the current displays bit depth.

norinoriko commented 1 month ago

Manually set MPVs dither-depth to whatever has no banding for you.

No shit. This is not relevant to this issue. I'm not complaining about banding here, because there's no banding regardless of whether or not mpv selects rgba8 or rgb10_a2 (for all of the reasons I already reiterated, for the former case mpv is already dithering by default, and for the latter case both mpv and the GPU are dithering since the output has a higher bit-depth than the display).

I'm demonstrating a point that if you manually configure mpv to select the correct output format, you get less unnecessary filtering/noise which is always a net-positive. The core of the issue here is the output format selection does not match the device bit-depth.