// SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute // SPDX-License-Identifier: GPL-3.0-only #pragma once #include "ImagePreprocessor.h" class ImagePreprocessorCPU : public ImagePreprocessor { // The pixel mask one bit per pixel, 32 to a word - PixelMask derives it once, so each engine only // copies it. std::vector mask_bits; template void AnalyzeBlock(ImagePreprocessorBuffer &processed_image, size_t first, const uint8_t *input, size_t n, T err_value, T sat_value, ImageStatistics &stats); public: ImagePreprocessorCPU(const DiffractionExperiment &experiment, const PixelMask &mask); ImageStatistics Analyze(ImagePreprocessorBuffer &processed_image, const uint8_t *decompressed_image, CompressedImageMode image_mode) override; // Analyze for the n pixels from pixel `first` on, whose values `input` holds, adding to stats. The // blocks of an image can come in any order and together give Analyze()'s result. void AnalyzeBlock(ImagePreprocessorBuffer &processed_image, size_t first, const uint8_t *input, size_t n, CompressedImageMode image_mode, ImageStatistics &stats); };