Commit 4f5af7b3 authored by Alejandro Homs Puron's avatar Alejandro Homs Puron
Browse files

* Fixed CtBuffer management in (Stripe)Concatenation acq. mode

* Extended CtBuffer::getFrame and CtControl::Read[Base]Image
  to allow retrieval of concatenated stripe blocks
* Implemented (Stripe)Concatenation acq. mode in Frelon[Taco]Acq,
  allowing retrieval of a "big buffer" with multiple concatenated frames
* Optimised the Frelon::Model feature retrieving
  by using cache variables and static Firmware const objects
* Implemented Espia::Dev::write/readReg
* Fixed Espia::Acq::bufferAlloc argument sip definition
parent 3effb692
taco @ 6f979112
Subproject commit f7a117170580dc2a7ac38496e8b56e38b18b5307
Subproject commit 6f97911233dbaeef6c5da730cd3f4531722f43a5
espia @ 740c019a
Subproject commit b980ea2317a7311e96313e46c5bd1be3c609b430
Subproject commit 740c019ab4d439ec0ef0d69be5a64c7c1bb464b5
frelon @ 2d3b8e5d
Subproject commit a7098b15eb3a7c5a95f75798c1fc9661f2f926f3
Subproject commit 2d3b8e5da1f5700e115cec85b99daa9a09d0839b
......@@ -80,12 +80,13 @@ namespace lima {
void registerFrameCallback(CtControl *ct);
void unregisterFrameCallback();
void getFrame(Data&,int frameNumber);
void getFrame(Data&,int frameNumber,int readBlockLen=1);
void reset();
void setup(CtControl *ct);
static void getDataFromHwFrameInfo(Data&,const HwFrameInfoType&);
static void getDataFromHwFrameInfo(Data&,const HwFrameInfoType&,
int readBlockLen=1);
private:
HwBufferCtrlObj* m_hw_buffer;
......
......@@ -142,8 +142,8 @@ namespace lima
void getStatus(Status& status) const; // from HW
void getImageStatus(ImageStatus& status) const;
void ReadImage(Data&,long frameNumber = -1);
void ReadBaseImage(Data&,long frameNumber = -1);
void ReadImage(Data&,long frameNumber = -1, long readBlockLen = 1);
void ReadBaseImage(Data&,long frameNumber = -1, long readBlockLen = 1);
void reset();
void resetStatus(bool only_acq_status);
......
......@@ -55,10 +55,11 @@ using namespace lima;
void registerFrameCallback(CtControl *ct);
void unregisterFrameCallback();
void getFrame(Data &data /Out/,int frameNumber);
void getFrame(Data &data /Out/,int frameNumber,int readBlockLen=1);
void reset();
void setup(CtControl *ct);
static void getDataFromHwFrameInfo(Data&,const HwFrameInfoType&);
static void getDataFromHwFrameInfo(Data& /Out/,const HwFrameInfoType&,
int readBlockLen=1);
};
......@@ -112,8 +112,10 @@ using namespace lima;
void getStatus(Status& status /Out/) const;
void getImageStatus(ImageStatus &imageStatus /Out/) const;
void ReadImage(Data& data /Out/,long frameNumber = -1);
void ReadBaseImage(Data& data /Out/,long frameNumber = -1);
void ReadImage(Data& data /Out/,long frameNumber = -1,
long readBlockLen = 1);
void ReadBaseImage(Data& data /Out/,long frameNumber = -1,
long readBlockLen = 1);
void reset();
void resetStatus(bool only_acq_status);
......
......@@ -146,10 +146,21 @@ void CtBuffer::getMaxMemory(short& max_memory) const
DEB_RETURN() << DEB_VAR1(max_memory);
}
void CtBuffer::getFrame(Data &aReturnData,int frameNumber)
void CtBuffer::getFrame(Data &aReturnData,int frameNumber,int readBlockLen)
{
DEB_MEMBER_FUNCT();
DEB_PARAM() << DEB_VAR1(frameNumber);
DEB_PARAM() << DEB_VAR2(frameNumber, readBlockLen);
int concat_frames;
m_hw_buffer->getNbConcatFrames(concat_frames);
if (readBlockLen != 1) {
if (concat_frames == 1)
throw LIMA_CTL_EXC(InvalidValue, "Cannot read block of frames "
"if not in Concatenation mode");
else if (frameNumber % concat_frames + readBlockLen > concat_frames)
throw LIMA_CTL_EXC(InvalidValue, "Reading block of frames cannot cross "
"boundaries given by specified nb_concat_frames");
}
if(m_ct_accumulation)
m_ct_accumulation->getFrame(aReturnData,frameNumber);
......@@ -157,7 +168,7 @@ void CtBuffer::getFrame(Data &aReturnData,int frameNumber)
{
HwFrameInfo info;
m_hw_buffer->getFrameInfo(frameNumber,info);
getDataFromHwFrameInfo(aReturnData,info);
getDataFromHwFrameInfo(aReturnData,info,readBlockLen);
}
DEB_RETURN() << DEB_VAR1(aReturnData);
}
......@@ -202,6 +213,8 @@ void CtBuffer::setup(CtControl *ct)
break;
case Concatenation:
acq->getConcatNbFrames(concat_nframes);
hwNbBuffer = (acq_nframes + concat_nframes - 1) / concat_nframes;
nbuffers = hwNbBuffer;
break;
}
m_hw_buffer->setFrameDim(fdim);
......@@ -221,10 +234,11 @@ void CtBuffer::setup(CtControl *ct)
}
void CtBuffer::getDataFromHwFrameInfo(Data &fdata,
const HwFrameInfoType& frame_info)
const HwFrameInfoType& frame_info,
int readBlockLen)
{
DEB_STATIC_FUNCT();
DEB_PARAM() << DEB_VAR1(frame_info);
DEB_PARAM() << DEB_VAR2(frame_info, readBlockLen);
ImageType ftype;
Size fsize;
......@@ -252,7 +266,7 @@ void CtBuffer::getDataFromHwFrameInfo(Data &fdata,
fsize= frame_info.frame_dim.getSize();
fdata.width= fsize.getWidth();
fdata.height= fsize.getHeight();
fdata.height= fsize.getHeight() * readBlockLen;
fdata.frameNumber= frame_info.acq_frame_nb;
fdata.timestamp = frame_info.frame_timestamp;
......
......@@ -364,13 +364,19 @@ void CtControl::getImageStatus(ImageStatus& status) const
DEB_RETURN() << DEB_VAR1(status);
}
void CtControl::ReadImage(Data &aReturnData,long frameNumber)
void CtControl::ReadImage(Data &aReturnData,long frameNumber,
long readBlockLen)
{
DEB_MEMBER_FUNCT();
DEB_PARAM() << DEB_VAR1(frameNumber);
DEB_PARAM() << DEB_VAR2(frameNumber, readBlockLen);
AutoMutex aLock(m_cond.mutex());
if(m_op_ext_link_task_active)
{
if (readBlockLen != 1)
throw LIMA_CTL_EXC(NotSupported, "Cannot read more than one frame "
"at a time with External Operations");
std::map<int,Data>::iterator i = m_images_buffer.find(frameNumber);
if(i != m_images_buffer.end())
aReturnData = i->second;
......@@ -385,30 +391,34 @@ void CtControl::ReadImage(Data &aReturnData,long frameNumber)
else
{
aLock.unlock();
ReadBaseImage(aReturnData,frameNumber); // todo change when external op activated
ReadBaseImage(aReturnData,frameNumber,readBlockLen); // todo change when external op activated
}
DEB_RETURN() << DEB_VAR1(aReturnData);
}
void CtControl::ReadBaseImage(Data &aReturnData,long frameNumber)
void CtControl::ReadBaseImage(Data &aReturnData,long frameNumber,
long readBlockLen)
{
DEB_MEMBER_FUNCT();
DEB_PARAM() << DEB_VAR1(frameNumber);
DEB_PARAM() << DEB_VAR2(frameNumber, readBlockLen);
AutoMutex aLock(m_cond.mutex());
ImageStatus &imgStatus = m_status.ImageCounters;
if(frameNumber < 0)
frameNumber = imgStatus.LastBaseImageReady;
else if(frameNumber > imgStatus.LastBaseImageReady)
throw LIMA_CTL_EXC(Error, "Frame not available yet");
long lastFrame = imgStatus.LastBaseImageReady;
if (frameNumber < 0) {
frameNumber = lastFrame - (readBlockLen - 1);
if (frameNumber < 0)
throw LIMA_CTL_EXC(Error, "Frame(s) not available yet");
} else if (frameNumber + readBlockLen - 1 > lastFrame)
throw LIMA_CTL_EXC(Error, "Frame(s) not available yet");
aLock.unlock();
m_ct_buffer->getFrame(aReturnData,frameNumber);
m_ct_buffer->getFrame(aReturnData,frameNumber,readBlockLen);
FrameDim img_dim;
m_ct_image->getImageDim(img_dim);
int roiWidth = img_dim.getSize().getWidth();
int roiHeight = img_dim.getSize().getHeight();
int roiHeight = img_dim.getSize().getHeight() * readBlockLen;
if((roiWidth * roiHeight) >
(aReturnData.width * aReturnData.height))
throw LIMA_CTL_EXC(Error, "Roi dim > HwBuffer dim");
......
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