├── .gitignore
├── COPYRIGHT
├── LICENSE
├── README.md
├── configs
├── WSJT-X-example.ini
├── fldigi_def_example.xml
└── gqrx-example-b210.conf
├── docs
└── images
│ ├── overview.jpg
│ ├── overview2.jpg
│ └── thor22-rtty45-psk125r-3.jpg
├── fldigi-noise-sdr
├── Makefile
└── src
│ ├── fldigi-noise-sdr
│ ├── AndFlmsg_Fldigi_Interface.cxx
│ ├── include
│ │ └── AndFlmsg_Fldigi_Interface.h
│ └── main.cxx
│ ├── fldigi
│ ├── contestia
│ │ └── contestia.cxx
│ ├── cw_rtty
│ │ ├── cw.cxx
│ │ ├── morse.cxx
│ │ └── rtty.cxx
│ ├── dominoex
│ │ ├── dominoex.cxx
│ │ └── dominovar.cxx
│ ├── fft
│ │ └── fft.cxx
│ ├── filters
│ │ ├── fftfilt.cxx
│ │ ├── filters.cxx
│ │ └── viterbi.cxx
│ ├── include
│ │ ├── ascii.h
│ │ ├── complex.h
│ │ ├── configuration.h
│ │ ├── contestia.h
│ │ ├── cw.h
│ │ ├── debug.h
│ │ ├── dominoex.h
│ │ ├── dominovar.h
│ │ ├── dsp.h
│ │ ├── fft.h
│ │ ├── fftfilt.h
│ │ ├── filters.h
│ │ ├── globals.h
│ │ ├── interleave.h
│ │ ├── jalocha
│ │ │ ├── pj_cmpx.h
│ │ │ ├── pj_fft.h
│ │ │ ├── pj_fht.h
│ │ │ ├── pj_fifo.h
│ │ │ ├── pj_gray.h
│ │ │ ├── pj_lowpass3.h
│ │ │ ├── pj_mfsk.h
│ │ │ └── pj_struc.h
│ │ ├── lora.h
│ │ ├── mfsk.h
│ │ ├── mfskvaricode.h
│ │ ├── misc.h
│ │ ├── modem.h
│ │ ├── morse.h
│ │ ├── mt63.h
│ │ ├── mt63base.h
│ │ ├── olivia.h
│ │ ├── psk.h
│ │ ├── pskcoeff.h
│ │ ├── pskrep.h
│ │ ├── pskvaricode.h
│ │ ├── rsid.h
│ │ ├── rtty.h
│ │ ├── thor.h
│ │ ├── thorvaricode.h
│ │ ├── util.h
│ │ └── viterbi.h
│ ├── libsamplerate
│ │ ├── common.h
│ │ ├── config.h
│ │ ├── fastest_coeffs.h
│ │ ├── float_cast.h
│ │ ├── high_qual_coeffs.h
│ │ ├── mid_qual_coeffs.h
│ │ ├── samplerate.c
│ │ ├── samplerate.h
│ │ ├── src_linear.c
│ │ ├── src_sinc.c
│ │ └── src_zoh.c
│ ├── lora
│ │ └── lora.cxx
│ ├── mfsk
│ │ ├── interleave.cxx
│ │ ├── mfsk.cxx
│ │ └── mfskvaricode.cxx
│ ├── misc
│ │ ├── configuration.cxx
│ │ ├── misc.cxx
│ │ └── util.cxx
│ ├── modem.cxx
│ ├── mt63
│ │ ├── alias_1k.dat
│ │ ├── alias_2k.dat
│ │ ├── alias_k5.dat
│ │ ├── dsp.cxx
│ │ ├── morse.dat
│ │ ├── mt63.cxx
│ │ ├── mt63base.cxx
│ │ ├── mt63intl.dat
│ │ └── symbol.dat
│ ├── olivia
│ │ └── olivia.cxx
│ ├── psk
│ │ ├── psk.cxx
│ │ ├── pskcoeff.cxx
│ │ └── pskvaricode.cxx
│ ├── rsid
│ │ └── rsid.cxx
│ └── thor
│ │ ├── thor.cxx
│ │ └── thorvaricode.cxx
│ └── libion
│ ├── chipset.cxx
│ ├── include
│ └── ion
│ │ └── ion.h
│ ├── ion.c
│ └── kernel-headers
│ └── linux
│ └── ion.h
├── gnss
├── glonass
│ ├── glonass-normal
│ │ ├── generate-example.sh
│ │ ├── gnss-sdr-1.5M.conf
│ │ ├── gnss-sdr.conf
│ │ ├── receive-1.5M.sh
│ │ ├── receive.sh
│ │ └── rx.grc
│ ├── glonass-sim.py
│ └── glonass-slow-10
│ │ ├── generate-slow-10-example.sh
│ │ ├── gnss-sdr.conf
│ │ ├── receive.sh
│ │ └── rx.grc
└── gps
│ ├── generate-slow-100-example.sh
│ ├── gnss-sdr.conf
│ ├── gps-sim-slow-100.py
│ ├── receive.sh
│ └── rx.grc
├── gnuradio
└── misc
│ └── generic.grc
├── offline-noise-sdr
├── generate
│ └── rf-pwm.py
└── transmit
│ ├── Makefile
│ └── src
│ ├── libion
│ ├── chipset.cxx
│ ├── include
│ │ └── ion
│ │ │ └── ion.h
│ ├── ion.c
│ └── kernel-headers
│ │ └── linux
│ │ └── ion.h
│ └── noise-sdr
│ └── main.cxx
├── scripts
├── data
│ ├── buffer.txt
│ ├── ft4-turing-2020-08-12-log.csv
│ └── rfpwm.txt
├── fig12.py
├── fig15.py
└── fig3.py
└── vagrant
├── Vagrantfile
└── bootstrap.sh
/.gitignore:
--------------------------------------------------------------------------------
1 | # Prerequisites
2 | *.d
3 |
4 | # Compiled Object files
5 | *.slo
6 | *.lo
7 | *.o
8 | *.obj
9 |
10 | # Precompiled Headers
11 | *.gch
12 | *.pch
13 |
14 | # Compiled Dynamic libraries
15 | *.so
16 | *.dylib
17 | *.dll
18 |
19 | # Fortran module files
20 | *.mod
21 | *.smod
22 |
23 | # Compiled Static libraries
24 | *.lai
25 | *.la
26 | *.a
27 | *.lib
28 |
29 | # Executables
30 | *.exe
31 | *.out
32 | *.app
33 |
34 | # Traces
35 | vagrant/traces
36 | vagrant/rfpwm
37 |
--------------------------------------------------------------------------------
/COPYRIGHT:
--------------------------------------------------------------------------------
1 | Copyright (C) EURECOM
2 | Copyright (C) Giovanni Camurati, Aurélien Francillon
3 |
4 | This screaming_channels repository contains what is necessary
5 | to reproduce the results of the Noise-SDR project.
6 |
7 | Certain files in this project may have specific licenses or copyright
8 | restrictions, as this project uses multiple open-source projects.
9 | Files in this project without any specific license can be assumed
10 | to follow the following general clause:
11 |
12 | screaming_channels is free software: you can redistribute it and/or modify
13 | it under the terms of the GNU General Public License as published by
14 | the Free Software Foundation, either version 3 of the License, or
15 | (at your option) any later version.
16 |
17 | Noise-SDR is distributed in the hope that it will be useful,
18 | but WITHOUT ANY WARRANTY; without even the implied warranty of
19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 | GNU General Public License for more details.
21 |
22 | You should have received a copy of the GNU General Public License
23 | along with screaming_channels. If not, see .
24 |
--------------------------------------------------------------------------------
/configs/gqrx-example-b210.conf:
--------------------------------------------------------------------------------
1 | [General]
2 | configversion=2
3 | crashed=true
4 |
5 | [audio]
6 | gain=-200
7 | pandapter_min_db=0
8 | rec_dir=
9 | udp_host=localhost
10 | udp_port=65535
11 | waterfall_min_db=0
12 |
13 | [fft]
14 | averaging=50
15 | pandapter_min_db=0
16 | split=50
17 | waterfall_min_db=0
18 |
19 | [gui]
20 | fctl_reset_digits=false
21 | geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x2\0\0\0\0\0\0\0\0\0\0\0\0\x3\xb5\0\0\x2W\0\0\0\0\0\0\0\0\0\0\x3\xb5\0\0\x2W\0\0\0\0\0\0\0\0\x6@)
22 | state=@ByteArray(\0\0\0\xff\0\0\0\0\xfd\0\0\0\x2\0\0\0\x1\0\0\0\0\0\0\0\0\xfc\x2\0\0\0\x2\xfc\0\0\0\0\xff\xff\xff\xff\0\0\x1j\0\b\0\x1a\xfa\0\0\0\x1\x2\0\0\0\x3\xfb\0\0\0\x18\0\x44\0o\0\x63\0k\0I\0n\0p\0u\0t\0\x43\0t\0l\x1\0\0\0\0\xff\xff\xff\xff\0\0\0\xf0\0\xff\xff\xff\xfb\0\0\0\x12\0\x44\0o\0\x63\0k\0R\0x\0O\0p\0t\x1\0\0\0\0\xff\xff\xff\xff\0\0\x1O\0\a\xff\xff\xfb\0\0\0\xe\0\x44\0o\0\x63\0k\0\x46\0\x66\0t\x1\0\0\0\0\xff\xff\xff\xff\0\0\0\xc8\0\a\xff\xff\xfc\0\0\0\0\xff\xff\xff\xff\0\0\0\xc8\0\xff\xff\xff\xfa\0\0\0\0\x2\0\0\0\x2\xfb\0\0\0\x12\0\x44\0o\0\x63\0k\0\x41\0u\0\x64\0i\0o\x1\0\0\0\0\xff\xff\xff\xff\0\0\0\xc8\0\xff\xff\xff\xfb\0\0\0\xe\0\x44\0o\0\x63\0k\0R\0\x44\0S\0\0\0\0\0\xff\xff\xff\xff\0\0\0h\0\xff\xff\xff\0\0\0\x3\0\0\0\0\0\0\0\0\xfc\x1\0\0\0\x1\xfb\0\0\0\x1a\0\x44\0o\0\x63\0k\0\x42\0o\0o\0k\0m\0\x61\0r\0k\0s\0\0\0\0\0\xff\xff\xff\xff\0\0\x1\x42\0\xff\xff\xff\0\0\0\0\0\0\0\0\0\0\0\x1\0\0\0\x2\0\0\0\b\0\0\0\x2\xfc\0\0\0\x1\0\0\0\x2\0\0\0\x1\0\0\0\x16\0m\0\x61\0i\0n\0T\0o\0o\0l\0\x42\0\x61\0r\x1\0\0\0\0\xff\xff\xff\xff\0\0\0\0\0\0\0\0)
23 |
24 | [input]
25 | antenna=TX/RX
26 | device="name=MyB210,product=B210,serial=3189F57,type=b200,uhd"
27 | frequency=400004900
28 | gains=@Variant(\0\0\0\b\0\0\0\x1\0\0\0\x6\0P\0G\0\x41\0\0\0\x2\0\0\x2\xc1)
29 | hwagc=true
30 | sample_rate=80000
31 |
32 | [receiver]
33 | demod=7
34 | filter_high_cut=1900
35 | filter_low_cut=100
36 | offset=4900
37 |
38 | [remote_control]
39 | allowed_hosts=::ffff:127.0.0.1
40 |
--------------------------------------------------------------------------------
/docs/images/overview.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eurecom-s3/noise-sdr/06e12a0baa35f3e0defc2727516706c97dd77419/docs/images/overview.jpg
--------------------------------------------------------------------------------
/docs/images/overview2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eurecom-s3/noise-sdr/06e12a0baa35f3e0defc2727516706c97dd77419/docs/images/overview2.jpg
--------------------------------------------------------------------------------
/docs/images/thor22-rtty45-psk125r-3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eurecom-s3/noise-sdr/06e12a0baa35f3e0defc2727516706c97dd77419/docs/images/thor22-rtty45-psk125r-3.jpg
--------------------------------------------------------------------------------
/fldigi-noise-sdr/Makefile:
--------------------------------------------------------------------------------
1 | # Giovanni Camurati
2 | # NDK android-ndk-r21d for Arm-V7A and Arm-V8A
3 | # Clang 3.6.2 for x86
4 | # minggw-x64 for windows
5 | # toolchain-mips_34kc_gcc-5.3.0_musl-1.1.14 for MIPS
6 | # Makefile inpired from https://spin.atomicobject.com/2016/08/26/makefile-c-projects/
7 | # and drammer https://github.com/vusec/drammer
8 |
9 | ARCH ?= v8
10 | OP ?= CIVAC
11 | DEBUG ?= false
12 | OS ?= linux
13 |
14 | ifeq ($(strip $(ARCH)),v8)
15 |
16 | TARGET_ARCH=aarch64-linux-android
17 | LEAKY_OP=-DLEAKY_OP_$(OP)
18 | API=21
19 | TOOLCHAIN=${NDK}/toolchains/llvm/prebuilt/linux-x86_64/bin/${TARGET_ARCH}${API}-
20 | SRC_DIRS=./src/fldigi-noise-sdr ./src/fldigi ./src/libion
21 | LDDFLAGS = -lstdc++ --static
22 | CC=${TOOLCHAIN}clang
23 | CXX=${TOOLCHAIN}clang++
24 | LD=${TOOLCHAIN}llvm-link
25 | INSTALL=adb push $(BUILD_DIR)/$(TARGET_EXEC) /data/local/tmp/
26 |
27 | else ifeq ($(strip $(ARCH)),v7)
28 |
29 | TARGET_ARCH=armv7a-linux-androideabi
30 | OP=ION
31 | LEAKY_OP=-DLEAKY_OP_$(OP)
32 | API=21
33 | TOOLCHAIN=${NDK}/toolchains/llvm/prebuilt/linux-x86_64/bin/${TARGET_ARCH}${API}-
34 | SRC_DIRS=./src/fldigi-noise-sdr ./src/fldigi ./src/libion
35 | LDDFLAGS = -lstdc++ --static
36 | CC=${TOOLCHAIN}clang
37 | CXX=${TOOLCHAIN}clang++
38 | LD=${TOOLCHAIN}llvm-link
39 | INSTALL=adb push $(BUILD_DIR)/$(TARGET_EXEC) /data/local/tmp/
40 |
41 | else ifeq ($(strip $(ARCH)),x86)
42 |
43 | ifeq ($(strip $(OS)),linux)
44 | OP=STREAM
45 | LEAKY_OP=-DLEAKY_OP_$(OP)
46 | TOOLCHAIN=
47 | SRC_DIRS=./src/fldigi-noise-sdr ./src/fldigi
48 | LDDFLAGS = -lstdc++ --static -lpthread
49 | CC=${TOOLCHAIN}clang
50 | CXX=${TOOLCHAIN}clang++
51 | LD=${TOOLCHAIN}llvm-link
52 | INSTALL=
53 | else ifeq ($(strip $(OS)),windows)
54 | OP=STREAM
55 | LEAKY_OP=-DLEAKY_OP_$(OP)
56 | TOOLCHAIN=
57 | SRC_DIRS=./src/fldigi-noise-sdr ./src/fldigi
58 | LDDFLAGS = -lstdc++ --static -lpthread
59 | CC=x86_64-w64-mingw32-gcc-posix
60 | CXX=x86_64-w64-mingw32-g++-posix
61 | LD=x86_64-w64-mingw32-ld
62 | INSTALL=
63 | endif
64 |
65 | else ifeq ($(strip $(ARCH)),mips)
66 |
67 | TARGET_ARCH=mips-openwrt-linux
68 | #OP=CNT
69 | OP=CNT
70 | LEAKY_OP=-DLEAKY_OP_$(OP)
71 | SMALL=-DSMALL
72 | TOOLCHAIN=${TOOLCHAIN_MIPS}/bin/${TARGET_ARCH}-
73 | SRC_DIRS=./src/fldigi-noise-sdr ./src/fldigi
74 | LDDFLAGS = -lstdc++ -lgcc_pic --static
75 | CC=${TOOLCHAIN}gcc
76 | CXX=${TOOLCHAIN}g++
77 | LD=${TOOLCHAIN}ld
78 | INSTALL=scp $(BUILD_DIR)/$(TARGET_EXEC) carambola:/home/carambola/
79 | ARCHFLAGS=-march=mips32r2
80 |
81 | endif
82 |
83 | ifeq ($(strip $(OS)),windows)
84 | TARGET_EXEC=fldigi-noise-sdr-$(ARCH)-$(OP).exe
85 | else
86 | TARGET_EXEC=fldigi-noise-sdr-$(ARCH)-$(OP)
87 | endif
88 |
89 | BUILD_DIR ?= ./build
90 |
91 | SRCS := $(shell find $(SRC_DIRS) -name *.cxx -or -name *.c -or -name *.s)
92 | OBJS := $(SRCS:%=$(BUILD_DIR)/%.o)
93 | DEPS := $(OBJS:.o=.d)
94 |
95 | INC_DIRS := $(shell find $(SRC_DIRS) -type d)
96 | INC_FLAGS := $(addprefix -I,$(INC_DIRS))
97 |
98 | HAVE = -DHAVE_STRCASESTR -DHAVE_SETENV
99 | CFLAGS ?= -O3 -Wall $(ARCHFLAGS) $(HAVE) $(LEAKY_OP) $(SMALL) $(INC_FLAGS) -MMD -MP
100 | CXXFLAGS ?= -std=c++11 $(CFLAGS)
101 |
102 | ifeq ($(strip $(DEBUG)),true)
103 | CFLAGS += -ggdb3
104 | CXXFLAGS += -ggdb3
105 | endif
106 |
107 | # https://stackoverflow.com/questions/51602926/how-to-rebuild-when-the-recipe-has-changed
108 | ALLFLAGS=$(ARCH)$(OS)$(OP)$(API)$(CFLAGS)$(CXXFLAGS)$(ASFLAGS)$(LDDFLAGS)
109 | BUILT_MARKER := $(BUILD_DIR)/$(shell echo $(ALLFLAGS) | md5sum | head -c 32).built
110 |
111 | $(BUILD_DIR)/$(TARGET_EXEC): $(OBJS)
112 | @echo $(INC_DIRS)
113 | $(CXX) $(OBJS) -o $@ $(LDDFLAGS)
114 |
115 | $(BUILT_MARKER):
116 | @echo $(BUILT_MARKER)
117 | @mkdir -p $(BUILD_DIR)
118 | @-rm -f $(BUILD_DIR)/*.built
119 | @touch $(BUILT_MARKER)
120 |
121 | # assembly
122 | $(BUILD_DIR)/%.s.o: %.s $(BUILT_MARKER)
123 | $(MKDIR_P) $(dir $@)
124 | $(AS) $(ASFLAGS) -c $< -o $@
125 |
126 | # c source
127 | $(BUILD_DIR)/%.c.o: %.c $(BUILT_MARKER)
128 | $(MKDIR_P) $(dir $@)
129 | $(CC) $(CFLAGS) -c $< -o $@
130 |
131 | # c++ source
132 | $(BUILD_DIR)/%.cxx.o: %.cxx $(BUILT_MARKER)
133 | $(MKDIR_P) $(dir $@)
134 | $(CXX) $(CXXFLAGS) -c $< -o $@
135 |
136 | .PHONY: clean install
137 |
138 | install: $(BUILD_DIR)/$(TARGET_EXEC) $(BUILT_MARKER)
139 | $(INSTALL)
140 | #adb push $(BUILD_DIR)/$(TARGET_EXEC) /data/local/tmp/
141 |
142 | clean:
143 | $(RM) -r $(BUILD_DIR)
144 |
145 | -include $(DEPS)
146 |
147 | MKDIR_P ?= mkdir -p
148 |
--------------------------------------------------------------------------------
/fldigi-noise-sdr/src/fldigi-noise-sdr/include/AndFlmsg_Fldigi_Interface.h:
--------------------------------------------------------------------------------
1 | #ifndef ANDFLMSG_FLDIGI_INTERFACE_H
2 | #define ANDFLMSG_FLDIGI_INTERFACE_H
3 |
4 |
5 | #include "rsid.h"
6 |
7 | using std::string;
8 |
9 | extern modem *active_modem;
10 |
11 | extern void txModulate(double *buffer, int len);
12 | extern void put_rx_char(int receivedChar);
13 | extern void put_echo_char(unsigned int txedChar);
14 | extern int get_tx_char();
15 | extern bool getNewAmplReady();
16 | extern void updateWaterfallBuffer(double *processedFft);
17 | extern string getPreferenceS2(string preferenceString, string defaultValue);
18 | extern int getPreferenceI(string preferenceString, int defaultValue);
19 | extern double getPreferenceD(string preferenceString, double defaultValue);
20 | extern bool getPreferenceB(string preferenceString, bool defaultValue);
21 | extern void change_CModem(int newMode, double newFrequency, double wpm,
22 | double cwrisetime, int rtty_baud, bool rtty_shaped);
23 | extern void androidShowRxViewer(int picW, int picH);
24 | extern void androidSaveLastPicture();
25 | extern void androidUpdateRxPic(int data, int pos);
26 |
27 | extern int modem_txInit(double frequency);
28 | extern int modem_createModem(int modemCode, double wpm, double cwrisetime,
29 | int rtty_baud, bool rtty_shaped);
30 | extern void modem_destroyModem();
31 | extern int modem_createRsidModem(double wpm, double cwrisetime, int rtty_baud,
32 | bool rtty_shaped);
33 | extern void modem_destroyRsidModem();
34 | extern void modem_txRSID();
35 | extern int modem_txCProcess(signed char *buffer, int length);
36 | extern void RFPWM(bool forever, char *buffile, char *rfpwmfile);
37 |
38 | #endif
39 |
--------------------------------------------------------------------------------
/fldigi-noise-sdr/src/fldigi/include/ascii.h:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------
2 | // ascii.h -- ASCII table
3 | //
4 | // Copyright (C) 2006
5 | // Dave Freese, W1HKJ
6 | //
7 | // This file is part of fldigi. Adapted from code contained in gmfsk source code
8 | // distribution.
9 | // gmfsk Copyright (C) 2001, 2002, 2003
10 | // Tomi Manninen (oh2bns@sral.fi)
11 | //
12 | // This file is part of fldigi.
13 | //
14 | // Fldigi is free software: you can redistribute it and/or modify
15 | // it under the terms of the GNU General Public License as published by
16 | // the Free Software Foundation, either version 3 of the License, or
17 | // (at your option) any later version.
18 | //
19 | // Fldigi is distributed in the hope that it will be useful,
20 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
21 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 | // GNU General Public License for more details.
23 | //
24 | // You should have received a copy of the GNU General Public License
25 | // along with fldigi. If not, see .
26 | // ----------------------------------------------------------------------------
27 |
28 | #ifndef ASCII_H
29 | #define ASCII_H
30 |
31 | extern const char *ascii[];
32 | extern const char *ascii2[];
33 | extern const char *ascii3[];
34 |
35 | #define SOH 0x01 // SOH ascii character
36 | #define EOT 0x04 // EOT ascii character
37 |
38 | #endif
39 |
--------------------------------------------------------------------------------
/fldigi-noise-sdr/src/fldigi/include/complex.h:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------
2 | // complex.h -- Complex arithmetic
3 | //
4 | // Copyright (C) 2006-2008
5 | // Dave Freese, W1HKJ
6 | // Copyright (C) 2008
7 | // Stelios Bounanos, M0GLD
8 | //
9 | // This file is part of fldigi.
10 | //
11 | // Fldigi is free software: you can redistribute it and/or modify
12 | // it under the terms of the GNU General Public License as published by
13 | // the Free Software Foundation, either version 3 of the License, or
14 | // (at your option) any later version.
15 | //
16 | // Fldigi is distributed in the hope that it will be useful,
17 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | // GNU General Public License for more details.
20 | //
21 | // You should have received a copy of the GNU General Public License
22 | // along with fldigi. If not, see .
23 | // ----------------------------------------------------------------------------
24 |
25 | #ifndef _COMPLEX_H
26 | #define _COMPLEX_H
27 |
28 | #define _USE_MATH_DEFINES
29 | #include
30 |
31 | class cmplx {
32 | public:
33 | double re;
34 | double im;
35 | cmplx(double r = 0.0, double i = 0.0)
36 | : re(r), im(i) { }
37 |
38 | double real() { return re; };
39 | void real(double R) {re = R;};
40 | double imag() { return im; };
41 | void imag(double I) {im = I;};
42 |
43 | // Z = X * Y
44 | cmplx& operator*=(const cmplx& y) {
45 | double temp = re * y.re - im * y.im;
46 | im = re * y.im + im * y.re;
47 | re = temp;
48 | return *this;
49 | }
50 | cmplx operator*(const cmplx& y) const {
51 | return cmplx(re * y.re - im * y.im, re * y.im + im * y.re);
52 | }
53 |
54 | // Z = X * y
55 | cmplx& operator*=(double y) {
56 | re *= y;
57 | im *= y;
58 | return *this;
59 | }
60 | cmplx operator*(double y) const {
61 | return cmplx(re * y, im * y);
62 | }
63 |
64 | // Z = X + Y
65 | cmplx& operator+=(const cmplx& y) {
66 | re += y.re;
67 | im += y.im;
68 | return *this;
69 | }
70 | cmplx operator+(const cmplx& y) const {
71 | return cmplx(re + y.re, im + y.im);
72 | }
73 |
74 | // Z = X - Y
75 | cmplx& operator-=(const cmplx& y) {
76 | re -= y.re;
77 | im -= y.im;
78 | return *this;
79 | }
80 | cmplx operator-(const cmplx& y) const {
81 | return cmplx(re - y.re, im - y.im);
82 | }
83 |
84 | // Z = X / Y
85 | cmplx& operator/=(const cmplx& y) {
86 | double temp, denom = y.re*y.re + y.im*y.im;
87 | if (denom == 0.0) denom = 1e-10;
88 | temp = (re * y.re + im * y.im) / denom;
89 | im = (im * y.re - re * y.im) / denom;
90 | re = temp;
91 | return *this;
92 | }
93 | cmplx operator/(const cmplx& y) const {
94 | double denom = y.re*y.re + y.im*y.im;
95 | if (denom == 0.0) denom = 1e-10;
96 | return cmplx((re * y.re + im * y.im) / denom, (im * y.re - re * y.im) / denom);
97 | }
98 |
99 | // Z = (cmplx conjugate of X) * Y
100 | // Z1 = x1 + jy1, or Z1 = |Z1|exp(jP1)
101 | // Z2 = x2 + jy2, or Z2 = |Z2|exp(jP2)
102 | // Z = (x1 - jy1) * (x2 + jy2)
103 | // or Z = |Z1|*|Z2| exp (j (P2 - P1))
104 | cmplx& operator%=(const cmplx& y) {
105 | double temp = re * y.re + im * y.im;
106 | im = re * y.im - im * y.re;
107 | re = temp;
108 | return *this;
109 | }
110 | cmplx operator%(const cmplx& y) const {
111 | cmplx z;
112 | z.re = re * y.re + im * y.im;
113 | z.im = re * y.im - im * y.re;
114 | return z;
115 | }
116 |
117 | // n = |Z| * |Z|
118 | double norm() const {
119 | return (re * re + im * im);
120 | }
121 |
122 | // n = |Z|
123 | double mag() const {
124 | return sqrt(norm());
125 | }
126 |
127 | // Z = x + jy
128 | // Z = |Z|exp(jP)
129 | // arg returns P
130 | double arg() const {
131 | return atan2(im, re);
132 | }
133 |
134 | };
135 |
136 | inline cmplx cmac (const cmplx *a, const cmplx *b, int ptr, int len) {
137 | cmplx z;
138 | ptr %= len;
139 | for (int i = 0; i < len; i++) {
140 | z += a[i] * b[ptr];
141 | ptr = (ptr + 1) % len;
142 | }
143 | return z;
144 | }
145 |
146 |
147 | #endif
148 |
--------------------------------------------------------------------------------
/fldigi-noise-sdr/src/fldigi/include/contestia.h:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------
2 | // contestia.h
3 | //
4 | // Copyright (C) 2006-2010
5 | // Dave Freese, W1HKJ
6 | //
7 | // This file is part of fldigi.
8 | //
9 | // Fldigi is free software: you can redistribute it and/or modify
10 | // it under the terms of the GNU General Public License as published by
11 | // the Free Software Foundation, either version 3 of the License, or
12 | // (at your option) any later version.
13 | //
14 | // Fldigi is distributed in the hope that it will be useful,
15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | // GNU General Public License for more details.
18 | //
19 | // You should have received a copy of the GNU General Public License
20 | // along with fldigi. If not, see .
21 | // ----------------------------------------------------------------------------
22 |
23 | #ifndef _CONTESTIA_H
24 | #define _CONTESTIA_H
25 |
26 | #include "modem.h"
27 | #include "jalocha/pj_mfsk.h"
28 | //Android
29 | //#include "sound.h"
30 | #include "complex.h"
31 |
32 | #define TONE_DURATION (SCBLOCKSIZE * 16)
33 | #define SR4 ((TONE_DURATION) / 4)
34 |
35 | class contestia : public modem {
36 | private:
37 |
38 | MFSK_Transmitter < double >*Tx;
39 | MFSK_Receiver < double >*Rx;
40 |
41 | double *txfbuffer;
42 | int txbufferlen;
43 |
44 | double phaseacc;
45 | cmplx prevsymbol;
46 | int preamble;
47 | unsigned int shreg;
48 |
49 | double np;
50 | double sp;
51 | double sigpwr;
52 | double noisepwr;
53 |
54 | int escape;
55 | int smargin;
56 | int sinteg;
57 | int tones;
58 | int bw;
59 | double tone_bw;
60 |
61 | int preamblesent;
62 | int postamblesent;
63 | double preamblephase;
64 |
65 | double txbasefreq;
66 | double tone_midfreq;
67 | double lastfreq;
68 |
69 | double ampshape[SR4];
70 | double tonebuff[TONE_DURATION];
71 |
72 | double nco(double freq);
73 | void send_tones();
74 |
75 | public:
76 | //Android contestia(trx_mode omode = MODE_CONTESTIA);
77 | contestia(int omode = MODE_CONTESTIA);
78 | ~contestia();
79 | void init();
80 | void rx_init();
81 | void rx_flush();
82 | void tx_init();
83 | void restart();
84 | //Android int rx_process(const double *buf, int len);
85 | int rx_process(const short *buf, int len);
86 | int tx_process();
87 | int unescape(int c);
88 | };
89 |
90 |
91 | #endif
92 |
--------------------------------------------------------------------------------
/fldigi-noise-sdr/src/fldigi/include/debug.h:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------
2 | // debug.h
3 | //
4 | // Copyright (C) 2008
5 | // Stelios Bounanos, M0GLD
6 | //
7 | // This file is part of fldigi.
8 | //
9 | // fldigi is free software; you can redistribute it and/or modify
10 | // it under the terms of the GNU General Public License as published by
11 | // the Free Software Foundation; either version 3 of the License, or
12 | // (at your option) any later version.
13 | //
14 | // fldigi is distributed in the hope that it will be useful,
15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | // GNU General Public License for more details.
18 | //
19 | // You should have received a copy of the GNU General Public License
20 | // along with this program. If not, see .
21 | // ----------------------------------------------------------------------------
22 |
23 | #ifndef _DEBUG_H_
24 | #define _DEBUG_H_
25 |
26 | #define DEBUG_PSKMAIL 1
27 |
28 | #include "util.h"
29 |
30 | class debug
31 | {
32 | public:
33 | enum level_e {
34 | QUIET_LEVEL, ERROR_LEVEL, WARN_LEVEL, INFO_LEVEL,
35 | VERBOSE_LEVEL, DEBUG_LEVEL, LOG_NLEVELS
36 | };
37 | enum source_e {
38 | LOG_ARQCONTROL = 1 << 0, LOG_AUDIO = 1 << 1, LOG_MODEM = 1 << 2,
39 | LOG_RIGCONTROL = 1 << 3, LOG_RPC = 1 << 4, LOG_SPOTTER = 1 << 5,
40 | LOG_OTHER = 1 << 6
41 | };
42 | static void start(const char* filename);
43 | static void stop(void);
44 | static void log(level_e level, const char* func, const char* srcf, int line,
45 | const char* format, ...) format__(printf, 5, 6);
46 | static void elog(const char* func, const char* srcf, int line, const char* text);
47 | static void rotate_log(const char* filename);
48 | static void show(void);
49 | static level_e level;
50 | static uint32_t mask;
51 | private:
52 | static void sync_text(void*);
53 | debug(const char* filename);
54 | debug(const debug&);
55 | debug& operator=(const debug&);
56 | ~debug();
57 | static debug* inst;
58 | };
59 |
60 | #define LOG(level__, source__, ...) \
61 | do { \
62 | if (level__ <= debug::level && source__ & debug::mask) \
63 | debug::log(level__, __func__, __FILE__, __LINE__, __VA_ARGS__); \
64 | } while (0)
65 |
66 | #define LOG_DEBUG(...) LOG(debug::DEBUG_LEVEL, log_source_, __VA_ARGS__)
67 | #define LOG_VERBOSE(...) LOG(debug::VERBOSE_LEVEL, log_source_, __VA_ARGS__)
68 | #define LOG_INFO(...) LOG(debug::INFO_LEVEL, log_source_, __VA_ARGS__)
69 | #define LOG_WARN(...) LOG(debug::WARN_LEVEL, log_source_, __VA_ARGS__)
70 | #define LOG_ERROR(...) LOG(debug::ERROR_LEVEL, log_source_, __VA_ARGS__)
71 |
72 | #define LOG_PERROR(msg__) \
73 | do { \
74 | if (debug::ERROR_LEVEL <= debug::level && log_source_ & debug::mask) \
75 | debug::elog(__func__, __FILE__, __LINE__, msg__); \
76 | } while (0)
77 |
78 | unused__ static uint32_t log_source_ = debug::LOG_OTHER;
79 | #if defined(__GNUC__) && (__GNUC__ >= 3)
80 | # define LOG_FILE_SOURCE(source__) \
81 | __attribute__((constructor)) \
82 | static void log_set_source_(void) { log_source_ = source__; }
83 | #else
84 | # define LOG_FILE_SOURCE(source__)
85 | #endif
86 |
87 | #define LOG_SET_SOURCE(source__) log_source_ = source__
88 |
89 | extern bool debug_pskmail;
90 | extern bool debug_audio;
91 |
92 | #endif // _DEBUG_H_
93 |
94 | // Local Variables:
95 | // mode: c++
96 | // c-file-style: "linux"
97 | // End:
98 |
--------------------------------------------------------------------------------
/fldigi-noise-sdr/src/fldigi/include/dominoex.h:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------
2 | // dominoex.h -- DominoEX modem
3 | //
4 | // Copyright (C) 2001, 2002, 2003
5 | // Tomi Manninen (oh2bns@sral.fi)
6 | // Copyright (C) 2006
7 | // Hamish Moffatt (hamish@debian.org)
8 | // Copyright (C) 2006
9 | // David Freese (w1hkj@w1hkj.com)
10 | //
11 | // Fldigi is free software: you can redistribute it and/or modify
12 | // it under the terms of the GNU General Public License as published by
13 | // the Free Software Foundation, either version 3 of the License, or
14 | // (at your option) any later version.
15 | //
16 | // Fldigi is distributed in the hope that it will be useful,
17 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | // GNU General Public License for more details.
20 | //
21 | // You should have received a copy of the GNU General Public License
22 | // along with fldigi. If not, see .
23 | // ----------------------------------------------------------------------------
24 |
25 | #ifndef _DOMINOEX_H
26 | #define _DOMINOEX_H
27 |
28 | #include
29 |
30 | #include "complex.h"
31 | #include "modem.h"
32 | #include "filters.h"
33 | #include "fftfilt.h"
34 | #include "dominovar.h"
35 | //Android #include "mbuffer.h"
36 |
37 | // NASA coefficients for viterbi encode/decode algorithms
38 | #define K 7
39 | #define POLY1 0x6d
40 | #define POLY2 0x4f
41 |
42 | //#include "mfskvaricode.h"
43 | #include "interleave.h"
44 | #include "viterbi.h"
45 |
46 | #define NUMTONES 18
47 | #define MAXFFTS 8
48 | #define BASEFREQ 1000.0
49 | #define FIRSTIF 1500.0
50 |
51 | #define SCOPESIZE 64
52 |
53 | struct domrxpipe {
54 | cmplx vector[MAXFFTS * NUMTONES * 6];
55 | };
56 |
57 | class dominoex : public modem {
58 | public:
59 | enum {
60 | TX_STATE_PREAMBLE,
61 | TX_STATE_START,
62 | TX_STATE_DATA,
63 | TX_STATE_END,
64 | TX_STATE_FLUSH
65 | };
66 | protected:
67 | // common variables
68 | double phase[MAXFFTS + 1];
69 | double txphase;
70 | int symlen;
71 | int doublespaced;
72 | double tonespacing;
73 | int counter;
74 | unsigned int twosym;
75 | int paths;
76 | int numbins;
77 | bool slowcpu;
78 | int basetone;
79 | int lotone;
80 | int hitone;
81 | int extones;
82 |
83 | // rx variables
84 | C_FIR_filter *hilbert;
85 | sfft *binsfft[MAXFFTS];
86 | fftfilt *fft;
87 | Cmovavg *vidfilter[SCOPESIZE];
88 | Cmovavg *syncfilter;
89 |
90 | domrxpipe *pipe;
91 | unsigned int pipeptr;
92 | //Android not yet mbuffer scopedata;
93 | //Android not yet mbuffer videodata;
94 |
95 | cmplx currvector;
96 |
97 | int currsymbol;
98 | int prev1symbol;
99 | int prev2symbol;
100 |
101 | double met1;
102 | double met2;
103 | double sig;
104 | double noise;
105 | double s2n;
106 |
107 | int synccounter;
108 |
109 | unsigned char symbolbuf[MAX_VARICODE_LEN];
110 | int symcounter;
111 |
112 | int symbolbit;
113 |
114 | bool filter_reset;
115 | bool staticburst;
116 | bool outofrange;
117 |
118 | // tx variables
119 | int txstate;
120 | int txprevtone;
121 | unsigned int bitshreg;
122 | std::string strSecXmtText;
123 |
124 | // FEC variables
125 | viterbi *MuPskDec;
126 | interleave *MuPskRxinlv;
127 | encoder *MuPskEnc;
128 | interleave *MuPskTxinlv;
129 | int Mu_bitstate;
130 | unsigned char Mu_symbolpair[2];
131 | unsigned int Mu_datashreg;
132 | int Mu_symcounter;
133 |
134 | private:
135 | cmplx mixer(int n, cmplx in);
136 | void recvchar(int c);
137 | void decodesymbol();
138 | void decodeDomino(int c);
139 | int harddecode();
140 | void update_syncscope();
141 | void synchronize();
142 | void afc();
143 | void reset_afc();
144 | void eval_s2n();
145 | void sendtone(int tone, int duration);
146 | void sendsymbol(int sym);
147 | void sendchar(unsigned char c, int secondary);
148 | void sendidle();
149 | void sendsecondary();
150 | void flushtx();
151 | int get_secondary_char();
152 | void reset_filters();
153 | // MultiPsk FEC scheme
154 | // Rx
155 | unsigned int MuPskPriSecChar(unsigned int c);
156 | void decodeMuPskSymbol(unsigned char symbol);
157 | void decodeMuPskEX(int c);
158 | // Tx
159 | unsigned char MuPskSec2Pri(int c);
160 | void sendMuPskEX(unsigned char c, int secondary);
161 | void MuPskClearbits();
162 | void MuPskFlushTx();
163 | void MuPsk_sec2pri_init(void);
164 | public:
165 | //Android
166 | //dominoex (trx_mode md);
167 | dominoex (int md);
168 | ~dominoex ();
169 | void init();
170 | void rx_init();
171 | //Android
172 | //void tx_init(SoundBase *sc);
173 | void tx_init();
174 | void restart();
175 | //Android
176 | //int rx_process(const double *buf, int len);
177 | int rx_process(const short *buf, int len);
178 | int tx_process();
179 | };
180 |
181 | #endif
182 |
--------------------------------------------------------------------------------
/fldigi-noise-sdr/src/fldigi/include/dominovar.h:
--------------------------------------------------------------------------------
1 | /*
2 | * varicode.h -- DominoEX Varicode
3 | *
4 | * Copyright (C) 2001, 2002, 2003
5 | * Tomi Manninen (oh2bns@sral.fi)
6 | *
7 | * This file is part of fldigi.
8 | *
9 | * Fldigi is free software: you can redistribute it and/or modify
10 | * it under the terms of the GNU General Public License as published by
11 | * the Free Software Foundation, either version 3 of the License, or
12 | * (at your option) any later version.
13 | *
14 | * Fldigi is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | * GNU General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU General Public License
20 | * along with fldigi. If not, see .
21 | *
22 | */
23 |
24 | #ifndef _DOMVARICODE_H
25 | #define _DOMVARICODE_H
26 |
27 | #define MAX_VARICODE_LEN 3
28 |
29 | extern unsigned char *dominoex_varienc(unsigned char c, int secondary);
30 | extern int dominoex_varidec(unsigned int symbol);
31 |
32 | #endif
33 |
--------------------------------------------------------------------------------
/fldigi-noise-sdr/src/fldigi/include/fft.h:
--------------------------------------------------------------------------------
1 | //===========================================================================
2 | // Real Discrete Fourier Transform
3 | // dimension :one
4 | // data length :power of 2, must be larger than 4
5 | // decimation :frequency
6 | // radix :4, 2
7 | // data :inplace
8 | // classes:
9 | // Cfft: real discrete fourier transform class
10 | // functions:
11 | // Cfft::rdft : compute the forward real discrete fourier transform
12 | // Cfft::cdft : compute the forward complex discrete fourier transform
13 | // Cfft::fft : compute the forward real dft on a set of integer values
14 | //
15 | // This class is derived from the work of Takuya Ooura, who has kindly put his
16 | // fft algorithims in the public domain. Thank you Takuya Ooura!
17 | //===========================================================================
18 |
19 | #ifndef FFT_H
20 | #define FFT_H
21 |
22 | #include "complex.h"
23 |
24 | enum fftPrefilter {FFT_NONE, FFT_HAMMING, FFT_HANNING, FFT_BLACKMAN, FFT_TRIANGULAR};
25 |
26 | class Cfft {
27 | private:
28 | double xi;
29 | double *w;
30 | int *ip;
31 | double *fftwin;
32 | fftPrefilter wintype;
33 | int fftlen;
34 | int fftsiz;
35 | void makewt();
36 | void makect();
37 | void bitrv2(int n, int *ip, double *a);
38 | void bitrv2conj(int n, int *ip, double *a);
39 | void cftfsub(int n, double *a);
40 | void cftbsub(int n, double *a);
41 | void cftmdl(int n, int l, double *a);
42 | void cft1st(int n, double *a);
43 | void rftfsub(int n, double *a);
44 | void rftbsub(int n, double *a);
45 |
46 | public:
47 | Cfft(int n);
48 | ~Cfft();
49 | void resize(int n);
50 | void cdft(double *a);
51 | //Android void cdft(complex *a) { cdft( (double *) a); }
52 | void cdft(cmplx *a) { cdft( (double *) a); }
53 | void icdft(double *a);
54 | //Android void icdft(complex *a) { icdft( (double *) a); }
55 | void icdft(cmplx *a) { icdft( (double *) a); }
56 | void sifft(short int *siData, double *out);
57 | //Android void sifft(short int *siData, complex *a) { sifft(siData, (double *) a); }
58 | void sifft(short int *siData, cmplx *a) { sifft(siData, (double *) a); }
59 | void rdft(double *a);
60 | //Android void rdft(complex *a) { rdft( (double *) a); }
61 | void rdft(cmplx *a) { rdft( (double *) a); }
62 | void irdft(double *a);
63 | //Android void irdft(complex *a) { irdft( (double *) a); }
64 | void irdft(cmplx *a) { irdft( (double *) a); }
65 |
66 | void setWindow(fftPrefilter pf);
67 | };
68 |
69 | #endif
70 |
--------------------------------------------------------------------------------
/fldigi-noise-sdr/src/fldigi/include/fftfilt.h:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------
2 | // Copyright (C) 2014
3 | // David Freese, W1HKJ
4 | //
5 | // This file is part of fldigi
6 | //
7 | // fldigi is free software; you can redistribute it and/or modify
8 | // it under the terms of the GNU General Public License as published by
9 | // the Free Software Foundation; either version 3 of the License, or
10 | // (at your option) any later version.
11 | //
12 | // fldigi is distributed in the hope that it will be useful,
13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | // GNU General Public License for more details.
16 | //
17 | // You should have received a copy of the GNU General Public License
18 | // along with this program. If not, see .
19 | // ----------------------------------------------------------------------------
20 |
21 | #ifndef _FFTFILT_H
22 | #define _FFTFILT_H
23 |
24 | #include "complex.h"
25 | //Android #include "gfft.h"
26 | #include "fft.h"
27 |
28 | //----------------------------------------------------------------------
29 |
30 | class fftfilt {
31 | enum {NONE, BLACKMAN, HAMMING, HANNING};
32 |
33 | protected:
34 | int flen;
35 | int flen2;
36 | //Android g_fft *fft;
37 | Cfft *fft;
38 | //Android g_fft *ift;
39 | Cfft *ift;
40 |
41 | cmplx *ht;
42 | cmplx *filter;
43 | cmplx *timedata;
44 | cmplx *freqdata;
45 | cmplx *ovlbuf;
46 | cmplx *output;
47 | int inptr;
48 | int pass;
49 | int window;
50 |
51 | inline double fsinc(double fc, int i, int len) {
52 | return (i == len/2) ? 2.0 * fc:
53 | sin(2 * M_PI * fc * (i - len/2)) / (M_PI * (i - len/2));
54 | }
55 | inline double _blackman(int i, int len) {
56 | return (0.42 -
57 | 0.50 * cos(2.0 * M_PI * i / len) +
58 | 0.08 * cos(4.0 * M_PI * i / len));
59 | }
60 | void init_filter();
61 |
62 | public:
63 | fftfilt(double f1, double f2, int len);
64 | fftfilt(double f, int len);
65 | ~fftfilt();
66 | // f1 < f2 ==> bandpass
67 | // f1 > f2 ==> band reject
68 | void create_filter(double f1, double f2);
69 | void create_lpf(double f) {
70 | create_filter(0, f);
71 | }
72 | void create_hpf(double f) {
73 | create_filter(f, 0);
74 | }
75 | void rtty_filter(double);
76 |
77 | int run(const cmplx& in, cmplx **out);
78 | };
79 |
80 | #endif
81 |
--------------------------------------------------------------------------------
/fldigi-noise-sdr/src/fldigi/include/filters.h:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------
2 | //
3 | // filters.h -- Several Digital Filter classes used in fldigi
4 | //
5 | // Copyright (C) 2006-2008
6 | // Dave Freese, W1HKJ
7 | //
8 | // This file is part of fldigi. These filters are based on the
9 | // gmfsk design and the design notes given in
10 | // "Digital Signal Processing", A Practical Guid for Engineers and Scientists
11 | // by Steven W. Smith.
12 | //
13 | // Fldigi is free software: you can redistribute it and/or modify
14 | // it under the terms of the GNU General Public License as published by
15 | // the Free Software Foundation, either version 3 of the License, or
16 | // (at your option) any later version.
17 | //
18 | // Fldigi is distributed in the hope that it will be useful,
19 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
20 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 | // GNU General Public License for more details.
22 | //
23 | // You should have received a copy of the GNU General Public License
24 | // along with fldigi. If not, see .
25 | // ----------------------------------------------------------------------------
26 |
27 |
28 | #ifndef _FILTER_H
29 | #define _FILTER_H
30 |
31 | #include "complex.h"
32 |
33 | //=====================================================================
34 | // FIR filters
35 | //=====================================================================
36 |
37 | class C_FIR_filter {
38 | #define FIRBufferLen 4096
39 | private:
40 | int length;
41 | int decimateratio;
42 |
43 | double *ifilter;
44 | double *qfilter;
45 |
46 | double ffreq;
47 |
48 | double ibuffer[FIRBufferLen];
49 | double qbuffer[FIRBufferLen];
50 |
51 | int pointer;
52 | int counter;
53 |
54 | cmplx fu;
55 |
56 | inline double sinc(double x) {
57 | if (fabs(x) < 1e-10)
58 | return 1.0;
59 | else
60 | return sin(M_PI * x) / (M_PI * x);
61 | }
62 | inline double cosc(double x) {
63 | if (fabs(x) < 1e-10)
64 | return 0.0;
65 | else
66 | return (1.0 - cos(M_PI * x)) / (M_PI * x);
67 | }
68 | inline double hamming(double x) {
69 | return 0.54 - 0.46 * cos(2 * M_PI * x);
70 | }
71 | inline double mac(const double *a, const double *b, unsigned int size) {
72 | double sum = 0.0;
73 | double sum2 = 0.0;
74 | double sum3 = 0.0;
75 | double sum4 = 0.0;
76 | // Reduces read-after-write dependencies : Each subsum does not wait for the others.
77 | // The CPU can therefore schedule each line independently.
78 | for (; size > 3; size -= 4, a += 4, b+=4)
79 | {
80 | sum += a[0] * b[0];
81 | sum2 += a[1] * b[1];
82 | sum3 += a[2] * b[2];
83 | sum4 += a[3] * b[3];
84 | }
85 | for (; size; --size)
86 | sum += (*a++) * (*b++);
87 | return sum + sum2 + sum3 + sum4 ;
88 | }
89 |
90 | protected:
91 |
92 | public:
93 | C_FIR_filter ();
94 | ~C_FIR_filter ();
95 | void init (int len, int dec, double *ifil, double *qfil);
96 | void init_lowpass (int len, int dec, double freq );
97 | void init_bandpass (int len, int dec, double freq1, double freq2);
98 | void init_hilbert (int len, int dec);
99 | double *bp_FIR(int len, int hilbert, double f1, double f2);
100 | void dump();
101 | int run (const cmplx &in, cmplx &out);
102 | int Irun (const double &in, double &out);
103 | int Qrun (const double &in, double &out);
104 | };
105 |
106 | //=====================================================================
107 | // Moving average filter
108 | //=====================================================================
109 |
110 | class Cmovavg {
111 | #define MAXMOVAVG 2048
112 | private:
113 | double *in;
114 | double out;
115 | int len, pint;
116 | bool empty;
117 | public:
118 | Cmovavg(int filtlen);
119 | ~Cmovavg();
120 | double run(double a);
121 | void setLength(int filtlen);
122 | void reset();
123 | double value() { return out / (len > 0 ? len : 1); }
124 | };
125 |
126 |
127 | //=====================================================================
128 | // Sliding FFT
129 | //=====================================================================
130 |
131 | class sfft {
132 | #define K1 0.99999999999L
133 | private:
134 | int fftlen;
135 | int first;
136 | int last;
137 | int ptr;
138 | struct vrot_bins_pair ;
139 | vrot_bins_pair * __restrict__ vrot_bins ;
140 | cmplx * __restrict__ delay;
141 | double k2;
142 | int count;
143 | public:
144 | sfft(int len, int first, int last);
145 | ~sfft();
146 | bool is_stable();
147 | void reset();
148 | void run(const cmplx& input, cmplx * __restrict__ result, int stride );
149 | };
150 |
151 |
152 |
153 | //=============================================================================
154 | // Goertzel DFT
155 | //=============================================================================
156 |
157 | class goertzel {
158 | private:
159 | int N;
160 | int count;
161 | double Q0;
162 | double Q1;
163 | double Q2;
164 | double k1;
165 | double k2;
166 | double k3;
167 | bool isvalid;
168 | public:
169 | goertzel(int n, double freq, double sr);
170 | ~goertzel();
171 | void reset();
172 | void reset(int n, double freq, double sr);
173 | bool run(double v);
174 | double real();
175 | double imag();
176 | double mag();
177 | };
178 |
179 | #endif /* _FILTER_H */
180 |
--------------------------------------------------------------------------------
/fldigi-noise-sdr/src/fldigi/include/interleave.h:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------
2 | // interleave.h -- MFSK (de)interleaver
3 | //
4 | // Copyright (C) 2006
5 | // Dave Freese, W1HKJ
6 | //
7 | // This file is part of fldigi. Adapted from code contained in gmfsk source code
8 | // distribution.
9 | // gmfsk Copyright (C) 2001, 2002, 2003
10 | // Tomi Manninen (oh2bns@sral.fi)
11 | //
12 | // Fldigi is free software: you can redistribute it and/or modify
13 | // it under the terms of the GNU General Public License as published by
14 | // the Free Software Foundation, either version 3 of the License, or
15 | // (at your option) any later version.
16 | //
17 | // Fldigi is distributed in the hope that it will be useful,
18 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 | // GNU General Public License for more details.
21 | //
22 | // You should have received a copy of the GNU General Public License
23 | // along with fldigi. If not, see .
24 | // ----------------------------------------------------------------------------
25 |
26 | #ifndef _INTERLEAVE_H
27 | #define _INTERLEAVE_H
28 |
29 | #define INTERLEAVE_FWD 0
30 | #define INTERLEAVE_REV 1
31 | #define PUNCTURE 128
32 |
33 | class interleave
34 | {
35 | protected:
36 | int size;
37 | int depth;
38 | int len;
39 | int direction;
40 | unsigned char *table;
41 | unsigned char *tab(int i, int j, int k) {
42 | return &table[(size * size * i) + (size * j) + k];
43 | }
44 |
45 | public:
46 | interleave(int _size, int depth, int dir);
47 | ~interleave();
48 | void symbols (unsigned char *psyms);
49 | void bits (unsigned int *pbits);
50 | void flush();
51 | };
52 |
53 | // ----------------------------------------------------------------------------
54 |
55 | #endif
56 |
--------------------------------------------------------------------------------
/fldigi-noise-sdr/src/fldigi/include/jalocha/pj_cmpx.h:
--------------------------------------------------------------------------------
1 |
2 | // Complex numbers
3 | // (c) 1999-2003, Pawel Jalocha
4 |
5 | #ifndef __CMPX_H__
6 | #define __CMPX_H__
7 |
8 | #include
9 | #define _USE_MATH_DEFINES
10 | #include
11 |
12 | // ----------------------------------------------------------------------------
13 | // float/double/other-complex type
14 |
15 | template
16 | class Cmpx
17 | {
18 | public:
19 | Type Re,Im;
20 |
21 | public:
22 | template
23 | Cmpx const &operator=(const Cmpx &New)
24 | { Re=New.Re; Im=New.Im; return (*this); }
25 | template
26 | Cmpx const &operator=(const Type2 &New)
27 | { Re=New; Im=0; return (*this); }
28 | template
29 | void Set(Type2 NewRe, Type2 NewIm=0) { Re=NewRe; Im=NewIm; }
30 | template
31 | void Set(Cmpx New) { Re=New.Re; Im=New.Im; }
32 | void SetPhase(double Phase, double Mag=1.0) { Re=Mag*cos(Phase); Im=Mag*sin(Phase); }
33 | void Conugate(void) { Im=(-Im); }
34 | void Negate(void) { Re=(-Re); Im=(-Im); }
35 | void QuarterTurnLeft(void) { Type OldIm=Im; Im=Re; Re=(-OldIm); }
36 | void QuarterTurnRight(void) { Type OldIm=Im; Im=(-Re); Re=OldIm; }
37 | double Energy(void) { return Re*Re+Im*Im; }
38 | double Mag2(void) { return Re*Re+Im*Im; }
39 | double Mag(void) { return sqrt(Re*Re+Im*Im); }
40 | double Phase(void) { return atan2(Im,Re); }
41 | int Zero(void) { return (Re==0)&&(Im==0); }
42 | int NotZero(void) { return (Re!=0)||(Im!=0); }
43 | // template
44 | // void operator *= (const Type2 Mult)
45 | // { Re*=Mult; Im*=Mult; }
46 | // template
47 | // void operator /= (const Type2 Mult)
48 | // { Re*=Mult; Im*=Mult; }
49 | template
50 | double VectDotProd(Cmpx X) { return Re*X.Re+Im*X.Im; }
51 | void Print(char *Form="%+6.3f")
52 | { printf("["); printf(Form,Re); printf(","); printf(Form,Im); printf("]"); }
53 | } ;
54 |
55 | typedef Cmpx fcmpx;
56 | typedef Cmpx dcmpx;
57 |
58 | // Some complex operators:
59 | // at least with the BC++ they carry some overhead because
60 | // a function is always called instead of making the code inline.
61 |
62 | template // equal (both Re and Im) ?
63 | inline int operator ==(Cmpx &Left, Cmpx &Right)
64 | { return (Left.Re==Right.Re)&&(Left.Im==Right.Im); }
65 |
66 | template // equal (both Re and Im) ?
67 | inline int operator !=(Cmpx &Left, Cmpx &Right)
68 | { return (Left.Re!=Right.Re)||(Left.Im!=Right.Im); }
69 |
70 | template // equal ?
71 | inline int operator ==(Cmpx &Left, type &Right)
72 | { return (Left.Re==Right)&&(Left.Im==0); }
73 |
74 | template // not equal ?
75 | inline int operator !=(Cmpx &Left, RightType &Right)
76 | { return (Left.Re!=Right)||(Left.Im!=0); }
77 |
78 | template // bigger (magnitude) ?
79 | inline int operator >(Cmpx &Left, Cmpx &Right)
80 | { return Left.Mag2() > Right.Mag2(); }
81 |
82 | template // smaller (magnitude) ?
83 | inline int operator <(Cmpx &Left, Cmpx &Right)
84 | { return Left.Mag2() < Right.Mag2(); }
85 |
86 | template // addition to the argument on the left
87 | inline void operator +=(Cmpx &Dst, Cmpx &Src)
88 | { Dst.Re+=Src.Re; Dst.Im+=Src.Im; }
89 |
90 | template // subtraction from the argument on the left
91 | inline void operator -=(Cmpx &Dst, Cmpx &Src)
92 | { Dst.Re-=Src.Re; Dst.Im-=Src.Im; }
93 |
94 | template // multiplication by a scalar
95 | inline void operator *=(Cmpx &Dst, num Src)
96 | { Dst.Re*=Src; Dst.Im*=Src; }
97 |
98 | template // multiplication by another complex number
99 | inline void operator *=(Cmpx &Dst, Cmpx Src)
100 | { type Re=Dst.Re*Src.Re-Dst.Im*Src.Im;
101 | type Im=Dst.Re*Src.Im+Dst.Im*Src.Re;
102 | Dst.Re=Re; Dst.Im=Im; }
103 |
104 | template // division by a scalar
105 | inline void operator /=(Cmpx &Dst, num Src)
106 | { Dst.Re/=Src; Dst.Im/=Src; }
107 |
108 | template // scalar multiplication
109 | inline double operator *(Cmpx &Left, Cmpx &Right)
110 | { return Left.Re*Right.Re+Left.Im*Right.Im; }
111 |
112 | // some arithmetic functions:
113 |
114 | // scalar product of two vectors
115 | template
116 | inline double ScalProd(Cmpx &A, Cmpx &B)
117 | { return A.Re*B.Re+A.Im*B.Im; }
118 |
119 | template
120 | inline double ScalProd(typeA Ia, typeA Qa, Cmpx &B)
121 | { return Ia*B.Re+Qa*B.Im; }
122 |
123 | // complex multiply
124 | template
125 | inline void CmpxMultAxB(Cmpx &Dst, Cmpx &A, Cmpx &B)
126 | { Dst.Re=A.Re*B.Re-A.Im*B.Im;
127 | Dst.Im=A.Re*B.Im+A.Im*B.Re; }
128 |
129 | template
130 | inline void CmpxMultAxB(typeDst &DstI, typeDst &DstQ, Cmpx &A, Cmpx &B)
131 | { DstI=A.Re*B.Re-A.Im*B.Im;
132 | DstQ=A.Re*B.Im+A.Im*B.Re; }
133 |
134 | // complex multiply, second argument with a "star" (B.im is negated)
135 | // (effectively subtracts the phase of the second argument)
136 | template
137 | inline void CmpxMultAxBs(Cmpx &Dst, Cmpx &A, Cmpx &B)
138 | { Dst.Re=A.Re*B.Re+A.Im*B.Im;
139 | Dst.Im=A.Im*B.Re-A.Re*B.Im; }
140 |
141 | template
142 | void CmpxSqrt(Cmpx &X)
143 | { Type Mag=X.Mag(); int NegIm=(X.Im<0);
144 | X.Im=sqrt((Mag-X.Re)/2);
145 | X.Re=sqrt((Mag+X.Re)/2);
146 | if(NegIm) X.Re=(-X.Re); }
147 |
148 | template
149 | void CmpxSquare(Cmpx &X)
150 | { Type Re=X.Re*X.Re-X.Im*X.Im;
151 | X.Im=2*X.Re*X.Im;
152 | X.Re=Re; }
153 |
154 | // ----------------------------------------------------------------------------
155 |
156 | #endif /* __CMPX_H__ */
157 |
--------------------------------------------------------------------------------
/fldigi-noise-sdr/src/fldigi/include/jalocha/pj_fht.h:
--------------------------------------------------------------------------------
1 | // Fast Hadamard Transform, Pawel Jalocha, December 2004
2 |
3 | #ifndef __FHT_H__
4 | #define __FHT_H__
5 |
6 | // Forward Fast Hadamard Transform
7 |
8 | template // Type can be float, Cmpx<>, int8_t, etc.
9 | void FHT(Type *Data, size_t Len)
10 | { size_t Step, Ptr, Ptr2; Type Bit1, Bit2, NewBit1, NewBit2;
11 | for(Step=1; Step
26 | void IFHT(Type *Data, size_t Len)
27 | { size_t Step, Ptr, Ptr2; Type Bit1, Bit2, NewBit1, NewBit2;
28 | for(Step=Len/2; Step; Step/=2)
29 | { for(Ptr=0; Ptr
9 | class FIFO
10 | { public:
11 |
12 | size_t Len;
13 |
14 | private:
15 |
16 | size_t ReadPtr;
17 | size_t WritePtr;
18 | Type *Data;
19 |
20 | public:
21 |
22 | FIFO()
23 | { Init(); }
24 |
25 | ~FIFO()
26 | { free(Data); }
27 |
28 | void Init(void)
29 | { Data=0; Len=0; }
30 |
31 | void Free(void)
32 | { free(Data); Data=0; Len=0; }
33 |
34 | void Reset(void)
35 | { ReadPtr=WritePtr=0; }
36 |
37 | void Clear(void)
38 | { ReadPtr=WritePtr; }
39 |
40 | int Preset(void)
41 | { if(ReallocArray(&Data,Len)<0) return -1;
42 | Reset(); return 0; }
43 |
44 | // increment the pointer (with wrapping around)
45 | void IncrPtr(size_t &Ptr, size_t Step=1)
46 | { Ptr+=Step; if(Ptr>=Len) Ptr-=Len; }
47 |
48 | // FIFO is full ?
49 | int Full(void)
50 | { size_t Ptr=WritePtr; IncrPtr(Ptr);
51 | return (Ptr==ReadPtr); }
52 |
53 | // FIFO is empty ?
54 | int Empty(void)
55 | { return (ReadPtr==WritePtr); }
56 |
57 | // how many elements we can write = space left in the FIFO
58 | size_t WriteReady(void)
59 | { int Ready=ReadPtr-WritePtr;
60 | if(Ready<=0) Ready+=Len;
61 | return Ready-1; }
62 |
63 | // how many elements we can read = space taken in the FIFO
64 | size_t ReadReady(void)
65 | { int Ready=WritePtr-ReadPtr;
66 | if(Ready<0) Ready+=Len;
67 | return Ready; }
68 |
69 | // write a new element
70 | int Write(Type &NewData)
71 | { size_t Ptr=WritePtr; IncrPtr(Ptr);
72 | if(Ptr==ReadPtr) return 0;
73 | Data[WritePtr]=NewData;
74 | WritePtr=Ptr; return 1; }
75 |
76 | // read the oldest element
77 | int Read(Type &OldData)
78 | { if(ReadPtr==WritePtr) return 0;
79 | OldData=Data[ReadPtr]; IncrPtr(ReadPtr); return 1; }
80 |
81 | // lookup data in the FIFO but without taking them out
82 | int Lookup(Type &OldData, size_t Offset=0)
83 | { size_t Ready=ReadReady(); if(Offset>=Ready) return 0;
84 | size_t Ptr=ReadPtr; IncrPtr(Ptr,Offset);
85 | OldData=Data[Ptr]; return 1; }
86 | } ;
87 |
88 | /*
89 | // FIFO buffer for batches of data (incomplete)
90 | template
91 | class WideFIFO
92 | { public:
93 |
94 | size_t Width;
95 | size_t Len;
96 | size_t ReadPtr;
97 | size_t WritePtr;
98 | size_t Size;
99 | Type *Data;
100 |
101 | public:
102 |
103 | WideFIFO()
104 | { Init(); }
105 |
106 | ~WideFIFO()
107 | { free(Data); }
108 |
109 | void Init(void)
110 | { Data=0; Size=0; }
111 |
112 | void Free(void)
113 | { free(Data); Data=0; Size=0; }
114 |
115 | // reset: set pointers to the beginning of the buffer
116 | void Reset(void)
117 | { ReadPtr=WritePtr=0; }
118 |
119 | // preset for given length and width
120 | int Preset(size_t NewLen, size_t NewWidth)
121 | { Width=NewWidth;
122 | Len=NewLen;
123 | Size=Width*Len;
124 | if(ReallocArray(&Data,Size)<0) return -1;
125 | Reset(); return 0; }
126 |
127 | // increment the pointer (with wrapping around)
128 | void IncrPtr(size_t &Ptr, size_t Step=1)
129 | { Ptr+=Step; if(Ptr>=Len) Ptr-=Len; }
130 |
131 | int Full(void)
132 | { Ptr=WritePtr; Incr(Ptr);
133 | return (Ptr==ReadPtr); }
134 |
135 | int Empty(void)
136 | { return (ReadPtr==WritePtr); }
137 |
138 | int Write(Type *DataBatch)
139 | { }
140 |
141 | int Read(Type *DataBatch)
142 | { }
143 | } ;
144 | */
145 |
146 | #endif // of __FIFO_H__
147 |
--------------------------------------------------------------------------------
/fldigi-noise-sdr/src/fldigi/include/jalocha/pj_gray.h:
--------------------------------------------------------------------------------
1 | // Gray code convertion
2 | // (c) 2004, Pawel Jalocha
3 |
4 | #ifndef __GRAY_H__
5 | #define __GRAY_H__
6 |
7 | #include
8 |
9 | template
10 | Type GrayCode(Type Binary)
11 | { return Binary ^ (Binary>>1); }
12 |
13 | inline uint8_t BinaryCode(uint8_t Gray)
14 | { Gray ^= (Gray>>4);
15 | Gray ^= (Gray>>2);
16 | Gray ^= (Gray>>1);
17 | return Gray; }
18 |
19 | inline uint16_t BinaryCode(uint16_t Gray)
20 | { Gray ^= (Gray>>8);
21 | Gray ^= (Gray>>4);
22 | Gray ^= (Gray>>2);
23 | Gray ^= (Gray>>1);
24 | return Gray; }
25 |
26 | inline uint32_t BinaryCode(uint32_t Gray)
27 | { Gray ^= (Gray>>16);
28 | Gray ^= (Gray>>8);
29 | Gray ^= (Gray>>4);
30 | Gray ^= (Gray>>2);
31 | Gray ^= (Gray>>1);
32 | return Gray; }
33 |
34 | #endif
35 |
--------------------------------------------------------------------------------
/fldigi-noise-sdr/src/fldigi/include/jalocha/pj_lowpass3.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef __LOWPASS3_H__
3 | #define __LOWPASS3_H__
4 |
5 | // ==========================================================================
6 |
7 | // IIR low pass filter for integration (averaging) purposes
8 | // Overshoot is about 1% for Feedback=0.5, and about 1e-6 for Feedback=0.1
9 | // Weight is 1 / PeakingTime
10 |
11 | template
12 | class LowPass3_Filter
13 | {
14 | public:
15 | Type Out1, Out2, Output;
16 | template
17 | void Process(InpType Inp, WeightType Weight, WeightType Feedback = 0.1)
18 | {
19 | Weight *= 2.0;
20 | Type DiffI1 = Inp; DiffI1 -= Out1;
21 | Type Diff12 = Out1; Diff12 -= Out2;
22 | Type Diff23 = Out2; Diff23 -= Output;
23 | DiffI1 *= Weight; Out1 += DiffI1;
24 | Diff12 *= Weight; Out2 += Diff12;
25 | Diff23 *= Weight; Output += Diff23;
26 | Diff23 *= Feedback; Out2 += Diff23;
27 | }
28 | template
29 | void operator = (LevelType Level)
30 | {
31 | Out1 = Level;
32 | Out2 = Level;
33 | Output=Level;
34 | }
35 | template
36 | void Set(LevelType Level=0)
37 | {
38 | Out1 = Level;
39 | Out2 = Level;
40 | Output=Level;
41 | }
42 | };
43 |
44 |
45 | // ==========================================================================
46 |
47 | #endif // of __LOWPASS3_H__
48 |
49 |
--------------------------------------------------------------------------------
/fldigi-noise-sdr/src/fldigi/include/lora.h:
--------------------------------------------------------------------------------
1 | /* -*- c++ -*- */
2 | /*
3 | * Copyright 2019 Joachim Tapparel TCL@EPFL.
4 | *
5 | * This is free software; you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation; either version 3, or (at your option)
8 | * any later version.
9 | *
10 | * This software is distributed in the hope that it will be useful,
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | * GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this software; see the file COPYING. If not, write to
17 | * the Free Software Foundation, Inc., 51 Franklin Street,
18 | * Boston, MA 02110-1301, USA.
19 | *
20 | * Modified by Giovanni Camurati to make it a library for fldigi-noise-sdr
21 | *
22 | */
23 |
24 | #ifndef _LORA_H
25 | #define _LORA_H
26 |
27 | #include
28 | #include "modem.h"
29 | //#include "complex.h"
30 |
31 | #define MAX_PKT_SIZE 255
32 | #define HEADER_SIZE 5
33 | #define CRC_SIZE 4
34 |
35 | const unsigned int whitening_seq[] = {
36 | 0xFF, 0xFE, 0xFC, 0xF8, 0xF0, 0xE1, 0xC2, 0x85, 0x0B, 0x17, 0x2F, 0x5E,
37 | 0xBC, 0x78, 0xF1, 0xE3, 0xC6, 0x8D, 0x1A, 0x34, 0x68, 0xD0, 0xA0, 0x40,
38 | 0x80, 0x01, 0x02, 0x04, 0x08, 0x11, 0x23, 0x47, 0x8E, 0x1C, 0x38, 0x71,
39 | 0xE2, 0xC4, 0x89, 0x12, 0x25, 0x4B, 0x97, 0x2E, 0x5C, 0xB8, 0x70, 0xE0,
40 | 0xC0, 0x81, 0x03, 0x06, 0x0C, 0x19, 0x32, 0x64, 0xC9, 0x92, 0x24, 0x49,
41 | 0x93, 0x26, 0x4D, 0x9B, 0x37, 0x6E, 0xDC, 0xB9, 0x72, 0xE4, 0xC8, 0x90,
42 | 0x20, 0x41, 0x82, 0x05, 0x0A, 0x15, 0x2B, 0x56, 0xAD, 0x5B, 0xB6, 0x6D,
43 | 0xDA, 0xB5, 0x6B, 0xD6, 0xAC, 0x59, 0xB2, 0x65, 0xCB, 0x96, 0x2C, 0x58,
44 | 0xB0, 0x61, 0xC3, 0x87, 0x0F, 0x1F, 0x3E, 0x7D, 0xFB, 0xF6, 0xED, 0xDB,
45 | 0xB7, 0x6F, 0xDE, 0xBD, 0x7A, 0xF5, 0xEB, 0xD7, 0xAE, 0x5D, 0xBA, 0x74,
46 | 0xE8, 0xD1, 0xA2, 0x44, 0x88, 0x10, 0x21, 0x43, 0x86, 0x0D, 0x1B, 0x36,
47 | 0x6C, 0xD8, 0xB1, 0x63, 0xC7, 0x8F, 0x1E, 0x3C, 0x79, 0xF3, 0xE7, 0xCE,
48 | 0x9C, 0x39, 0x73, 0xE6, 0xCC, 0x98, 0x31, 0x62, 0xC5, 0x8B, 0x16, 0x2D,
49 | 0x5A, 0xB4, 0x69, 0xD2, 0xA4, 0x48, 0x91, 0x22, 0x45, 0x8A, 0x14, 0x29,
50 | 0x52, 0xA5, 0x4A, 0x95, 0x2A, 0x54, 0xA9, 0x53, 0xA7, 0x4E, 0x9D, 0x3B,
51 | 0x77, 0xEE, 0xDD, 0xBB, 0x76, 0xEC, 0xD9, 0xB3, 0x67, 0xCF, 0x9E, 0x3D,
52 | 0x7B, 0xF7, 0xEF, 0xDF, 0xBF, 0x7E, 0xFD, 0xFA, 0xF4, 0xE9, 0xD3, 0xA6,
53 | 0x4C, 0x99, 0x33, 0x66, 0xCD, 0x9A, 0x35, 0x6A, 0xD4, 0xA8, 0x51, 0xA3,
54 | 0x46, 0x8C, 0x18, 0x30, 0x60, 0xC1, 0x83, 0x07, 0x0E, 0x1D, 0x3A, 0x75,
55 | 0xEA, 0xD5, 0xAA, 0x55, 0xAB, 0x57, 0xAF, 0x5F, 0xBE, 0x7C, 0xF9, 0xF2,
56 | 0xE5, 0xCA, 0x94, 0x28, 0x50, 0xA1, 0x42, 0x84, 0x09, 0x13, 0x27, 0x4F,
57 | 0x9F, 0x3F, 0x7F};
58 |
59 | class lora : public modem {
60 | private:
61 | int txstate;
62 | int payload_cnt;
63 | int len;
64 | int len_i;
65 | bool end;
66 | unsigned int payload[MAX_PKT_SIZE];
67 | unsigned int payload_w[2 * MAX_PKT_SIZE];
68 | int data[HEADER_SIZE + 2 * MAX_PKT_SIZE + CRC_SIZE];
69 | int data_i[8 * (HEADER_SIZE + 2 * MAX_PKT_SIZE + CRC_SIZE)];
70 |
71 | bool implicit_header;
72 | bool has_crc;
73 | bool simple;
74 | int sf;
75 | int cr;
76 | double bw;
77 |
78 | unsigned int number_of_bins; ///< number of bin per loar symbol
79 | double symbols_per_second; ///< lora symbols per second
80 | unsigned int samples_per_symbol; ///< samples per symbols(Works only for 2^sf)
81 |
82 | std::vector upchirp; ///< reference upchirp
83 | std::vector downchirp; ///< reference downchirp
84 | std::vector symbol; ///< reference downchirp
85 |
86 | unsigned int n_up; ///< number of upchirps in the preamble
87 | uint32_t symb_cnt; ///< counter of the number of lora symbols sent
88 |
89 | void simple_enc();
90 | void whithen();
91 | void add_header();
92 | void compute_header(int *data);
93 | unsigned int crc16(unsigned int crcValue, unsigned char newByte);
94 | void add_crc();
95 | void hamming_enc();
96 | void interleave();
97 | void gray_enc();
98 | double get_phase(unsigned int i, unsigned int id);
99 | inline void build_ref_chirps(double *upchirp, double *downchirp);
100 | inline void build_upchirp(double *upchirp, uint32_t id);
101 | void modulate();
102 |
103 | public:
104 | enum {
105 | TX_STATE_GET_PAYLOAD,
106 | TX_STATE_PROCESS_PKT,
107 | TX_STATE_END,
108 | };
109 |
110 | lora(int loramode);
111 | ~lora();
112 | void init();
113 | void rx_init();
114 | void tx_init();
115 | void restart();
116 | int rx_process(const short *, int );
117 | int tx_process();
118 | };
119 |
120 | #endif
121 |
--------------------------------------------------------------------------------
/fldigi-noise-sdr/src/fldigi/include/mfskvaricode.h:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------
2 | // mfskvaricode.h -- MFSK Varicode
3 | //
4 | // Copyright (C) 2006
5 | // Dave Freese, W1HKJ
6 | //
7 | // This file is part of fldigi. Adapted from code contained in gmfsk source code
8 | // distribution.
9 | //
10 | // Fldigi is free software: you can redistribute it and/or modify
11 | // it under the terms of the GNU General Public License as published by
12 | // the Free Software Foundation, either version 3 of the License, or
13 | // (at your option) any later version.
14 | //
15 | // Fldigi is distributed in the hope that it will be useful,
16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | // GNU General Public License for more details.
19 | //
20 | // You should have received a copy of the GNU General Public License
21 | // along with fldigi. If not, see .
22 | // ----------------------------------------------------------------------------
23 |
24 | #ifndef _MFSKVARICODE_H
25 | #define _MFSKVARICODE_H
26 |
27 | extern const char *varienc(int c);
28 | extern int varidec(unsigned int symbol);
29 |
30 | #endif
31 |
--------------------------------------------------------------------------------
/fldigi-noise-sdr/src/fldigi/include/misc.h:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------
2 | // misc.h -- Miscellaneous helper functions
3 | //
4 | // Copyright (C) 2006-2008
5 | // Dave Freese, W1HKJ
6 | //
7 | // This file is part of fldigi. These filters were adapted from code contained
8 | // in the gmfsk source code distribution.
9 | //
10 | // Fldigi is free software: you can redistribute it and/or modify
11 | // it under the terms of the GNU General Public License as published by
12 | // the Free Software Foundation, either version 3 of the License, or
13 | // (at your option) any later version.
14 | //
15 | // Fldigi is distributed in the hope that it will be useful,
16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | // GNU General Public License for more details.
19 | //
20 | // You should have received a copy of the GNU General Public License
21 | // along with fldigi. If not, see .
22 | // ----------------------------------------------------------------------------
23 |
24 | #ifndef _MISC_H
25 | #define _MISC_H
26 |
27 | #define _USE_MATH_DEFINES
28 | #include
29 |
30 | extern unsigned long hweight32(unsigned long w);
31 | extern unsigned short int hweight16(unsigned short int w);
32 | extern unsigned char hweight8(unsigned char w);
33 | extern int parity(unsigned long w);
34 | extern unsigned long rbits32(unsigned long w);
35 | extern unsigned short int rbits16(unsigned short int w);
36 | extern unsigned char rbits8(unsigned char w);
37 |
38 | extern unsigned int log2u(unsigned int x);
39 |
40 | extern unsigned char graydecode(unsigned char data);
41 | extern unsigned char grayencode(unsigned char data);
42 | //Android conflict with util.h definition extern void MilliSleep(long msecs);
43 |
44 | inline double sinc(double x)
45 | {
46 | return (fabs(x) < 1e-10) ? 1.0 : (sin(M_PI * x) / (M_PI * x));
47 | }
48 |
49 | inline double cosc(double x)
50 | {
51 | return (fabs(x) < 1e-10) ? 0.0 : ((1.0 - cos(M_PI * x)) / (M_PI * x));
52 | }
53 |
54 | inline double clamp(double x, double min, double max)
55 | {
56 | return (x < min) ? min : ((x > max) ? max : x);
57 | }
58 |
59 | /// This is always called with an int weight
60 | inline double decayavg(double average, double input, int weight)
61 | {
62 | if (weight <= 1) return input;
63 | return ( ( input - average ) / (double)weight ) + average ;
64 | }
65 |
66 | // following are defined inline to provide best performance
67 | inline double blackman(double x)
68 | {
69 | return (0.42 - 0.50 * cos(2 * M_PI * x) + 0.08 * cos(4 * M_PI * x));
70 | }
71 |
72 | inline double hamming(double x)
73 | {
74 | return 0.54 - 0.46 * cos(2 * M_PI * x);
75 | }
76 |
77 | inline double hanning(double x)
78 | {
79 | return 0.5 - 0.5 * cos(2 * M_PI * x);
80 | }
81 |
82 | inline double rcos( double t, double T, double alpha=1.0 )
83 | {
84 | if( t == 0 ) return 1.0;
85 | double taT = T / (2.0 * alpha);
86 | if( fabs(t) == taT ) return ((alpha/2.0) * sin(M_PI/(2.0*alpha)));
87 | return (sin(M_PI*t/T)/(M_PI*t/T))*cos(alpha*M_PI*t/T)/(1.0-(t/taT)*(t/taT));
88 | }
89 |
90 | // Rectangular - no pre filtering of data array
91 | void RectWindow(double *array, int n);
92 | // Hamming - used by gmfsk
93 | void HammingWindow(double *array, int n);
94 | // Hanning - used by winpsk
95 | void HanningWindow(double *array, int n);
96 | // Best lob suppression - least in band ripple
97 | void BlackmanWindow(double *array, int n);
98 | // Simple about effective as Hamming or Hanning
99 | void TriangularWindow(double *array, int n);
100 |
101 | #endif
102 |
--------------------------------------------------------------------------------
/fldigi-noise-sdr/src/fldigi/include/morse.h:
--------------------------------------------------------------------------------
1 | /*
2 | * morse.h -- morse code tables
3 | *
4 | * Copyright (C) 2017
5 | *
6 | * Fldigi is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Fldigi is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with fldigi. If not, see .
18 | *
19 | */
20 |
21 | #ifndef _MORSE_H
22 | #define _MORSE_H
23 |
24 | #include
25 |
26 | #define MorseTableSize 256
27 |
28 | #define CW_DOT_REPRESENTATION '.'
29 | #define CW_DASH_REPRESENTATION '-'
30 |
31 | struct CWstruct {
32 | bool enabled; // true if character is active
33 | std::string chr; // utf-8 string representation of character
34 | std::string prt; // utf-8 printable representation
35 | std::string rpr; // Dot-dash code representation
36 | };
37 |
38 | class cMorse {
39 | private:
40 | static CWstruct cw_table[];
41 | std::string utf8;
42 | std::string toprint;
43 | int ptr;
44 | public:
45 | cMorse() {
46 | init();
47 | }
48 | ~cMorse() {
49 | }
50 | void init();
51 | void enable(std::string, bool);
52 | std::string rx_lookup(std::string);
53 | std::string tx_lookup(int);
54 | std::string tx_print() { return toprint; }
55 | int tx_length(int);
56 | };
57 |
58 | #endif
59 |
--------------------------------------------------------------------------------
/fldigi-noise-sdr/src/fldigi/include/mt63.h:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------
2 | // mt63.h
3 | //
4 | // Copyright (C) 2006-2009
5 | // Dave Freese, W1HKJ
6 | //
7 | // This file is part of fldigi. Adapted from code contained in gmfsk source code
8 | // distribution.
9 | // Copyright (C) 2005
10 | // Tomi Manninen (oh2bns@sral.fi)
11 | //
12 | // Fldigi is free software: you can redistribute it and/or modify
13 | // it under the terms of the GNU General Public License as published by
14 | // the Free Software Foundation, either version 3 of the License, or
15 | // (at your option) any later version.
16 | //
17 | // Fldigi is distributed in the hope that it will be useful,
18 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 | // GNU General Public License for more details.
21 | //
22 | // You should have received a copy of the GNU General Public License
23 | // along with fldigi. If not, see .
24 | // ----------------------------------------------------------------------------
25 |
26 | #ifndef MT63_MODEM_H
27 | #define MT63_MODEM_H
28 |
29 | #include "dsp.h"
30 | #include "mt63base.h"
31 | #include "modem.h"
32 |
33 |
34 | class mt63 : public modem {
35 | private:
36 | int Interleave;
37 | int flush;
38 | int escape;
39 | bool long_integral;
40 |
41 | MT63tx *Tx;
42 | MT63rx *Rx;
43 |
44 | dspLevelMonitor *InpLevel;
45 | double_buff *InpBuff;
46 | double_buff *emptyBuff;
47 | bool flushbuffer;
48 | double FEC_offset;
49 | double FEC_snr;
50 |
51 | public:
52 | //Android mt63(trx_mode mode);
53 | mt63(int mode);
54 | ~mt63();
55 | void init();
56 | void rx_init();
57 | //Android void tx_init(SoundBase*);
58 | void tx_init();
59 | void restart();
60 | //Android buffer is array of shorts now int rx_process(const double *buf, int len);
61 | int rx_process(const short *buf, int len);
62 | int tx_process();
63 |
64 | void rx_flush();
65 | void set_freq(double);
66 | };
67 |
68 |
69 | #endif
70 |
--------------------------------------------------------------------------------
/fldigi-noise-sdr/src/fldigi/include/olivia.h:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------
2 | // olivia.h
3 | //
4 | // Copyright (C) 2006-2010
5 | // Dave Freese, W1HKJ
6 | //
7 | // This file is part of fldigi. Adapted from code contained in gmfsk source code
8 | // distribution.
9 | // Copyright (C) 2005
10 | // Tomi Manninen (oh2bns@sral.fi)
11 | //
12 | // This file is part of fldigi.
13 | //
14 | // Fldigi is free software: you can redistribute it and/or modify
15 | // it under the terms of the GNU General Public License as published by
16 | // the Free Software Foundation, either version 3 of the License, or
17 | // (at your option) any later version.
18 | //
19 | // Fldigi is distributed in the hope that it will be useful,
20 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
21 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 | // GNU General Public License for more details.
23 | //
24 | // You should have received a copy of the GNU General Public License
25 | // along with fldigi. If not, see .
26 | // ----------------------------------------------------------------------------
27 |
28 | #ifndef _OLIVIA_H
29 | #define _OLIVIA_H
30 |
31 | #include "modem.h"
32 | #include "jalocha/pj_mfsk.h"
33 | //Android #include "sound.h"
34 | #include "complex.h"
35 |
36 | #define TONE_DURATION (SCBLOCKSIZE * 16)
37 | #define SR4 ((TONE_DURATION) / 4)
38 |
39 | class olivia : public modem {
40 | private:
41 |
42 | MFSK_Transmitter < double >*Tx;
43 | MFSK_Receiver < double >*Rx;
44 |
45 | double *txfbuffer;
46 | int txbufferlen;
47 |
48 | double phaseacc;
49 | cmplx prevsymbol;
50 | int preamble;
51 | unsigned int shreg;
52 |
53 | double np;
54 | double sp;
55 | double sigpwr;
56 | double noisepwr;
57 |
58 | int escape;
59 | int smargin;
60 | int sinteg;
61 | int tones;
62 | int bw;
63 | double tone_bw;
64 |
65 | int preamblesent;
66 | int postamblesent;
67 | double preamblephase;
68 |
69 | double txbasefreq;
70 | double tone_midfreq;
71 | double lastfreq;
72 |
73 | double ampshape[SR4];
74 | double tonebuff[TONE_DURATION];
75 |
76 | double nco(double freq);
77 | void send_tones();
78 |
79 | public:
80 | //Android olivia(trx_mode omode = MODE_OLIVIA);
81 | olivia(int omode);
82 | ~olivia();
83 | void init();
84 | void rx_init();
85 | void rx_flush();
86 | //Android void tx_init(SoundBase *sc);
87 | void tx_init();
88 | void restart();
89 | //Android int rx_process(const double *buf, int len);
90 | int rx_process(const short *buf, int len);
91 | int tx_process();
92 | int unescape(int c);
93 | };
94 |
95 |
96 | #endif
97 |
--------------------------------------------------------------------------------
/fldigi-noise-sdr/src/fldigi/include/psk.h:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------
2 | // psk.h -- psk modem
3 | //
4 | // Copyright (C) 2006-2008
5 | // Dave Freese, W1HKJ
6 | //
7 | // This file is part of fldigi. Adapted from code contained in gmfsk source code
8 | // distribution.
9 | //
10 | // Fldigi is free software: you can redistribute it and/or modify
11 | // it under the terms of the GNU General Public License as published by
12 | // the Free Software Foundation, either version 3 of the License, or
13 | // (at your option) any later version.
14 | //
15 | // Fldigi is distributed in the hope that it will be useful,
16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | // GNU General Public License for more details.
19 | //
20 | // You should have received a copy of the GNU General Public License
21 | // along with fldigi. If not, see .
22 | // ----------------------------------------------------------------------------
23 |
24 | #ifndef _PSK_H
25 | #define _PSK_H
26 |
27 | #include "complex.h"
28 | #include "modem.h"
29 | //Android test #include "globals.h"
30 | #include "viterbi.h"
31 | #include "filters.h"
32 | #include "pskcoeff.h"
33 | #include "pskvaricode.h"
34 | //Android #include "viewpsk.h"
35 | //Android #include "pskeval.h"
36 | #include "interleave.h"
37 |
38 | //MFSK varicode instead of psk for PSKR modes
39 | #include "mfskvaricode.h"
40 |
41 | //=====================================================================
42 | #define PipeLen (64)
43 |
44 | #define SNTHRESHOLD 6.0
45 | #define AFCDECAYSLOW 8
46 |
47 | #define NUM_FILTERS 3
48 | #define GOERTZEL 288 //96 x 2 must be an integer value
49 |
50 | #define MAX_CARRIERS 32
51 |
52 | //=====================================================================
53 |
54 | class psk : public modem {
55 | private:
56 | // tx & rx
57 | int symbollen;
58 | int symbits;
59 | bool _qpsk;
60 | bool _pskr;
61 | bool _16psk;
62 | bool _8psk;
63 | bool _xpsk;
64 | bool _disablefec;
65 | bool _puncturing;
66 | int flushlength;
67 | double separation;
68 | double phaseacc[MAX_CARRIERS];
69 | cmplx prevsymbol[MAX_CARRIERS];
70 | unsigned int shreg;
71 | //FEC: 2nd stream
72 | unsigned int shreg2;
73 | int numinterleavers; //interleaver size (speed dependant)
74 | //double numcarriers; //Number of parallel carriers for M CAR PSK and PSKR and QPSKR
75 | int numcarriers; //Number of parallel carriers for M CAR PSK and PSKR and QPSKR
76 | double inter_carrier; // Frequency gap betweeb carriers
77 |
78 | // rx variables & functions
79 | C_FIR_filter *fir1[MAX_CARRIERS];
80 | C_FIR_filter *fir2[MAX_CARRIERS];
81 | // C_FIR_filter *fir3;
82 | double *fir1c;
83 | double *fir2c;
84 | Cmovavg *snfilt;
85 | Cmovavg *imdfilt;
86 |
87 | double I1[NUM_FILTERS];
88 | double I2[NUM_FILTERS];
89 | double Q1[NUM_FILTERS];
90 | double Q2[NUM_FILTERS];
91 | double COEF[NUM_FILTERS];
92 | double m_Energy[NUM_FILTERS];
93 | int m_NCount;
94 | bool imdValid;
95 |
96 | encoder *enc;
97 | viterbi *dec;
98 | //PSKR modes - 2nd Viterbi decoder and 2 receive de-interleaver for comparison
99 | viterbi *dec2;
100 | interleave *Rxinlv;
101 | interleave *Rxinlv2;
102 | interleave *Txinlv;
103 | unsigned int bitshreg;
104 | int rxbitstate;
105 | //PSKR modes - Soft decoding
106 | unsigned char symbolpair[2];
107 | double fecmet;
108 | double fecmet2;
109 |
110 | bool vestigial;
111 | int sfft_size;
112 | sfft *vestigial_sfft;
113 | cmplx sfft_bins[11];
114 |
115 | double phase;
116 | double freqerr;
117 | int bits;
118 | double bitclk;
119 | double syncbuf[16];
120 | double scope_pipe[2*PipeLen];//[PipeLen];
121 | unsigned int pipeptr;
122 | unsigned int dcdshreg;
123 | //PSKR modes - 2nd stream
124 | unsigned int dcdshreg2;
125 |
126 | int dcd;
127 | int dcdbits;
128 | cmplx quality;
129 | int acquire;
130 | int idepth;
131 |
132 | //Android viewpsk* pskviewer;
133 | //Android pskeval* evalpsk;
134 |
135 | void rx_symbol(cmplx symbol, int car);
136 | void rx_bit(int bit);
137 | void rx_bit2(int bit);
138 | void rx_qpsk(int bits);
139 | void rx_pskr(unsigned char symbol);
140 | double scopedata[16];
141 | // IMD & s/n variables
142 | double k0, k1, k2;
143 | double I11, I12, I21, I22, I31, I32;
144 | double snratio, s2n, imdratio, imd;
145 | double E1, E2, E3;
146 | double afcmetric;
147 |
148 | //PSKR modes
149 | bool firstbit;
150 | bool startpreamble;
151 |
152 | //PSKR & 8PSK modes
153 | bool PSKviterbi;
154 | double vphase;
155 | double maxamp;
156 |
157 |
158 | //MULTI-CARRIER
159 | double sc_bw; // single carrier bandwidth
160 |
161 |
162 | // cmplx thirdorder;
163 | // tx variables & functions
164 | int accumulated_bits; //JD for multiple carriers
165 | int txsymbols[MAX_CARRIERS];
166 |
167 | double *tx_shape;
168 | int preamble;
169 | void tx_carriers();
170 | void tx_symbol(int sym);
171 | void tx_bit(int bit);
172 | void tx_xpsk(int bit);
173 | void tx_char(unsigned char c);
174 | void tx_flush();
175 | void update_syncscope();
176 | void signalquality();
177 | void findsignal();
178 | void phaseafc();
179 | void afc();
180 | void coreafc();
181 | void vestigial_afc();
182 |
183 | void initSN_IMD();
184 | void resetSN_IMD();
185 | void calcSN_IMD(cmplx z);
186 | //PSKR modes - for Tx interleaver priming
187 | void clearbits();
188 |
189 | protected:
190 | void s2nreport(void);
191 |
192 | public:
193 | //Android not yet psk(trx_mode mode);
194 | psk(int pskmode);
195 | ~psk();
196 | void init();
197 | void rx_init();
198 | //Android void tx_init(SoundBase *sc);
199 | void tx_init();
200 | void restart();
201 | //Android reals now
202 | // int rx_process(const double *buf, int len);
203 | int rx_process(const short *, int );
204 | int tx_process();
205 | void searchDown();
206 | void searchUp();
207 |
208 | /*Android
209 | void clear_viewer() { pskviewer->clear(); }
210 | void clear_ch(int n) { pskviewer->clearch(n); }
211 | int viewer_get_freq(int n) {
212 | if (pskviewer) pskviewer->get_freq(n);
213 | return 0;
214 | }
215 | */
216 |
217 | };
218 |
219 | #endif
220 |
--------------------------------------------------------------------------------
/fldigi-noise-sdr/src/fldigi/include/pskcoeff.h:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------
2 | // Copyright (C) 2014
3 | // David Freese, W1HKJ
4 | //
5 | // This file is part of fldigi
6 | //
7 | // fldigi is free software; you can redistribute it and/or modify
8 | // it under the terms of the GNU General Public License as published by
9 | // the Free Software Foundation; either version 3 of the License, or
10 | // (at your option) any later version.
11 | //
12 | // fldigi is distributed in the hope that it will be useful,
13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | // GNU General Public License for more details.
16 | //
17 | // You should have received a copy of the GNU General Public License
18 | // along with this program. If not, see .
19 | // ----------------------------------------------------------------------------
20 |
21 | #ifndef _COEFF_H
22 | #define _COEFF_H
23 |
24 | #define FIRLEN 64
25 |
26 | extern double gmfir1c[FIRLEN];
27 | extern double gmfir2c[FIRLEN];
28 | extern double syncfilt[16];
29 |
30 | extern void raisedcosfilt(double *);
31 | extern void wsincfilt(double *, double fc, bool blackman);
32 | //Android less taps for slow cpus
33 | extern void wsincfilt32(double *, double fc, bool blackman);
34 |
35 | #endif
36 |
--------------------------------------------------------------------------------
/fldigi-noise-sdr/src/fldigi/include/pskrep.h:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------
2 | // Copyright (C) 2014
3 | // David Freese, W1HKJ
4 | //
5 | // This file is part of fldigi
6 | //
7 | // fldigi is free software; you can redistribute it and/or modify
8 | // it under the terms of the GNU General Public License as published by
9 | // the Free Software Foundation; either version 3 of the License, or
10 | // (at your option) any later version.
11 | //
12 | // fldigi is distributed in the hope that it will be useful,
13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | // GNU General Public License for more details.
16 | //
17 | // You should have received a copy of the GNU General Public License
18 | // along with this program. If not, see .
19 | // ----------------------------------------------------------------------------
20 |
21 | #ifndef PSKREP_H_
22 | #define PSKREP_H_
23 |
24 | bool pskrep_start(void);
25 | void pskrep_stop();
26 | const char* pskrep_error(void);
27 | unsigned pskrep_count(void);
28 |
29 | // The regular expression that matches the spotter's buffer when it calls us.
30 | // It must define at least two capturing groups, the second of which is the
31 | // spotted callsign.
32 | #define CALLSIGN_RE "[[:alnum:]]?[[:alpha:]/]+[[:digit:]]+[[:alnum:]/]+"
33 | #define PSKREP_RE "(de|cq|qrz)[^[:alnum:]/\n]+" "(" CALLSIGN_RE ")" " +(.* +)?\\2[^[:alnum:]]+$"
34 | #define PSKREP_RE_INDEX 2
35 |
36 | #endif // PSKREP_H_
37 |
--------------------------------------------------------------------------------
/fldigi-noise-sdr/src/fldigi/include/pskvaricode.h:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------
2 | // varicode.h -- PSK31 Varicode
3 | //
4 | // Copyright (C) 2006
5 | // Dave Freese, W1HKJ
6 | //
7 | // This file is part of fldigi. Adapted from code contained in gmfsk source code
8 | // distribution.
9 | //
10 | // Fldigi is free software: you can redistribute it and/or modify
11 | // it under the terms of the GNU General Public License as published by
12 | // the Free Software Foundation, either version 3 of the License, or
13 | // (at your option) any later version.
14 | //
15 | // Fldigi is distributed in the hope that it will be useful,
16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | // GNU General Public License for more details.
19 | //
20 | // You should have received a copy of the GNU General Public License
21 | // along with fldigi. If not, see .
22 | // ----------------------------------------------------------------------------
23 |
24 |
25 | #ifndef _VARICODE_H
26 | #define _VARICODE_H
27 |
28 | extern const char *psk_varicode_encode(unsigned char c);
29 | extern int psk_varicode_decode(unsigned int symbol);
30 |
31 | #endif
32 |
--------------------------------------------------------------------------------
/fldigi-noise-sdr/src/fldigi/include/rsid.h:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------
2 | //
3 | // rsid.h
4 | //
5 | // Copyright (C) 2008, 2009
6 | // Dave Freese, W1HKJ
7 | // Copyright (C) 2009
8 | // Stelios Bounanos, M0GLD
9 | // Copyright (C) 2014
10 | // John Douyere, VK2ETA
11 | //
12 | // This file is part of fldigi.
13 | //
14 | // Fldigi is free software: you can redistribute it and/or modify
15 | // it under the terms of the GNU General Public License as published by
16 | // the Free Software Foundation, either version 3 of the License, or
17 | // (at your option) any later version.
18 | //
19 | // Fldigi is distributed in the hope that it will be useful,
20 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
21 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 | // GNU General Public License for more details.
23 | //
24 | // You should have received a copy of the GNU General Public License
25 | // along with fldigi. If not, see .
26 | // ----------------------------------------------------------------------------
27 |
28 | // ----------------------------------------------------------------------------
29 | // Tone separation: 10.766Hz
30 | // Integer tone separator (x 16): 172
31 | // Error on 16 tones: 0.25Hz
32 |
33 | // Tone duration: 0.093 sec
34 | // Tone duration, #samples at 8ksps: 743
35 | // Error on 15 tones: negligible
36 |
37 | // 1024 samples -> 512 tones
38 | // 2048 samples, second half zeros
39 |
40 | // each 512 samples new FFT
41 | // ----------------------------------------------------------------------------
42 |
43 | #ifndef RSID_H
44 | #define RSID_H
45 |
46 | #include
47 |
48 | //Android not yet #include
49 | //Android
50 | #include "complex.h"
51 | //Android #include "ringbuffer.h"
52 | #include "globals.h"
53 | #include "modem.h"
54 | #include "complex.h"
55 | //Android#include "gfft.h"
56 | #include "fft.h"
57 |
58 | #define RSID_SAMPLE_RATE 11025.0
59 |
60 | #define RSID_FFT_SAMPLES 512
61 | #define RSID_FFT_SIZE 1024
62 | #define RSID_ARRAY_SIZE (RSID_FFT_SIZE * 2)
63 | #define RSID_BUFFER_SIZE (RSID_ARRAY_SIZE * 2)
64 |
65 | #define RSID_NSYMBOLS 15
66 | #define RSID_NTIMES (RSID_NSYMBOLS * 2)
67 | #define RSID_PRECISION 2.7 // detected frequency precision in Hz
68 |
69 | // each rsid symbol has a duration equal to 1024 samples at 11025 Hz smpl rate
70 | #define RSID_SYMLEN (1024.0 / RSID_SAMPLE_RATE) // 0.09288 // duration of each rsid symbol
71 |
72 | //Android Moved from rsid.cxx
73 | #define NUM_MODES 9999
74 | //Android new for when a mode does not have a dedicated rsid code
75 | #define NO_RSID 9995
76 |
77 |
78 | enum {
79 | RSID_BANDWIDTH_500 = 0,
80 | RSID_BANDWIDTH_1K,
81 | RSID_BANDWIDTH_WIDE,
82 | };
83 |
84 | typedef double rs_fft_type;
85 | //typedef std::complex rs_cpx_type;
86 | //Android typedef std::complex rs_cpx_type;
87 | typedef cmplx rs_cpx_type;
88 |
89 | //Android struct RSIDs { unsigned short rs; trx_mode mode; const char* name; };
90 | struct RSIDs { unsigned short rs; int mode; const char* name; };
91 |
92 | class cRsId {
93 |
94 | protected:
95 | enum { INITIAL, EXTENDED, WAIT };
96 |
97 | public:
98 |
99 | //Android public access for Java side
100 | static const RSIDs rsid_ids_1[];
101 | static const int rsid_ids_size1;
102 | static const RSIDs rsid_ids_2[];
103 | static const int rsid_ids_size2;
104 |
105 |
106 | private:
107 | // Table of precalculated Reed Solomon symbols
108 | unsigned char *pCodes1;
109 | unsigned char *pCodes2;
110 |
111 | bool found1;
112 | bool found2;
113 |
114 | //Android static const RSIDs rsid_ids_1[];
115 | //Android static const int rsid_ids_size1;
116 | static const int Squares[];
117 | static const int indices[];
118 |
119 | //Android static const RSIDs rsid_ids_2[];
120 | //Android static const int rsid_ids_size2;
121 |
122 | int rsid_secondary_time_out;
123 |
124 | int hamming_resolution;
125 |
126 | int fftCounter;
127 |
128 | // Span of FFT bins, in which the RSID will be searched for
129 | int nBinLow;
130 | int nBinHigh;
131 |
132 | float aInputSamples[RSID_ARRAY_SIZE * 2];
133 | rs_fft_type fftwindow[RSID_ARRAY_SIZE];
134 | //Android using old fft routines rs_cpx_type aFFTReal[RSID_ARRAY_SIZE];
135 | rs_fft_type aFFTReal[RSID_ARRAY_SIZE];
136 | rs_fft_type aFFTAmpl[RSID_FFT_SIZE];
137 |
138 | //Android g_fft *rsfft;
139 | Cfft *rsfft;
140 |
141 | bool bPrevTimeSliceValid;
142 | int iPrevDistance;
143 | int iPrevBin;
144 | int iPrevSymbol;
145 |
146 | int fft_buckets[RSID_NTIMES][RSID_FFT_SIZE];
147 |
148 | bool bPrevTimeSliceValid2;
149 | int iPrevDistance2;
150 | int iPrevBin2;
151 | int iPrevSymbol2;
152 |
153 | // resample
154 | //Android not yet SRC_STATE* src_state;
155 | //Android not yet SRC_DATA src_data;
156 | int inptr;
157 | static long src_callback(void* cb_data, float** data);
158 |
159 | // transmit
160 | double *outbuf;
161 | size_t symlen;
162 | unsigned short rmode;
163 | unsigned short rmode2;
164 |
165 | private:
166 | void Encode(int code, unsigned char *rsid);
167 | // void search(void);
168 | void search(bool doSearch);
169 | void setup_mode(int m);
170 |
171 | void CalculateBuckets(const rs_fft_type *pSpectrum, int iBegin, int iEnd);
172 | inline int HammingDistance(int iBucket, unsigned char *p2);
173 | bool search_amp( int &bin_out, int &symbol_out, unsigned char *pcode_table );
174 | void apply ( int iBin, int iSymbol, int extended );
175 | double wpm;
176 | double cwrisetime;
177 | double rtty_baud;
178 | bool rtty_shaped;
179 |
180 | public:
181 | cRsId(double _wpm, double _cwrisetime, int _rtty_baud, bool _rtty_shaped);
182 | ~cRsId();
183 | void reset();
184 | // void receive(const float* buf, size_t len);
185 | void receive(const float* buf, size_t len, bool doSearch);
186 | void send(bool postidle);
187 | //Android added
188 | void sendThisMode(bool preRSID, int thisMode);
189 | //Android bool assigned(trx_mode mode);
190 | bool assigned(int mode);
191 |
192 | friend void reset_rsid(void *who);
193 | };
194 |
195 | #endif
196 |
--------------------------------------------------------------------------------
/fldigi-noise-sdr/src/fldigi/include/thor.h:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------
2 | // thor.h -- thor modem
3 | //
4 | // Copyright (C) 2008-2012
5 | // David Freese
6 | // John Douyere
7 | // John Phelps
8 | //
9 | // This file is part of fldigi.
10 | //
11 | // Fldigi is free software: you can redistribute it and/or modify
12 | // it under the terms of the GNU General Public License as published by
13 | // the Free Software Foundation, either version 3 of the License, or
14 | // (at your option) any later version.
15 | //
16 | // Fldigi is distributed in the hope that it will be useful,
17 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 | // GNU General Public License for more details.
20 | //
21 | // You should have received a copy of the GNU General Public License
22 | // along with fldigi. If not, see .
23 | // ----------------------------------------------------------------------------
24 |
25 | #ifndef _thor_H
26 | #define _thor_H
27 |
28 | #include
29 |
30 | #include "complex.h"
31 | #include "modem.h"
32 | #include "globals.h"
33 | #include "filters.h"
34 | #include "fftfilt.h"
35 | #include "dominovar.h"
36 | //Not used ???? #include "mbuffer.h"
37 |
38 | // NASA coefficients for viterbi encode/decode algorithms
39 | #define THOR_K 7
40 | #define THOR_POLY1 0x6d
41 | #define THOR_POLY2 0x4f
42 |
43 | //VK2ETA high speed modes
44 | // IEEE coefficients for viterbi encode/decode algorithms
45 | #define THOR_K15 15
46 | #define K15_POLY1 044735
47 | #define K15_POLY2 063057
48 |
49 | //#include "mfskvaricode.h"
50 | #include "interleave.h"
51 |
52 | #include "viterbi.h"
53 |
54 |
55 | #define THORNUMTONES 18
56 | #define THORMAXFFTS 8
57 | #define THORBASEFREQ 1500.0
58 | #define THORFIRSTIF 2000.0
59 |
60 | #define THORSCOPESIZE 64
61 |
62 | #define THORSLOWPATHS 3
63 | #define THORFASTPATHS 5
64 |
65 | // the following constant changes if a mode with more tones than 25x4 is
66 | // created
67 | #define MAXPATHS (8 * THORFASTPATHS * THORNUMTONES )
68 |
69 | struct THORrxpipe {
70 | cmplx vector[THORMAXFFTS * THORNUMTONES * 6];
71 | };
72 |
73 | class thor : public modem {
74 | public:
75 | enum {
76 | TX_STATE_PREAMBLE,
77 | TX_STATE_START,
78 | TX_STATE_DATA,
79 | TX_STATE_END,
80 | TX_STATE_FLUSH
81 | };
82 | protected:
83 | // common variables
84 | double phase[THORMAXFFTS + 1];
85 | double txphase;
86 | int symlen;
87 | int doublespaced;
88 | double tonespacing;
89 | int counter;
90 | unsigned int twosym;
91 | int paths;
92 | int numbins;
93 | bool slowcpu;
94 | int basetone;
95 | int lotone;
96 | int hitone;
97 | int extones;
98 |
99 | // rx variables
100 | C_FIR_filter *hilbert;
101 | sfft *binsfft[THORMAXFFTS];
102 | fftfilt *fft;
103 | Cmovavg *vidfilter[THORSCOPESIZE];
104 | Cmovavg *syncfilter;
105 |
106 | THORrxpipe *pipe;
107 | unsigned int pipeptr;
108 | unsigned int datashreg;
109 | // mbuffer scopedata;
110 | // mbuffer videodata;
111 |
112 | cmplx currvector;
113 |
114 | int currsymbol;
115 | int prev1symbol;
116 | int prev2symbol;
117 |
118 | double currmag;
119 | double prev1mag;
120 | double prev2mag;
121 |
122 | double met1;
123 | double met2;
124 | double sig;
125 | double noise;
126 | double s2n;
127 |
128 | int synccounter;
129 |
130 | unsigned char symbolbuf[MAX_VARICODE_LEN];
131 | int symcounter;
132 |
133 | int symbolbit;
134 |
135 | bool filter_reset;
136 | bool staticburst;
137 |
138 | int fec_confidence;
139 |
140 | // tx variables
141 | int txstate;
142 | int txprevtone;
143 | unsigned int bitshreg;
144 | std::string strSecXmtText;
145 | unsigned int cptr;
146 |
147 | viterbi *Dec;
148 | interleave *Rxinlv;
149 | encoder *Enc;
150 | interleave *Txinlv;
151 | int bitstate;
152 | unsigned char symbolpair[2];
153 |
154 | int flushlength;
155 |
156 |
157 | private:
158 | cmplx mixer(int n, const cmplx& in);
159 |
160 | // Rx
161 | void recvchar(int c);
162 | void decodesymbol();
163 | void softdecodesymbol();
164 | int harddecode();
165 | int softdecode();
166 | void update_syncscope();
167 | void synchronize();
168 | void reset_afc();
169 | void eval_s2n();
170 | int get_secondary_char();
171 | void reset_filters();
172 | void decodePairs(unsigned char symbol);
173 | bool preambledetect(int c);
174 | void softflushrx();
175 |
176 | // Tx
177 | void sendtone(int tone, int duration);
178 | void sendsymbol(int sym);
179 | void sendchar(unsigned char c, int secondary);
180 | void sendidle();
181 | void sendsecondary();
182 | void flushtx();
183 | void Clearbits();
184 |
185 | protected:
186 | void s2nreport(void);
187 |
188 | public:
189 | //Android thor (trx_mode md);
190 | thor (int md);
191 | ~thor ();
192 | void init();
193 | void rx_init();
194 | //Android void tx_init(SoundBase *sc);
195 | void tx_init();
196 | void restart();
197 | //Android int rx_process(const double *buf, int len);
198 | int rx_process(const short *buf, int len);
199 | int tx_process();
200 | };
201 |
202 | #endif
203 |
--------------------------------------------------------------------------------
/fldigi-noise-sdr/src/fldigi/include/thorvaricode.h:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------
2 | // thorvaricode.h -- DEX Varicode
3 | //
4 | // Copyright (C) 2008
5 | // Dave Freese, W1HKJ
6 | //
7 | // This file is part of fldigi.
8 | //
9 | // Fldigi is free software: you can redistribute it and/or modify
10 | // it under the terms of the GNU General Public License as published by
11 | // the Free Software Foundation, either version 3 of the License, or
12 | // (at your option) any later version.
13 | //
14 | // Fldigi is distributed in the hope that it will be useful,
15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 | // GNU General Public License for more details.
18 | //
19 | // You should have received a copy of the GNU General Public License
20 | // along with fldigi. If not, see .
21 | // ----------------------------------------------------------------------------
22 |
23 | #ifndef _DEXVARICODE_H
24 | #define _DEXVARICODE_H
25 |
26 | extern const char *thorvarienc(int c, int secondary);
27 | extern int thorvaridec(unsigned int symbol);
28 |
29 | #endif
30 |
--------------------------------------------------------------------------------
/fldigi-noise-sdr/src/fldigi/include/viterbi.h:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------
2 | // viterbi.h -- Viterbi decoder
3 | //
4 | // Copyright (C) 2006
5 | // Dave Freese, W1HKJ
6 | //
7 | // This file is part of fldigi. These filters were adapted from code contained
8 | // in the gmfsk source code distribution.
9 | //
10 | // Fldigi is free software: you can redistribute it and/or modify
11 | // it under the terms of the GNU General Public License as published by
12 | // the Free Software Foundation, either version 3 of the License, or
13 | // (at your option) any later version.
14 | //
15 | // Fldigi is distributed in the hope that it will be useful,
16 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 | // GNU General Public License for more details.
19 | //
20 | // You should have received a copy of the GNU General Public License
21 | // along with fldigi. If not, see .
22 | // ----------------------------------------------------------------------------
23 |
24 |
25 | #ifndef VITERBI_H
26 | #define VITERBI_H
27 |
28 | #define PATHMEM 128
29 |
30 | class viterbi {
31 | private:
32 | int _traceback;
33 | int _chunksize;
34 | int nstates;
35 | int *output;
36 | int outsize;
37 | int *metrics[PATHMEM];
38 | int *history[PATHMEM];
39 | int sequence[PATHMEM];
40 | int mettab[2][256];
41 | unsigned int ptr;
42 | int traceback(int *metric);
43 | int _k;
44 | int _poly1;
45 | int _poly2;
46 | public:
47 | viterbi(int k, int poly1, int poly2);
48 | ~viterbi();
49 | void reset();
50 | void init();
51 | int settraceback(int trace);
52 | int setchunksize(int chunk);
53 | int decode(unsigned char *sym, int *metric);
54 | };
55 |
56 |
57 |
58 | class encoder {
59 | private:
60 | int *output;
61 | unsigned int shreg;
62 | unsigned int shregmask;
63 | int _k;
64 | int _poly1;
65 | int _poly2;
66 | public:
67 | encoder(int k, int poly1, int poly2);
68 | ~encoder();
69 | int encode(int bit);
70 | void init(void);
71 | };
72 |
73 | #endif
74 |
--------------------------------------------------------------------------------
/fldigi-noise-sdr/src/fldigi/libsamplerate/common.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Copyright (C) 2002-2011 Erik de Castro Lopo
3 | **
4 | ** This program is free software; you can redistribute it and/or modify
5 | ** it under the terms of the GNU General Public License as published by
6 | ** the Free Software Foundation; either version 2 of the License, or
7 | ** (at your option) any later version.
8 | **
9 | ** This program is distributed in the hope that it will be useful,
10 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | ** GNU General Public License for more details.
13 | **
14 | ** You should have received a copy of the GNU General Public License
15 | ** along with this program; if not, write to the Free Software
16 | ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
17 | */
18 |
19 | /*
20 | ** This code is part of Secret Rabbit Code aka libsamplerate. A commercial
21 | ** use license for this code is available, please see:
22 | ** http://www.mega-nerd.com/SRC/procedure.html
23 | */
24 |
25 | #ifndef COMMON_H_INCLUDED
26 | #define COMMON_H_INCLUDED
27 |
28 | #ifdef HAVE_STDINT_H
29 | #include
30 | #elif (SIZEOF_INT == 4)
31 | typedef int int32_t ;
32 | #elif (SIZEOF_LONG == 4)
33 | typedef long int32_t ;
34 | #endif
35 |
36 | #define SRC_MAX_RATIO 256
37 | #define SRC_MAX_RATIO_STR "256"
38 |
39 | #define SRC_MIN_RATIO_DIFF (1e-20)
40 |
41 | #define MAX(a,b) (((a) > (b)) ? (a) : (b))
42 | #define MIN(a,b) (((a) < (b)) ? (a) : (b))
43 |
44 | #define ARRAY_LEN(x) ((int) (sizeof (x) / sizeof ((x) [0])))
45 | #define OFFSETOF(type,member) ((int) (&((type*) 0)->member))
46 |
47 | #define MAKE_MAGIC(a,b,c,d,e,f) ((a) + ((b) << 4) + ((c) << 8) + ((d) << 12) + ((e) << 16) + ((f) << 20))
48 |
49 | /*
50 | ** Inspiration : http://sourcefrog.net/weblog/software/languages/C/unused.html
51 | */
52 | #ifdef UNUSED
53 | #elif defined (__GNUC__)
54 | # define UNUSED(x) UNUSED_ ## x __attribute__ ((unused))
55 | #elif defined (__LCLINT__)
56 | # define UNUSED(x) /*@unused@*/ x
57 | #else
58 | # define UNUSED(x) x
59 | #endif
60 |
61 | #ifdef __GNUC__
62 | # define WARN_UNUSED __attribute__ ((warn_unused_result))
63 | #else
64 | # define WARN_UNUSED
65 | #endif
66 |
67 |
68 | #include "samplerate.h"
69 |
70 | enum
71 | { SRC_FALSE = 0,
72 | SRC_TRUE = 1,
73 |
74 | SRC_MODE_PROCESS = 555,
75 | SRC_MODE_CALLBACK = 556
76 | } ;
77 |
78 | enum
79 | { SRC_ERR_NO_ERROR = 0,
80 |
81 | SRC_ERR_MALLOC_FAILED,
82 | SRC_ERR_BAD_STATE,
83 | SRC_ERR_BAD_DATA,
84 | SRC_ERR_BAD_DATA_PTR,
85 | SRC_ERR_NO_PRIVATE,
86 | SRC_ERR_BAD_SRC_RATIO,
87 | SRC_ERR_BAD_PROC_PTR,
88 | SRC_ERR_SHIFT_BITS,
89 | SRC_ERR_FILTER_LEN,
90 | SRC_ERR_BAD_CONVERTER,
91 | SRC_ERR_BAD_CHANNEL_COUNT,
92 | SRC_ERR_SINC_BAD_BUFFER_LEN,
93 | SRC_ERR_SIZE_INCOMPATIBILITY,
94 | SRC_ERR_BAD_PRIV_PTR,
95 | SRC_ERR_BAD_SINC_STATE,
96 | SRC_ERR_DATA_OVERLAP,
97 | SRC_ERR_BAD_CALLBACK,
98 | SRC_ERR_BAD_MODE,
99 | SRC_ERR_NULL_CALLBACK,
100 | SRC_ERR_NO_VARIABLE_RATIO,
101 | SRC_ERR_SINC_PREPARE_DATA_BAD_LEN,
102 |
103 | /* This must be the last error number. */
104 | SRC_ERR_MAX_ERROR
105 | } ;
106 |
107 | typedef struct SRC_PRIVATE_tag
108 | { double last_ratio, last_position ;
109 |
110 | int error ;
111 | int channels ;
112 |
113 | /* SRC_MODE_PROCESS or SRC_MODE_CALLBACK */
114 | int mode ;
115 |
116 | /* Pointer to data to converter specific data. */
117 | void *private_data ;
118 |
119 | /* Varispeed process function. */
120 | int (*vari_process) (struct SRC_PRIVATE_tag *psrc, SRC_DATA *data) ;
121 |
122 | /* Constant speed process function. */
123 | int (*const_process) (struct SRC_PRIVATE_tag *psrc, SRC_DATA *data) ;
124 |
125 | /* State reset. */
126 | void (*reset) (struct SRC_PRIVATE_tag *psrc) ;
127 |
128 | /* Data specific to SRC_MODE_CALLBACK. */
129 | src_callback_t callback_func ;
130 | void *user_callback_data ;
131 | long saved_frames ;
132 | float *saved_data ;
133 | } SRC_PRIVATE ;
134 |
135 | /* In src_sinc.c */
136 | const char* sinc_get_name (int src_enum) ;
137 | const char* sinc_get_description (int src_enum) ;
138 |
139 | int sinc_set_converter (SRC_PRIVATE *psrc, int src_enum) ;
140 |
141 | /* In src_linear.c */
142 | const char* linear_get_name (int src_enum) ;
143 | const char* linear_get_description (int src_enum) ;
144 |
145 | int linear_set_converter (SRC_PRIVATE *psrc, int src_enum) ;
146 |
147 | /* In src_zoh.c */
148 | const char* zoh_get_name (int src_enum) ;
149 | const char* zoh_get_description (int src_enum) ;
150 |
151 | int zoh_set_converter (SRC_PRIVATE *psrc, int src_enum) ;
152 |
153 | /*----------------------------------------------------------
154 | ** Common static inline functions.
155 | */
156 |
157 | static inline double
158 | fmod_one (double x)
159 | { double res ;
160 |
161 | res = x - lrint (x) ;
162 | if (res < 0.0)
163 | return res + 1.0 ;
164 |
165 | return res ;
166 | } /* fmod_one */
167 |
168 | #endif /* COMMON_H_INCLUDED */
169 |
170 |
--------------------------------------------------------------------------------
/fldigi-noise-sdr/src/fldigi/libsamplerate/config.h:
--------------------------------------------------------------------------------
1 | /* src/config.h. Generated from config.h.in by configure. */
2 | /* src/config.h.in. Generated from configure.ac by autoheader. */
3 |
4 | /* Set to 1 if the compile is GNU GCC. */
5 | #define COMPILER_IS_GCC 1
6 |
7 | /* Target processor clips on negative float to int conversion. */
8 | #define CPU_CLIPS_NEGATIVE 0
9 |
10 | /* Target processor clips on positive float to int conversion. */
11 | #define CPU_CLIPS_POSITIVE 0
12 |
13 | /* Target processor is big endian. */
14 | #define CPU_IS_BIG_ENDIAN 0
15 |
16 | /* Target processor is little endian. */
17 | #define CPU_IS_LITTLE_ENDIAN 1
18 |
19 | /* Major version of GCC or 3 otherwise. */
20 | #define GCC_MAJOR_VERSION 4
21 |
22 | /* Define to 1 if you have the `alarm' function. */
23 | #define HAVE_ALARM 1
24 |
25 | /* Define to 1 if you have the `calloc' function. */
26 | #define HAVE_CALLOC 1
27 |
28 | /* Define to 1 if you have the `ceil' function. */
29 | #define HAVE_CEIL 1
30 |
31 | /* Define to 1 if you have the header file. */
32 | #define HAVE_DLFCN_H 1
33 |
34 | /* Set to 1 if you have libfftw3. */
35 | /* #undef HAVE_FFTW3 */
36 |
37 | /* Define to 1 if you have the `floor' function. */
38 | #define HAVE_FLOOR 1
39 |
40 | /* Define to 1 if you have the `fmod' function. */
41 | #define HAVE_FMOD 1
42 |
43 | /* Define to 1 if you have the `free' function. */
44 | #define HAVE_FREE 1
45 |
46 | /* Define to 1 if you have the header file. */
47 | #define HAVE_INTTYPES_H 1
48 |
49 | /* Define to 1 if you have the `m' library (-lm). */
50 | #define HAVE_LIBM 1
51 |
52 | /* Define if you have C99's lrint function. */
53 | #define HAVE_LRINT 1
54 |
55 | /* Define if you have C99's lrintf function. */
56 | #define HAVE_LRINTF 1
57 |
58 | /* Define to 1 if you have the `malloc' function. */
59 | #define HAVE_MALLOC 1
60 |
61 | /* Define to 1 if you have the `memcpy' function. */
62 | #define HAVE_MEMCPY 1
63 |
64 | /* Define to 1 if you have the `memmove' function. */
65 | #define HAVE_MEMMOVE 1
66 |
67 | /* Define to 1 if you have the header file. */
68 | #define HAVE_MEMORY_H 1
69 |
70 | /* Define if you have signal SIGALRM. */
71 | #define HAVE_SIGALRM 1
72 |
73 | /* Define to 1 if you have the `signal' function. */
74 | /* #undef HAVE_SIGNAL */
75 |
76 | /* Set to 1 if you have libsndfile. */
77 | #define HAVE_SNDFILE 0
78 |
79 | /* Define to 1 if you have the header file. */
80 | #define HAVE_STDINT_H 1
81 |
82 | /* Define to 1 if you have the header file. */
83 | #define HAVE_STDLIB_H 1
84 |
85 | /* Define to 1 if you have the header file. */
86 | #define HAVE_STRINGS_H 1
87 |
88 | /* Define to 1 if you have the header file. */
89 | #define HAVE_STRING_H 1
90 |
91 | /* Define to 1 if you have the header file. */
92 | #define HAVE_SYS_STAT_H 1
93 |
94 | /* Define to 1 if you have the header file. */
95 | #define HAVE_SYS_TIMES_H 1
96 |
97 | /* Define to 1 if you have the header file. */
98 | #define HAVE_SYS_TYPES_H 1
99 |
100 | /* Define to 1 if you have the header file. */
101 | #define HAVE_UNISTD_H 1
102 |
103 | /* Define to the sub-directory in which libtool stores uninstalled libraries.
104 | */
105 | #define LT_OBJDIR ".libs/"
106 |
107 | /* Define to 1 if your C compiler doesn't accept -c and -o together. */
108 | /* #undef NO_MINUS_C_MINUS_O */
109 |
110 | /* Set to 1 if compiling for Win32 */
111 | #define OS_IS_WIN32 0
112 |
113 | /* Name of package */
114 | #define PACKAGE "libsamplerate"
115 |
116 | /* Define to the address where bug reports for this package should be sent. */
117 | #define PACKAGE_BUGREPORT "erikd@mega-nerd.com"
118 |
119 | /* Define to the full name of this package. */
120 | #define PACKAGE_NAME "libsamplerate"
121 |
122 | /* Define to the full name and version of this package. */
123 | #define PACKAGE_STRING "libsamplerate 0.1.8"
124 |
125 | /* Define to the one symbol short name of this package. */
126 | #define PACKAGE_TARNAME "libsamplerate"
127 |
128 | /* Define to the home page for this package. */
129 | #define PACKAGE_URL "http://www.mega-nerd.com/libsamplerate/"
130 |
131 | /* Define to the version of this package. */
132 | #define PACKAGE_VERSION "0.1.8"
133 |
134 | /* The size of `double', as computed by sizeof. */
135 | #define SIZEOF_DOUBLE 8
136 |
137 | /* The size of `float', as computed by sizeof. */
138 | #define SIZEOF_FLOAT 4
139 |
140 | /* The size of `int', as computed by sizeof. */
141 | #define SIZEOF_INT 4
142 |
143 | /* The size of `long', as computed by sizeof. */
144 | #define SIZEOF_LONG 4
145 |
146 | /* Define to 1 if you have the ANSI C header files. */
147 | #define STDC_HEADERS 1
148 |
149 | /* Version number of package */
150 | #define VERSION "0.1.8"
151 |
--------------------------------------------------------------------------------
/fldigi-noise-sdr/src/fldigi/libsamplerate/samplerate.h:
--------------------------------------------------------------------------------
1 | /*
2 | ** Copyright (C) 2002-2011 Erik de Castro Lopo
3 | **
4 | ** This program is free software; you can redistribute it and/or modify
5 | ** it under the terms of the GNU General Public License as published by
6 | ** the Free Software Foundation; either version 2 of the License, or
7 | ** (at your option) any later version.
8 | **
9 | ** This program is distributed in the hope that it will be useful,
10 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | ** GNU General Public License for more details.
13 | **
14 | ** You should have received a copy of the GNU General Public License
15 | ** along with this program; if not, write to the Free Software
16 | ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
17 | */
18 |
19 | /*
20 | ** This code is part of Secret Rabbit Code aka libsamplerate. A commercial
21 | ** use license for this code is available, please see:
22 | ** http://www.mega-nerd.com/SRC/procedure.html
23 | */
24 |
25 | /*
26 | ** API documentation is available here:
27 | ** http://www.mega-nerd.com/SRC/api.html
28 | */
29 |
30 | #ifndef SAMPLERATE_H
31 | #define SAMPLERATE_H
32 |
33 | #ifdef __cplusplus
34 | //Android extern "C" {
35 | #endif /* __cplusplus */
36 |
37 |
38 | /* Opaque data type SRC_STATE. */
39 | typedef struct SRC_STATE_tag SRC_STATE ;
40 |
41 | /* SRC_DATA is used to pass data to src_simple() and src_process(). */
42 | typedef struct
43 | { float *data_in, *data_out ;
44 |
45 | long input_frames, output_frames ;
46 | long input_frames_used, output_frames_gen ;
47 |
48 | int end_of_input ;
49 |
50 | double src_ratio ;
51 | } SRC_DATA ;
52 |
53 | /* SRC_CB_DATA is used with callback based API. */
54 | typedef struct
55 | { long frames ;
56 | float *data_in ;
57 | } SRC_CB_DATA ;
58 |
59 | /*
60 | ** User supplied callback function type for use with src_callback_new()
61 | ** and src_callback_read(). First parameter is the same pointer that was
62 | ** passed into src_callback_new(). Second parameter is pointer to a
63 | ** pointer. The user supplied callback function must modify *data to
64 | ** point to the start of the user supplied float array. The user supplied
65 | ** function must return the number of frames that **data points to.
66 | */
67 |
68 | typedef long (*src_callback_t) (void *cb_data, float **data) ;
69 |
70 | /*
71 | ** Standard initialisation function : return an anonymous pointer to the
72 | ** internal state of the converter. Choose a converter from the enums below.
73 | ** Error returned in *error.
74 | */
75 |
76 | SRC_STATE* src_new (int converter_type, int channels, int *error) ;
77 |
78 | /*
79 | ** Initilisation for callback based API : return an anonymous pointer to the
80 | ** internal state of the converter. Choose a converter from the enums below.
81 | ** The cb_data pointer can point to any data or be set to NULL. Whatever the
82 | ** value, when processing, user supplied function "func" gets called with
83 | ** cb_data as first parameter.
84 | */
85 |
86 | SRC_STATE* src_callback_new (src_callback_t func, int converter_type, int channels,
87 | int *error, void* cb_data) ;
88 |
89 | /*
90 | ** Cleanup all internal allocations.
91 | ** Always returns NULL.
92 | */
93 |
94 | SRC_STATE* src_delete (SRC_STATE *state) ;
95 |
96 | /*
97 | ** Standard processing function.
98 | ** Returns non zero on error.
99 | */
100 |
101 | int src_process (SRC_STATE *state, SRC_DATA *data) ;
102 |
103 | /*
104 | ** Callback based processing function. Read up to frames worth of data from
105 | ** the converter int *data and return frames read or -1 on error.
106 | */
107 | long src_callback_read (SRC_STATE *state, double src_ratio, long frames, float *data) ;
108 |
109 | /*
110 | ** Simple interface for performing a single conversion from input buffer to
111 | ** output buffer at a fixed conversion ratio.
112 | ** Simple interface does not require initialisation as it can only operate on
113 | ** a single buffer worth of audio.
114 | */
115 |
116 | int src_simple (SRC_DATA *data, int converter_type, int channels) ;
117 |
118 | /*
119 | ** This library contains a number of different sample rate converters,
120 | ** numbered 0 through N.
121 | **
122 | ** Return a string giving either a name or a more full description of each
123 | ** sample rate converter or NULL if no sample rate converter exists for
124 | ** the given value. The converters are sequentially numbered from 0 to N.
125 | */
126 |
127 | const char *src_get_name (int converter_type) ;
128 | const char *src_get_description (int converter_type) ;
129 | const char *src_get_version (void) ;
130 |
131 | /*
132 | ** Set a new SRC ratio. This allows step responses
133 | ** in the conversion ratio.
134 | ** Returns non zero on error.
135 | */
136 |
137 | int src_set_ratio (SRC_STATE *state, double new_ratio) ;
138 |
139 | /*
140 | ** Reset the internal SRC state.
141 | ** Does not modify the quality settings.
142 | ** Does not free any memory allocations.
143 | ** Returns non zero on error.
144 | */
145 |
146 | int src_reset (SRC_STATE *state) ;
147 |
148 | /*
149 | ** Return TRUE if ratio is a valid conversion ratio, FALSE
150 | ** otherwise.
151 | */
152 |
153 | int src_is_valid_ratio (double ratio) ;
154 |
155 | /*
156 | ** Return an error number.
157 | */
158 |
159 | int src_error (SRC_STATE *state) ;
160 |
161 | /*
162 | ** Convert the error number into a string.
163 | */
164 | const char* src_strerror (int error) ;
165 |
166 | /*
167 | ** The following enums can be used to set the interpolator type
168 | ** using the function src_set_converter().
169 | */
170 |
171 | enum
172 | {
173 | SRC_SINC_BEST_QUALITY = 0,
174 | SRC_SINC_MEDIUM_QUALITY = 1,
175 | SRC_SINC_FASTEST = 2,
176 | SRC_ZERO_ORDER_HOLD = 3,
177 | SRC_LINEAR = 4,
178 | } ;
179 |
180 | /*
181 | ** Extra helper functions for converting from short to float and
182 | ** back again.
183 | */
184 |
185 | void src_short_to_float_array (const short *in, float *out, int len) ;
186 | void src_float_to_short_array (const float *in, short *out, int len) ;
187 |
188 | void src_int_to_float_array (const int *in, float *out, int len) ;
189 | void src_float_to_int_array (const float *in, int *out, int len) ;
190 |
191 |
192 | #ifdef __cplusplus
193 | } /* extern "C" */
194 | #endif /* __cplusplus */
195 |
196 | #endif /* SAMPLERATE_H */
197 |
198 |
--------------------------------------------------------------------------------
/fldigi-noise-sdr/src/fldigi/mfsk/interleave.cxx:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------
2 | // interleave.cxx -- MFSK (de)interleaver
3 | //
4 | // Copyright (C) 2006-2008
5 | // Dave Freese, W1HKJ
6 | //
7 | // This file is part of fldigi. Adapted from code contained in gmfsk source
8 | // code
9 | // distribution.
10 | // gmfsk Copyright (C) 2001, 2002, 2003
11 | // Tomi Manninen (oh2bns@sral.fi)
12 | //
13 | // Fldigi is free software: you can redistribute it and/or modify
14 | // it under the terms of the GNU General Public License as published by
15 | // the Free Software Foundation, either version 3 of the License, or
16 | // (at your option) any later version.
17 | //
18 | // Fldigi is distributed in the hope that it will be useful,
19 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
20 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 | // GNU General Public License for more details.
22 | //
23 | // You should have received a copy of the GNU General Public License
24 | // along with fldigi. If not, see .
25 | // ----------------------------------------------------------------------------
26 |
27 | // Android #include
28 |
29 | #include
30 |
31 | #include "interleave.h"
32 |
33 | // ----------------------------------------------------------------------
34 |
35 | interleave::interleave(int _size, int _depth, int dir) {
36 | size = _size;
37 | depth = _depth;
38 | direction = dir;
39 | len = size * size * depth;
40 | table = new unsigned char[len];
41 | flush();
42 | }
43 |
44 | interleave::~interleave() { delete[] table; }
45 |
46 | void interleave::symbols(unsigned char *psyms) {
47 | int i, j, k;
48 |
49 | for (k = 0; k < depth; k++) {
50 | for (i = 0; i < size; i++)
51 | for (j = 0; j < size - 1; j++)
52 | *tab(k, i, j) = *tab(k, i, j + 1);
53 |
54 | for (i = 0; i < size; i++)
55 | *tab(k, i, size - 1) = psyms[i];
56 |
57 | for (i = 0; i < size; i++) {
58 | if (direction == INTERLEAVE_FWD)
59 | psyms[i] = *tab(k, i, size - i - 1);
60 | else
61 | psyms[i] = *tab(k, i, i);
62 | }
63 | }
64 | }
65 |
66 | void interleave::bits(unsigned int *pbits) {
67 | unsigned char syms[size];
68 | int i;
69 |
70 | for (i = 0; i < size; i++)
71 | syms[i] = (*pbits >> (size - i - 1)) & 1;
72 |
73 | symbols(syms);
74 |
75 | for (*pbits = i = 0; i < size; i++)
76 | *pbits = (*pbits << 1) | syms[i];
77 | }
78 |
79 | void interleave::flush(void) {
80 | // Fill entire RX interleaver with punctures or 0 depending on whether
81 | // Rx or Tx
82 | if (direction == INTERLEAVE_REV)
83 | memset(table, PUNCTURE, len);
84 | else
85 | memset(table, 0, len);
86 | }
87 |
88 | // ----------------------------------------------------------------------
89 |
--------------------------------------------------------------------------------
/fldigi-noise-sdr/src/fldigi/mfsk/mfskvaricode.cxx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/eurecom-s3/noise-sdr/06e12a0baa35f3e0defc2727516706c97dd77419/fldigi-noise-sdr/src/fldigi/mfsk/mfskvaricode.cxx
--------------------------------------------------------------------------------
/fldigi-noise-sdr/src/fldigi/misc/configuration.cxx:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------
2 | // configuration.cxx
3 | //
4 | // Copyright (C) 2006-2010
5 | // Dave Freese, W1HKJ
6 | // Copyright (C) 2007-2008
7 | // Leigh L. Klotz, Jr., WA5ZNU
8 | // Copyright (C) 2007-2010
9 | // Stelios Bounanos, M0GLD
10 | // Copyright (C) 2013
11 | // Remi Chateauneu, F4ECW
12 | //
13 | // This file is part of fldigi.
14 | //
15 | // Fldigi is free software: you can redistribute it and/or modify
16 | // it under the terms of the GNU General Public License as published by
17 | // the Free Software Foundation, either version 3 of the License, or
18 | // (at your option) any later version.
19 | //
20 | // Fldigi is distributed in the hope that it will be useful,
21 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
22 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 | // GNU General Public License for more details.
24 | //
25 | // You should have received a copy of the GNU General Public License
26 | // along with fldigi. If not, see .
27 | // ----------------------------------------------------------------------------
28 |
29 | // Android#include
30 |
31 | #include "configuration.h"
32 | //#include "confdialog.h"
33 | //#include "xmlreader.h"
34 | //#include "soundconf.h"
35 | //#include "fl_digi.h"
36 | //#include "main.h"
37 | //#include "gettext.h"
38 | //#include "nls.h"
39 | //#include "icons.h"
40 |
41 | #if USE_HAMLIB
42 | #include "hamlib.h"
43 | #include "rigclass.h"
44 | #endif
45 |
46 | //#include "rigio.h"
47 | //#include "rigxml.h"
48 | //#include "debug.h"
49 |
50 | //#include
51 |
52 | #include
53 | #include
54 | #include