Commit Graph

124 Commits

Author SHA1 Message Date
kris
1ed565ff8d Fix a bug with palette depths < 8 2021-11-02 22:14:42 +00:00
kris
0f1ec6f6f2 Optimize memory a bit 2021-11-02 21:25:00 +00:00
kris
4fbb0faf84 Fixes 2021-11-02 15:47:37 +00:00
kris
9dbf413733 Tidy 2021-11-02 15:45:20 +00:00
kris
e84dfb59f9 Tidy a bit 2021-11-02 15:26:43 +00:00
kris
b63fd81c07 Unify DHGRScreen implementations 2021-11-02 15:23:23 +00:00
kris
75a3c6bc48 Simplify image_to_rgb and remove the need for DOTS and DOTS_TO_INDEX 2021-11-02 15:14:22 +00:00
kris
809b975e6e Return a bitmap directly from dither_image. This removes the need to
deal with n-bit encodings at all in DHGRScreen
2021-11-02 14:42:00 +00:00
kris
b7e8c69f64 More descriptive variables 2021-11-02 13:48:53 +00:00
kris
cf69dc9cf2 Bounds check lookahead 2021-11-02 13:42:23 +00:00
kris
8cfee55b1d Get rid of support for 140px mode, it was only useful as a demo of why
other converters have the wrong basic approach.
2021-11-02 13:40:32 +00:00
kris
d442baf1f1 Tidy a bit 2021-11-02 12:30:43 +00:00
kris
5675fac40d Clean up a bit and accommodate palette depth in sliding pixel window 2021-11-02 12:29:30 +00:00
kris
24644658cb Tidy a bit 2021-11-01 12:10:02 +00:00
kris
0c588f7489 Tidy 2021-07-19 18:40:16 +01:00
kris
e5c49b3518 Floyd-Steinberg is working well now, and gives better detail 2021-07-19 18:39:38 +01:00
kris
feefdb5dc6 Use .npy format for RGB to CAM16UCS conversion matrix, and get rid of precomputed CIE2000 distances 2021-07-19 18:35:44 +01:00
kris
e979df03bc Nope, don't need XYZ 2021-07-19 18:13:43 +01:00
kris
8b500b16cb Dither in XYZ representation but use CAM16UCS for colour differences.
This gives the best of both worlds: dithering in a linear space, with
good (and fast) perceptual error differences

TBD: would linear RGB work as well as XYZ?
2021-07-19 17:54:46 +01:00
kris
4984df7f7a Tidy up and optimize a bit 2021-07-19 13:21:32 +01:00
kris
e08f25e4cc Simplify 2021-07-19 12:55:50 +01:00
kris
20a73ffb8a Checkpoint - working again, and simpler 2021-07-19 12:33:49 +01:00
kris
508ce134aa Try to fix how we compute the next pixel palette for 8-bit mode.
Still not sure this is correct.
2021-07-19 09:58:22 +01:00
kris
70074a2942 Support arbitrary gamma correction of input image 2021-07-19 09:57:26 +01:00
kris
7a3adea025 Try cam16UCS instead 2021-07-15 14:25:32 +01:00
kris
4fcda908bd WIP - use colourspacious to perform image dithering in CAM02_UCS
colour space, which is supposed to be perceptually uniform.  i.e. we
can use Euclidean distance instead of CIEDE2000
2021-07-15 13:58:22 +01:00
kris
9bbb9fda7c Fix typos in x transition labels 2021-07-15 09:41:57 +01:00
kris
a593639606 Allow parametrizing gamma 2021-05-28 11:24:05 +01:00
kris
07a358d49b Fix --all to be an optional boolean argument, and fix a deprecation warning (h/t: 4am) 2021-03-15 21:42:21 +00:00
kris
fb6a0f90ab whitespace 2021-03-15 21:42:01 +00:00
kris
99242d455f Fix warning 2021-03-15 21:41:39 +00:00
kris
7a7923503f With recent optimizations converter became ~2.1x faster, so
--lookahead=8 is a reasonable new default.
2021-03-15 17:55:21 +00:00
kris
5487b4aa7e Note disk space requirements and tweak usage 2021-03-15 17:50:56 +00:00
kris
527f6504f7 Add comments and tidy up some more 2021-03-15 17:22:14 +00:00
kris
101d974d50 Use hyphens in option names so that --no-boolean-option is
consistently hyphenated.
2021-03-15 17:21:22 +00:00
kris
ede063a21b No need to pattern to have third axis of shape 1
Minor optimization to not compute error_fraction 3 times

Tidy a bit
2021-03-15 16:22:55 +00:00
kris
551be3eba7 Get --resolution=140 working again
Back out the pixel_palette_options WIP to make this mergable
2021-03-15 15:41:33 +00:00
kris
fcf83aaf9c Even more fasterer! 2021-03-15 15:11:06 +00:00
kris
f157272327 Checkpoint more type annotations 2021-03-15 15:10:49 +00:00
kris
722e85f645 Combine loops in dither_lookahead and don't bother dithering beyond
lookahead or edge of screen.
2021-03-15 15:10:33 +00:00
kris
8b48455c8f Checkpoint 2021-03-15 15:10:33 +00:00
kris
049c334950 Fixed 2021-03-15 15:10:33 +00:00
kris
f4cc7dac40 Checkpoint - I broke something 2021-03-15 15:10:33 +00:00
kris
a686ef76c3 WIP 2021-03-15 15:10:12 +00:00
kris
f87ca90fd4 Add a --verbose option to output progress 2021-03-15 15:01:21 +00:00
kris
e98116b276 Tidy up for merge 2021-03-15 14:01:14 +00:00
kris
72de8f0dfe Try using a table 2021-03-15 13:55:44 +00:00
kris
4ddd48ed8c Try to fix image layout 2021-03-15 13:43:25 +00:00
kris
85ad76a251 More fixes 2021-03-15 13:41:01 +00:00
kris
aa802b93d4 Fixes 2021-03-15 13:35:17 +00:00