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

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

?? rs.cpp

?? 在GF(8)域內
?? CPP
?? 第 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  8           /* RS code over GF(2**4) - change to suit */
#define nn  255          /* nn=2**mm -1   length of codeword */
#define tt  10          /* number of errors that can be corrected */
#define kk  235           /* kk = nn-2*tt  */

int pp [mm+1] = { 1, 1, 1, 0, 0, 0, 0, 1, 1} ; /* specify irreducible polynomial coeffts */
int alpha_to [nn+1], index_of [nn+1], gg [nn-kk+1] ;
int recd [nn], data [kk], bb [nn-kk] ;


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 ;

  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[mm] ^= mask ;
     mask <<= 1 ;
   }
  index_of[alpha_to[mm]] = mm ;
  mask >>= 1 ;
  for (i=mm+1; i<nn; i++)
   { if (alpha_to[i-1] >= mask)
        alpha_to[i] = alpha_to[mm] ^ ((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 ;
 }


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] = alpha_to[1] ;    /* primitive element alpha = 2  for GF(2**mm)  */
   gg[1] = 1 ;    /* g(x) = (X+alpha) initially */
   for (i=2; i<=nn-kk; 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)%nn] ;
        else gg[j] = gg[j-1] ;
      gg[0] = alpha_to[(index_of[gg[0]]+i)%nn] ;     /* gg[0] can never be zero */
    }
   /* convert gg[] to index form for quicker encoding */
//   for (i=0; i<=nn-kk; i++)  gg[i] = index_of[gg[i]] ;
//   for (i=0; i<=nn-kk; i++)  gg[i] = alpha_to[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<nn-kk; i++)   bb[i] = 0 ;
   for (i=kk-1; i>=0; i--)
    {  feedback = index_of[data[i]^bb[nn-kk-1]] ;
       if (feedback != -1)
        { for (j=nn-kk-1; j>0; j--)
            if (gg[j] != -1)
              bb[j] = bb[j-1]^alpha_to[(gg[j]+feedback)%nn] ;
            else
              bb[j] = bb[j-1] ;
          bb[0] = alpha_to[(gg[0]+feedback)%nn] ;
        }
       else
        { for (j=nn-kk-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[nn-kk+2][nn-kk], d[nn-kk+2], l[nn-kk+2], u_lu[nn-kk+2], s[nn-kk+1] ;
   int count=0, syn_error=0, root[tt], loc[tt], z[tt+1], err[nn], reg[tt+1] ;

/* first form the syndromes */
   for (i=1; i<=nn-kk; i++)
    { s[i] = 0 ;
      for (j=0; j<nn; j++)
        if (recd[j]!=-1)
          s[i] ^= alpha_to[(recd[j]+i*j)%nn] ;      /* 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,
   following the terminology of Lin and Costello :   d[u] is the 'mu'th
   discrepancy, where u='mu'+1 and 'mu' (the Greek letter!) is the step number
   ranging from -1 to 2*tt (see L&C),  l[u] is the
   degree of the elp at that step, and u_l[u] is the difference between the
   step number and the degree of the elp.
*/
/* initialise table entries */
      d[0] = 0 ;           /* index form */
      d[1] = s[1] ;        /* index form */
      elp[0][0] = 0 ;      /* index form */
      elp[1][0] = 1 ;      /* polynomial form */
      for (i=1; i<nn-kk; i++)
        { elp[0][i] = -1 ;   /* index form */
          elp[1][i] = 0 ;   /* polynomial form */
        }
      l[0] = 0 ;
      l[1] = 0 ;
      u_lu[0] = -1 ;
      u_lu[1] = 0 ;
      u = 0 ;

      do
      {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
26uuu精品一区二区| 一区二区激情视频| 亚洲国产精品麻豆| 国产一区二区三区在线看麻豆| 成人免费观看视频| 欧美一级理论片| 尤物视频一区二区| 成人激情黄色小说| 久久午夜电影网| 日韩激情视频在线观看| 99久久99久久久精品齐齐| 欧美精品一区男女天堂| 五月婷婷综合网| 在线观看视频一区二区欧美日韩| 国产午夜精品一区二区三区视频| 午夜亚洲福利老司机| 91免费小视频| 国产精品超碰97尤物18| 国产成人亚洲综合a∨婷婷图片| 91精品国产综合久久精品性色 | 成人美女在线观看| 精品日韩99亚洲| 天天色图综合网| 欧美日本在线视频| 香港成人在线视频| 欧美日本在线观看| 五月天久久比比资源色| 欧美剧在线免费观看网站| 亚洲成av人片| 3d动漫精品啪啪1区2区免费 | 精品国产免费久久| 看片网站欧美日韩| 久久一夜天堂av一区二区三区| 一本大道久久精品懂色aⅴ| 久久久久国产精品免费免费搜索| 久久国产尿小便嘘嘘尿| 欧美一级一区二区| 国产一区二区三区四区在线观看| 精品美女一区二区三区| 国产精品资源在线看| 久久精品男人的天堂| 国产.欧美.日韩| 中文字幕一区二区三区在线不卡| 不卡av在线网| 一区二区三区毛片| 91麻豆精品国产91久久久使用方法 | 色哟哟国产精品| 日韩伦理免费电影| 欧洲中文字幕精品| 日韩av电影一区| 久久一区二区视频| av午夜一区麻豆| 亚洲成av人片www| 日韩欧美一区电影| 成人做爰69片免费看网站| 亚洲丝袜另类动漫二区| 99久久er热在这里只有精品66| 亚洲精品视频在线观看网站| 欧美揉bbbbb揉bbbbb| 久久国产精品免费| 国产精品麻豆久久久| 91成人在线精品| 久草在线在线精品观看| 国产精品另类一区| 欧美少妇xxx| 国产精品亚洲视频| 亚洲高清免费一级二级三级| 一区二区不卡在线播放| 91精品欧美福利在线观看| 精品一区二区三区在线观看国产| 国产精品久久久久毛片软件| 欧美日韩一区二区三区四区五区| 国产在线麻豆精品观看| 一区二区三区中文字幕精品精品| 精品裸体舞一区二区三区| 91在线视频播放| 黄色日韩网站视频| 亚洲3atv精品一区二区三区| 国产女同性恋一区二区| 欧美精品一卡两卡| 91免费国产视频网站| 精品一区二区三区蜜桃| 亚洲综合久久av| 国产精品丝袜一区| 日韩精品一区二区三区在线播放| 色狠狠色狠狠综合| 国产精品996| 美女视频一区二区| 香蕉久久夜色精品国产使用方法| 中文字幕不卡在线观看| 欧美白人最猛性xxxxx69交| 一本大道久久a久久精二百| 国产一区二区在线观看免费| 亚洲国产sm捆绑调教视频| 国产精品不卡在线观看| 国产欧美日韩亚州综合| 欧美一区二区精品在线| 欧美日韩视频专区在线播放| 波多野洁衣一区| 国产福利电影一区二区三区| 日韩国产高清在线| 亚洲va欧美va人人爽午夜| 亚洲欧美二区三区| 中文字幕日本乱码精品影院| 国产女人水真多18毛片18精品视频| 欧美一级在线免费| 亚洲另类在线制服丝袜| 国产欧美日韩在线看| 精品免费视频.| 欧美一级片在线看| 日韩免费看网站| 日韩精品一区在线观看| 欧美成人vr18sexvr| 日韩美女视频一区二区在线观看| 欧美一区二区二区| 日韩精品一区二区三区视频播放 | 精品一区二区日韩| 另类专区欧美蜜桃臀第一页| 午夜精品久久久久久久| 午夜精品久久久久久久99樱桃 | 精品亚洲免费视频| 国产一区免费电影| 国产成人超碰人人澡人人澡| 国产宾馆实践打屁股91| 99视频一区二区三区| 91丝袜美女网| 欧美色图免费看| 91精品国产91综合久久蜜臀| 日韩一区二区麻豆国产| 久久综合九色综合欧美98| 国产欧美日韩视频一区二区| 中文成人综合网| 一区二区三区欧美日韩| 日韩二区三区四区| 欧美日韩一区国产| 欧美高清dvd| 久久精品亚洲麻豆av一区二区| 欧美韩国日本不卡| 一级特黄大欧美久久久| 捆绑调教美女网站视频一区| 国产精品自拍av| 色av一区二区| 日韩精品一区二区三区视频播放 | 日韩在线观看一区二区| 看电影不卡的网站| 99久久免费国产| 欧美日韩国产精选| 国产亚洲欧洲一区高清在线观看| 成人免费在线视频观看| 日韩成人午夜精品| 成人免费毛片片v| 欧美日韩国产小视频| 国产日韩视频一区二区三区| 有码一区二区三区| 极品少妇xxxx偷拍精品少妇| www.视频一区| 91精品久久久久久久久99蜜臂| 日本一区二区三区在线观看| 亚洲成人在线观看视频| 春色校园综合激情亚洲| 欧美一区二区三区四区久久| 国产精品卡一卡二| 欧美96一区二区免费视频| 不卡的电视剧免费网站有什么| 欧美精品乱码久久久久久按摩| 久久精品免视看| 日本视频免费一区| 色88888久久久久久影院野外 | 在线观看欧美黄色| 久久亚洲欧美国产精品乐播| 亚洲观看高清完整版在线观看| 国产精品一品视频| 欧美一级高清片| 亚洲视频每日更新| 国产在线麻豆精品观看| 欧美高清视频在线高清观看mv色露露十八 | 久久精品夜夜夜夜久久| 天天综合色天天| 色又黄又爽网站www久久| 久久午夜老司机| 免费三级欧美电影| 欧美精品xxxxbbbb| 亚洲自拍欧美精品| 91在线观看免费视频| 国产性天天综合网| 国产一区二区三区免费看 | 欧美日韩高清不卡| 亚洲精品写真福利| 99久久久精品| 国产精品久久久久久久蜜臀| 韩国欧美一区二区| 精品久久久久香蕉网| 日本怡春院一区二区| 欧美精品久久天天躁| 亚洲国产精品久久一线不卡| 91福利国产精品| 亚洲成人动漫在线观看| 色一情一乱一乱一91av| 日韩一区在线播放| 色综合久久综合|