[varLib] Optimize out multiplication by 1 when computing deltas

This commit is contained in:
Behdad Esfahbod 2021-04-06 17:54:05 -06:00
parent 77abdad0f7
commit 96690de9a9

View File

@ -375,7 +375,10 @@ class VariationModel(object):
for i,weights in enumerate(self.deltaWeights):
delta = masterValues[mapping[i]]
for j,weight in weights.items():
delta -= out[j] * weight
if weight == 1:
delta -= out[j]
else:
delta -= out[j] * weight
out.append(round(delta))
return out