mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-25 21:58:38 -05:00
Try APtype 4, 3, 2, 1, 0.
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6929 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
920fd25537
commit
f92afadc6c
@ -54,13 +54,15 @@
|
||||
typedef struct {
|
||||
float decEsNoMetric;
|
||||
int apflags;
|
||||
int apmsg_set[APTYPE_SIZE]; // indicate which ap type knowledge has been set by the user
|
||||
int apmsg_set[APTYPE_SIZE]; // indicate which ap type knowledge has
|
||||
// been set by the user
|
||||
// ap messages buffers
|
||||
int apmsg_cqqrz[12]; // [cq/qrz ? ?/blank]
|
||||
int apmsg_call1[12]; // [mycall ? ?/blank]
|
||||
int apmsg_call2[12]; // [? hiscall ?/blank]
|
||||
int apmsg_call1_call2[12]; // [mycall hiscall ?]
|
||||
int apmsg_call1_call2_grid[12]; // [mycall hiscall grid]
|
||||
|
||||
// ap messages masks
|
||||
int apmask_cqqrz[12];
|
||||
int apmask_cqqrz_ooo[12];
|
||||
@ -80,40 +82,38 @@ qra64codec *qra64_init(int flags);
|
||||
// QRA64 mode initialization function
|
||||
// arguments:
|
||||
// flags: set the decoder mode
|
||||
// When flags = QRA_NOAP no a-priori information will be used by the decoder
|
||||
// When flags = QRA_AUTOAP the decoder will attempt to decode with the amount
|
||||
// of available a-priori information
|
||||
// When flags = QRA_USERAP the decoder will attempt to decode with the amount
|
||||
// of a-priori information as provided by the caller with the function qra64_apset(...)
|
||||
// QRA_NOAP use no a-priori information
|
||||
// QRA_AUTOAP use any relevant previous decodes
|
||||
// QRA_USERAP use a-priori information provided via qra64_apset(...)
|
||||
// returns:
|
||||
// Pointer to the qra64codec data structure allocated and inizialized by the function
|
||||
// this handle should be passed to the encoding/decoding functions
|
||||
// Pointer to initialized qra64codec data structure
|
||||
// this pointer should be passed to the encoding/decoding functions
|
||||
//
|
||||
// 0 if unsuccessful (can't allocate memory)
|
||||
// -------------------------------------------------------------------------------------------
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void qra64_encode(qra64codec *pcodec, int *y, const int *x);
|
||||
// QRA64 mode encoder
|
||||
// QRA64 encoder
|
||||
// arguments:
|
||||
// pcodec = pointer to a qra64codec data structure as returned by qra64_init
|
||||
// x = pointer to the message to encode
|
||||
// x = pointer to the message to be encoded, int x[12]
|
||||
// x must point to an array of integers (i.e. defined as int x[12])
|
||||
// y = pointer to the encoded message
|
||||
// y must point to an array of integers of lenght 63 (i.e. defined as int y[63])
|
||||
// -------------------------------------------------------------------------------------------
|
||||
// y = pointer to encoded message, int y[63]=
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
int qra64_decode(qra64codec *pcodec, float *ebno, int *x, const float *r);
|
||||
// QRA64 mode decoder
|
||||
// arguments:
|
||||
// pcodec = pointer to a qra64codec data structure as returned by qra64_init
|
||||
// ebno = pointer to a float number where the avg Eb/No (in dB) will be stored
|
||||
// in case of successfull decoding (pass a null pointer if not interested)
|
||||
// x = pointer to the array of integers where the decoded message will be stored
|
||||
// x must point to an array of integers (i.e. defined as int x[12])
|
||||
// r = pointer to the received symbols energies (squared amplitudes)
|
||||
// r must point to an array of QRA64_M*QRA64_N (=64*63=4032) float numbers.
|
||||
// The first QRA_M entries should be the energies of the first symbol in the codeword
|
||||
// The last QRA_M entries should be the energies of the last symbol in the codeword
|
||||
// ebno = pointer to a float where the avg Eb/No (in dB) will be stored
|
||||
// in case of successfull decoding
|
||||
// (pass a null pointer if not interested)
|
||||
// x = pointer to decoded message, int x[12]
|
||||
// r = pointer to received symbol energies (squared amplitudes)
|
||||
// r must point to an array of length QRA64_M*QRA64_N (=64*63=4032)
|
||||
// The first QRA_M entries should be the energies of the first
|
||||
// symbol in the codeword; the last QRA_M entries should be the
|
||||
// energies of the last symbol in the codeword
|
||||
//
|
||||
// return code:
|
||||
//
|
||||
@ -129,17 +129,18 @@ int qra64_decode(qra64codec *pcodec, float *ebno, int *x, const float *r);
|
||||
// rc=6 [? CALL ?] AP29
|
||||
// rc=7 [? CALL ] AP45
|
||||
// rc=8 [CALL CALL GRID] AP72
|
||||
// return codes in the range 1-8 indicate the amount and the type of a-priori information
|
||||
// which was required to decode the received message
|
||||
// return codes in the range 1-8 indicate the amount and the type of a-priori
|
||||
// information was required to decode the received message.
|
||||
|
||||
int qra64_apset(qra64codec *pcodec, const int mycall, const int hiscall, const int grid, const int aptype);
|
||||
// Set decoder a-priori knowledge accordingly to the type of the message to look up for
|
||||
// Set decoder a-priori knowledge accordingly to the type of the message to
|
||||
// look up for
|
||||
// arguments:
|
||||
// pcodec = pointer to a qra64codec data structure as returned by qra64_init
|
||||
// mycall = mycall to look for
|
||||
// hiscall = hiscall to look for
|
||||
// grid = grid to look for
|
||||
// aptype = define the type of AP to be set accordingly to the following table:
|
||||
// aptype = define the type of AP to be set:
|
||||
// APTYPE_CQQRZ set [cq/qrz ? ?/blank]
|
||||
// APTYPE_MYCALL set [mycall ? ?/blank]
|
||||
// APTYPE_HISCALL set [? hiscall ?/blank]
|
||||
@ -148,9 +149,8 @@ int qra64_apset(qra64codec *pcodec, const int mycall, const int hiscall, const i
|
||||
// returns:
|
||||
// 0 on success
|
||||
// -1 when qra64_init was called with the QRA_NOAP flag
|
||||
// -2 invalid apytpe (aptype must be in the range [APTYPE_MYCALL..APTYPE_FULL]
|
||||
// (APTYPE_CQQRZ [cq/qrz ? ?] is set during the initialization function and
|
||||
// doesn't need to be set by the user
|
||||
// -2 invalid apytpe (valid range [APTYPE_MYCALL..APTYPE_FULL]
|
||||
// (APTYPE_CQQRZ [cq/qrz ? ?] is set by default )
|
||||
|
||||
void qra64_apdisable(qra64codec *pcodec, const int aptype);
|
||||
// disable specific AP type
|
||||
@ -168,7 +168,7 @@ void qra64_close(qra64codec *pcodec);
|
||||
// arguments:
|
||||
// pcodec = pointer to a qra64codec data structure as returned by qra64_init
|
||||
|
||||
// -------------------------------------------------------------------------------------------
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// encode/decode std msgs in 12 symbols as done in jt65
|
||||
void encodemsg_jt65(int *y, const int call1, const int call2, const int grid);
|
||||
|
@ -10,44 +10,48 @@ static qra64codec *pqra64codec = NULL;
|
||||
|
||||
void qra64_enc_(int x[], int y[])
|
||||
{
|
||||
if (pqra64codec==NULL) pqra64codec = qra64_init(QRA_AUTOAP);
|
||||
if (pqra64codec==NULL) pqra64codec = qra64_init(QRA_USERAP);
|
||||
qra64_encode(pqra64codec, y, x);
|
||||
}
|
||||
|
||||
void qra64_dec_(float r[], int* nmycall, int* nhiscall, int* nhisgrid,
|
||||
void qra64_dec_(float r[], int* nc1, int* nc2, int* ng2, int* APtype,
|
||||
int xdec[], float* snr, int* rc)
|
||||
{
|
||||
// Return codes:
|
||||
// rc=-16 failed sanity check
|
||||
// rc=-2 decoded, but crc check failed
|
||||
// rc=-1 no decode
|
||||
// rc=0 [? ? ?] AP0 (decoding with no a-priori information)
|
||||
// rc=1 [CQ ? ?] AP27
|
||||
// rc=2 [CQ ? ] AP42
|
||||
// rc=3 [CALL ? ?] AP29
|
||||
// rc=4 [CALL ? ] AP44
|
||||
// rc=5 [CALL CALL ?] AP57
|
||||
// rc=6 [? CALL ?] AP29
|
||||
// rc=7 [? CALL ] AP44
|
||||
// rc=8 [CALL CALL G] AP72
|
||||
/*
|
||||
APtype:
|
||||
-1 (no AP information)
|
||||
0 [CQ/QRZ * ?_] (* means 26 or 28 bit info)
|
||||
1 [call1 * ?_] (?_ means 16-bit info or "blank")
|
||||
2 [* call2 ?_]
|
||||
3 [call1 call2 ?_]
|
||||
4 [call1 call2 grid]
|
||||
|
||||
static ncall0=-1;
|
||||
int ncall=*nmycall;
|
||||
Return codes:
|
||||
-16 Failed sanity check
|
||||
-2 Decoded, but crc check failed
|
||||
-1 No decode
|
||||
0 [? ? ?] AP0 (decoding with no a-priori information)
|
||||
1 [CQ ? ?] AP27
|
||||
2 [CQ ? ] AP42
|
||||
3 [CALL ? ?] AP29
|
||||
4 [CALL ? ] AP44
|
||||
5 [CALL CALL ?] AP57
|
||||
6 [? CALL ?] AP29
|
||||
7 [? CALL ] AP44
|
||||
8 [CALL CALL G] AP72
|
||||
*/
|
||||
static int nc1z=-1;
|
||||
float EbNodBEstimated;
|
||||
int err=0;
|
||||
|
||||
#ifdef NICO_WANTS_SNR_DUMP
|
||||
FILE *fout;
|
||||
#endif
|
||||
|
||||
if(ncall!=ncall0) {
|
||||
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);
|
||||
ncall0=ncall;
|
||||
}
|
||||
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);
|
||||
|
||||
*rc = qra64_decode(pqra64codec,&EbNodBEstimated,xdec,r);
|
||||
*snr = EbNodBEstimated - 31.0;
|
||||
|
||||
|
@ -8,6 +8,7 @@ subroutine qra64a(dd,nf1,nf2,nfqso,ntol,mycall_12,hiscall_12,hisgrid_6, &
|
||||
character*6 mycall,hiscall,hisgrid_6
|
||||
character*4 hisgrid
|
||||
logical ltext
|
||||
integer*8 count0,count1,clkfreq
|
||||
integer icos7(0:6)
|
||||
integer ipk(1)
|
||||
integer jpk(1)
|
||||
@ -126,7 +127,10 @@ subroutine qra64a(dd,nf1,nf2,nfqso,ntol,mycall_12,hiscall_12,hisgrid_6, &
|
||||
call packcall(hiscall,nhiscall,ltext)
|
||||
call packgrid(hisgrid,nhisgrid,ltext)
|
||||
snr2=-99.
|
||||
call qra64_dec(s3,nmycall,nhiscall,nhisgrid,dat4,snr2,irc) !Attempt decoding
|
||||
ttot=0.
|
||||
do naptype=4,0,-1
|
||||
call system_clock(count0,clkfreq)
|
||||
call qra64_dec(s3,nmycall,nhiscall,nhisgrid,naptype,dat4,snr2,irc)
|
||||
if(irc.ge.0) then
|
||||
call unpackmsg(dat4,decoded) !Unpack the user message
|
||||
call fmtmsg(decoded,iz)
|
||||
@ -135,10 +139,14 @@ subroutine qra64a(dd,nf1,nf2,nfqso,ntol,mycall_12,hiscall_12,hisgrid_6, &
|
||||
else
|
||||
snr2=0.
|
||||
endif
|
||||
call system_clock(count1,clkfreq)
|
||||
tsec=float(count1-count0)/float(clkfreq)
|
||||
ttot=ttot+tsec
|
||||
write(78,3900) sync,snr1,snr2,snr2-snr1,dtx,nfreq,nhard,naptype,irc, &
|
||||
tsec,ttot,decoded
|
||||
3900 format(4f6.1,f6.2,i5,i3,i2,i3,2f6.3,1x,a22)
|
||||
if(irc.ge.0) exit
|
||||
enddo
|
||||
|
||||
900 continue
|
||||
write(78,3900) sync,snr1,snr2,snr2-snr1,dtx,nfreq,nhard,irc,decoded
|
||||
3900 format(4f7.1,f7.2,i6,2i4,2x,a22)
|
||||
|
||||
return
|
||||
900 return
|
||||
end subroutine qra64a
|
||||
|
Loading…
Reference in New Issue
Block a user