42 "--fit-extra-bleach --ab-stabilize %g --ab-level %g --bleach-nudge %g" % (AB_STAB, AB_LEVEL, BLEACH_NUGDE)),
89def patch_c(text, vnum, ins, iro, outs, oro):
90 block = (
' inset_anchor[0] = %+.7ff; inset_anchor[1] = %+.7ff; inset_anchor[2] = %+.7ff;\n'
91 ' rotation_anchor[0] = %+.7ff; rotation_anchor[1] = %+.7ff; rotation_anchor[2] = %+.7ff;\n'
92 ' outset_anchor[0] = %.6ff; outset_anchor[1] = %.6ff; outset_anchor[2] = %.6ff;\n'
93 ' outset_rotation[0] = %+.7ff; outset_rotation[1] = %+.7ff; outset_rotation[2] = %+.7ff;'
94 % (ins[0], ins[1], ins[2], iro[0], iro[1], iro[2],
95 outs[0], outs[1], outs[2], oro[0], oro[1], oro[2]))
97 r'(case DT_FILMIC_COLORSCIENCE_%s:.*?)'
98 r' inset_anchor\[0\][^\n]*\n'
99 r' rotation_anchor\[0\][^\n]*\n'
100 r' outset_anchor\[0\][^\n]*\n'
101 r' outset_rotation\[0\][^\n]*;' % vnum, re.S)
102 new, n = pat.subn(
lambda m: m.group(1) + block, text, count=1)
104 sys.exit(
"could not patch C case %s" % vnum)
109 for name, vnum, flags, fitstr
in STEPS:
110 print(
"=== fitting %-14s (%s) : %s" % (name, vnum,
" ".join(flags)))
112 for ln
in out.splitlines():
113 if ln.startswith(
"// ")
and (
"bisect(" in ln
or "extra best" in ln):
118 with open(PY,
"w")
as f:
119 f.write(
patch_shipped(py, name, fitstr, ins, iro, outs, oro))
122 with open(C,
"w")
as f:
123 f.write(
patch_c(cc, vnum, ins, iro, outs, oro))
124 print(
" patched SHIPPED_VARIANTS['%s'] + C %s inset=[%s]"
125 % (name, vnum,
", ".join(
"%.4f" % v
for v
in ins)))
127 diag =
run([
"--diagnose"])
128 rep =
run([
"--report"])
129 with open(os.path.join(ROOT,
"tools",
"agx_diagnose.log"),
"w")
as f:
131 with open(os.path.join(ROOT,
"tools",
"agx_report.md"),
"w")
as f:
133 print(
"\n=== per-hue continuity (tools/agx_diagnose.log) ===")
135 print(
"Wrote tools/agx_report.md . Now build + verify:\n"
136 " cmake --build build --target filmicrgb")