@fxi/zartigl 0.8.0 → 0.9.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/engine.d.ts +47 -18
- package/dist/engine.js +51 -43
- package/dist/{geovideo-index-_qQ6iS2d.js → geovideo-index-CzQo6UIG.js} +192 -187
- package/dist/zartigl.js +741 -737
- package/package.json +1 -1
package/dist/engine.d.ts
CHANGED
|
@@ -181,6 +181,14 @@ export declare function fadeToOpacity(fade: number): number;
|
|
|
181
181
|
*/
|
|
182
182
|
export declare function formatUnit(unit: string | undefined): string;
|
|
183
183
|
|
|
184
|
+
/**
|
|
185
|
+
* `float geoVideoScalarValue(float r)`: a scalar-luma frame's red channel to
|
|
186
|
+
* its value, with the `u_code_range` / `u_value_range` uniforms it declares
|
|
187
|
+
* (geoVideoScalarUniforms); GLSL ES 1.0 and 3.0. The one scalar GeoVideo
|
|
188
|
+
* decoder: frames go to the GPU as images, never read back.
|
|
189
|
+
*/
|
|
190
|
+
export declare const GEOVIDEO_SCALAR_GLSL: string;
|
|
191
|
+
|
|
184
192
|
/**
|
|
185
193
|
* One immutable chunk of a GeoVideo archive, independent of the catalog: a
|
|
186
194
|
* manifest and the range of its encoded samples.
|
|
@@ -315,8 +323,8 @@ export declare interface GeoVideoChunkSpan {
|
|
|
315
323
|
end: number;
|
|
316
324
|
}
|
|
317
325
|
|
|
318
|
-
/**
|
|
319
|
-
export declare type GeoVideoFrameData =
|
|
326
|
+
/** A scalar frame image (decoded on the GPU) or u/v components (NaN invalid). */
|
|
327
|
+
export declare type GeoVideoFrameData = GeoVideoScalarFrame | GeoVideoVectorFrame;
|
|
320
328
|
|
|
321
329
|
/** The part of a frame source an archive reads. */
|
|
322
330
|
export declare interface GeoVideoFrameReader<TFrame> {
|
|
@@ -332,11 +340,12 @@ export declare interface GeoVideoFrameRequest {
|
|
|
332
340
|
|
|
333
341
|
/**
|
|
334
342
|
* GeoVideo frames read one time step at a time (seek, no playback): video
|
|
335
|
-
* and static mask loading,
|
|
336
|
-
*
|
|
337
|
-
*
|
|
338
|
-
*
|
|
339
|
-
*
|
|
343
|
+
* and static mask loading, a serial decode queue, and a small LRU cache of
|
|
344
|
+
* decoded frames. Requests for the same step share one decode; each can be
|
|
345
|
+
* abandoned with its own signal, and the decode is dropped once no request
|
|
346
|
+
* waits for it. cancelAll() aborts every pending decode. Subclasses capture
|
|
347
|
+
* the presented frame: read back as luma codes (readCodes) or kept as an
|
|
348
|
+
* image for the GPU.
|
|
340
349
|
*/
|
|
341
350
|
export declare abstract class GeoVideoFrameSource<TFrame> {
|
|
342
351
|
/** Grid size; the video stacks `planes` grids vertically. */
|
|
@@ -348,7 +357,7 @@ export declare abstract class GeoVideoFrameSource<TFrame> {
|
|
|
348
357
|
private readonly cacheSize;
|
|
349
358
|
private readonly reader;
|
|
350
359
|
private video;
|
|
351
|
-
private
|
|
360
|
+
private maskCodes;
|
|
352
361
|
private initPromise;
|
|
353
362
|
private presented;
|
|
354
363
|
private primed;
|
|
@@ -361,8 +370,17 @@ export declare abstract class GeoVideoFrameSource<TFrame> {
|
|
|
361
370
|
constructor(manifest: GeoVideoManifest, planes: number, options?: {
|
|
362
371
|
cacheSize?: number;
|
|
363
372
|
});
|
|
364
|
-
/**
|
|
365
|
-
|
|
373
|
+
/**
|
|
374
|
+
* The presented frame (`rows` = stacked planes) and the per-cell mask to
|
|
375
|
+
* frame data; null when the decoder exposed no pixels yet.
|
|
376
|
+
*/
|
|
377
|
+
protected abstract capture(video: HTMLVideoElement, rows: number, mask: Uint8Array): Promise<TFrame | null>;
|
|
378
|
+
/** Static validity, one 8-bit value per grid cell; null before init(). */
|
|
379
|
+
get mask(): Uint8Array | null;
|
|
380
|
+
/** Luma codes of the presented frame, or null when it is blank. */
|
|
381
|
+
protected readCodes(video: HTMLVideoElement, rows: number): Uint8Array | null;
|
|
382
|
+
/** True when the decoder exposed no pixels; reads back one row only. */
|
|
383
|
+
protected isBlank(video: HTMLVideoElement): boolean;
|
|
366
384
|
init(): Promise<void>;
|
|
367
385
|
/** Abort every pending frame decode; frames already decoded stay cached. */
|
|
368
386
|
cancelAll(): void;
|
|
@@ -390,8 +408,8 @@ export declare abstract class GeoVideoFrameSource<TFrame> {
|
|
|
390
408
|
*/
|
|
391
409
|
private primeDecoder;
|
|
392
410
|
/**
|
|
393
|
-
* Seek
|
|
394
|
-
*
|
|
411
|
+
* Seek and capture one step. `signal` aborts it between steps; a seek
|
|
412
|
+
* already started completes first, keeping the queue serial.
|
|
395
413
|
*/
|
|
396
414
|
protected decode(index: number, signal: AbortSignal): Promise<TFrame>;
|
|
397
415
|
}
|
|
@@ -514,18 +532,28 @@ export declare interface GeoVideoScalarEncoding {
|
|
|
514
532
|
colorRange: "limited" | "full";
|
|
515
533
|
}
|
|
516
534
|
|
|
535
|
+
/** One scalar-luma frame, as decoded by the browser; GPU input only. */
|
|
536
|
+
export declare type GeoVideoScalarFrame = ImageBitmap;
|
|
537
|
+
|
|
517
538
|
/**
|
|
518
|
-
* Scalar-luma GeoVideo read frame by frame (seek, no playback)
|
|
519
|
-
*
|
|
539
|
+
* Scalar-luma GeoVideo read frame by frame (seek, no playback). Frames stay
|
|
540
|
+
* images, uploaded as textures and decoded by GEOVIDEO_SCALAR_GLSL, the
|
|
541
|
+
* decoder GeoVideoLayer uses: never read back, so both renderers turn the
|
|
542
|
+
* same pixels into the same values.
|
|
520
543
|
*/
|
|
521
|
-
export declare class GeoVideoScalarSource extends GeoVideoFrameSource<
|
|
522
|
-
private readonly encoding;
|
|
544
|
+
export declare class GeoVideoScalarSource extends GeoVideoFrameSource<GeoVideoScalarFrame> {
|
|
523
545
|
constructor(manifest: GeoVideoManifest, options?: {
|
|
524
546
|
cacheSize?: number;
|
|
525
547
|
});
|
|
526
|
-
protected
|
|
548
|
+
protected capture(video: HTMLVideoElement): Promise<GeoVideoScalarFrame | null>;
|
|
527
549
|
}
|
|
528
550
|
|
|
551
|
+
/** Uniforms of GEOVIDEO_SCALAR_GLSL for a scalar-luma encoding. */
|
|
552
|
+
export declare function geoVideoScalarUniforms(encoding: Pick<GeoVideoScalarEncoding, "codeMin" | "codeMax" | "valueMin" | "valueMax">): {
|
|
553
|
+
codeRange: [number, number];
|
|
554
|
+
valueRange: [number, number];
|
|
555
|
+
};
|
|
556
|
+
|
|
529
557
|
declare interface GeoVideoSnapshotLoopTimeline {
|
|
530
558
|
kind: "snapshot-loop";
|
|
531
559
|
date: string;
|
|
@@ -592,7 +620,8 @@ export declare class GeoVideoVectorSource extends GeoVideoFrameSource<GeoVideoVe
|
|
|
592
620
|
fetchSpatialChunkResult(variable: string, selection: {
|
|
593
621
|
timeIndex: number;
|
|
594
622
|
}): Promise<ZarrChunkFetchResult>;
|
|
595
|
-
|
|
623
|
+
/** u/v codes are written into luma: read back, then decoded on the CPU. */
|
|
624
|
+
protected capture(video: HTMLVideoElement, rows: number, mask: Uint8Array): Promise<GeoVideoVectorFrame | null>;
|
|
596
625
|
}
|
|
597
626
|
|
|
598
627
|
export declare function getPalettes(): PaletteMeta[];
|
package/dist/engine.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { B as
|
|
1
|
+
import { F as i, H as u, I as m, G as v, T as g, J as x, b as f, K as _, c as p, L as V, M as G, l as C, y as S, D as b, N as O, O as R, n as L, t as A, z as h, A as y, C as F, m as I, B as T, P as k, Q as D, R as E, p as B, S as w, E as M, v as N } from "./geovideo-index-CzQo6UIG.js";
|
|
2
|
+
import { B as z, C as H, e as K, b as U, d as J, c as Q, g as j, i as q, a as W, r as X } from "./backdrop-DctkJ45Q.js";
|
|
3
3
|
var e = `vec3 applyVibrance(vec3 c, float v) {
|
|
4
4
|
float mx = max(c.r, max(c.g, c.b));
|
|
5
5
|
float mn = min(c.r, min(c.g, c.b));
|
|
@@ -21,7 +21,13 @@ vec3 gradeColor(vec3 c, vec4 g) {
|
|
|
21
21
|
|
|
22
22
|
c = mix(c, c * c * (3.0 - 2.0 * c), g.y);
|
|
23
23
|
return clamp(applyVibrance(c, g.z), 0.0, 1.0);
|
|
24
|
-
}`, a = `
|
|
24
|
+
}`, a = `uniform vec2 u_code_range;
|
|
25
|
+
uniform vec2 u_value_range;
|
|
26
|
+
|
|
27
|
+
float geoVideoScalarValue(float r) {
|
|
28
|
+
float code = clamp((r - u_code_range.x) / (u_code_range.y - u_code_range.x), 0.0, 1.0);
|
|
29
|
+
return mix(u_value_range.x, u_value_range.y, code);
|
|
30
|
+
}`, o = `uint pcg(uint v) {
|
|
25
31
|
uint state = v * 747796405u + 2891336453u;
|
|
26
32
|
uint word = ((state >> ((state >> 28u) + 4u)) ^ state) * 277803737u;
|
|
27
33
|
return (word >> 22u) ^ word;
|
|
@@ -29,55 +35,57 @@ vec3 gradeColor(vec3 c, vec4 g) {
|
|
|
29
35
|
|
|
30
36
|
float random(uvec3 v) {
|
|
31
37
|
return float(pcg(v.x ^ pcg(v.y ^ pcg(v.z))) >> 8u) * (1.0 / 16777216.0);
|
|
32
|
-
}`,
|
|
38
|
+
}`, r = `vec3 applyVibrance(vec3 c, float v) {
|
|
33
39
|
float mx = max(c.r, max(c.g, c.b));
|
|
34
40
|
float mn = min(c.r, min(c.g, c.b));
|
|
35
41
|
float boost = v * (1.0 - (mx - mn));
|
|
36
42
|
float luma = dot(c, vec3(0.299, 0.587, 0.114));
|
|
37
43
|
return mix(vec3(luma), c, 1.0 + boost);
|
|
38
44
|
}`;
|
|
39
|
-
const
|
|
45
|
+
const n = r, c = e, t = o, s = a;
|
|
40
46
|
export {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
i as
|
|
47
|
-
|
|
48
|
-
m as
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
47
|
+
z as BACKDROP_OFF,
|
|
48
|
+
c as COLOR_GRADE_GLSL,
|
|
49
|
+
H as COLOR_GRADE_OFF,
|
|
50
|
+
K as COLOR_GRADE_VIBRANT,
|
|
51
|
+
s as GEOVIDEO_SCALAR_GLSL,
|
|
52
|
+
i as GeoVideoArchiveSource,
|
|
53
|
+
u as GeoVideoFrameSource,
|
|
54
|
+
m as GeoVideoScalarSource,
|
|
55
|
+
v as GeoVideoVectorSource,
|
|
56
|
+
t as RANDOM_GLSL,
|
|
57
|
+
g as TrailFade,
|
|
58
|
+
n as VIBRANCE_GLSL,
|
|
59
|
+
x as assertGeoVideoIndexIdentity,
|
|
60
|
+
U as backdropVec4,
|
|
61
|
+
J as colorGradeToGrade,
|
|
62
|
+
Q as colorGradeVec4,
|
|
63
|
+
f as createColorRampTexture,
|
|
64
|
+
_ as createGeoVideoFrameSource,
|
|
58
65
|
p as createProgram,
|
|
59
|
-
|
|
66
|
+
V as createShader,
|
|
60
67
|
G as fadeToFrames,
|
|
61
|
-
|
|
62
|
-
|
|
68
|
+
C as fadeToOpacity,
|
|
69
|
+
S as formatUnit,
|
|
63
70
|
b as geoVideoChunkSources,
|
|
64
|
-
|
|
71
|
+
O as geoVideoGrid,
|
|
65
72
|
R as geoVideoIndexChunks,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
T as
|
|
75
|
-
k as
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
73
|
+
L as geoVideoScalarUniforms,
|
|
74
|
+
A as geoVideoTimelineValues,
|
|
75
|
+
h as getPalettes,
|
|
76
|
+
j as gradeToColorGrade,
|
|
77
|
+
y as isGeoVideoArchiveSource,
|
|
78
|
+
q as isHexColor,
|
|
79
|
+
F as loadGeoVideoIndex,
|
|
80
|
+
I as loadGeoVideoManifest,
|
|
81
|
+
T as nextChunk,
|
|
82
|
+
k as nextChunkSpan,
|
|
83
|
+
D as pairChunk,
|
|
84
|
+
E as pairChunkSpan,
|
|
85
|
+
W as resolveBackdrop,
|
|
86
|
+
X as resolveColorGrade,
|
|
87
|
+
B as resolveColorRamp,
|
|
88
|
+
w as validateGeoVideoIndex,
|
|
89
|
+
M as validateGeoVideoManifest,
|
|
90
|
+
N as validateScalarColorDomain
|
|
83
91
|
};
|