Texas Instruments TMS320C64X Security Camera User Manual


 
DSP_bitrev_cplx
4-91 C64x+ DSPLIB Reference
int nbits, nbot, ntop, ndiff, n2, halfn;
short *xs = (short *) x;
nbits = 0;
i = nx;
while (i > 1){
i = i >> 1;
nbits++;}
nbot = nbits >> 1;
ndiff = nbits & 1;
ntop = nbot + ndiff;
n2 = 1 << ntop;
mask = n2 − 1;
halfn = nx >> 1;
for (i0 = 0; i0 < halfn; i0 += 2) {
b = i0 & mask;
a = i0 >> nbot;
if (!b) ia = index[a];
ib = index[b];
ibs = ib << nbot;
j0 = ibs + ia;
t = i0 < j0;
xi0 = x[i0];
xj0 = x[j0];
if (t){x[i0] = xj0;
x[j0] = xi0;}
i1 = i0 + 1;
j1 = j0 + halfn;
xi1 = x[i1];
xj1 = x[j1];
x[i1] = xj1;
x[j1] = xi1;
i3 = i1 + halfn;
j3 = j1 + 1;
xi3 = x[i3];
xj3 = x[j3];