enh: speedup RS03 repair (fixes #100)
This commit is contained in:
@@ -734,7 +734,8 @@ void RS03Fix(Image *image)
|
|||||||
if(num1 != 0)
|
if(num1 != 0)
|
||||||
{ int location = loc[j];
|
{ int location = loc[j];
|
||||||
|
|
||||||
if(erasure_map[location] != 1) /* erasure came from CRC error */
|
if((Closure->debugMode && Closure->verbose) || Closure->regtestMode)
|
||||||
|
{ if (erasure_map[location] != 1) /* erasure came from CRC error */
|
||||||
{ int old = fc->imgBlock[location][offset];
|
{ int old = fc->imgBlock[location][offset];
|
||||||
int new = old ^ gf_alpha_to[mod_fieldmax(gf_index_of[num1] + gf_index_of[num2] + GF_FIELDMAX - gf_index_of[den])];
|
int new = old ^ gf_alpha_to[mod_fieldmax(gf_index_of[num1] + gf_index_of[num2] + GF_FIELDMAX - gf_index_of[den])];
|
||||||
char *msg, *type;
|
char *msg, *type;
|
||||||
@@ -762,6 +763,14 @@ void RS03Fix(Image *image)
|
|||||||
old, canprint(old) ? old : '.',
|
old, canprint(old) ? old : '.',
|
||||||
new, canprint(new) ? new : '.');
|
new, canprint(new) ? new : '.');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else /* in non-debug mode, apply the only non-printf-preparing code of the above block */
|
||||||
|
{
|
||||||
|
if (erasure_map[location] == 0)
|
||||||
|
{ erasure_map[location] = 7;
|
||||||
|
error_count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fc->imgBlock[location][offset] ^= gf_alpha_to[mod_fieldmax(gf_index_of[num1] + gf_index_of[num2] + GF_FIELDMAX - gf_index_of[den])];
|
fc->imgBlock[location][offset] ^= gf_alpha_to[mod_fieldmax(gf_index_of[num1] + gf_index_of[num2] + GF_FIELDMAX - gf_index_of[den])];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user