Go to the documentation of this file.
22 #define L_CODEWORD 255
24 #define L_CODEBLOCK (I * L_CODEWORD)
25 #define FRAME_SIZE (I * L_SYMBOL)
26 #define SYMBOLS_NO_CONV (L_ASM + L_CODEBLOCK)
27 #define MAX_SYMBOLS ( 2 * (L_ASM + L_CODEBLOCK + 1))
32 #define V_FRAMEBITS (8 * SYMBOLS_NO_CONV)
34 #define VERSION "0.20"
42 printf(
"0x%02hhx", *(
data++));
61 printf(
"%02hhx", *(
data++));
75 void prng(
unsigned char* lfsr,
unsigned char* o) {
76 unsigned char rnd = 0U;
77 unsigned char bit = 0U;
79 for (
i = 0;
i < 8;
i++) {
80 rnd = (rnd << 1) | (*lfsr & 0x1U);
81 bit = (((*lfsr >> 3) ^ *lfsr) ^ (*lfsr >> 5)) ^ (*lfsr >>7);
82 *lfsr = (*lfsr >> 1) | (bit << 7);
96 symbols[
i ] = ((coded[
i/8] << (
i % 8)) & 0x80) > 0 ? 255 : 0;
112 printf(
"\nTest decoded for Outernet\n");
113 printf(
"\nDecode Channel Access Data Units encoded via propsed use of");
114 printf(
"\nCCSDS TM Sync and Channel Coding standard\n\n");
115 printf(
"Use: %s [options]\n", progname);
116 printf(
" c Indicates that CADU has been convolutionally coded\n");
117 printf(
" A Viterbi decoder will be used\n");
119 printf(
" Decoded frame\n");
121 printf(
" Errors from the Reed-Solomon decode are detected but not\n");
122 printf(
" corrected.\n");
127 int main(
int argc,
char** argv) {
128 unsigned char sync[] = {0x1A, 0xCF, 0xFC, 0x1D};
134 unsigned char lfsr = 0xFFU;
148 printf(
"outernetDecode %s (%s %s)\n",
VERSION, __DATE__, __TIME__);
151 printf(
"\nouternetDecode input_downlink_filename output_telemetry_filename\n");
156 while ((d = getopt(argc, argv,
"c")) != EOF) {
172 in = fopen(argv[1],
"r");
173 out = fopen(argv[2],
"w");
176 while (fread(symbols,
sizeof(
char), caduSymbols, in) == caduSymbols) {
187 if(memcmp(sync, convdecoded,
L_ASM) != 0) {
188 fprintf(
stderr,
"ASM not found\n");
198 for (
i = 0;
i <
I;
i++) {
201 codeword[
j] = convdecoded[
L_ASM +
i +
j *
I];
212 if (rsErrCnt == -1) {
213 fprintf(
stderr,
"Uncorrectable errors in frame\n");
216 }
else if (rsErrCnt > 0) {
218 fprintf(
stderr,
"%d errors in block\n", rsErrCnt);
220 fprintf(
stderr,
"symbol: %i\n",
int main(int argc, char **argv)
int init_viterbi27(void *vp, int starting_state)
int chainback_viterbi27(void *vp, unsigned char *data, unsigned int nbits, unsigned int endstate)
void outputHex(unsigned char *data, int length)
no change in intended resolving MODur00064 Corrected handling of bad ephemeris attitude resolving resolving GSFcd00179 Corrected handling of fill values for[Sensor|Solar][Zenith|Azimuth] resolving MODxl01751 Changed to validate LUT version against a value retrieved from the resolving MODxl02056 Changed to calculate Solar Diffuser angles without adjustment for estimated post launch changes in the MODIS orientation relative to incidentally resolving defects MODxl01766 Also resolves MODxl01947 Changed to ignore fill values in SCI_ABNORM and SCI_STATE rather than treating them as resolving MODxl01780 Changed to use spacecraft ancillary data to recognise when the mirror encoder data is being set by side A or side B and to change calculations accordingly This removes the need for seperate LUTs for Side A and Side B data it makes the new LUTs incompatible with older versions of the and vice versa Also resolves MODxl01685 A more robust GRing algorithm is being which will create a non default GRing anytime there s even a single geolocated pixel in a granule Removed obsolete messages from seed as required for compatibility with version of the SDP toolkit Corrected test output file names to end in out
int update_viterbi27_blk(void *vp, unsigned char sym[], int npairs)
void prng(unsigned char *lfsr, unsigned char *o)
void showHelp(char *progname)
int decode_rs_ccsds(unsigned char *data, int *eras_pos, int no_eras, int pad)
void formatHex(unsigned char *data, int length)
void set_viterbi27_polynomial(int polys[2])
void convDecode(unsigned char *data, unsigned char *coded)
no change in intended resolving MODur00064 Corrected handling of bad ephemeris attitude data
void * create_viterbi27(int len)
void delete_viterbi27(void *vp)