Log in

View Full Version : Super Slow Sharpen


Pages : [1] 2

*.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.