FastLED 3.9.15
|
Fast, efficient 8-bit scaling functions specifically designed for high-performance LED programming.
Because of the AVR(Arduino) and ARM assembly language implementations provided, using these functions often results in smaller and faster code than the equivalent program using plain "C" arithmetic and logic.
Topics | |
Scaling Functions that Leave R1 Dirty | |
These functions are more efficient for scaling multiple bytes at once, but require calling cleanup_R1() afterwards. | |
Functions | |
LIB8STATIC void | nscale8x2 (uint8_t &i, uint8_t &j, fract8 scale) |
Scale two one-byte values by a third one, which is treated as the numerator of a fraction whose demominator is 256. | |
LIB8STATIC void | nscale8x2_video (uint8_t &i, uint8_t &j, fract8 scale) |
Scale two one-byte values by a third one, which is treated as the numerator of a fraction whose demominator is 256. | |
LIB8STATIC void | nscale8x3 (uint8_t &r, uint8_t &g, uint8_t &b, fract8 scale) |
Scale three one-byte values by a fourth one, which is treated as the numerator of a fraction whose demominator is 256. | |
LIB8STATIC void | nscale8x3_video (uint8_t &r, uint8_t &g, uint8_t &b, fract8 scale) |
Scale three one-byte values by a fourth one, which is treated as the numerator of a fraction whose demominator is 256. | |
LIB8STATIC uint16_t | scale16 (uint16_t i, fract16 scale) |
Scale a 16-bit unsigned value by an 16-bit value, which is treated as the numerator of a fraction whose denominator is 65536. | |
LIB8STATIC_ALWAYS_INLINE uint16_t | scale16by8 (uint16_t i, fract8 scale) |
Scale a 16-bit unsigned value by an 8-bit value, which is treated as the numerator of a fraction whose denominator is 256. | |
LIB8STATIC_ALWAYS_INLINE uint8_t | scale8 (uint8_t i, fract8 scale) |
Scale one byte by a second one, which is treated as the numerator of a fraction whose denominator is 256. | |
constexpr uint8_t | scale8_constexpr (uint8_t i, fract8 scale) |
LIB8STATIC_ALWAYS_INLINE uint8_t | scale8_video (uint8_t i, fract8 scale) |
The "video" version of scale8() guarantees that the output will be only be zero if one or both of the inputs are zero. | |