feat(editor): visual crop, rotate/mirror/flip/straighten, colour looks (owner review 1 phase 4) (#26)
CI / Build and test (push) Successful in 8m19s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 7s
Release / Build, test and publish (push) Successful in 12m9s
CI / PostgreSQL 16 integration (push) Successful in 7m49s
CI / PostgreSQL 17 integration (push) Successful in 7m19s
CI / Docker image (push) Successful in 46s
Release / Server image (push) Successful in 1m14s
CI / Build and test (push) Successful in 8m19s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 7s
Release / Build, test and publish (push) Successful in 12m9s
CI / PostgreSQL 16 integration (push) Successful in 7m49s
CI / PostgreSQL 17 integration (push) Successful in 7m19s
CI / Docker image (push) Successful in 46s
Release / Server image (push) Successful in 1m14s
Owner review 1 R5 + R6. Camera rotation, mirror, flip, straighten and crop handles locked to the output; an Exposure Look group; Export output size ("proportions win"); settings format 2 with older-node gates. Also fixes project text and hashes differing between Windows and Linux.
Closes #19
Closes #20
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Alberto Balbo <alberto.balbo.96@gmail.com>
This commit was merged in pull request #26.
This commit is contained in:
1 parent
db389a54f2
commit
188b2c2e55
355 files changed
+10549
-1061
No files matched your search
@@ -2,6 +2,7 @@ using Chronos.Core.Advice;
|
||||
using Chronos.Core.Analysis;
|
||||
using Chronos.Core.Analysis.Deep;
|
||||
using Chronos.Core.Diagnostics.Synthetic;
|
||||
using Chronos.Core.Imaging.Geometry;
|
||||
using Chronos.Core.Mathematics;
|
||||
using Chronos.Core.Project;
|
||||
using Chronos.Core.Tests.Analysis.Deep;
|
||||
@@ -326,6 +327,51 @@ public sealed class AdvisorTests(TestContext context)
|
||||
Assert.Equal("3840x2160", Value(wide, AdvisorParameters.Resolution));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TheAspectIsAdvisedOnTheTurnedView()
|
||||
{
|
||||
var (light, sequence) = Inputs(new SyntheticFrameSource(DeepScenes.HolyGrail()));
|
||||
var turned = sequence.ForCamera(new CameraSettings { Rotate = 90 });
|
||||
Assert.Equal(90, turned.Rotate);
|
||||
var portrait = Advisor.Recommend(light, null, turned);
|
||||
Assert.Equal("9:16", Value(portrait, AdvisorParameters.Aspect));
|
||||
Assert.Equal(AdvisorKeys.AspectPortrait, portrait.Find(AdvisorParameters.Aspect)!.ReasonKey);
|
||||
Assert.Equal("16:9", Value(Advisor.Recommend(light, null, sequence with { Rotate = 180 }), AdvisorParameters.Aspect));
|
||||
|
||||
// A portrait source turned a quarter is landscape again, its reason naming the view's size.
|
||||
var landscape = Advisor.Recommend(light, null, sequence with { SourceWidth = 4000, SourceHeight = 6000, Rotate = 270 });
|
||||
Assert.Equal("16:9", Value(landscape, AdvisorParameters.Aspect));
|
||||
Assert.SequenceEqual([6000.0, 4000.0, 84.0], landscape.Find(AdvisorParameters.Aspect)!.ReasonArgs.Select(Convert.ToDouble));
|
||||
|
||||
// Applied to a turned project, the advice matches what a turn of the advised aspect gives.
|
||||
var project = Advisor.Apply(new ProjectSettings { Camera = new CameraSettings { Rotate = 90 } }, portrait);
|
||||
Assert.Equal("9:16", project.Camera.Aspect.AutoValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The horizon framing places the decoded frame's horizon in the view as shown, as the preview draws it: a half turn or a
|
||||
/// flip shows it upside down, a straighten turns it about the centre and magnifies it by its cover zoom (10° on 3:2
|
||||
/// moves a horizon at 0.70 to about 0.745, which the framing must put on the third).
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TheHorizonIsPlacedInTheViewAsShown()
|
||||
{
|
||||
double[] horizon = [0.70, 0.70, 0.70, 0.70, 0.70];
|
||||
Assert.Approximately(0.70, AdvisorRules.ViewRow(FrameOrientation.Identity(6000, 4000), horizon), 1e-12);
|
||||
Assert.Approximately(0.30, AdvisorRules.ViewRow(FrameOrientation.Of(0, false, true, 0, 6000, 4000), horizon), 1e-9);
|
||||
Assert.Approximately(0.30, AdvisorRules.ViewRow(FrameOrientation.Of(180, false, false, 0, 6000, 4000), horizon), 1e-9);
|
||||
Assert.Approximately(0.70, AdvisorRules.ViewRow(FrameOrientation.Of(0, true, false, 0, 6000, 4000), horizon), 1e-9);
|
||||
|
||||
var straightened = FrameOrientation.Of(0, false, false, 10, 6000, 4000);
|
||||
var centre = (4000 - 1) / 2.0;
|
||||
var expected = (centre + straightened.CoverZoom * double.Cos(10 * double.Pi / 180) * (0.70 * 4000 - 0.5 - centre) + 0.5) / 4000;
|
||||
Assert.Approximately(expected, AdvisorRules.ViewRow(straightened, horizon), 1e-9);
|
||||
Assert.InRange(expected, 0.74, 0.75);
|
||||
|
||||
// The context carries the straighten, so the advice is worked out again for it.
|
||||
Assert.Equal(10.0, new SequenceContext().ForCamera(new CameraSettings { Straighten = 10 }).Straighten);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task RecommendationsAreDeterministic()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user