I am generating a LUT dividing 0-2PI into 512 fragments and then finding sine of these values and storing them as Q1.31 values.
Example:
LUT[0] = 0
LUT[1] = sin((1/512) * 2*PI) * (2^31)
..
..
LUT[511] = sin((511/512) * 2*PI) * (2^31)
My inputs are also values in the Q1.31 format.
My question is how do I go about using the LUT i.e. what is the algorithm to find the offset values in the table when I get a random value as an input to figure out the sine value
Example:
int sample_input = 0.125 * (2^31) //0.125radians in Q31 format = 268435456