亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
亚洲女爱视频在线| 国产精品免费网站在线观看| 国产精品综合视频| 免费一级片91| 久久成人免费电影| 国产一区二区三区高清播放| 狠狠色综合色综合网络| 国产乱码一区二区三区| 成人精品一区二区三区中文字幕| 国产 日韩 欧美大片| 国产成人一级电影| 在线免费亚洲电影| 日韩一区二区不卡| 久久久久国产精品免费免费搜索| 国产精品私人影院| 有坂深雪av一区二区精品| 五月婷婷另类国产| 国产suv精品一区二区883| 日本高清不卡视频| 久久精品亚洲麻豆av一区二区 | 91浏览器打开| 成人激情黄色小说| 91精品国产综合久久小美女| 国产亚洲一区二区在线观看| 国产精品视频第一区| 午夜在线成人av| 成人性生交大片| 精品剧情在线观看| 午夜精品久久久久久久蜜桃app| 国产馆精品极品| 欧美成人激情免费网| 午夜精品一区二区三区免费视频| 国产精品系列在线播放| 欧美精品1区2区3区| 亚洲午夜电影在线观看| 成年人午夜久久久| 国产精品情趣视频| 国产精品资源站在线| 日韩一区二区在线播放| 三级亚洲高清视频| 欧美日韩情趣电影| 天堂影院一区二区| 欧美日韩激情一区二区三区| 亚洲乱码一区二区三区在线观看| 波多野结衣91| 中文字幕视频一区二区三区久| 国产成人免费在线视频| 国产色一区二区| 不卡一区二区三区四区| 综合久久久久久久| 欧美亚洲动漫精品| 日韩中文字幕区一区有砖一区| 日韩一卡二卡三卡四卡| 三级影片在线观看欧美日韩一区二区| 欧美日韩精品一区二区三区四区 | 在线观看视频一区二区欧美日韩| 777xxx欧美| 亚洲一区二区视频在线| 91麻豆精品国产91久久久久| 国产精品资源站在线| 国产精品久久毛片| 欧美日韩日日骚| 成人午夜视频网站| 日韩av一区二| 亚洲你懂的在线视频| 日韩视频一区在线观看| 91在线精品一区二区三区| 美国毛片一区二区| 中文字幕在线观看不卡视频| 69成人精品免费视频| 99久久精品国产毛片| 久久99精品久久久久| 亚洲午夜久久久久久久久电影院 | 日韩av电影免费观看高清完整版 | 成人丝袜18视频在线观看| 亚洲国产三级在线| 亚洲色图欧美在线| 欧美国产一区二区在线观看| 欧美人成免费网站| 欧美午夜片在线观看| 99久久免费国产| av在线一区二区三区| 国产激情精品久久久第一区二区 | 日韩一区二区免费电影| 欧美日韩国产美女| 欧美网站大全在线观看| 欧美一区二区三区四区视频 | 久久久久久久av麻豆果冻| 欧美精品久久天天躁| 欧美精品国产精品| 欧美一二区视频| 久久免费午夜影院| 国产精品国产三级国产普通话99 | 亚洲一区二三区| 亚洲中国最大av网站| 亚洲韩国一区二区三区| 亚洲一区二区三区爽爽爽爽爽| 亚洲欧美日韩国产一区二区三区| 亚洲国产成人自拍| 一区二区三区精品视频| 日韩福利视频导航| 国产中文字幕一区| 色欲综合视频天天天| 7777精品伊人久久久大香线蕉的| 精品国产污网站| 欧美国产欧美综合| 婷婷综合在线观看| 粉嫩av一区二区三区粉嫩| 欧美做爰猛烈大尺度电影无法无天| 欧美日韩国产一二三| 久久人人97超碰com| 一个色妞综合视频在线观看| 日韩va欧美va亚洲va久久| 波多野结衣的一区二区三区| 欧美综合视频在线观看| 精品久久久久久久一区二区蜜臀| 亚洲国产精品国自产拍av| 性久久久久久久| 一道本成人在线| 欧美国产乱子伦| 国产一区二区三区电影在线观看| 99精品国产99久久久久久白柏| 欧美日韩在线不卡| 一区二区三区精密机械公司| 成人免费视频视频在线观看免费| 日韩欧美激情在线| 免费在线观看一区| 日韩精品一区二区三区老鸭窝| 亚洲午夜日本在线观看| 色婷婷av一区二区三区之一色屋| 国产精品热久久久久夜色精品三区| 精品一区二区精品| 国产日韩欧美制服另类| 国产一区二区美女| 国产亚洲欧美日韩日本| 久久精品视频免费观看| 久久不见久久见免费视频1| 欧美日韩在线直播| 日韩av电影免费观看高清完整版| 欧美日韩激情在线| 国产一区二区三区四区五区美女 | 夜夜嗨av一区二区三区网页| 日本高清无吗v一区| 同产精品九九九| 26uuu欧美| 色综合久久久网| 亚洲mv在线观看| 久久午夜老司机| 色一情一乱一乱一91av| 日韩黄色免费电影| 国产精品婷婷午夜在线观看| 欧美亚洲国产一卡| 国产精品一区二区x88av| 亚洲男人的天堂av| 国产色产综合色产在线视频| 波多野结衣视频一区| 美女视频一区二区| 一区二区三区小说| 26uuu国产在线精品一区二区| 91片黄在线观看| 国产风韵犹存在线视精品| 午夜精品福利在线| 中文字幕日韩av资源站| 26uuuu精品一区二区| 欧美网站大全在线观看| 成人av动漫在线| 国产美女视频91| 国产一区二区福利视频| 亚洲第一综合色| 亚洲国产欧美另类丝袜| 一区二区三区中文字幕电影| 中文无字幕一区二区三区 | 老汉av免费一区二区三区| 亚洲一线二线三线视频| 综合在线观看色| 亚洲天堂成人网| 伊人开心综合网| 一级女性全黄久久生活片免费| 国产精品国产三级国产有无不卡| 久久综合色天天久久综合图片| 3d成人h动漫网站入口| 欧美精品亚洲一区二区在线播放| 欧美视频一区二区在线观看| 欧美日韩1234| 国产日产精品1区| 欧美日韩国产小视频在线观看| 成人免费毛片嘿嘿连载视频| 不卡视频在线看| 欧美无砖砖区免费| 欧美精品在线一区二区| 精品区一区二区| 中文字幕成人在线观看| 一区二区三区在线播| 奇米一区二区三区| 国产成人在线观看| 91美女在线观看| 亚洲精品一区二区在线观看| 国产精品丝袜一区| 美腿丝袜一区二区三区| 91在线无精精品入口|