コード例 #1
0
def DebandReader(clip, csvfile, range=30, delimiter=' ', mask=None, luma_scaling=15):
    """
    DebandReader, read a csv file to apply a f3kdb filter for given strengths and frames. From awsmfunc.
    > Usage: DebandReader(clip, csvfile, grain, range)
      * csvfile is the path to a csv file containing in each row: <startframe> <endframe> <<strength_y>,**<strength_b>,**<strength_r>> <grain strength> <mask>
      * mask is the mask list you want to apply. it should be in a list
      * range is passed as range in the f3kdb filter
    """
    import csv

    filtered = clip if get_depth(clip) <= 16 else Depth(clip, 16)
    depth = get_depth(clip)

    with open(csvfile) as debandcsv:
        csvzones = csv.reader(debandcsv, delimiter=delimiter)
        for row in csvzones:
            clip_mask = int(row[4])
            strength = row[2].split(',')
            while len(strength) < 3:
                strength.append(strength[-1])
            grain_strength = float(row[3])
            db = core.f3kdb.Deband(clip, y=strength[0], cb=strength[1], cr=strength[2], grainy=0, grainc=0,
                                   range=range, output_depth=depth)
            db = agm.adptvgrnMod(db, luma_scaling=luma_scaling, strength=grain_strength)
            filtered = awf.ReplaceFrames(filtered, db, mappings="[" + row[0] + " " + row[1] + "]")
            if mask:
                filtered = core.std.MaskedMerge(filtered, clip, mask[clip_mask])

    return filtered
コード例 #2
0
def creditlessvfm(clip):
    a = clip[:120].vivtc.VFM(1)
    b = clip[120:230].nnedi3cl.NNEDI3CL(1)
    c = clip[230:].vivtc.VFM(1)

    clip = a + b + c
    vinv = clip.vinverse.Vinverse()

    clip = awf.ReplaceFrames(
        vinv, core.nnedi3cl.NNEDI3CL(clip, field=1),
        "230 266 668 949 953 957 961 962 1091 1151 1580 1611 1638 1826 1858 2006 2133 2341 2385 2447 2585 2608 2620 2626 2634 2646 2658 2664 2669 2671"
    )
    return clip
コード例 #3
0
def creditedvfm(clip):
    a = clip[:120].vivtc.VFM(1)
    b = clip[120:230].nnedi3cl.NNEDI3CL(1)
    c = clip[230:].vivtc.VFM(1)

    clip = a + b + c
    vinv = clip.vinverse.Vinverse()
    nnedi = core.nnedi3cl.NNEDI3CL(clip, field=1)

    clip = awf.ReplaceFrames(
        vinv, nnedi,
        "230 266 668 901 949 953 954 957 961 962 1091 1151 1580 [1582 1588] [1590 1599] 1600 1605 1608 1611 1638 1826 1858 2006 2012 2015 2133 2341 2385 2447 2585 2608 2620 2626 2634 2646 2658 2664 2669 2671 [2673 2675]"
    )
    return clip
コード例 #4
0
from vapoursynth import core
import awsmfunc as awf
import havsfunc as haf

fbi_story = core.d2v.Source("THE_FBI_STORY/VTS_01_1.d2v")
fbi_story = core.vivtc.VFM(fbi_story, 1)
fbi_story = awf.ReplaceFrames(
    core.std.SelectEvery(fbi_story, cycle=5, offsets=[0, 1, 2, 4]),
    core.std.SelectEvery(fbi_story, cycle=5, offsets=[0, 1, 2, 3]),
    f"[0 127490]")
fbi_story = haf.Deblock_QED(fbi_story)

fbi_story.set_output()
コード例 #5
0
        fvf.Depth(
            awf.bbmod(fvf.AutoDeblock(src.vinverse.Vinverse(),
                                      adb1=0.2,
                                      adb2=0.8,
                                      adb1d=0.1,
                                      adb2d=1.4),
                      top=6,
                      bottom=4,
                      thresh=4,
                      blur=6), 16))

average = core.average.Mean(lyokos)
average = average.std.Crop(top=2, bottom=2, left=2, right=2)

lyoko = lvf.aa.upscaled_sraa(average, rfactor=2.0, rep=True)

deband = lyoko.f3kdb.Deband(range=2, grainy=16, grainc=16)

deband = awf.ReplaceFrames(deband,
                           lyoko.f3kdb.Deband(range=15, grainy=32, grainc=32),
                           "[417 425]")
deband = awf.ReplaceFrames(deband, lyoko, "435")

lyoko = awf.ReplaceFrames(
    deband, G41Fun.MaskedDHA(deband, rx=1.8, ry=1.8, darkstr=0.0, lowsens=70),
    "[384 420] [474 551] [606 673] [728 785]")
lyoko = fvf.Depth(lyoko, 10)

lyoko = lyoko[5:]
lyoko.set_output()
コード例 #6
0
ファイル: S01E01-lolichad.py プロジェクト: po5/encoderino
cunny = awf.fb(cunny, top=1)
cunny = cunny.resize.Bicubic(src_top=1)
cunny = cunny.fb.FillBorders(top=1, bottom=1, mode="fixborders")
cunny = cunny.vinverse.Vinverse()
black = core.tcm.TColorMask(cunny.std.Minimum(), ["$000000"],
                            tolerance=7,
                            bt601=True,
                            gray=False,
                            lutthr=9)
cunny = rektlvls(cunny, colnum=[1, 709], colval=[-9, 35])
aa = taa.TAAmbk(cunny, "Nnedi3")
sangnom = taa.TAAmbk(cunny, "Nnedi3SangNom")
mask = kgf.retinex_edgemask(cunny).std.Binarize(200).std.Deflate(threshold=250)
cunny = cunny.placebo.Deband(threshold=6, radius=16, grain=4)
cunny = awf.ReplaceFrames(core.std.MaskedMerge(cunny, aa, mask),
                          core.std.MaskedMerge(cunny, sangnom, mask),
                          "[4708 4850] [5290 5421] [5542 5698] [5770 5803]")
no_bbmod = cunny
censor = cunny.fb.FillBorders(top=2, mode="fixborders")
censor = awf.bbmod(censor, top=4, thresh=200, blur=10)
censor = awf.bbmod(censor, right=4, thresh=2, blur=5)
censor = awf.bbmod(censor, left=4, thresh=6, blur=8)
censor = awf.bbmod(censor, right=1)
cunny = awf.bbmod(cunny, right=4, top=4, thresh=2, blur=5)
cunny = awf.bbmod(cunny, left=4, thresh=6, blur=8)
cunny = awf.bbmod(cunny, right=1)
cunny = core.std.MaskedMerge(cunny, no_bbmod, black)
cunny = awf.ReplaceFrames(cunny, no_bbmod, "[0 15] [42581 44935]")
cunny = awf.ReplaceFrames(cunny, censor, "[38311 38485]")
cunny.set_output()
コード例 #7
0
ファイル: hattoushin.py プロジェクト: po5/encoderino
head_start = -1

hattoushin_id = 12

head_first = True

for frame in range(fc):
    if head_start >= frame:
        continue

    head_end = frame
    if hattoushin_id not in heads:
        heads[hattoushin_id] = ""
    if head_first:
        head_end = 2
    head_first = False
    heads[hattoushin_id] += f"{frame} "
    head_start = head_end
    hattoushin_id += 1
    if hattoushin_id > 12:
        hattoushin_id = 1

for rng, frames in heads.items():
    hattoushin = awf.ReplaceFrames(hattoushin, core.std.AssumeFPS(core.imwri.Read(f"吹っ切れた/furifuri/fuirfuir-{rng:02}.png")*fc, fpsnum=15), frames)

hattoushin = core.std.AssumeFPS(hattoushin, fpsnum=15)

hattoushin = hattoushin.resize.Point(format=YUV420P8, matrix_s="709")[3:1353]

hattoushin.set_output()
コード例 #8
0
import awsmfunc as awf
import havsfunc as haf
import fvsfunc as fvf
import lvsfunc as lvf
import G41Fun

ep = 1

lyoko = core.lsmas.LWLibavSource(
    f"Code.Lyoko.S01E{ep:02}.DVD.Remux.Multi-Odd_HD.mkv")
lyoko = lyoko.std.AssumeFPS(fpsnum=25)
lyoko = lyoko.std.Crop(top=2, bottom=2, left=10, right=8)
lyoko = awf.fb(lyoko, left=1, right=1)

no_deblock = lyoko
lyoko = fvf.AutoDeblock(lyoko)
lyoko = haf.Deblock_QED(lyoko)
lyoko = awf.ReplaceFrames(lyoko, no_deblock, "[4864 4942]")

lyoko = awf.bbmod(lyoko, top=6, bottom=6, thresh=2, blur=5)
lyoko = lvf.aa.upscaled_sraa(lyoko, rfactor=3.0, rep=True)
lyoko = lyoko.vinverse.Vinverse()

no_deband = lyoko
lyoko = lyoko.placebo.Deband(radius=8, threshold=1.0)
lyoko = awf.ReplaceFrames(lyoko, no_deband, "[4864 4942]")

lyoko = G41Fun.MaskedDHA(lyoko, rx=1.8, ry=1.8, darkstr=0.0, lowsens=70)

lyoko.set_output()
コード例 #9
0
ファイル: S01E02-XC.py プロジェクト: po5/encoderino
import fvsfunc as fvf
import lvsfunc as lvf
import G41Fun

ep = 2

source = core.lsmas.LWLibavSource(
    f"Code.Lyoko.S01E{ep:02}.DVD.Remux.Multi-Odd_HD.mkv")[1130:]
source = source.std.AssumeFPS(fpsnum=25)
source = source.std.Crop(top=6, bottom=2, left=10, right=8)
lyoko = awf.fb(source, left=1, right=1)
lyoko = lyoko.vinverse.Vinverse()
lyoko = fvf.Depth(lyoko, 16)
no_filter = lyoko
lyoko = awf.bbmod(lyoko, top=4, bottom=4, thresh=4, blur=4)
lyoko = fvf.AutoDeblock(lyoko, adb1=0.4, adb2=0.1, adb1d=0.3, adb2d=1.4)
aa2 = lvf.aa.upscaled_sraa(lyoko, rfactor=2.0, rep=True)
lyoko = lvf.aa.upscaled_sraa(lyoko, rfactor=3.0, rep=True)
lyoko = G41Fun.MaskedDHA(lyoko, rx=1.4, ry=1.4, darkstr=0.0, lowsens=70)
lyoko = awf.ReplaceFrames(
    lyoko, aa2,
    "[4189 4238] [4931 5386] [6796 6845] [9084 9133] [14670 14876] [16507 16556] [19215 19512] [19560 19662] [21924 22287] [22348 22486] [22577 22751] [23495 23843] [24354 25444] [25498 26806] [26950 27304] [27947 28648] [28751 29253] [29421 29768] [29824 29905] [30008 30104] [30250 30304] [30391 30419] [30506 30590] [30659 30699] [31071 31323]"
)
lyoko = lyoko.f3kdb.Deband(range=2, grainy=16, grainc=16)
lyoko = fvf.ReplaceFrames(haf.Deblock_QED(no_filter), lyoko,
                          "[0 33399] [33650 33655]")

lyoko = fvf.Depth(lyoko, 10)

lyoko.set_output()
コード例 #10
0
                      weight=[0.4, 0.6])

aa = core.std.Expr([lvf.aa.upscaled_sraa(dpir, rfactor=1.8), dpir], "x y min")
aa = core.std.Merge(lvf.aa.upscaled_sraa(aa, rfactor=2.2),
                    aa,
                    weight=[0.9, 0.1])

dpir = debandshit.dumb3kdb(aa.resize.Bicubic(format=YUV420P10,
                                             matrix_s="170m",
                                             dither_type="error_diffusion"),
                           threshold=40,
                           output_depth=10)

# freeze framing to frame +1
dpir = awf.ReplaceFrames(
    dpir, dpir[1:],
    "1154 1262 1341 1441 1522 1573 1609 1835 2357 2405 2477 2525 2530 2633 2688 3235 3283 3499 3978 4170 4174 4176 4207 4363 4425 4477 4645 4764 4773 4812 4849 5124 5143 5233 5285"
)  # 3978 is questionable
# freeze framing to frame +2
dpir = awf.ReplaceFrames(
    dpir, dpir[2:],
    "1153 1261 1608 1834 2356 2404 2476 2524 2632 3234 3282 3498 4169 4173 4206 4362 4476 4644 4848 5142 5232"
)
# freeze framing to frame -1
dpir = awf.ReplaceFrames(
    dpir, dpir[0] + dpir,
    "1338 1340 1606 1976 2402 2475 2523 2631 2687 3281 3497 3904 4204 4360 4421 4474 4762 4846 4913 5146"
)
# freeze framing to frame -2
dpir = awf.ReplaceFrames(dpir, dpir[:2] + dpir,
                         "1607 1977 2403 3905 4205 4361 4475 4763 4847 5147")
# apartment guide
コード例 #11
0
ファイル: S01E02-lolichad.py プロジェクト: po5/encoderino
cunny = cunny.vivtc.VFM(1)
cunny = cunny.vivtc.VDecimate()
cunny = cunny[:41832]
cunny = cunny.std.Crop(left=6, right=4)
cunny = awf.fb(cunny, top=1)
cunny = cunny.resize.Bicubic(src_top=1)
cunny = cunny.fb.FillBorders(top=1, bottom=1, mode="fixborders")
cunny = cunny.vinverse.Vinverse()
no_rekt = cunny
black = core.tcm.TColorMask(cunny.std.Minimum(), ["$000000"],
                            tolerance=7,
                            bt601=True,
                            gray=False,
                            lutthr=9)
cunny = rektlvls(cunny, colnum=[1, 709], colval=[-9, 35])
cunny = awf.ReplaceFrames(cunny, no_rekt, "[0 11] [1485 1554] [38678 41831]")
aa = taa.TAAmbk(cunny, "Nnedi3")
sangnom = taa.TAAmbk(cunny, "Nnedi3SangNom")
mask = kgf.retinex_edgemask(cunny).std.Binarize(200).std.Deflate(threshold=250)
cunny = cunny.placebo.Deband(threshold=6, radius=16, grain=4)
cunny = awf.ReplaceFrames(
    core.std.MaskedMerge(cunny, aa, mask),
    core.std.MaskedMerge(cunny, sangnom, mask),
    "[1329 1501] [29378 29568] [31140 31499] [32495 32656]")
no_bbmod = cunny
cunny = awf.bbmod(cunny, right=4, top=4, thresh=2, blur=5)
cunny = awf.bbmod(cunny, left=4, thresh=6, blur=8)
cunny = awf.bbmod(cunny, right=1)
cunny = core.std.MaskedMerge(cunny, no_bbmod, black)
cunny = awf.ReplaceFrames(cunny, no_bbmod, "[0 11] [38678 41831]")
cunny.set_output()
コード例 #12
0
        heads[teto_id] = ""
    if head_first:
        head_end = 2
    head_first = False
    heads[teto_id] += f"[{frame} {head_end}] "
    head_start = head_end
    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1,2,2,3,2,5,5,1,1,1,0,0,2,3,2,2,1,2,3,2,2,2,2,0,0,2,0,4,4,4,5,5,5,3,2,2,4,4,4,2,2,2,2,3,2,2,2,2,2,3,3,3,3,2,3,3,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,5,2,3,4,3,4,4,0,2,2,2,2,1,2,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]

for rng, frames in heads.items():
    out = awf.ReplaceFrames(out, owoverlay(tiled, f"teto/colored/heads/tetoB0{rng:02}.png"), frames)
    for start, end in ast.literal_eval("["+frames.replace(" ", ",")+"]"):
        try:
            mouth_id = mouths_lookup[start // 6]
        except Exception:
            mouth_id = 0
        out = awf.ReplaceFrames(out, owoverlay(out, f"teto/v3/colored/tetoB0{rng:02}/(invalid UTF-8 string) #6/tetoB{mouth_id}{rng:02}.png"), f"[{start} {end}]")

out = out[:6712] + out[6712]*38

for rng, frames in hattoushin.items():
    cat, cat_mask = core.imwri.Read(f"teto/colored/bigcat-fix/{rng:03}.png", alpha=True)
    cat = shifteroo(resizeroo(cat.std.Crop(bottom=208), width=136, height=132), left=1)
    cat_mask = shifteroo(resizeroo(cat_mask.std.Crop(bottom=208), width=136, height=132), left=1)
    out = awf.ReplaceFrames(out, haf.Overlay(out, cat, y=out.height-cat.height, mask=cat_mask), frames)
コード例 #13
0
    1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
]

mask = core.imwri.Read("catmask2.png", alpha=True)
mask = core.std.ShufflePlanes(clips=mask[0], planes=0, colorfamily=GRAY)

for rng, frames in heads.items():
    for start, end in ast.literal_eval("[" + frames.replace(" ", ",") + "]"):
        try:
            mouth_id = mouths_lookup[start // 6]
        except Exception:
            mouth_id = 0
        out = awf.ReplaceFrames(
            out,
            core.std.AssumeFPS(core.imwri.Read(
                f"myteto/v3/sketch/tetoB{mouth_id}{rng:02}.png") * fc,
                               fpsnum=75),
            f"[{start} {end}]")  # use a cache here?

for rng, frames in hattoushin.items():
    cat = shifteroo(resizeroo(
        core.imwri.Read(f"吹っ切れた/furifuri/fuirfuir-{rng:02}.png").std.Crop(
            bottom=208),
        width=136,
        height=132),
                    left=1)
    out = awf.ReplaceFrames(
        out, haf.Overlay(out, cat, y=out.height - cat.height, mask=mask),
        frames)

f****d = out.resize.Point(format=YUV420P8, matrix_s="170m")
コード例 #14
0
from vapoursynth import core
import awsmfunc as awf
import havsfunc as haf
import muvsfunc as muf
import vsTAAmbk as taa

src = core.lsmas.LWLibavSource("VBR.mkv")
src = src[:54023]
sr = muf.Cdeblend(src, omode=3)
sr = awf.ReplaceFrames(sr, src, "[0 441] [2791 2793] [2796 2797] [2807 2808] [2937 2951] [3006 3048] [4193 4228] [4981 4994] [5042 5146] [5358 5431] [51869 54022]")
sr = sr.placebo.Deband(threshold=3, radius=8, grain=0)
sr = taa.TAAmbk(sr, "Nnedi3SangNom")
dehalo = haf.DeHalo_alpha(sr)

dehalo.set_output()
コード例 #15
0
eds.append(sp5[3])

for disc in [sp2, sp3, sp4]:
    eds.append(disc[13])

worst_to_best = [
    eds[7], eds[10], eds[2], eds[3], eds[1], eds[9], eds[4], eds[0], eds[8],
    eds[11], eds[6], eds[5]
]

merged = nced
merged = awf.ReplaceFrames(
    merged,
    core.std.Levels(merged,
                    min_in=0,
                    max_in=255,
                    min_out=0,
                    max_out=249,
                    planes=0), "[120 229] [668 726]")
merged = awf.ReplaceFrames(
    merged,
    core.std.Levels(merged,
                    min_in=0,
                    max_in=255,
                    min_out=0,
                    max_out=249,
                    planes=0), "[726 775]")
merged = awf.ReplaceFrames(
    merged,
    core.std.Levels(merged,
                    min_in=0,
コード例 #16
0
ファイル: S02E01-XC.py プロジェクト: po5/encoderino
from vapoursynth import core, GRAY, YUV, YUV444P16, YUV420P10
import awsmfunc as awf
import lvsfunc as lvf
import havsfunc as haf
import vardefunc as vdf
from rekt import rektlvls

src = core.ffms2.Source("[SubsPlease] Nomad - Megalo Box 2 - 01 (1080p) [99D681F1].mkv")
fb = rektlvls(src, colnum=[0, 1919], colval=[15, 15])
fb = rektlvls(fb, rownum=[0, 1079], rowval=[16, 16])
descale = lvf.scale.descale(fb, upscaler=None, height=720, kernel=lvf.kernels.Bicubic(b=0, c=1))
descale = lvf.scale.descale(descale, upscaler=None, height=405, kernel=lvf.kernels.Bicubic(b=0, c=1/2))
downscale = fb.resize.Spline36(width=descale.width, height=descale.height, format=YUV444P16)
descale = descale.resize.Spline36(format=YUV444P16)
u = core.std.ShufflePlanes(downscale, planes=[1], colorfamily=GRAY)
v = core.std.ShufflePlanes(downscale, planes=[2], colorfamily=GRAY)
descale = core.std.ShufflePlanes([descale, u, v], planes=[0, 0, 0], colorfamily=YUV)
deband = descale.placebo.Deband(threshold=3, radius=8, grain=0)
rescale = vdf.fsrcnnx_upscale(deband, 1920, 1080, shader_file="FSRCNNX_x2_56-16-4-1.glsl").resize.Spline36(1920, 1080)
rescale = vdf.merge_chroma(rescale, deband.resize.Spline36(width=1920, height=1080))
rescale = awf.ReplaceFrames(rescale, haf.Deblock_QED(src).placebo.Deband(threshold=3, radius=8, grain=0).resize.Spline36(format=YUV444P16), "[0 167] [662 757] [806 901] [950 1045] [1130 1125] [1418 1513] [2514 2637] [32698 34694]")
rescale = awf.ReplaceFrames(rescale, fb.placebo.Deband(threshold=3, radius=8, grain=0).resize.Spline36(format=YUV444P16), "[168 601] [25058 25185]")
rescale = rescale.resize.Spline36(format=YUV420P10, dither_type="error_diffusion")

rescale.set_output()
コード例 #17
0
aa = core.std.Expr([lvf.aa.upscaled_sraa(opfix, rfactor=1.8), opfix],
                   "x y min")
aa = core.std.Merge(lvf.aa.upscaled_sraa(aa, rfactor=2.2),
                    aa,
                    weight=[0.9, 0.1])

dpir = debandshit.dumb3kdb(aa.resize.Bicubic(format=YUV420P10,
                                             matrix_s="170m",
                                             dither_type="error_diffusion"),
                           threshold=40,
                           output_depth=10)

# freeze framing to frame +1
dpir = awf.ReplaceFrames(
    dpir, dpir[1:],
    "312 382 405 446 463 484 486 488 521 523 525 527 529 551 554 556 558 560 562 639 641 643 647 649 651 655 657 659 700 702 704 706 708 1059"
)  # 312 is questionable
# freeze framing to frame +2
dpir = awf.ReplaceFrames(dpir, dpir[2:],
                         "311 381 445 483 520 550")  # 311 is questionable
# freeze framing to frame -1
dpir = awf.ReplaceFrames(dpir, dpir[0] + dpir,
                         "249 267 310 316 342 410 549")  # 316 is questionable
# freeze framing to frame -2
dpir = awf.ReplaceFrames(dpir, dpir[:2] + dpir, "343")

title = core.imwri.Read("title/final-digi-op1_268-fix.png").resize.Bicubic(
    format=YUV420P10, matrix_s="170m", dither_type="error_diffusion")
title = title.std.AssumeFPS(dpir)
dpir = awf.ReplaceFrames(dpir, title * 269, "268")