Skip to content

Commit

Permalink
workaround for i444 while svp interpolating
Browse files Browse the repository at this point in the history
  • Loading branch information
couleurm committed Apr 9, 2024
1 parent 06c6cc2 commit d3e3610
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions target/jamba.vpy
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,27 @@ if (ip := rc['interpolation'])['enabled'].lower() in YES:
og_clip = clip
new_fps = int(ip['fps'])

def ScaleLuminance (scale: bool, clip: vs.VideoNode):
y = core.std.ShufflePlanes(clip, planes=0, colorfamily=vs.GRAY)
u = core.std.ShufflePlanes(clip, planes=1, colorfamily=vs.GRAY)
v = core.std.ShufflePlanes(clip, planes=2, colorfamily=vs.GRAY)

if scale: # up
y = core.resize.Point(y, width=y.width * 2, height=y.height * 2)
else: # down
y = core.resize.Point(y, width=y.width / 2, height=y.height / 2)

clip = core.std.ShufflePlanes(clips=[y, u, v], planes=[0, 0, 0], colorfamily=vs.YUV)

return clip

if clip.format.id in [vs.YUV444P8]:
scaled = True
print("WARNING: (SVPFlow) Interpolation with i444 is normally not compatible, using a slower workaround.", file=sys.stderr)
clip = ScaleLuminance(scale=True, clip=clip)
else:
scaled = False

clip = havsfunc.InterFrame(
Input=clip,
GPU=ip['use gpu'].lower() in YES,
Expand All @@ -363,6 +384,9 @@ if (ip := rc['interpolation'])['enabled'].lower() in YES:
OverrideArea=area
)

if scaled:
clip = ScaleLuminance(scale=False, clip=clip)

if ip['masking'] in YES:
clip = Masking(
to_mask=clip,
Expand Down

0 comments on commit d3e3610

Please sign in to comment.