kopia lustrzana https://github.com/M17-Project/M17_Implementations
fixed all m17-* demo apps
rodzic
663fab8e9d
commit
72f01c6321
|
@ -1,5 +1,5 @@
|
||||||
m17-coder-sym: m17-coder-sym.c ../lib/*.c ../lib/*.h
|
m17-coder-sym: m17-coder-sym.c
|
||||||
gcc -O2 -Wall m17-coder-sym.c ../lib/*.c -o m17-coder-sym -lm
|
gcc -I ../lib -L ../lib -O2 -Wall m17-coder-sym.c -o m17-coder-sym -lm -lm17
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f m17-coder-sym
|
rm -f m17-coder-sym
|
||||||
|
|
|
@ -3,14 +3,15 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "../lib/m17lib.h"
|
//libm17
|
||||||
#include "../lib/m17call.h"
|
#include <lib.h>
|
||||||
#include "../lib/m17consts.h"
|
#include <encode/convol.h>
|
||||||
#include "../lib/m17convol.h"
|
#include <math/golay.h>
|
||||||
#include "../lib/m17crc.h"
|
#include <payload/crc.h>
|
||||||
#include "../lib/m17golay.h"
|
#include <payload/lsf.h>
|
||||||
#include "../lib/m17math.h"
|
#include <phy/interleave.h>
|
||||||
#include "../lib/m17viterbi.h"
|
#include <phy/randomize.h>
|
||||||
|
#include <phy/sync.h>
|
||||||
|
|
||||||
//#define FN60_DEBUG
|
//#define FN60_DEBUG
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
m17-decoder-sym: m17-decoder-sym.c ../lib/*.c ../lib/*.h
|
m17-decoder-sym: m17-decoder-sym.c
|
||||||
gcc -Wall -O2 m17-decoder-sym.c ../lib/*.c -o m17-decoder-sym -lm
|
gcc -I ../lib -L ../lib -Wall -O2 m17-decoder-sym.c -o m17-decoder-sym -lm -lm17
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f m17-decoder-sym
|
rm -f m17-decoder-sym
|
||||||
|
|
|
@ -3,14 +3,19 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "../lib/m17lib.h"
|
//libm17
|
||||||
#include "../lib/m17call.h"
|
#include <lib.h>
|
||||||
#include "../lib/m17consts.h"
|
#include <decode/symbols.h>
|
||||||
#include "../lib/m17convol.h"
|
#include <decode/viterbi.h>
|
||||||
#include "../lib/m17crc.h"
|
#include <encode/convol.h>
|
||||||
#include "../lib/m17golay.h"
|
#include <encode/symbols.h>
|
||||||
#include "../lib/m17math.h"
|
#include <math/golay.h>
|
||||||
#include "../lib/m17viterbi.h"
|
#include <math/math.h>
|
||||||
|
#include <payload/call.h>
|
||||||
|
#include <payload/crc.h>
|
||||||
|
#include <phy/interleave.h>
|
||||||
|
#include <phy/sync.h>
|
||||||
|
#include <phy/randomize.h>
|
||||||
|
|
||||||
#define DECODE_CALLSIGNS
|
#define DECODE_CALLSIGNS
|
||||||
#define SHOW_VITERBI_ERRS
|
#define SHOW_VITERBI_ERRS
|
||||||
|
@ -54,7 +59,7 @@ int main(void)
|
||||||
last[7]=sample;
|
last[7]=sample;
|
||||||
|
|
||||||
//calculate euclidean norm
|
//calculate euclidean norm
|
||||||
dist = eucl_norm(last, str_sync, 8);
|
dist = eucl_norm(last, str_sync_symbols, 8);
|
||||||
|
|
||||||
if(dist<DIST_THRESH) //frame syncword detected
|
if(dist<DIST_THRESH) //frame syncword detected
|
||||||
{
|
{
|
||||||
|
@ -66,7 +71,7 @@ int main(void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//calculate euclidean norm again, this time against LSF syncword
|
//calculate euclidean norm again, this time against LSF syncword
|
||||||
dist = eucl_norm(last, lsf_sync, 8);
|
dist = eucl_norm(last, lsf_sync_symbols, 8);
|
||||||
|
|
||||||
if(dist<DIST_THRESH) //LSF syncword
|
if(dist<DIST_THRESH) //LSF syncword
|
||||||
{
|
{
|
||||||
|
@ -88,21 +93,21 @@ int main(void)
|
||||||
for(uint8_t i=0; i<SYM_PER_PLD; i++)
|
for(uint8_t i=0; i<SYM_PER_PLD; i++)
|
||||||
{
|
{
|
||||||
//bit 0
|
//bit 0
|
||||||
if(pld[i]>=symbs[3])
|
if(pld[i]>=symbol_map[3])
|
||||||
{
|
{
|
||||||
soft_bit[i*2+1]=0xFFFF;
|
soft_bit[i*2+1]=0xFFFF;
|
||||||
}
|
}
|
||||||
else if(pld[i]>=symbs[2])
|
else if(pld[i]>=symbol_map[2])
|
||||||
{
|
{
|
||||||
soft_bit[i*2+1]=-(float)0xFFFF/(symbs[3]-symbs[2])*symbs[2]+pld[i]*(float)0xFFFF/(symbs[3]-symbs[2]);
|
soft_bit[i*2+1]=-(float)0xFFFF/(symbol_map[3]-symbol_map[2])*symbol_map[2]+pld[i]*(float)0xFFFF/(symbol_map[3]-symbol_map[2]);
|
||||||
}
|
}
|
||||||
else if(pld[i]>=symbs[1])
|
else if(pld[i]>=symbol_map[1])
|
||||||
{
|
{
|
||||||
soft_bit[i*2+1]=0x0000;
|
soft_bit[i*2+1]=0x0000;
|
||||||
}
|
}
|
||||||
else if(pld[i]>=symbs[0])
|
else if(pld[i]>=symbol_map[0])
|
||||||
{
|
{
|
||||||
soft_bit[i*2+1]=(float)0xFFFF/(symbs[1]-symbs[0])*symbs[1]-pld[i]*(float)0xFFFF/(symbs[1]-symbs[0]);
|
soft_bit[i*2+1]=(float)0xFFFF/(symbol_map[1]-symbol_map[0])*symbol_map[1]-pld[i]*(float)0xFFFF/(symbol_map[1]-symbol_map[0]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -110,13 +115,13 @@ int main(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
//bit 1
|
//bit 1
|
||||||
if(pld[i]>=symbs[2])
|
if(pld[i]>=symbol_map[2])
|
||||||
{
|
{
|
||||||
soft_bit[i*2]=0x0000;
|
soft_bit[i*2]=0x0000;
|
||||||
}
|
}
|
||||||
else if(pld[i]>=symbs[1])
|
else if(pld[i]>=symbol_map[1])
|
||||||
{
|
{
|
||||||
soft_bit[i*2]=0x7FFF-pld[i]*(float)0xFFFF/(symbs[2]-symbs[1]);
|
soft_bit[i*2]=0x7FFF-pld[i]*(float)0xFFFF/(symbol_map[2]-symbol_map[1]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -147,7 +152,7 @@ int main(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
//decode
|
//decode
|
||||||
uint32_t e=viterbi_decode_punctured(frame_data, enc_data, P_2, 272, 12);
|
uint32_t e=viterbi_decode_punctured(frame_data, enc_data, puncture_pattern_2, 272, 12);
|
||||||
|
|
||||||
uint16_t fn = (frame_data[1] << 8) | frame_data[2];
|
uint16_t fn = (frame_data[1] << 8) | frame_data[2];
|
||||||
|
|
||||||
|
@ -241,7 +246,7 @@ int main(void)
|
||||||
printf("LSF\n");
|
printf("LSF\n");
|
||||||
|
|
||||||
//decode
|
//decode
|
||||||
uint32_t e=viterbi_decode_punctured(lsf, d_soft_bit, P_1, 2*SYM_PER_PLD, 61);
|
uint32_t e=viterbi_decode_punctured(lsf, d_soft_bit, puncture_pattern_1, 2*SYM_PER_PLD, 61);
|
||||||
|
|
||||||
//shift the buffer 1 position left - get rid of the encoded flushing bits
|
//shift the buffer 1 position left - get rid of the encoded flushing bits
|
||||||
for(uint8_t i=0; i<30; i++)
|
for(uint8_t i=0; i<30; i++)
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
all: m17-packet-encode m17-packet-decode
|
all: m17-packet-encode m17-packet-decode
|
||||||
|
|
||||||
m17-packet-encode: m17-packet-encode.c ../lib/*.c ../lib/*.h
|
m17-packet-encode: m17-packet-encode.c
|
||||||
gcc -O2 -Wall m17-packet-encode.c ../lib/*.c -o m17-packet-encode -lm
|
gcc -I ../lib -L ../lib -O2 -Wall m17-packet-encode.c -o m17-packet-encode -lm -lm17
|
||||||
|
|
||||||
m17-packet-decode: m17-packet-decode.c ../lib/*.c ../lib/*.h
|
m17-packet-decode: m17-packet-decode.c
|
||||||
gcc -O2 -Wall m17-packet-decode.c ../lib/*.c -o m17-packet-decode -lm
|
gcc -I ../lib -L ../lib -O2 -Wall m17-packet-decode.c -o m17-packet-decode -lm -lm17
|
||||||
|
|
||||||
install: all
|
install: all
|
||||||
sudo install m17-packet-encode /usr/local/bin
|
sudo install m17-packet-encode /usr/local/bin
|
||||||
|
|
|
@ -3,14 +3,19 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "../lib/m17lib.h"
|
//libm17
|
||||||
#include "../lib/m17call.h"
|
#include <lib.h>
|
||||||
#include "../lib/m17consts.h"
|
#include <decode/symbols.h>
|
||||||
#include "../lib/m17convol.h"
|
#include <decode/viterbi.h>
|
||||||
#include "../lib/m17crc.h"
|
#include <encode/convol.h>
|
||||||
#include "../lib/m17golay.h"
|
#include <encode/symbols.h>
|
||||||
#include "../lib/m17math.h"
|
#include <math/golay.h>
|
||||||
#include "../lib/m17viterbi.h"
|
#include <math/math.h>
|
||||||
|
#include <payload/call.h>
|
||||||
|
#include <payload/crc.h>
|
||||||
|
#include <phy/interleave.h>
|
||||||
|
#include <phy/sync.h>
|
||||||
|
#include <phy/randomize.h>
|
||||||
|
|
||||||
float sample; //last raw sample from the stdin
|
float sample; //last raw sample from the stdin
|
||||||
float last[8]; //look-back buffer for finding syncwords
|
float last[8]; //look-back buffer for finding syncwords
|
||||||
|
@ -94,7 +99,7 @@ int main(int argc, char* argv[])
|
||||||
last[7]=sample;
|
last[7]=sample;
|
||||||
|
|
||||||
//calculate euclidean norm
|
//calculate euclidean norm
|
||||||
dist = eucl_norm(last, pkt_sync, 8);
|
dist = eucl_norm(last, pkt_sync_symbols, 8);
|
||||||
|
|
||||||
//fprintf(stderr, "pkt_sync dist: %3.5f\n", dist);
|
//fprintf(stderr, "pkt_sync dist: %3.5f\n", dist);
|
||||||
if(dist<DIST_THRESH) //frame syncword detected
|
if(dist<DIST_THRESH) //frame syncword detected
|
||||||
|
@ -107,7 +112,7 @@ int main(int argc, char* argv[])
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//calculate euclidean norm again, this time against LSF syncword
|
//calculate euclidean norm again, this time against LSF syncword
|
||||||
dist = eucl_norm(last, lsf_sync, 8);
|
dist = eucl_norm(last, lsf_sync_symbols, 8);
|
||||||
|
|
||||||
//fprintf(stderr, "lsf_sync dist: %3.5f\n", dist);
|
//fprintf(stderr, "lsf_sync dist: %3.5f\n", dist);
|
||||||
if(dist<DIST_THRESH) //LSF syncword
|
if(dist<DIST_THRESH) //LSF syncword
|
||||||
|
@ -130,21 +135,21 @@ int main(int argc, char* argv[])
|
||||||
for(uint8_t i=0; i<SYM_PER_PLD; i++)
|
for(uint8_t i=0; i<SYM_PER_PLD; i++)
|
||||||
{
|
{
|
||||||
//bit 0
|
//bit 0
|
||||||
if(pld[i]>=symbs[3])
|
if(pld[i]>=symbol_map[3])
|
||||||
{
|
{
|
||||||
soft_bit[i*2+1]=0xFFFF;
|
soft_bit[i*2+1]=0xFFFF;
|
||||||
}
|
}
|
||||||
else if(pld[i]>=symbs[2])
|
else if(pld[i]>=symbol_map[2])
|
||||||
{
|
{
|
||||||
soft_bit[i*2+1]=-(float)0xFFFF/(symbs[3]-symbs[2])*symbs[2]+pld[i]*(float)0xFFFF/(symbs[3]-symbs[2]);
|
soft_bit[i*2+1]=-(float)0xFFFF/(symbol_map[3]-symbol_map[2])*symbol_map[2]+pld[i]*(float)0xFFFF/(symbol_map[3]-symbol_map[2]);
|
||||||
}
|
}
|
||||||
else if(pld[i]>=symbs[1])
|
else if(pld[i]>=symbol_map[1])
|
||||||
{
|
{
|
||||||
soft_bit[i*2+1]=0x0000;
|
soft_bit[i*2+1]=0x0000;
|
||||||
}
|
}
|
||||||
else if(pld[i]>=symbs[0])
|
else if(pld[i]>=symbol_map[0])
|
||||||
{
|
{
|
||||||
soft_bit[i*2+1]=(float)0xFFFF/(symbs[1]-symbs[0])*symbs[1]-pld[i]*(float)0xFFFF/(symbs[1]-symbs[0]);
|
soft_bit[i*2+1]=(float)0xFFFF/(symbol_map[1]-symbol_map[0])*symbol_map[1]-pld[i]*(float)0xFFFF/(symbol_map[1]-symbol_map[0]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -152,13 +157,13 @@ int main(int argc, char* argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
//bit 1
|
//bit 1
|
||||||
if(pld[i]>=symbs[2])
|
if(pld[i]>=symbol_map[2])
|
||||||
{
|
{
|
||||||
soft_bit[i*2]=0x0000;
|
soft_bit[i*2]=0x0000;
|
||||||
}
|
}
|
||||||
else if(pld[i]>=symbs[1])
|
else if(pld[i]>=symbol_map[1])
|
||||||
{
|
{
|
||||||
soft_bit[i*2]=0x7FFF-pld[i]*(float)0xFFFF/(symbs[2]-symbs[1]);
|
soft_bit[i*2]=0x7FFF-pld[i]*(float)0xFFFF/(symbol_map[2]-symbol_map[1]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -183,7 +188,7 @@ int main(int argc, char* argv[])
|
||||||
if(!fl)
|
if(!fl)
|
||||||
{
|
{
|
||||||
//decode
|
//decode
|
||||||
uint32_t e=viterbi_decode_punctured(frame_data, d_soft_bit, P_3, SYM_PER_PLD*2, 8);
|
uint32_t e=viterbi_decode_punctured(frame_data, d_soft_bit, puncture_pattern_3, SYM_PER_PLD*2, 8);
|
||||||
|
|
||||||
//dump FN
|
//dump FN
|
||||||
uint8_t rx_fn=(frame_data[26]>>2)&0x1F;
|
uint8_t rx_fn=(frame_data[26]>>2)&0x1F;
|
||||||
|
@ -246,7 +251,7 @@ int main(int argc, char* argv[])
|
||||||
//fprintf(stderr, "LSF\n");
|
//fprintf(stderr, "LSF\n");
|
||||||
|
|
||||||
//decode
|
//decode
|
||||||
uint32_t e=viterbi_decode_punctured(lsf, d_soft_bit, P_1, 2*SYM_PER_PLD, 61);
|
uint32_t e=viterbi_decode_punctured(lsf, d_soft_bit, puncture_pattern_1, 2*SYM_PER_PLD, 61);
|
||||||
|
|
||||||
//shift the buffer 1 position left - get rid of the encoded flushing bits
|
//shift the buffer 1 position left - get rid of the encoded flushing bits
|
||||||
for(uint8_t i=0; i<30; i++)
|
for(uint8_t i=0; i<30; i++)
|
||||||
|
|
|
@ -4,14 +4,18 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "../lib/m17lib.h"
|
//libm17
|
||||||
#include "../lib/m17call.h"
|
#include <lib.h>
|
||||||
#include "../lib/m17consts.h"
|
#include <encode/convol.h>
|
||||||
#include "../lib/m17convol.h"
|
#include <encode/symbols.h>
|
||||||
#include "../lib/m17crc.h"
|
#include <math/golay.h>
|
||||||
#include "../lib/m17golay.h"
|
#include <math/rrc.h>
|
||||||
#include "../lib/m17math.h"
|
#include <payload/call.h>
|
||||||
#include "../lib/m17viterbi.h"
|
#include <payload/crc.h>
|
||||||
|
#include <payload/lsf.h>
|
||||||
|
#include <phy/interleave.h>
|
||||||
|
#include <phy/randomize.h>
|
||||||
|
#include <phy/sync.h>
|
||||||
|
|
||||||
#define FLT_LEN (BSB_SPS*FLT_SPAN+1) //for 48kHz sample rate this is 81
|
#define FLT_LEN (BSB_SPS*FLT_SPAN+1) //for 48kHz sample rate this is 81
|
||||||
|
|
||||||
|
@ -383,7 +387,7 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
//calc the sum of products
|
//calc the sum of products
|
||||||
for(uint16_t k=0; k<FLT_LEN; k++)
|
for(uint16_t k=0; k<FLT_LEN; k++)
|
||||||
mac+=mem[k]*taps_10[k]*sqrtf(10.0); //temporary fix for the interpolation gain error
|
mac+=mem[k]*rrc_taps_10[k]*sqrtf(10.0); //temporary fix for the interpolation gain error
|
||||||
|
|
||||||
//shift the delay line right by 1
|
//shift the delay line right by 1
|
||||||
for(int16_t k=FLT_LEN-1; k>0; k--)
|
for(int16_t k=FLT_LEN-1; k>0; k--)
|
||||||
|
|
Ładowanie…
Reference in New Issue