SHARE
TWEET

Untitled

a guest Dec 2nd, 2012 111 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.     if ((n % 2) == 0) {
  7.         memmove(inp + n*interp - n/2, inp + n/2,     n/2*sizeof(cfloat_t));
  8.         memset (inp + n/2 + 1, 0,       (n*(interp-1)-1)*sizeof(cfloat_t)); // Duplicate Fs/2 so we need one less zero
  9.        
  10.         inp[n/2]          /= 2.0;
  11.         inp[n*interp-n/2] /= 2.0;
  12.     } else {
  13.         memmove(inp + n*interp - n/2, inp + (n+1)/2, n/2*sizeof(cfloat_t));
  14.         memset (inp + (n+1)/2, 0,         (n*(interp-1))*sizeof(cfloat_t));
  15.     }
  16. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top