Jbl/chunked prereq cleanups#171
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).
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.
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.
Add preprocessor checks to select appropriate bitmap copy or conversion routines depending on host endianness and pixel type. Ensures correct pixel data handling on both big-endian and little-endian systems.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
Src/libCZI_UnitTests/test_reader.cpp:1611
CreateBitmapFromSubBlockData()now explicitly throwsstd::invalid_argumentwhenpv == nullptr, but the new unit tests don’t cover this contract. Adding a small regression test would help ensure callers keep getting a clear exception instead of a potential codec-level crash if this guard changes later.
for (int y = 1; y < 4; ++y)
{
bitmap_pointer = static_cast<const uint8_t*>(locked_bitmap.ptrDataRoi) + static_cast<size_t>(y) * locked_bitmap.stride;
for (int x = y == 1 ? 2 : 0; x < 4; ++x)
{
EXPECT_EQ(bitmap_pointer[x], 0);
}
}
}
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
The cmake.yml workflow was updated to set -DLIBCZI_BUILD_UNITTESTS=OFF, preventing unit tests from being built or run during the build process. This change may improve build speed or reflect that tests are not required in this environment.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #171 +/- ##
==========================================
+ Coverage 66.47% 66.63% +0.15%
==========================================
Files 96 96
Lines 12365 12402 +37
==========================================
+ Hits 8220 8264 +44
+ Misses 4145 4138 -7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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: