CI / Build and test (pull_request) Failing after 2m3s
CI / PostgreSQL 16 integration (pull_request) Skipped
CI / PostgreSQL 17 integration (pull_request) Skipped
CI / Docker image (pull_request) Skipped
CI / Windows tests and installer (pull_request) Skipped
CI / YAML check (pull_request) Successful in 4s
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. 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) and pe-check. 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>
84 lines
4.3 KiB
C#
84 lines
4.3 KiB
C#
using Chronos.Core.Diagnostics.Synthetic;
|
||
using Chronos.Core.Export;
|
||
using Chronos.Core.Imaging;
|
||
using Chronos.Core.Project;
|
||
using Chronos.Core.Render;
|
||
using Chronos.Core.Render.Diagnostics;
|
||
using Chronos.Core.Video;
|
||
using Chronos.Core.Video.Managed;
|
||
|
||
namespace Chronos.Core.Tests.Render;
|
||
|
||
/// <summary>Small synthetic renders shared by the render tests.</summary>
|
||
internal static class RenderFixture
|
||
{
|
||
/// <summary>No module and no knee: the output equals the source.</summary>
|
||
public static ProjectSettings Plain { get; } = new() { Exposure = new ExposureSettings { HighlightKnee = null } };
|
||
|
||
public static SyntheticFrameSource Source(int frames = 12, double flickerEv = 0, Func<int, (double X, double Y)>? motion = null, int width = 96, int height = 64,
|
||
Func<SyntheticSequenceOptions, SyntheticSequenceOptions>? configure = null)
|
||
{
|
||
var options = new SyntheticSequenceOptions
|
||
{
|
||
Width = width,
|
||
Height = height,
|
||
FrameCount = frames,
|
||
StartEv = 0,
|
||
EndEv = 1,
|
||
FlickerEv = flickerEv,
|
||
Seed = 5,
|
||
};
|
||
return new SyntheticFrameSource(SyntheticSequence.Create(configure is null ? options : configure(options)), motion);
|
||
}
|
||
|
||
/// <summary>Renders into a capturing encoder (PNG-sequence capability) and returns the captured frames.</summary>
|
||
public static async Task<(CapturedEncode Encode, RenderResult Result)> CaptureAsync(RenderInput input, ResolvedExport? export = null, RenderOptions? options = null,
|
||
CancellationToken cancellationToken = default)
|
||
{
|
||
var capture = new CapturingEncoderProvider("capture", new EncoderCapability(VideoCodec.PngSequence, "Capture", false, 8192, 8192, true));
|
||
var target = new RenderTarget(export ?? Preset("png-sequence"), Path.Combine(Path.GetTempPath(), "chronos-capture-" + Guid.NewGuid().ToString("N")));
|
||
var result = await Pipeline(capture).RenderAsync(input, target, options, cancellationToken: cancellationToken);
|
||
return (capture.Encodes.Single(), result);
|
||
}
|
||
|
||
public static RenderInput Input(SyntheticFrameSource source, ProjectSettings? project = null) =>
|
||
new() { Source = source, Frames = source.Metadata(), Project = project ?? Plain };
|
||
|
||
/// <summary>A built-in preset's values at an explicit size (0×0 = source size).</summary>
|
||
public static ResolvedExport Preset(string presetId, int width = 96, int height = 64) =>
|
||
ExportResolver.FromPreset(ExportPresets.Find(presetId)!) with { Width = width, Height = height };
|
||
|
||
public static RenderTarget Target(string folder, ResolvedExport export, string name = "out") =>
|
||
new(export, Path.Combine(folder, name + (export.Container == ContainerFormat.ImageSequence ? string.Empty : VideoCodecInfo.FileExtension(export.Codec))));
|
||
|
||
public static RenderPipeline Pipeline(params IVideoEncoderProvider[] extra) =>
|
||
new([.. extra, new ManagedEncoderProvider()]);
|
||
|
||
/// <summary>Peak signal-to-noise ratio of the 8-bit sRGB encodings.</summary>
|
||
public static double Psnr(ImageBuffer expected, ImageBuffer actual)
|
||
{
|
||
var a = PixelConvert.ToInterleaved8(expected, 3);
|
||
var b = PixelConvert.ToInterleaved8(actual, 3);
|
||
double sum = 0;
|
||
for (var i = 0; i < a.Length; i++) sum += (a[i] - b[i]) * (a[i] - b[i]);
|
||
return sum == 0 ? double.PositiveInfinity : 10 * Math.Log10(255.0 * 255 / (sum / a.Length));
|
||
}
|
||
|
||
/// <summary>Synchronous progress sink (Progress<T> would post to the thread pool).</summary>
|
||
public sealed class Sink<T>(Action<T> report) : IProgress<T>
|
||
{
|
||
public void Report(T value) => report(value);
|
||
}
|
||
|
||
/// <summary>Throws an <see cref="IOException"/> for one frame, as an unreadable file would.</summary>
|
||
public sealed class FailingSource(IRenderFrameSource inner, int failAt) : IRenderFrameSource
|
||
{
|
||
public int FrameCount => inner.FrameCount;
|
||
public int Width => inner.Width;
|
||
public int Height => inner.Height;
|
||
|
||
public ValueTask<ImageBuffer> GetFrameAsync(int index, int maxLongEdge, DecodePurpose purpose, CancellationToken cancellationToken) =>
|
||
index == failAt ? throw new IOException($"frame {index} is unreadable") : inner.GetFrameAsync(index, maxLongEdge, purpose, cancellationToken);
|
||
}
|
||
}
|