亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
久久蜜臀中文字幕| 免费美女久久99| 午夜日韩在线观看| 国产一区二区美女诱惑| 91麻豆成人久久精品二区三区| 91久久奴性调教| 日韩视频在线你懂得| 中文字幕在线播放不卡一区| 亚洲一区二区视频在线观看| 国产一区二区主播在线| 色综合久久66| 精品免费国产一区二区三区四区| 欧美高清在线精品一区| 天堂精品中文字幕在线| 高清shemale亚洲人妖| 欧美日韩夫妻久久| 亚洲欧美日韩人成在线播放| 麻豆精品一区二区av白丝在线| 一本色道亚洲精品aⅴ| 国产欧美日韩激情| 日韩影院在线观看| 欧美三区在线观看| 中文字幕乱码一区二区免费| 美女高潮久久久| 717成人午夜免费福利电影| 国产精品久久久久aaaa樱花| 国产一区在线看| 久久欧美一区二区| 激情五月激情综合网| 91精品国产美女浴室洗澡无遮挡| 亚洲国产一区二区a毛片| 成人性视频免费网站| 久久综合久久99| 国产成人精品一区二区三区四区| 欧美一区二区三区在线观看视频| 亚洲va中文字幕| 欧美在线高清视频| 亚洲综合免费观看高清完整版在线| 国产91精品在线观看| 国产精品色在线观看| 成+人+亚洲+综合天堂| 国产精品精品国产色婷婷| 99riav久久精品riav| 日韩毛片一二三区| 91福利精品第一导航| 一区二区三区**美女毛片| 欧美日韩国产高清一区二区| 偷拍与自拍一区| 欧美xxxxxxxx| 99久久精品免费精品国产| 亚洲一区二区三区精品在线| 欧美午夜一区二区三区免费大片| 热久久久久久久| 国产精品视频看| 欧美视频一区二区三区| 麻豆freexxxx性91精品| 国产精品萝li| 欧美一二三区在线| 成人高清免费在线播放| 亚洲大片精品永久免费| 国产日韩欧美电影| 9191久久久久久久久久久| 国产精品一级片在线观看| 亚洲午夜视频在线| 国产精品久久久久三级| 日韩av成人高清| 91麻豆国产香蕉久久精品| 亚洲国产一区视频| 欧美激情在线一区二区三区| 欧美日韩黄色一区二区| 99久久伊人网影院| 久久99国产精品久久99果冻传媒 | 日韩视频123| 91色porny在线视频| 国产麻豆9l精品三级站| 亚洲国产一区在线观看| 成人欧美一区二区三区在线播放| 精品国产自在久精品国产| 欧美亚一区二区| 99精品视频中文字幕| 国产麻豆视频一区二区| 精品一区二区在线播放| 蜜桃一区二区三区四区| 三级久久三级久久久| 一区二区三区中文在线观看| 亚洲欧洲中文日韩久久av乱码| 国产色综合久久| 欧美成人bangbros| 欧美一区二区视频在线观看2022| 欧洲激情一区二区| 欧美日韩成人高清| 欧美日韩精品一区二区三区蜜桃 | 国产精品乱码久久久久久| 2021国产精品久久精品| 久久影视一区二区| 国产日韩欧美在线一区| 欧美高清一级片在线观看| 国产精品丝袜久久久久久app| 国产精品亲子乱子伦xxxx裸| 日韩一区中文字幕| 亚洲综合在线电影| 日韩高清电影一区| 国产在线精品免费| 成人的网站免费观看| 色网综合在线观看| 欧美一区二区三区视频在线观看| 日韩一级在线观看| 国产精品久久久久久亚洲毛片| 亚洲色大成网站www久久九九| 亚洲激情自拍视频| 国模少妇一区二区三区| av网站免费线看精品| 69堂国产成人免费视频| 日本一区二区三区在线不卡| 亚洲黄网站在线观看| 久久精品国产999大香线蕉| www.日韩在线| 日韩欧美精品三级| 亚洲精品第1页| 国产大陆a不卡| 在线看国产一区| 国产婷婷一区二区| 无吗不卡中文字幕| 成人免费黄色大片| 日韩美女视频一区二区在线观看| 综合久久一区二区三区| 另类成人小视频在线| 精品视频一区 二区 三区| 国产日韩精品一区二区浪潮av| 调教+趴+乳夹+国产+精品| 99久久久久免费精品国产 | wwwwww.欧美系列| 亚洲国产精品久久人人爱| 成人黄色777网| 久久精品一区二区三区av| 青椒成人免费视频| 欧美日韩激情一区| 亚州成人在线电影| 欧美亚洲日本国产| 亚洲自拍都市欧美小说| 色国产精品一区在线观看| 中文字幕在线观看不卡| 国产成人亚洲综合a∨猫咪| 精品日韩一区二区三区免费视频| 日韩在线一区二区三区| 91精品国产综合久久香蕉的特点| 亚洲综合久久av| 欧美性受xxxx黑人xyx性爽| 亚洲欧美乱综合| 欧美特级限制片免费在线观看| 亚洲免费av观看| 欧美日韩精品一区二区三区四区| 午夜精品一区在线观看| 欧美精品 国产精品| 麻豆精品新av中文字幕| 国产欧美va欧美不卡在线| 成人精品视频网站| 亚洲免费观看高清完整版在线| 不卡一区二区中文字幕| 亚洲福利视频导航| 精品免费日韩av| 99久久精品国产网站| 亚洲18女电影在线观看| 欧美精品一区二区三| 成人丝袜高跟foot| 亚洲成人在线网站| 久久综合色综合88| 欧美性感一区二区三区| 免费精品视频在线| 国产精品美女视频| 91精品在线一区二区| 成人免费毛片片v| 日韩综合小视频| 中文字幕在线不卡一区| 91精品国产色综合久久不卡蜜臀 | 久久综合久色欧美综合狠狠| 91丨九色丨蝌蚪富婆spa| 香蕉成人伊视频在线观看| 欧美激情综合五月色丁香| 欧美一区午夜视频在线观看 | 色噜噜狠狠一区二区三区果冻| 日韩不卡一区二区三区| 亚洲在线免费播放| 中文字幕va一区二区三区| 日韩一区二区麻豆国产| 色婷婷久久99综合精品jk白丝| 国产一区二区91| 麻豆成人久久精品二区三区红| 亚洲永久精品大片| 中文字幕中文字幕在线一区 | 亚洲精品一区二区在线观看| 欧美中文字幕亚洲一区二区va在线| 激情六月婷婷综合| 日本不卡123| 亚洲最色的网站| 欧美日韩免费在线视频| 狠狠色丁香婷婷综合| 日韩二区在线观看| 亚洲永久免费av| 午夜视频一区二区三区|