DATV demod: more leansdr cleanup and Windows build

This commit is contained in:
f4exb 2019-03-24 19:53:23 +01:00
parent 929bd81679
commit 94cd6b0f0d
7 changed files with 50 additions and 25 deletions

View File

@ -11,6 +11,7 @@ QT += core gui multimedia multimediawidgets widgets opengl qml
TARGET = demoddatv TARGET = demoddatv
DEFINES += _USE_MATH_DEFINES=1
DEFINES += USE_SSE2=1 DEFINES += USE_SSE2=1
QMAKE_CXXFLAGS += -msse2 QMAKE_CXXFLAGS += -msse2
DEFINES += USE_SSE4_1=1 DEFINES += USE_SSE4_1=1
@ -31,26 +32,41 @@ CONFIG(macx):INCLUDEPATH += "../../../../../boost_1_69_0"
SOURCES += datvdemod.cpp\ SOURCES += datvdemod.cpp\
datvdemodgui.cpp\ datvdemodgui.cpp\
datvdemodsettings.cpp \
datvdemodplugin.cpp\ datvdemodplugin.cpp\
datvideostream.cpp \ datvideostream.cpp \
datvideorender.cpp datvideorender.cpp \
leansdr/dvb.cpp \
leansdr/filtergen.cpp \
leansdr/framework.cpp \
leansdr/math.cpp \
leansdr/sdr.cpp
HEADERS += datvdemod.h\ HEADERS += datvdemod.h\
datvdemodgui.h\ datvdemodgui.h\
datvdemodsettings.h \
datvdemodplugin.h\ datvdemodplugin.h\
leansdr/bch.h \
leansdr/convolutional.h \ leansdr/convolutional.h \
leansdr/crc.h \
leansdr/discrmath.h \
leansdr/dsp.h \ leansdr/dsp.h \
leansdr/dvb.h \ leansdr/dvb.h \
leansdr/dvbs2.h \
leansdr/dvbs2_data.h \
leansdr/filtergen.h \ leansdr/filtergen.h \
leansdr/framework.h \ leansdr/framework.h \
leansdr/generic.h \ leansdr/generic.h \
leansdr/gui.h \
leansdr/hdlc.h \ leansdr/hdlc.h \
leansdr/iess.h \ leansdr/iess.h \
leansdr/ldpc.h \
leansdr/math.h \ leansdr/math.h \
leansdr/rs.h \ leansdr/rs.h \
leansdr/sdr.h \ leansdr/sdr.h \
leansdr/softword.h \
leansdr/viterbi.h \ leansdr/viterbi.h \
datvconstellation.h \ leansdr/datvconstellation.h \
datvvideoplayer.h \ datvvideoplayer.h \
datvideostream.h \ datvideostream.h \
datvideorender.h datvideorender.h

View File

@ -297,7 +297,7 @@ struct fir_filter : runnable
} }
} }
unsigned long count = min((in.readable() - ncoeffs) / decim, long count = min((in.readable() - ncoeffs) / decim,
out.writable()); out.writable());
T *pin = in.rd() + ncoeffs, *pend = pin + count * decim, *pout = out.wr(); T *pin = in.rd() + ncoeffs, *pend = pin + count * decim, *pout = out.wr();
// TBD use coeffs when current_freq=0 (fewer mults if float) // TBD use coeffs when current_freq=0 (fewer mults if float)
@ -315,11 +315,11 @@ struct fir_filter : runnable
} }
private: private:
unsigned int ncoeffs; int ncoeffs;
Tc *coeffs; Tc *coeffs;
pipereader<T> in; pipereader<T> in;
pipewriter<T> out; pipewriter<T> out;
unsigned int decim; int decim;
T *shifted_coeffs; T *shifted_coeffs;
float current_freq; float current_freq;

View File

@ -650,13 +650,13 @@ static struct fec_spec
const uint16_t *polys; // [bits_out] const uint16_t *polys; // [bits_out]
} fec_specs[FEC_COUNT] = } fec_specs[FEC_COUNT] =
{ {
[FEC12] = {1, 2, polys_fec12}, {1, 2, polys_fec12},
[FEC23] = {2, 3, polys_fec23}, {2, 3, polys_fec23},
[FEC46] = {4, 6, polys_fec46}, {4, 6, polys_fec46},
[FEC34] = {3, 4, polys_fec34}, {3, 4, polys_fec34},
[FEC56] = {5, 6, polys_fec56}, {5, 6, polys_fec56},
[FEC78] = {7, 8, polys_fec78}, {7, 8, polys_fec78},
[FEC45] = {4, 5, polys_fec45}, // Non-standard {4, 5, polys_fec45}, // Non-standard
}; };
struct dvb_convol : runnable struct dvb_convol : runnable

View File

@ -17,6 +17,9 @@
#ifndef LEANSDR_FRAMEWORK_H #ifndef LEANSDR_FRAMEWORK_H
#define LEANSDR_FRAMEWORK_H #define LEANSDR_FRAMEWORK_H
#include <cstddef>
#include <algorithm>
#include <math.h> #include <math.h>
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>

View File

@ -20,7 +20,13 @@
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/types.h> #include <sys/types.h>
#ifdef _MSC_VER
#include <stdlib.h>
#include <io.h>
#else
#include <unistd.h> #include <unistd.h>
#endif
#include "leansdr/math.h" #include "leansdr/math.h"
@ -302,7 +308,7 @@ struct itemcounter : runnable
template <typename T> template <typename T>
struct decimator : runnable struct decimator : runnable
{ {
unsigned int d; int d;
decimator(scheduler *sch, int _d, pipebuf<T> &_in, pipebuf<T> &_out) decimator(scheduler *sch, int _d, pipebuf<T> &_in, pipebuf<T> &_out)
: runnable(sch, "decimator"), : runnable(sch, "decimator"),
@ -312,7 +318,7 @@ struct decimator : runnable
} }
void run() void run()
{ {
unsigned long count = min(in.readable() / d, out.writable()); long count = min(in.readable() / d, out.writable());
T *pin = in.rd(), *pend = pin + count * d, *pout = out.wr(); T *pin = in.rd(), *pend = pin + count * d, *pout = out.wr();
for (; pin < pend; pin += d, ++pout) for (; pin < pend; pin += d, ++pout)
*pout = *pin; *pout = *pin;

View File

@ -5,15 +5,15 @@ namespace leansdr
const char *cstln_base::names[] = const char *cstln_base::names[] =
{ {
[BPSK] = "BPSK", "BPSK",
[QPSK] = "QPSK", "QPSK",
[PSK8] = "8PSK", "8PSK",
[APSK16] = "16APSK", "16APSK",
[APSK32] = "32APSK", "32APSK",
[APSK64E] = "64APSKe", "64APSKe",
[QAM16] = "16QAM", "16QAM",
[QAM64] = "64QAM", "64QAM",
[QAM256] = "256QAM" "256QAM"
}; };

View File

@ -763,7 +763,7 @@ struct cstln_lut : cstln_base
void make_lut_from_symbols(float mer) void make_lut_from_symbols(float mer)
{ {
// Note: Excessively low values of MER will break 16APSK and 32APSK. // Note: Excessively low values of MER will break 16APSK and 32APSK.
float sigma = cstln_amp * exp10f(-mer / 20); float sigma = cstln_amp * pow(10.0, (-mer / 20));
// Precomputed values. // Precomputed values.
// Shared scope so that we don't have to reset dists2[nsymbols..] to -1. // Shared scope so that we don't have to reset dists2[nsymbols..] to -1.