Added a few comments, fixed ortography and some other cosmetic changes.

This commit is contained in:
EdFuentetaja
2014-03-31 21:31:00 +08:00
parent 3f4ff87078
commit 9b35ef5c83
2 changed files with 17 additions and 10 deletions

View File

@@ -254,13 +254,13 @@ processFrame (dsd_opts * opts, dsd_state * state)
dibit = getDibit (opts, state);
v = 1 & (dibit >> 1); // bit 1
nac[j] = v + 48;
nac[j] = v + '0';
j++;
bch_code[index_bch_code] = v;
index_bch_code++;
v = 1 & dibit; // bit 0
nac[j] = v + 48;
nac[j] = v + '0';
j++;
bch_code[index_bch_code] = v;
index_bch_code++;
@@ -271,7 +271,7 @@ processFrame (dsd_opts * opts, dsd_state * state)
for (i = 0; i < 2; i++)
{
dibit = getDibit (opts, state);
duid[i] = dibit + 48;
duid[i] = dibit + '0';
bch_code[index_bch_code] = 1 & (dibit >> 1); // bit 1
index_bch_code++;
@@ -289,7 +289,9 @@ processFrame (dsd_opts * opts, dsd_state * state)
bch_code[index_bch_code] = 1 & dibit; // bit 0
index_bch_code++;
}
status_0 = getDibit (opts, state) + 48;
// Intermission: read the status dibit
status_0 = getDibit (opts, state) + '0';
// ... continue reading the BCH error correction data
for (i = 0; i < 20; i++)
{
dibit = getDibit (opts, state);
@@ -325,7 +327,7 @@ processFrame (dsd_opts * opts, dsd_state * state)
//printf("NID error\n");
duid[0] = 'E';
duid[1] = 'E';
state->debug_header_critical_errors ++;
state->debug_header_critical_errors++;
}
}
@@ -448,7 +450,7 @@ processFrame (dsd_opts * opts, dsd_state * state)
// Now processing NID
skipDibit (opts, state, 14); // 28 null bits
status_1 = getDibit (opts, state) + 48;
status_1 = getDibit (opts, state) + '0';
}
else if (strcmp (duid, "13") == 0)
{

View File

@@ -80,12 +80,12 @@ static void
correct_hex_word (dsd_state* state, char* hex, char* parity)
{
int fixed_errors;
int unrecoverable_errors;
int irrecoverable_errors;
unrecoverable_errors = check_and_fix_golay24(hex, parity, &fixed_errors);
irrecoverable_errors = check_and_fix_golay24(hex, parity, &fixed_errors);
state->debug_header_errors += fixed_errors;
if (unrecoverable_errors != 0)
if (irrecoverable_errors != 0)
{
state->debug_header_critical_errors++;
}
@@ -120,6 +120,7 @@ processHDU (dsd_opts * opts, dsd_state * state)
char parity[12];
int status_count;
int status;
int irrecoverable_errors;
char hex_data[20][6]; // Data in hex-words (6 bit words). A total of 20 hex words.
char hex_parity[16][6]; // Parity of the data, again in hex-word format. A total of 16 parity hex words.
@@ -150,7 +151,11 @@ processHDU (dsd_opts * opts, dsd_state * state)
}
// Use the Reed-Solomon algorithm to correct the data. hex_data is modified in place
check_and_fix_redsolomon63((char*)hex_data, (char*)hex_parity);
irrecoverable_errors = check_and_fix_redsolomon63((char*)hex_data, (char*)hex_parity);
if (irrecoverable_errors != 0)
{
state->debug_header_critical_errors++;
}
mi[72] = 0;
mfid[8] = 0;