mirror of https://github.com/f4exb/sdrangel.git
: FT8 demod: implement Qt dependency and export for MSVC
This commit is contained in:
parent
22acbebab6
commit
38fbcc65b7
|
@ -151,4 +151,16 @@
|
||||||
# define MODEMM17_API
|
# define MODEMM17_API
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* the 'FT8_API' controls the import/export of 'ft8' symbols
|
||||||
|
*/
|
||||||
|
#if !defined(sdrangel_STATIC)
|
||||||
|
# ifdef ft8_EXPORTS
|
||||||
|
# define FT8_API __SDR_EXPORT
|
||||||
|
# else
|
||||||
|
# define FT8_API __SDR_IMPORT
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
# define FT8_API
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* __SDRANGEL_EXPORT_H */
|
#endif /* __SDRANGEL_EXPORT_H */
|
||||||
|
|
|
@ -18,12 +18,17 @@ set(ft8_HEADERS
|
||||||
util.h
|
util.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
include_directories(
|
||||||
|
${CMAKE_SOURCE_DIR}/exports
|
||||||
|
)
|
||||||
|
|
||||||
add_library(ft8 SHARED
|
add_library(ft8 SHARED
|
||||||
${ft8_SOURCES}
|
${ft8_SOURCES}
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(ft8
|
target_link_libraries(ft8
|
||||||
${FFTW3F_LIBRARIES}
|
${FFTW3F_LIBRARIES}
|
||||||
|
Qt::Core
|
||||||
)
|
)
|
||||||
|
|
||||||
install(TARGETS ft8 DESTINATION ${INSTALL_LIB_DIR})
|
install(TARGETS ft8 DESTINATION ${INSTALL_LIB_DIR})
|
||||||
|
|
|
@ -19,8 +19,9 @@
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "fft.h"
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <QDebug>
|
||||||
|
#include "fft.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
#define TIMING 0
|
#define TIMING 0
|
||||||
|
@ -564,7 +565,7 @@ void FFTEngine::fft_stats()
|
||||||
for (int i = 0; i < nplans; i++)
|
for (int i = 0; i < nplans; i++)
|
||||||
{
|
{
|
||||||
Plan *p = plans[i];
|
Plan *p = plans[i];
|
||||||
printf("%-13s %6d %9d %6.3f\n",
|
qDebug("FT8::FFTEngine::fft_stats: %-13s %6d %9d %6.3fn",
|
||||||
p->why_,
|
p->why_,
|
||||||
p->n_,
|
p->n_,
|
||||||
p->uses_,
|
p->uses_,
|
||||||
|
|
|
@ -27,9 +27,11 @@
|
||||||
#include <complex>
|
#include <complex>
|
||||||
#include <fftw3.h>
|
#include <fftw3.h>
|
||||||
|
|
||||||
|
#include "export.h"
|
||||||
|
|
||||||
namespace FT8
|
namespace FT8
|
||||||
{
|
{
|
||||||
class FFTEngine
|
class FT8_API FFTEngine
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// a cached fftw plan, for both of:
|
// a cached fftw plan, for both of:
|
||||||
|
|
36
ft8/ft8.cpp
36
ft8/ft8.cpp
|
@ -43,6 +43,8 @@
|
||||||
#include <random>
|
#include <random>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
// #include <QDebug>
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "ft8.h"
|
#include "ft8.h"
|
||||||
#include "libldpc.h"
|
#include "libldpc.h"
|
||||||
|
@ -490,7 +492,7 @@ int FT8::blocksize(int rate)
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// look for potential signals by searching FFT bins for Costas symbol
|
// look for potential psignals by searching FFT bins for Costas symbol
|
||||||
// blocks. returns a vector of candidate positions.
|
// blocks. returns a vector of candidate positions.
|
||||||
//
|
//
|
||||||
std::vector<Strength> FT8::coarse(const FFTEngine::ffts_t &bins, int si0, int si1)
|
std::vector<Strength> FT8::coarse(const FFTEngine::ffts_t &bins, int si0, int si1)
|
||||||
|
@ -2737,17 +2739,17 @@ int FT8::one_iter(const std::vector<float> &samples200, int best_off, float hz_f
|
||||||
float FT8::guess_snr(const FFTEngine::ffts_t &m79)
|
float FT8::guess_snr(const FFTEngine::ffts_t &m79)
|
||||||
{
|
{
|
||||||
int costas[] = {3, 1, 4, 0, 6, 5, 2};
|
int costas[] = {3, 1, 4, 0, 6, 5, 2};
|
||||||
float noises = 0;
|
float pnoises = 0;
|
||||||
float signals = 0;
|
float psignals = 0;
|
||||||
|
|
||||||
for (int i = 0; i < 7; i++)
|
for (int i = 0; i < 7; i++)
|
||||||
{
|
{
|
||||||
signals += std::abs(m79[i][costas[i]]);
|
psignals += std::abs(m79[i][costas[i]]);
|
||||||
signals += std::abs(m79[36 + i][costas[i]]);
|
psignals += std::abs(m79[36 + i][costas[i]]);
|
||||||
signals += std::abs(m79[72 + i][costas[i]]);
|
psignals += std::abs(m79[72 + i][costas[i]]);
|
||||||
noises += std::abs(m79[i][(costas[i] + 4) % 8]);
|
pnoises += std::abs(m79[i][(costas[i] + 4) % 8]);
|
||||||
noises += std::abs(m79[36 + i][(costas[i] + 4) % 8]);
|
pnoises += std::abs(m79[36 + i][(costas[i] + 4) % 8]);
|
||||||
noises += std::abs(m79[72 + i][(costas[i] + 4) % 8]);
|
pnoises += std::abs(m79[72 + i][(costas[i] + 4) % 8]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 79; i++)
|
for (int i = 0; i < 79; i++)
|
||||||
|
@ -2760,17 +2762,17 @@ float FT8::guess_snr(const FFTEngine::ffts_t &m79)
|
||||||
v[j] = std::abs(m79[i][j]);
|
v[j] = std::abs(m79[i][j]);
|
||||||
}
|
}
|
||||||
std::sort(v.begin(), v.end());
|
std::sort(v.begin(), v.end());
|
||||||
signals += v[7]; // strongest tone, probably the signal
|
psignals += v[7]; // strongest tone, probably the signal
|
||||||
noises += (v[2] + v[3] + v[4]) / 3;
|
pnoises += (v[2] + v[3] + v[4]) / 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
noises /= 79;
|
pnoises /= 79;
|
||||||
signals /= 79;
|
psignals /= 79;
|
||||||
|
|
||||||
noises *= noises; // square yields power
|
pnoises *= pnoises; // square yields power
|
||||||
signals *= signals;
|
psignals *= psignals;
|
||||||
|
|
||||||
float raw = signals / noises;
|
float raw = psignals / pnoises;
|
||||||
raw -= 1; // turn (s+n)/n into s/n
|
raw -= 1; // turn (s+n)/n into s/n
|
||||||
if (raw < 0.1)
|
if (raw < 0.1)
|
||||||
raw = 0.1;
|
raw = 0.1;
|
||||||
|
@ -2956,7 +2958,7 @@ void FT8::fine(const FFTEngine::ffts_t &m79, int, float &adj_hz, float &adj_off)
|
||||||
if (nlate > 0)
|
if (nlate > 0)
|
||||||
late /= nlate;
|
late /= nlate;
|
||||||
|
|
||||||
// printf("early %d %.1f, late %d %.1f\n", nearly, early, nlate, late);
|
// qDebug("early %d %.1f, late %d %.1f", nearly, early, nlate, late);
|
||||||
|
|
||||||
// assumes 32 samples/symbol.
|
// assumes 32 samples/symbol.
|
||||||
if (nearly > 2 * nlate)
|
if (nearly > 2 * nlate)
|
||||||
|
|
18
ft8/ft8.h
18
ft8/ft8.h
|
@ -25,9 +25,11 @@
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include "fft.h"
|
#include "fft.h"
|
||||||
|
|
||||||
|
#include "export.h"
|
||||||
|
|
||||||
namespace FT8 {
|
namespace FT8 {
|
||||||
// Callback interface to get the results
|
// Callback interface to get the results
|
||||||
class CallbackInterface
|
class FT8_API CallbackInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual int hcb(
|
virtual int hcb(
|
||||||
|
@ -54,7 +56,7 @@ public:
|
||||||
// 4: similar to 3.
|
// 4: similar to 3.
|
||||||
// 5: laplace
|
// 5: laplace
|
||||||
//
|
//
|
||||||
class Stats
|
class FT8_API Stats
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
std::vector<float> a_;
|
std::vector<float> a_;
|
||||||
|
@ -89,7 +91,7 @@ private:
|
||||||
float log_rate_;
|
float log_rate_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Strength
|
class FT8_API Strength
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
float hz_;
|
float hz_;
|
||||||
|
@ -99,7 +101,7 @@ public:
|
||||||
|
|
||||||
// same as Python class CDECODE
|
// same as Python class CDECODE
|
||||||
//
|
//
|
||||||
struct cdecode
|
struct FT8_API cdecode
|
||||||
{
|
{
|
||||||
float hz0;
|
float hz0;
|
||||||
float hz1;
|
float hz1;
|
||||||
|
@ -121,7 +123,7 @@ struct cdecode
|
||||||
// total transmission time is 12.64 seconds
|
// total transmission time is 12.64 seconds
|
||||||
|
|
||||||
// tunable parameters
|
// tunable parameters
|
||||||
struct FT8Params
|
struct FT8_API FT8Params
|
||||||
{
|
{
|
||||||
int nthreads; // number of parallel threads, for multi-core
|
int nthreads; // number of parallel threads, for multi-core
|
||||||
int npasses_one; // number of spectral subtraction passes
|
int npasses_one; // number of spectral subtraction passes
|
||||||
|
@ -260,7 +262,7 @@ struct FT8Params
|
||||||
}; // class FT8Params
|
}; // class FT8Params
|
||||||
|
|
||||||
// The FT8 worker
|
// The FT8 worker
|
||||||
class FT8
|
class FT8_API FT8
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
std::thread *th_;
|
std::thread *th_;
|
||||||
|
@ -649,7 +651,7 @@ private:
|
||||||
static const double apriori174[];
|
static const double apriori174[];
|
||||||
}; // class FT8
|
}; // class FT8
|
||||||
|
|
||||||
class FT8Decoder {
|
class FT8_API FT8Decoder {
|
||||||
public:
|
public:
|
||||||
void entry(
|
void entry(
|
||||||
float xsamples[],
|
float xsamples[],
|
||||||
|
@ -669,7 +671,7 @@ public:
|
||||||
FT8Params& getParams() { return params; }
|
FT8Params& getParams() { return params; }
|
||||||
private:
|
private:
|
||||||
FT8Params params;
|
FT8Params params;
|
||||||
};
|
}; // FT8Decoder
|
||||||
|
|
||||||
} // namespace FT8
|
} // namespace FT8
|
||||||
|
|
||||||
|
|
14
ft8/osd.h
14
ft8/osd.h
|
@ -23,13 +23,13 @@
|
||||||
|
|
||||||
namespace FT8 {
|
namespace FT8 {
|
||||||
|
|
||||||
extern int gen_sys[174][91];
|
extern int gen_sys[174][91];
|
||||||
int check_crc(const int a91[91]);
|
int check_crc(const int a91[91]);
|
||||||
void ldpc_encode(int plain[91], int codeword[174]);
|
void ldpc_encode(int plain[91], int codeword[174]);
|
||||||
float osd_score(int xplain[91], float ll174[174]);
|
float osd_score(int xplain[91], float ll174[174]);
|
||||||
int osd_check(const int plain[91]);
|
int osd_check(const int plain[91]);
|
||||||
void matmul(int a[91][91], int b[91], int c[91]);
|
void matmul(int a[91][91], int b[91], int c[91]);
|
||||||
int osd_decode(float codeword[174], int depth, int out[91], int *out_depth);
|
int osd_decode(float codeword[174], int depth, int out[91], int *out_depth);
|
||||||
|
|
||||||
} // namepsace FT8
|
} // namepsace FT8
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
#ifndef unpack_h
|
#ifndef unpack_h
|
||||||
#define unpack_h
|
#define unpack_h
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
namespace FT8 {
|
namespace FT8 {
|
||||||
|
|
||||||
std::string unpack(int a91[], std::string& call1str, std::string& call2str, std::string& locstr);
|
std::string unpack(int a91[], std::string& call1str, std::string& call2str, std::string& locstr);
|
||||||
|
|
|
@ -24,8 +24,8 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <complex>
|
#include <complex>
|
||||||
|
|
||||||
namespace FT8
|
namespace FT8 {
|
||||||
{
|
|
||||||
double now();
|
double now();
|
||||||
void writetxt(std::vector<float> v, const char *filename);
|
void writetxt(std::vector<float> v, const char *filename);
|
||||||
std::complex<float> goertzel(std::vector<float> v, int rate, int i0, int n, float hz);
|
std::complex<float> goertzel(std::vector<float> v, int rate, int i0, int n, float hz);
|
||||||
|
@ -51,6 +51,7 @@ std::string trim(const std::string &s);
|
||||||
|
|
||||||
typedef unsigned long ulong;
|
typedef unsigned long ulong;
|
||||||
typedef unsigned int uint;
|
typedef unsigned int uint;
|
||||||
|
|
||||||
} // namespace FT8
|
} // namespace FT8
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -8,7 +8,7 @@ set(logging_SOURCES
|
||||||
logmessage.cpp
|
logmessage.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(httpserver_HEADERS
|
set(logging_HEADERS
|
||||||
dualfilelogger.h
|
dualfilelogger.h
|
||||||
loggerwithfile.h
|
loggerwithfile.h
|
||||||
filelogger.h
|
filelogger.h
|
||||||
|
|
Loading…
Reference in New Issue