-
Notifications
You must be signed in to change notification settings - Fork 65
/
exr.worker.js.map
1 lines (1 loc) · 7.27 KB
/
exr.worker.js.map
1
{"version":3,"sources":["webpack:///webpack/bootstrap a98a6a02fdcb424897c6","webpack:///./build_npm/utils/exr-parser.worker.js","webpack:///./build_npm/exr-wrap/exr-wrap.js","webpack:///./build_npm/exr-wrap/exr-wrap.js.mem"],"names":[],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;AAEA;AACA;;;;;;;AC7DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,OAAO;AAC/B;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA,iCAAiC;AACjC,wBAAwB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,2BAA2B,oBAAoB;AAC/C;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,oBAAoB;AAC/C;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,wCAAwC;AACxC;AACA;;;;;;;ACpHA,uD;;;;;;ACAA,2D","file":"exr.worker.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap a98a6a02fdcb424897c6","/**\n * Web worker script that uses an emscripten-compiled version\n * of OpenEXR to parse EXR files. The webworker can be used like this:\n *\n * const ExrParser = require('worker-loader!./utils/exr-parser-webworker.js');\n * var worker = new ExrParser();\n * # Send an ArrayBuffer to the webworker\n * # Because it's basses as the second argument, the data won't be copied\n * # but ownership will be transfered.\n * worker.postMessage({ data }, [data]);\n * worker.onmessage = (event: MessageEvent) => {\n * if (event.data.success) {\n * console.log(event.data.image);\n * } else {\n * console.error(event.data.message);\n * }\n * };\n */\n\n\nconst openexr = require('file-loader?name=exr-wrap.js!../exr-wrap/exr-wrap.js');\nrequire('file-loader?name=exr-wrap.js.mem!../exr-wrap/exr-wrap.js.mem');\n\nlet openEXRLoaded = false;\nlet queuedJobs = [];\n\nModule = {\n onRuntimeInitialized: function() {\n openEXRLoaded = true;\n while (queuedJobs.length > 0) {\n const job = queuedJobs.shift();\n if (job) {\n handleJob(job);\n }\n }\n }\n};\nimportScripts(openexr);\nconst OpenEXR = Module;\n\nself.addEventListener('message', (event) => {\n if (!openEXRLoaded) {\n queuedJobs.push(event.data);\n } else {\n handleJob(event.data);\n }\n});\n\nfunction handleJob(job) {\n const jobId = job.jobId;\n try {\n const image = parseExr(job.data);\n self.postMessage(\n {\n jobId,\n success: true,\n image\n },\n [image.data.buffer]\n );\n } catch (error) {\n console.log('Error: ', error);\n self.postMessage({\n jobId,\n success: false,\n message: error.toString()\n });\n }\n}\n\nfunction parseExr(data) {\n console.time('Decoding EXR'); // tslint:disable-line\n let exrImage = null; // tslint:disable-line:no-any\n try {\n exrImage = OpenEXR.loadEXRStr(data);\n const channels = exrImage.channels();\n const {\n width,\n height\n } = exrImage;\n const nChannels = channels.length;\n let exrData;\n if (nChannels === 1) {\n const z = exrImage.plane(exrImage.channels()[0]);\n exrData = new Float32Array(width * height);\n for (let i = 0; i < width * height; i++) {\n exrData[i] = z[i];\n }\n } else if (exrImage.channels().includes('R') &&\n exrImage.channels().includes('G') &&\n exrImage.channels().includes('B')) {\n const r = exrImage.plane('R');\n const g = exrImage.plane('G');\n const b = exrImage.plane('B');\n exrData = new Float32Array(width * height * 3);\n for (let i = 0; i < width * height; i++) {\n exrData[i * 3] = r[i];\n exrData[i * 3 + 1] = g[i];\n exrData[i * 3 + 2] = b[i];\n }\n } else {\n throw new Error('EXR image not supported');\n }\n return {\n height,\n width,\n nChannels,\n data: exrData,\n type: 'HdrImage',\n };\n } finally {\n if (exrImage) {\n exrImage.delete();\n }\n console.timeEnd('Decoding EXR'); // tslint:disable-line\n }\n}\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/source-map-loader!./build_npm/utils/exr-parser.worker.js\n// module id = 0\n// module chunks = 0","module.exports = __webpack_public_path__ + \"exr-wrap.js\";\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/file-loader/dist/cjs.js?name=exr-wrap.js!./build_npm/exr-wrap/exr-wrap.js\n// module id = 1\n// module chunks = 0","module.exports = __webpack_public_path__ + \"exr-wrap.js.mem\";\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/file-loader/dist/cjs.js?name=exr-wrap.js.mem!./build_npm/exr-wrap/exr-wrap.js.mem\n// module id = 2\n// module chunks = 0"],"sourceRoot":""}