feat(m4): cap map images at Full HD and shrink on import (#85)

The owner fixed the map cap at 1920 px on the long side and 1080 px on the
short side (either orientation). fff-vtt import now shrinks a larger source
with ImageMagick Lanczos before tiling (alpha kept, proportions preserved,
no upscaling), prints `scaled WxH -> WxH`, and records the shrunk w/h; a
source at or below the cap is untouched, so the pixel-identity tests still
hold. A scene row already above the cap is not rewritten: the server logs
`map_above_cap` at startup and serve prints the re-import advice.

Docs: ADR-0023, DESIGN 3.3/5.3/8/11.1/13/14, TESTING 5.3/13, README,
HANDOFF-M4, client README. The M4 phone gate and the fogbench measurement
now use the Full HD maximum; the 16384 px / 262144-cell bench and test rows
stay as labelled server stress references. import-scale now proves a 16384²
input is shrunk to 1080x1080 (289 tiles at 64 px) quickly and bounded.

Part of #63, #85. #77 is blocked by this issue.
This commit is contained in:
2026-11-21 22:37:34 +01:00
parent 52ab50d765
commit a79d809394
22 changed files with 515 additions and 193 deletions
+4 -2
View File
@@ -549,8 +549,10 @@ suite "egress borrows the world instead of copying it (#28)":
check sizeof(Context) <= 6 * sizeof(pointer) + 8
test "building a Context and egressing does not scale with the explored sets":
var small = bigStore(16384) # 128 x 128 cells: the v1 map at cell 32
var large = bigStore(262144) # 512 x 512 cells: a 16384 px map at cell 32
# Synthetic server stress sizes, not the product target: the Full HD maximum is 60 x 34 =
# 2040 cells at cell 32 (#85). Kept large so an explored-set regression has room to show.
var small = bigStore(16384) # 128 x 128 cells (synthetic)
var large = bigStore(262144) # 512 x 512 cells: a 16384 px stress map at cell 32
var sink = 0
# Wall-clock gates are load-sensitive, so every number below is the *fastest* timed sample
# after a warm-up, never a mean: a sample the OS descheduled (or a parallel build on the same
+20
View File
@@ -510,3 +510,23 @@ suite "scene.set (6.1, slice 10 / #25)":
check parseScenePatch(%*{"extra": []}).isNone
check parseScenePatch(%*{"extra": newJNull()}).isNone
check parseScenePatch(%*{"extra": {}}).isSome
suite "Full HD map cap (#85)":
test "cappedMapSize preserves proportions and never upscales":
check cappedMapSize(4000, 3000) == (1440, 1080)
check cappedMapSize(3000, 4000) == (1080, 1440)
check cappedMapSize(16384, 16384) == (1080, 1080)
check cappedMapSize(2000, 2000) == (1080, 1080)
check cappedMapSize(1921, 1080) == (1920, 1079)
check cappedMapSize(1080, 1921) == (1079, 1920)
check cappedMapSize(1920, 1080) == (1920, 1080) # exactly at the cap
check cappedMapSize(256, 192) == (256, 192) # smaller is untouched
test "exceedsMapCap is the long/short side rule, either orientation":
check not exceedsMapCap(1920, 1080)
check not exceedsMapCap(1080, 1920)
check exceedsMapCap(1921, 1080)
check exceedsMapCap(1080, 1921)
check exceedsMapCap(1920, 1081)
check exceedsMapCap(16384, 1080)
check not exceedsMapCap(0, 5000) # no pixels, not "over"