Advertisement
Guest User

Untitled

a guest
Dec 2nd, 2012
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. // Copy negative frequency components to end of buffer and zero out middle
  2. //  inp    - input buffer of complex floats
  3. //    n    - transform size
  4. //  interp - interpolation amount
  5. void zero_pad_freq(cfloat_t *inp, size_t n, size_t interp) {
  6.     memmove(inp + n*interp - n/2, inp + (n+1)/2, (n+1)/2*sizeof(cfloat_t));
  7.     memset (inp + n/2 + 1, 0,           (n*(interp-1)-1)*sizeof(cfloat_t));
  8.    
  9.     if (n % 2 == 0) {
  10.         inp[n/2]          /= 2.0;
  11.         inp[n*interp-n/2]  = conj(inp[n/2])/2.0;
  12.     }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement