@automovie/ingest 0.3.3 → 0.4.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 +9 -29
- package/lib/AUTOMOVIE_GLTF_MOTION_INTERPRETATION_PROFILE.d.ts +4 -1
- package/lib/AUTOMOVIE_GLTF_MOTION_INTERPRETATION_PROFILE.js +4 -1
- package/lib/AUTOMOVIE_GLTF_MOTION_INTERPRETATION_PROFILE.js.map +1 -1
- package/lib/AUTO_MOVIE_EXTERNAL_MODEL_INGEST_PROFILES.d.ts +4 -1
- package/lib/AUTO_MOVIE_EXTERNAL_MODEL_INGEST_PROFILES.js +4 -1
- package/lib/AUTO_MOVIE_EXTERNAL_MODEL_INGEST_PROFILES.js.map +1 -1
- package/lib/adoptAutoMovieExternalMotion.d.ts +21 -11
- package/lib/adoptAutoMovieExternalMotion.js +26 -12
- package/lib/adoptAutoMovieExternalMotion.js.map +1 -1
- package/lib/audio/admitProductionTtsReceipt.d.ts +25 -0
- package/lib/audio/admitProductionTtsReceipt.js +166 -0
- package/lib/audio/admitProductionTtsReceipt.js.map +1 -0
- package/lib/audio/decodeProductionAudioAsset.d.ts +42 -14
- package/lib/audio/decodeProductionAudioAsset.js +53 -30
- package/lib/audio/decodeProductionAudioAsset.js.map +1 -1
- package/lib/audio/index.d.ts +1 -0
- package/lib/audio/index.js +1 -0
- package/lib/audio/index.js.map +1 -1
- package/lib/audio/resampleProductionAudio.d.ts +22 -0
- package/lib/audio/resampleProductionAudio.js +103 -0
- package/lib/audio/resampleProductionAudio.js.map +1 -0
- package/lib/decodeAutoMoviePpmImage.d.ts +10 -18
- package/lib/decodeAutoMoviePpmImage.js +10 -18
- package/lib/decodeAutoMoviePpmImage.js.map +1 -1
- package/lib/font/TrueTypeByteReader.d.ts +34 -0
- package/lib/font/TrueTypeByteReader.js +67 -0
- package/lib/font/TrueTypeByteReader.js.map +1 -0
- package/lib/font/decodeAutoMovieTrueTypeFont.d.ts +31 -0
- package/lib/font/decodeAutoMovieTrueTypeFont.js +168 -0
- package/lib/font/decodeAutoMovieTrueTypeFont.js.map +1 -0
- package/lib/font/index.d.ts +1 -0
- package/lib/font/index.js +18 -0
- package/lib/font/index.js.map +1 -0
- package/lib/font/readTrueTypeCharacterMap.d.ts +23 -0
- package/lib/font/readTrueTypeCharacterMap.js +98 -0
- package/lib/font/readTrueTypeCharacterMap.js.map +1 -0
- package/lib/font/readTrueTypeGlyphOutline.d.ts +45 -0
- package/lib/font/readTrueTypeGlyphOutline.js +275 -0
- package/lib/font/readTrueTypeGlyphOutline.js.map +1 -0
- package/lib/font/readTrueTypeKerning.d.ts +19 -0
- package/lib/font/readTrueTypeKerning.js +63 -0
- package/lib/font/readTrueTypeKerning.js.map +1 -0
- package/lib/font/readTrueTypeNames.d.ts +20 -0
- package/lib/font/readTrueTypeNames.js +75 -0
- package/lib/font/readTrueTypeNames.js.map +1 -0
- package/lib/humanoidSkeleton.d.ts +28 -15
- package/lib/humanoidSkeleton.js +28 -15
- package/lib/humanoidSkeleton.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/ingestDocument.d.ts +25 -12
- package/lib/ingestDocument.js +25 -12
- package/lib/ingestDocument.js.map +1 -1
- package/lib/inspectAutoMovieExternalModelBytes.d.ts +24 -12
- package/lib/inspectAutoMovieExternalModelBytes.js +24 -12
- package/lib/inspectAutoMovieExternalModelBytes.js.map +1 -1
- package/lib/internal/IAccessorSource.d.ts +11 -8
- package/lib/internal/IExternalModelAccessorReader.d.ts +1 -8
- package/lib/internal/IHumanoidSlot.d.ts +9 -10
- package/lib/internal/IParsedContainer.d.ts +10 -8
- package/lib/internal/SHAPE_COMPONENTS.d.ts +4 -1
- package/lib/internal/SHAPE_COMPONENTS.js +4 -1
- package/lib/internal/SHAPE_COMPONENTS.js.map +1 -1
- package/lib/internal/accessorElementByteLength.d.ts +1 -11
- package/lib/internal/accessorElementByteLength.js +1 -11
- package/lib/internal/accessorElementByteLength.js.map +1 -1
- package/lib/internal/accessorReader.d.ts +5 -9
- package/lib/internal/accessorReader.js +5 -9
- package/lib/internal/accessorReader.js.map +1 -1
- package/lib/internal/accessorValues.d.ts +10 -10
- package/lib/internal/accessorValues.js +10 -10
- package/lib/internal/collectExternalResources.d.ts +1 -11
- package/lib/internal/collectExternalResources.js +1 -11
- package/lib/internal/collectExternalResources.js.map +1 -1
- package/lib/internal/compareCodeUnits.d.ts +1 -11
- package/lib/internal/compareCodeUnits.js +1 -11
- package/lib/internal/compareCodeUnits.js.map +1 -1
- package/lib/internal/composeLocalTransform.d.ts +13 -10
- package/lib/internal/composeLocalTransform.js +13 -10
- package/lib/internal/composeLocalTransform.js.map +1 -1
- package/lib/internal/decodeDataUri.d.ts +4 -9
- package/lib/internal/decodeDataUri.js +4 -9
- package/lib/internal/decodeDataUri.js.map +1 -1
- package/lib/internal/decodeGlb.d.ts +1 -11
- package/lib/internal/decodeGlb.js +1 -11
- package/lib/internal/decodeGlb.js.map +1 -1
- package/lib/internal/decodeJson.d.ts +1 -11
- package/lib/internal/decodeJson.js +10 -12
- package/lib/internal/decodeJson.js.map +1 -1
- package/lib/internal/fileExtension.d.ts +2 -9
- package/lib/internal/fileExtension.js +2 -9
- package/lib/internal/fileExtension.js.map +1 -1
- package/lib/internal/finiteTuple.d.ts +4 -9
- package/lib/internal/finiteTuple.js +4 -9
- package/lib/internal/finiteTuple.js.map +1 -1
- package/lib/internal/gltfHumanoidBones.d.ts +5 -9
- package/lib/internal/gltfHumanoidBones.js +5 -9
- package/lib/internal/gltfHumanoidBones.js.map +1 -1
- package/lib/internal/humanoidBoneOfName.d.ts +7 -9
- package/lib/internal/humanoidBoneOfName.js +7 -9
- package/lib/internal/humanoidBoneOfName.js.map +1 -1
- package/lib/internal/inspectExternalModelHierarchy.d.ts +1 -11
- package/lib/internal/inspectExternalModelHierarchy.js +1 -11
- package/lib/internal/inspectExternalModelHierarchy.js.map +1 -1
- package/lib/internal/inspectExternalMotion.d.ts +8 -9
- package/lib/internal/inspectExternalMotion.js +8 -9
- package/lib/internal/inspectExternalMotion.js.map +1 -1
- package/lib/internal/inspectExternalMotionNodes.d.ts +6 -9
- package/lib/internal/inspectExternalMotionNodes.js +6 -9
- package/lib/internal/inspectExternalMotionNodes.js.map +1 -1
- package/lib/internal/integerIndex.d.ts +1 -11
- package/lib/internal/integerIndex.js +1 -11
- package/lib/internal/integerIndex.js.map +1 -1
- package/lib/internal/integerIndices.d.ts +1 -11
- package/lib/internal/integerIndices.js +1 -11
- package/lib/internal/integerIndices.js.map +1 -1
- package/lib/internal/nonNegativeInteger.d.ts +1 -11
- package/lib/internal/nonNegativeInteger.js +1 -11
- package/lib/internal/nonNegativeInteger.js.map +1 -1
- package/lib/internal/object.d.ts +1 -11
- package/lib/internal/object.js +1 -11
- package/lib/internal/object.js.map +1 -1
- package/lib/internal/optionalArray.d.ts +1 -11
- package/lib/internal/optionalArray.js +1 -11
- package/lib/internal/optionalArray.js.map +1 -1
- package/lib/internal/optionalObject.d.ts +1 -11
- package/lib/internal/optionalObject.js +1 -11
- package/lib/internal/optionalObject.js.map +1 -1
- package/lib/internal/optionalStringArray.d.ts +1 -11
- package/lib/internal/optionalStringArray.js +1 -11
- package/lib/internal/optionalStringArray.js.map +1 -1
- package/lib/internal/positiveInteger.d.ts +1 -11
- package/lib/internal/positiveInteger.js +1 -11
- package/lib/internal/positiveInteger.js.map +1 -1
- package/lib/internal/readMotionAccessor.d.ts +5 -9
- package/lib/internal/readMotionAccessor.js +5 -9
- package/lib/internal/readMotionAccessor.js.map +1 -1
- package/lib/internal/requiredArray.d.ts +1 -11
- package/lib/internal/requiredArray.js +1 -11
- package/lib/internal/requiredArray.js.map +1 -1
- package/lib/internal/uniqueStrings.d.ts +1 -11
- package/lib/internal/uniqueStrings.js +1 -11
- package/lib/internal/uniqueStrings.js.map +1 -1
- package/lib/internal/validNodeIndex.d.ts +1 -11
- package/lib/internal/validNodeIndex.js +1 -11
- package/lib/internal/validNodeIndex.js.map +1 -1
- package/lib/internal/validateAccessorRange.d.ts +6 -9
- package/lib/internal/validateAccessorRange.js +6 -9
- package/lib/internal/validateAccessorRange.js.map +1 -1
- package/lib/internal/validateHumanoidSkinning.d.ts +8 -10
- package/lib/internal/validateHumanoidSkinning.js +8 -10
- package/lib/internal/validateHumanoidSkinning.js.map +1 -1
- package/lib/internal/validatePayloadClosure.d.ts +8 -9
- package/lib/internal/validatePayloadClosure.js +8 -9
- package/lib/internal/validatePayloadClosure.js.map +1 -1
- package/lib/internal/validateSparseAccessor.d.ts +6 -9
- package/lib/internal/validateSparseAccessor.js +6 -9
- package/lib/internal/validateSparseAccessor.js.map +1 -1
- package/lib/internal/vrmHumanoidBones.d.ts +7 -9
- package/lib/internal/vrmHumanoidBones.js +12 -10
- package/lib/internal/vrmHumanoidBones.js.map +1 -1
- package/lib/isAutoMovieExternalModelIngestProfile.d.ts +4 -10
- package/lib/isAutoMovieExternalModelIngestProfile.js +4 -10
- package/lib/isAutoMovieExternalModelIngestProfile.js.map +1 -1
- package/package.json +7 -7
- package/src/AUTOMOVIE_GLTF_MOTION_INTERPRETATION_PROFILE.ts +4 -1
- package/src/AUTO_MOVIE_EXTERNAL_MODEL_INGEST_PROFILES.ts +4 -1
- package/src/adoptAutoMovieExternalMotion.ts +26 -12
- package/src/audio/admitProductionTtsReceipt.ts +262 -0
- package/src/audio/decodeProductionAudioAsset.ts +54 -39
- package/src/audio/index.ts +1 -0
- package/src/audio/resampleProductionAudio.ts +114 -0
- package/src/decodeAutoMoviePpmImage.ts +10 -18
- package/src/font/TrueTypeByteReader.ts +80 -0
- package/src/font/decodeAutoMovieTrueTypeFont.ts +217 -0
- package/src/font/index.ts +1 -0
- package/src/font/readTrueTypeCharacterMap.ts +115 -0
- package/src/font/readTrueTypeGlyphOutline.ts +375 -0
- package/src/font/readTrueTypeKerning.ts +73 -0
- package/src/font/readTrueTypeNames.ts +74 -0
- package/src/humanoidSkeleton.ts +28 -15
- package/src/index.ts +1 -0
- package/src/ingestDocument.ts +25 -12
- package/src/inspectAutoMovieExternalModelBytes.ts +24 -12
- package/src/internal/IAccessorSource.ts +11 -8
- package/src/internal/IExternalModelAccessorReader.ts +1 -8
- package/src/internal/IHumanoidSlot.ts +9 -10
- package/src/internal/IParsedContainer.ts +10 -8
- package/src/internal/SHAPE_COMPONENTS.ts +4 -1
- package/src/internal/accessorElementByteLength.ts +1 -11
- package/src/internal/accessorReader.ts +5 -9
- package/src/internal/accessorValues.ts +10 -10
- package/src/internal/collectExternalResources.ts +1 -11
- package/src/internal/compareCodeUnits.ts +1 -11
- package/src/internal/composeLocalTransform.ts +13 -10
- package/src/internal/decodeDataUri.ts +4 -9
- package/src/internal/decodeGlb.ts +1 -11
- package/src/internal/decodeJson.ts +10 -12
- package/src/internal/fileExtension.ts +2 -9
- package/src/internal/finiteTuple.ts +4 -9
- package/src/internal/gltfHumanoidBones.ts +5 -9
- package/src/internal/humanoidBoneOfName.ts +7 -9
- package/src/internal/inspectExternalModelHierarchy.ts +1 -11
- package/src/internal/inspectExternalMotion.ts +8 -9
- package/src/internal/inspectExternalMotionNodes.ts +6 -9
- package/src/internal/integerIndex.ts +1 -11
- package/src/internal/integerIndices.ts +1 -11
- package/src/internal/nonNegativeInteger.ts +1 -11
- package/src/internal/object.ts +1 -11
- package/src/internal/optionalArray.ts +1 -11
- package/src/internal/optionalObject.ts +1 -11
- package/src/internal/optionalStringArray.ts +1 -11
- package/src/internal/positiveInteger.ts +1 -11
- package/src/internal/readMotionAccessor.ts +5 -9
- package/src/internal/requiredArray.ts +1 -11
- package/src/internal/uniqueStrings.ts +1 -11
- package/src/internal/validNodeIndex.ts +1 -11
- package/src/internal/validateAccessorRange.ts +6 -9
- package/src/internal/validateHumanoidSkinning.ts +8 -10
- package/src/internal/validatePayloadClosure.ts +8 -9
- package/src/internal/validateSparseAccessor.ts +6 -9
- package/src/internal/vrmHumanoidBones.ts +12 -10
- package/src/isAutoMovieExternalModelIngestProfile.ts +4 -10
|
@@ -1,29 +1,58 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.decodeProductionAudioAsset = void 0;
|
|
4
|
+
const resampleProductionAudio_1 = require("./resampleProductionAudio");
|
|
4
5
|
/**
|
|
5
|
-
* Decode one complete supported RIFF/WAVE file into finite mono samples at a
|
|
6
|
+
* Decode one complete supported RIFF/WAVE file into finite mono samples at a
|
|
7
|
+
* requested rate.
|
|
6
8
|
*
|
|
7
|
-
* The parser walks the RIFF chunks by id, requires the declared RIFF extent,
|
|
9
|
+
* The parser walks the RIFF chunks by id, requires the declared RIFF extent,
|
|
10
|
+
* `nBlockAlign`, and `nAvgBytesPerSec` to agree with the format fields, and
|
|
11
|
+
* refuses a duplicate `fmt ` or `data` chunk, an odd chunk without its pad
|
|
12
|
+
* byte, and terminal bytes too short for a chunk header. An extensible header
|
|
13
|
+
* follows the Microsoft WAVEFORMATEXTENSIBLE contract
|
|
14
|
+
* (https://learn.microsoft.com/en-us/windows/win32/api/mmreg/ns-mmreg-waveformatextensible):
|
|
15
|
+
* "The cbSize member must be at least 22", `wValidBitsPerSample` "can be any
|
|
16
|
+
* value not exceeding the container size", "the channels specified in
|
|
17
|
+
* dwChannelMask must be present in the prescribed order (from least significant
|
|
18
|
+
* bit up)" with SPEAKER_FRONT_LEFT `0x1`, SPEAKER_FRONT_RIGHT `0x2`, and
|
|
19
|
+
* SPEAKER_FRONT_CENTER `0x4`, and "the number of bits set in dwChannelMask
|
|
20
|
+
* should be the same as the number of channels". The SubFormat is admitted only
|
|
21
|
+
* when every byte after its leading 16-bit tag equals the
|
|
22
|
+
* `xxxxxxxx-0000-0010-8000-00aa00389b71` template that Ksmedia.h's
|
|
23
|
+
* `IS_VALID_WAVEFORMATEX_GUID` compares
|
|
24
|
+
* (https://learn.microsoft.com/en-us/windows-hardware/drivers/audio/converting-between-format-tags-and-subformat-guids),
|
|
25
|
+
* so a vendor GUID whose low word happens to read as PCM is not decoded as
|
|
26
|
+
* PCM.
|
|
8
27
|
*
|
|
9
|
-
* The supported subset is deliberately narrow: 16-bit PCM in a 16-bit
|
|
28
|
+
* The supported subset is deliberately narrow: 16-bit PCM in a 16-bit
|
|
29
|
+
* container, 32-bit IEEE float in a 32-bit container, mono front-center, and
|
|
30
|
+
* stereo front-left/front-right. A legal declaration outside it, such as 20
|
|
31
|
+
* valid bits in a 24-bit container or a front-left/front-center pair, is
|
|
32
|
+
* refused as unsupported by field rather than misread as the nearest supported
|
|
33
|
+
* layout. Every decoded sample is checked finite before the mono fold and
|
|
34
|
+
* before any resampling, so a NaN or infinity in one channel refuses the whole
|
|
35
|
+
* asset at its frame and channel instead of averaging into a plausible number.
|
|
10
36
|
*
|
|
11
|
-
* PCM codes scale by 1/32768, so -32768 reads as exactly -1 and 32767 just
|
|
37
|
+
* PCM codes scale by 1/32768, so -32768 reads as exactly -1 and 32767 just
|
|
38
|
+
* under 1. Stereo folds to the mean of its two channels. A source at another
|
|
39
|
+
* rate is converted by band-limited windowed-sinc interpolation with fixed
|
|
40
|
+
* coefficients (`resampleProductionAudio`, after Smith and Gossett, ICASSP
|
|
41
|
+
* 1984) to `round(frames * rate / sourceRate)` samples, which may round to zero
|
|
42
|
+
* for a short source and a low target rate; its low-pass leaves no images when
|
|
43
|
+
* upsampling and folds no alias when downsampling.
|
|
12
44
|
*
|
|
13
|
-
* Field admission refusals throw `Audio asset "<path>" [<reason>] <message>`,
|
|
45
|
+
* Field admission refusals throw `Audio asset "<path>" [<reason>] <message>`,
|
|
46
|
+
* where the reason names the field, such as `riff-size`, `block-align`, or
|
|
47
|
+
* `unsupported-wave-layout`. Buffer size follows source frames and the
|
|
48
|
+
* requested rate ratio; this function imposes no product memory budget, so
|
|
49
|
+
* platform allocation errors may propagate outside that refusal format.
|
|
14
50
|
*
|
|
15
51
|
* @param props.path Asset path, used only in refusal messages.
|
|
16
52
|
* @param props.bytes Complete file bytes; they are only read.
|
|
17
|
-
* @param props.sampleRate Output rate in samples per second; a positive safe
|
|
53
|
+
* @param props.sampleRate Output rate in samples per second; a positive safe
|
|
54
|
+
* integer.
|
|
18
55
|
* @returns The source facts as declared and new mono samples the caller owns.
|
|
19
|
-
*
|
|
20
|
-
* @evidence contracts/development/implementation.md#principled-implementation Chunks are found by id in RIFF order with the even-byte pad rule, the format fields are checked against WAVEFORMATEXTENSIBLE's own consistency rules and the KSDATAFORMAT GUID template, samples scale by 1/32768 or read as IEEE floats, and resampling is two-tap linear interpolation; that interpolation has no anti-alias filter, which the documentation states as the remaining limitation when a source is downsampled.
|
|
21
|
-
* @evidence contracts/development/implementation.md#clear-and-simple-structure One linear pass validates the container, a second folds frames to mono, and a third resamples only when the rates differ; private refusal, chunk and hex helpers keep WAVE parsing local, while production speech probes consume the public decoder's format facts and mono samples.
|
|
22
|
-
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No file, path or rate is special-cased: every unsupported declaration throws with a field-named reason instead of decoding as the nearest supported layout, and the only constants are the WAVE format tags, speaker masks and GUID tail the Microsoft contract defines.
|
|
23
|
-
* @evidence contracts/development/common.md#meaningful-documentation The documentation cites the WAVEFORMATEXTENSIBLE rules it enforces, lists the supported subset, gives the PCM scale, stereo fold, resampled length and aliasing limitation, and states the refusal message shape and parameter units.
|
|
24
|
-
* @evidence contracts/development/implementation.md#efficient-algorithms Time follows RIFF chunk headers, source frames times channels and output samples; storage follows source and output frames, each encoded sample is read once through one DataView, and the mono buffer becomes the result when rates match.
|
|
25
|
-
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work The decoder is a pure function of one call's bytes and rate and coordinates no work across requests; any caching of decoded assets would belong to its caller.
|
|
26
|
-
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources The call owns source-frame mono storage and, on resampling, rate-ratio-sized output storage; no product memory budget bounds a requested allocation. Temporary buffers become collectable on return/throw, the returned buffer transfers to its caller, and no raw bytes, handles or tasks are retained.
|
|
27
56
|
*/
|
|
28
57
|
const decodeProductionAudioAsset = (props) => {
|
|
29
58
|
if (Number.isSafeInteger(props.sampleRate) === false || props.sampleRate <= 0)
|
|
@@ -154,7 +183,7 @@ const decodeProductionAudioAsset = (props) => {
|
|
|
154
183
|
}
|
|
155
184
|
const resampling = sourceSampleRate !== props.sampleRate;
|
|
156
185
|
const samples = resampling
|
|
157
|
-
?
|
|
186
|
+
? (0, resampleProductionAudio_1.resampleProductionAudio)(mono, sourceSampleRate, props.sampleRate)
|
|
158
187
|
: mono;
|
|
159
188
|
return {
|
|
160
189
|
sourceSampleRate,
|
|
@@ -207,23 +236,14 @@ const SUBFORMAT_TAIL = Uint8Array.from([
|
|
|
207
236
|
0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b,
|
|
208
237
|
0x71,
|
|
209
238
|
]);
|
|
210
|
-
/**
|
|
239
|
+
/**
|
|
240
|
+
* Throw the decoder's refusal. The explicit function type on the constant is
|
|
241
|
+
* what lets TypeScript narrow after a statement call, so callers need no
|
|
242
|
+
* non-null assertion.
|
|
243
|
+
*/
|
|
211
244
|
const fail = (asset, reason, message) => {
|
|
212
245
|
throw new Error(`Audio asset "${asset}" [${reason}] ${message}`);
|
|
213
246
|
};
|
|
214
|
-
const resampleMono = (source, from, to) => {
|
|
215
|
-
const length = Math.round((source.length * to) / from);
|
|
216
|
-
const output = new Float32Array(length);
|
|
217
|
-
const step = from / to;
|
|
218
|
-
for (let index = 0; index < length; ++index) {
|
|
219
|
-
const position = index * step;
|
|
220
|
-
const left = Math.floor(position);
|
|
221
|
-
const right = Math.min(source.length - 1, left + 1);
|
|
222
|
-
const weight = position - left;
|
|
223
|
-
output[index] = source[left] * (1 - weight) + source[right] * weight;
|
|
224
|
-
}
|
|
225
|
-
return output;
|
|
226
|
-
};
|
|
227
247
|
const asciiTag = (bytes, offset) => {
|
|
228
248
|
let text = "";
|
|
229
249
|
for (let index = offset; index < offset + 4; ++index) {
|
|
@@ -233,7 +253,10 @@ const asciiTag = (bytes, offset) => {
|
|
|
233
253
|
return text;
|
|
234
254
|
};
|
|
235
255
|
const leadingHex = (bytes) => `0x${hexBytes(bytes, 0, 4)}`;
|
|
236
|
-
/**
|
|
256
|
+
/**
|
|
257
|
+
* Canonical GUID text: the first three fields are little-endian in the file,
|
|
258
|
+
* the last two are byte strings.
|
|
259
|
+
*/
|
|
237
260
|
const waveGuid = (bytes) => `${hexBytes(bytes, 3, -1)}-${hexBytes(bytes, 5, 3)}-${hexBytes(bytes, 7, 5)}-${hexBytes(bytes, 8, 10)}-${hexBytes(bytes, 10, 16)}`;
|
|
238
261
|
/** Hex digits of `bytes[from]` toward `to` (exclusive), in either direction. */
|
|
239
262
|
const hexBytes = (bytes, from, to) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decodeProductionAudioAsset.js","sourceRoot":"","sources":["../../src/audio/decodeProductionAudioAsset.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACI,MAAM,0BAA0B,GAEM,CAC3C,KAAmD,EACZ,EAAE;IACzC,IAAI,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,KAAK,IAAI,KAAK,CAAC,UAAU,IAAI,CAAC;QAC3E,IAAI,CACF,KAAK,CAAC,IAAI,EACV,aAAa,EACb,wBAAwB,KAAK,CAAC,UAAU,6EAA6E,CACtH,CAAC;IACJ,MAAM,KAAK,GAAe,KAAK,CAAC,KAAK,CAAC;IACtC,IAAI,KAAK,CAAC,UAAU,GAAG,EAAE;QACvB,IAAI,CACF,KAAK,CAAC,IAAI,EACV,aAAa,EACb,MAAM,KAAK,CAAC,UAAU,kDAAkD,eAAe,EAAE,CAC1F,CAAC;IACJ,MAAM,IAAI,GAAa,IAAI,QAAQ,CACjC,KAAK,CAAC,MAAM,EACZ,KAAK,CAAC,UAAU,EAChB,KAAK,CAAC,UAAU,CACjB,CAAC;IACF,MAAM,IAAI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AAC,EAAE,CAAC"}
|
package/lib/audio/index.d.ts
CHANGED
package/lib/audio/index.js
CHANGED
|
@@ -14,5 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./admitProductionTtsReceipt"), exports);
|
|
17
18
|
__exportStar(require("./decodeProductionAudioAsset"), exports);
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
package/lib/audio/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/audio/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+DAA6C"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/audio/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8DAA4C;AAC5C,+DAA6C"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert mono samples from one rate to another by band-limited interpolation
|
|
3
|
+
* (Smith and Gossett, "A flexible sampling-rate conversion method", ICASSP
|
|
4
|
+
* 1984).
|
|
5
|
+
*
|
|
6
|
+
* Output sample `i` sits at input position `t = i × from / to` and is the sum
|
|
7
|
+
* of the input samples within `ZERO_CROSSINGS` zero crossings of a
|
|
8
|
+
* windowed-sinc low-pass centred on `t`. The low-pass cuts at `ROLLOFF` of the
|
|
9
|
+
* lower of the two Nyquist frequencies, so upsampling leaves no spectral images
|
|
10
|
+
* and downsampling folds no content back below the new Nyquist frequency. The
|
|
11
|
+
* kernel is read from one fixed table by linear interpolation between its
|
|
12
|
+
* entries, so equal inputs give equal samples on every platform. Samples before
|
|
13
|
+
* the first and after the last input sample are zero. The output holds
|
|
14
|
+
* `round(source.length × to / from)` samples, which may be zero for a short
|
|
15
|
+
* source and a low target rate.
|
|
16
|
+
*
|
|
17
|
+
* @param source Mono input samples at `from` samples per second; only read.
|
|
18
|
+
* @param from Input rate, a positive safe integer.
|
|
19
|
+
* @param to Output rate, a positive safe integer.
|
|
20
|
+
* @returns New mono samples at `to` samples per second, rounded to Float32.
|
|
21
|
+
*/
|
|
22
|
+
export declare function resampleProductionAudio(source: Float32Array, from: number, to: number): Float32Array;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resampleProductionAudio = resampleProductionAudio;
|
|
4
|
+
/**
|
|
5
|
+
* Convert mono samples from one rate to another by band-limited interpolation
|
|
6
|
+
* (Smith and Gossett, "A flexible sampling-rate conversion method", ICASSP
|
|
7
|
+
* 1984).
|
|
8
|
+
*
|
|
9
|
+
* Output sample `i` sits at input position `t = i × from / to` and is the sum
|
|
10
|
+
* of the input samples within `ZERO_CROSSINGS` zero crossings of a
|
|
11
|
+
* windowed-sinc low-pass centred on `t`. The low-pass cuts at `ROLLOFF` of the
|
|
12
|
+
* lower of the two Nyquist frequencies, so upsampling leaves no spectral images
|
|
13
|
+
* and downsampling folds no content back below the new Nyquist frequency. The
|
|
14
|
+
* kernel is read from one fixed table by linear interpolation between its
|
|
15
|
+
* entries, so equal inputs give equal samples on every platform. Samples before
|
|
16
|
+
* the first and after the last input sample are zero. The output holds
|
|
17
|
+
* `round(source.length × to / from)` samples, which may be zero for a short
|
|
18
|
+
* source and a low target rate.
|
|
19
|
+
*
|
|
20
|
+
* @param source Mono input samples at `from` samples per second; only read.
|
|
21
|
+
* @param from Input rate, a positive safe integer.
|
|
22
|
+
* @param to Output rate, a positive safe integer.
|
|
23
|
+
* @returns New mono samples at `to` samples per second, rounded to Float32.
|
|
24
|
+
*/
|
|
25
|
+
function resampleProductionAudio(source, from, to) {
|
|
26
|
+
const length = Math.round((source.length * to) / from);
|
|
27
|
+
const output = new Float32Array(length);
|
|
28
|
+
// The kernel's argument is in units of the low-pass's zero-crossing spacing.
|
|
29
|
+
// Downsampling stretches that spacing over more input samples and scales the
|
|
30
|
+
// kernel down by the same factor, so its DC gain stays one at either rate.
|
|
31
|
+
const scale = Math.min(1, to / from) * ROLLOFF;
|
|
32
|
+
const reach = Math.ceil(ZERO_CROSSINGS / scale);
|
|
33
|
+
for (let index = 0; index < length; ++index) {
|
|
34
|
+
const position = (index * from) / to;
|
|
35
|
+
const centre = Math.floor(position);
|
|
36
|
+
let sum = 0;
|
|
37
|
+
for (let input = Math.max(0, centre - reach); input <= Math.min(source.length - 1, centre + reach); ++input) {
|
|
38
|
+
const distance = Math.abs(position - input) * scale;
|
|
39
|
+
if (distance >= ZERO_CROSSINGS)
|
|
40
|
+
continue;
|
|
41
|
+
const at = distance * TABLE_DENSITY;
|
|
42
|
+
const entry = Math.floor(at);
|
|
43
|
+
const weight = KERNEL[entry] + (at - entry) * (KERNEL[entry + 1] - KERNEL[entry]);
|
|
44
|
+
sum += source[input] * weight;
|
|
45
|
+
}
|
|
46
|
+
output[index] = sum * scale;
|
|
47
|
+
}
|
|
48
|
+
return output;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Zero crossings of the sinc on each side of the centre. With `ROLLOFF` and the
|
|
52
|
+
* Kaiser window below, the filter spans `2 × 32 / 0.9 ≈ 71` input samples when
|
|
53
|
+
* upsampling, which gives a transition band of about 0.44 rad per input sample
|
|
54
|
+
* by Kaiser's design formula `Δω = (A − 8) / (2.285 M)` (Oppenheim and Schafer,
|
|
55
|
+
* Discrete-Time Signal Processing, 3rd ed., §7.6): 1.7 kHz at a 24 kHz source.
|
|
56
|
+
*/
|
|
57
|
+
const ZERO_CROSSINGS = 32;
|
|
58
|
+
/**
|
|
59
|
+
* Cutoff as a fraction of the lower Nyquist frequency. At 0.9 the transition
|
|
60
|
+
* band of a 24 kHz source runs from about 9.95 to 11.65 kHz, so speech up to 10
|
|
61
|
+
* kHz passes and the first image of any passband tone lies in the stopband.
|
|
62
|
+
*/
|
|
63
|
+
const ROLLOFF = 0.9;
|
|
64
|
+
/** Kaiser window stopband attenuation in dB, the design target `A`. */
|
|
65
|
+
const STOPBAND_DB = 80;
|
|
66
|
+
/**
|
|
67
|
+
* Kernel table entries per zero crossing; Smith and Gossett interpolate
|
|
68
|
+
* linearly between them.
|
|
69
|
+
*/
|
|
70
|
+
const TABLE_DENSITY = 512;
|
|
71
|
+
/** Modified Bessel function of the first kind, order zero, by its power series. */
|
|
72
|
+
const besselI0 = (x) => {
|
|
73
|
+
let sum = 1;
|
|
74
|
+
let term = 1;
|
|
75
|
+
for (let k = 1; term > sum * 1e-21; ++k) {
|
|
76
|
+
term *= (x / (2 * k)) * (x / (2 * k));
|
|
77
|
+
sum += term;
|
|
78
|
+
}
|
|
79
|
+
return sum;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* The windowed sinc `sinc(u) × I0(β √(1 − (u/Z)²)) / I0(β)` at `u = i /
|
|
83
|
+
* TABLE_DENSITY`, for `u` from 0 to `ZERO_CROSSINGS`, followed by one zero so
|
|
84
|
+
* the last interpolation step ends at the window's edge. `β = 0.1102 (A − 8.7)`
|
|
85
|
+
* is Kaiser's shape for an attenuation `A` above 50 dB (Oppenheim and Schafer,
|
|
86
|
+
* §7.6.1).
|
|
87
|
+
*/
|
|
88
|
+
const KERNEL = (() => {
|
|
89
|
+
const beta = 0.1102 * (STOPBAND_DB - 8.7);
|
|
90
|
+
const entries = ZERO_CROSSINGS * TABLE_DENSITY;
|
|
91
|
+
const table = new Float64Array(entries + 2);
|
|
92
|
+
const norm = besselI0(beta);
|
|
93
|
+
for (let index = 0; index <= entries; ++index) {
|
|
94
|
+
const u = index / TABLE_DENSITY;
|
|
95
|
+
const sinc = u === 0 ? 1 : Math.sin(Math.PI * u) / (Math.PI * u);
|
|
96
|
+
const ratio = u / ZERO_CROSSINGS;
|
|
97
|
+
table[index] =
|
|
98
|
+
(sinc * besselI0(beta * Math.sqrt(Math.max(0, 1 - ratio * ratio)))) /
|
|
99
|
+
norm;
|
|
100
|
+
}
|
|
101
|
+
return table;
|
|
102
|
+
})();
|
|
103
|
+
//# sourceMappingURL=resampleProductionAudio.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resampleProductionAudio.js","sourceRoot":"","sources":["../../src/audio/resampleProductionAudio.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,iCACE,MAAoB,EACpB,IAAY,EACZ,EAAU;IAEV,MAAM,MAAM,GAAW,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,MAAM,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;IAC/D,MAAM,MAAM,GAAiB,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC;IAEtD,6EAA6E;IAC7E,6EAA6E;IAC7E,2EAA2E;IAC3E,MAAM,KAAK,GAAW,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,GAAG,OAAO,CAAC;IACvD,MAAM,KAAK,GAAW,IAAI,CAAC,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC,CAAC;IACxD,KAAK,IAAI,KAAK,GAAW,CAAC,EAAE,KAAK,GAAG,MAAM,EAAE,EAAE,KAAK,EAAE,CAAC;QACpD,MAAM,QAAQ,GAAW,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC7C,MAAM,MAAM,GAAW,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAC5C,IAAI,GAAG,GAAW,CAAC,CAAC;QACpB,KACE,IAAI,KAAK,GAAW,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,EAC/C,KAAK,IAAI,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,EACpD,EAAE,KAAK,EACP,CAAC;YAC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,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,GAAiB,CAAC,GAAiB,EAAE;IAC/C,MAAM,IAAI,GAAW,MAAM,GAAG,CAAC,WAAW,GAAG,GAAG,CAAC,CAAC;IAClD,MAAM,OAAO,GAAW,cAAc,GAAG,aAAa,CAAC;IACvD,MAAM,KAAK,GAAiB,IAAI,YAAY,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC;IAC1D,MAAM,IAAI,GAAW,QAAQ,CAAC,IAAI,CAAC,CAAC;IACpC,KAAK,IAAI,KAAK,GAAW,CAAC,EAAE,KAAK,IAAI,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC;QACtD,MAAM,CAAC,GAAW,KAAK,GAAG,aAAa,CAAC;QACxC,MAAM,IAAI,GAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;QACzE,MAAM,KAAK,GAAW,CAAC,GAAG,cAAc,CAAC;QACzC,KAAK,CAAC,KAAK,CAAC;YACV,CAAC,IAAI,GAAG,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;gBACnE,IAAI,CAAC;IACT,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC,EAAE,CAAC"}
|
|
@@ -1,22 +1,14 @@
|
|
|
1
1
|
import type { IAutoMoviePpmImageDecodeOptions, IAutoMovieRgb8Image } from "@automovie/interface";
|
|
2
2
|
/**
|
|
3
|
-
* Decode one raw P6 RGB8 image under an explicitly supplied transfer
|
|
4
|
-
* This codec processes bytes without importing glTF SDK objects.
|
|
5
|
-
* main entry also exposes SDK-backed operations with their own
|
|
6
|
-
* The initial subset admits maxval 255, comments
|
|
7
|
-
* and exactly one whitespace byte between maxval
|
|
8
|
-
* 16-bit samples, image sequences and trailing
|
|
9
|
-
* to be whitespace or '#' is pixel data and
|
|
10
|
-
* Netpbm normally specifies BT.709; sRGB is its documented
|
|
11
|
-
* The decoder preserves samples without performing colour
|
|
12
|
-
* See https://netpbm.sourceforge.net/doc/ppm.html.
|
|
13
|
-
*
|
|
14
|
-
* @evidence contracts/development/implementation.md#principled-implementation The documented P6 header and exact RGB raster length determine decoding; explicit transfer metadata avoids relabeling standard BT.709 samples as sRGB. Pixel/header budgets are validated before the detached output allocation.
|
|
15
|
-
* @evidence contracts/development/implementation.md#clear-and-simple-structure This renderer-free byte codec performs only admission and RGB extraction; capture calibration, foreground observation and source publication remain with their owners.
|
|
16
|
-
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No header repair, ignored trailing image, post-header whitespace skipping, unsupported maxval rescaling or implicit colour conversion changes fixed bytes.
|
|
17
|
-
* @evidence contracts/development/common.md#meaningful-documentation States the admitted P6 subset, comments, delimiter/raster distinction, detached ownership, transfer declaration, unsupported variants and budget refusal.
|
|
18
|
-
* @evidence contracts/development/implementation.md#efficient-algorithms Parsing costs O(H) for admitted header bytes and one O(P) RGB copy for P pixels; maxHeaderBytes and maxPixels bound both populations before allocation.
|
|
19
|
-
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Each synchronous call decodes caller-supplied fixed bytes once and defines no cross-request cache.
|
|
20
|
-
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources The caller owns one detached RGB8 result; borrowed source bytes and constant header scratch are released from the call without handles or global retention.
|
|
3
|
+
* Decode one raw P6 RGB8 image under an explicitly supplied transfer
|
|
4
|
+
* convention. This codec processes bytes without importing glTF SDK objects.
|
|
5
|
+
* The package's main entry also exposes SDK-backed operations with their own
|
|
6
|
+
* declaration dependencies. The initial subset admits maxval 255, comments
|
|
7
|
+
* before numeric header tokens and exactly one whitespace byte between maxval
|
|
8
|
+
* and raster. It rejects P3, 16-bit samples, image sequences and trailing
|
|
9
|
+
* bytes. A raster byte that happens to be whitespace or '#' is pixel data and
|
|
10
|
+
* is never skipped. Netpbm normally specifies BT.709; sRGB is its documented
|
|
11
|
+
* common variation. The decoder preserves samples without performing colour
|
|
12
|
+
* conversion. See https://netpbm.sourceforge.net/doc/ppm.html.
|
|
21
13
|
*/
|
|
22
14
|
export declare function decodeAutoMoviePpmImage(bytes: Uint8Array, options: IAutoMoviePpmImageDecodeOptions): IAutoMovieRgb8Image;
|
|
@@ -2,24 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.decodeAutoMoviePpmImage = decodeAutoMoviePpmImage;
|
|
4
4
|
/**
|
|
5
|
-
* Decode one raw P6 RGB8 image under an explicitly supplied transfer
|
|
6
|
-
* This codec processes bytes without importing glTF SDK objects.
|
|
7
|
-
* main entry also exposes SDK-backed operations with their own
|
|
8
|
-
* The initial subset admits maxval 255, comments
|
|
9
|
-
* and exactly one whitespace byte between maxval
|
|
10
|
-
* 16-bit samples, image sequences and trailing
|
|
11
|
-
* to be whitespace or '#' is pixel data and
|
|
12
|
-
* Netpbm normally specifies BT.709; sRGB is its documented
|
|
13
|
-
* The decoder preserves samples without performing colour
|
|
14
|
-
* See https://netpbm.sourceforge.net/doc/ppm.html.
|
|
15
|
-
*
|
|
16
|
-
* @evidence contracts/development/implementation.md#principled-implementation The documented P6 header and exact RGB raster length determine decoding; explicit transfer metadata avoids relabeling standard BT.709 samples as sRGB. Pixel/header budgets are validated before the detached output allocation.
|
|
17
|
-
* @evidence contracts/development/implementation.md#clear-and-simple-structure This renderer-free byte codec performs only admission and RGB extraction; capture calibration, foreground observation and source publication remain with their owners.
|
|
18
|
-
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No header repair, ignored trailing image, post-header whitespace skipping, unsupported maxval rescaling or implicit colour conversion changes fixed bytes.
|
|
19
|
-
* @evidence contracts/development/common.md#meaningful-documentation States the admitted P6 subset, comments, delimiter/raster distinction, detached ownership, transfer declaration, unsupported variants and budget refusal.
|
|
20
|
-
* @evidence contracts/development/implementation.md#efficient-algorithms Parsing costs O(H) for admitted header bytes and one O(P) RGB copy for P pixels; maxHeaderBytes and maxPixels bound both populations before allocation.
|
|
21
|
-
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Each synchronous call decodes caller-supplied fixed bytes once and defines no cross-request cache.
|
|
22
|
-
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources The caller owns one detached RGB8 result; borrowed source bytes and constant header scratch are released from the call without handles or global retention.
|
|
5
|
+
* Decode one raw P6 RGB8 image under an explicitly supplied transfer
|
|
6
|
+
* convention. This codec processes bytes without importing glTF SDK objects.
|
|
7
|
+
* The package's main entry also exposes SDK-backed operations with their own
|
|
8
|
+
* declaration dependencies. The initial subset admits maxval 255, comments
|
|
9
|
+
* before numeric header tokens and exactly one whitespace byte between maxval
|
|
10
|
+
* and raster. It rejects P3, 16-bit samples, image sequences and trailing
|
|
11
|
+
* bytes. A raster byte that happens to be whitespace or '#' is pixel data and
|
|
12
|
+
* is never skipped. Netpbm normally specifies BT.709; sRGB is its documented
|
|
13
|
+
* common variation. The decoder preserves samples without performing colour
|
|
14
|
+
* conversion. See https://netpbm.sourceforge.net/doc/ppm.html.
|
|
23
15
|
*/
|
|
24
16
|
function decodeAutoMoviePpmImage(bytes, options) {
|
|
25
17
|
if (!(bytes instanceof Uint8Array) ||
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decodeAutoMoviePpmImage.js","sourceRoot":"","sources":["../src/decodeAutoMoviePpmImage.ts"],"names":[],"mappings":";;;AAKA
|
|
1
|
+
{"version":3,"file":"decodeAutoMoviePpmImage.js","sourceRoot":"","sources":["../src/decodeAutoMoviePpmImage.ts"],"names":[],"mappings":";;;AAKA;;;;;;;;;;;GAWG;AACH,iCACE,KAAiB,EACjB,OAAwC;IAExC,IACE,CAAC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AM,CAAC,aAAa,CAAC,MAAM,CAAC;QAC7B,MAAM,GAAG,OAAO,CAAC,SAAS;QAE1B,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,IAAI,KAAK,CAAC,MAAM,GAAG,MAAM,KAAK,CAAC,GAAG,MAAM;QACtC,MAAM,IAAI,KAAK,CACb,sEAAsE,CACvE,CAAC;IACJ,OAAO;QACL,KAAK;QACL,MAAM;QACN,IAAI,EAAE,IAAI,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC5C,QAAQ,EAAE,OAAO,CAAC,QAAQ;KAC3B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bounds-checked big-endian reads over one font's bytes, as the Open Font
|
|
3
|
+
* Format stores every field (ISO/IEC 14496-22, section 4.2).
|
|
4
|
+
*
|
|
5
|
+
* Every read names the table it serves, so an offset or a length that leaves
|
|
6
|
+
* the bytes refuses with that table's name instead of reading past the buffer
|
|
7
|
+
* or returning `undefined`. The reader borrows the bytes and copies nothing.
|
|
8
|
+
*/
|
|
9
|
+
export declare class TrueTypeByteReader {
|
|
10
|
+
/** The borrowed font bytes. */
|
|
11
|
+
private readonly bytes;
|
|
12
|
+
/** Big-endian view over the borrowed bytes. */
|
|
13
|
+
private readonly view;
|
|
14
|
+
/** Borrow the font bytes for the life of one decode. */
|
|
15
|
+
constructor(bytes: Uint8Array);
|
|
16
|
+
/**
|
|
17
|
+
* Refuse unless `[offset, offset + size)` lies inside the bytes.
|
|
18
|
+
*
|
|
19
|
+
* @throws {Error} The span leaves the bytes; the message names `what`.
|
|
20
|
+
*/
|
|
21
|
+
require(offset: number, size: number, what: string): void;
|
|
22
|
+
/** Unsigned 8-bit integer. */
|
|
23
|
+
u8(offset: number, what: string): number;
|
|
24
|
+
/** Signed 8-bit integer. */
|
|
25
|
+
i8(offset: number, what: string): number;
|
|
26
|
+
/** Unsigned 16-bit big-endian integer. */
|
|
27
|
+
u16(offset: number, what: string): number;
|
|
28
|
+
/** Signed 16-bit big-endian integer. */
|
|
29
|
+
i16(offset: number, what: string): number;
|
|
30
|
+
/** Unsigned 32-bit big-endian integer. */
|
|
31
|
+
u32(offset: number, what: string): number;
|
|
32
|
+
/** Four-byte tag read as ASCII, such as a table name or an `sfnt` version tag. */
|
|
33
|
+
tag(offset: number, what: string): string;
|
|
34
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TrueTypeByteReader = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Bounds-checked big-endian reads over one font's bytes, as the Open Font
|
|
6
|
+
* Format stores every field (ISO/IEC 14496-22, section 4.2).
|
|
7
|
+
*
|
|
8
|
+
* Every read names the table it serves, so an offset or a length that leaves
|
|
9
|
+
* the bytes refuses with that table's name instead of reading past the buffer
|
|
10
|
+
* or returning `undefined`. The reader borrows the bytes and copies nothing.
|
|
11
|
+
*/
|
|
12
|
+
class TrueTypeByteReader {
|
|
13
|
+
/** The borrowed font bytes. */
|
|
14
|
+
bytes;
|
|
15
|
+
/** Big-endian view over the borrowed bytes. */
|
|
16
|
+
view;
|
|
17
|
+
/** Borrow the font bytes for the life of one decode. */
|
|
18
|
+
constructor(bytes) {
|
|
19
|
+
this.bytes = bytes;
|
|
20
|
+
this.view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Refuse unless `[offset, offset + size)` lies inside the bytes.
|
|
24
|
+
*
|
|
25
|
+
* @throws {Error} The span leaves the bytes; the message names `what`.
|
|
26
|
+
*/
|
|
27
|
+
require(offset, size, what) {
|
|
28
|
+
if (!Number.isSafeInteger(offset) ||
|
|
29
|
+
!Number.isSafeInteger(size) ||
|
|
30
|
+
offset < 0 ||
|
|
31
|
+
size < 0 ||
|
|
32
|
+
offset + size > this.bytes.byteLength)
|
|
33
|
+
throw new Error(`TrueType ${what} at byte ${offset} with length ${size} lies outside the ${this.bytes.byteLength} font bytes`);
|
|
34
|
+
}
|
|
35
|
+
/** Unsigned 8-bit integer. */
|
|
36
|
+
u8(offset, what) {
|
|
37
|
+
this.require(offset, 1, what);
|
|
38
|
+
return this.view.getUint8(offset);
|
|
39
|
+
}
|
|
40
|
+
/** Signed 8-bit integer. */
|
|
41
|
+
i8(offset, what) {
|
|
42
|
+
this.require(offset, 1, what);
|
|
43
|
+
return this.view.getInt8(offset);
|
|
44
|
+
}
|
|
45
|
+
/** Unsigned 16-bit big-endian integer. */
|
|
46
|
+
u16(offset, what) {
|
|
47
|
+
this.require(offset, 2, what);
|
|
48
|
+
return this.view.getUint16(offset, false);
|
|
49
|
+
}
|
|
50
|
+
/** Signed 16-bit big-endian integer. */
|
|
51
|
+
i16(offset, what) {
|
|
52
|
+
this.require(offset, 2, what);
|
|
53
|
+
return this.view.getInt16(offset, false);
|
|
54
|
+
}
|
|
55
|
+
/** Unsigned 32-bit big-endian integer. */
|
|
56
|
+
u32(offset, what) {
|
|
57
|
+
this.require(offset, 4, what);
|
|
58
|
+
return this.view.getUint32(offset, false);
|
|
59
|
+
}
|
|
60
|
+
/** Four-byte tag read as ASCII, such as a table name or an `sfnt` version tag. */
|
|
61
|
+
tag(offset, what) {
|
|
62
|
+
this.require(offset, 4, what);
|
|
63
|
+
return String.fromCharCode(this.view.getUint8(offset), this.view.getUint8(offset + 1), this.view.getUint8(offset + 2), this.view.getUint8(offset + 3));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.TrueTypeByteReader = TrueTypeByteReader;
|
|
67
|
+
//# sourceMappingURL=TrueTypeByteReader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TrueTypeByteReader.js","sourceRoot":"","sources":["../../src/font/TrueTypeByteReader.ts"],"names":[],"mappings":";;;AAAA;;;;;;;GAOG;AACH;IACE,+BA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IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC5C,CAAC;IAED,wCAAwC;IACjC,GAAG,CAAC,MAAc,EAAE,IAAY;QACrC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;QAC9B,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC3C,CAAC;IAED,0CAA0C;IACnC,GAAG,CAAC,MAAc,EAAE,IAAY;QACrC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;QAC9B,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC5C,CAAC;IAED,kFAAkF;IAC3E,GAAG,CAAC,MAAc,EAAE,IAAY;QACrC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;QAC9B,OAAO,MAAM,CAAC,YAAY,CACxB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAC1B,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,EAC9B,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,EAC9B,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAC/B,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { IAutoMovieFont } from "@automovie/interface";
|
|
2
|
+
/**
|
|
3
|
+
* Decode one TrueType-outline font's bytes into outlines, metrics, kerning and
|
|
4
|
+
* descriptive names, following the Open Font Format (ISO/IEC 14496-22).
|
|
5
|
+
*
|
|
6
|
+
* It admits a single font whose `sfnt` version is `0x00010000` or the tag
|
|
7
|
+
* `true`, and refuses, each with its own diagnostic, CFF outlines (`OTTO`), a
|
|
8
|
+
* font collection (`ttcf`), WOFF (`wOFF`) and WOFF2 (`wOF2`), any other
|
|
9
|
+
* version, a missing required table (`head`, `hhea`, `maxp`, `cmap`, `hmtx`,
|
|
10
|
+
* `loca`, `glyf`), a table record or field outside the bytes, a `head` magic
|
|
11
|
+
* number other than `0x5F0F3CF5`, a units-per-em outside 16 to 16384, and a
|
|
12
|
+
* `loca` offset that decreases or lies past the end of `glyf`.
|
|
13
|
+
*
|
|
14
|
+
* It reads `head` (units per em, `loca` format), `hhea` (ascender, descender,
|
|
15
|
+
* line gap, horizontal metric count), `maxp` (glyph count), `cmap` (formats 4
|
|
16
|
+
* and 12 for Unicode), `hmtx`, `loca` and `glyf`, composite glyphs included;
|
|
17
|
+
* `kern` format 0 pairs when present; the `OS/2` `fsType` and `name` IDs 1, 13
|
|
18
|
+
* and 14 when present. Only glyphs a code point maps to are decoded, each once.
|
|
19
|
+
* Table checksums are not verified: a damaged byte that still decodes yields
|
|
20
|
+
* the outline it encodes, and the asset ledger's digest is what fixes the
|
|
21
|
+
* bytes. Hinting instructions are skipped.
|
|
22
|
+
*
|
|
23
|
+
* The function is pure: the same bytes always give a deep-equal record, and the
|
|
24
|
+
* result shares no storage with the input.
|
|
25
|
+
*
|
|
26
|
+
* @param bytes The font file's bytes; only read.
|
|
27
|
+
* @returns The decoded record in font units.
|
|
28
|
+
* @throws {Error} Any refusal above, naming the format, table, glyph or offset
|
|
29
|
+
* at fault.
|
|
30
|
+
*/
|
|
31
|
+
export declare function decodeAutoMovieTrueTypeFont(bytes: Uint8Array): IAutoMovieFont;
|