Commit b67c7039 authored by Sebastien Petitdemange's avatar Sebastien Petitdemange
Browse files

first compilable Accumulation into control layer

parent ded5b048
......@@ -81,9 +81,6 @@ class BufferCtrlObj : public HwBufferCtrlObj
virtual void setNbConcatFrames(int nb_concat_frames);
virtual void getNbConcatFrames(int &nb_concat_frames);
virtual void setNbAccFrames(int nb_acc_frames);
virtual void getNbAccFrames(int &nb_acc_frames);
virtual void getMaxNbBuffers(int &max_nb_buffers);
virtual void *getBufferPtr(int buffer_nb, int concat_frame_nb=0);
......
......@@ -148,18 +148,6 @@ void BufferCtrlObj::getNbConcatFrames(int &nb_concat_frames)
}
void BufferCtrlObj::setNbAccFrames(int nb_acc_frames)
{
m_buffer_mgr.setNbAccFrames(nb_acc_frames);
}
void BufferCtrlObj::getNbAccFrames(int &nb_acc_frames)
{
m_buffer_mgr.getNbAccFrames(nb_acc_frames);
}
void BufferCtrlObj::getMaxNbBuffers(int &max_nb_buffers)
{
m_buffer_mgr.getMaxNbBuffers(max_nb_buffers);
......@@ -315,7 +303,6 @@ void Interface::reset(ResetLevel reset_level)
m_sync.setNbFrames(1);
m_buffer.setNbConcatFrames(1);
m_buffer.setNbAccFrames(1);
// m_buffer.setNbBuffers(1); // We need to set the FrameDim before this!
}
......
......@@ -69,9 +69,6 @@ class BufferCtrlObj : public HwBufferCtrlObj
virtual void setNbConcatFrames(int nb_concat_frames);
virtual void getNbConcatFrames(int& nb_concat_frames);
virtual void setNbAccFrames(int nb_acc_frames);
virtual void getNbAccFrames(int& nb_acc_frames);
virtual void getMaxNbBuffers(int& max_nb_buffers);
virtual void *getBufferPtr(int buffer_nb, int concat_frame_nb = 0);
......
......@@ -57,9 +57,6 @@ class BufferCtrlObj : HwBufferCtrlObj
virtual void setNbConcatFrames(int nb_concat_frames);
virtual void getNbConcatFrames(int& nb_concat_frames /Out/);
virtual void setNbAccFrames(int nb_acc_frames);
virtual void getNbAccFrames(int& nb_acc_frames /Out/);
virtual void getMaxNbBuffers(int& max_nb_buffers /Out/);
virtual void *getBufferPtr(int buffer_nb, int concat_frame_nb = 0);
......
......@@ -148,18 +148,6 @@ void BufferCtrlObj::getNbConcatFrames(int& nb_concat_frames)
m_buffer_mgr.getNbConcatFrames(nb_concat_frames);
}
void BufferCtrlObj::setNbAccFrames(int nb_acc_frames)
{
DEB_MEMBER_FUNCT();
m_buffer_mgr.setNbAccFrames(nb_acc_frames);
}
void BufferCtrlObj::getNbAccFrames(int& nb_acc_frames)
{
DEB_MEMBER_FUNCT();
m_buffer_mgr.getNbAccFrames(nb_acc_frames);
}
void BufferCtrlObj::getMaxNbBuffers(int& max_nb_buffers)
{
DEB_MEMBER_FUNCT();
......@@ -504,7 +492,6 @@ void Interface::reset(ResetLevel reset_level)
m_buffer.setFrameDim(frame_dim);
m_buffer.setNbConcatFrames(1);
m_buffer.setNbAccFrames(1);
m_buffer.setNbBuffers(1);
}
......
......@@ -525,25 +525,6 @@ void test_frelon_hw_inter(bool do_reset)
hw_inter.stopAcq();
print_status(hw_inter);
hw_buffer->setFrameDim(effect_frame_dim);
hw_buffer->setNbAccFrames(5);
hw_buffer->setNbBuffers(10);
check_sps_image_frame_dim(hw_inter, bin, set_roi, sps_image);
hw_sync->setNbFrames(3);
DebParams::disableModuleFlags(DebModEspia);
print_deb_flags();
print_status(hw_inter);
acq_state.set(AcqState::Acquiring);
hw_inter.startAcq();
acq_state.waitNot(AcqState::Acquiring);
PoolThreadMgr::get().wait();
print_status(hw_inter);
hw_inter.stopAcq();
print_status(hw_inter);
DebParams::enableTypeFlags (DebParams::AllFlags);
DebParams::enableFormatFlags(DebParams::AllFlags);
DebParams::enableModuleFlags(DebParams::AllFlags);
......
......@@ -66,9 +66,6 @@ class BufferCtrlObj : public HwBufferCtrlObj
virtual void setNbConcatFrames(int nb_concat_frames);
virtual void getNbConcatFrames(int& nb_concat_frames);
virtual void setNbAccFrames(int nb_acc_frames);
virtual void getNbAccFrames(int& nb_acc_frames);
virtual void getMaxNbBuffers(int& max_nb_buffers);
virtual void *getBufferPtr(int buffer_nb, int concat_frame_nb = 0);
......
......@@ -51,9 +51,6 @@ class BufferCtrlObj : HwBufferCtrlObj
virtual void setNbConcatFrames(int nb_concat_frames);
virtual void getNbConcatFrames(int& nb_concat_frames /Out/);
virtual void setNbAccFrames(int nb_acc_frames);
virtual void getNbAccFrames(int& nb_acc_frames /Out/);
virtual void getMaxNbBuffers(int& max_nb_buffers /Out/);
virtual void *getBufferPtr(int buffer_nb, int concat_frame_nb = 0);
......
......@@ -127,18 +127,6 @@ void BufferCtrlObj::getNbConcatFrames(int& nb_concat_frames)
m_buffer_mgr.getNbConcatFrames(nb_concat_frames);
}
void BufferCtrlObj::setNbAccFrames(int nb_acc_frames)
{
DEB_MEMBER_FUNCT();
m_buffer_mgr.setNbAccFrames(nb_acc_frames);
}
void BufferCtrlObj::getNbAccFrames(int& nb_acc_frames)
{
DEB_MEMBER_FUNCT();
m_buffer_mgr.getNbAccFrames(nb_acc_frames);
}
void BufferCtrlObj::getMaxNbBuffers(int& max_nb_buffers)
{
DEB_MEMBER_FUNCT();
......
......@@ -68,9 +68,6 @@ class SimuBufferCtrlObj : public HwBufferCtrlObj
virtual void setNbConcatFrames(int nb_concat_frames);
virtual void getNbConcatFrames(int& nb_concat_frames);
virtual void setNbAccFrames(int nb_acc_frames);
virtual void getNbAccFrames(int& nb_acc_frames);
virtual void getMaxNbBuffers(int& max_nb_buffers);
virtual void *getBufferPtr(int buffer_nb, int concat_frame_nb = 0);
......
......@@ -46,9 +46,6 @@ class SimuBufferCtrlObj : HwBufferCtrlObj
virtual void setNbConcatFrames(int nb_concat_frames);
virtual void getNbConcatFrames(int& nb_concat_frames /Out/);
virtual void setNbAccFrames(int nb_acc_frames);
virtual void getNbAccFrames(int& nb_acc_frames /Out/);
virtual void getMaxNbBuffers(int& max_nb_buffers /Out/);
virtual void *getBufferPtr(int buffer_nb, int concat_frame_nb = 0);
......
......@@ -126,16 +126,6 @@ void SimuBufferCtrlObj::getNbConcatFrames(int& nb_concat_frames)
m_buffer_mgr.getNbConcatFrames(nb_concat_frames);
}
void SimuBufferCtrlObj::setNbAccFrames(int nb_acc_frames)
{
m_buffer_mgr.setNbAccFrames(nb_acc_frames);
}
void SimuBufferCtrlObj::getNbAccFrames(int& nb_acc_frames)
{
m_buffer_mgr.getNbAccFrames(nb_acc_frames);
}
void SimuBufferCtrlObj::getMaxNbBuffers(int& max_nb_buffers)
{
m_buffer_mgr.getMaxNbBuffers(max_nb_buffers);
......
......@@ -117,19 +117,6 @@ void test_simu_hw_interface()
print_status(simu_hw);
simu_hw.stopAcq();
print_status(simu_hw);
cout << "Trying accumulation now..." << endl;
hw_buffer->setNbAccFrames(5);
hw_buffer->setNbBuffers(10);
hw_sync->setNbFrames(3);
print_status(simu_hw);
simu_hw.startAcq();
print_status(simu_hw);
simu_hw.stopAcq();
print_status(simu_hw);
}
int main(int argc, char *argv[])
......
#ifndef CTACCCONCAT_H
#define CTACCCONCAT_H
#ifndef CTACCUMULATION_H
#define CTACCUMULATION_H
#include <list>
#include <deque>
#include "CtControl.h"
namespace lima
{
class CtAccConcat
class CtAccumulation
{
DEB_CLASS_NAMESPC(DebModControl,"AccConcat","Control");
DEB_CLASS_NAMESPC(DebModControl,"Accumulation","Control");
public:
friend class CtControl;
friend class CtBuffer;
friend class CtBufferFrameCB;
typedef std::list<std::list<long long> > saturatedCounterResult;
struct Parameters
{
DEB_CLASS_NAMESPC(DebModControl,"AccConcat::Parameters","Control");
DEB_CLASS_NAMESPC(DebModControl,"Accumulation::Parameters","Control");
public:
Parameters();
void reset();
......@@ -17,8 +28,8 @@ namespace lima
bool active; ///< if true do the calculation
long long pixelThresholdValue; ///< value which determine the threshold of the calculation
int saturatedImageCounterBufferSize; ///< default 64
unsigned int buffers_size; ///< total nb buffer for acquisition
bool savingFlag; ///< saving flag if true save saturatedImageCounter
std::string savePrefix; ///< prefix filename of saturatedImageCounter (default is saturated_image_counter)
};
......@@ -28,15 +39,16 @@ namespace lima
DEB_CLASS_NAMESPC(DebModControl,"AccConcat::ThresholdCallback",
"Control");
public:
ThresholdCallback();
virtual ~ThresholdCallback();
ThresholdCallback() {};
virtual ~ThresholdCallback() {};
long long m_max;
protected:
virtual void aboveMax(Data&,long long value) = 0;
long long m_max;
};
CtAccConcat();
~CtAccConcat();
CtAccumulation(CtControl&);
~CtAccumulation();
// --- accumulation adn concatenation parameters
......@@ -46,13 +58,13 @@ namespace lima
void setActive(bool activeFlag);
void getActive(bool &activeFlag);
void setPixelThresholdValue(const int &pixelThresholdValue);
void setPixelThresholdValue(int pixelThresholdValue);
void getPixelThresholdValue(int &pixelThresholdValue) const;
void setSaturatedImageCounterBufferSize(const int &saturatedImageCounterBufferSize);
void getSaturatedImageCounterBufferSize(int &saturatedImageCounterBufferSize) const;
void setBufferSize(int aBufferSize);
void getBufferSize(int &aBufferSize) const;
void setSavingFlag(const bool &savingFlag);
void setSavingFlag(bool savingFlag);
void getSavingFlag(bool &savingFlag) const;
void setSavePrefix(const std::string &savePrefix);
......@@ -60,18 +72,31 @@ namespace lima
// --- variable and data result of Concatenation or Accumulation
void readSaturatedImageCounter(Data&,long frameNumber = -1) const;
void readSaturatedSumCounter(int from,std::list<long long> &result) const;
void readSaturatedImageCounter(Data&,long frameNumber = -1);
void readSaturatedSumCounter(int from,saturatedCounterResult &result);
// --- Mask image to calculate sum counter
void setMask(Data&);
// --- Callback to monitor detector saturation
void registerThresholdCallback(ThresholdCallback &cb);
void unregisterThresholdCallback(ThresholdCallback &cb);
private:
Parameters m_pars;
Parameters m_pars;
std::deque<Data> m_datas;
std::deque<Data> m_saturated_images;
CtControl& m_ct;
mutable Mutex m_lock;
// --- Methodes for acquisition
void prepare();
bool newFrameReady(Data&);
void getFrame(Data &,int frameNumber);
void _accFrame(Data &src,Data &dst);
void _calcSaturatedImage(Data &src);
};
}
#endif
......@@ -15,12 +15,14 @@ namespace lima {
class CtBufferFrameCB : public HwFrameCallback
{
DEB_CLASS_NAMESPC(DebModControl,"BufferFrameCB","Control");
friend class CtBuffer;
public:
CtBufferFrameCB(CtControl *ct): m_ct(ct) {}
CtBufferFrameCB(CtControl *ct): m_ct(ct),m_ct_accumulation(NULL) {}
protected:
bool newFrameReady(const HwFrameInfoType& frame_info);
private:
CtControl *m_ct;
CtControl* m_ct;
CtAccumulation* m_ct_accumulation;
};
class CtBuffer
......@@ -65,10 +67,10 @@ namespace lima {
static void getDataFromHwFrameInfo(Data&,const HwFrameInfoType&);
private:
HwBufferCtrlObj *m_hw_buffer;
CtBufferFrameCB *m_frame_cb;
Parameters m_pars;
HwBufferCtrlObj* m_hw_buffer;
CtBufferFrameCB* m_frame_cb;
Parameters m_pars;
CtAccumulation* m_ct_accumulation;
};
inline std::ostream& operator<<(std::ostream &os,
......
......@@ -20,6 +20,7 @@ namespace lima
class CtBufferFrameCB;
class CtSaving;
class CtSpsImage;
class CtAccumulation;
class SoftOpInternalMgr;
class SoftOpExternalMgr;
......@@ -28,6 +29,7 @@ namespace lima
DEB_CLASS_NAMESPC(DebModControl,"Control","Control");
friend class CtBufferFrameCB;
friend class CtAccumulation;
friend class CtSaving; // just to set saving error in stat
public:
......@@ -94,13 +96,14 @@ namespace lima
void startAcq();
void stopAcq();
CtAcquisition* acquisition() { return m_ct_acq; }
CtSaving* saving() { return m_ct_saving; }
CtSpsImage* display() { return m_ct_sps_image; }
CtImage* image() { return m_ct_image; }
CtBuffer* buffer() { return m_ct_buffer; }
CtAcquisition* acquisition() { return m_ct_acq; }
CtSaving* saving() { return m_ct_saving; }
CtSpsImage* display() { return m_ct_sps_image; }
CtImage* image() { return m_ct_image; }
CtBuffer* buffer() { return m_ct_buffer; }
CtAccumulation* accumulation() { return m_ct_accumulation; }
SoftOpExternalMgr* externalOperation() {return m_op_ext;}
SoftOpExternalMgr* externalOperation() {return m_op_ext;}
HwInterface* interface() {return m_hw;}
......@@ -155,6 +158,7 @@ namespace lima
CtAcquisition *m_ct_acq;
CtImage *m_ct_image;
CtBuffer *m_ct_buffer;
CtAccumulation *m_ct_accumulation;
SoftOpInternalMgr *m_op_int;
SoftOpExternalMgr *m_op_ext;
......
#ifndef CTIMAGE_H
#define CTIMAGE_H
#include "CtControl.h"
#include "Constants.h"
#include "HwInterface.h"
#include "HwDetInfoCtrlObj.h"
......@@ -98,7 +99,7 @@ class CtImage {
HardAndSoft,
};
CtImage(HwInterface *hw);
CtImage(HwInterface *hw,CtControl&);
~CtImage();
void getMaxImageSize(Size& size) const;
......@@ -135,14 +136,15 @@ class CtImage {
void _setHSRoi(const Roi &roi);
void _setHSBin(const Bin &bin);
HwDetInfoCtrlObj *m_hw_det;
CtMaxImageSizeCB *m_cb_size;
CtSwBinRoi *m_sw;
CtHwBinRoi *m_hw;
HwDetInfoCtrlObj* m_hw_det;
CtMaxImageSizeCB* m_cb_size;
CtSwBinRoi* m_sw;
CtHwBinRoi* m_hw;
CtControl& m_ct;
Size m_max_size;
ImageType m_img_type;
ImageOpMode m_mode;
Size m_max_size;
ImageType m_img_type;
ImageOpMode m_mode;
};
inline std::ostream& operator<<(std::ostream& os,const CtSwBinRoi &binroi)
......
class CtAccumulation
{
%TypeHeaderCode
#include <CtAccumulation.h>
using namespace lima;
%End
public:
typedef std::list<std::list<long long> > saturatedCounterResult;
struct Parameters
{
Parameters();
void reset();
bool active; ///< if true do the calculation
long long pixelThresholdValue; ///< value which determine the threshold of the calculation
unsigned int buffers_size; ///< total nb buffer for acquisition
bool savingFlag; ///< saving flag if true save saturatedImageCounter
std::string savePrefix; ///< prefix filename of saturatedImageCounter (default is saturated_image_counter)
};
class ThresholdCallback
{
public:
ThresholdCallback();
virtual ~ThresholdCallback();
long long m_max;
protected:
virtual void aboveMax(Data&,long long value) = 0;
};
CtAccumulation(CtControl&);
~CtAccumulation();
// --- accumulation adn concatenation parameters
void setParameters(const Parameters &pars);
void getParameters(Parameters& pars) const;
void setActive(bool activeFlag);
void getActive(bool &activeFlag);
void setPixelThresholdValue(int pixelThresholdValue);
void getPixelThresholdValue(int &pixelThresholdValue) const;
void setBufferSize(int aBufferSize);
void getBufferSize(int &aBufferSize) const;
void setSavingFlag(bool savingFlag);
void getSavingFlag(bool &savingFlag) const;
void setSavePrefix(const std::string &savePrefix);
void getSavePrefix(std::string &savePrefix) const;
// --- variable and data result of Concatenation or Accumulation
// void readSaturatedImageCounter(Data&,long frameNumber = -1);
// void readSaturatedSumCounter(int from,saturatedCounterResult &result);
// --- Mask image to calculate sum counter
void setMask(Data&);
// --- Callback to monitor detector saturation
void registerThresholdCallback(ThresholdCallback &cb);
void unregisterThresholdCallback(ThresholdCallback &cb);
};
......@@ -76,6 +76,7 @@ using namespace lima;
CtSpsImage* display();
CtImage* image();
CtBuffer* buffer();
CtAccumulation* accumulation();
SoftOpExternalMgr* externalOperation();
......
......@@ -71,7 +71,7 @@ using namespace lima;
// Size, Type, Bin, XY from common
CtImage(HwInterface *hw);
CtImage(HwInterface *hw,CtControl&);
~CtImage();
void getMaxImageSize(Size& size /Out/) const;
......
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