Remove Unused Bits of Code for DMR/RS Sync Pattern (Fixes Bug if RES Sync is detected and flag tripped); #270

This commit is contained in:
lwvmobile 2024-11-17 08:43:11 -05:00
parent cd32158a73
commit b8beede921
4 changed files with 32 additions and 84 deletions

View File

@ -699,7 +699,6 @@ typedef struct
int dpmr_color_code; int dpmr_color_code;
short int dmr_stereo; //need state variable for upsample function short int dmr_stereo; //need state variable for upsample function
short int dmr_ms_rc;
short int dmr_ms_mode; short int dmr_ms_mode;
unsigned int dmrburstL; unsigned int dmrburstL;
unsigned int dmrburstR; unsigned int dmrburstR;
@ -956,7 +955,7 @@ typedef struct
#define NXDN_PANDFSW "3131133313131331131" //19 symbols #define NXDN_PANDFSW "3131133313131331131" //19 symbols
#define INV_NXDN_PANDFSW "1313311131313113313" //19 symbols #define INV_NXDN_PANDFSW "1313311131313113313" //19 symbols
#define DMR_RC_DATA_SYNC "131331111133133133311313" #define DMR_RESERVED_SYNC "131331111133133133311313"
#define DMR_DIRECT_MODE_TS1_DATA_SYNC "331333313111313133311111" #define DMR_DIRECT_MODE_TS1_DATA_SYNC "331333313111313133311111"
#define DMR_DIRECT_MODE_TS1_VOICE_SYNC "113111131333131311133333" #define DMR_DIRECT_MODE_TS1_VOICE_SYNC "113111131333131311133333"

View File

@ -293,8 +293,8 @@ dmr_data_sync (dsd_opts * opts, dsd_state * state)
info[(2*i) + 99] = (1 & dibit); // bit 0 info[(2*i) + 99] = (1 & dibit); // bit 0
} }
//don't run on MS Reverse Channel Data //
if (state->dmr_ms_rc == 0) dmr_data_burst_handler(opts, state, (uint8_t *)info, burst); dmr_data_burst_handler(opts, state, (uint8_t *)info, burst);
//don't run cach on simplex or mono //don't run cach on simplex or mono
if (state->dmr_ms_mode == 0 && opts->dmr_mono == 0) if (state->dmr_ms_mode == 0 && opts->dmr_mono == 0)

View File

@ -27,7 +27,7 @@ void dmrMS (dsd_opts * opts, dsd_state * state)
uint8_t m3[4][24]; uint8_t m3[4][24];
const int *w, *x, *y, *z; const int *w, *x, *y, *z;
char sync[25];
uint8_t syncdata[48]; uint8_t syncdata[48];
memset (syncdata, 0, sizeof(syncdata)); memset (syncdata, 0, sizeof(syncdata));
@ -156,8 +156,6 @@ void dmrMS (dsd_opts * opts, dsd_state * state)
syncdata[(2*i)] = (1 & (dibit >> 1)); // bit 1 syncdata[(2*i)] = (1 & (dibit >> 1)); // bit 1
syncdata[(2*i)+1] = (1 & dibit); // bit 0 syncdata[(2*i)+1] = (1 & dibit); // bit 0
sync[i] = (dibit | 1) + 48;
// load the superframe to do embedded signal processing // load the superframe to do embedded signal processing
if(vc > 1) //grab on vc1 values 2-5 B C D and E if(vc > 1) //grab on vc1 values 2-5 B C D and E
{ {
@ -167,24 +165,6 @@ void dmrMS (dsd_opts * opts, dsd_state * state)
} }
sync[24] = 0;
//test for RC sync pattern in MS sourced audio
if ( strcmp (sync, DMR_RC_DATA_SYNC) == 0)
{
state->dmr_ms_rc = 1;
fprintf (stderr, "%s ", timestr);
if (opts->inverted_dmr == 0)
{
fprintf (stderr,"Sync: +DMR MS/DM MODE/MONO ");
}
else fprintf (stderr,"Sync: -DMR MS/DM MODE/MONO ");
fprintf (stderr, "| RC ");
fprintf (stderr, "\n");
}
for(i = 0; i < 8; i++) emb_pdu[i + 0] = syncdata[i]; for(i = 0; i < 8; i++) emb_pdu[i + 0] = syncdata[i];
for(i = 0; i < 8; i++) emb_pdu[i + 8] = syncdata[i + 40]; for(i = 0; i < 8; i++) emb_pdu[i + 8] = syncdata[i + 40];
@ -264,38 +244,35 @@ void dmrMS (dsd_opts * opts, dsd_state * state)
memcpy (m2, ambe_fr2, sizeof(m2)); memcpy (m2, ambe_fr2, sizeof(m2));
memcpy (m3, ambe_fr3, sizeof(m3)); memcpy (m3, ambe_fr3, sizeof(m3));
if (state->dmr_ms_rc == 0) if (state->directmode == 0)
{ {
if (state->directmode == 0) processMbeFrame (opts, state, NULL, ambe_fr, NULL);
{ memcpy(state->f_l4[0], state->audio_out_temp_buf, sizeof(state->audio_out_temp_buf));
processMbeFrame (opts, state, NULL, ambe_fr, NULL); memcpy(state->s_l4[0], state->s_l, sizeof(state->s_l));
memcpy(state->f_l4[0], state->audio_out_temp_buf, sizeof(state->audio_out_temp_buf)); memcpy(state->s_l4u[0], state->s_lu, sizeof(state->s_lu));
memcpy(state->s_l4[0], state->s_l, sizeof(state->s_l)); processMbeFrame (opts, state, NULL, ambe_fr2, NULL);
memcpy(state->s_l4u[0], state->s_lu, sizeof(state->s_lu)); memcpy(state->f_l4[1], state->audio_out_temp_buf, sizeof(state->audio_out_temp_buf));
processMbeFrame (opts, state, NULL, ambe_fr2, NULL); memcpy(state->s_l4[1], state->s_l, sizeof(state->s_l));
memcpy(state->f_l4[1], state->audio_out_temp_buf, sizeof(state->audio_out_temp_buf)); memcpy(state->s_l4u[1], state->s_lu, sizeof(state->s_lu));
memcpy(state->s_l4[1], state->s_l, sizeof(state->s_l)); processMbeFrame (opts, state, NULL, ambe_fr3, NULL);
memcpy(state->s_l4u[1], state->s_lu, sizeof(state->s_lu)); memcpy(state->f_l4[2], state->audio_out_temp_buf, sizeof(state->audio_out_temp_buf));
processMbeFrame (opts, state, NULL, ambe_fr3, NULL); memcpy(state->s_l4[2], state->s_l, sizeof(state->s_l));
memcpy(state->f_l4[2], state->audio_out_temp_buf, sizeof(state->audio_out_temp_buf)); memcpy(state->s_l4u[2], state->s_lu, sizeof(state->s_lu));
memcpy(state->s_l4[2], state->s_l, sizeof(state->s_l)); }
memcpy(state->s_l4u[2], state->s_lu, sizeof(state->s_lu)); else
} {
else processMbeFrame (opts, state, NULL, ambe_fr4, NULL); //play duplicate of 2 here to smooth audio on tdma direct
{ memcpy(state->f_l4[0], state->audio_out_temp_buf, sizeof(state->audio_out_temp_buf));
processMbeFrame (opts, state, NULL, ambe_fr4, NULL); //play duplicate of 2 here to smooth audio on tdma direct memcpy(state->s_l4[0], state->s_l, sizeof(state->s_l));
memcpy(state->f_l4[0], state->audio_out_temp_buf, sizeof(state->audio_out_temp_buf)); memcpy(state->s_l4u[0], state->s_lu, sizeof(state->s_lu));
memcpy(state->s_l4[0], state->s_l, sizeof(state->s_l)); processMbeFrame (opts, state, NULL, ambe_fr2, NULL);
memcpy(state->s_l4u[0], state->s_lu, sizeof(state->s_lu)); memcpy(state->f_l4[1], state->audio_out_temp_buf, sizeof(state->audio_out_temp_buf));
processMbeFrame (opts, state, NULL, ambe_fr2, NULL); memcpy(state->s_l4[1], state->s_l, sizeof(state->s_l));
memcpy(state->f_l4[1], state->audio_out_temp_buf, sizeof(state->audio_out_temp_buf)); memcpy(state->s_l4u[1], state->s_lu, sizeof(state->s_lu));
memcpy(state->s_l4[1], state->s_l, sizeof(state->s_l)); processMbeFrame (opts, state, NULL, ambe_fr3, NULL);
memcpy(state->s_l4u[1], state->s_lu, sizeof(state->s_lu)); memcpy(state->f_l4[2], state->audio_out_temp_buf, sizeof(state->audio_out_temp_buf));
processMbeFrame (opts, state, NULL, ambe_fr3, NULL); memcpy(state->s_l4[2], state->s_l, sizeof(state->s_l));
memcpy(state->f_l4[2], state->audio_out_temp_buf, sizeof(state->audio_out_temp_buf)); memcpy(state->s_l4u[2], state->s_lu, sizeof(state->s_lu));
memcpy(state->s_l4[2], state->s_l, sizeof(state->s_l));
memcpy(state->s_l4u[2], state->s_lu, sizeof(state->s_lu));
}
} }
//TODO: Consider copying f_l to f_r for left and right channel saturation on MS mode //TODO: Consider copying f_l to f_r for left and right channel saturation on MS mode
@ -343,7 +320,6 @@ void dmrMS (dsd_opts * opts, dsd_state * state)
if (vc > 6) goto END; if (vc > 6) goto END;
skipDibit (opts, state, 144); //skip to next tdma channel skipDibit (opts, state, 144); //skip to next tdma channel
state->dmr_ms_rc = 0;
//since we are in a loop, run ncursesPrinter here //since we are in a loop, run ncursesPrinter here
if (opts->use_ncurses_terminal == 1) if (opts->use_ncurses_terminal == 1)
@ -371,7 +347,6 @@ void dmrMS (dsd_opts * opts, dsd_state * state)
state->dmr_stereo = 0; state->dmr_stereo = 0;
state->dmr_ms_mode = 0; state->dmr_ms_mode = 0;
state->dmr_ms_rc = 0;
state->directmode = 0; //flag off state->directmode = 0; //flag off
if (timestr != NULL) if (timestr != NULL)

View File

@ -867,32 +867,6 @@ getFrameSync (dsd_opts * opts, dsd_state * state)
return (32); return (32);
} }
} }
//not sure if this should be here, RC data should only be present in vc6?
if(strcmp (synctest, DMR_RC_DATA_SYNC) == 0)
{
state->carrier = 1;
state->offset = synctest_pos;
state->max = ((state->max) + lmax) / 2;
state->min = ((state->min) + lmin) / 2;
//state->directmode = 0;
//fprintf (stderr, "DMR RC DATA\n");
state->dmr_ms_rc = 1; //set flag for RC data, then process accordingly and reset back to 0 afterwards
if (0 == 0) //opts->inverted_dmr
{
// voice frame
sprintf(state->ftype, "DMR RC");
if (opts->errorbars == 1)
{
//printFrameSync (opts, state, "+DMR RC Data", synctest_pos + 1, modulation);
}
if (state->lastsynctype != 34)
{
//state->firstframe = 1;
}
state->lastsynctype = 34;
return (34);
}
}
if(strcmp (synctest, DMR_MS_VOICE_SYNC) == 0) if(strcmp (synctest, DMR_MS_VOICE_SYNC) == 0)
{ {