View Full Version : Super Slow Sharpen
*.mp4 guy
2nd December 2007, 03:52
#version 0.1, optimizations by Didée
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)
}
Rad must be a multiple of 0.25 when ss=true, or 1 when ss=false. usable range is 0.25 to ~8, using a rad that is not close to the radius of the bluring present in your source will give suboptimal results. Higher iter, with lower strength will give more precise masking (less halos for same sharpening) but will be very slow.
example usage:source = MPEG2Source("J:\GITS_D1\VIDEO_TS\GITS.d2v", cpu=0, info=3).colormatrix(hints=true, interlaced=true).crop(8,8,-8,-8).assumetff()
Deint = Source.securedeint().selecteven
IVTC = source.TFM(mode=7, clip2=deint, pp=7, slow=2, d2v="J:\GITS_D1\VIDEO_TS\GITS.d2v")
IVTC
SSSharp(ssw=true, iter=1, strength=1, rad=1)
SSSharp(ssw=true, iter=2, strength=3)
deen("m2d", 20, 12, 0)
example pic (http://img225.imageshack.us/img225/9485/examplejz3.png)
no processing (http://img225.imageshack.us/img225/7565/noprocessingwv3.png)
TheRyuu
2nd December 2007, 08:44
I can't find 2 plugins needed for the script: unsharp, and gaussianblur.
And I always though I had all the filters I'd ever need :P
*.mp4 guy
2nd December 2007, 10:04
They are both part of the variableblur (http://forum.doom9.org/showthread.php?t=88645&highlight=variable+blur) plugin by tsp.
Didée
2nd December 2007, 13:28
There is a possible speed improvement, target is MedianBlur. MedianBlur alas is rather slow compared to the available faster alternatives.
MedianBlur(1) can be replaced by RemoveGrain(4). That's 2.5 to 3 times faster.
With radii > 1, MedianBlur(r) can be replaced by Quantile(), which is part of kassandro's new RemoveGrainHD filter package.
The parameters are a bit unintuitive at first glance, however Quantile runs at least 2.5 times as fast as MedianBlur, if not more.
Not sure how much impact this has in the context of the whole script (it seems very very slow just by looking at the script's code;)), but at least this particular filter is an obvious target for optimization.
tsp
2nd December 2007, 23:01
also using binomialBlur instead of gaussianblur might be worth a try.
*.mp4 guy
3rd December 2007, 05:47
@ tsp
How big is the difference between a vary=1 guassianblur and a var=1 binomialblur?
@Didée
Do you know if removegrain(4) has higher or lower ram usage then medianblur(1)?
[edit]
I tried to implement removegrain instead of medianblur for aplicable radii, but avisynth is barfing on all of the if : then's, I might just split out a separate function for it.
Didée
3rd December 2007, 13:17
How big is the difference between a vary=1 guassianblur and a var=1 binomialblur?
Big enough to make a noticeable difference.
Do you know if removegrain(4) has higher or lower ram usage then medianblur(1)?From testing with your function: a bit lower, it seems.
I tried to implement removegrain instead of medianblur for aplicable radii, but avisynth is barfing on all of the if : then's,
Hmm, I cannot reproduce that. To make use of the alternative filters, I changed two lines in HaloMask():
s = c
# Ablur = s.medianblur(agmrad)
Ablur = (agmrad==1) ? s.removegrain(4,-1) : s.Quantile(radius_y=agmrad,radius_u=-1,radius_v=-1)
# gblur = s.gaussianblur(vary=agmrad, varc=0)
gblur = (agmrad<=5) ? s.binomialblur(vary=agmrad, varc=0) : s.gaussianblur(vary=agmrad, varc=0)
mask3 = mt_lutxy(Ablur, Gblur, "y x - abs "+string(hthr)+" * "+string(hbias)+" +", U=1, V=1)
- That's all. No crashes or anything, even with insane settings.
Measures with SetMemoryMax(300) on a 2.8GHz Core2, 720x576 PAL smaple:
(Note that it's frames per *minute* ...)
SSSharp()
original: 23fpm
modded: 53 fpm
SSSharp(rad=3,ssw=true,iter=4)
original: 3.4 fpm
modded: 6.5 fpm
Those were quick'n dirty tests - short sample, only one repetition, no reboot inbetween, etc. Short of time, sorry. Still, it seems that the speed is roughly doubled by those changes, perhaps even more.
*.mp4 guy
3rd December 2007, 20:01
Thanks Didée, the way I was trying to implement it was pretty braindead... which is, I'm sure why I had problems.
Soulhunter
4th December 2007, 23:37
Wow! After seeing the long aWarpSharp chain, I was a bit shocked... But looking at your example n considering how blurry the source is, the result surprises me... Looks almost like some sort of deconvolution! How does it look in motion? [Is the effect "stable"?] Can you give some more samples? [Different content, less blurry -> less filtering, a source with higher resolution...] :]
Thx n' Bye
*.mp4 guy
4th December 2007, 23:53
Wow! After seeing the long aWarpSharp chain, I was a bit shocked... But looking at your example n considering how blurry the source is, the result surprises me... Looks almost like some sort of deconvolution! How does it look in motion? [Is the effect "stable"?] Can you give some more samples? [Different content, less blurry -> less filtering, a source with higher resolution...]
Thx n' Bye
The effect is completely stable (aslong as super sampling is used during mask generation, as it was in the example). To answer your second question, yes I can provide some more samples using a higher quality source, but the effect will be more subtle because there isn't as much room for improvement with good sources. I should also mention that this sharpening method sharpens halos just as much as it sharpens everything else, so given a source with haloig, sharpening it with SSSharp will make it worse, just to a much lesser extent then a regular unsharp mask.
I'm currently running a very ram hungry script, it should be done soon, and when it is I'll edit this post with a few more examples.
[edit]
script:MPEG2Source("J:\THANKYOUFORSMOKING_WS\VIDEO_TS\TYFS.d2v", cpu=0, info=3).colormatrix(hints=true).crop(0, 60, 0, -60)
SSSharp(denoise=1, iter=2, ssw=true)
SSSharp (http://img212.imageshack.us/img212/5310/sssharphf6.png), no processing (http://img486.imageshack.us/img486/5537/plainwg0.png)
SSSharp (http://img359.imageshack.us/img359/5624/sssharp2xv2.png), no processing (http://img212.imageshack.us/img212/3633/plain2cx5.png)
SSSharp (http://img359.imageshack.us/img359/5738/sssharp3ka0.png), no processing (http://img149.imageshack.us/img149/1262/plain3gb2.png)
Keep in mind that these examples are actualy very oversharp, and wouldn't look good after being scaled up to fullscreen, realistically this source doesn't need such strong sharpening.
foxyshadis
6th December 2007, 17:27
I vote for calling it GlacialSharpen, though thanks to Didée it's no longer EpochSharpen. :p (EpicSharpen?) Works great for scans, though waiting 10 seconds every attempt while finding the right settings can be rather frustrating.
序列人
9th December 2007, 07:12
Very Very Very Slow! :(
EasyStart
14th December 2007, 06:09
I get an error message when I tried the script - no function named "unsharp". Where can I download the unsharp filter.
Easystart
EasyStart
14th December 2007, 06:22
Sorry guys. Forget my previous post. I didn't read the posts correctly from the beginning.
Easystart
xbox360
10th January 2008, 12:42
May you please list down all the plugin's needed to run this Super Slow Sharpen script please, thank you.
*.mp4 guy
10th January 2008, 18:54
removegrain, quantile, variableblur, masktools 2, awarpsharp, degrainmedian and dctfun4b.
xbox360
11th January 2008, 02:33
Can you give a sample full working script with all the loaded plugins + syntax & everything else please, thank you.
*.mp4 guy
12th January 2008, 00:15
Just put the plugins in the autoload directory. The only thing you should bother changing is the strength parameter, 4, the default value, is very strong.
xbox360
12th January 2008, 03:15
Just put the plugins in the autoload directory. The only thing you should bother changing is the strength parameter, 4, the default value, is very strong.
I do not compute, seriously I dont understand, can you give a step by step guide please, thank you. I hope it's not too troublesome. Also I get this error -> unsharp unknown command
Shinigami-Sama
12th January 2008, 03:31
(EpicSharpen?)
<3
+1
also
this looks really cool
I've got some lame scans and such laying around that would benefit from this
'course that means I'd have to set avisynth again
*.mp4 guy
12th January 2008, 06:25
I do not compute, seriously I dont understand, can you give a step by step guide please, thank you. I hope it's not too troublesome. Also I get this error -> unsharp unknown command
That error means that you need tsp's variable blur (http://forum.doom9.org/showthread.php?t=88645&highlight=variable%20blur) plugin.
I vote for calling it GlacialSharpen, though thanks to Didée it's no longer EpochSharpen. :p (EpicSharpen?) Works great for scans, though waiting 10 seconds every attempt while finding the right settings can be rather frustrating.
I wish I could think of good names like that, I usually just go with the shortest semi-discriptive thing I can cludge together.
vcmohan
20th January 2008, 13:32
I was trying out an idea of mine to sharpen images as seen in my plugin FQSharp. Since that was not satisfactory I left it and was trying different methods. The results were not still satisfactory as I was trying on more severely blurred images. On two of images given above the output I get are:
http://img89.imageshack.us/img89/3549/fqblurunblur0vj0.th.png (http://img89.imageshack.us/my.php?image=fqblurunblur0vj0.png)
http://img89.imageshack.us/img89/5206/fqblurunblur1gc4.th.png (http://img89.imageshack.us/my.php?image=fqblurunblur1gc4.png)
It can be seen that while it sharpens, ringing is seen noticeably in the second image. One redeeming factor is it is very fast. If I can attenuate the ringing I will consider releasing it.
*.mp4 guy
21st January 2008, 03:26
I assume that your sharpener operates in the frequency domain (from the way the ringing manifests).
A while ago I made a masking function to find areas where a frequency based sharpener (dctlimit) would ring. Modified slightly and used on the example image you posted this is the result (http://img260.imageshack.us/img260/6350/fqblurunblurlessringingnx6.png). The results are suboptimal because this method relies on knowledge of the frequency transorm being aplied to estimate the error that will be introduced.
This is how it works.
C = [sharpened source]
S = C.sharpeningtransform
B = S.InverseSharpeningtransform # IE, if in the sharpener coeficient X is multiplied by 3.14, in the invers it is divided by 3.14
Then you take the absolute value of the difference between B and C, this can be thought of as the irrecoverable error introduced by the sharpening transform.
You then subtract a certain amount form this value, the amount represents the amount of error that is acceptable in the output,
lower values give better protection, higher give more sharpening, you then multiply everything by 255 to create a binary mask, only applying sharpening in the black areas.
It is generally a good idea to apply some bluring/antialiasing to the mask.
Here is an example as an MT_lutxy operation:
MT_lutxy(C, B, "x y - abs "+string(thresh)+" - 256 *", u=3, v=3)
vcmohan
21st January 2008, 04:26
Yes. As the name implies its in Freq domain. I also am able to determine the magnitude of blur, as long as it is constant in the frame. I have some ideas based on my experience in processing oil exploration data. If successful I will come back.
vcmohan
24th January 2008, 09:56
If I assume the original blur was Gaussian and process, then most of the ringing disappears. Was the original artificially Gaussian blurred? Theoretically an out of focus photograph has a Mexican hat style blur.
*.mp4 guy
24th January 2008, 11:20
No idea, thats what it looks like directly off the dvd, heres the script I used.
MPEG2Source("J:\THANKYOUFORSMOKING_WS\VIDEO_TS\TYFS.d2v", cpu=0, info=3).colormatrix(hints=true).crop(0, 60, 0, -60)
Personally, I think it looks like its been artificially blured in some way, but I really don't know. The studio may have just used a really bad resampler, or lowpassed it, or god knows what else.
ankurs
24th January 2008, 11:23
this rocks ! thanks :D brb after doing some sample encode's will let u knw the results soon ..
ankurs
24th January 2008, 11:25
also can anyone tell me how to use this on a .bmp image ? how can i call that in my script ?
ankurs
24th January 2008, 11:52
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\aWarpSharp.dll")
Import("C:\Program Files\AviSynth 2.5\plugins\SSSharp.avs")
DGDecode_mpeg2source("C:\PATH",cpu=3)
crop( 20, 78, -70, -74)
Spline36Resize(640,272)
SSSharp(ssw=true, iter=1, strength=1, rad=1)
and i am just doing this on purpose , not deinterlacing or anything myself , and this is the error which i am getting ..
http://i30.tinypic.com/4lokf6.jpg
:eek: ?
P.S : Also i d/led the awrapsharp of wrapenterprises page ..
*.mp4 guy
24th January 2008, 11:54
Instead of an avisource, or mpeg2 source line, you would use this to process a bitmap.
ImageReader("C:\yourfilepathhere.bmp").converttoyv12()
[edit]
you need these plugins for the script to work. removegrain, quantile, variableblur, masktools 2, awarpsharp, degrainmedian and dctfun4b.
ankurs
24th January 2008, 12:09
also the same for 8-bit ones .. and yh lemme get quantile , i have all the other's :)
edit : no quantile.dll here http://avisynth.org/warpenterprises/
Didée
24th January 2008, 12:15
Quantile is not a plugin. It's a filter provided by Kassandro's RemoveGrainHD (http://www.removegrainhd.de.tf/) plugin.
*.mp4 guy
24th January 2008, 12:28
Doh! sorry about that, thanks Didée.
ankurs
24th January 2008, 13:15
thanks a LOT didee :D , n yh tested it out , another rip going atm so cant actually encode , made my script on a sample though n i must say it is good and releiving to the eyes , did quite some strong denoising and dehalo'íng and even then i got a good result , this is quite an interesting filter , lets see how it turns out :p here's my script ..
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\degrainmedian.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\VariableBlur.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\RemoveGrain.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\RemoveGrainHD.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\mt_masktools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\dctfun4b.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\aWarpSharp.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\AGC.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MT.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MaskTools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\warpsharp.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\Vinverse.dll")
Import("C:\Program Files\AviSynth 2.5\plugins\ylevelsS.avs")
Import("C:\Program Files\AviSynth 2.5\plugins\FizzKiller.avs")
Import("C:\Program Files\AviSynth 2.5\plugins\soothe.avs")
Import("C:\Program Files\AviSynth 2.5\plugins\temporal degrain.avs")
Import("C:\Program Files\AviSynth 2.5\plugins\mrestore.avs")
Import("C:\Program Files\AviSynth 2.5\plugins\SSSharp.avs")
DGDecode_mpeg2source("C:\PATH/1.d2v",cpu=3)
SetMTMode(2,2)
ColorMatrix(mode="Rec.709->Rec.601",opt=0,interlaced=true,threads=2)
AssumeTFF().tdeint(mode=1).mrestore(...).vinverse()
crop( ..)
dull = last.Spline36Resize(640,304)
YlevelsS(...)
sharp = dull.SSSharp(ssw=true, iter=2, strength=3)
asharp(...)
temporaldegrain()
FizzKiller (...)
soothe(...)
o = last
mb1 = o.minblurX(1,1)
mb2 = mb1.minblurX(2,1)
mb12 = mb1.mt_lutxy(mb2,"x 3 + y < x 2 + x 3 - y > x 2 - y ? ?",U=2,V=2)
e = mb1.mt_edge("prewitt",0,255,0,255)
e3 = e.mt_expand().mt_expand().mt_expand().removegrain(11,-1).mt_expand()
h = o.repair(mb12.removegrain(11,-1),17)
hD = mt_makediff(h,o)
h1 = h.minblurX(1,1)
hsD = mt_makediff(h1.minblurX(2,1),h1).mt_lut("x 128 - 8 * 128 +")
DD = mt_lutxy(hsD,hD,"x 128 - y 128 - * 0 < y 128 - 4 / 0 1 - * 128 + x 128 - abs y 128 - abs < x y ? ?").removegrain(5)
h = h.mt_makediff(DD,U=2,V=2)
x1 = o.mt_merge(h,e3,U=2,V=2) .mt_merge(o,e,U=2,V=2)
return (x1)
limitedsharpenfaster()
# ===========
function MinBlurX(clip clp, int r, int "uv")
{
uv = default(uv,3)
uv2 = (uv==2) ? 1 : uv
rg4 = (uv==3) ? 4 : -1
rg11 = (uv==3) ? 11 : -1
rg20 = (uv==3) ? 20 : -1
medf = (uv==3) ? 1 : -200
RG11D = (r==1) ? mt_makediff(clp,clp.removegrain(11,rg11),U=uv2,V=uv2)
\ : (r==2) ? mt_makediff(clp,clp.removegrain(11,rg11).removegrain(20,rg20),U=uv2,V=uv2)
\ : mt_makediff(clp,clp.removegrain(11,rg11).removegrain(20,rg20).removegrain(20,rg20),U=uv2,V=uv2)
RG4D = (r==1) ? mt_makediff(clp,clp.removegrain(4,rg4),U=uv2,V=uv2)
\ : (r==2) ? mt_makediff(clp,clp.repair(clp.medianblur(2,2*medf,2*medf),12),U=uv2,V=uv2)
\ : mt_makediff(clp,clp.medianblur(3,3*medf,3*medf),U=uv2,V=uv2)
DD = mt_lutxy(RG11D,RG4D,"x 128 - y 128 - * 0 < 128 x 128 - abs y 128 - abs < x y ? ?",U=uv2,V=uv2)
clp.mt_makediff(DD,U=uv,V=uv)
return(last)
}
converttoyv12()
well i used 2 denoisers and removing halo's on purpose hehe :p testing :) and well here's my result ...
source : http://i28.tinypic.com/23kvh1t.png
filtered : http://i30.tinypic.com/124uidt.jpg
and beleive me this is quite a shitty source lol ...
P.S : couldnt open vdub at that time due to some circumstances so took the preview frame screenshot of megui itself only hehe ..
Adub
26th January 2008, 04:09
How many hours per frame are you getting with that script? :eek:
ankurs
26th January 2008, 21:56
How many hours per frame are you getting with that script? :eek:
lol @ hours per frame hehe m well @ this my dual core got to 6 fps and the encode was done in about a total of 23 hours for both passes :devil: its fast ;) n this is exactly what i used :p
Adub
26th January 2008, 22:39
Well, freakin sweet then!
Sp00kyFox
27th February 2008, 00:58
can someone point me to a download link for the unsharp filter?
edit: sry I found it
brainman
28th February 2009, 15:31
Hi there
Well, I try to see if anyone answers even if this thread has been dead for more than a year now.
SSSharpen looks promising so I wanted to try it on some old VHS video material I've captured.
However, no matter what I do, I get a message saying:
Avisynth open failure:
Evaluate System exception - Access Violation
SSSharpen.avsi, line 66"
and in the last line of the error message there is a reference to the line in my .avs script where the SSSharp command is located.
I have read this thread through many times to see if I forgot something, but I can't see where I do things different.
The 66th line in my SSSharpen script is this:
(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
Unfortunately this line is very complex, at least to me (I only possess rudimentary coding skills).
I've tried both masktools-v2.0a36 and masktools-v2.0a26 . Apparently there's no difference.
I'm using the SSSharpen script exactly as it is shown in the thread starter.
Could somebody maybe enlighten me a bit and come up with a tip how to solve this problem.
Edit: It might be of some importance to know the filter versions I've been using to get this error (althoug I seem to get the error no matter what versions I use but I've not tested this extensively):
masktools-v2.0a36
RemoveGrain 0.9 (SSE3)
Variableblur (The latest version from Neuron2)
awarpsharp (the one you can download in the file awarpsharp_25_dll_20030203 from http://avisynth.org/warpenterprises/ )
DegrainMedian 0.8.2
dctfun4b
My system is a 2GHz Core 2Duo with 2GB RAM, running WinXP Pro SP3
*.mp4 guy
1st March 2009, 03:42
What are the frame dimensions and color format of the input you are feeding the script?
brainman
1st March 2009, 21:46
The original video capture is 720x576 YUY2, however I do converttoYV12 right after trimming the clip and I stay in this color space through the whole script.
Sometimes I do some cropping if necessary, but due to restrictions in one or more of the other filters I use, I always crop so the resulting dimensions are multiples of 4.
I got the thought that my other filters were somehow interfering with SSSharpen but although I deactivated most of them (except for mcbob I think I can remember) I got the same error.
Btw my script looks like this:
AviSource("C:\VIDEO\Fuglekrigen.avi")
Trim(356, 94020)
converttoYV12
mcbob()
selecteven()
DeGrainMedian(limitY=2,limitUV=3,mode=0,interlaced=false)
DeGrainMedian(limitY=2,limitUV=3,mode=1,interlaced=false)
fft3dfilter(sigma=2.5, plane=4, bt=5, bw=32, bh=32, ow=16, oh=16, sharpen=1.0, dehalo=1.0, ncpu=2, interlaced=false)
Crop(12,44,-16,-40)
LimitedSharpenFaster(strength=150)
And I was trying to change the last line from Limitedsharpenfaster to SSSharpen, but until now without luck.
And yes, it's already so slow that SSSharpen is like a drop in the ocean ;) . But I get some quite nice results. Though, I'm a complete Avisynth noob so there might exist more efficient and considerably faster scripts. I've got plenty of time, though, so I just want my old VHS video to look as nice as possible.
*.mp4 guy
2nd March 2009, 04:21
Try modifying your cropping so your video is mod16 in each dimension.
brainman
2nd March 2009, 08:16
I just put a # in front of the cropping line.
720=16*45 and 576=16*36 . That should do it, shouldn't it?
But unfortunately it didn't. I still get exactly the same error.
Didée
2nd March 2009, 08:29
Too little system ressources. The script from another angle:
mcbob() # (1) - an insane ressource muncher
selecteven() # (-) - doesn't matter here
temporal(r=1) # (2) - needs to have three frames from (1)
temporal(r=1) # (3) - needs to have three frames from (2), i.e. five frames from (1)
fft3d(bt=5) # (4) - needs to have five frames from (3), i.e. nine(!) frames from (1)
SSSharpen() # (5) - pretty computational expensive, too
You can only put so much pebbles on a paper boat until it sinks. SSSharpen was the final pebble. You probably didn't realize how much pebbles your script already had put.
Either reduce the number of pebbles, or increase the size of the boat.
brainman
2nd March 2009, 08:51
I know, I know.
The interesting thing here, though, is, that I have tried to deactivate all the lines in the script so I only have this little one, just as a proof of concept:
AviSource("C:\VIDEO\Fuglekrigen.avi")
Trim(356, 94020)
converttoYV12
LeakKernelDeint(order=0)
SSSharp()
Guess what happens?
The error message pops up :)
I both like and understand your pebble analogy but it seems that there's more than pebbles to this problem...
Didée
2nd March 2009, 09:08
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?
brainman
2nd March 2009, 09:20
Regarding MCBob, you're right. I just tried it with that one deactivated also after I wrote the message.
I've tried what you said. Here are the results:
unsharp(vary=2,varc=1)
Evaluate: System Exception - Access violation
halomaskM(hbias=-128,hthr=256,amgrad=4)
Script error: HalomaskM does not have a named argument: amgrad
Didée
2nd March 2009, 10:03
Oh, in the hurry I mistyped that halomaskM parameter - it's "agmrad", not "amgrad".
However, now it seems that it boils down to variableblur's unsharp() filter. If even this basice usage of unsharp() fails, then something is wrong ... but I've no clue what it is. It works for me (both the original and neuron2's fixed version), don't see why it breaks for you, sorry.
brainman
2nd March 2009, 18:15
Yes, somehow my Masktools choke in the video on my machine. I don't get it. Is there anything that has to be done in a different way when copying the masktools .dll to the plugins library? I've been reading around quite a bit but I can't find anything but I might have missed something.
Can it be a problem that I run a newer version of Avisynth than required by Masktools?
brainman
2nd March 2009, 20:13
I was getting stubborn and removed all plugins except for those that are needed for SSSharp.
I reran the script entries proposed by you, Didée, a few posts ago:
unsharp(vary=2,varc=1)
halomaskM(hbias=-128,hthr=256,amgrad=4)
The first one still gives the access violation error.
The second one actually runs without making any trouble.
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, 10: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, 10: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, 13: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, 02: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, 04:15
Hi canuckerfan! Yes, your mod is correct.
markanini
24th October 2009, 23: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, 05: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, 05: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, 06: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, 06: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, 23: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, 04: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, 04: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, 04: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, 17:23
something wrong with what I said?
Anyone at all may i ask? :D
*.mp4 guy
23rd July 2010, 13: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, 06: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, 02: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, 10: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, 14: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, 21: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, 21: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.
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.