Commit 12a0efa6 authored by Alejandro Homs Puron's avatar Alejandro Homs Puron Committed by Laurent Claustre
Browse files

Add HW RoI support to Frelon16:

* Camera is configured to read full lines
* Both single-dual SPB8 modes are supported
* EspiaSGRoi is disabled in dual-SPB8 mode
parent 75fcbc7f
......@@ -475,13 +475,18 @@ Flip Geometry::getMirror()
{
DEB_MEMBER_FUNCT();
Flip mirror;
if (isFrelon16()) {
mirror.x = false;
mirror.y = (m_model.getSPBConType() == SPBConXY);
} else {
InputChan curr;
getInputChan(curr);
Flip mirror;
mirror.x = isChanActive(curr, Chan12) || isChanActive(curr, Chan34);
mirror.y = isChanActive(curr, Chan13) || isChanActive(curr, Chan24);
if (isFrelon16())
mirror = Flip(false);
mirror.x = (isChanActive(curr, Chan12) ||
isChanActive(curr, Chan34));
mirror.y = (isChanActive(curr, Chan13) ||
isChanActive(curr, Chan24));
}
DEB_RETURN() << DEB_VAR1(mirror);
return mirror;
}
......@@ -532,11 +537,16 @@ void Geometry::xformChanCoords(const Point& point, Point& xform_point,
Flip mirror = getMirror();
Size chan_size = getChanSize();
Flip readout_flip(false);
if (!isFrelon16()) {
InputChan curr;
getInputChan(curr);
bool right = !isChanActive(curr, Chan1) && !isChanActive(curr, Chan3);
bool bottom = !isChanActive(curr, Chan1) && !isChanActive(curr, Chan2);
Flip readout_flip(right, bottom);
bool right = (!isChanActive(curr, Chan1) &&
!isChanActive(curr, Chan3));
bool bottom = (!isChanActive(curr, Chan1) &&
!isChanActive(curr, Chan2));
readout_flip = Flip(right, bottom);
}
DEB_TRACE() << DEB_VAR2(chan_flip, readout_flip);
Flip effect_flip = chan_flip & readout_flip;
......@@ -713,8 +723,21 @@ void Geometry::processSetRoi(const Roi& set_roi, Roi& hw_roi,
DEB_MEMBER_FUNCT();
DEB_PARAM() << DEB_VAR1(set_roi);
Roi aligned_roi = set_roi;
Roi aligned_roi;
if (isFrelon16()) {
// no horizontal roi in Frelon16
Point top_left(0, set_roi.getTopLeft().y);
FrameDim frame_dim;
getFrameDim(frame_dim);
Bin bin;
getBin(bin);
Size size(frame_dim.getSize().getWidth() / bin.getX(),
set_roi.getSize().getHeight());
aligned_roi = Roi(top_left, size);
} else {
aligned_roi = set_roi;
aligned_roi.alignCornersTo(Point(32, 1), Ceil);
}
Flip roi_inside_mirror;
calcChanRoi(aligned_roi, chan_roi, roi_inside_mirror);
Roi image_roi;
......
......@@ -586,7 +586,8 @@ void RoiCtrlObj::checkEspiaRoi(const Roi& set_roi, Roi& hw_roi,
det_frame_size = hw_roi.getSize();
bool sg_roi = (!set_roi.isEmpty() && (hw_roi != set_roi));
bool f16_dual = m_cam.getModel().isFrelon16Dual();
bool sg_roi = (!f16_dual && !set_roi.isEmpty() && (hw_roi != set_roi));
if (sg_roi) {
espia_roi = hw_roi.subRoiAbs2Rel(set_roi);
int width = set_roi.getSize().getWidth();
......@@ -659,12 +660,19 @@ void FlipCtrlObj::setFlip(const Flip& flip)
Espia::SGImgConfig img_config = (flip.y ? Espia::SGImgConcatVertInv2 :
Espia::SGImgConcatVert2);
Size det_size;
Roi roi;
m_cam.getRoi(roi);
if (roi.isActive()) {
det_size = roi.getSize();
} else {
FrameDim det_frame_dim;
m_cam.getFrameDim(det_frame_dim);
Bin bin;
m_cam.getBin(bin);
det_frame_dim /= bin;
m_acq.setSGImgConfig(img_config, det_frame_dim.getSize());
det_size = det_frame_dim.getSize() / bin;
}
m_acq.setSGImgConfig(img_config, det_size);
}
void FlipCtrlObj::getFlip(Flip& flip)
......
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