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 29th August 2021, 04:01   #261  |  Link
Pauly Dunne
Grumpy Old Man.
 
Pauly Dunne's Avatar
 
Join Date: Jul 2019
Location: Out There....
Posts: 692
Hello again,

Can someone please tell me whats missing with this script :-

Quote:
#Custom
LoadPlugin("%AVISYNTHPLUGINS%\mvtools\mvtools2.dll")
LoadPlugin("%AVISYNTHPLUGINS%\BM3D\x64\BM3DCPU_AVS.dll")
LoadPlugin("%AVISYNTHPLUGINS%\BM3D\x64\BM3D_VAggregate_AVS.dll")
LoadPlugin("%AVISYNTHPLUGINS%\dfttest\dfttest.dll")
LoadPlugin("%AVISYNTHPLUGINS%\RgTools\RgTools.dll")
Import("%AVISYNTHPLUGINS%\scripts\extras\ExTools52.avs")
Import("%AVISYNTHPLUGINS%\scripts\extras\Sharpeners Pack v0.5.avs")
Import("%AVISYNTHPLUGINS%\scripts\extras\SMDegrain326d.avs")
Import("%AVISYNTHPLUGINS%\scripts\extras\Utils-r41.avs")
Import("%AVISYNTHPLUGINS%\scripts\extras\Zs_RF_Shared.avs")
video=SMDegrain(video,tr=4,thSAD=400,contrasharp=true,refinemotion=true,prefilter=5)
It has a error with Line 160 of SMDegrain3.2.6d.


But if I run this, there's no error :-

Quote:
#Custom
LoadPlugin("%AVISYNTHPLUGINS%\mvtools\mvtools2.dll")
LoadPlugin("%AVISYNTHPLUGINS%\BM3D\x64\BM3DCUDA_AVS.dll")
LoadPlugin("%AVISYNTHPLUGINS%\BM3D\x64\BM3D_VAggregate_AVS.dll")
LoadPlugin("%AVISYNTHPLUGINS%\dfttest\dfttest.dll")
LoadPlugin("%AVISYNTHPLUGINS%\RgTools\RgTools.dll")
Import("%AVISYNTHPLUGINS%\scripts\extras\ExTools52.avs")
Import("%AVISYNTHPLUGINS%\scripts\extras\Sharpeners Pack v0.5.avs")
Import("%AVISYNTHPLUGINS%\scripts\extras\SMDegrain326d.avs")
Import("%AVISYNTHPLUGINS%\scripts\extras\Utils-r41.avs")
Import("%AVISYNTHPLUGINS%\scripts\extras\Zs_RF_Shared.avs")
video=SMDegrain(video,tr=4,thSAD=400,contrasharp=true,refinemotion=true,prefilter=5)
BTW, I'm using either a 3950X or a 5950X.

__________________
Not poorly done, just doin' it my way !!!
Live every day like it's your last, because one day, it will be !! (M$B)

Last edited by Pauly Dunne; 29th August 2021 at 04:15.
Pauly Dunne is offline   Reply With Quote
Old 29th August 2021, 04:45   #262  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 2,160
Quote:
Originally Posted by Pauly Dunne View Post
Hello again,

Can someone please tell me whats missing with this script :-



It has a error with Line 160 of SMDegrain3.2.6d.


But if I run this, there's no error :-



BTW, I'm using either a 3950X or a 5950X.

In BM3D_CPU don't have fast=true, extractor_exp=6, just deleted it when you change BM3D_CUDA to BM3D_CPU
https://github.com/Dogway/Avisynth-S...2.6d.avsi#L617
kedautinh12 is offline   Reply With Quote
Old 29th August 2021, 05:19   #263  |  Link
Pauly Dunne
Grumpy Old Man.
 
Pauly Dunne's Avatar
 
Join Date: Jul 2019
Location: Out There....
Posts: 692
Quote:
Originally Posted by kedautinh12 View Post
In BM3D_CPU don't have fast=true, extractor_exp=6, just deleted it when you change BM3D_CUDA to BM3D_CPU
https://github.com/Dogway/Avisynth-S...2.6d.avsi#L617
You're awesome, I could make a "custom" SMDegrain with those deleted, and get the script to call the modded one.

I'll give it a shot, and let you know

Reply:- OK, that didn't work at first, but when I changed something else, it did, but it's SLOW !!!!

BM3D_CUDA(sigma=[s,ch?s/2:0,ch?s/2:0], radius=r, chroma=ch, fast=true, extractor_exp=6)
to
BM3D_CPU(sigma=[s,ch?s/2:0,ch?s/2:0], radius=r, chroma=ch)

Maybe that could be tweaked....
__________________
Not poorly done, just doin' it my way !!!
Live every day like it's your last, because one day, it will be !! (M$B)

Last edited by Pauly Dunne; 29th August 2021 at 05:40.
Pauly Dunne is offline   Reply With Quote
Old 29th August 2021, 06:48   #264  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 2,160
Try this script i shared with BM3D_CPU & BM3D_CUDA. After benchmark between them
video=SMDegrain(video,tr=4,thSAD=400,contrasharp=true,refinemotion=true,prefilter=5)
Prefetch(16) #or try any number can make a good speed fps
kedautinh12 is offline   Reply With Quote
Old 29th August 2021, 09:20   #265  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,752
I personally wouldn't put too much effort on the prefiltering part. I use this kind of prefiltering method that was snatched from QTGMC (where it is used for prefiltering as well).

Code:
w = clip.Width()
h = clip.Height()
srchClip = clip.RemoveGrain(12,12).GaussResize(w,h, 0,0, w+0.0001,h+0.0001, p=2).MergeLuma(clip, 0.1)
__________________
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 August 2021, 22:27   #266  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Yo Doggy,
does anything in your Extools [or other] whotsits, measure distance of current pixel to nearest eg black[or white] pixel ? [maybe result pixel 0->255 for 8 bit]

Thanks in advance.

EDIT: Or suggestion. I'm not really expecting any +ve reply, but thought I'de ask.
Good Doggy
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 29th August 2021 at 22:51.
StainlessS is offline   Reply With Quote
Old 30th August 2021, 11:03   #267  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,364
Maybe you can try this. Binarize first, then expand (to calculate distance) and calculate output value.

Code:
ex_binarize(254)
aug = true  # to see the mask

aug = aug ? "0.250001 *" : "range_max / "
ex2 = ex_expand(2)

Expr(last,ex_expand(1),ex2,ex2.ex_expand(1),Format("x y z a + + + "+aug),"")
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread

Last edited by Dogway; 30th August 2021 at 11:06.
Dogway is offline   Reply With Quote
Old 30th August 2021, 13:36   #268  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Woah, I really was not expecting anything at all, I'll give it a go, thanks very much
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 31st August 2021, 14:55   #269  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,364
Just uploaded SMDegrain v3.2.7d, it includes a new function, ex_retinex(), its use is similar to ex_luma_rebuild() but more robust and a about half the speed although still fast.
I didn't like the implementations in VapourSynth or other sources so I directly ported from a paper and it works great. You can use it with SMDegrain argument "Str" and value 1.0, with value 0 it fallsback to frameprops to check if clip is TV levels and do a range conversion.
Also added a small optimization update to ex_minblur().

I also uploaded DeStripe() although either this or ex_retinex() make use of updates in ExTools that I still haven't uploaded, maybe this evening since I still want to do a quality check on ex_luts(), should be working fine but want to be sure.
I also ported from VapourSynth to ExTools Guided Blur and Anisotropic Guided Filtering, they are both slow. Will think for optimizations at another time.
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread
Dogway is offline   Reply With Quote
Old 31st August 2021, 22:14   #270  |  Link
Julek
Registered User
 
Julek's Avatar
 
Join Date: Dec 2020
Posts: 94
Quote:
Originally Posted by Dogway View Post
Just uploaded SMDegrain v3.2.7d, it includes a new function, ex_retinex(), its use is similar to ex_luma_rebuild() but more robust and a about half the speed although still fast.
I get an error with ex_lutxyza, did you forget to add it or did I do something wrong?
Julek is offline   Reply With Quote
Old 1st September 2021, 00:12   #271  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,364
Quote:
Originally Posted by Dogway View Post
I also uploaded DeStripe() although either this or ex_retinex() make use of updates in ExTools that I still haven't uploaded, maybe this evening since I still want to do a quality check on ex_luts(), should be working fine but want to be sure.
I had a birthday tonight, will upload tomorrow ExTools update after some quality checks. I also think that ex_retinex() should better make use of AutoLevels instead of my runtime levels for better performance, will have a look tomorrow.
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread
Dogway is offline   Reply With Quote
Old 1st September 2021, 00:24   #272  |  Link
Julek
Registered User
 
Julek's Avatar
 
Join Date: Dec 2020
Posts: 94
Oh, my bad.
Julek is offline   Reply With Quote
Old 1st September 2021, 06:07   #273  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 2,160
It's strange. Your ex_retinex use int sigma but MSRCP use float sigma[...] and your don't have upper_thr
kedautinh12 is offline   Reply With Quote
Old 1st September 2021, 13:40   #274  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Here something for Doggies Birthday[225 KB]:- https://www.mediafire.com/file/4fw6c...rthday.7z/file
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 1st September 2021, 14:40   #275  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,364
Quote:
Originally Posted by StainlessS View Post
Here something for Doggies Birthday[225 KB]:- https://www.mediafire.com/file/4fw6c...rthday.7z/file
Haha thank you, did I misscommunicate? I didn't mean my birthday lol. Thanks anyway

Just uploaded ExTools update. Didn't do a deep QC for ex_luts() today but should work fine for most things. If something odd arises I will fix on the go. I also had to update GradePack to allow floats in ex_levels() so ex_retinex() works fine.

Please test and if you see any issue let me know to fix it.

@kedautinh12: Just changed sigma to float. It wasn't an issue but I didn't port from anywhere. MSRCP is for RGB (chromaticity preservation), YUV doesn't need to preserve chroma as it is already detached from luma, one problem though is that YUV chroma is not entirely decorrelated, so one option I can add in the future is to preconvert to a better decorrelated color space. For SMDegrain prefiltering though this is not important.

@Julek: Test now with updated ExTools. Also if you let me know what type of Adaptive Threshold you use I can give it another stab. "Adaptive" is a generic family, some use integral other not. In your case it seemed to also use an edge mask. Here is a list of most kind of thresholds I could find.

Code:
Adaptive Mean
Adaptive Median
Adaptive Gaussian
Otsu Thresholding
Maximum Entropy Thresholding
Mixture Model Thresholding
Binary Clustering
Metric
Moment-Preserving Thresholding
Inner-class Variance
Pun Thresholding 
Niblack Thresholding
Bernsen Thresholding
Abutaleb Thresholding
Sauvola Thresholding
Phansalkar Thresholding
PirahanSiah Adaptive Single thresholding based on PSNR ( www.pirahansiah.com )
Lloyd Thresholding
Ridler-Calvard Thresholding // Iterative Selection Thresholding
Johannsen Entropy Thresholding
Yen, Chang Thresholding
Sahoo, Wilkins, Yeager Thresholding // Renyi's Entropy Thresholding
Triangle Thresholding
Kittler-Illingworth Thresholding // Minimum Error Thresholding
Kapur, Sahoo, Wong Thresholding
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread
Dogway is offline   Reply With Quote
Old 1st September 2021, 15:18   #276  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 2,160
Thanks, can i useable ex_retinex(sigma=[50, 200, 350])??
kedautinh12 is offline   Reply With Quote
Old 1st September 2021, 15:25   #277  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,364
I haven't implemented custom sigmas, my reference paper did careful measurements to retrieve the optimal sigmas and weighted sums, so it is [1.5%, 5%, global mean] of width dimension and with weights [0.2, 0.1, 0.7]. 'sigma' arg is just a multiplier.
Do you have an example where this doesn't work fine?
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread
Dogway is offline   Reply With Quote
Old 1st September 2021, 15:29   #278  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 2,160
Oh, i try use your ex_retinex for port retinex_edgemask to avs+
https://github.com/Irrational-Encodi...gefunc.py#L217
kedautinh12 is offline   Reply With Quote
Old 1st September 2021, 15:55   #279  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,364
I don't have VS installed to compare results, so maybe that MSRCP call is not optimized enough, for example the sigmas there are fixed. I think you might be safe by replacing it entirely with ex_retinex(), if any play with the percentile value in my function to roughly match the dynamic range.
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread
Dogway is offline   Reply With Quote
Old 1st September 2021, 16:57   #280  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 2,616
Quote:
Originally Posted by Dogway View Post
SMDegrain
Which filter do you suggest to lower HBD output from 16/12/10 bit SMDegrain to 8 bit? I am really not satisfied from the internal dithering used by x264 as it sometimes gives really visible banding.

I prefer modern filter ones.
__________________
@turment on Telegram
tormento 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 03:10.


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