Skip to content

Commit

Permalink
Merge branch 'master' into arm64
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr-Precise committed Feb 14, 2024
2 parents 8b4e84a + a52b634 commit 87c6440
Show file tree
Hide file tree
Showing 13 changed files with 104 additions and 373 deletions.
9 changes: 7 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ option(OPT_BUILD_FILE_SOURCE "Wav file source" ON)
option(OPT_BUILD_HACKRF_SOURCE "Build HackRF Source Module (Dependencies: libhackrf)" ON)
option(OPT_BUILD_HERMES_SOURCE "Build Hermes Source Module (no dependencies required)" ON)
option(OPT_BUILD_LIMESDR_SOURCE "Build LimeSDR Source Module (Dependencies: liblimesuite)" OFF)
option(OPT_BUILD_NETWORK_SOURCE "Build Network Source Module (no dependencies required)" on)
option(OPT_BUILD_NETWORK_SOURCE "Build Network Source Module (no dependencies required)" ON)
option(OPT_BUILD_PERSEUS_SOURCE "Build Perseus Source Module (Dependencies: libperseus-sdr)" OFF)
option(OPT_BUILD_PLUTOSDR_SOURCE "Build PlutoSDR Source Module (Dependencies: libiio, libad9361)" ON)
option(OPT_BUILD_RFSPACE_SOURCE "Build RFspace Source Module (no dependencies required)" ON)
Expand Down Expand Up @@ -287,7 +287,12 @@ if (OPT_BUILD_SCHEDULER)
add_subdirectory("misc_modules/scheduler")
endif (OPT_BUILD_SCHEDULER)

add_executable(sdrpp "src/main.cpp" "win32/resources.rc")
if (MSVC)
add_executable(sdrpp "src/main.cpp" "win32/resources.rc")
else ()
add_executable(sdrpp "src/main.cpp")
endif ()

target_link_libraries(sdrpp PRIVATE sdrpp_core)

# Compiler arguments
Expand Down
3 changes: 3 additions & 0 deletions core/src/credits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ namespace sdrpp_credits {
"CaribouLabs",
"Ettus Research",
"Howard Su",
"MicroPhase",
"MyriadRF",
"Nuand",
"RFspace",
Expand All @@ -54,6 +55,7 @@ namespace sdrpp_credits {
"Croccydile",
"Dale L Puckett (K0HYD)",
"Daniele D'Agnelli",
"David Taylor (GM8ARV)",
"D. Jones",
"Dexruus",
"EB3FRN",
Expand Down Expand Up @@ -81,6 +83,7 @@ namespace sdrpp_credits {
"Syne Ardwin (WI9SYN)",
"W4IPA",
"William Arcand (W1WRA)",
"William Pitchford",
"Yves Rougy",
"Zipper"
};
Expand Down
4 changes: 4 additions & 0 deletions core/src/dsp/compression/sample_stream_compressor.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ namespace dsp::compression {

void init(stream<complex_t>* in, PCMType pcmType) {
_pcmType = pcmType;

// Set the output buffer size to the max size of a complex buffer + 8 bytes for the header
out.setBufferSize(STREAM_BUFFER_SIZE*sizeof(complex_t) + 8);

base_type::init(in);
}

Expand Down
2 changes: 1 addition & 1 deletion core/src/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ namespace server {
// Compress data if needed and fill out header fields
if (compression) {
bb_pkt_hdr->type = PACKET_TYPE_BASEBAND_COMPRESSED;
bb_pkt_hdr->size = sizeof(PacketHeader) + (uint32_t)ZSTD_compressCCtx(cctx, &bbuf[sizeof(PacketHeader)], SERVER_MAX_PACKET_SIZE, data, count, 1);
bb_pkt_hdr->size = sizeof(PacketHeader) + (uint32_t)ZSTD_compressCCtx(cctx, &bbuf[sizeof(PacketHeader)], SERVER_MAX_PACKET_SIZE-sizeof(PacketHeader), data, count, 1);
}
else {
bb_pkt_hdr->type = PACKET_TYPE_BASEBAND;
Expand Down
19 changes: 10 additions & 9 deletions decoder_modules/atv_decoder/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,18 +139,19 @@ class ATVDecoderModule : public ModuleManager::Instance {
_this->pll.process(720, _this->fir.out.writeBuf, _this->pll.out.writeBuf, ((_this->ypos%2)==1) ^ _this->evenFrame);

// Render line to the image without color
//int lypos = _this->ypos - 1;
//if (lypos < 0) { lypos = 624; }
//uint32_t* lastLine = &((uint32_t *)_this->img.buffer)[(lypos < 313) ? (lypos*720*2) : ((((lypos - 313)*2)+1)*720) ];
//uint32_t* currentLine = &((uint32_t *)_this->img.buffer)[(_this->ypos < 313) ? (_this->ypos*720*2) : ((((_this->ypos - 313)*2)+1)*720) ];
int lypos = _this->ypos - 1;
if (lypos < 0) { lypos = 624; }
uint32_t* lastLine = &((uint32_t *)_this->img.buffer)[(lypos < 313) ? (lypos*720*2) : ((((lypos - 313)*2)+1)*720) ];
uint32_t* currentLine = &((uint32_t *)_this->img.buffer)[(_this->ypos < 313) ? (_this->ypos*720*2) : ((((_this->ypos - 313)*2)+1)*720) ];

uint32_t* currentLine = &((uint32_t *)_this->img.buffer)[_this->ypos*720];
//uint32_t* currentLine = &((uint32_t *)_this->img.buffer)[_this->ypos*720];

for (int i = 0; i < count; i++) {
//float imval = std::clamp<float>((data[i] - _this->minLvl) * 255.0 / _this->spanLvl, 0, 255);
uint32_t re = std::clamp<float>((_this->pll.out.writeBuf[i].re - _this->minLvl) * 255.0 / _this->spanLvl, 0, 255);
uint32_t im = std::clamp<float>((_this->pll.out.writeBuf[i].im - _this->minLvl) * 255.0 / _this->spanLvl, 0, 255);
currentLine[i] = 0xFF000000 | (im << 8) | re;
int imval = std::clamp<float>((data[i] - _this->minLvl) * 255.0 / _this->spanLvl, 0, 255);
// uint32_t re = std::clamp<float>((_this->pll.out.writeBuf[i].re - _this->minLvl) * 255.0 / _this->spanLvl, 0, 255);
// uint32_t im = std::clamp<float>((_this->pll.out.writeBuf[i].im - _this->minLvl) * 255.0 / _this->spanLvl, 0, 255);
// currentLine[i] = 0xFF000000 | (im << 8) | re;
currentLine[i] = 0xFF000000 | (imval << 16) | (imval << 8) | imval;
}

// Vertical scan logic
Expand Down
4 changes: 2 additions & 2 deletions decoder_modules/pager_decoder/src/pocsag/decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

class POCSAGDecoder : public Decoder {
public:
POCSAGDecoder(const std::string& name, VFOManager::VFO* vfo) : diag(0.6, 544) {
POCSAGDecoder(const std::string& name, VFOManager::VFO* vfo) : diag(0.6, BAUDRATE) {
this->name = name;
this->vfo = vfo;

Expand All @@ -26,7 +26,7 @@ class POCSAGDecoder : public Decoder {
vfo->setBandwidthLimits(12500, 12500, true);
vfo->setSampleRate(SAMPLERATE, 12500);
dsp.init(vfo->output, SAMPLERATE, BAUDRATE);
reshape.init(&dsp.soft, 544, 0);
reshape.init(&dsp.soft, BAUDRATE, (BAUDRATE / 30.0) - BAUDRATE);
dataHandler.init(&dsp.out, _dataHandler, this);
diagHandler.init(&reshape.out, _diagHandler, this);

Expand Down
104 changes: 4 additions & 100 deletions decoder_modules/pager_decoder/src/pocsag/dsp.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,89 +11,6 @@
#include <dsp/digital/binary_slicer.h>
#include <dsp/routing/doubler.h>

#include "packet_clock_sync.h"

inline float PATTERN_DSDSDZED[] = {
-1.00000000e+00, -8.00000000e-01, -6.00000000e-01, -4.00000000e-01,
-2.00000000e-01, -2.77555756e-17, 2.00000000e-01, 4.00000000e-01,
6.00000000e-01, 8.00000000e-01, 1.00000000e+00, 1.00000000e+00,
1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00,
1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00,
1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00,
1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00,
1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00,
1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00,
1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00,
1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00,
1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00,
1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 8.00000000e-01,
6.00000000e-01, 4.00000000e-01, 2.00000000e-01, 2.77555756e-17,
-2.00000000e-01, -4.00000000e-01, -6.00000000e-01, -8.00000000e-01,
-1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00,
-1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00,
-1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -8.00000000e-01,
-6.00000000e-01, -4.00000000e-01, -2.00000000e-01, -2.77555756e-17,
2.00000000e-01, 4.00000000e-01, 6.00000000e-01, 8.00000000e-01,
1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00,
1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00,
1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 8.00000000e-01,
6.00000000e-01, 4.00000000e-01, 2.00000000e-01, 2.77555756e-17,
-2.00000000e-01, -4.00000000e-01, -6.00000000e-01, -8.00000000e-01,
-1.00000000e+00, -8.00000000e-01, -6.00000000e-01, -4.00000000e-01,
-2.00000000e-01, -2.77555756e-17, 2.00000000e-01, 4.00000000e-01,
6.00000000e-01, 8.00000000e-01, 1.00000000e+00, 8.00000000e-01,
6.00000000e-01, 4.00000000e-01, 2.00000000e-01, 2.77555756e-17,
-2.00000000e-01, -4.00000000e-01, -6.00000000e-01, -8.00000000e-01,
-1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00,
-1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00,
-1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -8.00000000e-01,
-6.00000000e-01, -4.00000000e-01, -2.00000000e-01, -2.77555756e-17,
2.00000000e-01, 4.00000000e-01, 6.00000000e-01, 8.00000000e-01,
1.00000000e+00, 8.00000000e-01, 6.00000000e-01, 4.00000000e-01,
2.00000000e-01, 2.77555756e-17, -2.00000000e-01, -4.00000000e-01,
-6.00000000e-01, -8.00000000e-01, -1.00000000e+00, -1.00000000e+00,
-1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00,
-1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00,
-1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00,
-1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00,
-1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00,
-1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00,
-1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00,
-1.00000000e+00, -8.00000000e-01, -6.00000000e-01, -4.00000000e-01,
-2.00000000e-01, -2.77555756e-17, 2.00000000e-01, 4.00000000e-01,
6.00000000e-01, 8.00000000e-01, 1.00000000e+00, 8.00000000e-01,
6.00000000e-01, 4.00000000e-01, 2.00000000e-01, 2.77555756e-17,
-2.00000000e-01, -4.00000000e-01, -6.00000000e-01, -8.00000000e-01,
-1.00000000e+00, -8.00000000e-01, -6.00000000e-01, -4.00000000e-01,
-2.00000000e-01, -2.77555756e-17, 2.00000000e-01, 4.00000000e-01,
6.00000000e-01, 8.00000000e-01, 1.00000000e+00, 8.00000000e-01,
6.00000000e-01, 4.00000000e-01, 2.00000000e-01, 2.77555756e-17,
-2.00000000e-01, -4.00000000e-01, -6.00000000e-01, -8.00000000e-01,
-1.00000000e+00, -8.00000000e-01, -6.00000000e-01, -4.00000000e-01,
-2.00000000e-01, -2.77555756e-17, 2.00000000e-01, 4.00000000e-01,
6.00000000e-01, 8.00000000e-01, 1.00000000e+00, 1.00000000e+00,
1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00,
1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00,
1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00,
1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00,
1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 8.00000000e-01,
6.00000000e-01, 4.00000000e-01, 2.00000000e-01, 2.77555756e-17,
-2.00000000e-01, -4.00000000e-01, -6.00000000e-01, -8.00000000e-01,
-1.00000000e+00, -8.00000000e-01, -6.00000000e-01, -4.00000000e-01,
-2.00000000e-01, -2.77555756e-17, 2.00000000e-01, 4.00000000e-01,
6.00000000e-01, 8.00000000e-01, 1.00000000e+00, 1.00000000e+00,
1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00,
1.00000000e+00, 1.00000000e+00, 1.00000000e+00, 1.00000000e+00,
1.00000000e+00, 8.00000000e-01, 6.00000000e-01, 4.00000000e-01,
2.00000000e-01, 2.77555756e-17, -2.00000000e-01, -4.00000000e-01,
-6.00000000e-01, -8.00000000e-01, -1.00000000e+00, -1.00000000e+00,
-1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00,
-1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00,
-1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00,
-1.00000000e+00, -1.00000000e+00, -1.00000000e+00, -1.00000000e+00,
-1.00000000e+00, -1.00000000e+00, -1.00000000e+00
};

class POCSAGDSP : public dsp::Processor<dsp::complex_t, uint8_t> {
using base_type = dsp::Processor<dsp::complex_t, uint8_t>;
public:
Expand All @@ -106,16 +23,12 @@ class POCSAGDSP : public dsp::Processor<dsp::complex_t, uint8_t> {

// Configure blocks
demod.init(NULL, -4500.0, samplerate);
//dcBlock.init(NULL, 0.001); // NOTE: DC blocking causes issues because no scrambling, think more about it
float taps[] = { 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f };
shape = dsp::taps::fromArray<float>(10, taps);
fir.init(NULL, shape);
//recov.init(NULL, samplerate/baudrate, 1e-4, 1.0, 0.05);

cs.init(NULL, PATTERN_DSDSDZED, sizeof(PATTERN_DSDSDZED)/sizeof(float), 544, 10);
recov.init(NULL, samplerate/baudrate, 1e-4, 1.0, 0.05);

// Free useless buffers
// dcBlock.out.free();
fir.out.free();
recov.out.free();

Expand All @@ -125,13 +38,9 @@ class POCSAGDSP : public dsp::Processor<dsp::complex_t, uint8_t> {

int process(int count, dsp::complex_t* in, float* softOut, uint8_t* out) {
count = demod.process(count, in, demod.out.readBuf);
//count = dcBlock.process(count, demod.out.readBuf, demod.out.readBuf);
count = fir.process(count, demod.out.readBuf, demod.out.readBuf);
//count = recov.process(count, demod.out.readBuf, softOut);

count = cs.process(count, demod.out.readBuf, softOut);

//dsp::digital::BinarySlicer::process(count, softOut, out);
count = recov.process(count, demod.out.readBuf, softOut);
dsp::digital::BinarySlicer::process(count, softOut, out);
return count;
}

Expand All @@ -146,22 +55,17 @@ class POCSAGDSP : public dsp::Processor<dsp::complex_t, uint8_t> {
count = process(count, base_type::_in->readBuf, soft.writeBuf, base_type::out.writeBuf);

base_type::_in->flush();
//if (!base_type::out.swap(count)) { return -1; }

if (!base_type::out.swap(count)) { return -1; }
if (count) { if (!soft.swap(count)) { return -1; } }

return count;
}

dsp::stream<float> soft;

private:
dsp::demod::Quadrature demod;
//dsp::correction::DCBlocker<float> dcBlock;
dsp::tap<float> shape;
dsp::filter::FIR<float, float> fir;
dsp::clock_recovery::MM<float> recov;

dsp::PacketClockSync cs;

};
Loading

0 comments on commit 87c6440

Please sign in to comment.