Delete nxdn_voice.c.bkp3
This commit is contained in:
parent
a6c83a7fbb
commit
a239cd94fe
|
|
@ -1,118 +0,0 @@
|
|||
#include "dsd.h"
|
||||
#include "nxdn_const.h"
|
||||
|
||||
void
|
||||
processNXDNVoice (dsd_opts * opts, dsd_state * state)
|
||||
{
|
||||
int i, j, dibit, k, l;
|
||||
char ambe_fr[4][24];
|
||||
const int *w, *x, *y, *z;
|
||||
const char *pr;
|
||||
//borrow from LEH data
|
||||
unsigned char sacch_raw[72] = {0};
|
||||
unsigned char sacch_decoded[32] = {0}; /* 26 bit + 6 bit CRC */
|
||||
unsigned char *pr2; //change this to pr2 to differentiate
|
||||
uint8_t CrcIsGood = 0;
|
||||
uint8_t StructureField = 0;
|
||||
uint8_t RAN = 0;
|
||||
uint8_t PartOfFrame = 0;
|
||||
|
||||
if (opts->errorbars == 1)
|
||||
{
|
||||
fprintf (stderr,"VOICE e:");
|
||||
}
|
||||
|
||||
for (i = 0; i < 30; i++)
|
||||
{
|
||||
dibit = getDibit (opts, state);
|
||||
#ifdef NXDN_DUMP
|
||||
fprintf (stderr,"%c", dibit + 48);
|
||||
#endif
|
||||
}
|
||||
#ifdef NXDN_DUMP
|
||||
fprintf (stderr," ");
|
||||
#endif
|
||||
|
||||
pr = nxdnpr;
|
||||
pr2 = (unsigned char *)(&nxdnpr2[8]); //from LEH data
|
||||
|
||||
for (j = 0; j < 4; j++)
|
||||
{
|
||||
w = nW;
|
||||
x = nX;
|
||||
y = nY;
|
||||
z = nZ;
|
||||
for (i = 0; i < 36; i++)
|
||||
{
|
||||
dibit = getDibit (opts, state);
|
||||
//fprintf (stderr,"%c", dibit + 48); //remove later
|
||||
if (i < 30){
|
||||
sacch_raw[(2*i)] = ((*pr2) & 1) ^ (1 & (dibit >> 1)); // bit 1
|
||||
sacch_raw[(2*i)+1] = (1 & dibit); // bit 0
|
||||
}
|
||||
|
||||
#ifdef NXDN_DUMP
|
||||
fprintf (stderr,"%c", dibit + 48);
|
||||
#endif
|
||||
ambe_fr[*w][*x] = *pr ^ (1 & (dibit >> 1)); // bit 1
|
||||
pr++;
|
||||
ambe_fr[*y][*z] = (1 & dibit); // bit 0
|
||||
w++;
|
||||
x++;
|
||||
y++;
|
||||
z++;
|
||||
}
|
||||
processMbeFrame (opts, state, NULL, ambe_fr, NULL);
|
||||
//from LEH data
|
||||
/* Decode the SACCH fields */
|
||||
CrcIsGood = NXDN_SACCH_raw_part_decode(sacch_raw, sacch_decoded);
|
||||
StructureField = (sacch_decoded[0]<<1 | sacch_decoded[1]<<0) & 0x03; /* Compute the Structure Field (remove 2 first bits of the SR Information in the SACCH) */
|
||||
RAN = (sacch_decoded[2]<<5 | sacch_decoded[3]<<4 | sacch_decoded[4]<<3 | sacch_decoded[5]<<2 | sacch_decoded[6]<<1 | sacch_decoded[7]<<0) & 0x3F; /* Compute the RAN (6 last bits of the SR Information in the SACCH) */
|
||||
|
||||
/* Compute the Part of Frame according to the structure field */
|
||||
if (StructureField == 3) PartOfFrame = 0;
|
||||
else if(StructureField == 2) PartOfFrame = 1;
|
||||
else if(StructureField == 1) PartOfFrame = 2;
|
||||
else if(StructureField == 0) PartOfFrame = 3;
|
||||
else PartOfFrame = 0; /* Normally we should never go here */
|
||||
|
||||
/* Fill the SACCH structure */
|
||||
state->NxdnSacchRawPart[PartOfFrame].CrcIsGood = CrcIsGood;
|
||||
state->NxdnSacchRawPart[PartOfFrame].StructureField = StructureField;
|
||||
state->NxdnSacchRawPart[PartOfFrame].RAN = RAN;
|
||||
|
||||
memcpy(state->NxdnSacchRawPart[PartOfFrame].Data, &sacch_decoded[8], 18); /* Copy the 18 bits of SACCH content */
|
||||
|
||||
//fprintf(stderr, "RAN=%02d - Part %d/4 ", RAN, PartOfFrame + 1);
|
||||
if(CrcIsGood)
|
||||
{
|
||||
//fprintf (stderr, "RAN=%02d - Part %d/4 ", RAN, PartOfFrame + 1);
|
||||
//fprintf (stderr, " (OK) - ");
|
||||
state->nxdn_last_ran = RAN; //disable, try to grab this in voice instead
|
||||
}
|
||||
|
||||
else fprintf (stderr, "(CRC ERR) - ");
|
||||
|
||||
if(PartOfFrame == 3)
|
||||
{
|
||||
/* Decode the entire SACCH content */
|
||||
NXDN_SACCH_Full_decode(opts, state);
|
||||
}
|
||||
|
||||
/* Reset the SACCH CRCs when all 4 voice frame
|
||||
* SACCH spare parts have been received */
|
||||
if(PartOfFrame == 3)
|
||||
{
|
||||
/* Reset all CRCs of the SACCH */
|
||||
for(i = 0; i < 4; i++) state->NxdnSacchRawPart[i].CrcIsGood = 0;
|
||||
}
|
||||
#ifdef NXDN_DUMP
|
||||
fprintf (stderr," ");
|
||||
#endif
|
||||
}
|
||||
//fprintf (stderr, "\nV%c\n%c\n", ambe_fr, pr);
|
||||
if (opts->errorbars == 1)
|
||||
{
|
||||
fprintf (stderr,"\n");
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue