@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.
package/dist/look.d.ts ADDED
@@ -0,0 +1,553 @@
1
+ import type { HeadlessPixels } from './index.js';
2
+ /** An 8-bit sRGB frame: RGBA, straight alpha, top row first, as `readPixels` and `decodePNG` give. */
3
+ export type LookImage = HeadlessPixels;
4
+ /** A mask: one byte per pixel, or RGBA where the first channel counts. 128 and above is inside. */
5
+ export interface LookMask {
6
+ width: number;
7
+ height: number;
8
+ data: Uint8Array;
9
+ }
10
+ /** A float frame, RGBA: `Float32Array`, or `Uint16Array` of half-float bits as an `rgba16float` readback holds them. */
11
+ export interface FloatFrame {
12
+ width: number;
13
+ height: number;
14
+ data: Float32Array | Uint16Array;
15
+ }
16
+ /** A bound from a shot file's `lookBounds`: a number is the largest value that passes, `[low, high]` a range. */
17
+ export type LookBound = number | readonly [number, number];
18
+ /** The name of a look check, as `lookBounds` names it. */
19
+ export type LookCheckName = 'skyClip' | 'grain' | 'speckle' | 'banding' | 'flat' | 'blocks' | 'horizonSeam' | 'waterSeam' | 'lights' | 'foamEdges' | 'crush' | 'flicker' | 'shimmer' | 'nan' | 'backends' | 'reference' | 'penumbra' | 'stairs' | 'colourEdges' | 'chromaSmear' | 'shimmerMoving' | 'motionBlur' | 'silhouette' | 'silhouetteShape' | 'bounce' | 'shadowTint' | 'nightLuma' | 'nightPeak';
20
+ /** What a check gives back. */
21
+ export interface LookResult {
22
+ /** The check's name. */
23
+ check: LookCheckName | string;
24
+ /** The measured value, in `unit`. NaN when the check could not run (`missing`), which never passes. */
25
+ value: number;
26
+ /** `[low, high]`: the value passes when inside, ends included. */
27
+ bound: [number, number];
28
+ pass: boolean;
29
+ unit: string;
30
+ /** Set when the check could not run: what was missing. */
31
+ missing?: string;
32
+ /**
33
+ * Set when the check ran over a mask with no pixels in it, so it measured nothing: for example `0 sky pixels` for
34
+ * a shot with no sky in view. The row passes, and the report says what it measured, so the pass is never silent.
35
+ */
36
+ empty?: string;
37
+ /**
38
+ * The mask the check measured inside, by name, when {@link checkProbe} chose one: `sky` (the page's sky mask),
39
+ * `sky-coverage` (the pixels `@margoengine/sky` drew, when there is no `sky` mask) or `frame` (the whole frame).
40
+ * Set on `skyClip`; the report says which.
41
+ */
42
+ mask?: string;
43
+ /** Further numbers the check measured, for the report. */
44
+ detail: Record<string, number>;
45
+ }
46
+ /** Each check's default bound, its unit and what it measures. A shot's `lookBounds` replaces the bound by name. */
47
+ export declare const LOOK_CHECKS: Readonly<Record<LookCheckName, {
48
+ bound: [number, number];
49
+ unit: string;
50
+ about: string;
51
+ }>>;
52
+ /** The `[low, high]` of a bound: a number is the high end, with no low end. */
53
+ export declare function lookBound(bound: LookBound): [number, number];
54
+ /** A row for a check that could not run, which fails: an asked-for check that did not run is not a pass. */
55
+ export declare function missingResult(check: LookCheckName | string, missing: string, bound?: LookBound): LookResult;
56
+ /** Luma of each pixel on 0 to 255: BT.709 weights on the encoded values. */
57
+ export declare function luma(image: LookImage): Float32Array;
58
+ /** Options of {@link skyClip}. */
59
+ export interface SkyClipOptions {
60
+ /** The sky mask; the whole frame without one. */
61
+ sky?: LookMask;
62
+ /** A channel at or above this code is clipped. Default 254. */
63
+ level?: number;
64
+ bound?: LookBound;
65
+ }
66
+ /** Percent of the sky's pixels with a channel at the clip level. */
67
+ export declare function skyClip(frame: LookImage, { sky, level, bound }?: SkyClipOptions): LookResult;
68
+ /** Options of {@link grain} and {@link speckle}. */
69
+ export interface RegionOptions {
70
+ /** Only pixels whose 3 x 3 neighbourhood is inside this mask count; the whole frame without one. */
71
+ mask?: LookMask;
72
+ bound?: LookBound;
73
+ }
74
+ /**
75
+ * Noise standard deviation in 8-bit codes, by Immerkaer's estimator: the mean absolute response to the 3 x 3 mask
76
+ * [1 -2 1; -2 4 -2; 1 -2 1], which is blind to flat areas, ramps and planes, times sqrt(pi / 2) / 6.
77
+ */
78
+ export declare function grain(frame: LookImage, { mask, bound }?: RegionOptions): LookResult;
79
+ /** Options of {@link speckle}. */
80
+ export interface SpeckleOptions extends RegionOptions {
81
+ /** A pixel this many codes above the brightest, or below the darkest, of its eight neighbours is a speckle. Default 24. */
82
+ threshold?: number;
83
+ }
84
+ /** Isolated pixels, per million: brighter than all eight neighbours, or darker than all, by `threshold` codes. */
85
+ export declare function speckle(frame: LookImage, { mask, threshold, bound }?: SpeckleOptions): LookResult;
86
+ /** Options of {@link banding}. */
87
+ export interface BandingOptions extends RegionOptions {
88
+ /** Shortest flat run, in pixels, on each side of a step. Default 6. */
89
+ minRun?: number;
90
+ /** A step of more than this many luma codes skips a code. Default 1.5. */
91
+ minStep?: number;
92
+ /** Steps above this many codes are edges of things, not bands. Default 12. */
93
+ maxStep?: number;
94
+ }
95
+ /**
96
+ * Percent of pixels in banded runs: along every row and column, two neighbouring runs of identical pixels, each at
97
+ * least `minRun` long, whose luma differs by more than one code and at most `maxStep`. A smooth 8-bit gradient steps
98
+ * one code at a time and passes; the same gradient with too few levels skips codes between its flat runs, the gaps
99
+ * in the gradient's histogram that show as bands. Dithered or textured areas have no long runs and pass.
100
+ */
101
+ export declare function banding(frame: LookImage, options?: BandingOptions): LookResult;
102
+ /** Options of {@link flat}. */
103
+ export interface FlatOptions extends RegionOptions {
104
+ /** Half the side of the constant window: 32 is a 65 x 65 window, wider than the one-code steps of a slow 8-bit
105
+ * gradient, so a smooth sky is not flat. Default 32. */
106
+ radius?: number;
107
+ }
108
+ /**
109
+ * Percent of pixels at the centre of a window of identical pixels, leaving out black and white (the crush and clip
110
+ * checks own those): an area with no variation at all, such as a missing texture or a fog that lost its detail.
111
+ */
112
+ export declare function flat(frame: LookImage, { mask, radius, bound }?: FlatOptions): LookResult;
113
+ /** Options of {@link blocks}. */
114
+ export interface BlocksOptions {
115
+ /** The block size in pixels, for example the froxel tile of `@margoengine/environment`. Default 8. */
116
+ pitch?: number;
117
+ /** Neighbour differences, less one code, are capped at this many codes, so a few strong edges cannot pose as a
118
+ * pattern. Default 8. */
119
+ cap?: number;
120
+ bound?: LookBound;
121
+ }
122
+ /**
123
+ * Percent of the frame in tiles showing a block pattern at the pitch: a blocky image is a smooth one plus a step
124
+ * signal at a known period (Wang, Bovik and Evans 2000). The frame is cut into tiles 8 pitches across. In each tile
125
+ * and along each axis, every neighbour difference loses one code (the one-code steps of a smooth 8-bit gradient
126
+ * never count), is capped, and is summed by its phase within the pitch and its period. A tile is blocky when one
127
+ * phase holds more step energy than every other phase in at least 7 of the 8 periods, and on average a quarter code
128
+ * more than they do. Random detail wins 7 of 8 periods with odds near 1 in 300,000 per phase; the edges of an object
129
+ * or two fall in a few periods; a pattern at a divisor of the pitch ties between phases. Texture masks blocks here as
130
+ * it does to the eye. Tiles with too few steps to say are counted as clear.
131
+ */
132
+ export declare function blocks(frame: LookImage, { pitch, cap, bound }?: BlocksOptions): LookResult;
133
+ /**
134
+ * The analytic horizon: the row, per column, where horizontal planes vanish, from the camera's view-projection
135
+ * (column-major, WebGPU clip space with y up). NaN in columns where the horizon is off the frame or the view looks
136
+ * straight up or down. The horizon of every horizontal plane is one line, so no plane height is needed.
137
+ */
138
+ export declare function horizonLine(viewProjection: ArrayLike<number>, width: number, height: number): Float32Array;
139
+ /** The first row, per column, where a mask turns inside going down: the top edge of the water is the water line. */
140
+ export declare function maskTopEdge(mask: LookMask): Float32Array;
141
+ /** Options of {@link horizonSeam}. */
142
+ export interface HorizonSeamOptions {
143
+ /** The camera's view-projection at this frame, column-major. */
144
+ viewProjection: ArrayLike<number>;
145
+ /**
146
+ * The sky mask: only columns with sky just above the line (3 rows up) count, where the horizon is in view. Without
147
+ * it every column counts, whatever stands across the line. {@link checkProbe} runs the check only with one.
148
+ */
149
+ sky?: LookMask;
150
+ bound?: LookBound;
151
+ }
152
+ /**
153
+ * The seam at the analytic horizon ({@link horizonLine}): the luma step there beyond its surroundings, in codes, over
154
+ * the columns where the sky meets the line. A wall, a mantel or a hill across the line is not a horizon: it has no sky
155
+ * above it, so those columns are left out, and a frame with no sky at the line measures 0 over 0 columns.
156
+ */
157
+ export declare function horizonSeam(frame: LookImage, { viewProjection, sky, bound }: HorizonSeamOptions): LookResult;
158
+ /** Options of {@link waterSeam}. */
159
+ export interface WaterSeamOptions {
160
+ /** The water mask: its top edge is the water line. */
161
+ water: LookMask;
162
+ bound?: LookBound;
163
+ }
164
+ /** The seam at the water line (the top edge of the water mask): the luma step there beyond its surroundings, in codes. */
165
+ export declare function waterSeam(frame: LookImage, { water, bound }: WaterSeamOptions): LookResult;
166
+ /** Options of {@link lights}. */
167
+ export interface LightsOptions {
168
+ /** Search only inside this mask, for example the sky. */
169
+ mask?: LookMask;
170
+ /** Luma at or above this is bright. Default 0.85 of the brightest luma in the search area, and at least 128. */
171
+ level?: number;
172
+ /** Smallest disc area in pixels; stars, sparks and glints are smaller. Default 24. */
173
+ minArea?: number;
174
+ /** The lights the scene shows, from its light list: the default bound is [0, lights]. Default 1. */
175
+ expected?: number;
176
+ bound?: LookBound;
177
+ }
178
+ /** A bright disc {@link lights} found. */
179
+ export interface LightDisc {
180
+ x: number;
181
+ y: number;
182
+ radius: number;
183
+ area: number;
184
+ }
185
+ /**
186
+ * Counts bright discs: 8-connected components of bright pixels that fill their bounding box as a disc does (between
187
+ * 0.6 and 0.95 of it) and are about as wide as tall. A second moon or sun is the double light this catches; streaks
188
+ * such as lightning fill too little of their box to count. A light is an emitter: its core clips (luma 250 or more)
189
+ * or it stands clear of what surrounds it (the mean luma of a ring just outside it is below 0.7 of the level). The
190
+ * sunlit tops of cumulus clear the level as round puffs too, but shade smoothly into the cloud round them, so they
191
+ * are not lights (KB-LOOK-LIGHTS-CLOUD1).
192
+ */
193
+ export declare function lights(frame: LookImage, options?: LightsOptions): LookResult & {
194
+ discs: LightDisc[];
195
+ };
196
+ /** Options of {@link foamEdges}. */
197
+ export interface FoamEdgesOptions {
198
+ /** Where the foam is. Edges within 2 pixels of it count. */
199
+ foam: LookMask;
200
+ /** An edge's luma rise across its width must reach this many codes to count. Default 48. */
201
+ minContrast?: number;
202
+ /** Edges this many pixels wide or less are hard. Default 2. */
203
+ hardWidth?: number;
204
+ bound?: LookBound;
205
+ }
206
+ /**
207
+ * Percent of the foam's strong edges that are hard. Each edge pixel (a local maximum of the gradient along its
208
+ * stronger axis) is walked both ways to the luma extrema, and the distance between them is its width (Marziliano et
209
+ * al. 2002): a thresholded foam edge is 1 pixel wide, a soft one many.
210
+ */
211
+ export declare function foamEdges(frame: LookImage, options: FoamEdgesOptions): LookResult;
212
+ /** Options of {@link crush}. */
213
+ export interface CrushOptions {
214
+ /** Areas declared dark, where black is meant; left out of the count. */
215
+ dark?: LookMask;
216
+ /** A pixel whose largest channel is at or below this code is crushed. Default 2. */
217
+ level?: number;
218
+ bound?: LookBound;
219
+ }
220
+ /** Percent of the pixels outside the declared dark areas that are crushed to black. */
221
+ export declare function crush(frame: LookImage, { dark, level, bound }?: CrushOptions): LookResult;
222
+ /** Options of {@link flicker} and {@link shimmer}. */
223
+ export interface FlickerOptions {
224
+ /** Only pixels inside this mask count. */
225
+ mask?: LookMask;
226
+ bound?: LookBound;
227
+ }
228
+ /**
229
+ * The largest jump of the mean luma off its trend over consecutive frames of a still camera, in codes: the most
230
+ * |m(t) - (m(t-1) + m(t+1)) / 2|. A steady change, a fade or a slow sweep, is a trend and passes.
231
+ */
232
+ export declare function flicker(frames: readonly LookImage[], { mask, bound }?: FlickerOptions): LookResult;
233
+ /**
234
+ * Percent of pixels that jump more than `threshold` codes off their own trend, averaged over the inner frames of a
235
+ * still camera: march noise and unstable shading that the frame mean hides.
236
+ */
237
+ export declare function shimmer(frames: readonly LookImage[], { mask, bound, threshold }?: FlickerOptions & {
238
+ threshold?: number;
239
+ }): LookResult;
240
+ /** Pixels of a float frame with a NaN or infinite channel; detail gives the first one's position. */
241
+ export declare function nan(frame: FloatFrame, { bound }?: {
242
+ bound?: LookBound;
243
+ }): LookResult;
244
+ /** Options of {@link flip}. */
245
+ export interface FlipOptions {
246
+ /** Pixels per degree of visual angle where the frames are seen. Default 67, the FLIP paper's 0.7 m from a 4K
247
+ * monitor 0.69 m wide; a phone held at 30 cm showing 1080 pixels across 6.5 cm is about 87. */
248
+ pixelsPerDegree?: number;
249
+ /** Also return the error of each pixel. Default false. */
250
+ map?: boolean;
251
+ }
252
+ /** What {@link flip} gives back: FLIP errors are 0 (no visible difference) to 1. */
253
+ export interface FlipResult {
254
+ mean: number;
255
+ /** Error at the 50th, 95th and 99th percentile of pixels. */
256
+ p50: number;
257
+ p95: number;
258
+ p99: number;
259
+ max: number;
260
+ /** With `map: true`: the error of each pixel, row by row. */
261
+ map?: Float32Array;
262
+ }
263
+ /**
264
+ * FLIP (Andersson et al. 2020): the difference a viewer sees flipping between a test frame and its reference, per
265
+ * pixel 0 to 1, as `{ mean, p50, p95, p99, max }`. Colour: both images filtered by the eye's contrast sensitivity at
266
+ * `pixelsPerDegree`, compared in Hunt-adjusted L*a*b* with HyAB and compressed into 0..1; features: edges and points
267
+ * found in one image and not the other raise it.
268
+ */
269
+ export declare function flip(test: LookImage, reference: LookImage, { pixelsPerDegree, map }?: FlipOptions): FlipResult;
270
+ /** Mean FLIP of a frame against a reference, as the `reference` (16-sample frame) or `backends` (compat frame) check. */
271
+ export declare function difference(frame: LookImage, other: LookImage, check: 'reference' | 'backends', { bound, ...options }?: FlipOptions & {
272
+ bound?: LookBound;
273
+ }): LookResult & {
274
+ map?: Float32Array;
275
+ };
276
+ /** One probe frame and what the checks need beside it. Checks whose inputs are missing are left out, unless named. */
277
+ export interface LookProbe {
278
+ name: string;
279
+ frame: LookImage;
280
+ /**
281
+ * Masks by name: `sky`, `water`, `foam` and `dark` are read, and `sky-coverage` (the pixels `@margoengine/sky` drew,
282
+ * its `coverage` option) limits `skyClip` when there is no `sky` mask. `grain`, `lights` and `horizonSeam` read only
283
+ * `sky`.
284
+ */
285
+ masks?: Record<string, LookMask>;
286
+ /** The float frame before tone mapping, for the `nan` check. */
287
+ hdr?: FloatFrame;
288
+ /** The 16-sample reference render of this frame. */
289
+ reference?: LookImage;
290
+ /** This frame from the WebGL2 compatibility layer. */
291
+ compat?: LookImage;
292
+ /** The camera's view-projection at this frame, column-major, for the horizon seam. */
293
+ viewProjection?: ArrayLike<number>;
294
+ /** Consecutive frames of a still camera around this one, for flicker and shimmer. */
295
+ still?: LookImage[];
296
+ /** The frame after this one and each pixel's motion to it, for `shimmerMoving` and `motionBlur`. */
297
+ moving?: MovingFrames;
298
+ }
299
+ /** Options of {@link checkProbe}. */
300
+ export interface CheckProbeOptions {
301
+ /** The block pitch: the froxel tile in pixels. Default 8. */
302
+ pitch?: number;
303
+ /** Viewing condition of the FLIP checks. Default 67 pixels per degree. */
304
+ pixelsPerDegree?: number;
305
+ /** A look family from {@link LOOK_FAMILY_NAMES}: its bounds apply to every check the probe can run, under `bounds`. */
306
+ family?: string | null;
307
+ }
308
+ /**
309
+ * Runs every look check a probe has the inputs for, with `bounds` from the shot file's `lookBounds` in place of the
310
+ * defaults. A check named in `bounds` that cannot run fails as missing, and so does a name no check has.
311
+ */
312
+ export declare function checkProbe(probe: LookProbe, bounds?: Readonly<Record<string, LookBound>>, { pitch, pixelsPerDegree, family }?: CheckProbeOptions): (LookResult & {
313
+ map?: Float32Array;
314
+ })[];
315
+ /** A checked probe, for {@link lookReport}. */
316
+ export interface CheckedProbe {
317
+ name: string;
318
+ frame: LookImage;
319
+ results: (LookResult & {
320
+ map?: Float32Array;
321
+ })[];
322
+ }
323
+ /** The report as JSON. */
324
+ export interface LookReportJSON {
325
+ format: 'margo-look-report';
326
+ version: 1;
327
+ pass: boolean;
328
+ probes: {
329
+ name: string;
330
+ pass: boolean;
331
+ results: LookResult[];
332
+ }[];
333
+ }
334
+ /** What {@link lookReport} gives back: one page for review. */
335
+ export interface LookReport {
336
+ pass: boolean;
337
+ json: LookReportJSON;
338
+ /** A markdown table: one row per probe and check, failures first. */
339
+ markdown: string;
340
+ /** The contact sheet: each probe's thumbnail framed green (pass) or red (fail) and labelled with what failed, then
341
+ * its FLIP map against the reference when it has one. Save it with `encodePNG`. */
342
+ sheet: LookImage;
343
+ }
344
+ /** Options of {@link lookReport}. */
345
+ export interface LookReportOptions {
346
+ /** Thumbnail width in pixels. Default 270, a quarter of a vertical short. */
347
+ thumbWidth?: number;
348
+ /** Tiles per row. Default 4. */
349
+ columns?: number;
350
+ /** A title over the table. Default "Look checks". */
351
+ title?: string;
352
+ }
353
+ /** The contact sheet and the table, JSON and markdown, of checked probes. */
354
+ export declare function lookReport(probes: readonly CheckedProbe[], { thumbWidth, columns, title }?: LookReportOptions): LookReport;
355
+ /** A probe of a shot tool manifest (`manifest.json`, docs/shots.md): file paths relative to the shot folder. */
356
+ export interface ShotManifestProbe {
357
+ frame: number;
358
+ file: string;
359
+ aovs?: Record<string, string>;
360
+ /** The 16-sample reference render of this frame, a PNG. */
361
+ reference?: string;
362
+ /** This frame from the WebGL2 compatibility layer, a PNG. */
363
+ compat?: string;
364
+ /** The float frame, raw little-endian RGBA float32 rows (`.rgba32f`), the frame's size. */
365
+ hdr?: string;
366
+ /** The camera's view-projection at this frame, column-major. */
367
+ viewProjection?: number[];
368
+ /** PNGs of consecutive frames of a still camera around this one. */
369
+ still?: string[];
370
+ /**
371
+ * The frame after this one (a PNG) and each pixel's motion to it (raw little-endian float32, x then y per pixel, the
372
+ * frame's size), for `shimmerMoving` and `motionBlur`.
373
+ */
374
+ moving?: {
375
+ next: string;
376
+ motion: string;
377
+ };
378
+ /**
379
+ * This probe's own bounds, check name: bound. They replace the shot's `lookBounds` for the checks they name, on this
380
+ * probe only (for example a lights bound for the probes that face the lamps).
381
+ */
382
+ lookBounds?: Record<string, LookBound>;
383
+ }
384
+ /** What {@link checkShot} reads. */
385
+ export interface CheckShotOptions extends CheckProbeOptions, LookReportOptions {
386
+ /** The shot tool's manifest.json, parsed. */
387
+ manifest: {
388
+ id?: string;
389
+ header?: {
390
+ lookBounds?: Record<string, LookBound>;
391
+ lookFamily?: string | null;
392
+ };
393
+ probes?: Record<string, ShotManifestProbe>;
394
+ };
395
+ /** Reads a file of the shot folder by its manifest path, for example `(path) => readFile(join(folder, path))`. */
396
+ read: (path: string) => Promise<Uint8Array>;
397
+ /** Stops between probes; the promise rejects with the signal's reason. */
398
+ signal?: AbortSignal;
399
+ }
400
+ /**
401
+ * Runs the look checks on every probe of a rendered shot, with its `lookBounds` (and each probe's own `lookBounds` in
402
+ * their place for the checks a probe names), and makes the report.
403
+ */
404
+ export declare function checkShot({ manifest, read, signal, pitch, pixelsPerDegree, ...report }: CheckShotOptions): Promise<LookReport>;
405
+ /** A bound per check for a named look family. `natural` has none: every check keeps its default. */
406
+ export declare const LOOK_FAMILY_BOUNDS: Readonly<Record<string, Readonly<Record<string, LookBound>>>>;
407
+ /**
408
+ * The share of its fine detail a master frame must keep after a platform re-encode (T7, `detailKept` of the shot tool's
409
+ * master check), per look family: 0.5 for `natural`, 0.6 for `animatedFeature`.
410
+ */
411
+ export declare const LOOK_FAMILY_DETAIL_KEPT: Readonly<Record<string, number>>;
412
+ /** The `detailKept` floor of a look family (a missing or null family is `natural`). @throws RangeError for an unknown family. */
413
+ export declare function detailKeptFloor(family?: string | null): number;
414
+ /** The names of the look families, `natural` first. */
415
+ export declare const LOOK_FAMILY_NAMES: readonly string[];
416
+ /**
417
+ * The bounds of a look family, to pass as `lookBounds` (a shot's own `lookBounds` replace them by name).
418
+ * @throws RangeError for a family not in {@link LOOK_FAMILY_NAMES}.
419
+ */
420
+ export declare function familyBounds(family: string): Record<string, LookBound>;
421
+ /** Options of {@link stairs} and {@link colourEdges}. */
422
+ export interface EdgeOptions extends RegionOptions {
423
+ /** A step this large between neighbours is a strong edge: 24 codes of luma (or L*), 24 of a* or b*. Default 24. */
424
+ strong?: number;
425
+ }
426
+ /**
427
+ * T3: percent of the strong luma edges (a step over 24 codes) that are hard, one pixel stair steps with no value
428
+ * between the two plateaus in their 3 x 3 window. A frame supersampled and resolved has none; a pixel-aliased edge is all of them.
429
+ */
430
+ export declare function stairs(frame: LookImage, { mask, strong, bound }?: EdgeOptions): LookResult;
431
+ /**
432
+ * T7: percent of the strong colour edges (a step over 24 in a* or b*) that are one pixel wide. H.264 at 4:2:0 halves the
433
+ * colour detail, so a colour edge narrower than two pixels is smeared by the encoder: red fire and red skies first.
434
+ */
435
+ export declare function colourEdges(frame: LookImage, { mask, strong, bound }?: EdgeOptions): LookResult;
436
+ /** Options of {@link chromaSmear}. */
437
+ export interface ChromaSmearOptions extends RegionOptions {
438
+ /** A pixel whose CIE76 colour difference after the 4:2:0 round trip is over this is smeared. Default 6, clearly visible side by side. */
439
+ threshold?: number;
440
+ }
441
+ /**
442
+ * T7: percent of the pixels whose colour moves visibly when the frame is cut to 4:2:0 chroma, as a platform's H.264
443
+ * encode does before any quantisation. The frame goes to BT.709 Y'CbCr (full range), Cb and Cr are averaged over
444
+ * each 2 x 2 block (the frame's edge blocks use the pixels they have) and read back with the bilinear sampling a
445
+ * player uses (the block centres, linear between them), and each pixel's CIE76 difference is counted over
446
+ * `threshold`. It needs no encoder, so it runs on any frame, and finds the colour detail an encode will lose: where
447
+ * {@link colourEdges} counts the edges that are one pixel wide, this counts what that loss does.
448
+ */
449
+ export declare function chromaSmear(frame: LookImage, { mask, threshold, bound }?: ChromaSmearOptions): LookResult;
450
+ /** Options of {@link penumbra}. */
451
+ export interface PenumbraOptions {
452
+ /** The shadow penumbra mask. */
453
+ mask?: LookMask;
454
+ bound?: LookBound;
455
+ }
456
+ /** T1 in shadow penumbras: the grain of the frame inside the `penumbra` mask (bound 0.7 codes for the family). */
457
+ export declare function penumbra(frame: LookImage, { mask, bound }?: PenumbraOptions): LookResult;
458
+ /** Per pixel motion of a frame to the next, in pixels: x then y of each pixel, `width * height * 2` floats. */
459
+ export interface LookMotion {
460
+ width: number;
461
+ height: number;
462
+ data: Float32Array;
463
+ }
464
+ /** A moving probe: the frame after this one and where each pixel of this one went. */
465
+ export interface MovingFrames {
466
+ next: LookImage;
467
+ motion: LookMotion;
468
+ }
469
+ /**
470
+ * T4 while moving: frame n is warped onto n + 1 by its motion (`reprojectionMotion` makes it from the depth and the two
471
+ * view-projections), and the percent of pixels whose warped luma differs from the next frame by more than `threshold`
472
+ * (6 codes) is the shimmer. Pixels whose target leaves the frame are not counted.
473
+ */
474
+ export declare function shimmerMoving(frame: LookImage, { next, motion }: MovingFrames, { mask, bound, threshold }?: FlickerOptions & {
475
+ threshold?: number;
476
+ }): LookResult;
477
+ /**
478
+ * The motion of every pixel of a still world seen by a moving camera: each pixel's depth (NDC z, in the convention of the
479
+ * matrices) takes it back to the world by the inverse of `viewProjection`, and `nextViewProjection` takes it forward to
480
+ * where it lands in the next frame. Column-major matrices. Pixels with no depth (`NaN`) move by 0.
481
+ * @throws RangeError for a singular matrix or a depth that is not `width * height` floats.
482
+ */
483
+ export declare function reprojectionMotion(depth: Float32Array, viewProjection: ArrayLike<number>, nextViewProjection: ArrayLike<number>, width: number, height: number): LookMotion;
484
+ /**
485
+ * The NDC depth of every pixel of a frame from its distance to the eye, in the convention of `viewProjection`, for
486
+ * {@link reprojectionMotion}: the pixel's ray (the line through the unprojected points at depth 0 and 1, pointing away
487
+ * from `eye`) is walked `distance` metres from `eye` and the point is projected back. A pixel with no distance (not
488
+ * finite or not above 0) takes `options`: where `water` is 128 or more its ray meets the plane y = `plane` (the sea
489
+ * level), and any other pixel is `far` metres away (a sky); with neither it gives `NaN` (no depth). Column-major matrix.
490
+ * @throws RangeError for a singular matrix, an eye that is not 3 numbers or a distance that is not `width * height` floats.
491
+ */
492
+ export declare function depthFromDistance(distance: ArrayLike<number>, eye: ArrayLike<number>, viewProjection: ArrayLike<number>, width: number, height: number, options?: {
493
+ water?: ArrayLike<number>;
494
+ plane?: number;
495
+ far?: number;
496
+ }): Float32Array;
497
+ /**
498
+ * T8: of the edge centres of pixels moving more than `minimum` (8) pixels a frame, the percent whose edge is narrower
499
+ * than half their travel, where a 180 degree shutter smears it across the whole travel: strobing spray, rain or debris.
500
+ * An edge centre is a pixel whose luma profile along its motion (one travel wide, centred on it, spanning over 24 codes)
501
+ * crosses the middle value within one pixel of the pixel itself; the edge's width is the part of the profile between 10
502
+ * and 90 percent of its range. A hard edge is under a pixel wide, a blurred one as wide as its travel.
503
+ */
504
+ export declare function motionBlur(frame: LookImage, motion: LookMotion, { mask, bound, minimum }?: FlickerOptions & {
505
+ minimum?: number;
506
+ }): LookResult;
507
+ /** Options of the subject checks. */
508
+ export interface SilhouetteOptions {
509
+ /** The subject's mask: required. */
510
+ subject: LookMask;
511
+ bound?: LookBound;
512
+ }
513
+ /**
514
+ * T5: percent of the subject's outline pixels where the subject differs from what is behind it by at least `contrast`
515
+ * (15) L*: the mean L* of the subject pixels in the 3 x 3 window against the mean of the others.
516
+ */
517
+ export declare function silhouette(frame: LookImage, { subject, bound, contrast }: SilhouetteOptions & {
518
+ contrast?: number;
519
+ }): LookResult;
520
+ /**
521
+ * T5 at a glance: the frame reduced to 320 x 180 (box filter) and its L* cut into three values (thirds of 0 to 100); the
522
+ * percent of the subject's mask (a reduced pixel is the subject when half of it is) that sits in one value. A subject
523
+ * that reads as one shape sits in one.
524
+ */
525
+ export declare function silhouetteShape(frame: LookImage, { subject, bound }: SilhouetteOptions): LookResult;
526
+ /** Options of {@link bounce}. */
527
+ export interface BounceOptions {
528
+ /** Where the ground is in the sun. */
529
+ lit: LookMask;
530
+ /** Where the ground is in shadow. */
531
+ shadow: LookMask;
532
+ bound?: LookBound;
533
+ }
534
+ /**
535
+ * The share of the frame's shorter side kept clear of a ground mask's edge by {@link bounce} and {@link shadowTint}:
536
+ * 1/360, 3 pixels at 1080p and 1 at 360p (at least 1).
537
+ */
538
+ export declare const GROUND_INSET: number;
539
+ /**
540
+ * T6: the mean luminance of the shadowed ground as a percent of the lit ground's, in linear light, each averaged over
541
+ * its mask's interior ({@link GROUND_INSET} in from the edges, where the frame mixes both sides). Shadow that holds
542
+ * 10 to 35 percent of the sunlit value carries bounce and sky light; under 10 is crushed, over 35 flat.
543
+ */
544
+ export declare function bounce(frame: LookImage, { lit, shadow, bound }: BounceOptions): LookResult;
545
+ /**
546
+ * T6: how much cooler (lower b*) the shadowed ground is than the lit ground, in CIE b* points (at least 3), over the
547
+ * masks' interiors as {@link bounce}.
548
+ */
549
+ export declare function shadowTint(frame: LookImage, { lit, shadow, bound }: BounceOptions): LookResult;
550
+ /** T7 at night: the mean luma of the frame, in codes (at least 24, a night that still reads on a phone). */
551
+ export declare function nightLuma(frame: LookImage, { mask, bound }?: RegionOptions): LookResult;
552
+ /** T7 at night: the luma the brightest 1 percent of the frame reaches, in codes (over 180: a night has its lights). */
553
+ export declare function nightPeak(frame: LookImage, { mask, bound }?: RegionOptions): LookResult;