Possible to access LUTs from flash rather than have them consume RAM?

I have a bunch of look up tables but there are large and I am already lows on RAM

I’ve tried this:

public static readonly float[] quantisationLUT = new float[]
1.0f, 1.0f…

but that chews up RAM.
Is there anyway to having them be accessed directly out of program flash memory rather than RAM?

I remember something but not sure. I think of you add a binary resource then you can read it right from flash. Not that is a bytes array. I am not sure about float.

Either way, your is something we can definitely look into in the future.

Another thought! If the byte array works then you can use native code to cast float into that array.


public const float[] quantisationLUT = new float[]
1.0f, 1.0f…

1 Like

Thanks Gus. I found some some docs on the old site about resources :slight_smile:
What do you mean by ‘can use native code to cast float into that array’? Specially Native Code in this context?

Hey Mike, Sadly that wouldn’t compile. I gives:
A const field of a reference type other than string can only be initialized with null

doing some digging I found this explanation on stack overflow:

Actually you are trying to make the array - which is a reference type - const - this would not affect mutability of its values at all (you still can mutate any value within the array) - making the array readonly would make it compile, but not have the desired effect either. Constant expressions have to be fully evaluated at compile time, hence the new operator is not allowed.


public const float[] quantisationLUT = {1.0, 2.0};

Hi Mike, same error. you can’t have const arrays :frowning:


Sorry… my C# is a bit rusty…