Bit Reverse Complex Library

mikroPascal PRO for PIC32 includes a Bit Reverse Complex Library for DSP engine. All routines work with fractional Q15 format.

Library Routines

BitReverseComplex

Prototype

procedure BitReverseComplex(indata : ^integer; log2N : word);

Description

This function does Complex (in-place) Bit Reverse re-organization.

Parameters
  • indata: pointer to the input complex array.
  • log2N: logarithm with the base 2 of the number of input complex pairs.
Returns

Nothing.

Requires

Nothing.

Example
program BitReverseComp;

// 8 pairs of [Re, Im] values
var   inputSamples : array[16] of integer;// { 0x4000, 0, 0x4000, 0, 0x4000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0};
      log2N        : word;
// Twiddle factors for 8 pairs complex input values.
const Wn           : array[8] of integer = (0x7fff,0, 0x5A82, integer(0xA57E), 0, integer(0x8000), integer(0xA57E), integer(0xA57E));

procedure Init();
  begin
    inputSamples[0] := 0x4000;
    inputSamples[1] := 0;
    inputSamples[2] := 0x4000;
    inputSamples[3] := 0;
    inputSamples[4] := 0x4000;
    inputSamples[5] := 0;
    inputSamples[6] := 0;
    inputSamples[7] := 0;
    inputSamples[8] := 0;
    inputSamples[9] := 0;
    inputSamples[10] := 0;
    inputSamples[11] := 0;
    inputSamples[12] := 0;
    inputSamples[13] := 0;
    inputSamples[14] := 0;
    inputSamples[15] := 0;
    log2N := 3;
  end;

begin
  Init();
  FFT(@inputSamples, @Wn, log2N);
  BitReverseComplex(@inputSamples, log2N);
end.
Notes

None.

Copyright (c) 2002-2012 mikroElektronika. All rights reserved.
What do you think about this topic ? Send us feedback!
Want more examples and libraries? 
Find them on LibStock - A place for the code