View Full Version : Super Slow Sharpen
brainman
2nd March 2009, 21:19
HEUREKA! I've found the solution! (at least it seems so)
It was actually you, Didée who solved it, maybe even without knowing, sorta.
I went back and read the variableblur thread and there you, Didée, mention that if the FFTW3 dll is too new, variableblur doesn't like it, and the one hosted on warpenterprises is working.
So i tried it out, and voila!
Thanks a lot for help given a long time ago :)
Archimedes
6th March 2009, 17:14
I've got very strange results with SSSharp (default settings). Look at the white points around the corner.
http://img243.imageshack.us/img243/3825/noprocessingwv30704x046.th.png (http://img243.imageshack.us/my.php?image=noprocessingwv30704x046.png)
With denoise=0, i haven't any problems:
http://img13.imageshack.us/img13/3825/noprocessingwv30704x046.th.png (http://img13.imageshack.us/my.php?image=noprocessingwv30704x046.png)
My plugin section:
LoadPlugin("plugins\LoadDLL\LoadDll.dll")
LoadDll("dll\fftw3.dll")
LoadPlugin("plugins\aWarpSharp\aWarpSharp.dll")
LoadPlugin("plugins\DCTFun4b\dctfun4b.dll")
LoadPlugin("plugins\DeGrainMedian\degrainmedian.dll")
LoadPlugin("plugins\MaskTools 2\mt_masktools.dll")
LoadPlugin("plugins\RemoveGrain 1.0\RemoveGrain.dll")
LoadPlugin("plugins\RemoveGrainHD\RemoveGrainHD.dll")
LoadPlugin("plugins\VariableBlur\VariableBlur.dll")
*.mp4 guy
7th March 2009, 06:20
Thats a known bug with mask creation. If you pad all of the borders of the image out a few pixels before sssharp, then crop them back, it should take care of the problem. The denoise parameter is mostly to keep the the noise level in check while undergoing multiple sharpening iterations; If you don't need to use it to keep sssharp from turning the picture to snow, you are probably better off using something else for denoising.
Archimedes
9th March 2009, 10:29
Thanks for the explanation. So i will go with an extra denoiser afterwards (if needed).
SSSharp seems to be a good alternative for sharpening very blur sources (e. g. upscaled images). Where LimitedSharpenFaster fails, die to it’s internal sharpening principle, SSSharp can "blow up" such kind of sources.
Original (upscaled image):
http://img13.imageshack.us/img13/7672/2007042800121280x0960nn.th.png (http://img13.imageshack.us/my.php?image=2007042800121280x0960nn.png)
SuperSlowSharpen and dfttest:
http://img23.imageshack.us/img23/907/2007042800121280x0960su.th.jpg (http://img23.imageshack.us/my.php?image=2007042800121280x0960su.jpg)
Nearly the same effect can be achieved with SeeSaw, but you have to tweak more parameters.
whwhwhwh9
11th March 2009, 04:28
Hi,
I got VariableBlur040.zip as indicated in an eariler post, however, when I tried to load the script into VirtualDub, there's an error message saying "AVIsynth open failure: LoadPlugin: unable to load VariableBlur.dll". Could someone explain a little bit?
#version 0.1, optimizations by Didee
loadPlugin("variableBlur.dll")
loadPlugin("warpSharp.dll")
function halomaskM(clip c, int "hthr", int "hbias", int "agmrad"){
hthr = default(hthr, 256)
hbias = default(hbias, -128)
agmrad = default(agmrad, 1)
s = c
Mblur = (agmrad==1) ? s.removegrain(4,-1) : s.Quantile(radius_y=agmrad,radius_u=-1,radius_v=-1)
gblur = (agmrad<=5) ? s.binomialblur(vary=agmrad, varc=0) : s.gaussianblur(vary=agmrad, varc=0)
maskM = mt_lutxy(Mblur, Gblur, "y x - abs "+string(hthr)+" * "+string(hbias)+" +", U=1, V=1)
return(maskM)}
function halomaskMR(clip c, int "hthr", int "hbias"){
hthr = default(hthr, 256)
hbias = default(hbias, -128)
s = c
Ablur = s.removegrain(4)
gblur = s.gaussianblur(vary=1, varc=0)
mask3 = mt_lutxy(Ablur, Gblur, "y x - abs "+string(hthr)+" * "+string(hbias)+" +", U=1, V=1)
return(mask3)}
function SSW(clip c){
c#.unsharp()
w = width
h = height
spline36resize(w*3, h*3)
awarpsharp(cm=0, depth=3, blurlevel=1, thresh=0.99)
awarpsharp(cm=0, depth=3, blurlevel=1, thresh=0.99)
awarpsharp(cm=0, depth=3, blurlevel=1, thresh=0.99)
awarpsharp(cm=0, depth=3, blurlevel=1, thresh=0.99)
awarpsharp(cm=0, depth=3, blurlevel=1, thresh=0.99)
awarpsharp(cm=0, depth=3, blurlevel=1, thresh=0.99)
awarpsharp(cm=0, depth=3, blurlevel=1, thresh=0.99)
awarpsharp(cm=0, depth=3, blurlevel=1, thresh=0.99)
awarpsharp(cm=0, depth=3, blurlevel=1, thresh=0.99)
awarpsharp(cm=0, depth=3, blurlevel=1, thresh=0.99)
spline36resize(w, h)}
function SSSharp(clip c, float "rad", bool "ssw", float "strength", int "iter", bool "ss", int "denoise"){
rad = default(rad, 0.25)
ssw = default(ssw, true)
strength = default(strength, 4)
iter = default(iter, 1)
ss = default(ss, true)
denoise = default(denoise, iter)
c
w = width(c)
h = height(c)
sswc = ssw ? c.ssw() : c
(iter >= 1) ? MT_Merge(unsharp(vary=rad, varc=1, strength=strength), sswc, spline36resize((ss ? w*4 : w), (ss ? h*4 : h)).halomaskM(hbias=-128, hthr=256, agmrad=(ss ? round(rad*4) : round(rad))).spline36resize(w, h)) : last
(denoise >=1) ? degrainmedian(mode=3).dctfun4b(2,2) : last
(iter >= 2) ? MT_Merge(unsharp(vary=rad, varc=1, strength=strength), sswc, spline36resize((ss ? w*4 : w), (ss ? h*4 : h)).halomaskM(hbias=-128, hthr=256, agmrad=(ss ? round(rad*4) : round(rad))).spline36resize(w, h)) : last
(denoise >=2) ? degrainmedian(mode=3).dctfun4b(2,2) : last
(iter >= 3) ? MT_Merge(unsharp(vary=rad, varc=1, strength=strength), sswc, spline36resize((ss ? w*4 : w), (ss ? h*4 : h)).halomaskM(hbias=-128, hthr=256, agmrad=(ss ? round(rad*4) : round(rad))).spline36resize(w, h)) : last
(denoise >=3) ? degrainmedian(mode=3).dctfun4b(2,2) : last
(iter >= 4) ? MT_Merge(unsharp(vary=rad, varc=1, strength=strength), sswc, spline36resize((ss ? w*4 : w), (ss ? h*4 : h)).halomaskM(hbias=-128, hthr=256, agmrad=(ss ? round(rad*4) : round(rad))).spline36resize(w, h)) : last
(denoise >=4) ? degrainmedian(mode=3).dctfun4b(2,2) : last
return(last)
}
source = ImageSource("Ch11_20090228_191748_ClipSmall_7.264_Frame_1755.bmp")
SSSharp(source, ssw=true, iter=1, strength=1, rad=1)
#SSSharp(ssw=true, iter=2, strength=3)
Adub
11th March 2009, 04:31
Give it the actual path to your variableblur.
Ex:
LoadPlugin("C:/path/to/my/variablur.dll")
vs just
LoadPlugin("variableblur.dll")
whwhwhwh9
11th March 2009, 04:34
tried that, didn't work, either.
#version 0.1, optimizations by Didee
loadPlugin("j:\test\variableBlur.dll")
......
Archimedes
12th March 2009, 00:37
VariableBlur needs the fftw3 library.
sumawo13
7th September 2009, 09:11
Okay ... a bit earlier you said you deactivated everything *but* MCBob, so I thought you're still running the two fat boys in chain.
Next step: closer pebble examination.;) - try if the filters from the offending line cause an error when called on ther own:
AviSource("C:\VIDEO\Fuglekrigen.avi")
Trim(356, 94020)
converttoYV12
bob()
# unsharp(vary=2,varc=1) # error, or not?
# halomaskM(hbias=-128,hthr=256,amgrad=4) # error, or not?
What do I do if both of these cause an error? I'm having the same access violation error.
canuckerfan
12th October 2009, 09:08
i'm trying to modify this script to be compliant with SEt's new aWarpSharp2 (http://forum.doom9.org/showthread.php?t=147285). here's what I have so far:
old:
...
awarpsharp(cm=0, depth=3, blurlevel=1, thresh=0.99)
awarpsharp(cm=0, depth=3, blurlevel=1, thresh=0.99)
awarpsharp(cm=0, depth=3, blurlevel=1, thresh=0.99)
awarpsharp(cm=0, depth=3, blurlevel=1, thresh=0.99)
awarpsharp(cm=0, depth=3, blurlevel=1, thresh=0.99)
awarpsharp(cm=0, depth=3, blurlevel=1, thresh=0.99)
awarpsharp(cm=0, depth=3, blurlevel=1, thresh=0.99)
awarpsharp(cm=0, depth=3, blurlevel=1, thresh=0.99)
awarpsharp(cm=0, depth=3, blurlevel=1, thresh=0.99)
awarpsharp(cm=0, depth=3, blurlevel=1, thresh=0.99)
...
new:
...
awarpsharp2(chroma=2, depth=2, blur=1, thresh=253)
awarpsharp2(chroma=2, depth=2, blur=1, thresh=253)
awarpsharp2(chroma=2, depth=2, blur=1, thresh=253)
awarpsharp2(chroma=2, depth=2, blur=1, thresh=253)
awarpsharp2(chroma=2, depth=2, blur=1, thresh=253)
awarpsharp2(chroma=2, depth=2, blur=1, thresh=253)
awarpsharp2(chroma=2, depth=2, blur=1, thresh=253)
awarpsharp2(chroma=2, depth=2, blur=1, thresh=253)
awarpsharp2(chroma=2, depth=2, blur=1, thresh=253)
awarpsharp2(chroma=2, depth=2, blur=1, thresh=253)
...
this should do it right?
Original aWarpSharp compatibility:
Mapping from original aWarpSharp parameters:
thresh = thresh*256
blur = blurlevel
depth = depth*blurlevel/2
chroma = 0->2, 1->4, 2->3
Nightshiver
12th October 2009, 12:35
If the original thresh in the function was 0.99, why are you setting it so high to 253? And you also lowered the depth.
canuckerfan
13th October 2009, 01:34
^i'm trying to adapt the function for awarpsharp2 (SEt's mod).
thresh: 0..255, default 128
Saturation limit for edge detection. Reduce for less aggressive sharpening.
and for awarpsharp (original) to awarpsharp2 mapping:
Original aWarpSharp compatibility:
Mapping from original aWarpSharp parameters:
thresh = thresh*256
blur = blurlevel
depth = depth*blurlevel/2
chroma = 0->2, 1->4, 2->3
ncatt
13th October 2009, 03:15
Hi canuckerfan! Yes, your mod is correct.
markanini
24th October 2009, 22:13
I assume ss stands for supersampling and the w in ssw for warp? Great filter btw :D
I don't suppose this could be motion-compensated? Frames with low motion are sharpened and ones with high motion are not etc.
Undead Sega
2nd July 2010, 04:46
Hi everyone, sorry for bringing up this old but yet wonderful thread up, but after going through the pages and as obvious what the filter is called, may i ask if can someone tell me how slow this is compared to TGMC+NNEDI2??
Undead Sega
5th July 2010, 04:40
Anyone at all? hahaha, I can probably understand that no one maybe doesnt know this? I just wanted to know so I can be aware of its performance and speed.
Anyways, i am posting here to ask some advice, correct me if i am wrong but upon reading this filter's description, one can assume that this is probably (or one of) the best sharpening filters around. This is where I would like to ask, say if one has a pretty grainy DVD source and of course he or she would want to bring out more details by 'sharpening' it, what order or workflow would you suggest? Would you degrain the footage first before sharpening? OR sharpen before degraining?
I assume it would be the latter but I'm only assuming and it might not be a good filtering method or order, thus why I'm asking. :D
Assassinator
5th July 2010, 05:13
Hi everyone, sorry for bringing up this old but yet wonderful thread up, but after going through the pages and as obvious what the filter is called, may i ask if can someone tell me how slow this is compared to TGMC+NNEDI2??
1. Why don't you actually try it yourself? It would take someone else just as much effort as you to do that comparison.
2. Why are you comparing to TGMC? Last I checked, TGMC is a deinterlacer, and SSSharp is a sharpener. Completely different things, you can't substitute one for the other.
Undead Sega
5th July 2010, 05:15
1. Why don't you actually try it yourself? It would take someone else just as much effort as you to do that comparison.
2. Why are you comparing to TGMC? Last I checked, TGMC is a deinterlacer, and SSSharp is a sharpener. Completely different things, you can't substitute one for the other.
1. I was just asking and wondering at the same time...
2. ...in relation to that, the reason why I mention TGMC was because it is also known to be very slow as well and it is something that I am using myself, nothing to do with wat it can do, just all about the speed :)
*.mp4 guy
5th July 2010, 22:08
There are many reasons why they are not directly comparable speed wise. Ram usage, seek latency, startup latency from luts, etc. That said I'm pretty sure that sssharp is not significantly slower then tgmc, its possible it might be faster, but I haven't ever directly compared them.
Undead Sega
6th July 2010, 03:17
Oh right then, thanks for that, that definately gives me a small idea in the speed (and of course why :D) that SSSharp performs at.
With that out of the way, I still would like to know what would be a good order for processing SSSharp on a grainy source. Would I degrain the footage first before sharpening? OR sharpen before degraining? In addition to that, NNEDI2 or BlackmanResize (dont know which one to apply) will be used to resize the footage to HD resolution (cant stand my TV doing the upscaling).
In this case, would I:
- Sharpen > Degrain > Resize?
- Degrain > Sharpen > Resize?
- Sharpen > Resize > Degrain?
- Degrain > Resize > Sharpen?
- Resize > Sharpen > Degrain?
In theory, all methods have their pros (and cons) but I thought I would ask the people here on this, I would appreciate it if someone can help me on this. Thanks again.
*.mp4 guy
8th July 2010, 03:50
Well, sssharp's output always needs denoising, but other then that its like debating which part of a pizza to eat first.
Undead Sega
9th July 2010, 03:16
Well, sssharp's output always needs denoising, but other then that its like debating which part of a pizza to eat first.
Well I like to place a compass ontop of my pizza to know where it's pointing North so I can start eating from South making my way towards the top :D
...anyways, I can understand from what you said, as it is most likely that just sharpening footage not only enhances detail but will also make noise/grain more evident right?
Therefore, for the first stage, it is best to sharpen first, however after that would I degrain the footage (using Temporaldegrain) before resizing or after?
Also, if you dont mind me asking, besides from SSSharp being slow, how does it differ from or what does it do exactly compared to other sharpeners to make it operate at this sort of speed?
Undead Sega
21st July 2010, 16:23
something wrong with what I said?
Anyone at all may i ask? :D
*.mp4 guy
23rd July 2010, 12:34
Therefore, for the first stage, it is best to sharpen first, however after that would I degrain the footage (using Temporaldegrain) before resizing or after?
If you interpolate first, (before sharpening and denoising) things will be much much slower, and interpolation artifacts will be sharpened, and you will need to make the denoiser slower/stronger because the noise it is dealing with is lower frequency. Therefore interpolation has to be last (possibly with some minor additional sharpening after the fact), as there is no significant advantage to doing it first, but it is much slower.
If you sharpen first you make the job of the interpolator and the denoiser more difficult, but the interpolator is going to have problems with the sharpening no matter when you do it, and this is faster.
So do you denoise before or after sharpening? well, that depends on a lot of things. In sssharps case, it essentially always requires denoising after the fact, but if you denoise before sssharp, you can reduce the amount of noise amplification it causes. So basically, denoise after sssharp if you can do that while achieving an acceptable level of noise. Otherwise you will probably have to denoise both before and after; alternatively you could use a less aggressive sharpener, which is probably the better choice.
Also, if you dont mind me asking, besides from SSSharp being slow, how does it differ from or what does it do exactly compared to other sharpeners to make it operate at this sort of speed?
Long story short, the approach sssharp uses requires much more supersampling then other sharpeners, and supersampling is very slow.
Undead Sega
27th July 2010, 05:01
Hello *.mp4 guy, thanks for getting back to me here :D
If you interpolate first, (before sharpening and denoising) things will be much much slower, and interpolation artifacts will be sharpened, and you will need to make the denoiser slower/stronger because the noise it is dealing with is lower frequency. Therefore interpolation has to be last (possibly with some minor additional sharpening after the fact), as there is no significant advantage to doing it first, but it is much slower.
This makes sense, as when using an already powerful/slow degrainer(denoiser?) on SD sources knowing it will be quite slow, who knows how long it will take on HD sources? :D Also I do agree with you about when interpolating first because whatever risidue or artifacts are created by it, it will only be enhanced by the forthcoming filters. So in this case, Resizing will come last.
If you sharpen first you make the job of the interpolator and the denoiser more difficult, but the interpolator is going to have problems with the sharpening no matter when you do it, and this is faster.
This i dont quite understand, as when sharpening, you would be enhacing details if i am correct, how can this make the job more difficult for the resizing and denoiser? And what problems would I encounter from the interpolator? :(
So do you denoise before or after sharpening? well, that depends on a lot of things. In sssharps case, it essentially always requires denoising after the fact, but if you denoise before sssharp, you can reduce the amount of noise amplification it causes. So basically, denoise after sssharp if you can do that while achieving an acceptable level of noise. Otherwise you will probably have to denoise both before and after; alternatively you could use a less aggressive sharpener, which is probably the better choice.
Because of the fact i am enhacing a grainy/noisy image, the denoiser will now obviously come after the sharpener. However, now going in specifics with the filters, my intention as i said before is to use TemporalDegrain, which is apprantly an excellent degrainer with having detail retained, if i was to use this before sharpening, wouldnt I need to use it again to clean it again or that wouldnt be the case because it was cleaned already?
Also, if its true wat they say about TemporalDegrain, in theory, if the source was sharpened, enhancing detail and grain itself and then using TemporalDegrain to remove the grain, wouldnt I result in a highly detailed clean video compared to how it looked originally?
Long story short, the approach sssharp uses requires much more supersampling then other sharpeners, and supersampling is very slow.
Probably the reason why I am wanting to use SSSharp, dont think anything beats it (performance wise, not speed) right? :D By the way, is there any option on SSSharpen to say "ohhh...I only want to sharpen the footage this amount, or like twice as sharp than what the original is?" (silly I know but I could never figure out how sharpeners work).
*.mp4 guy
30th July 2010, 01:44
This i dont quite understand, as when sharpening, you would be enhacing details if i am correct, how can this make the job more difficult for the resizing and denoiser? And what problems would I encounter from the interpolator? :(
sharpening puts more "energy" into the high frequencies, which are by definition closer to the nyquist frequency (the frequency beyond which all other frequencies can only result in aliasing rather then useful information). Putting more stuff close to the nyquist frequency almost by definition requires higher quality interpolation to remain as artifact free as something with less energy close to the nyquist limit.
Because of the fact i am enhacing a grainy/noisy image, the denoiser will now obviously come after the sharpener. However, now going in specifics with the filters, my intention as i said before is to use TemporalDegrain, which is apprantly an excellent degrainer with having detail retained, if i was to use this before sharpening, wouldnt I need to use it again to clean it again or that wouldnt be the case because it was cleaned already?
The issue is that getting good quality denoising and removing 100% of the noise you are targeting are mutually exclusive. So if you denoise beforehand then sharpen, there will be noise left, and the same if you sharpen and then denoise. clearly sharpening and then denoising will also result in more left over noise then denoising alone. So the question is "will denoising after sharpening result in acceptably low noise levels?" Usually I would say that the answer is yes.
Also, if its true wat they say about TemporalDegrain, in theory, if the source was sharpened, enhancing detail and grain itself and then using TemporalDegrain to remove the grain, wouldnt I result in a highly detailed clean video compared to how it looked originally?
That is completely contingent upon the source and the filters you use.
Probably the reason why I am wanting to use SSSharp, dont think anything beats it (performance wise, not speed) right? :D By the way, is there any option on SSSharpen to say "ohhh...I only want to sharpen the footage this amount, or like twice as sharp than what the original is?" (silly I know but I could never figure out how sharpeners work).
That would require some useful way to calculate a quantifiable metric of "sharpness" that can understand what needs to be sharp and what doesn't.
Nevilne
8th August 2010, 09:29
I would love some help with modifying SSSharpen:
I've altered SSSharpfaster by LaTo for my encoding needs, and it turned out quite fast, to the point where i'm thinking of using it as lowres video filter in ffdshow.
However there's a really weird black/white pixel noise, and I can't fix it in script because I don't know masktools good enough.
_____
super old post edit: just using LSFmod now, yay!
Didée
8th August 2010, 13:10
That's not a problem of MaskTools usage. The problem is mode 19 of RemoveGrain, and the very high default strength. Strength is used as a multiplicator, so the default means that an original blur difference of e.g. +/- 4 will be amplified to a sharpen difference of +/- 36. Leaving the edge masking aside for a moment, this strength is roughly comparable to sharpen(1).sharpen(1).sharpen(1). In a word, that's really way too much. :)
Another point is that removegrain(19) will cause inversion on some certain spatial pixel combinations. Therefore, in some pixel clusters the effect will be additionally amplified. This will be particularly noticeable on DCT compression artifacts of realworld video sources - (Though, this inversion/amplification probably only affects the not-supersampled S5 version. On S4 with its 2x supersampling, it shouldn't be an issue.)
Nevilne
11th August 2010, 20:15
Yeah, it appears that it's too strong when it's not supersampled, but I need this strength so resizing is unavoidable. Thanks!
*.mp4 guy
11th August 2010, 20:57
function MGsharp(clip c, float "strength", int "thresh", int "ss")
{
thresh = default(thresh, 121)
strength = default(strength, 6.0)
ss = default(ss , 4)
ss = 8 - ss
ss = C.lanczosresize(round(C.width/ss)*8, round(C.height/ss)*8, taps=2)
lowpass = ss.dctfilter(1, 1, 1, 1, 0.875, 0.75, 0.375, 0.125)
Gblur = lowpass.removegrain(19,-1)
DiffBlur = mt_makediff(lowpass, Gblur, u=1, v=1)
Med_Diff = DiffBlur.removegrain(4 ,-1)
Med_diff = Mt_Lut(Med_Diff, \
" X 128 - X 128 - abs X 128 - abs * X 128 - * X 128 - abs X 128 - abs * "+string(thresh)+" + / - "+string(strength)+" * 128 +",\
u=2, v=2).bilinearresize(C.width, C.height)
mt_adddiff(Med_diff, C, u=1, v=1).mergechroma(C, 1)
}
This is the fastest thing similar to sssharp I can think of. No masking, only one lut, and it is a single variable lut, faster supersampling (less taps), lowpassing is approximated with a single dctfilter call, which is very fast. It will also work with ss=0 (no supersampling), though it looks best with ss=4 (2x supersampling). with lower ss, you have to set either thresh or strength lower to avoid aliasing, lower thresh means less sharpening of already sharp things, less strength means less sharpening of everything.
[Edit] Nevermind all that, I put this together in a hurry and only tested it on one source, this filter is in fact junk, worthless, don't use it.
Gser
1st November 2011, 17:04
I am running SETs avisynth 2.6 and I'm only using this filter and it just crashes. I have the newest versions of the filters.
*.mp4 guy
2nd November 2011, 02:29
Make sure all of the plugins work individually, let the requisite parties know if any of them don't work. If everything checks out, using non-MT, non-64 bit avisynth, try using sssharp on very small images to rule out memory management problems.
The script is very simple, but also very resource heavy, it's almost certainly a bug somewhere else.
Jenyok
1st December 2011, 09:29
http://avisynth.org/mediawiki/External_filters
UnsharpHQ A strong and fast unsharp mask with some new features. See thread. YV12 Plugin
.
Could I use UnsharpHQ function instead Unsharp function (SSSharp()) ?
What are parameters for UnsharpHQ function, if I could use this UnsharpHQ function in SSSharp() ?
See URL upper...
.
I tried with
# unsharpHQ(float STR = 5.0)
ush = unsharpHQ(rad)
(iter >= 1) ? MT_Merge(ush, sswc, spline36resize((ss ? w*4 : w), (ss ? h*4 : h)).halomaskM(hbias=-128, hthr=256, agmrad=(ss ? round(rad*4) : round(rad))).spline36resize(w, h)) : last
(denoise >=1) ? degrainmedian(mode=3).dctfun4b(2, 2) : last
#
# so on...
.
It is works, but I don't know, unsharpHQ works correct or no in this function ?!
.
Thanks a lot...
*.mp4 guy
2nd December 2011, 02:09
You can put just about any linear form of sharpening there and it will "work". If the output looks the way you want it too, it works.
Jenyok
3rd December 2011, 15:38
*.mp4 guy
.
I think your answer is bad...
jinkazuya
10th December 2011, 08:54
Pretty nice plugin and gotta give it a try here.
Jenyok
4th September 2012, 12:57
Various SSSharp functions...
.
#
# Various Sharpen functions ...
#
# Sharp.avsi
#
#
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\VARIABLEBLUR_25_DLL_20050524\variableblur.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\DCTFUN4B_25_DLL_20060205\dctfun4b.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\DEGRAINMEDIAN_20061008\degrainmedian.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\MASKTOOLS-V2_0A48\mt_masktools-25.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAIN-1_0\removegrain.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAINHD_20071126\removegrainhd.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\SHARPFUNCTION_ASHARP_25_DLL_20030118\asharp.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\SHARPFUNCTION_WARPSHARP_20080325\warpsharp.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\SHARPFUNCTION_AWARPSHARP_25_DLL_20030203\awarpsharp.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\SHARPFUNCTION_AWARPSHARP_20090619\awarpsharp.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\SHARPFUNCTION_UNSHARPHQ_V04\unsharphq_v04.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\DCTFILTER_25_DLL_20030221\dctfilter.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\FFT3DFILTER_20070220\fft3dfilter.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\TTEMPSMOOTH_25_DLL_20051117\ttempsmooth.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\VAGUEDENOISER_25_DLL_20050926\vaguedenoiser.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\HQDN3D_25_DLL_20050125\hqdn3d.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\MVTOOLS-V2_5_11_3\mvtools2.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\REMOVEGRAIN-1_0\repair.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\NNEDI2\nnedi2.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\MASKTOOLS-V1_5_8\masktools.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\DEEN_25_DLL_20050705\deen.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\SANGNOM_25_DLL_20040118\sangnom.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\GRADFUN2DB-V1_0\gradfun2db.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\ADDGRAINC_25_DLL_20060610\addgrainc.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\AVERAGE_V11\average.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\DFTTESTV_1_6\dfttest.dll")
Import("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\MINBLUR\minblur.avsi")
Import("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\GRADFUN2DBMOD_V1_5\gradfun2dbmod_v1_5.avsi")
Import("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\HQDERING\hqdering.avsi")
Import("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\DEHALO_ALPHA\dehalo_alpha.avsi")
Import("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\SEESAW\seesaw.avsi")
#
# SSSharp() function ...
#
# http://forum.doom9.org/showthread.php?t=132330
#
function SSSharp(clip c, float "rad", bool "ssw", float "strength", int "iter", bool "ss", int "denoise")
{
rad = Default(rad, 0.25)
ssw = Default(ssw, true)
strength = Default(strength, 4.0)
iter = Default(iter, 1)
ss = Default(ss, true)
denoise = Default(denoise, iter)
c
w = width(c)
h = height(c)
sswc = ssw ? c.ssw() : c
ush = unsharp(vary=rad, varc=1, strength=strength)
(iter >= 1) ? MT_Merge(ush, sswc, spline64resize((ss ? w * 4 : w), (ss ? h * 4 : h)).halomaskM(hbias=-128, hthr=256, \
agmrad=(ss ? round(rad * 4) : round(rad))).spline64resize(w, h)) : last
(denoise >=c1) ? degrainmedian(mode=3).dctfun4b(2, 2) : last
(iter >= 2) ? MT_Merge(ush, sswc, spline64resize((ss ? w * 4 : w), (ss ? h * 4 : h)).halomaskM(hbias=-128, hthr=256, \
agmrad=(ss ? round(rad * 4) : round(rad))).spline64resize(w, h)) : last
(denoise >=c2) ? degrainmedian(mode=3).dctfun4b(2, 2) : last
(iter >= 3) ? MT_Merge(ush, sswc, spline64resize((ss ? w * 4 : w), (ss ? h * 4 : h)).halomaskM(hbias=-128, hthr=256, \
agmrad=(ss ? round(rad * 4) : round(rad))).spline64resize(w, h)) : last
(denoise >=c3) ? degrainmedian(mode=3).dctfun4b(2, 2) : last
(iter >= 4) ? MT_Merge(ush, sswc, spline64resize((ss ? w * 4 : w), (ss ? h * 4 : h)).halomaskM(hbias=-128, hthr=256, \
agmrad=(ss ? round(rad * 4) : round(rad))).spline64resize(w, h)) : last
(denoise >=c4) ? degrainmedian(mode=3).dctfun4b(2, 2) : last
return (last)
}
#
# SSSharp2() function ...
#
# http://forum.doom9.org/showthread.php?t=132330
# http://forum.doom9.org/showthread.php?t=132330&page=3
#
# replace SSW() function with SSW2() function ...
#
function SSSharp2(clip c, float "rad", bool "ssw", float "strength", int "iter", bool "ss", int "denoise")
{
rad = Default(rad, 0.25)
ssw = Default(ssw, true)
strength = Default(strength, 4.0)
iter = Default(iter, 1)
ss = Default(ss, true)
denoise = Default(denoise, iter)
c
w = width(c)
h = height(c)
sswc = ssw ? c.ssw2() : c
ush = unsharp(vary=rad, varc=1, strength=strength)
(iter >= 1) ? MT_Merge(ush, sswc, spline64resize((ss ? w * 4 : w), (ss ? h * 4 : h)).halomaskM(hbias=-128, hthr=256, \
agmrad=(ss ? round(rad * 4) : round(rad))).spline64resize(w, h)) : last
(denoise >= 1) ? degrainmedian(mode=3).dctfun4b(2, 2) : last
(iter >= 2) ? MT_Merge(ush, sswc, spline64resize((ss ? w * 4 : w), (ss ? h * 4 : h)).halomaskM(hbias=-128, hthr=256, \
agmrad=(ss ? round(rad * 4) : round(rad))).spline64resize(w, h)) : last
(denoise >= 2) ? degrainmedian(mode=3).dctfun4b(2, 2) : last
(iter >= 3) ? MT_Merge(ush, sswc, spline64resize((ss ? w * 4 : w), (ss ? h * 4 : h)).halomaskM(hbias=-128, hthr=256, \
agmrad=(ss ? round(rad * 4) : round(rad))).spline64resize(w, h)) : last
(denoise >= 3) ? degrainmedian(mode=3).dctfun4b(2, 2) : last
(iter >= 4) ? MT_Merge(ush, sswc, spline64resize((ss ? w * 4 : w), (ss ? h * 4 : h)).halomaskM(hbias=-128, hthr=256, \
agmrad=(ss ? round(rad * 4) : round(rad))).spline64resize(w, h)) : last
(denoise >= 4) ? degrainmedian(mode=3).dctfun4b(2, 2) : last
return (last)
}
#
# SSSharpHQ() function ...
#
# http://forum.doom9.org/showthread.php?t=132330
#
# replace unSharp() function with unSarpHQ() function ...
#
function SSSharpHQ(clip c, float "rad", bool "ssw", float "strength", int "iter", bool "ss", int "denoise")
{
rad = Default(rad, 0.25)
ssw = Default(ssw, true)
strength = Default(strength, 4.0)
iter = Default(iter, 1)
ss = Default(ss, true)
denoise = Default(denoise, iter)
c
w = width(c)
h = height(c)
sswc = ssw ? c.ssw() : c
## unsharpHQ(float STR = 5.0)
# ush = unsharpHQ(rad * 10.0)
ush = unsharpHQ(strength)
(iter >= 1) ? MT_Merge(ush, sswc, spline64resize((ss ? w * 4 : w), (ss ? h * 4 : h)).halomaskM(hbias=-128, hthr=256, \
agmrad=(ss ? round(rad * 4) : round(rad))).spline64resize(w, h)) : last
(denoise >= 1) ? degrainmedian(mode=3).dctfun4b(2, 2) : last
(iter >= 2) ? MT_Merge(ush, sswc, spline64resize((ss ? w * 4 : w), (ss ? h * 4 : h)).halomaskM(hbias=-128, hthr=256, \
agmrad=(ss ? round(rad * 4) : round(rad))).spline64resize(w, h)) : last
(denoise >= 2) ? degrainmedian(mode=3).dctfun4b(2, 2) : last
(iter >= 3) ? MT_Merge(ush, sswc, spline64resize((ss ? w * 4 : w), (ss ? h * 4 : h)).halomaskM(hbias=-128, hthr=256, \
agmrad=(ss ? round(rad * 4) : round(rad))).spline64resize(w, h)) : last
(denoise >= 3) ? degrainmedian(mode=3).dctfun4b(2, 2) : last
(iter >= 4) ? MT_Merge(ush, sswc, spline64resize((ss ? w * 4 : w), (ss ? h * 4 : h)).halomaskM(hbias=-128, hthr=256, \
agmrad=(ss ? round(rad * 4) : round(rad))).spline64resize(w, h)) : last
(denoise >= 4) ? degrainmedian(mode=3).dctfun4b(2, 2) : last
return (last)
}
#
# SSSharpHQ2() function ...
#
# http://forum.doom9.org/showthread.php?t=132330
# http://forum.doom9.org/showthread.php?t=132330&page=3
#
# replace unSharp() function with unSharpHQ() function ...
# replace SSW() function with SSW2() function ...
#
function SSSharpHQ2(clip c, float "rad", bool "ssw", float "strength", int "iter", bool "ss", int "denoise")
{
rad = Default(rad, 0.25)
ssw = Default(ssw, true)
strength = Default(strength, 4.0)
iter = Default(iter, 1)
ss = Default(ss, true)
denoise = Default(denoise, iter)
c
w = width(c)
h = height(c)
sswc = ssw ? c.ssw2() : c
## unsharpHQ(float STR = 5.0)
# ush = unsharpHQ(rad * 10.0)
ush = unsharpHQ(strength)
(iter >= 1) ? MT_Merge(ush, sswc, spline64resize((ss ? w * 4 : w), (ss ? h * 4 : h)).halomaskM(hbias=-128, hthr=256, \
agmrad=(ss ? round(rad * 4) : round(rad))).spline64resize(w, h)) : last
(denoise >= 1) ? degrainmedian(mode=3).dctfun4b(2, 2) : last
(iter >= 2) ? MT_Merge(ush, sswc, spline64resize((ss ? w * 4 : w), (ss ? h * 4 : h)).halomaskM(hbias=-128, hthr=256, \
agmrad=(ss ? round(rad * 4) : round(rad))).spline64resize(w, h)) : last
(denoise >= 2) ? degrainmedian(mode=3).dctfun4b(2, 2) : last
(iter >= 3) ? MT_Merge(ush, sswc, spline64resize((ss ? w * 4 : w), (ss ? h * 4 : h)).halomaskM(hbias=-128, hthr=256, \
agmrad=(ss ? round(rad * 4) : round(rad))).spline64resize(w, h)) : last
(denoise >= 3) ? degrainmedian(mode=3).dctfun4b(2, 2) : last
(iter >= 4) ? MT_Merge(ush, sswc, spline64resize((ss ? w * 4 : w), (ss ? h * 4 : h)).halomaskM(hbias=-128, hthr=256, \
agmrad=(ss ? round(rad * 4) : round(rad))).spline64resize(w, h)) : last
(denoise >= 4) ? degrainmedian(mode=3).dctfun4b(2, 2) : last
return (last)
}
#
# Supported functions() and so on...
# for SSSharp(), SSSharp2(), SSSharpHQ(), SSSharpHQ2() functions ...
#
# http://forum.doom9.org/showthread.php?t=132330
#
# version 0.1, optimizations by Didee
#
function halomaskM(clip c, int "hthr", int "hbias", int "agmrad")
{
hthr = Default(hthr, 256)
hbias = Default(hbias, -128)
agmrad = Default(agmrad, 1)
s = c
Mblur = (agmrad == 1) ? s.removegrain(4, -1) : s.Quantile(radius_y=agmrad, radius_u=-1, radius_v=-1)
Gblur = (agmrad <= 5) ? s.binomialblur(vary=agmrad, varc=0) : s.gaussianblur(vary=agmrad, varc=0)
maskM = mt_lutxy(Mblur, Gblur, "y x - abs " + string(hthr) + " * " + string(hbias) + " +", U=1, V=1)
return (maskM)
}
#
# Supported functions() and so on...
# for SSSharp(), SSSharp2(), SSSharpHQ(), SSSharpHQ2() functions ...
#
# http://forum.doom9.org/showthread.php?t=132330
#
# version 0.1, optimizations by Didee
#
function halomaskMR(clip c, int "hthr", int "hbias")
{
hthr = Default(hthr, 256)
hbias = Default(hbias, -128)
s = c
Ablur = s.removegrain(4)
Gblur = s.gaussianblur(vary=1, varc=0)
mask3 = mt_lutxy(Ablur, Gblur, "y x - abs " + string(hthr) + " * " + string(hbias) + " +", U=1, V=1)
return (mask3)
}
#
# Supported functions() and so on...
# for SSSharp(), SSSharp2(), SSSharpHQ(), SSSharpHQ2() functions ...
#
# http://forum.doom9.org/showthread.php?t=132330
#
# version 0.1, optimizations by Didee
#
function SSW(clip c)
{
c#.unsharp()
w = width(c)
h = height(c)
spline64resize(w * 3, h * 3)
awarpsharp(cm=0, depth=3, blurlevel=1, thresh=0.99)
awarpsharp(cm=0, depth=3, blurlevel=1, thresh=0.99)
awarpsharp(cm=0, depth=3, blurlevel=1, thresh=0.99)
awarpsharp(cm=0, depth=3, blurlevel=1, thresh=0.99)
awarpsharp(cm=0, depth=3, blurlevel=1, thresh=0.99)
awarpsharp(cm=0, depth=3, blurlevel=1, thresh=0.99)
awarpsharp(cm=0, depth=3, blurlevel=1, thresh=0.99)
awarpsharp(cm=0, depth=3, blurlevel=1, thresh=0.99)
awarpsharp(cm=0, depth=3, blurlevel=1, thresh=0.99)
awarpsharp(cm=0, depth=3, blurlevel=1, thresh=0.99)
Spline64Resize(w, h)
return (last)
}
#
# Supported functions() and so on...
# for SSSharp(), SSSharp2(), SSSharpHQ(), SSSharpHQ2() functions ...
#
# http://forum.doom9.org/showthread.php?t=132330
#
# version 0.1, optimizations by Didee
#
function SSW2(clip c)
{
c#.unsharp()
w = width(c)
h = height(c)
spline64resize(w * 3, h * 3)
awarpsharp2(chroma=2, depth=2, blur=1, thresh=253)
awarpsharp2(chroma=2, depth=2, blur=1, thresh=253)
awarpsharp2(chroma=2, depth=2, blur=1, thresh=253)
awarpsharp2(chroma=2, depth=2, blur=1, thresh=253)
awarpsharp2(chroma=2, depth=2, blur=1, thresh=253)
awarpsharp2(chroma=2, depth=2, blur=1, thresh=253)
awarpsharp2(chroma=2, depth=2, blur=1, thresh=253)
awarpsharp2(chroma=2, depth=2, blur=1, thresh=253)
awarpsharp2(chroma=2, depth=2, blur=1, thresh=253)
awarpsharp2(chroma=2, depth=2, blur=1, thresh=253)
Spline64Resize(w, h)
return (last)
}
Jenyok
14th September 2012, 14:58
While using function SSSharpHQ2(), see upper previous my post "Various SSSharp functions...", with the following parameters
SSSharpHQ2(iter=4, strength=15, rad=2) with parameter "rad=2" and more then 2,
there is an error, see attached file picture, in function
halomaskM(clip c, int "hthr", int "hbias", int "agmrad")
line/string in function
Gblur = (agmrad <= 5) ? s.binomialblur(vary=agmrad, varc=0) : s.gaussianblur(vary=agmrad, varc=0)
.
I think, this error is in binomialblur() or in gaussianblur() function.
.
Why ?
What could I do ?
Jenyok
15th September 2012, 15:57
Found errors in various SSSharp functions.
Please, change VARIABLEBLUR.DLL version 0.4 to version 0.7 from here http://bengal.missouri.edu/~kes25c/variableblur.zip
.
Please, read following topic http://forum.doom9.org/showthread.php?t=88645
especially page 4 .
.
Function unsharpHQ() does not works correctly.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.