-
Notifications
You must be signed in to change notification settings - Fork 28
Add --data-type CLI option and output format tests #588
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
Merged
Conversation
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
4a0c5c9 to
3d2d2f8
Compare
Benchmark @ 4a0a330Comparing: 4ac4460b (Base) vs 1e53d214 (PR)
|
veluca93
reviewed
Dec 23, 2025
6bf820e to
d692e0a
Compare
veluca93
reviewed
Dec 31, 2025
veluca93
approved these changes
Jan 5, 2026
Add CLI option to request specific output data types (u8, u16, f16, f32) for benchmarking the decoder's conversion pipeline. Add integration tests comparing u8/u16/f16 output against f32 reference to catch conversion bugs like those fixed in PR libjxl#586. Tests verify both RGB and BGRA formats across simple and low-memory pipelines. Changes: - jxl_cli: Add --data-type flag (default: f32) - jxl_cli/src/dec: Add decode_frames_with_type() for typed output - jxl/src/api/decoder.rs: Add test_output_format_{u8,u16,f16}_matches_f32 - jxl/Cargo.toml: Add half as dev-dependency for f16 tests
Returns TypedDecodeOutput that preserves the original output type, with conversion to f32 happening in the caller (outside of timing). This ensures benchmark timing accurately reflects just the decode time, not post-decode conversion overhead. - New enum TypedDecodeOutput that can hold u8/u16/f16/f32 output - decode_frames_with_type returns TypedDecodeOutput + Duration - Caller calls .to_f32() when needed for saving to encoders - Added integration tests for output format consistency
- Add premultiply parameter to decode_with_format<T> - Remove duplicate decode_image functions from premultiply tests - All tests now use the shared decode_with_format helper Removes ~140 lines of duplicated code.
fe7cf60 to
4a0a330
Compare
zond
pushed a commit
that referenced
this pull request
Jan 13, 2026
* Add --data-type CLI option and output format consistency tests Add CLI option to request specific output data types (u8, u16, f16, f32) for benchmarking the decoder's conversion pipeline. Add integration tests comparing u8/u16/f16 output against f32 reference to catch conversion bugs like those fixed in PR #586. Tests verify both RGB and BGRA formats across simple and low-memory pipelines. Changes: - jxl_cli: Add --data-type flag (default: f32) - jxl_cli/src/dec: Add decode_frames_with_type() for typed output - jxl/src/api/decoder.rs: Add test_output_format_{u8,u16,f16}_matches_f32 - jxl/Cargo.toml: Add half as dev-dependency for f16 tests * Add --data-type CLI option and output format tests Returns TypedDecodeOutput that preserves the original output type, with conversion to f32 happening in the caller (outside of timing). This ensures benchmark timing accurately reflects just the decode time, not post-decode conversion overhead. - New enum TypedDecodeOutput that can hold u8/u16/f16/f32 output - decode_frames_with_type returns TypedDecodeOutput + Duration - Caller calls .to_f32() when needed for saving to encoders - Added integration tests for output format consistency * Consolidate duplicate decode_image helpers into decode_with_format - Add premultiply parameter to decode_with_format<T> - Remove duplicate decode_image functions from premultiply tests - All tests now use the shared decode_with_format helper Removes ~140 lines of duplicated code.
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.
Summary
This PR addresses the feedback from PR #586 about being able to:
Changes
CLI
--data-typeoption (jxl_cli)--data-type u8|u16|f16|f32(default: f32)jxl_cli image.jxl -s --data-type u8Output format consistency tests (
jxl/src/api/decoder.rs)test_output_format_u8_matches_f32- Verifies u8 output matches f32test_output_format_u16_matches_f32- Verifies u16 output matches f32test_output_format_f16_matches_f32- Verifies f16 output matches f32