Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
LightArrowsEXE committed May 2, 2020
1 parent c73db6b commit 39030cc
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 18 deletions.
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ Functions
lvsfunc.scale.test_descale
lvsfunc.util.get_scale_filter
lvsfunc.util.one_plane
lvsfunc.util.pick_repair
lvsfunc.util.pick_removegrain
lvsfunc.util.pick_repair
lvsfunc.util.quick_resample
lvsfunc.util.resampler

Expand Down Expand Up @@ -202,8 +202,8 @@ lvsfunc.util

lvsfunc.util.get_scale_filter
lvsfunc.util.one_plane
lvsfunc.util.pick_repair
lvsfunc.util.pick_removegrain
lvsfunc.util.pick_repair
lvsfunc.util.quick_resample
lvsfunc.util.resampler

Expand Down
10 changes: 6 additions & 4 deletions lvsfunc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@

edgefixer = misc.edgefixer
fix_cr_tint = misc.fix_cr_tint
frames_since_bookmark = misc.frames_since_bookmark
limit_dark = misc.limit_dark
load_bookmarks = misc.load_bookmarks
replace_ranges = misc.replace_ranges
source = misc.source
wipe_row = misc.wipe_row
Expand All @@ -38,10 +40,10 @@
test_descale = scale.test_descale

# Aliases
sraa = upscaled_sraa
comp = compare
scomp = stack_compare
cond_desc = conditional_descale
qden = quick_denoise
src = source
rfs = replace_ranges
cond_desc = conditional_descale
scomp = stack_compare
sraa = upscaled_sraa
src = source
10 changes: 5 additions & 5 deletions lvsfunc/aa.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ def nneedi3_clamp(clip: vs.VideoNode, strength: int = 1,

bits = clip.format.bits_per_sample - 8
thr = strength * (1 >> bits)
strong = TAAmbk(clip, aatype='Eedi3', alpha=0.25, beta=0.5, gamma=40, nrad=2, mdis=20, mtype=0,
opencl=opencl)
strong = TAAmbk(clip, aatype='Eedi3', alpha=0.25, beta=0.5, gamma=40, nrad=2, mdis=20, mtype=0, opencl=opencl)
weak = TAAmbk(clip, aatype='Nnedi3', nsize=3, nns=3, qual=1, mtype=0, opencl=opencl)
expr = 'x z - y z - * 0 < y x y {0} + min y {0} - max ?'.format(thr)

Expand Down Expand Up @@ -84,7 +83,7 @@ def transpose_aa(clip: vs.VideoNode,
Original function written by Zastin, modified by LightArrowsEXE.
Dependencies: vapoursynth-eedi3, vapoursynth-nnedi3, znedi3
Dependencies: rgsf (optional: 32 bit clip), vapoursynth-eedi3, vapoursynth-nnedi3, znedi3
:param clip: Input clip
:param eedi3: Use eedi3 for the interpolation (Default: False)
Expand Down Expand Up @@ -119,7 +118,8 @@ def _csharp(flt, clip):
return core.std.Expr([flt, clip, blur], 'x y < x x + z - x max y min x x + z - x min y max ?')

aaclip = _aa(clip_y)
aaclip = _csharp(aaclip, clip_y).rgvs.Repair(clip_y, 13)
aaclip = _csharp(aaclip, clip_y)
aaclip = util.pick_repair(clip_y)(clip_y, 13)

return aaclip if clip.format.color_family is vs.GRAY else core.std.ShufflePlanes([aaclip, clip], [0, 1, 2], vs.YUV)

Expand All @@ -136,7 +136,7 @@ def upscaled_sraa(clip: vs.VideoNode,
Original function written by Zastin, heavily modified by LightArrowsEXE.
Dependencies: fmtconv, rgsf (optional: 32bit clip), vapoursynth-eedi3, vapoursynth-nnedi3
Dependencies: fmtconv, rgsf (optional: 32 bit clip), vapoursynth-eedi3, vapoursynth-nnedi3
:param clip: Input clip
:param rfactor: Image enlargement factor. 1.3..2 makes it comparable in strength to vsTAAmbk.
Expand Down
8 changes: 4 additions & 4 deletions lvsfunc/comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def compare(clip_a: vs.VideoNode, clip_b: vs.VideoNode,
mismatch: bool = False) -> vs.VideoNode:
"""
Allows for the same frames from two different clips to be compared by interleaving them into a single clip.
Clips are automatically resampled to 8bit YUV -> RGB24 to emulate how a monitor shows the frame.
Clips are automatically resampled to 8 bit YUV -> RGB24 to emulate how a monitor shows the frame.
This can be disabled by setting `disable_resample` to True.
Alias for this function is "comp".
Expand All @@ -38,13 +38,13 @@ def compare(clip_a: vs.VideoNode, clip_b: vs.VideoNode,
:return: Interleaved clip containing specified frames from clip_a and clip_b
"""
try:
import mvsfunc as mvf
from mvsfunc import GetMatrix
except ModuleNotFoundError:
raise ModuleNotFoundError("compare: missing dependency 'mvsfunc'")

def _resample(clip: vs.VideoNode) -> vs.VideoNode:
# Resampling to 8bit and RGB to properly display how it appears on your screen
return util.resampler(clip.resize.Point(format=vs.RGB24, matrix_in_s=mvf.GetMatrix(clip)), 8)
# Resampling to 8 bit and RGB to properly display how it appears on your screen
return util.resampler(clip.resize.Point(format=vs.RGB24, matrix_in_s=GetMatrix(clip)), 8)

# Error handling
if frames and len(frames) > clip_a.num_frames:
Expand Down
2 changes: 1 addition & 1 deletion lvsfunc/deinterlace.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def decomb(clip: vs.VideoNode,
:param vinv: Use vinverse to get rid of additional combing (Default: False)
:param sharpen: Unsharpen after deinterlacing (Default: False)
:param dir: Directional vector. 'v' = Vertical, 'h' = Horizontal (Default: v)
:param rep: Repair mode for repairing the decombed frame using the original src frame (Default: None)
:param rep: Repair mode for repairing the decombed clip using the original clip (Default: None)
:return: Decombed clip
"""
Expand Down
4 changes: 2 additions & 2 deletions lvsfunc/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ def source(file: str, ref: Optional[vs.VideoNode] = None,

if ref:
try:
import mvsfunc as mvf
from mvsfunc import GetMatrix
except ModuleNotFoundError:
raise ModuleNotFoundError("source: missing dependency 'mvsfunc'")

clip = core.std.AssumeFPS(clip, fpsnum=ref.fps.numerator, fpsden=ref.fps.denominator)
clip = core.resize.Bicubic(clip, width=ref.width, height=ref.height, format=ref.format, matrix_s=mvf.GetMatrix(ref))
clip = core.resize.Bicubic(clip, width=ref.width, height=ref.height, format=ref.format, matrix_s=GetMatrix(ref))
if is_image(file):
clip = clip * (ref.num_frames - 1)

Expand Down
1 change: 1 addition & 0 deletions lvsfunc/scale.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ def test_descale(clip: vs.VideoNode,
merge = core.std.ShufflePlanes([upsc, clip], [0, 1, 2], vs.YUV)
return core.text.FrameProps(merge, "PlaneStatsDiff") if show_error else merge


# TODO: Write a function that checks every possible combination of B and C in bicubic
# and returns a list of the results. Possibly return all the frames in order of
# smallest difference to biggest. Not reliable, but maybe useful as starting point.
Expand Down

0 comments on commit 39030cc

Please sign in to comment.