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
This commit is contained in:
2026-09-28 02:43:16 +02:00
co-authored by Claude Opus 5.5
30 changed files with 726 additions and 267 deletions
@@ -11,8 +11,13 @@ class ImagePreprocessorCPU : public ImagePreprocessor {
// copies it.
std::vector<uint32_t> mask_bits;
template <class T> ImageStatistics Analyze(ImagePreprocessorBuffer &processed_image, const uint8_t *input, T err_value, T sat_value);
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);
};