[MN-dev] [mndiff]: r76 - in trunk/noe: . Makefile galois.c galois.h noe_internal.h rs.c rs.h test.c
michael
subversion at mplayerhq.hu
Tue Jul 10 00:04:24 CEST 2007
Author: michael
Date: Tue Jul 10 00:04:24 2007
New Revision: 76
Log:
forgotten code from 2002-11-21 11:33
Added:
trunk/noe/
trunk/noe/Makefile
trunk/noe/galois.c
trunk/noe/galois.h
trunk/noe/noe_internal.h
trunk/noe/rs.c
trunk/noe/rs.h
trunk/noe/test.c
Added: trunk/noe/Makefile
==============================================================================
--- (empty file)
+++ trunk/noe/Makefile Tue Jul 10 00:04:24 2007
@@ -0,0 +1,20 @@
+OBJS = test.o galois.o rs.o
+SRCS = $(OBJS:.o=.c) $(ASM_OBJS:.o=.s)
+
+CFLAGS = -g -Wall -O4 $(OPTFLAGS) -I. $(EXTRA_INC)
+
+%.o: %.c
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+all: test
+
+test: $(OBJS)
+ $(CC) $(LDFLAGS) -o $@ $(OBJS)
+
+clean:
+ rm -f *.o *.a *~
+
+dep: depend
+
+depend:
+ $(CC) -MM $(CFLAGS) $(SRCS) 1>.depend
Added: trunk/noe/galois.c
==============================================================================
--- (empty file)
+++ trunk/noe/galois.c Tue Jul 10 00:04:24 2007
@@ -0,0 +1,166 @@
+/*
+ * Copyright (C) 2002 Michael Niedermayer <michaelni at gmx.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <inttypes.h>
+#include <assert.h>
+#include <stdio.h>
+
+#include "noe_internal.h"
+#include "galois.h"
+
+GF2h16Element noe_exp[65536];
+GF2h16Element noe_log[65536];
+uint32_t noe_mod[256];
+
+void noe_init(){
+ GF2h16Element ge= 1;
+ int i;
+
+ for(i=0; i<256; i++){
+ noe_mod[i]= gf2poly_mod(i<<16, PRIMITIVE_POLYNOM);
+ noe_mod[i]^= i<<16;
+ }
+
+ for(i=0; i<SIZE; i++){
+ noe_exp[i]= ge;
+ noe_log[ge]= i;
+ ge= gf2poly_mod(ge+ge, PRIMITIVE_POLYNOM);
+ }
+
+ noe_log[0]= 0xFFFF;
+ noe_log[1]= 0;
+}
+
+//int zech_log(GaloisField gf, GF2Polynom b){
+//}
+
+void noe_gfft(GF2h16Element *src, GF2h16Element *dst){
+
+}
+
+int noe_prodPoly(GF2h16Element *dst, GF2h16Element *src1, GF2h16Element *src2, int order1, int order2){
+ int order= order1 + order2;
+ int i;
+
+ for(i=order; i>=0; i--){
+ int acc=0;
+ int j, end;
+
+ j = NOE_MAX(0, i - order2);
+ end= NOE_MIN(i, order1);
+
+ for(; j<=end; j++){
+ acc^= prod(src1[j], src2[i-j]);
+ }
+ dst[i]= acc;
+ }
+
+ return order;
+}
+
+/**
+ * returns the first order2 coefficients of the product of the 2 polynoms.
+ */
+int noe_partialProdPoly(GF2h16Element *dst, GF2h16Element *src1, GF2h16Element *src2, int order1, int order2){
+ const int order= order2;
+ int i;
+
+ for(i=order; i>=0; i--){
+ int acc=0;
+ int j, end;
+
+ j = NOE_MAX(0, i - order2);
+ end= NOE_MIN(i, order1);
+
+ for(; j<=end; j++){
+ acc^= prod(src1[j], src2[i-j]);
+ }
+ dst[i]= acc;
+ }
+
+ return order;
+}
+
+void noe_printPoly(GF2h16Element *src, int order){
+ int i;
+
+ for(i=order; i>=0; i--){
+ printf(" + %X*x^%d", src[i], i);
+ }
+ printf("\n");
+}
+
+/**
+ * Evaluates the src polynom at x.
+ */
+GF2h16Element noe_evalPoly(GF2h16Element *src, int order, GF2h16Element x){
+ int acc=0;
+ int j;
+
+ for(j=order; j>=0; j--){
+ acc = prod(acc, x) ^ src[j];
+ }
+
+ return acc;
+}
+
+void noe_getDerivative(GF2h16Element *dst, GF2h16Element *src, int order){
+ int i;
+
+ for(i=0; i<order-1; i+=2){
+ dst[i ]= src[i+1];
+ dst[i+1]= 0;
+ }
+ if(i<order)
+ dst[i ]= src[i+1];
+}
+
+static inline int rev(int x){
+ x = (((x & 0xaaaa) >> 1) | ((x & 0x5555) << 1));
+ x = (((x & 0xcccc) >> 2) | ((x & 0x3333) << 2));
+ x = (((x & 0xf0f0) >> 4) | ((x & 0x0f0f) << 4));
+ x = (( x >> 8) | ((x & 0x00ff) << 8));
+ return(x);
+}
+
+void noe_gfft_dit2(GF2h16Element *dst, GF2h16Element *src){
+ int i, j, pass;
+
+ for(i=0; i<SIZE; i++){
+ dst[i]= src[rev(i)];
+ }
+
+ for(pass=0; pass<EXPONENT; pass++){
+ int block;
+ const int np= 1<<pass;
+ const int blockCount= 1<<(EXPONENT-pass-1);
+
+ for(block=0; block<blockCount; block++){
+ int n;
+ const int top= block*np<<1;
+ const int bot= top + np;
+
+ for(n=0; n<np; n++){
+ int a= dst[top + n];
+ int b= dst[bot + n];
+
+ dst[top + n]= a^b;
+ }
+ }
+ }
+}
Added: trunk/noe/galois.h
==============================================================================
--- (empty file)
+++ trunk/noe/galois.h Tue Jul 10 00:04:24 2007
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 2002 Michael Niedermayer <michaelni at gmx.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#define PRIMITIVE_ELEMENT 2
+#define PRIMITIVE_POLYNOM 0x0001002D
+#define EXPONENT 16
+#define SIZE (1<<EXPONENT)
+
+typedef uint16_t GF2h16Element;
+
+typedef uint32_t GF2Polynom;
+
+extern GF2h16Element noe_exp[65536];
+extern GF2h16Element noe_log[65536];
+extern uint32_t noe_mod[256];
+
+int noe_prodPoly(GF2h16Element *dst, GF2h16Element *src1, GF2h16Element *src2, int order1, int order2);
+int noe_partialProdPoly(GF2h16Element *dst, GF2h16Element *src1, GF2h16Element *src2, int order1, int order2);
+void noe_init();
+void noe_printPoly(GF2h16Element *src, int order);
+void noe_getDerivative(GF2h16Element *dst, GF2h16Element *src, int order);
+GF2h16Element noe_evalPoly(GF2h16Element *src, int order, GF2h16Element x);
+
+
+static inline GF2Polynom gf2poly_prod(GF2Polynom a, GF2Polynom b){
+ int i;
+ unsigned int ret=0;
+#if 0
+ if(a&1) ret^=b;
+ b+=b;
+ if(a&2) ret^=b;
+ b+=b;
+ if(a&4) ret^=b;
+ b+=b;
+ if(a&8) ret^=b;
+ b+=b;
+ if(a&16) ret^=b;
+ b+=b;
+ if(a&32) ret^=b;
+ b+=b;
+ if(a&64) ret^=b;
+ b+=b;
+ if(a&128) ret^=b;
+ b+=b;
+ if(a&256) ret^=b;
+ b+=b;
+ if(a&512) ret^=b;
+ b+=b;
+ if(a&1024) ret^=b;
+ b+=b;
+ if(a&2048) ret^=b;
+ b+=b;
+ if(a&4096) ret^=b;
+ b+=b;
+ if(a&8192) ret^=b;
+ b+=b;
+ if(a&16384) ret^=b;
+ b+=b;
+ if(a&32768) ret^=b;
+ return ret;
+#elif 1
+ unsigned int tmp[4];
+ tmp[0]= 0;
+ tmp[1]= b;
+ tmp[2]= b + b;
+ tmp[3]= (b + b) ^ b;
+
+ ret ^= tmp[a&3] ; a>>=2;
+ ret ^= tmp[a&3]<<2 ; a>>=2;
+ ret ^= tmp[a&3]<<4 ; a>>=2;
+ ret ^= tmp[a&3]<<6 ; a>>=2;
+ ret ^= tmp[a&3]<<8 ; a>>=2;
+ ret ^= tmp[a&3]<<10; a>>=2;
+ ret ^= tmp[a&3]<<12; a>>=2;
+ ret ^= tmp[a&3]<<14;
+ return ret;
+#else
+ if(a==0 || b==0) return 0;
+ ret= noe_log[a] + noe_log[b];
+ if(ret >= 0xFFFF) ret-= 0xFFFF;
+ return noe_exp[ret];
+#endif
+}
+
+static inline GF2Polynom gf2poly_mod(GF2Polynom a, GF2Polynom b){
+ int i;
+
+ b<<= EXPONENT - 1;
+
+ for(i=0; i<EXPONENT; i++){
+ if((a^b) < a) a^=b;
+ b>>=1;
+ }
+
+ return a;
+}
+
+static inline GF2Polynom gf2poly_mod_m(GF2Polynom a){
+ a ^= noe_mod[a>>24]<<8;
+ a ^= noe_mod[a>>16];
+
+ return a;
+}
+
+static inline GF2h16Element prod(GF2h16Element a, GF2h16Element b){
+ return gf2poly_mod_m(gf2poly_prod(a, b));
+}
+
+static inline GF2h16Element inv(GF2h16Element a){
+ assert(a!=0);
+
+ return noe_exp[(1<<EXPONENT) - 1 - noe_log[a]];
+}
Added: trunk/noe/noe_internal.h
==============================================================================
--- (empty file)
+++ trunk/noe/noe_internal.h Tue Jul 10 00:04:24 2007
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2002 Michael Niedermayer <michaelni at gmx.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#define NOE_MAX(a,b) ((a) > (b) ? (a) : (b))
+#define NOE_MIN(a,b) ((a) > (b) ? (b) : (a))
Added: trunk/noe/rs.c
==============================================================================
--- (empty file)
+++ trunk/noe/rs.c Tue Jul 10 00:04:24 2007
@@ -0,0 +1,149 @@
+/*
+ * Copyright (C) 2002 Michael Niedermayer <michaelni at gmx.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <inttypes.h>
+#include <assert.h>
+#include <malloc.h>
+
+#include "noe_internal.h"
+#include "galois.h"
+#include "rs.h"
+
+/**
+ *
+ */
+void noe_getRsGenerator(GF2h16Element *dst, int first, int order){
+ GF2h16Element factor[2];
+ int i;
+
+ dst[0]= 1;
+
+ factor[0]= noe_exp[first];
+ factor[1]= 1;
+
+ for(i=0; i<order; i++){
+ int j;
+
+ noe_prodPoly(dst, dst, factor, i, 1);
+ factor[0]= prod(factor[0], PRIMITIVE_ELEMENT);
+ }
+}
+
+void noe_getSyndrom(GF2h16Element *syn, GF2h16Element *src, int first, int order){
+ int i;
+ //FIXME use GFFT if order is large
+
+ syn[0]= 1;
+
+ for(i=0; i<order; i++){
+ syn[i+1]= noe_evalPoly(src, (1<<EXPONENT)-2, noe_exp[first + i]);
+ }
+}
+#if 1
+noe_RsEncoder *noe_getRsEncoder(int parityCount){
+ const int dataCount= (1<<EXPONENT) - parityCount - 1;
+ int i;
+ GF2h16Element *locator, *factor;
+ GF2h16Element locatorDerivative[parityCount];
+ noe_RsEncoder *encoder= memalign(16, sizeof(noe_RsEncoder));
+
+ locator= encoder->parityLocator= memalign(16, sizeof(GF2h16Element)*(parityCount+1));
+ factor= encoder->parityFactor = memalign(16, sizeof(GF2h16Element)* parityCount );
+
+ encoder->parityCount= parityCount;
+
+ locator[0]= 1;
+ for(i=0; i<parityCount; i++){
+ GF2h16Element locationFactor[2];
+
+ locationFactor[0] = 1;
+ locationFactor[1] = noe_exp[dataCount + i];
+ noe_prodPoly(locator, locator, locationFactor, i, 1);
+ }
+#if 0
+for(i=0; i<parityCount; i++){
+ if(noe_evalPoly(locator, parityCount, inv(noe_exp[dataCount + i]))){
+ printf("Internal Error 1\n");
+ }
+}
+if(!noe_evalPoly(locator, parityCount, inv(noe_exp[dataCount - 1])))
+ printf("Internal Error 2\n");
+#endif
+ noe_getDerivative(locatorDerivative, locator, parityCount);
+
+ for(i=0; i<parityCount; i++){
+ GF2h16Element X= noe_exp[dataCount + i];
+ GF2h16Element invX= noe_exp[(1<<EXPONENT) - dataCount - i - 1];
+ GF2h16Element denom;
+
+ assert(X == inv(invX));
+
+ denom= noe_evalPoly(locatorDerivative, parityCount-1, invX);
+ factor[i]= prod(X, inv(denom));
+ }
+
+ return encoder;
+}
+
+void noe_freeRsEncoder(noe_RsEncoder *encoder){
+ if(!encoder) return;
+
+ if(encoder->parityLocator) free(encoder->parityLocator);
+ encoder->parityLocator= NULL;
+
+ if(encoder->parityFactor) free(encoder->parityFactor);
+ encoder->parityFactor= NULL;
+
+ free(encoder);
+}
+
+/**
+ *
+ */
+void noe_rsEncode(noe_RsEncoder *encoder, GF2h16Element *data){
+ int i;
+ const int parityCount= encoder->parityCount;
+ const int dataCount= (1<<EXPONENT) - parityCount - 1;
+ GF2h16Element syn[parityCount+1];
+ GF2h16Element omega[2*parityCount+1];
+ GF2h16Element *locator= encoder->parityLocator;
+ GF2h16Element *factor= encoder->parityFactor;
+
+ memset(data + dataCount, 0, parityCount*sizeof(GF2h16Element));
+
+ noe_getSyndrom(syn, data, 1, parityCount);
+
+ if(parityCount < 1000 || 1){
+ noe_partialProdPoly(omega, locator, syn, parityCount, parityCount);
+
+ for(i=0; i<parityCount; i++){
+ GF2h16Element invX= noe_exp[(1<<EXPONENT) - dataCount - i - 1];
+
+ GF2h16Element parity= prod(noe_evalPoly(omega, parityCount, invX), factor[i]);
+
+ data[dataCount + i]= parity;
+ }
+ }else{
+ //FIXME freq domain encoding
+ }
+
+}
+#endif
+
+
+
Added: trunk/noe/rs.h
==============================================================================
--- (empty file)
+++ trunk/noe/rs.h Tue Jul 10 00:04:24 2007
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2002 Michael Niedermayer <michaelni at gmx.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+typedef struct noe_RsEncoder{
+ int parityCount;
+ GF2h16Element *parityLocator;
+ GF2h16Element *parityFactor;
+}noe_RsEncoder;
+
+void noe_getRsGenerator(GF2h16Element *dst, int first, int order);
+
+/**
+ * gets the syndroms.
+ * @param src a 2^16 entry long polynom
+ * @param syn the syndrom polynom will be stored here
+ */
+void noe_getSyndrom(GF2h16Element *syn, GF2h16Element *src, int first, int order);
+noe_RsEncoder *noe_getRsEncoder(int parityOrder);
+void noe_freeRsEncoder(noe_RsEncoder *encoder);
+
+/**
+ *
+ */
+void noe_rsEncode(noe_RsEncoder *encoder, GF2h16Element *data);
Added: trunk/noe/test.c
==============================================================================
--- (empty file)
+++ trunk/noe/test.c Tue Jul 10 00:04:24 2007
@@ -0,0 +1,171 @@
+/*
+ * Copyright (C) 2002 Michael Niedermayer <michaelni at gmx.at>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <inttypes.h>
+#include <assert.h>
+#include <stdio.h>
+#include <time.h>
+#include <stdlib.h>
+
+#include "noe_internal.h"
+#include "galois.h"
+#include "rs.h"
+
+main(){
+ int i, j;
+ GF2Polynom bp=1;
+
+ noe_init();
+
+ printf("Testing GF(2^%d)\n", EXPONENT);
+ for(i=0; i<(1<<EXPONENT)-1; i++){
+ if((bp==1 || bp==0) && i>0){
+ printf("FAIL\n");
+ break;
+ }
+ bp= prod(bp, PRIMITIVE_ELEMENT);
+ }
+ if(bp!=1) printf("FAILED to reach 1\n");
+
+ printf("Testing inverse\n");
+ bp=1;
+ for(i=1; i<(1<<EXPONENT); i++){
+ if(prod(bp, inv(bp)) != 1){
+ printf("FAIL %X %X\n", (int)bp, (int)inv(bp));
+ break;
+ }
+ bp= prod(bp, PRIMITIVE_ELEMENT);
+ }
+
+ srand (time (0));
+
+ printf("Testing generator polynoms");
+ for(i=1; i<20; i++){
+ int n= (1<<EXPONENT) - 1;
+ int k= (1<<EXPONENT) - 1 - i;
+ GF2h16Element syn[i+1];
+ GF2h16Element gen[i+1];
+ GF2h16Element data[k];
+ GF2h16Element code[n];
+
+ for(j=0; j<k; j++)
+ data[j]= rand() & 0xFFFF;
+
+ noe_getRsGenerator(gen, 1, i);
+ j=noe_prodPoly(code, gen, data, i, k-1);
+ assert(j==n-1);
+
+ noe_getSyndrom(syn, code, 1, i);
+
+// noe_printPoly(gen, i);
+// noe_printPoly(syn, i-1);
+
+ for(j=0; j<i; j++){
+ if(syn[j+1]) printf("FAIL generator:%d coefficient:%d\n", i, j);
+ }
+ printf("."); fflush(stdout);
+ }
+
+ printf("\nTesting encoder");
+ for(i=1; i<50; i+=10){
+ int n= (1<<EXPONENT) - 1;
+ int k= (1<<EXPONENT) - 1 - i;
+ GF2h16Element syn[i+1];
+ GF2h16Element gen[i+1];
+ GF2h16Element data[k];
+ GF2h16Element code[n];
+ noe_RsEncoder *encoder;
+ int pass=5;
+
+ encoder= noe_getRsEncoder(i);
+
+ for(pass=5; pass; pass--){
+ for(j=0; j<k; j++)
+ data[j]= rand() & 0xFFFF;
+
+ memcpy(code, data, n*sizeof(GF2h16Element));
+
+ noe_rsEncode(encoder, code);
+
+ noe_getSyndrom(syn, code, 1, i);
+ //FIXME check that code contains data, but its not touched so ...
+
+ // noe_printPoly(gen, i);
+ // noe_printPoly(syn, i-1);
+
+ for(j=0; j<i; j++){
+ if(syn[j+1]) printf("FAIL generator:%d coefficient:%d is %X\n", i, j, syn[j+1]);
+ }
+ printf("."); fflush(stdout);
+ }
+ noe_freeRsEncoder(encoder);
+ }
+
+return 0;
+
+ printf("Testing erasure decoding\n");
+ for(i=1; i<20; i++){
+ int n= (1<<EXPONENT) - 1;
+ int k= (1<<EXPONENT) - 1 - i;
+ GF2h16Element syn[i+1];
+ GF2h16Element gen[i+1];
+ GF2h16Element data[k];
+ GF2h16Element code[n];
+ GF2h16Element locator[i+1];
+ GF2h16Element omega[2*i];
+
+ int locatorOrder=0;
+
+ for(j=0; j<k; j++)
+ data[j]= rand() & 0xFFFF;
+
+ noe_getRsGenerator(gen, 1, i);
+ j=noe_prodPoly(code, gen, data, i, k);
+ assert(j==n);
+
+ locator[0] = 1;
+ for(j=0; j<i; j++){
+ int index;
+ GF2h16Element locationFactor[2];
+
+ if((rand()&7)==0 && j) continue;
+
+ index= rand()%0xFFFF;
+ locationFactor[0] = 1;
+ locationFactor[1] = inv(noe_exp[index]);
+ locatorOrder= noe_prodPoly(locator, locator, locationFactor, j, 1);
+
+ code[index] += rand()&0xFFFF;
+ }
+
+ syn[0] ^= 1;
+
+ noe_getSyndrom(syn, code, 1, i);
+ noe_prodPoly(omega, syn, locator, i-1, locatorOrder);
+// noe_getDeriative(locator, locator, locatorOrder);
+
+
+// noe_printPoly(gen, i);
+// noe_printPoly(syn, i-1);
+
+ for(j=0; j<i; j++){
+ if(syn[j]) printf("FAIL generator:%d coefficient:%d\n", i, j);
+ }
+ }
+ return 0;
+}
More information about the Mndiff-dev
mailing list