2016-07-19 09:16:10 -04:00
|
|
|
// qra64_subs.c
|
2016-07-02 08:15:41 -04:00
|
|
|
// 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
|
|
|
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-19 11:24:15 -04:00
|
|
|
if (pqra64codec==NULL) pqra64codec = qra64_init(QRA_USERAP);
|
2016-07-18 08:42:10 -04:00
|
|
|
qra64_encode(pqra64codec, y, x);
|
2016-06-22 16:45:29 -04:00
|
|
|
}
|
|
|
|
|
2016-07-19 11:24:15 -04:00
|
|
|
void qra64_dec_(float r[], int* nc1, int* nc2, int* ng2, int* APtype,
|
2016-11-07 11:58:37 -05:00
|
|
|
int* iset, int* ns0, float* b0, int* nf0,
|
|
|
|
int xdec[], float* snr, int* rc)
|
2016-06-22 16:45:29 -04:00
|
|
|
{
|
2016-07-19 11:24:15 -04:00
|
|
|
/*
|
2016-11-27 10:50:47 -05:00
|
|
|
APtype: AP
|
|
|
|
-----------------------------------------------------------------------
|
|
|
|
-1 0 (no AP information)
|
|
|
|
0 [CQ/QRZ ? ? ] 25/37
|
|
|
|
1 [MyCall ? ? ] 25/37
|
|
|
|
2 [ ? HisCall ? ] 25/37
|
|
|
|
3 [MyCall HisCall ? ] 49/68
|
|
|
|
4 [MyCall HisCall grid] 68
|
|
|
|
5 [CQ/QRZ HisCall ? ] 49/68
|
2016-07-19 11:24:15 -04:00
|
|
|
|
2016-11-27 10:50:47 -05:00
|
|
|
rc Message format AP APTYPE Comments
|
|
|
|
------------------------------------------------------------------------
|
|
|
|
-16 Failed sanity check
|
|
|
|
-2 Decoded but CRC failed
|
|
|
|
-1 No decode
|
|
|
|
0 [ ? ? ? ] 0 -1 Decode with no AP info
|
|
|
|
1 [CQ/QRZ ? ? ] 25 0
|
|
|
|
2 [CQ/QRZ ? _ ] 37 0
|
|
|
|
3 [MyCall ? ? ] 25 1
|
|
|
|
4 [MyCall ? _ ] 37 1
|
|
|
|
5 [MyCall HisCall ? ] 49 3
|
|
|
|
6 [ ? HisCall ? ] 25 2 Optional
|
|
|
|
7 [ ? HisCall _ ] 37 2 Optional
|
|
|
|
8 [MyCall HisCall Grid] 68 4
|
|
|
|
9 [CQ/QRZ HisCall ? ] 49 5 Optional (not needed?)
|
|
|
|
10 [CQ/QRZ HisCall _ ] 68 5 Optional
|
|
|
|
11 [CQ/QRZ HisCall Grid] 68 ? Optional
|
2016-07-19 11:24:15 -04:00
|
|
|
*/
|
2016-11-27 11:38:39 -05:00
|
|
|
|
2016-07-18 08:42:10 -04:00
|
|
|
float EbNodBEstimated;
|
2016-07-19 11:24:15 -04:00
|
|
|
int err=0;
|
2016-11-07 11:58:37 -05:00
|
|
|
int nSubmode=*ns0;
|
|
|
|
float b90=*b0;
|
|
|
|
int nFadingModel=*nf0;
|
2016-06-24 15:54:34 -04:00
|
|
|
|
2016-07-19 11:24:15 -04:00
|
|
|
if(pqra64codec==NULL) pqra64codec = qra64_init(QRA_USERAP);
|
|
|
|
err=qra64_apset(pqra64codec,*nc1,*nc2,*ng2,*APtype);
|
|
|
|
if(err<0) printf("ERROR: qra64_apset returned %d\n",err);
|
|
|
|
|
2016-07-20 11:38:29 -04:00
|
|
|
if(*iset==0) {
|
2016-11-07 11:47:40 -05:00
|
|
|
*rc = qra64_decode_fastfading(pqra64codec,&EbNodBEstimated,xdec,r,
|
2016-11-08 15:11:02 -05:00
|
|
|
nSubmode,b90,nFadingModel);
|
2016-07-20 11:38:29 -04:00
|
|
|
*snr = EbNodBEstimated - 31.0;
|
|
|
|
}
|
2016-06-22 16:45:29 -04:00
|
|
|
}
|
2016-11-08 15:11:02 -05:00
|
|
|
|