Commit 95aeeae8 authored by Alejandro Homs Puron's avatar Alejandro Homs Puron Committed by operator for beamline
Browse files

Buffer & Video: fix issues with SoftOpExt:

* Take into account SoftOpExt in image buffer overrun & availability
parent 091b2201
Pipeline #42710 failed with stages
in 8 minutes and 8 seconds
...@@ -1296,11 +1296,18 @@ bool CtControl::_checkOverrun(Data& aData, AutoMutex& l) ...@@ -1296,11 +1296,18 @@ bool CtControl::_checkOverrun(Data& aData, AutoMutex& l)
const ImageStatus &imageStatus = m_status.ImageCounters; const ImageStatus &imageStatus = m_status.ImageCounters;
long imageToProcess = imageStatus.LastImageAcquired - // ext ops are not in-place, relaxing hw buffer limit is LastImageReady
imageStatus.LastBaseImageReady; // if no ext ops, full processing chain needs orig hw buffer
bool full_chain = !m_op_ext_link_task_active;
long imageToSave = imageStatus.LastImageAcquired - bool lastProcIsCounter = m_op_ext_sink_task_active && full_chain;
imageStatus.LastImageSaved; long lastProcessed = lastProcIsCounter ? imageStatus.LastCounterReady :
imageStatus.LastImageReady;
long imageToProcess = imageStatus.LastImageAcquired - lastProcessed;
long lastUsedForSave = full_chain ? imageStatus.LastImageSaved :
imageStatus.LastImageReady;
long imageToSave = imageStatus.LastImageAcquired - lastUsedForSave;
long nb_buffers; long nb_buffers;
m_ct_buffer->getNumber(nb_buffers); m_ct_buffer->getNumber(nb_buffers);
...@@ -1322,7 +1329,7 @@ bool CtControl::_checkOverrun(Data& aData, AutoMutex& l) ...@@ -1322,7 +1329,7 @@ bool CtControl::_checkOverrun(Data& aData, AutoMutex& l)
m_ct_saving->getSaveCounters(first_to_save, last_to_save); m_ct_saving->getSaveCounters(first_to_save, last_to_save);
DEB_ERROR() << DEB_VAR2(first_to_save, last_to_save); DEB_ERROR() << DEB_VAR2(first_to_save, last_to_save);
int frames_to_save = last_to_save - first_to_save + 1; int frames_to_save = last_to_save - first_to_save + 1;
int frames_to_compress = imageStatus.LastBaseImageReady - last_to_save; int frames_to_compress = imageStatus.LastImageReady - last_to_save;
bool slow_processing = frames_to_compress > frames_to_save; bool slow_processing = frames_to_compress > frames_to_save;
DEB_ERROR() << DEB_VAR2(frames_to_compress, frames_to_save); DEB_ERROR() << DEB_VAR2(frames_to_compress, frames_to_save);
error_code = slow_processing ? ProcessingOverun : SaveOverun; error_code = slow_processing ? ProcessingOverun : SaveOverun;
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "lima/CtAcquisition.h" #include "lima/CtAcquisition.h"
#include "lima/CtImage.h" #include "lima/CtImage.h"
#include "lima/CtBuffer.h" #include "lima/CtBuffer.h"
#include "lima/SoftOpExternalMgr.h"
#include "processlib/PoolThreadMgr.h" #include "processlib/PoolThreadMgr.h"
#include "processlib/SinkTask.h" #include "processlib/SinkTask.h"
...@@ -26,7 +27,8 @@ class CtVideo::_Data2ImageTask : public SinkTaskBase ...@@ -26,7 +27,8 @@ class CtVideo::_Data2ImageTask : public SinkTaskBase
{ {
DEB_CLASS_NAMESPC(DebModControl,"Data to image","Control"); DEB_CLASS_NAMESPC(DebModControl,"Data to image","Control");
public: public:
_Data2ImageTask(CtVideo &cnt) : SinkTaskBase(),m_nb_buffer(0),m_cnt(cnt) {} _Data2ImageTask(CtVideo &cnt) : SinkTaskBase(),m_nb_buffer(0),
m_data_always_available(false),m_cnt(cnt) {}
virtual void process(Data &aData) virtual void process(Data &aData)
{ {
...@@ -82,13 +84,21 @@ public: ...@@ -82,13 +84,21 @@ public:
} }
long m_nb_buffer; long m_nb_buffer;
bool m_data_always_available;
private: private:
inline bool _check_available(Data& aData) inline bool _check_available(Data& aData)
{ {
DEB_MEMBER_FUNCT();
CtControl::ImageStatus status; CtControl::ImageStatus status;
m_cnt.m_ct.getImageStatus(status); m_cnt.m_ct.getImageStatus(status);
if (m_data_always_available)
return true;
long offset = status.LastImageAcquired - aData.frameNumber; long offset = status.LastImageAcquired - aData.frameNumber;
DEB_TRACE() << DEB_VAR4(status.LastImageAcquired, aData.frameNumber,
offset, m_nb_buffer);
return offset < m_nb_buffer; return offset < m_nb_buffer;
} }
...@@ -1054,6 +1064,13 @@ void CtVideo::_prepareAcq() ...@@ -1054,6 +1064,13 @@ void CtVideo::_prepareAcq()
m_read_image->frameNumber = -1; m_read_image->frameNumber = -1;
m_write_image->frameNumber = -1; m_write_image->frameNumber = -1;
m_data_2_image_task->m_data_always_available = false;
SoftOpExternalMgr* op_ext = m_ct.externalOperation();
bool op_ext_link_task_active, op_ext_sink_task_active;
op_ext->isTaskActive(op_ext_link_task_active, op_ext_sink_task_active);
if ((m_pars.video_source == LAST_IMAGE) && op_ext_link_task_active)
m_data_2_image_task->m_data_always_available = true;
CtBuffer* buffer = m_ct.buffer(); CtBuffer* buffer = m_ct.buffer();
buffer->getNumber(m_data_2_image_task->m_nb_buffer); buffer->getNumber(m_data_2_image_task->m_nb_buffer);
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment