@monogrid/gainmap-js 1.0.2 → 1.1.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 (48) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +103 -19
  3. package/dist/LoaderBase-aa4842c4.js +373 -0
  4. package/dist/_commonjsHelpers-1789f0cf.js +1 -1
  5. package/dist/compress-a4b59cab.js +1 -1
  6. package/dist/decode.d.ts +25 -6
  7. package/dist/index.d.ts +1 -1
  8. package/dist/index.js +173 -246
  9. package/dist/index.umd.js +305 -14
  10. package/dist/libultrahdr-esm.wasm +0 -0
  11. package/dist/libultrahdr.d.ts +14 -19
  12. package/dist/libultrahdr.js +245 -203
  13. package/dist/libultrahdr.umd.js +611 -206
  14. package/dist/loaders/GainMapLoader.d.ts +68 -0
  15. package/dist/loaders/JPEGRLoader.d.ts +60 -0
  16. package/dist/loaders/LoaderBase.d.ts +27 -0
  17. package/dist/materials/GainMapDecoderMaterial.d.ts +44 -1
  18. package/dist/materials/GainMapEncoderMaterial.d.ts +29 -2
  19. package/dist/types.d.ts +10 -0
  20. package/dist/utils/QuadRenderer.d.ts +2 -1
  21. package/dist/worker-interface.js +1 -1
  22. package/dist/worker-interface.umd.js +1 -1
  23. package/dist/worker.js +1 -1
  24. package/dist/worker.umd.js +1 -1
  25. package/libultrahdr-wasm/build/libultrahdr-debug.js +156 -182
  26. package/libultrahdr-wasm/build/libultrahdr-debug.wasm +0 -0
  27. package/libultrahdr-wasm/build/libultrahdr-esm.js +153 -182
  28. package/libultrahdr-wasm/build/libultrahdr-esm.wasm +0 -0
  29. package/libultrahdr-wasm/build/libultrahdr.js +151 -180
  30. package/libultrahdr-wasm/build/libultrahdr.wasm +0 -0
  31. package/package.json +1 -1
  32. package/examples/README.md +0 -3
  33. package/examples/compress.ts +0 -43
  34. package/examples/decode-from-jpeg.ts +0 -40
  35. package/examples/decode-from-separate-data.ts +0 -41
  36. package/examples/decode-to-datatexture.ts +0 -65
  37. package/examples/encode-and-compress.ts +0 -29
  38. package/examples/encode-jpeg-metadata.ts +0 -57
  39. package/examples/encode.ts +0 -28
  40. package/examples/globals.d.ts +0 -6
  41. package/examples/worker.ts +0 -41
  42. package/reports/eslint-examples.json +0 -1
  43. package/reports/eslint-src.json +0 -1
  44. package/reports/eslint-tests.json +0 -1
  45. package/reports/junit.xml +0 -35
  46. package/reports/typecheck-examples.log +0 -0
  47. package/reports/typecheck-tests.log +0 -0
  48. package/reports/typecheck.log +0 -0
@@ -335,7 +335,7 @@ assert(!ENVIRONMENT_IS_SHELL, "shell environment detected but not enabled at bui
335
335
  // An online HTML version (which may be of a different version of Emscripten)
336
336
  // is up at http://kripken.github.io/emscripten-site/docs/api_reference/preamble.js.html
337
337
 
338
- var wasmBinary;
338
+ var wasmBinary;
339
339
  if (Module['wasmBinary']) wasmBinary = Module['wasmBinary'];legacyModuleProp('wasmBinary', 'wasmBinary');
340
340
 
341
341
  if (typeof WebAssembly != 'object') {
@@ -359,6 +359,10 @@ var ABORT = false;
359
359
  // but only when noExitRuntime is false.
360
360
  var EXITSTATUS;
361
361
 
362
+ // In STRICT mode, we only define assert() when ASSERTIONS is set. i.e. we
363
+ // don't define it at all in release modes. This matches the behaviour of
364
+ // MINIMAL_RUNTIME.
365
+ // TODO(sbc): Make this the default even without STRICT enabled.
362
366
  /** @type {function(*, string=)} */
363
367
  function assert(condition, text) {
364
368
  if (!condition) {
@@ -1210,10 +1214,7 @@ function dbg(text) {
1210
1214
  var setter = field.setter;
1211
1215
  var setterContext = field.setterContext;
1212
1216
  fields[fieldName] = {
1213
- read: (ptr) => {
1214
- return getterReturnType['fromWireType'](
1215
- getter(getterContext, ptr));
1216
- },
1217
+ read: (ptr) => getterReturnType['fromWireType'](getter(getterContext, ptr)),
1217
1218
  write: (ptr, o) => {
1218
1219
  var destructors = [];
1219
1220
  setter(setterContext, ptr, setterArgumentType['toWireType'](destructors, o));
@@ -1480,33 +1481,12 @@ function dbg(text) {
1480
1481
  });
1481
1482
  };
1482
1483
 
1483
- var char_0 = 48;
1484
-
1485
- var char_9 = 57;
1486
- var makeLegalFunctionName = (name) => {
1487
- if (undefined === name) {
1488
- return '_unknown';
1489
- }
1490
- name = name.replace(/[^a-zA-Z0-9_]/g, '$');
1491
- var f = name.charCodeAt(0);
1492
- if (f >= char_0 && f <= char_9) {
1493
- return `_${name}`;
1494
- }
1495
- return name;
1496
- };
1484
+ var createNamedFunction = (name, body) => Object.defineProperty(body, 'name', {
1485
+ value: name
1486
+ });
1497
1487
 
1498
1488
 
1499
1489
 
1500
- function createNamedFunction(name, body) {
1501
- name = makeLegalFunctionName(name);
1502
- // Use an abject with a computed property name to create a new function with
1503
- // a name specified at runtime, but without using `new Function` or `eval`.
1504
- return {
1505
- [name]: function() {
1506
- return body.apply(this, arguments);
1507
- }
1508
- }[name];
1509
- }
1510
1490
  function newFunc(constructor, argumentList) {
1511
1491
  if (!(constructor instanceof Function)) {
1512
1492
  throw new TypeError(`new_ called with constructor type ${typeof(constructor)} which is not a function`);
@@ -1575,7 +1555,7 @@ function dbg(text) {
1575
1555
  }
1576
1556
 
1577
1557
  var invokerFnBody = `
1578
- return function ${makeLegalFunctionName(humanName)}(${argsList}) {
1558
+ return function (${argsList}) {
1579
1559
  if (arguments.length !== ${argCount - 2}) {
1580
1560
  throwBindingError('function ${humanName} called with ' + arguments.length + ' arguments, expected ${argCount - 2}');
1581
1561
  }`;
@@ -1628,7 +1608,8 @@ function dbg(text) {
1628
1608
 
1629
1609
  args1.push(invokerFnBody);
1630
1610
 
1631
- return newFunc(Function, args1).apply(null, args2);
1611
+ var invokerFn = newFunc(Function, args1).apply(null, args2);
1612
+ return createNamedFunction(humanName, invokerFn);
1632
1613
  }
1633
1614
 
1634
1615
  var ensureOverloadTable = (proto, methodName, humanName) => {
@@ -1960,7 +1941,7 @@ function dbg(text) {
1960
1941
 
1961
1942
 
1962
1943
  var stringToUTF8Array = (str, heap, outIdx, maxBytesToWrite) => {
1963
- assert(typeof str === 'string');
1944
+ assert(typeof str === 'string', `stringToUTF8Array expects a string (got ${typeof str})`);
1964
1945
  // Parameter maxBytesToWrite is not optional. Negative values, 0, null,
1965
1946
  // undefined and false each don't write out any bytes.
1966
1947
  if (!(maxBytesToWrite > 0))
@@ -2104,7 +2085,7 @@ function dbg(text) {
2104
2085
  * @return {string}
2105
2086
  */
2106
2087
  var UTF8ToString = (ptr, maxBytesToRead) => {
2107
- assert(typeof ptr == 'number');
2088
+ assert(typeof ptr == 'number', `UTF8ToString expects a number (got ${typeof ptr})`);
2108
2089
  return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : '';
2109
2090
  };
2110
2091
  var __embind_register_std_string = (rawType, name) => {
@@ -2478,9 +2459,7 @@ function dbg(text) {
2478
2459
  return symbol;
2479
2460
  };
2480
2461
 
2481
- var __emval_new_cstring = (v) => {
2482
- return Emval.toHandle(getStringOrSymbol(v));
2483
- };
2462
+ var __emval_new_cstring = (v) => Emval.toHandle(getStringOrSymbol(v));
2484
2463
 
2485
2464
 
2486
2465
 
@@ -2695,9 +2674,7 @@ function dbg(text) {
2695
2674
  var paths = Array.prototype.slice.call(arguments);
2696
2675
  return PATH.normalize(paths.join('/'));
2697
2676
  },
2698
- join2:(l, r) => {
2699
- return PATH.normalize(l + '/' + r);
2700
- },
2677
+ join2:(l, r) => PATH.normalize(l + '/' + r),
2701
2678
  };
2702
2679
 
2703
2680
  var initRandomFill = () => {
@@ -3365,7 +3342,7 @@ function dbg(text) {
3365
3342
 
3366
3343
 
3367
3344
  var FS_createDataFile = (parent, name, fileData, canRead, canWrite, canOwn) => {
3368
- return FS.createDataFile(parent, name, fileData, canRead, canWrite, canOwn);
3345
+ FS.createDataFile(parent, name, fileData, canRead, canWrite, canOwn);
3369
3346
  };
3370
3347
 
3371
3348
  var preloadPlugins = Module['preloadPlugins'] || [];
@@ -3562,7 +3539,128 @@ function dbg(text) {
3562
3539
  };
3563
3540
 
3564
3541
  var ERRNO_CODES = {
3565
- };
3542
+ 'EPERM': 63,
3543
+ 'ENOENT': 44,
3544
+ 'ESRCH': 71,
3545
+ 'EINTR': 27,
3546
+ 'EIO': 29,
3547
+ 'ENXIO': 60,
3548
+ 'E2BIG': 1,
3549
+ 'ENOEXEC': 45,
3550
+ 'EBADF': 8,
3551
+ 'ECHILD': 12,
3552
+ 'EAGAIN': 6,
3553
+ 'EWOULDBLOCK': 6,
3554
+ 'ENOMEM': 48,
3555
+ 'EACCES': 2,
3556
+ 'EFAULT': 21,
3557
+ 'ENOTBLK': 105,
3558
+ 'EBUSY': 10,
3559
+ 'EEXIST': 20,
3560
+ 'EXDEV': 75,
3561
+ 'ENODEV': 43,
3562
+ 'ENOTDIR': 54,
3563
+ 'EISDIR': 31,
3564
+ 'EINVAL': 28,
3565
+ 'ENFILE': 41,
3566
+ 'EMFILE': 33,
3567
+ 'ENOTTY': 59,
3568
+ 'ETXTBSY': 74,
3569
+ 'EFBIG': 22,
3570
+ 'ENOSPC': 51,
3571
+ 'ESPIPE': 70,
3572
+ 'EROFS': 69,
3573
+ 'EMLINK': 34,
3574
+ 'EPIPE': 64,
3575
+ 'EDOM': 18,
3576
+ 'ERANGE': 68,
3577
+ 'ENOMSG': 49,
3578
+ 'EIDRM': 24,
3579
+ 'ECHRNG': 106,
3580
+ 'EL2NSYNC': 156,
3581
+ 'EL3HLT': 107,
3582
+ 'EL3RST': 108,
3583
+ 'ELNRNG': 109,
3584
+ 'EUNATCH': 110,
3585
+ 'ENOCSI': 111,
3586
+ 'EL2HLT': 112,
3587
+ 'EDEADLK': 16,
3588
+ 'ENOLCK': 46,
3589
+ 'EBADE': 113,
3590
+ 'EBADR': 114,
3591
+ 'EXFULL': 115,
3592
+ 'ENOANO': 104,
3593
+ 'EBADRQC': 103,
3594
+ 'EBADSLT': 102,
3595
+ 'EDEADLOCK': 16,
3596
+ 'EBFONT': 101,
3597
+ 'ENOSTR': 100,
3598
+ 'ENODATA': 116,
3599
+ 'ETIME': 117,
3600
+ 'ENOSR': 118,
3601
+ 'ENONET': 119,
3602
+ 'ENOPKG': 120,
3603
+ 'EREMOTE': 121,
3604
+ 'ENOLINK': 47,
3605
+ 'EADV': 122,
3606
+ 'ESRMNT': 123,
3607
+ 'ECOMM': 124,
3608
+ 'EPROTO': 65,
3609
+ 'EMULTIHOP': 36,
3610
+ 'EDOTDOT': 125,
3611
+ 'EBADMSG': 9,
3612
+ 'ENOTUNIQ': 126,
3613
+ 'EBADFD': 127,
3614
+ 'EREMCHG': 128,
3615
+ 'ELIBACC': 129,
3616
+ 'ELIBBAD': 130,
3617
+ 'ELIBSCN': 131,
3618
+ 'ELIBMAX': 132,
3619
+ 'ELIBEXEC': 133,
3620
+ 'ENOSYS': 52,
3621
+ 'ENOTEMPTY': 55,
3622
+ 'ENAMETOOLONG': 37,
3623
+ 'ELOOP': 32,
3624
+ 'EOPNOTSUPP': 138,
3625
+ 'EPFNOSUPPORT': 139,
3626
+ 'ECONNRESET': 15,
3627
+ 'ENOBUFS': 42,
3628
+ 'EAFNOSUPPORT': 5,
3629
+ 'EPROTOTYPE': 67,
3630
+ 'ENOTSOCK': 57,
3631
+ 'ENOPROTOOPT': 50,
3632
+ 'ESHUTDOWN': 140,
3633
+ 'ECONNREFUSED': 14,
3634
+ 'EADDRINUSE': 3,
3635
+ 'ECONNABORTED': 13,
3636
+ 'ENETUNREACH': 40,
3637
+ 'ENETDOWN': 38,
3638
+ 'ETIMEDOUT': 73,
3639
+ 'EHOSTDOWN': 142,
3640
+ 'EHOSTUNREACH': 23,
3641
+ 'EINPROGRESS': 26,
3642
+ 'EALREADY': 7,
3643
+ 'EDESTADDRREQ': 17,
3644
+ 'EMSGSIZE': 35,
3645
+ 'EPROTONOSUPPORT': 66,
3646
+ 'ESOCKTNOSUPPORT': 137,
3647
+ 'EADDRNOTAVAIL': 4,
3648
+ 'ENETRESET': 39,
3649
+ 'EISCONN': 30,
3650
+ 'ENOTCONN': 53,
3651
+ 'ETOOMANYREFS': 141,
3652
+ 'EUSERS': 136,
3653
+ 'EDQUOT': 19,
3654
+ 'ESTALE': 72,
3655
+ 'ENOTSUP': 138,
3656
+ 'ENOMEDIUM': 148,
3657
+ 'EILSEQ': 25,
3658
+ 'EOVERFLOW': 61,
3659
+ 'ECANCELED': 11,
3660
+ 'ENOTRECOVERABLE': 56,
3661
+ 'EOWNERDEAD': 62,
3662
+ 'ESTRPIPE': 135,
3663
+ };
3566
3664
 
3567
3665
  var demangle = (func) => {
3568
3666
  warnOnce('warning: build with -sDEMANGLE_SUPPORT to link in libcxxabi demangling');
@@ -4903,7 +5001,6 @@ function dbg(text) {
4903
5001
  FS.close(stream);
4904
5002
  FS.chmod(node, mode);
4905
5003
  }
4906
- return node;
4907
5004
  },
4908
5005
  createDevice(parent, name, input, output) {
4909
5006
  var path = PATH.join2(typeof parent == 'string' ? parent : FS.getPath(parent), name);
@@ -5203,19 +5300,19 @@ function dbg(text) {
5203
5300
  HEAP32[(((buf)+(12))>>2)] = stat.uid;
5204
5301
  HEAP32[(((buf)+(16))>>2)] = stat.gid;
5205
5302
  HEAP32[(((buf)+(20))>>2)] = stat.rdev;
5206
- (tempI64 = [stat.size>>>0,(tempDouble=stat.size,(+(Math.abs(tempDouble))) >= 1.0 ? (tempDouble > 0.0 ? (+(Math.floor((tempDouble)/4294967296.0)))>>>0 : (~~((+(Math.ceil((tempDouble - +(((~~(tempDouble)))>>>0))/4294967296.0)))))>>>0) : 0)], HEAP32[(((buf)+(24))>>2)] = tempI64[0],HEAP32[(((buf)+(28))>>2)] = tempI64[1]);
5303
+ (tempI64 = [stat.size>>>0,(tempDouble = stat.size,(+(Math.abs(tempDouble))) >= 1.0 ? (tempDouble > 0.0 ? (+(Math.floor((tempDouble)/4294967296.0)))>>>0 : (~~((+(Math.ceil((tempDouble - +(((~~(tempDouble)))>>>0))/4294967296.0)))))>>>0) : 0)], HEAP32[(((buf)+(24))>>2)] = tempI64[0],HEAP32[(((buf)+(28))>>2)] = tempI64[1]);
5207
5304
  HEAP32[(((buf)+(32))>>2)] = 4096;
5208
5305
  HEAP32[(((buf)+(36))>>2)] = stat.blocks;
5209
5306
  var atime = stat.atime.getTime();
5210
5307
  var mtime = stat.mtime.getTime();
5211
5308
  var ctime = stat.ctime.getTime();
5212
- (tempI64 = [Math.floor(atime / 1000)>>>0,(tempDouble=Math.floor(atime / 1000),(+(Math.abs(tempDouble))) >= 1.0 ? (tempDouble > 0.0 ? (+(Math.floor((tempDouble)/4294967296.0)))>>>0 : (~~((+(Math.ceil((tempDouble - +(((~~(tempDouble)))>>>0))/4294967296.0)))))>>>0) : 0)], HEAP32[(((buf)+(40))>>2)] = tempI64[0],HEAP32[(((buf)+(44))>>2)] = tempI64[1]);
5309
+ (tempI64 = [Math.floor(atime / 1000)>>>0,(tempDouble = Math.floor(atime / 1000),(+(Math.abs(tempDouble))) >= 1.0 ? (tempDouble > 0.0 ? (+(Math.floor((tempDouble)/4294967296.0)))>>>0 : (~~((+(Math.ceil((tempDouble - +(((~~(tempDouble)))>>>0))/4294967296.0)))))>>>0) : 0)], HEAP32[(((buf)+(40))>>2)] = tempI64[0],HEAP32[(((buf)+(44))>>2)] = tempI64[1]);
5213
5310
  HEAPU32[(((buf)+(48))>>2)] = (atime % 1000) * 1000;
5214
- (tempI64 = [Math.floor(mtime / 1000)>>>0,(tempDouble=Math.floor(mtime / 1000),(+(Math.abs(tempDouble))) >= 1.0 ? (tempDouble > 0.0 ? (+(Math.floor((tempDouble)/4294967296.0)))>>>0 : (~~((+(Math.ceil((tempDouble - +(((~~(tempDouble)))>>>0))/4294967296.0)))))>>>0) : 0)], HEAP32[(((buf)+(56))>>2)] = tempI64[0],HEAP32[(((buf)+(60))>>2)] = tempI64[1]);
5311
+ (tempI64 = [Math.floor(mtime / 1000)>>>0,(tempDouble = Math.floor(mtime / 1000),(+(Math.abs(tempDouble))) >= 1.0 ? (tempDouble > 0.0 ? (+(Math.floor((tempDouble)/4294967296.0)))>>>0 : (~~((+(Math.ceil((tempDouble - +(((~~(tempDouble)))>>>0))/4294967296.0)))))>>>0) : 0)], HEAP32[(((buf)+(56))>>2)] = tempI64[0],HEAP32[(((buf)+(60))>>2)] = tempI64[1]);
5215
5312
  HEAPU32[(((buf)+(64))>>2)] = (mtime % 1000) * 1000;
5216
- (tempI64 = [Math.floor(ctime / 1000)>>>0,(tempDouble=Math.floor(ctime / 1000),(+(Math.abs(tempDouble))) >= 1.0 ? (tempDouble > 0.0 ? (+(Math.floor((tempDouble)/4294967296.0)))>>>0 : (~~((+(Math.ceil((tempDouble - +(((~~(tempDouble)))>>>0))/4294967296.0)))))>>>0) : 0)], HEAP32[(((buf)+(72))>>2)] = tempI64[0],HEAP32[(((buf)+(76))>>2)] = tempI64[1]);
5313
+ (tempI64 = [Math.floor(ctime / 1000)>>>0,(tempDouble = Math.floor(ctime / 1000),(+(Math.abs(tempDouble))) >= 1.0 ? (tempDouble > 0.0 ? (+(Math.floor((tempDouble)/4294967296.0)))>>>0 : (~~((+(Math.ceil((tempDouble - +(((~~(tempDouble)))>>>0))/4294967296.0)))))>>>0) : 0)], HEAP32[(((buf)+(72))>>2)] = tempI64[0],HEAP32[(((buf)+(76))>>2)] = tempI64[1]);
5217
5314
  HEAPU32[(((buf)+(80))>>2)] = (ctime % 1000) * 1000;
5218
- (tempI64 = [stat.ino>>>0,(tempDouble=stat.ino,(+(Math.abs(tempDouble))) >= 1.0 ? (tempDouble > 0.0 ? (+(Math.floor((tempDouble)/4294967296.0)))>>>0 : (~~((+(Math.ceil((tempDouble - +(((~~(tempDouble)))>>>0))/4294967296.0)))))>>>0) : 0)], HEAP32[(((buf)+(88))>>2)] = tempI64[0],HEAP32[(((buf)+(92))>>2)] = tempI64[1]);
5315
+ (tempI64 = [stat.ino>>>0,(tempDouble = stat.ino,(+(Math.abs(tempDouble))) >= 1.0 ? (tempDouble > 0.0 ? (+(Math.floor((tempDouble)/4294967296.0)))>>>0 : (~~((+(Math.ceil((tempDouble - +(((~~(tempDouble)))>>>0))/4294967296.0)))))>>>0) : 0)], HEAP32[(((buf)+(88))>>2)] = tempI64[0],HEAP32[(((buf)+(92))>>2)] = tempI64[1]);
5219
5316
  return 0;
5220
5317
  },
5221
5318
  doMsync(addr, stream, len, flags, offset) {
@@ -5356,7 +5453,7 @@ function dbg(text) {
5356
5453
  if (isNaN(offset)) return 61;
5357
5454
  var stream = SYSCALLS.getStreamFromFD(fd);
5358
5455
  FS.llseek(stream, offset, whence);
5359
- (tempI64 = [stream.position>>>0,(tempDouble=stream.position,(+(Math.abs(tempDouble))) >= 1.0 ? (tempDouble > 0.0 ? (+(Math.floor((tempDouble)/4294967296.0)))>>>0 : (~~((+(Math.ceil((tempDouble - +(((~~(tempDouble)))>>>0))/4294967296.0)))))>>>0) : 0)], HEAP32[((newOffset)>>2)] = tempI64[0],HEAP32[(((newOffset)+(4))>>2)] = tempI64[1]);
5456
+ (tempI64 = [stream.position>>>0,(tempDouble = stream.position,(+(Math.abs(tempDouble))) >= 1.0 ? (tempDouble > 0.0 ? (+(Math.floor((tempDouble)/4294967296.0)))>>>0 : (~~((+(Math.ceil((tempDouble - +(((~~(tempDouble)))>>>0))/4294967296.0)))))>>>0) : 0)], HEAP32[((newOffset)>>2)] = tempI64[0],HEAP32[(((newOffset)+(4))>>2)] = tempI64[1]);
5360
5457
  if (stream.getdents && offset === 0 && whence === 0) stream.getdents = null; // reset readdir state
5361
5458
  return 0;
5362
5459
  } catch (e) {
@@ -5396,9 +5493,7 @@ function dbg(text) {
5396
5493
  }
5397
5494
  }
5398
5495
 
5399
- var isLeapYear = (year) => {
5400
- return year%4 === 0 && (year%100 !== 0 || year%400 === 0);
5401
- };
5496
+ var isLeapYear = (year) => year%4 === 0 && (year%100 !== 0 || year%400 === 0);
5402
5497
 
5403
5498
  var arraySum = (array, index) => {
5404
5499
  var sum = 0;
@@ -5773,129 +5868,6 @@ UnboundTypeError = Module['UnboundTypeError'] = extendError(Error, 'UnboundTypeE
5773
5868
  FS.FSNode = FSNode;
5774
5869
  FS.createPreloadedFile = FS_createPreloadedFile;
5775
5870
  FS.staticInit();;
5776
- ERRNO_CODES = {
5777
- 'EPERM': 63,
5778
- 'ENOENT': 44,
5779
- 'ESRCH': 71,
5780
- 'EINTR': 27,
5781
- 'EIO': 29,
5782
- 'ENXIO': 60,
5783
- 'E2BIG': 1,
5784
- 'ENOEXEC': 45,
5785
- 'EBADF': 8,
5786
- 'ECHILD': 12,
5787
- 'EAGAIN': 6,
5788
- 'EWOULDBLOCK': 6,
5789
- 'ENOMEM': 48,
5790
- 'EACCES': 2,
5791
- 'EFAULT': 21,
5792
- 'ENOTBLK': 105,
5793
- 'EBUSY': 10,
5794
- 'EEXIST': 20,
5795
- 'EXDEV': 75,
5796
- 'ENODEV': 43,
5797
- 'ENOTDIR': 54,
5798
- 'EISDIR': 31,
5799
- 'EINVAL': 28,
5800
- 'ENFILE': 41,
5801
- 'EMFILE': 33,
5802
- 'ENOTTY': 59,
5803
- 'ETXTBSY': 74,
5804
- 'EFBIG': 22,
5805
- 'ENOSPC': 51,
5806
- 'ESPIPE': 70,
5807
- 'EROFS': 69,
5808
- 'EMLINK': 34,
5809
- 'EPIPE': 64,
5810
- 'EDOM': 18,
5811
- 'ERANGE': 68,
5812
- 'ENOMSG': 49,
5813
- 'EIDRM': 24,
5814
- 'ECHRNG': 106,
5815
- 'EL2NSYNC': 156,
5816
- 'EL3HLT': 107,
5817
- 'EL3RST': 108,
5818
- 'ELNRNG': 109,
5819
- 'EUNATCH': 110,
5820
- 'ENOCSI': 111,
5821
- 'EL2HLT': 112,
5822
- 'EDEADLK': 16,
5823
- 'ENOLCK': 46,
5824
- 'EBADE': 113,
5825
- 'EBADR': 114,
5826
- 'EXFULL': 115,
5827
- 'ENOANO': 104,
5828
- 'EBADRQC': 103,
5829
- 'EBADSLT': 102,
5830
- 'EDEADLOCK': 16,
5831
- 'EBFONT': 101,
5832
- 'ENOSTR': 100,
5833
- 'ENODATA': 116,
5834
- 'ETIME': 117,
5835
- 'ENOSR': 118,
5836
- 'ENONET': 119,
5837
- 'ENOPKG': 120,
5838
- 'EREMOTE': 121,
5839
- 'ENOLINK': 47,
5840
- 'EADV': 122,
5841
- 'ESRMNT': 123,
5842
- 'ECOMM': 124,
5843
- 'EPROTO': 65,
5844
- 'EMULTIHOP': 36,
5845
- 'EDOTDOT': 125,
5846
- 'EBADMSG': 9,
5847
- 'ENOTUNIQ': 126,
5848
- 'EBADFD': 127,
5849
- 'EREMCHG': 128,
5850
- 'ELIBACC': 129,
5851
- 'ELIBBAD': 130,
5852
- 'ELIBSCN': 131,
5853
- 'ELIBMAX': 132,
5854
- 'ELIBEXEC': 133,
5855
- 'ENOSYS': 52,
5856
- 'ENOTEMPTY': 55,
5857
- 'ENAMETOOLONG': 37,
5858
- 'ELOOP': 32,
5859
- 'EOPNOTSUPP': 138,
5860
- 'EPFNOSUPPORT': 139,
5861
- 'ECONNRESET': 15,
5862
- 'ENOBUFS': 42,
5863
- 'EAFNOSUPPORT': 5,
5864
- 'EPROTOTYPE': 67,
5865
- 'ENOTSOCK': 57,
5866
- 'ENOPROTOOPT': 50,
5867
- 'ESHUTDOWN': 140,
5868
- 'ECONNREFUSED': 14,
5869
- 'EADDRINUSE': 3,
5870
- 'ECONNABORTED': 13,
5871
- 'ENETUNREACH': 40,
5872
- 'ENETDOWN': 38,
5873
- 'ETIMEDOUT': 73,
5874
- 'EHOSTDOWN': 142,
5875
- 'EHOSTUNREACH': 23,
5876
- 'EINPROGRESS': 26,
5877
- 'EALREADY': 7,
5878
- 'EDESTADDRREQ': 17,
5879
- 'EMSGSIZE': 35,
5880
- 'EPROTONOSUPPORT': 66,
5881
- 'ESOCKTNOSUPPORT': 137,
5882
- 'EADDRNOTAVAIL': 4,
5883
- 'ENETRESET': 39,
5884
- 'EISCONN': 30,
5885
- 'ENOTCONN': 53,
5886
- 'ETOOMANYREFS': 141,
5887
- 'EUSERS': 136,
5888
- 'EDQUOT': 19,
5889
- 'ESTALE': 72,
5890
- 'ENOTSUP': 138,
5891
- 'ENOMEDIUM': 148,
5892
- 'EILSEQ': 25,
5893
- 'EOVERFLOW': 61,
5894
- 'ECANCELED': 11,
5895
- 'ENOTRECOVERABLE': 56,
5896
- 'EOWNERDEAD': 62,
5897
- 'ESTRPIPE': 135,
5898
- };;
5899
5871
  function checkIncomingModuleAPI() {
5900
5872
  ignoredModuleProp('fetchSettings');
5901
5873
  }
@@ -5980,7 +5952,6 @@ var _main = Module['_main'] = createExportWrapper('main');
5980
5952
  var _free = createExportWrapper('free');
5981
5953
  var ___errno_location = createExportWrapper('__errno_location');
5982
5954
  var ___getTypeName = createExportWrapper('__getTypeName');
5983
- var __embind_initialize_bindings = Module['__embind_initialize_bindings'] = createExportWrapper('_embind_initialize_bindings');
5984
5955
  var _fflush = Module['_fflush'] = createExportWrapper('fflush');
5985
5956
  var _setThrew = createExportWrapper('setThrew');
5986
5957
  var _emscripten_stack_init = () => (_emscripten_stack_init = wasmExports['emscripten_stack_init'])();
@@ -6247,8 +6218,11 @@ var missingLibrarySymbols = [
6247
6218
  'downcastPointer',
6248
6219
  'upcastPointer',
6249
6220
  'validateThis',
6250
- 'craftEmvalAllocator',
6221
+ 'char_0',
6222
+ 'char_9',
6223
+ 'makeLegalFunctionName',
6251
6224
  'emval_get_global',
6225
+ 'emval_returnValue',
6252
6226
  'emval_lookupTypes',
6253
6227
  'emval_addMethodCaller',
6254
6228
  ];
@@ -6429,17 +6403,14 @@ var unexportedSymbols = [
6429
6403
  'detachFinalizer_deps',
6430
6404
  'deletionQueue',
6431
6405
  'delayFunction',
6432
- 'char_0',
6433
- 'char_9',
6434
- 'makeLegalFunctionName',
6435
6406
  'emval_handles',
6436
6407
  'emval_symbols',
6437
6408
  'init_emval',
6438
6409
  'count_emval_handles',
6439
6410
  'getStringOrSymbol',
6440
6411
  'Emval',
6441
- 'emval_newers',
6442
6412
  'emval_methodCallers',
6413
+ 'reflectConstruct',
6443
6414
  ];
6444
6415
  unexportedSymbols.forEach(unexportedRuntimeSymbol);
6445
6416
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monogrid/gainmap-js",
3
- "version": "1.0.2",
3
+ "version": "1.1.0",
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": {
@@ -1,3 +0,0 @@
1
- Examples of use cases using this library
2
-
3
- Kept here for linting & typechecking purposes of the final use cases
@@ -1,43 +0,0 @@
1
- /* eslint-disable unused-imports/no-unused-vars */
2
- import { compress, encode, findTextureMinMax } from '@monogrid/gainmap-js'
3
- import { EXRLoader } from 'three/examples/jsm/loaders/EXRLoader.js'
4
-
5
- // load an HDR file
6
- const loader = new EXRLoader()
7
- const image = await loader.loadAsync('image.exr')
8
-
9
- // find RAW RGB Max value of a texture
10
- const textureMax = await findTextureMinMax(image)
11
-
12
- // Encode the gainmap
13
- const encodingResult = encode({
14
- image,
15
- // this will encode the full HDR range
16
- maxContentBoost: Math.max.apply(this, textureMax)
17
- })
18
-
19
- // obtain the RAW RGBA SDR buffer and create an ImageData
20
- const sdrImageData = new ImageData(encodingResult.sdr.toArray(), encodingResult.sdr.width, encodingResult.sdr.height)
21
- // obtain the RAW RGBA Gain map buffer and create an ImageData
22
- const gainMapImageData = new ImageData(encodingResult.gainMap.toArray(), encodingResult.gainMap.width, encodingResult.gainMap.height)
23
-
24
- // parallel compress the RAW buffers into the specified mimeType
25
- const mimeType = 'image/jpeg'
26
- const quality = 0.9
27
- const [sdr, gainMap] = await Promise.all([
28
- compress({
29
- source: sdrImageData,
30
- mimeType,
31
- quality,
32
- flipY: true // output needs to be flipped
33
- }),
34
- compress({
35
- source: gainMapImageData,
36
- mimeType,
37
- quality,
38
- flipY: true // output needs to be flipped
39
- })
40
- ])
41
-
42
- // `sdr` will contain a JPEG which can be saved somewhere
43
- // `gainMap` will contain a JPEG which can be saved somewhere
@@ -1,40 +0,0 @@
1
- /* eslint-disable unused-imports/no-unused-vars */
2
-
3
- import { decode } from '@monogrid/gainmap-js'
4
- import { decodeJPEGMetadata } from '@monogrid/gainmap-js/libultrahdr'
5
- import {
6
- Mesh,
7
- MeshBasicMaterial,
8
- PerspectiveCamera,
9
- PlaneGeometry,
10
- Scene,
11
- WebGLRenderer
12
- } from 'three'
13
-
14
- const renderer = new WebGLRenderer()
15
-
16
- // fetch a JPEG image containing a gainmap as ArrayBuffer
17
- const gainmap = await (await fetch('gainmap.jpeg')).arrayBuffer()
18
-
19
- // extract data from the JPEG
20
- const { sdr, gainMap, parsedMetadata } = await decodeJPEGMetadata(new Uint8Array(gainmap))
21
-
22
- // restore the HDR texture
23
- const result = await decode({
24
- sdr,
25
- gainMap,
26
- // this allows to use `result.renderTarget.texture` directly
27
- renderer,
28
- // this will restore the full HDR range
29
- maxDisplayBoost: Math.pow(2, parsedMetadata.hdrCapacityMax),
30
- ...parsedMetadata
31
- })
32
-
33
- const scene = new Scene()
34
- // `result` can be used to populate a Texture
35
- const mesh = new Mesh(
36
- new PlaneGeometry(),
37
- new MeshBasicMaterial({ map: result.renderTarget.texture })
38
- )
39
- scene.add(mesh)
40
- renderer.render(scene, new PerspectiveCamera())
@@ -1,41 +0,0 @@
1
- /* eslint-disable unused-imports/no-unused-vars */
2
- import { decode } from '@monogrid/gainmap-js'
3
- import {
4
- Mesh,
5
- MeshBasicMaterial,
6
- PerspectiveCamera,
7
- PlaneGeometry,
8
- Scene,
9
- TextureLoader,
10
- WebGLRenderer
11
- } from 'three'
12
-
13
- const renderer = new WebGLRenderer()
14
-
15
- const loader = new TextureLoader()
16
-
17
- // load SDR Representation
18
- const sdr = await loader.loadAsync('sdr.jpg')
19
- // load Gain map recovery image
20
- const gainMap = await loader.loadAsync('gainmap.jpg')
21
- // load metadata
22
- const metadata = await (await fetch('metadata.json')).json()
23
-
24
- const result = await decode({
25
- sdr,
26
- gainMap,
27
- // this allows to use `result.renderTarget.texture` directly
28
- renderer,
29
- // this will restore the full HDR range
30
- maxDisplayBoost: Math.pow(2, metadata.hdrCapacityMax),
31
- ...metadata
32
- })
33
-
34
- const scene = new Scene()
35
- // `result` can be used to populate a Texture
36
- const mesh = new Mesh(
37
- new PlaneGeometry(),
38
- new MeshBasicMaterial({ map: result.renderTarget.texture })
39
- )
40
- scene.add(mesh)
41
- renderer.render(scene, new PerspectiveCamera())