From 3ad8a8117435124d5df8c1d70de62c32dd97e113 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Wed, 28 Oct 2026 21:23:53 -0300 Subject: one copy of each codec: PNG and JPEG through wuffs (ghostty's, already linked by ghostty-vt), stb_image without them, its writer and its inflate, SDL without its private stb_image; a symbol-table guard; docs/shared-libs.md ReleaseFast before, both binaries carried stb_image's PNG, JPEG and inflate beside wuffs's (whose function tables keep its decoders linked whatever pardes calls), stb_image_write and its deflate (unused), and the GUI a second stb_image of SDL's (SDL_stb.c, for SDL_LoadPNG and camera MJPEG). Now: - image.zig decodes PNG and JPEG with wuffs (`wuffs_images`, wherever ghostty-vt is in the build), sized from the IHDR or the first SOF before decoding, as stb's info call sized them; other formats and the builds without ghostty-vt keep stb_image. - build.zig compiles zstbi with -DSTBI_NO_PNG -DSTBI_NO_JPEG and patches its stb_image_write include out (one count-checked anchor; a no-op stbi_flip_vertically_on_write stays for zstbi.deinit), and SDL with SDL_DISABLE_STB. Text: tty -74,488 bytes, gui -154,392. `zig build shared-libs-check` (in unit-test, ELF) reads the linked symbol table and fails on a family the build chose against: stb's PNG/JPEG/inflate beside wuffs, a second stb_image, stb_image_write's deflate, a second zlib or FreeType. Checked against the old binaries: it names every one. docs/shared-libs.md: the inventory (implementation, users, copies and bytes before and after, allocator hook) and where one copy was not possible: zlib and wuffs both inflate (FreeType's and MuPDF's zlib API vs ghostty's kitty o=z), MuPDF's libjpeg beside wuffs (filter-dct.c is libjpeg's API), MuPDF's unreached fitz image loaders, base64 in Zig std/simdutf/MuPDF, per-library Unicode code, std.debug's flate. Co-Authored-By: Claude Opus 5.5 --- src/CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/CHANGELOG.md') diff --git a/src/CHANGELOG.md b/src/CHANGELOG.md index 7aab597d..4466ad26 100644 --- a/src/CHANGELOG.md +++ b/src/CHANGELOG.md @@ -2,6 +2,14 @@ ## Unreleased +- One PNG and one JPEG decoder in a binary: images decode through wuffs, + the decoders ghostty uses (ghostty-vt already links them), and stb_image + keeps only the other formats. stb's own inflate and image writer go, as + does SDL's private stb_image, which pardes never called: 73 KB less code + in the tty binary, 151 KB in the GUI. `zig build shared-libs-check` (run + with unit-test) fails if a second copy of one of them comes back; + docs/shared-libs.md lists what is shared and where one copy was not + possible. - Kitty graphics in a terminal pane take every medium kitty and ghostty do: a file (`t=f`), a temporary file (`t=t`) and shared memory (`t=s`) beside direct data, so `kitten icat` no longer falls back to base64 -- cgit v1.3