Skip to content

Decompress and decode SOG(S) files in JS and add support for unbundled SOG files#389

Open
mrxz wants to merge 3 commits into
sparkjsdev:mainfrom
mrxz:sog-web-decode
Open

Decompress and decode SOG(S) files in JS and add support for unbundled SOG files#389
mrxz wants to merge 3 commits into
sparkjsdev:mainfrom
mrxz:sog-web-decode

Conversation

@mrxz

@mrxz mrxz commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

This PR builds upon #380

Instead of decompressing SOG(S) files and decoding their WebP images on the Rust side, this PR moves it to the JS side. This allows the Rust dependencies zip and image to be omitted from the bundle. Additionally it makes it possible to support unbundled SOG files. For the build-lod command the current behaviour is retained as it does not have a JS component. This is handled with a Cargo feature for spark-lib that allows to conditionally compile the desired implementation.

The unzipping currently happens synchronously after which the image decoding can start in parallel. An async approach would be nicer, but sadly fflate contains a bug preventing this from working reliably (101arrowz/fflate#208).

In terms of bundle size reduction (#321) this PR has the following effect:

File Before After Delta
spark.module.min.js 2599.85 kB (gzip: 903.24 kB) 1983.95 kB (gzip: 644.65 kB) -23.7% (gzip: -28.6%)
spark.module.js 2769.86 kB (gzip: 917.25 kB) 2163.22 kB (gzip: 659.79 kB) -21.9% (gzip: -28.1%)

The unbundled SOG support does require passing the right SplatFileType (not auto-detected), but the main reason for reintroducing support is the prospect of supporting Streamed SOG files (#375).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant