complex DSP vector API

If you have a simple question and just want an answer.
Post Reply
woodsb
Experienced Member
Posts: 79
Joined: Thu Nov 17, 2016 11:24 pm

complex DSP vector API

Post by woodsb »

Hello:

The portion of the dsp_vector library that treats complex arithmetic requires real and imaginary parts in separate vectors. Yet the library's FFT provides real and imaginary parts as elements of a structure, making the two libraries, in a sense, incompatible. For instance, if I've read it correctly, a response to a related question (http://www.xcore.com/viewtopic.php?f=47 ... tor#p26517) suggests that users write their own routines for the dsp_vector library functions for this very reason.

I imagine almost all complex DSP is done on the results of FFTs, so am surprised these two libraries are not compatible.

Am I missing something? Is there an easy way to use these two libraries together? If not, any plans to make this possible?

Thanks,
Bill


RitchRock
XCore Addict
Posts: 186
Joined: Tue Jan 17, 2017 9:25 pm

Post by RitchRock »

I think you might be looking for dsp_fft_forward.

Code: Select all

/** This function computes a forward FFT. The complex input signal is
 * supplied in an array of real and imaginary fixed-point values.
 * The same array is also used to store the output.
 * The magnitude of the FFT output is right shifted log2(N) times which corresponds to
 * division by N as shown in EQUATION 31-5 of ``http://www.dspguide.com/CH31.PDF``.
 * The number of points must be a power of 2, and the array of sine values should contain a quarter sine-wave.
 * Use one of the dsp_sine_N tables. The function does not perform bit reversed indexing of the input data.
 * If required then dsp_fft_bit_reverse() should be called beforehand.
 *
 * \param[in,out] pts   Array of dsp_complex_t elements.
 * \param[in]     N     Number of points. Must be a power of two.
 * \param[in]     sine  Array of N/4+1 sine values, each represented as a sign bit,
 *                      and a 31 bit fraction. 1 should be represented as 0x7fffffff.
 *                      Arrays are provided in dsp_tables.c; for example, for a 1024 point
 *                      FFT use dsp_sine_1024.
 */
void dsp_fft_forward (
    dsp_complex_t pts[],
    const uint32_t        N,
    const int32_t         sine[] );
RitchRock
XCore Addict
Posts: 186
Joined: Tue Jan 17, 2017 9:25 pm

Post by RitchRock »

Have a look at this thread I started - it may put you in the right direction in terms of the best way to do the multiplication.
http://www.xcore.com/viewtopic.php?p=31290#p31290
woodsb
Experienced Member
Posts: 79
Joined: Thu Nov 17, 2016 11:24 pm

Post by woodsb »

Thanks for the response, RitchRock. I may not have been clear in my original post, however.

Rather than asking how to write my own code to cover the functionality of the dsp_vector library, I was asking if I was missing a way to interface the dsp_vector and FFT functionality, and, if not, were there any plans to create one.

I asked because, though I have written the covering code (e.g., the complex-vector multiplication), I don't think it is as efficient as a library generated by XMOS.

cheers,
Bill
Post Reply