@monogrid/gainmap-js 3.0.3 → 3.0.4
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 +65 -1
- package/dist/{QuadRenderer-vDmOC3x_.js → QuadRenderer-C4ionbnq.js} +1 -1
- package/dist/{_commonjsHelpers-QOuTPcZm.js → _commonjsHelpers-DXfhkIdK.js} +1 -1
- package/dist/{compress-FEb3eYc4.js → compress-CQEeAo-R.js} +1 -1
- package/dist/decode/loaders/LoaderBase.d.ts +9 -2
- package/dist/decode.js +16 -3
- package/dist/decode.umd.js +15 -2
- package/dist/encode.js +3 -3
- package/dist/encode.umd.js +1 -1
- package/dist/libultrahdr.js +1 -1
- package/dist/libultrahdr.umd.js +1 -1
- package/dist/worker-interface.js +2 -2
- package/dist/worker-interface.umd.js +1 -1
- package/dist/worker.js +3 -3
- package/dist/worker.umd.js +1 -1
- package/package.json +25 -25
- package/libultrahdr-wasm/LICENSE +0 -202
- package/libultrahdr-wasm/README.md +0 -99
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [3.0.4](https://github.com/MONOGRID/gainmap-js/compare/v3.0.3...v3.0.4) (2024-04-02)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* adds setRenderer on LoaderBase ([#34](https://github.com/MONOGRID/gainmap-js/issues/34)) ([18ad0ec](https://github.com/MONOGRID/gainmap-js/commit/18ad0eca49d95685b7f78fc4137f4aaf1338e782))
|
|
7
|
+
|
|
1
8
|
## [3.0.3](https://github.com/MONOGRID/gainmap-js/compare/v3.0.2...v3.0.3) (2024-02-09)
|
|
2
9
|
|
|
3
10
|
|
package/README.md
CHANGED
|
@@ -252,6 +252,70 @@ module.exports = defineConfig({
|
|
|
252
252
|
})
|
|
253
253
|
```
|
|
254
254
|
|
|
255
|
+
|
|
256
|
+
Hi, thanks for reporting this.
|
|
257
|
+
I'm afraid this is a documentation issue on my side, I'm going to update the README after resolving this
|
|
258
|
+
Here's a rough draft, let me know if it works for you (I already pushed the `rollup.config.decodeonly.mjs`)
|
|
259
|
+
|
|
260
|
+
## Building with full encoding support (libultrahdr-wasm)
|
|
261
|
+
|
|
262
|
+
Clone the repository with git submodules recursively:
|
|
263
|
+
```bash
|
|
264
|
+
$ git clone --recurse-submodules git@github.com:MONOGRID/gainmap-js.git
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
Proceed to build the libultrahdr-wasm module following the [documentation found here](https://github.com/MONOGRID/libultrahdr-wasm#building), here's a quick summary
|
|
268
|
+
|
|
269
|
+
```bash
|
|
270
|
+
$ cd gainmap-js/libultrahdr-wasm/
|
|
271
|
+
```
|
|
272
|
+
Create a meson "cross compile config" named em.txt and place the following content inside:
|
|
273
|
+
```ini
|
|
274
|
+
[binaries]
|
|
275
|
+
c = 'emcc'
|
|
276
|
+
cpp = 'em++'
|
|
277
|
+
ar = 'emar'
|
|
278
|
+
nm = 'emnm'
|
|
279
|
+
|
|
280
|
+
[host_machine]
|
|
281
|
+
system = 'emscripten'
|
|
282
|
+
cpu_family = 'wasm32'
|
|
283
|
+
cpu = 'wasm32'
|
|
284
|
+
endian = 'little'
|
|
285
|
+
```
|
|
286
|
+
Then execute
|
|
287
|
+
|
|
288
|
+
```bash
|
|
289
|
+
$ meson setup build --cross-file=em.txt
|
|
290
|
+
$ meson compile -C build
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
After compiling the WASM, head back to the main repository
|
|
294
|
+
|
|
295
|
+
```bash
|
|
296
|
+
$ cd ..
|
|
297
|
+
$ npm i
|
|
298
|
+
$ npm run build
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
## Building with no encoding support (requires no wasm)
|
|
302
|
+
|
|
303
|
+
> :warning: Building the library with decode only capabilities will not allow to run playwright e2e tests with `npm run test`
|
|
304
|
+
> this method should only be used by people who would like to customize the "decoding" part of the library but are unable to build the WASM module for some reason (emscripten can be tricky sometimes, I've been there)
|
|
305
|
+
|
|
306
|
+
Clone the repository normally:
|
|
307
|
+
```bash
|
|
308
|
+
$ git clone git@github.com:MONOGRID/gainmap-js.git
|
|
309
|
+
$ cd gainmap-js
|
|
310
|
+
$ npm i
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
build with
|
|
314
|
+
```bash
|
|
315
|
+
$ npm run build --config rollup.config.decodeonly.mjs
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
|
|
255
319
|
## References
|
|
256
320
|
|
|
257
321
|
* [Adobe Gainmap Specification](https://helpx.adobe.com/camera-raw/using/gain-map.html)
|
|
@@ -259,4 +323,4 @@ module.exports = defineConfig({
|
|
|
259
323
|
|
|
260
324
|
|
|
261
325
|
## License
|
|
262
|
-
[](https://app.fossa.com/projects/git%2Bgithub.com%2FMONOGRID%2Fgainmap-js?ref=badge_large)
|
|
326
|
+
[](https://app.fossa.com/projects/git%2Bgithub.com%2FMONOGRID%2Fgainmap-js?ref=badge_large)
|
|
@@ -3,7 +3,7 @@ import { QuadRenderer } from '../../core/QuadRenderer';
|
|
|
3
3
|
import { type GainMapMetadata, QuadRendererTextureOptions } from '../../core/types';
|
|
4
4
|
import { GainMapDecoderMaterial } from '../materials/GainMapDecoderMaterial';
|
|
5
5
|
export declare class LoaderBase<TUrl = string> extends Loader<QuadRenderer<typeof HalfFloatType, GainMapDecoderMaterial>, TUrl> {
|
|
6
|
-
private _renderer
|
|
6
|
+
private _renderer?;
|
|
7
7
|
private _renderTargetOptions?;
|
|
8
8
|
/**
|
|
9
9
|
* @private
|
|
@@ -14,7 +14,14 @@ export declare class LoaderBase<TUrl = string> extends Loader<QuadRenderer<typeo
|
|
|
14
14
|
* @param renderer
|
|
15
15
|
* @param manager
|
|
16
16
|
*/
|
|
17
|
-
constructor(renderer
|
|
17
|
+
constructor(renderer?: WebGLRenderer, manager?: LoadingManager);
|
|
18
|
+
/**
|
|
19
|
+
* Specify the renderer to use when rendering the gain map
|
|
20
|
+
*
|
|
21
|
+
* @param renderer
|
|
22
|
+
* @returns
|
|
23
|
+
*/
|
|
24
|
+
setRenderer(renderer: WebGLRenderer): this;
|
|
18
25
|
/**
|
|
19
26
|
* Specify the renderTarget options to use when rendering the gain map
|
|
20
27
|
*
|
package/dist/decode.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @monogrid/gainmap-js v3.0.
|
|
2
|
+
* @monogrid/gainmap-js v3.0.4
|
|
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-C4ionbnq.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 */ `
|
|
@@ -547,9 +547,20 @@ class LoaderBase extends Loader {
|
|
|
547
547
|
*/
|
|
548
548
|
constructor(renderer, manager) {
|
|
549
549
|
super(manager);
|
|
550
|
-
|
|
550
|
+
if (renderer)
|
|
551
|
+
this._renderer = renderer;
|
|
551
552
|
this._internalLoadingManager = new LoadingManager();
|
|
552
553
|
}
|
|
554
|
+
/**
|
|
555
|
+
* Specify the renderer to use when rendering the gain map
|
|
556
|
+
*
|
|
557
|
+
* @param renderer
|
|
558
|
+
* @returns
|
|
559
|
+
*/
|
|
560
|
+
setRenderer(renderer) {
|
|
561
|
+
this._renderer = renderer;
|
|
562
|
+
return this;
|
|
563
|
+
}
|
|
553
564
|
/**
|
|
554
565
|
* Specify the renderTarget options to use when rendering the gain map
|
|
555
566
|
*
|
|
@@ -565,6 +576,8 @@ class LoaderBase extends Loader {
|
|
|
565
576
|
* @returns
|
|
566
577
|
*/
|
|
567
578
|
prepareQuadRenderer() {
|
|
579
|
+
if (!this._renderer)
|
|
580
|
+
console.warn('WARNING: An existing WebGL Renderer was not passed to this Loader constructor or in setRenderer, the result of this Loader will need to be converted to a Data Texture with toDataTexture() before you can use it in your renderer.');
|
|
568
581
|
// temporary values
|
|
569
582
|
const material = new GainMapDecoderMaterial({
|
|
570
583
|
gainMapMax: [1, 1, 1],
|
package/dist/decode.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @monogrid/gainmap-js v3.0.
|
|
2
|
+
* @monogrid/gainmap-js v3.0.4
|
|
3
3
|
* With ❤️, by MONOGRID <rnd@monogrid.com>
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -843,9 +843,20 @@ void main() {
|
|
|
843
843
|
*/
|
|
844
844
|
constructor(renderer, manager) {
|
|
845
845
|
super(manager);
|
|
846
|
-
|
|
846
|
+
if (renderer)
|
|
847
|
+
this._renderer = renderer;
|
|
847
848
|
this._internalLoadingManager = new three.LoadingManager();
|
|
848
849
|
}
|
|
850
|
+
/**
|
|
851
|
+
* Specify the renderer to use when rendering the gain map
|
|
852
|
+
*
|
|
853
|
+
* @param renderer
|
|
854
|
+
* @returns
|
|
855
|
+
*/
|
|
856
|
+
setRenderer(renderer) {
|
|
857
|
+
this._renderer = renderer;
|
|
858
|
+
return this;
|
|
859
|
+
}
|
|
849
860
|
/**
|
|
850
861
|
* Specify the renderTarget options to use when rendering the gain map
|
|
851
862
|
*
|
|
@@ -861,6 +872,8 @@ void main() {
|
|
|
861
872
|
* @returns
|
|
862
873
|
*/
|
|
863
874
|
prepareQuadRenderer() {
|
|
875
|
+
if (!this._renderer)
|
|
876
|
+
console.warn('WARNING: An existing WebGL Renderer was not passed to this Loader constructor or in setRenderer, the result of this Loader will need to be converted to a Data Texture with toDataTexture() before you can use it in your renderer.');
|
|
864
877
|
// temporary values
|
|
865
878
|
const material = new GainMapDecoderMaterial({
|
|
866
879
|
gainMapMax: [1, 1, 1],
|
package/dist/encode.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @monogrid/gainmap-js v3.0.
|
|
2
|
+
* @monogrid/gainmap-js v3.0.4
|
|
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-CQEeAo-R.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-C4ionbnq.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Utility function to obtain a `DataTexture` from various input formats
|
package/dist/encode.umd.js
CHANGED
package/dist/libultrahdr.js
CHANGED
package/dist/libultrahdr.umd.js
CHANGED
package/dist/worker-interface.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @monogrid/gainmap-js v3.0.
|
|
2
|
+
* @monogrid/gainmap-js v3.0.4
|
|
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-DXfhkIdK.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.
|
|
2
|
+
* @monogrid/gainmap-js v3.0.4
|
|
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-DXfhkIdK.js';
|
|
7
|
+
import { c as compress } from './compress-CQEeAo-R.js';
|
|
8
8
|
|
|
9
9
|
var isPromise$2 = {exports: {}};
|
|
10
10
|
|
package/dist/worker.umd.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monogrid/gainmap-js",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.4",
|
|
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": {
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"check:typecheck-tests": "tsc -p tests",
|
|
92
92
|
"check:eslint-tests": "eslint \"tests/**/*.ts\"",
|
|
93
93
|
"ci:check": "concurrently npm:ci:check:*",
|
|
94
|
-
"ci:check:typecheck-src": "tsc --pretty false > reports/typecheck.log",
|
|
94
|
+
"ci:check:typecheck-src": "tsc --pretty false -p src > reports/typecheck.log",
|
|
95
95
|
"ci:check:eslint-src": "eslint --format json --output-file reports/eslint-src.json \"src/**/*.ts\"",
|
|
96
96
|
"ci:check:typecheck-examples": "tsc --pretty false -p examples > reports/typecheck-examples.log",
|
|
97
97
|
"ci:check:eslint-examples": "eslint --format json --output-file reports/eslint-examples.json \"examples/**/*.{ts,html}\"",
|
|
@@ -105,49 +105,49 @@
|
|
|
105
105
|
"promise-worker-transferable": "^1.0.4"
|
|
106
106
|
},
|
|
107
107
|
"devDependencies": {
|
|
108
|
-
"@playwright/test": "^1.
|
|
108
|
+
"@playwright/test": "^1.42.1",
|
|
109
109
|
"@rollup/plugin-commonjs": "^25.0.7",
|
|
110
110
|
"@rollup/plugin-json": "^6.1.0",
|
|
111
111
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
112
112
|
"@rollup/plugin-terser": "^0.4.4",
|
|
113
113
|
"@rollup/plugin-typescript": "^11.1.6",
|
|
114
114
|
"@semantic-release/changelog": "^6.0.3",
|
|
115
|
-
"@semantic-release/commit-analyzer": "^
|
|
115
|
+
"@semantic-release/commit-analyzer": "^12.0.0",
|
|
116
116
|
"@semantic-release/git": "github:semantic-release/git",
|
|
117
|
-
"@semantic-release/github": "^
|
|
118
|
-
"@semantic-release/npm": "^
|
|
119
|
-
"@semantic-release/release-notes-generator": "^
|
|
120
|
-
"@types/node": "^20.
|
|
121
|
-
"@types/three": "^0.
|
|
122
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
123
|
-
"@typescript-eslint/parser": "^
|
|
117
|
+
"@semantic-release/github": "^10.0.2",
|
|
118
|
+
"@semantic-release/npm": "^12.0.0",
|
|
119
|
+
"@semantic-release/release-notes-generator": "^13.0.0",
|
|
120
|
+
"@types/node": "^20.12.2",
|
|
121
|
+
"@types/three": "^0.163.0",
|
|
122
|
+
"@typescript-eslint/eslint-plugin": "^7.5.0",
|
|
123
|
+
"@typescript-eslint/parser": "^7.5.0",
|
|
124
124
|
"concurrently": "^8.2.2",
|
|
125
125
|
"conventional-changelog-conventionalcommits": "^7.0.2",
|
|
126
126
|
"cz-conventional-changelog": "^3.3.0",
|
|
127
|
-
"eslint": "^8.
|
|
127
|
+
"eslint": "^8.57.0",
|
|
128
128
|
"eslint-config-mdcs": "^5.0.0",
|
|
129
|
-
"eslint-config-standard": "^17.
|
|
129
|
+
"eslint-config-standard": "^17.1.0",
|
|
130
130
|
"eslint-plugin-compat": "^4.2.0",
|
|
131
|
-
"eslint-plugin-html": "^
|
|
131
|
+
"eslint-plugin-html": "^8.0.0",
|
|
132
132
|
"eslint-plugin-import": "^2.29.1",
|
|
133
133
|
"eslint-plugin-n": "^16.6.2",
|
|
134
|
-
"eslint-plugin-promise": "^6.
|
|
135
|
-
"eslint-plugin-simple-import-sort": "^
|
|
136
|
-
"eslint-plugin-unused-imports": "^3.
|
|
134
|
+
"eslint-plugin-promise": "^6.1.1",
|
|
135
|
+
"eslint-plugin-simple-import-sort": "^12.0.0",
|
|
136
|
+
"eslint-plugin-unused-imports": "^3.1.0",
|
|
137
137
|
"nyc": "^15.1.0",
|
|
138
|
-
"rollup": "^4.
|
|
138
|
+
"rollup": "^4.13.2",
|
|
139
139
|
"rollup-plugin-copy": "^3.5.0",
|
|
140
140
|
"rollup-plugin-delete": "^2.0.0",
|
|
141
141
|
"rollup-plugin-istanbul": "^5.0.0",
|
|
142
|
-
"rollup-plugin-license": "^3.
|
|
143
|
-
"semantic-release": "^23.0.
|
|
144
|
-
"servez": "^2.1.
|
|
145
|
-
"sharp": "^0.33.
|
|
146
|
-
"three": "^0.
|
|
147
|
-
"typedoc": "^0.25.
|
|
142
|
+
"rollup-plugin-license": "^3.3.1",
|
|
143
|
+
"semantic-release": "^23.0.6",
|
|
144
|
+
"servez": "^2.1.4",
|
|
145
|
+
"sharp": "^0.33.3",
|
|
146
|
+
"three": "^0.163.0",
|
|
147
|
+
"typedoc": "^0.25.12",
|
|
148
148
|
"typedoc-github-wiki-theme": "^1.1.0",
|
|
149
149
|
"typedoc-plugin-markdown": "^3.17.1",
|
|
150
|
-
"typescript": "^5.
|
|
150
|
+
"typescript": "^5.4.3"
|
|
151
151
|
},
|
|
152
152
|
"browserslist": [
|
|
153
153
|
"> 1%, not dead, not ie 11, not op_mini all"
|
package/libultrahdr-wasm/LICENSE
DELETED
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
Apache License
|
|
3
|
-
Version 2.0, January 2004
|
|
4
|
-
http://www.apache.org/licenses/
|
|
5
|
-
|
|
6
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
-
|
|
8
|
-
1. Definitions.
|
|
9
|
-
|
|
10
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
-
|
|
13
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
-
the copyright owner that is granting the License.
|
|
15
|
-
|
|
16
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
-
other entities that control, are controlled by, or are under common
|
|
18
|
-
control with that entity. For the purposes of this definition,
|
|
19
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
-
direction or management of such entity, whether by contract or
|
|
21
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
-
|
|
24
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
-
exercising permissions granted by this License.
|
|
26
|
-
|
|
27
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
-
including but not limited to software source code, documentation
|
|
29
|
-
source, and configuration files.
|
|
30
|
-
|
|
31
|
-
"Object" form shall mean any form resulting from mechanical
|
|
32
|
-
transformation or translation of a Source form, including but
|
|
33
|
-
not limited to compiled object code, generated documentation,
|
|
34
|
-
and conversions to other media types.
|
|
35
|
-
|
|
36
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
-
Object form, made available under the License, as indicated by a
|
|
38
|
-
copyright notice that is included in or attached to the work
|
|
39
|
-
(an example is provided in the Appendix below).
|
|
40
|
-
|
|
41
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
-
form, that is based on (or derived from) the Work and for which the
|
|
43
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
-
of this License, Derivative Works shall not include works that remain
|
|
46
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
-
the Work and Derivative Works thereof.
|
|
48
|
-
|
|
49
|
-
"Contribution" shall mean any work of authorship, including
|
|
50
|
-
the original version of the Work and any modifications or additions
|
|
51
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
-
means any form of electronic, verbal, or written communication sent
|
|
56
|
-
to the Licensor or its representatives, including but not limited to
|
|
57
|
-
communication on electronic mailing lists, source code control systems,
|
|
58
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
-
excluding communication that is conspicuously marked or otherwise
|
|
61
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
-
|
|
63
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
-
subsequently incorporated within the Work.
|
|
66
|
-
|
|
67
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
-
Work and such Derivative Works in Source or Object form.
|
|
73
|
-
|
|
74
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
-
(except as stated in this section) patent license to make, have made,
|
|
78
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
-
where such license applies only to those patent claims licensable
|
|
80
|
-
by such Contributor that are necessarily infringed by their
|
|
81
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
-
institute patent litigation against any entity (including a
|
|
84
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
-
or contributory patent infringement, then any patent licenses
|
|
87
|
-
granted to You under this License for that Work shall terminate
|
|
88
|
-
as of the date such litigation is filed.
|
|
89
|
-
|
|
90
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
-
modifications, and in Source or Object form, provided that You
|
|
93
|
-
meet the following conditions:
|
|
94
|
-
|
|
95
|
-
(a) You must give any other recipients of the Work or
|
|
96
|
-
Derivative Works a copy of this License; and
|
|
97
|
-
|
|
98
|
-
(b) You must cause any modified files to carry prominent notices
|
|
99
|
-
stating that You changed the files; and
|
|
100
|
-
|
|
101
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
-
that You distribute, all copyright, patent, trademark, and
|
|
103
|
-
attribution notices from the Source form of the Work,
|
|
104
|
-
excluding those notices that do not pertain to any part of
|
|
105
|
-
the Derivative Works; and
|
|
106
|
-
|
|
107
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
-
distribution, then any Derivative Works that You distribute must
|
|
109
|
-
include a readable copy of the attribution notices contained
|
|
110
|
-
within such NOTICE file, excluding those notices that do not
|
|
111
|
-
pertain to any part of the Derivative Works, in at least one
|
|
112
|
-
of the following places: within a NOTICE text file distributed
|
|
113
|
-
as part of the Derivative Works; within the Source form or
|
|
114
|
-
documentation, if provided along with the Derivative Works; or,
|
|
115
|
-
within a display generated by the Derivative Works, if and
|
|
116
|
-
wherever such third-party notices normally appear. The contents
|
|
117
|
-
of the NOTICE file are for informational purposes only and
|
|
118
|
-
do not modify the License. You may add Your own attribution
|
|
119
|
-
notices within Derivative Works that You distribute, alongside
|
|
120
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
-
that such additional attribution notices cannot be construed
|
|
122
|
-
as modifying the License.
|
|
123
|
-
|
|
124
|
-
You may add Your own copyright statement to Your modifications and
|
|
125
|
-
may provide additional or different license terms and conditions
|
|
126
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
-
the conditions stated in this License.
|
|
130
|
-
|
|
131
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
-
this License, without any additional terms or conditions.
|
|
135
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
-
the terms of any separate license agreement you may have executed
|
|
137
|
-
with Licensor regarding such Contributions.
|
|
138
|
-
|
|
139
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
-
except as required for reasonable and customary use in describing the
|
|
142
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
-
|
|
144
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
-
implied, including, without limitation, any warranties or conditions
|
|
149
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
-
appropriateness of using or redistributing the Work and assume any
|
|
152
|
-
risks associated with Your exercise of permissions under this License.
|
|
153
|
-
|
|
154
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
-
unless required by applicable law (such as deliberate and grossly
|
|
157
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
-
liable to You for damages, including any direct, indirect, special,
|
|
159
|
-
incidental, or consequential damages of any character arising as a
|
|
160
|
-
result of this License or out of the use or inability to use the
|
|
161
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
-
other commercial damages or losses), even if such Contributor
|
|
164
|
-
has been advised of the possibility of such damages.
|
|
165
|
-
|
|
166
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
-
or other liability obligations and/or rights consistent with this
|
|
170
|
-
License. However, in accepting such obligations, You may act only
|
|
171
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
-
defend, and hold each Contributor harmless for any liability
|
|
174
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
-
of your accepting any such warranty or additional liability.
|
|
176
|
-
|
|
177
|
-
END OF TERMS AND CONDITIONS
|
|
178
|
-
|
|
179
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
-
|
|
181
|
-
To apply the Apache License to your work, attach the following
|
|
182
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
-
replaced with your own identifying information. (Don't include
|
|
184
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
-
comment syntax for the file format. We also recommend that a
|
|
186
|
-
file or class name and description of purpose be included on the
|
|
187
|
-
same "printed page" as the copyright notice for easier
|
|
188
|
-
identification within third-party archives.
|
|
189
|
-
|
|
190
|
-
Copyright [yyyy] [name of copyright owner]
|
|
191
|
-
|
|
192
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
-
you may not use this file except in compliance with the License.
|
|
194
|
-
You may obtain a copy of the License at
|
|
195
|
-
|
|
196
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
-
|
|
198
|
-
Unless required by applicable law or agreed to in writing, software
|
|
199
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
-
See the License for the specific language governing permissions and
|
|
202
|
-
limitations under the License.
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
# libultrahdr wasm
|
|
2
|
-
|
|
3
|
-
WASM version of the [libultrahdr](https://github.com/google/libultrahdr) library.
|
|
4
|
-
|
|
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
|
-
|
|
7
|
-
This library is provided "as-is" and not tested nor optimized for general use.
|
|
8
|
-
|
|
9
|
-
## Format Introduction
|
|
10
|
-
https://developer.android.com/guide/topics/media/platform/hdr-image-format
|
|
11
|
-
|
|
12
|
-
## WASM Bindings
|
|
13
|
-
|
|
14
|
-
At the time of writing (2023-10-20): The only exposed function is `appendGainMap` which can be used like this:
|
|
15
|
-
|
|
16
|
-
```js
|
|
17
|
-
import libultrahdr from './build/libultrahdr-esm.js'
|
|
18
|
-
const libraryInstance = await libultrahdr()
|
|
19
|
-
|
|
20
|
-
// given:
|
|
21
|
-
// # width: width of the final image
|
|
22
|
-
// # height: height of the final image
|
|
23
|
-
// # sdr: Uint8Array containing the SDR rendition encoded in jpeg
|
|
24
|
-
// # gainmap: Uint8Array containing the Gainmap encoded in jpeg
|
|
25
|
-
// # metadata: an object containing the parameters of the gainmap
|
|
26
|
-
|
|
27
|
-
const result = libraryInstance.appendGainMap(
|
|
28
|
-
width, height,
|
|
29
|
-
sdr, sdr.length,
|
|
30
|
-
gainmap, gainmap.length,
|
|
31
|
-
metadata.gainMapMax, metadata.gainMapMin,
|
|
32
|
-
metadata.mapGamma, metadata.offsetSdr, metadata.offsetHdr,
|
|
33
|
-
metadata.hdrCapacityMin, metadata.hdrCapacityMax
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
// result in an Uint8Array of a jpeg file (sdr rendition) with the gainMap "appended" (XMP metadata + MPF Binary gainmap)
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
further investigation is needed in order to integrate more bindings, especially given the library contains `libjpeg-turbo` which is completely unused at the moment.
|
|
40
|
-
|
|
41
|
-
It has the potential to handle the complete encoding of a gainmap jpeg given raw YUV440 HDR Data (as per the upstream repository intended usage).
|
|
42
|
-
|
|
43
|
-
## Testing Locally
|
|
44
|
-
|
|
45
|
-
After building, start a server with `python -m http.server` in the root of the project and open `http://localhost:8000`, you will have an HTML page which can be used to load the files expected by the `appendGainMap` function.
|
|
46
|
-
|
|
47
|
-
Once all the files are provided the page will download a JPEG with appended gainmap.
|
|
48
|
-
|
|
49
|
-
## Building Requirements
|
|
50
|
-
|
|
51
|
-
* Requires **emscripten**: follow [this guide](https://emscripten.org/docs/getting_started/downloads.html) to download it and setup it.
|
|
52
|
-
* Requires [python 3](https://www.python.org/downloads/)
|
|
53
|
-
* Requires python module **meson**: install it with `pip3 install --user meson`
|
|
54
|
-
* Requires python module **ninja**: install it with `pip3 install --user ninja`
|
|
55
|
-
|
|
56
|
-
make sure the globally installed python scripts folder is included in your OS Path.
|
|
57
|
-
|
|
58
|
-
## Building
|
|
59
|
-
|
|
60
|
-
Create a meson "cross compile config" named `em.txt` and place the following content inside:
|
|
61
|
-
|
|
62
|
-
```ini
|
|
63
|
-
[binaries]
|
|
64
|
-
c = 'emcc'
|
|
65
|
-
cpp = 'em++'
|
|
66
|
-
ar = 'emar'
|
|
67
|
-
nm = 'emnm'
|
|
68
|
-
|
|
69
|
-
[host_machine]
|
|
70
|
-
system = 'emscripten'
|
|
71
|
-
cpu_family = 'wasm32'
|
|
72
|
-
cpu = 'wasm32'
|
|
73
|
-
endian = 'little'
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
this assumes the path to `em++`, `emcc` etc is globally accessible (i.e. added to PATH).
|
|
77
|
-
|
|
78
|
-
on Windows you may need to specify the full path for binaries like this
|
|
79
|
-
|
|
80
|
-
```ini
|
|
81
|
-
[binaries]
|
|
82
|
-
c = 'C:\path\to\emsdk\upstream\emscripten\emnm.bat'
|
|
83
|
-
cpp = 'C:\path\to\emsdk\upstream\emscripten\emnm.bat'
|
|
84
|
-
ar = 'C:\path\to\emsdk\upstream\emscripten\emnm.bat'
|
|
85
|
-
nm = 'C:\path\to\emsdk\upstream\emscripten\emnm.bat'
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
### Build commands
|
|
89
|
-
|
|
90
|
-
```bash
|
|
91
|
-
$ meson setup build --cross-file=em.txt
|
|
92
|
-
$ meson compile -C build
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
the `build` folder will contain the compiled wasm files in multiple versions
|
|
96
|
-
|
|
97
|
-
1. `libultrahdr-debug.js` is the ESM debug version with source maps enabled
|
|
98
|
-
2. `libultrahdr-esm.js` is the release version compiled in ESM
|
|
99
|
-
3. `libultrahdr.js` is the release version without ESM
|