Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 23rd April 2022, 14:09   #1101  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,351
I updated a few scripts today. Wanted to call out Boulder as I updated TransformsPack so now 'SSIM2' works over there or deep_resize().
deep_resize() also supports now ratio resize, so deep_resize(2) will mean to double the size, likewise deep_resize(0.5) is halving the size.

As I said I finally added accumulated scene stats to SoftLimiter, making the limiting work on a per-scene basis.
My plan is to include per-scene filtering in more functions so if you have a request for one of my filters let me know.

Now all the scripts are up-to-date with internal (oops, nope, ExTools needs a minor update). From now on I will add global stats parser to SceneStats, work on Zopti optimizations and finally finish TransformsPack final.
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread

Last edited by Dogway; 23rd April 2022 at 14:14.
Dogway is offline   Reply With Quote
Old 23rd April 2022, 14:17   #1102  |  Link
Shinkiro
Registered User
 
Join Date: Dec 2012
Posts: 65
Quote:
Originally Posted by kedautinh12 View Post
Can you share script you were change to expr??
Code:
setmemorymax(6000)
ffms2("video.mkv",cache=true)

ContinuityFixer(left=4, top=0, right=5, bottom=0, radius=0)
FillBorders(left=3,top=0, right=4, bottom=0, mode=0, y=2, u=3, v=3)
EdgeCleaner(strength=10, rep=false, rmode=17, smode=0, hot=false)

W=1920
H=1080
nnedi3_rpow2(rfactor=2, nsize=0, nns=4, qual=2, etype=0, pscrn=4, cshift="spline36resize", threads=8)
Blackmanresize(W, H, taps=4,0,0,-0,0)
ConvertTo16bit()

mthr = 16
bi = BitsPerComponent(last)
mthrHBD = ex_bs(mthr, 8, bi, true)
mlight1=last.flatmask(2, scale=5.0, lo=4, MSR=70, invert=false)
mdark1=last.flatmask(3, scale=7.0, lo=4, MSR=50, invert=false)
mask=last.ConditionalFilter(mlight1, mdark1, "AverageLuma()",">","60").ex_lut(Format("x {mthrHBD} <= x 0.5 * x 2 * ?"), UV=1).RemoveGrain((W>960) ? 20 : 11, -1)

deg1 = last.SMDegrain(tr=3,thSAD=340, thSADC=150, thSCD1=250,thSCD2=96, contrasharp=false, refinemotion=true, chroma=true, plane=4)
deg2 = last.SMDegrain(tr=2,thSAD=121, thSADC=50, thSCD1=156,thSCD2=96, contrasharp=false, refinemotion=true, chroma=true, plane=4)
deg=ConditionalFilter(deg1, deg2, "AverageLuma()",">","60")
ex_merge(deg ,last ,mask, luma=true, Y=3, UV=3)

LSFmod(ss_x=1.0,ss_y=1.0,strength=4,Smode=5)
FineDehalo(rx=2.8, ry=2.8, thmi=80, thma=128, thlimi=50, thlima=100, darkstr=0.0, brightstr=1.0, showmask=0, contra=0.0, excl=true)#.aWarpSharp2(depth=2)

db=last.neo_f3kdb(sample_mode=2, Y=64, Cb=64, Cr=64, grainy=44, grainC=0, range=15, dynamic_grain=false)
ex_merge(db, last, mask, luma=true, Y=3, UV=3) # пкрвый клип  (дебандинг) второй клип(чистые линии) 

z_ConvertFormat(colorspace_op="470bg:601:470bg:f=>709:709:709:f",dither_type="none")
ConvertBits(bits=10)
Prefetch(8)
__________________
Ryzen 2700x | ASUS ROG Strix GTX 1080 Ti | 16 Gb DDR4
Windows 10 x64 20H2
KD-55XE9005 | Edifier R2800
Shinkiro is offline   Reply With Quote
Old 23rd April 2022, 17:55   #1103  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,703
Quote:
Originally Posted by Dogway View Post
I updated a few scripts today. Wanted to call out Boulder as I updated TransformsPack so now 'SSIM2' works over there or deep_resize().
deep_resize() also supports now ratio resize, so deep_resize(2) will mean to double the size, likewise deep_resize(0.5) is halving the size.
Thanks, did some eyeballing tests. It's definitely much sharper than a simple Spline36. 'SSIM' looks like it could be a good replacement for that instead. Are there any caveats I should be aware of?
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...

Last edited by Boulder; 23rd April 2022 at 17:59.
Boulder is offline   Reply With Quote
Old 23rd April 2022, 18:07   #1104  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,351
Quote:
Originally Posted by Boulder View Post
Thanks, did some eyeballing tests. It's definitely much sharper than a simple Spline36. 'SSIM' looks like it could be a good replacement for that instead. Are there any caveats I should be aware of?
Prerequisites only as it needs SimilarityMetrics, fmtconv, vsTCanny... Speed wise I guess slower but haven't benchmarked. Hopefully I didn't break something/logic.
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread
Dogway is offline   Reply With Quote
Old 23rd April 2022, 19:04   #1105  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,703
Something I noticed - 'Didée' as a string doesn't work correctly as it requires UTF8 support. VDub2 won't put the 'é' there in the script editor.

EDIT: and show=true won't help to see what is really being used since it shows whatever string is given in the function call.
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...

Last edited by Boulder; 23rd April 2022 at 19:11.
Boulder is offline   Reply With Quote
Old 24th April 2022, 11:55   #1106  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,351
Quote:
Originally Posted by Boulder View Post
Something I noticed - 'Didée' as a string doesn't work correctly as it requires UTF8 support. VDub2 won't put the 'é' there in the script editor.

EDIT: and show=true won't help to see what is really being used since it shows whatever string is given in the function call.
Thanks, "Didee" is also supported as alias so I changed default for that.

Do you mean to show also 'b' and 'c' coefficients? I know them by memory mostly, expected people to also familiarize but I can add them no problem.
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread
Dogway is offline   Reply With Quote
Old 24th April 2022, 18:16   #1107  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,703
Quote:
Originally Posted by Dogway View Post
Do you mean to show also 'b' and 'c' coefficients? I know them by memory mostly, expected people to also familiarize but I can add them no problem.
Yes, I think it would be good to see what the actual resizer parameters are for each case. There's quite a few of them there
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 29th April 2022, 14:42   #1108  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,500
@DogWay

I recently bought the Aniplex version of Full Metal Alchemist Brotherhood (an anime) and (I could easily guess) it's an upsampled version of the broadcast show.

There are many aliased black line arts (with some halo too) and what was some grain (not excessive though) now became pixel blocks, mostly in dark areas.

Is there anything I could do with your tools?

Some examples:

__________________
@turment on Telegram
tormento is online now   Reply With Quote
Old 29th April 2022, 16:33   #1109  |  Link
Julek
Registered User
 
Julek's Avatar
 
Join Date: Dec 2020
Posts: 83
Quote:
Originally Posted by tormento View Post
@DogWay

I recently bought the Aniplex version of Full Metal Alchemist Brotherhood (an anime) and (I could easily guess) it's an upsampled version of the broadcast show.

There are many aliased black line arts (with some halo too) and what was some grain (not excessive though) now became pixel blocks, mostly in dark areas.

Is there anything I could do with your tools?
FMAB is a 960x540 animation upscaled to 1920x1080 with bicubic 0/1, the correction process (using VS) looks like this:
Code:
from vsutil import depth, split, join
import vapoursynth as vs
core = vs.core

src = core.dgdecodenv.DGSource(r"D:\Encodes\FMAB\00000.dgi")
src32 = depth(src, 32)
y, u, v = split(src32)
dsc = core.descale.Debicubic(y, width=960, height=540, b=0, c=1)
w2x = core.caffe.Waifu2x(dsc, noise=-1, scale=2, model=6, cudnn=True, tta=False)
w2x = join([w2x, u, v])
depth(w2x, 10).set_output()
Result: https://slow.pics/c/zSsrC5HW
__________________
CPU: AMD 3700X | GPU: RTX 3070Ti | RAM: 32GB 3200MHz
Discord: @Julek#9391 || GitHub
Julek is offline   Reply With Quote
Old 29th April 2022, 16:40   #1110  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,788
Lineart looks great now!
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database
ChaosKing is offline   Reply With Quote
Old 29th April 2022, 17:51   #1111  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,500
Quote:
Originally Posted by Julek View Post
FMAB is a 960x540 animation upscaled to 1920x1080 with bicubic 0/1, the correction process (using VS) looks like this
Is possible to have a AVS+ script?

I am really a noob with VS. Anyway, is it the CUDA filter version?

P.S: Results are awesome.
__________________
@turment on Telegram

Last edited by tormento; 29th April 2022 at 18:20.
tormento is online now   Reply With Quote
Old 29th April 2022, 18:05   #1112  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,351
Yes, I was going to recommend de-scalers, probably the aliasing is due to a bad upscaling, so it should be fixed by returning it to the original size and optionally upscaling with a better (AI) upscaler.

Julek example is wonders, not even it cleaned the aliasing but also the ringing.

A port attempt:
Code:
src   = DGSource("D:\Encodes\FMAB\00000.dgi")
src32 = ConvertBits(src, 32)
dsc   = DeBicubicResizeMT(ExtractY(src32), 960, 540, b=0, c=1)
# w2x   = Waifu2x(dsc, nr=0, scale=2, models="C:\opt\waifu2xAvisynth-models\models", jobs=4)
w2x   = nnedi3resize(dsc, 1920,1080)
w2x   = CombinePlanes(w2x, src32, planes="YUV",Pixel_Type="YUV420PS")
Adaptive_sharpen(w2x,0.5)
ConvertBits(10, dither=1)
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread

Last edited by Dogway; 29th April 2022 at 18:27.
Dogway is offline   Reply With Quote
Old 29th April 2022, 18:15   #1113  |  Link
Julek
Registered User
 
Julek's Avatar
 
Join Date: Dec 2020
Posts: 83
Waifu2x for AVS has the cunet model? It is the only model with good results, the other models damage the image a bit.
The second option is to use just nnedi3_rpow2.
__________________
CPU: AMD 3700X | GPU: RTX 3070Ti | RAM: 32GB 3200MHz
Discord: @Julek#9391 || GitHub
Julek is offline   Reply With Quote
Old 29th April 2022, 18:49   #1114  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,351
I don't know, it's this build but only for AVS 2.6 x86.

There are other AI upscalers in AVS+ like FCBI, SuperResXBR or FSRCC. But I don't think any is modeled for anime.

EDIT (alternative with less ringing):

Code:
src   = DGSource("D:\Encodes\FMAB\00000.dgi")
src32 = ConvertBits(last, 32)

dsc   = deep_resize(ExtractY(src32), 960, 540)
w2x   = deep_resize(dsc, 1920,1080,grain=0,deconv=0)
w2x   = CombinePlanes(w2x, src32, planes="YUV",Pixel_Type="YUV420PS")
w2x
ConvertBits(10, dither=1)
aWarpSharp2(depth=4,type=1,blur=3,thresh=128,chroma=2)
FastLineDarkenMOD(prot=0, thinning=10, strength=30)
# some denoise
sec  = ex_bs(0.51, 8, 10, fulls=true, flt=true)
ex_lutxy(ex_median("median5"), Format("x y == x dup y x - sgn {sec} * + ?"), UV=3)
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread

Last edited by Dogway; 29th April 2022 at 19:16.
Dogway is offline   Reply With Quote
Old 29th April 2022, 19:01   #1115  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,500
Quote:
Originally Posted by Dogway View Post
but only for AVS 2.6 x86.
We need something that works with GPU of we can get old waiting
__________________
@turment on Telegram
tormento is online now   Reply With Quote
Old 29th April 2022, 19:22   #1116  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,500
Quote:
Originally Posted by Julek View Post
Waifu2x for AVS has the cunet model? It is the only model with good results, the other models damage the image a bit.
The second option is to use just nnedi3_rpow2.
Can you "take my hand" and lead me to files needed, i.e. urls etc?

I can "stupidly" apply your script if you give me some coordinates.
__________________
@turment on Telegram
tormento is online now   Reply With Quote
Old 29th April 2022, 19:56   #1117  |  Link
Julek
Registered User
 
Julek's Avatar
 
Join Date: Dec 2020
Posts: 83
Quote:
Originally Posted by tormento View Post
Can you "take my hand" and lead me to files needed, i.e. urls etc?

I can "stupidly" apply your script if you give me some coordinates.
Talk about a VS installation? I am a little busy today, but I can give a very detailed explanation tomorrow.
In advance I can tell you that we have 3 cunet options:
caffe (CUDA ver) which has a brightness bug
w2xnvk (Vulkan ver), which is slower than caffe, but has a bug-free release.
mlrt (CUDA ver) which is the fastest of them, but has the same bug as caffe

It's possible to mitigate the effects of the bug with Expr, or just use w2xnvk R3.2
__________________
CPU: AMD 3700X | GPU: RTX 3070Ti | RAM: 32GB 3200MHz
Discord: @Julek#9391 || GitHub
Julek is offline   Reply With Quote
Old 29th April 2022, 19:59   #1118  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,500
Quote:
Originally Posted by Julek View Post
Talk about a VS installation? I am a little busy today, but I can give a very detailed explanation tomorrow.
Thank you in advance. Please cover every aspect so that other users can have benefits too.
__________________
@turment on Telegram
tormento is online now   Reply With Quote
Old 30th April 2022, 10:53   #1119  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,351
Quote:
Originally Posted by Julek View Post
You might be interested in this:
https://github.com/dnjulek/jvsfunc/b...xpr.py#L10-L55

I did ccd using only Expr, I saw that AVS does not yet have a native plugin and I think this might help.

To help with vs-expr: https://github.com/AkarinVS/vapoursy...pr-expressions
Finally ported. It acts more like a chroma deblocker so added into DeblockPack. I added a few optimizations and features so you might want to give it a look.
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread
Dogway is offline   Reply With Quote
Old 30th April 2022, 10:57   #1120  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,703
Quote:
Originally Posted by Julek View Post
FMAB is a 960x540 animation upscaled to 1920x1080 with bicubic 0/1
Is there a clear method for defining the upscale method? I have some film sources which are clearly rather poor upscales and would like to downscale back to the original resolution for the encode.
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Reply

Tags
avisynth, dogway, filters, hbd, packs

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 13:57.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.