Commit Graph

15 Commits

Author SHA1 Message Date
David Thomas bd2ae1eb61
Appease the automatons 2025-06-24 17:43:35 +01:00
David Thomas 4c5f5249d8
Fix transposed arg, add consts 2025-06-24 11:08:01 +01:00
David Thomas 87fc82a978
Flip dither matrix when zig-zagging 2025-06-24 11:08:01 +01:00
David Thomas b43e3e6ac1
Avoid copying error buffers around
# Conflicts:
#	src/render/error_diffusion.cpp
2025-06-24 11:08:01 +01:00
David Thomas d6129359c4
Adopt clang-tidy suggestions 2025-06-24 11:08:01 +01:00
David Thomas 9e9abfab27
Add five new types of diffusion dither and expose zig zag to user
This extends the existing dithering code to add Jarvis-Judice-Ninke,
Stucki, Atkinson, Burkes and Sierra error diffused dithers. It also
exposes the zig zag (serpentine) choice to the user. Diffusion is
tweaked to use fixed point for the error values.
2025-06-24 11:08:01 +01:00
David Capello 09538f9a1a clang-format all files 2024-12-16 14:52:19 -03:00
David Capello 71d885d2a0 Replace base::clamp -> std::clamp as now we use C++17 2022-06-09 19:05:48 -03:00
David Capello 86259a64fc Replace MID() macro with base::clamp() function
In the future we will replace base::clamp() with std::clamp().
2020-04-07 19:47:16 -03:00
David Capello fcf272bb69 Add amount parameter to Error Diffusion algorithm 2019-04-03 18:45:18 -03:00
David Capello e1437a20c3 Fix Floyd-Steinberg error propagation for the 1/16 part
This patch fixes the quantization of a complete gray
image (RGB=128,128,128), which must generate a black and white
checkered pattern when the Floyd-Steinberg filter is applied.

Regression from b6d07d995f
2019-04-03 15:02:23 -03:00
David Capello 08ec3767ba Add support to scan the image in zig-zag way for error diffusion filters 2019-04-03 12:14:17 -03:00
David Capello b6d07d995f Fix error diffusion algorithm
The error propagation must be limited to 0...255 values, and the new
quantization error must be calculated to that limited value. Also the
1/16 part of the Floyd-Steinberg distribution must be the remaining of
the other parts.
2019-04-02 13:58:55 -03:00
David Capello c2af88343e Fix invalid memory access in ErrorDiffusionDither 2019-04-02 00:18:36 -03:00
David Capello 20b8ee0e57 Add Floyd-Steinberg dithering for RGBA -> Indexed conversion 2019-04-01 22:00:32 -03:00