libaaruformat
1.0
Aaru Data Preservation Suite - Format Library
Toggle main menu visibility
Loading...
Searching...
No Matches
reed_solomon.h
Go to the documentation of this file.
1
/*
2
* This file is part of the Aaru Data Preservation Suite.
3
* Copyright (c) 2019-2026 Natalia Portillo.
4
*
5
* This library is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU Lesser General Public License as
7
* published by the Free Software Foundation; either version 2.1 of the
8
* License, or (at your option) any later version.
9
*
10
* This library is distributed in the hope that it will be useful, but
11
* WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* Lesser General Public License for more details.
14
*
15
* You should have received a copy of the GNU Lesser General Public
16
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
#ifndef LIBAARUFORMAT_REED_SOLOMON_H
20
#define LIBAARUFORMAT_REED_SOLOMON_H
21
22
#include <stddef.h>
23
#include <stdint.h>
24
28
typedef
struct
rs_context
rs_context
;
29
43
rs_context
*
rs_create
(uint16_t
K
, uint16_t
M
);
44
49
void
rs_free
(
rs_context
*ctx);
50
62
uint8_t
rs_get_coefficient
(
const
rs_context
*ctx, uint16_t m, uint16_t k);
63
79
void
rs_encode_incremental
(uint8_t coeff,
const
uint8_t *data, uint8_t *parity,
size_t
shard_size);
80
94
int
rs_decode
(
const
rs_context
*ctx, uint8_t **shards,
const
uint8_t *present,
size_t
shard_size);
95
96
#endif
/* LIBAARUFORMAT_REED_SOLOMON_H */
rs_free
void rs_free(rs_context *ctx)
Free a Reed-Solomon codec context.
Definition
reed_solomon.c:201
rs_create
rs_context * rs_create(uint16_t K, uint16_t M)
Create a Reed-Solomon codec for RS(K, M) over GF(2^8).
Definition
reed_solomon.c:150
rs_encode_incremental
void rs_encode_incremental(uint8_t coeff, const uint8_t *data, uint8_t *parity, size_t shard_size)
Incrementally accumulate one data shard's contribution to one parity shard.
Definition
reed_solomon.c:213
rs_get_coefficient
uint8_t rs_get_coefficient(const rs_context *ctx, uint16_t m, uint16_t k)
Get the generator matrix coefficient for parity shard m, data shard k.
Definition
reed_solomon.c:208
rs_decode
int rs_decode(const rs_context *ctx, uint8_t **shards, const uint8_t *present, size_t shard_size)
Decode (reconstruct) erased shards.
Definition
reed_solomon.c:218
rs_context
Definition
reed_solomon.c:44
rs_context::K
uint16_t K
Number of data shards.
Definition
reed_solomon.c:45
rs_context::M
uint16_t M
Number of parity shards.
Definition
reed_solomon.c:46
src
lib
reed_solomon.h
Generated by
1.18.0