Skip to content

Jbl/chunked prereq cleanups#171

Draft
ptahmose wants to merge 6 commits into
ZEISS:mainfrom
ptahmose:jbl/chunked_prereq_cleanups
Draft

Jbl/chunked prereq cleanups#171
ptahmose wants to merge 6 commits into
ZEISS:mainfrom
ptahmose:jbl/chunked_prereq_cleanups

Conversation

@ptahmose

Copy link
Copy Markdown
Contributor

Description

This PR contains preparatory changes and small API additions that are independent of the planned experimental chunked-compression work.

Summary of changes:

  • Add CreateBitmapFromSubBlockData, a low-level helper for creating a bitmap directly from compressed subblock payload data and the required bitmap metadata.
  • Refactor bitmap creation internals so decoding from an ISubBlock and decoding from raw subblock data can share the same implementation.
  • Add AttachmentStatistics and GetAttachmentStatistics() support for attachment repositories.
  • Improve unit-test registration for cross-compiling by using gtest_discover_tests() only when tests can be discovered by executing the test binary.
  • Fix the Codecov workflow flag variable casing from matrix.OS to matrix.os.
  • Switch CLI11 usage to the single-header include.
  • Bump libCZI version to 0.68.0 and update the version history.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • locally
  • CI/CD

Checklist:

  • I followed the Contributing Guidelines.
  • I did a self-review.
  • I commented my code, particularly in hard-to-understand areas.
  • I updated the documentation.
  • I updated the version of libCZI following Versioning of libCZI depending on the type of change
    • Bug fix -> PATCH
    • New feature -> MINOR
    • Breaking change -> MAJOR
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.

ptahmose added 5 commits June 22, 2026 14:09
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).
@ptahmose ptahmose added the cla Contributor License Agreement sent to Admin label Jun 22, 2026
@ptahmose ptahmose requested a review from Copilot June 22, 2026 12:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 thread Src/libCZI/CreateBitmap.cpp Outdated
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 thread Src/libCZI/libCZI.h
Comment on lines +597 to +602
/// Statistics about the attachments in the CZI-document;
struct AttachmentStatistics
{
/// The total number of attachments.
int attachmentsCount;
};
Comment thread Src/libCZI/libCZI.h
Comment on lines +753 to +756
/// Gets statistics about the attachments in the document.
/// \returns The attachment statistics.
virtual AttachmentStatistics GetAttachmentStatistics() = 0;

Comment thread Src/libCZI/libCZI.h
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla Contributor License Agreement sent to Admin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants