conformtools 0.6.4 → 0.6.6
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 +3 -3
- package/dist/account-HDXVTS5T.js +3 -0
- package/dist/avid-panel/MANIFEST.json +11 -0
- package/dist/avid-panel/avid-manifest.json +46 -0
- package/dist/avid-panel/icon.svg +4 -0
- package/dist/avid-panel/icons/conformtools.svg +4 -0
- package/dist/avid-panel/index.html +26 -0
- package/dist/avid-panel/panel.css +12 -0
- package/dist/avid-panel/panel.js +7 -0
- package/dist/bridge-D5KPIUSY.js +3 -0
- package/dist/browser/timeline_core_bg.wasm +0 -0
- package/dist/chunk-3OCQA33E.js +3 -0
- package/dist/chunk-3XD6NC4G.js +10 -0
- package/dist/chunk-5JBUCVRI.js +20 -0
- package/dist/chunk-5RSNFPED.js +8 -0
- package/dist/{chunk-BW2NQ54J.js → chunk-5SUGU2YR.js} +1 -1
- package/dist/{chunk-HKP4P6JN.js → chunk-6ML26TIK.js} +1 -1
- package/dist/chunk-7MC7M2Y5.js +3 -0
- package/dist/chunk-AS7IXHYM.js +19 -0
- package/dist/chunk-BL6L5ZBP.js +39 -0
- package/dist/chunk-C5IX63YF.js +3 -0
- package/dist/chunk-EJGVNQ3E.js +8 -0
- package/dist/{chunk-EPZ6NWE4.js → chunk-HGDO3OED.js} +1 -1
- package/dist/chunk-JV7TZDKJ.js +3 -0
- package/dist/chunk-LFJLRLEP.js +3 -0
- package/dist/chunk-NFJHWZJX.js +3 -0
- package/dist/{chunk-WT6NIJCB.js → chunk-NQHQKEP5.js} +1 -1
- package/dist/chunk-NU3X7P4N.js +3 -0
- package/dist/chunk-OJWIBQK4.js +376 -0
- package/dist/chunk-OVUCL3YY.js +5 -0
- package/dist/chunk-PFISREY4.js +3 -0
- package/dist/chunk-PFZVET7S.js +3 -0
- package/dist/chunk-PLRB2YXJ.js +3 -0
- package/dist/chunk-RFIPLBQ4.js +5 -0
- package/dist/chunk-SZD4C5MB.js +6 -0
- package/dist/chunk-TXQR2HI2.js +4 -0
- package/dist/chunk-UKKRZ574.js +7 -0
- package/dist/{chunk-EO5NIBOV.js → chunk-VS3MKKJ5.js} +1 -1
- package/dist/{chunk-42QQI3WX.js → chunk-X53BNWNV.js} +1 -1
- package/dist/{chunk-QTPCU2TF.js → chunk-XNR7M4VX.js} +1 -1
- package/dist/{claude-setup-BM3AAUKR.js → claude-setup-IIWUB4CE.js} +1 -1
- package/dist/cli.js +8 -8
- package/dist/conformtools-analyze +0 -0
- package/dist/conformtools-decode +0 -0
- package/dist/{cr3-wasm-WKWMEK3V.js → cr3-wasm-L2LFY3LM.js} +1 -1
- package/dist/{dng-wasm-Z5OVO4UI.js → dng-wasm-U6NC3MDK.js} +1 -1
- package/dist/{dpx-wasm-QNYXAOAJ.js → dpx-wasm-RMKEUKED.js} +1 -1
- package/dist/engine-P6H5P6HP.js +5 -0
- package/dist/{exr-wasm-BHSBJLQH.js → exr-wasm-LBAOMOZD.js} +1 -1
- package/dist/flame/hook/conformtools_flame/__init__.py +10 -0
- package/dist/flame/hook/conformtools_flame/building.py +191 -0
- package/dist/flame/hook/conformtools_flame/hook.py +177 -0
- package/dist/flame/hook/conformtools_flame/render.py +622 -0
- package/dist/flame/hook/conformtools_flame/util.py +33 -0
- package/dist/flame/hook/conformtools_flame/verbs.py +1037 -0
- package/dist/flame/hook/conformtools_flame_hook.py +42 -0
- package/dist/fonts/gfx/BarlowCondensed-Bold.ttf +0 -0
- package/dist/fonts/gfx/BarlowCondensed-Regular.ttf +0 -0
- package/dist/fonts/gfx/InstrumentSerif-Regular.ttf +0 -0
- package/dist/fonts/gfx/Inter-Bold.ttf +0 -0
- package/dist/fonts/gfx/Inter-Regular.ttf +0 -0
- package/dist/fonts/gfx/JetBrainsMono-Bold.ttf +0 -0
- package/dist/fonts/gfx/JetBrainsMono-Regular.ttf +0 -0
- package/dist/fonts/gfx/OFL.txt +100 -0
- package/dist/framing-SRCJKAYO.js +3 -0
- package/dist/gfx-worker.js +3 -0
- package/dist/h264-3ESGVT6G.js +3 -0
- package/dist/{h264-mxf-MWS7DDV7.js → h264-mxf-NPFS7NGH.js} +1 -1
- package/dist/host-relink-D6CB2VOQ.js +10 -0
- package/dist/hosts-W4AD2MYH.js +3 -0
- package/dist/http.js +3 -2
- package/dist/i2o-transfer +0 -0
- package/dist/inspect-7ASUPU73.js +68 -0
- package/dist/isobmff-SIOE67WL.js +3 -0
- package/dist/mcp.js +7 -8
- package/dist/media-7AUNRKHF.js +3 -0
- package/dist/media_core-Q2PIEV7D.js +9 -0
- package/dist/{media_core_bg-FGAR5KA5.js → media_core_bg-FDL7GJZP.js} +1 -1
- package/dist/mxf-74TTDICM.js +3 -0
- package/dist/nuke/panel/python/Startup/conformtools_nuke_startup.py +44 -0
- package/dist/nuke/panel/python/conformtools_nuke/__init__.py +10 -0
- package/dist/nuke/panel/python/conformtools_nuke/panel.py +217 -0
- package/dist/nuke/panel/python/conformtools_nuke/verbs.py +837 -0
- package/dist/{ops-73NR3X6R.js → ops-FSOOBXMV.js} +1 -1
- package/dist/peer-kit/ctpeer/__init__.py +21 -0
- package/dist/peer-kit/ctpeer/client.py +247 -0
- package/dist/peer-kit/ctpeer/neutral.py +178 -0
- package/dist/peer-kit/ctpeer/pairing.py +139 -0
- package/dist/peer-kit/ctpeer/protocol.py +209 -0
- package/dist/peer-kit/ctpeer/websocket.py +289 -0
- package/dist/premiere-uxp/index.js +5 -5
- package/dist/premiere-uxp/lib/clipmeta.js +6 -6
- package/dist/premiere-uxp/lib/ctx.js +30 -24
- package/dist/premiere-uxp/lib/edit.js +516 -0
- package/dist/premiere-uxp/lib/markers.js +5 -5
- package/dist/premiere-uxp/lib/pairing.js +14 -5
- package/dist/premiere-uxp/lib/premiere.js +10 -1
- package/dist/premiere-uxp/lib/probe.js +102 -0
- package/dist/premiere-uxp/lib/render.js +15 -8
- package/dist/premiere-uxp/lib/session.js +1 -1
- package/dist/premiere-uxp/lib/sizing.js +30 -17
- package/dist/premiere-uxp/lib/time.js +7 -1
- package/dist/premiere-uxp/lib/timeline.js +2 -2
- package/dist/premiere-uxp/lib/verbs.js +3 -2
- package/dist/premiere-uxp/lib/write.js +3 -3
- package/dist/premiere-uxp/manifest.json +1 -1
- package/dist/probe-F7WQHMIA.js +3 -0
- package/dist/r3d-YTLOMC7C.js +3 -0
- package/dist/{r3d-VUOYU2KQ.js → r3d-ZDJ3WURS.js} +1 -1
- package/dist/resolve-bridge.py +1262 -13
- package/dist/{still-4G25EYN5.js → still-ZG2RUQAL.js} +1 -1
- package/dist/store-ZHXLQCGN.js +3 -0
- package/dist/{tiff-wasm-QJPCR7JT.js → tiff-wasm-D2FJ3L56.js} +1 -1
- package/dist/timeline-6DYFDVEH.js +3 -0
- package/dist/timeline_core-IOENXK4Z.js +3 -0
- package/dist/wasm/media_core_bg.wasm +0 -0
- package/dist/wasm-threads/media_core_bg.wasm +0 -0
- package/dist/wav-OWMUGQMM.js +3 -0
- package/package.json +6 -4
- package/dist/chunk-6FVGUJ6L.js +0 -3
- package/dist/chunk-6TM32YIJ.js +0 -7
- package/dist/chunk-BUEIRRNY.js +0 -3
- package/dist/chunk-CL26XMDO.js +0 -3
- package/dist/chunk-DRHOPOC7.js +0 -3
- package/dist/chunk-GXEVALBL.js +0 -3
- package/dist/chunk-JB7PR2TQ.js +0 -3
- package/dist/chunk-QDWB7QU7.js +0 -3
- package/dist/chunk-QTKRMXL5.js +0 -363
- package/dist/chunk-SP5RGDAM.js +0 -3
- package/dist/chunk-TEZP6VEQ.js +0 -3
- package/dist/chunk-Y2BEEOPB.js +0 -3
- package/dist/h264-LIZVHN2W.js +0 -3
- package/dist/inspect-DZF537QL.js +0 -46
- package/dist/isobmff-HM3UPWPZ.js +0 -3
- package/dist/media_core-R5PPN3AY.js +0 -9
- package/dist/mxf-K465SWBN.js +0 -3
- package/dist/onnxruntime-web-stub-PKJ2NZBF.js +0 -3
- package/dist/r3d-RR3FUM6H.js +0 -3
- package/dist/sscd-embed-DHFTEIOC.js +0 -3
- package/dist/sscd-sweep-OYS4XAID.js +0 -3
- package/dist/timeline_core-VK2ZWPCO.js +0 -3
- package/dist/wav-63QF6SCT.js +0 -3
- /package/dist/{arriraw-3GKCR6K2.js → arriraw-YIJ3BYNN.js} +0 -0
- /package/dist/{chunk-WHY3DVXS.js → chunk-D6YDLKSA.js} +0 -0
- /package/dist/{media_core_bg-YK63OUDM.js → media_core_bg-XRBVKQZH.js} +0 -0
- /package/dist/{prores-L4JZZWGH.js → prores-RIG37OIH.js} +0 -0
- /package/dist/{timeline_core_bg-2TYWZ35G.js → timeline_core_bg-JW42YM3G.js} +0 -0
- /package/dist/{udf_bg-A4WEMSAX.js → udf_bg-B37GKRIH.js} +0 -0
|
@@ -5,6 +5,108 @@
|
|
|
5
5
|
const { P, g, activeProject } = require("./ctx");
|
|
6
6
|
|
|
7
7
|
const verbs = {
|
|
8
|
+
// Which add / commit / lock arrangement lands a sequence marker on THIS Premiere (26.5.2 answered "Requires
|
|
9
|
+
// locked access" with the action made inside lockedAccess). Each variant adds one marker at its own frame
|
|
10
|
+
// (`frame` + i), reports the step that threw, then every marker it landed is removed again.
|
|
11
|
+
"debug.marker_probe": async ({ timeline, frame }) => {
|
|
12
|
+
const ppro = P.api();
|
|
13
|
+
const project = await activeProject();
|
|
14
|
+
const seq = timeline ? g(timeline, "seq") : await project.getActiveSequence();
|
|
15
|
+
const tb = Number(await seq.getTimebase());
|
|
16
|
+
const t = (f) => ppro.TickTime.createWithTicks(String(Math.round(f * tb)));
|
|
17
|
+
const type = (ppro.Marker && ppro.Marker.MARKER_TYPE_COMMENT) || "Comment";
|
|
18
|
+
const base = Number(frame || 300);
|
|
19
|
+
const out = {};
|
|
20
|
+
const run = (label, fn) => { try { const r = fn(); out[label] = { ok: true, ...(r && typeof r === "object" ? r : {}) }; } catch (e) { out[label] = { ok: false, error: String(e && e.message || e), stack: String(e && e.stack || "").split("\n").slice(0, 3).join(" | ") }; } };
|
|
21
|
+
let holder = await ppro.Markers.getMarkers(seq);
|
|
22
|
+
const mk = (i) => holder.createAddMarkerAction(`ct-probe-${i}`, type, t(base + i), t(1), "conform.tools lock probe");
|
|
23
|
+
// A: made + committed inside lockedAccess
|
|
24
|
+
run("A_inside_lock", () => { let err = null; project.lockedAccess(() => { try { const a = mk(0); project.executeTransaction((c) => c.addAction(a), "probe A"); } catch (e) { err = e; } }); if (err) throw err; });
|
|
25
|
+
// B: made inside the transaction callback, inside the lock
|
|
26
|
+
run("B_inside_transaction", () => { let err = null; project.lockedAccess(() => { try { project.executeTransaction((c) => c.addAction(mk(1)), "probe B"); } catch (e) { err = e; } }); if (err) throw err; });
|
|
27
|
+
// C: no lock at all
|
|
28
|
+
run("C_no_lock", () => { const a = mk(2); project.executeTransaction((c) => c.addAction(a), "probe C"); });
|
|
29
|
+
// D: made outside, committed inside the lock
|
|
30
|
+
run("D_made_outside", () => { const a = mk(3); let err = null; project.lockedAccess(() => { try { project.executeTransaction((c) => c.addAction(a), "probe D"); } catch (e) { err = e; } }); if (err) throw err; });
|
|
31
|
+
// E: no lock, made inside the transaction callback
|
|
32
|
+
run("E_txn_only", () => { project.executeTransaction((c) => c.addAction(mk(4)), "probe E"); });
|
|
33
|
+
// F: a fresh Markers object (fetched now), then A
|
|
34
|
+
holder = await ppro.Markers.getMarkers(seq);
|
|
35
|
+
run("F_fresh_holder", () => { let err = null; project.lockedAccess(() => { try { const a = mk(5); project.executeTransaction((c) => c.addAction(a), "probe F"); } catch (e) { err = e; } }); if (err) throw err; });
|
|
36
|
+
// what landed
|
|
37
|
+
holder = await ppro.Markers.getMarkers(seq);
|
|
38
|
+
let landed = [];
|
|
39
|
+
try { landed = holder.getMarkers().filter((m) => String(m.name || "").startsWith("ct-probe-")); } catch (e) { out.list_error = String(e.message || e); }
|
|
40
|
+
out.landed = landed.map((m) => m.name);
|
|
41
|
+
// clean up with whichever arrangement works for a remove
|
|
42
|
+
const removed = {};
|
|
43
|
+
for (const m of landed) {
|
|
44
|
+
for (const [label, fn] of [["inside_lock", () => { let err = null; project.lockedAccess(() => { try { const a = holder.createRemoveMarkerAction(m); project.executeTransaction((c) => c.addAction(a), "probe cleanup"); } catch (e) { err = e; } }); if (err) throw err; }],
|
|
45
|
+
["no_lock", () => { const a = holder.createRemoveMarkerAction(m); project.executeTransaction((c) => c.addAction(a), "probe cleanup"); }]]) {
|
|
46
|
+
try { fn(); removed[m.name] = label; break; } catch (e) { removed[m.name] = `failed: ${e.message || e}`; }
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
out.removed = removed;
|
|
50
|
+
return out;
|
|
51
|
+
},
|
|
52
|
+
// Which createInsertProjectItemAction / createOverwriteItemAction argument shapes THIS Premiere accepts: each is
|
|
53
|
+
// only CREATED under the lock (never committed), so nothing in the sequence changes. {timeline, clip, frame}
|
|
54
|
+
"debug.place_probe": async ({ timeline, clip, frame }) => {
|
|
55
|
+
const ppro = P.api();
|
|
56
|
+
const project = await activeProject();
|
|
57
|
+
const seq = g(timeline, "seq");
|
|
58
|
+
const raw = g(clip);
|
|
59
|
+
let cast = raw;
|
|
60
|
+
try { cast = ppro.ClipProjectItem.cast(raw) || raw; } catch (_) { /* raw */ }
|
|
61
|
+
const editor = await ppro.SequenceEditor.getEditor(seq);
|
|
62
|
+
const tb = Number(await seq.getTimebase());
|
|
63
|
+
const vCount = await seq.getVideoTrackCount();
|
|
64
|
+
const aCount = await seq.getAudioTrackCount();
|
|
65
|
+
const times = { ticktime: ppro.TickTime.createWithTicks(String(Math.round(Number(frame || 0) * tb))), seconds_tt: ppro.TickTime.createWithSeconds(Number(frame || 0) * tb / 254016000000) };
|
|
66
|
+
const out = { vCount, aCount, raw_type: String(raw && raw.type), insert: {}, overwrite: {} };
|
|
67
|
+
project.lockedAccess(() => {
|
|
68
|
+
for (const [iname, item] of [["raw", raw], ["cast", cast]]) {
|
|
69
|
+
for (const [tname, t] of Object.entries(times)) {
|
|
70
|
+
for (const v of [0, vCount - 1, vCount]) {
|
|
71
|
+
for (const a of [-1, 0, aCount - 1, aCount]) {
|
|
72
|
+
for (const lim of [true, false]) {
|
|
73
|
+
const key = `${iname}/${tname}/v${v}/a${a}/lim${lim}`;
|
|
74
|
+
try { const act = editor.createInsertProjectItemAction(item, t, v, a, lim); out.insert[key] = act ? "ok" : "null"; } catch (e) { out.insert[key] = String(e.message || e); }
|
|
75
|
+
}
|
|
76
|
+
const key = `${iname}/${tname}/v${v}/a${a}`;
|
|
77
|
+
try { const act = editor.createOverwriteItemAction(item, t, v, a); out.overwrite[key] = act ? "ok" : "null"; } catch (e) { out.overwrite[key] = String(e.message || e); }
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
return out;
|
|
84
|
+
},
|
|
85
|
+
// What a sequence's settings object holds and offers (for an in-place resize): members and current values of
|
|
86
|
+
// getSettings(), the frame size, and whether createSetSettingsAction exists. Read-only.
|
|
87
|
+
"debug.settings_probe": async ({ timeline }) => {
|
|
88
|
+
const seq = g(timeline, "seq");
|
|
89
|
+
const st = await seq.getSettings();
|
|
90
|
+
const out = { members: P.members(st), values: {}, frame: null, has_set: P.has(seq, "createSetSettingsAction") };
|
|
91
|
+
for (const m of out.members) {
|
|
92
|
+
if (!/^get/.test(m)) continue;
|
|
93
|
+
try { const v = await st[m](); out.values[m] = v && typeof v === "object" ? { str: String(v), members: P.members(v).filter((x) => !/^__|^(constructor|hasOwnProperty|isPrototypeOf|propertyIsEnumerable|toLocaleString|toString|valueOf)$/.test(x)).slice(0, 20), w: v.width, h: v.height, value: v.value } : v; } catch (e) { out.values[m] = `error: ${e.message || e}`; }
|
|
94
|
+
}
|
|
95
|
+
try { out.frame = await seq.getFrameSize(); out.frame = { w: out.frame.width, h: out.frame.height }; } catch (_) { /* none */ }
|
|
96
|
+
return out;
|
|
97
|
+
},
|
|
98
|
+
// ProjectConverter's OTIO export, signature probed like the XML one: does it write without a modal report?
|
|
99
|
+
"timeline_write.export_otio": async ({ project, timeline, path }) => {
|
|
100
|
+
const ppro = P.api();
|
|
101
|
+
const p = project ? g(project, "project") : await activeProject();
|
|
102
|
+
const seq = timeline ? g(timeline, "seq") : await p.getActiveSequence();
|
|
103
|
+
const conv = ppro.ProjectConverter;
|
|
104
|
+
const errors = [];
|
|
105
|
+
for (const [label, fn] of [["sequence,path", () => conv.exportAsOpenTimelineIO(seq, String(path))], ["project,path,sequence", () => conv.exportAsOpenTimelineIO(p, String(path), seq)], ["project,sequence,path", () => conv.exportAsOpenTimelineIO(p, seq, String(path))]]) {
|
|
106
|
+
try { const ok = await fn(); if (ok !== false && ok !== undefined) return { ok: true, how: label, errors, path: String(path) }; errors.push(`${label}: returned ${ok}`); } catch (e) { errors.push(`${label}: ${e.message || e}`); }
|
|
107
|
+
}
|
|
108
|
+
return { ok: false, how: "", errors, path: String(path) };
|
|
109
|
+
},
|
|
8
110
|
// Try every plausible createKeyframe / createSetValueAction shape on ONE
|
|
9
111
|
// Motion param of `item` (Scale), inside a real transaction, and report
|
|
10
112
|
// which builds and which raises - so the write path uses the form Premiere
|
|
@@ -9,12 +9,17 @@ const progress = { jobs: {} };
|
|
|
9
9
|
|
|
10
10
|
async function manager() {
|
|
11
11
|
const ppro = P.api();
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
const EM = ppro.EncoderManager;
|
|
13
|
+
if (!EM) throw new PeerError("api_missing", "EncoderManager is not in this Premiere");
|
|
14
|
+
const m = await P.callAny(EM, ["getManager"]);
|
|
15
|
+
const target = m && P.has(m, "addEventListener") ? m : P.has(EM, "addEventListener") ? EM : null;
|
|
16
|
+
if (target && manager._wired !== target) {
|
|
17
|
+
manager._wired = target;
|
|
18
|
+
// The DOM's events are EncoderManager's EVENT_RENDER_* constants (probe.json, 26.2); older builds used onEncode*.
|
|
19
|
+
const named = ["PROGRESS", "COMPLETE", "ERROR", "CANCEL", "QUEUE"].filter((k) => EM["EVENT_RENDER_" + k] !== undefined).map((k) => [k.toLowerCase(), EM["EVENT_RENDER_" + k]]);
|
|
20
|
+
const evs = named.length ? named : [["progress", "onEncodeProgress"], ["complete", "onEncodeComplete"], ["error", "onEncodeError"]];
|
|
21
|
+
for (const [label, ev] of evs) {
|
|
22
|
+
try { target.addEventListener(ev, (e) => { progress.jobs[String((e && e.jobId) || "last")] = { event: label, data: e && e.progress !== undefined ? e.progress : (e && e.status) }; }); } catch (_) { /* not this build */ }
|
|
18
23
|
}
|
|
19
24
|
}
|
|
20
25
|
return m;
|
|
@@ -27,8 +32,10 @@ const verbs = {
|
|
|
27
32
|
const ppro = P.api();
|
|
28
33
|
const seq = g(timeline, "seq");
|
|
29
34
|
const m = await manager();
|
|
30
|
-
|
|
31
|
-
const
|
|
35
|
+
// the export types are EncoderManager's own constants (EXPORT_QUEUE_TO_AME, EXPORT_IMMEDIATELY); Constants.ExportType on older builds
|
|
36
|
+
const EM = ppro.EncoderManager, types = ppro.Constants && ppro.Constants.ExportType ? ppro.Constants.ExportType : {};
|
|
37
|
+
const pick = (a, b, n) => (EM[a] !== undefined ? EM[a] : types[b] !== undefined ? types[b] : n);
|
|
38
|
+
const type = queue ? pick("EXPORT_QUEUE_TO_AME", "QUEUE_TO_AME", 1) : pick("EXPORT_IMMEDIATELY", "IMMEDIATELY", 0);
|
|
32
39
|
const job = await P.callAny(m, ["exportSequence"], seq, type, String(output_path), String(preset_path || ""));
|
|
33
40
|
return { ok: job !== false, job: job && typeof job === "object" ? String(job.jobId || job.id || "") : String(job || "") };
|
|
34
41
|
},
|
|
@@ -61,7 +61,7 @@ const verbs = {
|
|
|
61
61
|
if (!project) throw new PeerError("no_project", "No project open");
|
|
62
62
|
if (kind === "project") throw new PeerError("refused", "a project is renamed on disk, not here");
|
|
63
63
|
const n = await transact(project, `Rename to "${name}"`, async (add) => {
|
|
64
|
-
add(
|
|
64
|
+
add(() => P.callAnySync(obj, ["createSetNameAction"], String(name)));
|
|
65
65
|
});
|
|
66
66
|
return n > 0;
|
|
67
67
|
},
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
const { h, g, transact, activeProject, PeerError, P } = require("./ctx");
|
|
21
21
|
const S = { _sizingSetForm: null };
|
|
22
22
|
const T = require("./time");
|
|
23
|
+
const isThen = (x) => !!x && typeof x.then === "function";
|
|
23
24
|
|
|
24
25
|
const MOTION = { matchNames: ["AE.ADBE Motion", "ADBE Motion"], display: ["Motion"] };
|
|
25
26
|
const OPACITY = { matchNames: ["AE.ADBE Opacity", "ADBE Opacity"], display: ["Opacity"] };
|
|
@@ -171,6 +172,15 @@ async function readPose(item, raster) {
|
|
|
171
172
|
async function writePose(item, pose, raster, label) {
|
|
172
173
|
const project = await activeProject();
|
|
173
174
|
if (!project) throw new PeerError("no_project", "No project open");
|
|
175
|
+
const r = await poseActions(item, pose, raster);
|
|
176
|
+
const n = await transact(project, label || "conform.tools sizing", (add) => { for (const a of r.actions) add(a); });
|
|
177
|
+
return { actions: n, written: r.written, skipped: r.skipped };
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/** The actions that set `pose` on `item`, not committed: edit.apply adds them to its one transaction. */
|
|
181
|
+
async function poseActions(item, pose, raster) {
|
|
182
|
+
const actions = [];
|
|
183
|
+
const add = (a) => { if (a) actions.push(a); };
|
|
174
184
|
const w = raster && raster[0] ? raster[0] : 1920;
|
|
175
185
|
const hgt = raster && raster[1] ? raster[1] : 1080;
|
|
176
186
|
const chain = await chainOf(item);
|
|
@@ -180,7 +190,7 @@ async function writePose(item, pose, raster, label) {
|
|
|
180
190
|
const written = [];
|
|
181
191
|
const at = P.has(item, "getStartTime") ? await item.getStartTime() : undefined;
|
|
182
192
|
const raw = await readRaw(item);
|
|
183
|
-
|
|
193
|
+
await (async () => {
|
|
184
194
|
// MEASURED 26.2: createSetValueAction's exact signature is not documented
|
|
185
195
|
// and a wrong shape raises "Illegal Parameter type". Try the forms in
|
|
186
196
|
// order and remember the first that builds an action - a keyframe with
|
|
@@ -192,21 +202,25 @@ async function writePose(item, pose, raster, label) {
|
|
|
192
202
|
// commits. The keyframe is created INSIDE each try so a value shape
|
|
193
203
|
// createKeyframe rejects (a PointF, say) falls through instead of
|
|
194
204
|
// throwing before the loop. The first shape that builds is cached.
|
|
195
|
-
|
|
205
|
+
// A THUNK the transaction runs under project.lockedAccess (26.3+ makes every action there, synchronously).
|
|
206
|
+
// The first form that builds is cached for the rest of the pass.
|
|
207
|
+
const buildSetValue = (p, value) => () => {
|
|
196
208
|
const forms = [
|
|
197
|
-
["keyframe,updateUI",
|
|
198
|
-
["keyframe",
|
|
199
|
-
["value,updateUI",
|
|
200
|
-
["value",
|
|
209
|
+
["keyframe,updateUI", () => { const k = p.createKeyframe(value); return isThen(k) ? k.then((kf) => p.createSetValueAction(kf, true)) : p.createSetValueAction(k, true); }],
|
|
210
|
+
["keyframe", () => { const k = p.createKeyframe(value); return isThen(k) ? k.then((kf) => p.createSetValueAction(kf)) : p.createSetValueAction(k); }],
|
|
211
|
+
["value,updateUI", () => p.createSetValueAction(value, true)],
|
|
212
|
+
["value", () => p.createSetValueAction(value)],
|
|
201
213
|
].filter(([name]) => P.has(p, "createKeyframe") || !name.startsWith("keyframe"));
|
|
202
214
|
const only = forms.filter(([name]) => !S._sizingSetForm || name === S._sizingSetForm);
|
|
203
215
|
const errors = [];
|
|
204
216
|
for (const [name, make] of (only.length ? only : forms)) {
|
|
205
|
-
try { const a =
|
|
217
|
+
try { const a = make(); if (a) { S._sizingSetForm = name; return a; } } catch (e) { errors.push(`${name}: ${e.message || e}`); }
|
|
206
218
|
}
|
|
207
219
|
throw new PeerError("set_value_failed", `createSetValueAction: ${errors.join("; ")}`);
|
|
208
220
|
};
|
|
209
221
|
const setValueAction = (p, value) => buildSetValue(p, value);
|
|
222
|
+
// the key counts as written once its action is made (under the lock, at commit); a refusal names it
|
|
223
|
+
const guard = (thunk, key) => { written.push(key); return () => { try { return thunk(); } catch (e) { written.splice(written.indexOf(key), 1); skipped.push(`${key} (${e.message || e})`); return null; } }; };
|
|
210
224
|
// One param failing does not abort the pose: the ones that write, write,
|
|
211
225
|
// and the rest are named. (MEASURED 26.2: scalar Motion params - Scale,
|
|
212
226
|
// Rotation, Opacity - write through the keyframe form; the two-axis
|
|
@@ -218,17 +232,17 @@ async function writePose(item, pose, raster, label) {
|
|
|
218
232
|
const p = await findParam(motion, spec);
|
|
219
233
|
if (!p) return;
|
|
220
234
|
if (await isVarying(p)) { skipped.push(key); return; }
|
|
221
|
-
|
|
222
|
-
catch (e) { skipped.push(`${key} (${e.message || e})`); }
|
|
235
|
+
add(guard(setValueAction(p, value), key));
|
|
223
236
|
};
|
|
224
237
|
const setPoint = async (spec, x, y, key) => {
|
|
225
238
|
const p = await findParam(motion, spec);
|
|
226
239
|
if (!p) return;
|
|
227
240
|
if (await isVarying(p)) { skipped.push(key); return; }
|
|
228
241
|
const ppro = P.api();
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
242
|
+
// 26.5 documents `new PointF(x, y)`; 26.2 had neither shape working (PointF.create, a plain {x, y})
|
|
243
|
+
let point = { x, y };
|
|
244
|
+
try { point = typeof ppro.PointF === "function" ? new ppro.PointF(x, y) : P.has(ppro.PointF, "create") ? ppro.PointF.create(x, y) : point; } catch (_) { try { point = ppro.PointF.create(x, y); } catch (_e) { /* plain */ } }
|
|
245
|
+
add(guard(setValueAction(p, point), key));
|
|
232
246
|
};
|
|
233
247
|
if (pose.Pan !== undefined || pose.Tilt !== undefined) {
|
|
234
248
|
const x = 0.5 + Number(pose.Pan !== undefined ? pose.Pan : (raw.position.x - 0.5) * w) / w;
|
|
@@ -259,14 +273,13 @@ async function writePose(item, pose, raster, label) {
|
|
|
259
273
|
if (p) {
|
|
260
274
|
if (await isVarying(p)) skipped.push("Opacity");
|
|
261
275
|
else {
|
|
262
|
-
|
|
263
|
-
catch (e) { skipped.push(`Opacity (${e.message || e})`); }
|
|
276
|
+
add(guard(buildSetValue(p, Number(pose.Opacity)), "Opacity"));
|
|
264
277
|
}
|
|
265
278
|
}
|
|
266
279
|
}
|
|
267
280
|
if (pose.FlipX || pose.FlipY) skipped.push("Flip (Premiere's Motion has no flip; use a Transform effect)");
|
|
268
|
-
});
|
|
269
|
-
return { actions
|
|
281
|
+
})();
|
|
282
|
+
return { actions, written, skipped };
|
|
270
283
|
}
|
|
271
284
|
|
|
272
285
|
async function rasterOfItemSeq() {
|
|
@@ -309,4 +322,4 @@ const verbs = {
|
|
|
309
322
|
"sizing.raw": async ({ item }) => readRaw(g(item, "item")),
|
|
310
323
|
};
|
|
311
324
|
|
|
312
|
-
module.exports = { verbs, readRaw, toNeutral, readPose, writePose, readSizingForModel, MOTION_PARAMS, OPACITY_PARAMS, findComponent, findParam, h };
|
|
325
|
+
module.exports = { verbs, readRaw, toNeutral, readPose, writePose, poseActions, readSizingForModel, MOTION_PARAMS, OPACITY_PARAMS, findComponent, findParam, h };
|
|
@@ -36,8 +36,14 @@ function framesToTicks(frames, timebase) {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
/** Timebase for common rates when only fps is known (tests, model_from fps). */
|
|
39
|
+
// MEASURED 26.5.2: Premiere reports a DJI clip's rate as its measured 29.970089…, not 30000/1001; ticks per frame
|
|
40
|
+
// from that put a source in-point just short of its frame, which Premiere floors — every cut-in landed 1 frame
|
|
41
|
+
// early. A rate within 0.01 % of a standard one is that standard rate, with Premiere's exact ticks per frame.
|
|
42
|
+
const STANDARD = [[24000, 1001], [24, 1], [25, 1], [30000, 1001], [30, 1], [48000, 1001], [48, 1], [50, 1], [60000, 1001], [60, 1], [120000, 1001], [120, 1]];
|
|
39
43
|
function timebaseFromFps(fps) {
|
|
40
|
-
|
|
44
|
+
const f = Number(fps);
|
|
45
|
+
for (const [n, d] of STANDARD) if (Math.abs(f - n / d) < (n / d) * 1e-4) return Math.round(TICKS_PER_SECOND * d / n);
|
|
46
|
+
return Math.round(TICKS_PER_SECOND / f);
|
|
41
47
|
}
|
|
42
48
|
|
|
43
49
|
/** HH:MM:SS:FF (or ; for drop-frame) from a frame count at `fps`. Drop-frame
|
|
@@ -71,8 +71,8 @@ async function sourceStartFrames(projectItem, fps) {
|
|
|
71
71
|
const media = await projectItem.getMedia();
|
|
72
72
|
if (media && P.has(media, "getStart")) {
|
|
73
73
|
const st = await media.getStart();
|
|
74
|
-
|
|
75
|
-
if (
|
|
74
|
+
// a media start of 0 is a real start (00:00:00:00, every DJI clip), not a missing one
|
|
75
|
+
if (st !== undefined && st !== null) return Math.round(T.toTicks(st) / (T.TICKS_PER_SECOND / fps));
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
} catch (_) { /* fall through */ }
|
|
@@ -11,10 +11,11 @@ const VERBS = Object.assign({},
|
|
|
11
11
|
require("./write").verbs,
|
|
12
12
|
require("./render").verbs,
|
|
13
13
|
require("./probe").verbs,
|
|
14
|
+
require("./edit").verbs,
|
|
14
15
|
);
|
|
15
16
|
|
|
16
|
-
const CAPABILITIES = ["session", "timeline_read", "markers", "clip_meta", "sizing", "timeline_write", "render"];
|
|
17
|
+
const CAPABILITIES = ["session", "timeline_read", "markers", "clip_meta", "sizing", "timeline_write", "render", "edit"];
|
|
17
18
|
const OPTIONAL_VERBS = ["timeline_read.set_current_frame", "markers.move", "markers.set_color", "markers.set_text", "clip_meta.set_clip_properties",
|
|
18
|
-
"timeline_write.import_file", "timeline_write.export_xml", "render.export_sequence", "debug.probe", "debug.sizing_probe"];
|
|
19
|
+
"timeline_write.import_file", "timeline_write.export_xml", "render.export_sequence", "debug.probe", "debug.sizing_probe", "debug.marker_probe", "debug.place_probe", "debug.settings_probe", "timeline_write.export_otio"];
|
|
19
20
|
|
|
20
21
|
module.exports = { VERBS, CAPABILITIES, OPTIONAL_VERBS };
|
|
@@ -56,8 +56,8 @@ const verbs = {
|
|
|
56
56
|
const editor = await P.callAny(ppro.SequenceEditor, ["getEditor"], seq);
|
|
57
57
|
const vIdx = Math.max(0, Number(track || 1) - 1);
|
|
58
58
|
const n = await transact(project, mode === "insert" ? "Insert clip" : "Overwrite clip", async (add) => {
|
|
59
|
-
if (mode === "insert") add(
|
|
60
|
-
else add(
|
|
59
|
+
if (mode === "insert") add(() => P.callAnySync(editor, ["createInsertProjectItemAction"], item, tt, vIdx, 0, false));
|
|
60
|
+
else add(() => P.callAnySync(editor, ["createOverwriteItemAction"], item, tt, vIdx, 0));
|
|
61
61
|
});
|
|
62
62
|
return n > 0;
|
|
63
63
|
},
|
|
@@ -68,7 +68,7 @@ const verbs = {
|
|
|
68
68
|
const editor = await P.callAny(ppro.SequenceEditor, ["getEditor"], seq);
|
|
69
69
|
const objs = (items || []).map((x) => g(x, "item"));
|
|
70
70
|
const mt = ppro.Constants && ppro.Constants.MediaType ? ppro.Constants.MediaType.VIDEO : 0;
|
|
71
|
-
const n = await transact(project, "Remove clips", async (add) => { add(
|
|
71
|
+
const n = await transact(project, "Remove clips", async (add) => { add(() => P.callAnySync(editor, ["createRemoveItemsAction"], objs, !!ripple, mt)); });
|
|
72
72
|
return n > 0;
|
|
73
73
|
},
|
|
74
74
|
"timeline_write.export_xml": async ({ project, timeline, path }) => {
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
+
import{d as h}from"./chunk-TXQR2HI2.js";import{D as d,Y as o,b as p,g as n,i as a,l as u,r as s}from"./chunk-PLRB2YXJ.js";import"./chunk-PSANHDZM.js";import{dirname as m}from"node:path";import{fileURLToPath as P}from"node:url";import w from"node:process";var r="ColorMatchProbe.ofx.bundle",x="http://127.0.0.1:9876",i="/Library/OFX/Plugins";async function b(){let e=w.execPath;for(let t of[p("CONFORM_RESOLVE_PROBE"),o(m(e),"..","Resources","resolve-probe",r),o(m(P(import.meta.url)),"..","..","..","resolve_hook","build",r)])if(t&&await s(o(t,"Contents","MacOS","ColorMatchProbe.ofx")))return t;return null}async function E(){let e=n()==="darwin"&&a()==="arm64",t=await s(o(i,r)),l=await fetch(x+"/",{signal:AbortSignal.timeout(500)}).then(f=>f.ok).catch(()=>!1),c=!!await b();return{installed:t,loaded:l,shipped:c,supported:e,next:e?l?"running: the Color page selection and the selected node are read live":t?"installed; restart Resolve to load it":c?"host_setup host=resolve action=install_probe (asks for an administrator), then restart Resolve":"not in this build":"the probe runs on Apple silicon Macs only"}}async function S(){if(n()!=="darwin"||a()!=="arm64")throw new Error("the probe runs on Apple silicon Macs only");let e=await b();if(!e)throw new Error("this build does not carry the probe (resolve_hook/build.sh makes it)");return await h("darwin",e,i,r),await d(o(u(),"Library","Application Support","Blackmagic Design","DaVinci Resolve","OFXPluginCacheV2.xml")).catch(()=>{}),{path:o(i,r),restart_required:!0}}export{r as PROBE_BUNDLE,x as PROBE_URL,S as installProbe,E as probeStatus};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
+
import{c as l}from"./chunk-XNR7M4VX.js";import{Aa as F,Fa as O,G as _,Ga as f,H as S,I as P,ia as b,ja as R,wa as w,za as v}from"./chunk-C5IX63YF.js";import"./chunk-PSANHDZM.js";var g=class{constructor(e=[]){this.ranges=[];for(let[r,n]of e)this.add(r,n)}add(e,r){if(r<=e)return;let n=[],[s,o]=[e,r];for(let[i,a]of this.ranges)a<s||i>o?n.push([i,a]):(s=Math.min(s,i),o=Math.max(o,a));n.push([s,o]),n.sort((i,a)=>i[0]-a[0]),this.ranges=n}has(e,r){return r<=e?!0:this.ranges.some(([n,s])=>n<=e&&s>=r)}missing(e,r){if(r<=e)return[];let n=[],s=e;for(let[o,i]of this.ranges)if(!(i<=s)&&(o>=r||(o>s&&n.push([s,Math.min(o,r)]),s=Math.max(s,i),s>=r)))break;return s<r&&n.push([s,r]),n}count(){return this.ranges.reduce((e,[r,n])=>e+(n-r),0)}toJSON(){return this.ranges.map(([e,r])=>[e,r])}};function U(t,e){let r=new g;for(let n of t){if(n.kind!=="clip"||!n.source_range)continue;let s=n.source_range.start.value,o=n.source_range.duration.value,i=Math.max(0,Math.max(0,Math.floor(s))-e),a=Math.floor(s+o)+e;a>i&&r.add(i,a)}return r.toJSON()}function J(t,e,r){let n=U(e,r),s=a=>n.some(([c,u])=>a>=c&&a<u),o=new Map,i=a=>{let c=o.get(a);return c||(c={part:a,structuralRanges:[],essenceRanges:[]},o.set(a,c)),c};for(let a of t.segments){let c=a.part??0;a.kind==="structural"?i(c).structuralRanges.push({offset:a.offset,length:a.length}):(a.kind==="frame"||a.kind==="gop")&&a.frame_in!=null&&s(a.frame_in)&&i(c).essenceRanges.push({offset:a.offset,length:a.length})}return[...o.values()].sort((a,c)=>a.part-c.part)}async function A(t,e){if(!O)return null;try{let n=await(await import("./r3d-ZDJ3WURS.js")).decodeR3dRgbaGpu(t,e);return n?{width:n.width,height:n.height,rgba:n.rgba}:null}catch{return null}}function p(t){return(e,r,n)=>t.parts[e].read(r,n)}function d(t){return JSON.stringify(t.parts.map(e=>({name:e.filename,size:e.fileSize})))}function L(t,e){let r=[];for(let n of t){if(n.kind!=="clip"||!n.source_range)continue;let s=n.source_range.start.value,o=n.source_range.duration.value;r.push({frame_in:Math.max(0,Math.floor(s)),frame_out:Math.floor(s+o),handles:e})}return JSON.stringify(r)}var k=16,h=new WeakMap,D=new WeakMap;function x(t){let e=D.get(t);return e||(e=t.parts[0].read(0,Math.min(16*1024,t.parts[0].fileSize)),D.set(t,e)),e}async function N(t){let e=h.get(t);return e||(await f(),e=JSON.parse(await b(p(t),d(t))),h.set(t,e)),e}async function G(t){await f();let e=await b(p(t),d(t));return h.set(t,JSON.parse(e)),e}function B(t,e){h.set(t,JSON.parse(e))}async function C(t,e){let r=JSON.parse(await R(p(t),d(t)));return{v:1,container:"r3d",codec:"redcode",frame_count:e.frame_count,granularity:"frame",...t.parts.length>1?{part_names:t.parts.map(n=>n.filename.split(/[/\\]/).pop()??n.filename)}:{},segments:r}}var V={async inspect(t){await f();let e=await w(p(t),d(t)),r=JSON.parse(e);if(!r||r.frame_count===0)return null;let n=t.parts[0],s=r.timecode??null,o=s&&s.fps_denominator>0?s.fps_numerator/s.fps_denominator:null,i=r.width??null,a=r.height??null;return{id:n.filename,kind:"external",target_url:n.filename,available_range:o&&r.frame_count?{start:{value:0,rate:o},duration:{value:r.frame_count,rate:o}}:null,reel_name:r.reel??null,source_timecode:s?.display??null,source_fps:o,source_resolution_w:i,source_resolution_h:a,container:"r3d",codec:"redcode",size_bytes:r.file_size,streams:[{kind:"video",codec:"redcode",width:i??void 0,height:a??void 0,rate:o??void 0,bit_depth:k,codec_specific:{fourcc:r.codec_fourcc??"REDCODE"}}],decode_provenance:r.decode_provenance??null,vendor_metadata:{frame_count:r.frame_count,...s?{drop_frame:s.drop_frame}:{}},binding_state:"unbound",raw_extraction:{r3d_probe:r},metadata:{}}},async extract(t){await f();let e=JSON.parse(await w(p(t),d(t)));return!e||e.frame_count===0?null:C(t,e)},async sparsify(t,e){await f();let r=JSON.parse(await R(p(t),d(t))),n={v:1,container:"r3d",codec:"redcode",frame_count:r.filter(o=>o.kind==="frame").length,granularity:"frame",segments:r},s=new Map;for(let o of r)o.kind==="frame"&&s.set(o.part??0,(s.get(o.part??0)??0)+1);return J(n,e.items,e.handles).map(o=>({filename:t.parts[o.part].filename,fileSize:t.parts[o.part].fileSize,structuralRanges:o.structuralRanges,essenceRanges:o.essenceRanges,frameCount:s.get(o.part)??0,keptFrames:o.essenceRanges.length}))},async trim(t,e){await f();let r=t.parts.some(a=>a.dataRanges!==void 0),n=r?JSON.stringify(t.parts.map(a=>a.dataRanges??[])):"[]",s=r?"[]":L(e.items,e.handles),o=await F(p(t),d(t),s,n);return JSON.parse(o).parts.map(a=>a.trim_plan)},async decode(t,e,r){await f();let n=await N(t);if(e<0||e>=n.length)throw new l(e,n.length);let s=n[e],o=s.part??0,i=t.parts[o];if(!i)throw new l(e,n.length);let a=await i.read(s.essenceOffset,s.essenceLength),c=2,u=await x(t),m;if(r.detail==="coarse")m=_(a,u,0);else if(v(a))m=_(a,u,c);else{let y=await A(a,u);if(y)return y;m=P(a,u)}let M=new DataView(m.buffer,m.byteOffset,8);return{width:M.getUint32(0,!0),height:M.getUint32(4,!0),rgba:m.slice(8)}},async decode16(t,e){await f();let r=await N(t);if(e<0||e>=r.length)throw new l(e,r.length);let n=r[e],s=t.parts[n.part??0];if(!s)throw new l(e,r.length);let o=await s.read(n.essenceOffset,n.essenceLength),i=S(o),a=new DataView(i.buffer,i.byteOffset,8),c=a.getUint32(0,!0),u=a.getUint32(4,!0),m=i.slice(8);return{width:c,height:u,rgb16:new Uint16Array(m.buffer,m.byteOffset,c*u*3)}}};export{G as listR3dFramesJson,V as r3dFormat,B as seedR3dFramesJson};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __conformRequire } from 'node:module'; const require = __conformRequire(import.meta.url);
|
|
3
|
-
import{a as e1}from"./chunk-7D7H6VFW.js";import{Ca as r1,sa as n1}from"./chunk-CL26XMDO.js";import"./chunk-PSANHDZM.js";var t1=new Uint32Array([327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,458759,458759,458759,458759,458759,458759,458759,458759,524296,524296,524296,524296,589839,589839,655376,655377,393227,393227,393227,393227,393227,393227,393227,393227,393227,393227,393227,393227,393227,393227,393227,393227,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,458764,458764,458764,458764,458764,458764,458764,458764,458766,458766,458766,458766,458766,458766,458766,458766,393229,393229,393229,393229,393229,393229,393229,393229,393229,393229,393229,393229,393229,393229,393229,393229,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154]),a1=new Uint32Array([393223,393224,327686,327686,262149,262149,262149,262149,196609,196609,196609,196609,196609,196609,196609,196609,262146,262146,262146,262146,262147,262147,262147,262147,196612,196612,196612,196612,196612,196612,196612,196612,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536]),i1=new Uint32Array([131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,196610,196610,196610,196610,196610,196610,196610,196610,196611,196611,196611,196611,196611,196611,196611,196611,196612,196612,196612,196612,196612,196612,196612,196612,262149,262149,262149,262149,262150,262150,262150,262150,131073,131073,131073,131073,131073,131073,131073,131073,131073,131073,131073,131073,131073,131073,131073,131073]),u1=new Uint32Array([0,1,5,6,14,15,27,28,44,45,65,66,90,91,119,120,2,4,7,13,16,26,29,43,46,64,67,89,92,118,121,150,3,8,12,17,25,30,42,47,63,68,88,93,117,122,149,151,9,11,18,24,31,41,48,62,69,87,94,116,123,148,152,177,10,19,23,32,40,49,61,70,86,95,115,124,147,153,176,178,20,22,33,39,50,60,71,85,96,114,125,146,154,175,179,200,21,34,38,51,59,72,84,97,113,126,145,155,174,180,199,201,35,37,52,58,73,83,98,112,127,144,156,173,181,198,202,219,36,53,57,74,82,99,111,128,143,157,172,182,197,203,218,220,54,56,75,81,100,110,129,142,158,171,183,196,204,217,221,234,55,76,80,101,109,130,141,159,170,184,195,205,216,222,233,235,77,79,102,108,131,140,160,169,185,194,206,215,223,232,236,245,78,103,107,132,139,161,168,186,193,207,214,224,231,237,244,246,104,106,133,138,162,167,187,192,208,213,225,230,238,243,247,252,105,134,137,163,166,188,191,209,212,226,229,239,242,248,251,253,135,136,164,165,189,190,210,211,227,228,240,241,249,250,254,255]),z=new Int32Array([2048,2882,2841,2772,2676,2554,2408,2239,2048,1837,1609,1365,1108,841,565,284,2048,2772,2408,1837,1108,284,-565,-1365,-2048,-2554,-2841,-2882,-2676,-2239,-1609,-841,2048,2554,1609,284,-1108,-2239,-2841,-2772,-2048,-841,565,1837,2676,2882,2408,1365,2048,2239,565,-1365,-2676,-2772,-1609,284,2048,2882,2408,841,-1108,-2554,-2841,-1837,2048,1837,-565,-2554,-2676,-841,1609,2882,2048,-284,-2408,-2772,-1108,1365,2841,2239,2048,1365,-1609,-2882,-1108,1837,2841,841,-2048,-2772,-565,2239,2676,284,-2408,-2554,2048,841,-2408,-2239,1108,2882,565,-2554,-2048,1365,2841,284,-2676,-1837,1609,2772,2048,284,-2841,-841,2676,1365,-2408,-1837,2048,2239,-1609,-2554,1108,2772,-565,-2882,2048,-284,-2841,841,2676,-1365,-2408,1837,2048,-2239,-1609,2554,1108,-2772,-565,2882,2048,-841,-2408,2239,1108,-2882,565,2554,-2048,-1365,2841,-284,-2676,1837,1609,-2772,2048,-1365,-1609,2882,-1108,-1837,2841,-841,-2048,2772,-565,-2239,2676,-284,-2408,2554,2048,-1837,-565,2554,-2676,841,1609,-2882,2048,284,-2408,2772,-1108,-1365,2841,-2239,2048,-2239,565,1365,-2676,2772,-1609,-284,2048,-2882,2408,-841,-1108,2554,-2841,1837,2048,-2554,1609,-284,-1108,2239,-2841,2772,-2048,841,565,-1837,2676,-2882,2408,-1365,2048,-2772,2408,-1837,1108,-284,-565,1365,-2048,2554,-2841,2882,-2676,2239,-1609,841,2048,-2882,2841,-2772,2676,-2554,2408,-2239,2048,-1837,1609,-1365,1108,-841,565,-284]),s1={m16:931135616,lg_a:1098061119,lg_b:1125906863,lg_c:1046850094,lg_pa:1008981770,gc_k:1064554302,gc_p:1101529087,gc_t:1028443341,sd_eps:953267991,inv273:997199617,rr_c13:956301440,rr_c16:931135616,rr_c18:914358400,bil_sg:973078528,bil_srb:975874731,sobel_sc:931135616,bil_t7_0:1032826803,bil_t7_1:1040595071,bil_t7_2:1044597305,bil_t7_3:1046301409,bil_t7_4:1044597305,bil_t7_5:1040595071,bil_t7_6:1032826803,bil_t9_0:1031861895,bil_t9_1:1035879338,bil_t9_2:1039871874,bil_t9_3:1041522383,bil_t9_4:1042077871,bil_t9_5:1041522383,bil_t9_6:1039871874,bil_t9_7:1035879338,bil_t9_8:1031861895,gauss55_00:1065353216,gauss55_01:1082130432,gauss55_02:1088421888,gauss55_03:1082130432,gauss55_04:1065353216,gauss55_10:1082130432,gauss55_11:1098907648,gauss55_12:1104150528,gauss55_13:1098907648,gauss55_14:1082130432,gauss55_20:1088421888,gauss55_21:1104150528,gauss55_22:1109655552,gauss55_23:1104150528,gauss55_24:1088421888,gauss55_30:1082130432,gauss55_31:1098907648,gauss55_32:1104150528,gauss55_33:1098907648,gauss55_34:1082130432,gauss55_40:1065353216,gauss55_41:1082130432,gauss55_42:1088421888,gauss55_43:1082130432,gauss55_44:1065353216};function E(n,r){return(n[r]<<24|n[r+1]<<16|n[r+2]<<8|n[r+3])>>>0}function w(n,r){return n[r]<<8|n[r+1]}function q(n){let r=Math.min(n.length,65536),e=-1;for(let u=16;u+6<=r;u+=2){if(w(n,u)!==259)continue;let g=w(n,u+2),p=w(n,u+4);if(g<256||g>8192||p<128||p>8192)continue;let y=u-16;if(E(n,y+4)!==0||E(n,y+8)!==0)continue;let P=E(n,y);if(!(P<65536||y+P>n.length+8192)){e=y;break}}if(e<0)throw new Error("RED codestream container not found");let i=e,t=i+12,a=[];for(let u=0;u<8;u++)a.push(w(n,t+4+2*u));let o=i+28;if(o+512>n.length)throw new Error("R3D container table truncated");let b=a[1],m=a[2],f=i+540,v=v1(n,f,a[4],b);if(b%2!==0)throw new Error(`odd R3D canvas width ${b}`);return{canvasW:b,canvasH:m,rawFields:a,table512:n.subarray(o,o+512),streamOff:f,segments:v}}function v1(n,r,e,i){let t=Math.ceil(i/128),a=r;for(;(w(n,a)&4095)<256;)if(a+=2,a+2>n.length)throw new Error("R3D segment stream truncated");a+=1;let o=a,b=n[a-1],m=[];for(let f=0;f<e;f++){if(o+8>n.length)throw new Error("R3D segment header past essence end");let v=[w(n,o),w(n,o+2),w(n,o+4),w(n,o+6)],u=v.map(h=>h+7>>3),g=o+8,p=u[0]+u[1]+u[2]+u[3];if(g+p>n.length)throw new Error("R3D segment body past essence end");let y=g,P=v.map((h,x)=>{let C={off:y,bitLength:h,byteLength:u[x]};return y+=u[x],C});m.push({x:f%t*128,y:Math.floor(f/t)*16,quant:b,subbands:P}),b=n[g+p]??0,o=g+p+1}return m}function o1(n){let r=new Uint32Array(n.segments.length*4*8),e=0;for(let i of n.segments)for(let t=0;t<4;t++){let a=i.subbands[t];r[e]=a.off,r[e+1]=a.bitLength,r[e+2]=a.byteLength,r[e+3]=i.x,r[e+4]=i.y,r[e+5]=i.quant,r[e+6]=t,r[e+7]=0,e+=8}return r}function k(n){return x1[0]=n>>>0,h1[0]}var c1=new ArrayBuffer(4),x1=new Uint32Array(c1),h1=new Float32Array(c1),w1=1112556626;function B1(n){if(n.length<140)return null;let r=new DataView(n.buffer,n.byteOffset,n.byteLength);if(r.getUint32(0,!0)!==w1||r.getUint32(4,!0)!==1)return null;let e=r.getUint32(8,!0),i=12,t=[];for(let f=0;f<4;f++,i+=4)t.push(r.getUint32(i,!0));let a=[];for(let f=0;f<26;f++,i+=4)a.push(r.getUint32(i,!0));let o=r.getUint32(i,!0);i+=4;let b=r.getUint32(i,!0);if(i+=4,i+b>n.length)return null;let m=new TextDecoder().decode(n.subarray(i,i+b));return{wbBits:t,smatrixBits:a,exposureBits:o,fixFlashers:(e&2)!==0,model:m}}async function M(n){try{return await r1(),B1(n1(n??new Uint8Array(0)))}catch{return null}}var l1=`// R3D KOMODO entropy decode (kernel 1 of 2). One invocation per (segment, subband) job.
|
|
3
|
+
import{a as e1}from"./chunk-7D7H6VFW.js";import{Ga as r1,xa as n1}from"./chunk-C5IX63YF.js";import"./chunk-PSANHDZM.js";var t1=new Uint32Array([327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,327683,458759,458759,458759,458759,458759,458759,458759,458759,524296,524296,524296,524296,589839,589839,655376,655377,393227,393227,393227,393227,393227,393227,393227,393227,393227,393227,393227,393227,393227,393227,393227,393227,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262148,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,262146,458764,458764,458764,458764,458764,458764,458764,458764,458766,458766,458766,458766,458766,458766,458766,458766,393229,393229,393229,393229,393229,393229,393229,393229,393229,393229,393229,393229,393229,393229,393229,393229,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,327686,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,131081,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,196609,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262149,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154,262154]),a1=new Uint32Array([393223,393224,327686,327686,262149,262149,262149,262149,196609,196609,196609,196609,196609,196609,196609,196609,262146,262146,262146,262146,262147,262147,262147,262147,196612,196612,196612,196612,196612,196612,196612,196612,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536,65536]),i1=new Uint32Array([131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,131072,196610,196610,196610,196610,196610,196610,196610,196610,196611,196611,196611,196611,196611,196611,196611,196611,196612,196612,196612,196612,196612,196612,196612,196612,262149,262149,262149,262149,262150,262150,262150,262150,131073,131073,131073,131073,131073,131073,131073,131073,131073,131073,131073,131073,131073,131073,131073,131073]),u1=new Uint32Array([0,1,5,6,14,15,27,28,44,45,65,66,90,91,119,120,2,4,7,13,16,26,29,43,46,64,67,89,92,118,121,150,3,8,12,17,25,30,42,47,63,68,88,93,117,122,149,151,9,11,18,24,31,41,48,62,69,87,94,116,123,148,152,177,10,19,23,32,40,49,61,70,86,95,115,124,147,153,176,178,20,22,33,39,50,60,71,85,96,114,125,146,154,175,179,200,21,34,38,51,59,72,84,97,113,126,145,155,174,180,199,201,35,37,52,58,73,83,98,112,127,144,156,173,181,198,202,219,36,53,57,74,82,99,111,128,143,157,172,182,197,203,218,220,54,56,75,81,100,110,129,142,158,171,183,196,204,217,221,234,55,76,80,101,109,130,141,159,170,184,195,205,216,222,233,235,77,79,102,108,131,140,160,169,185,194,206,215,223,232,236,245,78,103,107,132,139,161,168,186,193,207,214,224,231,237,244,246,104,106,133,138,162,167,187,192,208,213,225,230,238,243,247,252,105,134,137,163,166,188,191,209,212,226,229,239,242,248,251,253,135,136,164,165,189,190,210,211,227,228,240,241,249,250,254,255]),z=new Int32Array([2048,2882,2841,2772,2676,2554,2408,2239,2048,1837,1609,1365,1108,841,565,284,2048,2772,2408,1837,1108,284,-565,-1365,-2048,-2554,-2841,-2882,-2676,-2239,-1609,-841,2048,2554,1609,284,-1108,-2239,-2841,-2772,-2048,-841,565,1837,2676,2882,2408,1365,2048,2239,565,-1365,-2676,-2772,-1609,284,2048,2882,2408,841,-1108,-2554,-2841,-1837,2048,1837,-565,-2554,-2676,-841,1609,2882,2048,-284,-2408,-2772,-1108,1365,2841,2239,2048,1365,-1609,-2882,-1108,1837,2841,841,-2048,-2772,-565,2239,2676,284,-2408,-2554,2048,841,-2408,-2239,1108,2882,565,-2554,-2048,1365,2841,284,-2676,-1837,1609,2772,2048,284,-2841,-841,2676,1365,-2408,-1837,2048,2239,-1609,-2554,1108,2772,-565,-2882,2048,-284,-2841,841,2676,-1365,-2408,1837,2048,-2239,-1609,2554,1108,-2772,-565,2882,2048,-841,-2408,2239,1108,-2882,565,2554,-2048,-1365,2841,-284,-2676,1837,1609,-2772,2048,-1365,-1609,2882,-1108,-1837,2841,-841,-2048,2772,-565,-2239,2676,-284,-2408,2554,2048,-1837,-565,2554,-2676,841,1609,-2882,2048,284,-2408,2772,-1108,-1365,2841,-2239,2048,-2239,565,1365,-2676,2772,-1609,-284,2048,-2882,2408,-841,-1108,2554,-2841,1837,2048,-2554,1609,-284,-1108,2239,-2841,2772,-2048,841,565,-1837,2676,-2882,2408,-1365,2048,-2772,2408,-1837,1108,-284,-565,1365,-2048,2554,-2841,2882,-2676,2239,-1609,841,2048,-2882,2841,-2772,2676,-2554,2408,-2239,2048,-1837,1609,-1365,1108,-841,565,-284]),s1={m16:931135616,lg_a:1098061119,lg_b:1125906863,lg_c:1046850094,lg_pa:1008981770,gc_k:1064554302,gc_p:1101529087,gc_t:1028443341,sd_eps:953267991,inv273:997199617,rr_c13:956301440,rr_c16:931135616,rr_c18:914358400,bil_sg:973078528,bil_srb:975874731,sobel_sc:931135616,bil_t7_0:1032826803,bil_t7_1:1040595071,bil_t7_2:1044597305,bil_t7_3:1046301409,bil_t7_4:1044597305,bil_t7_5:1040595071,bil_t7_6:1032826803,bil_t9_0:1031861895,bil_t9_1:1035879338,bil_t9_2:1039871874,bil_t9_3:1041522383,bil_t9_4:1042077871,bil_t9_5:1041522383,bil_t9_6:1039871874,bil_t9_7:1035879338,bil_t9_8:1031861895,gauss55_00:1065353216,gauss55_01:1082130432,gauss55_02:1088421888,gauss55_03:1082130432,gauss55_04:1065353216,gauss55_10:1082130432,gauss55_11:1098907648,gauss55_12:1104150528,gauss55_13:1098907648,gauss55_14:1082130432,gauss55_20:1088421888,gauss55_21:1104150528,gauss55_22:1109655552,gauss55_23:1104150528,gauss55_24:1088421888,gauss55_30:1082130432,gauss55_31:1098907648,gauss55_32:1104150528,gauss55_33:1098907648,gauss55_34:1082130432,gauss55_40:1065353216,gauss55_41:1082130432,gauss55_42:1088421888,gauss55_43:1082130432,gauss55_44:1065353216};function E(n,r){return(n[r]<<24|n[r+1]<<16|n[r+2]<<8|n[r+3])>>>0}function w(n,r){return n[r]<<8|n[r+1]}function q(n){let r=Math.min(n.length,65536),e=-1;for(let u=16;u+6<=r;u+=2){if(w(n,u)!==259)continue;let g=w(n,u+2),p=w(n,u+4);if(g<256||g>8192||p<128||p>8192)continue;let y=u-16;if(E(n,y+4)!==0||E(n,y+8)!==0)continue;let P=E(n,y);if(!(P<65536||y+P>n.length+8192)){e=y;break}}if(e<0)throw new Error("RED codestream container not found");let i=e,t=i+12,a=[];for(let u=0;u<8;u++)a.push(w(n,t+4+2*u));let o=i+28;if(o+512>n.length)throw new Error("R3D container table truncated");let b=a[1],m=a[2],f=i+540,v=v1(n,f,a[4],b);if(b%2!==0)throw new Error(`odd R3D canvas width ${b}`);return{canvasW:b,canvasH:m,rawFields:a,table512:n.subarray(o,o+512),streamOff:f,segments:v}}function v1(n,r,e,i){let t=Math.ceil(i/128),a=r;for(;(w(n,a)&4095)<256;)if(a+=2,a+2>n.length)throw new Error("R3D segment stream truncated");a+=1;let o=a,b=n[a-1],m=[];for(let f=0;f<e;f++){if(o+8>n.length)throw new Error("R3D segment header past essence end");let v=[w(n,o),w(n,o+2),w(n,o+4),w(n,o+6)],u=v.map(h=>h+7>>3),g=o+8,p=u[0]+u[1]+u[2]+u[3];if(g+p>n.length)throw new Error("R3D segment body past essence end");let y=g,P=v.map((h,x)=>{let C={off:y,bitLength:h,byteLength:u[x]};return y+=u[x],C});m.push({x:f%t*128,y:Math.floor(f/t)*16,quant:b,subbands:P}),b=n[g+p]??0,o=g+p+1}return m}function o1(n){let r=new Uint32Array(n.segments.length*4*8),e=0;for(let i of n.segments)for(let t=0;t<4;t++){let a=i.subbands[t];r[e]=a.off,r[e+1]=a.bitLength,r[e+2]=a.byteLength,r[e+3]=i.x,r[e+4]=i.y,r[e+5]=i.quant,r[e+6]=t,r[e+7]=0,e+=8}return r}function k(n){return x1[0]=n>>>0,h1[0]}var c1=new ArrayBuffer(4),x1=new Uint32Array(c1),h1=new Float32Array(c1),w1=1112556626;function B1(n){if(n.length<140)return null;let r=new DataView(n.buffer,n.byteOffset,n.byteLength);if(r.getUint32(0,!0)!==w1||r.getUint32(4,!0)!==1)return null;let e=r.getUint32(8,!0),i=12,t=[];for(let f=0;f<4;f++,i+=4)t.push(r.getUint32(i,!0));let a=[];for(let f=0;f<26;f++,i+=4)a.push(r.getUint32(i,!0));let o=r.getUint32(i,!0);i+=4;let b=r.getUint32(i,!0);if(i+=4,i+b>n.length)return null;let m=new TextDecoder().decode(n.subarray(i,i+b));return{wbBits:t,smatrixBits:a,exposureBits:o,fixFlashers:(e&2)!==0,model:m}}async function M(n){try{return await r1(),B1(n1(n??new Uint8Array(0)))}catch{return null}}var l1=`// R3D KOMODO entropy decode (kernel 1 of 2). One invocation per (segment, subband) job.
|
|
4
4
|
// Faithful port of decode_subband_raw in rust/media-core/src/r3d/entropy.rs.
|
|
5
5
|
// Writes RAW coefficients (scan order) straight into coeff[job*2048 ..] \u2014 the buffer must be
|
|
6
6
|
// zero-initialized; only nonzero decoded positions are written (deterministic across reruns).
|