Skip to content

Test JP2/JXR detection, native pixels and display previews - #207

Merged
danoli3 merged 1 commit into
masterfrom
fix/jp2-jxr-display-tests
Oct 25, 2026
Merged

danoli3 merged 1 commit into
masterfrom
fix/jp2-jxr-display-tests

Conversation

@danoli3

@danoli3 danoli3 commented Oct 25, 2026 •

Copy link
Copy Markdown
Owner

The #198 samples can decode successfully and then fail when a caller selects a decoder from the extension or passes native RGB16/RGBAF pixels to an 8-bit bitmap/display API. Add a reproducible diagnostic and regression coverage for these paths.

CodecDiagnostics detects input content before falling back to the extension, reports native type/dimensions, optionally verifies matching file/memory pixel hashes, and exports an explicitly requested 24-bit preview. RGB16 uses direct conversion; floating-point RGB/RGBA uses Drago tone mapping. Preview conversion/save failures are reported separately from decode failures, and the native image stays unchanged. The preview policy changes HDR appearance and discards alpha; the decoder's native output remains available.

Synthetic regression tests cover HDR/RGB16 preview conversion, preserved native pixels/alpha, typed codec round trips, and raw J2K mislabeled as .jp2. Fix the bundled JXR CMake ANSI definition and two missing C declarations/includes so the diagnostic can also build on Linux and macOS.

The new JP2/JXR sample checks action tests portable builds and runs the six supplied files on MSVC static and DLL builds. It downloads the public archive linked in #198, verifies its SHA-256, and keeps photographs/previews out of the repository. Runner CPU counts set CMAKE_BUILD_PARALLEL_LEVEL automatically. The workflow can also be dispatched manually.

Validation:

  • Clean macOS JXR-enabled build without global ANSI flags; all 11 TestAPI tests pass.
  • All six supplied files pass file/memory pixel comparison and preview export using both a saved archive and the actual download runner.
  • Standalone diagnostic builds against the installed CMake package and correctly identifies sample-photo.jp2 as J2K.
  • Missing-input and preview-save failures report their own stage; Python and workflow syntax checks pass.
  • Dedicated CI passed on Ubuntu and macOS with JXR enabled.
  • Native MSVC static and DLL jobs both passed the synthetic regression and all six supplied files through file/memory comparison and preview export: static, DLL.

Refs #198. These diagnostics provide a tested loading/display path; the reporting application's actual code is still needed to identify its failure.

@danoli3

danoli3 commented Oct 25, 2026

Copy link
Copy Markdown
Owner Author

The non-Windows JXR build failure was caused by the missing __ANSI__ definition in the CMake build. The classic Makefiles already supplied it. This PR applies it to the bundled JXR sources and PluginJXR.cpp on non-Windows platforms so the portable definitions are selected.

The accompanying _byteswap_ulong declaration and <wchar.h> include resolve the remaining modern-C-compiler build errors. Linux and macOS JXR checks now pass.

For clarity, this fixes the non-Windows build configuration. The supplied images also pass the separate native MSVC static/DLL decode and preview checks; their runtime handling still needs content-based format selection and explicit conversion of HDR/16-bit pixels for ordinary bitmap display.

@danoli3
danoli3 marked this pull request as ready for review October 25, 2026 12:16
@danoli3
danoli3 merged commit e90763c into master Oct 25, 2026
74 checks passed
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