carta1 1.8.0 → 1.9.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/codec/allocation/distortion.js +371 -0
- package/codec/allocation/refine.js +461 -0
- package/codec/allocation/solve.js +247 -318
- package/codec/allocation/source.js +44 -22
- package/codec/allocation/stage.js +15 -3
- package/codec/analysis/bands.js +7 -6
- package/codec/analysis/blocks.js +19 -8
- package/codec/analysis/spectrum.js +9 -10
- package/codec/core/constants.js +13 -1
- package/codec/core/tables.js +87 -16
- package/codec/index.js +1 -1
- package/codec/pipeline/decoder.js +3 -1
- package/codec/pipeline/encoder.js +3 -1
- package/codec/state/decoder.js +71 -0
- package/codec/state/encoder.js +113 -0
- package/codec/state/storage.js +38 -0
- package/codec/state/transform.js +61 -0
- package/codec/syntax/frame.js +3 -4
- package/codec/synthesis/bands.js +9 -13
- package/codec/synthesis/pcm.js +7 -6
- package/dist/carta1-worker.min.js +1 -1
- package/dist/carta1-worker.min.js.map +1 -1
- package/dist/carta1.min.js +1 -1
- package/dist/carta1.min.js.map +1 -1
- package/package.json +1 -1
- package/codec/state.js +0 -112
package/package.json
CHANGED
package/codec/state.js
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Carta1 stream state and reusable scratch.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
QMF_ANALYSIS_DELAY_SAMPLES,
|
|
7
|
-
QMF_BANDS,
|
|
8
|
-
QMF_HIGH_BAND_DELAY,
|
|
9
|
-
QMF_SYNTHESIS_DELAY_SAMPLES,
|
|
10
|
-
} from './core/constants.js'
|
|
11
|
-
|
|
12
|
-
/** Persistent delay state for one two-band QMF synthesis stage. */
|
|
13
|
-
class QmfSynthesisState {
|
|
14
|
-
constructor() {
|
|
15
|
-
this.delay = new Float32Array(QMF_SYNTHESIS_DELAY_SAMPLES)
|
|
16
|
-
this.delayRow = 0
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Values with meaning across chronological frames.
|
|
22
|
-
*/
|
|
23
|
-
class History {
|
|
24
|
-
constructor() {
|
|
25
|
-
this.qmfAnalysisDelays = {
|
|
26
|
-
lowBand: new Float32Array(QMF_ANALYSIS_DELAY_SAMPLES),
|
|
27
|
-
midBand: new Float32Array(QMF_ANALYSIS_DELAY_SAMPLES),
|
|
28
|
-
}
|
|
29
|
-
this.qmfSynthesisStates = {
|
|
30
|
-
lowBand: new QmfSynthesisState(),
|
|
31
|
-
midBand: new QmfSynthesisState(),
|
|
32
|
-
}
|
|
33
|
-
this.qmfHighBandDelay = new Float32Array(QMF_HIGH_BAND_DELAY)
|
|
34
|
-
|
|
35
|
-
this.transientDetection = [
|
|
36
|
-
new Float32Array(64),
|
|
37
|
-
new Float32Array(64),
|
|
38
|
-
new Float32Array(128),
|
|
39
|
-
]
|
|
40
|
-
|
|
41
|
-
this.mdctOverlap = [
|
|
42
|
-
new Float32Array(32),
|
|
43
|
-
new Float32Array(32),
|
|
44
|
-
new Float32Array(32),
|
|
45
|
-
]
|
|
46
|
-
|
|
47
|
-
this.imdctOverlap = [
|
|
48
|
-
new Float32Array(256),
|
|
49
|
-
new Float32Array(256),
|
|
50
|
-
new Float32Array(512),
|
|
51
|
-
]
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Reusable storage with no meaning between operations.
|
|
57
|
-
*/
|
|
58
|
-
class Scratch {
|
|
59
|
-
constructor() {
|
|
60
|
-
this.transformBuffers = {
|
|
61
|
-
64: new Float32Array(64),
|
|
62
|
-
128: new Float32Array(128),
|
|
63
|
-
256: new Float32Array(256),
|
|
64
|
-
512: new Float32Array(512),
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
this.qmfScratch = {
|
|
68
|
-
analysisWindows: {
|
|
69
|
-
128: new Float32Array(QMF_ANALYSIS_DELAY_SAMPLES + 128),
|
|
70
|
-
256: new Float32Array(QMF_ANALYSIS_DELAY_SAMPLES + 256),
|
|
71
|
-
512: new Float32Array(QMF_ANALYSIS_DELAY_SAMPLES + 512),
|
|
72
|
-
},
|
|
73
|
-
highBandWindows: {
|
|
74
|
-
128: new Float32Array(QMF_HIGH_BAND_DELAY + 128),
|
|
75
|
-
256: new Float32Array(QMF_HIGH_BAND_DELAY + 256),
|
|
76
|
-
},
|
|
77
|
-
polyphase: new Float32Array(QMF_BANDS),
|
|
78
|
-
extended: new Float64Array(QMF_BANDS),
|
|
79
|
-
bands: new Float32Array(QMF_BANDS),
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
this.mdctBuffers = {
|
|
83
|
-
16: {
|
|
84
|
-
real: new Float32Array(16),
|
|
85
|
-
imaginary: new Float32Array(16),
|
|
86
|
-
},
|
|
87
|
-
64: {
|
|
88
|
-
real: new Float32Array(64),
|
|
89
|
-
imaginary: new Float32Array(64),
|
|
90
|
-
},
|
|
91
|
-
128: {
|
|
92
|
-
real: new Float32Array(128),
|
|
93
|
-
imaginary: new Float32Array(128),
|
|
94
|
-
},
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
this.reversalBuffers = {
|
|
98
|
-
32: new Float32Array(32),
|
|
99
|
-
128: new Float32Array(128),
|
|
100
|
-
256: new Float32Array(256),
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Own one chronological stream's history and reusable storage.
|
|
107
|
-
*/
|
|
108
|
-
export class BufferPool {
|
|
109
|
-
constructor() {
|
|
110
|
-
Object.assign(this, new History(), new Scratch())
|
|
111
|
-
}
|
|
112
|
-
}
|