@monogrid/gainmap-js 3.2.0 → 3.3.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/CHANGELOG.md +7 -0
- package/README.md +8 -55
- package/dist/{Loader-BZcKUVaX.js → Loader-CsjVTcg5.js} +1 -1
- package/dist/Loader-D4XqFES7.js +5 -0
- package/dist/{QuadRenderer-Y5tm-R3m.js → QuadRenderer-BqJ2Q8P5.js} +1 -1
- package/dist/QuadRenderer-De5PMMtY.js +5 -0
- package/dist/{_commonjsHelpers-CuGYGi_5.js → _commonjsHelpers-C2Rq7Bzs.js} +1 -1
- package/dist/_commonjsHelpers-FnzxO7yL.js +5 -0
- package/dist/compress-HAw5HoXG.js +5 -0
- package/dist/{compress-BaKKOAXI.js → compress-bMJEJ5JM.js} +3 -1
- package/dist/core/types.d.ts +5 -0
- package/dist/decode.js +4 -4
- package/dist/decode.min.js +5 -0
- package/dist/decode.umd.cjs +1 -1
- package/dist/decode.umd.min.cjs +5 -0
- package/dist/decode.webgpu.js +3 -3
- package/dist/decode.webgpu.min.js +5 -0
- package/dist/decode.webgpu.umd.cjs +1 -1
- package/dist/decode.webgpu.umd.min.cjs +5 -0
- package/dist/encode/encode-and-compress.d.ts +1 -1
- package/dist/encode/types.d.ts +2 -2
- package/dist/encode.js +4 -4
- package/dist/encode.min.js +5 -0
- package/dist/encode.umd.cjs +4 -2
- package/dist/encode.umd.min.cjs +5 -0
- package/dist/libultrahdr/encode-jpeg-metadata.d.ts +5 -5
- package/dist/libultrahdr/jpeg-assembler.d.ts +41 -0
- package/dist/libultrahdr/jpeg-markers.d.ts +47 -0
- package/dist/libultrahdr/mpf-generator.d.ts +20 -0
- package/dist/libultrahdr/xmp-generator.d.ts +33 -0
- package/dist/libultrahdr.d.ts +0 -3
- package/dist/libultrahdr.js +546 -6584
- package/dist/libultrahdr.min.js +5 -0
- package/dist/libultrahdr.umd.cjs +632 -6673
- package/dist/libultrahdr.umd.min.cjs +5 -0
- package/dist/third-party.txt +301 -0
- package/dist/worker-interface.js +2 -2
- package/dist/worker-interface.min.js +5 -0
- package/dist/worker-interface.umd.cjs +1 -1
- package/dist/worker-interface.umd.min.cjs +5 -0
- package/dist/worker.js +3 -3
- package/dist/worker.min.js +5 -0
- package/dist/worker.umd.cjs +3 -1
- package/dist/worker.umd.min.cjs +5 -0
- package/package.json +2 -2
- package/dist/libultrahdr/decode-jpeg-metadata.d.ts +0 -28
- package/dist/libultrahdr/library.d.ts +0 -9
- package/dist/libultrahdr-esm.wasm +0 -0
- package/libultrahdr-wasm/build/libultrahdr-debug.js +0 -7156
- package/libultrahdr-wasm/build/libultrahdr-debug.wasm +0 -0
- package/libultrahdr-wasm/build/libultrahdr-esm.js +0 -6633
- package/libultrahdr-wasm/build/libultrahdr-esm.wasm +0 -0
- package/libultrahdr-wasm/build/libultrahdr.d.ts +0 -30
- package/libultrahdr-wasm/build/libultrahdr.js +0 -6591
- package/libultrahdr-wasm/build/libultrahdr.wasm +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GainMapMetadata } from '../core/types';
|
|
2
2
|
import { type CompressedImage } from '../encode/types';
|
|
3
3
|
/**
|
|
4
4
|
* Encapsulates a Gainmap into a single JPEG file (aka: JPEG-R) with the base map
|
|
@@ -63,7 +63,7 @@ import { type CompressedImage } from '../encode/types';
|
|
|
63
63
|
*
|
|
64
64
|
* // embed the compressed images + metadata into a single
|
|
65
65
|
* // JPEG file
|
|
66
|
-
* const jpeg =
|
|
66
|
+
* const jpeg = encodeJPEGMetadata({
|
|
67
67
|
* ...encodingResult,
|
|
68
68
|
* ...metadata,
|
|
69
69
|
* sdr,
|
|
@@ -73,12 +73,12 @@ import { type CompressedImage } from '../encode/types';
|
|
|
73
73
|
* // `jpeg` will be an `Uint8Array` which can be saved somewhere
|
|
74
74
|
*
|
|
75
75
|
*
|
|
76
|
-
* @param encodingResult
|
|
77
|
-
* @returns
|
|
76
|
+
* @param encodingResult - Encoding result containing SDR image, gain map image, and metadata
|
|
77
|
+
* @returns A Uint8Array representing a JPEG-R file
|
|
78
78
|
* @throws {Error} If `encodingResult.sdr.mimeType !== 'image/jpeg'`
|
|
79
79
|
* @throws {Error} If `encodingResult.gainMap.mimeType !== 'image/jpeg'`
|
|
80
80
|
*/
|
|
81
81
|
export declare const encodeJPEGMetadata: (encodingResult: GainMapMetadata & {
|
|
82
82
|
sdr: CompressedImage;
|
|
83
83
|
gainMap: CompressedImage;
|
|
84
|
-
}) =>
|
|
84
|
+
}) => Uint8Array<ArrayBuffer>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JPEG assembler for creating JPEG-R (JPEG with gain map) files
|
|
3
|
+
* Based on libultrahdr jpegr.cpp implementation
|
|
4
|
+
*/
|
|
5
|
+
import { GainMapMetadataExtended } from '../core/types';
|
|
6
|
+
import { type CompressedImage } from '../encode/types';
|
|
7
|
+
/**
|
|
8
|
+
* Options for assembling a JPEG with gain map
|
|
9
|
+
*/
|
|
10
|
+
export interface AssembleJpegOptions {
|
|
11
|
+
/** Primary (SDR) JPEG image */
|
|
12
|
+
sdr: CompressedImage;
|
|
13
|
+
/** Gain map JPEG image */
|
|
14
|
+
gainMap: CompressedImage;
|
|
15
|
+
/** Gain map metadata */
|
|
16
|
+
metadata: GainMapMetadataExtended;
|
|
17
|
+
/** Optional EXIF data to embed */
|
|
18
|
+
exif?: Uint8Array<ArrayBuffer>;
|
|
19
|
+
/** Optional ICC color profile */
|
|
20
|
+
icc?: Uint8Array<ArrayBuffer>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Assemble a JPEG-R file (JPEG with embedded gain map)
|
|
24
|
+
*
|
|
25
|
+
* The structure is:
|
|
26
|
+
* 1. Primary image:
|
|
27
|
+
* - SOI
|
|
28
|
+
* - APP1 (EXIF if present)
|
|
29
|
+
* - APP1 (XMP with gain map metadata)
|
|
30
|
+
* - APP2 (ICC profile if present)
|
|
31
|
+
* - APP2 (MPF data)
|
|
32
|
+
* - Rest of primary JPEG data
|
|
33
|
+
* 2. Secondary image (gain map):
|
|
34
|
+
* - SOI
|
|
35
|
+
* - APP1 (XMP with gain map parameters)
|
|
36
|
+
* - Rest of gain map JPEG data
|
|
37
|
+
*
|
|
38
|
+
* @param options - Assembly options
|
|
39
|
+
* @returns Complete JPEG-R file as Uint8Array
|
|
40
|
+
*/
|
|
41
|
+
export declare function assembleJpegWithGainMap(options: AssembleJpegOptions): Uint8Array<ArrayBuffer>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JPEG marker constants
|
|
3
|
+
* Based on JPEG specification and libultrahdr implementation
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* JPEG marker prefix - all markers start with this byte
|
|
7
|
+
*/
|
|
8
|
+
export declare const MARKER_PREFIX = 255;
|
|
9
|
+
/**
|
|
10
|
+
* JPEG markers
|
|
11
|
+
*/
|
|
12
|
+
export declare const MARKERS: {
|
|
13
|
+
/** Start of Image */
|
|
14
|
+
readonly SOI: 216;
|
|
15
|
+
/** End of Image */
|
|
16
|
+
readonly EOI: 217;
|
|
17
|
+
/** Application segment 0 */
|
|
18
|
+
readonly APP0: 224;
|
|
19
|
+
/** Application segment 1 (EXIF/XMP) */
|
|
20
|
+
readonly APP1: 225;
|
|
21
|
+
/** Application segment 2 (ICC/MPF) */
|
|
22
|
+
readonly APP2: 226;
|
|
23
|
+
/** Start of Scan */
|
|
24
|
+
readonly SOS: 218;
|
|
25
|
+
/** Define Quantization Table */
|
|
26
|
+
readonly DQT: 219;
|
|
27
|
+
/** Define Huffman Table */
|
|
28
|
+
readonly DHT: 196;
|
|
29
|
+
/** Start of Frame (baseline DCT) */
|
|
30
|
+
readonly SOF0: 192;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* XMP namespace identifier for APP1 marker
|
|
34
|
+
*/
|
|
35
|
+
export declare const XMP_NAMESPACE = "http://ns.adobe.com/xap/1.0/\0";
|
|
36
|
+
/**
|
|
37
|
+
* EXIF identifier for APP1 marker
|
|
38
|
+
*/
|
|
39
|
+
export declare const EXIF_IDENTIFIER = "Exif\0\0";
|
|
40
|
+
/**
|
|
41
|
+
* MPF signature for APP2 marker
|
|
42
|
+
*/
|
|
43
|
+
export declare const MPF_SIGNATURE = "MPF\0";
|
|
44
|
+
/**
|
|
45
|
+
* ICC profile identifier for APP2 marker
|
|
46
|
+
*/
|
|
47
|
+
export declare const ICC_IDENTIFIER = "ICC_PROFILE\0";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Multi-Picture Format (MPF) generator
|
|
3
|
+
* Based on CIPA DC-007 specification and libultrahdr multipictureformat.cpp
|
|
4
|
+
*
|
|
5
|
+
* MPF is used to embed multiple images in a single JPEG file
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Calculate the total size of the MPF structure
|
|
9
|
+
*/
|
|
10
|
+
export declare function calculateMpfSize(): number;
|
|
11
|
+
/**
|
|
12
|
+
* Generate MPF (Multi-Picture Format) data structure
|
|
13
|
+
*
|
|
14
|
+
* @param primaryImageSize - Size of the primary image in bytes
|
|
15
|
+
* @param primaryImageOffset - Offset of the primary image (typically 0 for FII - First Individual Image)
|
|
16
|
+
* @param secondaryImageSize - Size of the secondary (gain map) image in bytes
|
|
17
|
+
* @param secondaryImageOffset - Offset of the secondary image from the MP Endian field
|
|
18
|
+
* @returns Uint8Array containing the MPF data
|
|
19
|
+
*/
|
|
20
|
+
export declare function generateMpf(primaryImageSize: number, primaryImageOffset: number, secondaryImageSize: number, secondaryImageOffset: number): Uint8Array<ArrayBuffer>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* XMP metadata generator for gain map images
|
|
3
|
+
* Based on libultrahdr jpegrutils.cpp implementation
|
|
4
|
+
*/
|
|
5
|
+
import { type GainMapMetadataExtended } from '../core/types';
|
|
6
|
+
/**
|
|
7
|
+
* Generate XMP metadata for the primary image
|
|
8
|
+
*
|
|
9
|
+
* This XMP contains:
|
|
10
|
+
* - Container directory with references to primary and gain map images
|
|
11
|
+
* - Gain map version
|
|
12
|
+
* - Item metadata for both images
|
|
13
|
+
*
|
|
14
|
+
* @param secondaryImageLength - Length of the secondary (gain map) JPEG in bytes
|
|
15
|
+
* @param metadata - Gain map metadata
|
|
16
|
+
* @returns XMP packet as string
|
|
17
|
+
*/
|
|
18
|
+
export declare function generateXmpForPrimaryImage(secondaryImageLength: number, metadata: GainMapMetadataExtended): string;
|
|
19
|
+
/**
|
|
20
|
+
* Generate XMP metadata for the secondary (gain map) image
|
|
21
|
+
*
|
|
22
|
+
* This XMP contains all the gain map parameters:
|
|
23
|
+
* - Version
|
|
24
|
+
* - Gain map min/max
|
|
25
|
+
* - Gamma
|
|
26
|
+
* - Offset SDR/HDR
|
|
27
|
+
* - HDR capacity min/max
|
|
28
|
+
* - Base rendition flag
|
|
29
|
+
*
|
|
30
|
+
* @param metadata - Gain map metadata
|
|
31
|
+
* @returns XMP packet as string
|
|
32
|
+
*/
|
|
33
|
+
export declare function generateXmpForSecondaryImage(metadata: GainMapMetadataExtended): string;
|
package/dist/libultrahdr.d.ts
CHANGED