HomeOfVapourSynthEvolution / havsfunc

Holy's ported AviSynth functions for VapourSynth
The Unlicense
112 stars 38 forks source link

"Stab" doesn't work properly on some material #50

Open BlohoJo opened 2 years ago

BlohoJo commented 2 years ago

I included an example... the clip jerks all over the place with the Stab filter enabled for no apparent reason. Increse the max x/y shift to 10 to see it better.

This doesn't happen with the AviSynth version of Stab.

I attached a clip that exhibits the issue (github doesn't let me attach, used zippyshare).

I also attached the script and plugins that I am using in AviSynth and Vapoursynth, just to rule out any version issues.

Clip -> https://www101.zippyshare.com/v/6IlzcOER/file.html avisynthPlugins.zip vsfilters.zip

HolyWu commented 2 years ago

The Depan filter in MVTools plugin does not support range parameter. I guess it's affected by that. You can try https://github.com/theChaosCoder/lostfunc/blob/0a6816844b8f08ecac0e7a5bb32aacae2f4a3b93/lostfunc.py#L58 which supports range parameter, but I don't know where you can download the Depan plugin since the original repo has been lost in the limbo.

BlohoJo commented 2 years ago

~Yeah, it looks like it's not going to work without DePanEstimate.dll. What I'm not understanding, is that isn't DePan.dll and DePanEstimate.dll part of libmvtools.dll?~

You can download the Depan plugin from the above "vsfilters.zip" that I posted above. It's also included in Hybrid.

The script you linked crashed; it appears to have syntax errors. I was able to get it working by changing it to:

# Stab function that uses DePanEstimate from "Depan" plugin which supports 
# the range parameter. DePanEstimate from MvTools is missing that paramater.
# Function copied from https://github.com/HomeOfVapourSynthEvolution/havsfunc
##############################################################################
# Original script by g-force converted into a stand alone script by McCauley #
# latest version from December 10, 2008                                      #
##############################################################################
def Stab(clp, range=1, dxmax=4, dymax=4, mirror=0):
    if not isinstance(clp, vs.VideoNode):
        raise vs.Error('Stab: This is not a clip')

    temp = AverageFrames(clp, weights=[1] * 15, scenechange=25 / 255)
    inter = core.std.Interleave([core.rgvs.Repair(temp, AverageFrames(clp, weights=[1] * 3, scenechange=25 / 255), mode=[1]), clp])
    mdata = core.depan.DePanEstimate(inter, range=range, trust=0, dxmax=dxmax, dymax=dymax)
    last = core.depan.DePan(inter, data=mdata, offset=-1, mirror=mirror)
    return last[::2]

It now works, and fixes the instability issues. Thanks very much for the help as I'm not a coder, the above is just me cutting and pasting lines. But it works; if range isn't specified then it defaults to 1.

theChaosCoder commented 2 years ago

I restored the Depan source code (hopefully it's the latest version) and the binary here: https://github.com/Vapoursynth-Plugins-Gitify/DePan Will add it to vsrepo soon.