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
DEFINES += _USE_MATH_DEFINES=1
DEFINES += USE_SSE2=1
QMAKE_CXXFLAGS += -msse2
DEFINES += USE_SSE4_1=1
@ -31,26 +32,41 @@ CONFIG(macx):INCLUDEPATH += "../../../../../boost_1_69_0"
SOURCES += datvdemod.cpp\
datvdemodgui.cpp\
datvdemodsettings.cpp \
datvdemodplugin.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\
datvdemodgui.h\
datvdemodsettings.h \
datvdemodplugin.h\
leansdr/bch.h \
leansdr/convolutional.h \
leansdr/crc.h \
leansdr/discrmath.h \
leansdr/dsp.h \
leansdr/dvb.h \
leansdr/dvbs2.h \
leansdr/dvbs2_data.h \
leansdr/filtergen.h \
leansdr/framework.h \
leansdr/generic.h \
leansdr/gui.h \
leansdr/hdlc.h \
leansdr/iess.h \
leansdr/ldpc.h \
leansdr/math.h \
leansdr/rs.h \
leansdr/sdr.h \
leansdr/softword.h \
leansdr/viterbi.h \
datvconstellation.h \
leansdr/datvconstellation.h \
datvvideoplayer.h \
datvideostream.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());
T *pin = in.rd() + ncoeffs, *pend = pin + count * decim, *pout = out.wr();
// TBD use coeffs when current_freq=0 (fewer mults if float)
@ -315,11 +315,11 @@ struct fir_filter : runnable
}
private:
unsigned int ncoeffs;
int ncoeffs;
Tc *coeffs;
pipereader<T> in;
pipewriter<T> out;
unsigned int decim;
int decim;
T *shifted_coeffs;
float current_freq;

View File

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

View File

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

View File

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

View File

@ -5,15 +5,15 @@ namespace leansdr
const char *cstln_base::names[] =
{
[BPSK] = "BPSK",
[QPSK] = "QPSK",
[PSK8] = "8PSK",
[APSK16] = "16APSK",
[APSK32] = "32APSK",
[APSK64E] = "64APSKe",
[QAM16] = "16QAM",
[QAM64] = "64QAM",
[QAM256] = "256QAM"
"BPSK",
"QPSK",
"8PSK",
"16APSK",
"32APSK",
"64APSKe",
"16QAM",
"64QAM",
"256QAM"
};
@ -95,4 +95,4 @@ void to_softsymb(const full_ss *fss, llr_ss *ss)
}
}
} // leansdr
} // leansdr

View File

@ -763,7 +763,7 @@ struct cstln_lut : cstln_base
void make_lut_from_symbols(float mer)
{
// 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.
// Shared scope so that we don't have to reset dists2[nsymbols..] to -1.