Commit Graph

9 Commits

Author SHA1 Message Date
kris
6bf7fd90ff WIP - optimizations but also some bugs 2021-01-08 22:44:28 +00:00
kris
8f2424127f Remove debug code 2021-01-04 21:11:18 +00:00
kris
7f47aa33e7 - work with image as numpy.ndarray instead of Image
- use float32 representation instead of uint8
- Vectorize applying dither
- Improve quality of 560px images by looking ahead N pixels,
  evaluating all 2^N colour choices and minimizing the total error.
2021-01-04 21:08:29 +00:00
kris
82e5779a3a Allow modeling screen as 140x192x16 pixels (i.e. ignoring fringing) or
560x192 where each pixel has a choice of two colours.

The latter doesn't give good results currently, it produces long runs
of colour, presumably when the immediate next choice for dithering is
worse than the current one.  i.e. it gets easily stuck in a local
minimum.

Looking ahead N pixels and computing the 2^N options should improve
this.
2021-01-03 23:23:15 +00:00
kris
ff7a7365bb - Convert from sRGB to linear RGB when rescaling image, and when
dithering.  This is important for linear treatment of quantization
  errors.

- Implement Jarvis dithering

- Implement CIE2000 perceptual diff for colour matching, and the
  CIR601 luminosity weighting used by bmp2dhr (which might come from
  https://bisqwit.iki.fi/story/howto/dither/jy/ - I can't find any
  other source references for this yet).  The former seems to give
  much better results, although it is also several times slower.

- Switch back to treating the display as 140x192x16 colours,
  i.e. ignoring NTSC colour fringing.

- Add sRGB palettes for Virtual II and OpenEmulator (based on sampling
  screen display when rendering full-screen colour)
2021-01-03 22:32:04 +00:00
kris
2458bf98f7 Pack output in Apple II screen format and save as binary file. 2020-12-30 10:27:33 +00:00
kris
38d621a097 Fix edge conditions in dithering
Add TODOs
2020-12-29 21:03:17 +00:00
kris
da420b66c8 Limit colour choices to the two available at each pixel. 2020-12-29 20:47:33 +00:00
kris
5a6eb08db1 Floyd-Steinberg dithering to DHGR colour palette. Doesn't yet take
into account the restrictions on neighbouring colours.
2020-12-29 18:24:29 +00:00