havsfunc icon indicating copy to clipboard operation
havsfunc copied to clipboard

"Stab" doesn't work properly on some material

Open BlohoJo opened this issue 2 years ago • 3 comments

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

BlohoJo avatar Jan 15 '22 19:01 BlohoJo

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.

HolyWu avatar Jan 16 '22 03:01 HolyWu

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

BlohoJo avatar Jan 16 '22 16:01 BlohoJo

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.

theChaosCoder avatar Jan 26 '22 10:01 theChaosCoder