View Full Version : Dogway's Filters Packs
Dogway
23rd April 2022, 14:09
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.
Shinkiro
23rd April 2022, 14:17
Can you share script you were change to expr??
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)
Boulder
23rd April 2022, 17:55
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?
Dogway
23rd April 2022, 18:07
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.
Boulder
23rd April 2022, 19:04
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.
Dogway
24th April 2022, 11:55
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.
Boulder
24th April 2022, 18:16
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 :)
tormento
29th April 2022, 14:42
@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:
https://i.lensdump.com/i/trQBue.md.png (https://lensdump.com/i/trQBue) https://i1.lensdump.com/i/trQsAk.md.png (https://lensdump.com/i/trQsAk)
https://i2.lensdump.com/i/trQ3Qx.md.png (https://lensdump.com/i/trQ3Qx) https://i3.lensdump.com/i/trQ4nH.md.png (https://lensdump.com/i/trQ4nH)
Julek
29th April 2022, 16:33
@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:
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
ChaosKing
29th April 2022, 16:40
Lineart looks great now!
tormento
29th April 2022, 17:51
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.
Dogway
29th April 2022, 18:05
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:
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)
Julek
29th April 2022, 18:15
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.
Dogway
29th April 2022, 18:49
I don't know, it's this build (https://github.com/sunnyone/Waifu2xAvisynth) 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):
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)
tormento
29th April 2022, 19:01
but only for AVS 2.6 x86.
We need something that works with GPU of we can get old waiting :)
tormento
29th April 2022, 19:22
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.
Julek
29th April 2022, 19:56
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) (https://github.com/HomeOfVapourSynthEvolution/VapourSynth-Waifu2x-caffe) which has a brightness bug (https://github.com/HomeOfVapourSynthEvolution/VapourSynth-Waifu2x-caffe/issues/20)
w2xnvk (Vulkan ver) (https://github.com/Nlzy/vapoursynth-waifu2x-ncnn-vulkan), which is slower than caffe, but has a bug-free release (https://github.com/Nlzy/vapoursynth-waifu2x-ncnn-vulkan/issues/10).
mlrt (CUDA ver) (https://github.com/AmusementClub/vs-mlrt) which is the fastest of them, but has the same bug as caffe (https://github.com/AmusementClub/vs-mlrt/issues/2)
It's possible to mitigate the effects of the bug with Expr, or just use w2xnvk R3.2
tormento
29th April 2022, 19:59
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. [emoji4]
Dogway
30th April 2022, 10:53
You might be interested in this:
https://github.com/dnjulek/jvsfunc/blob/main/jvsfunc/expr.py#L10-L55
I did ccd using only Expr, I saw that AVS does not yet have a native plugin (https://forum.doom9.org/showthread.php?p=1947846#post1947846) and I think this might help.
To help with vs-expr: https://github.com/AkarinVS/vapoursynth-plugin/wiki/Expr#translating-avs-expr-expressions
Finally ported (https://github.com/Dogway/Avisynth-Scripts/blob/master/EX%20mods/DeblockPack.avsi#L203). 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.
Boulder
30th April 2022, 10:57
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.
Reel.Deel
30th April 2022, 12:11
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.
Here's a nice article on descaling: https://guideencodemoe-mkdocs.readthedocs.io/encoding/descaling/
tormento
30th April 2022, 12:14
Is there a clear method for defining the upscale method?
The university professor of a friend of mine talked about it but that friend of mine lost the notes.... :scared:
Boulder
30th April 2022, 13:47
Here's a nice article on descaling: https://guideencodemoe-mkdocs.readthedocs.io/encoding/descaling/
Thanks :)
anton_foy
30th April 2022, 18:10
Finally ported (https://github.com/Dogway/Avisynth-Scripts/blob/master/EX%20mods/DeblockPack.avsi#L203). 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.
Thanks for this! But with CCD(30,HD=true) on UHD clip something strange is happening with the colors, like a tint of pink and grey. As if the green channel is gone or something.
EDIT:
src=last
CCD(10,HD=true)
CombinePlanes(src, last, src, planes="YUV")
This works wonders though on my noisy high ISO Slog2 footage!
tormento
1st May 2022, 20:24
I am a little busy today, but I can give a very detailed explanation tomorrow.
Waiting :)
Perhaps it's better that you open a new thread about it.
Dogway
2nd May 2022, 01:24
@anton_foy: Yes, I could test on grainy chroma and works great as well. As for your issue I haven't seen it... also tested on a 4K clip. I updated today the filter again to be able to turn off either chroma plane either U or V. Also removed the HD arg since it works fine for all resolutions whereas 4 and 12 step size was giving issues.
Also wanted to bring to the attention a new filter. Was unexpected but it occurred to me while reading around. Called FindTemp() will infer color temperature from the image, therefore it will only make sense for natural acquired images without grading of any kind. This tool is useful to know if you shot with a temperature of D50, D55 or other and then fix according with WhitePoint() as a step of the color correction process.
Tomorrow I will be uploading the last battery of script changes to resume the mvtools Zopti optimizations.
Waiting :)
Perhaps it's better that you open a new thread about it.
Sorry for the delay, I made a video explaining how to setup vapousynth in windows with editor: https://youtu.be/DBL8nc2hp3U
Link for the mentioned guide: https://silentaperture.gitlab.io/mdbook-guide/introduction.html
And for specific questions, I prefer that you join our discord, where there are many VS users who can help: https://discord.gg/qxTxVJGtst
Finally ported (https://github.com/Dogway/Avisynth-Scripts/blob/master/EX%20mods/DeblockPack.avsi#L203). 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.
Cool, I'll try to implement the matrix size resizer as well.
real.finder
2nd May 2022, 04:12
Julek, tormento, what about just use https://github.com/theChaosCoder/vapoursynth-portable-FATPACK/releases it got editor and stuff, Personally I use it to spy on vs things :D
Julek, tormento, what about just use https://github.com/theChaosCoder/vapoursynth-portable-FATPACK/releases it got editor and stuff, Personally I use it to spy on vs things :D
I prefer to avoid portable installation because I have had issues with some plugins.
And his editor doesn't have autocomplete for scripts, you can see how it looks in vs code at this minute: https://youtu.be/DBL8nc2hp3U?t=764
This is really important for things like QTGMC, which has a lot of parameters.
real.finder
2nd May 2022, 04:34
Either way, I don't care, it's do the job for test (spy), I even use avs/avs+ as portable in my personal laptop, I just hate install things and I love things be portable :) and as aside note for vs, it's kinda bloated with python so I may never use it in my personal laptop
Dogway
2nd May 2022, 11:37
Julek, tormento, what about just use https://github.com/theChaosCoder/vapoursynth-portable-FATPACK/releases it got editor and stuff, Personally I use it to spy on vs things :D
I think the latest Win7 supported version is the 3.8.x branch. I don't know about vs support though.
tormento
2nd May 2022, 11:56
Sorry for the delay, I made a video explaining how to setup vapousynth in windows with editor
Thanks, man. I just wanted to understand how to use the various versions of waifu2x :)
I prefer that you join our discord
Just joined.
LeXXuz
5th May 2022, 07:41
Dogway I've used SMDegrain v3.1.2d quite a lot before. Now I'm trying out your version but get very different visual results.
Is there any kind of correlation for tr, thSAD etc to get kind of 'similar' results?
f.e. I've used these parameters with SMDegrain(+LSFmod):
PRE=(sneo_dfttest(Y=3, U=3, V=3, tbsize=1, slocation="0.0:0 0.5:2 0.9:8 1.0:16", chrslocation="0.0:0 0.5:0.5 0.9:2 1.0:4"))
SMDegrain(tr=3, thSAD=200, thSADC=50, contrasharp=100, refinemotion=true, truemotion=false, Str=1.0, pel=1, subpixel=2, prefilter=PRE, chroma=true, plane=4)
By just copying these I get a much more grainy output. :o
Dogway
5th May 2022, 12:17
I think you mean neo_dfttest()?
PRE=neo_dfttest(Y=3, U=3, V=3, tbsize=1, slocation="0.0:0 0.5:2 0.9:8 1.0:16", nlocation="0.0:0 0.5:0.5 0.9:2 1.0:4")
NotSMDegrain(tr=3, thSAD=200, thSADC=50, refinemotion=true, truemotion=false, Str=1.0, pel=1, subpixel=2, prefilter=PRE, chroma=true, plane=4)
That's the your call updated and without contrasharp.
I compared to:
PRE=neo_dfttest(Y=3, U=3, V=3, tbsize=1, slocation="0.0:0 0.5:2 0.9:8 1.0:16", nlocation="0.0:0 0.5:0.5 0.9:2 1.0:4")
SMDegrain(tr=3, thSAD=400, thSADC=50, refinemotion=true, truemotion=false, Str=5.0, pel=1, subpixel=2, prefilter=PRE, chroma=true, plane=4)
I see less smearing and better detail retention. SMDegrain has been partially optimized with Zopti for better qual/perf, and it's going to see better improvements on the following weeks.
With contrasharp=100 all your grain is back because the prefilter clip 'PRE' barely denoises and now 'contrasharp=n' (LSFplus) is doing a better recovery job. You can try with:
SMDegrain(tr=3, thSAD=300, thSADC=50, contrasharp=40, refinemotion=true, truemotion=false, Str=5.0, pel=1, subpixel=2, prefilter=2, chroma=true, plane=4)
Other internal prefilters also ok 0~7.
LeXXuz
5th May 2022, 19:42
Thanks for your reply Dogway. I think I should've added more detail about how I use SMD in the first place, sorry. :o
I think you mean neo_dfttest()?
PRE=neo_dfttest(Y=3, U=3, V=3, tbsize=1, slocation="0.0:0 0.5:2 0.9:8 1.0:16", nlocation="0.0:0 0.5:0.5 0.9:2 1.0:4")
NotSMDegrain(tr=3, thSAD=200, thSADC=50, refinemotion=true, truemotion=false, Str=1.0, pel=1, subpixel=2, prefilter=PRE, chroma=true, plane=4)
I've used real.finder's stuff so far. sneo_dfttst() is a helper function to use neo_dfttest() with different sigma strings for luma and chroma
That's the your call updated and without contrasharp.
I compared to:
PRE=neo_dfttest(Y=3, U=3, V=3, tbsize=1, slocation="0.0:0 0.5:2 0.9:8 1.0:16", nlocation="0.0:0 0.5:0.5 0.9:2 1.0:4")
SMDegrain(tr=3, thSAD=400, thSADC=50, refinemotion=true, truemotion=false, Str=5.0, pel=1, subpixel=2, prefilter=PRE, chroma=true, plane=4)
With contrasharp=100 all your grain is back because the prefilter clip 'PRE' barely denoises and now 'contrasharp=n' (LSFplus) is doing a better recovery job.
I already had the feeling that something was off with LSFmod in NotSMDegrain(). I had to use quite high values to even recognize some sharpening in the final output (and some increase in file size). You may remember I already mentioned this here. (https://forum.doom9.org/showthread.php?p=1966480#post1966480)
I understand now that the value is much too high for your version of SMD as the sharpener seems to be working (again) as it should. So I have to find new values for my presets.
I made myself a few different presets over the past months for a wider variety of grain in sources. From sources with hardly visible grain to extremely grainy ones.
My example above was for a source with very little grain, hence the small values for dfttest and thSAD.
I see less smearing and better detail retention. SMDegrain has been partially optimized with Zopti for better qual/perf, and it's going to see better improvements on the following weeks.
That's one of the major problems I had with SMDegrain so far. On higher values with very grainy sources I decided to skip sharpening at all because some subtle textures like skin pores, fine suit textures and such became blurry/smeared as soon as there was movement involved and on the other hand looked very sharp when they stood still. This gave the picture a very unnatural look which, to my taste, was worse than the original grainy look.
I'm also very carefull with chroma denoising, that's why I prefer a ratio of 3:1 or even 4:1 between luma and chroma, depending on source.
Dogway
5th May 2022, 20:08
LSFplus is a top-to-bottom refactor of LSFmod (more over the contrasharpening block), and it makes much more sense. I didn't repurpose the filter, just made more sense out of it following some Didée's suggestions and greatly optimizing and improving the code at the same time.
The thing is LSFmod was mostly meant to be used for SD content. I had to add back 'old' (now named 'LSF') method and make it default for HD.
The sharpening method people prefers varies greatly, as it also depends on the source condition so you can even use a separate sharpener with some temporal limiting (ie. with soothe), etc. By the way you can also use temporal limited sharpening within SMDegrain, simply set 'limitS=false'.
As for the smearing, I made great efforts with that. First there is the internal luma_rebuild, I recommend the default Str=5.0 to separate dark elements better. Then I made LFR, to recover low frequency smearing.
As for the chroma, all my tests showed an ideal ratio (scaleCSAD) of 1:2 for good content, even for grainy HD. For SD it switches to 2:1. There are HUE lines that MAnalyse can pick up in chroma and are not clear in luma so it's important for vector structure.
There are some automations internally for defaults, so check defaults with show=true to have some ground to test from.
EDIT: To make it clear. Prefiltering is as important as MDegrain. Prefilter spatially as you would stand-alone, no need to be perfect but in the ballpark (falling short if any). Then let MDegrain do the dirty job.
LeXXuz
5th May 2022, 21:52
Thanks for that detailed explanation Dogway.
Guess I have quite a lot to play around with to find some new presets for me. In theory any movie/source is different and needs special adjustment on its own for optimum results. But this would clearly exceed the free time and motivation I have, so I'm trying to find some different presets as a compromise for most of my sources.
What about the temporal radius? I used tr=6 with values even up to 12 in old SMDegrain for some of the nastier stuff. I see the range is now 1-9 so I guess the scale is different? How high would/should you go with tr for little grain up to really nasty ones?
Dogway
5th May 2022, 23:40
IMO anything higher than 3-4 is a waste of time, it might indicate a problem with prefiltering.
I don't know what you work with but for live action there's little temporal correlation.
Try to play with the function definition sliders to get there faster, I only exposed the main ones to care about.
LeXXuz
6th May 2022, 06:48
It's mostly movies and TV-Shows on Blu-ray as source.
Yes I've seen there's a lot more switches and functions to play around with. :)
tormento
6th May 2022, 11:08
IMO anything higher than 3-4 is a waste of time, it might indicate a problem with prefiltering.
There are really bad movies outta there :p
Sometimes I had to use thsad=900 up to 1200 :eek:
Then I learned about double pass denoising.
I always thought that increasing the frame span, besides denoising better, increases its precision. Am I wrong?
LeXXuz
6th May 2022, 13:34
That is very high. The result would most likely show quite some ghosting/smearing in moving objects. Wouldn't it?
Dogway
6th May 2022, 13:51
There are really bad movies outta there :p
Sometimes I had to use thsad=900 up to 1200 :eek:
Then I learned about double pass denoising.
I always thought that increasing the frame span, besides denoising better, increases its precision. Am I wrong?
Theoretically yes, maybe for true static like anime, but for live action half a pixel is the difference between sharp and blurry, MAnalyse might have a hard time picking half a pixel change more so in noisy clips and the higher the 'tr' the blurrier the output. MAnalyse is lacking rotational and zoom predictors, so the stakes are high.
Double pass is more effective as it performs a binomial weighting to the pixel motion estimation, the furthest frames having less weight.
Also for larger 'tr' all the truemotion and vector penalty settings lose their meaning and turn basically to noop. Read that on a DTL post but can't track it. So for my next Zopti tests I'm going to optimize for tr=1.
VoodooFX
6th May 2022, 18:07
What that means: "Resize: height must be greater than 0.", when I add to script "FlatMask()"?
ExTools.avsi line 1793
ExTools.avsi line 1820
SMDegrain v3.5.0d.avsi line 893
MasksPack.avsi line 161
AvS+ 3.7.2, and latest scripts from your github.
PS:
Could it do magic on sample there? -> https://forum.doom9.org/showthread.php?p=1968672#post1968672
Dogway
6th May 2022, 21:06
Yes thanks, looks like an ex_retinex() issue with small clips (actually ex_gaussianblur() ). I'm having a look, for the time being you can disable that line (161 ln on MasksPack), as it's doesn't seem essential for this task even maybe harmful as it wasn't designed for halos...
https://i.imgur.com/nuPZtCf.png
LeXXuz
7th May 2022, 08:44
I did a few more encodes with SMDegrain in the meantime.
I think there is a slight visible improvement over the old version when it comes to detail retention, movement and the ghosting/smearing problem. Which is very nice. :)
But the differences in file size are kinda worrying me, because in comparison to the slight visual improvements they are 'huge'.
I already raised thSAD and prefiltering values beyond what I was used to from the old version. And yet there is still quite a big difference in filesize.
To give an example. With the old version and these settings:
LoadPlugin("C:\Video Editing\MeGUI (x64)\tools\avisynth_plugin\neo-dfttest_rf-fix\64\neo-dfttest.dll") #fixed version by real.finder from 05/29/21
LoadPlugin("c:\Video Editing\MeGUI (x64)\tools\avisynth_plugin\neo-f3kdb_r6\clang-x64\neo-f3kdb.dll")
LoadPlugin("c:\Video Editing\MeGUI (x64)\tools\avisynth_plugin\masktools2-v2.2.26\x64_clang\masktools2.dll")
LoadPlugin("c:\Video Editing\MeGUI (x64)\tools\avisynth_plugin\mvtools-2.7.44\x64\mvtools2.dll")
LoadPlugin("c:\Video Editing\MeGUI (x64)\tools\avisynth_plugin\RgTools-v1.1\x64_LLVM_build\RgTools.dll")
LoadPlugin("c:\Video Editing\MeGUI (x64)\tools\avisynth_plugin\MedianBlur2_v1.1\x64_Clang\MedianBlur2.dll")
#
Import("C:\Video Editing\MeGUI (x64)\tools\avisynth_plugin\LSFmod.avsi") #v2.193
Import("C:\Video Editing\MeGUI (x64)\tools\avisynth_plugin\NotSMDegrain.avsi") #v3.1.2.116s mod for v3.1.2d
Import("C:\Video Editing\MeGUI (x64)\tools\avisynth_plugin\Zs_RF_Shared.avsi") #v1.147
Import("C:\Video Editing\MeGUI (x64)\tools\avisynth_plugin\mtmodes.avsi")
#
ConvertBits(16)
PRE=(sneo_dfttest(Y=3, U=3, V=3, tbsize=1, slocation="0.0:0 0.5:2 0.9:8 1.0:16", chrslocation="0.0:0 0.5:0.5 0.9:2 1.0:4"))
NotSMDegrain(tr=3, thSAD=200, thSADC=50, contrasharp=100, refinemotion=true, truemotion=false, Str=1.0, pel=1, subpixel=2, prefilter=PRE, chroma=true, plane=4)
neo_f3kdb(range=30, Y=64, Cb=32, Cr=32, grainY=32, grainC=16, sample_mode=4)
Prefetch(12,12)
Return(Last)
I ended up with an HEVC file of 8,04GB.
With the new version and these settings:
LoadPlugin("C:\Video Editing\MeGUI (x64)\tools\avisynth_plugin\neo-dfttest_rf-fix\64\neo-dfttest.dll") #fixed version by real.finder from 05/29/21
LoadPlugin("c:\Video Editing\MeGUI (x64)\tools\avisynth_plugin\neo-f3kdb_r6\clang-x64\neo-f3kdb.dll")
LoadPlugin("c:\Video Editing\MeGUI (x64)\tools\avisynth_plugin\masktools2-v2.2.26\x64_clang\masktools2.dll")
LoadPlugin("c:\Video Editing\MeGUI (x64)\tools\avisynth_plugin\mvtools-2.7.44\x64\mvtools2.dll")
LoadPlugin("c:\Video Editing\MeGUI (x64)\tools\avisynth_plugin\RgTools-v1.1\x64_LLVM_build\RgTools.dll")
LoadPlugin("c:\Video Editing\MeGUI (x64)\tools\avisynth_plugin\MedianBlur2_v1.1\x64_Clang\MedianBlur2.dll")
#
Import("C:\Video Editing\MeGUI (x64)\tools\avisynth_plugin\GradePack.avsi") #v7.1
Import("C:\Video Editing\MeGUI (x64)\tools\avisynth_plugin\ResizersPack.avsi") #v9.2
Import("C:\Video Editing\MeGUI (x64)\tools\avisynth_plugin\SharpenersPack.avsi") #v4.2
Import("C:\Video Editing\MeGUI (x64)\tools\avisynth_plugin\ExTools.avsi") #v8.4
Import("C:\Video Editing\MeGUI (x64)\tools\avisynth_plugin\LSFplus.avsi") #v5.3
Import("C:\Video Editing\MeGUI (x64)\tools\avisynth_plugin\SMDegrain.avsi") #v3.5.0.d
Import("C:\Video Editing\MeGUI (x64)\tools\avisynth_plugin\Zs_RF_Shared.avsi") #v1.147
Import("C:\Video Editing\MeGUI (x64)\tools\avisynth_plugin\mtmodes.avsi")
#
ConvertBits(16)
PRE=(sneo_dfttest(Y=3, U=3, V=3, tbsize=1, slocation="0.0:0 0.5:8 0.9:16 1.0:32", chrslocation="0.0:0 0.5:4 0.9:8 1.0:16"))
SMDegrain(tr=3, thSAD=400, thSADC=200, contrasharp=20, refinemotion=true, truemotion=false, Str=5.0, pel=1, subpixel=2, prefilter=PRE, chroma=true, plane=4)
neo_f3kdb(range=30, Y=64, Cb=32, Cr=32, grainY=32, grainC=16, sample_mode=4)
Prefetch(12,12)
Return(Last)
I ended up with an HEVC file of 10,86GB.
Encoder settings are exactly the same for both files of course.
That's a 35% gain in file size. I just wonder if I may do something wrong or something is not working right. (Or was not working right before) :o
VoodooFX
7th May 2022, 12:59
disable that line (161 ln on MasksPack)
That made it work. Thanks.
Dogway
7th May 2022, 15:04
That's a 35% gain in file size. I just wonder if I may do something wrong or something is not working right. (Or was not working right before) :o
Let me have a deeper look as it seems LSFplus smode=5 had issues with secure implementation. secure=false retrieves what seems LSFmod parity, but this is not good for flat areas where banding might occur. I need some time and concentration so will check the expression when I have time.
EDIT: Looks like it was a simple swap of clip variables. I'd swear I had fixed that before, but anyways check now, updated LSFplus and ExTools.
LeXXuz
7th May 2022, 15:28
Let me have a deeper look as it seems LSFplus smode=5 had issues with secure implementation. secure=false retrieves what seems LSFmod parity, but this is not good for flat areas where banding might occur. I need some time and concentration so will check the expression when I have time.
I'm very grateful guys like you share their vast knowledge about digital video with the community. Giving normal 'users' like me tools at hand that even professional studios don't have (judging by the quality of many commercial sources out there...) :thanks:
So take all the time you need. ;) In the meantime I'll do some double encodes without contrasharp at all to see how the differences between old and new SMDegrain play out.
Julek
11th May 2022, 04:59
Finally ported (https://github.com/Dogway/Avisynth-Scripts/blob/master/EX%20mods/DeblockPack.avsi#L203). 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.
I finally updated my version (https://github.com/dnjulek/jvsfunc/blob/ef910ec7d499f20df11fa99e8bf4e60401abf36e/jvsfunc/expr.py#L31-L35), I made the matrix size more settable.
anton_foy
11th May 2022, 22:32
I try to find ex_occlusion() but I cannot find it, in which pack is it?
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.