From c09ff65f79b1c243efab0ed67b90b20ee50c44b5 Mon Sep 17 00:00:00 2001 From: Thomas Kolb Date: Wed, 21 Nov 2012 22:07:23 +0100 Subject: [PATCH] Start counting from 0 in LUT generator --- gen_lut.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gen_lut.py b/gen_lut.py index 531004d..4109cb0 100755 --- a/gen_lut.py +++ b/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");