open-ultrahdr-wasm 0.1.1 → 0.1.2
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/package.json +2 -2
- package/pkg/open_ultrahdr.d.ts +119 -1
- package/pkg/open_ultrahdr.js +248 -2
- package/pkg/open_ultrahdr_bg.wasm +0 -0
- package/pkg/open_ultrahdr_bg.wasm.d.ts +24 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "open-ultrahdr-wasm",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "UltraHDR (ISO 21496-1) gain map WASM implementation",
|
|
5
5
|
"author": "Adam Silverstein",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"homepage": "https://github.com/adamsilverstein/lib-open-ultrahdr",
|
|
16
16
|
"repository": {
|
|
17
17
|
"type": "git",
|
|
18
|
-
"url": "https://github.com/adamsilverstein/lib-open-ultrahdr.git",
|
|
18
|
+
"url": "git+https://github.com/adamsilverstein/lib-open-ultrahdr.git",
|
|
19
19
|
"directory": "wasm"
|
|
20
20
|
},
|
|
21
21
|
"bugs": {
|
package/pkg/open_ultrahdr.d.ts
CHANGED
|
@@ -180,6 +180,61 @@ export class UltraHdrEncodeOptions {
|
|
|
180
180
|
targetHdrCapacity: number;
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
+
/**
|
|
184
|
+
* Result of probing an image to check if it's UltraHDR.
|
|
185
|
+
*
|
|
186
|
+
* This provides detailed information about what components were found
|
|
187
|
+
* without fully decoding the image. Useful for batch processing and filtering.
|
|
188
|
+
*/
|
|
189
|
+
export class UltraHdrProbeResult {
|
|
190
|
+
free(): void;
|
|
191
|
+
[Symbol.dispose](): void;
|
|
192
|
+
/**
|
|
193
|
+
* Creates a new probe result with default (invalid) values.
|
|
194
|
+
*/
|
|
195
|
+
constructor();
|
|
196
|
+
/**
|
|
197
|
+
* Gain map height in pixels (0 if not found)
|
|
198
|
+
*/
|
|
199
|
+
gainMapHeight: number;
|
|
200
|
+
/**
|
|
201
|
+
* Gain map width in pixels (0 if not found)
|
|
202
|
+
*/
|
|
203
|
+
gainMapWidth: number;
|
|
204
|
+
/**
|
|
205
|
+
* Whether a gain map image was found
|
|
206
|
+
*/
|
|
207
|
+
hasGainMap: boolean;
|
|
208
|
+
/**
|
|
209
|
+
* Whether gain map metadata (XMP) was found
|
|
210
|
+
*/
|
|
211
|
+
hasMetadata: boolean;
|
|
212
|
+
/**
|
|
213
|
+
* Whether a primary JPEG image was found
|
|
214
|
+
*/
|
|
215
|
+
hasPrimaryImage: boolean;
|
|
216
|
+
/**
|
|
217
|
+
* HDR capacity (max additional stops of dynamic range), 0 if not found
|
|
218
|
+
*/
|
|
219
|
+
hdrCapacity: number;
|
|
220
|
+
/**
|
|
221
|
+
* Primary image height in pixels (0 if not found)
|
|
222
|
+
*/
|
|
223
|
+
height: number;
|
|
224
|
+
/**
|
|
225
|
+
* Whether the image is a valid UltraHDR image (has all required components)
|
|
226
|
+
*/
|
|
227
|
+
isValid: boolean;
|
|
228
|
+
/**
|
|
229
|
+
* Metadata version string (empty if not found)
|
|
230
|
+
*/
|
|
231
|
+
metadataVersion: string;
|
|
232
|
+
/**
|
|
233
|
+
* Primary image width in pixels (0 if not found)
|
|
234
|
+
*/
|
|
235
|
+
width: number;
|
|
236
|
+
}
|
|
237
|
+
|
|
183
238
|
/**
|
|
184
239
|
* Creates default gain map metadata.
|
|
185
240
|
*
|
|
@@ -361,6 +416,46 @@ export function isMeaningfulHdr(metadata: GainMapMetadata): boolean;
|
|
|
361
416
|
*/
|
|
362
417
|
export function isUltraHdr(buffer: Uint8Array): boolean;
|
|
363
418
|
|
|
419
|
+
/**
|
|
420
|
+
* Probes an image to check if it's UltraHDR and extracts component information.
|
|
421
|
+
*
|
|
422
|
+
* This function efficiently validates if an image is UltraHDR by checking for
|
|
423
|
+
* required components (primary image, gain map, metadata) without full decoding.
|
|
424
|
+
* Returns structured results useful for batch processing and filtering.
|
|
425
|
+
*
|
|
426
|
+
* Unlike `isUltraHdr`, this function provides detailed information about what
|
|
427
|
+
* was found, making it useful for diagnostics and filtering workflows.
|
|
428
|
+
*
|
|
429
|
+
* # Arguments
|
|
430
|
+
* * `buffer` - Image file contents as bytes
|
|
431
|
+
*
|
|
432
|
+
* # Returns
|
|
433
|
+
* `UltraHdrProbeResult` containing:
|
|
434
|
+
* - `isValid`: Whether the image is a valid UltraHDR image
|
|
435
|
+
* - `hasPrimaryImage`: Whether a primary JPEG was found
|
|
436
|
+
* - `hasGainMap`: Whether a gain map image was found
|
|
437
|
+
* - `hasMetadata`: Whether XMP metadata was found
|
|
438
|
+
* - `width`, `height`: Primary image dimensions (0 if not found)
|
|
439
|
+
* - `gainMapWidth`, `gainMapHeight`: Gain map dimensions (0 if not found)
|
|
440
|
+
* - `hdrCapacity`: HDR capacity in stops (0 if not found)
|
|
441
|
+
* - `metadataVersion`: Metadata version string (empty if not found)
|
|
442
|
+
*
|
|
443
|
+
* # Example (JavaScript)
|
|
444
|
+
* ```js
|
|
445
|
+
* const buffer = await file.arrayBuffer();
|
|
446
|
+
* const result = probeUltraHdr(new Uint8Array(buffer));
|
|
447
|
+
* if (result.isValid) {
|
|
448
|
+
* console.log('UltraHDR image:', result.width, 'x', result.height);
|
|
449
|
+
* console.log('HDR capacity:', result.hdrCapacity, 'stops');
|
|
450
|
+
* } else {
|
|
451
|
+
* if (!result.hasPrimaryImage) console.log('Not a JPEG');
|
|
452
|
+
* if (!result.hasGainMap) console.log('No gain map found');
|
|
453
|
+
* if (!result.hasMetadata) console.log('No HDR metadata');
|
|
454
|
+
* }
|
|
455
|
+
* ```
|
|
456
|
+
*/
|
|
457
|
+
export function probeUltraHdr(buffer: Uint8Array): UltraHdrProbeResult;
|
|
458
|
+
|
|
364
459
|
/**
|
|
365
460
|
* Validates gain map metadata.
|
|
366
461
|
*
|
|
@@ -399,6 +494,15 @@ export interface InitOutput {
|
|
|
399
494
|
readonly __wbg_get_ultrahdrencodeoptions_includeIsoMetadata: (a: number) => number;
|
|
400
495
|
readonly __wbg_get_ultrahdrencodeoptions_includeUltrahdrV1: (a: number) => number;
|
|
401
496
|
readonly __wbg_get_ultrahdrencodeoptions_targetHdrCapacity: (a: number) => number;
|
|
497
|
+
readonly __wbg_get_ultrahdrproberesult_gainMapHeight: (a: number) => number;
|
|
498
|
+
readonly __wbg_get_ultrahdrproberesult_gainMapWidth: (a: number) => number;
|
|
499
|
+
readonly __wbg_get_ultrahdrproberesult_hasGainMap: (a: number) => number;
|
|
500
|
+
readonly __wbg_get_ultrahdrproberesult_hasMetadata: (a: number) => number;
|
|
501
|
+
readonly __wbg_get_ultrahdrproberesult_hasPrimaryImage: (a: number) => number;
|
|
502
|
+
readonly __wbg_get_ultrahdrproberesult_hdrCapacity: (a: number) => number;
|
|
503
|
+
readonly __wbg_get_ultrahdrproberesult_height: (a: number) => number;
|
|
504
|
+
readonly __wbg_get_ultrahdrproberesult_isValid: (a: number) => number;
|
|
505
|
+
readonly __wbg_get_ultrahdrproberesult_width: (a: number) => number;
|
|
402
506
|
readonly __wbg_set_gainmapmetadata_baseRenditionIsHdr: (a: number, b: number) => void;
|
|
403
507
|
readonly __wbg_set_gainmapmetadata_gainMapMax: (a: number, b: number, c: number) => void;
|
|
404
508
|
readonly __wbg_set_gainmapmetadata_gainMapMin: (a: number, b: number, c: number) => void;
|
|
@@ -420,15 +524,28 @@ export interface InitOutput {
|
|
|
420
524
|
readonly __wbg_set_ultrahdrencodeoptions_includeIsoMetadata: (a: number, b: number) => void;
|
|
421
525
|
readonly __wbg_set_ultrahdrencodeoptions_includeUltrahdrV1: (a: number, b: number) => void;
|
|
422
526
|
readonly __wbg_set_ultrahdrencodeoptions_targetHdrCapacity: (a: number, b: number) => void;
|
|
527
|
+
readonly __wbg_set_ultrahdrproberesult_gainMapHeight: (a: number, b: number) => void;
|
|
528
|
+
readonly __wbg_set_ultrahdrproberesult_gainMapWidth: (a: number, b: number) => void;
|
|
529
|
+
readonly __wbg_set_ultrahdrproberesult_hasGainMap: (a: number, b: number) => void;
|
|
530
|
+
readonly __wbg_set_ultrahdrproberesult_hasMetadata: (a: number, b: number) => void;
|
|
531
|
+
readonly __wbg_set_ultrahdrproberesult_hasPrimaryImage: (a: number, b: number) => void;
|
|
532
|
+
readonly __wbg_set_ultrahdrproberesult_hdrCapacity: (a: number, b: number) => void;
|
|
533
|
+
readonly __wbg_set_ultrahdrproberesult_height: (a: number, b: number) => void;
|
|
534
|
+
readonly __wbg_set_ultrahdrproberesult_isValid: (a: number, b: number) => void;
|
|
535
|
+
readonly __wbg_set_ultrahdrproberesult_width: (a: number, b: number) => void;
|
|
423
536
|
readonly __wbg_ultrahdrdecoderesult_free: (a: number, b: number) => void;
|
|
424
537
|
readonly __wbg_ultrahdrencodeoptions_free: (a: number, b: number) => void;
|
|
538
|
+
readonly __wbg_ultrahdrproberesult_free: (a: number, b: number) => void;
|
|
425
539
|
readonly gainmapmetadata_forSdrBase: (a: number) => number;
|
|
426
540
|
readonly gainmapmetadata_new: () => number;
|
|
427
541
|
readonly ultrahdrdecoderesult_new: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
|
|
428
542
|
readonly ultrahdrencodeoptions_highQuality: () => number;
|
|
429
543
|
readonly ultrahdrencodeoptions_new: () => number;
|
|
430
544
|
readonly ultrahdrencodeoptions_smallSize: () => number;
|
|
545
|
+
readonly ultrahdrproberesult_new: () => number;
|
|
546
|
+
readonly __wbg_get_ultrahdrproberesult_metadataVersion: (a: number) => [number, number];
|
|
431
547
|
readonly __wbg_set_ultrahdrdecoderesult_sdrImage: (a: number, b: number, c: number) => void;
|
|
548
|
+
readonly __wbg_set_ultrahdrproberesult_metadataVersion: (a: number, b: number, c: number) => void;
|
|
432
549
|
readonly createDefaultMetadata: () => number;
|
|
433
550
|
readonly createDefaultOptions: () => number;
|
|
434
551
|
readonly createHighQualityOptions: () => number;
|
|
@@ -438,10 +555,11 @@ export interface InitOutput {
|
|
|
438
555
|
readonly estimateHdrHeadroom: (a: number) => number;
|
|
439
556
|
readonly extractSdrBase: (a: number, b: number) => [number, number, number, number];
|
|
440
557
|
readonly getMetadata: (a: number, b: number) => [number, number, number];
|
|
558
|
+
readonly init: () => void;
|
|
441
559
|
readonly isMeaningfulHdr: (a: number) => number;
|
|
442
560
|
readonly isUltraHdr: (a: number, b: number) => number;
|
|
561
|
+
readonly probeUltraHdr: (a: number, b: number) => number;
|
|
443
562
|
readonly validateMetadata: (a: number) => number;
|
|
444
|
-
readonly init: () => void;
|
|
445
563
|
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
446
564
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
447
565
|
readonly __externref_table_dealloc: (a: number) => void;
|
package/pkg/open_ultrahdr.js
CHANGED
|
@@ -379,7 +379,7 @@ export class UltraHdrDecodeResult {
|
|
|
379
379
|
set sdrImage(arg0) {
|
|
380
380
|
const ptr0 = passArray8ToWasm0(arg0, wasm.__wbindgen_malloc);
|
|
381
381
|
const len0 = WASM_VECTOR_LEN;
|
|
382
|
-
wasm.
|
|
382
|
+
wasm.__wbg_set_ultrahdrdecoderesult_sdrImage(this.__wbg_ptr, ptr0, len0);
|
|
383
383
|
}
|
|
384
384
|
/**
|
|
385
385
|
* Image width in pixels
|
|
@@ -552,6 +552,202 @@ export class UltraHdrEncodeOptions {
|
|
|
552
552
|
}
|
|
553
553
|
if (Symbol.dispose) UltraHdrEncodeOptions.prototype[Symbol.dispose] = UltraHdrEncodeOptions.prototype.free;
|
|
554
554
|
|
|
555
|
+
/**
|
|
556
|
+
* Result of probing an image to check if it's UltraHDR.
|
|
557
|
+
*
|
|
558
|
+
* This provides detailed information about what components were found
|
|
559
|
+
* without fully decoding the image. Useful for batch processing and filtering.
|
|
560
|
+
*/
|
|
561
|
+
export class UltraHdrProbeResult {
|
|
562
|
+
static __wrap(ptr) {
|
|
563
|
+
ptr = ptr >>> 0;
|
|
564
|
+
const obj = Object.create(UltraHdrProbeResult.prototype);
|
|
565
|
+
obj.__wbg_ptr = ptr;
|
|
566
|
+
UltraHdrProbeResultFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
567
|
+
return obj;
|
|
568
|
+
}
|
|
569
|
+
__destroy_into_raw() {
|
|
570
|
+
const ptr = this.__wbg_ptr;
|
|
571
|
+
this.__wbg_ptr = 0;
|
|
572
|
+
UltraHdrProbeResultFinalization.unregister(this);
|
|
573
|
+
return ptr;
|
|
574
|
+
}
|
|
575
|
+
free() {
|
|
576
|
+
const ptr = this.__destroy_into_raw();
|
|
577
|
+
wasm.__wbg_ultrahdrproberesult_free(ptr, 0);
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* Gain map height in pixels (0 if not found)
|
|
581
|
+
* @returns {number}
|
|
582
|
+
*/
|
|
583
|
+
get gainMapHeight() {
|
|
584
|
+
const ret = wasm.__wbg_get_ultrahdrproberesult_gainMapHeight(this.__wbg_ptr);
|
|
585
|
+
return ret >>> 0;
|
|
586
|
+
}
|
|
587
|
+
/**
|
|
588
|
+
* Gain map width in pixels (0 if not found)
|
|
589
|
+
* @returns {number}
|
|
590
|
+
*/
|
|
591
|
+
get gainMapWidth() {
|
|
592
|
+
const ret = wasm.__wbg_get_ultrahdrproberesult_gainMapWidth(this.__wbg_ptr);
|
|
593
|
+
return ret >>> 0;
|
|
594
|
+
}
|
|
595
|
+
/**
|
|
596
|
+
* Whether a gain map image was found
|
|
597
|
+
* @returns {boolean}
|
|
598
|
+
*/
|
|
599
|
+
get hasGainMap() {
|
|
600
|
+
const ret = wasm.__wbg_get_ultrahdrproberesult_hasGainMap(this.__wbg_ptr);
|
|
601
|
+
return ret !== 0;
|
|
602
|
+
}
|
|
603
|
+
/**
|
|
604
|
+
* Whether gain map metadata (XMP) was found
|
|
605
|
+
* @returns {boolean}
|
|
606
|
+
*/
|
|
607
|
+
get hasMetadata() {
|
|
608
|
+
const ret = wasm.__wbg_get_ultrahdrproberesult_hasMetadata(this.__wbg_ptr);
|
|
609
|
+
return ret !== 0;
|
|
610
|
+
}
|
|
611
|
+
/**
|
|
612
|
+
* Whether a primary JPEG image was found
|
|
613
|
+
* @returns {boolean}
|
|
614
|
+
*/
|
|
615
|
+
get hasPrimaryImage() {
|
|
616
|
+
const ret = wasm.__wbg_get_ultrahdrproberesult_hasPrimaryImage(this.__wbg_ptr);
|
|
617
|
+
return ret !== 0;
|
|
618
|
+
}
|
|
619
|
+
/**
|
|
620
|
+
* HDR capacity (max additional stops of dynamic range), 0 if not found
|
|
621
|
+
* @returns {number}
|
|
622
|
+
*/
|
|
623
|
+
get hdrCapacity() {
|
|
624
|
+
const ret = wasm.__wbg_get_ultrahdrproberesult_hdrCapacity(this.__wbg_ptr);
|
|
625
|
+
return ret;
|
|
626
|
+
}
|
|
627
|
+
/**
|
|
628
|
+
* Primary image height in pixels (0 if not found)
|
|
629
|
+
* @returns {number}
|
|
630
|
+
*/
|
|
631
|
+
get height() {
|
|
632
|
+
const ret = wasm.__wbg_get_ultrahdrproberesult_height(this.__wbg_ptr);
|
|
633
|
+
return ret >>> 0;
|
|
634
|
+
}
|
|
635
|
+
/**
|
|
636
|
+
* Whether the image is a valid UltraHDR image (has all required components)
|
|
637
|
+
* @returns {boolean}
|
|
638
|
+
*/
|
|
639
|
+
get isValid() {
|
|
640
|
+
const ret = wasm.__wbg_get_ultrahdrproberesult_isValid(this.__wbg_ptr);
|
|
641
|
+
return ret !== 0;
|
|
642
|
+
}
|
|
643
|
+
/**
|
|
644
|
+
* Metadata version string (empty if not found)
|
|
645
|
+
* @returns {string}
|
|
646
|
+
*/
|
|
647
|
+
get metadataVersion() {
|
|
648
|
+
let deferred1_0;
|
|
649
|
+
let deferred1_1;
|
|
650
|
+
try {
|
|
651
|
+
const ret = wasm.__wbg_get_ultrahdrproberesult_metadataVersion(this.__wbg_ptr);
|
|
652
|
+
deferred1_0 = ret[0];
|
|
653
|
+
deferred1_1 = ret[1];
|
|
654
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
655
|
+
} finally {
|
|
656
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
/**
|
|
660
|
+
* Primary image width in pixels (0 if not found)
|
|
661
|
+
* @returns {number}
|
|
662
|
+
*/
|
|
663
|
+
get width() {
|
|
664
|
+
const ret = wasm.__wbg_get_ultrahdrproberesult_width(this.__wbg_ptr);
|
|
665
|
+
return ret >>> 0;
|
|
666
|
+
}
|
|
667
|
+
/**
|
|
668
|
+
* Gain map height in pixels (0 if not found)
|
|
669
|
+
* @param {number} arg0
|
|
670
|
+
*/
|
|
671
|
+
set gainMapHeight(arg0) {
|
|
672
|
+
wasm.__wbg_set_ultrahdrproberesult_gainMapHeight(this.__wbg_ptr, arg0);
|
|
673
|
+
}
|
|
674
|
+
/**
|
|
675
|
+
* Gain map width in pixels (0 if not found)
|
|
676
|
+
* @param {number} arg0
|
|
677
|
+
*/
|
|
678
|
+
set gainMapWidth(arg0) {
|
|
679
|
+
wasm.__wbg_set_ultrahdrproberesult_gainMapWidth(this.__wbg_ptr, arg0);
|
|
680
|
+
}
|
|
681
|
+
/**
|
|
682
|
+
* Whether a gain map image was found
|
|
683
|
+
* @param {boolean} arg0
|
|
684
|
+
*/
|
|
685
|
+
set hasGainMap(arg0) {
|
|
686
|
+
wasm.__wbg_set_ultrahdrproberesult_hasGainMap(this.__wbg_ptr, arg0);
|
|
687
|
+
}
|
|
688
|
+
/**
|
|
689
|
+
* Whether gain map metadata (XMP) was found
|
|
690
|
+
* @param {boolean} arg0
|
|
691
|
+
*/
|
|
692
|
+
set hasMetadata(arg0) {
|
|
693
|
+
wasm.__wbg_set_ultrahdrproberesult_hasMetadata(this.__wbg_ptr, arg0);
|
|
694
|
+
}
|
|
695
|
+
/**
|
|
696
|
+
* Whether a primary JPEG image was found
|
|
697
|
+
* @param {boolean} arg0
|
|
698
|
+
*/
|
|
699
|
+
set hasPrimaryImage(arg0) {
|
|
700
|
+
wasm.__wbg_set_ultrahdrproberesult_hasPrimaryImage(this.__wbg_ptr, arg0);
|
|
701
|
+
}
|
|
702
|
+
/**
|
|
703
|
+
* HDR capacity (max additional stops of dynamic range), 0 if not found
|
|
704
|
+
* @param {number} arg0
|
|
705
|
+
*/
|
|
706
|
+
set hdrCapacity(arg0) {
|
|
707
|
+
wasm.__wbg_set_ultrahdrproberesult_hdrCapacity(this.__wbg_ptr, arg0);
|
|
708
|
+
}
|
|
709
|
+
/**
|
|
710
|
+
* Primary image height in pixels (0 if not found)
|
|
711
|
+
* @param {number} arg0
|
|
712
|
+
*/
|
|
713
|
+
set height(arg0) {
|
|
714
|
+
wasm.__wbg_set_ultrahdrproberesult_height(this.__wbg_ptr, arg0);
|
|
715
|
+
}
|
|
716
|
+
/**
|
|
717
|
+
* Whether the image is a valid UltraHDR image (has all required components)
|
|
718
|
+
* @param {boolean} arg0
|
|
719
|
+
*/
|
|
720
|
+
set isValid(arg0) {
|
|
721
|
+
wasm.__wbg_set_ultrahdrproberesult_isValid(this.__wbg_ptr, arg0);
|
|
722
|
+
}
|
|
723
|
+
/**
|
|
724
|
+
* Metadata version string (empty if not found)
|
|
725
|
+
* @param {string} arg0
|
|
726
|
+
*/
|
|
727
|
+
set metadataVersion(arg0) {
|
|
728
|
+
const ptr0 = passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
729
|
+
const len0 = WASM_VECTOR_LEN;
|
|
730
|
+
wasm.__wbg_set_ultrahdrproberesult_metadataVersion(this.__wbg_ptr, ptr0, len0);
|
|
731
|
+
}
|
|
732
|
+
/**
|
|
733
|
+
* Primary image width in pixels (0 if not found)
|
|
734
|
+
* @param {number} arg0
|
|
735
|
+
*/
|
|
736
|
+
set width(arg0) {
|
|
737
|
+
wasm.__wbg_set_ultrahdrproberesult_width(this.__wbg_ptr, arg0);
|
|
738
|
+
}
|
|
739
|
+
/**
|
|
740
|
+
* Creates a new probe result with default (invalid) values.
|
|
741
|
+
*/
|
|
742
|
+
constructor() {
|
|
743
|
+
const ret = wasm.ultrahdrproberesult_new();
|
|
744
|
+
this.__wbg_ptr = ret >>> 0;
|
|
745
|
+
UltraHdrProbeResultFinalization.register(this, this.__wbg_ptr, this);
|
|
746
|
+
return this;
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
if (Symbol.dispose) UltraHdrProbeResult.prototype[Symbol.dispose] = UltraHdrProbeResult.prototype.free;
|
|
750
|
+
|
|
555
751
|
/**
|
|
556
752
|
* Creates default gain map metadata.
|
|
557
753
|
*
|
|
@@ -819,6 +1015,53 @@ export function isUltraHdr(buffer) {
|
|
|
819
1015
|
return ret !== 0;
|
|
820
1016
|
}
|
|
821
1017
|
|
|
1018
|
+
/**
|
|
1019
|
+
* Probes an image to check if it's UltraHDR and extracts component information.
|
|
1020
|
+
*
|
|
1021
|
+
* This function efficiently validates if an image is UltraHDR by checking for
|
|
1022
|
+
* required components (primary image, gain map, metadata) without full decoding.
|
|
1023
|
+
* Returns structured results useful for batch processing and filtering.
|
|
1024
|
+
*
|
|
1025
|
+
* Unlike `isUltraHdr`, this function provides detailed information about what
|
|
1026
|
+
* was found, making it useful for diagnostics and filtering workflows.
|
|
1027
|
+
*
|
|
1028
|
+
* # Arguments
|
|
1029
|
+
* * `buffer` - Image file contents as bytes
|
|
1030
|
+
*
|
|
1031
|
+
* # Returns
|
|
1032
|
+
* `UltraHdrProbeResult` containing:
|
|
1033
|
+
* - `isValid`: Whether the image is a valid UltraHDR image
|
|
1034
|
+
* - `hasPrimaryImage`: Whether a primary JPEG was found
|
|
1035
|
+
* - `hasGainMap`: Whether a gain map image was found
|
|
1036
|
+
* - `hasMetadata`: Whether XMP metadata was found
|
|
1037
|
+
* - `width`, `height`: Primary image dimensions (0 if not found)
|
|
1038
|
+
* - `gainMapWidth`, `gainMapHeight`: Gain map dimensions (0 if not found)
|
|
1039
|
+
* - `hdrCapacity`: HDR capacity in stops (0 if not found)
|
|
1040
|
+
* - `metadataVersion`: Metadata version string (empty if not found)
|
|
1041
|
+
*
|
|
1042
|
+
* # Example (JavaScript)
|
|
1043
|
+
* ```js
|
|
1044
|
+
* const buffer = await file.arrayBuffer();
|
|
1045
|
+
* const result = probeUltraHdr(new Uint8Array(buffer));
|
|
1046
|
+
* if (result.isValid) {
|
|
1047
|
+
* console.log('UltraHDR image:', result.width, 'x', result.height);
|
|
1048
|
+
* console.log('HDR capacity:', result.hdrCapacity, 'stops');
|
|
1049
|
+
* } else {
|
|
1050
|
+
* if (!result.hasPrimaryImage) console.log('Not a JPEG');
|
|
1051
|
+
* if (!result.hasGainMap) console.log('No gain map found');
|
|
1052
|
+
* if (!result.hasMetadata) console.log('No HDR metadata');
|
|
1053
|
+
* }
|
|
1054
|
+
* ```
|
|
1055
|
+
* @param {Uint8Array} buffer
|
|
1056
|
+
* @returns {UltraHdrProbeResult}
|
|
1057
|
+
*/
|
|
1058
|
+
export function probeUltraHdr(buffer) {
|
|
1059
|
+
const ptr0 = passArray8ToWasm0(buffer, wasm.__wbindgen_malloc);
|
|
1060
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1061
|
+
const ret = wasm.probeUltraHdr(ptr0, len0);
|
|
1062
|
+
return UltraHdrProbeResult.__wrap(ret);
|
|
1063
|
+
}
|
|
1064
|
+
|
|
822
1065
|
/**
|
|
823
1066
|
* Validates gain map metadata.
|
|
824
1067
|
*
|
|
@@ -839,7 +1082,7 @@ export function validateMetadata(metadata) {
|
|
|
839
1082
|
function __wbg_get_imports() {
|
|
840
1083
|
const import0 = {
|
|
841
1084
|
__proto__: null,
|
|
842
|
-
|
|
1085
|
+
__wbg___wbindgen_throw_6ddd609b62940d55: function(arg0, arg1) {
|
|
843
1086
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
844
1087
|
},
|
|
845
1088
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
@@ -872,6 +1115,9 @@ const UltraHdrDecodeResultFinalization = (typeof FinalizationRegistry === 'undef
|
|
|
872
1115
|
const UltraHdrEncodeOptionsFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
873
1116
|
? { register: () => {}, unregister: () => {} }
|
|
874
1117
|
: new FinalizationRegistry(ptr => wasm.__wbg_ultrahdrencodeoptions_free(ptr >>> 0, 1));
|
|
1118
|
+
const UltraHdrProbeResultFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1119
|
+
? { register: () => {}, unregister: () => {} }
|
|
1120
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_ultrahdrproberesult_free(ptr >>> 0, 1));
|
|
875
1121
|
|
|
876
1122
|
function _assertClass(instance, klass) {
|
|
877
1123
|
if (!(instance instanceof klass)) {
|
|
Binary file
|
|
@@ -24,6 +24,15 @@ export const __wbg_get_ultrahdrencodeoptions_gainMapScale: (a: number) => number
|
|
|
24
24
|
export const __wbg_get_ultrahdrencodeoptions_includeIsoMetadata: (a: number) => number;
|
|
25
25
|
export const __wbg_get_ultrahdrencodeoptions_includeUltrahdrV1: (a: number) => number;
|
|
26
26
|
export const __wbg_get_ultrahdrencodeoptions_targetHdrCapacity: (a: number) => number;
|
|
27
|
+
export const __wbg_get_ultrahdrproberesult_gainMapHeight: (a: number) => number;
|
|
28
|
+
export const __wbg_get_ultrahdrproberesult_gainMapWidth: (a: number) => number;
|
|
29
|
+
export const __wbg_get_ultrahdrproberesult_hasGainMap: (a: number) => number;
|
|
30
|
+
export const __wbg_get_ultrahdrproberesult_hasMetadata: (a: number) => number;
|
|
31
|
+
export const __wbg_get_ultrahdrproberesult_hasPrimaryImage: (a: number) => number;
|
|
32
|
+
export const __wbg_get_ultrahdrproberesult_hdrCapacity: (a: number) => number;
|
|
33
|
+
export const __wbg_get_ultrahdrproberesult_height: (a: number) => number;
|
|
34
|
+
export const __wbg_get_ultrahdrproberesult_isValid: (a: number) => number;
|
|
35
|
+
export const __wbg_get_ultrahdrproberesult_width: (a: number) => number;
|
|
27
36
|
export const __wbg_set_gainmapmetadata_baseRenditionIsHdr: (a: number, b: number) => void;
|
|
28
37
|
export const __wbg_set_gainmapmetadata_gainMapMax: (a: number, b: number, c: number) => void;
|
|
29
38
|
export const __wbg_set_gainmapmetadata_gainMapMin: (a: number, b: number, c: number) => void;
|
|
@@ -45,15 +54,28 @@ export const __wbg_set_ultrahdrencodeoptions_gainMapScale: (a: number, b: number
|
|
|
45
54
|
export const __wbg_set_ultrahdrencodeoptions_includeIsoMetadata: (a: number, b: number) => void;
|
|
46
55
|
export const __wbg_set_ultrahdrencodeoptions_includeUltrahdrV1: (a: number, b: number) => void;
|
|
47
56
|
export const __wbg_set_ultrahdrencodeoptions_targetHdrCapacity: (a: number, b: number) => void;
|
|
57
|
+
export const __wbg_set_ultrahdrproberesult_gainMapHeight: (a: number, b: number) => void;
|
|
58
|
+
export const __wbg_set_ultrahdrproberesult_gainMapWidth: (a: number, b: number) => void;
|
|
59
|
+
export const __wbg_set_ultrahdrproberesult_hasGainMap: (a: number, b: number) => void;
|
|
60
|
+
export const __wbg_set_ultrahdrproberesult_hasMetadata: (a: number, b: number) => void;
|
|
61
|
+
export const __wbg_set_ultrahdrproberesult_hasPrimaryImage: (a: number, b: number) => void;
|
|
62
|
+
export const __wbg_set_ultrahdrproberesult_hdrCapacity: (a: number, b: number) => void;
|
|
63
|
+
export const __wbg_set_ultrahdrproberesult_height: (a: number, b: number) => void;
|
|
64
|
+
export const __wbg_set_ultrahdrproberesult_isValid: (a: number, b: number) => void;
|
|
65
|
+
export const __wbg_set_ultrahdrproberesult_width: (a: number, b: number) => void;
|
|
48
66
|
export const __wbg_ultrahdrdecoderesult_free: (a: number, b: number) => void;
|
|
49
67
|
export const __wbg_ultrahdrencodeoptions_free: (a: number, b: number) => void;
|
|
68
|
+
export const __wbg_ultrahdrproberesult_free: (a: number, b: number) => void;
|
|
50
69
|
export const gainmapmetadata_forSdrBase: (a: number) => number;
|
|
51
70
|
export const gainmapmetadata_new: () => number;
|
|
52
71
|
export const ultrahdrdecoderesult_new: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
|
|
53
72
|
export const ultrahdrencodeoptions_highQuality: () => number;
|
|
54
73
|
export const ultrahdrencodeoptions_new: () => number;
|
|
55
74
|
export const ultrahdrencodeoptions_smallSize: () => number;
|
|
75
|
+
export const ultrahdrproberesult_new: () => number;
|
|
76
|
+
export const __wbg_get_ultrahdrproberesult_metadataVersion: (a: number) => [number, number];
|
|
56
77
|
export const __wbg_set_ultrahdrdecoderesult_sdrImage: (a: number, b: number, c: number) => void;
|
|
78
|
+
export const __wbg_set_ultrahdrproberesult_metadataVersion: (a: number, b: number, c: number) => void;
|
|
57
79
|
export const createDefaultMetadata: () => number;
|
|
58
80
|
export const createDefaultOptions: () => number;
|
|
59
81
|
export const createHighQualityOptions: () => number;
|
|
@@ -63,10 +85,11 @@ export const encodeUltraHdr: (a: number, b: number, c: number, d: number, e: num
|
|
|
63
85
|
export const estimateHdrHeadroom: (a: number) => number;
|
|
64
86
|
export const extractSdrBase: (a: number, b: number) => [number, number, number, number];
|
|
65
87
|
export const getMetadata: (a: number, b: number) => [number, number, number];
|
|
88
|
+
export const init: () => void;
|
|
66
89
|
export const isMeaningfulHdr: (a: number) => number;
|
|
67
90
|
export const isUltraHdr: (a: number, b: number) => number;
|
|
91
|
+
export const probeUltraHdr: (a: number, b: number) => number;
|
|
68
92
|
export const validateMetadata: (a: number) => number;
|
|
69
|
-
export const init: () => void;
|
|
70
93
|
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
71
94
|
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
72
95
|
export const __externref_table_dealloc: (a: number) => void;
|