Files
basis_universal/encoder
Richard GeldreichandClaude Opus 5.5 f76df2518b LDR image loader: decode .PNG/.TGA/.JPG/.QOI with Wuffs (BASISU_USE_WUFFS_LDR_LOADER, default 1)
load_png(mem), load_tga(file), load_jpg(file/mem) and load_qoi(mem/file) now
go through a thin Wuffs C-API adapter (wuffs_load_ldr) when
BASISU_USE_WUFFS_LDR_LOADER is 1 (the default, basisu_enc.h). Everything
built on them (load_image, load_image_hdr's LDR paths, basis_compressor,
the basisu tool, KTX2 Studio's WASM encoder) switches automatically. The
old pvpngreader / read_tga() / jpgd / qoi.h decode bodies stay in #else
branches (=0 gives today's code; qoi.h is still used to write .QOI).

The adapter only converts to basisu's RGBA image, enforces the caps and
reports errors. Wuffs' accept/reject and pixels are final: no fallback,
no fixups. decode_image_config reads the header, then a 0 width/height
("empty image"), width/height > BASISU_WUFFS_LDR_MAX_DIM (default
basist::BASISU_MAX_SUPPORTED_TEXTURE_DIMENSION = 16384) or a work buffer >
BASISU_WUFFS_LDR_MAX_WORKBUF_BYTES (default 3 GiB here, the measured worst
case at 16384^2; tradeoff documented in basisu_enc.h) is refused BEFORE any
pixel or work buffer is allocated. All memory is basisu's own
(image::try_alloc - added here - and try_resize, initialized); img is only
replaced on success; nothing asserts on file data.

get_ldr_image_info() is a header-only query (no cap) that returns the
true dimensions, even of files beyond the decode cap.

Wuffs is declared here (wuffs-v0.4.c included without
WUFFS_IMPLEMENTATION, same config header) and compiled in
encoder/3rdparty/basisu_wuffs.cpp.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 16:56:38 -04:00
..
2026-03-02 02:52:13 -05:00
2026-07-01 13:20:12 -04:00
2026-07-01 13:20:12 -04:00
2026-07-01 13:30:21 -04:00
2026-07-01 13:30:21 -04:00
2026-07-01 13:20:12 -04:00
2026-07-01 13:20:12 -04:00
2026-07-01 13:20:12 -04:00
2026-07-01 13:20:12 -04:00
2026-07-01 13:20:12 -04:00
2026-07-03 23:01:13 -04:00
2026-07-01 13:20:12 -04:00
2025-11-21 11:52:38 -08:00
2026-07-01 13:30:21 -04:00
2024-09-10 14:44:59 -04:00
2026-07-01 13:30:21 -04:00
2025-11-21 21:30:58 -05:00
2024-09-10 14:44:59 -04:00
2026-07-01 13:30:21 -04:00
2026-01-19 01:59:35 -05:00
2026-07-01 13:20:12 -04:00
2026-07-01 13:30:21 -04:00
2025-11-21 11:52:38 -08:00
2024-09-10 14:44:59 -04:00
2026-01-19 01:59:54 -05:00
2026-01-19 01:59:54 -05:00
2026-07-01 13:30:21 -04:00
2025-11-21 11:52:38 -08:00