ImageProcessor: Work in progress on GPU code to preprocess images

This commit is contained in:
2026-04-22 21:06:43 +02:00
parent 4ee249fca2
commit f208109717
8 changed files with 313 additions and 76 deletions
@@ -9,22 +9,21 @@
#include "../common/DiffractionExperiment.h"
#include "../common/PixelMask.h"
struct ImageStatistics {
size_t error_pixel_count = 0;
size_t saturated_pixel_count = 0;
size_t masked_pixel_count = 0;
int64_t max_value = INT64_MIN;
int64_t min_value = INT64_MAX;
struct alignas(8) ImageStatistics {
unsigned long long error_pixel_count = 0;
unsigned long long saturated_pixel_count = 0;
unsigned long long masked_pixel_count = 0;
long long max_value = INT64_MIN;
long long min_value = INT64_MAX;
};
class ImagePreprocessor {
protected:
const size_t npixels;
const DiffractionExperiment &experiment;
std::vector<bool> mask_1bit;
const int64_t saturation_limit;
template <class T> ImageStatistics Analyze(std::vector<int32_t> &processed_image, const uint8_t *input, T err_value, T sat_value);
public:
ImagePreprocessor(const DiffractionExperiment &experiment, const PixelMask &mask);
ImageStatistics Analyze(std::vector<int32_t> &processed_image, const uint8_t *decompressed_image, CompressedImageMode image_mode);
ImagePreprocessor(const DiffractionExperiment &experiment);
virtual ~ImagePreprocessor() = default;
virtual ImageStatistics Analyze(std::vector<int32_t> &processed_image, const uint8_t *decompressed_image, CompressedImageMode image_mode) = 0;
};