Private
Public Access
Release 0.13.1
This commit is contained in:
1 parent
c0d891b372
commit
c3040680a0
14 files changed
+58
-10
No files matched your search
@@ -0,0 +1,16 @@
|
||||
#ifndef HYPERDRM_DARK_COLOR_H
|
||||
#define HYPERDRM_DARK_COLOR_H
|
||||
/* Suppress near-black histogram residuals without changing channel ratios.
|
||||
* Apply only to fresh histogram colors, before continuity and interpolation. */
|
||||
static inline void dark_color_filter(unsigned char color[3]) {
|
||||
unsigned peak = color[0];
|
||||
for (unsigned c = 1; c < 3; c++)
|
||||
if (color[c] > peak)
|
||||
peak = color[c];
|
||||
if (peak >= 24)
|
||||
return;
|
||||
unsigned gain = peak > 12 ? peak - 12 : 0;
|
||||
for (unsigned c = 0; c < 3; c++)
|
||||
color[c] = (unsigned char)((color[c] * gain + 6) / 12);
|
||||
}
|
||||
#endif
|
||||
Reference in new issue
Block a user