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
@@ -153,11 +153,14 @@ static int tick(void *unused) {
|
||||
}
|
||||
for (int c = 0; c < 3; c++)
|
||||
capture_ctx.sent_rgb[c] = (unsigned char)(aggregate[c] / 16);
|
||||
dark_color_filter(capture_ctx.sent_rgb);
|
||||
unsigned char boosted_mean[3];
|
||||
boost_color(capture_ctx.sent_rgb, boosted_mean);
|
||||
memcpy(capture_ctx.sent_rgb, boosted_mean, 3);
|
||||
unsigned char mapped_rgb[16][3], stable_rgb[16][3];
|
||||
calibration_colors(capture_ctx.rgb, mapped_rgb);
|
||||
for (unsigned i = 0; i < 16; i++)
|
||||
dark_color_filter(mapped_rgb[i]);
|
||||
continuity_frame(&capture_ctx.continuity, true, mapped_rgb, now, stable_rgb);
|
||||
receiver_layout.interpolation = receiver_layout.count && calibration_effective() != CAL_AVERAGE;
|
||||
char *line = region_command(stable_rgb, receiver_layout.blends, receiver_layout.count, 1500);
|
||||
|
||||
@@ -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
|
||||
@@ -199,6 +199,7 @@ static bool respond(void *h, void *m, const char *s) {
|
||||
#include "receiver_stream.h"
|
||||
#include "source_bridge.h"
|
||||
#include "service_api.h"
|
||||
#include "dark_color.h"
|
||||
#include "capture_loop.h"
|
||||
static void *symbol(void *lib, const char *name) {
|
||||
void *s = dlsym(lib, name);
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include "dark_color.h"
|
||||
int main(void) {
|
||||
for (unsigned v = 0; v <= 255; v++) {
|
||||
unsigned char gray[3] = {v, v, v};
|
||||
dark_color_filter(gray);
|
||||
unsigned expected = v <= 12 ? 0 : v >= 24 ? v : (v * (v - 12) + 6) / 12;
|
||||
for (unsigned c = 0; c < 3; c++) assert(gray[c] == expected);
|
||||
}
|
||||
unsigned char residual[3] = {4, 8, 2};
|
||||
dark_color_filter(residual);
|
||||
assert(!residual[0] && !residual[1] && !residual[2]);
|
||||
unsigned char transition[3] = {9, 18, 6};
|
||||
dark_color_filter(transition);
|
||||
assert(transition[0] == 5 && transition[1] == 9 && transition[2] == 3);
|
||||
unsigned char saturated[3] = {0, 24, 0};
|
||||
dark_color_filter(saturated);
|
||||
assert(saturated[0] == 0 && saturated[1] == 24 && saturated[2] == 0);
|
||||
puts("PASS: near-black suppression, gradual transition, unchanged brighter colors");
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
#ifndef HYPERDRM_VERSION_H
|
||||
#define HYPERDRM_VERSION_H
|
||||
#define HYPERDRM_VERSION "0.13.0"
|
||||
#define HYPERDRM_VERSION "0.13.1"
|
||||
#endif
|
||||
Reference in new issue
Block a user