EleonoreMizo / fmtconv

Format conversion tools for Vapoursynth and Avisynth+
Do What The F*ck You Want To Public License
67 stars 14 forks source link

Crashed using fmtc.bitdepth() #15

Closed GoodManWEN closed 3 years ago

GoodManWEN commented 4 years ago

Operating system : Windows 10-64bit Python version : 3.7.1 vs core version : R48 Input clip format : vs.GRAY16 latest version from fmtconv/releases description:

VS edit crashed over and over again without giving any error message running this line code below:

... # load
mask = mask.fmtc.bitdepth(bits=16, fulls=True, fulld=True, dmode=1)
mask.set_output()
GoodManWEN commented 4 years ago

fullcode:

# Crash.vpy
import vapoursynth as vs
# from nazobase import dataloader

def rmask(clip, rx=None, amp=None):

    scale = lambda val,d:val * ((1 << d) - 1) // 255
    GetPlane = lambda clip,n:core.std.ShufflePlanes(clip, n, vs.GRAY)

    if clip.format.color_family != vs.GRAY:
        clip = GetPlane(clip, 0)

    w, h = clip.width, clip.height
    bits = clip.format.bits_per_sample

    smooth = core.fmtc.resample(clip, w/2, h/2, a1=1, a2=0,kernel='bicubic',fulls=False, fulld=False)
    smoother = core.fmtc.resample(clip, w/2, h/2, a1=2, a2=0,kernel='bicubic',fulls=False, fulld=False)
    mask = core.std.Expr([smooth, smoother], ['x y - {amp} *'.format(amp=amp)])
    return mask.fmtc.bitdepth(bits=bits, fulls=True, fulld=True, dmode=1)

core = vs.core
s16 = dataloader('index.mkv') 
# ↑ just simply load a vs.YUV420P16 clip ,with a geometry of 1920*1080
flt = rmask(s16, 2, 100)
flt.set_output()