MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / getCubeLut

Function getCubeLut

packages/core/src/runtime/colorGrading.ts:455–475  ·  view source on GitHub ↗
(src: string)

Source from the content-addressed store, hash-verified

453}
454
455function getCubeLut(src: string): LutCacheEntry {
456 const resolved = resolveLutUrl(src);
457 if ("error" in resolved) return { state: "error", message: resolved.error };
458 const cached = LUT_CACHE.get(resolved.href);
459 if (cached) return cached;
460
461 const promise = fetch(resolved.href, { credentials: "same-origin" })
462 .then((response) => {
463 if (!response.ok) throw new Error(`Failed to load LUT (${response.status})`);
464 return response.text();
465 })
466 .then((text) => parseCubeLut(text, { maxSize: MAX_LUT_SIZE }));
467
468 const pending: LutCacheEntry = { state: "pending", promise };
469 LUT_CACHE.set(resolved.href, pending);
470 promise.then(
471 (lut) => LUT_CACHE.set(resolved.href, { state: "ready", lut }),
472 (err) => LUT_CACHE.set(resolved.href, { state: "error", message: errorMessage(err) }),
473 );
474 return pending;
475}
476
477function uploadEntryLut(
478 entry: ColorGradingEntry,

Callers 1

ensureEntryLutFunction · 0.85

Calls 6

parseCubeLutFunction · 0.90
resolveLutUrlFunction · 0.85
fetchFunction · 0.85
errorMessageFunction · 0.85
getMethod · 0.80
setMethod · 0.65

Tested by

no test coverage detected