mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 16:47:31 -05:00
Hydrasdr Tuner Support (#2339)
HydraSDR tuner support * Adds Bias-T option * Update nightly.yml * Fix BoardID * Consolidated calibrations and sample converters and removed logging. --------- Co-authored-by: Benjamin Vernoux <bvernoux@gmail.com> Co-authored-by: denny <dennis.sheirer@gmail.com>
This commit is contained in:
@@ -22,9 +22,6 @@ package io.github.dsheirer.vector.calibrate;
|
||||
import io.github.dsheirer.dsp.am.AmDemodulatorCalibration;
|
||||
import io.github.dsheirer.preference.UserPreferences;
|
||||
import io.github.dsheirer.preference.calibration.VectorCalibrationPreference;
|
||||
import io.github.dsheirer.vector.calibrate.airspy.AirspySampleConverterCalibration;
|
||||
import io.github.dsheirer.vector.calibrate.airspy.AirspyUnpackedCalibration;
|
||||
import io.github.dsheirer.vector.calibrate.airspy.AirspyUnpackedInterleavedCalibration;
|
||||
import io.github.dsheirer.vector.calibrate.demodulator.DifferentialDemodulatorCalibration;
|
||||
import io.github.dsheirer.vector.calibrate.demodulator.FmDemodulatorCalibration;
|
||||
import io.github.dsheirer.vector.calibrate.filter.FirFilterCalibration;
|
||||
@@ -41,6 +38,9 @@ import io.github.dsheirer.vector.calibrate.magnitude.MagnitudeCalibration;
|
||||
import io.github.dsheirer.vector.calibrate.mixer.ComplexMixerCalibration;
|
||||
import io.github.dsheirer.vector.calibrate.oscillator.ComplexOscillatorCalibration;
|
||||
import io.github.dsheirer.vector.calibrate.oscillator.RealOscillatorCalibration;
|
||||
import io.github.dsheirer.vector.calibrate.sample.PackedSampleConverterCalibration;
|
||||
import io.github.dsheirer.vector.calibrate.sample.UnpackedInterleavedSampleConverterCalibration;
|
||||
import io.github.dsheirer.vector.calibrate.sample.UnpackedSampleConverterCalibration;
|
||||
import io.github.dsheirer.vector.calibrate.sync.DMRSoftSyncCalibration;
|
||||
import io.github.dsheirer.vector.calibrate.sync.P25P1SoftSyncCalibration;
|
||||
import io.github.dsheirer.vector.calibrate.window.WindowCalibration;
|
||||
@@ -100,9 +100,9 @@ public class CalibrationManager
|
||||
|
||||
sInstance = new CalibrationManager();
|
||||
|
||||
sInstance.add(new AirspySampleConverterCalibration());
|
||||
sInstance.add(new AirspyUnpackedCalibration());
|
||||
sInstance.add(new AirspyUnpackedInterleavedCalibration());
|
||||
sInstance.add(new PackedSampleConverterCalibration());
|
||||
sInstance.add(new UnpackedSampleConverterCalibration());
|
||||
sInstance.add(new UnpackedInterleavedSampleConverterCalibration());
|
||||
sInstance.add(new AmDemodulatorCalibration());
|
||||
sInstance.add(new ComplexGainCalibration());
|
||||
sInstance.add(new ComplexGainControlCalibration());
|
||||
|
||||
@@ -32,9 +32,6 @@ public enum CalibrationType
|
||||
OSCILLATOR_COMPLEX("Complex Oscillator", 1),
|
||||
GAIN_COMPLEX("Complex Gain", 1),
|
||||
|
||||
AIRSPY_SAMPLE_CONVERTER("Airspy Sample Converter", 1),
|
||||
AIRSPY_UNPACKED_INTERLEAVED_ITERATOR("Airspy Unpacked Interleaved Iterator", 1),
|
||||
AIRSPY_UNPACKED_ITERATOR("Airspy Unpacked Iterator", 1),
|
||||
AM_DEMODULATOR("AM Demodulator", 1),
|
||||
DC_REMOVAL_REAL("Real DC Removal Filter", 1),
|
||||
DMR_SOFT_SYNC_DETECTOR("DMR Soft Sync Detector", 1),
|
||||
@@ -53,6 +50,9 @@ public enum CalibrationType
|
||||
MIXER_COMPLEX("Complex Mixer", 1),
|
||||
OSCILLATOR_REAL("Real Oscillator", 1),
|
||||
P25P1_SOFT_SYNC_DETECTOR("P25 Phase 1 Soft Sync Detector", 1),
|
||||
SAMPLE_PACKED_CONVERTER("Packed Sample Converter", 1),
|
||||
SAMPLE_UNPACKED_INTERLEAVED_ITERATOR("Unpacked Interleaved Sample Iterator", 1),
|
||||
SAMPLE_UNPACKED_ITERATOR("Unpacked Sample Iterator", 1),
|
||||
SQUELCHING_FM_DEMODULATOR("Squelching FM Demodulator", 1),
|
||||
WINDOW("Window", 1);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* *****************************************************************************
|
||||
* Copyright (C) 2014-2022 Dennis Sheirer
|
||||
* Copyright (C) 2014-2025 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -17,19 +17,18 @@
|
||||
* ****************************************************************************
|
||||
*/
|
||||
|
||||
package io.github.dsheirer.vector.calibrate.airspy;
|
||||
package io.github.dsheirer.vector.calibrate.sample;
|
||||
|
||||
import io.github.dsheirer.buffer.airspy.ScalarUnpackedSampleConverter;
|
||||
import io.github.dsheirer.buffer.airspy.VectorUnpackedSampleConverter;
|
||||
import io.github.dsheirer.buffer.sample.ScalarUnpackedSampleConverter;
|
||||
import io.github.dsheirer.buffer.sample.VectorUnpackedSampleConverter;
|
||||
import io.github.dsheirer.vector.calibrate.Calibration;
|
||||
import io.github.dsheirer.vector.calibrate.CalibrationException;
|
||||
import io.github.dsheirer.vector.calibrate.CalibrationType;
|
||||
import io.github.dsheirer.vector.calibrate.Implementation;
|
||||
import java.nio.ByteBuffer;
|
||||
import org.apache.commons.math3.stat.descriptive.moment.Mean;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
public class AirspySampleConverterCalibration extends Calibration
|
||||
public class PackedSampleConverterCalibration extends Calibration
|
||||
{
|
||||
private static final int BUFFER_SIZE = 262144;
|
||||
private static final int ITERATION_DURATION_MS = 1000;
|
||||
@@ -39,9 +38,9 @@ public class AirspySampleConverterCalibration extends Calibration
|
||||
/**
|
||||
* Constructs an instance
|
||||
*/
|
||||
public AirspySampleConverterCalibration()
|
||||
public PackedSampleConverterCalibration()
|
||||
{
|
||||
super(CalibrationType.AIRSPY_SAMPLE_CONVERTER);
|
||||
super(CalibrationType.SAMPLE_PACKED_CONVERTER);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -59,7 +58,7 @@ public class AirspySampleConverterCalibration extends Calibration
|
||||
scalarMean.increment(score);
|
||||
}
|
||||
|
||||
mLog.info("AIRSPY CONVERTER WARMUP - SCALAR: " + DECIMAL_FORMAT.format(scalarMean.getResult()));
|
||||
mLog.info("PACKED SAMPLE CONVERTER WARMUP - SCALAR: " + DECIMAL_FORMAT.format(scalarMean.getResult()));
|
||||
|
||||
for(int vectorTest = 0; vectorTest < WARM_UP_ITERATIONS; vectorTest++)
|
||||
{
|
||||
@@ -67,7 +66,7 @@ public class AirspySampleConverterCalibration extends Calibration
|
||||
vectorMean.increment(score);
|
||||
}
|
||||
|
||||
mLog.info("AIRSPY CONVERTER WARMUP - VECTOR: " + DECIMAL_FORMAT.format(vectorMean.getResult()));
|
||||
mLog.info("PACKED SAMPLE CONVERTER WARMUP - VECTOR: " + DECIMAL_FORMAT.format(vectorMean.getResult()));
|
||||
|
||||
scalarMean.clear();
|
||||
vectorMean.clear();
|
||||
@@ -78,7 +77,7 @@ public class AirspySampleConverterCalibration extends Calibration
|
||||
scalarMean.increment(score);
|
||||
}
|
||||
|
||||
mLog.info("AIRSPY CONVERTER - SCALAR: " + DECIMAL_FORMAT.format(scalarMean.getResult()));
|
||||
mLog.info("PACKED SAMPLE CONVERTER - SCALAR: " + DECIMAL_FORMAT.format(scalarMean.getResult()));
|
||||
|
||||
for(int vectorTest = 0; vectorTest < TEST_ITERATIONS; vectorTest++)
|
||||
{
|
||||
@@ -86,7 +85,7 @@ public class AirspySampleConverterCalibration extends Calibration
|
||||
vectorMean.increment(score);
|
||||
}
|
||||
|
||||
mLog.info("AIRSPY CONVERTER - VECTOR: " + DECIMAL_FORMAT.format(vectorMean.getResult()));
|
||||
mLog.info("PACKED SAMPLE CONVERTER - VECTOR: " + DECIMAL_FORMAT.format(vectorMean.getResult()));
|
||||
|
||||
if(scalarMean.getResult() > vectorMean.getResult())
|
||||
{
|
||||
@@ -97,7 +96,7 @@ public class AirspySampleConverterCalibration extends Calibration
|
||||
setImplementation(Implementation.VECTOR_SIMD_PREFERRED);
|
||||
}
|
||||
|
||||
mLog.info("AIRSPY CONVERTER - SETTING OPTIMAL IMPLEMENTATION TO: " + getImplementation());
|
||||
mLog.info("PACKED SAMPLE CONVERTER - SETTING OPTIMAL IMPLEMENTATION TO: " + getImplementation());
|
||||
}
|
||||
|
||||
private long testScalar(ByteBuffer buffer)
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* *****************************************************************************
|
||||
* Copyright (C) 2014-2022 Dennis Sheirer
|
||||
* Copyright (C) 2014-2025 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -17,14 +17,14 @@
|
||||
* ****************************************************************************
|
||||
*/
|
||||
|
||||
package io.github.dsheirer.vector.calibrate.airspy;
|
||||
package io.github.dsheirer.vector.calibrate.sample;
|
||||
|
||||
import io.github.dsheirer.buffer.airspy.AirspyBufferIterator;
|
||||
import io.github.dsheirer.buffer.airspy.AirspyInterleavedBufferIteratorScalar;
|
||||
import io.github.dsheirer.buffer.airspy.AirspyInterleavedBufferIteratorVector128Bits;
|
||||
import io.github.dsheirer.buffer.airspy.AirspyInterleavedBufferIteratorVector256Bits;
|
||||
import io.github.dsheirer.buffer.airspy.AirspyInterleavedBufferIteratorVector512Bits;
|
||||
import io.github.dsheirer.buffer.airspy.AirspyInterleavedBufferIteratorVector64Bits;
|
||||
import io.github.dsheirer.buffer.sample.SampleBufferIterator;
|
||||
import io.github.dsheirer.buffer.sample.SampleInterleavedBufferIteratorScalar;
|
||||
import io.github.dsheirer.buffer.sample.SampleInterleavedBufferIteratorVector128Bits;
|
||||
import io.github.dsheirer.buffer.sample.SampleInterleavedBufferIteratorVector256Bits;
|
||||
import io.github.dsheirer.buffer.sample.SampleInterleavedBufferIteratorVector512Bits;
|
||||
import io.github.dsheirer.buffer.sample.SampleInterleavedBufferIteratorVector64Bits;
|
||||
import io.github.dsheirer.vector.calibrate.Calibration;
|
||||
import io.github.dsheirer.vector.calibrate.CalibrationException;
|
||||
import io.github.dsheirer.vector.calibrate.CalibrationType;
|
||||
@@ -33,9 +33,9 @@ import jdk.incubator.vector.FloatVector;
|
||||
import org.apache.commons.math3.stat.descriptive.moment.Mean;
|
||||
|
||||
/**
|
||||
* Calculates optimal implementation (SCALAR vs VECTOR) for interleaved airspy native buffers.
|
||||
* Calculates optimal implementation (SCALAR vs VECTOR) for interleaved sample native buffers.
|
||||
*/
|
||||
public class AirspyUnpackedInterleavedCalibration extends Calibration
|
||||
public class UnpackedInterleavedSampleConverterCalibration extends Calibration
|
||||
{
|
||||
private static final int BUFFER_SIZE = 131072;
|
||||
private static final int ITERATION_DURATION_MS = 1000;
|
||||
@@ -45,20 +45,20 @@ public class AirspyUnpackedInterleavedCalibration extends Calibration
|
||||
/**
|
||||
* Constructs an instance
|
||||
*/
|
||||
public AirspyUnpackedInterleavedCalibration()
|
||||
public UnpackedInterleavedSampleConverterCalibration()
|
||||
{
|
||||
super(CalibrationType.AIRSPY_UNPACKED_INTERLEAVED_ITERATOR);
|
||||
super(CalibrationType.SAMPLE_UNPACKED_INTERLEAVED_ITERATOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void calibrate() throws CalibrationException
|
||||
{
|
||||
short[] samples = getShortSamples(BUFFER_SIZE);
|
||||
short[] residualI = getShortSamples(AirspyBufferIterator.I_OVERLAP);
|
||||
short[] residualQ = getShortSamples(AirspyBufferIterator.Q_OVERLAP);
|
||||
short[] residualI = getShortSamples(SampleBufferIterator.I_OVERLAP);
|
||||
short[] residualQ = getShortSamples(SampleBufferIterator.Q_OVERLAP);
|
||||
|
||||
//Warm-Up Phase ....
|
||||
mLog.info("AIRSPY UNPACKED INTERLEAVED - VECTOR SIMD LANES PREFERRED: " + FloatVector.SPECIES_PREFERRED.length());
|
||||
mLog.info("UNPACKED INTERLEAVED SAMPLE CONVERTER - VECTOR SIMD LANES PREFERRED: " + FloatVector.SPECIES_PREFERRED.length());
|
||||
|
||||
Mean scalarMean = new Mean();
|
||||
|
||||
@@ -68,7 +68,7 @@ public class AirspyUnpackedInterleavedCalibration extends Calibration
|
||||
scalarMean.increment(score);
|
||||
}
|
||||
|
||||
mLog.info("AIRSPY UNPACKED INTERLEAVED WARMUP - SCALAR: " + DECIMAL_FORMAT.format(scalarMean.getResult()));
|
||||
mLog.info("UNPACKED INTERLEAVED SAMPLE CONVERTER WARMUP - SCALAR: " + DECIMAL_FORMAT.format(scalarMean.getResult()));
|
||||
|
||||
switch(FloatVector.SPECIES_PREFERRED.length())
|
||||
{
|
||||
@@ -84,7 +84,7 @@ public class AirspyUnpackedInterleavedCalibration extends Calibration
|
||||
vectorMean.increment(score);
|
||||
}
|
||||
|
||||
mLog.info("AIRSPY UNPACKED INTERLEAVED WARMUP - VECTOR 512: " + DECIMAL_FORMAT.format(vectorMean.getResult()));
|
||||
mLog.info("UNPACKED INTERLEAVED SAMPLE CONVERTER WARMUP - VECTOR 512: " + DECIMAL_FORMAT.format(vectorMean.getResult()));
|
||||
}
|
||||
case 8:
|
||||
{
|
||||
@@ -96,7 +96,7 @@ public class AirspyUnpackedInterleavedCalibration extends Calibration
|
||||
vectorMean.increment(score);
|
||||
}
|
||||
|
||||
mLog.info("AIRSPY UNPACKED INTERLEAVED WARMUP - VECTOR 256: " + DECIMAL_FORMAT.format(vectorMean.getResult()));
|
||||
mLog.info("UNPACKED INTERLEAVED SAMPLE CONVERTER WARMUP - VECTOR 256: " + DECIMAL_FORMAT.format(vectorMean.getResult()));
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
@@ -108,7 +108,7 @@ public class AirspyUnpackedInterleavedCalibration extends Calibration
|
||||
vectorMean.increment(score);
|
||||
}
|
||||
|
||||
mLog.info("AIRSPY UNPACKED INTERLEAVED WARMUP - VECTOR 128: " + DECIMAL_FORMAT.format(vectorMean.getResult()));
|
||||
mLog.info("UNPACKED INTERLEAVED SAMPLE CONVERTER WARMUP - VECTOR 128: " + DECIMAL_FORMAT.format(vectorMean.getResult()));
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
@@ -120,7 +120,7 @@ public class AirspyUnpackedInterleavedCalibration extends Calibration
|
||||
vectorMean.increment(score);
|
||||
}
|
||||
|
||||
mLog.info("AIRSPY UNPACKED INTERLEAVED WARMUP - VECTOR 64: " + DECIMAL_FORMAT.format(vectorMean.getResult()));
|
||||
mLog.info("UNPACKED INTERLEAVED SAMPLE CONVERTER WARMUP - VECTOR 64: " + DECIMAL_FORMAT.format(vectorMean.getResult()));
|
||||
}
|
||||
|
||||
//Test Phase ....
|
||||
@@ -134,7 +134,7 @@ public class AirspyUnpackedInterleavedCalibration extends Calibration
|
||||
double bestScore = scalarMean.getResult();
|
||||
setImplementation(Implementation.SCALAR);
|
||||
|
||||
mLog.info("AIRSPY UNPACKED INTERLEAVED - SCALAR: " + DECIMAL_FORMAT.format(scalarMean.getResult()));
|
||||
mLog.info("UNPACKED INTERLEAVED SAMPLE CONVERTER - SCALAR: " + DECIMAL_FORMAT.format(scalarMean.getResult()));
|
||||
|
||||
switch(FloatVector.SPECIES_PREFERRED.length())
|
||||
{
|
||||
@@ -156,7 +156,7 @@ public class AirspyUnpackedInterleavedCalibration extends Calibration
|
||||
setImplementation(Implementation.VECTOR_SIMD_512);
|
||||
}
|
||||
|
||||
mLog.info("AIRSPY UNPACKED INTERLEAVED - VECTOR 512: " + DECIMAL_FORMAT.format(vectorMean.getResult()));
|
||||
mLog.info("UNPACKED INTERLEAVED SAMPLE CONVERTER - VECTOR 512: " + DECIMAL_FORMAT.format(vectorMean.getResult()));
|
||||
}
|
||||
case 8:
|
||||
{
|
||||
@@ -174,7 +174,7 @@ public class AirspyUnpackedInterleavedCalibration extends Calibration
|
||||
setImplementation(Implementation.VECTOR_SIMD_256);
|
||||
}
|
||||
|
||||
mLog.info("AIRSPY UNPACKED INTERLEAVED - VECTOR 256: " + DECIMAL_FORMAT.format(vectorMean.getResult()));
|
||||
mLog.info("UNPACKED INTERLEAVED SAMPLE CONVERTER - VECTOR 256: " + DECIMAL_FORMAT.format(vectorMean.getResult()));
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
@@ -192,7 +192,7 @@ public class AirspyUnpackedInterleavedCalibration extends Calibration
|
||||
setImplementation(Implementation.VECTOR_SIMD_128);
|
||||
}
|
||||
|
||||
mLog.info("AIRSPY UNPACKED INTERLEAVED - VECTOR 128: " + DECIMAL_FORMAT.format(vectorMean.getResult()));
|
||||
mLog.info("UNPACKED INTERLEAVED SAMPLE CONVERTER - VECTOR 128: " + DECIMAL_FORMAT.format(vectorMean.getResult()));
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
@@ -209,12 +209,12 @@ public class AirspyUnpackedInterleavedCalibration extends Calibration
|
||||
setImplementation(Implementation.VECTOR_SIMD_64);
|
||||
}
|
||||
|
||||
mLog.info("AIRSPY UNPACKED INTERLEAVED - VECTOR 64: " + DECIMAL_FORMAT.format(vectorMean.getResult()));
|
||||
mLog.info("UNPACKED INTERLEAVED SAMPLE CONVERTER - VECTOR 64: " + DECIMAL_FORMAT.format(vectorMean.getResult()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mLog.info("AIRSPY UNPACKED INTERLEAVED - SET OPTIMAL IMPLEMENTATION TO: " + getImplementation());
|
||||
mLog.info("UNPACKED INTERLEAVED SAMPLE CONVERTER - SET OPTIMAL IMPLEMENTATION TO: " + getImplementation());
|
||||
}
|
||||
|
||||
private long calibrateScalar(short[] samples, short[] residualI, short[] residualQ)
|
||||
@@ -224,7 +224,7 @@ public class AirspyUnpackedInterleavedCalibration extends Calibration
|
||||
long count = 0;
|
||||
while((System.currentTimeMillis() - start) < ITERATION_DURATION_MS)
|
||||
{
|
||||
AirspyInterleavedBufferIteratorScalar iterator = new AirspyInterleavedBufferIteratorScalar(samples, residualI,
|
||||
SampleInterleavedBufferIteratorScalar iterator = new SampleInterleavedBufferIteratorScalar(samples, residualI,
|
||||
residualQ, 0.0f, System.currentTimeMillis(), 0.0f);
|
||||
|
||||
while(iterator.hasNext() && ((System.currentTimeMillis() - start) < ITERATION_DURATION_MS))
|
||||
@@ -245,7 +245,7 @@ public class AirspyUnpackedInterleavedCalibration extends Calibration
|
||||
|
||||
while((System.currentTimeMillis() - start) < ITERATION_DURATION_MS)
|
||||
{
|
||||
AirspyInterleavedBufferIteratorVector64Bits iterator = new AirspyInterleavedBufferIteratorVector64Bits(samples, residualI,
|
||||
SampleInterleavedBufferIteratorVector64Bits iterator = new SampleInterleavedBufferIteratorVector64Bits(samples, residualI,
|
||||
residualQ, 0.0f, System.currentTimeMillis(), 0.0f);
|
||||
|
||||
while(iterator.hasNext() && ((System.currentTimeMillis() - start) < ITERATION_DURATION_MS))
|
||||
@@ -266,7 +266,7 @@ public class AirspyUnpackedInterleavedCalibration extends Calibration
|
||||
|
||||
for(int x = 0; x < ITERATION_DURATION_MS; x++)
|
||||
{
|
||||
AirspyInterleavedBufferIteratorVector128Bits iterator = new AirspyInterleavedBufferIteratorVector128Bits(samples, residualI,
|
||||
SampleInterleavedBufferIteratorVector128Bits iterator = new SampleInterleavedBufferIteratorVector128Bits(samples, residualI,
|
||||
residualQ, 0.0f, System.currentTimeMillis(), 0.0f);
|
||||
|
||||
while(iterator.hasNext() && ((System.currentTimeMillis() - start) < ITERATION_DURATION_MS))
|
||||
@@ -287,8 +287,8 @@ public class AirspyUnpackedInterleavedCalibration extends Calibration
|
||||
|
||||
while((System.currentTimeMillis() - start) < ITERATION_DURATION_MS)
|
||||
{
|
||||
AirspyInterleavedBufferIteratorVector256Bits iterator =
|
||||
new AirspyInterleavedBufferIteratorVector256Bits(samples, residualI, residualQ, 0.0f, System.currentTimeMillis(), 0.0f);
|
||||
SampleInterleavedBufferIteratorVector256Bits iterator =
|
||||
new SampleInterleavedBufferIteratorVector256Bits(samples, residualI, residualQ, 0.0f, System.currentTimeMillis(), 0.0f);
|
||||
|
||||
while(iterator.hasNext() && ((System.currentTimeMillis() - start) < ITERATION_DURATION_MS))
|
||||
{
|
||||
@@ -308,8 +308,8 @@ public class AirspyUnpackedInterleavedCalibration extends Calibration
|
||||
|
||||
while((System.currentTimeMillis() - start) < ITERATION_DURATION_MS)
|
||||
{
|
||||
AirspyInterleavedBufferIteratorVector512Bits iterator =
|
||||
new AirspyInterleavedBufferIteratorVector512Bits(samples, residualI, residualQ, 0.0f,
|
||||
SampleInterleavedBufferIteratorVector512Bits iterator =
|
||||
new SampleInterleavedBufferIteratorVector512Bits(samples, residualI, residualQ, 0.0f,
|
||||
System.currentTimeMillis(), 0.0f);
|
||||
|
||||
while(iterator.hasNext() && ((System.currentTimeMillis() - start) < ITERATION_DURATION_MS))
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* *****************************************************************************
|
||||
* Copyright (C) 2014-2022 Dennis Sheirer
|
||||
* Copyright (C) 2014-2025 Dennis Sheirer
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -17,14 +17,14 @@
|
||||
* ****************************************************************************
|
||||
*/
|
||||
|
||||
package io.github.dsheirer.vector.calibrate.airspy;
|
||||
package io.github.dsheirer.vector.calibrate.sample;
|
||||
|
||||
import io.github.dsheirer.buffer.airspy.AirspyBufferIterator;
|
||||
import io.github.dsheirer.buffer.airspy.AirspyBufferIteratorScalar;
|
||||
import io.github.dsheirer.buffer.airspy.AirspyBufferIteratorVector128Bits;
|
||||
import io.github.dsheirer.buffer.airspy.AirspyBufferIteratorVector256Bits;
|
||||
import io.github.dsheirer.buffer.airspy.AirspyBufferIteratorVector512Bits;
|
||||
import io.github.dsheirer.buffer.airspy.AirspyBufferIteratorVector64Bits;
|
||||
import io.github.dsheirer.buffer.sample.SampleBufferIterator;
|
||||
import io.github.dsheirer.buffer.sample.SampleBufferIteratorScalar;
|
||||
import io.github.dsheirer.buffer.sample.SampleBufferIteratorVector128Bits;
|
||||
import io.github.dsheirer.buffer.sample.SampleBufferIteratorVector256Bits;
|
||||
import io.github.dsheirer.buffer.sample.SampleBufferIteratorVector512Bits;
|
||||
import io.github.dsheirer.buffer.sample.SampleBufferIteratorVector64Bits;
|
||||
import io.github.dsheirer.vector.calibrate.Calibration;
|
||||
import io.github.dsheirer.vector.calibrate.CalibrationException;
|
||||
import io.github.dsheirer.vector.calibrate.CalibrationType;
|
||||
@@ -33,9 +33,9 @@ import jdk.incubator.vector.FloatVector;
|
||||
import org.apache.commons.math3.stat.descriptive.moment.Mean;
|
||||
|
||||
/**
|
||||
* Calculates optimal implementation (SCALAR vs VECTOR) for non-interleaved airspy native buffers.
|
||||
* Calculates optimal implementation (SCALAR vs VECTOR) for non-interleaved sample native buffers.
|
||||
*/
|
||||
public class AirspyUnpackedCalibration extends Calibration
|
||||
public class UnpackedSampleConverterCalibration extends Calibration
|
||||
{
|
||||
private static final int BUFFER_SIZE = 131072;
|
||||
private static final int ITERATION_DURATION_MS = 1000;
|
||||
@@ -45,19 +45,19 @@ public class AirspyUnpackedCalibration extends Calibration
|
||||
/**
|
||||
* Constructs an instance
|
||||
*/
|
||||
public AirspyUnpackedCalibration()
|
||||
public UnpackedSampleConverterCalibration()
|
||||
{
|
||||
super(CalibrationType.AIRSPY_UNPACKED_ITERATOR);
|
||||
super(CalibrationType.SAMPLE_UNPACKED_ITERATOR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void calibrate() throws CalibrationException
|
||||
{
|
||||
short[] samples = getShortSamples(BUFFER_SIZE);
|
||||
short[] residualI = getShortSamples(AirspyBufferIterator.I_OVERLAP);
|
||||
short[] residualQ = getShortSamples(AirspyBufferIterator.Q_OVERLAP);
|
||||
short[] residualI = getShortSamples(SampleBufferIterator.I_OVERLAP);
|
||||
short[] residualQ = getShortSamples(SampleBufferIterator.Q_OVERLAP);
|
||||
|
||||
mLog.info("AIRSPY UNPACKED - VECTOR SIMD LANES PREFERRED: " + FloatVector.SPECIES_PREFERRED.length());
|
||||
mLog.info("UNPACKED SAMPLE CONVERTER - VECTOR SIMD LANES PREFERRED: " + FloatVector.SPECIES_PREFERRED.length());
|
||||
|
||||
//Warm-Up Phase ....
|
||||
Mean scalarMean = new Mean();
|
||||
@@ -68,7 +68,7 @@ public class AirspyUnpackedCalibration extends Calibration
|
||||
scalarMean.increment(score);
|
||||
}
|
||||
|
||||
mLog.info("AIRSPY UNPACKED WARMUP - SCALAR: " + DECIMAL_FORMAT.format(scalarMean.getResult()));
|
||||
mLog.info("UNPACKED SAMPLE CONVERTER WARMUP - SCALAR: " + DECIMAL_FORMAT.format(scalarMean.getResult()));
|
||||
|
||||
switch(FloatVector.SPECIES_PREFERRED.length())
|
||||
{
|
||||
@@ -83,7 +83,7 @@ public class AirspyUnpackedCalibration extends Calibration
|
||||
vector512Mean.increment(score);
|
||||
}
|
||||
|
||||
mLog.info("AIRSPY UNPACKED WARMUP - VECTOR 512: " + DECIMAL_FORMAT.format(vector512Mean.getResult()));
|
||||
mLog.info("UNPACKED SAMPLE CONVERTER WARMUP - VECTOR 512: " + DECIMAL_FORMAT.format(vector512Mean.getResult()));
|
||||
}
|
||||
case 8:
|
||||
{
|
||||
@@ -94,7 +94,7 @@ public class AirspyUnpackedCalibration extends Calibration
|
||||
vector256Mean.increment(score);
|
||||
}
|
||||
|
||||
mLog.info("AIRSPY UNPACKED WARMUP - VECTOR 256: " + DECIMAL_FORMAT.format(vector256Mean.getResult()));
|
||||
mLog.info("UNPACKED SAMPLE CONVERTER WARMUP - VECTOR 256: " + DECIMAL_FORMAT.format(vector256Mean.getResult()));
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
@@ -105,7 +105,7 @@ public class AirspyUnpackedCalibration extends Calibration
|
||||
vector128Mean.increment(score);
|
||||
}
|
||||
|
||||
mLog.info("AIRSPY UNPACKED WARMUP - VECTOR 128: " + DECIMAL_FORMAT.format(vector128Mean.getResult()));
|
||||
mLog.info("UNPACKED SAMPLE CONVERTER WARMUP - VECTOR 128: " + DECIMAL_FORMAT.format(vector128Mean.getResult()));
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
@@ -116,7 +116,7 @@ public class AirspyUnpackedCalibration extends Calibration
|
||||
vector64Mean.increment(score);
|
||||
}
|
||||
|
||||
mLog.info("AIRSPY UNPACKED WARMUP - VECTOR 64: " + DECIMAL_FORMAT.format(vector64Mean.getResult()));
|
||||
mLog.info("UNPACKED SAMPLE CONVERTER WARMUP - VECTOR 64: " + DECIMAL_FORMAT.format(vector64Mean.getResult()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ public class AirspyUnpackedCalibration extends Calibration
|
||||
|
||||
double bestScore = scalarMean.getResult();
|
||||
setImplementation(Implementation.SCALAR);
|
||||
mLog.info("AIRSPY UNPACKED - SCALAR: " + DECIMAL_FORMAT.format(scalarMean.getResult()));
|
||||
mLog.info("UNPACKED SAMPLE CONVERTER - SCALAR: " + DECIMAL_FORMAT.format(scalarMean.getResult()));
|
||||
|
||||
switch(FloatVector.SPECIES_PREFERRED.length())
|
||||
{
|
||||
@@ -146,7 +146,7 @@ public class AirspyUnpackedCalibration extends Calibration
|
||||
vector512Mean.increment(score);
|
||||
}
|
||||
|
||||
mLog.info("AIRSPY UNPACKED - VECTOR 512: " + DECIMAL_FORMAT.format(vector512Mean.getResult()));
|
||||
mLog.info("UNPACKED SAMPLE CONVERTER - VECTOR 512: " + DECIMAL_FORMAT.format(vector512Mean.getResult()));
|
||||
if(vector512Mean.getResult() > bestScore)
|
||||
{
|
||||
bestScore = vector512Mean.getResult();
|
||||
@@ -162,7 +162,7 @@ public class AirspyUnpackedCalibration extends Calibration
|
||||
vector256Mean.increment(score);
|
||||
}
|
||||
|
||||
mLog.info("AIRSPY UNPACKED - VECTOR 256: " + DECIMAL_FORMAT.format(vector256Mean.getResult()));
|
||||
mLog.info("UNPACKED SAMPLE CONVERTER - VECTOR 256: " + DECIMAL_FORMAT.format(vector256Mean.getResult()));
|
||||
if(vector256Mean.getResult() > bestScore)
|
||||
{
|
||||
bestScore = vector256Mean.getResult();
|
||||
@@ -178,7 +178,7 @@ public class AirspyUnpackedCalibration extends Calibration
|
||||
vector128Mean.increment(score);
|
||||
}
|
||||
|
||||
mLog.info("AIRSPY UNPACKED - VECTOR 128: " + DECIMAL_FORMAT.format(vector128Mean.getResult()));
|
||||
mLog.info("UNPACKED SAMPLE CONVERTER - VECTOR 128: " + DECIMAL_FORMAT.format(vector128Mean.getResult()));
|
||||
if(vector128Mean.getResult() > bestScore)
|
||||
{
|
||||
bestScore = vector128Mean.getResult();
|
||||
@@ -194,7 +194,7 @@ public class AirspyUnpackedCalibration extends Calibration
|
||||
vector64Mean.increment(score);
|
||||
}
|
||||
|
||||
mLog.info("AIRSPY UNPACKED - VECTOR 64: " + DECIMAL_FORMAT.format(vector64Mean.getResult()));
|
||||
mLog.info("UNPACKED SAMPLE CONVERTER - VECTOR 64: " + DECIMAL_FORMAT.format(vector64Mean.getResult()));
|
||||
if(vector64Mean.getResult() > bestScore)
|
||||
{
|
||||
setImplementation(Implementation.VECTOR_SIMD_64);
|
||||
@@ -202,7 +202,7 @@ public class AirspyUnpackedCalibration extends Calibration
|
||||
}
|
||||
}
|
||||
|
||||
mLog.info("AIRSPY UNPACKED - SET OPTIMAL IMPLEMENTATION TO: " + getImplementation());
|
||||
mLog.info("UNPACKED SAMPLE CONVERTER - SET OPTIMAL IMPLEMENTATION TO: " + getImplementation());
|
||||
}
|
||||
|
||||
private long testScalar(short[] samples, short[] residualI, short[] residualQ)
|
||||
@@ -213,7 +213,7 @@ public class AirspyUnpackedCalibration extends Calibration
|
||||
|
||||
while((System.currentTimeMillis() - start) < ITERATION_DURATION_MS)
|
||||
{
|
||||
AirspyBufferIteratorScalar iterator = new AirspyBufferIteratorScalar(samples, residualI,
|
||||
SampleBufferIteratorScalar iterator = new SampleBufferIteratorScalar(samples, residualI,
|
||||
residualQ, 0.0f, System.currentTimeMillis(), 0.0f);
|
||||
|
||||
while(iterator.hasNext() && ((System.currentTimeMillis() - start) < ITERATION_DURATION_MS))
|
||||
@@ -234,7 +234,7 @@ public class AirspyUnpackedCalibration extends Calibration
|
||||
|
||||
while((System.currentTimeMillis() - start) < ITERATION_DURATION_MS)
|
||||
{
|
||||
AirspyBufferIteratorVector64Bits iterator = new AirspyBufferIteratorVector64Bits(samples, residualI,
|
||||
SampleBufferIteratorVector64Bits iterator = new SampleBufferIteratorVector64Bits(samples, residualI,
|
||||
residualQ, 0.0f, System.currentTimeMillis(), 0.0f);
|
||||
|
||||
while(iterator.hasNext() && ((System.currentTimeMillis() - start) < ITERATION_DURATION_MS))
|
||||
@@ -254,7 +254,7 @@ public class AirspyUnpackedCalibration extends Calibration
|
||||
long count = 0;
|
||||
while((System.currentTimeMillis() - start) < ITERATION_DURATION_MS)
|
||||
{
|
||||
AirspyBufferIteratorVector128Bits iterator = new AirspyBufferIteratorVector128Bits(samples, residualI,
|
||||
SampleBufferIteratorVector128Bits iterator = new SampleBufferIteratorVector128Bits(samples, residualI,
|
||||
residualQ, 0.0f, System.currentTimeMillis(), 0.0f);
|
||||
|
||||
while(iterator.hasNext() && ((System.currentTimeMillis() - start) < ITERATION_DURATION_MS))
|
||||
@@ -275,8 +275,8 @@ public class AirspyUnpackedCalibration extends Calibration
|
||||
|
||||
while((System.currentTimeMillis() - start) < ITERATION_DURATION_MS)
|
||||
{
|
||||
AirspyBufferIteratorVector256Bits iterator =
|
||||
new AirspyBufferIteratorVector256Bits(samples, residualI, residualQ, 0.0f,
|
||||
SampleBufferIteratorVector256Bits iterator =
|
||||
new SampleBufferIteratorVector256Bits(samples, residualI, residualQ, 0.0f,
|
||||
System.currentTimeMillis(), 0.0f);
|
||||
|
||||
while(iterator.hasNext() && ((System.currentTimeMillis() - start) < ITERATION_DURATION_MS))
|
||||
@@ -297,8 +297,8 @@ public class AirspyUnpackedCalibration extends Calibration
|
||||
|
||||
while((System.currentTimeMillis() - start) < ITERATION_DURATION_MS)
|
||||
{
|
||||
AirspyBufferIteratorVector512Bits iterator =
|
||||
new AirspyBufferIteratorVector512Bits(samples, residualI, residualQ, 0.0f,
|
||||
SampleBufferIteratorVector512Bits iterator =
|
||||
new SampleBufferIteratorVector512Bits(samples, residualI, residualQ, 0.0f,
|
||||
System.currentTimeMillis(), 0.0f);
|
||||
|
||||
while(iterator.hasNext() && ((System.currentTimeMillis() - start) < ITERATION_DURATION_MS))
|
||||
Reference in New Issue
Block a user