|
|
@ -80,12 +80,18 @@ int minio_init_decoder (int32_t *error_index, |
|
|
|
unsigned char **decode_tbls, |
|
|
|
unsigned char **decode_tbls, |
|
|
|
uint32_t **decode_index) |
|
|
|
uint32_t **decode_index) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int i, j, r, s, l, z; |
|
|
|
int i, j, r, l; |
|
|
|
unsigned char input_matrix[k * n]; |
|
|
|
|
|
|
|
unsigned char inverse_matrix[k * n]; |
|
|
|
uint32_t *tmp_decode_index = (uint32_t *) malloc(sizeof(uint32_t) * k); |
|
|
|
unsigned char tmp_decode_matrix[k * n]; |
|
|
|
unsigned char *input_matrix; |
|
|
|
unsigned char tmp_decode_tbls[k * n * 32]; |
|
|
|
unsigned char *inverse_matrix; |
|
|
|
uint32_t tmp_decode_index[k]; |
|
|
|
unsigned char *tmp_decode_matrix; |
|
|
|
|
|
|
|
unsigned char *tmp_decode_tbls; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
input_matrix = (unsigned char *) malloc(sizeof(unsigned char) * k * n); |
|
|
|
|
|
|
|
inverse_matrix = (unsigned char *) malloc(sizeof(unsigned char) * k * n); |
|
|
|
|
|
|
|
tmp_decode_matrix = (unsigned char *) malloc(sizeof(unsigned char) * k * n);; |
|
|
|
|
|
|
|
tmp_decode_tbls = (unsigned char *) malloc(sizeof(unsigned char) * k * n * 32); |
|
|
|
|
|
|
|
|
|
|
|
for (i = 0, r = 0; i < k; i++, r++) { |
|
|
|
for (i = 0, r = 0; i < k; i++, r++) { |
|
|
|
while (_minio_src_index_in_error(r, error_index, errs)) |
|
|
|
while (_minio_src_index_in_error(r, error_index, errs)) |
|
|
@ -98,6 +104,9 @@ int minio_init_decoder (int32_t *error_index, |
|
|
|
|
|
|
|
|
|
|
|
// Not all vandermonde matrix can be inverted
|
|
|
|
// Not all vandermonde matrix can be inverted
|
|
|
|
if (gf_invert_matrix(input_matrix, inverse_matrix, k) < 0) { |
|
|
|
if (gf_invert_matrix(input_matrix, inverse_matrix, k) < 0) { |
|
|
|
|
|
|
|
free(tmp_decode_matrix); |
|
|
|
|
|
|
|
free(tmp_decode_tbls); |
|
|
|
|
|
|
|
free(tmp_decode_index); |
|
|
|
return -1; |
|
|
|
return -1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -110,10 +119,9 @@ int minio_init_decoder (int32_t *error_index, |
|
|
|
error_index[l] + j]; |
|
|
|
error_index[l] + j]; |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
int s = 0; |
|
|
|
|
|
|
|
// decoding matrix element for coding chunks
|
|
|
|
// decoding matrix element for coding chunks
|
|
|
|
for (i = 0; i < k; i++) { |
|
|
|
for (i = 0; i < k; i++) { |
|
|
|
s = 0; |
|
|
|
unsigned char s = 0; |
|
|
|
for (j = 0; j < k; j++) { |
|
|
|
for (j = 0; j < k; j++) { |
|
|
|
s ^= gf_mul(inverse_matrix[j * k + i], |
|
|
|
s ^= gf_mul(inverse_matrix[j * k + i], |
|
|
|
encode_matrix[k * |
|
|
|
encode_matrix[k * |
|
|
|