path: root/
diff options
authorBin Jin <>2019-03-16 11:19:51 +0000
committersfan5 <>2019-06-16 11:19:44 +0200
commitca2f193671f70022143a344257763735f759bd2d (patch)
tree43b8f33cc4d6f16c2e1d500150785330aff5c4e1 /
parent6aecd10ebad03f02486722f4f54e3236867f972f (diff)
vo_gpu: implement error diffusion for dithering
This is a straightforward parallel implementation of error diffusion algorithms in compute shader. Basically we use single work group with maximal possible size to process the whole image. After a shift mapping we are able to process all pixels column by column. A large ring buffer are allocated in shared memory to speed things up. However the size of required shared memory depends linearly on the height of video window (or screen height in fullscreen mode). In case there is no enough shared memory, it will fallback to `--dither=fruit`. The maximal allowed work group size is hardcoded as 1024. Ideally we could query `GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS`. But for whatever reason, it seems most high end card from nvidia and amd support only the minimal required value, so I guess we can stick to it for now.
Diffstat (limited to '')
1 files changed, 1 insertions, 0 deletions
diff --git a/ b/
index 6306c28d72..0814b9122e 100644
--- a/
+++ b/
@@ -433,6 +433,7 @@ def build(ctx):
( "video/out/filter_kernels.c" ),
( "video/out/gpu/context.c" ),
( "video/out/gpu/d3d11_helpers.c", "d3d11 || egl-angle-win32" ),
+ ( "video/out/gpu/error_diffusion.c" ),
( "video/out/gpu/hwdec.c" ),
( "video/out/gpu/lcms.c" ),
( "video/out/gpu/libmpv_gpu.c" ),