mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-11 14:50:02 +00:00
feat(core): define media treatment capabilities
This commit is contained in:
@@ -11,12 +11,10 @@ const LUT_DIR = join(SKILL_DIR, "luts");
|
||||
const LUT_INDEX = join(LUT_DIR, "index.json");
|
||||
export const LIBRARY_LUT_OFFLINE_CODE = "MEDIA_USE_LIBRARY_LUT_OFFLINE";
|
||||
|
||||
// Mirrored from packages/core/src/colorGrading.ts HfColorGradingPresetId.
|
||||
// Keep this list in lockstep with the core runtime contract.
|
||||
export const CORE_PRESET_IDS = [
|
||||
// Presets this released resolver can safely emit at this stack layer.
|
||||
// Effect-backed treatment presets join after their runtime support lands.
|
||||
export const RESOLVABLE_PRESET_IDS = [
|
||||
"neutral",
|
||||
"natural-lift",
|
||||
"fresh-pop",
|
||||
"warm-daylight",
|
||||
"clean-studio",
|
||||
"skin-soft",
|
||||
@@ -26,8 +24,6 @@ export const CORE_PRESET_IDS = [
|
||||
"vintage-wash",
|
||||
"mono-clean",
|
||||
"mono-fade",
|
||||
"warm-clean",
|
||||
"cool-clean",
|
||||
"soft-boost",
|
||||
"bright-pop",
|
||||
"deep-contrast",
|
||||
@@ -35,16 +31,25 @@ export const CORE_PRESET_IDS = [
|
||||
|
||||
const PRESET_SYNONYMS = {
|
||||
neutral: ["neutral", "identity", "none", "ungraded", "natural base"],
|
||||
"natural-lift": ["natural lift", "natural light", "gentle lift", "soft natural"],
|
||||
"fresh-pop": ["fresh pop", "fresh", "bright fresh", "clean colorful"],
|
||||
"warm-daylight": [
|
||||
"warm daylight",
|
||||
"warm natural light",
|
||||
"golden daylight",
|
||||
"sunlit",
|
||||
"warm sunny",
|
||||
"warm clean",
|
||||
"clean warm",
|
||||
"warm product",
|
||||
],
|
||||
"clean-studio": [
|
||||
"clean studio",
|
||||
"studio clean",
|
||||
"cool studio",
|
||||
"product studio",
|
||||
"cool clean",
|
||||
"clean cool",
|
||||
"cool crisp",
|
||||
],
|
||||
"clean-studio": ["clean studio", "studio clean", "cool studio", "product studio"],
|
||||
"skin-soft": ["skin soft", "soft skin", "portrait soft", "beauty skin"],
|
||||
"food-pop": ["food pop", "food vibrant", "appetizing", "restaurant color"],
|
||||
"night-lift": ["night lift", "night", "low light lift", "city night"],
|
||||
@@ -52,15 +57,29 @@ const PRESET_SYNONYMS = {
|
||||
"vintage-wash": ["vintage wash", "vintage", "retro wash", "aged film"],
|
||||
"mono-clean": ["mono clean", "black white clean", "monochrome clean"],
|
||||
"mono-fade": ["mono fade", "black white fade", "faded monochrome"],
|
||||
"warm-clean": ["warm clean", "clean warm", "warm product"],
|
||||
"cool-clean": ["cool clean", "clean cool", "cool crisp"],
|
||||
"soft-boost": ["soft boost", "soft bright", "gentle boost"],
|
||||
"bright-pop": ["bright pop", "bright punchy", "vivid bright"],
|
||||
"soft-boost": [
|
||||
"soft boost",
|
||||
"soft bright",
|
||||
"gentle boost",
|
||||
"natural lift",
|
||||
"natural light",
|
||||
"gentle lift",
|
||||
"soft natural",
|
||||
],
|
||||
"bright-pop": [
|
||||
"bright pop",
|
||||
"bright punchy",
|
||||
"vivid bright",
|
||||
"fresh pop",
|
||||
"fresh",
|
||||
"bright fresh",
|
||||
"clean colorful",
|
||||
],
|
||||
"deep-contrast": ["deep contrast", "high contrast punchy", "punchy contrast", "bold contrast"],
|
||||
};
|
||||
|
||||
function presetCandidates() {
|
||||
return CORE_PRESET_IDS.map((id) => ({
|
||||
return RESOLVABLE_PRESET_IDS.map((id) => ({
|
||||
kind: "preset",
|
||||
preset: id,
|
||||
synonyms: PRESET_SYNONYMS[id] ?? [],
|
||||
|
||||
@@ -4,8 +4,8 @@ import { join } from "node:path";
|
||||
import { tmpdir } from "node:os";
|
||||
import { test } from "node:test";
|
||||
import {
|
||||
CORE_PRESET_IDS,
|
||||
LIBRARY_LUT_OFFLINE_CODE,
|
||||
RESOLVABLE_PRESET_IDS,
|
||||
freezeLibraryLut,
|
||||
matchColorLook,
|
||||
readBundledLutIndex,
|
||||
@@ -35,6 +35,13 @@ test("high contrast punchy resolves to deep-contrast", () => {
|
||||
assert.equal(matchColorLook("high contrast punchy").preset, "deep-contrast");
|
||||
});
|
||||
|
||||
test("removed preset phrases resolve to surviving looks", () => {
|
||||
assert.equal(matchColorLook("natural lift").preset, "soft-boost");
|
||||
assert.equal(matchColorLook("fresh pop").preset, "bright-pop");
|
||||
assert.equal(matchColorLook("warm clean").preset, "warm-daylight");
|
||||
assert.equal(matchColorLook("cool clean").preset, "clean-studio");
|
||||
});
|
||||
|
||||
test("library look freezes a validated cube from params offline (--local-only)", async () => {
|
||||
const projectDir = mkdtempSync(join(tmpdir(), "mu-lut-provider-"));
|
||||
try {
|
||||
@@ -53,9 +60,13 @@ test("library look freezes a validated cube from params offline (--local-only)",
|
||||
}
|
||||
});
|
||||
|
||||
test("preset IDs stay in sync with packages/core/src/colorGrading.ts", () => {
|
||||
assert.deepEqual(CORE_PRESET_IDS, corePresetIdsFromSource());
|
||||
for (const id of CORE_PRESET_IDS) {
|
||||
test("every resolver preset exists in packages/core/src/colorGrading.ts", () => {
|
||||
const corePresetIds = corePresetIdsFromSource();
|
||||
assert.deepEqual(
|
||||
RESOLVABLE_PRESET_IDS.filter((id) => !corePresetIds.includes(id)),
|
||||
[],
|
||||
);
|
||||
for (const id of RESOLVABLE_PRESET_IDS) {
|
||||
const match = matchColorLook(id);
|
||||
assert.equal(match.kind, "preset");
|
||||
assert.equal(match.preset, id);
|
||||
|
||||
Reference in New Issue
Block a user