@bubo-squared/gyroview 0.3.1 → 0.4.1
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/CHANGELOG.md +45 -0
- package/README.md +3 -3
- package/dist/index.d.ts +36 -0
- package/dist/packages/adapters/mediabunny/src/MediabunnyAudioPackager.js +49 -15
- package/dist/packages/adapters/mediabunny/src/MediabunnyCodecReader.js +3 -1
- package/dist/packages/adapters/mediabunny/src/decoderConfigurations.js +2 -2
- package/dist/packages/adapters/mediabunny/src/trackColour.js +21 -0
- package/dist/packages/adapters/mse-audio/src/SourceBufferFeeder.js +12 -1
- package/dist/packages/adapters/three/src/ThreeFrameRenderer.js +3 -0
- package/dist/packages/adapters/three/src/conversionUniforms.js +61 -0
- package/dist/packages/adapters/three/src/glslLiterals.js +10 -0
- package/dist/packages/adapters/three/src/matrixCorrections.js +35 -0
- package/dist/packages/adapters/three/src/rendererUniforms.js +33 -12
- package/dist/packages/adapters/three/src/shaderPrograms.js +4 -2
- package/dist/packages/adapters/three/src/shaders/analysis.frag.js +1 -1
- package/dist/packages/adapters/three/src/shaders/displayConversion.js +4 -0
- package/dist/packages/adapters/three/src/shaders/lensModels.js +1 -1
- package/dist/packages/adapters/three/src/shaders/lensSampling.js +1 -1
- package/dist/packages/adapters/three/src/shaders/rawLenses.frag.js +1 -1
- package/dist/packages/adapters/three/src/shaders/stitch.frag.js +1 -1
- package/dist/packages/adapters/three/src/threeMatrix.js +10 -0
- package/dist/packages/adapters/webcodecs/src/WebCodecsVideoDecoderPort.js +4 -2
- package/dist/packages/adapters/webcodecs/src/colorSpaceOf.js +32 -0
- package/dist/packages/core/src/application/recording/frameTimesOf.js +0 -1
- package/dist/packages/core/src/domain/colour/DisplayConversion.js +137 -0
- package/dist/packages/core/src/domain/colour/TrackColour.js +38 -0
- package/dist/packages/core/src/domain/colour/matrixCorrection.js +76 -0
- package/dist/packages/core/src/domain/format/calibration/CalibrationVersion.js +7 -4
- package/dist/packages/core/src/domain/format/calibration/layouts/CalibrationStringLayout.js +1 -1
- package/dist/packages/core/src/domain/format/calibration/layouts/LegacyCalibrationLayout.js +1 -0
- package/dist/packages/core/src/domain/format/calibration/layouts/MeiCalibrationLayout.js +109 -35
- package/dist/packages/core/src/domain/format/calibration/layouts/PolynomialCalibrationLayout.js +1 -0
- package/dist/packages/core/src/domain/format/calibration/offsetTokens.js +33 -4
- package/dist/packages/core/src/domain/format/calibration/parseOffsetString.js +22 -17
- package/dist/packages/core/src/domain/format/calibration/selectCalibration.js +28 -15
- package/dist/packages/core/src/domain/format/calibration/v6TermReading.js +20 -0
- package/dist/packages/core/src/domain/format/info/calibrationSources.js +27 -0
- package/dist/packages/core/src/domain/format/info/infoFields.js +8 -2
- package/dist/packages/core/src/domain/format/info/parseInfoRecord.js +11 -6
- package/dist/packages/core/src/domain/motion/imu/ImuFrame.js +31 -9
- package/dist/packages/core/src/domain/motion/timing/FrameTimes.js +1 -3
- package/dist/packages/core/src/domain/motion/timing/frameTimeSources.js +0 -3
- package/dist/packages/core/src/domain/optics/MeiDistortion.js +43 -0
- package/dist/packages/core/src/domain/optics/MeiModel.js +6 -14
- package/dist/packages/core/src/domain/optics/scaledProjection.js +30 -0
- package/dist/packages/core/src/domain/stitching/StitchingSetup.js +13 -4
- package/dist/packages/core/src/index.js +6 -2
- package/dist/packages/core/src/shared/index.js +11 -0
- package/dist/packages/core/src/shared/mapRecord.js +11 -0
- package/dist/packages/core/src/shared/protobuf/ProtobufMessage.js +12 -26
- package/dist/packages/core/src/shared/protobuf/wireFormat.js +16 -0
- package/dist/packages/player/src/composition/buildPipeline.js +2 -1
- package/dist/packages/player/src/composition/openInputs.js +4 -1
- package/dist/standalone.js +211 -100
- package/package.json +2 -2
|
@@ -1,24 +1,10 @@
|
|
|
1
1
|
import { GyroViewError } from "../errors/GyroViewError.js";
|
|
2
2
|
import { ByteReader } from "../binary/ByteReader.js";
|
|
3
3
|
import { decodeUtf8 } from "../text/utf8.js";
|
|
4
|
+
import { WireType } from "./wireFormat.js";
|
|
4
5
|
//#region ../../packages/core/src/shared/protobuf/ProtobufMessage.ts
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*/
|
|
8
|
-
var WireType = {
|
|
9
|
-
Varint: 0,
|
|
10
|
-
Fixed64: 1,
|
|
11
|
-
LengthDelimited: 2,
|
|
12
|
-
Fixed32: 5
|
|
13
|
-
};
|
|
14
|
-
var FIELD_NUMBER_SHIFT = 3;
|
|
15
|
-
var WIRE_TYPE_MASK = 7;
|
|
16
|
-
var VARINT_PAYLOAD_BITS = 7n;
|
|
17
|
-
var VARINT_PAYLOAD_MASK = 127n;
|
|
18
|
-
var VARINT_CONTINUATION_BIT = 128;
|
|
19
|
-
var FIXED64_SIZE = 8;
|
|
20
|
-
var FIXED32_SIZE = 4;
|
|
21
|
-
var MAX_VARINT_BYTES = 10;
|
|
6
|
+
var VARINT_SHIFT = BigInt(7);
|
|
7
|
+
var VARINT_MASK = BigInt(127);
|
|
22
8
|
var MAX_SAFE = BigInt(Number.MAX_SAFE_INTEGER);
|
|
23
9
|
/**
|
|
24
10
|
* A schema-less view of one encoded protobuf message: fields are looked up by number and unknown
|
|
@@ -93,8 +79,8 @@ var Cursor = class {
|
|
|
93
79
|
}
|
|
94
80
|
readField() {
|
|
95
81
|
const key = this.readVarint();
|
|
96
|
-
const number = Number(key >> BigInt(
|
|
97
|
-
const wireType = Number(key & BigInt(
|
|
82
|
+
const number = Number(key >> BigInt(3));
|
|
83
|
+
const wireType = Number(key & BigInt(7));
|
|
98
84
|
return {
|
|
99
85
|
number,
|
|
100
86
|
value: this.readValue(wireType, number)
|
|
@@ -108,11 +94,11 @@ var Cursor = class {
|
|
|
108
94
|
};
|
|
109
95
|
case WireType.Fixed64: return {
|
|
110
96
|
kind: "fixed64",
|
|
111
|
-
bytes: this.readBytes(
|
|
97
|
+
bytes: this.readBytes(8)
|
|
112
98
|
};
|
|
113
99
|
case WireType.Fixed32: return {
|
|
114
100
|
kind: "fixed32",
|
|
115
|
-
bytes: this.readBytes(
|
|
101
|
+
bytes: this.readBytes(4)
|
|
116
102
|
};
|
|
117
103
|
case WireType.LengthDelimited: return {
|
|
118
104
|
kind: "bytes",
|
|
@@ -124,13 +110,13 @@ var Cursor = class {
|
|
|
124
110
|
readVarint() {
|
|
125
111
|
let result = 0n;
|
|
126
112
|
let shift = 0n;
|
|
127
|
-
for (let consumed = 0; consumed <
|
|
113
|
+
for (let consumed = 0; consumed < 10; consumed += 1) {
|
|
128
114
|
const byte = this.readByte();
|
|
129
|
-
result |= (BigInt(byte) &
|
|
130
|
-
if ((byte &
|
|
131
|
-
shift +=
|
|
115
|
+
result |= (BigInt(byte) & VARINT_MASK) << shift;
|
|
116
|
+
if ((byte & 128) === 0) return result;
|
|
117
|
+
shift += VARINT_SHIFT;
|
|
132
118
|
}
|
|
133
|
-
throw new GyroViewError("invalid-protobuf", `varint longer than
|
|
119
|
+
throw new GyroViewError("invalid-protobuf", `varint longer than 10 bytes at byte ${this.position}`);
|
|
134
120
|
}
|
|
135
121
|
readLength() {
|
|
136
122
|
const length = this.readVarint();
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region ../../packages/core/src/shared/protobuf/wireFormat.ts
|
|
2
|
+
/**
|
|
3
|
+
* The Protocol Buffers wire format (protobuf encoding spec, "Message Structure"): the wire types
|
|
4
|
+
* a field key names and how keys and varints are laid out. The decoder and the fixtures' encoder
|
|
5
|
+
* share it, so that the two cannot disagree on a byte.
|
|
6
|
+
*
|
|
7
|
+
* The wire types the info record uses; groups (3, 4) are obsolete, and the decoder rejects them.
|
|
8
|
+
*/
|
|
9
|
+
var WireType = {
|
|
10
|
+
Varint: 0,
|
|
11
|
+
Fixed64: 1,
|
|
12
|
+
LengthDelimited: 2,
|
|
13
|
+
Fixed32: 5
|
|
14
|
+
};
|
|
15
|
+
//#endregion
|
|
16
|
+
export { WireType };
|
|
@@ -122,7 +122,8 @@ function wallClock(warning) {
|
|
|
122
122
|
function stitchingSetupOf(opened) {
|
|
123
123
|
return buildStitchingSetup({
|
|
124
124
|
calibration: opened.calibration,
|
|
125
|
-
layout: opened.layout
|
|
125
|
+
layout: opened.layout,
|
|
126
|
+
displayConversions: opened.displayConversions
|
|
126
127
|
});
|
|
127
128
|
}
|
|
128
129
|
function sinkOver(renderer, opened) {
|
|
@@ -3,6 +3,7 @@ import { seconds } from "../../../core/src/shared/units/time.js";
|
|
|
3
3
|
import { timeRecording } from "../../../core/src/application/recording/timeRecording.js";
|
|
4
4
|
import { detectLensLayout } from "../../../core/src/domain/format/layout/detectLensLayout.js";
|
|
5
5
|
import { lensFrameOrder } from "../../../core/src/domain/stitching/StitchingSetup.js";
|
|
6
|
+
import { displayConversionsOf } from "../../../core/src/domain/colour/DisplayConversion.js";
|
|
6
7
|
import { startFileDownload } from "../../../core/src/application/download/startFileDownload.js";
|
|
7
8
|
import { downloadPolicyFor } from "../../../core/src/domain/download/DownloadPolicy.js";
|
|
8
9
|
import { RecordingBuffer } from "../../../core/src/application/download/RecordingBuffer.js";
|
|
@@ -77,18 +78,20 @@ function calibrationOf(recording) {
|
|
|
77
78
|
function assemble(parts, packager, disposables) {
|
|
78
79
|
const { read, files, layout, frameSources, calibration, timing } = parts;
|
|
79
80
|
const duration = seconds(Math.min(...files.map((file) => file.duration)));
|
|
81
|
+
const display = displayConversionsOf(frameSources.map((source) => source.description.colour));
|
|
80
82
|
const [sound] = files.flatMap((file) => file.audioTracks);
|
|
81
83
|
return {
|
|
82
84
|
recording: read.recording,
|
|
83
85
|
layout,
|
|
84
86
|
frameSources,
|
|
85
87
|
calibration,
|
|
88
|
+
displayConversions: display.conversions,
|
|
86
89
|
duration,
|
|
87
90
|
frameTimes: timing.frameTimes,
|
|
88
91
|
motion: timing.motion,
|
|
89
92
|
soundSegments: sound && (() => packager.segmentsOf(sound.samples, sound.configuration)),
|
|
90
93
|
metadata: metadataOf(parts, duration, sound !== void 0),
|
|
91
|
-
warnings: timing.warnings,
|
|
94
|
+
warnings: [...timing.warnings, ...display.warnings],
|
|
92
95
|
readAhead: () => {
|
|
93
96
|
for (const file of files) file.download.startReadingAhead();
|
|
94
97
|
},
|