T_Max Frame Sync Work; Reorganizing;

This commit is contained in:
lwvmobile 2022-11-11 22:07:37 -05:00
parent ec4ace1514
commit 8141ea2e78
9 changed files with 400 additions and 757 deletions

View File

@ -70,39 +70,6 @@ typedef struct
char groupName[50];
} groupinfo;
typedef struct
{
uint8_t RFChannelType;
uint8_t FunctionnalChannelType;
uint8_t Option;
uint8_t Direction;
uint8_t CompleteLich; /* 7 bits of LICH without parity */
uint8_t PreviousCompleteLich; /* 7 bits of previous LICH without parity */
} NxdnLich_t;
typedef struct
{
uint8_t StructureField;
uint8_t RAN;
uint8_t Data[18];
uint8_t CrcIsGood;
} NxdnSacchRawPart_t;
typedef struct
{
uint8_t Data[80];
uint8_t CrcIsGood;
} NxdnFacch1RawPart_t;
typedef struct
{
uint8_t Data[184];
uint8_t CrcIsGood;
} NxdnFacch2RawPart_t;
typedef struct
{
@ -143,11 +110,11 @@ typedef struct
uint8_t NextIVComputed[8];
} NxdnElementsContent_t;
//Read Solomon (12,9) constant
//Reed Solomon (12,9) constant
#define RS_12_9_DATASIZE 9
#define RS_12_9_CHECKSUMSIZE 3
//Read Solomon (12,9) struct
//Reed Solomon (12,9) struct
typedef struct
{
uint8_t data[RS_12_9_DATASIZE+RS_12_9_CHECKSUMSIZE];
@ -255,14 +222,14 @@ typedef struct
int p25status;
int p25tg;
int scoperate;
char audio_in_dev[2048]; //increase size for super long directory/file names?
char audio_in_dev[2048]; //increase size for super long directory/file names
int audio_in_fd;
SNDFILE *audio_in_file;
SF_INFO *audio_in_file_info;
uint32_t rtlsdr_center_freq;
int rtlsdr_ppm_error; //was int, changed to float
int audio_in_type; // 0 for device, 1 for file, 3 for rtlsdr
int rtlsdr_ppm_error;
int audio_in_type;
char audio_out_dev[1024];
int audio_out_fd;
SNDFILE *audio_out_file;
@ -390,7 +357,7 @@ typedef struct
int wav_interpolator;
int wav_decimator;
int p25_trunk; //enable experimental P25 trunking with RIGCTL (or RTLFM)
int p25_trunk; //experimental P25 trunking with RIGCTL (or RTLFM)
int p25_is_tuned; //set to 1 if currently on VC, set back to 0 if on CC
//csv import filenames
@ -423,7 +390,6 @@ typedef struct
int audio_out_idx2;
int audio_out_idxR;
int audio_out_idx2R;
//int wav_out_bytes;
int center;
int jitter;
int synctype;
@ -470,7 +436,6 @@ typedef struct
int numtdulc;
int firstframe;
char slot0light[8];
//char slot1light[8];
float aout_gain;
float aout_gainR;
float aout_max_buf[200];
@ -537,16 +502,10 @@ typedef struct
unsigned int nxdn_key;
char nxdn_call_type[1024];
char dmr_callsign[2][6][99]; //plenty of room in case of overflow;
char dmr_lrrp[2][6][9999]; //memory hog
char dmr_lrrp[2][6][9999]; //need to fix this
unsigned long long int dmr_lrrp_source[2];
NxdnSacchRawPart_t NxdnSacchRawPart[4];
NxdnFacch1RawPart_t NxdnFacch1RawPart[2];
NxdnFacch2RawPart_t NxdnFacch2RawPart;
NxdnElementsContent_t NxdnElementsContent;
NxdnLich_t NxdnLich;
int printNXDNAmbeVoiceSampleHex;
char ambe_ciphered[49];
char ambe_deciphered[49];
@ -670,7 +629,7 @@ typedef struct
//trunking group and lcn freq list
long int trunk_lcn_freq[26]; //max number on an EDACS system, should be enough on DMR too hopefully
groupinfo group_array[0x3FF]; //max supported by Cygwin is 3FFF (signed vs unsigned?)
groupinfo group_array[0x3FF]; //max supported by Cygwin is 3FFF, I hope nobody actually tries to import this many groups
unsigned int group_tally; //tally number of groups imported from CSV file for referencing later
int lcn_freq_count;
int lcn_freq_roll; //number we have 'rolled' to in search of the CC
@ -684,7 +643,7 @@ typedef struct
uint8_t nxdn_sacch_frame_segment[4][18]; //part of frame by 18 bits
uint8_t nxdn_sacch_frame_segcrc[4];
uint8_t nxdn_alias_block_number;
char nxdn_alias_block_segment[4][4][8]; //might be too large? maybe just an 8?
char nxdn_alias_block_segment[4][4][8];
} dsd_state;
@ -840,45 +799,47 @@ void processP2(dsd_opts * opts, dsd_state * state); //P2
void processTSBK(dsd_opts * opts, dsd_state * state);
short dmr_filter(short sample);
short nxdn_filter(short sample);
short dpmr_filter(short sample);
int strncmperr(const char *s1, const char *s2, size_t size, int MaxErr);
/* Global functions */ //also borrowed
/* Global functions */
uint32_t ConvertBitIntoBytes(uint8_t * BufferIn, uint32_t BitLength);
uint32_t ConvertAsciiToByte(uint8_t AsciiMsbByte, uint8_t AsciiLsbByte, uint8_t * OutputByte);
void Convert49BitSampleInto7Bytes(char * InputBit, char * OutputByte);
void Convert7BytesInto49BitSample(char * InputByte, char * OutputBit);
void ncursesOpen (dsd_opts * opts, dsd_state * state);
void ncursesPrinter (dsd_opts * opts, dsd_state * state);
void ncursesClose ();
/* NXDN frame decoding functions */
void ProcessNXDNFrame(dsd_opts * opts, dsd_state * state, uint8_t Inverted);
void ProcessNxdnRCCHFrame(dsd_opts * opts, dsd_state * state, uint8_t Inverted);
void ProcessNxdnRTCHFrame(dsd_opts * opts, dsd_state * state, uint8_t Inverted);
void ProcessNxdnRDCHFrame(dsd_opts * opts, dsd_state * state, uint8_t Inverted);
void ProcessNxdnRTCH_C_Frame(dsd_opts * opts, dsd_state * state, uint8_t Inverted);
void ProcessNXDNIdleData (dsd_opts * opts, dsd_state * state, uint8_t Inverted);
void ProcessNXDNFacch1Data (dsd_opts * opts, dsd_state * state, uint8_t Inverted);
void ProcessNXDNUdchData (dsd_opts * opts, dsd_state * state, uint8_t Inverted);
//end borrow
//new NXDN Functions start here!
void nxdn_frame (dsd_opts * opts, dsd_state * state);
void nxdn_descramble (uint8_t dibits[], int len);
void nxdn_deperm_facch (dsd_opts * opts, dsd_state * state, uint8_t bits[144]);
void nxdn_deperm_sacch (dsd_opts * opts, dsd_state * state, uint8_t bits[60]);
void nxdn_deperm_cac (dsd_opts * opts, dsd_state * state, uint8_t bits[300]);
void nxdn_deperm_facch2_udch (dsd_opts * opts, dsd_state * state, uint8_t bits[348]);
void nxdn_message_type (dsd_opts * opts, dsd_state * state, uint8_t MessageType);
void nxdn_voice (dsd_opts * opts, dsd_state * state, int voice, uint8_t dbuf[182]);
//utility functions from OP25 needed by NXDN frame handler
static inline int load_i(const uint8_t val[], int len);
static inline void cfill(uint8_t result[], const uint8_t src[], int len);
static inline void trellis_encode(uint8_t result[], const uint8_t source[], int result_len, int reg);
static inline void trellis_decode(uint8_t result[], const uint8_t source[], int result_len);
//OP25 CRC functions
static uint8_t crc6(const uint8_t buf[], int len);
static uint16_t crc12f(const uint8_t buf[], int len);
static uint16_t crc15(const uint8_t buf[], int len);
static uint16_t crc16cac(const uint8_t buf[], int len);
/* NXDN functions */
void CNXDNConvolution_start(void);
void CNXDNConvolution_decode(uint8_t s0, uint8_t s1);
void CNXDNConvolution_chainback(unsigned char* out, unsigned int nBits);
void CNXDNConvolution_encode(const unsigned char* in, unsigned char* out, unsigned int nBits);
uint8_t NXDN_decode_LICH(uint8_t InputLich[8],
uint8_t * RFChannelType,
uint8_t * FunctionnalChannelType,
uint8_t * Option,
uint8_t * Direction,
uint8_t * CompleteLichBinaryFormat,
uint8_t Inverted);
uint8_t NXDN_SACCH_raw_part_decode(uint8_t * Input, uint8_t * Output);
//keeping these
void NXDN_SACCH_Full_decode(dsd_opts * opts, dsd_state * state);
uint8_t NXDN_FACCH1_decode(uint8_t * Input, uint8_t * Output);
uint8_t NXDN_UDCH_decode(uint8_t * Input, uint8_t * Output);
void NXDN_Elements_Content_decode(dsd_opts * opts, dsd_state * state,
uint8_t CrcCorrect, uint8_t * ElementsContent);
void NXDN_decode_VCALL(dsd_opts * opts, dsd_state * state, uint8_t * Message);
@ -886,9 +847,7 @@ void NXDN_decode_VCALL_IV(dsd_opts * opts, dsd_state * state, uint8_t * Message)
char * NXDN_Call_Type_To_Str(uint8_t CallType);
void NXDN_Voice_Call_Option_To_Str(uint8_t VoiceCallOption, uint8_t * Duplex, uint8_t * TransmissionMode);
char * NXDN_Cipher_Type_To_Str(uint8_t CipherType);
uint16_t CRC15BitNXDN(uint8_t * BufferIn, uint32_t BitLength);
uint16_t CRC12BitNXDN(uint8_t * BufferIn, uint32_t BitLength);
uint8_t CRC6BitNXDN(uint8_t * BufferIn, uint32_t BitLength);
void NXDN_decode_Alias(dsd_opts * opts, dsd_state * state, uint8_t * Message);
void dPMRVoiceFrameProcess(dsd_opts * opts, dsd_state * state);
void printdPMRAmbeVoiceSample(dsd_opts * opts, dsd_state * state);
@ -911,7 +870,7 @@ uint32_t BPTC_196x96_Extract_Data(uint8_t InputDeInteleavedData[196], uint8_t DM
uint32_t BPTC_128x77_Extract_Data(uint8_t InputDataMatrix[8][16], uint8_t DMRDataExtracted[77]);
uint32_t BPTC_16x2_Extract_Data(uint8_t InputInterleavedData[32], uint8_t DMRDataExtracted[32]);
//Read Solomon (12,9) functions
//Reed Solomon (12,9) functions
void rs_12_9_calc_syndrome(rs_12_9_codeword_t *codeword, rs_12_9_poly_t *syndrome);
uint8_t rs_12_9_check_syndrome(rs_12_9_poly_t *syndrome);
rs_12_9_correct_errors_result_t rs_12_9_correct_errors(rs_12_9_codeword_t *codeword, rs_12_9_poly_t *syndrome, uint8_t *errors_found);
@ -1014,7 +973,7 @@ bool GetSignalLevelEx(int sockfd, double *dBFS, int n_samp);
//UDP socket connection
int UDPBind (char *hostname, int portno);
//Edacs
//EDACS
void edacs(dsd_opts * opts, dsd_state * state);
unsigned long long int edacs_bch (unsigned long long int message);
@ -1032,10 +991,9 @@ void cleanup_rtlsdr_stream();
void get_rtlsdr_sample(int16_t *sample, dsd_opts * opts, dsd_state * state);
void rtlsdr_sighandler();
#endif
//TRELLIS
//DMR TRELLIS
void CDMRTrellisTribitsToBits(const unsigned char* tribits, unsigned char* payload);
unsigned int CDMRTrellisCheckCode(const unsigned char* points, unsigned char* tribits);
//unsigned int CDMRTrellisCheckCode(const unsigned char* points, unsigned char* state, unsigned char* tribits);
bool CDMRTrellisFixCode(unsigned char* points, unsigned int failPos, unsigned char* payload);
void CDMRTrellisDeinterleave(const unsigned char* data, signed char* dibits);
void CDMRTrellisDibitsToPoints(const signed char* dibits, unsigned char* points);
@ -1049,7 +1007,6 @@ int ez_rs28_facch (int payload[156], int parity[114]); //ezpwd bridge for FME
int ez_rs28_sacch (int payload[180], int parity[132]); //ezpwd bridge for FME
unsigned long long int isch_lookup (unsigned long long int isch); //isch map lookup
int bd_bridge (int payload[196], uint8_t decoded[12]); //bridge to Michael Ossmann Block De-interleaver and 1/2 rate trellis decoder
// uint16_t crc16(uint8_t buf[], int len);
int crc16_lb_bridge (int payload[190], int len);
int crc12_xb_bridge (int payload[190], int len);

View File

@ -15,6 +15,9 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
//Originally found at - https://github.com/LouisErigHerve/dsd
//Modified for use in DSD-FME
#include "dsd.h"
char * getTimeL(void) //get pretty hh:mm:ss timestamp
@ -2919,4 +2922,18 @@ uint8_t ComputeCrc5Bit(uint8_t * DMRData)
return CRC;
} /* End ComputeCrc5Bit() */
uint32_t ConvertBitIntoBytes(uint8_t * BufferIn, uint32_t BitLength)
{
uint32_t Output = 0;
uint32_t i;
for(i = 0; i < BitLength; i++)
{
Output <<= 1;
Output |= (uint32_t)(BufferIn[i] & 1);
}
return Output;
} /* End ConvertBitIntoBytes() */
/* End of file */

View File

@ -177,10 +177,8 @@ void processdPMRvoice (dsd_opts * opts, dsd_state * state)
x++;
y++;
z++;
if (j == 3 && i == 28) //find sweet spot to cut off early
{
i = 40; //break early so FS2 sync can resync
}
//should be fixed now with the frame_sync t_max setup
//no more early breaking required
}
}

View File

@ -265,7 +265,7 @@ static int digitize (dsd_opts* opts, dsd_state* state, int symbol)
else if ((state->synctype == 1) || (state->synctype == 3) || (state->synctype == 5) ||
(state->synctype == 9) || (state->synctype == 11) || (state->synctype == 13) ||
(state->synctype == 17) || (state->synctype == 36) )
(state->synctype == 17) || (state->synctype == 29) || (state->synctype == 36) )
{
// 1 -P25p1
@ -275,6 +275,8 @@ static int digitize (dsd_opts* opts, dsd_state* state, int symbol)
// 11 -DMR (inverted signal voice frame)
// 13 -DMR (inverted signal data frame)
// 17 -NXDN (inverted data frame)
// 29 -NXDN (inverted FSW)
// 36 -P25p2
int valid;
int dibit;
@ -284,7 +286,7 @@ static int digitize (dsd_opts* opts, dsd_state* state, int symbol)
if (state->synctype == 1)
{
// Use the P25 heuristics if available
valid = estimate_symbol(state->rf_mod, &(state->inv_p25_heuristics), state->last_dibit, symbol, &dibit);
//valid = estimate_symbol(state->rf_mod, &(state->inv_p25_heuristics), state->last_dibit, symbol, &dibit);
}
if (valid == 0)
@ -336,6 +338,8 @@ static int digitize (dsd_opts* opts, dsd_state* state, int symbol)
// 10 +DMR (non inverted signal data frame)
// 12 +DMR (non inverted signal voice frame)
// 16 +NXDN (non inverted data frame)
// 28 +NXND (FSW)
// 35 +p25p2
int valid;
int dibit;
@ -345,7 +349,7 @@ static int digitize (dsd_opts* opts, dsd_state* state, int symbol)
if (state->synctype == 0)
{
// Use the P25 heuristics if available
valid = estimate_symbol(state->rf_mod, &(state->p25_heuristics), state->last_dibit, symbol, &dibit);
//valid = estimate_symbol(state->rf_mod, &(state->p25_heuristics), state->last_dibit, symbol, &dibit);
}
if (valid == 0)

View File

@ -1,4 +1,4 @@
// DMR filter
// Original DMR filter
#define NZEROS 60
float ngain = 7.423339364f;
static float xv[NZEROS+1];
@ -21,70 +21,48 @@ float xcoeffs[] =
-0.0083649323f,
};
// NXDN48 filter
//#define NXZEROS 134
//float nxgain = 15.95930463f;
#define NXZEROS 91 //Osmocom OP25
float nxgain = 1.0f; //Osmocom OP25
//reverted to original NXDN filters, do better with LICH/Data handling
// NXDN48 filter - Original Version
#define NXZEROS 134
float nxgain = 15.95930463f;
static float nxv[NXZEROS+1];
//OP25 Osmocom NXDN48 Coeffs seem to do well, will want to do some VS testing
float nxcoeffs[] =
{ 0.00203767f, 0.00491622f, 0.00748189f, 0.00934561f, 0.01017049f, 0.00972167f,
0.00790748f, 0.00480597f, 0.00067202f, -0.00407743f, -0.00890019f, -0.01318478f,
-0.01632047f, -0.01777371f, -0.01716241f, -0.01431852f, -0.00933066f, -0.00255979f,
0.00537624f, 0.01364992f, 0.02130038f, 0.02733235f, 0.03082824f, 0.03106179f,
0.02760061f, 0.02038545f, 0.00977572f, -0.0034462f, -0.01811514f, -0.03276675f,
-0.04575844f, -0.05541762f, -0.06020353f, -0.0588669f, -0.05059129f, -0.03510097f,
-0.01272309f, 0.01560398f, 0.04837926f, 0.08364189f, 0.11912012f, 0.15241359f,
0.18119246f, 0.20339503f, 0.21740525f, 0.2221932f, 0.21740525f, 0.20339503f,
0.18119246f, 0.15241359f, 0.11912012f, 0.08364189f, 0.04837926f, 0.01560398f,
-0.01272309f, -0.03510097f, -0.05059129f, -0.0588669f, -0.06020353f, -0.05541762f,
-0.04575844f, -0.03276675f, -0.01811514f, -0.0034462f, 0.00977572f, 0.02038545f,
0.02760061f, 0.03106179f, 0.03082824f, 0.02733235f, 0.02130038f, 0.01364992f,
0.00537624f, -0.00255979f, -0.00933066f, -0.01431852f, -0.01716241f, -0.01777371f,
-0.01632047f, -0.01318478f, -0.00890019f, -0.00407743f, 0.00067202f, 0.00480597f,
0.00790748f, 0.00972167f, 0.01017049f, 0.00934561f, 0.00748189f, 0.00491622f,
0.00203767f};
//OLD nxCOEFFS
// { +0.031462429f, +0.031747267f, +0.030401148f, +0.027362877f,
// +0.022653298f, +0.016379869f, +0.008737200f, +0.000003302f,
// -0.009468531f, -0.019262057f, -0.028914291f, -0.037935027f,
// -0.045828927f, -0.052119261f, -0.056372283f, -0.058221106f,
// -0.057387924f, -0.053703443f, -0.047122444f, -0.037734535f,
// -0.025769308f, -0.011595336f, +0.004287292f, +0.021260954f,
// +0.038610717f, +0.055550276f, +0.071252765f, +0.084885375f,
// +0.095646450f, +0.102803611f, +0.105731303f, +0.103946126f,
// +0.097138329f, +0.085197939f, +0.068234131f, +0.046586711f,
// +0.020828821f, -0.008239664f, -0.039608255f, -0.072081234f,
// -0.104311776f, -0.134843790f, -0.162160200f, -0.184736015f,
// -0.201094346f, -0.209863285f, -0.209831516f, -0.200000470f,
// -0.179630919f, -0.148282051f, -0.105841323f, -0.052543664f,
// +0.011020985f, +0.083912428f, +0.164857408f, +0.252278939f,
// +0.344336996f, +0.438979335f, +0.534000832f, +0.627109358f,
// +0.715995947f, +0.798406824f, +0.872214756f, +0.935487176f,
// +0.986548646f, +1.024035395f, +1.046939951f, +1.054644241f,
// +1.046939951f, +1.024035395f, +0.986548646f, +0.935487176f,
// +0.872214756f, +0.798406824f, +0.715995947f, +0.627109358f,
// +0.534000832f, +0.438979335f, +0.344336996f, +0.252278939f,
// +0.164857408f, +0.083912428f, +0.011020985f, -0.052543664f,
// -0.105841323f, -0.148282051f, -0.179630919f, -0.200000470f,
// -0.209831516f, -0.209863285f, -0.201094346f, -0.184736015f,
// -0.162160200f, -0.134843790f, -0.104311776f, -0.072081234f,
// -0.039608255f, -0.008239664f, +0.020828821f, +0.046586711f,
// +0.068234131f, +0.085197939f, +0.097138329f, +0.103946126f,
// +0.105731303f, +0.102803611f, +0.095646450f, +0.084885375f,
// +0.071252765f, +0.055550276f, +0.038610717f, +0.021260954f,
// +0.004287292f, -0.011595336f, -0.025769308f, -0.037734535f,
// -0.047122444f, -0.053703443f, -0.057387924f, -0.058221106f,
// -0.056372283f, -0.052119261f, -0.045828927f, -0.037935027f,
// -0.028914291f, -0.019262057f, -0.009468531f, +0.000003302f,
// +0.008737200f, +0.016379869f, +0.022653298f, +0.027362877f,
// +0.030401148f, +0.031747267f, +0.031462429f,
// };
{ +0.031462429f, +0.031747267f, +0.030401148f, +0.027362877f,
+0.022653298f, +0.016379869f, +0.008737200f, +0.000003302f,
-0.009468531f, -0.019262057f, -0.028914291f, -0.037935027f,
-0.045828927f, -0.052119261f, -0.056372283f, -0.058221106f,
-0.057387924f, -0.053703443f, -0.047122444f, -0.037734535f,
-0.025769308f, -0.011595336f, +0.004287292f, +0.021260954f,
+0.038610717f, +0.055550276f, +0.071252765f, +0.084885375f,
+0.095646450f, +0.102803611f, +0.105731303f, +0.103946126f,
+0.097138329f, +0.085197939f, +0.068234131f, +0.046586711f,
+0.020828821f, -0.008239664f, -0.039608255f, -0.072081234f,
-0.104311776f, -0.134843790f, -0.162160200f, -0.184736015f,
-0.201094346f, -0.209863285f, -0.209831516f, -0.200000470f,
-0.179630919f, -0.148282051f, -0.105841323f, -0.052543664f,
+0.011020985f, +0.083912428f, +0.164857408f, +0.252278939f,
+0.344336996f, +0.438979335f, +0.534000832f, +0.627109358f,
+0.715995947f, +0.798406824f, +0.872214756f, +0.935487176f,
+0.986548646f, +1.024035395f, +1.046939951f, +1.054644241f,
+1.046939951f, +1.024035395f, +0.986548646f, +0.935487176f,
+0.872214756f, +0.798406824f, +0.715995947f, +0.627109358f,
+0.534000832f, +0.438979335f, +0.344336996f, +0.252278939f,
+0.164857408f, +0.083912428f, +0.011020985f, -0.052543664f,
-0.105841323f, -0.148282051f, -0.179630919f, -0.200000470f,
-0.209831516f, -0.209863285f, -0.201094346f, -0.184736015f,
-0.162160200f, -0.134843790f, -0.104311776f, -0.072081234f,
-0.039608255f, -0.008239664f, +0.020828821f, +0.046586711f,
+0.068234131f, +0.085197939f, +0.097138329f, +0.103946126f,
+0.105731303f, +0.102803611f, +0.095646450f, +0.084885375f,
+0.071252765f, +0.055550276f, +0.038610717f, +0.021260954f,
+0.004287292f, -0.011595336f, -0.025769308f, -0.037734535f,
-0.047122444f, -0.053703443f, -0.057387924f, -0.058221106f,
-0.056372283f, -0.052119261f, -0.045828927f, -0.037935027f,
-0.028914291f, -0.019262057f, -0.009468531f, +0.000003302f,
+0.008737200f, +0.016379869f, +0.022653298f, +0.027362877f,
+0.030401148f, +0.031747267f, +0.031462429f,
};
// DMR filter F4EXB
#define DMRNZEROS 60
@ -110,6 +88,52 @@ const float dmrcoeffs[] =
0.0147202645, -0.0186176083, -0.0428325003, -0.0543747957, -0.0528141756,
-0.0404938748, -0.0216605133, -0.0013114705, 0.0159662432, 0.0269200615, 0.0301506278};
// dPMR filter, version of F4EXB
static float dpmrxv[NXZEROS+1];
// dPMR filter, version of F4EXB
#define DPMRNZEROS 134
// dPMR filter, version of F4EXB
const float dpmrgain = 14.6083498224f;
// dPMR filter - root raised cosine alpha=0.2 Ts = 3325 S/s Fc = 48 kHz - zero at boundaries appears to be slightly better
const float dpmrcoeffs[] =
{-0.0000983004, 0.0058388841, 0.0119748846, 0.0179185547, 0.0232592816,
0.0275919612, 0.0305433586, 0.0317982965, 0.0311240307,
0.0283911865, 0.0235897433, 0.0168387650, 0.0083888763,
-0.0013831396, -0.0119878087, -0.0228442151, -0.0333082708,
-0.0427067804, -0.0503756642, -0.0557003599, -0.0581561791,
-0.0573462646, -0.0530347941, -0.0451732069, -0.0339174991,
-0.0196350217, -0.0028997157, 0.0155246961, 0.0347134030,
0.0536202583, 0.0711271166, 0.0861006725, 0.0974542022,
0.1042112035, 0.1055676660, 0.1009496091, 0.0900625944,
0.0729301774, 0.0499186839, 0.0217462748, -0.0105250265,
-0.0455148664, -0.0815673067, -0.1168095612, -0.1492246435,
-0.1767350726, -0.1972941202, -0.2089805758, -0.2100926829,
-0.1992367833, -0.1754063031, -0.1380470370, -0.0871052089,
-0.0230554989, 0.0530929052, 0.1398131936, 0.2351006721,
0.3365341927, 0.4413570929, 0.5465745033, 0.6490630781,
0.7456885564, 0.8334261381, 0.9094784589, 0.9713859928,
1.0171250045, 1.0451886943, 1.0546479089, 1.0451886943,
1.0171250045, 0.9713859928, 0.9094784589, 0.8334261381,
0.7456885564, 0.6490630781, 0.5465745033, 0.4413570929,
0.3365341927, 0.2351006721, 0.1398131936, 0.0530929052,
-0.0230554989, -0.0871052089, -0.1380470370, -0.1754063031,
-0.1992367833, -0.2100926829, -0.2089805758, -0.1972941202,
-0.1767350726, -0.1492246435, -0.1168095612, -0.0815673067,
-0.0455148664, -0.0105250265, 0.0217462748, 0.0499186839,
0.0729301774, 0.0900625944, 0.1009496091, 0.1055676660,
0.1042112035, 0.0974542022, 0.0861006725, 0.0711271166,
0.0536202583, 0.0347134030, 0.0155246961, -0.0028997157,
-0.0196350217, -0.0339174991, -0.0451732069, -0.0530347941,
-0.0573462646, -0.0581561791, -0.0557003599, -0.0503756642,
-0.0427067804, -0.0333082708, -0.0228442151, -0.0119878087,
-0.0013831396, 0.0083888763, 0.0168387650, 0.0235897433,
0.0283911865, 0.0311240307, 0.0317982965, 0.0305433586,
0.0275919612, 0.0232592816, 0.0179185547, 0.0119748846,
0.0058388841, -0.0000983004};
short dsd_input_filter(short sample, int mode);
@ -123,7 +147,13 @@ dmr_filter(short sample)
short
nxdn_filter(short sample)
{
return dsd_input_filter(sample, 2);
return dsd_input_filter(sample, 2);
}
short
dpmr_filter(short sample)
{
return dsd_input_filter(sample, 4);
}
@ -144,7 +174,7 @@ dsd_input_filter(short sample, int mode)
case 2:
gain = nxgain;
v = nxv;
coeffs = nxcoeffs;
coeffs = (float *)nxcoeffs;
zeros = NXZEROS;
break;
case 3:
@ -153,6 +183,12 @@ dsd_input_filter(short sample, int mode)
coeffs = (float *)dmrcoeffs;
zeros = DMRNZEROS;
break;
case 4:
gain = dpmrgain;
v = dpmrxv;
coeffs = (float *)dpmrcoeffs;
zeros = DPMRNZEROS;
break;
default:
return sample;
}

View File

@ -84,54 +84,13 @@ processFrame (dsd_opts * opts, dsd_state * state)
state->minref = state->min;
}
if ((state->synctype == 8) || (state->synctype == 9)) //NXDN Voice
{
//state->rf_mod = 2; //wrong type of modulation HERE HERE
state->nac = 0;
state->lastsrc = 0;
state->lasttg = 0;
if (opts->errorbars == 1)
{
if (opts->verbose > 0)
{
level = (int) state->max / 164;
//fprintf (stderr, "inlvl: %2i%% ", level);
}
}
state->nac = 0;
if ((opts->mbe_out_dir[0] != 0) && (opts->mbe_out_f == NULL))
{
openMbeOutFile (opts, state);
}
sprintf (state->fsubtype, " VOICE ");
processNXDNVoice (opts, state);
//ProcessNXDNFrame (opts, state, 0);
return;
}
else if ((state->synctype == 16) || (state->synctype == 17)) //NXDN Data
{
//state->rf_mod = 2;
state->nac = 0;
state->lastsrc = 0;
state->lasttg = 0;
if (opts->errorbars == 1)
{
if (opts->verbose > 0)
{
level = (int) state->max / 164;
//fprintf (stderr, "inlvl: %2i%% ", level);
}
}
state->nac = 0;
if ((opts->mbe_out_dir[0] != 0) && (opts->mbe_out_f == NULL))
{
openMbeOutFile (opts, state);
}
sprintf (state->fsubtype, " DATA ");
processNXDNData (opts, state);
//ProcessNXDNFrame (opts, state, 0);
return;
}
//NXDN FSW
if ((state->synctype == 28) || (state->synctype == 29))
{
nxdn_frame (opts, state);
//no MBEout...use symbol capture bin instead!
return;
}
else if ((state->synctype == 6) || (state->synctype == 7))
{
state->nac = 0;

File diff suppressed because it is too large Load Diff

View File

@ -201,7 +201,7 @@ processMbeFrame (dsd_opts * opts, dsd_state * state, char imbe_fr[8][23], char a
saveAmbe2450Data (opts, state, ambe_d);
}
}
else if ((state->synctype == 8) || (state->synctype == 9))
else if ((state->synctype == 28) || (state->synctype == 29)) //was 8 and 9
{
state->errs = mbe_eccAmbe3600x2450C0 (ambe_fr);

View File

@ -178,18 +178,25 @@ getSymbol (dsd_opts * opts, dsd_state * state, int have_sync)
state->lastsynctype == 20 || state->lastsynctype == 21 ||
state->lastsynctype == 22 || state->lastsynctype == 23 ||
state->lastsynctype == 24 || state->lastsynctype == 25 ||
state->lastsynctype == 26 || state->lastsynctype == 27 ) //||
//state->lastsynctype == 35 || state->lastsynctype == 36) //phase 2
state->lastsynctype == 26 || state->lastsynctype == 27 ||
state->lastsynctype == 28 || state->lastsynctype == 29 ) //||
//state->lastsynctype == 35 || state->lastsynctype == 36) //phase 2 C4FM disc tap input
{
if(state->samplesPerSymbol == 20)
//if(state->samplesPerSymbol == 20)
if(opts->frame_nxdn48 == 1)
{
sample = nxdn_filter(sample);
}
//else if (state->lastsynctype >= 20 && state->lastsynctype <=27) //this the right range?
else if (opts->frame_dpmr == 1)
{
sample = dpmr_filter(sample);
}
else if (state->samplesPerSymbol == 8) //phase 2 cqpsk
{
//sample = dmr_filter(sample); //work on filter later
}
else // the 12.5KHz NXDN filter is the same as the DMR filter
else // the 12.5KHz NXDN filter is the same as the DMR filter...hopefully
{
sample = dmr_filter(sample);
}