Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🪅 Fix blosc loading #73

Merged
merged 6 commits into from
Dec 8, 2024
Merged

🪅 Fix blosc loading #73

merged 6 commits into from
Dec 8, 2024

Conversation

rosaliedewinther
Copy link
Contributor

@rosaliedewinther rosaliedewinther commented Dec 8, 2024

For a while we have not been able to load blosc encoded files. But that time is no more. After a significant debugging session I found out that OpenVDB does hit this check https://github.com/AcademySoftwareFoundation/openvdb/blob/master/openvdb/openvdb/io/Compression.h#L308 and does an early out if count == 0. We didnt do this check resulting in us reading num_compressed_bytes from the reader, reading garbage and offsetting the reader incorrectly.

I validated the results against one frame of each of JangaFX's free download models, specifically the ones listed below:
image
All these models now load correctly. yay.

The main problematic files remaining are specific exports I made myself with Houdini. These models use f32 for the voxel values, unlike Embergen, which uses f16.

This PR fixes #33

src/reader.rs Outdated Show resolved Hide resolved
@rosaliedewinther rosaliedewinther merged commit 632f3f5 into main Dec 8, 2024
4 checks passed
@rosaliedewinther rosaliedewinther deleted the fix-blosc branch December 8, 2024 17:21
@Jasper-Bekkers
Copy link
Member

Glad to see that you already resolved and ninja-merge this before I could even get to the bottom of that T::zeroed(); discard 🤷 👍

That investigation can easily happen async an decoupled from this PR. As the code got fixed before merging.

src/reader.rs Outdated
@@ -229,6 +229,9 @@ impl<R: Read + Seek> VdbReader<R> {
gd: &GridDescriptor,
count: usize,
) -> Result<Vec<T>, ParseError> {
if count == 0 {
return Ok(vec![T::zeroed(); count]);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ya that didn't make sense. I am constructing an empty vec now.

@rosaliedewinther
Copy link
Contributor Author

I'm sorry, at the time of merging I didnt know you were still reviewing.

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.

Allocation failure on parsing of BLOSC compressed VDB data
2 participants