2016-07-02 08:15:41 -04:00
|
|
|
// qra64_subs.c
|
|
|
|
// Fortran interface routines for QRA64
|
2016-06-22 16:45:29 -04:00
|
|
|
|
2016-07-02 08:15:41 -04:00
|
|
|
#include "qra64.h"
|
2016-06-22 16:45:29 -04:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2016-07-18 08:42:10 -04:00
|
|
|
#define NICO_WANTS_SNR_DUMP
|
|
|
|
|
|
|
|
static qra64codec *pqra64codec = NULL;
|
|
|
|
|
2016-07-02 08:15:41 -04:00
|
|
|
void qra64_enc_(int x[], int y[])
|
2016-06-22 16:45:29 -04:00
|
|
|
{
|
2016-07-18 08:42:10 -04:00
|
|
|
if (pqra64codec==NULL)
|
|
|
|
pqra64codec = qra64_init(QRA_AUTOAP);
|
|
|
|
|
|
|
|
qra64_encode(pqra64codec, y, x);
|
2016-06-22 16:45:29 -04:00
|
|
|
}
|
|
|
|
|
2016-07-02 08:15:41 -04:00
|
|
|
void qra64_dec_(float r[], int* nmycall, int xdec[], int* rc)
|
2016-06-22 16:45:29 -04:00
|
|
|
{
|
2016-06-23 09:58:18 -04:00
|
|
|
// Return codes:
|
2016-06-24 15:54:34 -04:00
|
|
|
// rc=-16 failed sanity check
|
|
|
|
// rc=-2 decoded, but crc check failed
|
|
|
|
// rc=-1 no decode
|
2016-06-23 09:58:18 -04:00
|
|
|
// rc=0 [? ? ?] AP0 (decoding with no a-priori information)
|
|
|
|
// rc=1 [CQ ? ?] AP27
|
2016-06-24 15:54:34 -04:00
|
|
|
// rc=2 [CQ ? ] AP42
|
2016-06-23 09:58:18 -04:00
|
|
|
// rc=3 [CALL ? ?] AP29
|
2016-06-24 15:54:34 -04:00
|
|
|
// rc=4 [CALL ? ] AP44
|
2016-06-23 09:58:18 -04:00
|
|
|
// rc=5 [CALL CALL ?] AP57
|
2016-07-18 08:42:10 -04:00
|
|
|
// rc=6 [? CALL ?] AP29
|
|
|
|
// rc=7 [? CALL ] AP44
|
|
|
|
// rc=8 [CALL CALL G] AP72
|
2016-06-23 09:58:18 -04:00
|
|
|
|
2016-06-30 16:38:36 -04:00
|
|
|
static ncall0=-1;
|
|
|
|
int ncall=*nmycall;
|
2016-07-18 08:42:10 -04:00
|
|
|
float EbNodBEstimated;
|
2016-06-24 15:54:34 -04:00
|
|
|
|
2016-07-18 08:42:10 -04:00
|
|
|
#ifdef NICO_WANTS_SNR_DUMP
|
|
|
|
FILE *fout;
|
|
|
|
#endif
|
|
|
|
|
2016-06-30 16:38:36 -04:00
|
|
|
if(ncall!=ncall0) {
|
2016-07-18 08:42:10 -04:00
|
|
|
if (pqra64codec!=NULL)
|
|
|
|
qra64_close(pqra64codec);
|
|
|
|
pqra64codec = qra64_init(QRA_AUTOAP);
|
|
|
|
// the following apset call is not strictly necessary
|
|
|
|
// It enables AP decoding of messages directed to our call
|
|
|
|
// also in the case we have never made a CQ
|
|
|
|
qra64_apset(pqra64codec,ncall,0,0,APTYPE_MYCALL);
|
2016-06-30 16:38:36 -04:00
|
|
|
ncall0=ncall;
|
2016-06-24 15:54:34 -04:00
|
|
|
}
|
2016-07-18 08:42:10 -04:00
|
|
|
*rc = qra64_decode(pqra64codec,&EbNodBEstimated,xdec,r);
|
|
|
|
|
|
|
|
#ifdef NICO_WANTS_SNR_DUMP
|
|
|
|
fout = fopen("C:\\JTSDK\\snrdump.txt","a+");
|
|
|
|
if ((*rc)>=0)
|
|
|
|
fprintf(fout,"rc=%d snr=%.2f dB\n",*rc,EbNodBEstimated-31.0f);
|
|
|
|
fclose(fout);
|
|
|
|
#endif
|
2016-06-22 16:45:29 -04:00
|
|
|
}
|