geotiff 3.0.2 → 3.0.4-beta.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.
- package/dist-browser/geotiff.js +3 -3
- package/dist-browser/geotiff.js.map +1 -1
- package/dist-module/compression/basedecoder.d.ts +30 -4
- package/dist-module/compression/basedecoder.d.ts.map +1 -1
- package/dist-module/compression/basedecoder.js +22 -1
- package/dist-module/compression/basedecoder.js.map +1 -0
- package/dist-module/compression/deflate.d.ts +2 -1
- package/dist-module/compression/deflate.d.ts.map +1 -1
- package/dist-module/compression/deflate.js +2 -0
- package/dist-module/compression/deflate.js.map +1 -0
- package/dist-module/compression/index.d.ts +14 -22
- package/dist-module/compression/index.d.ts.map +1 -1
- package/dist-module/compression/index.js +36 -25
- package/dist-module/compression/index.js.map +1 -0
- package/dist-module/compression/jpeg.d.ts +55 -15
- package/dist-module/compression/jpeg.d.ts.map +1 -1
- package/dist-module/compression/jpeg.js +187 -16
- package/dist-module/compression/jpeg.js.map +1 -0
- package/dist-module/compression/lerc.d.ts +11 -1
- package/dist-module/compression/lerc.d.ts.map +1 -1
- package/dist-module/compression/lerc.js +16 -4
- package/dist-module/compression/lerc.js.map +1 -0
- package/dist-module/compression/lzw.d.ts +2 -1
- package/dist-module/compression/lzw.d.ts.map +1 -1
- package/dist-module/compression/lzw.js +29 -1
- package/dist-module/compression/lzw.js.map +1 -0
- package/dist-module/compression/packbits.d.ts +2 -1
- package/dist-module/compression/packbits.d.ts.map +1 -1
- package/dist-module/compression/packbits.js +2 -0
- package/dist-module/compression/packbits.js.map +1 -0
- package/dist-module/compression/raw.d.ts +2 -1
- package/dist-module/compression/raw.d.ts.map +1 -1
- package/dist-module/compression/raw.js +2 -0
- package/dist-module/compression/raw.js.map +1 -0
- package/dist-module/compression/webimage.d.ts +2 -1
- package/dist-module/compression/webimage.d.ts.map +1 -1
- package/dist-module/compression/webimage.js +5 -0
- package/dist-module/compression/webimage.js.map +1 -0
- package/dist-module/compression/zstd.d.ts +4 -2
- package/dist-module/compression/zstd.d.ts.map +1 -1
- package/dist-module/compression/zstd.js +3 -1
- package/dist-module/compression/zstd.js.map +1 -0
- package/dist-module/dataslice.d.ts +78 -22
- package/dist-module/dataslice.d.ts.map +1 -1
- package/dist-module/dataslice.js +57 -1
- package/dist-module/dataslice.js.map +1 -0
- package/dist-module/dataview64.d.ts +71 -14
- package/dist-module/dataview64.d.ts.map +1 -1
- package/dist-module/dataview64.js +58 -1
- package/dist-module/dataview64.js.map +1 -0
- package/dist-module/geotiff.d.ts +61 -12
- package/dist-module/geotiff.d.ts.map +1 -1
- package/dist-module/geotiff.js +73 -14
- package/dist-module/geotiff.js.map +1 -0
- package/dist-module/geotiffimage.d.ts +41 -15
- package/dist-module/geotiffimage.d.ts.map +1 -1
- package/dist-module/geotiffimage.js +132 -52
- package/dist-module/geotiffimage.js.map +1 -0
- package/dist-module/geotiffwriter.d.ts +28 -1
- package/dist-module/geotiffwriter.d.ts.map +1 -1
- package/dist-module/geotiffwriter.js +206 -84
- package/dist-module/geotiffwriter.js.map +1 -0
- package/dist-module/globals.d.ts +912 -92
- package/dist-module/globals.d.ts.map +1 -1
- package/dist-module/globals.js +201 -227
- package/dist-module/globals.js.map +1 -0
- package/dist-module/imagefiledirectory.d.ts +72 -19
- package/dist-module/imagefiledirectory.d.ts.map +1 -1
- package/dist-module/imagefiledirectory.js +51 -26
- package/dist-module/imagefiledirectory.js.map +1 -0
- package/dist-module/logging.d.ts +36 -10
- package/dist-module/logging.d.ts.map +1 -1
- package/dist-module/logging.js +16 -2
- package/dist-module/logging.js.map +1 -0
- package/dist-module/pool.d.ts +15 -8
- package/dist-module/pool.d.ts.map +1 -1
- package/dist-module/pool.js +11 -3
- package/dist-module/pool.js.map +1 -0
- package/dist-module/predictor.d.ts +10 -1
- package/dist-module/predictor.d.ts.map +1 -1
- package/dist-module/predictor.js +19 -0
- package/dist-module/predictor.js.map +1 -0
- package/dist-module/resample.d.ts.map +1 -1
- package/dist-module/resample.js +12 -0
- package/dist-module/resample.js.map +1 -0
- package/dist-module/rgb.js +1 -0
- package/dist-module/rgb.js.map +1 -0
- package/dist-module/source/arraybuffer.d.ts +7 -4
- package/dist-module/source/arraybuffer.d.ts.map +1 -1
- package/dist-module/source/arraybuffer.js +15 -1
- package/dist-module/source/arraybuffer.js.map +1 -0
- package/dist-module/source/basesource.d.ts +11 -6
- package/dist-module/source/basesource.d.ts.map +1 -1
- package/dist-module/source/basesource.js +7 -4
- package/dist-module/source/basesource.js.map +1 -0
- package/dist-module/source/blockedsource.d.ts +2 -2
- package/dist-module/source/blockedsource.d.ts.map +1 -1
- package/dist-module/source/blockedsource.js +8 -5
- package/dist-module/source/blockedsource.js.map +1 -0
- package/dist-module/source/client/base.d.ts +8 -7
- package/dist-module/source/client/base.d.ts.map +1 -1
- package/dist-module/source/client/base.js +7 -5
- package/dist-module/source/client/base.js.map +1 -0
- package/dist-module/source/client/fetch.d.ts +6 -2
- package/dist-module/source/client/fetch.d.ts.map +1 -1
- package/dist-module/source/client/fetch.js +7 -2
- package/dist-module/source/client/fetch.js.map +1 -0
- package/dist-module/source/client/http.d.ts +27 -5
- package/dist-module/source/client/http.d.ts.map +1 -1
- package/dist-module/source/client/http.js +16 -2
- package/dist-module/source/client/http.js.map +1 -0
- package/dist-module/source/client/xhr.d.ts +22 -3
- package/dist-module/source/client/xhr.d.ts.map +1 -1
- package/dist-module/source/client/xhr.js +12 -2
- package/dist-module/source/client/xhr.js.map +1 -0
- package/dist-module/source/file.d.ts +8 -5
- package/dist-module/source/file.d.ts.map +1 -1
- package/dist-module/source/file.js +40 -8
- package/dist-module/source/file.js.map +1 -0
- package/dist-module/source/filereader.d.ts +12 -4
- package/dist-module/source/filereader.d.ts.map +1 -1
- package/dist-module/source/filereader.js +15 -2
- package/dist-module/source/filereader.js.map +1 -0
- package/dist-module/source/httputils.d.ts +16 -9
- package/dist-module/source/httputils.d.ts.map +1 -1
- package/dist-module/source/httputils.js +19 -12
- package/dist-module/source/httputils.js.map +1 -0
- package/dist-module/source/remote.d.ts.map +1 -1
- package/dist-module/source/remote.js +19 -7
- package/dist-module/source/remote.js.map +1 -0
- package/dist-module/utils.d.ts +36 -41
- package/dist-module/utils.d.ts.map +1 -1
- package/dist-module/utils.js +17 -12
- package/dist-module/utils.js.map +1 -0
- package/dist-module/worker/create.js +1 -1
- package/dist-module/worker/create.js.map +1 -0
- package/dist-module/worker/decoder.d.ts +2 -0
- package/dist-module/worker/decoder.d.ts.map +1 -0
- package/dist-module/worker/decoder.js +21 -0
- package/dist-module/worker/decoder.js.map +1 -0
- package/dist-node/compression/basedecoder.d.ts +30 -4
- package/dist-node/compression/basedecoder.d.ts.map +1 -1
- package/dist-node/compression/basedecoder.js +22 -1
- package/dist-node/compression/basedecoder.js.map +1 -1
- package/dist-node/compression/deflate.d.ts +2 -1
- package/dist-node/compression/deflate.d.ts.map +1 -1
- package/dist-node/compression/deflate.js +2 -0
- package/dist-node/compression/deflate.js.map +1 -1
- package/dist-node/compression/index.d.ts +14 -22
- package/dist-node/compression/index.d.ts.map +1 -1
- package/dist-node/compression/index.js +36 -25
- package/dist-node/compression/index.js.map +1 -1
- package/dist-node/compression/jpeg.d.ts +55 -16
- package/dist-node/compression/jpeg.d.ts.map +1 -1
- package/dist-node/compression/jpeg.js +187 -16
- package/dist-node/compression/jpeg.js.map +1 -1
- package/dist-node/compression/lerc.d.ts +11 -1
- package/dist-node/compression/lerc.d.ts.map +1 -1
- package/dist-node/compression/lerc.js +16 -4
- package/dist-node/compression/lerc.js.map +1 -1
- package/dist-node/compression/lzw.d.ts +2 -1
- package/dist-node/compression/lzw.d.ts.map +1 -1
- package/dist-node/compression/lzw.js +29 -1
- package/dist-node/compression/lzw.js.map +1 -1
- package/dist-node/compression/packbits.d.ts +2 -1
- package/dist-node/compression/packbits.d.ts.map +1 -1
- package/dist-node/compression/packbits.js +2 -0
- package/dist-node/compression/packbits.js.map +1 -1
- package/dist-node/compression/raw.d.ts +2 -1
- package/dist-node/compression/raw.d.ts.map +1 -1
- package/dist-node/compression/raw.js +2 -0
- package/dist-node/compression/raw.js.map +1 -1
- package/dist-node/compression/webimage.d.ts +2 -2
- package/dist-node/compression/webimage.d.ts.map +1 -1
- package/dist-node/compression/webimage.js +5 -0
- package/dist-node/compression/webimage.js.map +1 -1
- package/dist-node/compression/zstd.d.ts +2 -1
- package/dist-node/compression/zstd.d.ts.map +1 -1
- package/dist-node/compression/zstd.js +3 -1
- package/dist-node/compression/zstd.js.map +1 -1
- package/dist-node/dataslice.d.ts +78 -22
- package/dist-node/dataslice.d.ts.map +1 -1
- package/dist-node/dataslice.js +57 -1
- package/dist-node/dataslice.js.map +1 -1
- package/dist-node/dataview64.d.ts +71 -14
- package/dist-node/dataview64.d.ts.map +1 -1
- package/dist-node/dataview64.js +58 -1
- package/dist-node/dataview64.js.map +1 -1
- package/dist-node/geotiff.d.ts +61 -12
- package/dist-node/geotiff.d.ts.map +1 -1
- package/dist-node/geotiff.js +75 -15
- package/dist-node/geotiff.js.map +1 -1
- package/dist-node/geotiffimage.d.ts +41 -15
- package/dist-node/geotiffimage.d.ts.map +1 -1
- package/dist-node/geotiffimage.js +132 -52
- package/dist-node/geotiffimage.js.map +1 -1
- package/dist-node/geotiffwriter.d.ts +28 -1
- package/dist-node/geotiffwriter.d.ts.map +1 -1
- package/dist-node/geotiffwriter.js +206 -84
- package/dist-node/geotiffwriter.js.map +1 -1
- package/dist-node/globals.d.ts +910 -90
- package/dist-node/globals.d.ts.map +1 -1
- package/dist-node/globals.js +202 -228
- package/dist-node/globals.js.map +1 -1
- package/dist-node/imagefiledirectory.d.ts +72 -19
- package/dist-node/imagefiledirectory.d.ts.map +1 -1
- package/dist-node/imagefiledirectory.js +51 -26
- package/dist-node/imagefiledirectory.js.map +1 -1
- package/dist-node/logging.d.ts +36 -10
- package/dist-node/logging.d.ts.map +1 -1
- package/dist-node/logging.js +16 -2
- package/dist-node/logging.js.map +1 -1
- package/dist-node/pool.d.ts +15 -8
- package/dist-node/pool.d.ts.map +1 -1
- package/dist-node/pool.js +11 -3
- package/dist-node/pool.js.map +1 -1
- package/dist-node/predictor.d.ts +10 -1
- package/dist-node/predictor.d.ts.map +1 -1
- package/dist-node/predictor.js +19 -0
- package/dist-node/predictor.js.map +1 -1
- package/dist-node/resample.d.ts.map +1 -1
- package/dist-node/resample.js +12 -0
- package/dist-node/resample.js.map +1 -1
- package/dist-node/rgb.js +1 -0
- package/dist-node/rgb.js.map +1 -1
- package/dist-node/source/arraybuffer.d.ts +7 -4
- package/dist-node/source/arraybuffer.d.ts.map +1 -1
- package/dist-node/source/arraybuffer.js +15 -1
- package/dist-node/source/arraybuffer.js.map +1 -1
- package/dist-node/source/basesource.d.ts +11 -6
- package/dist-node/source/basesource.d.ts.map +1 -1
- package/dist-node/source/basesource.js +7 -4
- package/dist-node/source/basesource.js.map +1 -1
- package/dist-node/source/blockedsource.d.ts +2 -2
- package/dist-node/source/blockedsource.d.ts.map +1 -1
- package/dist-node/source/blockedsource.js +8 -5
- package/dist-node/source/blockedsource.js.map +1 -1
- package/dist-node/source/client/base.d.ts +8 -7
- package/dist-node/source/client/base.d.ts.map +1 -1
- package/dist-node/source/client/base.js +7 -5
- package/dist-node/source/client/base.js.map +1 -1
- package/dist-node/source/client/fetch.d.ts +5 -2
- package/dist-node/source/client/fetch.d.ts.map +1 -1
- package/dist-node/source/client/fetch.js +7 -2
- package/dist-node/source/client/fetch.js.map +1 -1
- package/dist-node/source/client/http.d.ts +22 -4
- package/dist-node/source/client/http.d.ts.map +1 -1
- package/dist-node/source/client/http.js +16 -2
- package/dist-node/source/client/http.js.map +1 -1
- package/dist-node/source/client/xhr.d.ts +23 -3
- package/dist-node/source/client/xhr.d.ts.map +1 -1
- package/dist-node/source/client/xhr.js +12 -2
- package/dist-node/source/client/xhr.js.map +1 -1
- package/dist-node/source/file.d.ts +8 -5
- package/dist-node/source/file.d.ts.map +1 -1
- package/dist-node/source/file.js +40 -8
- package/dist-node/source/file.js.map +1 -1
- package/dist-node/source/filereader.d.ts +12 -4
- package/dist-node/source/filereader.d.ts.map +1 -1
- package/dist-node/source/filereader.js +15 -2
- package/dist-node/source/filereader.js.map +1 -1
- package/dist-node/source/httputils.d.ts +16 -9
- package/dist-node/source/httputils.d.ts.map +1 -1
- package/dist-node/source/httputils.js +19 -12
- package/dist-node/source/httputils.js.map +1 -1
- package/dist-node/source/remote.d.ts.map +1 -1
- package/dist-node/source/remote.js +19 -7
- package/dist-node/source/remote.js.map +1 -1
- package/dist-node/utils.d.ts +9 -8
- package/dist-node/utils.d.ts.map +1 -1
- package/dist-node/utils.js +17 -12
- package/dist-node/utils.js.map +1 -1
- package/dist-node/worker/create.js +1 -1
- package/dist-node/worker/create.js.map +1 -1
- package/dist-node/worker/decoder.d.ts +2 -0
- package/dist-node/worker/decoder.d.ts.map +1 -0
- package/dist-node/worker/decoder.js +24 -0
- package/dist-node/worker/decoder.js.map +1 -0
- package/package.json +5 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/worker/create.js"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,OAAO,MAAM,MAAM,YAAY,CAAC;AAEhC,MAAM,CAAC,OAAO,UAAU,MAAM;IAC5B,OAAO,IAAI,MAAM,CAAC,IAAI,GAAG,CAAC,cAAc,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QAC1D,IAAI,EAAE,QAAQ;KACf,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decoder.d.ts","sourceRoot":"","sources":["../../src/worker/decoder.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/* global globalThis */
|
|
2
|
+
/* eslint-disable import/no-mutable-exports */
|
|
3
|
+
import { getDecoder } from '../compression/index.js';
|
|
4
|
+
const worker = globalThis;
|
|
5
|
+
worker.addEventListener('message', async (e) => {
|
|
6
|
+
const { compression, decoderParameters, buffer, ...extra } = e.data;
|
|
7
|
+
try {
|
|
8
|
+
const decoder = await getDecoder(compression, decoderParameters);
|
|
9
|
+
const decoded = await decoder.decode(buffer);
|
|
10
|
+
worker.postMessage({ decoded, ...extra }, { transfer: [decoded] });
|
|
11
|
+
}
|
|
12
|
+
catch (error) {
|
|
13
|
+
if (error instanceof Error) {
|
|
14
|
+
worker.postMessage({ error: error.message, ...extra });
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
worker.postMessage({ error: String(error), ...extra });
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
//# sourceMappingURL=decoder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decoder.js","sourceRoot":"","sources":["../../src/worker/decoder.js"],"names":[],"mappings":"AAAA,uBAAuB;AACvB,8CAA8C;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,MAAM,MAAM,GAAG,UAAU,CAAC;AAE1B,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;IAC7C,MAAM,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC;IACpE,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAC;QACjE,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC7C,MAAM,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACrE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YAC3B,MAAM,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC;QACzD,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC;QACzD,CAAC;IACH,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -1,10 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} BaseDecoderParameters
|
|
3
|
+
* @property {number} tileWidth
|
|
4
|
+
* @property {number} tileHeight
|
|
5
|
+
* @property {number} predictor
|
|
6
|
+
* @property {number|number[]|import('../geotiff.js').TypedArray} bitsPerSample
|
|
7
|
+
* @property {number} planarConfiguration
|
|
8
|
+
* @property {number} [samplesPerPixel]
|
|
9
|
+
*/
|
|
1
10
|
export default class BaseDecoder {
|
|
2
|
-
|
|
3
|
-
|
|
11
|
+
/**
|
|
12
|
+
* @param {BaseDecoderParameters} parameters
|
|
13
|
+
*/
|
|
14
|
+
constructor(parameters: BaseDecoderParameters);
|
|
15
|
+
parameters: BaseDecoderParameters;
|
|
4
16
|
/**
|
|
5
17
|
* @abstract
|
|
18
|
+
* @param {ArrayBufferLike} _buffer
|
|
19
|
+
* @returns {Promise<ArrayBufferLike>|ArrayBufferLike}
|
|
20
|
+
*/
|
|
21
|
+
decodeBlock(_buffer: ArrayBufferLike): Promise<ArrayBufferLike> | ArrayBufferLike;
|
|
22
|
+
/**
|
|
23
|
+
* @param {ArrayBufferLike} buffer
|
|
24
|
+
* @returns {Promise<ArrayBufferLike>}
|
|
6
25
|
*/
|
|
7
|
-
|
|
8
|
-
decode(buffer: any): Promise<any>;
|
|
26
|
+
decode(buffer: ArrayBufferLike): Promise<ArrayBufferLike>;
|
|
9
27
|
}
|
|
28
|
+
export type BaseDecoderParameters = {
|
|
29
|
+
tileWidth: number;
|
|
30
|
+
tileHeight: number;
|
|
31
|
+
predictor: number;
|
|
32
|
+
bitsPerSample: number | number[] | import("../geotiff.js").TypedArray;
|
|
33
|
+
planarConfiguration: number;
|
|
34
|
+
samplesPerPixel?: number | undefined;
|
|
35
|
+
};
|
|
10
36
|
//# sourceMappingURL=basedecoder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basedecoder.d.ts","sourceRoot":"","sources":["../../dist-module/compression/basedecoder.js"],"names":[],"mappings":"AACA;IACI,
|
|
1
|
+
{"version":3,"file":"basedecoder.d.ts","sourceRoot":"","sources":["../../dist-module/compression/basedecoder.js"],"names":[],"mappings":"AACA;;;;;;;;GAQG;AACH;IACI;;OAEG;IACH,wBAFW,qBAAqB,EAI/B;IADG,kCAA4B;IAEhC;;;;OAIG;IACH,qBAHW,eAAe,GACb,OAAO,CAAC,eAAe,CAAC,GAAC,eAAe,CAIpD;IACD;;;OAGG;IACH,eAHW,eAAe,GACb,OAAO,CAAC,eAAe,CAAC,CAWpC;CACJ;;eApCa,MAAM;gBACN,MAAM;eACN,MAAM;mBACN,MAAM,GAAC,MAAM,EAAE,GAAC,OAAO,eAAe,EAAE,UAAU;yBAClD,MAAM"}
|
|
@@ -1,24 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const predictor_js_1 = require("../predictor.js");
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {Object} BaseDecoderParameters
|
|
6
|
+
* @property {number} tileWidth
|
|
7
|
+
* @property {number} tileHeight
|
|
8
|
+
* @property {number} predictor
|
|
9
|
+
* @property {number|number[]|import('../geotiff.js').TypedArray} bitsPerSample
|
|
10
|
+
* @property {number} planarConfiguration
|
|
11
|
+
* @property {number} [samplesPerPixel]
|
|
12
|
+
*/
|
|
4
13
|
class BaseDecoder {
|
|
14
|
+
/**
|
|
15
|
+
* @param {BaseDecoderParameters} parameters
|
|
16
|
+
*/
|
|
5
17
|
constructor(parameters) {
|
|
6
18
|
this.parameters = parameters;
|
|
7
19
|
}
|
|
8
20
|
/**
|
|
9
21
|
* @abstract
|
|
22
|
+
* @param {ArrayBufferLike} _buffer
|
|
23
|
+
* @returns {Promise<ArrayBufferLike>|ArrayBufferLike}
|
|
10
24
|
*/
|
|
11
25
|
decodeBlock(_buffer) {
|
|
12
26
|
throw new Error('decodeBlock not implemented');
|
|
13
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* @param {ArrayBufferLike} buffer
|
|
30
|
+
* @returns {Promise<ArrayBufferLike>}
|
|
31
|
+
*/
|
|
14
32
|
async decode(buffer) {
|
|
15
33
|
const decoded = await this.decodeBlock(buffer);
|
|
16
34
|
const { tileWidth, tileHeight, predictor, bitsPerSample, planarConfiguration, } = this.parameters;
|
|
17
35
|
if (predictor !== 1) {
|
|
18
|
-
|
|
36
|
+
const isBitsPerSampleArray = Array.isArray(bitsPerSample) || ArrayBuffer.isView(bitsPerSample);
|
|
37
|
+
const adaptedBitsPerSample = isBitsPerSampleArray ? Array.from(bitsPerSample) : [bitsPerSample];
|
|
38
|
+
return (0, predictor_js_1.applyPredictor)(decoded, predictor, tileWidth, tileHeight, adaptedBitsPerSample, planarConfiguration);
|
|
19
39
|
}
|
|
20
40
|
return decoded;
|
|
21
41
|
}
|
|
22
42
|
}
|
|
23
43
|
exports.default = BaseDecoder;
|
|
44
|
+
//# sourceMappingURL=basedecoder.js.map
|
|
24
45
|
//# sourceMappingURL=basedecoder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basedecoder.js","sourceRoot":"","sources":["../../dist-module/compression/basedecoder.js"],"names":[],"mappings":";;AAAA,kDAAiD;AACjD,MAAqB,WAAW;IAC5B,YAAY,UAAU;QAClB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IACjC,CAAC;IACD
|
|
1
|
+
{"version":3,"file":"basedecoder.js","sourceRoot":"","sources":["../../dist-module/compression/basedecoder.js"],"names":[],"mappings":";;AAAA,kDAAiD;AACjD;;;;;;;;GAQG;AACH,MAAqB,WAAW;IAC5B;;OAEG;IACH,YAAY,UAAU;QAClB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IACjC,CAAC;IACD;;;;OAIG;IACH,WAAW,CAAC,OAAO;QACf,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;IACnD,CAAC;IACD;;;OAGG;IACH,KAAK,CAAC,MAAM,CAAC,MAAM;QACf,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QAC/C,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,mBAAmB,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC;QAClG,IAAI,SAAS,KAAK,CAAC,EAAE,CAAC;YAClB,MAAM,oBAAoB,GAAG,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;YAC/F,MAAM,oBAAoB,GAAG,oBAAoB,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC;YAChG,OAAO,IAAA,6BAAc,EAAC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,oBAAoB,EAAE,mBAAmB,CAAC,CAAC;QAChH,CAAC;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AA7BD,8BA6BC;AACD,uCAAuC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deflate.d.ts","sourceRoot":"","sources":["../../dist-module/compression/deflate.js"],"names":[],"mappings":"AAEA;IACI,
|
|
1
|
+
{"version":3,"file":"deflate.d.ts","sourceRoot":"","sources":["../../dist-module/compression/deflate.js"],"names":[],"mappings":"AAEA;IACI,kCAAkC;IAClC,oBADY,WAAW,eAGtB;CACJ;wBANuB,kBAAkB"}
|
|
@@ -6,9 +6,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const pako_1 = require("pako");
|
|
7
7
|
const basedecoder_js_1 = __importDefault(require("./basedecoder.js"));
|
|
8
8
|
class DeflateDecoder extends basedecoder_js_1.default {
|
|
9
|
+
/** @param {ArrayBuffer} buffer */
|
|
9
10
|
decodeBlock(buffer) {
|
|
10
11
|
return (0, pako_1.inflate)(new Uint8Array(buffer)).buffer;
|
|
11
12
|
}
|
|
12
13
|
}
|
|
13
14
|
exports.default = DeflateDecoder;
|
|
15
|
+
//# sourceMappingURL=deflate.js.map
|
|
14
16
|
//# sourceMappingURL=deflate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deflate.js","sourceRoot":"","sources":["../../dist-module/compression/deflate.js"],"names":[],"mappings":";;;;;AAAA,+BAA+B;AAC/B,sEAA2C;AAC3C,MAAqB,cAAe,SAAQ,wBAAW;IACnD,WAAW,CAAC,MAAM;QACd,OAAO,IAAA,cAAO,EAAC,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;IAClD,CAAC;CACJ;
|
|
1
|
+
{"version":3,"file":"deflate.js","sourceRoot":"","sources":["../../dist-module/compression/deflate.js"],"names":[],"mappings":";;;;;AAAA,+BAA+B;AAC/B,sEAA2C;AAC3C,MAAqB,cAAe,SAAQ,wBAAW;IACnD,kCAAkC;IAClC,WAAW,CAAC,MAAM;QACd,OAAO,IAAA,cAAO,EAAC,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;IAClD,CAAC;CACJ;AALD,iCAKC;AACD,mCAAmC"}
|
|
@@ -1,43 +1,35 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Either a number or undefined.
|
|
3
|
-
* @typedef {(number|undefined)} NumberOrUndefined
|
|
4
|
-
*/
|
|
5
1
|
/**
|
|
6
2
|
* Register a decoder for a specific compression method or a range of compressions
|
|
7
|
-
* @param {(
|
|
8
|
-
* @param {function():Promise} importFn the function to import the decoder
|
|
9
|
-
* @param {function(import("../imagefiledirectory").ImageFileDirectory):Promise} decoderParameterFn
|
|
3
|
+
* @param {(number|undefined|(number|undefined)[])} cases ids of the compression methods to register for
|
|
4
|
+
* @param {function():Promise<typeof BaseDecoder>} importFn the function to import the decoder
|
|
5
|
+
* @param {function(import("../imagefiledirectory").ImageFileDirectory):Promise<BaseDecoderParameters>} decoderParameterFn
|
|
10
6
|
* @param {boolean} preferWorker_ Whether to prefer running the decoder in a worker
|
|
11
7
|
*/
|
|
12
|
-
export function addDecoder(cases: (
|
|
8
|
+
export function addDecoder(cases: (number | undefined | (number | undefined)[]), importFn: () => Promise<typeof BaseDecoder>, decoderParameterFn?: (arg0: import("../imagefiledirectory").ImageFileDirectory) => Promise<BaseDecoderParameters>, preferWorker_?: boolean): void;
|
|
13
9
|
/**
|
|
14
10
|
* Get the required decoder parameters for a specific compression method
|
|
15
|
-
* @param {
|
|
11
|
+
* @param {number|undefined} compression
|
|
16
12
|
* @param {import('../imagefiledirectory.js').ImageFileDirectory} fileDirectory
|
|
17
13
|
*/
|
|
18
|
-
export function getDecoderParameters(compression:
|
|
14
|
+
export function getDecoderParameters(compression: number | undefined, fileDirectory: import("../imagefiledirectory.js").ImageFileDirectory): Promise<BaseDecoderParameters>;
|
|
19
15
|
/**
|
|
20
16
|
* Get a decoder for a specific compression and parameters
|
|
21
17
|
* @param {number} compression the compression method identifier
|
|
22
|
-
* @param {
|
|
18
|
+
* @param {BaseDecoderParameters} decoderParameters the parameters for the decoder
|
|
23
19
|
* @returns {Promise<import('./basedecoder.js').default>}
|
|
24
20
|
*/
|
|
25
|
-
export function getDecoder(compression: number, decoderParameters:
|
|
21
|
+
export function getDecoder(compression: number, decoderParameters: BaseDecoderParameters): Promise<import("./basedecoder.js").default>;
|
|
26
22
|
/**
|
|
27
23
|
* Whether to prefer running the decoder in a worker
|
|
28
24
|
* @param {number|undefined} compression the compression method identifier
|
|
29
25
|
* @returns {boolean}
|
|
30
26
|
*/
|
|
31
27
|
export function preferWorker(compression: number | undefined): boolean;
|
|
32
|
-
export type
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
bitsPerSample: number;
|
|
37
|
-
predictor: number;
|
|
28
|
+
export type RegistryEntry = {
|
|
29
|
+
importFn: () => Promise<typeof BaseDecoder>;
|
|
30
|
+
decoderParameterFn: (arg0: import("../imagefiledirectory").ImageFileDirectory) => Promise<BaseDecoderParameters>;
|
|
31
|
+
preferWorker: boolean;
|
|
38
32
|
};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
*/
|
|
42
|
-
export type NumberOrUndefined = (number | undefined);
|
|
33
|
+
import type BaseDecoder from "./basedecoder.js";
|
|
34
|
+
import type { BaseDecoderParameters } from "./basedecoder.js";
|
|
43
35
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../dist-module/compression/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../dist-module/compression/index.js"],"names":[],"mappings":"AA6BA;;;;;;GAMG;AACH,kCALW,CAAC,MAAM,GAAC,SAAS,GAAC,CAAC,MAAM,GAAC,SAAS,CAAC,EAAE,CAAC,YACvC,MAAW,OAAO,CAAC,kBAAkB,CAAC,uBACtC,CAAS,IAAkD,EAAlD,OAAO,uBAAuB,EAAE,kBAAkB,KAAE,OAAO,CAAC,qBAAqB,CAAC,kBAC3F,OAAO,QASjB;AACD;;;;GAIG;AACH,kDAHW,MAAM,GAAC,SAAS,iBAChB,OAAO,0BAA0B,EAAE,kBAAkB,kCAQ/D;AACD;;;;;GAKG;AACH,wCAJW,MAAM,qBACN,qBAAqB,GACnB,OAAO,CAAC,OAAO,kBAAkB,EAAE,OAAO,CAAC,CASvD;AACD;;;;GAIG;AACH,0CAHW,MAAM,GAAC,SAAS,GACd,OAAO,CAOnB;;cA7Ea,MAAW,OAAO,CAAC,kBAAkB,CAAC;wBACtC,CAAS,IAAkD,EAAlD,OAAO,uBAAuB,EAAE,kBAAkB,KAAE,OAAO,CAAC,qBAAqB,CAAC;kBAC3F,OAAO;;6BALiC,kBAAkB;2CAAlB,kBAAkB"}
|
|
@@ -37,39 +37,40 @@ exports.addDecoder = addDecoder;
|
|
|
37
37
|
exports.getDecoderParameters = getDecoderParameters;
|
|
38
38
|
exports.getDecoder = getDecoder;
|
|
39
39
|
exports.preferWorker = preferWorker;
|
|
40
|
-
|
|
40
|
+
/** @import BaseDecoder, {BaseDecoderParameters} from "./basedecoder.js" */
|
|
41
41
|
/**
|
|
42
|
-
* @typedef {Object}
|
|
43
|
-
* @property {
|
|
44
|
-
* @property {
|
|
45
|
-
* @property {
|
|
46
|
-
* @property {number} bitsPerSample
|
|
47
|
-
* @property {number} predictor
|
|
42
|
+
* @typedef {Object} RegistryEntry
|
|
43
|
+
* @property {function():Promise<typeof BaseDecoder>} importFn
|
|
44
|
+
* @property {function(import("../imagefiledirectory").ImageFileDirectory):Promise<BaseDecoderParameters>} decoderParameterFn
|
|
45
|
+
* @property {boolean} preferWorker
|
|
48
46
|
*/
|
|
47
|
+
/** @type {Map<number | undefined, RegistryEntry>} */
|
|
48
|
+
const registry = new Map();
|
|
49
49
|
/**
|
|
50
50
|
* Default decoder parameter retrieval function
|
|
51
51
|
* @param {import("../imagefiledirectory").ImageFileDirectory} fileDirectory
|
|
52
|
-
* @returns {Promise<
|
|
52
|
+
* @returns {Promise<BaseDecoderParameters>}
|
|
53
53
|
*/
|
|
54
54
|
async function defaultDecoderParameterFn(fileDirectory) {
|
|
55
55
|
const isTiled = !fileDirectory.hasTag('StripOffsets');
|
|
56
|
-
return {
|
|
57
|
-
tileWidth: isTiled
|
|
58
|
-
|
|
56
|
+
return /** @type {BaseDecoderParameters} */ ({
|
|
57
|
+
tileWidth: isTiled
|
|
58
|
+
? await fileDirectory.loadValue('TileWidth')
|
|
59
|
+
: await fileDirectory.loadValue('ImageWidth'),
|
|
60
|
+
tileHeight: isTiled
|
|
61
|
+
? await fileDirectory.loadValue('TileLength')
|
|
62
|
+
: (await fileDirectory.loadValue('RowsPerStrip')
|
|
63
|
+
|| await fileDirectory.loadValue('ImageLength')),
|
|
59
64
|
planarConfiguration: await fileDirectory.loadValue('PlanarConfiguration'),
|
|
60
65
|
bitsPerSample: await fileDirectory.loadValue('BitsPerSample'),
|
|
61
66
|
predictor: await fileDirectory.loadValue('Predictor') || 1,
|
|
62
|
-
};
|
|
67
|
+
});
|
|
63
68
|
}
|
|
64
|
-
/**
|
|
65
|
-
* Either a number or undefined.
|
|
66
|
-
* @typedef {(number|undefined)} NumberOrUndefined
|
|
67
|
-
*/
|
|
68
69
|
/**
|
|
69
70
|
* Register a decoder for a specific compression method or a range of compressions
|
|
70
|
-
* @param {(
|
|
71
|
-
* @param {function():Promise} importFn the function to import the decoder
|
|
72
|
-
* @param {function(import("../imagefiledirectory").ImageFileDirectory):Promise} decoderParameterFn
|
|
71
|
+
* @param {(number|undefined|(number|undefined)[])} cases ids of the compression methods to register for
|
|
72
|
+
* @param {function():Promise<typeof BaseDecoder>} importFn the function to import the decoder
|
|
73
|
+
* @param {function(import("../imagefiledirectory").ImageFileDirectory):Promise<BaseDecoderParameters>} decoderParameterFn
|
|
73
74
|
* @param {boolean} preferWorker_ Whether to prefer running the decoder in a worker
|
|
74
75
|
*/
|
|
75
76
|
function addDecoder(cases, importFn, decoderParameterFn = defaultDecoderParameterFn, preferWorker_ = true) {
|
|
@@ -82,27 +83,27 @@ function addDecoder(cases, importFn, decoderParameterFn = defaultDecoderParamete
|
|
|
82
83
|
}
|
|
83
84
|
/**
|
|
84
85
|
* Get the required decoder parameters for a specific compression method
|
|
85
|
-
* @param {
|
|
86
|
+
* @param {number|undefined} compression
|
|
86
87
|
* @param {import('../imagefiledirectory.js').ImageFileDirectory} fileDirectory
|
|
87
88
|
*/
|
|
88
89
|
async function getDecoderParameters(compression, fileDirectory) {
|
|
89
90
|
if (!registry.has(compression)) {
|
|
90
91
|
throw new Error(`Unknown compression method identifier: ${compression}`);
|
|
91
92
|
}
|
|
92
|
-
const { decoderParameterFn } = registry.get(compression);
|
|
93
|
+
const { decoderParameterFn } = /** @type {RegistryEntry} */ (registry.get(compression));
|
|
93
94
|
return decoderParameterFn(fileDirectory);
|
|
94
95
|
}
|
|
95
96
|
/**
|
|
96
97
|
* Get a decoder for a specific compression and parameters
|
|
97
98
|
* @param {number} compression the compression method identifier
|
|
98
|
-
* @param {
|
|
99
|
+
* @param {BaseDecoderParameters} decoderParameters the parameters for the decoder
|
|
99
100
|
* @returns {Promise<import('./basedecoder.js').default>}
|
|
100
101
|
*/
|
|
101
102
|
async function getDecoder(compression, decoderParameters) {
|
|
102
103
|
if (!registry.has(compression)) {
|
|
103
104
|
throw new Error(`Unknown compression method identifier: ${compression}`);
|
|
104
105
|
}
|
|
105
|
-
const { importFn } = registry.get(compression);
|
|
106
|
+
const { importFn } = /** @type {RegistryEntry} */ (registry.get(compression));
|
|
106
107
|
const Decoder = await importFn();
|
|
107
108
|
return new Decoder(decoderParameters);
|
|
108
109
|
}
|
|
@@ -115,7 +116,7 @@ function preferWorker(compression) {
|
|
|
115
116
|
if (!registry.has(compression)) {
|
|
116
117
|
throw new Error(`Unknown compression method identifier: ${compression}`);
|
|
117
118
|
}
|
|
118
|
-
return registry.get(compression).preferWorker;
|
|
119
|
+
return /** @type {RegistryEntry} */ (registry.get(compression)).preferWorker;
|
|
119
120
|
}
|
|
120
121
|
const defaultDecoderDefinitions = [
|
|
121
122
|
// No compression
|
|
@@ -140,6 +141,9 @@ const defaultDecoderDefinitions = [
|
|
|
140
141
|
{
|
|
141
142
|
cases: 7,
|
|
142
143
|
importFn: () => Promise.resolve().then(() => __importStar(require('./jpeg.js'))).then((m) => m.default),
|
|
144
|
+
/**
|
|
145
|
+
* @param {import("../imagefiledirectory").ImageFileDirectory} fileDirectory
|
|
146
|
+
*/
|
|
143
147
|
decoderParameterFn: async (fileDirectory) => {
|
|
144
148
|
return {
|
|
145
149
|
...await defaultDecoderParameterFn(fileDirectory),
|
|
@@ -165,6 +169,9 @@ const defaultDecoderDefinitions = [
|
|
|
165
169
|
return m;
|
|
166
170
|
})
|
|
167
171
|
.then((m) => m.default),
|
|
172
|
+
/**
|
|
173
|
+
* @param {import("../imagefiledirectory").ImageFileDirectory} fileDirectory
|
|
174
|
+
*/
|
|
168
175
|
decoderParameterFn: async (fileDirectory) => {
|
|
169
176
|
return {
|
|
170
177
|
...await defaultDecoderParameterFn(fileDirectory),
|
|
@@ -185,10 +192,13 @@ const defaultDecoderDefinitions = [
|
|
|
185
192
|
{
|
|
186
193
|
cases: 50001,
|
|
187
194
|
importFn: () => Promise.resolve().then(() => __importStar(require('./webimage.js'))).then((m) => m.default),
|
|
195
|
+
/**
|
|
196
|
+
* @param {import("../imagefiledirectory").ImageFileDirectory} fileDirectory
|
|
197
|
+
*/
|
|
188
198
|
decoderParameterFn: async (fileDirectory) => {
|
|
189
199
|
return {
|
|
190
200
|
...await defaultDecoderParameterFn(fileDirectory),
|
|
191
|
-
samplesPerPixel: await fileDirectory.loadValue('SamplesPerPixel') || 4,
|
|
201
|
+
samplesPerPixel: Number(await fileDirectory.loadValue('SamplesPerPixel')) || 4,
|
|
192
202
|
};
|
|
193
203
|
},
|
|
194
204
|
preferWorker: false,
|
|
@@ -199,4 +209,5 @@ for (const decoderDefinition of defaultDecoderDefinitions) {
|
|
|
199
209
|
const { cases, importFn, decoderParameterFn, preferWorker: preferWorker_ } = decoderDefinition;
|
|
200
210
|
addDecoder(cases, importFn, decoderParameterFn, preferWorker_);
|
|
201
211
|
}
|
|
212
|
+
//# sourceMappingURL=index.js.map
|
|
202
213
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../dist-module/compression/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../d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,CAAC,MAAM,aAAa,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC,IAAI,CAAC;aACjF,CAAC;QACN,CAAC;QACD,YAAY,EAAE,KAAK;KACtB;CACJ,CAAC;AACF,sFAAsF;AACtF,KAAK,MAAM,iBAAiB,IAAI,yBAAyB,EAAE,CAAC;IACxD,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,kBAAkB,EAAE,YAAY,EAAE,aAAa,EAAE,GAAG,iBAAiB,CAAC;IAC/F,UAAU,CAAC,KAAK,EAAE,QAAQ,EAAE,kBAAkB,EAAE,aAAa,CAAC,CAAC;AACnE,CAAC;AACD,iCAAiC"}
|
|
@@ -1,40 +1,79 @@
|
|
|
1
1
|
export default class JpegDecoder extends BaseDecoder {
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* @param {import('./basedecoder.js').BaseDecoderParameters & { JPEGTables?: Uint8Array }} parameters
|
|
4
|
+
*/
|
|
5
|
+
constructor(parameters: import("./basedecoder.js").BaseDecoderParameters & {
|
|
6
|
+
JPEGTables?: Uint8Array;
|
|
7
|
+
});
|
|
3
8
|
reader: JpegStreamReader;
|
|
4
|
-
|
|
9
|
+
/** @param {ArrayBuffer} buffer */
|
|
10
|
+
decodeBlock(buffer: ArrayBuffer): ArrayBuffer;
|
|
5
11
|
}
|
|
6
12
|
export type HuffmanNode = (number | HuffmanNode)[];
|
|
7
13
|
export type Code = {
|
|
8
14
|
children: HuffmanNode;
|
|
9
15
|
index: number;
|
|
10
16
|
};
|
|
17
|
+
export type JpegComponent = {
|
|
18
|
+
h: number;
|
|
19
|
+
v: number;
|
|
20
|
+
quantizationIdx?: number | undefined;
|
|
21
|
+
quantizationTable?: Int32Array<ArrayBufferLike> | undefined;
|
|
22
|
+
blocksPerLine: number;
|
|
23
|
+
blocksPerColumn: number;
|
|
24
|
+
blocks: Int32Array[][];
|
|
25
|
+
huffmanTableDC?: HuffmanNode | undefined;
|
|
26
|
+
huffmanTableAC?: HuffmanNode | undefined;
|
|
27
|
+
pred?: number | undefined;
|
|
28
|
+
};
|
|
29
|
+
export type JpegFrame = {
|
|
30
|
+
extended: boolean;
|
|
31
|
+
progressive: boolean;
|
|
32
|
+
precision: number;
|
|
33
|
+
scanLines: number;
|
|
34
|
+
samplesPerLine: number;
|
|
35
|
+
components: {
|
|
36
|
+
[x: string]: JpegComponent;
|
|
37
|
+
};
|
|
38
|
+
componentsOrder: number[];
|
|
39
|
+
maxH: number;
|
|
40
|
+
maxV: number;
|
|
41
|
+
mcusPerLine: number;
|
|
42
|
+
mcusPerColumn: number;
|
|
43
|
+
};
|
|
11
44
|
import BaseDecoder from './basedecoder.js';
|
|
12
45
|
declare class JpegStreamReader {
|
|
13
46
|
jfif: {
|
|
14
47
|
version: {
|
|
15
|
-
major:
|
|
16
|
-
minor:
|
|
48
|
+
major: number;
|
|
49
|
+
minor: number;
|
|
17
50
|
};
|
|
18
|
-
densityUnits:
|
|
51
|
+
densityUnits: number;
|
|
19
52
|
xDensity: number;
|
|
20
53
|
yDensity: number;
|
|
21
|
-
thumbWidth:
|
|
22
|
-
thumbHeight:
|
|
23
|
-
thumbData:
|
|
54
|
+
thumbWidth: number;
|
|
55
|
+
thumbHeight: number;
|
|
56
|
+
thumbData: Uint8Array<ArrayBufferLike>;
|
|
24
57
|
} | null;
|
|
25
58
|
adobe: {
|
|
26
|
-
version:
|
|
59
|
+
version: number;
|
|
27
60
|
flags0: number;
|
|
28
61
|
flags1: number;
|
|
29
|
-
transformCode:
|
|
62
|
+
transformCode: number;
|
|
30
63
|
} | null;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
64
|
+
/** @type {number} */
|
|
65
|
+
resetInterval: number;
|
|
66
|
+
/** @type {Int32Array[]} */
|
|
67
|
+
quantizationTables: Int32Array[];
|
|
68
|
+
/** @type {HuffmanNode[]} */
|
|
69
|
+
huffmanTablesAC: HuffmanNode[];
|
|
70
|
+
/** @type {HuffmanNode[]} */
|
|
71
|
+
huffmanTablesDC: HuffmanNode[];
|
|
72
|
+
/** @type {JpegFrame[]} */
|
|
73
|
+
frames: JpegFrame[];
|
|
35
74
|
resetFrames(): void;
|
|
36
|
-
|
|
37
|
-
|
|
75
|
+
/** @param {Uint8Array} data */
|
|
76
|
+
parse(data: Uint8Array): void;
|
|
38
77
|
getResult(): Uint8Array<ArrayBuffer>;
|
|
39
78
|
}
|
|
40
79
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jpeg.d.ts","sourceRoot":"","sources":["../../dist-module/compression/jpeg.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"jpeg.d.ts","sourceRoot":"","sources":["../../dist-module/compression/jpeg.js"],"names":[],"mappings":"AAmhCA;IACI;;OAEG;IACH,wBAFW,OAAO,kBAAkB,EAAE,qBAAqB,GAAG;QAAE,UAAU,CAAC,EAAE,UAAU,CAAA;KAAE,EAQxF;IAJG,yBAAoC;IAKxC,kCAAkC;IAClC,oBADY,WAAW,eAKtB;CACJ;0BAr/Ba,CAAC,MAAM,GAAC,WAAW,CAAC,EAAE;mBACtB;IAAC,QAAQ,EAAE,WAAW,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAC;;OAGtC,MAAM;OACN,MAAM;;;mBAGN,MAAM;qBACN,MAAM;YACN,UAAU,EAAE,EAAE;;;;;;cAOd,OAAO;iBACP,OAAO;eACP,MAAM;eACN,MAAM;oBACN,MAAM;;;;qBAEN,MAAM,EAAE;UACR,MAAM;UACN,MAAM;iBACN,MAAM;mBACN,MAAM;;wBA1EI,kBAAkB;AAytB1C;IAEQ;;;;;;;;;;;aAAgB;IAChB;;;;;aAAiB;IACjB,qBAAqB;IACrB,eADW,MAAM,CACK;IACtB,2BAA2B;IAC3B,oBADW,UAAU,EAAE,CACK;IAC5B,4BAA4B;IAC5B,iBADW,WAAW,EAAE,CACC;IACzB,4BAA4B;IAC5B,iBADW,WAAW,EAAE,CACC;IACzB,0BAA0B;IAC1B,QADW,SAAS,EAAE,CACN;IAEpB,oBAEC;IACD,+BAA+B;IAC/B,YADY,UAAU,QAsPrB;IACD,qCA+CC;CACJ"}
|