diff options
author | Bin Jin <bjin@ctrl-d.org> | 2019-03-16 11:19:51 +0000 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2019-06-16 11:19:44 +0200 |
commit | ca2f193671f70022143a344257763735f759bd2d (patch) | |
tree | 43b8f33cc4d6f16c2e1d500150785330aff5c4e1 /video/out/gpu/video.h | |
parent | 6aecd10ebad03f02486722f4f54e3236867f972f (diff) | |
download | mpv-ca2f193671f70022143a344257763735f759bd2d.tar.bz2 mpv-ca2f193671f70022143a344257763735f759bd2d.tar.xz |
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 'video/out/gpu/video.h')
-rw-r--r-- | video/out/gpu/video.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/video/out/gpu/video.h b/video/out/gpu/video.h index 1b0994ac78..931944a777 100644 --- a/video/out/gpu/video.h +++ b/video/out/gpu/video.h @@ -71,6 +71,7 @@ enum dither_algo { DITHER_NONE = 0, DITHER_FRUIT, DITHER_ORDERED, + DITHER_ERROR_DIFFUSION, }; enum alpha_mode { @@ -131,6 +132,7 @@ struct gl_video_opts { int dither_size; int temporal_dither; int temporal_dither_period; + char *error_diffusion; char *fbo_format; int alpha_mode; int use_rectangle; |