OpenJPEG  1.5.1
Macros | Typedefs | Functions
rs.h File Reference

Functions used to compute Reed-Solomon parity and check of byte arrays. More...

Go to the source code of this file.

Macros

#define MM   8 /* RS code over GF(2**MM) - change to suit */
 Global definitions for Reed-Solomon encoder/decoder Phil Karn KA9Q, September 1996. More...
 
#define NN   ((1 << MM) - 1)
 
#define min(a, b)   (((a) < (b)) ? (a) : (b))
 Computes the minimum between two integers. More...
 

Typedefs

typedef unsigned char dtype
 

Functions

void init_rs (int)
 Initialization function. More...
 
void generate_gf (void)
 These two functions must be called in this order (e.g., by init_rs()) before any encoding/decoding. More...
 
void gen_poly (void)
 
int encode_rs (dtype data[], dtype bb[])
 Reed-Solomon encoding data[] is the input block, parity symbols are placed in bb[] bb[] may lie past the end of the data, e.g., for (255,223): encode_rs(&data[0],&data[223]);. More...
 
int eras_dec_rs (dtype data[], int eras_pos[], int no_eras)
 Reed-Solomon erasures-and-errors decoding The received block goes into data[], and a list of zero-origin erasure positions, if any, goes in eras_pos[] with a count in no_eras. More...
 

Detailed Description

Functions used to compute Reed-Solomon parity and check of byte arrays.

Macro Definition Documentation

#define min (   a,
 
)    (((a) < (b)) ? (a) : (b))

Computes the minimum between two integers.

Parameters
afirst integer to compare
bsecond integer to compare
Returns
returns the minimum integer between a and b

Referenced by eras_dec_rs(), int_clamp(), jpwl_epbs_add(), tcd_decode_tile(), and tcd_rateallocate().

#define MM   8 /* RS code over GF(2**MM) - change to suit */

Global definitions for Reed-Solomon encoder/decoder Phil Karn KA9Q, September 1996.

The parameters MM and KK specify the Reed-Solomon code parameters.

Set MM to be the size of each code symbol in bits. The Reed-Solomon block size will then be NN = 2**M - 1 symbols. Supported values are defined in rs.c.

Set KK to be the number of data symbols in each block, which must be less than the block size. The code will then be able to correct up to NN-KK erasures or (NN-KK)/2 errors, or combinations thereof with each error counting as two erasures.

Referenced by generate_gf(), and modnn().

#define NN   ((1 << MM) - 1)

Typedef Documentation

typedef unsigned char dtype

Function Documentation

int encode_rs ( dtype  data[],
dtype  bb[] 
)

Reed-Solomon encoding data[] is the input block, parity symbols are placed in bb[] bb[] may lie past the end of the data, e.g., for (255,223): encode_rs(&data[0],&data[223]);.

int eras_dec_rs ( dtype  data[],
int  eras_pos[],
int  no_eras 
)

Reed-Solomon erasures-and-errors decoding The received block goes into data[], and a list of zero-origin erasure positions, if any, goes in eras_pos[] with a count in no_eras.

The decoder corrects the symbols in place, if possible and returns the number of corrected symbols. If the codeword is illegal or uncorrectible, the data array is unchanged and -1 is returned

void gen_poly ( void  )

References Alpha_to, B0, Gg, Index_of, KK, modnn(), and NN.

Referenced by init_rs().

void generate_gf ( void  )

These two functions must be called in this order (e.g., by init_rs()) before any encoding/decoding.

References A0, Alpha_to, Index_of, MM, NN, and Pp.

Referenced by init_rs().

void init_rs ( int  )

Initialization function.

References gen_poly(), generate_gf(), KK, and NN.

Referenced by jpwl_epb_correct(), and jpwl_epb_fill().