diff options
author | Niklas Haas <git@haasn.dev> | 2022-09-20 14:59:00 +0200 |
---|---|---|
committer | Niklas Haas <git@haasn.dev> | 2022-09-20 14:59:00 +0200 |
commit | 1fb5f06c66d07548c15159593643a5b133b148f4 (patch) | |
tree | e03de800f036b6eb3912be916170a48e56f1502b | |
parent | 9e3ec04d56f1ef2c6a9981cb4a0699b5f6ecbdd0 (diff) | |
download | mpv-1fb5f06c66d07548c15159593643a5b133b148f4.tar.bz2 mpv-1fb5f06c66d07548c15159593643a5b133b148f4.tar.xz |
vo_gpu_next: support error diffusion dithering
One step closer to vo_gpu_next feature parity with vo_gpu!
-rw-r--r-- | video/out/vo_gpu_next.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/video/out/vo_gpu_next.c b/video/out/vo_gpu_next.c index d5b85411c0..b4c0b2cbc8 100644 --- a/video/out/vo_gpu_next.c +++ b/video/out/vo_gpu_next.c @@ -1744,19 +1744,27 @@ static void update_render_options(struct vo *vo) p->color_map.gamut_mode = gamut_modes[opts->tone_map.gamut_mode]; switch (opts->dither_algo) { - case DITHER_ERROR_DIFFUSION: - MP_ERR(p, "Error diffusion dithering is not implemented.\n"); - // fall through case DITHER_NONE: p->params.dither_params = NULL; break; + case DITHER_ERROR_DIFFUSION: +#if PL_API_VER >= 225 + p->params.error_diffusion = pl_find_error_diffusion_kernel(opts->error_diffusion); + if (!p->params.error_diffusion) { + MP_WARN(p, "Could not find error diffusion kernel '%s', falling " + "back to fruit.\n", opts->error_diffusion); + } +#else + MP_ERR(p, "Error diffusion dithering is not implemented.\n"); +#endif + // fall through case DITHER_ORDERED: case DITHER_FRUIT: p->params.dither_params = &p->dither; p->dither = pl_dither_default_params; - p->dither.method = opts->dither_algo == DITHER_FRUIT - ? PL_DITHER_BLUE_NOISE - : PL_DITHER_ORDERED_FIXED; + p->dither.method = opts->dither_algo == DITHER_ORDERED + ? PL_DITHER_ORDERED_FIXED + : PL_DITHER_BLUE_NOISE; p->dither.lut_size = opts->dither_size; p->dither.temporal = opts->temporal_dither; break; |