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>
95 lines
4.3 KiB
C#
95 lines
4.3 KiB
C#
using System.Buffers.Binary;
|
|
using System.Diagnostics;
|
|
using System.Reflection;
|
|
using Chronos.Core.Codecs.Raw;
|
|
using Chronos.Core.Codecs.Tiff;
|
|
using Chronos.Core.Metadata.Tiff;
|
|
using Chronos.Testing;
|
|
|
|
namespace Chronos.Core.Tests.Raw;
|
|
|
|
/// <summary>24-megapixel Bayer DNG development timing: AHD at full size and binned Draft at half size, all cores.</summary>
|
|
[Serial]
|
|
[Category("Performance")]
|
|
public sealed class RawPerformanceTests(TestContext context)
|
|
{
|
|
private const int W = 6000, H = 4000;
|
|
|
|
[Test]
|
|
[Timeout(60_000)]
|
|
public void Develops24MegapixelDngWithinBudget()
|
|
{
|
|
// A Debug build disables the JIT optimiser in Chronos.Core: timings would measure the build, not the pipeline.
|
|
if (typeof(RawDecoder).Assembly.GetCustomAttribute<DebuggableAttribute>()?.IsJITOptimizerDisabled == true)
|
|
TestContext.Skip("timing gate needs an optimised build (dotnet run -c Release)");
|
|
var dng = Mosaic();
|
|
var ahd = Best(dng, RawDecodeOptions.Default, out var size);
|
|
Assert.Equal(W, size.Width);
|
|
var half = Best(dng, new RawDecodeOptions { Quality = DemosaicQuality.Draft, MaxLongEdge = W / 2 }, out var halfSize);
|
|
Assert.Equal(W / 2, halfSize.Width);
|
|
context.Log($"24 MP DNG: AHD full size {ahd.TotalMilliseconds:F0} ms, binned half size {half.TotalMilliseconds:F0} ms ({Environment.ProcessorCount} cores)");
|
|
Console.WriteLine($"[perf] {context.LogText.Trim()}");
|
|
Assert.Less(ahd.TotalSeconds, TestTiming.Budget(4.0));
|
|
Assert.Less(half.TotalSeconds, TestTiming.Budget(1.0));
|
|
}
|
|
|
|
/// <summary>Best of two runs (the machine is shared; the first run also pays JIT warm-up).</summary>
|
|
private static TimeSpan Best(byte[] dng, RawDecodeOptions options, out (int Width, int Height) size)
|
|
{
|
|
var best = TimeSpan.MaxValue;
|
|
size = default;
|
|
for (var run = 0; run < 2; run++)
|
|
{
|
|
var sw = Stopwatch.StartNew();
|
|
using var result = RawDecoder.Decode(new MemoryStream(dng, writable: false), "perf.dng", options);
|
|
best = sw.Elapsed < best ? sw.Elapsed : best;
|
|
size = (result.Image.Width, result.Image.Height);
|
|
}
|
|
return best;
|
|
}
|
|
|
|
/// <summary>Uncompressed 14-bit RGGB DNG with photo-like texture (smooth illumination plus detail and noise).</summary>
|
|
private static byte[] Mosaic()
|
|
{
|
|
var data = new byte[W * H * 2];
|
|
Parallel.For(0, H, y =>
|
|
{
|
|
var state = (uint)(y * 2654435761u + 7);
|
|
for (var x = 0; x < W; x++)
|
|
{
|
|
state ^= state << 13;
|
|
state ^= state >> 17;
|
|
state ^= state << 5;
|
|
var colour = (y & 1) * 2 + (x & 1);
|
|
var level = 1500 + 5000 * (0.5 + 0.5 * double.Sin(x * 0.01) * double.Cos(y * 0.013)) * (colour is 1 or 2 ? 1.0 : 0.6)
|
|
+ 800 * double.Sin(x * 0.4 + y * 0.3) + (state & 127);
|
|
BinaryPrimitives.WriteUInt16LittleEndian(data.AsSpan((y * W + x) * 2), (ushort)double.Clamp(level, 0, 16383));
|
|
}
|
|
});
|
|
using var output = new MemoryStream();
|
|
output.Write("II*\0\0\0\0\0"u8);
|
|
var ifd = new TiffDirectory();
|
|
ifd.Long(TiffTags.NewSubfileType, 0);
|
|
ifd.Long(TiffTags.ImageWidth, W);
|
|
ifd.Long(TiffTags.ImageLength, H);
|
|
ifd.Short(TiffTags.BitsPerSample, 16);
|
|
ifd.Short(TiffTags.Compression, 1);
|
|
ifd.Short(TiffTags.PhotometricInterpretation, 32803);
|
|
ifd.Short(TiffTags.SamplesPerPixel, 1);
|
|
ifd.Long(TiffTags.StripOffsets, 8);
|
|
ifd.Long(TiffTags.StripByteCounts, (uint)data.Length);
|
|
ifd.Long(TiffTags.RowsPerStrip, H);
|
|
ifd.Short(TiffTags.CfaRepeatPatternDim, 2, 2);
|
|
ifd.Bytes(TiffTags.CfaPattern, 0, 1, 1, 2);
|
|
ifd.Bytes(TiffTags.DngVersion, 1, 4, 0, 0);
|
|
ifd.Short(TiffTags.BlackLevel, 1024);
|
|
ifd.Short(TiffTags.WhiteLevel, 16383);
|
|
ifd.SRational(TiffTags.ColorMatrix1, (6722, 10000), (-635, 10000), (-963, 10000), (-4287, 10000), (12460, 10000), (2028, 10000), (-908, 10000), (2162, 10000), (5668, 10000));
|
|
ifd.Short(TiffTags.CalibrationIlluminant1, 21);
|
|
ifd.Rational(TiffTags.AsShotNeutral, (500u, 1000u), (1000u, 1000u), (700u, 1000u));
|
|
output.Write(data);
|
|
TiffWriter.WriteDirectory(output, 0, ifd);
|
|
return output.ToArray();
|
|
}
|
|
}
|