Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 2nd November 2007, 14:56   #461  |  Link
adhoya
Registered User
 
Join Date: Oct 2007
Posts: 7
Quote:
Originally Posted by Didée View Post
It's not SeeSaw which is that slow. It's MVDegrain with all the motion stuff which is killing your speed on HD content.
Try adding a "blksize=16" to all MVAnalyze() lines - you should see a huge speed increase, like 0.2 or even 0.3 fps instead of 0.1 fps ...
thanks a lot. it's working as you said. and it's faster. now 2.25fps. but still it takes 26hr long for encode. i guess i should omit analysing or use other script. i feel it's definitely sharper than other encoding but without deblocker i have lots of artifacts. i feel it has got to be smoothed. do you have any recommend for it.

b/regards
adhoya is offline   Reply With Quote
Old 2nd November 2007, 16:04   #462  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,389
Quote:
Originally Posted by Morte66 View Post
Quote:
Originally Posted by Didée View Post
Try adding a "blksize=16" to all MVAnalyze() lines
And change overlap from 4 to 8
That's a "can", not a "must". For speed reasons, I thought quarter-block-overlapping should be sufficient for denoising, compared to half-block-overlapping.


@adhoya:

Use higher values for "SdampLo" in SeeSaw. The default (SdampLo=Spower+1) might be too low for you. Try e.g. SdampLo=20..25..30.
Also, your Spower of "8" is pretty high. Note that the default is "4", and realize it's a power function.
With base=5 as an example: Default: 5^4=652. Yours: 5^8=390625. See a difference in those numbers? Powers are growing very quickly, and the default choice for SdampLo works linear, not exponential.

Depending on how your "blocking" looks like exactly, the usage of a deblocker might be appropriate indeed. This can't be judged from the mere statement "there is blocking".
Throwing in some "SootheS" might help as well. Default is zero (deactivated), try SootheS=20..40..60..75.
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)
Didée is offline   Reply With Quote
Old 2nd November 2007, 17:08   #463  |  Link
adhoya
Registered User
 
Join Date: Oct 2007
Posts: 7
where they are gone? (kidding..^^) really nice no blocks and noise. i used
Code:
SeeSaw(a,b, NRlimit=5, NRlimit2=6,Sstr=1.5, Slimit=8, Sdamplo=30, Spower=4, Szp=16,soothet=80,sootheS=75)
i'm gonna try without mvdegrain2 and analysis. thanks.
adhoya is offline   Reply With Quote
Old 2nd November 2007, 23:04   #464  |  Link
adhoya
Registered User
 
Join Date: Oct 2007
Posts: 7
Code:
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\masktools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\RemoveGrain.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\degrainmedian.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\repair.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\mvtools\mvtools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\DctFilter\DctFilter.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\mt_masktools.dll")

DirectShowSource("d:\new.grf",fps=23.976, audio=false)
crop( 0, 144, 0, -136)
spline36resize(1920,800)

backward_vec2 = last.MVAnalyse(isb = true, delta = 2, pel = 2, overlap=4, sharp=1, idx = 1,blksize=16)
backward_vec1 = last.MVAnalyse(isb = true, delta = 1, pel = 2, overlap=4, sharp=1, idx = 1,blksize=16)
forward_vec1 = last.MVAnalyse(isb = false, delta = 1, pel = 2, overlap=4, sharp=1, idx = 1,blksize=16)
forward_vec2 = last.MVAnalyse(isb = false, delta = 2, pel = 2, overlap=4, sharp=1, idx = 1,blksize=16)
a = last.MVDegrain2(backward_vec1,forward_vec1,backward_vec2,forward_vec2,thSAD=400,idx=1)
b = a.degrainmedian(mode=1)
SeeSaw(a,b, NRlimit=5, NRlimit2=6,Sstr=1.5, Slimit=8, Sdamplo=40, Spower=4, Szp=16,soothet=100, sootheS=95)

Deblock_QED(quant1=24, quant2=22, aOff1=2, bOff1=4, aOff2=4, bOff2=8, uv=1)
i tried without mvdgrain analysis.

Quote:
1) fluxsmooth, seesaw and spresso
2) fluxsmooth and seesaw
these combination were not so cool, too rough images with blocks and mosquito noises. no batter than first try, speed is quite fast,though. but first one also has blocks in some dark places in x264 encoding even if i tuned variables of seesaw(a,b, NRlimit=5, NRlimit2=6,Sstr=1.5, Slimit=8, Sdamplo=35, Spower=4, Szp=16,soothet=80,sootheS=100). and finally i decided another filter Deblock _QED. but when i load in megui. it says there's no funtion like Deblock_QED.but i already installed whole plug-ins pls post any ideas if possible.
adhoya is offline   Reply With Quote
Old 3rd November 2007, 04:54   #465  |  Link
R3Z
Silver Über Alles
 
R3Z's Avatar
 
Join Date: Aug 2006
Location: Australia
Posts: 269
Quote:
Originally Posted by adhoya View Post
Code:
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\masktools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\RemoveGrain.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\degrainmedian.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\repair.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\mvtools\mvtools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\DctFilter\DctFilter.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\mt_masktools.dll")

DirectShowSource("d:\new.grf",fps=23.976, audio=false)
crop( 0, 144, 0, -136)
spline36resize(1920,800)

backward_vec2 = last.MVAnalyse(isb = true, delta = 2, pel = 2, overlap=4, sharp=1, idx = 1,blksize=16)
backward_vec1 = last.MVAnalyse(isb = true, delta = 1, pel = 2, overlap=4, sharp=1, idx = 1,blksize=16)
forward_vec1 = last.MVAnalyse(isb = false, delta = 1, pel = 2, overlap=4, sharp=1, idx = 1,blksize=16)
forward_vec2 = last.MVAnalyse(isb = false, delta = 2, pel = 2, overlap=4, sharp=1, idx = 1,blksize=16)
a = last.MVDegrain2(backward_vec1,forward_vec1,backward_vec2,forward_vec2,thSAD=400,idx=1)
b = a.degrainmedian(mode=1)
SeeSaw(a,b, NRlimit=5, NRlimit2=6,Sstr=1.5, Slimit=8, Sdamplo=40, Spower=4, Szp=16,soothet=100, sootheS=95)

Deblock_QED(quant1=24, quant2=22, aOff1=2, bOff1=4, aOff2=4, bOff2=8, uv=1)
i tried without mvdgrain analysis.


these combination were not so cool, too rough images with blocks and mosquito noises. no batter than first try, speed is quite fast,though. but first one also has blocks in some dark places in x264 encoding even if i tuned variables of seesaw(a,b, NRlimit=5, NRlimit2=6,Sstr=1.5, Slimit=8, Sdamplo=35, Spower=4, Szp=16,soothet=80,sootheS=100). and finally i decided another filter Deblock _QED. but when i load in megui. it says there's no funtion like Deblock_QED.but i already installed whole plug-ins pls post any ideas if possible.

Deblock_QED is an avs script function, save the following as deblock_qed.avsi in your plugins folder;

Code:
function Deblock_QED ( clip clp, int "quant1", int "quant2", 
 \                     int "aOff1", int "bOff1", int "aOff2", int "bOff2", int "uv" )
{
quant1 = default( quant1, 20 )
quant2 = default( quant2, 40 )

aOff1  = default( aOff1, quant1/2 )  #  I've no clue if these are clever values or not!
bOff1  = default( bOff1, quant1/4 )  #  So:
aOff2  = default( aOff2, quant1/4 )  #  Also try all these 4 values @ 0 (zero),
bOff2  = default( bOff2, quant1/8 )  #  and quant1=30, quant2=40~45 instead.
uv     = default( uv,      1 )       #  u=3 -> use proposed method for chroma deblocking
                                     #  u=2 -> no chroma deblocking at all (fastest method)
ox     = clp.width()                 #  u=1|-1 -> directly use chroma debl. from the normal|strong deblock()
oy     = clp.height()                

# With avisynth scripting, there is no information available about the position of the  currently 
# processed pixel ... there simply is no such thing like an "actual" processed pixel.
# So first I've to build up a grid covering the transitions between all 8x8 blocks,
# and make some LUTmania with it later. Yes, this is cumbersome.

block = blankclip(clp,width=6*4,height=6*4,color=$000000).addborders(4,4,4,4,color=$FFFFFF)
block = stackhorizontal( block,block,block,block)
block = stackvertical(   block,block,block,block) .pointresize(32,32) .binarize(upper=false)
block = stackhorizontal( block,block,block,block,block,block,block,block)
block = stackvertical(   block,block,block,block,block,block)
block = stackhorizontal( block,block,block)
block = stackvertical(   block,block,block)
block = block .crop(0,0,ox,oy) 
block = (uv!=3) ? block
 \    : YtoUV(block.crop(0,0,ox/2,oy/2),block.crop(0,0,ox/2,oy/2),block)
block = block.trim(1,1) .loop(framecount(clp))


# create normal deblocking (for block borders) and strong deblocking (for block interiour)
normal   = clp.deblock(quant=quant1,aOffset=aOff1,bOffset=bOff1)
strong   = clp.deblock(quant=quant2,aOffset=aOff2,bOffset=bOff2)

# build difference maps of both
normalD  = yv12lutxy(clp,normal,"x y - 128 +","x y - 128 +","x y - 128 +",U=uv,V=uv)
strongD  = yv12lutxy(clp,strong,"x y - 128 +","x y - 128 +","x y - 128 +",U=uv,V=uv)

# separate border values of the difference maps, and set the interiours to '128'
strongD2 = yv12lutxy(StrongD,block,"y 255 = x 128 ?","y 255 = x 128 ?","y 255 = x 128 ?",U=uv,V=uv)
normalD2 = yv12lutxy(normalD,block,"y 255 = x 128 ?","y 255 = x 128 ?","y 255 = x 128 ?",U=uv,V=uv)

# interpolate the border values over the whole block: DCTFilter can do it. (Kiss to Tom Barry!)
# (Note: this is not fully accurate, but a reasonable approximation.)
strongD3 = strongD2.yv12lut("x 128 - 1.01 * 128 +","x 128 - 1.01 * 128 +","x 128 - 1.01 * 128 +",U=uv,V=uv).dctfilter(1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0)# .yv12lut("x 128 - 2 / 128 +")

# apply compensation from "normal" deblocking to the borders of the full-block-compensations calculated 
# from "strong" deblocking ... 
strongD4 = yv12lutxy(strongD3,normalD2,"y 128 = x y ?","y 128 = x y ?","y 128 = x y ?",U=uv,V=uv)

# ... and apply it.
deblocked= yv12lutxy(clp,strongD4,"x y 128 - -","x y 128 - -","x y 128 - -",U=uv,V=uv) 

# simple decisions how to treat chroma
deblocked = (uv<0) ? deblocked.mergechroma(strong) : uv<2 ? deblocked.mergechroma(normal) : deblocked

deblocked
return( last )
}
R3Z is offline   Reply With Quote
Old 3rd November 2007, 10:38   #466  |  Link
adhoya
Registered User
 
Join Date: Oct 2007
Posts: 7
i tested three options (1pass maxspeed profile x264 encoding with 7520kbps with no built-in x264 filter i.e. deblock filter)
only used below filters. thanks to R3Z and Didée(thru googling i found a script to correct qed by Didée ), i could install deblock_qed correctly


1)orginal encoding(without any filter)
2)only seesaw(MVDegrain2+degrainmedian)
3)only seesaw(MVDegrain2+degrainmedian)+deblock_qed

these are screenshots

original (1 pass maxspeed no x264 analyse )


seesaw only (1 pass maxspeed no x264 analyse )


seesaw + deblocker (1 pass maxspeed no x264 analyse )


seesaw+x264 built-in deblocker (2pass hq slow profile, eqm_avc_hr.cfg matrix)


at last blocks gone away.

Last edited by adhoya; 3rd November 2007 at 12:24.
adhoya is offline   Reply With Quote
Old 3rd November 2007, 14:46   #467  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,389
Somehow it seems your image quality problems lie not with SeeSaw, but rather with x264's settings ...

BTW, at that location where you have placed Deblock_qed, it is pretty much useless. That filter deals for removing blocking artefacts that are in the source. After having filtered the whole thing with MVDegrain+DegrainMedian already, there probably is no more blocking there that Deblock_qed could remove (or at least reckognize).
Also, you have a resizer at the start of the script. If that resizer actually does something (i.e. resolution is different than 1920x800 after cropping - not sure if it is, can't tell if your DS decoder spits out 1080p with 1080 or 1088 vertical pixels), then Deblock_qed can no more work correctly no matter what.
Prior to deblocking: NO resizing. NO noise filtering. Cropping only at macroblock boundaries.
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)
Didée is offline   Reply With Quote
Old 3rd November 2007, 16:46   #468  |  Link
adhoya
Registered User
 
Join Date: Oct 2007
Posts: 7
Code:
resolution is different than 1920x800 after cropping - not sure if it is, can't tell if your DS decoder spits out 1080p with 1080 or 1088 vertical pixels
you're right. i removed resizing script. i got much better results with seesaw itself. now i wonder i got the wrong way. of course, original HD source has perfectly no block but little mosquito noises and it's sharp. with your comment, i realized deblock qed is no use, cause block is generated during encode. only x264 setting can control them. but those filters(i.e mv,degrain,seesaw....) can get rid of other noise and blocks within source, making movie sharper or smooth. just now. but i hoped i could control blocks by encoding within avs scripts. maybe no way~!
and i am wondering why, after encode, colors goes different. it's sharper and has less noise but not that vivid compared to source after encode with seesaw. it could be natural consequense. but i hope to know the method to get back as much as possible. is there any(sharper and vivid)?

Last edited by adhoya; 3rd November 2007 at 17:05.
adhoya is offline   Reply With Quote
Old 3rd November 2007, 23:04   #469  |  Link
Adub
Fighting spam with a fish
 
Adub's Avatar
 
Join Date: Sep 2005
Posts: 2,698
Are you using Colormatrix?
__________________
FAQs:Bond's AVC/H.264 FAQ
Site:Adubvideo
Adub is offline   Reply With Quote
Old 16th November 2007, 17:00   #470  |  Link
Fizick
AviSynth plugger
 
Fizick's Avatar
 
Join Date: Nov 2003
Location: Russia
Posts: 2,183
Some bug was found with SeeSaw and Vfapi.
http://forum.doom9.org/showthread.php?t=128611

Didée, here is my bug report

VFapi catch all exception internally and report about error in float operation. (Avisynth itselft for some reason skip it).

I tried Sharpen2 function alone: it produce the bug too.
Then I try read your the extra long yv12lutxy expression.
It is really expressive expresion!

But now I know what is error. It is substring like:

"x y - x y - abs /"

In normal notation it is: (x-y)/abs(x-y)

Probably you wanted to construct the "sign" function.

But if x=y then you have 0/0
What is the result?

VFapi works fine (without error) when I replace the expression by "x < y -1 1 ?" or "x y - x y - abs 0.01 + /" or some other,
but i do not know your intention about value of 0/0.
Please correct it and similar substring like "y 128 - y 128 - abs /"
__________________
My Avisynth plugins are now at http://avisynth.org.ru and mirror at http://avisynth.nl/users/fizick
I usually do not provide a technical support in private messages.

Last edited by Fizick; 16th November 2007 at 20:10.
Fizick is offline   Reply With Quote
Old 16th November 2007, 19:05   #471  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,389
How could that be? Note the start of the expression:
Code:
"x y == x [...] x y - x y - abs / * + ?"
The case of "division by zero" can only take place if x equals y. But that case is explicitely checked for as first condition. So, IF x equals y, then the part with the division should not even be evaluated.
Same goes for the similar expression with "y 128 -".

Moreover, it's "only" in a mt_lutxy call: even if I overlooked something, then the hypothetical division-by-zero occurs only during the LUT building (which is handled by MaskTools without producing an error).

There is no reason why there should be a problem from that side. Either the script evaluates, or it does not. From my experience, it does.
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)
Didée is offline   Reply With Quote
Old 16th November 2007, 20:08   #472  |  Link
Fizick
AviSynth plugger
 
Fizick's Avatar
 
Join Date: Nov 2003
Location: Russia
Posts: 2,183
yes, it is during LUT building (at constructor).
yes, masktools for some reason do not report.

The order of internal calulations may differ ( i do not know why).
Probably even if you write condition at the left, evaluator may firstly calculate right part of expression. (to produce intermediate LUT).

And quite probably, that Avisynth or MaskTools skip "weak" exception like division by 0.

It is better to fix even potential bugs. They may appear in some case (next versions etc).



From my experience, the script does not evaluated with VFApi (see post above), but modified script does.


Simple script:

a=version().converttoyv12()
b=a.blur(1)
yv12lutxy(b,a,"x y /",u=2,v=2)

produce the same results. (works itself but do not work with VFapi)
__________________
My Avisynth plugins are now at http://avisynth.org.ru and mirror at http://avisynth.nl/users/fizick
I usually do not provide a technical support in private messages.

Last edited by Fizick; 16th November 2007 at 20:10.
Fizick is offline   Reply With Quote
Old 16th November 2007, 20:30   #473  |  Link
Fizick
AviSynth plugger
 
Fizick's Avatar
 
Join Date: Nov 2003
Location: Russia
Posts: 2,183
Mostly for programmers. DGFapi use:
Code:
try {
...
*(j->clip) = j->avsEnv->Invoke("Import", AVSValue(args1, 1)).AsClip();
... 
}

catch (AvisynthError e)
{
	OutputDebugString("DGVfapi: error (Avisynth Error) loading avisynth script!\n");
	sprintf(buf,"DGVfapi: %s.\n", e.msg);
	OutputDebugString(buf);
	closeAVS(j);
	return VF_ERROR;
}
catch (...)
{
	OutputDebugString("DGVfapi: error (Unknown) loading avisynth script!\n");
	closeAVS(j);
	return VF_ERROR;
}
Debugview log:
[3556] DGVfapi: error (Avisynth Error) loading avisynth script!
[3556] DGVfapi: Evaluate: System exception - Float Invalid Operation
__________________
My Avisynth plugins are now at http://avisynth.org.ru and mirror at http://avisynth.nl/users/fizick
I usually do not provide a technical support in private messages.
Fizick is offline   Reply With Quote
Old 16th November 2007, 20:55   #474  |  Link
Manao
Registered User
 
Join Date: Jan 2002
Location: France
Posts: 2,856
Quote:
The case of "division by zero" can only take place if x equals y. But that case is explicitely checked for as first condition. So, IF x equals y, then the part with the division should not even be evaluated.
Actually it is. Let's take the following expression :
Code:
x y = y x y / ?
The expression will be processed as follow :
Code:
? -> fetch next three values
  / -> fetch next two values
    y -> return y
    x -> return x
    -> return x / y
  y -> return y
  = -> fetch next two values
    y -> return y
    x -> return x
    -> return abs(x-y) < 0.000001 ? 1 : -1
-> return abs(x-y) < 0.000001 ? y : x / y
So if in the previous code, y = 0, then it does compute x / 0 even if x = 0.
__________________
Manao is offline   Reply With Quote
Old 17th November 2007, 15:10   #475  |  Link
Alain2
Registered User
 
Join Date: May 2005
Posts: 236
Interesting, thanks for the explanation of how the code is interpreted I never use very complex formula in my scripts so I (think I) never came across such problems, but I will keep that in mind now ^^ I think this example would be worth being added to the masktools doc in the section V) Reverse polish notation
Alain2 is offline   Reply With Quote
Old 16th January 2008, 23:34   #476  |  Link
cheshire2k
Registered User
 
Join Date: Nov 2007
Posts: 53
please could someone tell me what i need and how i put a movie thru this seesaw filter I like the quality pictures of it I have virtualdub virtualdubmod and avisynht installed i alreadty downloaded the first 3 files the seesaw one masktools and the other one i just dont know how to do it.

Thanks

CHESH
cheshire2k is offline   Reply With Quote
Old 23rd January 2008, 15:57   #477  |  Link
cheshire2k
Registered User
 
Join Date: Nov 2007
Posts: 53
ive got the filter working but how do i get the file size to stay the same. I tried lowering the bitirate but is there any calc to do it. Thanks

CHESH
cheshire2k is offline   Reply With Quote
Old 26th January 2008, 04:28   #478  |  Link
Adub
Fighting spam with a fish
 
Adub's Avatar
 
Join Date: Sep 2005
Posts: 2,698
Yah. It's called a bitrate calculator.

But, that might not help you, as with the increased sharpness comes the necessity for increased bitrate, meaning larger file size.

In short, if you want sharpness, you are going to have to pay for it with bits.
__________________
FAQs:Bond's AVC/H.264 FAQ
Site:Adubvideo
Adub is offline   Reply With Quote
Old 26th January 2008, 10:06   #479  |  Link
cyspur
Registered User
 
cyspur's Avatar
 
Join Date: Dec 2007
Posts: 39
Forgive my ignorance, with which program would one load the following?

Code:
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MaskTools158\MaskTools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\VagueDenoiser\VagueDenoiser.dll")
Import("C:\Program Files\AviSynth 2.5\plugins\mvbob\mvbob.avs")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\DGDecode.dll")
MPEG2Source("Z:\DestB\VTS_01_2.d2v")
mvbob()
Import("C:\Program Files\AviSynth 2.5\plugins\SeeSaw.avs")
ConvertToYv12()
a = last
b=a.VagueDenoiser(threshold=0.8, method=1, nsteps=6, chromaT=0.8)
SeeSaw(a,b, NRlimit=6, NRlimit2=7, Sstr=1.5, Slimit=5, Spower=5, Szp=16)
Lanczos4Resize(640,372)
cyspur is offline   Reply With Quote
Old 27th January 2008, 02:19   #480  |  Link
Sagekilla
x264aholic
 
Join Date: Jul 2007
Location: New York
Posts: 1,752
What exactly do you mean "load?" If you mean view it, you can use VirtualDubMod to view your video file, windows media player (yuck) , or media player classic.
Sagekilla is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:00.


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