mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-01-16 07:38:04 +01:00
ctb receiver fix: extract in 8 bit batches instead of 32 for less padding
This commit is contained in:
@@ -515,18 +515,18 @@ void DataProcessor::RearrangeDbitData(char* buf) {
|
|||||||
const int numSamples = (ctbDigitalDataBytes / sizeof(uint64_t));
|
const int numSamples = (ctbDigitalDataBytes / sizeof(uint64_t));
|
||||||
const int digOffset = FIFO_HEADER_NUMBYTES + sizeof(sls_receiver_header) + (*ctbAnalogDataBytes);
|
const int digOffset = FIFO_HEADER_NUMBYTES + sizeof(sls_receiver_header) + (*ctbAnalogDataBytes);
|
||||||
|
|
||||||
// ceil as numResult32Bits could be decimal
|
// ceil as numResult8Bits could be decimal
|
||||||
const int numResult32Bits = ceil((double)(numSamples * (*ctbDbitList).size()) / 32.00);
|
const int numResult8Bits = ceil((double)(numSamples * (*ctbDbitList).size()) / 8.00);
|
||||||
uint32_t result[numResult32Bits];
|
uint8_t result[numResult8Bits];
|
||||||
memset(result, 0, numResult32Bits * sizeof(uint32_t));
|
memset(result, 0, numResult8Bits * sizeof(uint8_t));
|
||||||
|
uint8_t* dest = result;
|
||||||
|
|
||||||
uint32_t* dest = result;
|
|
||||||
auto* source = (uint64_t*)(buf + digOffset + (*ctbDbitOffset));
|
auto* source = (uint64_t*)(buf + digOffset + (*ctbDbitOffset));
|
||||||
|
|
||||||
// loop through digital bit enable vector
|
// loop through digital bit enable vector
|
||||||
int bitoffset = 0;
|
int bitoffset = 0;
|
||||||
for (auto bi : (*ctbDbitList)) {
|
for (auto bi : (*ctbDbitList)) {
|
||||||
// where numbits * numsamples is not a multiple of 32
|
// where numbits * numsamples is not a multiple of 8
|
||||||
if (bitoffset != 0) {
|
if (bitoffset != 0) {
|
||||||
bitoffset = 0;
|
bitoffset = 0;
|
||||||
++dest;
|
++dest;
|
||||||
@@ -534,12 +534,12 @@ void DataProcessor::RearrangeDbitData(char* buf) {
|
|||||||
|
|
||||||
// loop through the frame digital data
|
// loop through the frame digital data
|
||||||
for (auto ptr = source; ptr < (source + numSamples);) {
|
for (auto ptr = source; ptr < (source + numSamples);) {
|
||||||
// get selected bit from each 32 bit
|
// get selected bit from each 8 bit
|
||||||
uint32_t bit = (*ptr++ >> bi) & 1;
|
uint8_t bit = (*ptr++ >> bi) & 1;
|
||||||
*dest |= bit << bitoffset;
|
*dest |= bit << bitoffset;
|
||||||
++bitoffset;
|
++bitoffset;
|
||||||
// extract destination in 32 bit batches
|
// extract destination in 8 bit batches
|
||||||
if (bitoffset == 32) {
|
if (bitoffset == 8) {
|
||||||
bitoffset = 0;
|
bitoffset = 0;
|
||||||
++dest;
|
++dest;
|
||||||
}
|
}
|
||||||
@@ -548,8 +548,8 @@ void DataProcessor::RearrangeDbitData(char* buf) {
|
|||||||
|
|
||||||
|
|
||||||
// copy back to buf and update size
|
// copy back to buf and update size
|
||||||
memcpy(buf + digOffset, result, numResult32Bits * sizeof(uint32_t));
|
memcpy(buf + digOffset, result, numResult8Bits * sizeof(uint8_t));
|
||||||
(*((uint32_t*)buf)) = numResult32Bits * sizeof(uint32_t);
|
(*((uint32_t*)buf)) = numResult8Bits * sizeof(uint8_t);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** eiger specific */
|
/** eiger specific */
|
||||||
|
|||||||
Reference in New Issue
Block a user