@margoengine/headless 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,123 @@
1
+ import { Camera, type Engine } from '@margoengine/core';
2
+ import { type HeadlessPixels } from './index.js';
3
+ import { type HDRPixels } from './formats.js';
4
+ import type { FrameTiming } from './video.js';
5
+ /** The pixel filter sub-pixel offsets are drawn from. */
6
+ export type PixelFilter = 'blackman-harris' | 'gaussian' | 'box';
7
+ /** Where the open shutter sits against the frame's time. */
8
+ export type ShutterPhase = 'start' | 'center' | 'end';
9
+ /** Options of {@link subFrames}. */
10
+ export interface SubFrameOptions {
11
+ /** How many frames, a whole number from 1. Required. */
12
+ frames: number;
13
+ /** Frames per second, finite and above 0. Default 30. */
14
+ fps?: number;
15
+ /** Renders per frame, a whole number in 1..4096. Default 16. */
16
+ samples?: number;
17
+ /** Share of the frame interval the shutter is open, in [0, 1]: 0.5 is a 180 degree shutter, 0 a still instant.
18
+ * Default 0.5. */
19
+ shutter?: number;
20
+ /** Where the open shutter sits: from the frame's time (`'start'`), around it, or up to it. Default `'start'`. */
21
+ shutterPhase?: ShutterPhase;
22
+ /** Filter the offsets are drawn from. Default `'blackman-harris'`. */
23
+ filter?: PixelFilter;
24
+ /** Filter width in pixels, finite and above 0. Default 1 for `'box'`, else 2. */
25
+ filterWidth?: number;
26
+ /** Seed of the sample pattern, a 32-bit unsigned integer. Default 0. */
27
+ seed?: number;
28
+ /** `'fixed'` uses one pattern on every frame, so still edges do not shimmer; `'per-frame'` draws a new one each
29
+ * frame. Default `'fixed'`. */
30
+ pattern?: 'fixed' | 'per-frame';
31
+ /** Number of the first frame, a whole number from 0: a span of a longer film, after {@link subFrameSteps} brought
32
+ * a fresh world's clocks to it. Its renders, times and deltas are those of the whole film's. Default 0. */
33
+ startFrame?: number;
34
+ }
35
+ /** One render of {@link subFrames}. */
36
+ export interface SubFrame {
37
+ /** The frame it belongs to, from `startFrame`. */
38
+ frame: number;
39
+ /** From 0 to `samples - 1`, in time order. */
40
+ sample: number;
41
+ /** Seconds: `frame / fps` plus its place in the open shutter. */
42
+ time: number;
43
+ /** Seconds the engine's clocks move before this render. Clocks start at 0 and follow `time`: within a frame the
44
+ * step between shutter times, from one frame to the next the rest of the interval. A render before time 0 (a
45
+ * `'center'` or `'end'` shutter on frame 0) moves them 0, so they read `max(0, time)`. Frame 0 of `renderFrames`
46
+ * (one sample, shutter 0) has delta 0 and later frames exactly `1 / fps`. */
47
+ delta: number;
48
+ /** Sub-pixel offset `[x, y]` in pixels, x right and y down, inside the filter's width. */
49
+ offset: readonly [number, number];
50
+ /** True on the frame's last render, after which the frame is finished. */
51
+ last: boolean;
52
+ }
53
+ /**
54
+ * The renders of a film sequence, in order: for each frame, `samples` shutter times spread evenly over the open
55
+ * shutter (one in the middle of each of `samples` equal slices, ascending), each with a sub-pixel offset drawn from
56
+ * the pixel filter (scrambled Sobol points, shuffled against the time order). Pure and repeatable for one seed.
57
+ * `samples: 1` gives a zero offset, and with `shutter: 0` `renderFrames`' times and deltas exactly.
58
+ * @throws RangeError or TypeError for an option out of its documented range.
59
+ */
60
+ export declare function subFrames(options: SubFrameOptions): Generator<SubFrame, void, void>;
61
+ /**
62
+ * The steps that bring a fresh world's clocks to the first render of frame `startFrame` of a sub-framed film: the
63
+ * deltas of every render before it, for `seek(engine, seconds, { steps })` in `@margoengine/cutscene/seek`, so a span
64
+ * rendered from that frame equals the same frames of a render from 0, bit for bit. Empty for frame 0.
65
+ * @throws RangeError or TypeError as {@link subFrames}.
66
+ */
67
+ export declare function subFrameSteps(options: Omit<SubFrameOptions, 'frames'> & {
68
+ startFrame: number;
69
+ }): number[];
70
+ /** The part of an Accumulate stage {@link renderAccumulated} drives; `@margoengine/post/accumulate` has it. */
71
+ export interface AccumulateTarget {
72
+ /** Starts a new sum. */
73
+ begin(): void;
74
+ /** The running mean in linear light, read for `output: 'linear'`. */
75
+ readonly texture?: GPUTexture;
76
+ /** Number of frames added since `begin()`. */
77
+ readonly count: number;
78
+ }
79
+ /**
80
+ * What `update` is given before each render: `index` the frame from 0, `time` the render's own time in seconds since
81
+ * the first frame (inside the open shutter), `delta` the seconds the engine's clocks move before it, and the sample.
82
+ */
83
+ export interface SubFrameTiming extends FrameTiming {
84
+ /** From 0 to `samples - 1`, in time order. */
85
+ sample: number;
86
+ /** Renders per frame. */
87
+ samples: number;
88
+ }
89
+ /** Options of {@link renderAccumulated}. */
90
+ export interface RenderAccumulatedOptions extends SubFrameOptions {
91
+ /** Camera to render through; it is not modified. Default the engine's camera. */
92
+ camera?: Camera;
93
+ /** Runs before each render; move the scene to `timing.time` here. May be async. Default none. */
94
+ update?: (timing: SubFrameTiming) => unknown;
95
+ /** The Accumulate stage in the engine's PostStack, before Tonemap. Default a new `Accumulate` attached alone (it
96
+ * shows the mean through the display curve), loaded from the optional peer `@margoengine/post` on first use and
97
+ * disposed when the sequence ends. */
98
+ accumulate?: AccumulateTarget;
99
+ /** `'display'` yields 8-bit RGBA as `readPixels` reads the canvas; `'linear'` yields float RGBA of the mean in
100
+ * linear light, for `encodeEXR`. Default `'display'`. */
101
+ output?: 'display' | 'linear';
102
+ /** Stops the sequence between renders or during readback; the iterator rejects with the signal's reason. */
103
+ signal?: AbortSignal;
104
+ }
105
+ /** A frame of {@link renderAccumulated}: its pixels and where it sits, with `renderFrames`' frame timing. */
106
+ export type AccumulatedFrame<P> = P & FrameTiming;
107
+ /**
108
+ * Renders a film sequence on a headless engine, `samples` renders a frame averaged in linear light: antialiased
109
+ * by the pixel filter and motion-blurred over the open shutter, for everything that moves (cameras, skinned and
110
+ * morphed meshes, particles, wind), since each render is the scene at its own time. The tone curve is applied once,
111
+ * to the average. Each frame is read back once, after its last render; the next is not drawn until the consumer asks.
112
+ * Time is the sequence's own: the same options give the same frames on any machine. The jitter is applied to a copy of
113
+ * the camera, so effects with their own jitter (TAA not in `velocityOnly` mode) must be off.
114
+ * @throws RangeError or TypeError for an option out of range (before any render); MargoError `'state'` when another
115
+ * accumulated or tiled render runs on this engine, or with `output: 'linear'` before the stage has a texture,
116
+ * `'unsupported'` without WebGPU.
117
+ */
118
+ export declare function renderAccumulated(engine: Engine, options: RenderAccumulatedOptions & {
119
+ output: 'linear';
120
+ }): AsyncGenerator<AccumulatedFrame<HDRPixels>, void, void>;
121
+ export declare function renderAccumulated(engine: Engine, options: RenderAccumulatedOptions & {
122
+ output?: 'display';
123
+ }): AsyncGenerator<AccumulatedFrame<HeadlessPixels>, void, void>;
@@ -0,0 +1,198 @@
1
+ // @margo/core-built 0.1.0
2
+ import {coreRequirement as __margoCoreRequirement,assertCore as __margoAssertCore} from '@margoengine/core/extension';
3
+ const a=(engine,version="0.1.0",source=import.meta.url)=>__margoRuntime(engine,version,source);
4
+ import { i as e } from "./src-VufTH2fo.js";
5
+ import { n as t, r as n, t as r } from "./errors-CDgOgzCd.js";
6
+ import { readTexture as i } from "./formats.js";
7
+ import { engineRuntime as __margoRuntime } from "@margoengine/core/extension";
8
+ import { Camera as o } from "@margoengine/core";
9
+ //#region src/accumulate.ts
10
+ var s = 4096;
11
+ function c(e) {
12
+ return e = e >>> 1 & 1431655765 | (e & 1431655765) << 1, e = e >>> 2 & 858993459 | (e & 858993459) << 2, e = e >>> 4 & 252645135 | (e & 252645135) << 4, e = e >>> 8 & 16711935 | (e & 16711935) << 8, (e >>> 16 | e << 16) >>> 0;
13
+ }
14
+ function l(e, t) {
15
+ return e = e + t >>> 0, e = (e ^ Math.imul(e, 1817228412)) >>> 0, e = (e ^ Math.imul(e, 3090095698)) >>> 0, e = (e ^ Math.imul(e, 3350193720)) >>> 0, e = (e ^ Math.imul(e, 2367878886)) >>> 0, e;
16
+ }
17
+ var u = (e, t) => c(l(c(e), t));
18
+ function d(e) {
19
+ return e = Math.imul(e ^ e >>> 16, 2146121005), e = Math.imul(e ^ e >>> 15, 2221713035), (e ^ e >>> 16) >>> 0;
20
+ }
21
+ function f(e) {
22
+ let t = 0;
23
+ for (let n = 2147483648; e; e >>>= 1, n ^= n >>> 1) e & 1 && (t ^= n);
24
+ return t >>> 0;
25
+ }
26
+ var p = (e) => e / 2 ** 32;
27
+ function m(e, t) {
28
+ if (e === "box") return (e) => (e - .5) * t;
29
+ let n = /* @__PURE__ */ new Float64Array(513);
30
+ for (let t = 0; t < 512; t++) {
31
+ let r = (t + .5) / 512, i;
32
+ if (e === "gaussian") {
33
+ let e = (r - .5) * 6;
34
+ i = Math.exp(-.5 * e * e);
35
+ } else {
36
+ let e = 2 * Math.PI * r;
37
+ i = .35875 - .48829 * Math.cos(e) + .14128 * Math.cos(2 * e) - .01168 * Math.cos(3 * e);
38
+ }
39
+ n[t + 1] = n[t] + i;
40
+ }
41
+ let r = n[512];
42
+ for (let e = 1; e <= 512; e++) n[e] /= r;
43
+ return (e) => {
44
+ let r = 0, i = 512;
45
+ for (; i - r > 1;) {
46
+ let t = r + i >> 1;
47
+ n[t] <= e ? r = t : i = t;
48
+ }
49
+ let a = n[i] - n[r];
50
+ return ((r + (a > 0 ? (e - n[r]) / a : .5)) / 512 - .5) * t;
51
+ };
52
+ }
53
+ function h(e) {
54
+ let { frames: r, fps: i = 30, samples: a = 16, shutter: o = .5, shutterPhase: c = "start", filter: l = "blackman-harris", seed: u = 0, pattern: d = "fixed", startFrame: f = 0 } = e, p = e.filterWidth ?? (l === "box" ? 1 : 2);
55
+ if (!Number.isInteger(r) || r < 1) throw t("Invalid frame count", "headless");
56
+ if (!(i > 0) || !Number.isFinite(i)) throw t("Invalid fps", "headless");
57
+ if (!Number.isInteger(a) || a < 1 || a > s) throw t(`Sub-frame samples must be a whole number in 1..${s}`, "headless");
58
+ if (!(o >= 0 && o <= 1)) throw t("Shutter must be in [0, 1] of the frame interval", "headless");
59
+ if (c !== "start" && c !== "center" && c !== "end") throw n("Shutter phase: 'start', 'center' or 'end'", "headless");
60
+ if (l !== "blackman-harris" && l !== "gaussian" && l !== "box") throw n("Pixel filter: 'blackman-harris', 'gaussian' or 'box'", "headless");
61
+ if (!(p > 0) || !Number.isFinite(p)) throw t("Filter width must be finite and above 0 pixels", "headless");
62
+ if (!Number.isInteger(u) || u < 0 || u > 4294967295) throw t("Seed must be a 32-bit unsigned integer", "headless");
63
+ if (d !== "fixed" && d !== "per-frame") throw n("Pattern: 'fixed' or 'per-frame'", "headless");
64
+ if (!Number.isSafeInteger(f) || f < 0) throw t("startFrame must be a whole number from 0", "headless");
65
+ return {
66
+ frames: r,
67
+ fps: i,
68
+ samples: a,
69
+ shutter: o,
70
+ shutterPhase: c,
71
+ filter: l,
72
+ filterWidth: p,
73
+ seed: u,
74
+ pattern: d,
75
+ startFrame: f
76
+ };
77
+ }
78
+ function* g(e) {
79
+ let t = h(e), n = m(t.filter, t.filterWidth), r = _(t), i = new Uint32Array(t.samples), a = [], o = new v(t.fps, r);
80
+ for (let e = 0; e < t.startFrame; e++) for (let n = 0; n < t.samples; n++) o.step(e, n);
81
+ for (let e = t.startFrame; e < t.startFrame + t.frames; e++) {
82
+ if (e === t.startFrame || t.pattern === "per-frame") {
83
+ let r = t.pattern === "fixed" ? t.seed : d(t.seed ^ d(e + 1));
84
+ for (let e = 0; e < t.samples; e++) i[e] = e;
85
+ for (let e = t.samples - 1, n = d(r ^ 2654435769); e > 0; e--) {
86
+ n = d(n + e);
87
+ let t = n % (e + 1), r = i[e];
88
+ i[e] = i[t], i[t] = r;
89
+ }
90
+ a.length = 0;
91
+ let o = d(r ^ 1757159915), s = d(r ^ 48610963);
92
+ for (let e = 0; e < t.samples; e++) {
93
+ if (t.samples === 1) {
94
+ a.push([0, 0]);
95
+ continue;
96
+ }
97
+ let r = i[e];
98
+ a.push([n(p(u(c(r), o))), n(p(u(f(r), s)))]);
99
+ }
100
+ }
101
+ for (let n = 0; n < t.samples; n++) yield {
102
+ frame: e,
103
+ sample: n,
104
+ time: e / t.fps + r[n],
105
+ delta: o.step(e, n),
106
+ offset: a[n],
107
+ last: n === t.samples - 1
108
+ };
109
+ }
110
+ }
111
+ function _(e) {
112
+ let t = e.shutterPhase === "start" ? 0 : e.shutterPhase === "center" ? -e.shutter / 2 : -e.shutter;
113
+ return Float64Array.from({ length: e.samples }, (n, r) => e.shutter === 0 ? 0 : (t + e.shutter * (r + .5) / e.samples) / e.fps);
114
+ }
115
+ var v = class {
116
+ constructor(e, t) {
117
+ this.fps = e, this.times = t, this.frame = 0, this.within = 0;
118
+ }
119
+ step(e, t) {
120
+ let n = (e - this.frame) / this.fps + (this.times[t] - this.within);
121
+ return n > 0 ? (this.frame = e, this.within = this.times[t], n) : 0;
122
+ }
123
+ };
124
+ function y(e) {
125
+ let t = h({
126
+ ...e,
127
+ frames: 1
128
+ }), n = new v(t.fps, _(t)), r = [];
129
+ for (let e = 0; e < t.startFrame; e++) for (let i = 0; i < t.samples; i++) r.push(n.step(e, i));
130
+ return r;
131
+ }
132
+ var b = /* @__PURE__ */ new WeakSet();
133
+ async function x(e) {
134
+ let t;
135
+ try {
136
+ t = await import("@margoengine/post/accumulate");
137
+ } catch (e) {
138
+ throw e.code === "ERR_MODULE_NOT_FOUND" ? Object.assign(r("state", "Install @margoengine/post", "install"), { cause: e }) : e;
139
+ }
140
+ return t.Accumulate.attach(e);
141
+ }
142
+ async function* S(t, s) {
143
+ let { update: c, signal: l, output: u = "display" } = s;
144
+ if (u !== "display" && u !== "linear") throw n("Output: 'display' or 'linear'", "headless");
145
+ let d = h(s);
146
+ l?.throwIfAborted();
147
+ let f = a(t);
148
+ if (!f.gpu) throw r("unsupported", "Accumulated rendering requires WebGPU", "headless");
149
+ if (b.has(f)) throw r("state", "An accumulated render is already active on this engine", "headless");
150
+ b.add(f);
151
+ let p;
152
+ try {
153
+ let n = s.accumulate ?? (p = await x(t)), a = s.camera ?? f.camera, m = new o(a), h = [0, 0];
154
+ m.update = (e, t) => {
155
+ o.prototype.update.call(m, e, t);
156
+ let { width: n, height: r } = f.canvas, i = 2 * h[0] / n, a = -2 * h[1] / r;
157
+ for (let e = 0; e < 16; e += 4) m.matrix[e] += i * m.matrix[e + 3], m.matrix[e + 1] += a * m.matrix[e + 3];
158
+ };
159
+ for (let o of g(d)) {
160
+ l?.throwIfAborted(), o.sample === 0 && n.begin();
161
+ let s = o.frame - d.startFrame;
162
+ if (await c?.({
163
+ index: s,
164
+ time: d.startFrame ? o.time - d.startFrame / d.fps : o.time,
165
+ delta: o.delta,
166
+ progress: s / d.frames,
167
+ sample: o.sample,
168
+ samples: d.samples
169
+ }), m.fov = a.fov, m.near = a.near, m.far = a.far, m.position = a.position, m.target = a.target, m.up = a.up, m.project = a.project, [h[0], h[1]] = o.offset, f.render({
170
+ camera: m,
171
+ delta: o.delta
172
+ }), !o.last) continue;
173
+ let p = {
174
+ index: s,
175
+ time: s / d.fps,
176
+ delta: s ? 1 / d.fps : 0,
177
+ progress: s / d.frames
178
+ };
179
+ if (u === "display") {
180
+ yield {
181
+ ...p,
182
+ ...await e(t, { signal: l })
183
+ };
184
+ continue;
185
+ }
186
+ let g = n.texture;
187
+ if (!g) throw r("state", "The Accumulate stage has no texture; add it to the PostStack", "headless");
188
+ yield {
189
+ ...p,
190
+ ...await i(t, g, { signal: l })
191
+ };
192
+ }
193
+ } finally {
194
+ p?.dispose(), b.delete(f);
195
+ }
196
+ }
197
+ //#endregion
198
+ export { S as renderAccumulated, y as subFrameSteps, g as subFrames };
@@ -0,0 +1,15 @@
1
+ /**
2
+ * The SPS NAL unit `nal` with its video_full_range_flag set to `fullRange`, or undefined when it already says that or
3
+ * cannot be read (anything not understood is left alone).
4
+ */
5
+ export declare function spsWithRange(nal: Uint8Array, fullRange: boolean): Uint8Array | undefined;
6
+ /**
7
+ * The AVCDecoderConfigurationRecord (ISO/IEC 14496-15 5.3.3.1) with every SPS saying `fullRange`; the record as it is
8
+ * when it says that already or cannot be read.
9
+ */
10
+ export declare function avcConfigurationWithRange(record: Uint8Array, fullRange: boolean): Uint8Array;
11
+ /**
12
+ * A length-prefixed H.264 sample with any in-band SPS saying `fullRange`; the sample itself when none changes.
13
+ * `lengthSize` is the record's lengthSizeMinusOne plus 1.
14
+ */
15
+ export declare function avcSampleWithRange(sample: Uint8Array, lengthSize: number, fullRange: boolean): Uint8Array;
@@ -0,0 +1,97 @@
1
+ import type { HeadlessPixels } from './index.js';
2
+ /** RGBA pixels, or PNG file bytes where a function says so. */
3
+ export type ImageSource = HeadlessPixels | Uint8Array;
4
+ /** Options of {@link pixelDiff}. */
5
+ export interface PixelDiffOptions {
6
+ /** Largest difference in any channel, 0 to 255, that still counts as the same. Default 2, which covers rounding
7
+ * between GPUs. */
8
+ threshold?: number;
9
+ /** Also return `image`, showing changed pixels in red over a faded copy of `a`. Default false. */
10
+ image?: boolean;
11
+ /** Also return `mask`: one byte a pixel, row by row from the top left, 1 where the pixel differs. Default false. */
12
+ mask?: boolean;
13
+ /**
14
+ * Also return `clusters`: one box per group of changed pixels. Touching pixels (8-connected) form a group, and groups
15
+ * whose boxes lie at most this many pixels apart join. 0 or more; default none.
16
+ */
17
+ clusters?: number;
18
+ }
19
+ /** A rectangle of pixels: the top left pixel and the size, like `ImageData` and `getImageData(x, y, width, height)`. */
20
+ export interface PixelBox {
21
+ x: number;
22
+ y: number;
23
+ width: number;
24
+ height: number;
25
+ }
26
+ /** What {@link pixelDiff} gives back. Differences are of colours premultiplied by alpha, on 0 to 255. */
27
+ export interface PixelDiff {
28
+ /** Pixels over the threshold. */
29
+ different: number;
30
+ /** All pixels. */
31
+ total: number;
32
+ /** `different / total`. */
33
+ ratio: number;
34
+ /** The largest channel difference anywhere. */
35
+ largest: number;
36
+ /** The mean of each pixel's largest channel difference. */
37
+ mean: number;
38
+ /** The smallest rectangle holding every pixel that differs; null when none does. */
39
+ box: PixelBox | null;
40
+ /** With `image: true`. */
41
+ image?: HeadlessPixels;
42
+ /** With `mask: true`: `width * height` bytes, 1 where the pixel differs, 0 elsewhere. */
43
+ mask?: Uint8Array;
44
+ /** With `clusters`: the box of each group of changed pixels, top to bottom, then left to right. */
45
+ clusters?: PixelBox[];
46
+ }
47
+ /** Options of {@link ssim}. */
48
+ export interface SSIMOptions {
49
+ /** Window width in pixels, odd, shrunk to fit a small image. Default 11. */
50
+ window?: number;
51
+ /** Standard deviation of the window's Gaussian in pixels. Default 1.5. */
52
+ sigma?: number;
53
+ /** Also return `map`. Default false. */
54
+ map?: boolean;
55
+ }
56
+ /** What {@link ssim} gives back. */
57
+ export interface SSIMResult {
58
+ /** The mean over all windows: 1 for identical images, lower as structure differs. */
59
+ score: number;
60
+ /** With `map: true`: the score of each window, `width` by `height`, one window per position fully inside the image. */
61
+ map?: {
62
+ width: number;
63
+ height: number;
64
+ data: Float32Array;
65
+ };
66
+ }
67
+ /** Options of {@link compareImages}: the limits a pass must meet, and those of {@link pixelDiff}. */
68
+ export interface CompareOptions extends Pick<PixelDiffOptions, 'threshold'> {
69
+ /** Largest `ratio` that passes. Default 0.001, one pixel in a thousand. */
70
+ maxRatio?: number;
71
+ /** Smallest SSIM score that passes. Default 0.99. */
72
+ minSSIM?: number;
73
+ }
74
+ /** What {@link compareImages} gives back. */
75
+ export interface CompareResult extends PixelDiff {
76
+ /** Whether both limits held. */
77
+ pass: boolean;
78
+ /** The SSIM score. */
79
+ ssim: number;
80
+ /** Always present: `a` faded with changes in red, ready to save with `encodePNG` when a test fails. */
81
+ image: HeadlessPixels;
82
+ }
83
+ /** Counts the pixels that differ. A pixel is compared premultiplied, so colour under full transparency does not count. */
84
+ export declare function pixelDiff(a: HeadlessPixels, b: HeadlessPixels, options?: PixelDiffOptions): PixelDiff;
85
+ /** Structural similarity of two images of one size: how alike they look, where a pixel count sees only how many moved. */
86
+ export declare function ssim(a: HeadlessPixels, b: HeadlessPixels, options?: SSIMOptions): SSIMResult;
87
+ /**
88
+ * Reads a PNG file to RGBA pixels, so a reference image made by any tool can be compared. Takes every colour type at
89
+ * every bit depth, interlaced or not; 16-bit samples keep their high byte. A chunk whose CRC does not match, or a bit depth
90
+ * the colour type does not allow, is refused. Colour profiles and gamma are ignored.
91
+ */
92
+ export declare function decodePNG(bytes: Uint8Array): Promise<HeadlessPixels>;
93
+ /**
94
+ * Compares a picture with its reference, each RGBA pixels or PNG file bytes, and says whether it passes: the check for
95
+ * a visual regression test. Images of different sizes reject.
96
+ */
97
+ export declare function compareImages(actual: ImageSource, reference: ImageSource, { threshold, maxRatio, minSSIM }?: CompareOptions): Promise<CompareResult>;