Checkpoint WIP for easier comparison to dhgr branch:

- naive version of NTSC artifacting, it uses a sliding 4-bit window to
  assign a nominal (D)HGR colour to each dot position.  A more
  sophisticated/correct implementation would model the YIQ signal
  directly.

- Switch DHGRBitmap implementation to use a 34-bit representation of
  the 4-byte tuple, comprised of a 3-bit header and footer, plus
  4*7=28-bit body.  The headers/footers account for the influence on
  neighbouring tuples from the 4-bit NTSC window.

- With this model each screen byte influences 13 pixels, so we need to
  precompute 2^26 edit distances for all possible (source, target)
  13-bit sequences.

- Checkpointing not-yet-working HGR implementation.

- Add new unit tests but not yet all passing due to refactoring
This commit is contained in:
kris
2019-07-02 22:40:50 +01:00
parent e2a8bd9b4d
commit 666272a8fc
9 changed files with 1268 additions and 367 deletions

View File

@ -21,6 +21,7 @@ class TestVideo(unittest.TestCase):
frame.page_offset[0, 1] = 0b1010101
target_pixelmap = screen.DHGRBitmap(
palette = palette.Palette.NTSC,
main_memory=v.memory_map,
aux_memory=frame
)
@ -28,10 +29,10 @@ class TestVideo(unittest.TestCase):
0b0000000101010100000001111111,
target_pixelmap.packed[0, 0])
diff = v._diff_weights(v.pixelmap, target_pixelmap, is_aux=True)
pal = palette.NTSCPalette
diff = target_pixelmap.diff_weights(v.pixelmap, is_aux=True)
# Expect byte 0 to map to 0b00000000 01111111
expect0 = target_pixelmap.edit_distances(pal.ID)[0][0b0000000001111111]
@ -63,7 +64,7 @@ class TestVideo(unittest.TestCase):
target_pixelmap.packed[0, 0]
)
diff = v._diff_weights(v.pixelmap, target_pixelmap, is_aux=True)
diff = target_pixelmap.diff_weights(v.pixelmap, is_aux=True)
# Expect byte 0 to map to 0b01111111 01101101
expect0 = target_pixelmap.edit_distances(pal.ID)[0][0b0111111101101101]