Skip to content

Commit

Permalink
And there goes that. I think this is a good example of what the C++ f…
Browse files Browse the repository at this point in the history
…olks call an anti-pattern. I mean seriously, what the hell?
  • Loading branch information
Peter Barfuss committed Jan 16, 2015
1 parent f31a3ad commit 455d760
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 45 deletions.
50 changes: 9 additions & 41 deletions dmr_voice.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,28 +99,16 @@ processDMRvoice (dsd_opts * opts, dsd_state * state)
int mutecurrentslot = 0;
unsigned char msMode = 0;

dibit_p = state->dibit_buf_p - 144;
dibit_p = state->dibit_buf_p - 24;
for (j = 0; j < 6; j++) {
// 2nd half of previous slot
for (i = 0; i < 54; i++) {
if (j > 0) {
dibit = getDibit (opts, state);
} else {
dibit = *dibit_p++;
if (opts->inverted_dmr == 1)
dibit = (dibit ^ 2);
}
dibit = getDibit (opts, state);
}

// CACH
for (i = 0; i < 12; i++) {
if (j > 0) {
dibit = getDibit (opts, state);
} else {
dibit = *dibit_p++;
if (opts->inverted_dmr == 1)
dibit = (dibit ^ 2);
}
dibit = getDibit (opts, state);
cachbits[2*i] = (1 & (dibit >> 1)); // bit 1
cachbits[2*i+1] = (1 & dibit); // bit 0
}
Expand All @@ -143,26 +131,14 @@ processDMRvoice (dsd_opts * opts, dsd_state * state)

// current slot frame 1
for (i = 0; i < 36; i++) {
if (j > 0) {
dibit = getDibit (opts, state);
} else {
dibit = *dibit_p++;
if (opts->inverted_dmr == 1)
dibit = (dibit ^ 2);
}
dibit = getDibit (opts, state);
ambe_fr[rW[i]][rX[i]] = (1 & (dibit >> 1)); // bit 1
ambe_fr[rY[i]][rZ[i]] = (1 & dibit); // bit 0
}

// current slot frame 2 first half
for (i = 0; i < 18; i++) {
if (j > 0) {
dibit = getDibit (opts, state);
} else {
dibit = *dibit_p++;
if (opts->inverted_dmr == 1)
dibit = (dibit ^ 2);
}
dibit = getDibit (opts, state);
ambe_fr2[rW[i]][rX[i]] = (1 & (dibit >> 1)); // bit 1
ambe_fr2[rY[i]][rZ[i]] = (1 & dibit); // bit 0
}
Expand Down Expand Up @@ -193,7 +169,10 @@ processDMRvoice (dsd_opts * opts, dsd_state * state)
if (!doQR1676(&emb_field)) {
#endif
lcss = ((emb_field >> 10) & 3);
processEmb (state, lcss, syncdata);
AssembleEmb (state, lcss, syncdata);
if(emb_fr_valid == 0x0f) {
processEmb (state, lcss, emb_fr);
}
#if 0
}
#endif
Expand Down Expand Up @@ -297,17 +276,6 @@ processDMRvoice (dsd_opts * opts, dsd_state * state)
strcpy (state->slot0light, " SLOT0 ");
}
}

if (j == 5) {
// 2nd half next slot
skipDibit (opts, state, 54);

// CACH
skipDibit (opts, state, 12);

// first half current slot
skipDibit (opts, state, 54);
}
}
}

6 changes: 2 additions & 4 deletions nxdn.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@ void
processNXDNData (dsd_opts * opts, dsd_state * state)
{
int i, dibit;
int *dibit_p;
char lich[9];
char lich_scram[9] = { 0, 0, 1, 0, 0, 1, 1, 1, 0 };
dibit_p = state->dibit_buf_p - 8;

for (i = 0; i < 8; i++) {
dibit = *dibit_p++;
dibit = getDibit (opts, state);
if(lich_scram[i] ^ (state->lastsynctype & 0x1)) {
dibit = (dibit ^ 2);
}
Expand Down Expand Up @@ -43,7 +41,7 @@ processNXDNData (dsd_opts * opts, dsd_state * state)
printf("\n");
}

skipDibit (opts, state, 174);
skipDibit (opts, state, 166);
}

void
Expand Down

0 comments on commit 455d760

Please sign in to comment.