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

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

?? ribm.cpp

?? RS碼解碼的C語言仿真程序,RiBM算法
?? 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>
#include <sys/timeb.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  8           /* number of errors that can be corrected */
#define kk  239          /* kk = nn-2*tt  */
#define no_p 16   /* no_p = 2*tt */
#define no_t 24   /* no_t = 3*tt */

//file://int pp [mm+1] = { 1, 1, 0, 0,1} ; /* specify irreducible polynomial coeffts */
int pp[mm+1] = { 1, 0, 1, 1, 1, 0, 0, 0, 1};
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] = 2 ;    /* 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]] ;
 }


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] ;

   int da[no_p+1][no_t+1];
   int st[no_p+1][no_t+1];
   int ga[no_p+1];
   int kr[no_p+1];
   int dg_mul;
   int ds_mul;
   int omiga;
   int sita;
   int yi;

/* 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 */
      //file://s[i] = index_of[s[i]] ;
    } 

   //file://Ribm algorithm
   //file://Begin
/*   int da[3*tt+1][2*tt+1];
   int st[3*tt+1][2*tt+1];
   int ga[2*tt+1];
   int kr[2*tt+1];
   int dg_mul;
   int ds_mul;*/

//   file://Calculate error locator and error evaluator polynomial
   for(i=0; i<no_p; i++){
    da[0][i] = s[i+1];
    st[0][i] = s[i+1];
//    file://da[0][i] = 1;
//   file://st[0][i] = 1;
   }

   for(i=no_p; i<no_t; i++){
    da[0][i] = 0;
    st[0][i] = 0;
   }

   da[0][no_t] = 1;
   st[0][no_t] = 1;

   kr[0] = 0;
   ga[0] = 1;

   for(i=0; i<no_p; i++)
   {
	 for(j=0; j<no_t; j++)
	 {
		 if(ga[i]!=0 && da[i][j+1]!=0)
			dg_mul = alpha_to[(index_of[ga[i]] + index_of[da[i][j+1]])%nn];
		 else
            dg_mul = 0;

     if(da[i][0]!=0 && st[i][j]!=0)
	   ds_mul = alpha_to[(index_of[da[i][0]] + index_of[st[i][j]])%nn];
     else
	   ds_mul = 0;

     da[i+1][j] = dg_mul ^ ds_mul;
	 }

    if(da[i][0]!=0 && st[i][no_t]!=0)
     da[i+1][no_t] = alpha_to[(index_of[da[i][0]] + index_of[st[i][no_t]])%nn];
    else
     da[i+1][no_t] = 0;

    if(da[i][0]!=0 && kr[i]>=0)
	{
		 ga[i+1] = da[i][0];
		 kr[i+1] = - (kr[i] + 1);
		 //file://kr[i+1] = - (kr[i] - 1);

		 for(j=0; j<no_t; j++)
			st[i+1][j] = da[i][j+1];

		 st[i+1][no_t] = 0;
    }

    else
	{
		 ga[i+1] = ga[i];
		kr[i+1] = kr[i] + 1;

			for(j=0; j<=no_t; j++)
               st[i+1][j] = st[i][j];
    }
   }

//   file://solve the error locator polynomial
   for (i=0; i<=tt; i++){
    reg[i] = index_of[da[no_p][i+tt]];
    if(i<tt)
     z[i] = index_of[da[no_p][i]];
   }

   count = 0 ;
   for (i=1; i<=nn; i++)
   {
    q = 0 ;
    for (j=0; j<=tt; j++)
	{
     if (reg[j]!=-1)
	 {
      reg[j] = (reg[j]+j)%nn ;
               q ^= alpha_to[reg[j]] ;
     }
    }

       if (!q){
     root[count] = i;
           loc[count] = nn-i ;
           count++ ;
    }
   }

 /*  file://For reference
   for(i=1; i<=nn; i++){
    omiga = 0;
    for(j=0; j<tt; j++){
     if(z[j]!=-1)

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
不卡视频在线观看| 韩国成人在线视频| 成人丝袜18视频在线观看| 欧美肥大bbwbbw高潮| 欧美国产乱子伦| 男男视频亚洲欧美| 欧美色涩在线第一页| 中文字幕亚洲在| 国产成人一区在线| 26uuu精品一区二区在线观看| 成人爱爱电影网址| 久久先锋影音av| 日本不卡视频在线观看| 欧美图片一区二区三区| 亚洲婷婷综合久久一本伊一区| 国产乱码一区二区三区| 日韩女同互慰一区二区| 三级影片在线观看欧美日韩一区二区| 91亚洲国产成人精品一区二三| 久久只精品国产| 久久精品国产秦先生| 欧美一区二区免费观在线| 亚洲最快最全在线视频| 91美女片黄在线| 中文字幕一区在线观看视频| 丁香婷婷综合激情五月色| 久久精品在这里| 国产永久精品大片wwwapp| 日韩欧美高清dvd碟片| 日日夜夜精品视频免费| 欧美日韩极品在线观看一区| 亚洲国产一区在线观看| 在线观看欧美精品| 亚洲一区av在线| 欧美在线影院一区二区| 一区二区三区四区在线| 91麻豆国产福利在线观看| 中文字幕中文字幕在线一区| 成人性生交大片免费看中文| 中文成人综合网| 国产成人精品亚洲午夜麻豆| 国产亚洲欧美色| 成人污污视频在线观看| 国产精品毛片大码女人| 99久免费精品视频在线观看| 1区2区3区精品视频| 色婷婷精品大在线视频| 欧美最猛性xxxxx直播| 一区二区三区在线高清| 在线观看一区二区精品视频| 午夜欧美2019年伦理| 日韩一级视频免费观看在线| 蜜臀av国产精品久久久久| 精品国产凹凸成av人网站| 国产乱对白刺激视频不卡| 国产精品女同互慰在线看| 99热这里都是精品| 亚洲国产视频在线| 欧美一级理论片| 国产一区二区三区av电影 | 国产乱国产乱300精品| 国产欧美日韩不卡免费| 成人美女在线视频| 亚洲一区二区三区小说| 在线不卡一区二区| 国产综合色精品一区二区三区| 国产校园另类小说区| 97精品久久久午夜一区二区三区| 亚洲激情一二三区| 91麻豆精品国产综合久久久久久| 久久不见久久见免费视频7 | 色婷婷久久综合| 亚洲成av人综合在线观看| 欧美成人精品高清在线播放| 国产成人在线免费观看| 亚洲精品欧美专区| 日韩一级高清毛片| 成人av在线网| 亚洲成a人片综合在线| 亚洲精品一区在线观看| 9人人澡人人爽人人精品| 午夜精品久久久久久久| 久久综合一区二区| 色综合视频一区二区三区高清| 午夜精品久久一牛影视| 久久精品视频免费| 欧美三级三级三级爽爽爽| 国产一区二区福利| 一区二区久久久久久| 精品欧美一区二区在线观看| av一区二区不卡| 日韩国产一二三区| 中文字幕在线观看一区| 欧美一区二区人人喊爽| av电影一区二区| 蜜桃久久久久久| 最新久久zyz资源站| 日韩精品一区二区在线观看| 色婷婷亚洲婷婷| 国产精品资源在线| 亚洲成人激情av| 中文无字幕一区二区三区 | 91亚洲精华国产精华精华液| 日本va欧美va精品| 亚洲视频狠狠干| 久久你懂得1024| 4438x亚洲最大成人网| 一本在线高清不卡dvd| 久久电影国产免费久久电影 | 精品国产91乱码一区二区三区| 91麻豆免费在线观看| 激情综合色播激情啊| 亚洲一区二区影院| 国产精品污污网站在线观看| 日韩一区二区三区免费观看| 91黄色免费网站| 成人黄色大片在线观看| 黄色成人免费在线| 三级亚洲高清视频| 亚洲一区免费在线观看| 国产精品狼人久久影院观看方式| 日韩精品一区二区三区老鸭窝| 欧美亚洲国产一区二区三区| 成人在线综合网站| 国产美女精品在线| 蜜桃久久精品一区二区| 午夜伊人狠狠久久| 一区二区成人在线视频| 国产精品国产三级国产a| 久久精品综合网| 精品国产自在久精品国产| 欧美喷水一区二区| 欧美探花视频资源| 色哟哟在线观看一区二区三区| 成人福利在线看| 国产成人aaaa| 国产成人免费9x9x人网站视频| 精品一二三四区| 久久99精品一区二区三区| 日本免费新一区视频| 日韩成人午夜精品| 香蕉久久一区二区不卡无毒影院| 亚洲一区欧美一区| 亚洲一区二区三区小说| 亚洲一区二区三区影院| 亚洲一级不卡视频| 亚洲图片自拍偷拍| 亚洲成人av中文| 亚洲国产日韩一级| 香蕉久久夜色精品国产使用方法| 亚洲一区二区精品视频| 一区二区三区四区蜜桃| 玉足女爽爽91| 亚洲一区二区三区爽爽爽爽爽| 亚洲在线视频网站| 亚洲电影一区二区| 日韩中文字幕91| 久久国产尿小便嘘嘘| 激情综合色综合久久综合| 久久99精品国产| 国产乱人伦精品一区二区在线观看 | 欧美成人vps| 精品sm在线观看| 欧美激情在线免费观看| 国产精品久久久久天堂| 亚洲人成网站影音先锋播放| 亚洲伦理在线精品| 亚洲中国最大av网站| 日本欧美韩国一区三区| 激情图区综合网| 国产精品996| 99视频超级精品| 欧美影视一区二区三区| 欧美人体做爰大胆视频| 日韩你懂的电影在线观看| 久久综合久久99| 国产精品久久久久久久久免费丝袜 | 欧美日韩高清影院| 日韩精品一区二区三区老鸭窝 | 欧美人伦禁忌dvd放荡欲情| 欧美一区二区视频在线观看2022| 日韩欧美一区电影| 亚洲国产精品av| 亚洲在线观看免费视频| 美国十次综合导航| 成人av网站在线观看免费| 日本福利一区二区| 日韩一区二区电影| 中文字幕第一区第二区| 亚洲欧美激情视频在线观看一区二区三区 | 国产农村妇女精品| 一区二区在线免费观看| 日本欧美一区二区三区乱码| 国产成人自拍高清视频在线免费播放| www.色精品| 3d动漫精品啪啪| 欧美激情在线看| 午夜国产精品影院在线观看| 国产剧情在线观看一区二区| 在线一区二区三区做爰视频网站|