ry-vue-map 0.1.2 → 0.1.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.
Files changed (52) hide show
  1. package/README.MD +1 -1
  2. package/lib/ryui.common.js +38444 -73751
  3. package/lib/ryui.common.js.gz +0 -0
  4. package/lib/ryui.css +1 -1
  5. package/lib/ryui.umd.js +38444 -73751
  6. package/lib/ryui.umd.js.gz +0 -0
  7. package/lib/ryui.umd.min.js +6 -13
  8. package/lib/ryui.umd.min.js.gz +0 -0
  9. package/package.json +1 -1
  10. package/src/components/maps/ryClustersMarker/src/index.vue +1 -1
  11. package/src/components/maps/ryMap/src/index.vue +3 -2
  12. package/src/utils/lMapServices.js +2 -3
  13. package/src/views/map/index.vue +11 -3
  14. package/lib/ryui.common.0.js +0 -6852
  15. package/lib/ryui.common.0.js.gz +0 -0
  16. package/lib/ryui.common.2.js +0 -1034
  17. package/lib/ryui.common.2.js.gz +0 -0
  18. package/lib/ryui.common.3.js +0 -268
  19. package/lib/ryui.common.4.js +0 -163
  20. package/lib/ryui.common.5.js +0 -144
  21. package/lib/ryui.common.6.js +0 -177
  22. package/lib/ryui.common.7.js +0 -2373
  23. package/lib/ryui.common.7.js.gz +0 -0
  24. package/lib/ryui.common.8.js +0 -47
  25. package/lib/ryui.common.8.js.gz +0 -0
  26. package/lib/ryui.common.9.js +0 -23
  27. package/lib/ryui.umd.0.js +0 -6852
  28. package/lib/ryui.umd.0.js.gz +0 -0
  29. package/lib/ryui.umd.2.js +0 -1034
  30. package/lib/ryui.umd.2.js.gz +0 -0
  31. package/lib/ryui.umd.3.js +0 -268
  32. package/lib/ryui.umd.4.js +0 -163
  33. package/lib/ryui.umd.5.js +0 -144
  34. package/lib/ryui.umd.6.js +0 -177
  35. package/lib/ryui.umd.7.js +0 -2373
  36. package/lib/ryui.umd.7.js.gz +0 -0
  37. package/lib/ryui.umd.8.js +0 -47
  38. package/lib/ryui.umd.8.js.gz +0 -0
  39. package/lib/ryui.umd.9.js +0 -23
  40. package/lib/ryui.umd.min.0.js +0 -3
  41. package/lib/ryui.umd.min.0.js.gz +0 -0
  42. package/lib/ryui.umd.min.2.js +0 -1
  43. package/lib/ryui.umd.min.2.js.gz +0 -0
  44. package/lib/ryui.umd.min.3.js +0 -1
  45. package/lib/ryui.umd.min.4.js +0 -1
  46. package/lib/ryui.umd.min.5.js +0 -1
  47. package/lib/ryui.umd.min.6.js +0 -1
  48. package/lib/ryui.umd.min.7.js +0 -2
  49. package/lib/ryui.umd.min.7.js.gz +0 -0
  50. package/lib/ryui.umd.min.8.js +0 -1
  51. package/lib/ryui.umd.min.8.js.gz +0 -0
  52. package/lib/ryui.umd.min.9.js +0 -1
@@ -1,1034 +0,0 @@
1
- ((typeof self !== 'undefined' ? self : this)["webpackJsonpryui"] = (typeof self !== 'undefined' ? self : this)["webpackJsonpryui"] || []).push([[2],{
2
-
3
- /***/ "2624":
4
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
5
-
6
- "use strict";
7
- __webpack_require__.r(__webpack_exports__);
8
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return JpegDecoder; });
9
- /* harmony import */ var _basedecoder_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("b3f7");
10
-
11
-
12
- /* -*- tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- /
13
- /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
14
- /*
15
- Copyright 2011 notmasteryet
16
- Licensed under the Apache License, Version 2.0 (the "License");
17
- you may not use this file except in compliance with the License.
18
- You may obtain a copy of the License at
19
- http://www.apache.org/licenses/LICENSE-2.0
20
- Unless required by applicable law or agreed to in writing, software
21
- distributed under the License is distributed on an "AS IS" BASIS,
22
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23
- See the License for the specific language governing permissions and
24
- limitations under the License.
25
- */
26
-
27
- // - The JPEG specification can be found in the ITU CCITT Recommendation T.81
28
- // (www.w3.org/Graphics/JPEG/itu-t81.pdf)
29
- // - The JFIF specification can be found in the JPEG File Interchange Format
30
- // (www.w3.org/Graphics/JPEG/jfif3.pdf)
31
- // - The Adobe Application-Specific JPEG markers in the Supporting the DCT Filters
32
- // in PostScript Level 2, Technical Note #5116
33
- // (partners.adobe.com/public/developer/en/ps/sdk/5116.DCT_Filter.pdf)
34
-
35
- const dctZigZag = new Int32Array([
36
- 0,
37
- 1, 8,
38
- 16, 9, 2,
39
- 3, 10, 17, 24,
40
- 32, 25, 18, 11, 4,
41
- 5, 12, 19, 26, 33, 40,
42
- 48, 41, 34, 27, 20, 13, 6,
43
- 7, 14, 21, 28, 35, 42, 49, 56,
44
- 57, 50, 43, 36, 29, 22, 15,
45
- 23, 30, 37, 44, 51, 58,
46
- 59, 52, 45, 38, 31,
47
- 39, 46, 53, 60,
48
- 61, 54, 47,
49
- 55, 62,
50
- 63,
51
- ]);
52
-
53
- const dctCos1 = 4017; // cos(pi/16)
54
- const dctSin1 = 799; // sin(pi/16)
55
- const dctCos3 = 3406; // cos(3*pi/16)
56
- const dctSin3 = 2276; // sin(3*pi/16)
57
- const dctCos6 = 1567; // cos(6*pi/16)
58
- const dctSin6 = 3784; // sin(6*pi/16)
59
- const dctSqrt2 = 5793; // sqrt(2)
60
- const dctSqrt1d2 = 2896;// sqrt(2) / 2
61
-
62
- function buildHuffmanTable(codeLengths, values) {
63
- let k = 0;
64
- const code = [];
65
- let length = 16;
66
- while (length > 0 && !codeLengths[length - 1]) {
67
- --length;
68
- }
69
- code.push({ children: [], index: 0 });
70
-
71
- let p = code[0];
72
- let q;
73
- for (let i = 0; i < length; i++) {
74
- for (let j = 0; j < codeLengths[i]; j++) {
75
- p = code.pop();
76
- p.children[p.index] = values[k];
77
- while (p.index > 0) {
78
- p = code.pop();
79
- }
80
- p.index++;
81
- code.push(p);
82
- while (code.length <= i) {
83
- code.push(q = { children: [], index: 0 });
84
- p.children[p.index] = q.children;
85
- p = q;
86
- }
87
- k++;
88
- }
89
- if (i + 1 < length) {
90
- // p here points to last code
91
- code.push(q = { children: [], index: 0 });
92
- p.children[p.index] = q.children;
93
- p = q;
94
- }
95
- }
96
- return code[0].children;
97
- }
98
-
99
- function decodeScan(data, initialOffset,
100
- frame, components, resetInterval,
101
- spectralStart, spectralEnd,
102
- successivePrev, successive) {
103
- const { mcusPerLine, progressive } = frame;
104
-
105
- const startOffset = initialOffset;
106
- let offset = initialOffset;
107
- let bitsData = 0;
108
- let bitsCount = 0;
109
- function readBit() {
110
- if (bitsCount > 0) {
111
- bitsCount--;
112
- return (bitsData >> bitsCount) & 1;
113
- }
114
- bitsData = data[offset++];
115
- if (bitsData === 0xFF) {
116
- const nextByte = data[offset++];
117
- if (nextByte) {
118
- throw new Error(`unexpected marker: ${((bitsData << 8) | nextByte).toString(16)}`);
119
- }
120
- // unstuff 0
121
- }
122
- bitsCount = 7;
123
- return bitsData >>> 7;
124
- }
125
- function decodeHuffman(tree) {
126
- let node = tree;
127
- let bit;
128
- while ((bit = readBit()) !== null) { // eslint-disable-line no-cond-assign
129
- node = node[bit];
130
- if (typeof node === 'number') {
131
- return node;
132
- }
133
- if (typeof node !== 'object') {
134
- throw new Error('invalid huffman sequence');
135
- }
136
- }
137
- return null;
138
- }
139
- function receive(initialLength) {
140
- let length = initialLength;
141
- let n = 0;
142
- while (length > 0) {
143
- const bit = readBit();
144
- if (bit === null) {
145
- return undefined;
146
- }
147
- n = (n << 1) | bit;
148
- --length;
149
- }
150
- return n;
151
- }
152
- function receiveAndExtend(length) {
153
- const n = receive(length);
154
- if (n >= 1 << (length - 1)) {
155
- return n;
156
- }
157
- return n + (-1 << length) + 1;
158
- }
159
- function decodeBaseline(component, zz) {
160
- const t = decodeHuffman(component.huffmanTableDC);
161
- const diff = t === 0 ? 0 : receiveAndExtend(t);
162
- component.pred += diff;
163
- zz[0] = component.pred;
164
- let k = 1;
165
- while (k < 64) {
166
- const rs = decodeHuffman(component.huffmanTableAC);
167
- const s = rs & 15;
168
- const r = rs >> 4;
169
- if (s === 0) {
170
- if (r < 15) {
171
- break;
172
- }
173
- k += 16;
174
- } else {
175
- k += r;
176
- const z = dctZigZag[k];
177
- zz[z] = receiveAndExtend(s);
178
- k++;
179
- }
180
- }
181
- }
182
- function decodeDCFirst(component, zz) {
183
- const t = decodeHuffman(component.huffmanTableDC);
184
- const diff = t === 0 ? 0 : (receiveAndExtend(t) << successive);
185
- component.pred += diff;
186
- zz[0] = component.pred;
187
- }
188
- function decodeDCSuccessive(component, zz) {
189
- zz[0] |= readBit() << successive;
190
- }
191
- let eobrun = 0;
192
- function decodeACFirst(component, zz) {
193
- if (eobrun > 0) {
194
- eobrun--;
195
- return;
196
- }
197
- let k = spectralStart;
198
- const e = spectralEnd;
199
- while (k <= e) {
200
- const rs = decodeHuffman(component.huffmanTableAC);
201
- const s = rs & 15;
202
- const r = rs >> 4;
203
- if (s === 0) {
204
- if (r < 15) {
205
- eobrun = receive(r) + (1 << r) - 1;
206
- break;
207
- }
208
- k += 16;
209
- } else {
210
- k += r;
211
- const z = dctZigZag[k];
212
- zz[z] = receiveAndExtend(s) * (1 << successive);
213
- k++;
214
- }
215
- }
216
- }
217
- let successiveACState = 0;
218
- let successiveACNextValue;
219
- function decodeACSuccessive(component, zz) {
220
- let k = spectralStart;
221
- const e = spectralEnd;
222
- let r = 0;
223
- while (k <= e) {
224
- const z = dctZigZag[k];
225
- const direction = zz[z] < 0 ? -1 : 1;
226
- switch (successiveACState) {
227
- case 0: { // initial state
228
- const rs = decodeHuffman(component.huffmanTableAC);
229
- const s = rs & 15;
230
- r = rs >> 4;
231
- if (s === 0) {
232
- if (r < 15) {
233
- eobrun = receive(r) + (1 << r);
234
- successiveACState = 4;
235
- } else {
236
- r = 16;
237
- successiveACState = 1;
238
- }
239
- } else {
240
- if (s !== 1) {
241
- throw new Error('invalid ACn encoding');
242
- }
243
- successiveACNextValue = receiveAndExtend(s);
244
- successiveACState = r ? 2 : 3;
245
- }
246
- continue; // eslint-disable-line no-continue
247
- }
248
- case 1: // skipping r zero items
249
- case 2:
250
- if (zz[z]) {
251
- zz[z] += (readBit() << successive) * direction;
252
- } else {
253
- r--;
254
- if (r === 0) {
255
- successiveACState = successiveACState === 2 ? 3 : 0;
256
- }
257
- }
258
- break;
259
- case 3: // set value for a zero item
260
- if (zz[z]) {
261
- zz[z] += (readBit() << successive) * direction;
262
- } else {
263
- zz[z] = successiveACNextValue << successive;
264
- successiveACState = 0;
265
- }
266
- break;
267
- case 4: // eob
268
- if (zz[z]) {
269
- zz[z] += (readBit() << successive) * direction;
270
- }
271
- break;
272
- default:
273
- break;
274
- }
275
- k++;
276
- }
277
- if (successiveACState === 4) {
278
- eobrun--;
279
- if (eobrun === 0) {
280
- successiveACState = 0;
281
- }
282
- }
283
- }
284
- function decodeMcu(component, decodeFunction, mcu, row, col) {
285
- const mcuRow = (mcu / mcusPerLine) | 0;
286
- const mcuCol = mcu % mcusPerLine;
287
- const blockRow = (mcuRow * component.v) + row;
288
- const blockCol = (mcuCol * component.h) + col;
289
- decodeFunction(component, component.blocks[blockRow][blockCol]);
290
- }
291
- function decodeBlock(component, decodeFunction, mcu) {
292
- const blockRow = (mcu / component.blocksPerLine) | 0;
293
- const blockCol = mcu % component.blocksPerLine;
294
- decodeFunction(component, component.blocks[blockRow][blockCol]);
295
- }
296
-
297
- const componentsLength = components.length;
298
- let component;
299
- let i;
300
- let j;
301
- let k;
302
- let n;
303
- let decodeFn;
304
- if (progressive) {
305
- if (spectralStart === 0) {
306
- decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;
307
- } else {
308
- decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;
309
- }
310
- } else {
311
- decodeFn = decodeBaseline;
312
- }
313
-
314
- let mcu = 0;
315
- let marker;
316
- let mcuExpected;
317
- if (componentsLength === 1) {
318
- mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn;
319
- } else {
320
- mcuExpected = mcusPerLine * frame.mcusPerColumn;
321
- }
322
-
323
- const usedResetInterval = resetInterval || mcuExpected;
324
-
325
- while (mcu < mcuExpected) {
326
- // reset interval stuff
327
- for (i = 0; i < componentsLength; i++) {
328
- components[i].pred = 0;
329
- }
330
- eobrun = 0;
331
-
332
- if (componentsLength === 1) {
333
- component = components[0];
334
- for (n = 0; n < usedResetInterval; n++) {
335
- decodeBlock(component, decodeFn, mcu);
336
- mcu++;
337
- }
338
- } else {
339
- for (n = 0; n < usedResetInterval; n++) {
340
- for (i = 0; i < componentsLength; i++) {
341
- component = components[i];
342
- const { h, v } = component;
343
- for (j = 0; j < v; j++) {
344
- for (k = 0; k < h; k++) {
345
- decodeMcu(component, decodeFn, mcu, j, k);
346
- }
347
- }
348
- }
349
- mcu++;
350
-
351
- // If we've reached our expected MCU's, stop decoding
352
- if (mcu === mcuExpected) {
353
- break;
354
- }
355
- }
356
- }
357
-
358
- // find marker
359
- bitsCount = 0;
360
- marker = (data[offset] << 8) | data[offset + 1];
361
- if (marker < 0xFF00) {
362
- throw new Error('marker was not found');
363
- }
364
-
365
- if (marker >= 0xFFD0 && marker <= 0xFFD7) { // RSTx
366
- offset += 2;
367
- } else {
368
- break;
369
- }
370
- }
371
-
372
- return offset - startOffset;
373
- }
374
-
375
- function buildComponentData(frame, component) {
376
- const lines = [];
377
- const { blocksPerLine, blocksPerColumn } = component;
378
- const samplesPerLine = blocksPerLine << 3;
379
- const R = new Int32Array(64);
380
- const r = new Uint8Array(64);
381
-
382
- // A port of poppler's IDCT method which in turn is taken from:
383
- // Christoph Loeffler, Adriaan Ligtenberg, George S. Moschytz,
384
- // "Practical Fast 1-D DCT Algorithms with 11 Multiplications",
385
- // IEEE Intl. Conf. on Acoustics, Speech & Signal Processing, 1989,
386
- // 988-991.
387
- function quantizeAndInverse(zz, dataOut, dataIn) {
388
- const qt = component.quantizationTable;
389
- let v0;
390
- let v1;
391
- let v2;
392
- let v3;
393
- let v4;
394
- let v5;
395
- let v6;
396
- let v7;
397
- let t;
398
- const p = dataIn;
399
- let i;
400
-
401
- // dequant
402
- for (i = 0; i < 64; i++) {
403
- p[i] = zz[i] * qt[i];
404
- }
405
-
406
- // inverse DCT on rows
407
- for (i = 0; i < 8; ++i) {
408
- const row = 8 * i;
409
-
410
- // check for all-zero AC coefficients
411
- if (p[1 + row] === 0 && p[2 + row] === 0 && p[3 + row] === 0
412
- && p[4 + row] === 0 && p[5 + row] === 0 && p[6 + row] === 0
413
- && p[7 + row] === 0) {
414
- t = ((dctSqrt2 * p[0 + row]) + 512) >> 10;
415
- p[0 + row] = t;
416
- p[1 + row] = t;
417
- p[2 + row] = t;
418
- p[3 + row] = t;
419
- p[4 + row] = t;
420
- p[5 + row] = t;
421
- p[6 + row] = t;
422
- p[7 + row] = t;
423
- continue; // eslint-disable-line no-continue
424
- }
425
-
426
- // stage 4
427
- v0 = ((dctSqrt2 * p[0 + row]) + 128) >> 8;
428
- v1 = ((dctSqrt2 * p[4 + row]) + 128) >> 8;
429
- v2 = p[2 + row];
430
- v3 = p[6 + row];
431
- v4 = ((dctSqrt1d2 * (p[1 + row] - p[7 + row])) + 128) >> 8;
432
- v7 = ((dctSqrt1d2 * (p[1 + row] + p[7 + row])) + 128) >> 8;
433
- v5 = p[3 + row] << 4;
434
- v6 = p[5 + row] << 4;
435
-
436
- // stage 3
437
- t = (v0 - v1 + 1) >> 1;
438
- v0 = (v0 + v1 + 1) >> 1;
439
- v1 = t;
440
- t = ((v2 * dctSin6) + (v3 * dctCos6) + 128) >> 8;
441
- v2 = ((v2 * dctCos6) - (v3 * dctSin6) + 128) >> 8;
442
- v3 = t;
443
- t = (v4 - v6 + 1) >> 1;
444
- v4 = (v4 + v6 + 1) >> 1;
445
- v6 = t;
446
- t = (v7 + v5 + 1) >> 1;
447
- v5 = (v7 - v5 + 1) >> 1;
448
- v7 = t;
449
-
450
- // stage 2
451
- t = (v0 - v3 + 1) >> 1;
452
- v0 = (v0 + v3 + 1) >> 1;
453
- v3 = t;
454
- t = (v1 - v2 + 1) >> 1;
455
- v1 = (v1 + v2 + 1) >> 1;
456
- v2 = t;
457
- t = ((v4 * dctSin3) + (v7 * dctCos3) + 2048) >> 12;
458
- v4 = ((v4 * dctCos3) - (v7 * dctSin3) + 2048) >> 12;
459
- v7 = t;
460
- t = ((v5 * dctSin1) + (v6 * dctCos1) + 2048) >> 12;
461
- v5 = ((v5 * dctCos1) - (v6 * dctSin1) + 2048) >> 12;
462
- v6 = t;
463
-
464
- // stage 1
465
- p[0 + row] = v0 + v7;
466
- p[7 + row] = v0 - v7;
467
- p[1 + row] = v1 + v6;
468
- p[6 + row] = v1 - v6;
469
- p[2 + row] = v2 + v5;
470
- p[5 + row] = v2 - v5;
471
- p[3 + row] = v3 + v4;
472
- p[4 + row] = v3 - v4;
473
- }
474
-
475
- // inverse DCT on columns
476
- for (i = 0; i < 8; ++i) {
477
- const col = i;
478
-
479
- // check for all-zero AC coefficients
480
- if (p[(1 * 8) + col] === 0 && p[(2 * 8) + col] === 0 && p[(3 * 8) + col] === 0
481
- && p[(4 * 8) + col] === 0 && p[(5 * 8) + col] === 0 && p[(6 * 8) + col] === 0
482
- && p[(7 * 8) + col] === 0) {
483
- t = ((dctSqrt2 * dataIn[i + 0]) + 8192) >> 14;
484
- p[(0 * 8) + col] = t;
485
- p[(1 * 8) + col] = t;
486
- p[(2 * 8) + col] = t;
487
- p[(3 * 8) + col] = t;
488
- p[(4 * 8) + col] = t;
489
- p[(5 * 8) + col] = t;
490
- p[(6 * 8) + col] = t;
491
- p[(7 * 8) + col] = t;
492
- continue; // eslint-disable-line no-continue
493
- }
494
-
495
- // stage 4
496
- v0 = ((dctSqrt2 * p[(0 * 8) + col]) + 2048) >> 12;
497
- v1 = ((dctSqrt2 * p[(4 * 8) + col]) + 2048) >> 12;
498
- v2 = p[(2 * 8) + col];
499
- v3 = p[(6 * 8) + col];
500
- v4 = ((dctSqrt1d2 * (p[(1 * 8) + col] - p[(7 * 8) + col])) + 2048) >> 12;
501
- v7 = ((dctSqrt1d2 * (p[(1 * 8) + col] + p[(7 * 8) + col])) + 2048) >> 12;
502
- v5 = p[(3 * 8) + col];
503
- v6 = p[(5 * 8) + col];
504
-
505
- // stage 3
506
- t = (v0 - v1 + 1) >> 1;
507
- v0 = (v0 + v1 + 1) >> 1;
508
- v1 = t;
509
- t = ((v2 * dctSin6) + (v3 * dctCos6) + 2048) >> 12;
510
- v2 = ((v2 * dctCos6) - (v3 * dctSin6) + 2048) >> 12;
511
- v3 = t;
512
- t = (v4 - v6 + 1) >> 1;
513
- v4 = (v4 + v6 + 1) >> 1;
514
- v6 = t;
515
- t = (v7 + v5 + 1) >> 1;
516
- v5 = (v7 - v5 + 1) >> 1;
517
- v7 = t;
518
-
519
- // stage 2
520
- t = (v0 - v3 + 1) >> 1;
521
- v0 = (v0 + v3 + 1) >> 1;
522
- v3 = t;
523
- t = (v1 - v2 + 1) >> 1;
524
- v1 = (v1 + v2 + 1) >> 1;
525
- v2 = t;
526
- t = ((v4 * dctSin3) + (v7 * dctCos3) + 2048) >> 12;
527
- v4 = ((v4 * dctCos3) - (v7 * dctSin3) + 2048) >> 12;
528
- v7 = t;
529
- t = ((v5 * dctSin1) + (v6 * dctCos1) + 2048) >> 12;
530
- v5 = ((v5 * dctCos1) - (v6 * dctSin1) + 2048) >> 12;
531
- v6 = t;
532
-
533
- // stage 1
534
- p[(0 * 8) + col] = v0 + v7;
535
- p[(7 * 8) + col] = v0 - v7;
536
- p[(1 * 8) + col] = v1 + v6;
537
- p[(6 * 8) + col] = v1 - v6;
538
- p[(2 * 8) + col] = v2 + v5;
539
- p[(5 * 8) + col] = v2 - v5;
540
- p[(3 * 8) + col] = v3 + v4;
541
- p[(4 * 8) + col] = v3 - v4;
542
- }
543
-
544
- // convert to 8-bit integers
545
- for (i = 0; i < 64; ++i) {
546
- const sample = 128 + ((p[i] + 8) >> 4);
547
- if (sample < 0) {
548
- dataOut[i] = 0;
549
- } else if (sample > 0XFF) {
550
- dataOut[i] = 0xFF;
551
- } else {
552
- dataOut[i] = sample;
553
- }
554
- }
555
- }
556
-
557
- for (let blockRow = 0; blockRow < blocksPerColumn; blockRow++) {
558
- const scanLine = blockRow << 3;
559
- for (let i = 0; i < 8; i++) {
560
- lines.push(new Uint8Array(samplesPerLine));
561
- }
562
- for (let blockCol = 0; blockCol < blocksPerLine; blockCol++) {
563
- quantizeAndInverse(component.blocks[blockRow][blockCol], r, R);
564
-
565
- let offset = 0;
566
- const sample = blockCol << 3;
567
- for (let j = 0; j < 8; j++) {
568
- const line = lines[scanLine + j];
569
- for (let i = 0; i < 8; i++) {
570
- line[sample + i] = r[offset++];
571
- }
572
- }
573
- }
574
- }
575
- return lines;
576
- }
577
-
578
- class JpegStreamReader {
579
- constructor() {
580
- this.jfif = null;
581
- this.adobe = null;
582
-
583
- this.quantizationTables = [];
584
- this.huffmanTablesAC = [];
585
- this.huffmanTablesDC = [];
586
- this.resetFrames();
587
- }
588
-
589
- resetFrames() {
590
- this.frames = [];
591
- }
592
-
593
- parse(data) {
594
- let offset = 0;
595
- // const { length } = data;
596
- function readUint16() {
597
- const value = (data[offset] << 8) | data[offset + 1];
598
- offset += 2;
599
- return value;
600
- }
601
- function readDataBlock() {
602
- const length = readUint16();
603
- const array = data.subarray(offset, offset + length - 2);
604
- offset += array.length;
605
- return array;
606
- }
607
- function prepareComponents(frame) {
608
- let maxH = 0;
609
- let maxV = 0;
610
- let component;
611
- let componentId;
612
- for (componentId in frame.components) {
613
- if (frame.components.hasOwnProperty(componentId)) {
614
- component = frame.components[componentId];
615
- if (maxH < component.h) {
616
- maxH = component.h;
617
- }
618
- if (maxV < component.v) {
619
- maxV = component.v;
620
- }
621
- }
622
- }
623
- const mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / maxH);
624
- const mcusPerColumn = Math.ceil(frame.scanLines / 8 / maxV);
625
- for (componentId in frame.components) {
626
- if (frame.components.hasOwnProperty(componentId)) {
627
- component = frame.components[componentId];
628
- const blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / maxH);
629
- const blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / maxV);
630
- const blocksPerLineForMcu = mcusPerLine * component.h;
631
- const blocksPerColumnForMcu = mcusPerColumn * component.v;
632
- const blocks = [];
633
- for (let i = 0; i < blocksPerColumnForMcu; i++) {
634
- const row = [];
635
- for (let j = 0; j < blocksPerLineForMcu; j++) {
636
- row.push(new Int32Array(64));
637
- }
638
- blocks.push(row);
639
- }
640
- component.blocksPerLine = blocksPerLine;
641
- component.blocksPerColumn = blocksPerColumn;
642
- component.blocks = blocks;
643
- }
644
- }
645
- frame.maxH = maxH;
646
- frame.maxV = maxV;
647
- frame.mcusPerLine = mcusPerLine;
648
- frame.mcusPerColumn = mcusPerColumn;
649
- }
650
-
651
- let fileMarker = readUint16();
652
- if (fileMarker !== 0xFFD8) { // SOI (Start of Image)
653
- throw new Error('SOI not found');
654
- }
655
-
656
- fileMarker = readUint16();
657
- while (fileMarker !== 0xFFD9) { // EOI (End of image)
658
- switch (fileMarker) {
659
- case 0xFF00: break;
660
- case 0xFFE0: // APP0 (Application Specific)
661
- case 0xFFE1: // APP1
662
- case 0xFFE2: // APP2
663
- case 0xFFE3: // APP3
664
- case 0xFFE4: // APP4
665
- case 0xFFE5: // APP5
666
- case 0xFFE6: // APP6
667
- case 0xFFE7: // APP7
668
- case 0xFFE8: // APP8
669
- case 0xFFE9: // APP9
670
- case 0xFFEA: // APP10
671
- case 0xFFEB: // APP11
672
- case 0xFFEC: // APP12
673
- case 0xFFED: // APP13
674
- case 0xFFEE: // APP14
675
- case 0xFFEF: // APP15
676
- case 0xFFFE: { // COM (Comment)
677
- const appData = readDataBlock();
678
-
679
- if (fileMarker === 0xFFE0) {
680
- if (appData[0] === 0x4A && appData[1] === 0x46 && appData[2] === 0x49
681
- && appData[3] === 0x46 && appData[4] === 0) { // 'JFIF\x00'
682
- this.jfif = {
683
- version: { major: appData[5], minor: appData[6] },
684
- densityUnits: appData[7],
685
- xDensity: (appData[8] << 8) | appData[9],
686
- yDensity: (appData[10] << 8) | appData[11],
687
- thumbWidth: appData[12],
688
- thumbHeight: appData[13],
689
- thumbData: appData.subarray(14, 14 + (3 * appData[12] * appData[13])),
690
- };
691
- }
692
- }
693
- // TODO APP1 - Exif
694
- if (fileMarker === 0xFFEE) {
695
- if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6F
696
- && appData[3] === 0x62 && appData[4] === 0x65 && appData[5] === 0) { // 'Adobe\x00'
697
- this.adobe = {
698
- version: appData[6],
699
- flags0: (appData[7] << 8) | appData[8],
700
- flags1: (appData[9] << 8) | appData[10],
701
- transformCode: appData[11],
702
- };
703
- }
704
- }
705
- break;
706
- }
707
-
708
- case 0xFFDB: { // DQT (Define Quantization Tables)
709
- const quantizationTablesLength = readUint16();
710
- const quantizationTablesEnd = quantizationTablesLength + offset - 2;
711
- while (offset < quantizationTablesEnd) {
712
- const quantizationTableSpec = data[offset++];
713
- const tableData = new Int32Array(64);
714
- if ((quantizationTableSpec >> 4) === 0) { // 8 bit values
715
- for (let j = 0; j < 64; j++) {
716
- const z = dctZigZag[j];
717
- tableData[z] = data[offset++];
718
- }
719
- } else if ((quantizationTableSpec >> 4) === 1) { // 16 bit
720
- for (let j = 0; j < 64; j++) {
721
- const z = dctZigZag[j];
722
- tableData[z] = readUint16();
723
- }
724
- } else {
725
- throw new Error('DQT: invalid table spec');
726
- }
727
- this.quantizationTables[quantizationTableSpec & 15] = tableData;
728
- }
729
- break;
730
- }
731
-
732
- case 0xFFC0: // SOF0 (Start of Frame, Baseline DCT)
733
- case 0xFFC1: // SOF1 (Start of Frame, Extended DCT)
734
- case 0xFFC2: { // SOF2 (Start of Frame, Progressive DCT)
735
- readUint16(); // skip data length
736
- const frame = {
737
- extended: (fileMarker === 0xFFC1),
738
- progressive: (fileMarker === 0xFFC2),
739
- precision: data[offset++],
740
- scanLines: readUint16(),
741
- samplesPerLine: readUint16(),
742
- components: {},
743
- componentsOrder: [],
744
- };
745
-
746
- const componentsCount = data[offset++];
747
- let componentId;
748
- // let maxH = 0;
749
- // let maxV = 0;
750
- for (let i = 0; i < componentsCount; i++) {
751
- componentId = data[offset];
752
- const h = data[offset + 1] >> 4;
753
- const v = data[offset + 1] & 15;
754
- const qId = data[offset + 2];
755
- frame.componentsOrder.push(componentId);
756
- frame.components[componentId] = {
757
- h,
758
- v,
759
- quantizationIdx: qId,
760
- };
761
- offset += 3;
762
- }
763
- prepareComponents(frame);
764
- this.frames.push(frame);
765
- break;
766
- }
767
-
768
- case 0xFFC4: { // DHT (Define Huffman Tables)
769
- const huffmanLength = readUint16();
770
- for (let i = 2; i < huffmanLength;) {
771
- const huffmanTableSpec = data[offset++];
772
- const codeLengths = new Uint8Array(16);
773
- let codeLengthSum = 0;
774
- for (let j = 0; j < 16; j++, offset++) {
775
- codeLengths[j] = data[offset];
776
- codeLengthSum += codeLengths[j];
777
- }
778
- const huffmanValues = new Uint8Array(codeLengthSum);
779
- for (let j = 0; j < codeLengthSum; j++, offset++) {
780
- huffmanValues[j] = data[offset];
781
- }
782
- i += 17 + codeLengthSum;
783
-
784
- if ((huffmanTableSpec >> 4) === 0) {
785
- this.huffmanTablesDC[huffmanTableSpec & 15] = buildHuffmanTable(
786
- codeLengths, huffmanValues,
787
- );
788
- } else {
789
- this.huffmanTablesAC[huffmanTableSpec & 15] = buildHuffmanTable(
790
- codeLengths, huffmanValues,
791
- );
792
- }
793
- }
794
- break;
795
- }
796
-
797
- case 0xFFDD: // DRI (Define Restart Interval)
798
- readUint16(); // skip data length
799
- this.resetInterval = readUint16();
800
- break;
801
-
802
- case 0xFFDA: { // SOS (Start of Scan)
803
- readUint16(); // skip length
804
- const selectorsCount = data[offset++];
805
- const components = [];
806
- const frame = this.frames[0];
807
- for (let i = 0; i < selectorsCount; i++) {
808
- const component = frame.components[data[offset++]];
809
- const tableSpec = data[offset++];
810
- component.huffmanTableDC = this.huffmanTablesDC[tableSpec >> 4];
811
- component.huffmanTableAC = this.huffmanTablesAC[tableSpec & 15];
812
- components.push(component);
813
- }
814
- const spectralStart = data[offset++];
815
- const spectralEnd = data[offset++];
816
- const successiveApproximation = data[offset++];
817
- const processed = decodeScan(data, offset,
818
- frame, components, this.resetInterval,
819
- spectralStart, spectralEnd,
820
- successiveApproximation >> 4, successiveApproximation & 15);
821
- offset += processed;
822
- break;
823
- }
824
-
825
- case 0xFFFF: // Fill bytes
826
- if (data[offset] !== 0xFF) { // Avoid skipping a valid marker.
827
- offset--;
828
- }
829
- break;
830
-
831
- default:
832
- if (data[offset - 3] === 0xFF
833
- && data[offset - 2] >= 0xC0 && data[offset - 2] <= 0xFE) {
834
- // could be incorrect encoding -- last 0xFF byte of the previous
835
- // block was eaten by the encoder
836
- offset -= 3;
837
- break;
838
- }
839
- throw new Error(`unknown JPEG marker ${fileMarker.toString(16)}`);
840
- }
841
- fileMarker = readUint16();
842
- }
843
- }
844
-
845
- getResult() {
846
- const { frames } = this;
847
- if (this.frames.length === 0) {
848
- throw new Error('no frames were decoded');
849
- } else if (this.frames.length > 1) {
850
- console.warn('more than one frame is not supported');
851
- }
852
-
853
- // set each frame's components quantization table
854
- for (let i = 0; i < this.frames.length; i++) {
855
- const cp = this.frames[i].components;
856
- for (const j of Object.keys(cp)) {
857
- cp[j].quantizationTable = this.quantizationTables[cp[j].quantizationIdx];
858
- delete cp[j].quantizationIdx;
859
- }
860
- }
861
-
862
- const frame = frames[0];
863
- const { components, componentsOrder } = frame;
864
- const outComponents = [];
865
- const width = frame.samplesPerLine;
866
- const height = frame.scanLines;
867
-
868
- for (let i = 0; i < componentsOrder.length; i++) {
869
- const component = components[componentsOrder[i]];
870
- outComponents.push({
871
- lines: buildComponentData(frame, component),
872
- scaleX: component.h / frame.maxH,
873
- scaleY: component.v / frame.maxV,
874
- });
875
- }
876
-
877
- const out = new Uint8Array(width * height * outComponents.length);
878
- let oi = 0;
879
- for (let y = 0; y < height; ++y) {
880
- for (let x = 0; x < width; ++x) {
881
- for (let i = 0; i < outComponents.length; ++i) {
882
- const component = outComponents[i];
883
- out[oi] = component.lines[0 | y * component.scaleY][0 | x * component.scaleX];
884
- ++oi;
885
- }
886
- }
887
- }
888
- return out;
889
- }
890
- }
891
-
892
- class JpegDecoder extends _basedecoder_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"] {
893
- constructor(fileDirectory) {
894
- super();
895
- this.reader = new JpegStreamReader();
896
- if (fileDirectory.JPEGTables) {
897
- this.reader.parse(fileDirectory.JPEGTables);
898
- }
899
- }
900
-
901
- decodeBlock(buffer) {
902
- this.reader.resetFrames();
903
- this.reader.parse(new Uint8Array(buffer));
904
- return this.reader.getResult().buffer;
905
- }
906
- }
907
-
908
-
909
- /***/ }),
910
-
911
- /***/ "b3f7":
912
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
913
-
914
- "use strict";
915
-
916
- // EXPORTS
917
- __webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ basedecoder_BaseDecoder; });
918
-
919
- // CONCATENATED MODULE: ./node_modules/geotiff/dist-module/predictor.js
920
- function decodeRowAcc(row, stride) {
921
- let length = row.length - stride;
922
- let offset = 0;
923
- do {
924
- for (let i = stride; i > 0; i--) {
925
- row[offset + stride] += row[offset];
926
- offset++;
927
- }
928
-
929
- length -= stride;
930
- } while (length > 0);
931
- }
932
-
933
- function decodeRowFloatingPoint(row, stride, bytesPerSample) {
934
- let index = 0;
935
- let count = row.length;
936
- const wc = count / bytesPerSample;
937
-
938
- while (count > stride) {
939
- for (let i = stride; i > 0; --i) {
940
- row[index + stride] += row[index];
941
- ++index;
942
- }
943
- count -= stride;
944
- }
945
-
946
- const copy = row.slice();
947
- for (let i = 0; i < wc; ++i) {
948
- for (let b = 0; b < bytesPerSample; ++b) {
949
- row[(bytesPerSample * i) + b] = copy[((bytesPerSample - b - 1) * wc) + i];
950
- }
951
- }
952
- }
953
-
954
- function applyPredictor(block, predictor, width, height, bitsPerSample,
955
- planarConfiguration) {
956
- if (!predictor || predictor === 1) {
957
- return block;
958
- }
959
-
960
- for (let i = 0; i < bitsPerSample.length; ++i) {
961
- if (bitsPerSample[i] % 8 !== 0) {
962
- throw new Error('When decoding with predictor, only multiple of 8 bits are supported.');
963
- }
964
- if (bitsPerSample[i] !== bitsPerSample[0]) {
965
- throw new Error('When decoding with predictor, all samples must have the same size.');
966
- }
967
- }
968
-
969
- const bytesPerSample = bitsPerSample[0] / 8;
970
- const stride = planarConfiguration === 2 ? 1 : bitsPerSample.length;
971
-
972
- for (let i = 0; i < height; ++i) {
973
- // Last strip will be truncated if height % stripHeight != 0
974
- if (i * stride * width * bytesPerSample >= block.byteLength) {
975
- break;
976
- }
977
- let row;
978
- if (predictor === 2) { // horizontal prediction
979
- switch (bitsPerSample[0]) {
980
- case 8:
981
- row = new Uint8Array(
982
- block, i * stride * width * bytesPerSample, stride * width * bytesPerSample,
983
- );
984
- break;
985
- case 16:
986
- row = new Uint16Array(
987
- block, i * stride * width * bytesPerSample, stride * width * bytesPerSample / 2,
988
- );
989
- break;
990
- case 32:
991
- row = new Uint32Array(
992
- block, i * stride * width * bytesPerSample, stride * width * bytesPerSample / 4,
993
- );
994
- break;
995
- default:
996
- throw new Error(`Predictor 2 not allowed with ${bitsPerSample[0]} bits per sample.`);
997
- }
998
- decodeRowAcc(row, stride, bytesPerSample);
999
- } else if (predictor === 3) { // horizontal floating point
1000
- row = new Uint8Array(
1001
- block, i * stride * width * bytesPerSample, stride * width * bytesPerSample,
1002
- );
1003
- decodeRowFloatingPoint(row, stride, bytesPerSample);
1004
- }
1005
- }
1006
- return block;
1007
- }
1008
-
1009
- // CONCATENATED MODULE: ./node_modules/geotiff/dist-module/compression/basedecoder.js
1010
-
1011
-
1012
- class basedecoder_BaseDecoder {
1013
- async decode(fileDirectory, buffer) {
1014
- const decoded = await this.decodeBlock(buffer);
1015
- const predictor = fileDirectory.Predictor || 1;
1016
- if (predictor !== 1) {
1017
- const isTiled = !fileDirectory.StripOffsets;
1018
- const tileWidth = isTiled ? fileDirectory.TileWidth : fileDirectory.ImageWidth;
1019
- const tileHeight = isTiled ? fileDirectory.TileLength : (
1020
- fileDirectory.RowsPerStrip || fileDirectory.ImageLength
1021
- );
1022
- return applyPredictor(
1023
- decoded, predictor, tileWidth, tileHeight, fileDirectory.BitsPerSample,
1024
- fileDirectory.PlanarConfiguration,
1025
- );
1026
- }
1027
- return decoded;
1028
- }
1029
- }
1030
-
1031
-
1032
- /***/ })
1033
-
1034
- }]);