define default threshold value in GRC flowgraph and remove unnecessary comments

main
Jean-Michel Friedt 2023-09-28 11:52:13 +02:00
parent 5989edb9cc
commit 443cfb36ef
2 changed files with 6 additions and 32 deletions

View File

@ -16,7 +16,7 @@ parameters:
- id: threshold
label: Threshold
dtype: float
default: 0.9
default: 2.0
templates:
imports: from gnuradio import m17
@ -47,6 +47,9 @@ outputs:
vlen: 1
optional: 0
documentation: |-
The decoder block accepts two boolean debugging flags defining which messages are displayed in the console when messages are received, and a threshold parameter. This threshold defines a value below which the incoming message is detected. Ideally the correlation would reach 0.0 for an ideal match. A default threshold value of 2.0 is selected.
# 'file_format' specifies the version of the GRC yml format used in the file
# and should usually not be changed.
file_format: 1

View File

@ -40,7 +40,6 @@
//#define SHOW_VITERBI_ERRS
//
//#define XCORR_THRESHOLD 0.90 // arbitrary threshold between 0 and 1: might be tunable from GNU Radio Block for flexibility
#define CODE_MEAN -0.75 // mean(str_sync)
#define CODE_STD 8.21583836f //std(str_sync)*sqrt(length(str_sync)-1)
// see ../M17_Implementations/SP5WWP/inc/m17.h for const int8_t str_sync[8]={-3, -3, -3, -3, +3, +3, -3, +3};
@ -204,7 +203,7 @@ float eucl_norm(const float* in1, const int8_t* in2, uint8_t len)
//calculate euclidean norm
dist = eucl_norm(last, str_sync, 8);
if(dist<_threshold) // DIST_THRESH) //frame syncword detected
if(dist<_threshold) //frame syncword detected
{
//fprintf(stderr, "str_sync dist: %3.5f\n", dist);
syncd=1;
@ -216,7 +215,7 @@ float eucl_norm(const float* in1, const int8_t* in2, uint8_t len)
//calculate euclidean norm again, this time against LSF syncword
dist = eucl_norm(last, lsf_sync, 8);
if(dist<_threshold) // DIST_THRESH) //LSF syncword
if(dist<_threshold) //LSF syncword
{
//fprintf(stderr, "lsf_sync dist: %3.5f\n", dist);
syncd=1;
@ -225,34 +224,6 @@ float eucl_norm(const float* in1, const int8_t* in2, uint8_t len)
}
}
}
/* //calculate cross-correlation
meanx=0.;
for(uint8_t i=0; i<8; i++) meanx+=last[i]; // sum(last)
meanx/=8.;
xcorr=0.;
normx=0.;
for(uint8_t i=0; i<8; i++)
{
xcorr+=(last[i]-meanx)*(str_sync[i]-CODE_MEAN); // -0.75=mean(str_sync)
normx+=(last[i]-meanx)*(last[i]-meanx); // sum(last^2)
}
xcorr/=(sqrt(normx)*CODE_STD); // 8.78=std(str_sync)*sqrt(length(str_sync))
// printf("%f\n", xcorr);
if(xcorr>_threshold) // XCORR_THRESHOLD) //Frame syncword detected
{
syncd=1;
pushed=0;
fl=0;
}
else if(xcorr<-_threshold) // XCORR_THRESHOLD) //LSF syncword
{
syncd=1;
pushed=0;
fl=1;
}
}
*/
else
{
pld[pushed++]=sample;