亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ffts.pas

?? fft源代碼
?? PAS
?? 第 1 頁 / 共 2 頁
字號:
{ Unit FFTs

  This unit provides a forward and inverse FFT pascal implementation
  for complex number series.

  The formal definition of the complex DFT is:
    y[k] = sum(x[m]*exp(-i*2*pi*k*m/n), m = 0..n-1), k = 0..n-1

  Copyright: Nils Haeck M.Sc. (email: n.haeck@simdesign.nl)
  For more information visit http://www.simdesign.nl
  Original date of publication: 10 Mar 2003

  This unit requires these other units:
  - Complexs: Complex number unit
  - Types:    Additional mathematical variable types
  - SysUtils: Delphi system utilities

  ****************************************************************

  The contents of this file are subject to the Mozilla Public
  License Version 1.1 (the "License"); you may not use this file
  except in compliance with the License. You may obtain a copy of
  the License at:
  http://www.mozilla.org/MPL/

  Software distributed under the License is distributed on an
  "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  implied. See the License for the specific language governing
  rights and limitations under the License.
}
unit FFTs;

interface

uses
  Complexs, Types, SysUtils;

const

  cMaxPrimeFactor     = 1021;
  cMaxPrimeFactorDiv2 = (cMaxPrimeFactor + 1) div 2;
  cMaxFactorCount     = 20;

resourcestring

  sErrPrimeTooLarge = 'Prime factor for FFT length too large. Change value for cMaxPrimeFactor in FFTs unit';

{ ForwardFFT:
  Perform a complex FFT on the data in Source, put result in Dest. This routine
  works best for Count as a power of 2, but also works usually faster than DFT
  by factoring the series. Only in cases where Count is a prime number will this
  method be identical to regular complex DFT.

  The largest prime factor in Count should be less or equal to cMaxPrimeFactor.

  The remaining factors are handled by optimised partial FFT code, that can be
  found in the FFT_X procedures

  Inputs:
    Source: this can be any zero-based array type of TComplex
    Count: The number of elements in the array.

  Outputs:
    Dest: this can be any zero-based array type of TComplex, and will contain
      the FFT transformed data (frequency spectrum). Source may be equal to
      Dest. In this case, the original series will be overwritten with the new
      fourier-transformed series.
}
procedure ForwardFFT(const Source: array of TComplex; var Dest: array of TComplex; Count: integer);

{ Perform the inverse FFT on the Source data, and put result in Dest. This is based
  on the forward FFT with some additional customisation. The result of a forward
  FFT followed by an inverse FFT should yield the same data, except for rounding
  errors.
}
procedure InverseFFT(const Source: array of TComplex; var Dest: array of TComplex; Count: integer);

implementation

const
  // Some helper constants for the FFT optimisations
  c31: TFloat = -1.5000000000000E+00; //  cos(2*pi / 3) - 1;
  c32: TFloat =  8.6602540378444E-01; //  sin(2*pi / 3);

  u5:  TFloat =  1.2566370614359E+00; //  2*pi / 5;
  c51: TFloat = -1.2500000000000E+00; // (cos(u5) + cos(2*u5))/2 - 1;
  c52: TFloat =  5.5901699437495E-01; // (cos(u5) - cos(2*u5))/2;
  c53: TFloat = -9.5105651629515E-01; //- sin(u5);
  c54: TFloat = -1.5388417685876E+00; //-(sin(u5) + sin(2*u5));
  c55: TFloat =  3.6327126400268E-01; // (sin(u5) - sin(2*u5));
  c8:  TFloat =  7.0710678118655E-01; //  1 / sqrt(2);

type
  // Base 1 and Base 0 arrays
  TIdx0FactorArray = array[0..cMaxFactorCount] of integer;
  TIdx1FactorArray = array[1..cMaxFactorCount] of integer;

// Factorise the series with length Count into FactorCount factors, stored in Fact
procedure Factorize(Count: integer; var FactorCount: integer; var Fact: TIdx1FactorArray);
var
  i: integer;
  Factors: TIdx1FactorArray;
const
  // Define specific FFT lengths (radices) that we can process with optimised routines
  cRadixCount = 6;
  cRadices: array[1..6] of integer =
    (2, 3, 4, 5, 8, 10);
begin

  if Count = 1 then begin
    FactorCount := 1;
    Factors[1]  := 1;
  end else begin
    FactorCount := 0;
  end;

  // Factorise the original series length Count into known factors and rest value
  i := cRadixCount;
  while (Count > 1) AND (i > 0) do begin
    if Count mod cRadices[i] = 0 then begin
      Count := Count div cRadices[i];
      inc(FactorCount);
      Factors[FactorCount] := cRadices[i];
    end else
      dec(i);
  end;

  // substitute factors 2*8 with more optimal 4*4
  if Factors[FactorCount] = 2 then begin
    i := FactorCount - 1;
    while (i > 0) AND (Factors[i] <> 8) do
      dec(i);
    if i > 0 then begin
      Factors[FactorCount] := 4;
      Factors[i] := 4;
    end;
  end;

  // Analyse the rest value and see if it can be factored in primes
  if Count > 1 then begin
    for i := 2 to trunc(sqrt(Count)) do begin
      while Count mod i = 0 do begin
        Count := Count div i;
        inc(FactorCount);
        Factors[FactorCount] := i;
      end;
    end;

    if (Count > 1) then begin
      inc(FactorCount);
      Factors[FactorCount] := Count;
    end;
  end;

  // Reverse factors so that primes are first
  for i := 1 to FactorCount do
    Fact[i] := Factors[FactorCount - i + 1];

end;

{ Reorder the series in X to a permuted sequence in Y so that the later step can
  be done in place, and the final FFT result is in correct order.
  The series X and Y must be different series!
}
procedure ReorderSeries(Count: integer; var Factors: TIdx1FactorArray; var Remain: TIdx0FactorArray;
  const X: array of TComplex; var Y: array of TComplex);
var
  i, j, k: integer;
  Counts: TIdx1FactorArray;
begin
  FillChar(Counts, SizeOf(Counts), 0);

  k := 0;
  for i := 0 to Count - 2 do begin
    Y[i] := X[k];
    j := 1;
    k := k + Remain[j];
    Counts[1] := Counts[1] + 1;
    while Counts[j] >= Factors[j] do begin
      Counts[j] := 0;
      k := k - Remain[j - 1] + Remain[j + 1];
      inc(j);
      inc(Counts[j]);
    end;
  end;

  Y[Count - 1] := X[Count - 1];
end;

procedure FFT_2(var Z: array of TComplex);
var
  T1: TComplex;
begin
  T1   := ComplexAdd(Z[0], Z[1]);
  Z[1] := ComplexSub(Z[0], Z[1]);
  Z[0] := T1;
end;

procedure FFT_3(var Z: array of TComplex);
var
  T1, M1, M2, S1: TComplex;
begin
  T1   := ComplexAdd(Z[1], Z[2]);
  Z[0] := ComplexAdd(Z[0], T1);
  M1   := ComplexScl(c31, T1);
  M2.Re := c32 * (Z[1].Im - Z[2].Im);
  M2.Im := c32 * (Z[2].Re - Z[1].Re);
  S1   := ComplexAdd(Z[0], M1);
  Z[1] := ComplexAdd(S1, M2);
  Z[2] := ComplexSub(S1, M2);
end;

procedure FFT_4(var Z: array of TComplex);
var
  T1, T2, M2, M3: TComplex;
begin
  T1 := ComplexAdd(Z[0], Z[2]);
  T2 := ComplexAdd(Z[1], Z[3]);

  M2 := ComplexSub(Z[0], Z[2]);
  M3.Re := Z[1].Im - Z[3].Im;
  M3.Im := Z[3].Re - Z[1].Re;

  Z[0] := ComplexAdd(T1, T2);
  Z[2] := ComplexSub(T1, T2);
  Z[1] := ComplexAdd(M2, M3);
  Z[3] := ComplexSub(M2, M3);
end;

procedure FFT_5(var Z: array of TComplex);
var
  T1, T2, T3, T4, T5: TComplex;
  M1, M2, M3, M4, M5: TComplex;
  S1, S2, S3, S4, S5: TComplex;
begin
  T1 := ComplexAdd(Z[1], Z[4]);
  T2 := ComplexAdd(Z[2], Z[3]);
  T3 := ComplexSub(Z[1], Z[4]);
  T4 := ComplexSub(Z[3], Z[2]);

  T5   := ComplexAdd(T1, T2);
  Z[0] := ComplexAdd(Z[0], T5);
  M1   := ComplexScl(c51, T5);
  M2   := ComplexScl(c52, ComplexSub(T1, T2));

  M3.Re := -c53 * (T3.Im + T4.Im);
  M3.Im :=  c53 * (T3.Re + T4.Re);
  M4.Re := -c54 * T4.Im;
  M4.Im :=  c54 * T4.Re;
  M5.Re := -c55 * T3.Im;
  M5.Im :=  c55 * T3.Re;

  S3 := ComplexSub(M3, M4);
  S5 := ComplexAdd(M3, M5);;
  S1 := ComplexAdd(Z[0], M1);
  S2 := ComplexAdd(S1, M2);
  S4 := ComplexSub(S1, M2);

  Z[1] := ComplexAdd(S2, S3);
  Z[2] := ComplexAdd(S4, S5);
  Z[3] := ComplexSub(S4, S5);
  Z[4] := ComplexSub(S2, S3);
end;

procedure FFT_8(var Z: array of TComplex);
var
  A, B: array[0..3] of TComplex;
  Gem: TFloat;
begin
  A[0] := Z[0]; B[0] := Z[1];
  A[1] := Z[2]; B[1] := Z[3];
  A[2] := Z[4]; B[2] := Z[5];
  A[3] := Z[6]; B[3] := Z[7];

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91精品国产全国免费观看| 国产精品一区二区无线| 久久伊人中文字幕| 麻豆中文一区二区| 精品久久久久久久久久久久久久久久久 | 久久久美女毛片| 成a人片国产精品| 亚洲一级二级三级在线免费观看| 欧美高清视频一二三区| 精品一二线国产| 中文字幕av一区二区三区高| 91色综合久久久久婷婷| 婷婷六月综合亚洲| 国产偷国产偷亚洲高清人白洁 | 色婷婷综合五月| 日韩和欧美一区二区| 久久综合999| 99久久综合国产精品| 亚洲成人免费在线观看| 精品国产乱码久久久久久蜜臀 | 欧美老年两性高潮| 国产一区二区三区av电影| 国产精品乱码人人做人人爱| 欧美特级限制片免费在线观看| 免费成人小视频| 最新热久久免费视频| 69久久99精品久久久久婷婷| 国产精品一二一区| 亚洲五月六月丁香激情| 国产日韩影视精品| 欧美日韩国产精品自在自线| 国产一区二区久久| 午夜精品在线看| 中文字幕亚洲区| 日韩精品一区二区在线观看| 一本一道久久a久久精品综合蜜臀| 奇米一区二区三区| 亚洲综合一区二区三区| 久久精品亚洲乱码伦伦中文| 欧美日韩亚洲国产综合| 成人一级视频在线观看| 美女视频第一区二区三区免费观看网站 | 亚洲精品视频在线观看网站| 欧美大黄免费观看| 欧美无砖砖区免费| 99视频在线精品| 国产精品白丝jk黑袜喷水| 日本亚洲一区二区| 一区二区三区不卡在线观看 | 国产精一区二区三区| 亚洲成人免费在线| 有坂深雪av一区二区精品| 国产三级三级三级精品8ⅰ区| 制服.丝袜.亚洲.中文.综合| 99热这里都是精品| 国产成人在线视频免费播放| 美日韩黄色大片| 日本中文字幕不卡| 日日夜夜精品视频天天综合网| 亚洲精品日韩综合观看成人91| 国产丝袜美腿一区二区三区| 精品福利av导航| 日韩亚洲国产中文字幕欧美| 欧美美女喷水视频| 欧美日韩中文一区| 欧美在线一二三四区| 日本道色综合久久| 91久久精品一区二区三区| av在线不卡电影| www.亚洲国产| 91社区在线播放| 色婷婷久久久亚洲一区二区三区| 99久久婷婷国产精品综合| av日韩在线网站| 97精品电影院| 91久久精品一区二区三区| 91行情网站电视在线观看高清版| 91丨九色丨国产丨porny| bt7086福利一区国产| 成人午夜激情在线| 91香蕉视频mp4| 在线亚洲人成电影网站色www| 色香蕉久久蜜桃| 欧美日韩日日夜夜| 日韩美女一区二区三区| 精品成a人在线观看| 久久亚洲二区三区| 国产精品美女视频| 亚洲免费在线电影| 午夜精品国产更新| 免费成人在线观看视频| 国产精品一区二区三区99| 粉嫩一区二区三区性色av| 91女神在线视频| 欧美日韩一区二区在线观看| 欧美一二三四区在线| 精品成人在线观看| 国产精品不卡在线观看| 亚洲大尺度视频在线观看| 蜜臀av亚洲一区中文字幕| 国产一区亚洲一区| 91社区在线播放| 日韩三级伦理片妻子的秘密按摩| 久久亚洲一级片| 夜夜精品浪潮av一区二区三区| 奇米精品一区二区三区在线观看 | 一区二区国产视频| 视频一区二区不卡| 国产二区国产一区在线观看| 日本道免费精品一区二区三区| 欧美一区二区三区视频在线| 亚洲国产精品v| 亚洲成人中文在线| 国产乱码精品一品二品| 日本电影亚洲天堂一区| 欧美精品一区二区三区高清aⅴ| 最新不卡av在线| 免费的成人av| 91一区一区三区| 欧美mv日韩mv亚洲| 亚洲精品视频在线观看免费| 久久er99热精品一区二区| 一本色道综合亚洲| 欧美精品一区二区久久婷婷| 亚洲精选视频免费看| 狠狠色丁香九九婷婷综合五月| 色哟哟精品一区| 国产女人水真多18毛片18精品视频| 亚洲国产精品自拍| 成人av电影在线播放| 日韩欧美中文一区二区| 一区二区三区中文免费| 高清国产一区二区| 日韩欧美成人午夜| 亚洲韩国精品一区| av不卡一区二区三区| 久久综合九色综合久久久精品综合| 亚洲一区二区精品久久av| 成人avav影音| 久久精品夜夜夜夜久久| 麻豆久久久久久| 7777精品伊人久久久大香线蕉超级流畅 | 色综合色综合色综合色综合色综合| 欧美r级电影在线观看| 三级一区在线视频先锋| 色av综合在线| 中文字幕亚洲在| 成人免费观看av| 国产欧美日韩在线| 国产专区欧美精品| 精品不卡在线视频| 久久国内精品自在自线400部| 制服.丝袜.亚洲.中文.综合 | 日韩激情在线观看| 欧美色精品天天在线观看视频| 亚洲人精品午夜| 99v久久综合狠狠综合久久| 久久久久国产精品麻豆ai换脸| 精品一区二区三区的国产在线播放| 欧美福利视频一区| 日韩制服丝袜av| 欧美精品777| 日韩国产高清影视| 欧美精品 日韩| 另类成人小视频在线| 91精品国产综合久久国产大片| 偷偷要91色婷婷| 91精品啪在线观看国产60岁| 三级在线观看一区二区| 欧美一区二区三区在线视频| 日韩国产欧美在线观看| 日韩一区二区在线免费观看| 奇米精品一区二区三区在线观看一| 91精品国产色综合久久久蜜香臀| 日韩福利电影在线| 精品国产一二三| 国产一区二区三区美女| 国产目拍亚洲精品99久久精品 | 日本高清不卡在线观看| 一区二区三区中文字幕| 91麻豆精品国产91久久久更新时间| 免费日本视频一区| 国产拍揄自揄精品视频麻豆| 成人av在线电影| 亚洲成人动漫在线观看| 日韩一区二区三区精品视频 | 成人欧美一区二区三区小说 | 欧美性一级生活| 午夜一区二区三区在线观看| 91精品国产乱码久久蜜臀| 国产麻豆一精品一av一免费 | 国产99久久久国产精品潘金 | 青青草伊人久久| 久久久美女毛片| 95精品视频在线| 麻豆精品久久精品色综合| 中文字幕成人av| 欧美三级在线看| 国产一区在线不卡| 亚洲一区二区精品3399|