feat(render): orient, straighten and let the chosen proportions win in the render geometry
Owner review 1, phase 4, package P1: the Core geometry behind the visual crop (R5) and the orientation controls (R6). - RenderGeometry: one warp stab⁻¹ · O⁻¹ · V with the crop and the keyframe centres in the view frame T (turned, mirrored, flipped, straightened); the output size comes from RenderSize, so a fixed preset adapts to the aspect (4K at 9:16 = 2160×3840) and AspectFromPreset is gone; the decode grows by the straighten cover zoom; ViewFor, ViewToFrame, EditableCrop and FootprintInView get their real bodies; a rotation that is not a quarter turn and an out-of-range straighten render as none or clamped, with their warnings. - FrameOrientation: the cover zoom is taken on the pixel-centre extents, so every output pixel samples inside the frame (full alpha coverage at ±15°, never a smeared border). - CropFrame: crops are written on the 12-decimal grid OrientationEdit remaps on, so four turns or two mirrors give back the same text; a stored crop is read value by value as the render reads it. - Advisor: the aspect (and the horizon framing) is advised on the view turned by the camera (SequenceContext.Rotate/Flip, ForCamera); the analyser passes the project's camera. - Self-test: proc.orient, proc.straighten, proc.portrait. - Tests: exact pixel permutations for turns, mirror and flip, the orientation algebra, straighten against an analytic ramp and its full coverage, Create sizes, a crop keeping its content through every press, CropFrame move/resize/refit/rows, OrientationEdit round trips and its agreement with FrameOrientation, the turned-view advice, determinism. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e4364c4f25
commit
bee66da63a
18 files changed
+1052
-67
No files matched your search
@@ -74,6 +74,33 @@ public sealed class RenderPipelineTests
|
||||
Assert.BytesEqual(File.ReadAllBytes(apngA.OutputPath), File.ReadAllBytes(apngB.OutputPath));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task TransformedOutputsAreByteIdenticalAcrossRuns()
|
||||
{
|
||||
var dir = _context.CreateTempDirectory();
|
||||
var project = Plain with
|
||||
{
|
||||
Camera = new CameraSettings
|
||||
{
|
||||
Rotate = 90,
|
||||
Mirror = true,
|
||||
Straighten = 3.5,
|
||||
Aspect = new Auto<string>().WithManual("4:5"),
|
||||
Crop = [0.1, 0.05, 0.8, 0.8],
|
||||
Keyframes = [new CameraKey(0, 0.45, 0.5, 1.2, 2), new CameraKey(11, 0.55, 0.5, 1.4, -2)],
|
||||
},
|
||||
};
|
||||
var export = Preset("png-sequence", 64, 64);
|
||||
var first = await Pipeline().RenderAsync(Input(Source(), project), Target(dir, export, "a"), cancellationToken: _context.Cancellation);
|
||||
var second = await Pipeline().RenderAsync(Input(Source(), project), Target(dir, export, "b"), cancellationToken: _context.Cancellation);
|
||||
Assert.Equal((51, 64), (first.Width, first.Height));
|
||||
var a = Directory.GetFiles(first.OutputPath).Order(StringComparer.Ordinal).ToArray();
|
||||
var b = Directory.GetFiles(second.OutputPath).Order(StringComparer.Ordinal).ToArray();
|
||||
Assert.Equal(12, a.Length);
|
||||
Assert.Equal(a.Length, b.Length);
|
||||
for (var i = 0; i < a.Length; i++) Assert.BytesEqual(File.ReadAllBytes(a[i]), File.ReadAllBytes(b[i]));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[Case("mjpeg-avi")]
|
||||
[Case("png-sequence")]
|
||||
|
||||
Reference in new issue
Block a user