Revert "JFConversionFixedPoint: More SIMD improvement (but Intel only!)"

This reverts commit b51c8b91d2.
This commit is contained in:
2023-06-09 18:17:14 +02:00
parent b51c8b91d2
commit 5b11a6f842
+38 -30
View File
@@ -51,9 +51,7 @@ void JFConversionFixedPoint::Setup(const JFModuleGainCalibration &gain_calibrati
inline int32_t jf_round(int32_t in) {
const int32_t half = (1L << (FIXED_PRECISION-1));
if (in > INT16_MAX * (1L << FIXED_PRECISION))
return INT16_MAX * (1L << FIXED_PRECISION);
else if (in > 0)
if (in > 0)
return in + half;
else
return in - half;
@@ -67,34 +65,44 @@ void JFConversionFixedPoint::ConvertModule(int16_t *dest, const uint16_t *source
auto pedestal_g1_aligned = std::assume_aligned<64>(pedestal_g1);
auto pedestal_g2_aligned = std::assume_aligned<64>(pedestal_g2);
for (int line = 0; line < RAW_MODULE_LINES; line++) {
for (int col = 0; col < RAW_MODULE_COLS; col++) {
int i = col + line * RAW_MODULE_COLS;
int32_t adc = source[i] & 0x3fff;
int32_t val = (adc - pedestal_g0_aligned[i]) * gain_g0_aligned[i];
dest[i] = static_cast<int16_t>(jf_round(val) / (1L << FIXED_PRECISION));
}
for (int col = 0; col < RAW_MODULE_COLS; col++) {
int i = col + line * RAW_MODULE_COLS;
uint16_t gainbits = source[i] & 0xc000;
int32_t adc = source[i] & 0x3fff;
int32_t val = (adc - pedestal_g1_aligned[i]) * gain_g1_aligned[i];
if (gainbits == 0x4000)
dest[i] = static_cast<int16_t>(jf_round(val) / (1L << FIXED_PRECISION));
}
for (int col = 0; col < RAW_MODULE_COLS; col++) {
int i = col + line * RAW_MODULE_COLS;
uint16_t gainbits = source[i] & 0xc000;
int32_t adc = source[i] & 0x3fff;
int32_t val = (adc - pedestal_g2_aligned[i]) * gain_g2_aligned[i];
if (gainbits == 0xc000)
dest[i] = static_cast<int16_t>(jf_round(val) / (1L << FIXED_PRECISION));
}
#pragma ivdep
for (int64_t i = 0; i < RAW_MODULE_SIZE; i++) {
int32_t adc = source[i] & 0x3fff;
uint16_t gainbits = source[i] & 0xc000;
int32_t val = (adc - pedestal_g0_aligned[i]) * gain_g0_aligned[i];
int32_t val_g1 = (adc - pedestal_g1_aligned[i]) * gain_g1_aligned[i];
int32_t val_g2 = (adc - pedestal_g2_aligned[i]) * gain_g2_aligned[i];
dest[i] = static_cast<int16_t>(jf_round(val) / (1L << FIXED_PRECISION));
if (gainbits == 0x4000)
dest[i] = static_cast<int16_t>(jf_round(val_g1) / (1L << FIXED_PRECISION));
if (gainbits == 0xc000)
dest[i] = static_cast<int16_t>(jf_round(val_g2) / (1L << FIXED_PRECISION));
if (source[i] == 0x4000)
dest[i] = INT16_MIN;
if (source[i] == 0x8000)
dest[i] = INT16_MIN;
if (source[i] == 0xc000)
dest[i] = INT16_MAX;
if (source[i] == 0xffff)
dest[i] = INT16_MIN;
for (int col = 0; col < RAW_MODULE_COLS; col++) {
int i = col + line * RAW_MODULE_COLS;
if (source[i] == 0xc000)
dest[i] = INT16_MAX;
if (source[i] == 0xffff)
dest[i] = INT16_MIN;
}
}
}