Start counting from 0 in LUT generator
This commit is contained in:
parent
f6173965f5
commit
c09ff65f79
14
gen_lut.py
14
gen_lut.py
|
@ -30,7 +30,7 @@ with open("lut.c", "w") as ofile:
|
|||
ofile.write(preamble)
|
||||
|
||||
# generate the sin() lookup table
|
||||
for layer in range(1, fft_exponent+1):
|
||||
for layer in range(0, fft_exponent):
|
||||
num_elements = (1 << layer)
|
||||
ofile.write("value_type sin_lut%i[%i] = {" % (layer, num_elements))
|
||||
|
||||
|
@ -41,27 +41,27 @@ with open("lut.c", "w") as ofile:
|
|||
|
||||
ofile.write("};\n\n")
|
||||
|
||||
ofile.write("value_type *sin_lut[%i] = {sin_lut1" % fft_exponent);
|
||||
ofile.write("value_type *sin_lut[%i] = {sin_lut0" % fft_exponent);
|
||||
|
||||
for i in range(2, fft_exponent+1):
|
||||
for i in range(1, fft_exponent):
|
||||
ofile.write(", sin_lut" + str(i));
|
||||
ofile.write("};\n");
|
||||
|
||||
# generate the cos() lookup table
|
||||
for layer in range(1, fft_exponent+1):
|
||||
for layer in range(0, fft_exponent):
|
||||
num_elements = (1 << layer)
|
||||
ofile.write("value_type cos_lut%i[%i] = {" % (layer, num_elements))
|
||||
|
||||
ofile.write("0")
|
||||
ofile.write("1")
|
||||
|
||||
for element in range(1, num_elements):
|
||||
ofile.write(", %.10f" % cos(-pi * element / num_elements));
|
||||
|
||||
ofile.write("};\n\n")
|
||||
|
||||
ofile.write("value_type *cos_lut[%i] = {cos_lut1" % fft_exponent);
|
||||
ofile.write("value_type *cos_lut[%i] = {cos_lut0" % fft_exponent);
|
||||
|
||||
for i in range(2, fft_exponent+1):
|
||||
for i in range(1, fft_exponent):
|
||||
ofile.write(", cos_lut" + str(i));
|
||||
ofile.write("};\n");
|
||||
|
||||
|
|
Loading…
Reference in a new issue