@monogrid/gainmap-js 1.1.0 → 2.0.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.
Files changed (51) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +21 -8
  3. package/dist/QuadRenderer-IDZuHqZM.js +178 -0
  4. package/dist/{_commonjsHelpers-1789f0cf.js → _commonjsHelpers-G_2thcKl.js} +1 -1
  5. package/dist/{compress-a4b59cab.js → compress-Cw5IwRTb.js} +1 -1
  6. package/dist/{loaders → core}/LoaderBase.d.ts +3 -3
  7. package/dist/{utils → core}/QuadRenderer.d.ts +6 -0
  8. package/dist/core/types.d.ts +64 -0
  9. package/dist/decode/decode.d.ts +56 -0
  10. package/dist/decode/extract.d.ts +10 -0
  11. package/dist/decode/index.d.ts +8 -0
  12. package/dist/{loaders → decode/loaders}/GainMapLoader.d.ts +4 -4
  13. package/dist/{loaders → decode/loaders}/JPEGRLoader.d.ts +5 -5
  14. package/dist/{materials → decode/materials}/GainMapDecoderMaterial.d.ts +3 -2
  15. package/dist/decode/types.d.ts +38 -0
  16. package/dist/decode/utils/MPFExtractor.d.ts +22 -0
  17. package/dist/decode/utils/extract-metadata-from-jpeg.d.ts +7 -0
  18. package/dist/decode.d.ts +1 -56
  19. package/dist/decode.js +737 -0
  20. package/dist/decode.umd.js +917 -0
  21. package/dist/{encode-utils → encode}/compress.d.ts +1 -1
  22. package/dist/encode/encode-and-compress.d.ts +61 -0
  23. package/dist/encode/encode.d.ts +58 -0
  24. package/dist/{encode-utils → encode}/get-gainmap.d.ts +3 -3
  25. package/dist/{encode-utils → encode}/get-sdr-rendition.d.ts +4 -5
  26. package/dist/encode/index.d.ts +10 -0
  27. package/dist/encode/types.d.ts +172 -0
  28. package/dist/encode.d.ts +1 -117
  29. package/dist/{index.js → encode.js} +42 -230
  30. package/dist/encode.umd.js +972 -0
  31. package/dist/libultrahdr/decode-jpeg-metadata.d.ts +31 -0
  32. package/dist/libultrahdr/encode-jpeg-metadata.d.ts +84 -0
  33. package/dist/libultrahdr/library.d.ts +9 -0
  34. package/dist/libultrahdr.d.ts +3 -123
  35. package/dist/libultrahdr.js +92 -167
  36. package/dist/libultrahdr.umd.js +91 -530
  37. package/dist/worker-interface.js +2 -2
  38. package/dist/worker-interface.umd.js +1 -3
  39. package/dist/worker-types.d.ts +2 -2
  40. package/dist/worker.js +3 -3
  41. package/dist/worker.umd.js +1 -1
  42. package/package.json +36 -29
  43. package/dist/LoaderBase-aa4842c4.js +0 -373
  44. package/dist/index.d.ts +0 -11
  45. package/dist/index.umd.js +0 -1360
  46. package/dist/materials/index.d.ts +0 -3
  47. package/dist/types.d.ts +0 -262
  48. /package/dist/{utils → core}/get-data-texture.d.ts +0 -0
  49. /package/dist/{encode-utils → encode}/find-texture-min-max.d.ts +0 -0
  50. /package/dist/{materials → encode/materials}/GainMapEncoderMaterial.d.ts +0 -0
  51. /package/dist/{materials → encode/materials}/SDRMaterial.d.ts +0 -0
@@ -1,3 +0,0 @@
1
- export * from './GainMapDecoderMaterial';
2
- export * from './GainMapEncoderMaterial';
3
- export * from './SDRMaterial';
package/dist/types.d.ts DELETED
@@ -1,262 +0,0 @@
1
- import { type DataTexture, Texture, ToneMapping, type WebGLRenderer } from 'three';
2
- import { type EXR } from 'three/examples/jsm/loaders/EXRLoader';
3
- import { type LogLuv } from 'three/examples/jsm/loaders/LogLuvLoader';
4
- import { type RGBE } from 'three/examples/jsm/loaders/RGBELoader';
5
- import { type WorkerInterfaceImplementation } from './worker-types';
6
- /**
7
- * This is the Metadata stored in an encoded Gainmap which is used
8
- * to decode it and return an HDR image
9
- *
10
- * @category Gainmap Specifications
11
- * @group Gainmap Specifications
12
- */
13
- export type GainMapMetadata = {
14
- /**
15
- * This is the gamma to apply to the stored map values.
16
- * @defaultValue [1, 1, 1]
17
- * @remarks
18
- * * Typically you can use a gamma of 1.0.
19
- * * You can use a different value if your gain map has a very uneven distribution of log_recovery(x, y) values.
20
- *
21
- * For example, this might apply if a gain map has a lot of detail just above SDR range (represented as small log_recovery(x, y) values), and a very large map_max_log2 for the top end of the HDR rendition's desired brightness (represented by large log_recovery(x, y) values). In this case, you can use a map_gamma higher than 1.0 so that recovery(x, y) can precisely encode the detail in both the low end and high end of log_recovery(x, y).
22
- */
23
- gamma: [number, number, number];
24
- /**
25
- * This is log2 of the minimum display boost value for which the map is applied at all.
26
- *
27
- * @remarks
28
- * * This value also affects how much to apply the gain map based on the display boost.
29
- * * Must be 0.0 or greater.
30
- *
31
- * @remarks Logarithmic space
32
- */
33
- hdrCapacityMin: number;
34
- /**
35
- * Stores the value of hdr_capacity_max. This is log2 of the maximum display boost value for which the map is applied completely.
36
- *
37
- * @remarks
38
- * * This value also affects how much to apply the gain map based on the display boost.
39
- * * Must be greater than hdrCapacityMin.
40
- * * Required.
41
- *
42
- * @remarks Logarithmic space
43
- */
44
- hdrCapacityMax: number;
45
- /**
46
- * This is the offset to apply to the SDR pixel values during gain map generation and application
47
- * @defaultValue [1/64, 1/64, 1/64]
48
- */
49
- offsetSdr: [number, number, number];
50
- /**
51
- * This is the offset to apply to the HDR pixel values during gain map generation and application.
52
- * @defaultValue [1/64, 1/64, 1/64]
53
- */
54
- offsetHdr: [number, number, number];
55
- /**
56
- * This is log2 of min content boost, which is the minimum allowed ratio of
57
- * the linear luminance for the target HDR rendition relative to
58
- * (divided by) that of the SDR image, at a given pixel.
59
- */
60
- gainMapMin: [number, number, number];
61
- /**
62
- * This is log2 of max content boost, which is the maximum allowed ratio of
63
- * the linear luminance for the Target HDR rendition relative to
64
- * (divided by) that of the SDR image, at a given pixel.
65
- */
66
- gainMapMax: [number, number, number];
67
- };
68
- /**
69
- * Parameters used by content Creators in order to create a GainMap
70
- * @category Gainmap Specifications
71
- * @group Gainmap Specifications
72
- */
73
- export type GainmapEncodingParameters = {
74
- /**
75
- * This is the offset to apply to the HDR pixel values during gain map generation and application.
76
- * @defaultValue [1/64, 1/64, 1/64]
77
- */
78
- offsetHdr?: [number, number, number];
79
- /**
80
- * This is the offset to apply to the SDR pixel values during gain map generation and application
81
- * @defaultValue [1/64, 1/64, 1/64]
82
- */
83
- offsetSdr?: [number, number, number];
84
- /**
85
- * This value lets the content creator constrain how much darker an image can get, when shown on an HDR display, relative to the SDR rendition. This value is a constant for a particular image.
86
- * @defaultValue 1
87
- * @remarks
88
- * * If, for example, the value is 0.5, then for any given pixel, the linear luminance of the displayed HDR rendition must be (at the least) 0.5x the linear luminance of the SDR rendition.
89
- * * In practice, this value is typically equal to or just less than 1.0.
90
- * * Always less than or equal to Max content boost.
91
- *
92
- * @remarks Non Logarithmic space
93
- */
94
- minContentBoost?: number;
95
- /**
96
- * This value lets the content creator constrain how much brighter an image can get, when shown on an HDR display, relative to the SDR rendition.
97
- *
98
- * @remarks
99
- * * This value is a constant for a particular image. For example, if the value is four, then for any given pixel, the linear luminance of the displayed HDR rendition must be, at the most, 4x the linear luminance of the SDR rendition. In practice, this means that the brighter parts of the scene can be shown up to 4x brighter.
100
- * * In practice, this value is typically greater than 1.0.
101
- * * Always greater than or equal to Min content boost.
102
- *
103
- * @remarks Non Logarithmic space
104
- */
105
- maxContentBoost: number;
106
- /**
107
- * This is the gamma to apply to the stored map values.
108
- *
109
- * @defaultValue [1, 1, 1]
110
- * @remarks
111
- * * Typically you can use a gamma of 1.0.
112
- * * You can use a different value if your gain map has a very uneven distribution of log_recovery(x, y) values.
113
- * For example, this might apply if a gain map has a lot of detail just above SDR range (represented as small log_recovery(x, y) values), and a very large map_max_log2 for the top end of the HDR rendition's desired brightness (represented by large log_recovery(x, y) values). In this case, you can use a map_gamma higher than 1.0 so that recovery(x, y) can precisely encode the detail in both the low end and high end of log_recovery(x, y).
114
- */
115
- gamma?: [number, number, number];
116
- };
117
- /**
118
- * Parameters for decoding a Gainmap
119
- *
120
- * @category Gainmap Specifications
121
- * @group Gainmap Specifications
122
- */
123
- export type GainmapDecodingParameters = {
124
- /**
125
- * The maximum available boost supported by a display, at a given point in time.
126
- *
127
- * @remarks
128
- * This value can change over time based on device settings and other factors,
129
- * such as ambient light conditions, or how many bright pixels are on the screen.
130
- *
131
- * @remarks Non Logarithmic space
132
- */
133
- maxDisplayBoost: number;
134
- };
135
- /**
136
- * Paramaters used to Encode a GainMap
137
- *
138
- * @category Encoding Parameters
139
- * @group Encoding Parameters
140
- */
141
- export type EncodingParametersBase = GainmapEncodingParameters & {
142
- /**
143
- * Input image for encoding, must be an HDR image
144
- */
145
- image: EXR | RGBE | LogLuv | DataTexture;
146
- /**
147
- * Optional WebGLRenderer
148
- * @remarks
149
- * will be created and destroyed on demand if not provided.
150
- */
151
- renderer?: WebGLRenderer;
152
- /**
153
- * Optional tonemapping to apply to the SDR Rendition
154
- * @defaultValue `ACESFilmicToneMapping`
155
- */
156
- toneMapping?: ToneMapping;
157
- };
158
- /**
159
- * This library can provide gainmap compressed in these mimeTypes
160
- *
161
- * @category Compression
162
- * @group Compression
163
- */
164
- export type CompressionMimeType = 'image/png' | 'image/jpeg' | 'image/webp';
165
- /**
166
- * Accepted HDR image buffers, definitions coming from the THREE.js Library types
167
- *
168
- * @category General
169
- * @group General
170
- */
171
- export type HDRRawImageBuffer = EXR['data'] | RGBE['data'] | LogLuv['data'];
172
- /**
173
- * Raw HDR image data
174
- *
175
- * @category General
176
- * @group General
177
- */
178
- export type HDRRawImage = {
179
- data: HDRRawImageBuffer;
180
- width: number;
181
- height: number;
182
- };
183
- /**
184
- * Options for compressing a RAW RGBA image into the specified mimeType
185
- *
186
- * @category Compression
187
- * @group Compression
188
- */
189
- export type CompressOptions = {
190
- /**
191
- * The mimeType of the output
192
- */
193
- mimeType: CompressionMimeType;
194
- /**
195
- * Encoding quality [0-1]
196
- */
197
- quality?: number;
198
- /**
199
- * FlipY of the encoding process
200
- */
201
- flipY?: boolean;
202
- };
203
- /**
204
- * Data structure representing a compressed image with a mimeType
205
- *
206
- * @category Compression
207
- * @group Compression
208
- */
209
- export type CompressedImage = {
210
- data: Uint8Array;
211
- mimeType: CompressionMimeType;
212
- width: number;
213
- height: number;
214
- };
215
- /**
216
- * @category Compression
217
- * @group Compression
218
- */
219
- export type CompressParameters = CompressOptions & ({
220
- /**
221
- * RAW RGBA Image Data
222
- */
223
- source: ImageData;
224
- } | {
225
- /**
226
- * Encoded Image Data with a mimeType
227
- */
228
- source: Uint8Array | Uint8ClampedArray;
229
- /**
230
- * mimeType of the encoded input
231
- */
232
- sourceMimeType: string;
233
- });
234
- /**
235
- * Additional parameters to encode a GainMap compressed with a mimeType
236
- * @category Encoding Parameters
237
- * @group Encoding Parameters
238
- */
239
- export type EncodingParametersWithCompression = EncodingParametersBase & CompressOptions & {
240
- /**
241
- * Encodes the Gainmap using a Web Worker
242
- */
243
- withWorker?: WorkerInterfaceImplementation;
244
- };
245
- /**
246
- * @category Decoding
247
- * @group Decoding
248
- */
249
- export type DecodeParameters = {
250
- /**
251
- * An Texture containing the SDR Rendition
252
- */
253
- sdr: Texture;
254
- /**
255
- * An Texture containing the GainMap recovery image
256
- */
257
- gainMap: Texture;
258
- /**
259
- * WebGLRenderer used to decode the GainMap
260
- */
261
- renderer?: WebGLRenderer;
262
- } & GainmapDecodingParameters & GainMapMetadata;
File without changes