Files
Jungfraujoch/image_analysis/image_preprocessing/ImagePreprocessorCPU.h
T
leonarski_fandClaude Opus 5.5 a277b8c458 Merge rc173 (fused CPU pixel pipeline) into cpu-loops-tail
Conflicts in the three CPU pixel loops the fused pipeline split per block, resolved by carrying this
branch's loop bodies into the new functions with the per-pixel arithmetic unchanged:
- AdaptiveSpotFinderCPU: the register-held ring sums now live in AccumulateRingsBlock (stored at the
  end of each block, so the additions stay in pixel order).
- ImagePreprocessorCPU::AnalyzeBlock reads the PixelMask-derived 32-pixel mask words at first + i.
- ImageSpotFinderCPU::DetectPass: rc173's new_row() marking/fill_row calls kept in place, the
  vertical update replaced by the vectorised slide with the prev_strong fix-up.

Byte-identical p.hkl, p.mtz, p_P1.mtz, p_unmerged.mtz vs rc173 references on myob, cytc, lyso,
sparse (CPU-only build) and myob (GPU build); targeted tests (ImageSpotFinderCPU*, AdaptiveSpotFinder,
SpotFinding, PixelMask, Bragg*, RotationScale, AzimuthalIntegration, portable) pass.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D1G8gJVAy6gp1K5Dz3NE5C
2026-09-28 02:43:16 +02:00

24 lines
1.2 KiB
C++

// SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
// 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<uint32_t> mask_bits;
template <class T> 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);
};