/* The algorithms, source code, look-and-feel of WSJT-X and related * programs, and protocol specifications for the modes FSK441, FT8, JT4, * JT6M, JT9, JT65, JTMS, QRA64, ISCAT, MSK144, are Copyright © 2001-2017 * by one or more of the following authors: Joseph Taylor, K1JT; Bill * Somerville, G4WJS; Steven Franke, K9AN; Nico Palermo, IV3NWV; Greg Beam, * KI7MT; Michael Black, W9MDB; Edson Pereira, PY2SDR; Philip Karn, KA9Q; * and other members of the WSJT Development Group. * * MSHV Decoder * Rewritten into C++ and modified by Hrisimir Hristov, LZ2HV 2015-2017 * (Edited by Harper Innes, VK1TTY - to remove Gendered Language and Replace with Non-Gendered language) NOTE:May be used under the terms of the GNU General Public License (GPL) */ #include "decoderms.h" #include using namespace std; // zaradi max( static const double DEC_SAMPLE_RATE_11025 = 11025.0; static const double DEC_SAMPLE_RATE_12000 = 12000.0; //#include #define MAXDUPMSGTHR 120 //2.63 from 100 to 120 DecoderMs::DecoderMs()//QObject *parent //: QObject(parent) { pomAll.initPomAll();//2.66 for pctile_shell in jt65 and pi4 for (int i = 0; i < MAXDUPMSGTHR; ++i) { dup_amsgs_thr[i] = ""; dup_afs_thr[i]=0; } dup_camsgf_thr = 0; is_thrTime = false; s_thr_used = 1; TheirGridLoc = ""; s_nftx = 1200.0; s_nQSOProgress = 0;//default -> CQ LZ2HV KN23 for +AP s_lapon = false; //default for +AP // //f_multi_answer_mod = false; //s_ncontest_ft8_2 = 0; /////////// FT4 /////////////////////////////////////////////////////////// DecFt4_0 = new DecoderFt4(0); connect(DecFt4_0, SIGNAL(EmitDecodetTextFt(QStringList)), this, SLOT(SetDecodetTextFtQ65(QStringList))); connect(DecFt4_0, SIGNAL(EmitBackColor()), this, SLOT(ThrSetBackColor())); DecFt4_1 = new DecoderFt4(1); connect(DecFt4_1, SIGNAL(EmitDecodetTextFt(QStringList)), this, SLOT(SetDecodetTextFtQ65(QStringList))); connect(DecFt4_1, SIGNAL(EmitBackColor()), this, SLOT(ThrSetBackColor())); DecFt4_2 = new DecoderFt4(2); connect(DecFt4_2, SIGNAL(EmitDecodetTextFt(QStringList)), this, SLOT(SetDecodetTextFtQ65(QStringList))); connect(DecFt4_2, SIGNAL(EmitBackColor()), this, SLOT(ThrSetBackColor())); DecFt4_3 = new DecoderFt4(3); connect(DecFt4_3, SIGNAL(EmitDecodetTextFt(QStringList)), this, SLOT(SetDecodetTextFtQ65(QStringList))); connect(DecFt4_3, SIGNAL(EmitBackColor()), this, SLOT(ThrSetBackColor())); DecFt4_4 = new DecoderFt4(4); connect(DecFt4_4, SIGNAL(EmitDecodetTextFt(QStringList)), this, SLOT(SetDecodetTextFtQ65(QStringList))); connect(DecFt4_4, SIGNAL(EmitBackColor()), this, SLOT(ThrSetBackColor())); DecFt4_5 = new DecoderFt4(5); connect(DecFt4_5, SIGNAL(EmitDecodetTextFt(QStringList)), this, SLOT(SetDecodetTextFtQ65(QStringList))); connect(DecFt4_5, SIGNAL(EmitBackColor()), this, SLOT(ThrSetBackColor())); /////////// FT4 END /////////////////////////////////////////////////////// /////////// FT8 /////////////////////////////////////////////////////////// //ft8 3 dec fromBufFt = false; id3decFt = 0; c_stat_ftb[0] = 0; c_stat_ftb[1] = 0; is_stat_ftb[0] = false; is_stat_ftb[1] = false; is_ftBuff = false; DecFt8_0 = new DecoderFt8(0); connect(DecFt8_0, SIGNAL(EmitDecodetTextFt(QStringList)), this, SLOT(SetDecodetTextFtQ65(QStringList))); connect(DecFt8_0, SIGNAL(EmitBackColor()), this, SLOT(ThrSetBackColor())); DecFt8_1 = new DecoderFt8(1); connect(DecFt8_1, SIGNAL(EmitDecodetTextFt(QStringList)), this, SLOT(SetDecodetTextFtQ65(QStringList))); connect(DecFt8_1, SIGNAL(EmitBackColor()), this, SLOT(ThrSetBackColor())); DecFt8_2 = new DecoderFt8(2); connect(DecFt8_2, SIGNAL(EmitDecodetTextFt(QStringList)), this, SLOT(SetDecodetTextFtQ65(QStringList))); connect(DecFt8_2, SIGNAL(EmitBackColor()), this, SLOT(ThrSetBackColor())); DecFt8_3 = new DecoderFt8(3); connect(DecFt8_3, SIGNAL(EmitDecodetTextFt(QStringList)), this, SLOT(SetDecodetTextFtQ65(QStringList))); connect(DecFt8_3, SIGNAL(EmitBackColor()), this, SLOT(ThrSetBackColor())); DecFt8_4 = new DecoderFt8(4); connect(DecFt8_4, SIGNAL(EmitDecodetTextFt(QStringList)), this, SLOT(SetDecodetTextFtQ65(QStringList))); connect(DecFt8_4, SIGNAL(EmitBackColor()), this, SLOT(ThrSetBackColor())); DecFt8_5 = new DecoderFt8(5); connect(DecFt8_5, SIGNAL(EmitDecodetTextFt(QStringList)), this, SLOT(SetDecodetTextFtQ65(QStringList))); connect(DecFt8_5, SIGNAL(EmitBackColor()), this, SLOT(ThrSetBackColor())); /////////// END FT8 /////////////////////////////////////////////////////////// allq65 = false; DecQ65 = new DecoderQ65(); connect(DecQ65, SIGNAL(EmitDecodetText(QStringList)), this, SLOT(SetDecodetTextFtQ65(QStringList))); connect(DecQ65, SIGNAL(EmitBackColor()), this, SLOT(SetBackColorQ65())); connect(DecQ65, SIGNAL(EmitAvgSavesQ65(int,int)), this, SIGNAL(EmitAvgSavesQ65(int,int))); /////////// PI4 /////////////////////////////////////////////////////////// first_pi4 = true; first_xcorpi4 = true; first_extractpi4 = true; off_mettab_pi4 = 130;//130 first_interleavepi4 = true; nutc0_pi4 = -1; first_avgpi4 = true; nfreq0_pi4 = -999999.0; clearave_pi4 = false; count_use_avgs_pi4 = 0; count_saved_avgs_pi4 = 0; ///////////END PI4 /////////////////////////////////////////////////////////// ///// JT65ABC ///////////////////////////////// //App_Path = app_path_65; TGen65 = new Gen65(); TGen65->setup65(); s_aggres_lev_ftd = 5;//def s_aggres_lev_deeps = 95;//def first_symspec65 = true; thresh0_jt65 = 0.0; dfref_jt65 = 0.0; nsave_jt65 = 0; width_jt65 = 0.0; s1_ofs_jt65 = 256+20; first_avg65 = true; first_subtract65 = true; //first_subtract65(); s_avg_jt65 = false; //1.60 to bool by default start //16=avg s_deep_search_jt65 = false;//1.49 clearave_jt65 = false; s_nfqso_all = 1270.46; s_max65_cand_for_dec = 4;// default s_f00 = 200.0; s_f01 = 3200.0; count_saved_avgs_1jt65 = 0; count_saved_avgs_2jt65 = 0; count_use_avgs_1jt65 = 0; count_use_avgs_2jt65 = 0; s_bVHF_jt65 = false;//1.60= def fsk441 mycall0_jt65ap = "none"; theircall0_jt65ap = "none"; theirgrid0_jt65ap = "none"; //hint65 sega ne rabotiat kato seve no za naptrd ??? //first_hint65 = true; //end hint65 sega ne rabotiat kato seve no za naptrd ??? //first_filbig = true; ///// END JT65ABC ///////////////////////////////// ////dftool_msk144//////////////// s_list_rpt_msk.clear(); prev_pt_msk = 0.0; ping_width_msk = 0.0; prev_ping_t_msk = 0.0; last_rpt_snr_msk = 0.0; one_end_ping_msk = false; is_new_rpt_msk = false; ss_msk144ms = false; //s_period_time = 30; last_ntol_msk144 = -1; last_df_msk144 = -1; ////end dftool_msk144//////////////// ////dftool_msk40//////////////// last_ntol_msk40 = -1; last_df_msk40 = -1; ////end dftool_msk40//////////////// //My_Grid_Loc = "GRID"; s_fopen = false; TGenMsk = new GenMsk(true);//f_dec_gen = dec=true gen=false //nfft0_jtmsk = 0;//jtmsk analytic_msk //zero_double_beg_count(h,0,(1024*1024));//jtmsk analytic_msk h[1024*1024]; //only1_syncmsk = true; ////jtmsk short/////// //first_short = true; //nrxfreq0 = -1; ////jtmsk short/////// ////msk144/////// first_dec_msk = true; first_sq = true; s_TheirCall = "NOCALL"; s_R1TheirCall = "NOCALL";//for fr8 MA QSO Foxs s_R2TheirCall = "NOCALL";//for fr8 MA QSO Foxs //s_ident_init_ldpc = -1; s_decoder_deep = 1; f_first_msk144 = false; for (int i = 0; i < HASH_CALLS_COUNT; i++) { hash_msk40_calls[i].hash = -101; hash_msk40_calls[i].calls="FALSE"; } //qDebug()<<"HASH_CALLS_COUNT"<SetMaxDrift(f); } void DecoderMs::AutoClrAvgChanged(bool f) { DecQ65->AutoClrAvgChanged(f); } void DecoderMs::SetClearAvgQ65() { DecQ65->SetClearAvgQ65(); } void DecoderMs::SetPerodTime(int i) { DecQ65->SetPeriod(i); } void DecoderMs::Decode3intFt(bool f)//2.39 remm { DecFt8_0->Decode3intFt(f);//2.39 remm } void DecoderMs::SetMAMCalls(QStringList ls) { DecFt4_0->SetMAMCalls(ls);// static no need more } void DecoderMs::SetTxFreq(double f) { s_nftx = f; DecFt8_0->SetStTxFreq(f); DecFt4_0->SetStTxFreq(f); DecQ65->SetTxFreq(f); } void DecoderMs::SetDecAftEMEDelay(bool f) { DecQ65->SetDecAftEMEDelay(f); } void DecoderMs::SetQSOProgress(int i) { if (i==5 || i==6)//1.69 and 1.70 //if (i==6)//1.70 s_nQSOProgress = 0; //MSHV +1 CQ LZ2HV 237 for +AP else { s_nQSOProgress = i+1; //MSHV +1 CQ LZ2HV 237 for +AP } DecFt8_0->SetStQSOProgress(s_nQSOProgress);//2.51 i=error DecFt4_0->SetStQSOProgress(s_nQSOProgress);//2.51 i=error DecQ65->SetStQSOProgress(s_nQSOProgress);//2.51 i=error //qDebug()<<"i="<SetStMultiAnswerMod(f); DecFt4_0->SetStMultiAnswerMod(f); //qDebug()<<"f_multi_answer_mod="<SetStMultiAnswerMod(f); } void DecoderMs::SetThrLevel(int i)//0=1 1=th/2 2=all { s_thr_used = i; if (s_thr_used<1) s_thr_used = 1; if (s_thr_used>6) s_thr_used = 6; //f2a.DestroyPlansAll(true); //qDebug()<SetStApDecode(f); DecFt4_0->SetStApDecode(f);// only in mshv DecQ65->SetStApDecode(f);// only in mshv //qDebug()<<"ft8 s_lapon="<SetStDecoderDeep(d); DecFt4_0->SetStDecoderDeep(d); DecQ65->SetStDecoderDeep(d); //qDebug()<<"s_decoder_deep="<SetSingleDecQ65(f); } QString DecoderMs::CharToQString(char* ch, int count) { QString s; for (int j = 0; j=0; end--) { if (str.at(end)==' ') break; } //qDebug()<=0; msg_count--) { if (str.at(msg_count)!=' ') break; } s = str.mid(0,msg_count+1); msg_count = 0; for (msg_count = 0; msg_countpart) { int pouse = msg.lastIndexOf(" ",part); int pouse_n = msg.lastIndexOf("\n",part); if (pouse<=pouse_n) pouse=-1; //qDebug()<<"pouse="<save_hash_call_my_their_r1_r2(s_MyCall,0);//0=my 1=their 2=r1 3=r2 TGenMsk->save_hash_call_my_their_r1_r2(s_MyCall,0); } else s_MyCall = "NOT__EXIST"; if (!lst.at(1).isEmpty()) s_MyBaseCall = lst.at(1);//for ft8 ap, jt65 ap else s_MyBaseCall = "NOT__EXIST"; // 0 : NONE ncontest=0 CQ // 1 : NA_VHF CQ TEST // 2 : EU_VHF CQ TEST // 3 : FIELD DAY CQ FD // 4 : RTTY CQ RU // 5 : WW Digi DX CQ WW // 6 : FOX = MSHV = CQ BU // 7 : HOUND = NONE // Activity Type id type dec-id dec-type dec-cq //"Standard" 0 0 0 = CQ 0 0 //"EU RSQ And Serial Number" 1 NONE 1 NONE NONE NONE //"NA VHF Contest" 2 2 2 CQ TEST 1 3 = CQ TEST //"EU VHF Contest" 3 3 3 CQ TEST 2 3 = CQ TEST //"ARRL Field Day" 4 4 4 CQ FD 3 2 = CQ FD //"ARRL Inter. Digital Contest" 5 2 5 CQ TEST 1 3 = CQ TEST //"WW Digi DX Contest" 6 2 6 CQ WW 1 4 = CQ WW //"FT4 DX Contest" 7 2 7 CQ WW 1 4 = CQ WW //"FT8 DX Contest" 8 2 8 CQ WW 1 4 = CQ WW //"FT Roundup Contest" 9 5 9 CQ RU 4 1 = CQ RU //"Bucuresti Digital Contest" 10 5 10 CQ BU 4 5 = CQ BU //"FT4 SPRINT Fast Training" 11 5 11 CQ FT 4 6 = CQ FT //"PRO DIGI Contest" 12 5 12 CQ PDC 4 7 = CQ PDC //"CQ WW VHF Contest" 13 2 13 CQ TEST 1 3 = CQ TEST DecFt8_0->SetStWords(s_MyCall,s_MyBaseCall,cont_cq,cont_type); DecFt4_0->SetStWords(s_MyCall,s_MyBaseCall,cont_cq,cont_type); DecQ65->SetStWords(s_MyCall,s_MyBaseCall,cont_cq,cont_type); //qDebug()<<"CQ="<peak) peak=s[i]; //qDebug()<i0) { //qDebug()<=wmin) { pingdat_[nping][0]=tstart; pingdat_[nping][1]=dtbuf*(double)(i-i0);//+0.02 pingdat_[nping][2]=peak; //qDebug()<.GT. <.LT. >=.GE. <=.LE. nn = n; if (nn < 1) { //print*,'ssort: The number of sort elements is not positive.' //print*,'ssort: n = ',nn,' kflag = ',kflag return; } kk = abs(kflag);//fabs ???? if (kk!=1 && kk!=2) { //print *,'The sort control parameter, k, is not 2, 1, -1, or -2.' return; } //! Alter array x to get decreasing order if needed if (kflag <= -1) { for (i = 0; i= 2) goto c100; //! Sort x only m = 1; i = 0; j = nn; r = 0.375e0; c20: if (i == j) goto c60; if (r <= 0.5898437e0) r = r+3.90625e-2; else r = r-0.21875e0; c30: k = i; //! Select a central element of the array and save it in location t ij = i + int((j-i)*r); t = x[ij]; //! If first element of array is greater than t, interchange with t //c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE. if (x[i] > t) { x[ij] = x[i]; x[i] = t; t = x[ij]; } l = j; //! If last element of array is less than than t, interchange with t if (x[j] < t) { x[ij] = x[j]; x[j] = t; t = x[ij]; //! If first element of array is greater than t, interchange with t if (x[i] > t) { x[ij] = x[i]; x[i] = t; t = x[ij]; } } //! Find an element in the second half of the array which is smaller than t c40: l = l-1; if (x[l] > t) goto c40; //! Find an element in the first half of the array which is greater than t c50: k = k+1; if (x[k] < t) goto c50; //! Interchange these elements //c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE. if (k <= l) { tt = x[l]; x[l] = x[k]; x[k] = tt; goto c40; } //! Save upper and lower subscripts of the array yet to be sorted if (l-i > j-k) { il[m] = i; iu[m] = l; i = k; m = m+1; } else { il[m] = k; iu[m] = j; j = l; m = m+1; } goto c70; //! Begin again on another portion of the unsorted array c60: m = m-1; if (m == 0) goto c190; i = il[m]; j = iu[m]; c70: if (j-i >= 1) goto c30; if (i == 1) goto c20; i = i-1; c80: i = i+1; if (i == j) goto c60; t = x[i+1]; if (x[i] <= t) goto c80; k = i; c90: x[k+1] = x[k]; k = k-1; if (t < x[k]) goto c90; x[k+1] = t; goto c80; //! Sort x and carry y along c100: m = 1; i = 0; j = nn; r = 0.375e0; c110: if (i == j) goto c150; if (r <= 0.5898437e0) r = r+3.90625e-2; else r = r-0.21875e0; c120: k = i; //c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE. //! Select a central element of the array and save it in location t ij = i + int((j-i)*r); t = x[ij]; ty = y[ij]; //qDebug()<<"kkk"< t) { x[ij] = x[i]; x[i] = t; t = x[ij]; y[ij] = y[i]; y[i] = ty; ty = y[ij]; } l = j; //! If last element of array is less than t, interchange with t if (x[j] < t) { x[ij] = x[j]; x[j] = t; t = x[ij]; y[ij] = y[j]; y[j] = ty; ty = y[ij]; //! If first element of array is greater than t, interchange with t if (x[i] > t) { x[ij] = x[i]; x[i] = t; t = x[ij]; y[ij] = y[i]; y[i] = ty; ty = y[ij]; } } //! Find an element in the second half of the array which is smaller than t c130: l = l-1; if (x[l] > t) goto c130; //c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE. //! Find an element in the first half of the array which is greater than t c140: k = k+1; if (x[k] < t) goto c140; //! Interchange these elements if (k <= l) { tt = x[l]; x[l] = x[k]; x[k] = tt; tty = y[l]; y[l] = y[k]; y[k] = tty; goto c130; } //! Save upper and lower subscripts of the array yet to be sorted if (l-i > j-k) { il[m] = i; iu[m] = l; i = k; m = m+1; } else { il[m] = k; iu[m] = j; j = l; m = m+1; } goto c160; //! Begin again on another portion of the unsorted array //c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE. c150: m = m-1; if (m == 0) goto c190; i = il[m]; j = iu[m]; c160: if (j-i >= 1) goto c120; if (i == 1) goto c110; i = i-1; c170: i = i+1; if (i == j) goto c150; t = x[i+1]; ty = y[i+1]; if (x[i] <= t) goto c170; k = i; c180: x[k+1] = x[k]; y[k+1] = y[k]; k = k-1; if (t < x[k]) goto c180; x[k+1] = t; y[k+1] = ty; goto c170; //! Clean up c190: if (kflag <= -1) { for (i = 0; inmax-1) j=nmax-1; //v1.35 if(j.gt.npts) j=npts //qDebug()<<"SSSSSSSSSSSSSSS"<.GT. <.LT. >=.GE. <=.LE. //nping=0; if (pick && nping==0)// predizvikva pone edno 4etene ako e pod shuma slim i nping==0 { pingdat_[nping][0]=(0.5*(double)count_in)*dt - 0.08;//1.34 = -0.1->dae w sredata 0.08 problem triabva da se oprawi //pingdat_[nping][0]=((double)count_in/2.0)*dt;// problem triabva da se oprawi if (s_mod==3)//fsk315 pingdat_[nping][1]=0.34; //hv v1.04 0.16 to 0.34 tested fsk315 else //fsk441 and jtms pingdat_[nping][1]=0.22; //hv v1.01 0.16 to 0.22 tested fsk441 and jtms pingdat_[nping][2]=1.0; if (nping<99)// max 99 v c++ nping++; } //int iping = 0; //for (int i = 0; i[NH]; double s[3100]; int indx[3100]; //double *s = new double[3100]; //int *indx = new int[3100]; //common/fcom/s(3100),indx(3100) //equivalence (x,c) //save double psavg0[128]; double psavg[128]; int nstep = 221; int nz=jz/nstep - 0; //int nchan=64; double s2_[3100][64]; double df=(double)DEC_SAMPLE_RATE/(double)NFFT; //double base = 0.0; double afac; double smaxx; pomAll.zero_double_beg_end(psavg0,0,128); //! Compute the 2d spectrogram s2(nchan,nz). Note that in s2 the frequency //! bins are shifted down 5 bins from their natural positions. int bins=5; set_double_to_d(0.0,psavg,NH); for (int n = 0; n.GT. <.LT. >=.GE. <=.LE. if (f<300.0) fac=f/300.0; if (f>3000.0) fac=fmax(0.00333,(3300.0-f)/300.0); //psavg0(i)=(fac**2)*psavg0(i) psavg0[i]=(fac*fac)*psavg0[i]; } //! Compute an average spectrum from the weakest 25% of time slices. //qDebug()<.GT. <.LT. >=.GE. <=.LE. if ((xn-n)>0.0) n++; int nfft=pow(2,n); if (nadd==0)// no devide by zero nadd=1; int nh=nfft/nadd; int nq=nh/2; for (int i = 0; ijz) //zero(x(jz+1),nfft-jz) pomAll.zero_double_beg_end(x,jz,nfft);//HV pri men e taka v1.17 xfft(c,x,nfft); //! This is a kludge: double df=DEC_SAMPLE_RATE/(double)(nadd*nfft); if (mode==7 || mode==8 || mode==9) //JT65abc ->mode 100 df=DEC_SAMPLE_RATE/(double)(2*nadd*nfft); double tol=10.0; int itol=int(2.0/df); for (int izap = 0; izap<200; izap++) {//do izap=1,200 //qDebug()<smax) { smax=s; ipk=i; } } //fzap(izap)=df*(ipk-1) fzap[izap]=df*(ipk-0); for (int i = ipk-itol; i<=ipk+itol; i++) {//do i=ipk-itol,ipk+itol c[i]=0.0 + 0.0*I; } } c10: int ia=70.0/df; for (int i = 0; i.GT. <.LT. >=.GE. <=.LE. if (jz<5) goto c900; //! Get variance in each freq channel, using only those spectra with //! power below the median. for (int i = 0; i add_dd_to_d_s2(psa,s2,0,j,ref,nbins); //nsum=nsum+1; nsum++; } } if (nsum==0)// no devide by zero nsum = 1; for (int i = 0; i.GT. <.LT. >=.GE. <=.LE. if (ref[k]>rmax) { rmax=ref[k]; kpk=k; } } double sum=0.0; nsum=0; for (int k = i-3; k1) { sum=sum+ref[k]; //nsum=nsum+1; nsum++; } } if (nsum==0)// no devide by zero nsum = 1; ref2[i]=(double)sum/nsum; } //call move(ref2(4),ref(4),nbins-6) //!Copy smoothed ref back into ref move_da_to_da(ref2,3,ref,3,nbins-6); //call pctile(ref(4),ref2,nbins-6,50,xmedian) //!Get median in-band level xmedian = pctile(ref,3,ref2,nbins-6,50); //! Fix ends of reference spectrum for (int i = 0; i<3; i++) {//do i=1,3 //ref(i)=ref(4) //ref(nbins+1-i)=ref(nbins-3) ref[i]=ref[3]; ref[nbins+0-i]=ref[nbins-3];// ????? } if (xmedian==0.0)// no devide by zero xmedian = 1.0; facmax=30.0/xmedian; for (int i = 0; idouble(DFTolerance)) { //if(n.lt.200 .and. variance(i-1).lt.2.5 .and. variance(i).lt.2.5.and.variance(i+1).lt.2.5) if (n<200 && variance[i-1]<2.5 && variance[i]<2.5 && variance[i+1]<2.5) { //n=n+1; fzap[n]=f; //qDebug()<.GT. <.LT. >=.GE. <=.LE. if (s_zap_count>14*DEC_SAMPLE_RATE)//kogato e celia region ili >14s dtrim(s_zap_in,s_zap_count); sum=0.0; for (int i = 0; i static bool have_dec0_ = false; void DecoderMs::StrtDecode() { if (s_f_rtd || s_mod==11 || s_mod==13 || allq65)//ft8 ft4 q65 usleep(20000); //1.30 important time>10ms 20000us=20ms slab PC pri auto decode da zabavi malko pri postoqnno decodirane hv else usleep(100000); //1.30 important time>10ms 100000us=100ms slab PC pri auto decode da zabavi malko pri postoqnno decodirane hv double sq=0.0; //double degrade = 1.0; int nforce = 1;//force_decode bool pick; if ((s_mod!=0 && s_mod!=7 && s_mod!=8 && s_mod!=9 && s_mod!=10 && s_mod!=11 && s_mod!=12 && s_mod!=13 && !allq65) && s_nzap) //1.52 msk144 JT65abc ft8 pi4 ft4 no zap {//if(mode.ne.2 .and. nzap.ne.0) then // nzap e check box //qDebug()<<"2ZAP Start"; double fzap[200];//pri men ne se izpolzva jt65-jt4 pomAll.zero_double_beg_end(fzap,0,200); bool nfrz=false;// e chesk box Freeze int MouseDF = 0; //if(mode==1) nfrz=0;//neznam //c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE. if (s_mousebutton==0 && s_static_dat_count>100000)//mousebutton Left=1, Right=3 fullfile=0 rtd=2 { avesp2(static_dat0,s_static_dat_count,2,s_mod,nfrz,MouseDF,G_DfTolerance,fzap); } else if (s_zap_count>100000) { //qDebug()<<"ZAP Start"; CalcZapDat(); //qDebug()<<"ZAP Calc"<20.0)) goto c900; if (s_mod == 0 || s_mod == 12)//msk144 msk144ms { bool f_mskms = false; if (s_mod == 12)//msk144ms f_mskms = true; if (s_f_rtd) msk_144_40_rtd(static_dat0,s_static_dat_count,s_in_istart,f_mskms); else msk_144_40_decode(static_dat0,s_static_dat_count,s_in_istart,f_mskms); } else if (s_mod == 11)//one thread ft8 { DecFt8_0->ft8_decode(static_dat0,s_static_dat_count,s_f00,s_f01,s_nfqso_all,have_dec0_,id3decFt,s_f00,s_f01); ResetDupThr(); goto c990; } else if (s_mod == 13)//ft4 { DecFt4_0->ft4_decode(static_dat0,s_f00,s_f01,s_f00,s_f01,s_nfqso_all,have_dec0_); ResetDupThr(); goto c990; } else if (allq65)//q65 { DecQ65->q65_decode(static_dat0,s_f00,s_f01,s_nfqso_all,s_mod,have_dec0_); if (is_thrTime) { if (have_dec0_) { float ftmp =(float)thrTime->elapsed()*0.001; emit EmitTimeElapsed(ftmp); } delete thrTime; is_thrTime = false; } id3decFt = 0; //ResetDupThr(); //goto c990; } else if (s_mod == 1 || s_mod == 2 || s_mod == 3)//jtms fsk144 fsk315 { if (s_mod == 2 || s_mod == 3)//fsk441 fsk315 { double sigma = 0.0; spec2d(static_dat0,s_static_dat_count,sigma); //c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE. //if(sigma<0.0) basevb=-99.0; //qDebug()<<"sigma1"<StrtDecode(); pthread_detach(pt->th); // inportant delete thread memory pthread_exit(NULL); return NULL; } /*void DecoderMs::SetDecodetTextFt(QStringList list) { bool ldupe = false; QString message = list.at(4); QString sf1 = list.at(7); int f1 = sf1.toInt(); int f1tool = 6; if (s_mod == 13) f1tool = 10; for (int id = 0; id < dup_camsgf_thr; ++id) { if (message==dup_amsgs_thr[id] && abs(dup_afs_thr[id]-f1)");//v2 protokol 2.02 QStringList tlist = tstr.split(" "); bool fmyc = false; for (int x = 0; x"); QStringList tlist = tstr.split(" "); bool fmyc = false; //if (to2list) //{ for (int x = 0; x"); QStringList tlist = tstr.split(" "); bool fmyc = false; for (int x = 0; xstart(); //qDebug()<<"CreateTimer++++++"; } static bool have_dec1_ = false; static bool have_dec2_ = false; static bool have_dec3_ = false; static bool have_dec4_ = false; static bool have_dec5_ = false; static bool have_decALL3_ = false; static bool thr_only_one_color = true; void DecoderMs::ResetDupThr() { //static bool have_decALL3_ = false; <- no use if (have_dec0_ || have_dec1_ || have_dec2_ || have_dec3_ || have_dec4_ || have_dec5_) have_decALL3_ = true; //qDebug()<<"1-DestroyPlansAll"<2) { //qDebug()<elapsed()*0.001; emit EmitTimeElapsed(ftmp); } delete thrTime; is_thrTime = false; //qDebug()<<"DeleteTimer------"; } id3decFt = 0; dup_camsgf_thr = 0; thr_only_one_color = true;//2.56 DecFt8_0->SetNewP(true); DecFt8_1->SetNewP(true); DecFt8_2->SetNewP(true); DecFt8_3->SetNewP(true); DecFt8_4->SetNewP(true); DecFt8_5->SetNewP(true); f2a.DestroyPlansAll(false); emit EmitDecodeInProgresPskRep(false); have_decALL3_ = false; //qDebug()<<"END-DestroyPlansAll"; } }//2.56 stop static bool thr_only_one_color = true; void DecoderMs::ThrSetBackColor() { if (thr_only_one_color) { thr_only_one_color = false; SetBackColor(); } } void DecoderMs::SetBackColorQ65() { SetBackColor(); } static bool end_dec0_ = true; static bool end_dec1_ = true; static bool end_dec2_ = true; static bool end_dec3_ = true; static bool end_dec4_ = true; static bool end_dec5_ = true; void DecoderMs::TryEndThr() { if (!end_dec0_ || !end_dec1_ || !end_dec2_ || !end_dec3_ || !end_dec4_ || !end_dec5_) return; ResetDupThr(); emit EmitDecode(false,0); if (is_ftBuff) { usleep(25000); thred_busy = false; SETftBuff(); } else thred_busy = false; //qDebug()<<"Multy Thread False thred_busy"; } static double _f00_ = 200; static double _f01_ = 700; void DecoderMs::StrtDec0() { usleep(17000); //qDebug()<<"0"; if (s_mod == 11) DecFt8_0->ft8_decode(static_dat0,s_static_dat_count,_f00_,_f01_,s_nfqso_all,have_dec0_,id3decFt,s_f00,s_f01); else if (s_mod == 13) DecFt4_0->ft4_decode(static_dat0,_f00_,_f01_,s_f00,s_f01,s_nfqso_all,have_dec0_); end_dec0_ = true; TryEndThr(); } static double _f02_ = 1200; //#define CORFT8 60.0 //#define CORFT4 100.0 void DecoderMs::StrtDec1() { usleep(18000); //qDebug()<<"1"; if (s_mod == 11) DecFt8_1->ft8_decode(static_dat1,s_static_dat_count,(_f01_-50.0),_f02_,s_nfqso_all,have_dec1_,id3decFt,s_f00,s_f01); else if (s_mod == 13) DecFt4_1->ft4_decode(static_dat1,(_f01_-100.0),_f02_,s_f00,s_f01,s_nfqso_all,have_dec1_); end_dec1_ = true; TryEndThr(); } static double _f03_ = 1700; void DecoderMs::StrtDec2() { usleep(19000); //qDebug()<<"2"; if (s_mod == 11) DecFt8_2->ft8_decode(static_dat2,s_static_dat_count,(_f02_-50.0),_f03_,s_nfqso_all,have_dec2_,id3decFt,s_f00,s_f01); else if (s_mod == 13) DecFt4_2->ft4_decode(static_dat2,(_f02_-100.0),_f03_,s_f00,s_f01,s_nfqso_all,have_dec2_); end_dec2_ = true; TryEndThr(); } static double _f04_ = 2200; void DecoderMs::StrtDec3() { usleep(20000); //qDebug()<<"3"; if (s_mod == 11) DecFt8_3->ft8_decode(static_dat3,s_static_dat_count,(_f03_-50.0),_f04_,s_nfqso_all,have_dec3_,id3decFt,s_f00,s_f01); else if (s_mod == 13) DecFt4_3->ft4_decode(static_dat3,(_f03_-100.0),_f04_,s_f00,s_f01,s_nfqso_all,have_dec3_); end_dec3_ = true; TryEndThr(); } static double _f05_ = 2700; void DecoderMs::StrtDec4() { usleep(21000); //qDebug()<<"4"; if (s_mod == 11) DecFt8_4->ft8_decode(static_dat4,s_static_dat_count,(_f04_-50.0),_f05_,s_nfqso_all,have_dec4_,id3decFt,s_f00,s_f01); else if (s_mod == 13) DecFt4_4->ft4_decode(static_dat4,(_f04_-100.0),_f05_,s_f00,s_f01,s_nfqso_all,have_dec3_); end_dec4_ = true; TryEndThr(); } static double _f06_ = 3200; void DecoderMs::StrtDec5() { usleep(22000); //qDebug()<<"5"; if (s_mod == 11) DecFt8_5->ft8_decode(static_dat5,s_static_dat_count,(_f05_-50.0),_f06_,s_nfqso_all,have_dec4_,id3decFt,s_f00,s_f01); else if (s_mod == 13) DecFt4_5->ft4_decode(static_dat5,(_f05_-100.0),_f06_,s_f00,s_f01,s_nfqso_all,have_dec3_); end_dec5_ = true; TryEndThr(); } void *DecoderMs::ThrDec0(void *argom) { DecoderMs* pt = (DecoderMs*)argom; pt->StrtDec0(); pthread_detach(pt->th0); pthread_exit(NULL); return NULL; } void *DecoderMs::ThrDec1(void *argom) { DecoderMs* pt = (DecoderMs*)argom; pt->StrtDec1(); pthread_detach(pt->th1); pthread_exit(NULL); return NULL; } void *DecoderMs::ThrDec2(void *argom) { DecoderMs* pt = (DecoderMs*)argom; pt->StrtDec2(); pthread_detach(pt->th2); pthread_exit(NULL); return NULL; } void *DecoderMs::ThrDec3(void *argom) { DecoderMs* pt = (DecoderMs*)argom; pt->StrtDec3(); pthread_detach(pt->th3); pthread_exit(NULL); return NULL; } void *DecoderMs::ThrDec4(void *argom) { DecoderMs* pt = (DecoderMs*)argom; pt->StrtDec4(); pthread_detach(pt->th4); pthread_exit(NULL); return NULL; } void *DecoderMs::ThrDec5(void *argom) { DecoderMs* pt = (DecoderMs*)argom; pt->StrtDec5(); pthread_detach(pt->th5); pthread_exit(NULL); return NULL; } void DecoderMs::dtrim(short*dat,int count) { //! Remove any transient data at start of record. //! real dat(jz),dat2(jz) double ssq[1000]; double sumsq=0.0; int nz=count/1000.0; int k=0; int ix=0; for (int i = 0; i<1000; i++) {//do i=1,1000 double sq=0.0; for (int n = 0; n=0; ix--) {//do i=ichk,1,-1 //c++ ==.EQ. !=.NE. >.GT. <.LT. >=.GE. <=.LE. //qDebug()<(3.0*avesq)) goto c10; } ix=0; c10: //continue; int ia=(ix+1)*nz; //qDebug()<0) { //dat(1:ia)=0 //!Zero the bad data for (int j = 0; j count_q<=0 return; s_zap_count = fmin(60*DEC_SAMPLE_RATE,count);//1.36 //qDebug()< mousebutton>3 if (mousebutton>3 && !fromBufFt && t_busy && (!is_stat_ftb[0] || !is_stat_ftb[1])) { if (count_q<5*DEC_SAMPLE_RATE) return;//tf8 minimum if (count_q > 186000) count_q = 186000; if (!is_stat_ftb[0] && mousebutton==5) { is_stat_ftb[0]=true; c_stat_ftb[0] = count_q; s_mousebftb[0] = mousebutton; s_fopenftb[0] = ffopen; s_timeftb[0] = time; for (int i = 0; i"<14*DEC_SAMPLE_RATE) dtrim(raw_in_s,s_static_dat_count); } sum=0.0; for (int i = 0; i THD BW= All"; //else qDebug()<<"Used Thread="< THD BW="<2) static_dat2[i]=static_dat0[i]; if (nthr>3) static_dat3[i]=static_dat0[i]; if (nthr>4) static_dat4[i]=static_dat0[i]; if (nthr>5) static_dat5[i]=static_dat0[i]; } //qDebug()<<"RXF---->"<