⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ecc.htm

📁 一些纠错编码算法的源代码
💻 HTM
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0041)http://mmc.et.tudelft.nl/~richie/ecc.html -->
<HTML><HEAD>
<META content="text/html; charset=gb2312" http-equiv=Content-Type>
<SCRIPT language=JavaScript><!-- Script start	function Validate( aForm ) {		i = aForm.m.selectedIndex;		m = parseInt(aForm.m.options[i].text);		if(aForm.action.indexOf("rm-codec")==-1) {			t = parseInt(aForm.t.value);			n = (1<<m)-1;		} else {			r = parseInt(aForm.r.value);			n = (1<<m);			d = (1<<(m-r));			t = parseInt((d-1)/2);			if((r < 1) || (r > m)) {				alert( "r should be chosen between 1 and "+m );				return false;			}		}		k1 = n - m*t;		k2 = n - 2*t		if((m < 1) || (m > 15)) {			alert( "m should be chosen between 1 and 15" );			return false;		}		if((t < 0) || (t > n)) {			alert( "t should be chosen between 1 and 2^m-1 = " +n);			return false;		}		if(aForm.action.indexOf("rs-codec")!=-1) {			bst  = parseInt(aForm.bstart.value);			blen = parseInt(aForm.blength.value);			if(aForm.etype[1].checked && (bst<0 || blen<1 ||							bst+blen>n*m)) {				alert( "Can't start a burst error of length "					+blen+" at position "+bst+					";\nwe only have "+n*m+" bits.");				return false;			}		}		return true;	}	function temp(x,y) {		temp.zero = x;		temp.one  = y;	}	function calc(x,y) {		aForm = document.forms[x];		i = aForm.m.selectedIndex;		m = parseInt(aForm.m.options[i].text);		err = parseFloat(aForm.errorprob.value);		if(x==2) {			r = parseInt(aForm.r.value);			n = (1<<m);			d=(1<<(m-r));			if(d>2)				t=parseInt((d-1)/2);			else				t=0;			tt=t;			e = Math.round(err * n);			k = 1;		} else {			tt = parseInt(aForm.t.value);			t = tt;			n = (1<<m)-1;			e = Math.round(err * n);			k = n - m*t;		}		if(x==1) {			e = Math.round((1-Math.pow(1-err,m))*n)+" symbols";			k = n - 2*t;			bst  = parseInt(aForm.bstart.value);			blen = parseInt(aForm.blength.value);			if(aForm.etype[1].checked) {				e = Math.max(0,Math.min(blen,n*m-bst))+" bits";				tt = m*(t-1)+1;			}		}		if(k<1) {			k=1;			tt = (1<<(m-1))-1;		}		if(x!=2) d = 2*tt + 1;		if(y == 'k') {			if(x==0) alert("k>="+k);			else     alert("k=" +k);		}		else if (y == 'n') alert("n="+n);		else if (y == 'd') alert("d>="+d);		else if (y == 'e') alert("Expected number of errors: " + e +		 			 "\nCorrecting capability: " + tt);		return true;	}// script end --></SCRIPT>

<META content="MSHTML 5.00.2920.0" name=GENERATOR></HEAD>
<BODY>BCH codec:
<P>
<FORM action=cgi-bin/bch3-codec method=post name=bchcodec 
onsubmit="return Validate(this);">m = <SELECT name=m> <OPTION 
  selected>3<OPTION>4<OPTION>5<OPTION>6<OPTION>7<OPTION>8<OPTION>9<OPTION>10<OPTION>11<OPTION>12<OPTION>13<OPTION>14<OPTION>15</OPTION></SELECT> 
t = <INPUT maxLength=4 name=t size=4 value=1> <INPUT maxLength=1 name=n onclick="return calc(0,'n')" size=1 type=button value=" n = ? "> 
<INPUT maxLength=1 name=k onclick="return calc(0,'k')" size=1 type=button value=" k >= ? "> 
<INPUT maxLength=1 name=d onclick="return calc(0,'d')" size=1 type=button value=" d >= ? "> 
<BR>Error probability per bit = <INPUT maxLength=4 name=errorprob size=5 
value=0.10> <INPUT maxLength=1 name=e onclick="return calc(0,'e')" size=1 type=button value=" Expected number of errors "> 
<BR><INPUT type=submit value=Code!> <INPUT type=reset value=重置> </FORM>
<P>
<HR SIZE=3 width="100%">

<P>Reed-Solomon codec:
<P>
<FORM action=cgi-bin/rs-codec method=post name=rs-form 
onsubmit="return Validate(this);">m = <SELECT name=m> <OPTION 
  selected>3<OPTION>4<OPTION>5<OPTION>6<OPTION>7<OPTION>8<OPTION>9<OPTION>10<OPTION>11<OPTION>12<OPTION>13<OPTION>14<OPTION>15</OPTION></SELECT> 
t = <INPUT maxLength=4 name=t size=4 value=1> <INPUT maxLength=1 name=n onclick="return calc(1,'n')" size=1 type=button value=" n = ? "> 
<INPUT maxLength=1 name=k onclick="return calc(1,'k')" size=1 type=button value=" k = ? "> 
<INPUT maxLength=1 name=d onclick="return calc(1,'d')" size=1 type=button value=" d >= ? "> 
<BR><INPUT CHECKED name=etype type=radio value=stat> Error probability per bit = 
<INPUT maxLength=4 name=errorprob size=5 value=0.10> <INPUT maxLength=1 name=e onclick="return calc(1,'e')" size=1 type=button value=" Expected number of errors "> 
<BR><INPUT name=etype type=radio value=burst> Burst error with length <INPUT 
maxLength=4 name=blength size=5 value=3> starting at data bit <INPUT maxLength=4 
name=bstart size=5 value=0> <BR><INPUT type=submit value=Code!> <INPUT type=reset value=重置> </FORM>
<P>
<HR SIZE=3 width="100%">

<P>Reed-Muller codec:
<P>
<FORM action=cgi-bin/rm-codec method=post name=rmcodec 
onsubmit="return Validate(this);">m = <SELECT name=m> <OPTION 
  selected>3<OPTION>4<OPTION>5<OPTION>6<OPTION>7<OPTION>8<OPTION>9<OPTION>10<OPTION>11<OPTION>12<OPTION>13<OPTION>14<OPTION>15</OPTION></SELECT> 
r = <INPUT maxLength=4 name=r size=4 value=1> <INPUT maxLength=1 name=n onclick="return calc(2,'n')" size=1 type=button value=" n = ? "> 
<INPUT maxLength=1 name=d onclick="return calc(2,'d')" size=1 type=button value=" d >= ? "> 
<BR>Error probability per bit = <INPUT maxLength=4 name=errorprob size=5 
value=0.10> <INPUT maxLength=1 name=e onclick="return calc(2,'e')" size=1 type=button value=" Expected number of errors "> 
<BR><INPUT type=submit value=Code!> <INPUT type=reset value=重置> 
</FORM></P></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -