INNER CODE UNIT · JavaScript
combineFidelity
Manavarya09/design-extract · src/fidelity/index.js:31
export function combineFidelity({ verify, motion, weights } = {}) {
const visual = verify?.fidelity ?? null;
const motionScore = motion?.score ?? null;
const vw = weights?.visual ?? VISUAL_WEIGHT;
const mw = weights?.motion ?? MOTION_WEIGHT;
let overall = null;
if (visual != null && motionScore != null) {
overall = Math.round((visual * vw + motionScore * mw) / (vw + mw));
} else if (visual != null) {
overall = visual;
} else if (motionScore != null) {
overall = motionScore;
}
const plan = buildCorrectionPlan({ verify, motion });
return {
overall,