bit_depth defined via config file

This commit is contained in:
lhdamiani
2021-12-14 12:01:50 +01:00
parent 8b43fb67cd
commit 7fcda636dc
13 changed files with 55 additions and 62 deletions
+14 -4
View File
@@ -50,11 +50,21 @@ void ZmqLiveSender::send(const ImageMetadata& meta, const char *data,
// TODO: Here we need to send to streamvis and live analysis metadata(probably need to operate still on them) and data(not every frame)
header.AddMember("frame", meta.id, header_alloc);
header.AddMember("is_good_frame", meta.status, header_alloc);
header.AddMember("pulse_id", meta.id, header_alloc);
// image status convention 0 == good, 1 == frames missing, 2 == different ids
header.AddMember("is_good_frame", (meta.status == 0) ? 1 : 0, header_alloc);
header.AddMember("flip_data", true, header_alloc);
rapidjson::Value detector_name;
detector_name.SetString(det_name_.c_str(), header_alloc);
header.AddMember("detector_name", detector_name, header_alloc);
#ifdef USE_EIGER
header.AddMember("detector_name", "Eiger", header_alloc);
#else
rapidjson::Value detector_name;
detector_name.SetString(det_name_.c_str(), header_alloc);
header.AddMember("detector_name", detector_name, header_alloc);
#endif
header.AddMember("htype", "array-1.0", header_alloc);
+5 -6
View File
@@ -7,6 +7,7 @@
#include "stream_config.hpp"
#include "ZmqLiveSender.hpp"
#include <algorithm>
using namespace std;
using namespace stream_config;
@@ -14,12 +15,11 @@ using namespace buffer_config;
int main (int argc, char *argv[])
{
if (argc != 4) {
if (argc != 3) {
cout << endl;
cout << "Usage: std_stream_send [detector_json_filename]"
" [bit_depth] [stream_address]" << endl;
" [stream_address]" << endl;
cout << "\tdetector_json_filename: detector config file path." << endl;
cout << "\tbit_depth: bit depth of the incoming udp packets." << endl;
cout << "\tstream_address: address to bind the output stream." << endl;
cout << endl;
@@ -27,7 +27,6 @@ int main (int argc, char *argv[])
}
auto config = BufferUtils::read_json_config(string(argv[1]));
const int bit_depth = atoi(argv[2]);
const auto stream_address = string(argv[3]);
auto ctx = zmq_ctx_new();
@@ -37,7 +36,7 @@ int main (int argc, char *argv[])
auto receiver_assembler = BufferUtils::connect_socket(
ctx, config.detector_name, "assembler");
const size_t IMAGE_N_BYTES = config.image_height * config.image_width * bit_depth / 8;
const size_t IMAGE_N_BYTES = config.image_height * config.image_width * config.bit_depth / 8;
RamBuffer image_buffer(config.detector_name + "_assembler",
sizeof(ImageMetadata), IMAGE_N_BYTES,
@@ -52,7 +51,7 @@ int main (int argc, char *argv[])
// gets the image data
char* dst_data = image_buffer.get_slot_data(meta.id);
// sends the json metadata with the data
sender.send(meta, dst_data, IMAGE_N_BYTES);
sender.send(meta, dst_data , IMAGE_N_BYTES);
}
}