Need help with using built in log table for gamma correction
I'm trying to figure out how to use the prop's built in log table to generate a 256-byte array (256 8-bit values) that will translate a linear 8-bit input value (0-255) into a logarithmic output value (0-255). Mathematically, for a specified value of G, I want to be able, in spin code, to generate an array such that array[N]=INT((N/255)^G*255). For G=1, array[N] would = N.
For G values >1 the array values would still span the range of 0-255, but the changes would be smaller at the beginning (ie same value duplicated multiple times), and larger at the end (ie increments>1). If that makes any sense...
This will be used to gamma-correct an LED intensity value to make it's dimming response more compatible with the human eye.
.
For G values >1 the array values would still span the range of 0-255, but the changes would be smaller at the beginning (ie same value duplicated multiple times), and larger at the end (ie increments>1). If that makes any sense...
This will be used to gamma-correct an LED intensity value to make it's dimming response more compatible with the human eye.
.
Comments
It doesn't use the built in log tables, but I generate the kind of table you're looking for on startup using the Float32 object for the POW function, but then I shut it down when I'm finished. The table size and power values are easy to change.