74 {
77 *out_power_5bit = 0;
78 return 0;
79 }
80 if (r16 == 0 && g16 == 0 && b16 == 0) {
84 }
85
86
87
88
89
90
91
92 static const uint8_t kStartBrightness = 0b00010000;
93 uint8_t v5 = kStartBrightness;
94
96
97
98
99 uint16_t max_component =
max3(r16, g16, b16);
100
102 if (shifts) {
103 r16 = r16 << shifts;
104 g16 = g16 << shifts;
105 b16 = b16 << shifts;
106 }
107
108
113 }
114
115
116
117 if (v5 > 1) {
118
119
120
121
122 v5 = v5 | (v5 - 1);
123 }
124
126 *out_power_5bit = v5;
128}
UISlider brightness("Brightness", 255, 0, 255, 1)
uint8_t brightness_bitshifter8(uint8_t *brightness_src, uint8_t *brightness_dst, uint8_t max_shifts)
uint8_t brightness_bitshifter16(uint8_t *brightness_src, uint16_t *brightness_dst, uint8_t max_shifts, uint8_t steps=2)
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 whos...
LIB8STATIC_ALWAYS_INLINE uint8_t map16_to_8(uint16_t x)
Representation of an RGB pixel (Red, Green, Blue)