Merge branch 'cpu-fused-pixels' into rc173 (CPU: decode, preprocess and ring statistics fused per bitshuffle block)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D1G8gJVAy6gp1K5Dz3NE5C
This commit is contained in:
2026-09-28 02:11:35 +02:00
co-authored by Claude Opus 5.5
10 changed files with 332 additions and 150 deletions
+28
View File
@@ -291,6 +291,34 @@ TEST_CASE("JFJochCompressor_JFJochDecompressor_LZ4","[ZSTD][portable]") {
REQUIRE(memcmp(image.data(), output.data(), x.GetPixelsNum() * sizeof(int32_t)) == 0);
}
TEST_CASE("JFJochDecompressBlocks_matches_JFJochDecompress","[ZSTD]") {
// An element count that leaves a partial block and a few unshuffled trailing elements.
const size_t nelements = 3 * 8192 + 1000 + 5;
std::vector<uint32_t> image(nelements);
std::mt19937 g(1);
std::poisson_distribution<uint32_t> dist(3.0);
for (auto &i: image)
i = dist(g);
for (auto algorithm: {CompressionAlgorithm::BSHUF_LZ4, CompressionAlgorithm::BSHUF_ZSTD}) {
JFJochBitShuffleCompressor compressor(algorithm);
std::vector<char> tmp(nelements * sizeof(uint32_t) * 2 + 12);
tmp.resize(compressor.Compress(tmp.data(), tmp.size(), image));
std::vector<uint32_t> output(nelements, UINT32_MAX);
size_t next = 0;
JFJochDecompressBlocks(algorithm, reinterpret_cast<const uint8_t *>(tmp.data()), tmp.size(),
nelements, sizeof(uint32_t),
[&](size_t first, const uint8_t *data, size_t n) {
REQUIRE(first == next);
memcpy(output.data() + first, data, n * sizeof(uint32_t));
next = first + n;
});
REQUIRE(next == nelements);
REQUIRE(output == image);
}
}
TEST_CASE("JFJochDecompressor_None","[ZSTD]") {
DiffractionExperiment x(DetJF4M());
x.Compression(CompressionAlgorithm::NO_COMPRESSION).BitDepthImage(32).PixelSigned(true);