speccpu/x264: add recompile_mc_src to simplify code

This commit is contained in:
2025-04-27 17:27:26 +08:00
parent 516d525ef4
commit 4c0c722616
3 changed files with 113 additions and 11 deletions

View File

@@ -203,3 +203,18 @@ def perf_ref(x264_run, perf_output):
],
cwd=x264_run,
)
def recompile_mc_src(mc_src: str, x264_build: Path, spec_env: Mapping[str, str]):
mc_path = get_mc_path(x264_build)
assert mc_path.exists()
# Write mc_src to mc_path, recompile it, and replace resulting exe
with open(mc_path, "w") as f:
f.write(mc_src)
# Recompile
recompiled_x264_path = recompile_mc(mc_path, x264_build, spec_env)
assert recompiled_x264_path.exists()
assert recompiled_x264_path.is_file()
return recompiled_x264_path