carta1 1.0.7 → 1.0.11

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/index.js CHANGED
@@ -9,19 +9,35 @@ import {
9
9
  deserializeFrame,
10
10
  AeaFile,
11
11
  } from './io/serialization.js'
12
+ import { quantize, dequantize } from './coding/quantization.js'
13
+ import { qmfAnalysisStage, mdctStage } from './pipeline/encoder.js'
14
+ import { pipe } from './utils.js'
12
15
  import { BufferPool } from './core/buffers.js'
13
16
  import { EncoderOptions } from './core/options.js'
14
17
  import { AudioProcessor } from './io/processor.js'
15
18
  import { FFT } from './transforms/fft.js'
19
+ import {
20
+ WORD_LENGTH_BITS,
21
+ SPECS_PER_BFU,
22
+ BFU_START_LONG,
23
+ } from './core/constants.js'
16
24
 
17
25
  export {
26
+ pipe,
18
27
  encode,
19
28
  decode,
29
+ qmfAnalysisStage,
30
+ mdctStage,
20
31
  serializeFrame,
21
32
  deserializeFrame,
33
+ quantize,
34
+ dequantize,
22
35
  AeaFile,
23
36
  BufferPool,
24
37
  EncoderOptions,
25
38
  AudioProcessor,
26
39
  FFT,
40
+ WORD_LENGTH_BITS,
41
+ SPECS_PER_BFU,
42
+ BFU_START_LONG,
27
43
  }
@@ -41,7 +41,7 @@ import {
41
41
  * @returns {Function} Stage function that processes quantized frame data
42
42
  * @throws {Error} If bufferPool is not provided in context
43
43
  */
44
- function dequantizationStage() {
44
+ export function dequantizationStage() {
45
45
  /**
46
46
  * Reconstruct MDCT coefficients from quantized data
47
47
  * @param {Object} frameData - Quantized frame data
@@ -105,7 +105,7 @@ function dequantizationStage() {
105
105
  * @returns {Function} Stage function that processes dequantization results
106
106
  * @throws {Error} If bufferPool is not provided in context
107
107
  */
108
- function imdctStage(context) {
108
+ export function imdctStage(context) {
109
109
  const bufferPool =
110
110
  context?.bufferPool ?? throwError('imdctStage: bufferPool is required')
111
111
  const overlapBuffers = bufferPool.imdctOverlap
@@ -213,7 +213,7 @@ function imdctStage(context) {
213
213
  * @returns {Function} Stage function that processes inverse MDCT results
214
214
  * @throws {Error} If bufferPool is not provided in context
215
215
  */
216
- function qmfSynthesisStage(context) {
216
+ export function qmfSynthesisStage(context) {
217
217
  const bufferPool =
218
218
  context?.bufferPool ??
219
219
  throwError('qmfSynthesisStage: bufferPool is required')
@@ -52,7 +52,7 @@ import { psychoAnalysis } from '../analysis/psychoacoustics.js'
52
52
  * @returns {Function} Stage function that processes PCM samples
53
53
  * @throws {Error} If bufferPool is not provided in context
54
54
  */
55
- function qmfAnalysisStage(context) {
55
+ export function qmfAnalysisStage(context) {
56
56
  const bufferPool =
57
57
  context?.bufferPool ??
58
58
  throwError('qmfAnalysisStage: bufferPool is required')
@@ -106,7 +106,7 @@ function qmfAnalysisStage(context) {
106
106
  * @returns {Function} Stage function that processes QMF analysis results
107
107
  * @throws {Error} If bufferPool is not provided in context
108
108
  */
109
- function blockSelectorStage(context) {
109
+ export function blockSelectorStage(context) {
110
110
  const bufferPool =
111
111
  context?.bufferPool ??
112
112
  throwError('blockSelectorStage: bufferPool is required')
@@ -176,7 +176,7 @@ function blockSelectorStage(context) {
176
176
  * @returns {Function} Stage function that processes block selection results
177
177
  * @throws {Error} If bufferPool is not provided in context
178
178
  */
179
- function mdctStage(context) {
179
+ export function mdctStage(context) {
180
180
  const bufferPool =
181
181
  context?.bufferPool ?? throwError('mdctStage: bufferPool is required')
182
182
  const overlapBuffers = bufferPool.mdctOverlap
@@ -272,7 +272,7 @@ function mdctStage(context) {
272
272
  * @returns {Function} Stage function that processes MDCT results
273
273
  * @throws {Error} If bufferPool or options are not provided in context
274
274
  */
275
- function quantizationStage(context) {
275
+ export function quantizationStage(context) {
276
276
  const bufferPool =
277
277
  context?.bufferPool ??
278
278
  throwError('quantizationStage: bufferPool is required')