refactor(render): keep render remarks in the Export localisation area
Plan, render and encoder remarks now share the Export area with the preset names; setups reject metadata that does not match the source. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
9 files changed
+24
-23
No files matched your search
@@ -92,7 +92,7 @@ public static partial class SelfTest
|
||||
{
|
||||
var plan = RenderPlan.Build(Regular(90), Timing(TimingMode.Remapped, curve: [new(0, 0), new(0.3, 0.6), new(0.5, 0.4), new(1, 1)]), new Rational(24, 1));
|
||||
RequireExact(plan);
|
||||
Require(plan.Warnings.Contains("Render.Plan.RemapNotMonotonic"), "the curve repair is not reported");
|
||||
Require(plan.Warnings.Contains("Export.Plan.RemapNotMonotonic"), "the curve repair is not reported");
|
||||
return Invariant($"{plan.Frames.Count} frames, {plan.Statistics.InterpolatedFrames} synthesised");
|
||||
});
|
||||
yield return Check("plan.fit", "Fit to duration rescales the plan exactly", () =>
|
||||
|
||||
@@ -476,8 +476,8 @@ public static partial class SelfTest
|
||||
var project = Plain with { ExcludedFrames = [.. Enumerable.Range(0, 6)] };
|
||||
var error = await CaptureAsync(() => Pipeline(context).RenderAsync(Input(Synthetic(6), project), Target(context, Preset("png-sequence")), cancellationToken: context.Cancellation))
|
||||
.ConfigureAwait(false);
|
||||
Require(error is RenderException { ReasonKey: "Render.Error.NoFrames" } && Directory.GetFileSystemEntries(context.WorkDirectory).Length == 0, "no NoFrames error");
|
||||
return "Render.Error.NoFrames";
|
||||
Require(error is RenderException { ReasonKey: "Export.Render.NoFrames" } && Directory.GetFileSystemEntries(context.WorkDirectory).Length == 0, "no NoFrames error");
|
||||
return "Export.Render.NoFrames";
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -82,13 +82,13 @@ public sealed class RenderGeometry
|
||||
var crop = NormalisedCrop(camera.Crop, warnings);
|
||||
if (!AspectRatio.TryParse(camera.Aspect.Resolve("source"), out var aspect))
|
||||
{
|
||||
warnings.Add(new RenderWarning("Render.Warning.AspectIgnored", camera.Aspect.Resolve(string.Empty)));
|
||||
warnings.Add(new RenderWarning("Export.Render.AspectIgnored", camera.Aspect.Resolve(string.Empty)));
|
||||
aspect = AspectRatio.Source;
|
||||
}
|
||||
var fixedSize = export.Width > 0 && export.Height > 0;
|
||||
var ratio = fixedSize ? export.Width / (double)export.Height : aspect.Resolve(sourceWidth, sourceHeight);
|
||||
if (fixedSize && !aspect.IsSource && double.Abs(aspect.Resolve(sourceWidth, sourceHeight) / ratio - 1) > 0.01)
|
||||
warnings.Add(new RenderWarning("Render.Warning.AspectFromPreset", aspect.ToString(), string.Create(CultureInfo.InvariantCulture, $"{export.Width}:{export.Height}")));
|
||||
warnings.Add(new RenderWarning("Export.Render.AspectFromPreset", aspect.ToString(), string.Create(CultureInfo.InvariantCulture, $"{export.Width}:{export.Height}")));
|
||||
var cropPixels = new RectD(crop.X * sourceWidth, crop.Y * sourceHeight, crop.Width * sourceWidth, crop.Height * sourceHeight);
|
||||
var fitted = AspectRatio.FitCrop(cropPixels, ratio, camera.OffsetX, camera.OffsetY);
|
||||
|
||||
@@ -152,7 +152,7 @@ public sealed class RenderGeometry
|
||||
if (crop is null) return full;
|
||||
if (crop.Length != 4 || !crop.All(double.IsFinite))
|
||||
{
|
||||
warnings.Add(new RenderWarning("Render.Warning.CropIgnored"));
|
||||
warnings.Add(new RenderWarning("Export.Render.CropIgnored"));
|
||||
return full;
|
||||
}
|
||||
var x = double.Clamp(crop[0], 0, 1);
|
||||
@@ -161,7 +161,7 @@ public sealed class RenderGeometry
|
||||
var h = double.Min(crop[3], 1 - y);
|
||||
if (w <= 1e-3 || h <= 1e-3)
|
||||
{
|
||||
warnings.Add(new RenderWarning("Render.Warning.CropIgnored"));
|
||||
warnings.Add(new RenderWarning("Export.Render.CropIgnored"));
|
||||
return full;
|
||||
}
|
||||
return new RectD(x, y, w, h);
|
||||
@@ -175,7 +175,7 @@ public sealed class RenderGeometry
|
||||
{
|
||||
if (!double.IsFinite(k.CenterX + k.CenterY + k.Zoom + k.Rotation))
|
||||
{
|
||||
warnings.Add(new RenderWarning("Render.Warning.KeyframeIgnored", k.Frame.ToString(CultureInfo.InvariantCulture)));
|
||||
warnings.Add(new RenderWarning("Export.Render.KeyframeIgnored", k.Frame.ToString(CultureInfo.InvariantCulture)));
|
||||
continue;
|
||||
}
|
||||
frames[k.Frame] = new CameraKeyframe(k.Frame, k.CenterX, k.CenterY, double.Max(1, k.Zoom), k.Rotation) { Easing = Easing(k.Easing, warnings) };
|
||||
@@ -200,7 +200,7 @@ public sealed class RenderGeometry
|
||||
&& double.TryParse(parts[2], NumberStyles.Float, CultureInfo.InvariantCulture, out var x2) && x2 is >= 0 and <= 1
|
||||
&& double.TryParse(parts[3], NumberStyles.Float, CultureInfo.InvariantCulture, out var y2) && double.IsFinite(y2))
|
||||
return new BezierEasing(x1, y1, x2, y2);
|
||||
warnings.Add(new RenderWarning("Render.Warning.EasingIgnored", text));
|
||||
warnings.Add(new RenderWarning("Export.Render.EasingIgnored", text));
|
||||
return BezierEasing.EaseInOut;
|
||||
}
|
||||
}
|
||||
@@ -60,7 +60,7 @@ public sealed class RenderPipeline(IReadOnlyList<IVideoEncoderProvider> encoders
|
||||
var notice = setup.Encoder.Notices.LastOrDefault() ?? new EncoderNotice(EncoderNotices.NoEncoder, setup.Encoder.Settings.Codec.ToString());
|
||||
throw new RenderException(notice.Key, $"No encoder can produce {target.Export.Codec} here ({setup.Encoder.Status})", notice.Args);
|
||||
}
|
||||
if (setup.Plan.Frames.Count == 0) throw new RenderException("Render.Error.NoFrames", "Every frame is excluded.");
|
||||
if (setup.Plan.Frames.Count == 0) throw new RenderException("Export.Render.NoFrames", "Every frame is excluded.");
|
||||
using var run = new RenderRun(input, corrections, setup, options, progress);
|
||||
return await run.ExecuteAsync(cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
@@ -135,7 +135,7 @@ internal sealed class RenderRun : IDisposable
|
||||
if (exposure.HighlightKnee is { } knee)
|
||||
{
|
||||
if (knee is > 0 and < 1) _knee = (float)knee;
|
||||
else _warnings.Add(new RenderWarning("Render.Warning.KneeIgnored", knee.ToString(CultureInfo.InvariantCulture)));
|
||||
else _warnings.Add(new RenderWarning("Export.Render.KneeIgnored", knee.ToString(CultureInfo.InvariantCulture)));
|
||||
}
|
||||
var motion = input.Project.Motion;
|
||||
_targetShutter = double.Clamp(ProjectValues.Get(motion.TargetShutterAngle, 180.0), 0, 360);
|
||||
|
||||
@@ -220,12 +220,12 @@ public sealed class RenderPlan
|
||||
}
|
||||
|
||||
var median = MedianInterval(captureTimes);
|
||||
if (mode is TimingMode.Adaptive or TimingMode.Interpolated && median is null) warnings.Add("Render.Plan.NoCaptureTimes");
|
||||
if (mode is TimingMode.Adaptive or TimingMode.Interpolated && median is null) warnings.Add("Export.Plan.NoCaptureTimes");
|
||||
var cutBefore = new bool[n];
|
||||
var entries = Timeline(captureTimes, included, mode, playback, median, options, cutBefore);
|
||||
if (entries.Length == 0)
|
||||
{
|
||||
warnings.Add("Render.Plan.NoFrames");
|
||||
warnings.Add("Export.Plan.NoFrames");
|
||||
var empty = new RenderPlanStatistics(n, n - included.Count, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, median);
|
||||
return new RenderPlan(mode, frameRate, playback, [], 0, [.. included], cutBefore, empty, warnings);
|
||||
}
|
||||
@@ -404,7 +404,7 @@ public sealed class RenderPlan
|
||||
xs.Add(x);
|
||||
ys.Add(value);
|
||||
}
|
||||
if (adjusted) warnings.Add("Render.Plan.RemapNotMonotonic");
|
||||
if (adjusted) warnings.Add("Export.Plan.RemapNotMonotonic");
|
||||
return new MonotoneSpline(xs.ToArray(), ys.ToArray());
|
||||
}
|
||||
|
||||
|
||||
@@ -141,10 +141,10 @@ public static class RenderPreparation
|
||||
if (regionMode != RegionMode.Off && mask is null && included.Count > 0)
|
||||
{
|
||||
mask = await SegmentAsync(input.Source, included, regionMode, options.AnalysisLongEdge, cancellationToken).ConfigureAwait(false);
|
||||
if (mask is null) warnings.Add(new RenderWarning("Render.Warning.RegionsUnavailable"));
|
||||
if (mask is null) warnings.Add(new RenderWarning("Export.Render.RegionsUnavailable"));
|
||||
else if (regionMode == RegionMode.Auto && mask.Confidence < MinimumRegionConfidence)
|
||||
{
|
||||
warnings.Add(new RenderWarning("Render.Warning.RegionsUnreliable", mask.Confidence.ToString("0.00", CultureInfo.InvariantCulture)));
|
||||
warnings.Add(new RenderWarning("Export.Render.RegionsUnreliable", mask.Confidence.ToString("0.00", CultureInfo.InvariantCulture)));
|
||||
mask = null;
|
||||
}
|
||||
}
|
||||
@@ -163,7 +163,7 @@ public static class RenderPreparation
|
||||
if (measureStabilization)
|
||||
{
|
||||
stabilization = pass.SolveStabilization(included, n);
|
||||
if (stabilization is null) warnings.Add(new RenderWarning("Render.Warning.StabilizationUnavailable"));
|
||||
if (stabilization is null) warnings.Add(new RenderWarning("Export.Render.StabilizationUnavailable"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,7 +231,7 @@ public static class RenderPreparation
|
||||
{
|
||||
zoom = 1 / double.Max(stabilization.CropScale, MinimumCropScale);
|
||||
if (stabilization.CropScale < MinimumCropScale)
|
||||
warnings.Add(new RenderWarning("Render.Warning.StabilizationBorders", stabilization.CropScale.ToString("0.00", CultureInfo.InvariantCulture)));
|
||||
warnings.Add(new RenderWarning("Export.Render.StabilizationBorders", stabilization.CropScale.ToString("0.00", CultureInfo.InvariantCulture)));
|
||||
}
|
||||
var measuredLuminance = luminance ?? NaNs(n);
|
||||
return new RenderCorrections
|
||||
|
||||
@@ -33,6 +33,7 @@ public sealed record RenderSetup
|
||||
ArgumentNullException.ThrowIfNull(target);
|
||||
ArgumentNullException.ThrowIfNull(encoders);
|
||||
options ??= RenderOptions.Default;
|
||||
if (input.Frames.Count != input.Source.FrameCount) throw new ArgumentException("One metadata entry per source frame is required.", nameof(input));
|
||||
var project = input.Project;
|
||||
var geometry = RenderGeometry.Create(project.Camera, target.Export, input.Source.Width, input.Source.Height,
|
||||
corrections?.StabilizationZoom ?? 1, options.MaxWorkingLongEdge);
|
||||
@@ -47,7 +48,7 @@ public sealed record RenderSetup
|
||||
warnings.AddRange(selection.Notices.Select(n => new RenderWarning(n.Key, n.Args)));
|
||||
var stacking = project.Stack.Mode != StackSetting.None;
|
||||
var blur = ProjectValues.Get(project.Motion.MotionBlur, false);
|
||||
if (blur && stacking) warnings.Add(new RenderWarning("Render.Warning.BlurOffWhileStacking"));
|
||||
if (blur && stacking) warnings.Add(new RenderWarning("Export.Render.BlurOffWhileStacking"));
|
||||
var exposure = project.Exposure;
|
||||
var measuring = ProjectValues.Get(exposure.Deflicker, false) || ProjectValues.Get(exposure.HolyGrail, false)
|
||||
|| ProjectValues.Get(exposure.WhiteBalanceSmoothing, false) || ProjectValues.Get(project.Motion.Stabilize, false);
|
||||
|
||||
@@ -158,7 +158,7 @@ public sealed class RenderPipelineTests
|
||||
{
|
||||
var project = Plain with { ExcludedFrames = [.. Enumerable.Range(0, 12)] };
|
||||
var error = await Assert.ThrowsAsync<RenderException>(() => Pipeline().RenderAsync(Input(Source(), project), Target(_context.CreateTempDirectory(), Preset("png-sequence"))));
|
||||
Assert.Equal("Render.Error.NoFrames", error.ReasonKey);
|
||||
Assert.Equal("Export.Render.NoFrames", error.ReasonKey);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -168,7 +168,7 @@ public sealed class RenderPlanTests
|
||||
Assert.Empty(ease.Warnings);
|
||||
|
||||
var bad = RenderPlan.Build(Regular(60), Timing(TimingMode.Remapped, curve: [new(1, 1), new(0, 0.1), new(0.4, 0.8), new(0.6, 0.3)]), new Rational(24, 1));
|
||||
Assert.Contains("Render.Plan.RemapNotMonotonic", bad.Warnings);
|
||||
Assert.Contains("Export.Plan.RemapNotMonotonic", bad.Warnings);
|
||||
AssertExactDurations(bad);
|
||||
Assert.Approximately(0.1 * 60, bad.Frames[0].SourcePosition, 1e-9);
|
||||
}
|
||||
@@ -179,7 +179,7 @@ public sealed class RenderPlanTests
|
||||
var plan = RenderPlan.Build(Regular(3), Timing(TimingMode.Constant, excluded: [0, 1, 2]), new Rational(30, 1));
|
||||
Assert.Empty(plan.Frames);
|
||||
Assert.Equal(0L, plan.Duration90k);
|
||||
Assert.Contains("Render.Plan.NoFrames", plan.Warnings);
|
||||
Assert.Contains("Export.Plan.NoFrames", plan.Warnings);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -187,7 +187,7 @@ public sealed class RenderPlanTests
|
||||
{
|
||||
var plan = RenderPlan.Build(new DateTime?[12], Timing(TimingMode.Adaptive), new Rational(30, 1));
|
||||
Assert.Equal(12, plan.Frames.Count);
|
||||
Assert.Contains("Render.Plan.NoCaptureTimes", plan.Warnings);
|
||||
Assert.Contains("Export.Plan.NoCaptureTimes", plan.Warnings);
|
||||
AssertExactDurations(plan);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user