FastLED 3.9.7
Loading...
Searching...
No Matches
scale8.h File Reference

Detailed Description

Fast, efficient 8-bit scaling functions specifically designed for high-performance LED programming.

Definition in file scale8.h.

#include "lib8static.h"
#include "crgb.h"
#include "fl/namespace.h"

Go to the source code of this file.

Functions

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.
 
LIB8STATIC_ALWAYS_INLINE uint8_t scale8_LEAVING_R1_DIRTY (uint8_t i, fract8 scale)
 This version of scale8() does not clean up the R1 register on AVR.
 
LIB8STATIC_ALWAYS_INLINE void nscale8_LEAVING_R1_DIRTY (uint8_t &i, fract8 scale)
 In place modifying version of scale8() that does not clean up the R1 register on AVR.
 
LIB8STATIC_ALWAYS_INLINE uint8_t scale8_video_LEAVING_R1_DIRTY (uint8_t i, fract8 scale)
 This version of scale8_video() does not clean up the R1 register on AVR.
 
LIB8STATIC_ALWAYS_INLINE void nscale8_video_LEAVING_R1_DIRTY (uint8_t &i, fract8 scale)
 In place modifying version of scale8_video() that does not clean up the R1 register on AVR.
 
LIB8STATIC_ALWAYS_INLINE void cleanup_R1 ()
 Clean up the r1 register after a series of *LEAVING_R1_DIRTY calls.
 
constexpr CRGB nscale8x3_constexpr (uint8_t r, uint8_t g, uint8_t b, fract8 scale)
 
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 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_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 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 uint8_t dim8_raw (uint8_t x)
 Adjust a scaling value for dimming.
 
LIB8STATIC uint8_t dim8_video (uint8_t x)
 Adjust a scaling value for dimming for video (value will never go below 1)
 
LIB8STATIC uint8_t dim8_lin (uint8_t x)
 Linear version of the dimming function that halves for values < 128.
 
LIB8STATIC uint8_t brighten8_raw (uint8_t x)
 Brighten a value (inverse of dim8_raw())
 
LIB8STATIC uint8_t brighten8_video (uint8_t x)
 Brighten a value (inverse of dim8_video())
 
LIB8STATIC uint8_t brighten8_lin (uint8_t x)
 Brighten a value (inverse of dim8_lin())