Exemplo n.º 1
0
gambo2 = gambo2.std.Crop(left=34, right=62)
gambo2 = gambo2[13:]

gambo = gambo2[:121] + gambo[118:]

gambo = gambo[:4506]

gambo = fvf.GradFun3(gambo,
                     thr=0.35,
                     radius=12,
                     elast=8.0,
                     mode=3,
                     ampo=1,
                     ampn=0,
                     pat=32,
                     dyn=False,
                     staticnoise=False,
                     thr_det=2 + round(max(1 - 0.35, 0) / 0.3),
                     debug=False,
                     thrc=1,
                     radiusc=12,
                     planes=list(range(gambo.format.num_planes)),
                     ref=gambo,
                     bits=gambo.format.bits_per_sample)
gambo = core.asharp.ASharp(gambo)
gambo = haf.FineDehalo(gambo)

gambo = taa.TAAmbk(gambo, "Nnedi3SangNom")

gambo = gambo.resize.Bicubic(height=844,
                             width=int(gambo.width / gambo.height * 844 + 0.5))
Exemplo n.º 2
0
def faggotdb_mod(clip: vs.VideoNode,
                 thrY=40,
                 thrC=None,
                 radiusY=15,
                 radiusC=15,
                 CbY=44,
                 CrY=44,
                 CbC=44,
                 CrC=44,
                 grainY=32,
                 grainC=None,
                 grainCC=0,
                 sample_mode=2,
                 neo=True,
                 dynamic_grainY=False,
                 dynamic_grainC=False,
                 tv_range=True,
                 mask="retinex",
                 binarize=False,
                 binarize_thr=70,
                 grayscale=True,
                 bitresamp=False,
                 outbits=None,
                 blurmask=True,
                 horizblur=2,
                 vertblur=2) -> vs.VideoNode:

    funcName = "faggotdb_mod"  # name kept to be fallback compatible

    # Original Idea: Author who created Fag3kdb. Edited by AlucardSama04; additional modifications by l00t

    if not isinstance(clip, vs.VideoNode):
        raise TypeError(f"{funcName}: This is not a clip")

    if outbits is None:
        outbits = clip.format.bits_per_sample

    if bitresamp:
        if clip.format.bits_per_sample != outbits:
            clip = fvf.Depth(
                clip,
                bits=outbits)  # instead of error, auto convert to 16 bits
    elif clip.format.bits_per_sample != outbits:
        raise TypeError(f"{funcName}: Input-output bitdepth mismatch")

    # if not isinstance(mask, vs.VideoNode):
    # raise vs.Error(f"{funcName}: mask' only clip inputs")

    if mask in [-1]:  # more user friendly if we do the masking intentionally
        mask = clip
        blurmask = False
    elif mask in [0, "retinex"]:
        mask = kgf.retinex_edgemask(clip)
    elif mask in [1, "kirsch"]:
        mask = kgf.kirsch(clip)
    elif mask in [2, "Sobel"]:
        mask = core.std.Sobel(clip, scale=1)
    elif mask in [3, "Prewitt"]:
        mask = core.std.Prewitt(clip)
    elif mask in [4, "GF"]:
        mask = fvf.GradFun3(clip, mask=2, debug=1)
    else:
        raise ValueError(f"{funcName}: Unknown Mask Mode")

    if grayscale:
        mask = core.std.ShufflePlanes(mask, planes=0, colorfamily=vs.GRAY)

    if binarize:  # binarize threshold should be adjusted according to bitdepth
        mask = core.std.Binarize(mask, threshold=binarize_thr)

    if blurmask:
        mask = core.std.BoxBlur(mask, hradius=horizblur, vradius=vertblur)

    if thrC is None:
        thrC = int(round(thrY / 2))

    if grainC is None:
        grainC = int(round(grainY / 2))

    if grainCC is None:
        grainCC = 0

    f3kdb = core.neo_f3kdb.Deband if neo else core.f3kdb.Deband

    U = plane(clip, 1)
    V = plane(clip, 2)

    U = f3kdb(U,
              range=radiusC,
              y=thrC,
              cb=CbC,
              cr=CrC,
              grainy=grainC,
              grainc=0,
              sample_mode=sample_mode,
              dynamic_grain=dynamic_grainC,
              keep_tv_range=tv_range,
              output_depth=outbits)

    V = f3kdb(V,
              range=radiusC,
              y=thrC,
              cb=CbC,
              cr=CrC,
              grainy=grainC,
              grainc=0,
              sample_mode=sample_mode,
              dynamic_grain=dynamic_grainC,
              keep_tv_range=tv_range,
              output_depth=outbits)

    filtered = core.std.ShufflePlanes([clip, U, V], [0, 0, 0], vs.YUV)

    filtered = f3kdb(filtered,
                     range=radiusY,
                     y=thrY,
                     cb=CbY,
                     cr=CrY,
                     grainy=grainY,
                     grainc=grainCC,
                     sample_mode=sample_mode,
                     dynamic_grain=dynamic_grainY,
                     keep_tv_range=tv_range,
                     output_depth=outbits
                     )  # if grainCC > 0 UV planes will be debanded once again

    return core.std.MaskedMerge(filtered, clip, mask)