How to use the vapoursynth.get_core function in VapourSynth

To help you get started, we’ve selected a few VapourSynth examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github darealshinji / vapoursynth-plugins / scripts / vsTAAmbk.py View on Github external
def soothe(clip, src, keep=24):
    core = vs.get_core()
    clip_bits = clip.format.bits_per_sample
    src_bits = src.format.bits_per_sample
    if clip_bits != src_bits:
        raise ValueError(MODULE_NAME + ': temporal_stabilize: bits depth of clip and src mismatch.')

    neutral = 1 << (clip_bits - 1)
    ceil = (1 << clip_bits) - 1
    multiple = ceil // 255
    const = 100 * multiple
    kp = keep * multiple

    diff = core.std.MakeDiff(src, clip)
    try:
        diff_soften = core.misc.AverageFrame(diff, weights=[1, 1, 1], scenechange=32)
    except AttributeError:
        diff_soften = core.focus.TemporalSoften(diff, radius=1, luma_threshold=255,
github darealshinji / vapoursynth-plugins / scripts / scoll.py View on Github external
def ezydegrain(src, tr=3, thsad=250, blksize=None, overlap=None, pel=None, limit=None, recalc=False, plane=4):
    core = vs.get_core()

    # Vars

    if blksize is None:
        if src.width < 1280 or src.height < 720:
            blksize = 8
        elif src.width >= 3840 or src.height >= 2160:
            blksize = 32
        else:
            blksize = 16

    if overlap is None:
        overlap = blksize // 2

    if pel is None:
        if src.width < 1280 or src.height < 720:
github darealshinji / vapoursynth-plugins / scripts / mvsfunc.py View on Github external
def _operator2(clip1, clip2, mode, neutral, funcName):
    # Set VS core
    core = vs.get_core()
    
    if not isinstance(clip1, vs.VideoNode):
        raise TypeError(funcName + ': \"clip1\" must be a clip!')
    if not isinstance(clip2, vs.VideoNode):
        raise TypeError(funcName + ': \"clip2\" must be a clip!')
    
    # Get properties of input clip
    sFormat = clip1.format
    if sFormat.id != clip2.format.id:
        raise ValueError(funcName + ': \"clip1\" and \"clip2\" must be of the same format!')
    if clip1.width != clip2.width or clip1.height != clip2.height:
        raise ValueError(funcName + ': \"clip1\" and \"clip2\" must be of the same width and height!')
    
    sSType = sFormat.sample_type
    sbitPS = sFormat.bits_per_sample
    sNumPlanes = sFormat.num_planes
github darealshinji / vapoursynth-plugins / scripts / scoll.py View on Github external
def unsharpmask(clip, strength=1.0, repair=False, repmode=16):
    core = vs.get_core()

    blur_clip = core.generic.GBlur(clip, sigma=strength, planes=[0])
    sharp_clip = core.std.Expr([clip, blur_clip], ['x x + y -', ''])

    if repair is True:
        rclip = core.rgvs.Repair(clip=sharp_clip, repairclip=clip, mode=repmode)
    else:
        rclip = sharp_clip

    return rclip
github darealshinji / vapoursynth-plugins / scripts / mvsfunc.py View on Github external
def PlaneStatistics(clip, plane=None, mean=True, mad=True, var=True, std=True, rms=True):
    # Set VS core and function name
    core = vs.get_core()
    funcName = 'PlaneStatistics'
    
    if not isinstance(clip, vs.VideoNode):
        raise TypeError(funcName + ': \"clip\" must be a clip!')
    
    # Get properties of input clip
    sFormat = clip.format
    
    sSType = sFormat.sample_type
    sbitPS = sFormat.bits_per_sample
    sNumPlanes = sFormat.num_planes
    
    valueRange = (1 << sbitPS) - 1 if sSType == vs.INTEGER else 1
    
    # Parameters
    if plane is None:
github darealshinji / vapoursynth-plugins / scripts / mvsfunc.py View on Github external
def _min_max_filter(src, flt1, flt2, planes, funcName):
    # Set VS core and function name
    core = vs.get_core()
    
    if not isinstance(src, vs.VideoNode):
        raise TypeError(funcName + ': \"src\" must be a clip!')
    if not isinstance(flt1, vs.VideoNode):
        raise TypeError(funcName + ': \"flt1\" must be a clip!')
    if not isinstance(flt2, vs.VideoNode):
        raise TypeError(funcName + ': \"flt2\" must be a clip!')
    
    # Get properties of input clip
    sFormat = src.format
    if sFormat.id != flt1.format.id or sFormat.id != flt2.format.id:
        raise ValueError(funcName + ': \"src\", \"flt1\" and \"flt2\" must be of the same format!')
    if src.width != flt1.width or src.height != flt1.height or src.width != flt2.width or src.height != flt2.height:
        raise ValueError(funcName + ': \"src\", \"flt1\" and \"flt2\" must be of the same width and height!')
    
    sNumPlanes = sFormat.num_planes
github darealshinji / vapoursynth-plugins / scripts / scoll.py View on Github external
def naa(c, ss=2, chroma=False):
    """
    naa - antialiasing function using nnedi3 +++++++++++++++++++++++++++++++++
        ss: supersampling value, must be even.
        cp: if false chroma will not be altered.
    """
    core = vs.get_core()

    if ss % 2 != 0:
        raise ValueError('ss must be an even number.')

    src = c

    if chroma is False:
        c = vsh.get_luma(c)

    if c.format.bits_per_sample > 8:
        fapprox = 12
    else:
        fapprox = 7

    ret = core.nnedi3.nnedi3_rpow2(clip=c, rfactor=ss, correct_shift=1, qual=2, fapprox=fapprox, nsize=6)
    ret = core.nnedi3.nnedi3(clip=ret, field=0, nns=2, fapprox=fapprox, nsize=6)
github HomeOfVapourSynthEvolution / vsTAAmbk / vsTAAmbk.py View on Github external
def mask_sobel(mthr, opencl=False, opencl_device=-1, **kwargs):
    core = vs.get_core()
    if opencl is True:
        try:
            canny = functools.partial(core.tcanny.TCannyCL, device=opencl_device)
        except AttributeError:
            canny = core.tcanny.TCanny
    else:
        canny = core.tcanny.TCanny
    mask_kwargs = {
        'gmmax': kwargs.get('gmmax', max(round(-0.14 * mthr + 61.87), 80)),
        'sigma': kwargs.get('sigma', 1.0),
        't_h': kwargs.get('t_h', 8.0),
        't_l': kwargs.get('t_l', 1.0),
    }
    return lambda clip: canny(clip, mode=1, op=2, **mask_kwargs)
github darealshinji / vapoursynth-plugins / scripts / mvsfunc.py View on Github external
def FilterIf(src, flt, prop_name, props=None):
    # Set VS core and function name
    core = vs.get_core()
    funcName = 'FilterIf'
    
    if not isinstance(src, vs.VideoNode):
        raise TypeError(funcName + ': \"src\" must be a clip!')
    if not isinstance(flt, vs.VideoNode):
        raise TypeError(funcName + ': \"flt\" must be a clip!')
    if props is not None and not isinstance(props, vs.VideoNode):
        raise TypeError(funcName + ': \"props\" must be a clip!')
    
    # Get properties of input clip
    sFormat = src.format
    if sFormat.id != flt.format.id:
        raise ValueError(funcName + ': \"src\" and \"flt\" must be of the same format!')
    if src.width != flt.width or src.height != flt.height:
        raise ValueError(funcName + ': \"src\" and \"flt\" must be of the same width and height!')
github darealshinji / vapoursynth-plugins / scripts / resamplehq.py View on Github external
Default 0.
        src_width (int): A sub‐pixel width to crop the source to. If negative,
            specifies offset from the right. Default is source width−src_left.
        src_height (int): A sub‐pixel height to crop the source to.
            If negative, specifies offset from the bottom.
            Default is source height − src_top.
        descale (bool): Activates the kernel inversion mode, allowing to “undo” a previous upsizing
            by compensating the loss in high frequencies, giving a sharper and more accurate output
            than classic kernels, closer to the original. Default is False.
        filter_param_a (float): For the bicubic filter, filter_param_a represent the “b” parameter ,
            for the lanczos filter, it represents the number of taps.
        filter_param_b (float): For the bicubic filter, it represent the “c” parameter.
        range_in (bool): Range of the input video, either "limited" or "full". Default is "limited".
        precision (bool): 0 uses half float precision , 1 uses single float precision. Default is 1.
    """
    core = vs.get_core()

    # Cheks

    if kernel == 'point' and descale is True:
        raise ValueError('Descale does not support point resizer.')

    if not isinstance(descale, bool):
        raise ValueError('"descale" must be True or False.')

    if precision < 0 or precision > 1:
        raise ValueError('"precision" must be either 0 (half) or 1 (single).')

    # Var stuff

    if descale is True:
        precision = 1