Skip to content
This repository was archived by the owner on Feb 27, 2025. It is now read-only.

Commit d71fb67

Browse files
authored
Fix replaces_ranges function (#168)
1 parent 0fa8c78 commit d71fb67

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

vstools/utils/ranges.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,19 @@ def _func(n: int) -> vs.VideoNode: # type: ignore
169169

170170
return base_clip.std.FrameEval(_func, prop_src if 'f' in params else None, [clip_a, clip_b])
171171

172+
shift = 1 - exclusive
173+
b_ranges = normalize_ranges(clip_b, ranges)
174+
172175
if hasattr(vs.core, 'vszip'):
173176
return vs.core.vszip.RFS(
174-
clip_a, clip_b, [y for (s, e) in ranges for y in range(s, e + (not exclusive if s != e else 1))],
177+
clip_a, clip_b,
178+
[y for (s, e) in b_ranges
179+
for y in range(
180+
s, e + (not exclusive if s != e else 1) + (1 if e == clip_b.num_frames - 1 and exclusive else 0)
181+
)
182+
],
175183
mismatch=mismatch
176184
)
177-
178-
shift = 1 - exclusive
179-
b_ranges = normalize_ranges(clip_b, ranges)
180185

181186
a_ranges = invert_ranges(clip_a, clip_b, b_ranges)
182187

0 commit comments

Comments
 (0)