Closed Isaacx123 closed 1 year ago
Forgot to add that the artifacts become bigger or smaller depending on the target resolution:
Bigger artifacts at 1046p:
Smaller artifacts at 810p:
Can you reproduce it with this shader as well (turn the native AR off if you want to give it a shot)?
The shader does not exhibit any artifacts when downscaling with a Polar filter:
mpv --no-config --vo=gpu-next --gpu-api=vulkan --correct-downscaling=yes --linear-downscaling=yes --dscale=ewa_robidouxsharp --glsl-shader=PixelClipper.glsl --autofit=1760x990 --log-file=mpv.log --screenshot-format=png --screenshot-high-bit-depth=no test-clip.mkv
The following patch (to libplacebo) fixed the artifacts for me:
diff --git a/src/shaders/sampling.c b/src/shaders/sampling.c
index efa69dd8..53ea52bd 100644
--- a/src/shaders/sampling.c
+++ b/src/shaders/sampling.c
@@ -480,7 +480,7 @@ static void polar_sample(pl_shader sh, pl_filter filter,
@for (c : comp_mask) { \
cc = vec2(${float: scale} * c[@c]); \
cc.x = 1.0 - cc.x; \
- ww = cc + vec2(0.07); \
+ ww = cc + vec2(0.08); \
ww = ww * ww; \
ww = ww * ww; \
ww = ww * ww; \
It seems that 0.07^33
underflows the range of float32
by just a little bit, and this issue becoming even more problematic with --linear-downscaling
(sample value much closer to zero).
EDIT: posted a PR at https://code.videolan.org/videolan/libplacebo/-/merge_requests/579
Thanks bjin
Important Information
Polar filters
Provide following Information:
Reference screenshot downscaled with Mitchell:
Screenshot with artifacts downscaled with EWA_RobidouxSharp plus AR at 0.5 strength:
Screenshot without artifacts downscaled with EWA_RobidouxSharp and no AR:
It also happens with non-Cubic/Mitchell-Netravali filters like EWA_Lanczos:
The artifacts become more evident with a higher AR strength, EWA_RobidouxSharp plus AR at 1.0 strength:
Orthogonal filters like Catmull_Rom or Mitchell don't present any issues, Catmull_Rom plus AR at 0.5 strength:
Reproduction steps
mpv --no-config --vo=gpu-next --gpu-api=vulkan --correct-downscaling=yes --linear-downscaling=yes --dscale=mitchell --autofit=1760x990 --log-file=mpv.log --screenshot-format=png --screenshot-high-bit-depth=no test-clip.mkv
mpv --no-config --vo=gpu-next --gpu-api=vulkan --correct-downscaling=yes --linear-downscaling=yes --dscale=ewa_robidouxsharp --scale-antiring=0.5 --autofit=1760x990 --log-file=mpv.log --screenshot-format=png --screenshot-high-bit-depth=no test-clip.mkv
mpv --no-config --vo=gpu-next --gpu-api=vulkan --correct-downscaling=yes --linear-downscaling=yes --dscale=ewa_lanczos --scale-antiring=0.5 --autofit=1760x990 --log-file=mpv.log --screenshot-format=png --screenshot-high-bit-depth=no test-clip.mkv
mpv --no-config --vo=gpu-next --gpu-api=vulkan --correct-downscaling=yes --linear-downscaling=yes --dscale=ewa_robidouxsharp --scale-antiring=1 --autofit=1760x990 --log-file=mpv.log --screenshot-format=png --screenshot-high-bit-depth=no test-clip.mkv
mpv --no-config --vo=gpu-next --gpu-api=vulkan --correct-downscaling=yes --linear-downscaling=yes --dscale=catmull_rom --scale-antiring=0.5 --autofit=1760x990 --log-file=mpv.log --screenshot-format=png --screenshot-high-bit-depth=no test-clip.mkv
Expected behavior
Downscaling without artifacts while AR is active.
Actual behavior
Dithering like squarish artifacts.
Log file
ewa_robidouxsharp+ar50.log
catmull_rom+ar50.log
Sample files
https://0x0.st/Hffj.mkv