Interface to q65_intrinsics_fastfading changed to support B90Ts instead of B90 and then supporting correctly modes with any T/R interval

This commit is contained in:
Nico Palermo/IV3NWV 2020-11-23 06:03:59 +01:00
parent de468e071a
commit 6fa9f76a75
5 changed files with 23 additions and 18 deletions

View File

@ -137,9 +137,13 @@ contains
read(c78,1060) apsymbols
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)
! baud rate required to compute B90TS later
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)
snr1,xdt1,f1,snr2,irc,dat4,baud)
call timer('q65loops',1)
snr2=snr2 + db(6912.0/nsps)
if(irc.ge.0) exit

View File

@ -277,9 +277,9 @@ int q65_esnodb(const q65_codec_ds *pCodec, float *pEsNodB, const int *ydec, cons
// Symbol time interval in seconds
#define TS_QRA64 0.576
#define TS_Q65 0.640
// #define TS_Q65 0.640 // T/R = 60 s
// The tables are computed assuming that the bin spacing is that of QRA64, that's to say
// 1/Ts = 12000/6912 Hz, but in q65 Ts is longer (0.640 s) and the table index
// 1/Ts = 12000/6912 Hz, but in Q65 Ts depends on the T/R interval and the table index
// corresponding to a given B90 must be scaled appropriately.
// See below.
@ -287,7 +287,7 @@ int q65_intrinsics_fastfading(q65_codec_ds *pCodec,
float *pIntrinsics, // intrinsic symbol probabilities output
const float *pInputEnergies, // received energies input
const int submode, // submode idx (0=A ... 4=E)
const float B90, // spread bandwidth (90% fractional energy)
const float B90Ts, // spread bandwidth (90% fractional energy)
const int fadingModel) // 0=Gaussian 1=Lorentzian fade model
{
int n, k, j;
@ -295,26 +295,26 @@ int q65_intrinsics_fastfading(q65_codec_ds *pCodec,
int hidx, hlen, hhsz, hlast;
const float *hptr;
float fTemp, fNoiseVar, sumix, maxlogp;
float EsNoMetric;
float EsNoMetric,B90;
float *weight;
const float *pCurSym, *pCurBin;
float *pCurIx;
// printf("pcodec=%08x submode=%d fadingmodel=%d B90Ts=%f\n",pcodec, submode,fadingModel, B90Ts);
if (pCodec==NULL)
return Q65_DECODE_INVPARAMS; // invalid pCodec pointer
if (submode<0 || submode>4)
return Q65_DECODE_INVPARAMS; // invalid submode
// As the symbol duration in q65 is longer than in QRA64 the fading tables continue
// to be valid if the B90 parameter is scaled by the actual symbol rate
// As the symbol duration in q65 is different than in QRA64,
// the fading tables continue to be valid if the B90Ts parameter
// is properly scaled to the QRA64 symbol interval
// Compute index to most appropriate weighting function coefficients
hidx = (int)(logf(B90*TS_Q65/TS_QRA64)/logf(1.09f) - 0.499f);
// if (hidx<0 || hidx > 64)
// // index of weighting function out of range
// // B90 out of range
// return q65_DECODE_INVPARAMS;
B90 = B90Ts/TS_QRA64;
hidx = (int)(logf(B90)/logf(1.09f) - 0.499f);
// Unlike in QRA64 we accept any B90, anyway limiting it to
// the extreme cases (0.9 to 210 Hz approx.)

View File

@ -69,7 +69,7 @@ int q65_intrinsics_fastfading(q65_codec_ds *pCodec,
float *pIntrinsics, // intrinsic symbol probabilities output
const float *pInputEnergies, // received energies input
const int submode, // submode idx (0=A ... 4=E)
const float B90, // spread bandwidth (90% fractional energy)
const float B90Ts, // normalized spread bandwidth (90% fractional energy)
const int fadingModel); // 0=Gaussian 1=Lorentzian fade model

View File

@ -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)
snr2,irc,dat4,baud)
use packjt77
use timer_module, only: timer
@ -84,7 +84,8 @@ subroutine q65_loops(c00,nutc,npts2,nsps,mode,mode64,nsubmode,nFadingModel, &
if(b90.gt.230.0) cycle
! if(b90.lt.0.15*width) exit
call timer('q65_intr',0)
call q65_intrinsics_ff(s3,nsubmode,b90,nFadingModel,s3prob)
b90ts = b90/baud
call q65_intrinsics_ff(s3,nsubmode,b90ts,nFadingModel,s3prob)
call timer('q65_intr',1)
call timer('q65_dec ',0)

View File

@ -46,7 +46,7 @@ void q65_enc_(int x[], int y[])
q65_encode(&codec,y,x);
}
void q65_intrinsics_ff_(float s3[], int* submode, float* B90,
void q65_intrinsics_ff_(float s3[], int* submode, float* B90Ts,
int* fadingModel, float s3prob[])
{
@ -69,7 +69,7 @@ void q65_intrinsics_ff_(float s3[], int* submode, float* B90,
}
first=0;
}
rc = q65_intrinsics_fastfading(&codec,s3prob,s3,*submode,*B90,*fadingModel);
rc = q65_intrinsics_fastfading(&codec,s3prob,s3,*submode,*B90Ts,*fadingModel);
if(rc<0) {
printf("error in q65_intrinsics()\n");
exit(0);