From 04e7311be378fc7b6d982cd4ec315218bd0cbad4 Mon Sep 17 00:00:00 2001 From: routersys Date: Tue, 29 Sep 2026 17:11:00 +0900 Subject: [PATCH] =?UTF-8?q?=E5=AE=9F=E6=A9=9F=E6=8F=8F=E7=94=BB=E3=81=A7?= =?UTF-8?q?=E6=A4=9C=E8=A8=BC=E3=81=99=E3=82=8B=E3=83=8F=E3=83=BC=E3=83=8D?= =?UTF-8?q?=E3=82=B9=E3=82=92=E8=BF=BD=E5=8A=A0=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WaveOptics.Harness/Golden.cs | 55 ++++ WaveOptics.Harness/GpuTimer.cs | 63 ++++ WaveOptics.Harness/HarnessArguments.cs | 88 +++++ WaveOptics.Harness/HarnessCases.cs | 100 ++++++ WaveOptics.Harness/HarnessImage.cs | 59 ++++ WaveOptics.Harness/HarnessRenderer.cs | 262 +++++++++++++++ WaveOptics.Harness/HostAssemblyResolver.cs | 37 +++ WaveOptics.Harness/ImageComparison.cs | 46 +++ WaveOptics.Harness/Program.cs | 328 +++++++++++++++++++ WaveOptics.Harness/SyntheticImage.cs | 51 +++ WaveOptics.Harness/WaveOptics.Harness.csproj | 62 ++++ WaveOptics.Harness/golden.json | 227 +++++++++++++ WaveOptics.slnx | 1 + 13 files changed, 1379 insertions(+) create mode 100644 WaveOptics.Harness/Golden.cs create mode 100644 WaveOptics.Harness/GpuTimer.cs create mode 100644 WaveOptics.Harness/HarnessArguments.cs create mode 100644 WaveOptics.Harness/HarnessCases.cs create mode 100644 WaveOptics.Harness/HarnessImage.cs create mode 100644 WaveOptics.Harness/HarnessRenderer.cs create mode 100644 WaveOptics.Harness/HostAssemblyResolver.cs create mode 100644 WaveOptics.Harness/ImageComparison.cs create mode 100644 WaveOptics.Harness/Program.cs create mode 100644 WaveOptics.Harness/SyntheticImage.cs create mode 100644 WaveOptics.Harness/WaveOptics.Harness.csproj create mode 100644 WaveOptics.Harness/golden.json diff --git a/WaveOptics.Harness/Golden.cs b/WaveOptics.Harness/Golden.cs new file mode 100644 index 0000000..2919107 --- /dev/null +++ b/WaveOptics.Harness/Golden.cs @@ -0,0 +1,55 @@ +using System.IO; +using System.Reflection; +using System.Text.Encodings.Web; +using System.Text.Json; + +namespace WaveOptics.Harness; + +internal sealed record GoldenCase(string Name, IReadOnlyList Frames, string Hash); + +internal sealed record Golden(string Adapter, string Driver, string Input, string Canvas, IReadOnlyList Cases) +{ + const string FileName = "golden.json"; + const string DirectoryKey = "HarnessDirectory"; + + static readonly JsonSerializerOptions Options = new() + { + Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping, + PropertyNamingPolicy = JsonNamingPolicy.CamelCase, + WriteIndented = true, + NewLine = "\n", + }; + + public static string PathFor(HarnessImage image) + => Path.Combine(ReadDirectory(), image.Key is null ? FileName : $"golden-{image.Key}.json"); + + public static Golden Load(string path) + { + if (!File.Exists(path)) + throw new HarnessException($"基準値がありません。先に --golden で書いてください。{path}"); + Golden? golden; + try + { + golden = JsonSerializer.Deserialize(File.ReadAllBytes(path), Options); + } + catch (JsonException exception) + { + throw new HarnessException($"基準値を読めません。{path} {exception.Message}"); + } + + if (golden is not { Adapter: not null, Driver: not null, Input: not null, Canvas: not null, Cases: not null } + || golden.Cases.Any(item => item is not { Name: not null, Frames: not null, Hash: not null })) + throw new HarnessException($"基準値の項目が足りません。{path}"); + if (golden.Cases.Select(item => item.Name).Distinct(StringComparer.Ordinal).Count() != golden.Cases.Count) + throw new HarnessException($"基準値のケース名が重複しています。{path}"); + return golden; + } + + public void Save(string path) => File.WriteAllBytes(path, JsonSerializer.SerializeToUtf8Bytes(this, Options)); + + static string ReadDirectory() + => typeof(Golden).Assembly + .GetCustomAttributes() + .FirstOrDefault(attribute => string.Equals(attribute.Key, DirectoryKey, StringComparison.Ordinal)) + ?.Value ?? throw new HarnessException($"アセンブリに {DirectoryKey} がありません。"); +} diff --git a/WaveOptics.Harness/GpuTimer.cs b/WaveOptics.Harness/GpuTimer.cs new file mode 100644 index 0000000..485f23b --- /dev/null +++ b/WaveOptics.Harness/GpuTimer.cs @@ -0,0 +1,63 @@ +using System.Diagnostics; +using Vortice.Direct3D11; + +namespace WaveOptics.Harness; + +internal sealed class GpuTimer : IDisposable +{ + static readonly TimeSpan ResolveTimeout = TimeSpan.FromSeconds(5); + + readonly ID3D11DeviceContext context; + readonly ID3D11Query disjoint; + readonly ID3D11Query start; + readonly ID3D11Query stop; + + public GpuTimer(ID3D11Device device, ID3D11DeviceContext context) + { + this.context = context; + disjoint = device.CreateQuery(new QueryDescription(QueryType.TimestampDisjoint, QueryFlags.None)); + start = device.CreateQuery(new QueryDescription(QueryType.Timestamp, QueryFlags.None)); + stop = device.CreateQuery(new QueryDescription(QueryType.Timestamp, QueryFlags.None)); + } + + public void Begin() + { + context.Begin(disjoint); + context.End(start); + } + + public void End() + { + context.End(stop); + context.End(disjoint); + } + + public TimeSpan? Resolve() + { + if (!Wait(disjoint, out var timing) || timing.Disjoint || timing.Frequency == 0UL) + return null; + if (!Wait(start, out var began) || !Wait(stop, out var ended) || ended < began) + return null; + return TimeSpan.FromSeconds((ended - began) / (double)timing.Frequency); + } + + bool Wait(ID3D11Query query, out T value) where T : unmanaged + { + var elapsed = Stopwatch.StartNew(); + while (!context.GetData(query, out value)) + { + if (elapsed.Elapsed > ResolveTimeout) + return false; + Thread.Yield(); + } + + return true; + } + + public void Dispose() + { + stop.Dispose(); + start.Dispose(); + disjoint.Dispose(); + } +} diff --git a/WaveOptics.Harness/HarnessArguments.cs b/WaveOptics.Harness/HarnessArguments.cs new file mode 100644 index 0000000..90e1ebd --- /dev/null +++ b/WaveOptics.Harness/HarnessArguments.cs @@ -0,0 +1,88 @@ +namespace WaveOptics.Harness; + +internal sealed class HarnessException(string message) : Exception(message); + +internal enum HarnessMode +{ + Render, + Golden, + Verify, + Transition, + Compare, + Benchmark, +} + +internal sealed record HarnessArguments(HarnessMode Mode, string? Input, string? OutputDirectory, string? Before, string? After) +{ + public const string Usage = """ + 使い方: + [<出力先>] [--input <画像>] ケースを描き、PNG とハッシュを出します + --golden [--input <画像>] 基準値を golden.json に書きます + --verify [--input <画像>] 基準値と照合します + --transition [<出力先>] [--input <画像>] 設定を変えた後とフレームを進めた後の描画を、作り直した描画と照合します + --compare <前> <後> 2 つの出力先の PNG を画素ごとに比べます + --benchmark [--input <画像>] 描画を計測します + """; + + public static HarnessArguments Parse(string[] arguments) + { + HarnessMode? mode = null; + string? input = null; + var positionals = new List(); + for (var index = 0; index < arguments.Length; index++) + { + var argument = arguments[index]; + switch (argument) + { + case "--golden": + mode = Select(mode, HarnessMode.Golden); + break; + case "--verify": + mode = Select(mode, HarnessMode.Verify); + break; + case "--transition": + mode = Select(mode, HarnessMode.Transition); + break; + case "--compare": + mode = Select(mode, HarnessMode.Compare); + break; + case "--benchmark": + mode = Select(mode, HarnessMode.Benchmark); + break; + case "--input": + if (index + 1 >= arguments.Length) + throw new HarnessException("--input には画像のパスを続けてください。"); + input = arguments[++index]; + break; + default: + if (argument.StartsWith('-')) + throw new HarnessException($"不明なオプションです。{argument}"); + positionals.Add(argument); + break; + } + } + + var selected = mode ?? HarnessMode.Render; + switch (selected) + { + case HarnessMode.Compare: + if (positionals.Count != 2) + throw new HarnessException("--compare には前と後の出力先を続けてください。"); + if (input is not null) + throw new HarnessException("--compare に --input は使えません。"); + return new HarnessArguments(HarnessMode.Compare, null, null, positionals[0], positionals[1]); + case HarnessMode.Render: + case HarnessMode.Transition: + if (positionals.Count > 1) + throw new HarnessException($"余分な引数です。{positionals[1]}"); + return new HarnessArguments(selected, input, positionals.FirstOrDefault(), null, null); + default: + if (positionals.Count > 0) + throw new HarnessException($"余分な引数です。{positionals[0]}"); + return new HarnessArguments(selected, input, null, null, null); + } + } + + static HarnessMode Select(HarnessMode? current, HarnessMode next) + => current is null ? next : throw new HarnessException("モードは 1 つだけ指定してください。"); +} diff --git a/WaveOptics.Harness/HarnessCases.cs b/WaveOptics.Harness/HarnessCases.cs new file mode 100644 index 0000000..3e3d59c --- /dev/null +++ b/WaveOptics.Harness/HarnessCases.cs @@ -0,0 +1,100 @@ +using System.Globalization; +using WaveOptics.Effects; +using YukkuriMovieMaker.Commons; +using YukkuriMovieMaker.Json; + +namespace WaveOptics.Harness; + +internal static class HarnessCases +{ + public static IEnumerable<(string Name, WaveOpticsEffect Effect, IReadOnlyList Frames)> All() + { + yield return ("default", Create(), [0]); + yield return ("default-frames-0-8", Create(), Enumerable.Range(0, 9).ToArray()); + yield return ("amount-0", Create(effect => effect.Amount.Values[0].Value = 0), [0]); + yield return ("amount-50", Create(effect => effect.Amount.Values[0].Value = 50), [0]); + yield return ("gain-50", Create(effect => effect.Gain.Values[0].Value = 50), [0]); + yield return ("gain-400", Create(effect => effect.Gain.Values[0].Value = 400), [0]); + yield return ("gain-400-amount-50", Create(effect => + { + effect.Gain.Values[0].Value = 400; + effect.Amount.Values[0].Value = 50; + }), [0]); + yield return ("wavelength-380", Create(effect => effect.Wavelength.Values[0].Value = 380), [0]); + yield return ("wavelength-780", Create(effect => effect.Wavelength.Values[0].Value = 780), [0]); + yield return ("f-number-4", Create(effect => effect.FNumber.Values[0].Value = 4), [0]); + yield return ("f-number-64", Create(effect => effect.FNumber.Values[0].Value = 64), [0]); + yield return ("pixel-pitch-0.25", Create(effect => effect.PixelPitch.Values[0].Value = 0.25), [0]); + yield return ("pixel-pitch-2", Create(effect => effect.PixelPitch.Values[0].Value = 2), [0]); + yield return ("kernel-radius-1", Create(effect => effect.KernelRadius = 1), [0]); + yield return ("kernel-radius-5", Create(effect => effect.KernelRadius = 5), [0]); + yield return ("quality-draft", Create(effect => effect.Quality = WaveOpticsQuality.Draft), [0]); + yield return ("quality-high", Create(effect => effect.Quality = WaveOpticsQuality.High), [0]); + yield return ("aperture-polygon", Create(effect => effect.ApertureShape = WaveOpticsApertureShape.RegularPolygon), [0]); + yield return ("blade-count-3", Create(effect => + { + effect.ApertureShape = WaveOpticsApertureShape.RegularPolygon; + effect.BladeCount = 3; + }), [0]); + yield return ("blade-count-32", Create(effect => + { + effect.ApertureShape = WaveOpticsApertureShape.RegularPolygon; + effect.BladeCount = 32; + }), [0]); + yield return ("blade-rotation-30", Create(effect => + { + effect.ApertureShape = WaveOpticsApertureShape.RegularPolygon; + effect.BladeRotation.Values[0].Value = 30; + }), [0]); + yield return ("obstruction-50", Create(effect => effect.Obstruction.Values[0].Value = 50), [0]); + yield return ("defocus-1", Create(effect => effect.Defocus.Values[0].Value = 1), [0]); + yield return ("astigmatism-vertical-1", Create(effect => effect.AstigmatismVertical.Values[0].Value = 1), [0]); + yield return ("astigmatism-oblique-1", Create(effect => effect.AstigmatismOblique.Values[0].Value = 1), [0]); + yield return ("coma-horizontal-1", Create(effect => effect.ComaHorizontal.Values[0].Value = 1), [0]); + yield return ("coma-vertical-1", Create(effect => effect.ComaVertical.Values[0].Value = 1), [0]); + yield return ("spherical-1", Create(effect => effect.Spherical.Values[0].Value = 1), [0]); + yield return ("defocus-animated-frames-0-8", Create(effect => effect.Defocus.CopyFrom(Linear(0d, 3d))), Enumerable.Range(0, 9).ToArray()); + } + + public static IEnumerable<(string Name, Func Create, Action Change, int Frame)> Transitions() + { + yield return ("amount-100-to-50", () => Create(), effect => effect.Amount.Values[0].Value = 50, 0); + yield return ("gain-100-to-400", () => Create(), effect => effect.Gain.Values[0].Value = 400, 0); + yield return ("wavelength-550-to-780", () => Create(), effect => effect.Wavelength.Values[0].Value = 780, 0); + yield return ("f-number-8-to-32", () => Create(), effect => effect.FNumber.Values[0].Value = 32, 0); + yield return ("pixel-pitch-4-to-2", () => Create(), effect => effect.PixelPitch.Values[0].Value = 2, 0); + yield return ("kernel-radius-15-to-5", () => Create(), effect => effect.KernelRadius = 5, 0); + yield return ("quality-standard-to-high", () => Create(), effect => effect.Quality = WaveOpticsQuality.High, 0); + yield return ("aperture-circular-to-polygon", () => Create(), effect => effect.ApertureShape = WaveOpticsApertureShape.RegularPolygon, 0); + yield return ("blade-count-6-to-5", () => Create(effect => effect.ApertureShape = WaveOpticsApertureShape.RegularPolygon), effect => effect.BladeCount = 5, 0); + yield return ("blade-rotation-0-to-30", () => Create(effect => effect.ApertureShape = WaveOpticsApertureShape.RegularPolygon), effect => effect.BladeRotation.Values[0].Value = 30, 0); + yield return ("obstruction-0-to-50", () => Create(), effect => effect.Obstruction.Values[0].Value = 50, 0); + yield return ("defocus-0-to-1", () => Create(), effect => effect.Defocus.Values[0].Value = 1, 0); + yield return ("astigmatism-vertical-0-to-1", () => Create(), effect => effect.AstigmatismVertical.Values[0].Value = 1, 0); + yield return ("astigmatism-oblique-0-to-1", () => Create(), effect => effect.AstigmatismOblique.Values[0].Value = 1, 0); + yield return ("coma-horizontal-0-to-1", () => Create(), effect => effect.ComaHorizontal.Values[0].Value = 1, 0); + yield return ("coma-vertical-0-to-1", () => Create(), effect => effect.ComaVertical.Values[0].Value = 1, 0); + yield return ("spherical-0-to-1", () => Create(), effect => effect.Spherical.Values[0].Value = 1, 0); + yield return ("amount-100-to-0", () => Create(), effect => effect.Amount.Values[0].Value = 0, 0); + } + + public static IEnumerable<(string Name, WaveOpticsEffect Effect)> Benchmarks() + { + yield return ("quality-draft", Create(effect => effect.Quality = WaveOpticsQuality.Draft)); + yield return ("default", Create()); + yield return ("quality-high", Create(effect => effect.Quality = WaveOpticsQuality.High)); + yield return ("kernel-radius-5", Create(effect => effect.KernelRadius = 5)); + yield return ("defocus-animated", Create(effect => effect.Defocus.CopyFrom(Linear(0d, 3d)))); + yield return ("amount-0", Create(effect => effect.Amount.Values[0].Value = 0)); + } + + static Animation Linear(double from, double to) + => Json.LoadFromText(string.Create(CultureInfo.InvariantCulture, $$"""{"AnimationType":"直線移動","Values":[{"Value":{{from}}},{"Value":{{to}}}]}""")) ?? throw new HarnessException("アニメーションを読み込めません。"); + + public static WaveOpticsEffect Create(Action? configure = null) + { + var effect = new WaveOpticsEffect(); + configure?.Invoke(effect); + return effect; + } +} diff --git a/WaveOptics.Harness/HarnessImage.cs b/WaveOptics.Harness/HarnessImage.cs new file mode 100644 index 0000000..d9ce4ab --- /dev/null +++ b/WaveOptics.Harness/HarnessImage.cs @@ -0,0 +1,59 @@ +using System.IO; +using System.Security.Cryptography; +using System.Windows.Media; +using System.Windows.Media.Imaging; + +namespace WaveOptics.Harness; + +internal sealed record HarnessImage(int Width, int Height, byte[] Pixels, string Identity, string? Key) +{ + public const int BytesPerPixel = 4; + const int KeyLength = 16; + + public static HarnessImage Synthetic(int width, int height) + { + var pixels = SyntheticImage.Create(width, height); + return new HarnessImage(width, height, pixels, $"synthetic {width}x{height} {Convert.ToHexString(SHA256.HashData(pixels))[..KeyLength]}", null); + } + + public static HarnessImage Load(string path) + { + if (!File.Exists(path)) + throw new HarnessException($"入力の画像がありません。{path}"); + + var bytes = File.ReadAllBytes(path); + var (width, height, pixels) = Decode(bytes, path); + var hash = Convert.ToHexString(SHA256.HashData(bytes)); + return new HarnessImage(width, height, pixels, $"{hash} {width}x{height}", hash[..KeyLength]); + } + + public static (int Width, int Height, byte[] Pixels) LoadPremultiplied(string path) => Decode(File.ReadAllBytes(path), path); + + public static void Save(string path, byte[] pixels, int width, int height) + { + var source = BitmapSource.Create(width, height, 96, 96, PixelFormats.Pbgra32, null, pixels, width * BytesPerPixel); + var encoder = new PngBitmapEncoder(); + encoder.Frames.Add(BitmapFrame.Create(source)); + using var stream = File.Create(path); + encoder.Save(stream); + } + + static (int Width, int Height, byte[] Pixels) Decode(byte[] bytes, string path) + { + using var stream = new MemoryStream(bytes); + BitmapDecoder decoder; + try + { + decoder = BitmapDecoder.Create(stream, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.OnLoad); + } + catch (Exception exception) when (exception is NotSupportedException or FileFormatException) + { + throw new HarnessException($"画像として読めません。{path}"); + } + + var converted = new FormatConvertedBitmap(decoder.Frames[0], PixelFormats.Pbgra32, null, 0d); + var pixels = new byte[converted.PixelWidth * converted.PixelHeight * BytesPerPixel]; + converted.CopyPixels(pixels, converted.PixelWidth * BytesPerPixel, 0); + return (converted.PixelWidth, converted.PixelHeight, pixels); + } +} diff --git a/WaveOptics.Harness/HarnessRenderer.cs b/WaveOptics.Harness/HarnessRenderer.cs new file mode 100644 index 0000000..2814038 --- /dev/null +++ b/WaveOptics.Harness/HarnessRenderer.cs @@ -0,0 +1,262 @@ +using System.Diagnostics; +using System.Numerics; +using System.Runtime.InteropServices; +using Vortice.DCommon; +using Vortice.Direct2D1; +using Vortice.Direct2D1.Effects; +using Vortice.DXGI; +using Vortice.Mathematics; +using YukkuriMovieMaker.Commons; +using YukkuriMovieMaker.Player.Video; +using YukkuriMovieMaker.Plugin.Effects; + +namespace WaveOptics.Harness; + +internal sealed class HarnessRenderer : IDisposable +{ + const int Fps = 30; + const int Length = 300; + const int WarmupUpdates = 2000; + const int UpdateRepeats = 20; + const float Dpi = 96f; + + static readonly PixelFormat PixelFormat = new(Format.B8G8R8A8_UNorm, Vortice.DCommon.AlphaMode.Premultiplied); + + readonly GraphicsDevices devices; + readonly IGraphicsDevicesAndContext context; + readonly ID2D1Bitmap1 image; + readonly ID2D1Bitmap1 target; + readonly ID2D1Bitmap1 readback; + readonly ID2D1Bitmap1 sync; + readonly GpuTimer timer; + readonly AffineTransform2D placement; + readonly ID2D1Image centered; + + public HarnessRenderer(int canvasWidth, int canvasHeight, HarnessImage source) + { + CanvasWidth = canvasWidth; + CanvasHeight = canvasHeight; + + devices = new GraphicsDevices(); + context = devices.CreateContext(); + var deviceContext = context.DeviceContext; + var adapter = devices.DXGI.Adapter; + Adapter = adapter.Description.Description; + Driver = adapter.CheckInterfaceSupport(out var version) ? FormatDriverVersion(version) : "不明"; + + image = CreateBitmap(deviceContext, source.Width, source.Height, BitmapOptions.None); + image.CopyFromMemory(source.Pixels, source.Width * HarnessImage.BytesPerPixel); + target = CreateBitmap(deviceContext, canvasWidth, canvasHeight, BitmapOptions.Target); + readback = CreateBitmap(deviceContext, canvasWidth, canvasHeight, BitmapOptions.CpuRead | BitmapOptions.CannotDraw); + sync = CreateBitmap(deviceContext, 1, 1, BitmapOptions.CpuRead | BitmapOptions.CannotDraw); + timer = new GpuTimer(devices.D3D.Device, devices.D3D.DeviceContext); + + placement = new AffineTransform2D(deviceContext) + { + TransformMatrix = Matrix3x2.CreateTranslation(-source.Width * 0.5f, -source.Height * 0.5f), + }; + placement.SetInput(0, image, true); + centered = placement.Output; + } + + public int CanvasWidth { get; } + + public int CanvasHeight { get; } + + public string Adapter { get; } + + public string Driver { get; } + + public byte[][] Render(IVideoEffect effect, IReadOnlyList frames) + { + if (frames.Count == 0) + throw new ArgumentException("フレームを 1 つ以上指定してください。", nameof(frames)); + + using var processor = effect.CreateVideoEffect(context); + processor.SetInput(centered); + try + { + var rendered = new byte[frames.Count][]; + for (var index = 0; index < frames.Count; index++) + { + processor.Update(Describe(frames[index])); + rendered[index] = Capture(processor.Output); + } + + return rendered; + } + finally + { + processor.ClearInput(); + } + } + + public (byte[] Direct, byte[] Transitioned) RenderTransition(Func create, Action change, int frame) + where TEffect : IVideoEffect + { + var settled = create(); + change(settled); + var direct = Render(settled, [frame])[0]; + + var live = create(); + using var processor = live.CreateVideoEffect(context); + processor.SetInput(centered); + try + { + processor.Update(Describe(frame)); + _ = Capture(processor.Output); + change(live); + processor.Update(Describe(frame)); + return (direct, Capture(processor.Output)); + } + finally + { + processor.ClearInput(); + } + } + + public Measurement Measure(IVideoEffect effect, int frames, bool moving) + { + var descriptions = new EffectDescription[frames]; + for (var frame = 0; frame < frames; frame++) + descriptions[frame] = Describe(moving ? frame : 0); + + using var processor = effect.CreateVideoEffect(context); + processor.SetInput(centered); + var output = processor.Output; + try + { + for (var index = 0; index < WarmupUpdates; index++) + processor.Update(descriptions[index % frames]); + for (var frame = 0; frame < frames; frame++) + { + processor.Update(descriptions[frame]); + Submit(output); + } + Synchronize(); + + var cpu = TimeSpan.MaxValue; + for (var frame = 0; frame < frames; frame++) + { + var elapsed = Stopwatch.StartNew(); + processor.Update(descriptions[frame]); + Submit(output); + elapsed.Stop(); + cpu = elapsed.Elapsed < cpu ? elapsed.Elapsed : cpu; + } + Synchronize(); + + TimeSpan? gpu = null; + for (var frame = 0; frame < frames; frame++) + { + processor.Update(descriptions[frame]); + timer.Begin(); + Submit(output); + timer.End(); + if (timer.Resolve() is { } resolved && (gpu is null || resolved < gpu)) + gpu = resolved; + } + Synchronize(); + + var repeats = frames * UpdateRepeats; + var updates = Stopwatch.StartNew(); + for (var index = 0; index < repeats; index++) + processor.Update(descriptions[index % frames]); + updates.Stop(); + + GC.Collect(); + GC.WaitForPendingFinalizers(); + GC.Collect(); + var before = GC.GetAllocatedBytesForCurrentThread(); + var collections = GC.CollectionCount(0); + for (var frame = 0; frame < frames; frame++) + processor.Update(descriptions[frame]); + var allocated = (GC.GetAllocatedBytesForCurrentThread() - before) / frames; + var gen0 = GC.CollectionCount(0) - collections; + + return new Measurement(gpu, cpu, updates.Elapsed / repeats, allocated, gen0); + } + finally + { + processor.ClearInput(); + } + } + + byte[] Capture(ID2D1Image output) + { + Submit(output); + readback.CopyFromBitmap(target); + + var stride = CanvasWidth * HarnessImage.BytesPerPixel; + var pixels = new byte[stride * CanvasHeight]; + var mapped = readback.Map(MapOptions.Read); + try + { + for (var y = 0; y < CanvasHeight; y++) + Marshal.Copy(mapped.Bits + y * (int)mapped.Pitch, pixels, y * stride, stride); + } + finally + { + readback.Unmap(); + } + + return pixels; + } + + void Submit(ID2D1Image output) + { + var deviceContext = context.DeviceContext; + deviceContext.Target = target; + deviceContext.BeginDraw(); + deviceContext.Clear(new Color4(0f, 0f, 0f, 0f)); + deviceContext.DrawImage(output, new Vector2(CanvasWidth * 0.5f, CanvasHeight * 0.5f), null, InterpolationMode.NearestNeighbor, CompositeMode.SourceOver); + deviceContext.EndDraw(); + deviceContext.Target = null; + } + + void Synchronize() + { + sync.CopyFromBitmap(Int2.Zero, target, new RectI(0, 0, 1, 1)); + _ = sync.Map(MapOptions.Read); + sync.Unmap(); + } + + EffectDescription Describe(int frame) + { + var timeline = new TimelineSourceDescription( + new System.Drawing.Size(CanvasWidth, CanvasHeight), + new YukkuriMovieMaker.Player.Video.FrameTime(frame, Fps), + new YukkuriMovieMaker.Player.Video.FrameTime(Length, Fps), + Fps, + TimelineSourceUsage.Playing, + Guid.Empty, + []); + var item = new TimelineItemSourceDescription(timeline, frame, Length, 0); + var draw = new DrawDescription(Vector3.Zero, Vector2.Zero, Vector2.One, Vector3.Zero, Matrix4x4.Identity, InterpolationMode.Linear, 1d, false, []); + return new EffectDescription(item, draw, 0, 1, 0, 1); + } + + static ID2D1Bitmap1 CreateBitmap(ID2D1DeviceContext6 deviceContext, int width, int height, BitmapOptions options) + => deviceContext.CreateBitmap( + new SizeI(width, height), nint.Zero, width * HarnessImage.BytesPerPixel, + new BitmapProperties1(PixelFormat, Dpi, Dpi, options)); + + static string FormatDriverVersion(long version) + => $"{(version >> 48) & 0xFFFF}.{(version >> 32) & 0xFFFF}.{(version >> 16) & 0xFFFF}.{version & 0xFFFF}"; + + public void Dispose() + { + placement.SetInput(0, null, true); + centered.Dispose(); + placement.Dispose(); + timer.Dispose(); + sync.Dispose(); + readback.Dispose(); + target.Dispose(); + image.Dispose(); + context.Dispose(); + devices.Dispose(); + } + + public readonly record struct Measurement(TimeSpan? Gpu, TimeSpan Cpu, TimeSpan Update, long Allocated, int Gen0); +} diff --git a/WaveOptics.Harness/HostAssemblyResolver.cs b/WaveOptics.Harness/HostAssemblyResolver.cs new file mode 100644 index 0000000..a711097 --- /dev/null +++ b/WaveOptics.Harness/HostAssemblyResolver.cs @@ -0,0 +1,37 @@ +using System.IO; +using System.Reflection; +using System.Runtime.CompilerServices; + +namespace WaveOptics.Harness; + +internal static class HostAssemblyResolver +{ + const string MetadataKey = "HostDirectory"; + const string AssemblyExtension = ".dll"; + + public static string Directory { get; } = ReadDirectory(); + + public static bool IsConfigured => Directory.Length != 0 && System.IO.Directory.Exists(Directory); + + [ModuleInitializer] + internal static void Initialize() + { + if (!IsConfigured) + return; + + AppDomain.CurrentDomain.AssemblyResolve += (_, arguments) => + { + var name = new AssemblyName(arguments.Name).Name; + if (name is null) + return null; + + var candidate = Path.Combine(Directory, name + AssemblyExtension); + return File.Exists(candidate) ? Assembly.LoadFrom(candidate) : null; + }; + } + + static string ReadDirectory() => typeof(HostAssemblyResolver).Assembly + .GetCustomAttributes() + .FirstOrDefault(attribute => string.Equals(attribute.Key, MetadataKey, StringComparison.Ordinal)) + ?.Value ?? string.Empty; +} diff --git a/WaveOptics.Harness/ImageComparison.cs b/WaveOptics.Harness/ImageComparison.cs new file mode 100644 index 0000000..a2196a7 --- /dev/null +++ b/WaveOptics.Harness/ImageComparison.cs @@ -0,0 +1,46 @@ +namespace WaveOptics.Harness; + +internal readonly record struct ImageDifference(int Differing, int MaxDelta, int Left, int Top, int Right, int Bottom) +{ + public bool IsEmpty => Differing == 0; + + public override string ToString() + => IsEmpty ? "一致" : $"differing={Differing} maxDelta={MaxDelta} box=({Left},{Top})-({Right},{Bottom})"; +} + +internal static class ImageComparison +{ + public static ImageDifference Of(byte[] first, byte[] second, int width, int height) + { + if (first.Length != second.Length || first.Length != width * height * HarnessImage.BytesPerPixel) + throw new ArgumentException("画像の寸法が一致しません。"); + + var differing = 0; + var maxDelta = 0; + var left = width; + var top = height; + var right = -1; + var bottom = -1; + for (var y = 0; y < height; y++) + { + for (var x = 0; x < width; x++) + { + var offset = (y * width + x) * HarnessImage.BytesPerPixel; + var delta = 0; + for (var channel = 0; channel < HarnessImage.BytesPerPixel; channel++) + delta = Math.Max(delta, Math.Abs(first[offset + channel] - second[offset + channel])); + if (delta == 0) + continue; + + differing++; + maxDelta = Math.Max(maxDelta, delta); + left = Math.Min(left, x); + top = Math.Min(top, y); + right = Math.Max(right, x); + bottom = Math.Max(bottom, y); + } + } + + return differing == 0 ? default : new ImageDifference(differing, maxDelta, left, top, right, bottom); + } +} diff --git a/WaveOptics.Harness/Program.cs b/WaveOptics.Harness/Program.cs new file mode 100644 index 0000000..157c60d --- /dev/null +++ b/WaveOptics.Harness/Program.cs @@ -0,0 +1,328 @@ +using System.IO; +using System.IO.Packaging; +using System.Security.Cryptography; +using WaveOptics.Harness; +using SharpGen.Runtime; + +const int CanvasWidth = 1280; +const int CanvasHeight = 720; +const int ImageWidth = 640; +const int ImageHeight = 480; +const int FullHdWidth = 1920; +const int FullHdHeight = 1080; + +_ = PackUriHelper.UriSchemePack; + +HarnessArguments arguments; +try +{ + arguments = HarnessArguments.Parse(args); +} +catch (HarnessException exception) +{ + Console.Error.WriteLine(exception.Message); + Console.Error.WriteLine(HarnessArguments.Usage); + return 2; +} + +try +{ + if (arguments.Mode == HarnessMode.Compare) + return Compare(arguments.Before!, arguments.After!); + + var outputDirectory = arguments.OutputDirectory ?? Path.Combine(AppContext.BaseDirectory, "harness-output"); + if (arguments.Mode == HarnessMode.Benchmark) + { + if (arguments.Input is { } benchmarkInput) + { + Benchmark(HarnessImage.Load(benchmarkInput)); + } + else + { + Benchmark(HarnessImage.Synthetic(CanvasWidth, CanvasHeight)); + Benchmark(HarnessImage.Synthetic(FullHdWidth, FullHdHeight)); + } + + return 0; + } + + var image = arguments.Input is { } input ? HarnessImage.Load(input) : HarnessImage.Synthetic(ImageWidth, ImageHeight); + using var renderer = new HarnessRenderer(CanvasWidth, CanvasHeight, image); + return arguments.Mode switch + { + HarnessMode.Golden => WriteGolden(renderer, image), + HarnessMode.Verify => Verify(renderer, image), + HarnessMode.Transition => Transition(renderer, outputDirectory), + _ => Render(renderer, outputDirectory), + }; +} +catch (Exception exception) when (exception is HarnessException or SharpGenException) +{ + Console.Error.WriteLine(exception.Message); + return 2; +} + +static int Render(HarnessRenderer renderer, string outputDirectory) +{ + Directory.CreateDirectory(outputDirectory); + var failures = 0; + var cases = Evaluate(renderer, (golden, files, frames) => + { + Console.WriteLine($"{golden.Name}: {golden.Hash}"); + for (var index = 0; index < files.Length; index++) + { + HarnessImage.Save(Path.Combine(outputDirectory, files[index]), frames[index], renderer.CanvasWidth, renderer.CanvasHeight); + var opaque = CountOpaque(frames[index]); + Console.WriteLine($" {files[index]} opaque={opaque}"); + if (opaque == 0) + { + Console.Error.WriteLine($"{files[index]}: 出力が完全に透明です。"); + failures++; + } + } + }); + Console.WriteLine($"-> {outputDirectory}"); + return failures + CountDuplicates(cases) == 0 ? 0 : 1; +} + +static int WriteGolden(HarnessRenderer renderer, HarnessImage image) +{ + var cases = Evaluate(renderer, null); + if (CountDuplicates(cases) != 0) + return 1; + if (cases.Count == 0) + Console.Error.WriteLine("ケースがありません。HarnessCases に書き足してください。"); + + var golden = new Golden(renderer.Adapter, renderer.Driver, image.Identity, $"{renderer.CanvasWidth}x{renderer.CanvasHeight}", cases); + var path = Golden.PathFor(image); + golden.Save(path); + Console.WriteLine($"adapter: {golden.Adapter} (driver {golden.Driver})"); + Console.WriteLine($"input: {golden.Input}"); + foreach (var (name, _, hash) in cases) + Console.WriteLine($"{name}: {hash}"); + Console.WriteLine($"-> {path}"); + return 0; +} + +static int Verify(HarnessRenderer renderer, HarnessImage image) +{ + var golden = Golden.Load(Golden.PathFor(image)); + var canvas = $"{renderer.CanvasWidth}x{renderer.CanvasHeight}"; + if (golden.Input != image.Identity || golden.Canvas != canvas) + { + Console.Error.WriteLine($"基準値は入力 {golden.Input} とキャンバス {golden.Canvas} で書かれています。今回は入力 {image.Identity} とキャンバス {canvas} です。"); + return 1; + } + + if (golden.Adapter != renderer.Adapter || golden.Driver != renderer.Driver) + Console.Error.WriteLine($"基準値は {golden.Adapter} (driver {golden.Driver}) で書かれています。今回は {renderer.Adapter} (driver {renderer.Driver}) です。画素の差はこの違いから来ることがあります。"); + + var failures = 0; + var current = Evaluate(renderer, null).ToDictionary(item => item.Name, StringComparer.Ordinal); + if (golden.Cases.Count == 0 && current.Count == 0) + Console.Error.WriteLine("ケースがありません。HarnessCases に書き足してください。"); + foreach (var (name, frames, hash) in golden.Cases) + { + if (!current.Remove(name, out var actual)) + { + Console.Error.WriteLine($"{name}: ケースがありません。基準値を書き直してください。"); + failures++; + } + else if (!actual.Frames.SequenceEqual(frames)) + { + Console.Error.WriteLine($"{name}: フレームが違います。基準値 [{string.Join(", ", frames)}]、今回 [{string.Join(", ", actual.Frames)}]。基準値を書き直してください。"); + failures++; + } + else if (actual.Hash != hash) + { + Console.Error.WriteLine($"{name}: 一致しません。基準値 {hash}、今回 {actual.Hash}"); + failures++; + } + else + { + Console.WriteLine($"{name}: 一致"); + } + } + + foreach (var name in current.Keys) + { + Console.Error.WriteLine($"{name}: 基準値にありません。基準値を書き直してください。"); + failures++; + } + + return failures == 0 ? 0 : 1; +} + +static int Transition(HarnessRenderer renderer, string outputDirectory) +{ + var failures = 0; + foreach (var (name, create, change, frame) in HarnessCases.Transitions()) + { + var (direct, transitioned) = renderer.RenderTransition(create, change, frame); + var difference = ImageComparison.Of(direct, transitioned, renderer.CanvasWidth, renderer.CanvasHeight); + if (difference.IsEmpty) + { + Console.WriteLine($"{name}: 一致"); + continue; + } + + failures++; + Directory.CreateDirectory(outputDirectory); + HarnessImage.Save(Path.Combine(outputDirectory, name + "-direct.png"), direct, renderer.CanvasWidth, renderer.CanvasHeight); + HarnessImage.Save(Path.Combine(outputDirectory, name + "-transitioned.png"), transitioned, renderer.CanvasWidth, renderer.CanvasHeight); + Console.Error.WriteLine($"{name}: {difference}。設定を変えた後の描画が作り直した場合と違います。-> {outputDirectory}"); + } + + if (!HarnessCases.Transitions().Any() && !HarnessCases.All().Any(item => item.Frames.Count > 1)) + Console.Error.WriteLine("ケースがありません。HarnessCases に書き足してください。"); + + foreach (var (name, effect, frames) in HarnessCases.All()) + { + if (frames.Count < 2) + continue; + + var sequential = renderer.Render(effect, frames); + for (var index = 0; index < frames.Count; index++) + { + var fresh = renderer.Render(effect, [frames[index]])[0]; + var difference = ImageComparison.Of(fresh, sequential[index], renderer.CanvasWidth, renderer.CanvasHeight); + var label = $"{name}-f{frames[index]:D3}"; + if (difference.IsEmpty) + { + Console.WriteLine($"{label}: 一致"); + continue; + } + + failures++; + Directory.CreateDirectory(outputDirectory); + HarnessImage.Save(Path.Combine(outputDirectory, label + "-direct.png"), fresh, renderer.CanvasWidth, renderer.CanvasHeight); + HarnessImage.Save(Path.Combine(outputDirectory, label + "-transitioned.png"), sequential[index], renderer.CanvasWidth, renderer.CanvasHeight); + Console.Error.WriteLine($"{label}: {difference}。前のフレームから進めた描画が作り直した場合と違います。-> {outputDirectory}"); + } + } + + return failures == 0 ? 0 : 1; +} + +static int Compare(string beforeDirectory, string afterDirectory) +{ + if (!Directory.Exists(beforeDirectory) || !Directory.Exists(afterDirectory)) + throw new HarnessException("比べる出力先がありません。"); + + var failures = 0; + var names = Directory.EnumerateFiles(beforeDirectory, "*.png") + .Concat(Directory.EnumerateFiles(afterDirectory, "*.png")) + .Select(path => Path.GetFileName(path)) + .Distinct(StringComparer.OrdinalIgnoreCase) + .Order(StringComparer.OrdinalIgnoreCase) + .ToArray(); + if (names.Length == 0) + throw new HarnessException("比べる PNG がありません。"); + + foreach (var name in names) + { + var before = Path.Combine(beforeDirectory, name); + var after = Path.Combine(afterDirectory, name); + if (!File.Exists(before) || !File.Exists(after)) + { + Console.Error.WriteLine($"{name}: {(File.Exists(before) ? "後" : "前")}にありません。"); + failures++; + continue; + } + + var (beforeWidth, beforeHeight, beforePixels) = HarnessImage.LoadPremultiplied(before); + var (afterWidth, afterHeight, afterPixels) = HarnessImage.LoadPremultiplied(after); + if (beforeWidth != afterWidth || beforeHeight != afterHeight) + { + Console.Error.WriteLine($"{name}: 寸法が違います。前 {beforeWidth}x{beforeHeight}、後 {afterWidth}x{afterHeight}"); + failures++; + continue; + } + + var difference = ImageComparison.Of(beforePixels, afterPixels, beforeWidth, beforeHeight); + Console.WriteLine($"{name}: {difference}"); + if (!difference.IsEmpty) + failures++; + } + + return failures == 0 ? 0 : 1; +} + +static void Benchmark(HarnessImage image) +{ + const int Frames = 60; + + using var renderer = new HarnessRenderer(image.Width, image.Height, image); + Console.WriteLine($"adapter: {renderer.Adapter} (driver {renderer.Driver})"); + foreach (var (name, effect) in HarnessCases.Benchmarks()) + { + Report(image, name, "still", renderer.Measure(effect, Frames, moving: false)); + Report(image, name, "moving", renderer.Measure(effect, Frames, moving: true)); + } +} + +static void Report(HarnessImage image, string name, string motion, HarnessRenderer.Measurement measurement) + => Console.WriteLine( + $"{image.Width}x{image.Height} {name,-15} {motion,-6} " + + $"gpu={(measurement.Gpu is { } gpu ? gpu.TotalMilliseconds.ToString("F3") : "n/a"),7} " + + $"cpu={measurement.Cpu.TotalMilliseconds,7:F3} " + + $"update={measurement.Update.TotalMilliseconds,6:F3} " + + $"alloc={measurement.Allocated,6} gen0={measurement.Gen0}"); + +static List Evaluate(HarnessRenderer renderer, Action? report) +{ + var cases = new List(); + var names = new HashSet(StringComparer.Ordinal); + foreach (var (name, effect, frames) in HarnessCases.All()) + { + if (!names.Add(name)) + throw new HarnessException($"ケース名が重複しています。{name}"); + + var rendered = renderer.Render(effect, frames); + var files = new string[frames.Count]; + using var hash = IncrementalHash.CreateHash(HashAlgorithmName.SHA256); + for (var index = 0; index < frames.Count; index++) + { + hash.AppendData(rendered[index]); + files[index] = frames.Count == 1 ? name + ".png" : $"{name}-f{frames[index]:D3}.png"; + } + + var golden = new GoldenCase(name, frames, Convert.ToHexString(hash.GetHashAndReset())); + cases.Add(golden); + report?.Invoke(golden, files, rendered); + } + + return cases; +} + +static int CountDuplicates(IReadOnlyList cases) +{ + var duplicates = 0; + var seen = new Dictionary(StringComparer.Ordinal); + foreach (var (name, _, hash) in cases) + { + if (seen.TryGetValue(hash, out var first)) + { + Console.Error.WriteLine($"{name}: {first} と出力が一致します。設定がシェーダーへ届いていません。"); + duplicates++; + } + else + { + seen.Add(hash, name); + } + } + + return duplicates; +} + +static int CountOpaque(byte[] pixels) +{ + var count = 0; + for (var offset = HarnessImage.BytesPerPixel - 1; offset < pixels.Length; offset += HarnessImage.BytesPerPixel) + { + if (pixels[offset] != 0) + count++; + } + + return count; +} diff --git a/WaveOptics.Harness/SyntheticImage.cs b/WaveOptics.Harness/SyntheticImage.cs new file mode 100644 index 0000000..130fc0f --- /dev/null +++ b/WaveOptics.Harness/SyntheticImage.cs @@ -0,0 +1,51 @@ +namespace WaveOptics.Harness; + +internal static class SyntheticImage +{ + const int GridPitch = 32; + + public static byte[] Create(int width, int height) + { + var pixels = new byte[width * height * HarnessImage.BytesPerPixel]; + var plateLeft = width * 0.10f; + var plateRight = width * 0.56f; + var plateTop = height * 0.14f; + var plateBottom = height * 0.86f; + var discCenterX = width * 0.70f; + var discCenterY = height * 0.50f; + var discRadius = MathF.Min(width, height) * 0.28f; + + for (var y = 0; y < height; y++) + { + for (var x = 0; x < width; x++) + { + var positionX = x + 0.5f; + var positionY = y + 0.5f; + var plateInset = MathF.Min(MathF.Min(positionX - plateLeft, plateRight - positionX), MathF.Min(positionY - plateTop, plateBottom - positionY)); + var plateCoverage = Math.Clamp(plateInset + 0.5f, 0f, 1f); + var distance = MathF.Sqrt((positionX - discCenterX) * (positionX - discCenterX) + (positionY - discCenterY) * (positionY - discCenterY)); + var discCoverage = Math.Clamp(discRadius - distance + 0.5f, 0f, 1f); + if (plateCoverage == 0f && discCoverage == 0f) + continue; + + var onGrid = x % GridPitch == 0 || y % GridPitch == 0; + var plateWeight = plateCoverage * (1f - discCoverage); + var shade = 1f - distance / discRadius * 0.5f; + var red = (onGrid ? 0.25f : 0.82f) * plateWeight + 0.90f * shade * discCoverage; + var green = (onGrid ? 0.30f : 0.86f) * plateWeight + 0.45f * shade * discCoverage; + var blue = (onGrid ? 0.40f : 0.90f) * plateWeight + 0.30f * shade * discCoverage; + var alpha = plateWeight + discCoverage; + + var offset = (y * width + x) * HarnessImage.BytesPerPixel; + pixels[offset] = ToByte(blue); + pixels[offset + 1] = ToByte(green); + pixels[offset + 2] = ToByte(red); + pixels[offset + 3] = ToByte(alpha); + } + } + + return pixels; + } + + static byte ToByte(float premultiplied) => (byte)MathF.Round(Math.Clamp(premultiplied, 0f, 1f) * byte.MaxValue); +} diff --git a/WaveOptics.Harness/WaveOptics.Harness.csproj b/WaveOptics.Harness/WaveOptics.Harness.csproj new file mode 100644 index 0000000..6ef97c7 --- /dev/null +++ b/WaveOptics.Harness/WaveOptics.Harness.csproj @@ -0,0 +1,62 @@ + + + + Exe + net10.0-windows10.0.19041.0 + true + enable + enable + false + WaveOptics.Harness + WaveOptics.Harness + x64 + false + + + + + SkipPluginDeploy=true + + + + + + + + + + + $(YMM4DirPath)SharpGen.Runtime.dll + false + + + $(YMM4DirPath)Vortice.Direct2D1.dll + false + + + $(YMM4DirPath)Vortice.Direct3D11.dll + false + + + $(YMM4DirPath)Vortice.DirectX.dll + false + + + $(YMM4DirPath)Vortice.DXGI.dll + false + + + $(YMM4DirPath)Vortice.Mathematics.dll + false + + + $(YMM4DirPath)YukkuriMovieMaker.Controls.dll + false + + + $(YMM4DirPath)YukkuriMovieMaker.Plugin.dll + false + + + + diff --git a/WaveOptics.Harness/golden.json b/WaveOptics.Harness/golden.json new file mode 100644 index 0000000..dcb062a --- /dev/null +++ b/WaveOptics.Harness/golden.json @@ -0,0 +1,227 @@ +{ + "adapter": "Intel(R) Iris(R) Xe Graphics", + "driver": "32.0.101.7085", + "input": "synthetic 640x480 89838D8976198E40", + "canvas": "1280x720", + "cases": [ + { + "name": "default", + "frames": [ + 0 + ], + "hash": "A469E7E51012056DC3E4D061181D650BE5546258D21140B4483F8F8A36D13243" + }, + { + "name": "default-frames-0-8", + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8 + ], + "hash": "8A597AE128750BBF5CC9FAE9B4FD4D4C191D0C9583FF15CE274D3B57079FDBA5" + }, + { + "name": "amount-0", + "frames": [ + 0 + ], + "hash": "0A700F76CEDDBAD7C4B6A2C19D46939C1A93940E86C6EFEF1E5A53DB48D2A020" + }, + { + "name": "amount-50", + "frames": [ + 0 + ], + "hash": "972D77C63B5FD4A7FD3CD81E236B162BFB146FC01EF02794A123C796D4D3668B" + }, + { + "name": "gain-50", + "frames": [ + 0 + ], + "hash": "DCE8AB039EE284328AC3264D8C8488C07D395BAD342DC46B51A1298A81E02149" + }, + { + "name": "gain-400", + "frames": [ + 0 + ], + "hash": "7DD0FEB7ECDFB07C27F9F1697799D76FF4860753C1D5054D7D7EFC8EC52F1A89" + }, + { + "name": "gain-400-amount-50", + "frames": [ + 0 + ], + "hash": "F0FF073F2619E07A2B5F316D60BC86630809C4CB5391F18C2A34B4972BACB7BE" + }, + { + "name": "wavelength-380", + "frames": [ + 0 + ], + "hash": "8E3BA230B7E95C1A0A5599D22834A75054517F7C4304264EA8B0A7C51D2C0037" + }, + { + "name": "wavelength-780", + "frames": [ + 0 + ], + "hash": "BDD5240D633DC5E179298ED016A669D57EF36615DBC1681CEC28E526A73EC1E5" + }, + { + "name": "f-number-4", + "frames": [ + 0 + ], + "hash": "C399CD74BBC9793335B2D5BE222D1FBF359936B375BD3D94560D3B2820BADF75" + }, + { + "name": "f-number-64", + "frames": [ + 0 + ], + "hash": "521C36A8D501E843316C10A53B1986C890842EF8F049F3209122CC0C18CDF618" + }, + { + "name": "pixel-pitch-0.25", + "frames": [ + 0 + ], + "hash": "F95BFDB91473A828901ABB13620C62938759F0FC2E36E892F9588CFD4B53B8EB" + }, + { + "name": "pixel-pitch-2", + "frames": [ + 0 + ], + "hash": "D4BAECD0E8AF03B66F5250B3E41F7836B7784EDE5AA7FC7788BF91BD38FCCE3F" + }, + { + "name": "kernel-radius-1", + "frames": [ + 0 + ], + "hash": "615057E755E239A267A082D6D0D723DFE290CE582DD95C7B38EF0FD4FD588204" + }, + { + "name": "kernel-radius-5", + "frames": [ + 0 + ], + "hash": "5A0A4FE0A0C29F51EF5CEB57204D33083CC922E9B273E2A4117CA903F2798996" + }, + { + "name": "quality-draft", + "frames": [ + 0 + ], + "hash": "F77815DB78C7EDD835CF74CCADB680D16A7B5C1AC3280897DA453C81F7CFB38D" + }, + { + "name": "quality-high", + "frames": [ + 0 + ], + "hash": "6657EA3BE5C11BF0C62518ED51D17DA8E8712767F4380A24BE88B2249C4B4D74" + }, + { + "name": "aperture-polygon", + "frames": [ + 0 + ], + "hash": "0F385B535F072D63389B6E7797A674F045579B0C4D56345B38C9EC85273529AB" + }, + { + "name": "blade-count-3", + "frames": [ + 0 + ], + "hash": "73C92697D66FDA9D08AD12A38A27274D8E194413ED08F6ABC99D46E6B62C4646" + }, + { + "name": "blade-count-32", + "frames": [ + 0 + ], + "hash": "D22ACACAC9CB1749DC2C9191B76BC169FBD603A5FBE98787F1A938951109D8EC" + }, + { + "name": "blade-rotation-30", + "frames": [ + 0 + ], + "hash": "E3C17A24C3B90AB6E03F954223E5E60F941244744A277087C49138FD49D35685" + }, + { + "name": "obstruction-50", + "frames": [ + 0 + ], + "hash": "5ADBBBE9C952586FD4FBB0F46BEAF7FCD8AFE05DA364F2F1EC807E0CD87AE196" + }, + { + "name": "defocus-1", + "frames": [ + 0 + ], + "hash": "815F61E3711E6717A329BF502DD7089775727D9363478BC60C53F77BE79632ED" + }, + { + "name": "astigmatism-vertical-1", + "frames": [ + 0 + ], + "hash": "FB1E160C781EE3B210A866D4057686C57C51D52B9422DC9ABD0E2D95A63F5C87" + }, + { + "name": "astigmatism-oblique-1", + "frames": [ + 0 + ], + "hash": "E9C464550526AB2E4A31FAD210EF0BBCE08AF23D38E026D28407D71C47E5BB96" + }, + { + "name": "coma-horizontal-1", + "frames": [ + 0 + ], + "hash": "0ED7F862A552B5B25C967089FC6187D2D5DA8800737621DE57206FA3C04AE052" + }, + { + "name": "coma-vertical-1", + "frames": [ + 0 + ], + "hash": "F914B6D7E423048EC985FF26BCA0054F5AEE0509EB162CFC1A27506E46F5C9A1" + }, + { + "name": "spherical-1", + "frames": [ + 0 + ], + "hash": "16F3352EA389A79A3F33E2ED4852BD74F0F85BF1CFA4774AE289509177611332" + }, + { + "name": "defocus-animated-frames-0-8", + "frames": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8 + ], + "hash": "92C585F8976041BC4E676C98909D1DB4E975CC94F04D3E4EE79BE0A30200705B" + } + ] +} \ No newline at end of file diff --git a/WaveOptics.slnx b/WaveOptics.slnx index 749b2bc..d9dd553 100644 --- a/WaveOptics.slnx +++ b/WaveOptics.slnx @@ -10,6 +10,7 @@ +