| 37 | } |
| 38 | |
| 39 | float SpecPowerCalculation::CalcPower(float* sig, float fc, float bw) |
| 40 | { |
| 41 | float pwr; |
| 42 | int loBin, hiBin; |
| 43 | |
| 44 | // Given the bandwidth bw, get the boundary bin numbers |
| 45 | loBin = Freq2Bin(fc - (bw / 2.0f)); |
| 46 | hiBin = Freq2Bin(fc + (bw / 2.0f)); |
| 47 | if (loBin == hiBin) |
| 48 | { |
| 49 | hiBin = loBin + 1; |
| 50 | } |
| 51 | |
| 52 | // Calc the FFT |
| 53 | FFT(mSigLen, 0, sig, mSigI.get(), mSigFR.get(), mSigFI.get()); |
| 54 | |
| 55 | // Calc the in-band power |
| 56 | pwr = CalcBinPower(mSigFR.get(), mSigFI.get(), loBin, hiBin); |
| 57 | |
| 58 | return pwr; |
| 59 | } |
| 60 | |
| 61 | float SpecPowerCalculation::CalcBinPower(float* sig_f_r, float* sig_f_i, int loBin, int hiBin) |
| 62 | { |