mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-17 07:17:13 +02:00
quad enabled with gap pixels without the extra vertical pixel line
This commit is contained in:
@ -129,7 +129,7 @@ void qDrawPlot::SetupWidgetWindow(){
|
||||
break;
|
||||
case slsDetectorDefs::EIGER:
|
||||
if (myDet->setQuad()) {
|
||||
nPixelsX = myDet->getTotalNumberOfChannelsInclGapPixels(slsDetectorDefs::X) / 2;
|
||||
nPixelsX = (myDet->getTotalNumberOfChannelsInclGapPixels(slsDetectorDefs::X) / 2) - 1;
|
||||
nPixelsY = myDet->getTotalNumberOfChannelsInclGapPixels(slsDetectorDefs::Y) * 2;
|
||||
}
|
||||
break;
|
||||
@ -603,7 +603,7 @@ void qDrawPlot::SetScanArgument(int scanArg){
|
||||
break;
|
||||
case slsDetectorDefs::EIGER:
|
||||
if (myDet->setQuad()) {
|
||||
nPixelsX = myDet->getTotalNumberOfChannelsInclGapPixels(slsDetectorDefs::X) / 2;
|
||||
nPixelsX = (myDet->getTotalNumberOfChannelsInclGapPixels(slsDetectorDefs::X) / 2) - 1;
|
||||
nPixelsY = myDet->getTotalNumberOfChannelsInclGapPixels(slsDetectorDefs::Y) * 2;
|
||||
}
|
||||
break;
|
||||
|
@ -38,6 +38,7 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject {
|
||||
* @param act pointer to activated
|
||||
* @param depaden pointer to deactivated padding enable
|
||||
* @param sm pointer to silent mode
|
||||
* @param qe pointer to quad Enable
|
||||
* @param dataReadycb pointer to data ready call back function
|
||||
* @param dataModifyReadycb pointer to data ready call back function with modified
|
||||
* @param pDataReadycb pointer to arguments of data ready call back function. To write/stream a smaller size of processed data, change this value (only smaller value is allowed).
|
||||
@ -45,7 +46,7 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject {
|
||||
DataProcessor(int ind, detectorType dtype, Fifo*& f, fileFormat* ftype,
|
||||
bool fwenable, bool* dsEnable, bool* gpEnable, uint32_t* dr,
|
||||
uint32_t* freq, uint32_t* timer,
|
||||
bool* fp, bool* act, bool* depaden, bool* sm,
|
||||
bool* fp, bool* act, bool* depaden, bool* sm, bool* qe,
|
||||
void (*dataReadycb)(char*, char*, uint32_t, void*),
|
||||
void (*dataModifyReadycb)(char*, char*, uint32_t &, void*),
|
||||
void *pDataReadycb);
|
||||
@ -341,6 +342,9 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject {
|
||||
/** Silent Mode */
|
||||
bool* silentMode;
|
||||
|
||||
/** quad enable */
|
||||
bool* quadEnable;
|
||||
|
||||
/** frame padding */
|
||||
bool* framePadding;
|
||||
|
||||
|
@ -190,8 +190,10 @@ public:
|
||||
/**
|
||||
* Enable Gap Pixels changes member variables
|
||||
* @param enable true if gap pixels enable, else false
|
||||
* @param dr dynamic range
|
||||
* @param q quad enable
|
||||
*/
|
||||
virtual void SetGapPixelsEnable(bool b, int dr) {
|
||||
virtual void SetGapPixelsEnable(bool b, int dr, bool q) {
|
||||
cprintf(RED,"This is a generic function that should be overloaded by a derived class\n");
|
||||
};
|
||||
|
||||
@ -646,13 +648,17 @@ class EigerData : public GeneralData {
|
||||
* Enable Gap Pixels changes member variables
|
||||
* @param enable true if gap pixels enable, else false
|
||||
* @param dr dynamic range
|
||||
* @param q quad enable
|
||||
*/
|
||||
void SetGapPixelsEnable(bool b, int dr) {
|
||||
void SetGapPixelsEnable(bool b, int dr, bool q) {
|
||||
if (dr == 4)
|
||||
b = 0;
|
||||
switch((int)b) {
|
||||
case 1:
|
||||
nPixelsX = (256 * 2) + 3;
|
||||
if (q) {
|
||||
--nPixelsX; // if quad, remove last line
|
||||
}
|
||||
nPixelsY = 256 + 1;
|
||||
imageSize = nPixelsX * nPixelsY * ((dr > 16) ? 4 : // 32 bit
|
||||
((dr > 8) ? 2 : // 16 bit
|
||||
|
@ -362,8 +362,9 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
||||
/**
|
||||
* Set Quad type Enable (eiger and hardware specific)
|
||||
* @param true if quad enabled, else false
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
void setQuad(const bool b);
|
||||
int setQuad(const bool b);
|
||||
|
||||
|
||||
//***file parameters***
|
||||
|
@ -453,8 +453,9 @@ class UDPInterface {
|
||||
/**
|
||||
* Set Quad type Enable (eiger and hardware specific)
|
||||
* @param true if quad enabled, else false
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
virtual void setQuad(const bool b) = 0;
|
||||
virtual int setQuad(const bool b) = 0;
|
||||
|
||||
|
||||
//***file parameters***
|
||||
|
@ -75,8 +75,9 @@ class UDPStandardImplementation: private virtual slsReceiverDefs, public UDPBase
|
||||
/**
|
||||
* Set Quad type Enable (eiger and hardware specific)
|
||||
* @param true if quad enabled, else false
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
void setQuad(const bool b);
|
||||
int setQuad(const bool b);
|
||||
|
||||
/**
|
||||
* Set File Format
|
||||
|
@ -26,7 +26,7 @@ DataProcessor::DataProcessor(int ind, detectorType dtype, Fifo*& f,
|
||||
fileFormat* ftype, bool fwenable,
|
||||
bool* dsEnable, bool* gpEnable, uint32_t* dr,
|
||||
uint32_t* freq, uint32_t* timer,
|
||||
bool* fp, bool* act, bool* depaden, bool* sm,
|
||||
bool* fp, bool* act, bool* depaden, bool* sm, bool* qe,
|
||||
void (*dataReadycb)(char*, char*, uint32_t, void*),
|
||||
void (*dataModifyReadycb)(char*, char*, uint32_t &, void*),
|
||||
void *pDataReadycb) :
|
||||
@ -49,6 +49,7 @@ DataProcessor::DataProcessor(int ind, detectorType dtype, Fifo*& f,
|
||||
activated(act),
|
||||
deactivatedPaddingEnable(depaden),
|
||||
silentMode(sm),
|
||||
quadEnable(qe),
|
||||
framePadding(fp),
|
||||
acquisitionStartedFlag(false),
|
||||
measurementStartedFlag(false),
|
||||
@ -511,31 +512,34 @@ void DataProcessor::InsertGapPixels(char* buf, uint32_t dr) {
|
||||
|
||||
memset(tempBuffer, 0xFF, generalData->imageSize);
|
||||
|
||||
int rightChip = ((*quadEnable) ? 0 : index); // quad enable, then faking both to be left chips
|
||||
const uint32_t nx = generalData->nPixelsX;
|
||||
const uint32_t ny = generalData->nPixelsY;
|
||||
const uint32_t npx = nx * ny;
|
||||
|
||||
bool group3 = (*quadEnable) ? false : true; // if quad enabled, no last line for left chips
|
||||
char* srcptr = 0;
|
||||
char* dstptr = 0;
|
||||
|
||||
const uint32_t b1px = generalData->imageSize / (npx); // not double as not dealing with 4 bit mode
|
||||
const uint32_t b2px = 2 * b1px;
|
||||
const uint32_t b1pxofst = (index ? b1px : 0); // left fpga (index 0) has no extra 1px offset, but right fpga has
|
||||
const uint32_t b1pxofst = (rightChip ? b1px : 0); // left fpga (chipIndex 0) has no extra 1px offset, but right fpga has
|
||||
const uint32_t b1chip = 256 * b1px;
|
||||
const uint32_t b1line = (nx * b1px);
|
||||
const uint32_t bgroup3chip = b1chip + (group3 ? b1px : 0);
|
||||
|
||||
// copying line by line
|
||||
srcptr = buf;
|
||||
dstptr = tempBuffer + b1line + b1pxofst; // left fpga (index 0) has no extra 1px offset, but right fpga has
|
||||
dstptr = tempBuffer + b1line + b1pxofst; // left fpga (chipIndex 0) has no extra 1px offset, but right fpga has
|
||||
for (uint32_t i = 0; i < (ny-1); ++i) {
|
||||
memcpy(dstptr, srcptr, b1chip);
|
||||
srcptr += b1chip;
|
||||
dstptr += (b1chip + b2px);
|
||||
memcpy(dstptr, srcptr, b1chip);
|
||||
srcptr += b1chip;
|
||||
dstptr += (b1chip + b1px);
|
||||
dstptr += bgroup3chip;
|
||||
}
|
||||
|
||||
|
||||
// vertical filling of values
|
||||
{
|
||||
char* srcgp1 = 0; char* srcgp2 = 0; char* srcgp3 = 0;
|
||||
@ -550,28 +554,36 @@ void DataProcessor::InsertGapPixels(char* buf, uint32_t dr) {
|
||||
dstgp1 = srcgp1 + b1px;
|
||||
srcgp2 = srcgp1 + b3px;
|
||||
dstgp2 = dstgp1 + b1px;
|
||||
if (!index) {
|
||||
if (group3) {
|
||||
if (!rightChip) {
|
||||
srcgp3 = srcptr + b1line - b2px;
|
||||
dstgp3 = srcgp3 + b1px;
|
||||
} else {
|
||||
srcgp3 = srcptr + b1px;
|
||||
dstgp3 = srcptr;
|
||||
}
|
||||
}
|
||||
switch (dr) {
|
||||
case 8:
|
||||
(*((uint8_t*)srcgp1)) = (*((uint8_t*)srcgp1))/2; (*((uint8_t*)dstgp1)) = (*((uint8_t*)srcgp1));
|
||||
(*((uint8_t*)srcgp2)) = (*((uint8_t*)srcgp2))/2; (*((uint8_t*)dstgp2)) = (*((uint8_t*)srcgp2));
|
||||
if (group3) {
|
||||
(*((uint8_t*)srcgp3)) = (*((uint8_t*)srcgp3))/2; (*((uint8_t*)dstgp3)) = (*((uint8_t*)srcgp3));
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
(*((uint16_t*)srcgp1)) = (*((uint16_t*)srcgp1))/2; (*((uint16_t*)dstgp1)) = (*((uint16_t*)srcgp1));
|
||||
(*((uint16_t*)srcgp2)) = (*((uint16_t*)srcgp2))/2; (*((uint16_t*)dstgp2)) = (*((uint16_t*)srcgp2));
|
||||
if (group3) {
|
||||
(*((uint16_t*)srcgp3)) = (*((uint16_t*)srcgp3))/2; (*((uint16_t*)dstgp3)) = (*((uint16_t*)srcgp3));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
(*((uint32_t*)srcgp1)) = (*((uint32_t*)srcgp1))/2; (*((uint32_t*)dstgp1)) = (*((uint32_t*)srcgp1));
|
||||
(*((uint32_t*)srcgp2)) = (*((uint32_t*)srcgp2))/2; (*((uint32_t*)dstgp2)) = (*((uint32_t*)srcgp2));
|
||||
if (group3) {
|
||||
(*((uint32_t*)srcgp3)) = (*((uint32_t*)srcgp3))/2; (*((uint32_t*)dstgp3)) = (*((uint32_t*)srcgp3));
|
||||
}
|
||||
break;
|
||||
}
|
||||
srcptr += b1line;
|
||||
|
@ -248,7 +248,6 @@ void DataStreamer::ProcessAnImage(char* buf) {
|
||||
|
||||
//normal
|
||||
else {
|
||||
|
||||
if (!SendHeader(header, (uint32_t)(*((uint32_t*)buf)),
|
||||
generalData->nPixelsX, generalData->nPixelsY, false)) // new size possibly from callback
|
||||
cprintf(RED,"Error: Could not send zmq header for fnum %lld and streamer %d\n",
|
||||
|
@ -426,12 +426,13 @@ int UDPBaseImplementation::setGapPixelsEnable(const bool b) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
void UDPBaseImplementation::setQuad(const bool b) {
|
||||
int UDPBaseImplementation::setQuad(const bool b) {
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
quadEnable = b;
|
||||
FILE_LOG(logINFO) << "Quad Enable: " << quadEnable;
|
||||
|
||||
// overridden
|
||||
return OK;
|
||||
}
|
||||
|
||||
/***file parameters***/
|
||||
|
@ -164,7 +164,7 @@ int UDPStandardImplementation::setGapPixelsEnable(const bool b) {
|
||||
gapPixelsEnable = b;
|
||||
|
||||
// side effects
|
||||
generalData->SetGapPixelsEnable(b, dynamicRange);
|
||||
generalData->SetGapPixelsEnable(b, dynamicRange, quadEnable);
|
||||
// to update npixelsx, npixelsy in file writer
|
||||
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
(*it)->SetPixelDimension();
|
||||
@ -177,10 +177,18 @@ int UDPStandardImplementation::setGapPixelsEnable(const bool b) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
void UDPStandardImplementation::setQuad(const bool b) {
|
||||
int UDPStandardImplementation::setQuad(const bool b) {
|
||||
if (quadEnable != b) {
|
||||
quadEnable = b;
|
||||
|
||||
generalData->SetGapPixelsEnable(gapPixelsEnable, dynamicRange, b);
|
||||
// to update npixelsx, npixelsy in file writer
|
||||
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
(*it)->SetPixelDimension();
|
||||
numberofJobs = -1; //changes to imagesize has to be noted to recreate fifo structure
|
||||
if (SetupFifoStructure() == FAIL)
|
||||
return FAIL;
|
||||
|
||||
if (!quadEnable) {
|
||||
for (std::vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it){
|
||||
(*it)->SetNumberofDetectors(numDet);
|
||||
@ -198,6 +206,7 @@ void UDPStandardImplementation::setQuad(const bool b) {
|
||||
}
|
||||
}
|
||||
FILE_LOG(logINFO) << "Quad Enable: " << quadEnable;
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
@ -372,7 +381,7 @@ int UDPStandardImplementation::setDynamicRange(const uint32_t i) {
|
||||
|
||||
//side effects
|
||||
generalData->SetDynamicRange(i,tengigaEnable);
|
||||
generalData->SetGapPixelsEnable(gapPixelsEnable, dynamicRange);
|
||||
generalData->SetGapPixelsEnable(gapPixelsEnable, dynamicRange, quadEnable);
|
||||
// to update npixelsx, npixelsy in file writer
|
||||
for (std::vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it)
|
||||
(*it)->SetPixelDimension();
|
||||
@ -391,6 +400,7 @@ int UDPStandardImplementation::setTenGigaEnable(const bool b) {
|
||||
tengigaEnable = b;
|
||||
//side effects
|
||||
generalData->SetTenGigaEnable(b,dynamicRange);
|
||||
generalData->SetGapPixelsEnable(gapPixelsEnable, dynamicRange, quadEnable);
|
||||
|
||||
numberofJobs = -1; //changes to imagesize has to be noted to recreate fifo structure
|
||||
if (SetupFifoStructure() == FAIL)
|
||||
@ -473,7 +483,7 @@ int UDPStandardImplementation::setDetectorType(const detectorType d) {
|
||||
DataProcessor* p = new DataProcessor(i, myDetectorType, fifo[i], &fileFormatType,
|
||||
fileWriteEnable, &dataStreamEnable, &gapPixelsEnable,
|
||||
&dynamicRange, &frameToGuiFrequency, &frameToGuiTimerinMS,
|
||||
&framePadding, &activated, &deactivatedPaddingEnable, &silentMode,
|
||||
&framePadding, &activated, &deactivatedPaddingEnable, &silentMode, &quadEnable,
|
||||
rawDataReadyCallBack, rawDataModifyReadyCallBack, pRawDataReady);
|
||||
dataProcessor.push_back(p);
|
||||
}
|
||||
|
@ -3008,7 +3008,11 @@ int slsReceiverTCPIPInterface::set_quad_type() {
|
||||
else if (receiverBase->getStatus() != IDLE)
|
||||
receiverNotIdle();
|
||||
else {
|
||||
receiverBase->setQuad(value); // no check required
|
||||
ret = receiverBase->setQuad(value);
|
||||
if (ret == FAIL) {
|
||||
strcpy(mess, "Could not set Quad due to fifo structure.\n");
|
||||
FILE_LOG(logERROR) << mess;
|
||||
}
|
||||
}
|
||||
}
|
||||
//get
|
||||
|
Reference in New Issue
Block a user