adafruit / Adalight

http://ladyada.net/make/adalight/
GNU General Public License v3.0
212 stars 131 forks source link

Gamma correction for LPD8806 #1

Closed elmerfud closed 12 years ago

elmerfud commented 12 years ago

This is gamma correction code ripped directly out of the advancedLEDbeltKit.pde from the LPD8806 library. I've added in to the LEDstream_LPD8806.pde.

PaintYourDragon commented 12 years ago

LEDstream purposefully does not handle its own gamma correction. This functionality, if required, should be handled in the host-side code (as is already done in Adalight and Adavision) -- covering it in both places will cause overcorrection.

Reasons for handling gamma correction on the host include:

  1. The computation is much less burdensome on the host side (typically a multi-gigahertz CPU). Minimizing computational requirements on the Arduino assists in maximizing throughput (and thus the max number of LEDs and/or frame rate that can be achieved) -- the microcontroller should cover as little work as possible in this case.
  2. The Adalight code and WS2801 library (used by Adavision demos) handle per-channel gamma correction vs. the simpler common lookup used here (which is adequate for a flashy belt, but less so for fixing color cast in video).
  3. It's my eventual plan to add more capable color correction to the WS2801 library in order to address the color cast better than gamma correction alone can handle...this will be more computationally intensive and thus vastly better suited to the host than the Arduino.

Very much appreciate the contribution, but there's a method to the madness and I apologize for not spelling out more of a roadmap in the code.