lzma1 0.2.0 → 0.3.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/README.md +10 -3
- package/lib/decoder.js +84 -85
- package/lib/encoder.js +794 -143
- package/lib/index.js +0 -1
- package/lib/lz-window.js +3 -4
- package/lib/lzma.js +50 -1383
- package/lib/match-finder.js +402 -0
- package/lib/range-decoder.js +3 -16
- package/lib/range-encoder.js +14 -24
- package/lib/streams.js +64 -1
- package/lib/utils.js +4 -102
- package/package.json +24 -13
- package/src/decoder.ts +604 -0
- package/src/encoder.ts +2108 -0
- package/src/index.ts +71 -0
- package/src/len-coder.ts +217 -0
- package/src/lit-coder.ts +196 -0
- package/src/lz-window.ts +99 -0
- package/src/lzma.ts +142 -0
- package/src/match-finder.ts +548 -0
- package/src/range-bit-tree-coder.ts +109 -0
- package/src/range-decoder.ts +98 -0
- package/src/range-encoder.ts +136 -0
- package/src/streams.ts +73 -0
- package/src/utils.ts +263 -0
- package/lib/chunker.d.ts +0 -46
- package/lib/chunker.js +0 -68
- package/lib/decoder.d.ts +0 -80
- package/lib/encoder.d.ts +0 -266
- package/lib/index.d.ts +0 -38
- package/lib/len-coder.d.ts +0 -70
- package/lib/lit-coder.d.ts +0 -63
- package/lib/lz-in-window.d.ts +0 -43
- package/lib/lz-in-window.js +0 -132
- package/lib/lz-window.d.ts +0 -35
- package/lib/lzma.d.ts +0 -107
- package/lib/match-finder-config.d.ts +0 -34
- package/lib/match-finder-config.js +0 -63
- package/lib/range-bit-tree-coder.d.ts +0 -34
- package/lib/range-decoder.d.ts +0 -34
- package/lib/range-encoder.d.ts +0 -46
- package/lib/streams.d.ts +0 -32
- package/lib/utils.d.ts +0 -127
package/lib/lz-window.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { Writer } from "./streams.js";
|
|
2
|
-
export declare class LzOutWindow {
|
|
3
|
-
buffer: number[] | null;
|
|
4
|
-
pos: number;
|
|
5
|
-
streamPos: number;
|
|
6
|
-
stream: Writer | null;
|
|
7
|
-
windowSize: number;
|
|
8
|
-
private w;
|
|
9
|
-
private buf;
|
|
10
|
-
constructor(writer?: Writer | null, windowSize?: number);
|
|
11
|
-
/**
|
|
12
|
-
* Copy a block of data from a previous position (LZ77-style)
|
|
13
|
-
*/
|
|
14
|
-
copyBlock(distance: number, length: number): void;
|
|
15
|
-
/**
|
|
16
|
-
* Put a single byte into the window
|
|
17
|
-
*/
|
|
18
|
-
putByte(byte: number): void;
|
|
19
|
-
/**
|
|
20
|
-
* Get a byte from a relative position
|
|
21
|
-
*/
|
|
22
|
-
getByte(relativePos: number): number;
|
|
23
|
-
/**
|
|
24
|
-
* Flush buffered data to output writer
|
|
25
|
-
*/
|
|
26
|
-
flush(): void;
|
|
27
|
-
/**
|
|
28
|
-
* Check if the window is empty
|
|
29
|
-
*/
|
|
30
|
-
isEmpty(): boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Reset the window
|
|
33
|
-
*/
|
|
34
|
-
reset(): void;
|
|
35
|
-
}
|
package/lib/lzma.d.ts
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import type { BaseStream, BufferWithCount } from "./streams.js";
|
|
2
|
-
import { type BitTree, type LiteralDecoderEncoder2 } from "./utils.js";
|
|
3
|
-
/**
|
|
4
|
-
* Range coder interface
|
|
5
|
-
*/
|
|
6
|
-
interface RangeCoder {
|
|
7
|
-
stream: BaseStream | BufferWithCount | null;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Range decoder
|
|
11
|
-
*/
|
|
12
|
-
export interface RangeDecoder extends RangeCoder {
|
|
13
|
-
code: number;
|
|
14
|
-
rrange: number;
|
|
15
|
-
stream: BaseStream | null;
|
|
16
|
-
init?(): void;
|
|
17
|
-
decodeBit?(probs: number[], index: number): 0 | 1;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Literal coder interface
|
|
21
|
-
*/
|
|
22
|
-
export interface LiteralCoder {
|
|
23
|
-
coders: LiteralDecoderEncoder2[];
|
|
24
|
-
numPrevBits: number;
|
|
25
|
-
numPosBits: number;
|
|
26
|
-
posMask: number;
|
|
27
|
-
init?(): void;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Length coder
|
|
31
|
-
*/
|
|
32
|
-
export interface LenCoder {
|
|
33
|
-
choice: number[];
|
|
34
|
-
lowCoder: BitTree[];
|
|
35
|
-
midCoder: BitTree[];
|
|
36
|
-
highCoder: BitTree;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* LZMA compression mode levels (1-9)
|
|
40
|
-
* Higher values provide better compression but are slower
|
|
41
|
-
*/
|
|
42
|
-
export type CompressionMode = keyof typeof MODES;
|
|
43
|
-
/**
|
|
44
|
-
* Compression modes
|
|
45
|
-
*/
|
|
46
|
-
export declare const MODES: {
|
|
47
|
-
readonly 1: {
|
|
48
|
-
readonly searchDepth: 16;
|
|
49
|
-
readonly filterStrength: 64;
|
|
50
|
-
readonly modeIndex: 0;
|
|
51
|
-
};
|
|
52
|
-
readonly 2: {
|
|
53
|
-
readonly searchDepth: 20;
|
|
54
|
-
readonly filterStrength: 64;
|
|
55
|
-
readonly modeIndex: 0;
|
|
56
|
-
};
|
|
57
|
-
readonly 3: {
|
|
58
|
-
readonly searchDepth: 19;
|
|
59
|
-
readonly filterStrength: 64;
|
|
60
|
-
readonly modeIndex: 1;
|
|
61
|
-
};
|
|
62
|
-
readonly 4: {
|
|
63
|
-
readonly searchDepth: 20;
|
|
64
|
-
readonly filterStrength: 64;
|
|
65
|
-
readonly modeIndex: 1;
|
|
66
|
-
};
|
|
67
|
-
readonly 5: {
|
|
68
|
-
readonly searchDepth: 21;
|
|
69
|
-
readonly filterStrength: 128;
|
|
70
|
-
readonly modeIndex: 1;
|
|
71
|
-
};
|
|
72
|
-
readonly 6: {
|
|
73
|
-
readonly searchDepth: 22;
|
|
74
|
-
readonly filterStrength: 128;
|
|
75
|
-
readonly modeIndex: 1;
|
|
76
|
-
};
|
|
77
|
-
readonly 7: {
|
|
78
|
-
readonly searchDepth: 23;
|
|
79
|
-
readonly filterStrength: 128;
|
|
80
|
-
readonly modeIndex: 1;
|
|
81
|
-
};
|
|
82
|
-
readonly 8: {
|
|
83
|
-
readonly searchDepth: 24;
|
|
84
|
-
readonly filterStrength: 255;
|
|
85
|
-
readonly modeIndex: 1;
|
|
86
|
-
};
|
|
87
|
-
readonly 9: {
|
|
88
|
-
readonly searchDepth: 25;
|
|
89
|
-
readonly filterStrength: 255;
|
|
90
|
-
readonly modeIndex: 1;
|
|
91
|
-
};
|
|
92
|
-
};
|
|
93
|
-
export declare class LZMA {
|
|
94
|
-
#private;
|
|
95
|
-
constructor();
|
|
96
|
-
writeHeaderProperties(): void;
|
|
97
|
-
GetPosSlot2(pos: number): number;
|
|
98
|
-
ReverseEncode(startIndex: number, NumBitLevels: number, symbol: number): void;
|
|
99
|
-
encodeString(inputString: string): number[];
|
|
100
|
-
compress(data: Uint8Array | ArrayBuffer, mode?: CompressionMode): Int8Array;
|
|
101
|
-
compressString(data: string, mode?: CompressionMode): Int8Array;
|
|
102
|
-
decompress(bytearray: Uint8Array | ArrayBuffer): number[];
|
|
103
|
-
decompressString(bytearray: Uint8Array | ArrayBuffer): string;
|
|
104
|
-
codeOneBlock(): void;
|
|
105
|
-
releaseStreams(): void;
|
|
106
|
-
}
|
|
107
|
-
export {};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { MatchFinder } from "./encoder.js";
|
|
2
|
-
/**
|
|
3
|
-
* Match finder configuration helpers
|
|
4
|
-
* Pure functions extracted from LZMA class for better modularity
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Compute window reservation size for match finder buffer allocation
|
|
8
|
-
*/
|
|
9
|
-
export declare function computeWindowReservSize(dictionarySize: number, keepBefore: number, numFastBytes: number, keepAfter: number): number;
|
|
10
|
-
/**
|
|
11
|
-
* Ensure cyclic buffer is properly sized and allocated
|
|
12
|
-
*/
|
|
13
|
-
export declare function ensureCyclicBuffer(matchFinder: MatchFinder, dictionarySize: number): void;
|
|
14
|
-
interface HashSizeConfig {
|
|
15
|
-
hashMask: number;
|
|
16
|
-
hashSizeSum: number;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Compute hash size for match finder hash table
|
|
20
|
-
*/
|
|
21
|
-
export declare function computeHashSize(dictionarySize: number, hashArrayEnabled: boolean): HashSizeConfig;
|
|
22
|
-
/**
|
|
23
|
-
* Set cut value for match finder based on fast bytes setting
|
|
24
|
-
*/
|
|
25
|
-
export declare function setCutValue(numFastBytes: number): number;
|
|
26
|
-
/**
|
|
27
|
-
* Set maximum match length for match finder
|
|
28
|
-
*/
|
|
29
|
-
export declare function setMatchMaxLen(numFastBytes: number): number;
|
|
30
|
-
/**
|
|
31
|
-
* Check if dictionary size is below threshold requiring special handling
|
|
32
|
-
*/
|
|
33
|
-
export declare function isDictionarySizeBelowThreshold(dictionarySize: number): boolean;
|
|
34
|
-
export {};
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { DICTIONARY_SIZE_THRESHOLD, initArray, } from "./utils.js";
|
|
2
|
-
/**
|
|
3
|
-
* Match finder configuration helpers
|
|
4
|
-
* Pure functions extracted from LZMA class for better modularity
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Compute window reservation size for match finder buffer allocation
|
|
8
|
-
*/
|
|
9
|
-
export function computeWindowReservSize(dictionarySize, keepBefore, numFastBytes, keepAfter) {
|
|
10
|
-
return ~~((dictionarySize + keepBefore + numFastBytes + keepAfter) / 2) + 0x100;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Ensure cyclic buffer is properly sized and allocated
|
|
14
|
-
*/
|
|
15
|
-
export function ensureCyclicBuffer(matchFinder, dictionarySize) {
|
|
16
|
-
const cyclicBufferSize = dictionarySize + 1;
|
|
17
|
-
if (matchFinder._cyclicBufferSize !== cyclicBufferSize) {
|
|
18
|
-
const doubledCyclicBufferSize = (matchFinder._cyclicBufferSize = cyclicBufferSize) * 2;
|
|
19
|
-
matchFinder._son = initArray(doubledCyclicBufferSize);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Compute hash size for match finder hash table
|
|
24
|
-
*/
|
|
25
|
-
export function computeHashSize(dictionarySize, hashArrayEnabled) {
|
|
26
|
-
let hs = 0x10000;
|
|
27
|
-
let hashMask = 0;
|
|
28
|
-
if (hashArrayEnabled) {
|
|
29
|
-
hs = dictionarySize - 1;
|
|
30
|
-
hs |= hs >> 1;
|
|
31
|
-
hs |= hs >> 2;
|
|
32
|
-
hs |= hs >> 4;
|
|
33
|
-
hs |= hs >> 0x08;
|
|
34
|
-
hs >>= 1;
|
|
35
|
-
hs |= 0xFFFF;
|
|
36
|
-
if (hs > 0x1000000) {
|
|
37
|
-
hs >>= 1;
|
|
38
|
-
}
|
|
39
|
-
hashMask = hs;
|
|
40
|
-
hs += 1;
|
|
41
|
-
// Add kFixHashSize (assumed to be available on matchFinder)
|
|
42
|
-
// This will be passed in from the calling context
|
|
43
|
-
}
|
|
44
|
-
return { hashMask, hashSizeSum: hs };
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Set cut value for match finder based on fast bytes setting
|
|
48
|
-
*/
|
|
49
|
-
export function setCutValue(numFastBytes) {
|
|
50
|
-
return 0x10 + (numFastBytes >> 1);
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Set maximum match length for match finder
|
|
54
|
-
*/
|
|
55
|
-
export function setMatchMaxLen(numFastBytes) {
|
|
56
|
-
return numFastBytes;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Check if dictionary size is below threshold requiring special handling
|
|
60
|
-
*/
|
|
61
|
-
export function isDictionarySizeBelowThreshold(dictionarySize) {
|
|
62
|
-
return dictionarySize < DICTIONARY_SIZE_THRESHOLD;
|
|
63
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { type BasicRangeDecoder, type BasicRangeEncoder } from "./utils.js";
|
|
2
|
-
export declare class RangeBitTreeCoder {
|
|
3
|
-
private models;
|
|
4
|
-
private numBitLevels;
|
|
5
|
-
constructor(numBitLevels: number);
|
|
6
|
-
/**
|
|
7
|
-
* Decode symbol using range decoder
|
|
8
|
-
*/
|
|
9
|
-
decode(rd: BasicRangeDecoder): number;
|
|
10
|
-
/**
|
|
11
|
-
* Reverse decode symbol using range decoder
|
|
12
|
-
*/
|
|
13
|
-
reverseDecode(rd: BasicRangeDecoder): number;
|
|
14
|
-
/**
|
|
15
|
-
* Encode symbol using range encoder
|
|
16
|
-
*/
|
|
17
|
-
encode(re: BasicRangeEncoder, symbol: number): void;
|
|
18
|
-
/**
|
|
19
|
-
* Reverse encode symbol using range encoder
|
|
20
|
-
*/
|
|
21
|
-
reverseEncode(re: BasicRangeEncoder, symbol: number): void;
|
|
22
|
-
/**
|
|
23
|
-
* Get price for encoding symbol
|
|
24
|
-
*/
|
|
25
|
-
getPrice(symbol: number): number;
|
|
26
|
-
/**
|
|
27
|
-
* Get price for reverse encoding symbol
|
|
28
|
-
*/
|
|
29
|
-
reverseGetPrice(symbol: number): number;
|
|
30
|
-
/**
|
|
31
|
-
* Reset models to initial state
|
|
32
|
-
*/
|
|
33
|
-
reset(): void;
|
|
34
|
-
}
|
package/lib/range-decoder.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { BaseStream } from "./streams.js";
|
|
2
|
-
export declare class RangeDecoder {
|
|
3
|
-
stream: BaseStream | null;
|
|
4
|
-
code: number;
|
|
5
|
-
rrange: number;
|
|
6
|
-
/**
|
|
7
|
-
* Set input stream for decoding
|
|
8
|
-
*/
|
|
9
|
-
setStream(stream: BaseStream | null): void;
|
|
10
|
-
/**
|
|
11
|
-
* Initialize range decoder
|
|
12
|
-
*/
|
|
13
|
-
init(): void;
|
|
14
|
-
/**
|
|
15
|
-
* Decode a single bit using probability model
|
|
16
|
-
*/
|
|
17
|
-
decodeBit(probs: number[], index: number): 0 | 1;
|
|
18
|
-
/**
|
|
19
|
-
* Decode direct bits (without probability model)
|
|
20
|
-
*/
|
|
21
|
-
decodeDirectBits(numTotalBits: number): number;
|
|
22
|
-
/**
|
|
23
|
-
* Get current code value (for compatibility)
|
|
24
|
-
*/
|
|
25
|
-
get currentCode(): number;
|
|
26
|
-
/**
|
|
27
|
-
* Get current range value (for compatibility)
|
|
28
|
-
*/
|
|
29
|
-
get currentRange(): number;
|
|
30
|
-
/**
|
|
31
|
-
* Read a single byte from the input stream
|
|
32
|
-
*/
|
|
33
|
-
private readFromStream;
|
|
34
|
-
}
|
package/lib/range-encoder.d.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { BufferWithCount } from "./streams.js";
|
|
2
|
-
export declare class RangeEncoder {
|
|
3
|
-
private stream;
|
|
4
|
-
private low;
|
|
5
|
-
private rrange;
|
|
6
|
-
private cache;
|
|
7
|
-
private cacheSize;
|
|
8
|
-
private position;
|
|
9
|
-
constructor();
|
|
10
|
-
/**
|
|
11
|
-
* Set output stream for encoding
|
|
12
|
-
*/
|
|
13
|
-
setStream(stream: BufferWithCount | null): void;
|
|
14
|
-
/**
|
|
15
|
-
* Initialize range encoder
|
|
16
|
-
*/
|
|
17
|
-
init(): void;
|
|
18
|
-
/**
|
|
19
|
-
* Encode a single bit using probability model
|
|
20
|
-
*/
|
|
21
|
-
encodeBit(probs: number[], index: number, bit: number): void;
|
|
22
|
-
/**
|
|
23
|
-
* Encode direct bits (without probability model)
|
|
24
|
-
*/
|
|
25
|
-
encodeDirectBits(value: number, numTotalBits: number): void;
|
|
26
|
-
/**
|
|
27
|
-
* Encode bit tree symbol
|
|
28
|
-
*/
|
|
29
|
-
encodeBitTree(numBitLevels: number, models: number[], symbol: number, startIndex?: number): void;
|
|
30
|
-
/**
|
|
31
|
-
* Reverse encode bits
|
|
32
|
-
*/
|
|
33
|
-
reverseEncodeBits(numBitLevels: number, models: number[], symbol: number, startIndex: number): void;
|
|
34
|
-
/**
|
|
35
|
-
* Finish encoding and flush remaining data
|
|
36
|
-
*/
|
|
37
|
-
finish(): void;
|
|
38
|
-
/**
|
|
39
|
-
* Shift low value and write to stream
|
|
40
|
-
*/
|
|
41
|
-
private shiftLow;
|
|
42
|
-
/**
|
|
43
|
-
* Write byte to output stream
|
|
44
|
-
*/
|
|
45
|
-
private writeToStream;
|
|
46
|
-
}
|
package/lib/streams.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* RelativeIndexable is a generic interface for array-like structures
|
|
3
|
-
* that can be indexed with a number
|
|
4
|
-
*/
|
|
5
|
-
export type RelativeIndexable<T> = {
|
|
6
|
-
[key: number]: T;
|
|
7
|
-
length: number;
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* Base stream interface for input/output operations
|
|
11
|
-
*/
|
|
12
|
-
export interface BaseStream {
|
|
13
|
-
buf: RelativeIndexable<number> | Uint8Array | ArrayBuffer | number[];
|
|
14
|
-
pos: number;
|
|
15
|
-
count: number;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Represents a buffer with a count of used elements
|
|
19
|
-
*/
|
|
20
|
-
export interface BufferWithCount {
|
|
21
|
-
buf: number[];
|
|
22
|
-
count: number;
|
|
23
|
-
write(buf: number[]): void;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Writer interface for output operations
|
|
27
|
-
*/
|
|
28
|
-
export interface Writer {
|
|
29
|
-
buf?: number[];
|
|
30
|
-
count?: number;
|
|
31
|
-
write(buf: number[]): void;
|
|
32
|
-
}
|
package/lib/utils.d.ts
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
export interface BitTree {
|
|
2
|
-
numBitLevels: number;
|
|
3
|
-
models: number[];
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* Literal decoder/encoder for optimization
|
|
7
|
-
*/
|
|
8
|
-
export interface LiteralDecoderEncoder2 {
|
|
9
|
-
decoders: number[];
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Basic range encoder interface for bit operations
|
|
13
|
-
*/
|
|
14
|
-
export interface BasicRangeEncoder {
|
|
15
|
-
encodeBit(probs: number[], index: number, bit: number): void;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Basic range decoder interface for bit operations
|
|
19
|
-
*/
|
|
20
|
-
export interface BasicRangeDecoder {
|
|
21
|
-
decodeBit(probs: number[], index: number): number;
|
|
22
|
-
}
|
|
23
|
-
export declare const INFINITY_PRICE = 268435455;
|
|
24
|
-
export declare const _MAX_UINT32 = 4294967295;
|
|
25
|
-
export declare const DICTIONARY_SIZE_THRESHOLD = 1073741823;
|
|
26
|
-
export declare const kTopValue: number;
|
|
27
|
-
export declare const kNumBitModelTotalBits = 11;
|
|
28
|
-
export declare const kBitModelTotal: number;
|
|
29
|
-
export declare const kNumMoveBits = 5;
|
|
30
|
-
export declare const kNumMoveReducingBits = 2;
|
|
31
|
-
export declare const kNumBitPriceShiftBits = 6;
|
|
32
|
-
export declare const MATCH_DECODERS_SIZE = 192;
|
|
33
|
-
export declare const REP_DECODERS_SIZE = 12;
|
|
34
|
-
export declare const POS_DECODERS_SIZE = 114;
|
|
35
|
-
export declare const LITERAL_DECODER_SIZE = 768;
|
|
36
|
-
export declare const DEFAULT_WINDOW_SIZE = 4096;
|
|
37
|
-
export declare const CHOICE_ARRAY_SIZE = 2;
|
|
38
|
-
export declare const N1_LONG_LIT: [number, number];
|
|
39
|
-
export declare const MIN_VALUE: [number, number];
|
|
40
|
-
export declare const P0_LONG_LIT: [number, number];
|
|
41
|
-
export declare const P1_LONG_LIT: [number, number];
|
|
42
|
-
export declare const ZERO_64: [number, number];
|
|
43
|
-
/**
|
|
44
|
-
* CRC32 lookup table for hash calculations
|
|
45
|
-
* dprint-ignore
|
|
46
|
-
*/
|
|
47
|
-
export declare const CRC32_TABLE: number[];
|
|
48
|
-
/**
|
|
49
|
-
* Pre-computed static instances for common use
|
|
50
|
-
*/
|
|
51
|
-
export declare const PROB_PRICES: number[];
|
|
52
|
-
export declare const G_FAST_POS: number[];
|
|
53
|
-
/**
|
|
54
|
-
* Initialize array with specified length and default value
|
|
55
|
-
* This is MUCH faster than "new Array(len)" in newer versions of v8
|
|
56
|
-
* (starting with Node.js 0.11.15, which uses v8 3.28.73).
|
|
57
|
-
*/
|
|
58
|
-
export declare function initArray(len: number, value?: number): number[];
|
|
59
|
-
/**
|
|
60
|
-
* Copy array data with bounds checking and overlap handling
|
|
61
|
-
*/
|
|
62
|
-
export declare function arraycopy(src: number[], srcOfs: number, dest: number[], destOfs: number, len: number): void;
|
|
63
|
-
/**
|
|
64
|
-
* Get bit price using pre-computed probability prices
|
|
65
|
-
*/
|
|
66
|
-
export declare function getBitPrice(probability: number, bit: number): number;
|
|
67
|
-
/**
|
|
68
|
-
* Create a 64-bit number from low and high parts
|
|
69
|
-
*/
|
|
70
|
-
export declare function create64(valueLow: number, valueHigh: number): [number, number];
|
|
71
|
-
/**
|
|
72
|
-
* Add two 64-bit numbers
|
|
73
|
-
*/
|
|
74
|
-
export declare function add64(a: [number, number], b: [number, number]): [number, number];
|
|
75
|
-
/**
|
|
76
|
-
* Subtract two 64-bit numbers
|
|
77
|
-
*/
|
|
78
|
-
export declare function sub64(a: [number, number], b: [number, number]): [number, number];
|
|
79
|
-
/**
|
|
80
|
-
* Compare two 64-bit numbers
|
|
81
|
-
*/
|
|
82
|
-
export declare function compare64(a: [number, number], b: [number, number]): 0 | 1 | -1;
|
|
83
|
-
/**
|
|
84
|
-
* Extract low bits from 64-bit number
|
|
85
|
-
*/
|
|
86
|
-
export declare function lowBits64(a: [number, number]): number;
|
|
87
|
-
/**
|
|
88
|
-
* Create 64-bit number from integer
|
|
89
|
-
*/
|
|
90
|
-
export declare function fromInt64(value: number): [number, number];
|
|
91
|
-
/**
|
|
92
|
-
* Right shift 64-bit number
|
|
93
|
-
*/
|
|
94
|
-
export declare function shr64(a: [number, number], n: number): [number, number];
|
|
95
|
-
/**
|
|
96
|
-
* Bit model operations
|
|
97
|
-
*/
|
|
98
|
-
/**
|
|
99
|
-
* Initialize bit models with default probability
|
|
100
|
-
*/
|
|
101
|
-
export declare function initBitModels(probs: number[]): void;
|
|
102
|
-
/**
|
|
103
|
-
* Position and state operations
|
|
104
|
-
*/
|
|
105
|
-
/**
|
|
106
|
-
* Get length to position state mapping
|
|
107
|
-
*/
|
|
108
|
-
export declare function getLenToPosState(len: number): number;
|
|
109
|
-
/**
|
|
110
|
-
* Update state after character encoding/decoding
|
|
111
|
-
*/
|
|
112
|
-
export declare function stateUpdateChar(index: number): number;
|
|
113
|
-
/**
|
|
114
|
-
* Bit tree operations
|
|
115
|
-
*/
|
|
116
|
-
/**
|
|
117
|
-
* Create a bit tree with specified number of bit levels
|
|
118
|
-
*/
|
|
119
|
-
export declare function createBitTree(numBitLevels: number): BitTree;
|
|
120
|
-
/**
|
|
121
|
-
* Create probability prices lookup table
|
|
122
|
-
*/
|
|
123
|
-
export declare function createProbPrices(): number[];
|
|
124
|
-
/**
|
|
125
|
-
* Create fast position lookup table
|
|
126
|
-
*/
|
|
127
|
-
export declare function createFastPos(): number[];
|