Feature request: utilizing nnedi3cl
Would be nice if nnedi3cl https://github.com/HomeOfVapourSynthEvolution/VapourSynth-NNEDI3CL could be utilized in GradFun with smode 5. Extending the other filters with an additional parameter to use nnedi3cl would be nice too and speedUp things,...
The only time nnedi3 is used inside GradFun3 is with resizer="lineart_rpow2" or resizer="lineart_rpow2_bicubic". Also, it is not called directly but within 4re's nnedi3_rpow2.py, so it would have to be changed in his script.
A quick and dirty way for you would be to add core.nnedi3.nnedi3 = core.nnedi3cl.NNEDI3CL right below of core = vs.get_core() inside nnedi3_rpow2.py.
NNEDI3 is used directly in JIVTC, though. There I might add automatic detection of znedi in the future.
A quick and dirty way for you would be to add core.nnedi3.nnedi3 = core.nnedi3cl.NNEDI3CL right below of core = vs.get_core() inside nnedi3_rpow2.py.
Or rather just change every occurrence of core.nnedi3.nnedi3. It's only two times in the script.
Since DescaleAA is hardcoded to use rpow=2 anyway, you could drop this thing in and lose the nnedi3_rpow2 dependency altogether
def lumadouble(clip, w, h, nsize=0, nns=3, qual=2, opencl=False):
core = vs.core
# Resizing between nnedi3 calls can either be faster or slower
# When doubling from 720p to 1080p, the 2nd nnedi3 call will be interpolating a 2560x720 clip
# It's faster to downscale to 720x1920, transpose, then interpolate the 1920x720 clip
# However, it is counter-intuitive to do this with i.e. 720x480 to 1920x1080
# So it needs to be decided on a case-by-case basis
resize_last = clip.width * 2 <= w
if opencl and hasattr(core, 'nnedi3cl'):
# only nnedi3cl has a dw parameter anyway so it's easier to just stick it here
if resize_last:
nnclip = core.nnedi3cl.NNEDI3CL(clip, field=0, dh=True, dw=True, nsize=nsize, nns=nns, qual=qual)
return core.resize.Spline36(nnclip, w, h, src_left=0.5, src_top=0.5)
nnedi3 = core.nnedi3cl.NNEDI3CL
elif hasattr(core, 'znedi3'):
nnedi3 = core.znedi3.nnedi3
else:
nnedi3 = core.nnedi3.nnedi3
nnclip = core.std.Transpose(clip)
nnclip = nnedi3(nnclip, field=0, dh=True, nsize=nsize, nns=nns, qual=qual)
if resize_last:
src_left = 0.5
else:
src_left = 0
nnclip = core.resize.Spline36(nnclip, height=w, src_top=0.5)
nnclip = core.std.Transpose(nnclip)
nnclip = nnedi3(nnclip, field=0, dh=True, nsize=nsize, nns=nns, qual=qual)
return core.resize.Spline36(nnclip, w, h, src_left=src_left, src_top=0.5)