Jaded-Encoding-Thaumaturgy / lvsfunc

lvsfunc, a collection of LightArrowsEXE's VapourSynth functions and wrappers
https://lvsfunc.readthedocs.io/
MIT License
52 stars 11 forks source link

replace_ranges: Error when rfsing image source #131

Closed LightArrowsEXE closed 2 years ago

LightArrowsEXE commented 2 years ago

This is a multi issue, since it also led to me finding a small issue with source.

Anyway, from Vodes: image

Setting exclusive=True fixed this issue. Will create a PR later to try and fix this behaviour.

LightArrowsEXE commented 2 years ago

Can't repro this with my code.

    src = core.std.Limiter(src) * 5
    b = lvf.src("./NegimaShaftBD_E01_OP_63367.png", ref=src)
    b = b + b[0]
    print(src, b)
    rf = lvf.replace_ranges(src.text.FrameNum(), b.text.FrameNum(), 150000)
    return src.text.FrameNum(), rf

image image

Vodes' original (fixed) code:

    # That one cursed frame - stolen from Aicha :)
    mnl = core.imwri.Read("edit2.png").std.AssumeFPS(filt)
    mnl = mnl.resize.Point(format=vs.GRAY16, dither_type="error_diffusion", matrix_s="709")
    sed = lvf.sraa(mnl, rfactor = 1.5)
    dif = core.std.Expr([mnl, sed], "x y - abs 600 > 65535 0 ?")
    msk = core.std.Expr([dif, mnl.std.Sobel().std.Binarize(12000)], "x y = x 0 ?").std.Maximum().std.Maximum()
    mnl = mnl.std.MaskedMerge(sed, msk)
    mnl = core.std.ShufflePlanes([mnl, filt], [0, 1, 2], vs.YUV)
    filt = lvf.rfs(filt, mnl, 114905, use_plugin = False, exclusive = True)
LightArrowsEXE commented 2 years ago

Confirmed to be fixed by Vodes. Thanks @Setsugennoao!