Exemplo n.º 1
0
/* given Psi (called Lambda in Modified_Berlekamp_Massey) and synBytes,
   compute the combined erasure/error evaluator polynomial as
   Psi*S mod z^4
  */
void
compute_modified_omega ()
{
	int i;
	int product[MAXDEG*2];

	mult_polys(product, Lambda, synBytes);
	zero_poly(Omega);
	for(i = 0; i < NPAR; i++) Omega[i] = product[i];

}
Exemplo n.º 2
0
void CReedSolomon::compute_modified_omega () {

	int product [MAX_LENGTH * 2];
	
	mult_polys (product, m_Lambda, m_synBytes);	
	for (int i = 0; i < MAX_LENGTH; i ++) {
		m_Omega [i] = 0;
	}
	for(int i = 0; i < m_iCorrectCodeSize; i ++) {
		m_Omega [i] = product [i];
	}
}
Exemplo n.º 3
0
Arquivo: rs.c Projeto: WTHsieh/diag
static void
compute_genpoly (int nbytes, unsigned short genpoly[])
{
  unsigned short i, tp[256], tp1[256];

  zero_poly(tp1);
  tp1[0] = 1;

  for (i = 1; i <= nbytes; i++) {
    zero_poly(tp);
    tp[0] = gexp[i];		/* set up x+a^n */
    tp[1] = 1;
	  
    mult_polys(genpoly, tp, tp1);
    copy_poly(tp1, genpoly);
  }
}
Exemplo n.º 4
0
static void
compute_genpoly (int nbytes, int genpoly[])
{
	int i, tp[256], tp1[256];

	/* multiply (x + a^n) for n = 1 to nbytes */

	zero_poly(tp1);
	tp1[0] = 1;

	for (i = 1; i <= nbytes; i++) {
		zero_poly(tp);
		tp[0] = gexp[i];        /* set up x+a^n */
		tp[1] = 1;

		mult_polys(genpoly, tp, tp1);
		copy_poly(tp1, genpoly);
	}
}
Exemplo n.º 5
0
void CReedSolomon::compute_genpoly (int nbytes, int genpoly []) {

	int tp [MAX_LENGTH];
	int tp1 [MAX_LENGTH];

	/* multiply (x + a^n) for n = 1 to nbytes */
	for (int i = 0; i < MAX_LENGTH; i ++) {
		tp1 [i] = 0;
	}
	tp1 [0] = 1;

	for (int i = 1; i <= nbytes; i++) {
		for (int j = 0; j < MAX_LENGTH; j ++) {
			tp [j] = 0;
		}
		tp [0] = byExpToInt [i];		/* set up x+a^n */
		tp [1] = 1;
		mult_polys (genpoly, tp, tp1);
		for (int j = 0; j < MAX_LENGTH; j ++) {
			tp1 [j] = genpoly [j];
		}
	}
}
Exemplo n.º 6
0
// Create a generator polynomial for an n byte RS code. 
void init_genpoly_cache(int par)
{
	int i;
	unsigned char tp[256], tp1[256];
	int tmp;

	unsigned char *genpoly = genpoly_cache[par-1];

	//multiply (x + a^n) for n = 1 to nbytes

	zero_poly(tp1, par*2);
	tp1[0] = 1;

	for (i = 1; i <= par; i++) 
	{
		zero_poly(tp, par*2);
		tp[0] = gexp[i];		// set up x+a^n
		tp[1] = 1;

		mult_polys(genpoly, tp, tp1, par*2);
		copy_poly(tp1, genpoly, par*2);
	}

	for(i=0; i<par/2; i++)
	{
		tmp = genpoly[i] ;
		genpoly[i] = genpoly[par-1-i];
		genpoly[par-1-i]=tmp;
	}

	for(i=0; i<256; i++)
	{
		for(int j=0; j<23; j++)
			genpoly_23_mult_cache[i][j] = gmult(i, genpoly_cache[22][j]);
		genpoly_23_mult_cache[i][23] = 0;
	}
}