@monogrid/gainmap-js 3.0.1 → 3.0.3
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 +14 -0
- package/CODE_OF_CONDUCT.md +1 -1
- package/CONTRIBUTING.md +1 -1
- package/README.md +7 -1
- package/dist/{QuadRenderer-pEe6Kzcn.js → QuadRenderer-vDmOC3x_.js} +4 -4
- package/dist/{_commonjsHelpers-Gkwpb-h5.js → _commonjsHelpers-QOuTPcZm.js} +2 -2
- package/dist/{compress-6L6-d1aM.js → compress-FEb3eYc4.js} +20 -11
- package/dist/core/QuadRenderer.d.ts +2 -2
- package/dist/decode/utils/MPFExtractor.d.ts +1 -2
- package/dist/decode.js +16 -4
- package/dist/decode.umd.js +17 -5
- package/dist/encode.js +15 -7
- package/dist/encode.umd.js +33 -16
- package/dist/libultrahdr/decode-jpeg-metadata.d.ts +1 -1
- package/dist/libultrahdr-esm.wasm +0 -0
- package/dist/libultrahdr.js +7 -6
- package/dist/libultrahdr.umd.js +7 -6
- package/dist/worker-interface.js +3 -3
- package/dist/worker-interface.umd.js +2 -2
- package/dist/worker.js +4 -4
- package/dist/worker.umd.js +20 -11
- package/libultrahdr-wasm/README.md +2 -2
- package/libultrahdr-wasm/build/libultrahdr-debug.wasm +0 -0
- package/libultrahdr-wasm/build/libultrahdr-esm.wasm +0 -0
- package/libultrahdr-wasm/build/libultrahdr.wasm +0 -0
- package/package.json +22 -24
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [3.0.3](https://github.com/MONOGRID/gainmap-js/compare/v3.0.2...v3.0.3) (2024-02-09)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **libultrahdr-wasm:** encoding of odd sized images ([#31](https://github.com/MONOGRID/gainmap-js/issues/31)) ([efd52c3](https://github.com/MONOGRID/gainmap-js/commit/efd52c385387d2575c161e243b07369100e8e349))
|
|
7
|
+
|
|
8
|
+
## [3.0.2](https://github.com/MONOGRID/gainmap-js/compare/v3.0.1...v3.0.2) (2024-01-31)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **encode:** encodes a valid image when an invalid tonemapping value was provided as input ([94cec23](https://github.com/MONOGRID/gainmap-js/commit/94cec2363aa0dcb3cc46fca048c68ed7e555ebd0))
|
|
14
|
+
|
|
1
15
|
## [3.0.1](https://github.com/MONOGRID/gainmap-js/compare/v3.0.0...v3.0.1) (2023-12-03)
|
|
2
16
|
|
|
3
17
|
|
package/CODE_OF_CONDUCT.md
CHANGED
|
@@ -60,7 +60,7 @@ representative at an online or offline event.
|
|
|
60
60
|
|
|
61
61
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
62
62
|
reported to the community leaders responsible for enforcement at
|
|
63
|
-
rnd@
|
|
63
|
+
rnd@monogrid.com.
|
|
64
64
|
All complaints will be reviewed and investigated promptly and fairly.
|
|
65
65
|
|
|
66
66
|
All community leaders are obligated to respect the privacy and security of the
|
package/CONTRIBUTING.md
CHANGED
|
@@ -81,7 +81,7 @@ A good bug report shouldn't leave others needing to chase you up for more inform
|
|
|
81
81
|
<!-- omit in toc -->
|
|
82
82
|
#### How Do I Submit a Good Bug Report?
|
|
83
83
|
|
|
84
|
-
> You must never report security related issues, vulnerabilities or bugs including sensitive information to the issue tracker, or elsewhere in public. Instead sensitive bugs must be sent by email to <rnd@
|
|
84
|
+
> You must never report security related issues, vulnerabilities or bugs including sensitive information to the issue tracker, or elsewhere in public. Instead sensitive bugs must be sent by email to <rnd@monogrid.com>.
|
|
85
85
|
<!-- You may add a PGP key to allow the messages to be sent encrypted as well. -->
|
|
86
86
|
|
|
87
87
|
We use GitHub issues to track bugs and errors. If you run into an issue with the project:
|
package/README.md
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
# gainmap-js
|
|
2
|
+
[](https://app.fossa.com/projects/git%2Bgithub.com%2FMONOGRID%2Fgainmap-js?ref=badge_shield)
|
|
3
|
+
|
|
2
4
|
A Javascript (TypeScript) Encoder/Decoder Implementation of Adobe's Gain Map Technology for storing HDR Images using an SDR Image + a "Gain map"
|
|
3
5
|
|
|
4
6
|
> :warning: This library **is primarily intended** for encoding and decoding gain map images for the [three.js](https://github.com/mrdoob/three.js/) 3D Library
|
|
@@ -14,7 +16,7 @@ Compares loading:
|
|
|
14
16
|
2. a `webp` sdr file + a `webp` gain map + metadata JSON
|
|
15
17
|
3. a comparable size `.hdr` file for comparison
|
|
16
18
|
|
|
17
|
-
## [Free online encoder](https://gainmap-creator.
|
|
19
|
+
## [Free online encoder](https://gainmap-creator.monogrid.com)
|
|
18
20
|
|
|
19
21
|
Use it to convert `.hdr` and `.exr` files into gain maps. It's free and the whole process happens in your browser.
|
|
20
22
|
|
|
@@ -254,3 +256,7 @@ module.exports = defineConfig({
|
|
|
254
256
|
|
|
255
257
|
* [Adobe Gainmap Specification](https://helpx.adobe.com/camera-raw/using/gain-map.html)
|
|
256
258
|
* [Ultra HDR Image Format v1.0](https://developer.android.com/guide/topics/media/platform/hdr-image-format)
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
## License
|
|
262
|
+
[](https://app.fossa.com/projects/git%2Bgithub.com%2FMONOGRID%2Fgainmap-js?ref=badge_large)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @monogrid/gainmap-js v3.0.
|
|
3
|
-
* With ❤️, by MONOGRID <
|
|
2
|
+
* @monogrid/gainmap-js v3.0.3
|
|
3
|
+
* With ❤️, by MONOGRID <rnd@monogrid.com>
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { RGBAFormat, LinearFilter, ClampToEdgeWrapping, Scene, OrthographicCamera, HalfFloatType, FloatType, Mesh, PlaneGeometry, WebGLRenderTarget, UVMapping, WebGLRenderer, DataTexture, LinearSRGBColorSpace, ShaderMaterial, Texture, IntType, ShortType, ByteType, UnsignedIntType, UnsignedByteType, MeshBasicMaterial } from 'three';
|
|
@@ -71,9 +71,9 @@ const canReadPixels = (type, renderer, camera, renderTargetOptions) => {
|
|
|
71
71
|
*/
|
|
72
72
|
class QuadRenderer {
|
|
73
73
|
/**
|
|
74
|
+
* Constructs a new QuadRenderer
|
|
74
75
|
*
|
|
75
|
-
* @param
|
|
76
|
-
* @param renderer
|
|
76
|
+
* @param options Parameters for this QuadRenderer
|
|
77
77
|
*/
|
|
78
78
|
constructor(options) {
|
|
79
79
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @monogrid/gainmap-js v3.0.
|
|
3
|
-
* With ❤️, by MONOGRID <
|
|
2
|
+
* @monogrid/gainmap-js v3.0.3
|
|
3
|
+
* With ❤️, by MONOGRID <rnd@monogrid.com>
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @monogrid/gainmap-js v3.0.
|
|
3
|
-
* With ❤️, by MONOGRID <
|
|
2
|
+
* @monogrid/gainmap-js v3.0.3
|
|
3
|
+
* With ❤️, by MONOGRID <rnd@monogrid.com>
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -13,17 +13,24 @@
|
|
|
13
13
|
* @returns
|
|
14
14
|
*/
|
|
15
15
|
const canvasToBlob = async (canvas, mimeType, quality) => {
|
|
16
|
-
if (canvas instanceof OffscreenCanvas) {
|
|
16
|
+
if (typeof OffscreenCanvas !== 'undefined' && canvas instanceof OffscreenCanvas) {
|
|
17
17
|
return canvas.convertToBlob({ type: mimeType, quality: quality || 0.9 });
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
else if (canvas instanceof HTMLCanvasElement) {
|
|
20
|
+
return new Promise((resolve, reject) => {
|
|
21
|
+
canvas.toBlob((res) => {
|
|
22
|
+
if (res)
|
|
23
|
+
resolve(res);
|
|
24
|
+
else
|
|
25
|
+
reject(new Error('Failed to convert canvas to blob'));
|
|
26
|
+
}, mimeType, quality || 0.9);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
/* istanbul ignore next
|
|
30
|
+
as long as this function is not exported this is only here
|
|
31
|
+
to satisfy TS strict mode internally
|
|
32
|
+
*/
|
|
33
|
+
throw new Error('Unsupported canvas element');
|
|
27
34
|
};
|
|
28
35
|
/**
|
|
29
36
|
* Converts a RAW RGBA image buffer into the provided `mimeType` using the provided `quality`
|
|
@@ -59,6 +66,8 @@ const compress = async (params) => {
|
|
|
59
66
|
}
|
|
60
67
|
else {
|
|
61
68
|
canvas = document.createElement('canvas');
|
|
69
|
+
canvas.width = width;
|
|
70
|
+
canvas.height = height;
|
|
62
71
|
}
|
|
63
72
|
const ctx = canvas.getContext('2d');
|
|
64
73
|
if (!ctx)
|
|
@@ -57,9 +57,9 @@ export declare class QuadRenderer<TType extends TextureDataType, TMaterial exten
|
|
|
57
57
|
private _colorSpace;
|
|
58
58
|
private _supportsReadPixels;
|
|
59
59
|
/**
|
|
60
|
+
* Constructs a new QuadRenderer
|
|
60
61
|
*
|
|
61
|
-
* @param
|
|
62
|
-
* @param renderer
|
|
62
|
+
* @param options Parameters for this QuadRenderer
|
|
63
63
|
*/
|
|
64
64
|
constructor(options: QuadRendererOptions<TType, TMaterial>);
|
|
65
65
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type MPFExtractorOptions = {
|
|
1
|
+
export type MPFExtractorOptions = {
|
|
2
2
|
debug: boolean;
|
|
3
3
|
extractFII: boolean;
|
|
4
4
|
extractNonFII: boolean;
|
|
@@ -19,4 +19,3 @@ export declare class MPFExtractor {
|
|
|
19
19
|
constructor(options?: Partial<MPFExtractorOptions>);
|
|
20
20
|
extract(imageArrayBuffer: Uint8Array): Promise<Blob[]>;
|
|
21
21
|
}
|
|
22
|
-
export {};
|
package/dist/decode.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @monogrid/gainmap-js v3.0.
|
|
3
|
-
* With ❤️, by MONOGRID <
|
|
2
|
+
* @monogrid/gainmap-js v3.0.3
|
|
3
|
+
* With ❤️, by MONOGRID <rnd@monogrid.com>
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { Q as QuadRenderer } from './QuadRenderer-
|
|
6
|
+
import { Q as QuadRenderer } from './QuadRenderer-vDmOC3x_.js';
|
|
7
7
|
import { ShaderMaterial, Vector3, NoBlending, SRGBColorSpace, LinearSRGBColorSpace, HalfFloatType, Loader, LoadingManager, Texture, UVMapping, ClampToEdgeWrapping, LinearFilter, LinearMipMapLinearFilter, RGBAFormat, UnsignedByteType, FileLoader } from 'three';
|
|
8
8
|
|
|
9
9
|
const vertexShader = /* glsl */ `
|
|
@@ -212,7 +212,7 @@ const decode = (params) => {
|
|
|
212
212
|
}
|
|
213
213
|
sdr.needsUpdate = true;
|
|
214
214
|
if (gainMap.colorSpace !== LinearSRGBColorSpace) {
|
|
215
|
-
console.warn('Gainmap Colorspace needs to be *LinearSRGBColorSpace
|
|
215
|
+
console.warn('Gainmap Colorspace needs to be *LinearSRGBColorSpace*, setting it automatically');
|
|
216
216
|
gainMap.colorSpace = LinearSRGBColorSpace;
|
|
217
217
|
}
|
|
218
218
|
gainMap.needsUpdate = true;
|
|
@@ -759,6 +759,9 @@ class GainMapLoader extends LoaderBase {
|
|
|
759
759
|
sdrLoader.setPath(this.path);
|
|
760
760
|
sdrLoader.setWithCredentials(this.withCredentials);
|
|
761
761
|
sdrLoader.load(sdrUrl, async (buffer) => {
|
|
762
|
+
/* istanbul ignore if
|
|
763
|
+
this condition exists only because of three.js types + strict mode
|
|
764
|
+
*/
|
|
762
765
|
if (typeof buffer === 'string')
|
|
763
766
|
throw new Error('Invalid sdr buffer');
|
|
764
767
|
sdr = buffer;
|
|
@@ -779,6 +782,9 @@ class GainMapLoader extends LoaderBase {
|
|
|
779
782
|
gainMapLoader.setPath(this.path);
|
|
780
783
|
gainMapLoader.setWithCredentials(this.withCredentials);
|
|
781
784
|
gainMapLoader.load(gainMapUrl, async (buffer) => {
|
|
785
|
+
/* istanbul ignore if
|
|
786
|
+
this condition exists only because of three.js types + strict mode
|
|
787
|
+
*/
|
|
782
788
|
if (typeof buffer === 'string')
|
|
783
789
|
throw new Error('Invalid gainmap buffer');
|
|
784
790
|
gainMap = buffer;
|
|
@@ -799,6 +805,9 @@ class GainMapLoader extends LoaderBase {
|
|
|
799
805
|
metadataLoader.setPath(this.path);
|
|
800
806
|
metadataLoader.setWithCredentials(this.withCredentials);
|
|
801
807
|
metadataLoader.load(metadataUrl, async (json) => {
|
|
808
|
+
/* istanbul ignore if
|
|
809
|
+
this condition exists only because of three.js types + strict mode
|
|
810
|
+
*/
|
|
802
811
|
if (typeof json !== 'string')
|
|
803
812
|
throw new Error('Invalid metadata string');
|
|
804
813
|
// TODO: implement check on JSON file and remove this eslint disable
|
|
@@ -887,6 +896,9 @@ class HDRJPGLoader extends LoaderBase {
|
|
|
887
896
|
loader.setWithCredentials(this.withCredentials);
|
|
888
897
|
this.manager.itemStart(url);
|
|
889
898
|
loader.load(url, async (jpeg) => {
|
|
899
|
+
/* istanbul ignore if
|
|
900
|
+
this condition exists only because of three.js types + strict mode
|
|
901
|
+
*/
|
|
890
902
|
if (typeof jpeg === 'string')
|
|
891
903
|
throw new Error('Invalid buffer, received [string], was expecting [ArrayBuffer]');
|
|
892
904
|
const jpegBuffer = new Uint8Array(jpeg);
|
package/dist/decode.umd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @monogrid/gainmap-js v3.0.
|
|
3
|
-
* With ❤️, by MONOGRID <
|
|
2
|
+
* @monogrid/gainmap-js v3.0.3
|
|
3
|
+
* With ❤️, by MONOGRID <rnd@monogrid.com>
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
(function (global, factory) {
|
|
@@ -75,9 +75,9 @@
|
|
|
75
75
|
*/
|
|
76
76
|
class QuadRenderer {
|
|
77
77
|
/**
|
|
78
|
+
* Constructs a new QuadRenderer
|
|
78
79
|
*
|
|
79
|
-
* @param
|
|
80
|
-
* @param renderer
|
|
80
|
+
* @param options Parameters for this QuadRenderer
|
|
81
81
|
*/
|
|
82
82
|
constructor(options) {
|
|
83
83
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
@@ -508,7 +508,7 @@ void main() {
|
|
|
508
508
|
}
|
|
509
509
|
sdr.needsUpdate = true;
|
|
510
510
|
if (gainMap.colorSpace !== three.LinearSRGBColorSpace) {
|
|
511
|
-
console.warn('Gainmap Colorspace needs to be *LinearSRGBColorSpace
|
|
511
|
+
console.warn('Gainmap Colorspace needs to be *LinearSRGBColorSpace*, setting it automatically');
|
|
512
512
|
gainMap.colorSpace = three.LinearSRGBColorSpace;
|
|
513
513
|
}
|
|
514
514
|
gainMap.needsUpdate = true;
|
|
@@ -1055,6 +1055,9 @@ void main() {
|
|
|
1055
1055
|
sdrLoader.setPath(this.path);
|
|
1056
1056
|
sdrLoader.setWithCredentials(this.withCredentials);
|
|
1057
1057
|
sdrLoader.load(sdrUrl, async (buffer) => {
|
|
1058
|
+
/* istanbul ignore if
|
|
1059
|
+
this condition exists only because of three.js types + strict mode
|
|
1060
|
+
*/
|
|
1058
1061
|
if (typeof buffer === 'string')
|
|
1059
1062
|
throw new Error('Invalid sdr buffer');
|
|
1060
1063
|
sdr = buffer;
|
|
@@ -1075,6 +1078,9 @@ void main() {
|
|
|
1075
1078
|
gainMapLoader.setPath(this.path);
|
|
1076
1079
|
gainMapLoader.setWithCredentials(this.withCredentials);
|
|
1077
1080
|
gainMapLoader.load(gainMapUrl, async (buffer) => {
|
|
1081
|
+
/* istanbul ignore if
|
|
1082
|
+
this condition exists only because of three.js types + strict mode
|
|
1083
|
+
*/
|
|
1078
1084
|
if (typeof buffer === 'string')
|
|
1079
1085
|
throw new Error('Invalid gainmap buffer');
|
|
1080
1086
|
gainMap = buffer;
|
|
@@ -1095,6 +1101,9 @@ void main() {
|
|
|
1095
1101
|
metadataLoader.setPath(this.path);
|
|
1096
1102
|
metadataLoader.setWithCredentials(this.withCredentials);
|
|
1097
1103
|
metadataLoader.load(metadataUrl, async (json) => {
|
|
1104
|
+
/* istanbul ignore if
|
|
1105
|
+
this condition exists only because of three.js types + strict mode
|
|
1106
|
+
*/
|
|
1098
1107
|
if (typeof json !== 'string')
|
|
1099
1108
|
throw new Error('Invalid metadata string');
|
|
1100
1109
|
// TODO: implement check on JSON file and remove this eslint disable
|
|
@@ -1183,6 +1192,9 @@ void main() {
|
|
|
1183
1192
|
loader.setWithCredentials(this.withCredentials);
|
|
1184
1193
|
this.manager.itemStart(url);
|
|
1185
1194
|
loader.load(url, async (jpeg) => {
|
|
1195
|
+
/* istanbul ignore if
|
|
1196
|
+
this condition exists only because of three.js types + strict mode
|
|
1197
|
+
*/
|
|
1186
1198
|
if (typeof jpeg === 'string')
|
|
1187
1199
|
throw new Error('Invalid buffer, received [string], was expecting [ArrayBuffer]');
|
|
1188
1200
|
const jpegBuffer = new Uint8Array(jpeg);
|
package/dist/encode.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @monogrid/gainmap-js v3.0.
|
|
3
|
-
* With ❤️, by MONOGRID <
|
|
2
|
+
* @monogrid/gainmap-js v3.0.3
|
|
3
|
+
* With ❤️, by MONOGRID <rnd@monogrid.com>
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { c as compress } from './compress-
|
|
6
|
+
import { c as compress } from './compress-FEb3eYc4.js';
|
|
7
7
|
import { DataTexture, RGBAFormat, UVMapping, RepeatWrapping, LinearFilter, LinearSRGBColorSpace, ShaderMaterial, Vector3, NoBlending, UnsignedByteType, ACESFilmicToneMapping, LinearToneMapping, CineonToneMapping, ReinhardToneMapping, SRGBColorSpace, Vector2, WebGLRenderTarget, NearestFilter, ClampToEdgeWrapping, FloatType, DataUtils } from 'three';
|
|
8
|
-
import { Q as QuadRenderer } from './QuadRenderer-
|
|
8
|
+
import { Q as QuadRenderer } from './QuadRenderer-vDmOC3x_.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Utility function to obtain a `DataTexture` from various input formats
|
|
@@ -370,24 +370,32 @@ class SDRMaterial extends ShaderMaterial {
|
|
|
370
370
|
}
|
|
371
371
|
get toneMapping() { return this._toneMapping; }
|
|
372
372
|
set toneMapping(value) {
|
|
373
|
+
let valid = false;
|
|
373
374
|
switch (value) {
|
|
374
375
|
case ACESFilmicToneMapping:
|
|
375
376
|
this.defines.TONEMAPPING_FUNCTION = 'ACESFilmicToneMapping';
|
|
377
|
+
valid = true;
|
|
376
378
|
break;
|
|
377
379
|
case ReinhardToneMapping:
|
|
378
380
|
this.defines.TONEMAPPING_FUNCTION = 'ReinhardToneMapping';
|
|
381
|
+
valid = true;
|
|
379
382
|
break;
|
|
380
383
|
case CineonToneMapping:
|
|
381
384
|
this.defines.TONEMAPPING_FUNCTION = 'CineonToneMapping';
|
|
385
|
+
valid = true;
|
|
382
386
|
break;
|
|
383
387
|
case LinearToneMapping:
|
|
384
388
|
this.defines.TONEMAPPING_FUNCTION = 'LinearToneMapping';
|
|
389
|
+
valid = true;
|
|
385
390
|
break;
|
|
386
391
|
default:
|
|
387
|
-
console.error(
|
|
388
|
-
|
|
392
|
+
console.error(`Unsupported toneMapping: ${value}. Using LinearToneMapping.`);
|
|
393
|
+
this.defines.TONEMAPPING_FUNCTION = 'LinearToneMapping';
|
|
394
|
+
this._toneMapping = LinearToneMapping;
|
|
395
|
+
}
|
|
396
|
+
if (valid) {
|
|
397
|
+
this._toneMapping = value;
|
|
389
398
|
}
|
|
390
|
-
this._toneMapping = value;
|
|
391
399
|
this.needsUpdate = true;
|
|
392
400
|
}
|
|
393
401
|
get brightness() { return this._brightness; }
|
package/dist/encode.umd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @monogrid/gainmap-js v3.0.
|
|
3
|
-
* With ❤️, by MONOGRID <
|
|
2
|
+
* @monogrid/gainmap-js v3.0.3
|
|
3
|
+
* With ❤️, by MONOGRID <rnd@monogrid.com>
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
(function (global, factory) {
|
|
@@ -19,17 +19,24 @@
|
|
|
19
19
|
* @returns
|
|
20
20
|
*/
|
|
21
21
|
const canvasToBlob = async (canvas, mimeType, quality) => {
|
|
22
|
-
if (canvas instanceof OffscreenCanvas) {
|
|
22
|
+
if (typeof OffscreenCanvas !== 'undefined' && canvas instanceof OffscreenCanvas) {
|
|
23
23
|
return canvas.convertToBlob({ type: mimeType, quality: quality || 0.9 });
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
else if (canvas instanceof HTMLCanvasElement) {
|
|
26
|
+
return new Promise((resolve, reject) => {
|
|
27
|
+
canvas.toBlob((res) => {
|
|
28
|
+
if (res)
|
|
29
|
+
resolve(res);
|
|
30
|
+
else
|
|
31
|
+
reject(new Error('Failed to convert canvas to blob'));
|
|
32
|
+
}, mimeType, quality || 0.9);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/* istanbul ignore next
|
|
36
|
+
as long as this function is not exported this is only here
|
|
37
|
+
to satisfy TS strict mode internally
|
|
38
|
+
*/
|
|
39
|
+
throw new Error('Unsupported canvas element');
|
|
33
40
|
};
|
|
34
41
|
/**
|
|
35
42
|
* Converts a RAW RGBA image buffer into the provided `mimeType` using the provided `quality`
|
|
@@ -65,6 +72,8 @@
|
|
|
65
72
|
}
|
|
66
73
|
else {
|
|
67
74
|
canvas = document.createElement('canvas');
|
|
75
|
+
canvas.width = width;
|
|
76
|
+
canvas.height = height;
|
|
68
77
|
}
|
|
69
78
|
const ctx = canvas.getContext('2d');
|
|
70
79
|
if (!ctx)
|
|
@@ -180,9 +189,9 @@
|
|
|
180
189
|
*/
|
|
181
190
|
class QuadRenderer {
|
|
182
191
|
/**
|
|
192
|
+
* Constructs a new QuadRenderer
|
|
183
193
|
*
|
|
184
|
-
* @param
|
|
185
|
-
* @param renderer
|
|
194
|
+
* @param options Parameters for this QuadRenderer
|
|
186
195
|
*/
|
|
187
196
|
constructor(options) {
|
|
188
197
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
@@ -741,24 +750,32 @@ void main() {
|
|
|
741
750
|
}
|
|
742
751
|
get toneMapping() { return this._toneMapping; }
|
|
743
752
|
set toneMapping(value) {
|
|
753
|
+
let valid = false;
|
|
744
754
|
switch (value) {
|
|
745
755
|
case three.ACESFilmicToneMapping:
|
|
746
756
|
this.defines.TONEMAPPING_FUNCTION = 'ACESFilmicToneMapping';
|
|
757
|
+
valid = true;
|
|
747
758
|
break;
|
|
748
759
|
case three.ReinhardToneMapping:
|
|
749
760
|
this.defines.TONEMAPPING_FUNCTION = 'ReinhardToneMapping';
|
|
761
|
+
valid = true;
|
|
750
762
|
break;
|
|
751
763
|
case three.CineonToneMapping:
|
|
752
764
|
this.defines.TONEMAPPING_FUNCTION = 'CineonToneMapping';
|
|
765
|
+
valid = true;
|
|
753
766
|
break;
|
|
754
767
|
case three.LinearToneMapping:
|
|
755
768
|
this.defines.TONEMAPPING_FUNCTION = 'LinearToneMapping';
|
|
769
|
+
valid = true;
|
|
756
770
|
break;
|
|
757
771
|
default:
|
|
758
|
-
console.error(
|
|
759
|
-
|
|
772
|
+
console.error(`Unsupported toneMapping: ${value}. Using LinearToneMapping.`);
|
|
773
|
+
this.defines.TONEMAPPING_FUNCTION = 'LinearToneMapping';
|
|
774
|
+
this._toneMapping = three.LinearToneMapping;
|
|
775
|
+
}
|
|
776
|
+
if (valid) {
|
|
777
|
+
this._toneMapping = value;
|
|
760
778
|
}
|
|
761
|
-
this._toneMapping = value;
|
|
762
779
|
this.needsUpdate = true;
|
|
763
780
|
}
|
|
764
781
|
get brightness() { return this._brightness; }
|
|
Binary file
|
package/dist/libultrahdr.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @monogrid/gainmap-js v3.0.
|
|
3
|
-
* With ❤️, by MONOGRID <
|
|
2
|
+
* @monogrid/gainmap-js v3.0.3
|
|
3
|
+
* With ❤️, by MONOGRID <rnd@monogrid.com>
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
var Module = (() => {
|
|
@@ -6527,7 +6527,6 @@ run();
|
|
|
6527
6527
|
|
|
6528
6528
|
);
|
|
6529
6529
|
})();
|
|
6530
|
-
var libultrahdr = Module;
|
|
6531
6530
|
|
|
6532
6531
|
// @ts-expect-error untyped
|
|
6533
6532
|
let library;
|
|
@@ -6540,18 +6539,19 @@ let library;
|
|
|
6540
6539
|
*/
|
|
6541
6540
|
const getLibrary = async () => {
|
|
6542
6541
|
if (!library) {
|
|
6543
|
-
library = await
|
|
6542
|
+
library = await Module();
|
|
6544
6543
|
}
|
|
6545
6544
|
return library;
|
|
6546
6545
|
};
|
|
6547
6546
|
|
|
6548
6547
|
/**
|
|
6549
|
-
*
|
|
6548
|
+
* @deprecated
|
|
6550
6549
|
* @param description
|
|
6551
6550
|
* @param name
|
|
6552
6551
|
* @param defaultValue
|
|
6553
6552
|
* @returns
|
|
6554
6553
|
*/
|
|
6554
|
+
/* istanbul ignore next */
|
|
6555
6555
|
const getAttribute = (description, name, defaultValue) => {
|
|
6556
6556
|
var _a;
|
|
6557
6557
|
let returnValue;
|
|
@@ -6584,7 +6584,7 @@ const getAttribute = (description, name, defaultValue) => {
|
|
|
6584
6584
|
*
|
|
6585
6585
|
* @category Decoding
|
|
6586
6586
|
* @group Decoding
|
|
6587
|
-
*
|
|
6587
|
+
* @deprecated
|
|
6588
6588
|
* @example
|
|
6589
6589
|
* import { decodeJPEGMetadata } from '@monogrid/gainmap-js/libultrahdr'
|
|
6590
6590
|
*
|
|
@@ -6598,6 +6598,7 @@ const getAttribute = (description, name, defaultValue) => {
|
|
|
6598
6598
|
* @returns The decoded data
|
|
6599
6599
|
* @throws {Error} if the provided file cannot be parsed or does not contain a valid Gainmap
|
|
6600
6600
|
*/
|
|
6601
|
+
/* istanbul ignore next */
|
|
6601
6602
|
const decodeJPEGMetadata = async (file) => {
|
|
6602
6603
|
var _a, _b;
|
|
6603
6604
|
const lib = await getLibrary();
|
package/dist/libultrahdr.umd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @monogrid/gainmap-js v3.0.
|
|
3
|
-
* With ❤️, by MONOGRID <
|
|
2
|
+
* @monogrid/gainmap-js v3.0.3
|
|
3
|
+
* With ❤️, by MONOGRID <rnd@monogrid.com>
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
(function (global, factory) {
|
|
@@ -6534,7 +6534,6 @@
|
|
|
6534
6534
|
|
|
6535
6535
|
);
|
|
6536
6536
|
})();
|
|
6537
|
-
var libultrahdr = Module;
|
|
6538
6537
|
|
|
6539
6538
|
// @ts-expect-error untyped
|
|
6540
6539
|
let library;
|
|
@@ -6547,18 +6546,19 @@
|
|
|
6547
6546
|
*/
|
|
6548
6547
|
const getLibrary = async () => {
|
|
6549
6548
|
if (!library) {
|
|
6550
|
-
library = await
|
|
6549
|
+
library = await Module();
|
|
6551
6550
|
}
|
|
6552
6551
|
return library;
|
|
6553
6552
|
};
|
|
6554
6553
|
|
|
6555
6554
|
/**
|
|
6556
|
-
*
|
|
6555
|
+
* @deprecated
|
|
6557
6556
|
* @param description
|
|
6558
6557
|
* @param name
|
|
6559
6558
|
* @param defaultValue
|
|
6560
6559
|
* @returns
|
|
6561
6560
|
*/
|
|
6561
|
+
/* istanbul ignore next */
|
|
6562
6562
|
const getAttribute = (description, name, defaultValue) => {
|
|
6563
6563
|
var _a;
|
|
6564
6564
|
let returnValue;
|
|
@@ -6591,7 +6591,7 @@
|
|
|
6591
6591
|
*
|
|
6592
6592
|
* @category Decoding
|
|
6593
6593
|
* @group Decoding
|
|
6594
|
-
*
|
|
6594
|
+
* @deprecated
|
|
6595
6595
|
* @example
|
|
6596
6596
|
* import { decodeJPEGMetadata } from '@monogrid/gainmap-js/libultrahdr'
|
|
6597
6597
|
*
|
|
@@ -6605,6 +6605,7 @@
|
|
|
6605
6605
|
* @returns The decoded data
|
|
6606
6606
|
* @throws {Error} if the provided file cannot be parsed or does not contain a valid Gainmap
|
|
6607
6607
|
*/
|
|
6608
|
+
/* istanbul ignore next */
|
|
6608
6609
|
const decodeJPEGMetadata = async (file) => {
|
|
6609
6610
|
var _a, _b;
|
|
6610
6611
|
const lib = await getLibrary();
|
package/dist/worker-interface.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @monogrid/gainmap-js v3.0.
|
|
3
|
-
* With ❤️, by MONOGRID <
|
|
2
|
+
* @monogrid/gainmap-js v3.0.3
|
|
3
|
+
* With ❤️, by MONOGRID <rnd@monogrid.com>
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { c as commonjsGlobal, g as getDefaultExportFromCjs } from './_commonjsHelpers-
|
|
6
|
+
import { c as commonjsGlobal, g as getDefaultExportFromCjs } from './_commonjsHelpers-QOuTPcZm.js';
|
|
7
7
|
|
|
8
8
|
var lib$1;
|
|
9
9
|
var hasRequiredLib$1;
|
package/dist/worker.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @monogrid/gainmap-js v3.0.
|
|
3
|
-
* With ❤️, by MONOGRID <
|
|
2
|
+
* @monogrid/gainmap-js v3.0.3
|
|
3
|
+
* With ❤️, by MONOGRID <rnd@monogrid.com>
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { g as getDefaultExportFromCjs } from './_commonjsHelpers-
|
|
7
|
-
import { c as compress } from './compress-
|
|
6
|
+
import { g as getDefaultExportFromCjs } from './_commonjsHelpers-QOuTPcZm.js';
|
|
7
|
+
import { c as compress } from './compress-FEb3eYc4.js';
|
|
8
8
|
|
|
9
9
|
var isPromise$2 = {exports: {}};
|
|
10
10
|
|
package/dist/worker.umd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @monogrid/gainmap-js v3.0.
|
|
3
|
-
* With ❤️, by MONOGRID <
|
|
2
|
+
* @monogrid/gainmap-js v3.0.3
|
|
3
|
+
* With ❤️, by MONOGRID <rnd@monogrid.com>
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
(function (factory) {
|
|
@@ -124,17 +124,24 @@
|
|
|
124
124
|
* @returns
|
|
125
125
|
*/
|
|
126
126
|
const canvasToBlob = async (canvas, mimeType, quality) => {
|
|
127
|
-
if (canvas instanceof OffscreenCanvas) {
|
|
127
|
+
if (typeof OffscreenCanvas !== 'undefined' && canvas instanceof OffscreenCanvas) {
|
|
128
128
|
return canvas.convertToBlob({ type: mimeType, quality: quality || 0.9 });
|
|
129
129
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
130
|
+
else if (canvas instanceof HTMLCanvasElement) {
|
|
131
|
+
return new Promise((resolve, reject) => {
|
|
132
|
+
canvas.toBlob((res) => {
|
|
133
|
+
if (res)
|
|
134
|
+
resolve(res);
|
|
135
|
+
else
|
|
136
|
+
reject(new Error('Failed to convert canvas to blob'));
|
|
137
|
+
}, mimeType, quality || 0.9);
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
/* istanbul ignore next
|
|
141
|
+
as long as this function is not exported this is only here
|
|
142
|
+
to satisfy TS strict mode internally
|
|
143
|
+
*/
|
|
144
|
+
throw new Error('Unsupported canvas element');
|
|
138
145
|
};
|
|
139
146
|
/**
|
|
140
147
|
* Converts a RAW RGBA image buffer into the provided `mimeType` using the provided `quality`
|
|
@@ -170,6 +177,8 @@
|
|
|
170
177
|
}
|
|
171
178
|
else {
|
|
172
179
|
canvas = document.createElement('canvas');
|
|
180
|
+
canvas.width = width;
|
|
181
|
+
canvas.height = height;
|
|
173
182
|
}
|
|
174
183
|
const ctx = canvas.getContext('2d');
|
|
175
184
|
if (!ctx)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
WASM version of the [libultrahdr](https://github.com/google/libultrahdr) library.
|
|
4
4
|
|
|
5
|
-
This library is
|
|
5
|
+
This library is primarily intended to be used in conjunction with the [gainmap-js](https://github.com/MONOGRID/gainmap-js) library which is, in turn, focused on providing an alternative lightweight HDR format for WebGL 3D Engines like (three.js)
|
|
6
6
|
|
|
7
7
|
This library is provided "as-is" and not tested nor optimized for general use.
|
|
8
8
|
|
|
@@ -22,7 +22,7 @@ const libraryInstance = await libultrahdr()
|
|
|
22
22
|
// # height: height of the final image
|
|
23
23
|
// # sdr: Uint8Array containing the SDR rendition encoded in jpeg
|
|
24
24
|
// # gainmap: Uint8Array containing the Gainmap encoded in jpeg
|
|
25
|
-
// # metadata: an object
|
|
25
|
+
// # metadata: an object containing the parameters of the gainmap
|
|
26
26
|
|
|
27
27
|
const result = libraryInstance.appendGainMap(
|
|
28
28
|
width, height,
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monogrid/gainmap-js",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.3",
|
|
4
4
|
"description": "A Javascript (TypeScript) Port of Adobe Gainmap Technology for storing HDR Images using an SDR Image + a gain map",
|
|
5
5
|
"homepage": "https://github.com/MONOGRID/gainmap-js#readme",
|
|
6
6
|
"repository": {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"three",
|
|
15
15
|
"threejs"
|
|
16
16
|
],
|
|
17
|
-
"author": "MONOGRID <
|
|
17
|
+
"author": "MONOGRID <rnd@monogrid.com>",
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"bugs": {
|
|
20
20
|
"url": "https://github.com/MONOGRID/gainmap-js/issues"
|
|
@@ -78,9 +78,8 @@
|
|
|
78
78
|
"build": "rollup -c",
|
|
79
79
|
"dev": "concurrently -n rollup,servez -c magenta,green \"rollup -c -w\" \"servez\"",
|
|
80
80
|
"start": "concurrently -n rollup,servez -c magenta,green \"rollup -c -w\" \"servez\"",
|
|
81
|
-
"test": "playwright test",
|
|
81
|
+
"test": "nyc --reporter=text --reporter=lcov playwright test",
|
|
82
82
|
"test:startserver": "rollup -c && servez",
|
|
83
|
-
"test:report-coverage": "nyc report --reporter=text --reporter=cobertura --reporter=html --reporter=json-summary",
|
|
84
83
|
"test:docker": "docker run --rm --network host -v $(pwd):/work -w /work -it -u $(id -u ${USER}):$(id -g ${USER}) mcr.microsoft.com/playwright:v1.40.0-jammy /bin/bash",
|
|
85
84
|
"test:codegen": "playwright codegen http://localhost:8080",
|
|
86
85
|
"prepack": "npm run build",
|
|
@@ -106,50 +105,49 @@
|
|
|
106
105
|
"promise-worker-transferable": "^1.0.4"
|
|
107
106
|
},
|
|
108
107
|
"devDependencies": {
|
|
109
|
-
"@playwright/test": "^1.
|
|
108
|
+
"@playwright/test": "^1.41.1",
|
|
110
109
|
"@rollup/plugin-commonjs": "^25.0.7",
|
|
111
|
-
"@rollup/plugin-json": "^6.0
|
|
110
|
+
"@rollup/plugin-json": "^6.1.0",
|
|
112
111
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
113
112
|
"@rollup/plugin-terser": "^0.4.4",
|
|
114
|
-
"@rollup/plugin-typescript": "^11.1.
|
|
113
|
+
"@rollup/plugin-typescript": "^11.1.6",
|
|
115
114
|
"@semantic-release/changelog": "^6.0.3",
|
|
116
115
|
"@semantic-release/commit-analyzer": "^11.1.0",
|
|
117
116
|
"@semantic-release/git": "github:semantic-release/git",
|
|
118
|
-
"@semantic-release/github": "^9.2.
|
|
119
|
-
"@semantic-release/npm": "^11.0.
|
|
117
|
+
"@semantic-release/github": "^9.2.6",
|
|
118
|
+
"@semantic-release/npm": "^11.0.2",
|
|
120
119
|
"@semantic-release/release-notes-generator": "^12.1.0",
|
|
121
|
-
"@types/node": "^20.
|
|
122
|
-
"@types/three": "^0.
|
|
123
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
124
|
-
"@typescript-eslint/parser": "^6.
|
|
120
|
+
"@types/node": "^20.11.15",
|
|
121
|
+
"@types/three": "^0.161.0",
|
|
122
|
+
"@typescript-eslint/eslint-plugin": "^6.20.0",
|
|
123
|
+
"@typescript-eslint/parser": "^6.20.0",
|
|
125
124
|
"concurrently": "^8.2.2",
|
|
126
125
|
"conventional-changelog-conventionalcommits": "^7.0.2",
|
|
127
126
|
"cz-conventional-changelog": "^3.3.0",
|
|
128
|
-
"eslint": "^8.
|
|
127
|
+
"eslint": "^8.56.0",
|
|
129
128
|
"eslint-config-mdcs": "^5.0.0",
|
|
130
129
|
"eslint-config-standard": "^17.0.0",
|
|
131
130
|
"eslint-plugin-compat": "^4.2.0",
|
|
132
131
|
"eslint-plugin-html": "^7.1.0",
|
|
133
|
-
"eslint-plugin-import": "^2.29.
|
|
134
|
-
"eslint-plugin-n": "^16.
|
|
132
|
+
"eslint-plugin-import": "^2.29.1",
|
|
133
|
+
"eslint-plugin-n": "^16.6.2",
|
|
135
134
|
"eslint-plugin-promise": "^6.0.0",
|
|
136
|
-
"eslint-plugin-quasar": "^1.1.0",
|
|
137
135
|
"eslint-plugin-simple-import-sort": "^10.0.0",
|
|
138
136
|
"eslint-plugin-unused-imports": "^3.0.0",
|
|
139
137
|
"nyc": "^15.1.0",
|
|
140
|
-
"rollup": "^4.6
|
|
138
|
+
"rollup": "^4.9.6",
|
|
141
139
|
"rollup-plugin-copy": "^3.5.0",
|
|
142
140
|
"rollup-plugin-delete": "^2.0.0",
|
|
143
141
|
"rollup-plugin-istanbul": "^5.0.0",
|
|
144
142
|
"rollup-plugin-license": "^3.2.0",
|
|
145
|
-
"semantic-release": "^
|
|
146
|
-
"servez": "^2.1.
|
|
147
|
-
"sharp": "^0.33.
|
|
148
|
-
"three": "^0.
|
|
149
|
-
"typedoc": "^0.25.
|
|
143
|
+
"semantic-release": "^23.0.0",
|
|
144
|
+
"servez": "^2.1.3",
|
|
145
|
+
"sharp": "^0.33.2",
|
|
146
|
+
"three": "^0.161.0",
|
|
147
|
+
"typedoc": "^0.25.7",
|
|
150
148
|
"typedoc-github-wiki-theme": "^1.1.0",
|
|
151
149
|
"typedoc-plugin-markdown": "^3.17.1",
|
|
152
|
-
"typescript": "^5.3.
|
|
150
|
+
"typescript": "^5.3.3"
|
|
153
151
|
},
|
|
154
152
|
"browserslist": [
|
|
155
153
|
"> 1%, not dead, not ie 11, not op_mini all"
|