diff --git a/lib/q65_decode.f90 b/lib/q65_decode.f90 index 347621026..4269a3cc8 100644 --- a/lib/q65_decode.f90 +++ b/lib/q65_decode.f90 @@ -58,6 +58,8 @@ contains integer apsym0(58),aph10(10) integer apmask1(78),apsymbols1(78) integer apmask(13),apsymbols(13) + integer dgen(13) + integer codewords(63,64) logical lapcqonly,unpk77_success complex, allocatable :: c00(:) !Analytic signal, 6000 Sa/s complex, allocatable :: c0(:) !Analytic signal, 6000 Sa/s @@ -88,7 +90,6 @@ contains this%callback => callback if(nutc.eq.-999) print*,lapdx,nfa,nfb,nfqso !Silence warning nFadingModel=1 -! call qra_params(ndepth,maxaptype,idfmax,idtmax,ibwmin,ibwmax,maxdist) call timer('sync_q65',0) call sync_q65(iwave,ntrperiod*12000,mode65,nsps,nfqso,ntol,xdt,f0, & snr1,width) @@ -135,17 +136,26 @@ contains 1060 format(13b6.6) write(c78,1050) apsymbols1 read(c78,1060) apsymbols + if(iaptype.eq.4) then + do j=1,3 + ng15=32401+j + write(c78(60:74),'(b15.15)') ng15 + read(c78,1060) dgen + call q65_enc(dgen,codewords(1,j)) + enddo + endif endif call timer('q65loops',0) call q65_loops(c00,nutc,npts/2,nsps/2,nmode,mode65,nsubmode, & nFadingModel,ndepth,jpk0,xdt,f0,width,iaptype,apmask,apsymbols, & - snr1,xdt1,f1,snr2,irc,dat4) + codewords,snr1,xdt1,f1,snr2,irc,dat4) call timer('q65loops',1) snr2=snr2 + db(6912.0/nsps) if(irc.ge.0) exit enddo 100 decoded=' ' +! if(irc.lt.0 .and.iaptype.eq.4) print*,'AAA',irc,iaptype if(irc.ge.0) then !### navg=irc/100 diff --git a/lib/qra/q65/q65_ap.f90 b/lib/qra/q65/q65_ap.f90 index 6c56cd2f5..32e26a4ed 100644 --- a/lib/qra/q65/q65_ap.f90 +++ b/lib/qra/q65/q65_ap.f90 @@ -149,8 +149,8 @@ subroutine q65_ap(nQSOprogress,ipass,ncontest,lapcqonly,iaptype, & apmask(1:78)=1 !MyCall, HisCall, RRR|73|RR73 apmask(72:74)=0 !Check for , RRR, RR73, 73 apsymbols(1:58)=apsym0 - if(iaptype.eq.4) apsymbols(59:77)=mrrr - if(iaptype.eq.5) apsymbols(59:77)=m73 + if(iaptype.eq.4) apsymbols(59:77)=mrrr + if(iaptype.eq.5) apsymbols(59:77)=m73 if(iaptype.eq.6) apsymbols(59:77)=mrr73 else if(ncontest.eq.7.and.iaptype.eq.4) then ! Hound listens for MyCall RR73;... apmask(1:28)=1 diff --git a/lib/qra/q65/q65_loops.f90 b/lib/qra/q65/q65_loops.f90 index 1e1576556..5f680f18a 100644 --- a/lib/qra/q65/q65_loops.f90 +++ b/lib/qra/q65/q65_loops.f90 @@ -1,6 +1,6 @@ subroutine q65_loops(c00,nutc,npts2,nsps,mode,mode64,nsubmode,nFadingModel, & - ndepth,jpk0,xdt0,f0,width,iaptype,APmask,APsymbols,snr1,xdt1,f1, & - snr2,irc,dat4) + ndepth,jpk0,xdt0,f0,width,iaptype,APmask,APsymbols,codewords,snr1, & + xdt1,f1,snr2,irc,dat4) use packjt77 use timer_module, only: timer @@ -16,6 +16,7 @@ subroutine q65_loops(c00,nutc,npts2,nsps,mode,mode64,nsubmode,nFadingModel, & logical unpk77_success integer APmask(13) integer APsymbols(13) + integer codewords(63,64) integer dat4(13) !Decoded message (as 13 six-bit integers) integer nap(0:11) !AP return codes data nap/0,2,3,2,3,4,2,3,6,4,6,6/,nsave/0/ @@ -86,10 +87,15 @@ subroutine q65_loops(c00,nutc,npts2,nsps,mode,mode64,nsubmode,nFadingModel, & call timer('q65_intr',0) call q65_intrinsics_ff(s3,nsubmode,b90,nFadingModel,s3prob) call timer('q65_intr',1) - - call timer('q65_dec ',0) - call q65_dec(s3,s3prob,APmask,APsymbols,esnodb,dat4,irc) - call timer('q65_dec ',1) + if(iaptype.eq.4) then + call timer('q65_apli',0) + call q65_dec_fullaplist(s3,s3prob,codewords,3,esnodb,dat4,irc) + call timer('q65_apli',1) + else + call timer('q65_dec ',0) + call q65_dec(s3,s3prob,APmask,APsymbols,esnodb,dat4,irc) + call timer('q65_dec ',1) + endif if(irc.ge.0) go to 100 ! irc > 0 ==> number of iterations required to decode ! -1 = invalid params diff --git a/lib/qra/q65/q65_subs.c b/lib/qra/q65/q65_subs.c index b36adc540..688ef899a 100644 --- a/lib/qra/q65/q65_subs.c +++ b/lib/qra/q65/q65_subs.c @@ -80,11 +80,12 @@ void q65_dec_(float s3[], float s3prob[], int APmask[], int APsymbols[], float* esnodb0, int xdec[], int* rc0) { -/* Input: s3prob[LL,NN] Symbol-value intrinsic probabilities +/* Input: s3[LL,NN] Symbol spectra + * s3prob[LL,NN] Symbol-value intrinsic probabilities * APmask[13] AP information to be used in decoding * APsymbols[13] Available AP informtion * Output: - * esnodb0 Estimated Es/No in dB + * esnodb0 Estimated Es/No (dB) * xdec[13] Decoded 78-bit message as 13 six-bit integers * rc0 Return code from q65_decode() */ @@ -108,3 +109,37 @@ void q65_dec_(float s3[], float s3prob[], int APmask[], int APsymbols[], } *esnodb0 = esnodb; } + +void q65_dec_fullaplist_(float s3[], float s3prob[], int codewords[], + int* ncw, float* esnodb0, int xdec[], int* rc0) +{ +/* Input: s3[LL,NN] Symbol spectra + * s3prob[LL,NN] Symbol-value intrinsic probabilities + * codewords[63,ncw] Full codewords to search for + * ncw Number of codewords + * Output: + * esnodb0 Estimated Es/No (dB) + * xdec[13] Decoded 78-bit message as 13 six-bit integers + * rc0 Return code from q65_decode() + */ + + int rc; + int ydec[63]; + float esnodb; + + rc = q65_decode_fullaplist(&codec,ydec,xdec,s3prob,codewords,*ncw); + *rc0=rc; + + // rc = -1: Invalid params + // rc = -2: Decode failed + // rc = -3: CRC mismatch + *esnodb0 = 0.0; //Default Es/No for a failed decode + if(rc<0) return; + + rc = q65_esnodb_fastfading(&codec,&esnodb,ydec,s3); + if(rc<0) { + printf("error in q65_esnodb_fastfading()\n"); + exit(0); + } + *esnodb0 = esnodb; +}