Files
Jungfraujoch/receiver/FrameTransformation.h
leonarski_fandClaude Opus 5.5 69948cb151 FPGAImagePuller back: rugnux live on the FPGA path through the stream receivers
FPGAImagePuller (rc186's, as 0d26ecd13 left it, with 6b485e57c: every slot and
its compressed-image buffer made up front) takes the card's frames, assembles
and compresses them and hands them on in image order as an ImagePuller, so a
PSI collection runs through the same stream receivers as a DECTRIS one.

JFJochReceiverService::UseFPGAImagePuller(FPGAImagePullerUse, slots):
- RugnuxLive (default): a PSI collection analysed by rugnux live goes through
  the puller to JFJochReceiverRugnuxStills, or JFJochReceiverRugnuxRotation for
  a rotation (which the FPGA path had no live analysis for); every other
  collection stays on JFJochReceiverFPGA.
- Always: also the others, through JFJochReceiverLite (rc186's switch).
- Never: everything on JFJochReceiverFPGA, its own live stills included (the
  rc188 behaviour, kept for comparison).
Pedestal runs, summation on the host and runs without images never take it.

Ported by hand, not cherry-picked: the puller files and its tests are restored
from rc186-old; the service changed since (force_still, refine_solvent,
ClearRugnuxStatus), so its dispatch is written anew around them.

Tests: FPGAImagePullerTest (rc186's 20 cases on the mock, the switch as an
enum, plus FPGAImagePuller_DefaultOnlyWithRugnuxLive); the three GPU-stills
processing tests run on both the default and JFJochReceiverFPGA's live stills.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UqXYdHHZ4cogS1mrGUtfN7
2026-11-18 08:20:18 +01:00

33 lines
1.3 KiB
C++

// SPDX-FileCopyrightText: 2024 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
// SPDX-License-Identifier: GPL-3.0-only
#pragma once
#include "../common/DiffractionExperiment.h"
#include "JFJochCompressor.h"
#include "../common/JFJochMessages.h"
#include "../fpga/pcie_driver/jfjoch_fpga.h"
class FrameTransformation {
const DiffractionExperiment& experiment;
JFJochBitShuffleCompressor compressor;
std::vector<char> precompression_buffer;
std::vector<char> compressed_buffer;
std::vector<char> err_value;
const size_t pixel_depth;
const CompressedImageMode image_mode;
public:
explicit FrameTransformation(const DiffractionExperiment &experiment);
void ProcessModule(const DeviceOutput *output, int data_stream);
void ProcessModule(const void *input, uint16_t module_number, int data_stream);
void FillNotCollectedModule(uint16_t module_number, int data_stream);
// Allocates and writes the buffer GetCompressedImage() compresses into, so its pages are not first touched there
void ReserveCompressedBuffer();
CompressedImage GetCompressedImage();
// Throws CompressionBufferTooSmallException if the image does not fit output_size.
size_t CompressImage(void *output, size_t output_size);
const void *GetImage() const;
};