Skip to content

Feature request: utilizing nnedi3cl #1

Open

Description

@Selur

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,...

Activity

  1. Frechdachs commented on Feb 24, 2018

    @Frechdachs
    Member

    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.

  2. Frechdachs commented on Feb 24, 2018

    @Frechdachs
    Member

    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.

  3. kgrabs commented on Jun 13, 2020

    @kgrabs
    Member

    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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions