Jbl/chunked prereq cleanups#171
Draft
ptahmose wants to merge 6 commits into
Draft
Conversation
Refactor bitmap creation logic to modularize decoding from compressed data, introducing new internal helpers and a public API (CreateBitmapFromSubBlockData) for direct bitmap creation from raw data and metadata. Update unit test CMake integration to use gtest_discover_tests when not cross-compiling. Switch CLI11 include to single-header. Improves modularity, testability, and API flexibility.
Introduce AttachmentStatistics struct and GetAttachmentStatistics() method to IAttachmentRepository and its implementations. Provide attachment count retrieval in CCZIReader, CCziReaderWriter, and CCziAttachmentsDirectory. Update headers and source files to support querying attachment statistics.
Changed Codecov flags from ${{matrix.OS}} to ${{matrix.os}} to resolve a case-sensitivity issue with the matrix variable in the workflow configuration.
Bump project version to 0.68.0 in CMakeLists.txt. Add version_history.md entry for v0.68.0, highlighting improved CMake packaging, better downstream build integration, and minor API additions (see PR ZEISS#170).
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a couple of preparatory API additions and internal refactors intended to support upcoming experimental chunked-compression work, while also improving build/test integration and CI workflow correctness.
Changes:
- Added a low-level bitmap decode entry point (
CreateBitmapFromSubBlockData) and refactored bitmap creation internals to share decoding logic. - Added an attachment statistics API (
AttachmentStatistics/GetAttachmentStatistics()), with implementations in reader and reader-writer. - Improved CMake unit test registration for cross-compiling, updated Codecov flag casing, updated CLI11 usage/version, and bumped libCZI to
0.68.0.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| Src/libCZIAPI_UnitTests/CMakeLists.txt | Use gtest_discover_tests() when not cross-compiling. |
| Src/libCZI_UnitTests/CMakeLists.txt | Use gtest_discover_tests() when not cross-compiling. |
| Src/libCZI/libCZI.h | Add CreateBitmapFromSubBlockData, AttachmentStatistics, and GetAttachmentStatistics(). |
| Src/libCZI/CreateBitmap.cpp | Refactor decoding helpers; implement CreateBitmapFromSubBlockData(). |
| Src/libCZI/CZIReader.h | Declare GetAttachmentStatistics() override. |
| Src/libCZI/CZIReader.cpp | Implement GetAttachmentStatistics() for the reader. |
| Src/libCZI/CziReaderWriter.h | Declare GetAttachmentStatistics() override. |
| Src/libCZI/CziReaderWriter.cpp | Implement GetAttachmentStatistics() for the reader-writer. |
| Src/libCZI/CziAttachmentsDirectory.h | Add GetAttachmentCount() to attachment directory. |
| Src/libCZI/CziAttachmentsDirectory.cpp | Implement GetAttachmentCount(). |
| Src/CZICmd/cmdlineoptions.cpp | Switch CLI11 includes to single-header CLI/CLI.hpp. |
| Src/CZICmd/CMakeLists.txt | Bump CLI11 FetchContent tag to v2.6.2. |
| .github/workflows/cmake.yml | Fix Codecov flag variable casing to matrix.os. |
| CMakeLists.txt | Bump project version to 0.68.0. |
| docs/source/pages/version_history.md | Add 0.68.0 version history entry. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+215
to
+216
| // only in this case (data is >= expected size, and if the pixel type is not endianness-agnostic on a big-endian host) | ||
| // we can directly use the data as bitmap data without copying or conversion |
Comment on lines
+256
to
+265
| std::shared_ptr<libCZI::IBitmapData> libCZI::CreateBitmapFromSubBlockData( | ||
| libCZI::CompressionMode compression_mode, | ||
| const void* pv, | ||
| size_t size, | ||
| libCZI::PixelType pixelType, | ||
| std::uint32_t width, | ||
| std::uint32_t height, | ||
| const CreateBitmapOptions* options) | ||
| { | ||
| switch (compression_mode) // NOLINT(clang-diagnostic-switch-enum) |
Comment on lines
+256
to
+263
| std::shared_ptr<libCZI::IBitmapData> libCZI::CreateBitmapFromSubBlockData( | ||
| libCZI::CompressionMode compression_mode, | ||
| const void* pv, | ||
| size_t size, | ||
| libCZI::PixelType pixelType, | ||
| std::uint32_t width, | ||
| std::uint32_t height, | ||
| const CreateBitmapOptions* options) |
Comment on lines
+597
to
+602
| /// Statistics about the attachments in the CZI-document; | ||
| struct AttachmentStatistics | ||
| { | ||
| /// The total number of attachments. | ||
| int attachmentsCount; | ||
| }; |
Comment on lines
+753
to
+756
| /// Gets statistics about the attachments in the document. | ||
| /// \returns The attachment statistics. | ||
| virtual AttachmentStatistics GetAttachmentStatistics() = 0; | ||
|
|
Comment on lines
+753
to
+755
| /// Gets statistics about the attachments in the document. | ||
| /// \returns The attachment statistics. | ||
| virtual AttachmentStatistics GetAttachmentStatistics() = 0; |
Refactored switch statement formatting for clarity. Added null checks for options pointer in JpgXr and Zstd0 cases, defaulting to true for mismatch handling if options is null.
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.
Description
This PR contains preparatory changes and small API additions that are independent of the planned experimental chunked-compression work.
Summary of changes:
CreateBitmapFromSubBlockData, a low-level helper for creating a bitmap directly from compressed subblock payload data and the required bitmap metadata.ISubBlockand decoding from raw subblock data can share the same implementation.AttachmentStatisticsandGetAttachmentStatistics()support for attachment repositories.gtest_discover_tests()only when tests can be discovered by executing the test binary.matrix.OStomatrix.os.0.68.0and update the version history.Type of change
How Has This Been Tested?
Checklist: