bit depth parameter infrastructure. partial eiger assemble image routine.

This commit is contained in:
lhdamiani
2021-07-02 10:44:51 +02:00
parent 3f7fef4f61
commit c344daaffe
37 changed files with 4369 additions and 103 deletions
+2
View File
@@ -18,6 +18,7 @@ namespace BufferUtils
const std::string detector_name;
const int n_modules;
const int n_submodules;
const int start_udp_port;
const std::string buffer_folder;
@@ -31,6 +32,7 @@ namespace BufferUtils
<< det_config.GAIN_FILENAME << ' '
<< det_config.detector_name << ' '
<< det_config.n_modules << ' '
<< det_config.n_submodules << ' '
<< det_config.start_udp_port << ' '
<< det_config.buffer_folder << ' ';
}
+14 -1
View File
@@ -7,7 +7,12 @@
class RamBuffer {
const std::string detector_name_;
const int n_modules_;
const int n_submodules_;
const int n_slots_;
const int bit_depth_;
const size_t n_packets_per_frame_;
const size_t data_bytes_per_frame_;
const size_t meta_bytes_;
const size_t image_bytes_;
@@ -19,10 +24,15 @@ class RamBuffer {
ModuleFrame* meta_buffer_;
char* image_buffer_;
private:
void assemble_eiger_image(ImageMetadata &image_meta,
const int bit_depth, const size_t slot_n) const;
public:
RamBuffer(const std::string& detector_name,
const int n_modules,
const int n_slots=buffer_config::RAM_BUFFER_N_SLOTS);
const int n_submodules,
const int bit_depth);
~RamBuffer();
void write_frame(const ModuleFrame &src_meta, const char *src_data) const;
@@ -33,6 +43,9 @@ public:
char* read_image(const uint64_t pulse_id) const;
void assemble_image(
const uint64_t pulse_id, ImageMetadata &image_meta) const;
};
-6
View File
@@ -6,12 +6,6 @@
namespace buffer_config {
const size_t MODULE_X_SIZE = 1024;
const size_t MODULE_Y_SIZE = 512;
const size_t MODULE_N_PIXELS = MODULE_X_SIZE * MODULE_Y_SIZE;
const size_t PIXEL_N_BYTES = 2;
const size_t MODULE_N_BYTES = MODULE_N_PIXELS * PIXEL_N_BYTES;
// How many frames we store in each file.
// Must be power of 10 and <= than FOLDER_MOD
const size_t FILE_MOD = 1000;
+29 -6
View File
@@ -4,11 +4,34 @@
#include <cstdint>
#define N_MODULES 1
#define BYTES_PER_PACKET 1072
#define DATA_BYTES_PER_PACKET 1024
#define BYTES_PER_PACKET 4144
#define DATA_BYTES_PER_PACKET 4096
// EIGER 1M
// Each packet line is made of 2 chip lines -> [CHIP1]<gap>[CHIP2]
// gaps between chips
// For a 1M:
// 0 gap 1
// gap gap
// 2 gap 3
#define MODULE_X_SIZE 256
#define MODULE_Y_SIZE 512
#define MODULE_N_PIXELS 131072
#define PIXEL_N_BYTES 2
#define MODULE_N_BYTES 262144
#define GAP_X_MODULE_PIXELS 2
#define GAP_Y_MODULE_PIXELS 2
#define GAP_X_EIGERMOD_PIXELS 8
#define GAP_Y_EIGERMOD_PIXELS 36
#define N_BYTES_PER_MODULE_LINE(bit_depth) ((MODULE_X_SIZE * bit_depth) / 8)
// #define N_BYTES_PER_IMAGE_LINE(bit_depth, n_submodules) ((n_submodules / 2 * MODULE_X_SIZE * bit_depth) / 8)
// DR 16
#define N_PACKETS_PER_FRAME 256
#define DATA_BYTES_PER_FRAME 262144
// #define N_PACKETS_PER_FRAME 256
// #define DATA_BYTES_PER_FRAME 262144
// DR 32
// #define N_PACKETS_PER_FRAME 512
// #define DATA_BYTES_PER_FRAME 524288
@@ -24,8 +47,8 @@ struct det_packet {
uint64_t timestamp;
uint16_t moduleID;
uint16_t xCoord;
uint16_t yCoord;
uint16_t row;
uint16_t column;
uint16_t reserved;
uint32_t debug;
+3 -5
View File
@@ -9,10 +9,7 @@
#include "eiger.hpp"
#endif
#ifdef DEBUG_OUTPUT
#define EIGER_DATA_BYTES_PER_PACKET_VALIDATION 262144
#define JUNGFRAU_DATA_BYTES_PER_PACKET_VALIDATION 1048576
#endif
#define IS_BOTTOM(n) ((n%2 != 0) ? -1 : 1)
#pragma pack(push)
#pragma pack(1)
@@ -22,6 +19,7 @@ struct ModuleFrame {
uint64_t daq_rec;
uint64_t n_recv_packets;
uint64_t module_id;
uint16_t bit_depth;
uint16_t row;
uint16_t column;
};
@@ -47,7 +45,7 @@ struct ModuleFrameBuffer {
struct BufferBinaryFormat {
const char FORMAT_MARKER = 0xBE;
ModuleFrame meta;
char data[buffer_config::MODULE_N_BYTES];
char data[MODULE_N_BYTES];
};
#pragma pack(pop)
+11 -4
View File
@@ -6,8 +6,15 @@
#define N_MODULES 32
#define BYTES_PER_PACKET 8240
#define DATA_BYTES_PER_PACKET 8192
#define N_PACKETS_PER_FRAME 128
#define DATA_BYTES_PER_FRAME 1048576
#define MODULE_X_SIZE 1024
#define MODULE_Y_SIZE 512
#define MODULE_N_PIXELS 524288
#define PIXEL_N_BYTES 2
#define MODULE_N_BYTES 1048576
// #define N_PACKETS_PER_FRAME 128
// #define DATA_BYTES_PER_FRAME 1048576
// 48 bytes + 8192 bytes = 8240 bytes
#pragma pack(push)
@@ -21,8 +28,8 @@ struct det_packet {
uint64_t timestamp;
uint16_t moduleID;
uint16_t xCoord;
uint16_t yCoord;
uint16_t row;
uint16_t column;
uint16_t zCoord;
uint32_t debug;