diff options
Diffstat (limited to 'qmap/libqmap')
| -rw-r--r-- | qmap/libqmap/CMakeLists.txt | 16 | ||||
| -rw-r--r-- | qmap/libqmap/cacb_mod.f90 | 23 | ||||
| -rw-r--r-- | qmap/libqmap/decode0.f90 | 4 | ||||
| -rw-r--r-- | qmap/libqmap/fftbig.f90 | 8 | ||||
| -rw-r--r-- | qmap/libqmap/getcand2.f90 | 1 | ||||
| -rw-r--r-- | qmap/libqmap/q65b.f90 | 22 | ||||
| -rw-r--r-- | qmap/libqmap/q65c.f90 | 6 | ||||
| -rw-r--r-- | qmap/libqmap/qmap_decode_ipc.f90 | 18 | ||||
| -rw-r--r-- | qmap/libqmap/qmapa.f90 | 6 | ||||
| -rw-r--r-- | qmap/libqmap/read_qm.f90 | 11 | ||||
| -rw-r--r-- | qmap/libqmap/save_qm.f90 | 2 |
11 files changed, 85 insertions, 32 deletions
diff --git a/qmap/libqmap/CMakeLists.txt b/qmap/libqmap/CMakeLists.txt index 2eb3a0bb..5480486b 100644 --- a/qmap/libqmap/CMakeLists.txt +++ b/qmap/libqmap/CMakeLists.txt @@ -1,5 +1,7 @@ set (libq65_FSRCS # Modules come first: + qmap_decode_ipc.f90 + cacb_mod.f90 # Non-module Fortran routines: astro.f90 @@ -48,10 +50,20 @@ set (libq65_C_and_CXXSRCS set_property (SOURCE ${libq65_C_and_CXXSRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -include wsjtx_config.h") set_property (SOURCE ${libq65_C_and_CXXSRCS} APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_BINARY_DIR}/wsjtx_config.h) +# These carry dummy arguments that are genuine QMAP-GUI-supplied state +# (see qmap/mainwindow.cpp) which the current Fortran implementation +# doesn't happen to reference; removing them would mean touching the +# GUI call sites too, so we suppress the warning instead. +set_source_files_properties (chkstat.f90 PROPERTIES COMPILE_FLAGS "-Wno-unused-dummy-argument") +set_source_files_properties (symspec.f90 PROPERTIES COMPILE_FLAGS "-Wno-unused-dummy-argument") +set_source_files_properties (q65b.f90 PROPERTIES COMPILE_FLAGS "-Wno-unused-dummy-argument") + # # build our targets # add_library (qmap_impl STATIC ${libq65_FSRCS} ${libq65_CSRCS} ${libq65_CXXSRCS}) -target_link_libraries (qmap_impl wsjt_fort wsjt_cxx Qt5::Core) - +if (NOT APPLE) + target_link_libraries (qmap_impl PUBLIC Qt5::Core) +endif () +wsjt_link_common_fortran (qmap_impl) diff --git a/qmap/libqmap/cacb_mod.f90 b/qmap/libqmap/cacb_mod.f90 new file mode 100644 index 00000000..ed4af75c --- /dev/null +++ b/qmap/libqmap/cacb_mod.f90 @@ -0,0 +1,23 @@ +module cacb_mod + implicit none + + complex, allocatable :: ca(:) ! FFT of raw I/Q data from Linrad + +contains + + subroutine init_cacb(n) + integer, intent(in) :: n + + if (allocated(ca)) then + if (size(ca) >= n) return + deallocate(ca) + endif + + allocate(ca(n)) + end subroutine init_cacb + + subroutine free_cacb() + if (allocated(ca)) deallocate(ca) + end subroutine free_cacb + +end module cacb_mod diff --git a/qmap/libqmap/decode0.f90 b/qmap/libqmap/decode0.f90 index d119fdcb..901da861 100644 --- a/qmap/libqmap/decode0.f90 +++ b/qmap/libqmap/decode0.f90 @@ -1,6 +1,7 @@ subroutine decode0(dd,ss,savg) use timer_module, only: timer + use qmap_decode_ipc, only: nQDecoderDone parameter (NSMAX=60*96000,NFFT=32768) real*4 dd(2,NSMAX),ss(400,NFFT),savg(NFFT) @@ -10,9 +11,6 @@ subroutine decode0(dd,ss,savg) logical*1 bAlso30 character mycall*12,hiscall*12,mygrid*6,hisgrid*6,datetime*20 character mycall0*12,hiscall0*12,hisgrid0*6 - character*72 result - common/decodes/ndecodes,ncand2,nQDecoderDone,nWDecoderBusy, & - nWTransmitting,kHzRequested,result(50) common/npar/fcenter,nutc,fselected,mousedf,mousefqso,nagain, & ndepth,ndiskdat,ntx60,newdat,nfa,nfb,nfcal,nfshift, & ntx30a,ntx30b,ntol,n60,nCFOM,nfsample,ndop58,nmode, & diff --git a/qmap/libqmap/fftbig.f90 b/qmap/libqmap/fftbig.f90 index 085fd39f..5fc2af6e 100644 --- a/qmap/libqmap/fftbig.f90 +++ b/qmap/libqmap/fftbig.f90 @@ -6,13 +6,12 @@ subroutine fftbig(dd,nmax) use FFTW3 use timer_module, only: timer + use cacb_mod, only: ca, init_cacb, free_cacb parameter (MAXFFT1=5376000) real*4 dd(2,nmax) !Input data - complex ca(MAXFFT1) !FFT of input real*8 df type(C_PTR) :: plan1 !Pointer to FFTW plan logical first - common/cacb/ca equivalence (rfilt,cfilt) data first/.true./,npatience/0/ save @@ -20,6 +19,7 @@ subroutine fftbig(dd,nmax) if(nmax.lt.0) go to 900 nfft1=MAXFFT1 + call init_cacb(nfft1) if(first) then nflags=FFTW_ESTIMATE if(npatience.eq.1) nflags=FFTW_ESTIMATE_PATIENT @@ -50,7 +50,9 @@ subroutine fftbig(dd,nmax) call timer('FFTbig ',1) go to 999 -900 call fftwf_destroy_plan(plan1) +900 if(.not.first) call fftwf_destroy_plan(plan1) + call free_cacb() + first=.true. 999 return end subroutine fftbig diff --git a/qmap/libqmap/getcand2.f90 b/qmap/libqmap/getcand2.f90 index 521f97f6..c98c3088 100644 --- a/qmap/libqmap/getcand2.f90 +++ b/qmap/libqmap/getcand2.f90 @@ -16,6 +16,7 @@ subroutine getcand2(ss,savg0,nts_q65,nagain,nhsym,ntx30a,ntx30b, & type(candidate) :: cand(MAX_CANDIDATES) real ss(400,NFFT) !Symbol spectra real savg0(NFFT),savg(NFFT) !Average spectra over whole Rx sequence + save savg !Keep this big array off the stack integer ipk1(1) !Peak index of local portion of spectrum logical sync_ok !True if sync pattern is present logical*1 bAlso30 diff --git a/qmap/libqmap/q65b.f90 b/qmap/libqmap/q65b.f90 index 8409b798..619f785d 100644 --- a/qmap/libqmap/q65b.f90 +++ b/qmap/libqmap/q65b.f90 @@ -6,20 +6,24 @@ subroutine q65b(nutc,nqd,fcenter,nfcal,nfsample,ikhz,mousedf,ntol, & ! This routine provides an interface between QMAP and the Q65 decoder ! in WSJT-X. All arguments are input data obtained from the QMAP GUI. ! Raw Rx data are available as the 96 kHz complex spectrum ca(MAXFFT1) -! in common/cacb. Decoded messages are sent back to the GUI. +! in cacb_mod. Decoded messages are sent back to the GUI. use q65_decode use wavhdr use timer_module, only: timer + use map65_mmdec_mod, only: map65_mmdec + use qmap_decode_ipc, only: max_decode_rows, decode_row_length, & + ndecodes, result, result2 + use iso_fortran_env, only: int16 + use cacb_mod, only: ca, init_cacb parameter (MAXFFT1=5376000) !56*96000 parameter (MAXFFT2=336000) !56*6000 (downsampled by 1/16) parameter (NMAX=60*12000) parameter (RAD=57.2957795) type(hdr) h - integer*2 iwave(60*12000) + integer(int16) iwave(300*12000) integer offset - complex ca(MAXFFT1) !FFT of raw I/Q data from Linrad complex cx(0:MAXFFT2-1),cz(0:MAXFFT2) real*8 fcenter,freq0,freq1 logical*1 bClickDecode @@ -29,17 +33,13 @@ subroutine q65b(nutc,nqd,fcenter,nfcal,nfsample,ikhz,mousedf,ntol, & character*4 grid4 character*3 csubmode character*17 fname - character*72 result,ctmp - character*8 result2 !liveCQ + character(len=decode_row_length) ctmp character*20 datetime,datetime1 - character*1 c1 - common/decodes/ndecodes,ncand2,nQDecoderDone,nWDecoderBusy, & - nWTransmitting,kHzRequested,result(50) - common/decodes2/result2(50) !liveCQ - common/cacb/ca data ifile/0/ save + call init_cacb(MAXFFT1) + if(mycall0(1:1).ne.' ') mycall=mycall0 if(hiscall0(1:1).ne.' ') hiscall=hiscall0 if(hisgrid(1:4).ne.' ') grid4=hisgrid(1:4) @@ -161,7 +161,7 @@ subroutine q65b(nutc,nqd,fcenter,nfcal,nfsample,ikhz,mousedf,ntol, & frx=0.001*k0*df+nkhz_center-48.0+1.0 - 0.001*nfcal fsked=frx - 0.001*ndop00/2.0 - 0.001*offset ctmp=csubmode//' '//trim(msg0) - ndecodes=min(ndecodes+1,50) + ndecodes=min(ndecodes+1,max_decode_rows) write(result(ndecodes),1120) nhhmmss,frx,fsked,xdt0,nsnr0,trim(ctmp) 1120 format(i6.6,f9.3,f7.1,f7.2,i5,2x,a) write(result2(ndecodes),1125) fsked !liveCQ diff --git a/qmap/libqmap/q65c.f90 b/qmap/libqmap/q65c.f90 index 51b4335e..eadf53d7 100644 --- a/qmap/libqmap/q65c.f90 +++ b/qmap/libqmap/q65c.f90 @@ -6,6 +6,7 @@ subroutine q65c use FFTW3 use q65 use q65_decode + use qmap_decode_ipc, only: ndecodes parameter (NFFT=32768) include 'njunk.f90' @@ -20,11 +21,6 @@ subroutine q65c character*12 mycall,hiscall character*6 mygrid,hisgrid character*20 datetime - character*72 result - character*8 result2 !liveCQ - common/decodes/ndecodes,ncand2,nQDecoderDone,nWDecoderBusy, & - nWTransmitting,kHzRequested,result(50) - common/decodes2/result2(50) !liveCQ common/datcom2/dd(2,5760000),ss(400,NFFT),savg(NFFT),nparams0 common/savecom/revision,fname !### REMEMBER that /npar/ is not updated until nparams=nparams0 is executed. ### diff --git a/qmap/libqmap/qmap_decode_ipc.f90 b/qmap/libqmap/qmap_decode_ipc.f90 new file mode 100644 index 00000000..0f8d5d5e --- /dev/null +++ b/qmap/libqmap/qmap_decode_ipc.f90 @@ -0,0 +1,18 @@ +module qmap_decode_ipc + implicit none + + ! Keep row dimensions in sync with qmap/decode_ipc.h. + integer, parameter :: max_decode_rows = 50 + integer, parameter :: decode_row_length = 80 + integer, parameter :: live_cq_row_length = 8 + + integer ndecodes,ncand2,nQDecoderDone,nWDecoderBusy + integer nWTransmitting,kHzRequested + character(len=decode_row_length) result(max_decode_rows) + character(len=live_cq_row_length) result2(max_decode_rows) + + common/decodes/ndecodes,ncand2,nQDecoderDone,nWDecoderBusy, & + nWTransmitting,kHzRequested,result + common/decodes2/result2 + +end module qmap_decode_ipc diff --git a/qmap/libqmap/qmapa.f90 b/qmap/libqmap/qmapa.f90 index 7c299885..2b785622 100644 --- a/qmap/libqmap/qmapa.f90 +++ b/qmap/libqmap/qmapa.f90 @@ -6,6 +6,7 @@ subroutine qmapa(dd,ss,savg,newdat,nutc,fcenter,ntol,nfa,nfb, & ! Processes timf2 data received from Linrad to find and decode Q65 signals. use timer_module, only: timer + use qmap_decode_ipc, only: ndecodes, ncand2 type candidate real :: snr !Relative S/N of sync detection @@ -33,12 +34,7 @@ subroutine qmapa(dd,ss,savg,newdat,nutc,fcenter,ntol,nfa,nfb, & character mycall*12,hiscall*12,hisgrid*6 type(candidate) :: cand(MAX_CANDIDATES) type(good_decode) found(MAX_CANDIDATES) - character*72 result - character*8 result2 !liveCQ character*20 datetime - common/decodes/ndecodes,ncand2,nQDecoderDone,nWDecoderBusy, & - nWTransmitting,kHzRequested,result(50) - common/decodes2/result2(50) !liveCQ save tsec0=sec_midn() diff --git a/qmap/libqmap/read_qm.f90 b/qmap/libqmap/read_qm.f90 index 67e3a0cd..30b02eda 100644 --- a/qmap/libqmap/read_qm.f90 +++ b/qmap/libqmap/read_qm.f90 @@ -7,21 +7,28 @@ subroutine read_qm(fname,iret) real*8 fcenter integer nxtra(15) !For possible future additions integer*1 id1(2,NMAX) + save id1 !Keep this big array off the stack common/datcom/dd(2,5760000),ss(400,NFFT),savg(NFFT), & fcenter,nutc,fselected,mousedf,mousefqso,nagain, & ndepth,ndiskdat,ntx60,newdat,nn1,nn2,nfcal,nfshift, & ntx30a,ntx30b !... open(28,file=trim(fname),status='old',access='stream',err=900) - read(28,end=910) prog_id,mycall,mygrid,fcenter,nutc,ntx30a, & + read(28,end=910,err=910) prog_id,mycall,mygrid,fcenter,nutc,ntx30a, & ntx30b,ndop00,ndop58,ia,ib,fac0,nxtra + + if(.not. ((ia.eq.1 .and. ib.eq.NMAX) .or. & + (ia.eq.1 .and. ib.eq.NMAX/2) .or. & + (ia.eq.NMAX/2+1 .and. ib.eq.NMAX) .or. & + (ia.eq.NMAX/2+1 .and. ib.eq.NMAX/2))) go to 910 + iret=3 if(ib.eq.NMAX/2) iret=1 if(ia.eq.NMAX/2+1) iret=2 fac=1.0 if(fac0.gt.0.0) fac=1.0/fac0 id1=0 - read(28,end=910) id1(1:2,ia:ib) + read(28,end=910,err=910) id1(1:2,ia:ib) dd=0. dd(1:2,ia:ib)=fac*id1(1:2,ia:ib) !Boost back to previous level go to 999 diff --git a/qmap/libqmap/save_qm.f90 b/qmap/libqmap/save_qm.f90 index 282f29b8..94a32b0b 100644 --- a/qmap/libqmap/save_qm.f90 +++ b/qmap/libqmap/save_qm.f90 @@ -15,6 +15,7 @@ subroutine save_qm(fname,revision,mycall,mygrid,dd,ntx30a,ntx30b,fcenter, & ib=NMAX if(ntx30a.gt.5) ia=NMAX/2+1 if(ntx30b.gt.5) ib=NMAX/2 + if(ia.gt.ib) return sq=0. do i=ia,ib @@ -60,4 +61,3 @@ subroutine save_qm(fname,revision,mycall,mygrid,dd,ntx30a,ntx30b,fcenter, & return end subroutine save_qm - |
