Skip to content

Commit

Permalink
fix_telecined_fades: make tff/bff handling simpler/saner
Browse files Browse the repository at this point in the history
Reflect the actual field placement in the property names.
  • Loading branch information
astiob committed Feb 7, 2024
1 parent efb9e7b commit 0d38404
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions vsdeinterlace/combing.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,15 @@ def fix_telecined_fades(
props_clip = core.akarin.PropExpr(
[f.work_clip, fields[::2], fields[1::2]], lambda: { # type: ignore[misc]
f'f{t}Avg{i}': f'{c}.P{i}Average {color} -' # type: ignore[has-type]
for t, c in ['ty', 'bz']
for t, c in zip('tb' if tff.is_tff else 'bt', 'yz')
for i, color in zip(f.norm_planes, f.norm_seq(colors))
}
)

fix = norm_expr(
props_clip, 'Y 2 % x.f{t1}Avg{i} x.f{t2}Avg{i} ? AVG! '
props_clip, 'Y 2 % x.fbAvg{i} x.ftAvg{i} ? AVG! '
'AVG@ 0 = x x {color} - x.ftAvg{i} x.fbAvg{i} + 2 / AVG@ / * ? {color} +',
planes, i=f.norm_planes, color=colors, force_akarin=func,
t1='b' if tff.is_tff else 't', t2='t' if tff.is_tff else 'b'
)

return f.return_clip(fix)
Expand Down

0 comments on commit 0d38404

Please sign in to comment.