Repository navigation
Decode Zstandard chunks in the HDF5 reader - #576
Merged
Merged
Conversation
The app's HDF5 reader (src/hdf5/, used for BigDataViewer datasets) now decodes chunks compressed with Zstandard: the HDF Group's registered plugin filter 32015, which hdf5plugin.Zstd() and H5Zzstd write. Before, such datasets failed with "HDF5 Zstandard chunks cannot be decoded". - decodeHdf5Chunk decompresses them with fzstd, alone or with other filters such as shuffle; FILTER_ZSTD is in SUPPORTED_HDF5_FILTERS. - fzstd is pure JavaScript and synchronous like the other filters, needs no WebAssembly or 'unsafe-eval', and was already in the bundle through hyparquet-compressors; it is now a direct dependency at the same 0.1.1. - zstd.h5 fixture (h5py with hdf5plugin): one setup with Zstandard alone, one with shuffle then Zstandard, chunks of 160 KiB (two Zstandard blocks). Reader and loader tests read it. - Docs: Phase 38 decision and delivered item, the BigDataViewer filter list in docs/modalities/image.md.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #569 (Phase 38). The app's own HDF5 reader (
src/hdf5/, which BigDataViewer datasets use) now decodes chunks compressed with Zstandard. Before, those datasets failed with "HDF5 Zstandard chunks cannot be decoded".What's in it
hdf5plugin.Zstd()and H5Zzstd write.decodeHdf5Chunkdecompresses it with fzstd, alone or with other filters such as shuffle.FILTER_ZSTDis inSUPPORTED_HDF5_FILTERS, so the BDV open check accepts it.'unsafe-eval'. It was already in the bundle through hyparquet-compressors. It is now a direct dependency, pinned to the same 0.1.1, so there is one copy. In the build it lands in the Zarr decode worker, where BDV chunks are decoded.zstd.h5is written bymake_bdv_fixtures.pywith h5py and hdf5plugin 7.1.0. It has two setups and no XML: one with Zstandard alone, one with shuffle then Zstandard. Each chunk is 160 KiB, so it spans two Zstandard blocks. Only this file was added. Re-running the script rewriteslatest.h5with different bytes; the other fixtures come out the same.docs/modalities/image.md.Worth knowing
.h5and the HDF5 structure browser read through h5wasm and still can't read Zstandard datasets, as the user guide already says.Checked
tsc -b, ESLint on the changed files, Prettier andcheck:docspass locally.zstd.h5served by Vite opens through the real Zarr decode workers: 2 channels, 4 z planes, no console errors. Auto-contrast ranges are 5077–5606 and 15077–15606, inside the fixture's values on that plane (5050–5623 and 15050–15623).