mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-22 14:38:14 +02:00
fix gui to stream accordingly for g2 bunch
This commit is contained in:
parent
32e3457e84
commit
6964be2aeb
@ -263,6 +263,7 @@ void DataProcessor::ThreadExecution() {
|
|||||||
LOG(logDEBUG1) << "DataProcessor " << index << ", " << std::hex
|
LOG(logDEBUG1) << "DataProcessor " << index << ", " << std::hex
|
||||||
<< static_cast<void *>(buffer) << std::dec;
|
<< static_cast<void *>(buffer) << std::dec;
|
||||||
|
|
||||||
|
bool streamImageInBunch = false;
|
||||||
char* tempBuffer = buffer;
|
char* tempBuffer = buffer;
|
||||||
for (size_t iFrame = 0; iFrame != fifoBunchSize; iFrame ++) {
|
for (size_t iFrame = 0; iFrame != fifoBunchSize; iFrame ++) {
|
||||||
|
|
||||||
@ -276,6 +277,9 @@ void DataProcessor::ThreadExecution() {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
ProcessAnImage(tempBuffer);
|
ProcessAnImage(tempBuffer);
|
||||||
|
if (streamCurrentFrame_) {
|
||||||
|
streamImageInBunch = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// exception from callback
|
// exception from callback
|
||||||
catch (const std::exception &e) {
|
catch (const std::exception &e) {
|
||||||
@ -284,13 +288,8 @@ void DataProcessor::ThreadExecution() {
|
|||||||
tempBuffer += fifoBunchSizeBytes;
|
tempBuffer += fifoBunchSizeBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
// stream (if time/freq to stream) or free
|
// stream or free
|
||||||
if (streamCurrentFrame_) {
|
if (streamImageInBunch) {
|
||||||
// copy the complete image back if roi enabled
|
|
||||||
if (receiverRoiEnabled_) {
|
|
||||||
(*((uint32_t *)buffer)) = generalData_->imageSize;
|
|
||||||
memcpy(buffer + generalData_->fifoBufferHeaderSize, &completeImageToStreamBeforeCropping[0], generalData_->imageSize);
|
|
||||||
}
|
|
||||||
fifo_->PushAddressToStream(buffer);
|
fifo_->PushAddressToStream(buffer);
|
||||||
} else {
|
} else {
|
||||||
fifo_->FreeAddress(buffer);
|
fifo_->FreeAddress(buffer);
|
||||||
@ -356,8 +355,13 @@ void DataProcessor::ProcessAnImage(char *buf) {
|
|||||||
(uint32_t)(fnum - firstIndex_);
|
(uint32_t)(fnum - firstIndex_);
|
||||||
}
|
}
|
||||||
streamCurrentFrame_ = true;
|
streamCurrentFrame_ = true;
|
||||||
|
// needed to know which one to stream from the bunch
|
||||||
|
(*((uint32_t *)(buf + FIFO_HEADER_STREAM_ENABLE))) = 1;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
streamCurrentFrame_ = false;
|
streamCurrentFrame_ = false;
|
||||||
|
// needed to know which one not to stream from the bunch
|
||||||
|
(*((uint32_t *)(buf + FIFO_HEADER_STREAM_ENABLE))) = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -407,6 +411,15 @@ void DataProcessor::ProcessAnImage(char *buf) {
|
|||||||
// via stopReceiver tcp)
|
// via stopReceiver tcp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// copy the complete image back if roi enabled
|
||||||
|
if (streamCurrentFrame_) {
|
||||||
|
if (receiverRoiEnabled_) {
|
||||||
|
(*((uint32_t *)buf)) = generalData_->imageSize;
|
||||||
|
memcpy(buf + generalData_->fifoBufferHeaderSize, &completeImageToStreamBeforeCropping[0], generalData_->imageSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DataProcessor::SendToStreamer() {
|
bool DataProcessor::SendToStreamer() {
|
||||||
@ -446,7 +459,7 @@ bool DataProcessor::CheckCount() {
|
|||||||
currentFreqCount_ = 1;
|
currentFreqCount_ = 1;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
currentFreqCount_ += fifoBunchSize;
|
++currentFreqCount_;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,7 +136,10 @@ void DataStreamer::ThreadExecution() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// process only if it needs to be streamed
|
||||||
|
if (*((uint32_t *)(tempBuffer + FIFO_HEADER_STREAM_ENABLE))) {
|
||||||
ProcessAnImage(tempBuffer);
|
ProcessAnImage(tempBuffer);
|
||||||
|
}
|
||||||
tempBuffer += fifoBunchSizeBytes;
|
tempBuffer += fifoBunchSizeBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@ namespace sls {
|
|||||||
// fifo
|
// fifo
|
||||||
#define FIFO_HEADER_NUMBYTES (16)
|
#define FIFO_HEADER_NUMBYTES (16)
|
||||||
#define FIFO_DATASIZE_NUMBYTES (4)
|
#define FIFO_DATASIZE_NUMBYTES (4)
|
||||||
|
#define FIFO_HEADER_STREAM_ENABLE (8)
|
||||||
|
|
||||||
// hdf5
|
// hdf5
|
||||||
#define MAX_CHUNKED_IMAGES (1)
|
#define MAX_CHUNKED_IMAGES (1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user