FEC.hpp
Go to the documentation of this file.
00001 #if !defined(FEC_C_H_INCLUDED)
00002 #define FEC_C_H_INCLUDED 1
00003 
00004 /*
00005     Copyright (C) 2010, Michael P. Thompson
00006 
00007     This program is free software; you can redistribute it and/or modify
00008     it under the terms of the GNU General Public License Version 2 as 
00009     specified in the README.txt file or as published by the Free Software 
00010     Foundation.
00011 
00012     This program is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015     GNU General Public License for more details.
00016 
00017     You should have received a copy of the GNU General Public License along
00018     with this program; if not, write to the Free Software Foundation, Inc.,
00019     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00020 
00021     $Id: rvFec.h 28 2010-03-09 23:49:39Z mike $
00022 */
00023 
00024 // Basic 8, 16, and 32 bit integer types.
00025 typedef char                rvInt8;
00026 typedef short               rvInt16;
00027 typedef unsigned char       rvUint8;
00028 typedef unsigned short      rvUint16;
00029 
00030 // A boolean type to match the C++ definition of "bool".
00031 
00032 
00033 // This defines the type used to store an element in the various
00034 // Galois Field tables.  Make sure this is something larger than
00035 // a rvUint8 if anything larger than GF(256) is used.
00036 typedef rvUint8 uintGF;
00037 
00038 // Forward error correcting types.
00039 typedef struct _rvFec rvFec;
00040 
00041 typedef struct _rvFec *FEC;
00042 
00043 // Forward error correcting structures.
00044 struct _rvFec
00045 {
00046     // Buffer properties.
00047     rvInt16 zeroSize;               // Zero padding portion of buffer.
00048     rvInt16 dataSize;               // Data portion of buffer.
00049     rvInt16 paritySize;         // Parity portion of buffer.
00050     rvInt16 blockSize;          // Data and parity portion of buffer.
00051 
00052     // Reed Solomon properties.
00053     rvInt16 mm;                 // The code symbol size in bits.
00054     rvInt16 nn;                 // The block size in symbols, which is always (2**mm - 1).
00055     rvInt16 kk;                 // The number of data symbols per block, kk < nn.
00056 
00057     // Reed Solomon tables.
00058     uintGF *gg;                 // Generator polynomial g(x)
00059     uintGF *alphaTo;            // Index to polynomial form conversion table.
00060     uintGF *indexOf;            // Polynomial to index form conversion table.
00061 };
00062 
00063 // Forward error correcting methods.
00064 rvFec* rvFec_New(rvInt16 symbolSize, rvInt16 dataSize, rvInt16 paritySize);
00065 rvInt16 rvFec_Parity(rvFec* self, rvUint8* dataBuffer, rvUint8* parityBuffer);
00066 rvInt16 rvFec_Correct(rvFec* self, rvUint8* blockBuffer);
00067 
00068 
00069 // External declarations:
00070 
00071 bool FEC__correct(FEC fec, unsigned int *data, unsigned int size);
00072 void FEC__parity(FEC fec, unsigned int *data, unsigned int size);
00073 FEC FEC__create(unsigned int symbol_size, unsigned int data_size, unsigned int parity_size);
00074 
00075 #endif // !defined(FEC_C_H_INCLUDED)


fiducial_lib
Author(s): Wayne Gramlich
autogenerated on Thu Jun 6 2019 18:08:04