/*----------------------------------------------------------------------------*/ BOOL glBusInit ( PVOID pvData ) { #if DBG initTrig(); #endif /* 1. initialize eHPI control registers */ collibri_ehpi_reg_init(); /* 2. memory remapping for MT5931 */ mt5931_ehpi_reg_init(); return TRUE; };
void twiddleTransf(int sofarRadix, int radix, int remainRadix, double yRe[], double yIm[]) { /* twiddleTransf */ double cosw, sinw, gem; double t1_re,t1_im, t2_re,t2_im, t3_re,t3_im; double t4_re,t4_im, t5_re,t5_im; double m2_re,m2_im, m3_re,m3_im, m4_re,m4_im; double m1_re,m1_im, m5_re,m5_im; double s1_re,s1_im, s2_re,s2_im, s3_re,s3_im; double s4_re,s4_im, s5_re,s5_im; initTrig(radix); omega = 2*pi/(double)(sofarRadix*radix); cosw = cos(omega); sinw = -sin(omega); tw_re = 1.0; tw_im = 0; dataOffset=0; groupOffset=dataOffset; adr=groupOffset; for (dataNo=0; dataNo<sofarRadix; dataNo++) { if (sofarRadix>1) { twiddleRe[0] = 1.0; twiddleIm[0] = 0.0; twiddleRe[1] = tw_re; twiddleIm[1] = tw_im; for (twNo=2; twNo<radix; twNo++) { twiddleRe[twNo]=tw_re*twiddleRe[twNo-1] - tw_im*twiddleIm[twNo-1]; twiddleIm[twNo]=tw_im*twiddleRe[twNo-1] + tw_re*twiddleIm[twNo-1]; } gem = cosw*tw_re - sinw*tw_im; tw_im = sinw*tw_re + cosw*tw_im; tw_re = gem; } for (groupNo=0; groupNo<remainRadix; groupNo++) { if ((sofarRadix>1) && (dataNo > 0)) { zRe[0]=yRe[adr]; zIm[0]=yIm[adr]; blockNo=1; do { adr = adr + sofarRadix; zRe[blockNo]= twiddleRe[blockNo] * yRe[adr] - twiddleIm[blockNo] * yIm[adr]; zIm[blockNo]= twiddleRe[blockNo] * yIm[adr] + twiddleIm[blockNo] * yRe[adr]; blockNo++; } while (blockNo < radix); } else for (blockNo=0; blockNo<radix; blockNo++) { zRe[blockNo]=yRe[adr]; zIm[blockNo]=yIm[adr]; adr=adr+sofarRadix; } switch(radix) { case 2 : gem=zRe[0] + zRe[1]; zRe[1]=zRe[0] - zRe[1]; zRe[0]=gem; gem=zIm[0] + zIm[1]; zIm[1]=zIm[0] - zIm[1]; zIm[0]=gem; break; case 3 : t1_re=zRe[1] + zRe[2]; t1_im=zIm[1] + zIm[2]; zRe[0]=zRe[0] + t1_re; zIm[0]=zIm[0] + t1_im; m1_re=c3_1*t1_re; m1_im=c3_1*t1_im; m2_re=c3_2*(zIm[1] - zIm[2]); m2_im=c3_2*(zRe[2] - zRe[1]); s1_re=zRe[0] + m1_re; s1_im=zIm[0] + m1_im; zRe[1]=s1_re + m2_re; zIm[1]=s1_im + m2_im; zRe[2]=s1_re - m2_re; zIm[2]=s1_im - m2_im; break; case 4 : t1_re=zRe[0] + zRe[2]; t1_im=zIm[0] + zIm[2]; t2_re=zRe[1] + zRe[3]; t2_im=zIm[1] + zIm[3]; m2_re=zRe[0] - zRe[2]; m2_im=zIm[0] - zIm[2]; m3_re=zIm[1] - zIm[3]; m3_im=zRe[3] - zRe[1]; zRe[0]=t1_re + t2_re; zIm[0]=t1_im + t2_im; zRe[2]=t1_re - t2_re; zIm[2]=t1_im - t2_im; zRe[1]=m2_re + m3_re; zIm[1]=m2_im + m3_im; zRe[3]=m2_re - m3_re; zIm[3]=m2_im - m3_im; break; case 5 : t1_re=zRe[1] + zRe[4]; t1_im=zIm[1] + zIm[4]; t2_re=zRe[2] + zRe[3]; t2_im=zIm[2] + zIm[3]; t3_re=zRe[1] - zRe[4]; t3_im=zIm[1] - zIm[4]; t4_re=zRe[3] - zRe[2]; t4_im=zIm[3] - zIm[2]; t5_re=t1_re + t2_re; t5_im=t1_im + t2_im; zRe[0]=zRe[0] + t5_re; zIm[0]=zIm[0] + t5_im; m1_re=c5_1*t5_re; m1_im=c5_1*t5_im; m2_re=c5_2*(t1_re - t2_re); m2_im=c5_2*(t1_im - t2_im); m3_re=-c5_3*(t3_im + t4_im); m3_im=c5_3*(t3_re + t4_re); m4_re=-c5_4*t4_im; m4_im=c5_4*t4_re; m5_re=-c5_5*t3_im; m5_im=c5_5*t3_re; s3_re=m3_re - m4_re; s3_im=m3_im - m4_im; s5_re=m3_re + m5_re; s5_im=m3_im + m5_im; s1_re=zRe[0] + m1_re; s1_im=zIm[0] + m1_im; s2_re=s1_re + m2_re; s2_im=s1_im + m2_im; s4_re=s1_re - m2_re; s4_im=s1_im - m2_im; zRe[1]=s2_re + s3_re; zIm[1]=s2_im + s3_im; zRe[2]=s4_re + s5_re; zIm[2]=s4_im + s5_im; zRe[3]=s4_re - s5_re; zIm[3]=s4_im - s5_im; zRe[4]=s2_re - s3_re; zIm[4]=s2_im - s3_im; break; case 8 : fft_8(); break; case 10 : fft_10(); break; default : fft_odd(radix); break; } adr=groupOffset; for (blockNo=0; blockNo<radix; blockNo++) { yRe[adr]=zRe[blockNo]; yIm[adr]=zIm[blockNo]; adr=adr+sofarRadix; } groupOffset=groupOffset+sofarRadix*radix; adr=groupOffset; } dataOffset=dataOffset+1; groupOffset=dataOffset; adr=groupOffset; } } /* twiddleTransf */
void twiddleTransf(int sofarRadix, int radix, int remainRadix, T3 yRe[], T4 yIm[]) { /* twiddleTransf */ double cosw, sinw, gem; initTrig(radix); omega = 2*M_PI/(double)(sofarRadix*radix); cosw = cos(omega); sinw = -sin(omega); tw_re = 1.0; tw_im = 0; dataOffset=0; groupOffset=dataOffset; adr=groupOffset; for (dataNo=0; dataNo<sofarRadix; dataNo++) { if (sofarRadix>1) { twiddleRe[0] = 1.0; twiddleIm[0] = 0.0; twiddleRe[1] = tw_re; twiddleIm[1] = tw_im; for (twNo=2; twNo<radix; twNo++) { twiddleRe[twNo]=tw_re*twiddleRe[twNo-1] - tw_im*twiddleIm[twNo-1]; twiddleIm[twNo]=tw_im*twiddleRe[twNo-1] + tw_re*twiddleIm[twNo-1]; } gem = cosw*tw_re - sinw*tw_im; tw_im = sinw*tw_re + cosw*tw_im; tw_re = gem; } for (groupNo=0; groupNo<remainRadix; groupNo++) { if ((sofarRadix>1) && (dataNo > 0)) { zRe[0]=yRe[adr]; zIm[0]=yIm[adr]; blockNo=1; do { adr = adr + sofarRadix; zRe[blockNo]= twiddleRe[blockNo] * yRe[adr] - twiddleIm[blockNo] * yIm[adr]; zIm[blockNo]= twiddleRe[blockNo] * yIm[adr] + twiddleIm[blockNo] * yRe[adr]; blockNo++; } while (blockNo < radix); } else for (blockNo=0; blockNo<radix; blockNo++) { zRe[blockNo]=yRe[adr]; zIm[blockNo]=yIm[adr]; adr=adr+sofarRadix; } switch(radix) { // T.Grill - replaced the inlined code by their function counterparts case 2 : fft_2(zRe,zIm); break; case 3 : fft_3(zRe,zIm); break; case 4 : fft_4(zRe,zIm); break; case 5 : fft_5(zRe,zIm); break; case 8 : fft_8(); break; case 10 : fft_10(); break; default : fft_odd(radix); break; } adr=groupOffset; for (blockNo=0; blockNo<radix; blockNo++) { yRe[adr]=zRe[blockNo]; yIm[adr]=zIm[blockNo]; adr=adr+sofarRadix; } groupOffset=groupOffset+sofarRadix*radix; adr=groupOffset; } dataOffset=dataOffset+1; groupOffset=dataOffset; adr=groupOffset; } } /* twiddleTransf */