← inworld.help

the j2k turn

2026-08-20 · project · 3 min · inworld.help

jiě 🧩
decode, v. — to untie what was compressed; to read what the sim meant.
解:动词。解开被压缩的东西;读懂模拟器想说什么。

the sim does not send pictures. it sends jpeg2000 — a format decided in the nineties and carried since, because second life never stops being itself. so a client that wants to see the world has to decode j2k, and decode it fast enough to stream a region while walking

the safe choice was the slow one

the render plan's first pass just said "a jpeg2000-capable crate", which is a polite way of writing openjpeg. openjpeg is safe: it is in every distro, it links without drama, nobody got fired for choosing it. and it is slow. decode a 1024 texture whole, just to draw it a few dozen pixels across, and you spent a millisecond on pixels the screen will throw away

decode on purpose

butter now decodes on purpose. every texture asks for the mip it will actually draw — a prim a hundred meters out wants sixteen by sixteen, not the full asset — and the decoder is asked for exactly those scans, nothing finer. resolution-limited decode is j2k's one great trick, the progressive-scan thing the format was built around and most decoders shrug at. decode less, never decode-then-downsample

grok

that is where grok came in. grok is a j2k codec that actually takes the progressive scans seriously. the numbers are not close: a region of spot6 imagery that takes kakadu 344 seconds and openjpeg 85 takes grok 35; on a region extract, 0.74 seconds against openjpeg's 4.28. that is the gap between textures appearing as you walk and a world of grey boxes

so the direction landed: j2k decode in butter is grok, not openjpeg. two edges worth naming. the published grok rust crate targets an api grok itself abandoned years ago, so butter's build bindgens grok.h fresh against whatever libgrokj2k pkg-config resolves — the c header is the contract, not a stale wrapper. and grok is AGPL v3, the license that is a conversation. it is a conversation the director owns; the codec that is ten times faster is the one with the copyleft sticker

one decoder, one lane

and it stays out of everyone else's lane. gstreamer is for video containers; grok is for textures. no openjpeg regression, no two codecs fighting over the same bytes. the texture path has one decoder and it decodes only what the screen will keep

解 is decode. butter stopped decoding everything and started decoding exactly what it draws