FastLED 3.9.15
Loading...
Searching...
No Matches
five_bit_hd_gamma.h
Go to the documentation of this file.
1
3
4#pragma once
5
6#include <stdint.h>
7
8#include "crgb.h"
9#include "fl/force_inline.h"
10#include "fl/namespace.h"
11
12namespace fl {
13
18
19// Applies gamma correction for the RGBV(8, 8, 8, 5) color space, where
20// the last byte is the brightness byte at 5 bits.
21// To override this five_bit_hd_gamma_bitshift you'll need to define
22// FASTLED_FIVE_BIT_HD_BITSHIFT_FUNCTION_OVERRIDE in your build settings
23// then define the function anywhere in your project.
24// Example:
25// FASTLED_NAMESPACE_BEGIN
26// void five_bit_hd_gamma_bitshift(
27// uint8_t r8, uint8_t g8, uint8_t b8,
28// uint8_t r8_scale, uint8_t g8_scale, uint8_t b8_scale,
29// uint8_t* out_r8,
30// uint8_t* out_g8,
31// uint8_t* out_b8,
32// uint8_t* out_power_5bit) {
33// cout << "hello world\n";
34// }
35// FASTLED_NAMESPACE_END
36
37void __builtin_five_bit_hd_gamma_bitshift(CRGB colors, CRGB colors_scale,
38 uint8_t global_brightness,
39 CRGB *out_colors,
40 uint8_t *out_power_5bit);
41
42// Exposed for testing.
43uint8_t five_bit_bitshift(uint16_t r16, uint16_t g16, uint16_t b16,
44 uint8_t brightness, CRGB *out,
45 uint8_t *out_power_5bit);
46
47#ifdef FASTLED_FIVE_BIT_HD_BITSHIFT_FUNCTION_OVERRIDE
48// This function is located somewhere else in your project, so it's declared
49// extern here.
50extern void five_bit_hd_gamma_bitshift(CRGB colors, CRGB colors_scale,
51 uint8_t global_brightness,
52 CRGB *out_colors,
53 uint8_t *out_power_5bit);
54#else
56 CRGB colors_scale,
57 uint8_t global_brightness,
58 CRGB *out_colors,
59 uint8_t *out_power_5bit) {
61 colors, colors_scale, global_brightness, out_colors, out_power_5bit);
62}
63#endif // FASTLED_FIVE_BIT_HD_BITSHIFT_FUNCTION_OVERRIDE
64
65// Simple gamma correction function that converts from
66// 8-bit color component and converts it to gamma corrected 16-bit
67// color component. Fast and no memory overhead!
68// To override this function you'll need to define
69// FASTLED_FIVE_BIT_HD_GAMMA_BITSHIFT_FUNCTION_OVERRIDE in your build settings
70// and then define your own version anywhere in your project. Example:
71// FASTLED_NAMESPACE_BEGIN
72// void five_bit_hd_gamma_function(
73// uint8_t r8, uint8_t g8, uint8_t b8,
74// uint16_t* r16, uint16_t* g16, uint16_t* b16) {
75// cout << "hello world\n";
76// }
77// FASTLED_NAMESPACE_END
78#ifdef FASTLED_FIVE_BIT_HD_GAMMA_FUNCTION_OVERRIDE
79// This function is located somewhere else in your project, so it's declared
80// extern here.
81extern void five_bit_hd_gamma_function(CRGB color, uint16_t *r16, uint16_t *g16,
82 uint16_t *b16);
83#else
84void five_bit_hd_gamma_function(CRGB color, uint16_t *r16, uint16_t *g16,
85 uint16_t *b16);
86#endif // FASTLED_FIVE_BIT_HD_GAMMA_FUNCTION_OVERRIDE
87
88} // namespace fl
UISlider brightness("Brightness", 255, 0, 255, 1)
Defines the red, green, and blue (RGB) pixel struct.
#define FASTLED_FORCE_INLINE
Definition force_inline.h:6
Implements the FastLED namespace macros.
FiveBitGammaCorrectionMode
@ kFiveBitGammaCorrectionMode_Null
@ kFiveBitGammaCorrectionMode_BitShift
void __builtin_five_bit_hd_gamma_bitshift(CRGB colors, CRGB colors_scale, uint8_t global_brightness, CRGB *out_colors, uint8_t *out_power_5bit)
uint8_t five_bit_bitshift(uint16_t r16, uint16_t g16, uint16_t b16, uint8_t brightness, CRGB *out, uint8_t *out_power_5bit)
void five_bit_hd_gamma_function(CRGB color, uint16_t *r16, uint16_t *g16, uint16_t *b16)
FASTLED_FORCE_INLINE void five_bit_hd_gamma_bitshift(CRGB colors, CRGB colors_scale, uint8_t global_brightness, CRGB *out_colors, uint8_t *out_power_5bit)
Implements a simple red square effect for 2D LED grids.
Definition crgb.h:16
Representation of an RGB pixel (Red, Green, Blue)
Definition crgb.h:55