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

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

?? rs.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一区二区三区免费野_久草精品视频
精品在线亚洲视频| 亚洲综合免费观看高清在线观看| 久久精品国产亚洲高清剧情介绍 | 欧美日韩在线观看一区二区| 一区二区三区精品在线| 日本韩国欧美国产| 丝袜美腿一区二区三区| 精品国产3级a| jlzzjlzz欧美大全| 亚洲国产视频a| 日韩欧美在线观看一区二区三区| 久久99国产精品久久99| 欧美激情资源网| 欧美亚洲综合网| 蜜臀a∨国产成人精品| 国产日本欧洲亚洲| 91福利精品第一导航| 美女高潮久久久| 国产精品福利在线播放| 欧美三级日本三级少妇99| 久久av资源网| 亚洲欧美一区二区不卡| 91精品福利在线一区二区三区 | 麻豆91精品91久久久的内涵| 久久这里只有精品首页| 99国产欧美另类久久久精品 | 美女爽到高潮91| 日本一二三不卡| 欧美理论片在线| 成人一区二区三区中文字幕| 亚洲大片一区二区三区| 久久综合五月天婷婷伊人| 色综合一区二区| 国模娜娜一区二区三区| 亚洲图片欧美一区| 国产日韩亚洲欧美综合| 欧美日韩二区三区| 成人午夜电影久久影院| 午夜精品久久久久影视| 国产精品免费视频网站| 91精品国产欧美日韩| 色综合久久天天| 国产精品538一区二区在线| 天堂蜜桃91精品| 亚洲日本在线a| 久久综合狠狠综合久久综合88| 欧美四级电影网| 国模大尺度一区二区三区| 亚洲自拍偷拍网站| 成人欧美一区二区三区在线播放| 欧美电影免费观看高清完整版在| 在线精品视频小说1| jizzjizzjizz欧美| 国产乱淫av一区二区三区| 日本亚洲三级在线| 亚洲第一会所有码转帖| 亚洲日本中文字幕区| 国产精品毛片a∨一区二区三区| 日韩久久精品一区| 91精品国产麻豆国产自产在线 | 制服丝袜中文字幕亚洲| 日本韩国欧美一区| 日本韩国欧美三级| 色欧美乱欧美15图片| 色综合天天做天天爱| 色综合欧美在线| 91在线观看地址| 99这里只有久久精品视频| av男人天堂一区| 色综合天天综合网天天狠天天| 成人综合在线网站| a级高清视频欧美日韩| 成人av片在线观看| 99久久久精品| 色丁香久综合在线久综合在线观看| 91在线你懂得| 91福利国产成人精品照片| 一本在线高清不卡dvd| 色综合久久久久久久久久久| 99精品久久免费看蜜臀剧情介绍| av影院午夜一区| 91在线观看一区二区| 一本一道久久a久久精品| 欧美亚洲自拍偷拍| 欧美精品少妇一区二区三区 | 2020国产精品自拍| 久久久精品国产99久久精品芒果| 国产校园另类小说区| 国产精品久久777777| 亚洲综合在线电影| 日日噜噜夜夜狠狠视频欧美人| 日韩高清在线一区| 激情久久久久久久久久久久久久久久| 久久成人免费电影| 成人免费精品视频| 欧美无砖砖区免费| 日韩一区二区三免费高清| 久久精品亚洲麻豆av一区二区| 国产欧美日韩精品一区| 中文字幕日韩精品一区| 亚洲图片有声小说| 激情另类小说区图片区视频区| 成人精品亚洲人成在线| 欧美最猛黑人xxxxx猛交| 日韩一区二区在线播放| 欧美韩日一区二区三区四区| 亚洲视频在线一区二区| 日韩综合在线视频| 国产福利电影一区二区三区| 在线视频国内自拍亚洲视频| 日韩欧美三级在线| 国产精品麻豆欧美日韩ww| 亚洲韩国一区二区三区| 狠狠色狠狠色综合日日91app| 国产成人av福利| 精品视频999| 国产精品久久久久久久久免费桃花 | 国产高清不卡一区| 一本久道久久综合中文字幕| 精品乱码亚洲一区二区不卡| 日韩一区欧美一区| 老汉av免费一区二区三区| 成人黄色在线看| 欧美大片一区二区| 亚洲欧美日韩电影| 久久99热这里只有精品| 91久久精品网| 国产欧美一区在线| 免费国产亚洲视频| 91福利精品视频| 国产精品拍天天在线| 喷水一区二区三区| 在线观看av一区二区| 国产精品久久久久一区二区三区| 乱一区二区av| 欧美军同video69gay| 亚洲精品欧美二区三区中文字幕| 狠狠色综合日日| 日韩欧美www| 日日夜夜精品视频免费| 日本精品免费观看高清观看| 欧美激情综合在线| 国产综合久久久久久鬼色| 欧美精品久久久久久久多人混战| 亚洲乱码精品一二三四区日韩在线| 久久99日本精品| 欧美电影免费观看高清完整版在| 亚洲成人在线观看视频| 色久综合一二码| 亚洲日本一区二区| 99久久精品免费| 国产精品美女久久久久aⅴ国产馆| 韩国成人福利片在线播放| 日韩欧美中文字幕制服| 日韩福利视频网| 日韩一区二区三区四区五区六区| 五月天欧美精品| 3atv在线一区二区三区| 日韩黄色片在线观看| 91.com视频| 麻豆久久一区二区| 日韩欧美国产精品一区| 美女视频第一区二区三区免费观看网站| 欧美日韩高清一区二区三区| 午夜精品爽啪视频| 777久久久精品| 久久成人免费网站| 久久久久久久久久美女| 国产成人在线网站| 国产精品丝袜在线| 色综合视频一区二区三区高清| 日韩美女久久久| 欧美性色黄大片| 男人的j进女人的j一区| 日韩三级高清在线| 国产高清在线观看免费不卡| 中文字幕欧美日本乱码一线二线| 国产成人精品免费在线| 中文字幕一区二区三区四区 | 久草热8精品视频在线观看| 精品国产一二三区| 风间由美性色一区二区三区| 中文在线资源观看网站视频免费不卡| a级高清视频欧美日韩| 一区二区三区高清| 日韩久久免费av| av网站免费线看精品| 亚洲自拍偷拍欧美| 欧美第一区第二区| 成人av在线影院| 亚洲成人av中文| 久久久久久久久久久黄色| 91在线国内视频| 热久久免费视频| 国产色产综合产在线视频| 色综合久久久久久久久久久| 日韩二区在线观看| 国产精品乱人伦| 51精品秘密在线观看| 丁香六月综合激情|