• src/doors/syncretro/syncretro_quant.c syncretro_quant.h test_quant.c

    From Rob Swindell (on Debian Linux)@1:103/705 to Git commit to main/sbbs/master on Saturday, July 25, 2026 23:10:02
    https://gitlab.synchro.net/main/sbbs/-/commit/4ba867d0bad38dfe141b8f7e
    Modified Files:
    src/doors/syncretro/syncretro_quant.c syncretro_quant.h test_quant.c Log Message:
    syncretro: take the oldest sixel register, don't rebuild the map

    The colour->register map only ever grew, and a frame whose new colours
    could not fit threw the whole map away and rebuilt it from that frame.
    With shared colour registers -- which is what SyncTERM has, and what
    `CSI ? 1070 l` asks every other terminal for -- redefining a register
    recolours every pixel already on screen that was drawn with it, so a
    rebuild repaints the entire displayed frame in the wrong colours until
    the new pixel data lands on top of it.

    A console with a small fixed palette never reaches that: Intellivision
    has 16 colours, the NES 64. A console whose games fade or cycle their
    palette reaches it in seconds. Street Fighter II's attract mode re-tints
    every colour of a ~150-colour screen every frame, so the map saturated
    and then rebuilt on nearly every frame -- measured over its attract loop,
    150 of 256 registers changing meaning in a single frame, and 4.3 per
    frame on average.

    Give each register the generation that last drew with it and hand a new
    colour the least recently used one instead. The frame the terminal is displaying is the youngest generation, so its registers go last, and the colours a frame carries over are stamped before anything is taken -- a
    colour still on screen can never lose its register to a colour of the
    same frame.

    Over the same attract loop that leaves a worst frame of 37 registers
    rather than 150, and 0.5 per frame rather than 4.3. Every eviction of a displayed register was checked for a better candidate and none had one:
    where it still recolours, prev and current frame genuinely need more than
    256 colours between them. Games that never fill the map (tmnt, joust,
    pacman, xevious) are byte-for-byte unaffected.

    Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
    --- SBBSecho 3.37-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)