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
@@ -599,6 +599,105 @@ public sealed class RenderJobTests(TestContext context)
|
||||
Assert.SequenceEqual(["mjpeg", "gif"], ProcessingJobs.Split(posted, 96, 64).Select(p => p.Codec));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Owner review 1, phase 4: a render job carries the output size its settings give it (the chosen proportions win over a
|
||||
/// fixed-size preset, a quarter turn swaps a source-sized output) and the settings format its render needs, so a render
|
||||
/// node is matched to what it will write; a job posted by an older client gets both from the server (<see cref="ProcessingJobs.Split"/>).
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void RenderJobsCarryTheSizeAndFormatOfTheirSettings()
|
||||
{
|
||||
var sequence = new Sequence { Id = Guid.CreateVersion7(), ArchiveId = Guid.CreateVersion7(), Folder = "Synthetic", Title = "Roof" };
|
||||
var uhd = new ExportSettings { Preset = new Auto<string>().WithManual("4k-h264") };
|
||||
var portrait = new ProjectSettings { Camera = new CameraSettings { Aspect = new Auto<string>().WithManual("9:16") } };
|
||||
static Chronos.Protocol.RenderJobParameters Read(Chronos.Data.Archiving.Jobs.ArchiveJobRequest request) => ProcessingJobs.ReadRender(request.ParametersJson).Parameters;
|
||||
|
||||
var adapted = Read(ProcessingJobs.Render(sequence, uhd, 6000, 4000, portrait));
|
||||
Assert.Equal((2160, 3840, 2), (adapted.Width, adapted.Height, adapted.RequiredSettingsFormat));
|
||||
var source = Read(ProcessingJobs.Render(sequence, uhd, 6000, 4000, new ProjectSettings()));
|
||||
Assert.Equal((3840, 2160, 1), (source.Width, source.Height, source.RequiredSettingsFormat));
|
||||
// A source-sized output turns with the picture; the turn needs format 2.
|
||||
var png = new ExportSettings { Preset = new Auto<string>().WithManual("png-sequence") };
|
||||
var turned = Read(ProcessingJobs.Render(sequence, png, 6000, 4000, new ProjectSettings { Camera = new CameraSettings { Rotate = 90 } }));
|
||||
Assert.Equal((4000, 6000, 2), (turned.Width, turned.Height, turned.RequiredSettingsFormat));
|
||||
// The sequence's own settings when the job embeds none.
|
||||
var own = Read(ProcessingJobs.Render(sequence with { SettingsJson = portrait.ToJson() }, uhd, 6000, 4000));
|
||||
Assert.Equal((2160, 3840, 2), (own.Width, own.Height, own.RequiredSettingsFormat));
|
||||
|
||||
// Posted by an older client (the preset's size, no format) with a batch: the server sizes each job for the settings.
|
||||
var posted = Read(ProcessingJobs.Render(sequence, uhd with { Batch = ["1080p-h264"] }, 6000, 4000)) with { SettingsJson = portrait.ToJson() };
|
||||
Assert.Equal((3840, 2160, 1), (posted.Width, posted.Height, posted.RequiredSettingsFormat));
|
||||
var split = ProcessingJobs.Split(posted, 6000, 4000, portrait);
|
||||
Assert.SequenceEqual([(2160, 3840, 2), (1080, 1920, 2)], split.Select(p => (p.Width, p.Height, p.RequiredSettingsFormat)));
|
||||
Assert.Equal(split[0], ProcessingJobs.Routed(split[0], portrait, 6000, 4000), "a size already adapted stays");
|
||||
// The sequence's settings change between posting and routing: the size comes from the preset again, never from the
|
||||
// size a newer client already adapted (2160×2160 for 1:1 would adapt to 2160×1215 for 16:9).
|
||||
var square = new ProjectSettings { Camera = new CameraSettings { Aspect = new Auto<string>().WithManual("1:1") } };
|
||||
var wide = new ProjectSettings { Camera = new CameraSettings { Aspect = new Auto<string>().WithManual("16:9") } };
|
||||
var squared = Read(ProcessingJobs.Render(sequence, uhd, 6000, 4000, square));
|
||||
Assert.Equal((2160, 2160), (squared.Width, squared.Height));
|
||||
var rerouted = ProcessingJobs.Routed(squared, wide, 6000, 4000);
|
||||
Assert.Equal((3840, 2160), (rerouted.Width, rerouted.Height), "the preset's box adapted to the new aspect");
|
||||
var tall = Read(ProcessingJobs.Render(sequence, uhd, 6000, 4000, new ProjectSettings { Camera = new CameraSettings { Aspect = new Auto<string>().WithManual("4:5") } }));
|
||||
Assert.Equal((2160, 2700), (tall.Width, tall.Height));
|
||||
Assert.Equal((3840, 2160), (ProcessingJobs.Routed(tall, wide, 6000, 4000).Width, ProcessingJobs.Routed(tall, wide, 6000, 4000).Height));
|
||||
Assert.Equal((3840, 2160, 1), ProcessingJobs.Split(posted, 6000, 4000).Select(p => (p.Width, p.Height, p.RequiredSettingsFormat)).First(),
|
||||
"settings that cannot be read keep the size the job was posted with");
|
||||
// What the desktop asks of a server before a render: the highest format of the export and its batch.
|
||||
Assert.Equal(1, ProcessingJobs.RequiredFormat(portrait, png, 6000, 4000), "a source-sized output keeps the proportions");
|
||||
Assert.Equal(2, ProcessingJobs.RequiredFormat(portrait, png with { Batch = ["4k-h264"] }, 6000, 4000));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Owner review 1, phase 4, end to end: a turned, portrait project with a look renders each output at the size its job
|
||||
/// was routed with (the fixed box adapted to 9:16, the source-sized output on the turned view) and records it so.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public async Task ATurnedPortraitProjectRendersAtTheSizeItsJobWasRoutedWith()
|
||||
{
|
||||
await using var fx = await ProcessingFixture.CreateAsync(context);
|
||||
var sequence = await fx.AddAsync(Scene());
|
||||
await fx.StartEngineAsync();
|
||||
|
||||
var settings = new ProjectSettings
|
||||
{
|
||||
Camera = new CameraSettings { Aspect = new Auto<string>().WithManual("9:16"), Rotate = 90, Straighten = 2 },
|
||||
Look = new LookSettings { Filter = "sepia", Strength = 0.6 },
|
||||
};
|
||||
var request = ProcessingJobs.Render(sequence, Mjpeg with { Batch = ["png-sequence"] }, 96, 64, settings);
|
||||
var routed = ProcessingJobs.ReadRender(request.ParametersJson).Parameters;
|
||||
Assert.Equal((54, 96, 2), (routed.Width, routed.Height, routed.RequiredSettingsFormat));
|
||||
await fx.WaitForAsync((await fx.EnqueueAsync(request)).Id, JobState.Done);
|
||||
|
||||
var renders = (await fx.Db.Renders.ListBySequenceAsync(sequence.Id, fx.Ct)).OrderBy(r => r.OutputPath, StringComparer.Ordinal).ToList();
|
||||
Assert.SequenceEqual([(54, 96), (54, 96)], renders.Select(r => (r.Width, r.Height)));
|
||||
var pngs = Directory.GetFiles(Path.Combine(fx.Folder(sequence).Exports, "clip-PNG")).Order().ToList();
|
||||
Assert.Equal(Frames, pngs.Count);
|
||||
using var decoded = DecoderFactory.CreateServer().Decode(new DecodeRequest(pngs[^1]));
|
||||
Assert.Equal((54, 96), (Assert.NotNull(decoded).Pixels.Width, decoded.Pixels.Height));
|
||||
}
|
||||
|
||||
/// <summary>Settings of a newer Chronos fail the render with the reason in the user's language, never as an English message.</summary>
|
||||
[Test]
|
||||
public async Task AnOverFormatRenderFailsSayingANewerChronosIsNeeded()
|
||||
{
|
||||
await using var fx = await ProcessingFixture.CreateAsync(context);
|
||||
var sequence = await fx.AddAsync(Scene());
|
||||
await fx.StartEngineAsync();
|
||||
|
||||
var parameters = ProcessingJobs.ReadRender(ProcessingJobs.Render(sequence, Mjpeg, 96, 64).ParametersJson).Parameters with
|
||||
{
|
||||
SettingsJson = """{"version":3,"camera":{"rotate":90},"grade":{"lut":"teal"}}""",
|
||||
};
|
||||
var request = new Chronos.Data.Archiving.Jobs.ArchiveJobRequest(JobKind.Render, [sequence.Id], "newer",
|
||||
System.Text.Json.JsonSerializer.Serialize(parameters, Chronos.Protocol.ProtocolJson.Default.RenderJobParameters), JobPriority.User);
|
||||
Assert.Equal(3, ProcessingJobs.ReadRender(ProcessingJobs.Render(sequence, Mjpeg, 96, 64,
|
||||
ProjectSettings.FromJson(parameters.SettingsJson, allowNewer: true)).ParametersJson).Parameters.RequiredSettingsFormat, "routed to none older");
|
||||
var failed = await fx.WaitForAsync((await fx.EnqueueAsync(request)).Id, JobState.Failed);
|
||||
Assert.Equal(Loc.L("Errors.Render.NewerSettings"), failed.Error);
|
||||
Assert.Empty(await fx.Db.Renders.ListBySequenceAsync(sequence.Id, fx.Ct));
|
||||
}
|
||||
|
||||
/// <summary>MJPEG job parameters whose preset JSON is <paramref name="presetJson"/>.</summary>
|
||||
private static string WithPreset(string presetJson) => System.Text.Json.JsonSerializer.Serialize(
|
||||
new Chronos.Protocol.RenderJobParameters("MJPEG", presetJson, "mjpeg", 96, 64, false, null), Chronos.Protocol.ProtocolJson.Default.RenderJobParameters);
|
||||
|
||||
Reference in new issue
Block a user