Hi-Res is essentially a more constrained version of Double Hi-Res, in which only about half of the 560 horizontal screen pixels can be independently addressed.
In particular an 8 bit byte in screen memory controls 14 or 15 screen pixels. Bits 0-7 are doubled, and bit 8 shifts these 14 dots to the right if enabled. In this case bit 7 of the previous byte is repeated a third time.
This means that we have to optimize all 8 bits at once and move forward in increments of 14 screen pixels.
There's also a timing difference that results in a phase shift of the NTSC colour signal, which means the mappings from dot patterns to effective colours are rotated.
Error diffusion seems to give best results if we only distribute about 2/3 of the quantization error according to the dither pattern.
- Preprocess the source image by dithering with the full 12-bit //gs
colour palette, ignoring SHR palette restrictions (i.e. each pixel
chosen independently from 4096 colours)
- Using this as the ground truth allows much better handling of
e.g. solid colours, which were being dithered inconsistently with
the previous approach
- Also when fitting an SHR palette, fix any colours that comprise more
than 10% of source pixels. This also encourages more uniformity in
regions of solid colour.
helps with images where there are large solid colour fields that
sometimes cause uneven dithering because of colours that cannot be
matched with the //gs palette, but it's not a viable solution in
general since it reduces overall quality (sometimes substantially,
e.g. in case of vertical colour gradients)
This is useful when used as part of an image repository build
pipeline, to avoid replacing existing images if the new score is
higher.
Hide intermediate output behind --verbose
reserved colours from the global palette, and pick unique random
points from the samples for the rest. This encourages a larger range
of colours in the resulting images and may improve quality.
Iterate a max number of times without improvement in the outer loop as
well.
Save intermediate preview outputs.