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-1
for(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 permutation
memset(indat, 0, inlen);
// j= s * floor(i/s)+(i+NCBPs-floor(16*i/Ncbps)) mod s i=0,1,...Ncbps-1
for(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;
}
19.4.6.6.5 Data interleaving
最新推荐文章于 2023-07-21 18:11:14 发布