dsp_fft16x16r.h

来自「dm642函数库」· C头文件 代码 · 共 702 行 · 第 1/4 页

H
702
字号
/*                                                                           */
/*                 xh0  = x_0    + x_l1;                                     */
/*                 xh1  = x_1    + x_l1p1;                                   */
/*                 xl0  = x_0    - x_l1;                                     */
/*                 xl1  = x_1    - x_l1p1;                                   */
/*                                                                           */
/*                 xh20 = x_h2   + x_l2;                                     */
/*                 xh21 = x_h2p1 + x_l2p1;                                   */
/*                 xl20 = x_h2   - x_l2;                                     */
/*                 xl21 = x_h2p1 - x_l2p1;                                   */
/*                                                                           */
/*                 ptr_x0 = x;                                               */
/*                 ptr_x0[0] = ((short) (xh0 + xh20))>>1; can be changed to  */
/*                 ptr_x0[1] = ((short) (xh1 + xh21))>>1; can be changed to  */
/*                                                                           */
/*                 ptr_x2 = ptr_x0;                                          */
/*                 x += 2;                                                   */
/*                 j += 6;                                                   */
/*                 predj = (j - fft_jmp);                                    */
/*                 if (!predj) x += fft_jmp;                                 */
/*                 if (!predj) j = 0;                                        */
/*                                                                           */
/*                 xt0 = xh0 - xh20;                                         */
/*                 yt0 = xh1 - xh21;                                         */
/*                 xt1 = xl0 + xl21;                                         */
/*                 yt2 = xl1 + xl20;                                         */
/*                 xt2 = xl0 - xl21;                                         */
/*                 yt1 = xl1 - xl20;                                         */
/*                                                                           */
/*                 ptr_x2[l1  ] = (xt1 * co1 + yt1 * si1 + 0x8000)>>16;      */
/*                 ptr_x2[l1+1] = (yt1 * co1 - xt1 * si1 + 0x8000)>>16;      */
/*                 ptr_x2[h2  ] = (xt0 * co2 + yt0 * si2 + 0x8000)>>16;      */
/*                 ptr_x2[h2+1] = (yt0 * co2 - xt0 * si2 + 0x8000)>>16;      */
/*                 ptr_x2[l2  ] = (xt2 * co3 + yt2 * si3 + 0x8000)>>16;      */
/*                 ptr_x2[l2+1] = (yt2 * co3 - xt2 * si3 + 0x8000)>>16;      */
/*             }                                                             */
/*             tw_offset += fft_jmp;                                         */
/*             stride = stride>>2;                                           */
/*         }-* end while *-                                                  */
/*                                                                           */
/*         j = offset>>2;                                                    */
/*                                                                           */
/*         ptr_x0 = ptr_x;                                                   */
/*         y0 = ptr_y;                                                       */
/*         l0 = _norm(nmax) - 17; -* get size of fft *-                      */
/*                                                                           */
/*         if (radix <= 4) for (i = 0; i < n; i += 4)                        */
/*         {                                                                 */
/*                 -* reversal computation *-                                */
/*                                                                           */
/*                 j0 = (j     ) & 0x3F;                                     */
/*                 j1 = (j >> 6) & 0x3F;                                     */
/*                 k0 = brev[j0];                                            */
/*                 k1 = brev[j1];                                            */
/*                 k = (k0 << 6) |  k1;                                      */
/*                 k = k >> l0;                                              */
/*                 j++;        -* multiple of 4 index *-                     */
/*                                                                           */
/*                 x0   = ptr_x0[0];  x1 = ptr_x0[1];                        */
/*                 x2   = ptr_x0[2];  x3 = ptr_x0[3];                        */
/*                 x4   = ptr_x0[4];  x5 = ptr_x0[5];                        */
/*                 x6   = ptr_x0[6];  x7 = ptr_x0[7];                        */
/*                 ptr_x0 += 8;                                              */
/*                                                                           */
/*                 xh0_0  = x0 + x4;                                         */
/*                 xh1_0  = x1 + x5;                                         */
/*                 xh0_1  = x2 + x6;                                         */
/*                 xh1_1  = x3 + x7;                                         */
/*                                                                           */
/*                 if (radix == 2) {                                         */
/*                   xh0_0 = x0;                                             */
/*                   xh1_0 = x1;                                             */
/*                   xh0_1 = x2;                                             */
/*                   xh1_1 = x3;                                             */
/*                 }                                                         */
/*                                                                           */
/*                 yt0  = xh0_0 + xh0_1;                                     */
/*                 yt1  = xh1_0 + xh1_1;                                     */
/*                 yt4  = xh0_0 - xh0_1;                                     */
/*                 yt5  = xh1_0 - xh1_1;                                     */
/*                                                                           */
/*                 xl0_0  = x0 - x4;                                         */
/*                 xl1_0  = x1 - x5;                                         */
/*                 xl0_1  = x2 - x6;                                         */
/*                 xl1_1  = x3 - x7;                                         */
/*                                                                           */
/*                 if (radix == 2) {                                         */
/*                   xl0_0 = x4;                                             */
/*                   xl1_0 = x5;                                             */
/*                   xl1_1 = x6;                                             */
/*                   xl0_1 = x7;                                             */
/*                 }                                                         */
/*                                                                           */
/*                 yt2  = xl0_0 + xl1_1;                                     */
/*                 yt3  = xl1_0 - xl0_1;                                     */
/*                 yt6  = xl0_0 - xl1_1;                                     */
/*                 yt7  = xl1_0 + xl0_1;                                     */
/*                                                                           */
/*                 if (radix == 2) {                                         */
/*                   yt7  = xl1_0 - xl0_1;                                   */
/*                   yt3  = xl1_0 + xl0_1;                                   */
/*                 }                                                         */
/*                                                                           */
/*                 y0[k] = yt0; y0[k+1] = yt1;                               */
/*                 k += n>>1;                                                */
/*                 y0[k] = yt2; y0[k+1] = yt3;                               */
/*                 k += n>>1;                                                */
/*                 y0[k] = yt4; y0[k+1] = yt5;                               */
/*                 k += n>>1;                                                */
/*                 y0[k] = yt6; y0[k+1] = yt7;                               */
/*         }                                                                 */
/*     }                                                                     */
/*                                                                           */
/*  REFERENCES                                                               */
/*  [1] C. S. Burrus and T.W. Parks (1985) "DFT/FFT and Convolution Algos -  */
/*      Theory and Implementation", J. Wiley.                                */
/*  [2] Implementation of Various Precision Fast Fourier Transforms on the   */
/*      TMS320C6400 processor - DJH, ESC 2000                                */
/*  [3] Burrus - Rice University and Papamichalis - TI (1988) - Paper on the */
/*      convertion of radix4 to radix2 digit reversal.                       */
/*                                                                           */
/*  SPECIAL NOTES                                                            */
/*  1. Complex multiplies are performed using _dotp2 and _dotpn2. _dotpn2    */
/*  requires the data to be swizzled about the halfword, so that an extra    */
/*  negate can be avoided.                                                   */
/*  2. The intermediate adds and subtracts are performed using _add2's,      */
/*  _sub2's.                                                                 */
/*  3. Data is loaded in using the intrinsic _amemd8 as a double word, and   */
/*  the low and high halves are accessed using _lo and _hi intrinsic.        */
/*  4. Middle two legs of radix4 butterfly are swapped to get intermediate   */
/*  outputs in bit reversed order. Final output in the output array "y" is   */
/*  in normal order.                                                         */
/*                                                                           */
/* CYCLES                                                                    */
/*     Cycle count formula is  for single pass only.                         */
/*     ceil(log4(N) - 1) * (5 * N/4 + 25) + 5 * N/4 + 26                     */
/*                                                                           */
/*     N = 128  cycles = 756  cycles    Single pass                          */
/*     N = 128  cycles = 1041 cycles    Multi  pass                          */
/*     N = 256  cycles = 1383 cycles    Single pass                          */
/*     N = 256  cycles = 1683 cycles    Multi  pass                          */
/*     N = 512  cycles = 3337 cycles    Single pass                          */
/*     N = 512  cycles = 3699 cycles    Multi  pass                          */
/*                                                                           */
/* CODESIZE                                                                  */
/*     856 bytes                                                             */
/*                                                                           */
/*==========================================================================S*/
/*            Copyright (c) 2003 Texas Instruments, Incorporated.           */
/*                           All Rights Reserved.                           */
/*==========================================================================S*/
#ifndef DSP_FFT16X16R_H_
#define DSP_FFT16X16R_H_ 1

void DSP_fft16x16r
(
    int                       n,
    short *restrict           ptr_x,
    const short *restrict     ptr_w,
    unsigned char *restrict   brev,
    short *restrict           ptr_y,
    int                       radix,
    int                       offset,
    int                       nmax
);

#endif
/* ======================================================================== */
/*  End of file:  dsp_fft16x16r.h                                           */
/* ------------------------------------------------------------------------ */
/*            Copyright (c) 2003 Texas Instruments, Incorporated.           */
/*                           All Rights Reserved.                           */
/* ======================================================================== */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?