Initial HyperDRM 0.6.0: webOS ambient light app and native service

This commit is contained in:
matze19999 committed 2026-10-06 13:28:45 +02:00
commit 376798d6ce
34 files changed
+2170

No files matched your search

+15
View File
@@ -0,0 +1,15 @@
#ifndef LG_HISTOGRAM_H
#define LG_HISTOGRAM_H
#include <stdint.h>
#include <stddef.h>
/* LG ABI: region ID followed by three planar channels, 256 uint16 bins
* per channel. Bin index is the 8-bit intensity (0..255). */
typedef struct { uint32_t id; uint16_t bins[3][256]; } Histogram;
_Static_assert(sizeof(Histogram)==0x604,"LG ABI record size");
_Static_assert(offsetof(Histogram,bins)==4,"LG ABI channel offset");
static inline unsigned char histogram_mean(const uint16_t bins[256]) {
uint64_t count=0,weight=0;
for(unsigned b=0;b<256;b++){count+=bins[b];weight+=(uint64_t)bins[b]*b;}
return count?(unsigned char)((weight+count/2)/count):0;
}
#endif