@sealpixel/core 1.0.0-rc.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/README.md +3 -0
- package/dist/assets.d.ts +37 -0
- package/dist/assets.d.ts.map +1 -0
- package/dist/assets.js +96 -0
- package/dist/assets.js.map +1 -0
- package/dist/canonical-json.d.ts +11 -0
- package/dist/canonical-json.d.ts.map +1 -0
- package/dist/canonical-json.js +48 -0
- package/dist/canonical-json.js.map +1 -0
- package/dist/compile.d.ts +30 -0
- package/dist/compile.d.ts.map +1 -0
- package/dist/compile.js +64 -0
- package/dist/compile.js.map +1 -0
- package/dist/embedded.d.ts +13 -0
- package/dist/embedded.d.ts.map +1 -0
- package/dist/embedded.js +145 -0
- package/dist/embedded.js.map +1 -0
- package/dist/errors.d.ts +9 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +19 -0
- package/dist/errors.js.map +1 -0
- package/dist/external-kernel.d.ts +13 -0
- package/dist/external-kernel.d.ts.map +1 -0
- package/dist/external-kernel.js +68 -0
- package/dist/external-kernel.js.map +1 -0
- package/dist/generated/geometry.d.ts +33 -0
- package/dist/generated/geometry.d.ts.map +1 -0
- package/dist/generated/geometry.js +3 -0
- package/dist/generated/geometry.js.map +1 -0
- package/dist/generated/output.d.ts +40 -0
- package/dist/generated/output.d.ts.map +1 -0
- package/dist/generated/output.js +3 -0
- package/dist/generated/output.js.map +1 -0
- package/dist/generated/plan.d.ts +292 -0
- package/dist/generated/plan.d.ts.map +1 -0
- package/dist/generated/plan.js +3 -0
- package/dist/generated/plan.js.map +1 -0
- package/dist/history.d.ts +16 -0
- package/dist/history.d.ts.map +1 -0
- package/dist/history.js +38 -0
- package/dist/history.js.map +1 -0
- package/dist/image-size.d.ts +12 -0
- package/dist/image-size.d.ts.map +1 -0
- package/dist/image-size.js +86 -0
- package/dist/image-size.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/inline-renderer.d.ts +28 -0
- package/dist/inline-renderer.d.ts.map +1 -0
- package/dist/inline-renderer.js +48 -0
- package/dist/inline-renderer.js.map +1 -0
- package/dist/options.d.ts +13 -0
- package/dist/options.d.ts.map +1 -0
- package/dist/options.js +35 -0
- package/dist/options.js.map +1 -0
- package/dist/plan.d.ts +16 -0
- package/dist/plan.d.ts.map +1 -0
- package/dist/plan.js +15 -0
- package/dist/plan.js.map +1 -0
- package/dist/plugin.d.ts +200 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +2 -0
- package/dist/plugin.js.map +1 -0
- package/dist/registry.d.ts +58 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +187 -0
- package/dist/registry.js.map +1 -0
- package/dist/render.d.ts +25 -0
- package/dist/render.d.ts.map +1 -0
- package/dist/render.js +164 -0
- package/dist/render.js.map +1 -0
- package/dist/renderer-core.d.ts +82 -0
- package/dist/renderer-core.d.ts.map +1 -0
- package/dist/renderer-core.js +228 -0
- package/dist/renderer-core.js.map +1 -0
- package/dist/renderer.d.ts +29 -0
- package/dist/renderer.d.ts.map +1 -0
- package/dist/renderer.js +2 -0
- package/dist/renderer.js.map +1 -0
- package/dist/session.d.ts +188 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +513 -0
- package/dist/session.js.map +1 -0
- package/dist/types.d.ts +114 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/worker-protocol.d.ts +100 -0
- package/dist/worker-protocol.d.ts.map +1 -0
- package/dist/worker-protocol.js +30 -0
- package/dist/worker-protocol.js.map +1 -0
- package/dist/worker-renderer.d.ts +35 -0
- package/dist/worker-renderer.d.ts.map +1 -0
- package/dist/worker-renderer.js +85 -0
- package/dist/worker-renderer.js.map +1 -0
- package/dist/worker.d.ts +23 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +81 -0
- package/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CAAC;QAC5D,MAAM,MAAM,GAAI,KAAgE,CAAC,MAAM,CAAC;QACxF,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,QAAQ,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvF,CAAC;IACD,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC;AAED,SAAS,cAAc,CAAmB,KAAQ;IAChD,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAAM,CAAC;AAC3F,CAAC"}
|
package/dist/render.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type RgbaBuffer, type SealpixelWasm } from '@sealpixel/wasm';
|
|
2
|
+
import { type Registry } from './registry.js';
|
|
3
|
+
import type { EditLog, OutputOptions, RenderOptions, RenderResult, RenderSource } from './types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Renders `log` against `source` and encodes the result.
|
|
6
|
+
*
|
|
7
|
+
* Pure with respect to its inputs: same bytes, same log, same options, same
|
|
8
|
+
* plugins and the same core version produce the same output bytes on every
|
|
9
|
+
* runtime. Core stages run inside the wasm; JS kernels run between them
|
|
10
|
+
* through the same orchestrator on every runtime.
|
|
11
|
+
*/
|
|
12
|
+
export declare function render(source: RenderSource, log: EditLog, options: RenderOptions): Promise<RenderResult>;
|
|
13
|
+
export interface PipelineOptions {
|
|
14
|
+
mode: 'truth' | 'preview';
|
|
15
|
+
upTo?: number;
|
|
16
|
+
signal?: AbortSignal;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Compiles the log and executes it: consecutive core stages become one wasm
|
|
20
|
+
* call, every external kernel runs in between on the RGBA buffer.
|
|
21
|
+
*/
|
|
22
|
+
export declare function runPipeline(wasm: SealpixelWasm, registry: Registry, image: RgbaBuffer, log: EditLog, options: PipelineOptions): Promise<RgbaBuffer>;
|
|
23
|
+
/** Maps the public output options onto the Rust `OutputOptions` JSON. */
|
|
24
|
+
export declare function toCoreOutput(output: OutputOptions): Record<string, unknown>;
|
|
25
|
+
//# sourceMappingURL=render.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,UAAU,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAQzF,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,KAAK,EACV,OAAO,EAEP,aAAa,EACb,aAAa,EACb,YAAY,EACZ,YAAY,EACb,MAAM,YAAY,CAAC;AAUpB;;;;;;;GAOG;AACH,wBAAsB,MAAM,CAC1B,MAAM,EAAE,YAAY,EACpB,GAAG,EAAE,OAAO,EACZ,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,YAAY,CAAC,CAuDvB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,aAAa,EACnB,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,UAAU,EACjB,GAAG,EAAE,OAAO,EACZ,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,UAAU,CAAC,CAsDrB;AAsBD,yEAAyE;AACzE,wBAAgB,YAAY,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAQ3E"}
|
package/dist/render.js
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { loadSealpixelWasm } from '@sealpixel/wasm';
|
|
2
|
+
import { withAssets } from './assets.js';
|
|
3
|
+
import { canonicalJson } from './canonical-json.js';
|
|
4
|
+
import { compile, toCoreStages, toPipeline } from './compile.js';
|
|
5
|
+
import { SealpixelError } from './errors.js';
|
|
6
|
+
import { runExternalKernel } from './external-kernel.js';
|
|
7
|
+
import { PLAN_VERSION } from './plan.js';
|
|
8
|
+
import { createRegistry } from './registry.js';
|
|
9
|
+
const FORMAT_TO_CORE = {
|
|
10
|
+
'image/png': 'png',
|
|
11
|
+
'image/jpeg': 'jpeg',
|
|
12
|
+
'image/webp': 'webp',
|
|
13
|
+
};
|
|
14
|
+
const EMPTY_REGISTRY = createRegistry([]);
|
|
15
|
+
/**
|
|
16
|
+
* Renders `log` against `source` and encodes the result.
|
|
17
|
+
*
|
|
18
|
+
* Pure with respect to its inputs: same bytes, same log, same options, same
|
|
19
|
+
* plugins and the same core version produce the same output bytes on every
|
|
20
|
+
* runtime. Core stages run inside the wasm; JS kernels run between them
|
|
21
|
+
* through the same orchestrator on every runtime.
|
|
22
|
+
*/
|
|
23
|
+
export async function render(source, log, options) {
|
|
24
|
+
const wasm = options.wasm ?? (await loadSealpixelWasm());
|
|
25
|
+
const registry = options.registry ?? EMPTY_REGISTRY;
|
|
26
|
+
throwIfAborted(options.signal);
|
|
27
|
+
const t0 = now();
|
|
28
|
+
const image = source instanceof Uint8Array ? tryCore(() => wasm.decode(source)) : source;
|
|
29
|
+
const decodeMs = now() - t0;
|
|
30
|
+
const mode = options.mode ?? 'truth';
|
|
31
|
+
if (mode === 'truth' &&
|
|
32
|
+
(image.width !== log.source.width || image.height !== log.source.height)) {
|
|
33
|
+
throw new SealpixelError('SOURCE_MISMATCH', `truth render expects ${log.source.width}x${log.source.height}, got ${image.width}x${image.height}`);
|
|
34
|
+
}
|
|
35
|
+
if (log.ops.length > 0 && registry === EMPTY_REGISTRY) {
|
|
36
|
+
throw new SealpixelError('INVALID_EDIT_LOG', 'log has ops but no registry was given');
|
|
37
|
+
}
|
|
38
|
+
throwIfAborted(options.signal);
|
|
39
|
+
const t1 = now();
|
|
40
|
+
const rendered = await withAssets(() => runPipeline(wasm, registry, image, log, {
|
|
41
|
+
mode,
|
|
42
|
+
...(options.upTo === undefined ? {} : { upTo: options.upTo }),
|
|
43
|
+
...(options.signal === undefined ? {} : { signal: options.signal }),
|
|
44
|
+
}), options.assets, (id, bytes) => wasm.assetPut(id, bytes));
|
|
45
|
+
const renderMs = now() - t1;
|
|
46
|
+
throwIfAborted(options.signal);
|
|
47
|
+
const t2 = now();
|
|
48
|
+
const coreOutput = toCoreOutput(options.output);
|
|
49
|
+
if (options.embedEditLog) {
|
|
50
|
+
coreOutput['embed'] = canonicalJson({ log, index: options.upTo ?? log.ops.length });
|
|
51
|
+
}
|
|
52
|
+
const bytes = tryCore(() => wasm.encode(rendered, JSON.stringify(coreOutput)));
|
|
53
|
+
const encodeMs = now() - t2;
|
|
54
|
+
return {
|
|
55
|
+
bytes,
|
|
56
|
+
mimeType: options.output.format,
|
|
57
|
+
width: rendered.width,
|
|
58
|
+
height: rendered.height,
|
|
59
|
+
hash: wasm.sha256Hex(bytes),
|
|
60
|
+
coreVersion: wasm.version(),
|
|
61
|
+
timings: { decode: decodeMs, render: renderMs, encode: encodeMs },
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Compiles the log and executes it: consecutive core stages become one wasm
|
|
66
|
+
* call, every external kernel runs in between on the RGBA buffer.
|
|
67
|
+
*/
|
|
68
|
+
export async function runPipeline(wasm, registry, image, log, options) {
|
|
69
|
+
const doc = compile(log, registry, options.upTo);
|
|
70
|
+
const logical = { width: log.source.width, height: log.source.height };
|
|
71
|
+
const ctx = {
|
|
72
|
+
logical,
|
|
73
|
+
actual: { width: image.width, height: image.height },
|
|
74
|
+
scale: image.width / log.source.width,
|
|
75
|
+
mode: options.mode,
|
|
76
|
+
};
|
|
77
|
+
const stages = toPipeline(doc, registry, ctx);
|
|
78
|
+
let current = image;
|
|
79
|
+
let currentLogical = logical;
|
|
80
|
+
for (const segment of segments(stages)) {
|
|
81
|
+
throwIfAborted(options.signal);
|
|
82
|
+
if (segment.kind === 'core') {
|
|
83
|
+
const plan = {
|
|
84
|
+
version: PLAN_VERSION,
|
|
85
|
+
source: currentLogical,
|
|
86
|
+
proxyScale: current.width / currentLogical.width,
|
|
87
|
+
stages: toCoreStages(segment.stages),
|
|
88
|
+
};
|
|
89
|
+
const planJson = JSON.stringify(plan);
|
|
90
|
+
const geometry = JSON.parse(tryCore(() => wasm.resolveGeometry(planJson, current.width, current.height)));
|
|
91
|
+
current = tryCore(() => wasm.renderRgba(current, planJson));
|
|
92
|
+
currentLogical = geometry.logicalOut;
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
const stage = segment.stage;
|
|
96
|
+
const kctx = {
|
|
97
|
+
logical: currentLogical,
|
|
98
|
+
actual: { width: current.width, height: current.height },
|
|
99
|
+
scale: current.width / currentLogical.width,
|
|
100
|
+
mode: options.mode,
|
|
101
|
+
asset: (id) => {
|
|
102
|
+
throw new SealpixelError('INVALID_EDIT_LOG', `asset "${id}" requested but assets are not supported yet (S3.3)`);
|
|
103
|
+
},
|
|
104
|
+
signal: options.signal ?? new AbortController().signal,
|
|
105
|
+
};
|
|
106
|
+
const out = await runExternalKernel(stage.plugin, current, stage.params, kctx);
|
|
107
|
+
if (out.width !== current.width || out.height !== current.height) {
|
|
108
|
+
currentLogical = {
|
|
109
|
+
width: Math.round(currentLogical.width * (out.width / current.width)),
|
|
110
|
+
height: Math.round(currentLogical.height * (out.height / current.height)),
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
current = out;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return current;
|
|
117
|
+
}
|
|
118
|
+
function* segments(stages) {
|
|
119
|
+
let run = [];
|
|
120
|
+
for (const stage of stages) {
|
|
121
|
+
if (stage.kind === 'core') {
|
|
122
|
+
run.push(stage);
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
if (run.length > 0) {
|
|
126
|
+
yield { kind: 'core', stages: run };
|
|
127
|
+
run = [];
|
|
128
|
+
}
|
|
129
|
+
yield { kind: 'external', stage };
|
|
130
|
+
}
|
|
131
|
+
if (run.length > 0)
|
|
132
|
+
yield { kind: 'core', stages: run };
|
|
133
|
+
}
|
|
134
|
+
/** Maps the public output options onto the Rust `OutputOptions` JSON. */
|
|
135
|
+
export function toCoreOutput(output) {
|
|
136
|
+
const core = { format: FORMAT_TO_CORE[output.format] };
|
|
137
|
+
if (output.quality !== undefined)
|
|
138
|
+
core['quality'] = output.quality;
|
|
139
|
+
if (output.progressive !== undefined)
|
|
140
|
+
core['progressive'] = output.progressive;
|
|
141
|
+
if (output.chromaSubsampling !== undefined)
|
|
142
|
+
core['chromaSubsampling'] = output.chromaSubsampling;
|
|
143
|
+
if (output.lossless !== undefined)
|
|
144
|
+
core['lossless'] = output.lossless;
|
|
145
|
+
if (output.background !== undefined)
|
|
146
|
+
core['background'] = output.background;
|
|
147
|
+
return core;
|
|
148
|
+
}
|
|
149
|
+
function tryCore(fn) {
|
|
150
|
+
try {
|
|
151
|
+
return fn();
|
|
152
|
+
}
|
|
153
|
+
catch (error) {
|
|
154
|
+
throw SealpixelError.from(error);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
function throwIfAborted(signal) {
|
|
158
|
+
if (signal?.aborted)
|
|
159
|
+
throw new SealpixelError('ABORTED', 'render aborted');
|
|
160
|
+
}
|
|
161
|
+
function now() {
|
|
162
|
+
return typeof performance === 'undefined' ? Date.now() : performance.now();
|
|
163
|
+
}
|
|
164
|
+
//# sourceMappingURL=render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../src/render.ts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AAC;AACd,CAAC;AAED,SAAS,OAAO,CAAI,EAAW;IAC7B,IAAI,CAAC;QACH,OAAO,EAAE,EAAE,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC;AACH,CAAC;AAED,SAAS,cAAc,CAAC,MAA+B;IACrD,IAAI,MAAM,EAAE,OAAO;QAAE,MAAM,IAAI,cAAc,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;AAC7E,CAAC;AAED,SAAS,GAAG;IACV,OAAO,OAAO,WAAW,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC;AAC7E,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The renderer's logic, independent of where it runs. `startSealpixelWorker`
|
|
3
|
+
* wraps it behind a message protocol; `InlineRenderer` calls it directly.
|
|
4
|
+
* It owns the decoded source, the proxy, and a per-stage preview cache.
|
|
5
|
+
*/
|
|
6
|
+
import type { RgbaBuffer, SealpixelWasm } from '@sealpixel/wasm';
|
|
7
|
+
import { type Geometry } from './plan.js';
|
|
8
|
+
import type { AnyPlugin } from './plugin.js';
|
|
9
|
+
import { type Registry } from './registry.js';
|
|
10
|
+
import type { EditLog, OutputOptions, SourceDescriptor } from './types.js';
|
|
11
|
+
export interface LoadedSource {
|
|
12
|
+
descriptor: SourceDescriptor;
|
|
13
|
+
/** Full-resolution pixels are kept only when under the megapixel limit. */
|
|
14
|
+
resident: boolean;
|
|
15
|
+
proxy: RgbaBuffer;
|
|
16
|
+
}
|
|
17
|
+
export interface RenderRequest {
|
|
18
|
+
log: EditLog;
|
|
19
|
+
/** `proxy` renders on the proxy in preview mode; `full` renders the resident source in truth mode. */
|
|
20
|
+
target: 'proxy' | 'full';
|
|
21
|
+
upTo?: number;
|
|
22
|
+
signal?: AbortSignal;
|
|
23
|
+
}
|
|
24
|
+
export interface ExportRequest {
|
|
25
|
+
log: EditLog;
|
|
26
|
+
output: OutputOptions;
|
|
27
|
+
upTo?: number;
|
|
28
|
+
embedEditLog?: boolean;
|
|
29
|
+
}
|
|
30
|
+
export interface ExportResult {
|
|
31
|
+
bytes: Uint8Array;
|
|
32
|
+
mimeType: OutputOptions['format'];
|
|
33
|
+
width: number;
|
|
34
|
+
height: number;
|
|
35
|
+
hash: string;
|
|
36
|
+
}
|
|
37
|
+
export interface RendererCoreOptions {
|
|
38
|
+
plugins: readonly AnyPlugin[];
|
|
39
|
+
/** Full-resolution pixels above this are not kept after loading. */
|
|
40
|
+
maxClientMegapixels: number;
|
|
41
|
+
/** Longest side of the preview proxy. */
|
|
42
|
+
proxyMaxSide: number;
|
|
43
|
+
/** Cached stage outputs kept for the preview pipeline. */
|
|
44
|
+
cacheEntries?: number;
|
|
45
|
+
}
|
|
46
|
+
export declare class RendererCore {
|
|
47
|
+
readonly wasm: SealpixelWasm;
|
|
48
|
+
readonly registry: Registry;
|
|
49
|
+
private readonly options;
|
|
50
|
+
private full;
|
|
51
|
+
private proxy;
|
|
52
|
+
private descriptor;
|
|
53
|
+
private readonly cache;
|
|
54
|
+
constructor(wasm: SealpixelWasm, options: RendererCoreOptions);
|
|
55
|
+
putAsset(id: string, bytes: Uint8Array): void;
|
|
56
|
+
hasAsset(id: string): boolean;
|
|
57
|
+
info(): {
|
|
58
|
+
coreVersion: string;
|
|
59
|
+
plugins: Record<string, number>;
|
|
60
|
+
};
|
|
61
|
+
/** Decodes `bytes`, derives the descriptor and proxy, and drops the full image when too large. */
|
|
62
|
+
load(bytes: Uint8Array, id: string): LoadedSource;
|
|
63
|
+
/** Decodes an encoded proxy (for example one the server produced) and uses it as the preview source. */
|
|
64
|
+
loadProxyEncoded(bytes: Uint8Array, descriptor: SourceDescriptor): LoadedSource;
|
|
65
|
+
/** Accepts pixels decoded elsewhere (native proxy strategy). Never resident. */
|
|
66
|
+
loadProxy(proxy: RgbaBuffer, descriptor: SourceDescriptor): LoadedSource;
|
|
67
|
+
hasSource(): boolean;
|
|
68
|
+
isResident(): boolean;
|
|
69
|
+
unload(): void;
|
|
70
|
+
/** Renders the log. Preview renders are split per stage and cached by prefix. */
|
|
71
|
+
render(req: RenderRequest): Promise<RgbaBuffer>;
|
|
72
|
+
export(req: ExportRequest): Promise<ExportResult>;
|
|
73
|
+
geometry(log: EditLog, target: 'proxy' | 'full', upTo?: number): Geometry;
|
|
74
|
+
private require;
|
|
75
|
+
private runStages;
|
|
76
|
+
/** Recomputes the logical size after a cached stage by asking the core for its geometry. */
|
|
77
|
+
private logicalAfter;
|
|
78
|
+
private remember;
|
|
79
|
+
/** For tests: number of cached stage outputs. */
|
|
80
|
+
cacheSize(): number;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=renderer-core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderer-core.d.ts","sourceRoot":"","sources":["../src/renderer-core.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAKjE,OAAO,EAAE,KAAK,QAAQ,EAAiC,MAAM,WAAW,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAA8B,MAAM,aAAa,CAAC;AACzE,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9D,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE3E,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,gBAAgB,CAAC;IAC7B,2EAA2E;IAC3E,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,UAAU,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,OAAO,CAAC;IACb,sGAAsG;IACtG,MAAM,EAAE,OAAO,GAAG,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AC,CAAA;KAAE;IAIhE,kGAAkG;IAClG,IAAI,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,GAAG,YAAY;IAoBjD,wGAAwG;IACxG,gBAAgB,CAAC,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,gBAAgB,GAAG,YAAY;IAI/E,gFAAgF;IAChF,SAAS,CAAC,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,gBAAgB,GAAG,YAAY;IAQxE,SAAS,IAAI,OAAO;IAIpB,UAAU,IAAI,OAAO;IAIrB,MAAM,IAAI,IAAI;IAOd,iFAAiF;IAC3E,MAAM,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAAC,UAAU,CAAC;IAwB/C,MAAM,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;IAoBvD,QAAQ,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ;IAwBzE,OAAO,CAAC,OAAO;YAKD,SAAS;IA8DvB,4FAA4F;IAC5F,OAAO,CAAC,YAAY;IA2BpB,OAAO,CAAC,QAAQ;IAWhB,iDAAiD;IACjD,SAAS,IAAI,MAAM;CAGpB"}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { canonicalJson } from './canonical-json.js';
|
|
2
|
+
import { compile, toCoreStages, toPipeline } from './compile.js';
|
|
3
|
+
import { SealpixelError } from './errors.js';
|
|
4
|
+
import { runExternalKernel } from './external-kernel.js';
|
|
5
|
+
import { PLAN_VERSION } from './plan.js';
|
|
6
|
+
import { createRegistry } from './registry.js';
|
|
7
|
+
import { toCoreOutput } from './render.js';
|
|
8
|
+
export class RendererCore {
|
|
9
|
+
wasm;
|
|
10
|
+
registry;
|
|
11
|
+
options;
|
|
12
|
+
full = null;
|
|
13
|
+
proxy = null;
|
|
14
|
+
descriptor = null;
|
|
15
|
+
cache = new Map();
|
|
16
|
+
constructor(wasm, options) {
|
|
17
|
+
this.wasm = wasm;
|
|
18
|
+
this.options = options;
|
|
19
|
+
this.registry = createRegistry(options.plugins);
|
|
20
|
+
}
|
|
21
|
+
putAsset(id, bytes) {
|
|
22
|
+
this.wasm.assetPut(id, bytes);
|
|
23
|
+
}
|
|
24
|
+
hasAsset(id) {
|
|
25
|
+
return this.wasm.assetHas(id);
|
|
26
|
+
}
|
|
27
|
+
info() {
|
|
28
|
+
return { coreVersion: this.wasm.version(), plugins: this.registry.pluginVersions() };
|
|
29
|
+
}
|
|
30
|
+
/** Decodes `bytes`, derives the descriptor and proxy, and drops the full image when too large. */
|
|
31
|
+
load(bytes, id) {
|
|
32
|
+
const decoded = this.wasm.decode(bytes);
|
|
33
|
+
const hash = this.wasm.sha256Hex(bytes);
|
|
34
|
+
const descriptor = {
|
|
35
|
+
id,
|
|
36
|
+
width: decoded.width,
|
|
37
|
+
height: decoded.height,
|
|
38
|
+
hash,
|
|
39
|
+
mimeType: decoded.mimeType,
|
|
40
|
+
};
|
|
41
|
+
const megapixels = (decoded.width * decoded.height) / 1e6;
|
|
42
|
+
const resident = megapixels <= this.options.maxClientMegapixels;
|
|
43
|
+
const proxy = this.wasm.resizeProxy(decoded, this.options.proxyMaxSide);
|
|
44
|
+
this.full = resident ? decoded : null;
|
|
45
|
+
this.proxy = proxy;
|
|
46
|
+
this.descriptor = descriptor;
|
|
47
|
+
this.cache.clear();
|
|
48
|
+
return { descriptor, resident, proxy: { ...proxy, data: new Uint8Array(proxy.data) } };
|
|
49
|
+
}
|
|
50
|
+
/** Decodes an encoded proxy (for example one the server produced) and uses it as the preview source. */
|
|
51
|
+
loadProxyEncoded(bytes, descriptor) {
|
|
52
|
+
return this.loadProxy(this.wasm.decode(bytes), descriptor);
|
|
53
|
+
}
|
|
54
|
+
/** Accepts pixels decoded elsewhere (native proxy strategy). Never resident. */
|
|
55
|
+
loadProxy(proxy, descriptor) {
|
|
56
|
+
this.full = null;
|
|
57
|
+
this.proxy = proxy;
|
|
58
|
+
this.descriptor = descriptor;
|
|
59
|
+
this.cache.clear();
|
|
60
|
+
return { descriptor, resident: false, proxy: { ...proxy, data: new Uint8Array(proxy.data) } };
|
|
61
|
+
}
|
|
62
|
+
hasSource() {
|
|
63
|
+
return this.descriptor !== null;
|
|
64
|
+
}
|
|
65
|
+
isResident() {
|
|
66
|
+
return this.full !== null;
|
|
67
|
+
}
|
|
68
|
+
unload() {
|
|
69
|
+
this.full = null;
|
|
70
|
+
this.proxy = null;
|
|
71
|
+
this.descriptor = null;
|
|
72
|
+
this.cache.clear();
|
|
73
|
+
}
|
|
74
|
+
/** Renders the log. Preview renders are split per stage and cached by prefix. */
|
|
75
|
+
async render(req) {
|
|
76
|
+
const { descriptor } = this.require();
|
|
77
|
+
const image = req.target === 'full' ? this.full : this.proxy;
|
|
78
|
+
if (!image) {
|
|
79
|
+
throw new SealpixelError('SOURCE_MISMATCH', req.target === 'full'
|
|
80
|
+
? 'full-resolution pixels are not resident; use a server render'
|
|
81
|
+
: 'no source loaded');
|
|
82
|
+
}
|
|
83
|
+
const mode = req.target === 'full' ? 'truth' : 'preview';
|
|
84
|
+
const doc = compile(req.log, this.registry, req.upTo);
|
|
85
|
+
const logical = { width: descriptor.width, height: descriptor.height };
|
|
86
|
+
const ctx = {
|
|
87
|
+
logical,
|
|
88
|
+
actual: { width: image.width, height: image.height },
|
|
89
|
+
scale: image.width / logical.width,
|
|
90
|
+
mode,
|
|
91
|
+
};
|
|
92
|
+
const stages = toPipeline(doc, this.registry, ctx);
|
|
93
|
+
return this.runStages(stages, image, logical, mode, req.signal, mode === 'preview');
|
|
94
|
+
}
|
|
95
|
+
async export(req) {
|
|
96
|
+
const rendered = await this.render({
|
|
97
|
+
log: req.log,
|
|
98
|
+
target: 'full',
|
|
99
|
+
...(req.upTo === undefined ? {} : { upTo: req.upTo }),
|
|
100
|
+
});
|
|
101
|
+
const coreOutput = toCoreOutput(req.output);
|
|
102
|
+
if (req.embedEditLog) {
|
|
103
|
+
coreOutput['embed'] = canonicalJson({ log: req.log, index: req.upTo ?? req.log.ops.length });
|
|
104
|
+
}
|
|
105
|
+
const bytes = this.wasm.encode(rendered, JSON.stringify(coreOutput));
|
|
106
|
+
return {
|
|
107
|
+
bytes,
|
|
108
|
+
mimeType: req.output.format,
|
|
109
|
+
width: rendered.width,
|
|
110
|
+
height: rendered.height,
|
|
111
|
+
hash: this.wasm.sha256Hex(bytes),
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
geometry(log, target, upTo) {
|
|
115
|
+
const { descriptor } = this.require();
|
|
116
|
+
const image = (target === 'full' ? this.full : this.proxy) ?? this.proxy;
|
|
117
|
+
if (!image)
|
|
118
|
+
throw new SealpixelError('SOURCE_MISMATCH', 'no source loaded');
|
|
119
|
+
const logical = { width: descriptor.width, height: descriptor.height };
|
|
120
|
+
const doc = compile(log, this.registry, upTo);
|
|
121
|
+
const stages = toPipeline(doc, this.registry, {
|
|
122
|
+
logical,
|
|
123
|
+
actual: { width: image.width, height: image.height },
|
|
124
|
+
scale: image.width / logical.width,
|
|
125
|
+
mode: target === 'full' ? 'truth' : 'preview',
|
|
126
|
+
});
|
|
127
|
+
const core = stages.filter((s) => s.kind === 'core');
|
|
128
|
+
const plan = {
|
|
129
|
+
version: PLAN_VERSION,
|
|
130
|
+
source: logical,
|
|
131
|
+
proxyScale: image.width / logical.width,
|
|
132
|
+
stages: toCoreStages(core),
|
|
133
|
+
};
|
|
134
|
+
return JSON.parse(this.wasm.resolveGeometry(JSON.stringify(plan), image.width, image.height));
|
|
135
|
+
}
|
|
136
|
+
require() {
|
|
137
|
+
if (!this.descriptor)
|
|
138
|
+
throw new SealpixelError('SOURCE_MISMATCH', 'no source loaded');
|
|
139
|
+
return { descriptor: this.descriptor };
|
|
140
|
+
}
|
|
141
|
+
async runStages(stages, image, logical, mode, signal, useCache) {
|
|
142
|
+
let current = image;
|
|
143
|
+
let currentLogical = logical;
|
|
144
|
+
let prefix = `${image.width}x${image.height}`;
|
|
145
|
+
for (const stage of stages) {
|
|
146
|
+
if (signal?.aborted)
|
|
147
|
+
throw new SealpixelError('ABORTED', 'render aborted');
|
|
148
|
+
prefix += `|${canonicalJson({ n: stage.name, p: stage.params })}`;
|
|
149
|
+
const cached = useCache ? this.cache.get(prefix) : undefined;
|
|
150
|
+
if (cached) {
|
|
151
|
+
current = cached;
|
|
152
|
+
currentLogical = this.logicalAfter(stage, currentLogical, current, image, logical);
|
|
153
|
+
continue;
|
|
154
|
+
}
|
|
155
|
+
if (stage.kind === 'core') {
|
|
156
|
+
const plan = {
|
|
157
|
+
version: PLAN_VERSION,
|
|
158
|
+
source: currentLogical,
|
|
159
|
+
proxyScale: current.width / currentLogical.width,
|
|
160
|
+
stages: toCoreStages([stage]),
|
|
161
|
+
};
|
|
162
|
+
const planJson = JSON.stringify(plan);
|
|
163
|
+
const geometry = JSON.parse(this.wasm.resolveGeometry(planJson, current.width, current.height));
|
|
164
|
+
current = this.wasm.renderRgba(current, planJson);
|
|
165
|
+
currentLogical = geometry.logicalOut;
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
const kctx = {
|
|
169
|
+
logical: currentLogical,
|
|
170
|
+
actual: { width: current.width, height: current.height },
|
|
171
|
+
scale: current.width / currentLogical.width,
|
|
172
|
+
mode,
|
|
173
|
+
asset: (id) => {
|
|
174
|
+
throw new SealpixelError('MISSING_ASSET', `asset "${id}" is not available to JS kernels yet`, { assetId: id });
|
|
175
|
+
},
|
|
176
|
+
signal: signal ?? new AbortController().signal,
|
|
177
|
+
};
|
|
178
|
+
const out = await runExternalKernel(stage.plugin, current, stage.params, kctx);
|
|
179
|
+
if (out.width !== current.width || out.height !== current.height) {
|
|
180
|
+
currentLogical = {
|
|
181
|
+
width: Math.round(currentLogical.width * (out.width / current.width)),
|
|
182
|
+
height: Math.round(currentLogical.height * (out.height / current.height)),
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
current = out;
|
|
186
|
+
}
|
|
187
|
+
if (useCache)
|
|
188
|
+
this.remember(prefix, current);
|
|
189
|
+
}
|
|
190
|
+
return current;
|
|
191
|
+
}
|
|
192
|
+
/** Recomputes the logical size after a cached stage by asking the core for its geometry. */
|
|
193
|
+
logicalAfter(stage, logicalIn, out, _image, _sourceLogical) {
|
|
194
|
+
if (stage.kind !== 'core') {
|
|
195
|
+
return {
|
|
196
|
+
width: Math.round(logicalIn.width * (out.width / out.width)),
|
|
197
|
+
height: logicalIn.height,
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
// The cached buffer already has the output size; the logical size is the
|
|
201
|
+
// geometry of this single stage on a buffer with the input's logical size.
|
|
202
|
+
const plan = {
|
|
203
|
+
version: PLAN_VERSION,
|
|
204
|
+
source: logicalIn,
|
|
205
|
+
proxyScale: 1,
|
|
206
|
+
stages: toCoreStages([stage]),
|
|
207
|
+
};
|
|
208
|
+
const g = JSON.parse(this.wasm.resolveGeometry(JSON.stringify(plan), logicalIn.width, logicalIn.height));
|
|
209
|
+
return g.logicalOut;
|
|
210
|
+
}
|
|
211
|
+
remember(key, value) {
|
|
212
|
+
const limit = this.options.cacheEntries ?? 6;
|
|
213
|
+
if (this.cache.has(key))
|
|
214
|
+
this.cache.delete(key);
|
|
215
|
+
this.cache.set(key, value);
|
|
216
|
+
while (this.cache.size > limit) {
|
|
217
|
+
const oldest = this.cache.keys().next().value;
|
|
218
|
+
if (oldest === undefined)
|
|
219
|
+
break;
|
|
220
|
+
this.cache.delete(oldest);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
/** For tests: number of cached stage outputs. */
|
|
224
|
+
cacheSize() {
|
|
225
|
+
return this.cache.size;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
//# sourceMappingURL=renderer-core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderer-core.js","sourceRoot":"","sources":["../src/renderer-core.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAA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asm';
|
|
2
|
+
import type { Geometry } from './plan.js';
|
|
3
|
+
import type { ExportRequest, ExportResult, LoadedSource, RenderRequest } from './renderer-core.js';
|
|
4
|
+
import type { SourceDescriptor } from './types.js';
|
|
5
|
+
/**
|
|
6
|
+
* What the session talks to. Implemented by `InlineRenderer` (same thread)
|
|
7
|
+
* and `WorkerRenderer` (message protocol to a worker running `startSealpixelWorker`).
|
|
8
|
+
*/
|
|
9
|
+
export interface Renderer {
|
|
10
|
+
init(): Promise<{
|
|
11
|
+
coreVersion: string;
|
|
12
|
+
plugins: Record<string, number>;
|
|
13
|
+
}>;
|
|
14
|
+
load(bytes: Uint8Array, id: string): Promise<LoadedSource>;
|
|
15
|
+
loadProxy(proxy: RgbaBuffer, descriptor: SourceDescriptor): Promise<LoadedSource>;
|
|
16
|
+
loadProxyEncoded(bytes: Uint8Array, descriptor: SourceDescriptor): Promise<LoadedSource>;
|
|
17
|
+
render(req: RenderRequest): Promise<RgbaBuffer>;
|
|
18
|
+
export(req: ExportRequest): Promise<ExportResult>;
|
|
19
|
+
geometry(req: {
|
|
20
|
+
log: RenderRequest['log'];
|
|
21
|
+
target: 'proxy' | 'full';
|
|
22
|
+
upTo?: number;
|
|
23
|
+
}): Promise<Geometry>;
|
|
24
|
+
unload(): Promise<void>;
|
|
25
|
+
/** Stores a verified asset for kernels that reference it by id. */
|
|
26
|
+
putAsset(id: string, bytes: Uint8Array): Promise<void>;
|
|
27
|
+
dispose(): void;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=renderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../src/renderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,YAAY,EAAE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