mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-11-30 07:38:39 -05:00
Update post-input IQ visual out queue to ReBuffer<>
+ float is no longer enough for FFT zoom resolution :D
This commit is contained in:
parent
847f7a7569
commit
655e4da1dc
@ -58,18 +58,18 @@ void SpectrumPanel::drawPanelContents() {
|
|||||||
|
|
||||||
if (points.size()) {
|
if (points.size()) {
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||||
float range = ceilValue-floorValue;
|
double range = ceilValue-floorValue;
|
||||||
float ranges[3][4] = { { 90.0, 5000.0, 10.0, 100.0 }, { 20.0, 150.0, 10.0, 10.0 }, { -20.0, 30.0, 10.0, 1.0 } };
|
double ranges[3][4] = { { 90.0, 5000.0, 10.0, 100.0 }, { 20.0, 150.0, 10.0, 10.0 }, { -20.0, 30.0, 10.0, 1.0 } };
|
||||||
|
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
float p = 0;
|
double p = 0;
|
||||||
float rangeMin = ranges[i][0];
|
double rangeMin = ranges[i][0];
|
||||||
float rangeMax = ranges[i][1];
|
double rangeMax = ranges[i][1];
|
||||||
float rangeTrans = ranges[i][2];
|
double rangeTrans = ranges[i][2];
|
||||||
float rangeStep = ranges[i][3];
|
double rangeStep = ranges[i][3];
|
||||||
|
|
||||||
if (range >= rangeMin && range <= rangeMax) {
|
if (range >= rangeMin && range <= rangeMax) {
|
||||||
float a = 1.0;
|
double a = 1.0;
|
||||||
|
|
||||||
if (range <= rangeMin+rangeTrans) {
|
if (range <= rangeMin+rangeTrans) {
|
||||||
a *= (range-rangeMin)/rangeTrans;
|
a *= (range-rangeMin)/rangeTrans;
|
||||||
@ -80,7 +80,7 @@ void SpectrumPanel::drawPanelContents() {
|
|||||||
|
|
||||||
glColor4f(0.12, 0.12, 0.12, a);
|
glColor4f(0.12, 0.12, 0.12, a);
|
||||||
glBegin(GL_LINES);
|
glBegin(GL_LINES);
|
||||||
for (float l = floorValue; l<=ceilValue+rangeStep; l+=rangeStep) {
|
for (double l = floorValue; l<=ceilValue+rangeStep; l+=rangeStep) {
|
||||||
p += rangeStep/range;
|
p += rangeStep/range;
|
||||||
glVertex2f(0,p); glVertex2f(1,p);
|
glVertex2f(0,p); glVertex2f(1,p);
|
||||||
}
|
}
|
||||||
@ -104,29 +104,34 @@ void SpectrumPanel::drawPanelContents() {
|
|||||||
float viewHeight = (float) vp[3];
|
float viewHeight = (float) vp[3];
|
||||||
float viewWidth = (float) vp[2];
|
float viewWidth = (float) vp[2];
|
||||||
|
|
||||||
long long leftFreq = (float) freq - ((float) bandwidth / 2.0);
|
long long leftFreq = (double) freq - ((double) bandwidth / 2.0);
|
||||||
long long rightFreq = leftFreq + (float) bandwidth;
|
long long rightFreq = leftFreq + (double) bandwidth;
|
||||||
|
|
||||||
long long firstMhz = (leftFreq / 1000000) * 1000000;
|
long long firstMhz = (leftFreq / 1000000) * 1000000;
|
||||||
long double mhzStart = ((long double) (firstMhz - leftFreq) / (long double) (rightFreq - leftFreq)) * 2.0;
|
long double mhzStart = ((long double) (firstMhz - leftFreq) / (long double) (rightFreq - leftFreq)) * 2.0;
|
||||||
|
|
||||||
long double mhzStep = (100000.0 / (long double) (rightFreq - leftFreq)) * 2.0;
|
long double mhzStep = (100000.0 / (long double) (rightFreq - leftFreq)) * 2.0;
|
||||||
float mhzVisualStep = 0.1f;
|
double mhzVisualStep = 0.1f;
|
||||||
|
|
||||||
if (mhzStep * 0.5 * viewWidth > 400) {
|
if (mhzStep * 0.5 * viewWidth > 400) {
|
||||||
mhzStep = (10000.0 / (long double) (rightFreq - leftFreq)) * 2.0;
|
mhzStep = (10000.0 / (long double) (rightFreq - leftFreq)) * 2.0;
|
||||||
mhzVisualStep = 0.01f;
|
mhzVisualStep = 0.01f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mhzStep * 0.5 * viewWidth < 40) {
|
||||||
|
mhzStep = (250000.0 / (long double) (rightFreq - leftFreq)) * 2.0;
|
||||||
|
mhzVisualStep = 0.25f;
|
||||||
|
}
|
||||||
|
|
||||||
long double currentMhz = trunc(floor(firstMhz / 1000000.0));
|
long double currentMhz = trunc(floor(firstMhz / 1000000.0));
|
||||||
|
|
||||||
std::stringstream label;
|
std::stringstream label;
|
||||||
label.precision(2);
|
label.precision(2);
|
||||||
|
|
||||||
float hPos = 1.0 - (16.0 / viewHeight);
|
double hPos = 1.0 - (16.0 / viewHeight);
|
||||||
float lMhzPos = 1.0 - (5.0 / viewHeight);
|
double lMhzPos = 1.0 - (5.0 / viewHeight);
|
||||||
|
|
||||||
for (float m = -1.0 + mhzStart, mMax = 1.0 + ((mhzStart>0)?mhzStart:-mhzStart); m <= mMax; m += mhzStep) {
|
for (double m = -1.0 + mhzStart, mMax = 1.0 + ((mhzStart>0)?mhzStart:-mhzStart); m <= mMax; m += mhzStep) {
|
||||||
label << std::fixed << currentMhz;
|
label << std::fixed << currentMhz;
|
||||||
|
|
||||||
double fractpart, intpart;
|
double fractpart, intpart;
|
||||||
|
@ -76,8 +76,6 @@ void SDRPostThread::run() {
|
|||||||
|
|
||||||
dcFilter = iirfilt_crcf_create_dc_blocker(0.0005);
|
dcFilter = iirfilt_crcf_create_dc_blocker(0.0005);
|
||||||
|
|
||||||
DemodulatorThreadIQData *visualDataOut = new DemodulatorThreadIQData;
|
|
||||||
|
|
||||||
std::cout << "SDR post-processing thread started.." << std::endl;
|
std::cout << "SDR post-processing thread started.." << std::endl;
|
||||||
|
|
||||||
iqDataInQueue = (SDRThreadIQDataQueue*)getInputQueue("IQDataInput");
|
iqDataInQueue = (SDRThreadIQDataQueue*)getInputQueue("IQDataInput");
|
||||||
@ -118,8 +116,8 @@ void SDRPostThread::run() {
|
|||||||
iirfilt_crcf_execute_block(dcFilter, &fpData[0], dataSize, &dataOut[0]);
|
iirfilt_crcf_execute_block(dcFilter, &fpData[0], dataSize, &dataOut[0]);
|
||||||
|
|
||||||
if (iqVisualQueue != NULL && iqVisualQueue->empty()) {
|
if (iqVisualQueue != NULL && iqVisualQueue->empty()) {
|
||||||
|
DemodulatorThreadIQData *visualDataOut = visualDataBuffers.getBuffer();
|
||||||
visualDataOut->busy_rw.lock();
|
visualDataOut->setRefCount(1);
|
||||||
|
|
||||||
if (visualDataOut->data.size() < num_vis_samples) {
|
if (visualDataOut->data.size() < num_vis_samples) {
|
||||||
if (visualDataOut->data.capacity() < num_vis_samples) {
|
if (visualDataOut->data.capacity() < num_vis_samples) {
|
||||||
@ -133,8 +131,6 @@ void SDRPostThread::run() {
|
|||||||
visualDataOut->data.assign(dataOut.begin(), dataOut.begin() + num_vis_samples);
|
visualDataOut->data.assign(dataOut.begin(), dataOut.begin() + num_vis_samples);
|
||||||
|
|
||||||
iqVisualQueue->push(visualDataOut);
|
iqVisualQueue->push(visualDataOut);
|
||||||
|
|
||||||
visualDataOut->busy_rw.unlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
busy_demod.lock();
|
busy_demod.lock();
|
||||||
@ -221,7 +217,7 @@ void SDRPostThread::run() {
|
|||||||
iqVisualQueue->pop(visualDataDummy);
|
iqVisualQueue->pop(visualDataDummy);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete visualDataOut;
|
visualDataBuffers.purge();
|
||||||
|
|
||||||
std::cout << "SDR post-processing thread done." << std::endl;
|
std::cout << "SDR post-processing thread done." << std::endl;
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,8 @@ protected:
|
|||||||
iirfilt_crcf dcFilter;
|
iirfilt_crcf dcFilter;
|
||||||
int num_vis_samples;
|
int num_vis_samples;
|
||||||
std::atomic_bool swapIQ;
|
std::atomic_bool swapIQ;
|
||||||
|
ReBuffer<DemodulatorThreadIQData> visualDataBuffers;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::vector<liquid_float_complex> _lut;
|
std::vector<liquid_float_complex> _lut;
|
||||||
|
Loading…
Reference in New Issue
Block a user