/// <summary>Swaps the I and Q channels in the array of data.</summary> /// <param name="buffer">The buffer.</param> /// <param name="floatOffset">The offset to the first floating point value to convert.</param> /// <param name="complexCount">The number of complex values to convert.</param> public static void SwapIQ(float[] buffer, int floatOffset, int complexCount) { fixed(float *pBuf = buffer) { Complex32 *pDst = (Complex32 *)(pBuf + floatOffset); for (int sample = 0; sample < complexCount; sample++, pDst++) { *pDst = new Complex32((*pDst).Imaginary, (*pDst).Real); } } }
/// <summary>Convert data format.</summary> /// <param name="source">The source array.</param> /// <param name="srcOffset">The offset to the first value in the source array.</param> /// <param name="destination">The destination array.</param> /// <param name="dstOffset">The offset to the first value in the destination array.</param> /// <param name="dstStride">The stride in the destination array.</param> /// <param name="complexCount">The number of the complex values to output.</param> public static void ComplexToStrided(Complex32[] source, int srcOffset, float[] destination, int dstOffset, int dstStride, int complexCount) { fixed(Complex32 *pSrc = source) fixed(float *pDst = destination) { Complex32 *src = pSrc + srcOffset; float * dst = pDst + dstOffset; for (int i = 0; i < complexCount; i++, src++, dst += dstStride) { *(Complex32 *)dst = *src; } } }
//float[] to Complex32[] /// <summary>Unpacks complex values from the array of floats.</summary> /// <param name="source">The source array.</param> /// <param name="srcOffset">The offset to the first value in the source array.</param> /// <param name="srcStride">The stride in the source array.</param> /// <param name="destination">The destination array.</param> /// <param name="dstOffset">The offset to the first value in the destination array.</param> /// <param name="complexCount">The number of the complex values to output.</param> public static void StridedToComplex(float[] source, int srcOffset, int srcStride, Complex32[] destination, int dstOffset, int complexCount) { fixed(float *pSrc = source) fixed(Complex32 * pDst = destination) { float * src = pSrc + srcOffset; Complex32 *dst = pDst + dstOffset; for (int i = 0; i < complexCount; i++, src += srcStride, dst++) { *dst = *(Complex32 *)src; } } }
public static extern IppStatus ippsFIRSRInit_32fc(Complex32 *pTaps, int tapsLen, IppAlgType algType, IppsFIRSpec_32fc *pSpec);
public static extern IppStatus ippsFIRMR_32fc(Complex32 *pSrc, Complex32 *pDst, int numIters, IppsFIRSpec_32fc *pSpec, Complex32 *pDlySrc, Complex32 *pDlyDst, byte *pBuf);
public static extern IppStatus ippsFIRMRInit_32fc(Complex32 *pTaps, int tapsLen, int upFactor, int upPhase, int downFactor, int downPhase, IppsFIRSpec_32fc *pSpec);