fixes for issue #62#63
Open
ahmedezzat85 wants to merge 23 commits into
Open
Conversation
…+ init submodules
…tch in opj_decode()
…gets + ASSERTIONS=1 for debug logging
…irect call signature mismatch in openjpeg j2k_exec pipeline
…gnature mismatch in openjpeg j2k_exec pipeline WebAssembly's typed function table traps on any indirect call where the caller and callee signatures don't match exactly. openjpeg's j2k_exec() builds a procedure list of function pointers at runtime and invokes them with casts that are valid in C but illegal in WASM. EMULATE_FUNCTION_POINTER_CASTS=1 instructs Emscripten to emit a trampoline shim for each mismatched indirect call, padding/truncating arguments to match the actual call site signature, preventing the hard WASM trap.
Two independent correctness fixes: 1. Use x1-x0 / y1-y0 for image dimensions instead of x1/y1 directly. image->x1 and image->y1 are absolute grid coordinates, not pixel counts. For any DICOM image where the image origin (x0, y0) is non-zero (tiled datasets, multi-frame, images with a non-zero offset), using x1/y1 directly produces an incorrect buffer size and pixel mapping. 2. Call opj_end_decompress() after opj_decode(). This is required by the openjpeg API to properly finalize decompression and release internal codec state before destroying the codec/stream. Omitting it can leave codec resources in an inconsistent state. 3. Remove unused variable: int comp_num.
The info handler printed [INFO] for every tile header read, tile decode, and image data update. This floods the browser console with ~4 lines per tile. Warning and error handlers are retained for diagnostics.
Restore info_callback and opj_set_info_handler in J2KDecoder.hpp. Restore full EMSCRIPTEN_BINDINGS in jslib-decode.cpp.
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.
No description provided.