Registriert seit: 12. Dez 2004
Ort: Wien, Österriech
893 Beiträge
Delphi 6 Enterprise
|
Re: nochmal c++ nach delphi
22. Jun 2005, 14:37
..und den selbserklärenden Rest zu bringen...
Delphi-Quellcode:
procedure imdct_init()
var i,k : Integer;
angle_step, current_angle: complex_t;
begin
// Twiddle factors to turn IFFT into IMDCT */
for i:=0 to 127 do
begin
xcos1[i] := cos(2.0 * M_PI * (8*i+1)/(8*N));
xsin1[i] := sin(2.0 * M_PI * (8*i+1)/(8*N));
end;
// More twiddle factors to turn IFFT into IMDCT */
for i:=0 to 63 do
begin
xcos2[i] := cos(2.0 * M_PI * (8*i+1)/(4*N));
xsin2[i] := sin(2.0 * M_PI * (8*i+1)/(4*N));
end;
//* Canonical twiddle factors for FFT */
w[0] := w_1;
w[1] := w_2;
w[2] := w_4;
w[3] := w_8;
w[4] := w_16;
w[5] := w_32;
w[6] := w_64;
for i:=0 to 6 do
begin
angle_step.real := cos(-2.0 * M_PI / (1 shl (i+1)));
angle_step.imag := sin(-2.0 * M_PI / (1 shl (i+1)));
current_angle.real := 1.0;
current_angle.imag := 0.0;
k:=0;
while(k<(1 shl i))do
begin
w[i,k] := current_angle;
current_angle := cmplx_mult(current_angle, angle_step);
Inc(k);
end;
// for (k = 0; k < 1 << i; k++)
// {
// w[i][k] = current_angle;
// current_angle = cmplx_mult(current_angle, angle_step);
// }
end;
ZeroMemory(@delay, sizeof(delay));
end;
procedure imdct_do_512(var data, delay:array of double);
var i,k
p,q,
m,
two_m,
two_m_plus_one:Integer;
tmp_a_i, tmp_a_r, tmp_b_i, tmp_b_r:double;
data_ptr, delay_ptr, window_ptr : ^Double;;
begin
Katura Haris Es (ein gutes Wort) ist wie ein guter Baum, dessen Wurzel fest ist und dessen Zweige in den Himmel reichen.
|
|
Zitat
|