19.4.6.6.5 Data interleaving

来源:互联网 发布:小腻腻淘宝是正品吗 编辑:程序博客网 时间:2024/06/03 21:31
void ofdm_interleaving(int_32 Ncbps, int_32 Nbpsc, INOUT uint_8 indat[], int_32 inlen){int_32 s, i, j, k;uint_8 mdat[288];if(Ncbps != inlen * 8){err("Ncbps != inlen\n");return ;}memset(mdat, 0, 288);/** The value of s is determined by the number of coded bits per subcarrier, Nbpsc , according to* s = max(Nbpsc /2,1)*/s = Nbpsc / 2;if(s < 1) { s = 1; }/** We shall denote by k the index of the coded bit before the first permutation; i shall be the index after the first and * before the second permutation, and j shall be the index after the second permutation, just prior to modulation * mapping. * k表示最初始的bit顺序* i表示经过第一次interleaving后的bit顺序* j表示经过第二次interleaving后的bit顺序* The function floor (.) denotes the largest integer not exceeding the parameter*///first permutation// i= (Ncbps / 16) (k mod 16)+floor(k/16)    k=0,1,...Ncbps-1for(k = 0; k < Ncbps; k++){i = (Ncbps / 16) * (k % 16) + k / 16;if(i >= Ncbps){err("i = %d\n", i);continue;}///printf("k = %d,i = %d;\n",k,i);mdat[i] = BIT(indat[k / 8], k % 8);}//second permutationmemset(indat, 0, inlen);// j= s * floor(i/s)+(i+NCBPs-floor(16*i/Ncbps)) mod s  i=0,1,...Ncbps-1for(i = 0; i < Ncbps; i++){j = s * (i / s) + (i + Ncbps - (16 * i) / Ncbps) % s;if(j >= Ncbps){err("j = %d\n", j);continue;}///printf("i = %d,j = %d;\n",i,j);indat[j / 8] |= (mdat[i] << (j % 8));}return;}

0 0
原创粉丝点击