open-ultrahdr-wasm 0.1.1 → 0.2.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 +11 -4
- package/package.json +10 -8
- package/pkg/open_ultrahdr.d.ts +79 -458
- package/pkg/open_ultrahdr.js +11 -1086
- package/pkg/open_ultrahdr.wasm +0 -0
- package/pkg/README.md +0 -17
- package/pkg/open_ultrahdr_bg.wasm +0 -0
- package/pkg/open_ultrahdr_bg.wasm.d.ts +0 -75
- package/pkg/package.json +0 -31
package/README.md
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
# Open UltraHDR WASM
|
|
2
2
|
|
|
3
|
-
WebAssembly module for UltraHDR (ISO 21496-1) gain map
|
|
3
|
+
WebAssembly module for UltraHDR (ISO 21496-1) gain map encoding/decoding,
|
|
4
|
+
built from upstream [`google/libultrahdr`](https://github.com/google/libultrahdr)
|
|
5
|
+
via Emscripten/embind.
|
|
4
6
|
|
|
5
|
-
This is the low-level WASM package. For most use cases, use the `open-ultrahdr`
|
|
7
|
+
This is the low-level WASM package. For most use cases, use the `open-ultrahdr`
|
|
8
|
+
package instead, which provides a higher-level TypeScript API.
|
|
6
9
|
|
|
7
10
|
## Building
|
|
8
11
|
|
|
9
|
-
Requires
|
|
12
|
+
Requires Emscripten SDK (`emcc`, `emcmake`) and CMake 3.20+:
|
|
10
13
|
|
|
11
14
|
```bash
|
|
15
|
+
source /path/to/emsdk/emsdk_env.sh
|
|
12
16
|
npm run build
|
|
13
17
|
```
|
|
14
18
|
|
|
19
|
+
The build vendors libultrahdr from the `third_party/libultrahdr` submodule and
|
|
20
|
+
links Emscripten's `libjpeg` port (no `UHDR_BUILD_DEPS` path).
|
|
21
|
+
|
|
15
22
|
## License
|
|
16
23
|
|
|
17
|
-
|
|
24
|
+
Dual-licensed under `Apache-2.0 OR MIT`. See the project root [LICENSE](../LICENSE) for details.
|
package/package.json
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "open-ultrahdr-wasm",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "UltraHDR (ISO 21496-1) gain map WASM implementation",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "UltraHDR (ISO 21496-1) gain map WASM implementation, built from upstream libultrahdr via Emscripten/embind",
|
|
5
5
|
"author": "Adam Silverstein",
|
|
6
|
-
"license": "
|
|
6
|
+
"license": "Apache-2.0 OR MIT",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"ultrahdr",
|
|
9
9
|
"hdr",
|
|
10
10
|
"gain-map",
|
|
11
11
|
"iso-21496",
|
|
12
12
|
"wasm",
|
|
13
|
-
"webassembly"
|
|
13
|
+
"webassembly",
|
|
14
|
+
"libultrahdr"
|
|
14
15
|
],
|
|
15
16
|
"homepage": "https://github.com/adamsilverstein/lib-open-ultrahdr",
|
|
16
17
|
"repository": {
|
|
17
18
|
"type": "git",
|
|
18
|
-
"url": "https://github.com/adamsilverstein/lib-open-ultrahdr.git",
|
|
19
|
+
"url": "git+https://github.com/adamsilverstein/lib-open-ultrahdr.git",
|
|
19
20
|
"directory": "wasm"
|
|
20
21
|
},
|
|
21
22
|
"bugs": {
|
|
@@ -41,9 +42,10 @@
|
|
|
41
42
|
"./package.json": "./package.json"
|
|
42
43
|
},
|
|
43
44
|
"scripts": {
|
|
44
|
-
"build": "
|
|
45
|
-
"build:release": "
|
|
46
|
-
"
|
|
45
|
+
"build": "rm -rf build && emcmake cmake -S . -B build -DCMAKE_BUILD_TYPE=Release && cmake --build build -j && cp build/open_ultrahdr.js build/open_ultrahdr.wasm pkg/",
|
|
46
|
+
"build:release": "npm run build",
|
|
47
|
+
"clean": "rm -rf build pkg/open_ultrahdr.js pkg/open_ultrahdr.wasm",
|
|
48
|
+
"test": "echo 'WASM tests run via the JS package (cd ../js && npm test)'"
|
|
47
49
|
},
|
|
48
50
|
"publishConfig": {
|
|
49
51
|
"access": "public"
|
package/pkg/open_ultrahdr.d.ts
CHANGED
|
@@ -1,473 +1,94 @@
|
|
|
1
|
-
/* tslint:disable */
|
|
2
|
-
/* eslint-disable */
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Color gamut enumeration for HDR images.
|
|
6
|
-
*/
|
|
7
|
-
export enum ColorGamut {
|
|
8
|
-
/**
|
|
9
|
-
* Standard sRGB color space (BT.709 primaries)
|
|
10
|
-
*/
|
|
11
|
-
Srgb = 0,
|
|
12
|
-
/**
|
|
13
|
-
* Display P3 wide color gamut
|
|
14
|
-
*/
|
|
15
|
-
DisplayP3 = 1,
|
|
16
|
-
/**
|
|
17
|
-
* BT.2100/BT.2020 wide color gamut (HDR)
|
|
18
|
-
*/
|
|
19
|
-
Bt2100 = 2,
|
|
20
|
-
}
|
|
21
|
-
|
|
22
1
|
/**
|
|
23
|
-
*
|
|
2
|
+
* Type declarations for the Emscripten/embind-built libultrahdr WASM module.
|
|
3
|
+
*
|
|
4
|
+
* The module is produced by Emscripten with MODULARIZE=1 + EXPORT_ES6=1,
|
|
5
|
+
* exposing a default-export factory that returns a Promise resolving to the
|
|
6
|
+
* populated module. Embind populates the function and value-object surface
|
|
7
|
+
* directly on the resolved Module instance.
|
|
24
8
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
9
|
+
* Metadata at this boundary is in *log2 stops* (e.g. `hdrCapacityMax = 3.0`
|
|
10
|
+
* means 3 stops above SDR diffuse white). The embind layer converts to/from
|
|
11
|
+
* libultrahdr's linear scale internally.
|
|
27
12
|
*/
|
|
28
|
-
export class GainMapMetadata {
|
|
29
|
-
free(): void;
|
|
30
|
-
[Symbol.dispose](): void;
|
|
31
|
-
/**
|
|
32
|
-
* Creates metadata suitable for a typical SDR base with HDR gain map.
|
|
33
|
-
*/
|
|
34
|
-
static forSdrBase(hdr_capacity_max: number): GainMapMetadata;
|
|
35
|
-
/**
|
|
36
|
-
* Creates a new GainMapMetadata with default values.
|
|
37
|
-
*/
|
|
38
|
-
constructor();
|
|
39
|
-
/**
|
|
40
|
-
* Whether the base rendition is HDR (false = SDR base, true = HDR base)
|
|
41
|
-
*/
|
|
42
|
-
baseRenditionIsHdr: boolean;
|
|
43
|
-
/**
|
|
44
|
-
* Maximum gain value per channel (RGB), in log2 scale
|
|
45
|
-
*/
|
|
46
|
-
gainMapMax: Float32Array;
|
|
47
|
-
/**
|
|
48
|
-
* Minimum gain value per channel (RGB), in log2 scale
|
|
49
|
-
*/
|
|
50
|
-
gainMapMin: Float32Array;
|
|
51
|
-
/**
|
|
52
|
-
* Gamma correction per channel (RGB)
|
|
53
|
-
*/
|
|
54
|
-
gamma: Float32Array;
|
|
55
|
-
/**
|
|
56
|
-
* Maximum HDR capacity (log2 scale) for full HDR output
|
|
57
|
-
*/
|
|
58
|
-
hdrCapacityMax: number;
|
|
59
|
-
/**
|
|
60
|
-
* Minimum HDR capacity (log2 scale) where gain map starts to apply
|
|
61
|
-
*/
|
|
62
|
-
hdrCapacityMin: number;
|
|
63
|
-
/**
|
|
64
|
-
* HDR offset per channel (RGB), used for black point adjustment
|
|
65
|
-
*/
|
|
66
|
-
offsetHdr: Float32Array;
|
|
67
|
-
/**
|
|
68
|
-
* SDR offset per channel (RGB), used for black point adjustment
|
|
69
|
-
*/
|
|
70
|
-
offsetSdr: Float32Array;
|
|
71
|
-
/**
|
|
72
|
-
* Specification version (e.g., "1.0")
|
|
73
|
-
*/
|
|
74
|
-
version: string;
|
|
75
|
-
}
|
|
76
13
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
Srgb = 0,
|
|
85
|
-
/**
|
|
86
|
-
* Linear (no gamma)
|
|
87
|
-
*/
|
|
88
|
-
Linear = 1,
|
|
89
|
-
/**
|
|
90
|
-
* Perceptual Quantizer (PQ) - SMPTE ST 2084
|
|
91
|
-
*/
|
|
92
|
-
Pq = 2,
|
|
93
|
-
/**
|
|
94
|
-
* Hybrid Log-Gamma (HLG) - BT.2100
|
|
95
|
-
*/
|
|
96
|
-
Hlg = 3,
|
|
14
|
+
export interface UltraHdrEncodeOptions {
|
|
15
|
+
baseQuality: number;
|
|
16
|
+
gainMapQuality: number;
|
|
17
|
+
targetHdrCapacity: number;
|
|
18
|
+
includeIsoMetadata: boolean;
|
|
19
|
+
includeUltrahdrV1: boolean;
|
|
20
|
+
gainMapScale: number;
|
|
97
21
|
}
|
|
98
22
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Gain map height in pixels (may differ from image height)
|
|
111
|
-
*/
|
|
112
|
-
gainMapHeight: number;
|
|
113
|
-
/**
|
|
114
|
-
* Gain map width in pixels (may differ from image width)
|
|
115
|
-
*/
|
|
116
|
-
gainMapWidth: number;
|
|
117
|
-
/**
|
|
118
|
-
* The gain map as grayscale JPEG bytes
|
|
119
|
-
*/
|
|
120
|
-
gainMap: Uint8Array;
|
|
121
|
-
/**
|
|
122
|
-
* Image height in pixels
|
|
123
|
-
*/
|
|
124
|
-
height: number;
|
|
125
|
-
/**
|
|
126
|
-
* Gain map metadata
|
|
127
|
-
*/
|
|
128
|
-
metadata: GainMapMetadata;
|
|
129
|
-
/**
|
|
130
|
-
* The SDR base image as JPEG bytes
|
|
131
|
-
*/
|
|
132
|
-
sdrImage: Uint8Array;
|
|
133
|
-
/**
|
|
134
|
-
* Image width in pixels
|
|
135
|
-
*/
|
|
136
|
-
width: number;
|
|
23
|
+
export interface GainMapMetadata {
|
|
24
|
+
version: string;
|
|
25
|
+
baseRenditionIsHdr: boolean;
|
|
26
|
+
gainMapMin: number[];
|
|
27
|
+
gainMapMax: number[];
|
|
28
|
+
gamma: number[];
|
|
29
|
+
offsetSdr: number[];
|
|
30
|
+
offsetHdr: number[];
|
|
31
|
+
hdrCapacityMin: number;
|
|
32
|
+
hdrCapacityMax: number;
|
|
137
33
|
}
|
|
138
34
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
* Creates encoding options with default values.
|
|
151
|
-
*/
|
|
152
|
-
constructor();
|
|
153
|
-
/**
|
|
154
|
-
* Creates options optimized for smaller file size.
|
|
155
|
-
*/
|
|
156
|
-
static smallSize(): UltraHdrEncodeOptions;
|
|
157
|
-
/**
|
|
158
|
-
* JPEG quality for the base image (1-100)
|
|
159
|
-
*/
|
|
160
|
-
baseQuality: number;
|
|
161
|
-
/**
|
|
162
|
-
* JPEG quality for the gain map (1-100)
|
|
163
|
-
*/
|
|
164
|
-
gainMapQuality: number;
|
|
165
|
-
/**
|
|
166
|
-
* Downscale factor for the gain map (1 = same size, 2 = half, 4 = quarter)
|
|
167
|
-
*/
|
|
168
|
-
gainMapScale: number;
|
|
169
|
-
/**
|
|
170
|
-
* Whether to include ISO 21496-1 metadata
|
|
171
|
-
*/
|
|
172
|
-
includeIsoMetadata: boolean;
|
|
173
|
-
/**
|
|
174
|
-
* Whether to include UltraHDR v1 metadata for Android compatibility
|
|
175
|
-
*/
|
|
176
|
-
includeUltrahdrV1: boolean;
|
|
177
|
-
/**
|
|
178
|
-
* Target HDR capacity (typically 2.0-4.0)
|
|
179
|
-
*/
|
|
180
|
-
targetHdrCapacity: number;
|
|
35
|
+
export interface UltraHdrProbeResult {
|
|
36
|
+
isValid: boolean;
|
|
37
|
+
hasPrimaryImage: boolean;
|
|
38
|
+
hasGainMap: boolean;
|
|
39
|
+
hasMetadata: boolean;
|
|
40
|
+
width: number;
|
|
41
|
+
height: number;
|
|
42
|
+
gainMapWidth: number;
|
|
43
|
+
gainMapHeight: number;
|
|
44
|
+
hdrCapacity: number;
|
|
45
|
+
metadataVersion: string;
|
|
181
46
|
}
|
|
182
47
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
*
|
|
193
|
-
* # Returns
|
|
194
|
-
* `UltraHdrEncodeOptions` with sensible defaults:
|
|
195
|
-
* - baseQuality: 85
|
|
196
|
-
* - gainMapQuality: 75
|
|
197
|
-
* - targetHdrCapacity: 3.0
|
|
198
|
-
* - includeIsoMetadata: true
|
|
199
|
-
* - includeUltrahdrV1: true
|
|
200
|
-
* - gainMapScale: 1
|
|
201
|
-
*/
|
|
202
|
-
export function createDefaultOptions(): UltraHdrEncodeOptions;
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* Creates high quality encoding options.
|
|
206
|
-
*
|
|
207
|
-
* # Returns
|
|
208
|
-
* `UltraHdrEncodeOptions` optimized for quality:
|
|
209
|
-
* - baseQuality: 95
|
|
210
|
-
* - gainMapQuality: 85
|
|
211
|
-
* - targetHdrCapacity: 4.0
|
|
212
|
-
*/
|
|
213
|
-
export function createHighQualityOptions(): UltraHdrEncodeOptions;
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Creates small size encoding options.
|
|
217
|
-
*
|
|
218
|
-
* # Returns
|
|
219
|
-
* `UltraHdrEncodeOptions` optimized for file size:
|
|
220
|
-
* - baseQuality: 75
|
|
221
|
-
* - gainMapQuality: 65
|
|
222
|
-
* - targetHdrCapacity: 3.0
|
|
223
|
-
* - gainMapScale: 2 (half-size gain map)
|
|
224
|
-
*/
|
|
225
|
-
export function createSmallSizeOptions(): UltraHdrEncodeOptions;
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* Decodes an UltraHDR JPEG, extracting SDR base, gain map, and metadata.
|
|
229
|
-
*
|
|
230
|
-
* # Arguments
|
|
231
|
-
* * `buffer` - UltraHDR JPEG file contents as bytes
|
|
232
|
-
*
|
|
233
|
-
* # Returns
|
|
234
|
-
* A `UltraHdrDecodeResult` containing:
|
|
235
|
-
* - `sdrImage`: The SDR base image as JPEG bytes
|
|
236
|
-
* - `gainMap`: The gain map as JPEG bytes
|
|
237
|
-
* - `metadata`: Gain map metadata (version, gains, gamma, offsets, etc.)
|
|
238
|
-
* - `width`, `height`: Image dimensions
|
|
239
|
-
* - `gainMapWidth`, `gainMapHeight`: Gain map dimensions
|
|
240
|
-
*
|
|
241
|
-
* # Errors
|
|
242
|
-
* Returns an error if the buffer is not a valid UltraHDR JPEG.
|
|
243
|
-
*/
|
|
244
|
-
export function decodeUltraHdr(buffer: Uint8Array): UltraHdrDecodeResult;
|
|
245
|
-
|
|
246
|
-
/**
|
|
247
|
-
* Encodes an UltraHDR JPEG from SDR and HDR inputs.
|
|
248
|
-
*
|
|
249
|
-
* # Arguments
|
|
250
|
-
* * `sdr_buffer` - SDR JPEG image bytes
|
|
251
|
-
* * `hdr_buffer` - HDR image as linear RGB float32 array (3 values per pixel, normalized to [0,1])
|
|
252
|
-
* * `options` - Encoding options (quality, HDR capacity, etc.)
|
|
253
|
-
*
|
|
254
|
-
* # Returns
|
|
255
|
-
* The encoded UltraHDR JPEG as bytes.
|
|
256
|
-
*
|
|
257
|
-
* # Errors
|
|
258
|
-
* Returns an error if:
|
|
259
|
-
* - The SDR buffer is not a valid JPEG
|
|
260
|
-
* - The HDR buffer size doesn't match the SDR dimensions
|
|
261
|
-
* - The dimensions are invalid (e.g., odd width/height)
|
|
262
|
-
*
|
|
263
|
-
* # Example (JavaScript)
|
|
264
|
-
* ```js
|
|
265
|
-
* const options = new UltraHdrEncodeOptions();
|
|
266
|
-
* options.baseQuality = 90;
|
|
267
|
-
* options.targetHdrCapacity = 3.0;
|
|
268
|
-
*
|
|
269
|
-
* const sdrBuffer = await sdrFile.arrayBuffer();
|
|
270
|
-
* const hdrBuffer = await getHdrLinearData(); // Float32Array
|
|
271
|
-
*
|
|
272
|
-
* const ultraHdr = encodeUltraHdr(
|
|
273
|
-
* new Uint8Array(sdrBuffer),
|
|
274
|
-
* new Float32Array(hdrBuffer),
|
|
275
|
-
* options
|
|
276
|
-
* );
|
|
277
|
-
* ```
|
|
278
|
-
*/
|
|
279
|
-
export function encodeUltraHdr(sdr_buffer: Uint8Array, hdr_buffer: Float32Array, options: UltraHdrEncodeOptions): Uint8Array;
|
|
280
|
-
|
|
281
|
-
/**
|
|
282
|
-
* Estimates the HDR headroom from metadata.
|
|
283
|
-
*
|
|
284
|
-
* # Arguments
|
|
285
|
-
* * `metadata` - The gain map metadata
|
|
286
|
-
*
|
|
287
|
-
* # Returns
|
|
288
|
-
* The maximum additional stops of dynamic range above SDR.
|
|
289
|
-
*/
|
|
290
|
-
export function estimateHdrHeadroom(metadata: GainMapMetadata): number;
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* Extracts just the SDR base image from an UltraHDR JPEG.
|
|
294
|
-
*
|
|
295
|
-
* This produces a standard JPEG that can be displayed on any device,
|
|
296
|
-
* without the gain map metadata. Useful for backwards compatibility.
|
|
297
|
-
*
|
|
298
|
-
* # Arguments
|
|
299
|
-
* * `buffer` - UltraHDR JPEG file contents as bytes
|
|
300
|
-
*
|
|
301
|
-
* # Returns
|
|
302
|
-
* A standard JPEG without gain map metadata.
|
|
303
|
-
*
|
|
304
|
-
* # Errors
|
|
305
|
-
* Returns an error if the buffer is not a valid JPEG.
|
|
306
|
-
*/
|
|
307
|
-
export function extractSdrBase(buffer: Uint8Array): Uint8Array;
|
|
308
|
-
|
|
309
|
-
/**
|
|
310
|
-
* Gets gain map metadata from an UltraHDR JPEG without full decode.
|
|
311
|
-
*
|
|
312
|
-
* This is faster than `decodeUltraHdr` when you only need the metadata.
|
|
313
|
-
*
|
|
314
|
-
* # Arguments
|
|
315
|
-
* * `buffer` - UltraHDR JPEG file contents as bytes
|
|
316
|
-
*
|
|
317
|
-
* # Returns
|
|
318
|
-
* The gain map metadata.
|
|
319
|
-
*
|
|
320
|
-
* # Errors
|
|
321
|
-
* Returns an error if the buffer doesn't contain gain map metadata.
|
|
322
|
-
*/
|
|
323
|
-
export function getMetadata(buffer: Uint8Array): GainMapMetadata;
|
|
324
|
-
|
|
325
|
-
/**
|
|
326
|
-
* Initializes the WASM module.
|
|
327
|
-
*
|
|
328
|
-
* This should be called before using any other functions.
|
|
329
|
-
*/
|
|
330
|
-
export function init(): void;
|
|
331
|
-
|
|
332
|
-
/**
|
|
333
|
-
* Checks if metadata indicates a meaningful HDR image.
|
|
334
|
-
*
|
|
335
|
-
* # Arguments
|
|
336
|
-
* * `metadata` - The gain map metadata
|
|
337
|
-
*
|
|
338
|
-
* # Returns
|
|
339
|
-
* `true` if the gain map provides significant dynamic range extension
|
|
340
|
-
* (more than half a stop).
|
|
341
|
-
*/
|
|
342
|
-
export function isMeaningfulHdr(metadata: GainMapMetadata): boolean;
|
|
343
|
-
|
|
344
|
-
/**
|
|
345
|
-
* Checks if a JPEG buffer contains UltraHDR/gain map data.
|
|
346
|
-
*
|
|
347
|
-
* This is a fast check that looks for gain map metadata in the XMP
|
|
348
|
-
* or MPF segments without fully decoding the image.
|
|
349
|
-
*
|
|
350
|
-
* # Arguments
|
|
351
|
-
* * `buffer` - JPEG file contents as bytes
|
|
352
|
-
*
|
|
353
|
-
* # Returns
|
|
354
|
-
* `true` if the image contains gain map metadata, `false` otherwise
|
|
355
|
-
*
|
|
356
|
-
* # Example (JavaScript)
|
|
357
|
-
* ```js
|
|
358
|
-
* const buffer = await file.arrayBuffer();
|
|
359
|
-
* const isHdr = isUltraHdr(new Uint8Array(buffer));
|
|
360
|
-
* ```
|
|
361
|
-
*/
|
|
362
|
-
export function isUltraHdr(buffer: Uint8Array): boolean;
|
|
363
|
-
|
|
364
|
-
/**
|
|
365
|
-
* Validates gain map metadata.
|
|
366
|
-
*
|
|
367
|
-
* # Arguments
|
|
368
|
-
* * `metadata` - The metadata to validate
|
|
369
|
-
*
|
|
370
|
-
* # Returns
|
|
371
|
-
* `true` if the metadata is valid, `false` otherwise
|
|
372
|
-
*/
|
|
373
|
-
export function validateMetadata(metadata: GainMapMetadata): boolean;
|
|
48
|
+
export interface UltraHdrDecodeResult {
|
|
49
|
+
sdrImage: Uint8Array;
|
|
50
|
+
gainMap: Uint8Array;
|
|
51
|
+
metadata: GainMapMetadata;
|
|
52
|
+
width: number;
|
|
53
|
+
height: number;
|
|
54
|
+
gainMapWidth: number;
|
|
55
|
+
gainMapHeight: number;
|
|
56
|
+
}
|
|
374
57
|
|
|
375
|
-
|
|
58
|
+
/** Options accepted by the module factory. */
|
|
59
|
+
export interface OpenUltraHdrModuleOptions {
|
|
60
|
+
/**
|
|
61
|
+
* Resolve URLs for files (typically the .wasm) loaded by the module at
|
|
62
|
+
* runtime. Mirrors Emscripten's standard `locateFile` hook.
|
|
63
|
+
*/
|
|
64
|
+
locateFile?: (path: string, scriptDirectory: string) => string;
|
|
65
|
+
wasmBinary?: ArrayBuffer | Uint8Array;
|
|
66
|
+
[key: string]: unknown;
|
|
67
|
+
}
|
|
376
68
|
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
readonly __wbg_get_ultrahdrencodeoptions_baseQuality: (a: number) => number;
|
|
397
|
-
readonly __wbg_get_ultrahdrencodeoptions_gainMapQuality: (a: number) => number;
|
|
398
|
-
readonly __wbg_get_ultrahdrencodeoptions_gainMapScale: (a: number) => number;
|
|
399
|
-
readonly __wbg_get_ultrahdrencodeoptions_includeIsoMetadata: (a: number) => number;
|
|
400
|
-
readonly __wbg_get_ultrahdrencodeoptions_includeUltrahdrV1: (a: number) => number;
|
|
401
|
-
readonly __wbg_get_ultrahdrencodeoptions_targetHdrCapacity: (a: number) => number;
|
|
402
|
-
readonly __wbg_set_gainmapmetadata_baseRenditionIsHdr: (a: number, b: number) => void;
|
|
403
|
-
readonly __wbg_set_gainmapmetadata_gainMapMax: (a: number, b: number, c: number) => void;
|
|
404
|
-
readonly __wbg_set_gainmapmetadata_gainMapMin: (a: number, b: number, c: number) => void;
|
|
405
|
-
readonly __wbg_set_gainmapmetadata_gamma: (a: number, b: number, c: number) => void;
|
|
406
|
-
readonly __wbg_set_gainmapmetadata_hdrCapacityMax: (a: number, b: number) => void;
|
|
407
|
-
readonly __wbg_set_gainmapmetadata_hdrCapacityMin: (a: number, b: number) => void;
|
|
408
|
-
readonly __wbg_set_gainmapmetadata_offsetHdr: (a: number, b: number, c: number) => void;
|
|
409
|
-
readonly __wbg_set_gainmapmetadata_offsetSdr: (a: number, b: number, c: number) => void;
|
|
410
|
-
readonly __wbg_set_gainmapmetadata_version: (a: number, b: number, c: number) => void;
|
|
411
|
-
readonly __wbg_set_ultrahdrdecoderesult_gainMap: (a: number, b: number, c: number) => void;
|
|
412
|
-
readonly __wbg_set_ultrahdrdecoderesult_gainMapHeight: (a: number, b: number) => void;
|
|
413
|
-
readonly __wbg_set_ultrahdrdecoderesult_gainMapWidth: (a: number, b: number) => void;
|
|
414
|
-
readonly __wbg_set_ultrahdrdecoderesult_height: (a: number, b: number) => void;
|
|
415
|
-
readonly __wbg_set_ultrahdrdecoderesult_metadata: (a: number, b: number) => void;
|
|
416
|
-
readonly __wbg_set_ultrahdrdecoderesult_width: (a: number, b: number) => void;
|
|
417
|
-
readonly __wbg_set_ultrahdrencodeoptions_baseQuality: (a: number, b: number) => void;
|
|
418
|
-
readonly __wbg_set_ultrahdrencodeoptions_gainMapQuality: (a: number, b: number) => void;
|
|
419
|
-
readonly __wbg_set_ultrahdrencodeoptions_gainMapScale: (a: number, b: number) => void;
|
|
420
|
-
readonly __wbg_set_ultrahdrencodeoptions_includeIsoMetadata: (a: number, b: number) => void;
|
|
421
|
-
readonly __wbg_set_ultrahdrencodeoptions_includeUltrahdrV1: (a: number, b: number) => void;
|
|
422
|
-
readonly __wbg_set_ultrahdrencodeoptions_targetHdrCapacity: (a: number, b: number) => void;
|
|
423
|
-
readonly __wbg_ultrahdrdecoderesult_free: (a: number, b: number) => void;
|
|
424
|
-
readonly __wbg_ultrahdrencodeoptions_free: (a: number, b: number) => void;
|
|
425
|
-
readonly gainmapmetadata_forSdrBase: (a: number) => number;
|
|
426
|
-
readonly gainmapmetadata_new: () => number;
|
|
427
|
-
readonly ultrahdrdecoderesult_new: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
|
|
428
|
-
readonly ultrahdrencodeoptions_highQuality: () => number;
|
|
429
|
-
readonly ultrahdrencodeoptions_new: () => number;
|
|
430
|
-
readonly ultrahdrencodeoptions_smallSize: () => number;
|
|
431
|
-
readonly __wbg_set_ultrahdrdecoderesult_sdrImage: (a: number, b: number, c: number) => void;
|
|
432
|
-
readonly createDefaultMetadata: () => number;
|
|
433
|
-
readonly createDefaultOptions: () => number;
|
|
434
|
-
readonly createHighQualityOptions: () => number;
|
|
435
|
-
readonly createSmallSizeOptions: () => number;
|
|
436
|
-
readonly decodeUltraHdr: (a: number, b: number) => [number, number, number];
|
|
437
|
-
readonly encodeUltraHdr: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
438
|
-
readonly estimateHdrHeadroom: (a: number) => number;
|
|
439
|
-
readonly extractSdrBase: (a: number, b: number) => [number, number, number, number];
|
|
440
|
-
readonly getMetadata: (a: number, b: number) => [number, number, number];
|
|
441
|
-
readonly isMeaningfulHdr: (a: number) => number;
|
|
442
|
-
readonly isUltraHdr: (a: number, b: number) => number;
|
|
443
|
-
readonly validateMetadata: (a: number) => number;
|
|
444
|
-
readonly init: () => void;
|
|
445
|
-
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
446
|
-
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
447
|
-
readonly __externref_table_dealloc: (a: number) => void;
|
|
448
|
-
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
449
|
-
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
450
|
-
readonly __wbindgen_start: () => void;
|
|
69
|
+
/** Populated module instance after the factory promise resolves. */
|
|
70
|
+
export interface OpenUltraHdrModule {
|
|
71
|
+
isUltraHdr(buffer: Uint8Array): boolean;
|
|
72
|
+
probeUltraHdr(buffer: Uint8Array): UltraHdrProbeResult;
|
|
73
|
+
decodeUltraHdr(buffer: Uint8Array): UltraHdrDecodeResult;
|
|
74
|
+
encodeUltraHdr(
|
|
75
|
+
sdrBuffer: Uint8Array,
|
|
76
|
+
hdrBuffer: Float32Array,
|
|
77
|
+
options: UltraHdrEncodeOptions
|
|
78
|
+
): Uint8Array;
|
|
79
|
+
extractSdrBase(buffer: Uint8Array): Uint8Array;
|
|
80
|
+
getMetadata(buffer: Uint8Array): GainMapMetadata;
|
|
81
|
+
createDefaultOptions(): UltraHdrEncodeOptions;
|
|
82
|
+
createHighQualityOptions(): UltraHdrEncodeOptions;
|
|
83
|
+
createSmallSizeOptions(): UltraHdrEncodeOptions;
|
|
84
|
+
createDefaultMetadata(): GainMapMetadata;
|
|
85
|
+
validateMetadata(metadata: GainMapMetadata): boolean;
|
|
86
|
+
estimateHdrHeadroom(metadata: GainMapMetadata): number;
|
|
87
|
+
isMeaningfulHdr(metadata: GainMapMetadata): boolean;
|
|
451
88
|
}
|
|
452
89
|
|
|
453
|
-
|
|
90
|
+
declare const createOpenUltraHdrModule: (
|
|
91
|
+
options?: OpenUltraHdrModuleOptions
|
|
92
|
+
) => Promise<OpenUltraHdrModule>;
|
|
454
93
|
|
|
455
|
-
|
|
456
|
-
* Instantiates the given `module`, which can either be bytes or
|
|
457
|
-
* a precompiled `WebAssembly.Module`.
|
|
458
|
-
*
|
|
459
|
-
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
460
|
-
*
|
|
461
|
-
* @returns {InitOutput}
|
|
462
|
-
*/
|
|
463
|
-
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
464
|
-
|
|
465
|
-
/**
|
|
466
|
-
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
467
|
-
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
468
|
-
*
|
|
469
|
-
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
470
|
-
*
|
|
471
|
-
* @returns {Promise<InitOutput>}
|
|
472
|
-
*/
|
|
473
|
-
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|
|
94
|
+
export default createOpenUltraHdrModule;
|