• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python vapoursynth.get_core函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中vapoursynth.get_core函数的典型用法代码示例。如果您正苦于以下问题:Python get_core函数的具体用法?Python get_core怎么用?Python get_core使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_core函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: dec_txt60mc

    def dec_txt60mc (src,frame_ref, srcbob=False,draft=False,tff=None):

	core = vs.get_core()

	field_ref = frame_ref if srcbob else frame_ref * 2
	field_ref =      field_ref  % 5
	invpos    = (5 - field_ref) % 5
	pel       = 1 if draft else 2
 
	if srcbob:
		last = src
	elif draft:
		last = haf.Bob(src,tff=tff)  
	else:
		last = haf.QTGMC(src,SourceMatch=3, Lossless=2, TR0=1, TR1=1, TR2=1,TFF=tff)  

     	
	if invpos > 3:
		clean  = core.std.AssumeFPS(core.std.Trim(last, 0, 0)+core.std.SelectEvery(last,5, 8 - invpos), fpsnum=12000, fpsden=1001)
	else:
		clean = core.std.SelectEvery(last,5, 4 - invpos)
	if invpos > 1:
		jitter = core.std.AssumeFPS(core.std.Trim(last, 0, 0)+core.std.SelectEvery(last,5, [6 - invpos, 5 - invpos]), fpsnum=24000, fpsden=1001)
	else:
		jitter = core.std.SelectEvery(last,5, [1 - invpos, 2 - invpos])
		
	jsup   = core.mv.Super(jitter,pel=pel)
	vect_f = core.mv.Analyse (jsup,isb=False, delta=1, overlap=4)
	vect_b = core.mv.Analyse (jsup,isb=True,  delta=1, overlap=4)
	comp   = core.mv.FlowInter (jitter,jsup, vect_b, vect_f, time=50, thscd1=400)
	fixed  = core.std.SelectEvery (comp,2, 0)
	last   = core.std.Interleave ([fixed, clean])
	return last[invpos // 3:]
开发者ID:BakaProxy,项目名称:Baka-Utilities,代码行数:33,代码来源:bakafunc.py


示例2: Resize16nr

def Resize16nr (src, w=None, h=None, sx=0, sy=0, sw=0, sh=0, kernel="spline36", kernelh=None, kernelv=None, fh=1, fv=1, taps=4, a1=None, a2=None, a3=None, kovrspl=1, cnorm=True, center=True, fulls=None, fulld=None, cplace="mpeg2", invks=False, invkstaps=4, noring=True):
    core    = vs.get_core ()
    w       = src.width if w is None else w
    h       = src.height if h is None else h
    kernelh = kernel if kernelh is None else kernelh
    kernelv = kernel if kernelv is None else kernelv
    sr_h    = float (w / src.width)
    sr_v    = float (h / src.height)
    sr_up   = max (sr_h, sr_v)
    sr_dw   = 1.0 / min (sr_h, sr_v)
    sr      = max (sr_up, sr_dw)

    thr   = 2.5
    nrb   = (sr > thr)
    nrf   = (sr < thr + 1.0 and noring)
    nrr   = min (sr - thr, 1.0) if nrb else 1.0
    nrv   = [round ((1.0 - nrr) * 65535), round ((1.0 - nrr) * 65535), round ((1.0 - nrr) * 65535)] if nrb else [0, 0, 0]
    nrm   = core.std.BlankClip (clip=src, width=w, height=h, color=nrv) if nrb and nrf else 0

    main  = core.fmtc.resample (src, w=w, h=h, sx=sx, sy=sy, sw=sw, sh=sh, kernel=kernel, kernelh=kernelh, kernelv=kernelv, fh=fh, fv=fv, taps=taps, a1=a1, a2=a2, a3=a3, kovrspl=kovrspl, cnorm=cnorm, center=center, fulls=fulls, fulld=fulld, cplace=cplace, invks=invks, invkstaps=invkstaps)
    nrng  = core.fmtc.resample (src, w=w, h=h, sx=sx, sy=sy, sw=sw, sh=sh, kernel="gauss", a1=100, center=center, fulls=fulls, fulld=fulld, cplace=cplace) if nrf else main

    clip  = core.rgvs.Repair (main, nrng, 1) if nrf else main
    clip  = core.std.MaskedMerge (main, clip, nrm) if nrf and nrb else clip
    return clip
开发者ID:IFeelBloated,项目名称:VaporSynth-Functions,代码行数:25,代码来源:Dither.py


示例3: __init__

 def __init__(self):
     self.core            = vs.get_core()
     self.MSuper          = self.core.mvsf.Super
     self.MAnalyze        = mvmulti.Analyze
     self.MRecalculate    = mvmulti.Recalculate
     self.MDegrainN       = mvmulti.DegrainN
     self.RGB2OPP         = self.core.bm3d.RGB2OPP
     self.OPP2RGB         = self.core.bm3d.OPP2RGB
     self.BMBasic         = self.core.bm3d.VBasic
     self.BMFinal         = self.core.bm3d.VFinal
     self.Aggregate       = self.core.bm3d.VAggregate
     self.DFTTest         = self.core.dfttest.DFTTest
     self.KNLMeansCL      = self.core.knlm.KNLMeansCL
     self.NNEDI           = self.core.nnedi3.nnedi3
     self.Resample        = self.core.fmtc.resample
     self.Expr            = self.core.std.Expr
     self.MakeDiff        = self.core.std.MakeDiff
     self.MergeDiff       = self.core.std.MergeDiff
     self.Crop            = self.core.std.CropRel
     self.CropAbs         = self.core.std.CropAbs
     self.Transpose       = self.core.std.Transpose
     self.BlankClip       = self.core.std.BlankClip
     self.AddBorders      = self.core.std.AddBorders
     self.StackHorizontal = self.core.std.StackHorizontal
     self.StackVertical   = self.core.std.StackVertical
     self.MaskedMerge     = self.core.std.MaskedMerge
     self.ShufflePlanes   = self.core.std.ShufflePlanes
     self.SetFieldBased   = self.core.std.SetFieldBased
开发者ID:IFeelBloated,项目名称:Oyster,代码行数:28,代码来源:Oyster.py


示例4: subtofull

def subtofull (src, cplace="mpeg2"):
    core            = vs.get_core ()
    resample        = core.fmtc.resample
    Expr            = core.std.Expr
    ShufflePlanes   = core.std.ShufflePlanes
    factor_w        = src.format.subsampling_w
    factor_h        = src.format.subsampling_h
    def inline_pel_422 (src):
        NNEDI       = core.nnedi3.nnedi3
        Transpose   = core.std.Transpose
        clip        = Transpose (NNEDI (Transpose (src), **nnedi_args))
        return clip
    srcy            = ShufflePlanes (src, 0, vs.GRAY)
    srcu            = Expr (ShufflePlanes (src, 1, vs.GRAY), "x 0.5 +")
    srcv            = Expr (ShufflePlanes (src, 2, vs.GRAY), "x 0.5 +")
    if factor_w == 1 and factor_h == 1:
       unew         = genpelclip (srcu, pel=2)
       vnew         = genpelclip (srcv, pel=2)
       if cplace == "mpeg2":
          ushift    = resample (unew, sx=0, sy=-0.5, kernel="spline", taps=6, **fmtc_args)
          vshift    = resample (vnew, sx=0, sy=-0.5, kernel="spline", taps=6, **fmtc_args)
       elif cplace == "mpeg1":
          ushift    = resample (unew, sx=-0.5, sy=-0.5, kernel="spline", taps=6, **fmtc_args)
          vshift    = resample (vnew, sx=-0.5, sy=-0.5, kernel="spline", taps=6, **fmtc_args)
       else:
          raise ValueError ("wtf?")
    if factor_w == 1 and factor_h == 0:
       unew         = inline_pel_422 (srcu)
       vnew         = inline_pel_422 (srcv)
       ushift       = resample (unew, sx=1, sy=0, kernel="spline", taps=6, **fmtc_args)
       vshift       = resample (vnew, sx=1, sy=0, kernel="spline", taps=6, **fmtc_args)
    ufinal          = Expr (ushift, "x 0.5 -")
    vfinal          = Expr (vshift, "x 0.5 -")
    clip            = ShufflePlanes ([srcy, ufinal, vfinal], [0, 0, 0], vs.YUV)
    return clip
开发者ID:IFeelBloated,项目名称:BlockMatchingToolkit,代码行数:35,代码来源:BMToolkit.py


示例5: add16

def add16 (src1, src2, dif=True):
    core = vs.get_core ()
    if dif:
       clip = core.std.MergeDiff (src1, src2)
    else:
       clip = core.std.Expr ([src1, src2], ["x y +"])
    return clip
开发者ID:IFeelBloated,项目名称:VaporSynth-Functions,代码行数:7,代码来源:Dither.py


示例6: hipass

def hipass (src, sharp, p=16):
    core            = vs.get_core ()
    MakeDiff        = core.std.MakeDiff
    MergeDiff       = core.std.MergeDiff
    hif             = MakeDiff (sharp, gauss (sharp, p=p))
    clip            = MergeDiff (gauss (src, p=p), hif)
    return clip
开发者ID:IFeelBloated,项目名称:BlockMatchingToolkit,代码行数:7,代码来源:BMToolkit.py


示例7: deconvolution

def deconvolution (src, loop=2, lowpass=8, a=32, h=12.8, thr=0.00390625, elast=None):
    core            = vs.get_core ()
    Deconv          = core.vcfreq.Sharp
    dcv             = Deconv (src, **deconv_args)
    clip            = hipass (src, dcv, p=lowpass)
    loop            = loop - 1
    return halonr (clip, a, h, thr, elast, lowpass) if loop == 0 else deconvolution (clip, loop, lowpass, a, h, thr, elast)
开发者ID:IFeelBloated,项目名称:BlockMatchingToolkit,代码行数:7,代码来源:BMToolkit.py


示例8: temporal_stabilize

def temporal_stabilize(clip, src, delta=3, pel=1, retain=0.6):
    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.')
    if delta not in [1, 2, 3]:
        raise ValueError(MODULE_NAME + ': temporal_stabilize: delta (1~3) invalid.')

    diff = core.std.MakeDiff(src, clip)
    clip_super = core.mv.Super(clip, pel=pel)
    diff_super = core.mv.Super(diff, pel=pel, levels=1)

    backward_vectors = [core.mv.Analyse(clip_super, isb=True, delta=i+1, overlap=8, blksize=16) for i in range(delta)]
    forward_vectors = [core.mv.Analyse(clip_super, isb=False, delta=i+1, overlap=8, blksize=16) for i in range(delta)]
    vectors = [vector for vector_group in zip(backward_vectors, forward_vectors) for vector in vector_group]

    stabilize_func = {
        1: core.mv.Degrain1,
        2: core.mv.Degrain2,
        3: core.mv.Degrain3
    }
    diff_stabilized = stabilize_func[delta](diff, diff_super, *vectors)

    neutral = 1 << (clip_bits - 1)
    expr = 'x {neutral} - abs y {neutral} - abs < x y ?'.format(neutral=neutral)
    diff_stabilized_limited = core.std.Expr([diff, diff_stabilized], expr)
    diff_stabilized = core.std.Merge(diff_stabilized_limited, diff_stabilized, retain)
    clip_stabilized = core.std.MakeDiff(src, diff_stabilized)
    return clip_stabilized
开发者ID:darealshinji,项目名称:vapoursynth-plugins,代码行数:30,代码来源:vsTAAmbk.py


示例9: soothe

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,
                                                chroma_threshold=255, scenechange=32, mode=2)
    diff_soothed_expr = "x {neutral} - y {neutral} - * 0 < x {neutral} - {const} / {kp} * {neutral} + " \
                        "x {neutral} - abs y {neutral} - abs > " \
                        "x {kp} * y {const} {kp} - * + {const} / x ? ?".format(neutral=neutral, const=const, kp=kp)
    diff_soothed = core.std.Expr([diff, diff_soften], diff_soothed_expr)
    clip_soothed = core.std.MakeDiff(src, diff_soothed)
    return clip_soothed
开发者ID:darealshinji,项目名称:vapoursynth-plugins,代码行数:25,代码来源:vsTAAmbk.py


示例10: interpolate

def interpolate(config, recalcconfig=None):
    core = vs.get_core()
    clip = video_in

    # Interpolating to fps higher than 60 is too CPU-expensive
    # Use interpolation from opengl video output
    dst_fps = display_fps
    while (dst_fps > 60):
        dst_fps /= 2

    src_fps_num = int(container_fps * 1e8)
    src_fps_den = int(1e8)
    dst_fps_num = int(dst_fps * 1e4)
    dst_fps_den = int(1e4)

    # Needed because clip FPS is missing
    clip = core.std.AssumeFPS(clip, fpsnum = src_fps_num, fpsden = src_fps_den)
    print("Reflowing from ",src_fps_num/src_fps_den," fps to ",dst_fps_num/dst_fps_den," fps.")

    pad = config.get('blksize',  8)
    sup  = core.mv.Super(clip, pel=1, hpad=pad, vpad=pad)
    bvec, fvec = analyse(sup, config)
    if recalcconfig:
        bvec, fvec = recalculate(sup, bvec, fvec, recalcconfig)
    clip = core.mv.FlowFPS(clip, sup, bvec, fvec, num=dst_fps_num, den=dst_fps_den, thscd2=90)

    clip.set_output()
开发者ID:7185,项目名称:void-packages,代码行数:27,代码来源:example.py


示例11: daa

def daa(clip, mode=-1, opencl=False):
    core = vs.get_core()
    if opencl is True:
        try:
            daa_nnedi3 = core.nnedi3cl.NNEDI3CL
        except AttributeError:
            daa_nnedi3 = core.nnedi3.nnedi3
    else:
        try:
            daa_nnedi3 = core.znedi3.nnedi3
        except AttributeError:
            daa_nnedi3 = core.nnedi3.nnedi3
    if mode == -1:
        nn = daa_nnedi3(clip, field=3)
        nnt = daa_nnedi3(core.std.Transpose(clip), field=3).std.Transpose()
        clph = core.std.Merge(core.std.SelectEvery(nn, cycle=2, offsets=0),
                              core.std.SelectEvery(nn, cycle=2, offsets=1))
        clpv = core.std.Merge(core.std.SelectEvery(nnt, cycle=2, offsets=0),
                              core.std.SelectEvery(nnt, cycle=2, offsets=1))
        clp = core.std.Merge(clph, clpv)
    elif mode == 1:
        nn = daa_nnedi3(clip, field=3)
        clp = core.std.Merge(core.std.SelectEvery(nn, cycle=2, offsets=0),
                             core.std.SelectEvery(nn, cycle=2, offsets=1))
    elif mode == 2:
        nnt = daa_nnedi3(core.std.Transpose(clip), field=3).std.Transpose()
        clp = core.std.Merge(core.std.SelectEvery(nnt, cycle=2, offsets=0),
                             core.std.SelectEvery(nnt, cycle=2, offsets=1))
    else:
        raise ValueError(MODULE_NAME + ': daa: at least one direction should be processed.')
    return clp
开发者ID:darealshinji,项目名称:vapoursynth-plugins,代码行数:31,代码来源:vsTAAmbk.py


示例12: setUp

    def setUp(self):
        self.core = vs.get_core()
        self.frame = self.core.std.BlankClip().get_frame(0)
        self.props = self.frame.props

        self.frame_copy = self.frame.copy()
        self.props_rw = self.frame_copy.props
开发者ID:Hinterwaeldlers,项目名称:vapoursynth-1,代码行数:7,代码来源:prop_dict_test.py


示例13: Baa

def Baa(c, aa = "sangnom2", ss = None, mask=True, mthr = 30, blur=5, expand = 1, chroma = False):

    core = vs.get_core() 
    
    aac = 48 if chroma == True else 0
	
    if not isinstance(c, vs.VideoNode):
        raise ValueError('ediaaclip: This is not a clip')
        
    edibits=c.format.bits_per_sample

    if edibits > 8:
        a8 = core.fmtc.bitdepth(c, bits=8)
         
    else :
        a8 = c
        
    if mask == True:
        mask = core.generic.Prewitt(a8, mthr, mthr)
        mask = BlurLoop(ExpandLoop(mask, expand), blur)
        
    if ss == None:
        ss = 2 if aa == "sangnom2" else 1.1
         
    if ss != 1:
        a8 = Resize(a8, m16(c.width * ss), m16(c.height * ss))
         
    if aa == "nnedi3":
        a8 = Resize(core.nnedi3.nnedi3(a8, field=1,dh=True).std.Transpose().nnedi3.nnedi3(field=1,dh=True).std.Transpose(), a8.width, a8.height, -0.5,-0.5,2*a8.width+.001,2*a8.height+.001)
            
    elif aa == "eedi3":
        a8 = Resize(core.eedi3.eedi3(a8, field=1,dh=True).std.Transpose().eedi3.eedi3(field=1,dh=True).std.Transpose(), a8.width, a8.height, -0.5,-0.5,2*a8.width+.001,2*a8.height+.001)
            
    elif aa == "eedi2":
        a8 = Resize(core.eedi2.EEDI2(a8, field=1,dh=True).std.Transpose().eedi2.EEDI2(field=1,dh=True).std.Transpose(), a8.width, a8.height, -0.5,-0.5,2*a8.width+.001,2*a8.height+.001)
        
        #To-Do rewrite eedix+sangnom2 combo to not throw away good field
    elif aa == "eedi2+sangnom2":
        a8 = Resize(core.std.Transpose(core.sangnom.SangNomMod(core.std.Transpose(core.sangnom.SangNomMod(core.std.Transpose(core.eedi2.EEDI2(core.std.Transpose(core.eedi2.EEDI2(a8, field=1,dh=True)), field=1,dh=True)),aac=aac)),aac=aac)), a8.width, a8.height, -0.5,-0.5,2*a8.width+.001,2*a8.height+.001)
        
    elif aa == "eedi3+sangnom2":
        a8 = Resize(core.std.Transpose(core.sangnom.SangNomMod(core.std.Transpose(core.sangnom.SangNomMod(core.std.Transpose(core.eedi3.eedi3(core.std.Transpose(core.eedi3.eedi3(a8, field=1,dh=True)), field=1,dh=True)),aac=aac)),aac=aac)), a8.width, a8.height, -0.5,-0.5,2*a8.width+.001,2*a8.height+.001)
        
    else:
        a8 = core.sangnom.SangNomMod(a8,aac=aac).std.Transpose().sangnom.SangNomMod(aac=aac).std.Transpose()
  
    if ss != 1:
        a8 = Resize(a8, c.width, c.height)

    if edibits > 8:
        a8 = core.fmtc.bitdepth(a8,bits=edibits)
        if isinstance(mask, vs.VideoNode):
            mask = core.fmtc.bitdepth(mask,bits=edibits)


    if isinstance(mask, vs.VideoNode):
        return core.std.MaskedMerge(c,a8,mask)
        
		 
    return a8
开发者ID:BakaProxy,项目名称:Baka-Utilities,代码行数:60,代码来源:bakafunc.py


示例14: BlurLoop

def BlurLoop(c, x, planes=[0]):
    
    if c.format.color_family != vs.GRAY:
        rg = [0,0,0]
        if 0 in planes:
            rg[0] = 12
        else:
            rg[0] = 0
            
        if 1 in planes:
            rg[1] = 12
        else:
            rg[1] = 0
            
        if 2 in planes:
            rg[2] = 12
        else:
            rg[2] = 0
    else:
        rg = [12]
        
        
    core = vs.get_core()
    
    for y in range(0, x):
        c = core.rgvs.RemoveGrain(c, rg)
        
    return c
开发者ID:BakaProxy,项目名称:Baka-Utilities,代码行数:28,代码来源:bakafunc.py


示例15: replace_range

def replace_range(clip1, clip2, start, end=None):
    """ Replaces a range of frames of a clip with the same range of
    frames from another clip.
    If no end frame is given, it will only replace the start frame.
    """
    core = vs.get_core()

    if end is None:
        end = start

    if start < 0 or start > clip1.num_frames - 1:
        raise ValueError('start frame out of bounds: {}.'.format(start))
    if end < start or end > clip1.num_frames - 1:
        raise ValueError('end frame out of bounds: {}.'.format(end))

    if start > 0:
        temp = 'core.std.Trim(clip1, 0, start - 1) + '
    else:
        temp = ''
    temp += 'core.std.Trim(clip2, start, end)'
    if end < clip1.num_frames - 1:
        temp += '+ core.std.Trim(clip1, end + 1)'

    final = eval(temp)

    if clip1.num_frames != final.num_frames:
        raise ValueError('input / output framecount missmatch (got: {}; expected: {}).'
                         .format(final.num_frames, clip1.num_frames))

    return final
开发者ID:darcyg,项目名称:vapoursynth-plugins,代码行数:30,代码来源:scoll.py


示例16: move

def move(clips, x, y):
    core = vs.get_core()

    moved = None

    for clip in clips:
        if clip.format.num_planes == 1:
            color = [(2 ** clip.format.bits_per_sample) - 1]
        else:
            color = None

        if x != 0 or y != 0:
            if x >= 0:
                right = 0
                left = x
            else:
                right = abs(x)
                left = 0
            if y >= 0:
                top = 0
                bottom = y
            else:
                top = abs(y)
                bottom = 0

            clip = core.std.AddBorders(clip=clip, left=left, right=right, top=top, bottom=bottom, color=color)
            clip = core.std.CropRel(clip=clip, left=right, right=left, top=bottom, bottom=top)

        if clip is isinstance(list()):
            moved.append(clip)
        else:
            moved = clip

    return moved
开发者ID:darcyg,项目名称:vapoursynth-plugins,代码行数:34,代码来源:vshelpers.py


示例17: delete_range

def delete_range(src, start, end=None):
    """ Deletes a range of frames from a clip.
    If no end frame is given, it will only delete the start frame.
    """
    core = vs.get_core()

    if end is None:
        end = start

    if start < 0 or start > src.num_frames - 1:
        raise ValueError('start frame out of bounds: {}.'.format(start))
    if end < start or end > src.num_frames - 1:
        raise ValueError('end frame out of bounds: {}.'.format(end))

    if start != 0:
        final = src[:start]
        if end < src.num_frames - 1:
            final = final + src[end + 1:]
    else:
        final = src[end + 1:]

    if src.num_frames != final.num_frames + (end - start + 1):
        raise ValueError('output expected framecount missmatch.')

    return final
开发者ID:darcyg,项目名称:vapoursynth-plugins,代码行数:25,代码来源:scoll.py


示例18: subtract

def subtract(c1, c2, luma=126, planes=[0]):
    core = vs.get_core()

    expr = ('{luma} x + y -').format(luma=luma)
    expr = [(i in planes) * expr for i in range(c1.format.num_planes)]

    return core.std.Expr([c1, c2], expr)
开发者ID:darcyg,项目名称:vapoursynth-plugins,代码行数:7,代码来源:vshelpers.py


示例19: padding

def padding (src, left=0, right=0, top=0, bottom=0):
    core            = vs.get_core ()
    resample        = core.fmtc.resample
    w               = src.width
    h               = src.height
    clip            = resample (src, w+left+right, h+top+bottom, -left, -top, w+left+right, h+top+bottom, kernel="point", **fmtc_args)
    return clip
开发者ID:IFeelBloated,项目名称:BlockMatchingToolkit,代码行数:7,代码来源:BMToolkit.py


示例20: fit

def fit(clipa, clipb):
    core = vs.get_core()

    bd = clipb.format.bits_per_sample
    max_ = 2 ** bd - 1
    mid = (max_ + 1) // 2

    if clipb.format.num_planes > 1:
        if clipb.format.color_family == vs.RGB:
            color = [max_, max_, max_]
        else:
            color = [max_, mid, mid]
    else:
        color = [max_]

    if clipa.width > clipb.width:
        clipb = core.std.AddBorders(clip=clipb, left=0, right=clipa.width - clipb.width, color=color)
    elif clipa.width < clipb.width:
        clipb = core.std.CropRel(clip=clipb, left=0, right=clipb.width - clipa.width)

    if clipa.height > clipb.height:
        clipb = core.std.AddBorders(clip=clipb, top=0, bottom=clipa.height - clipb.height, color=color)
    elif clipa.height < clipb.height:
        clipb = core.std.CropRel(clip=clipb, top=0, bottom=clipb.height - clipa.height)

    return clipb
开发者ID:darcyg,项目名称:vapoursynth-plugins,代码行数:26,代码来源:vshelpers.py



注:本文中的vapoursynth.get_core函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python variable_functions.my_attribute_label函数代码示例发布时间:2022-05-26
下一篇:
Python core.handle_request函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap