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>
80 lines
2.9 KiB
C#
80 lines
2.9 KiB
C#
using Chronos.Core.Codecs.Jpeg;
|
|
using Chronos.Testing;
|
|
using static Chronos.Core.Tests.Codecs.CodecTestData;
|
|
|
|
namespace Chronos.Core.Tests.Codecs;
|
|
|
|
/// <summary>Decoder output against libjpeg-turbo's djpeg (accurate integer IDCT) on cjpeg-produced fixtures.</summary>
|
|
public sealed class JpegDecoderTests(TestContext context)
|
|
{
|
|
[Theory]
|
|
[Case("b444", "4:4:4")]
|
|
[Case("b422", "4:2:2")]
|
|
[Case("b420", "4:2:0")]
|
|
[Case("b440", "4:4:0")]
|
|
[Case("b411", "4:1:1")]
|
|
[Case("p420", "4:2:0")]
|
|
[Case("p444", "4:4:4")]
|
|
[Case("r420", "4:2:0")]
|
|
[Case("r444", "4:4:4")]
|
|
public void MatchesDjpeg(string name, string sampling)
|
|
{
|
|
var data = Fixture($"jpeg/{name}.jpg");
|
|
var reference = ReadPnm(Fixture($"jpeg/{name}.ppm"));
|
|
var image = JpegDecoder.Decode(data);
|
|
Assert.Equal(reference.Width, image.Width);
|
|
Assert.Equal(reference.Height, image.Height);
|
|
Assert.Equal(3, image.Components);
|
|
Assert.Equal(sampling, image.Info.SamplingNotation);
|
|
Assert.Empty(image.Warnings);
|
|
var diff = MaxAbsDiff(image.Pixels8, reference.Samples);
|
|
context.Log($"{name}: max |diff| = {diff}");
|
|
Assert.LessOrEqual(diff, 2);
|
|
}
|
|
|
|
[Theory]
|
|
[Case("gray")]
|
|
[Case("pgray")]
|
|
public void GrayMatchesDjpeg(string name)
|
|
{
|
|
var image = JpegDecoder.Decode(Fixture($"jpeg/{name}.jpg"));
|
|
var reference = ReadPnm(Fixture($"jpeg/{name}.pgm"));
|
|
Assert.Equal(1, image.Components);
|
|
Assert.Equal(JpegColorSpace.Gray, image.Info.ColorSpace);
|
|
Assert.LessOrEqual(MaxAbsDiff(image.Pixels8, reference.Samples), 2);
|
|
}
|
|
|
|
[Test]
|
|
public void ReplicatedUpsamplingMatchesDjpegNoSmooth()
|
|
{
|
|
var image = JpegDecoder.Decode(Fixture("jpeg/b420.jpg"), new JpegDecodeOptions { FancyUpsampling = false });
|
|
Assert.LessOrEqual(MaxAbsDiff(image.Pixels8, ReadPnm(Fixture("jpeg/b420-nosmooth.ppm")).Samples), 2);
|
|
}
|
|
|
|
[Test]
|
|
public void ReadInfoParsesHeadersOnly()
|
|
{
|
|
var info = JpegDecoder.ReadInfo(Fixture("jpeg/p420.jpg"));
|
|
Assert.Equal(61, info.Width);
|
|
Assert.Equal(45, info.Height);
|
|
Assert.Equal(JpegProcess.Progressive, info.Process);
|
|
Assert.Equal(JpegColorSpace.YCbCr, info.ColorSpace);
|
|
Assert.Equal(8, info.Precision);
|
|
var restart = JpegDecoder.ReadInfo(Fixture("jpeg/r444.jpg"));
|
|
Assert.Equal(5, restart.RestartInterval);
|
|
}
|
|
|
|
[Test]
|
|
public void AdobeYcckIsConvertedToRgb()
|
|
{
|
|
var image = JpegDecoder.Decode(Fixture("jpeg/cmyk.jpg"));
|
|
Assert.Equal(JpegColorSpace.Ycck, image.Info.ColorSpace);
|
|
Assert.Equal(4, image.Info.Components);
|
|
Assert.Equal(3, image.Components);
|
|
var source = ReadPnm(Fixture("src.ppm"));
|
|
var psnr = Psnr(image.Pixels8, source.Bytes);
|
|
context.Log($"YCCK round trip PSNR {psnr:F1} dB");
|
|
Assert.Greater(psnr, 30);
|
|
}
|
|
}
|