So at the moment, I’m working out how I can keep track of 16 RGB LEDs with only the tiny 32 bytes of RAM in the ATtiny10 microcontroller to play with. The RGB LEDs each read three bytes of serial data; one byte for red, one byte for green and one byte for blue. With 16 RGB LEDs in operation storing the values in their native three-byte RGB format would take 48 bytes of RAM.
The solution I have come up with is to store the values in HL format (hue and luma) and convert them to RGB format as they are sent over serial. A pre-calculated lookup table can be made from values of one hue (in this example, red) and then shifted to get the values for the other two colour channels (in this example, green and blue) with minimal error.
Values in HL format are quick to manipulate, requiring the storage and update of one byte (four bits (16 levels) of hue and four bits of luma) rather than three seperate bytes (red, green and blue.)
There are limitations however. This system does not account for perceptual brightness. For example human vision perceives green to be brighter than red or blue at the same intensity as we mostly have green receptors in our retinas. To resolve this seperate lookup tables would be needed for red, green and blue. It also has no capacity for saturation and instead deals only with hue and luma. As this project only concerns decorative lighting I want full saturation for maximum effect.
I have included some examples of using only hue and luma for image compression. The result is almost cartoonish. I have no intention of using it in such a manner I was merely curious as to how it would look.