Main Page | Class List | File List | Class Members | File Members

golay.h

Go to the documentation of this file.
00001 /*
00002  * golay.h
00003  *
00004  * functions for (23,12) golay encoding/decoding
00005  */
00006 
00007 long arr2int(int *, int);
00008 /*
00009  * Convert a binary vector of Hamming weight r, and nonzero positions in
00010  * array a[1]...a[r], to a long integer \sum_{i=1}^r 2^{a[i]-1}.
00011  */
00012 
00013 void nextcomb(int,int,int*);
00014 /*
00015  * Calculate next r-combination of an n-set.
00016  */
00017 
00018 long get_syndrome(long);
00019 /*
00020  * Compute the syndrome corresponding to the given pattern, i.e., the
00021  * remainder after dividing the pattern (when considering it as the vector
00022  * representation of a polynomial) by the generator polynomial, GENPOL.
00023  * In the program this pattern has several meanings: (1) pattern = infomation
00024  * bits, when constructing the encoding table; (2) pattern = error pattern,
00025  * when constructing the decoding table; and (3) pattern = received vector, to
00026  * obtain its syndrome in decoding.
00027  */
00028 
00029 void gen_enc_table(void);
00030    /*
00031     * ---------------------------------------------------------------------
00032     *                  Generate ENCODING TABLE
00033     *
00034     * An entry to the table is an information vector, a 32-bit integer,
00035     * whose 12 least significant positions are the information bits. The
00036     * resulting value is a codeword in the (23,12,7) Golay code: A 32-bit
00037     * integer whose 23 least significant bits are coded bits: Of these, the
00038     * 12 most significant bits are information bits and the 11 least
00039     * significant bits are redundant bits (systematic encoding).
00040     * --------------------------------------------------------------------- 
00041     */
00042 
00043 void gen_dec_table(void);
00044    /*
00045     * ---------------------------------------------------------------------
00046     *                  Generate DECODING TABLE
00047     *
00048     * An entry to the decoding table is a syndrome and the resulting value
00049     * is the most likely error pattern. First an error pattern is generated.
00050     * Then its syndrome is calculated and used as a pointer to the table
00051     * where the error pattern value is stored.
00052     * --------------------------------------------------------------------- 
00053     *            
00054     */
00055 
00056 long encode_golay(long data);
00057 {
00058 /*
00059  * encodes data and returns the codeword.  
00060  * data is assumed to contain 12 bits in the least significant bit positions
00061  * codeword contains the 23 bits in the LSB positions
00062  * 
00063  */
00064 
00065 long decode_golay(long codeword);
00066 {
00067 /*
00068  * decodes codeword and returns the dataword contained within.  
00069  * 
00070  * note: no detection is done here!
00071  * codeword is assumed to contain the 23 bits in the LSB positions
00072  * the returned bits contain the bits in the LSB positions
00073  */
00074 

Generated on Sun Jul 16 16:27:45 2006 by  doxygen 1.3.9.1