Skip to content

Commit

Permalink
add hidden interp setting: block size
Browse files Browse the repository at this point in the history
  • Loading branch information
couleurm committed Mar 24, 2024
1 parent 98ad030 commit 1b31364
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
1 change: 1 addition & 0 deletions target/defaults.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ fps: 1920
speed: medium
tuning: weak
algorithm: 23
block size: auto
use gpu: no
area:

Expand Down
1 change: 1 addition & 0 deletions target/jamba.vpy
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ if (ip := rc['interpolation'])['enabled'].lower() in YES:
NewNum=float(ip['fps']),
NewDen=1,
OverrideAlgo=int(ip['algorithm']),
OverrideBlockSize=ip['block size'],
OverrideArea=area
)

Expand Down
23 changes: 16 additions & 7 deletions target/scripts/havsfunc.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def Overlay(base, overlay, x=0, y=0, mask=None, opacity=1.0, mode='normal', plan
Source: https://github.com/xyx98/my-vapoursynth-script/blob/master/xvs.py
"""
def InterFrame(Input, Preset='Medium', Tuning='Film', NewNum=None, NewDen=1, GPU=True, gpuid=0, OverrideAlgo=None, OverrideArea=None,
FrameDouble=False):
FrameDouble=False, OverrideBlockSize='auto'):

if not isinstance(Input, vs.VideoNode):
raise TypeError('InterFrame: This is not a video')
Expand Down Expand Up @@ -218,12 +218,21 @@ def InterFrameProcess(clip,oclip):
SuperString += 'gpu:1}' if GPU else 'gpu:0}'

# Create VectorsString
if Tuning == 'animation' or Preset == 'fastest':
VectorsString = '{block:{w:32,'
elif Preset in ['fast', 'faster'] or not GPU:
VectorsString = '{block:{w:16,'
if OverrideBlockSize not in [None, '', 'auto']:
if 'x' in OverrideBlockSize: # contains a width, and height
width, height = OverrideBlockSize.split('x')
VectorsString = '{block:{w:' + width + ','
if height != '':
VectorsString += 'h:' + height + ','
else: # only contains width
VectorsString = '{block:{w:' + OverrideBlockSize + ','
else:
VectorsString = '{block:{w:8,'
if Tuning == 'animation' or Preset == 'fastest':
VectorsString = '{block:{w:32,'
elif Preset in ['fast', 'faster'] or not GPU:
VectorsString = '{block:{w:16,'
else:
VectorsString = '{block:{w:8,'

if Tuning == 'animation' or Preset == 'fastest':
VectorsString += 'overlap:0'
Expand Down Expand Up @@ -281,7 +290,7 @@ def InterFrameProcess(clip,oclip):
if Tuning == 'weak':
SmoothString += ',area_sharp:1.2},scene:{blend:true,mode:0,limits:{blocks:50}}}'
else:
SmoothString += ',area_sharp:1.2},scene:{blend:true,mode:0}}'
SmoothString += ',area_sharp:1.2},scene:{blend:false,mode:0}}'

# Make interpolation vector clip
Super = core.svp1.Super(clip, SuperString)
Expand Down

0 comments on commit 1b31364

Please sign in to comment.