Go to the documentation of this file.
23 #define L_CODEWORD 255
25 #define L_CODEBLOCK (I * L_CODEWORD)
26 #define FRAME_SIZE (I * L_SYMBOL)
27 #define SYMBOLS_NO_CONV (L_ASM + L_CODEBLOCK)
28 #define MAX_SYMBOLS ( 2 * (L_ASM + L_CODEBLOCK + 1))
33 #define V_FRAMEBITS (8 * SYMBOLS_NO_CONV)
35 #define VERSION "1.00"
43 printf(
"0x%02hhx", *(
data++));
62 printf(
"%02hhx", *(
data++));
76 void prng(
unsigned char* lfsr,
unsigned char* o) {
77 unsigned char rnd = 0U;
78 unsigned char bit = 0U;
80 for (
i = 0;
i < 8;
i++) {
81 rnd = (rnd << 1) | (*lfsr & 0x1U);
82 bit = (((*lfsr >> 3) ^ *lfsr) ^ (*lfsr >> 5)) ^ (*lfsr >>7);
83 *lfsr = (*lfsr >> 1) | (bit << 7);
97 symbols[
i ] = ((coded[
i/8] << (
i % 8)) & 0x80) > 0 ? 255 : 0;
113 printf(
"\nTest decoded for Outernet\n");
114 printf(
"\nDecode Channel Access Data Units encoded via propsed use of");
115 printf(
"\nCCSDS TM Sync and Channel Coding standard\n\n");
116 printf(
"Use: %s [options]\n", progname);
117 printf(
" c Indicates that CADU has been convolutionally coded\n");
118 printf(
" A Viterbi decoder will be used\n");
120 printf(
" Decoded frame\n");
122 printf(
" Errors from the Reed-Solomon decode are detected but not\n");
123 printf(
" corrected.\n");
129 unsigned char sync[] = {0x1A, 0xCF, 0xFC, 0x1D};
135 unsigned char lfsr = 0xFFU;
150 printf(
"outernetDecode %s (%s %s)\n",
VERSION, __DATE__, __TIME__);
153 printf(
"\nouternetDecode input_downlink_filename output_telemetry_filename\n");
158 while ((d = getopt(
argc, argv,
"cv")) != EOF) {
177 in = fopen(argv[optind],
"r");
178 out = fopen(argv[optind+1],
"w");
181 while (fread(symbols,
sizeof(
char), caduSymbols, in) == caduSymbols) {
192 if(memcmp(sync, convdecoded,
L_ASM) != 0) {
193 fprintf(
stderr,
"ASM not found\n");
203 for (
i = 0;
i <
I;
i++) {
206 codeword[
j] = convdecoded[
L_ASM +
i +
j *
I];
217 if (rsErrCnt == -1) {
218 if (
verbose > 0) fprintf(
stderr,
"Uncorrectable errors in frame\n");
221 }
else if (rsErrCnt > 0 &
verbose > 0) {
223 fprintf(
stderr,
"%d errors in block\n", rsErrCnt);
225 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)