Skip to content

Commit

Permalink
speedup adg_mask for integer formats (#32)
Browse files Browse the repository at this point in the history
complexpr is only faster for 32-bit formats
  • Loading branch information
NSQY authored Dec 11, 2024
1 parent ec7a167 commit 2873c93
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions vsmasktools/spat_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,19 @@ def adg_mask(

assert check_variable(clip, func)

luma, prop = plane(clip, 0), 'P' if complexpr_available else None
use_complex = complexpr_available and clip.format.bits_per_sample > 16

luma, prop = plane(clip, 0), 'P' if use_complex else None
y, y_inv = luma.std.PlaneStats(prop=prop), luma.std.Invert().std.PlaneStats(prop=prop)

if not complexpr_available and relative:
if not use_complex and relative:
raise CustomRuntimeError(
"You don't have akarin plugin, you can't use this function!", func, 'relative=True'
)

assert y.format

if complexpr_available:
if use_complex:
peak = get_peak_value(y)

is_integer = y.format.sample_type == vs.INTEGER
Expand Down

0 comments on commit 2873c93

Please sign in to comment.