• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1  /*
2   *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
3   *
4   *  Use of this source code is governed by a BSD-style license
5   *  that can be found in the LICENSE file in the root of the source
6   *  tree. An additional intellectual property rights grant can be found
7   *  in the file PATENTS.  All contributing project authors may
8   *  be found in the AUTHORS file in the root of the source tree.
9   */
10  
11  
12  /*
13   * This file contains the function WebRtcSpl_ComplexBitReverse().
14   * The description header can be found in signal_processing_library.h
15   *
16   */
17  
18  #include "signal_processing_library.h"
19  
WebRtcSpl_ComplexBitReverse(WebRtc_Word16 frfi[],int stages)20  void WebRtcSpl_ComplexBitReverse(WebRtc_Word16 frfi[], int stages)
21  {
22      int mr, nn, n, l, m;
23      WebRtc_Word16 tr, ti;
24  
25      n = 1 << stages;
26  
27      mr = 0;
28      nn = n - 1;
29  
30      // decimation in time - re-order data
31      for (m = 1; m <= nn; ++m)
32      {
33          l = n;
34          do
35          {
36              l >>= 1;
37          } while (mr + l > nn);
38          mr = (mr & (l - 1)) + l;
39  
40          if (mr <= m)
41              continue;
42  
43          tr = frfi[2 * m];
44          frfi[2 * m] = frfi[2 * mr];
45          frfi[2 * mr] = tr;
46  
47          ti = frfi[2 * m + 1];
48          frfi[2 * m + 1] = frfi[2 * mr + 1];
49          frfi[2 * mr + 1] = ti;
50      }
51  }
52