亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? rs.c

?? 一些糾錯編碼的c程序實現
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*             rs.c        */
/* This program is an encoder/decoder for Reed-Solomon codes. Encoding is in
   systematic form, decoding via the Berlekamp iterative algorithm.
   In the present form , the constants mm, nn, tt, and kk=nn-2tt must be
   specified  (the double letters are used simply to avoid clashes with
   other n,k,t used in other programs into which this was incorporated!)
   Also, the irreducible polynomial used to generate GF(2**mm) must also be
   entered -- these can be found in Lin and Costello, and also Clark and Cain.

   The representation of the elements of GF(2**m) is either in index form,
   where the number is the power of the primitive element alpha, which is
   convenient for multiplication (add the powers modulo 2**m-1) or in
   polynomial form, where the bits represent the coefficients of the
   polynomial representation of the number, which is the most convenient form
   for addition.  The two forms are swapped between via lookup tables.
   This leads to fairly messy looking expressions, but unfortunately, there
   is no easy alternative when working with Galois arithmetic.

   The code is not written in the most elegant way, but to the best
   of my knowledge, (no absolute guarantees!), it works.
   However, when including it into a simulation program, you may want to do
   some conversion of global variables (used here because I am lazy!) to
   local variables where appropriate, and passing parameters (eg array
   addresses) to the functions  may be a sensible move to reduce the number
   of global variables and thus decrease the chance of a bug being introduced.

   This program does not handle erasures at present, but should not be hard
   to adapt to do this, as it is just an adjustment to the Berlekamp-Massey
   algorithm. It also does not attempt to decode past the BCH bound -- see
   Blahut "Theory and practice of error control codes" for how to do this.

              Simon Rockliff, University of Adelaide   21/9/89

   26/6/91 Slight modifications to remove a compiler dependent bug which hadn't
           previously surfaced. A few extra comments added for clarity.
           Appears to all work fine, ready for posting to net!

                  Notice
                 --------
   This program may be freely modified and/or given to whoever wants it.
   A condition of such distribution is that the author's contribution be
   acknowledged by his name being left in the comments heading the program,
   however no responsibility is accepted for any financial or other loss which
   may result from some unforseen errors or malfunctioning of the program
   during use.
                                 Simon Rockliff, 26th June 1991
*/

#include <math.h>
#include <stdio.h>
//#define mm  4           /* RS code over GF(2**4) - change to suit */
//#define nn  15          /* nn=2**mm -1   length of codeword */
//#define tt  3           /* number of errors that can be corrected */
//#define kk  9           /* kk = nn-2*tt  */

//int pp [mm+1] = { 1, 1, 0, 0, 1} ; /* specify irreducible polynomial coeffts */
int pp[21];
int alpha_to [1048576], index_of [1048576], gg [1048576] ;
int recd [1048576], data [1048576], bb [1048576] ;
int m,n,t,k;


void enter_parameter()
/* enter parameters ,mm,tt,kk,nn*/
{
	int i;
	do {
	   printf("Enter m (between 2 and 20): ");
	   scanf("%d", &m);
    } while ( !(m>1) || !(m<21) );
    printf("\n");
    n = 1;
    for(i = 0; i < m; i++) 
    {
		n *= 2;
    }
    n -= 1;
	do {
	  printf("Enter t(number of errors you want to correct):");
	  scanf("%d",&t);
	}while (t > n);
	printf("\n");
	k = n - 2*t;
}



void generate_gf()
/* generate GF(2**mm) from the irreducible polynomial p(X) in pp[0]..pp[mm]
   lookup tables:  index->polynomial form   alpha_to[] contains j=alpha**i;
                   polynomial form -> index form  index_of[j=alpha**i] = i
   alpha=2 is the primitive element of GF(2**mm)
*/
 {
   register int i, mask ;

 //modify by mhzhang 06-07-08
 //change m of RS code
   /*do {
  printf("Enter m (between 2 and 20): ");
	   scanf("%d", &mm);
   } while ( !(m>1) || !(m<21) );
   printf("\n");
   nn = 1;
   for(i = 0; i < mm; i++) 
   {
		nn *= 2;
   }
   nn -= 1;*/
 //modify end
  mask = 1 ;
  alpha_to[mm] = 0 ;
  for (i=0; i<mm; i++)
   { alpha_to[i] = mask ;
     index_of[alpha_to[i]] = i ;
     if (pp[i]!=0)
       alpha_to[m] ^= mask ;
     mask <<= 1 ;
   }
  index_of[alpha_to[m]] = m ;
  mask >>= 1 ;
  for (i=m+1; i<n; i++)
   { if (alpha_to[i-1] >= mask)
        alpha_to[i] = alpha_to[m] ^ ((alpha_to[i-1]^mask)<<1) ;
     else alpha_to[i] = alpha_to[i-1]<<1 ;
     index_of[alpha_to[i]] = i ;
   }
  index_of[0] = -1 ;
  //modify 
  /*do {
	  printf("Enter t(number of errors you want to correct):");
	  scanf("%d",&t);
  }while (t < n);
  printf("\n");
  k = n - 2*t;*/
  //modify end
 }


void gen_poly()
/* Obtain the generator polynomial of the tt-error correcting, length
  nn=(2**mm -1) Reed Solomon code  from the product of (X+alpha**i), i=1..2*tt
*/
 {
   register int i,j ;

   gg[0] = 2 ;    /* primitive element alpha = 2  for GF(2**mm)  */
   gg[1] = 1 ;    /* g(x) = (X+alpha) initially */
   for (i=2; i<=n-k; i++)
    { gg[i] = 1 ;
      for (j=i-1; j>0; j--)
        if (gg[j] != 0)  gg[j] = gg[j-1]^ alpha_to[(index_of[gg[j]]+i)%n] ;
        else gg[j] = gg[j-1] ;
      gg[0] = alpha_to[(index_of[gg[0]]+i)%n] ;     /* gg[0] can never be zero */
    }
   /* convert gg[] to index form for quicker encoding */
   for (i=0; i<=n-k; i++)  gg[i] = index_of[gg[i]] ;
 }


void encode_rs()
/* take the string of symbols in data[i], i=0..(k-1) and encode systematically
   to produce 2*tt parity symbols in bb[0]..bb[2*tt-1]
   data[] is input and bb[] is output in polynomial form.
   Encoding is done by using a feedback shift register with appropriate
   connections specified by the elements of gg[], which was generated above.
   Codeword is   c(X) = data(X)*X**(nn-kk)+ b(X)          */
 {
   register int i,j ;
   int feedback ;

   for (i=0; i<n-k; i++)   bb[i] = 0 ;
   for (i=k-1; i>=0; i--)
    {  feedback = index_of[data[i]^bb[n-k-1]] ;
       if (feedback != -1)
        { for (j=n-k-1; j>0; j--)
            if (gg[j] != -1)
              bb[j] = bb[j-1]^alpha_to[(gg[j]+feedback)%n] ;
            else
              bb[j] = bb[j-1] ;
          bb[0] = alpha_to[(gg[0]+feedback)%n] ;
        }
       else
        { for (j=n-k-1; j>0; j--)
            bb[j] = bb[j-1] ;
          bb[0] = 0 ;
        } ;
    } ;
 } ;



void decode_rs()
/* assume we have received bits grouped into mm-bit symbols in recd[i],
   i=0..(nn-1),  and recd[i] is index form (ie as powers of alpha).
   We first compute the 2*tt syndromes by substituting alpha**i into rec(X) and
   evaluating, storing the syndromes in s[i], i=1..2tt (leave s[0] zero) .
   Then we use the Berlekamp iteration to find the error location polynomial
   elp[i].   If the degree of the elp is >tt, we cannot correct all the errors
   and hence just put out the information symbols uncorrected. If the degree of
   elp is <=tt, we substitute alpha**i , i=1..n into the elp to get the roots,
   hence the inverse roots, the error location numbers. If the number of errors
   located does not equal the degree of the elp, we have more than tt errors
   and cannot correct them.  Otherwise, we then solve for the error value at
   the error location and correct the error.  The procedure is that found in
   Lin and Costello. For the cases where the number of errors is known to be too
   large to correct, the information symbols as received are output (the
   advantage of systematic encoding is that hopefully some of the information
   symbols will be okay and that if we are in luck, the errors are in the
   parity part of the transmitted codeword).  Of course, these insoluble cases
   can be returned as error flags to the calling routine if desired.   */
 {
   register int i,j,u,q ;
   int elp[1026][1024], d[1026], l[1026], u_lu[1026], s[1025] ;
   int count=0, syn_error=0, root[200], loc[200], z[201], err[1024], reg[201] ;

/* first form the syndromes */
   for (i=1; i<=n-k; i++)
    { s[i] = 0 ;
      for (j=0; j<n; j++)
        if (recd[j]!=-1)
          s[i] ^= alpha_to[(recd[j]+i*j)%n] ;      /* recd[j] in index form */
/* convert syndrome from polynomial form to index form  */
      if (s[i]!=0)  syn_error=1 ;        /* set flag if non-zero syndrome => error */
      s[i] = index_of[s[i]] ;
    } ;

   if (syn_error)       /* if errors, try and correct */
    {
/* compute the error location polynomial via the Berlekamp iterative algorithm,

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩一区二区三区不卡| 亚洲在线视频免费观看| 久久精品夜色噜噜亚洲a∨| 欧美一区二区在线视频| 日韩亚洲欧美一区二区三区| 久久久www免费人成精品| 中文字幕亚洲精品在线观看| 亚洲宅男天堂在线观看无病毒| 午夜激情综合网| 经典三级一区二区| 欧洲视频一区二区| 久久综合久久99| 日韩中文字幕区一区有砖一区 | 在线亚洲+欧美+日本专区| 欧美一区二区在线观看| 亚洲美女视频一区| 成人免费三级在线| 欧美r级电影在线观看| 亚洲一区二区精品3399| av在线不卡电影| 国产精品三级视频| 韩国精品在线观看| 精品对白一区国产伦| 丝袜国产日韩另类美女| 在线观看av一区| 亚洲成人av电影在线| 欧美视频第二页| 亚洲一区av在线| 欧美亚州韩日在线看免费版国语版| 国产欧美日韩精品一区| 国产精品自拍网站| 中文字幕日本不卡| 欧美三级资源在线| 麻豆成人av在线| 国产日韩欧美精品一区| 91亚洲精品久久久蜜桃| 一区二区欧美精品| 国产欧美日韩在线看| 国产成+人+日韩+欧美+亚洲| 国产精品福利一区| 欧美在线视频日韩| 国产一区久久久| 亚洲九九爱视频| 精品日韩成人av| 91亚洲精品久久久蜜桃网站| 蜜臀av在线播放一区二区三区| 日韩欧美久久一区| 欧美亚一区二区| 国产成人免费在线观看| 日韩精品一级中文字幕精品视频免费观看| 欧美日韩aaaaaa| jlzzjlzz亚洲日本少妇| 欧美aaaaa成人免费观看视频| 国产欧美日韩中文久久| 在线综合+亚洲+欧美中文字幕| 不卡视频免费播放| 国产精品综合网| 久久精品国产成人一区二区三区| 国产精品久久久久久久久免费樱桃| 欧美在线免费观看视频| 99久久伊人网影院| 波多野结衣中文一区| 国产精品一区二区不卡| 久久99九九99精品| 精品一区二区三区香蕉蜜桃 | 亚洲在线视频一区| 一区二区三区四区国产精品| 中文字幕不卡三区| 日韩成人av影视| 欧美xxxxxxxx| 日韩久久久久久| 欧美日韩国产电影| 成人一级片网址| 久久精品国产澳门| 中文字幕第一区综合| 国产麻豆精品95视频| 亚洲日本乱码在线观看| 91麻豆精品国产91久久久| 日韩精品一区二区三区四区| 精品亚洲免费视频| 亚洲美女一区二区三区| 精品国产百合女同互慰| 欧美另类videos死尸| 成人精品一区二区三区四区| 中文av一区二区| 亚洲一区二区在线免费看| 久久夜色精品国产欧美乱极品| a级精品国产片在线观看| 一区二区国产视频| 亚洲激情图片小说视频| 亚洲人一二三区| 久久精品亚洲国产奇米99| 欧洲精品视频在线观看| 色哟哟精品一区| 日本韩国欧美一区| 91麻豆精品国产91久久久资源速度| 久久综合久久综合亚洲| 亚洲小说欧美激情另类| 美女脱光内衣内裤视频久久影院| 精品一区二区影视| 91色.com| 久久这里都是精品| 亚洲欧洲国产日韩| 国产成人鲁色资源国产91色综| 精品久久久久久久久久久久久久久久久| 久久精品日韩一区二区三区| 日韩电影在线看| 欧美色爱综合网| 午夜电影一区二区三区| 精品女同一区二区| 美女视频一区二区三区| 欧美天堂一区二区三区| 一区二区三区成人在线视频| 欧美在线观看一二区| 亚洲一区二区三区中文字幕在线| 99re成人在线| 丝袜a∨在线一区二区三区不卡| 91丨porny丨户外露出| 午夜日韩在线观看| 久久精品视频在线免费观看| 国产成人超碰人人澡人人澡| 尤物视频一区二区| 欧美女孩性生活视频| 久久不见久久见免费视频1| 久久久久97国产精华液好用吗| 99在线视频精品| 青娱乐精品在线视频| 成人欧美一区二区三区视频网页| 91国偷自产一区二区使用方法| 日韩高清在线观看| 亚洲国产精品精华液网站| 日韩欧美国产一区在线观看| 亚洲精品综合在线| 7878成人国产在线观看| 日韩欧美国产一二三区| 久久亚洲影视婷婷| 亚洲另类色综合网站| 天天综合网 天天综合色| 麻豆国产精品官网| 色噜噜狠狠一区二区三区果冻| 欧美群妇大交群中文字幕| 精品国产乱码久久久久久久久 | 亚洲美女少妇撒尿| 成人午夜在线播放| 六月婷婷色综合| 精品系列免费在线观看| 日本三级韩国三级欧美三级| 婷婷综合久久一区二区三区| 亚洲欧美日韩一区| 亚洲一二三四在线| 亚洲一区在线免费观看| 一区二区高清免费观看影视大全| 国产精品不卡在线| 午夜精品影院在线观看| 免费成人在线网站| 成人一区在线观看| 色婷婷综合久色| 日韩欧美国产wwwww| 国产欧美视频一区二区三区| 亚洲激情自拍偷拍| 美腿丝袜亚洲一区| 91一区二区三区在线播放| 欧美区一区二区三区| 国产欧美日韩视频在线观看| 亚洲已满18点击进入久久| 久久精品国产一区二区| 99视频在线精品| 欧美不卡一区二区| 一区二区三区中文字幕| 国产suv一区二区三区88区| 欧美日韩一区 二区 三区 久久精品| 日韩写真欧美这视频| 亚洲欧美偷拍卡通变态| 国产美女精品在线| 日韩一区二区在线免费观看| 亚洲一区二区视频在线观看| 国产·精品毛片| 久久精子c满五个校花| 久久精品久久精品| 欧美精品成人一区二区三区四区| 亚洲欧洲制服丝袜| 91久久免费观看| 亚洲精品日韩一| 欧美中文字幕不卡| 亚洲午夜视频在线| 欧美日韩视频在线一区二区| 亚洲国产欧美在线人成| 欧美日韩在线精品一区二区三区激情 | 在线播放亚洲一区| 香蕉成人啪国产精品视频综合网| 欧美在线观看视频一区二区| 亚洲一区二区三区国产| 制服丝袜一区二区三区| 日精品一区二区三区| 91精品国产高清一区二区三区 | 久久精品视频一区二区三区| 国产成人精品www牛牛影视| 国产欧美日韩精品在线| 91蜜桃免费观看视频| 日韩成人av影视|