speccpu/x264: add a new function to disable weight->i_scale mul

This commit is contained in:
2025-04-23 10:46:16 +08:00
parent 9b6cbfe7ae
commit 819f08fb8d

View File

@@ -48,6 +48,23 @@ class MCBuilder:
return self
def with_disabled_iscale_mul(self):
"""
Disable the i_scale multiplication in the mc_weight function.
Find: "src[x] * weight->i_scale", replace it to src[x]
>>> builder = MCBuilder()
>>> 'src[x] * weight->i_scale' in builder.mc_src
True
>>> builder = builder.with_disabled_iscale_mul()
>>> 'src[x] * weight->i_scale' in builder.mc_src
False
>>> 'src[x]' in builder.mc_src
True
"""
self.mc_src = self.mc_src.replace("src[x] * weight->i_scale", "src[x]")
return self
def build(self):
return self.mc_src