246 Commits

Author SHA1 Message Date
kris
8c34d87216 WIP - interleave 3 successive palettes for each contiguous row range.
Avoids the banding but not clear if it's overall better

Also implement my own k-means clustering which is able to keep some
centroids fixed, e.g. to be able to retain some fixed palette entries
while swapping out others.  I was hoping this would improve colour
blending across neighbouring palettes but it's also not clear if it
does.
2021-11-10 18:30:39 +00:00
kris
322123522c Assign scan lines randomly to palettes and cluster independently. This doesn't give good results either, since
neighbouring lines end up getting similar but not identical colours, which still results in horizontal striping.
2021-11-10 00:34:17 +00:00
kris
fb52815412 Experiment with striping 16 palettes contiguously across line ranges.
As expected it has clear banding.  A better approach (though still not optimal)
might be to assign lines to palettes randomly.
2021-11-09 22:42:27 +00:00
kris
80885aabf9 Working SHR version. Still just uses a single palette 2021-11-09 22:26:34 +00:00
kris
21058084e2 Tidy 2021-11-09 16:14:37 +00:00
kris
01b19a4a06 Use 4-bit RGB values instead of 8-bit 2021-11-09 15:35:44 +00:00
kris
a92c9cd7b5 Work in CAM16-UCS colour space and cythonize 2021-11-09 15:13:07 +00:00
kris
173c283369 First implementation of using k-means clustering in RGB space to dither a 320x200 SHR image. 2021-11-09 11:23:25 +00:00
kris
0630db2bf1 More relnotes v1.1 2021-11-04 14:55:23 +00:00
kris
f097945b2e Add version history 2021-11-04 14:46:53 +00:00
kris
aebb21263e Update docs 2021-11-04 14:35:14 +00:00
kris
387500a9b4 Remove stray file 2021-11-04 14:34:44 +00:00
kris
bd19d27bd3 Add a script to regenerate image conversions for example images, and add a .po disk image 2021-11-04 14:32:58 +00:00
kris
7e68847bfe nit 2021-11-04 14:31:33 +00:00
kris
1010b64272 Fix shift_pixel_window when shift_right_by > window_width 2021-11-03 15:19:29 +00:00
kris
34ae40ac2d Fix a bug with output for non-ntsc palette 2021-11-03 15:17:57 +00:00
kris
b7174778e6 Oops, no that was wrong. I forgot to cross-check against OpenEmulator <o> 2021-11-03 12:40:22 +00:00
kris
bf76271d75 NTSC conversion should be using YIQ space instead of YUV, which seems
to explain several fudge factors I needed to include to match colours.
2021-11-02 23:28:58 +00:00
kris
df0adec8aa Fix typo 2021-11-02 22:24:47 +00:00
kris
d35cdbc877 Switch remaining palettes to be indexed by (n-bit pixel value, NTSC
phase) and update the comments to explain the encoding scheme.
2021-11-02 22:15:13 +00:00
kris
52bd35e875 Update comment 2021-11-02 22:15:09 +00:00
kris
3544bd74c8 Update comment 2021-11-02 22:14:59 +00:00
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