CI / Build and test (push) Successful in 8m14s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 7s
Release / Build, test and publish (push) Successful in 13m19s
CI / PostgreSQL 16 integration (push) Successful in 4m49s
CI / PostgreSQL 17 integration (push) Successful in 5m28s
CI / Docker image (push) Successful in 53s
Release / Server image (push) Failing after 10s
The owner renamed the product and moved the repository to the self-hosted Gitea (https://gitea.encke-hake.ts.net/BalboSoft/Chronos) for more control, and asked for Actions and a first automatic release with the server package and the Windows exe (docs/requests/2026-10-23-chronos-gitea.md). - Chronos everywhere: a byte-exact rename of contents and paths, then a per-language review of the forms the old name's ending had dictated. - Gitea instead of GitHub: the update check, licence, issue and support links read ChronosReleasesUrl; the update check takes the highest stable version, offers a pre-release build its final release and reports a repository it cannot see as a failed check. EULA, security policy and Gitea issue forms live at the repository root. - Gitea Actions for the Linux act_runner (.gitea/workflows): CI, release, nightly image and performance gates in the .NET SDK container with git checkout and the system SQLite. The release cross-compiles the Windows programs, checks their icon, version and DPI manifest, packs installers and zips, publishes the Gitea release and pushes the server image (REGISTRY_TOKEN). Windows-only tests run in an opt-in job on a Windows runner (WINDOWS_RUNNER). - New Chronos.Tools commands: zip, gitea-release, postgres-ci (replaces the docker-exec script, which Gitea's service containers do not allow; the throw-away server runs without durability) and pe-check. - Timed tests take their budget from TestTiming (CHRONOS_TEST_TIME_FACTOR, 3 on the shared runner; the weekly performance gates keep theirs). BREAKING CHANGE: programs, settings, data folders, file types, environment variables and the Docker image use the new name; nothing is migrated from Titano, which never had a release. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Alberto Balbo <alberto.balbo.96@gmail.com>
76 lines
3.0 KiB
C#
76 lines
3.0 KiB
C#
using Chronos.Core.Codecs.Raw;
|
|
using Chronos.Core.Imaging;
|
|
using Chronos.Testing;
|
|
|
|
namespace Chronos.Core.Tests.Raw;
|
|
|
|
/// <summary>Clip-aware highlight reconstruction on decoded DNGs.</summary>
|
|
public sealed class HighlightTests(TestContext context)
|
|
{
|
|
private const int W = 96, H = 64;
|
|
|
|
/// <summary>Scene with three gray patches: unclipped (0.4), green clipped only (1.3) and fully clipped (3.0).</summary>
|
|
private static ImageBuffer Patches()
|
|
{
|
|
var scene = new ImageBuffer(W, H);
|
|
for (var y = 0; y < H; y++)
|
|
{
|
|
for (var x = 0; x < W; x++)
|
|
{
|
|
var v = x < 32 ? 0.4f : x < 64 ? 1.3f : 3.0f;
|
|
for (var c = 0; c < 3; c++) scene[c, x, y] = v;
|
|
}
|
|
}
|
|
return scene;
|
|
}
|
|
|
|
[Theory]
|
|
[Case(DemosaicQuality.Best, false)]
|
|
[Case(DemosaicQuality.Draft, true)]
|
|
public void ClippedGrayStaysNeutral(DemosaicQuality quality, bool binning)
|
|
{
|
|
using var scene = Patches();
|
|
var dng = SyntheticDng.Write(scene, new DngSpec());
|
|
using var result = RawDecoder.Decode(new MemoryStream(dng), "h.dng", new RawDecodeOptions { Quality = quality, MaxLongEdge = binning ? 1 : 0 });
|
|
var s = binning ? 2 : 1;
|
|
var (r0, g0, b0) = Pixel(result.Image, 16 / s, 32 / s);
|
|
var (r1, g1, b1) = Pixel(result.Image, 48 / s, 32 / s);
|
|
var (r2, g2, b2) = Pixel(result.Image, 80 / s, 32 / s);
|
|
context.Log($"0.4 → ({r0:F3}, {g0:F3}, {b0:F3}); 1.3 → ({r1:F3}, {g1:F3}, {b1:F3}); 3.0 → ({r2:F3}, {g2:F3}, {b2:F3})");
|
|
|
|
// Unclipped: exact.
|
|
Assert.Approximately(0.4, g0, 0.01);
|
|
Assert.Approximately(r0, b0, 0.01);
|
|
|
|
// Only green clipped: rebuilt from red and blue, neutral and at its true level (no magenta cast).
|
|
Assert.Approximately(1.3, g1, 0.03);
|
|
Assert.Approximately(1.3, r1, 0.03);
|
|
Assert.Approximately(1.3, b1, 0.03);
|
|
|
|
// Everything clipped: neutral, at least as bright as the partially clipped patch.
|
|
Assert.Approximately(r2, g2, 1e-3);
|
|
Assert.Approximately(b2, g2, 1e-3);
|
|
Assert.GreaterOrEqual(g2, g1);
|
|
}
|
|
|
|
[Test]
|
|
public void SaturatedColourKeepsItsHue()
|
|
{
|
|
// A red highlight clips the red channel while green and blue stay low: it must stay red, not turn white.
|
|
using var scene = new ImageBuffer(W, H);
|
|
for (var i = 0; i < scene.PlaneLength; i++)
|
|
{
|
|
scene.Plane(0)[i] = 5f;
|
|
scene.Plane(1)[i] = 0.15f;
|
|
scene.Plane(2)[i] = 0.1f;
|
|
}
|
|
using var result = RawDecoder.Decode(new MemoryStream(SyntheticDng.Write(scene, new DngSpec())), "red.dng");
|
|
var (r, g, b) = Pixel(result.Image, W / 2, H / 2);
|
|
context.Log($"red highlight → ({r:F3}, {g:F3}, {b:F3})");
|
|
Assert.Greater(r, 4 * g);
|
|
Assert.Greater(r, 4 * b);
|
|
}
|
|
|
|
private static (float R, float G, float B) Pixel(ImageBuffer image, int x, int y) => (image[0, x, y], image[1, x, y], image[2, x, y]);
|
|
}
|