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 6th August 2008, 23:30   #41  |  Link
Mystery Keeper
Beyond Kawaii
 
Mystery Keeper's Avatar
 
Join Date: Feb 2008
Location: Russia
Posts: 724
Just write SharpAAMC() somewhere in your script. Better do it after deinterlacing and denoising and before resizing.
__________________
...desu!
Mystery Keeper is offline   Reply With Quote
Old 6th August 2008, 23:34   #42  |  Link
Mystery Keeper
Beyond Kawaii
 
Mystery Keeper's Avatar
 
Join Date: Feb 2008
Location: Russia
Posts: 724
Ok, Seraphic, here's the function using EEDI2 for you. Twice as slow.
Code:
function ESharpAAMC(clip orig, float "ds", int "ShPre", int "ShPost", int "SmPost")
{
ds=default(ds,0.2) #strokes darkening strength
ShPre=default(ShPre,80) #Presharpening
ShPost=default(ShPost,300) #Postsharpening
SmPost=default(SmPost,100) #Postsmoothing

a=orig.assumetff()
w=width(a)
h=height(a)
m=logic( a.DEdgeMask(0,255,0,255,"5 10 5 0 0 0 -5 -10 -5", divisor=4,Y=3,U=3,V=3)
 \       ,a.DEdgeMask(0,255,0,255,"5 0 -5 10 0 -10 5 0 -5", divisor=4,Y=3,U=3,V=3)
 \       ,"max").greyscale.levels(0,0.8,128,0,255,false)
b=a.Toon(ds).Warpsharp(depth=ShPre)
b=b.TurnLeft().EEDI2().TurnRight().EEDI2().spline64resize(w,h,0.5,-0.5,2*w+.001,2*h+.001)
b=b.LimitedSharpenFaster(edgemode=1,strength=ShPost,overshoot=1,soft=SmPost)


mt_merge(a,b,m,Y=3,U=3,V=3)
sD=mt_makediff(a,last)
fv2 = a.MVAnalyse(isb=false,delta=2,idx=13)
fv1 = a.MVAnalyse(isb=false,delta=1,idx=13)
bv1 = a.MVAnalyse(isb=true, delta=1,idx=13)
bv2 = a.MVAnalyse(isb=true, delta=2,idx=13)

sDD = sD.MVDegrain2(bv1,fv1,bv2,fv2,idx=14)

reduc = 0.4
sDD = mt_lutxy(sD,sDD,"x 128 - abs y 128 - abs < x y ?").mergeluma(sDD,1.0-reduc)

a.mt_makediff(sDD,U=2,V=2)

return last
}
And now compare them. Left - sangnom, right - eedi2.

__________________
...desu!
Mystery Keeper is offline   Reply With Quote
Old 6th August 2008, 23:55   #43  |  Link
Adub
Fighting spam with a fish
 
Adub's Avatar
 
Join Date: Sep 2005
Posts: 2,687
Hell, I can't tell the difference. I'll stick with the sangnom one.

Although, I got maa() (from the animeivtc package) and some other filters to achieve essentially the same results, with a much faster render time. Sure, it's not exactly the same, but it works.
__________________
FAQs:Bond's AVC/H.264 FAQ
Site:Adubvideo
Adub is offline   Reply With Quote
Old 7th August 2008, 00:00   #44  |  Link
Seraphic-
Forum Member
 
Join Date: May 2006
Posts: 698
Quote:
Originally Posted by Mystery Keeper View Post
Ok, Seraphic, here's the function using EEDI2 for you. Twice as slow.
Code:
function ESharpAAMC(clip orig, float "ds", int "ShPre", int "ShPost", int "SmPost")
{
ds=default(ds,0.2) #strokes darkening strength
ShPre=default(ShPre,80) #Presharpening
ShPost=default(ShPost,300) #Postsharpening
SmPost=default(SmPost,100) #Postsmoothing

a=orig.assumetff()
w=width(a)
h=height(a)
m=logic( a.DEdgeMask(0,255,0,255,"5 10 5 0 0 0 -5 -10 -5", divisor=4,Y=3,U=3,V=3)
 \       ,a.DEdgeMask(0,255,0,255,"5 0 -5 10 0 -10 5 0 -5", divisor=4,Y=3,U=3,V=3)
 \       ,"max").greyscale.levels(0,0.8,128,0,255,false)
b=a.Toon(ds).Warpsharp(depth=ShPre)
b=b.TurnLeft().EEDI2().TurnRight().EEDI2().spline64resize(w,h,0.5,-0.5,2*w+.001,2*h+.001)
b=b.LimitedSharpenFaster(edgemode=1,strength=ShPost,overshoot=1,soft=SmPost)


mt_merge(a,b,m,Y=3,U=3,V=3)
sD=mt_makediff(a,last)
fv2 = a.MVAnalyse(isb=false,delta=2,idx=13)
fv1 = a.MVAnalyse(isb=false,delta=1,idx=13)
bv1 = a.MVAnalyse(isb=true, delta=1,idx=13)
bv2 = a.MVAnalyse(isb=true, delta=2,idx=13)

sDD = sD.MVDegrain2(bv1,fv1,bv2,fv2,idx=14)

reduc = 0.4
sDD = mt_lutxy(sD,sDD,"x 128 - abs y 128 - abs < x y ?").mergeluma(sDD,1.0-reduc)

a.mt_makediff(sDD,U=2,V=2)

return last
}
And now compare them. Left - sangnom, right - eedi2.

You didn't have to do that.
All I meant was I used EEDI2 to do some testing here and there.

I'm getting a "no function named DEdgeMask" error.
I have LimitedSharpenFaster, mt_masktools-26.dll, and warpsharp.dll
During a search said you needed those three, but still returns the error.
Seraphic- is offline   Reply With Quote
Old 7th August 2008, 00:06   #45  |  Link
martino
masktools2 (ab)user
 
martino's Avatar
 
Join Date: Oct 2006
Location: PAL-I :(
Posts: 235
You need the old masktools for DEdgeMask.


P.S. You need Toon, EEDI2 and MVTools too.

Last edited by martino; 7th August 2008 at 00:10.
martino is offline   Reply With Quote
Old 7th August 2008, 00:15   #46  |  Link
Seraphic-
Forum Member
 
Join Date: May 2006
Posts: 698
Quote:
Originally Posted by martino View Post
You need the old masktools for DEdgeMask.


P.S. You need Toon, EEDI2 and MVTools too.
Yup, have those. Just having a hard time finding Toon.
Seraphic- is offline   Reply With Quote
Old 7th August 2008, 00:23   #47  |  Link
Mystery Keeper
Beyond Kawaii
 
Mystery Keeper's Avatar
 
Join Date: Feb 2008
Location: Russia
Posts: 724
http://mf.creations.nl/avs/filters/Toon-v1.0.dll
__________________
...desu!
Mystery Keeper is offline   Reply With Quote
Old 7th August 2008, 01:32   #48  |  Link
Seraphic-
Forum Member
 
Join Date: May 2006
Posts: 698
Quote:
Originally Posted by Mystery Keeper View Post
Thanks. Quite an impressive script as the default setting removed a lot o the jagged edges without much smoothing.
It over smooths on some of my other videos, so I'll have to mess around with the settings.

I tried to load your EEDI2 version from post #42, but get no function named "SharpAAMC".
However, after searching, I found nothing on it so I'm not sure what I'm missing.

(No AA Top - With AA Bottom)



Quote:
Originally Posted by Merlin7777 View Post
Edit2: Okay, it is REALLY SLOW. I am getting around 0.39fps on a lossless encode of a 720p source. Anyway to speed this up? Maybe use the Masktools 2 version of DEdgemask? (If it even exists, I don't know)
I'm getting 1.55fps on one of my lossless 720p captures.
For a 3:30 long video, that works out to about two hours.

Last edited by Seraphic-; 7th August 2008 at 01:40.
Seraphic- is offline   Reply With Quote
Old 7th August 2008, 02:07   #49  |  Link
Mystery Keeper
Beyond Kawaii
 
Mystery Keeper's Avatar
 
Join Date: Feb 2008
Location: Russia
Posts: 724
EEDI2 version is called ESharpAAMC.
__________________
...desu!
Mystery Keeper is offline   Reply With Quote
Old 7th August 2008, 02:24   #50  |  Link
Seraphic-
Forum Member
 
Join Date: May 2006
Posts: 698
Quote:
Originally Posted by Mystery Keeper View Post
EEDI2 version is called ESharpAAMC.
Ah, see what you mean now. Thanks.
Yeah, it is much slower as you said.
Getting 1.15fps, down from 1.55fps with the other.

During your testing, how did you find these scripts to handle fast motion?
Seraphic- is offline   Reply With Quote
Old 7th August 2008, 09:09   #51  |  Link
Mystery Keeper
Beyond Kawaii
 
Mystery Keeper's Avatar
 
Join Date: Feb 2008
Location: Russia
Posts: 724
Fast motion scenes are handled fine, but look a little jerky due to unusual sharpness. Actually, nothing special needs to be done for fast motion. Motion compensation is done for slow motion to compensate the flicker.
__________________
...desu!
Mystery Keeper is offline   Reply With Quote
Old 7th August 2008, 16:26   #52  |  Link
Adub
Fighting spam with a fish
 
Adub's Avatar
 
Join Date: Sep 2005
Posts: 2,687
Hmm...I seem to see a couple of artifacts produced from this script, such as here:
http://i34.photobucket.com/albums/d1...0807082354.jpg


I assume there is a setting I can change to protect against this?
__________________
FAQs:Bond's AVC/H.264 FAQ
Site:Adubvideo
Adub is offline   Reply With Quote
Old 7th August 2008, 16:34   #53  |  Link
Mystery Keeper
Beyond Kawaii
 
Mystery Keeper's Avatar
 
Join Date: Feb 2008
Location: Russia
Posts: 724
If you are sure that it is caused by that function, just disable motion compensation. I'll make it adjustable in the function a bit later.

@Didée, how can we make it apply MC only to if scene changes a little? 'Twould be good if it took a scene change threshold as parameter.
__________________
...desu!

Last edited by Mystery Keeper; 7th August 2008 at 16:45.
Mystery Keeper is offline   Reply With Quote
Old 7th August 2008, 16:56   #54  |  Link
Adub
Fighting spam with a fish
 
Adub's Avatar
 
Join Date: Sep 2005
Posts: 2,687
Yep, this was the only function in the filter chain. It's funny, I have seen pictures of artifacts like this before, and there is a way to guard against it in MVTools, but I can't for the life of me recall what it is.
__________________
FAQs:Bond's AVC/H.264 FAQ
Site:Adubvideo
Adub is offline   Reply With Quote
Old 7th August 2008, 17:11   #55  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,393
That artefact looks like if the sharpen-difference is merged in without motion compensation from a neighbor frame. From the way how MVAnalyse & MVDegrain work and how the script is layed out, I don't see how such a thing can sneak in at all.

Try truemotion=false,search=3,searchparam=256
__________________
- 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 7th August 2008, 17:18   #56  |  Link
Mystery Keeper
Beyond Kawaii
 
Mystery Keeper's Avatar
 
Join Date: Feb 2008
Location: Russia
Posts: 724
0_0 WEIRD. I suddenly started getting an error "RemoveGrain: invalid mode 19 (LimitedSharpenFaster.avsi, line 106)"

Fixed
__________________
...desu!

Last edited by Mystery Keeper; 7th August 2008 at 17:31.
Mystery Keeper is offline   Reply With Quote
Old 7th August 2008, 18:35   #57  |  Link
Mystery Keeper
Beyond Kawaii
 
Mystery Keeper's Avatar
 
Join Date: Feb 2008
Location: Russia
Posts: 724
Sorry, Merlin. I don't get such artifacts anywhere, so I can't help. Here's the function in which you can disable/enable MC easily.

Code:
function SharpAAMC(clip orig, int "aastr", float "ds", int "ShPre", int "ShPost", int "SmPost", bool "MC")
{
aastr=default(aastr,255) #antialiasing strength
ds=default(ds,0.2) #strokes darkening strength
ShPre=default(ShPre,80) #Presharpening
ShPost=default(ShPost,300) #Postsharpening
SmPost=default(SmPost,100) #Postsmoothing
MC=default(MC, true) #Motion Compensation

a=orig
w=width(a)
h=height(a)
m=logic( a.DEdgeMask(0,255,0,255,"5 10 5 0 0 0 -5 -10 -5", divisor=4,Y=3,U=3,V=3)
 \       ,a.DEdgeMask(0,255,0,255,"5 0 -5 10 0 -10 5 0 -5", divisor=4,Y=3,U=3,V=3)
 \       ,"max").greyscale.levels(0,0.8,128,0,255,false)
b=a.Toon(ds).Warpsharp(depth=ShPre)
b=b.spline64resize(w*2,h*2).TurnLeft().SangNom(aa=aastr).TurnRight().SangNom(aa=aastr)
b=b.spline64resize(w,h).LimitedSharpenFaster(edgemode=1,strength=ShPost,overshoot=1,soft=SmPost)

b=mt_merge(a,b,m,Y=3,U=3,V=3)
sD=mt_makediff(a,b)
fv2 = a.MVAnalyse(isb=false,delta=2,idx=13)
fv1 = a.MVAnalyse(isb=false,delta=1,idx=13)
bv1 = a.MVAnalyse(isb=true, delta=1,idx=13)
bv2 = a.MVAnalyse(isb=true, delta=2,idx=13)

sDD = sD.MVDegrain2(bv1,fv1,bv2,fv2,idx=14)

reduc = 0.4
sDD = mt_lutxy(sD,sDD,"x 128 - abs y 128 - abs < x y ?").mergeluma(sDD,1.0-reduc)

b=MC ? a.mt_makediff(sDD,U=2,V=2) : b

return b
}
__________________
...desu!
Mystery Keeper is offline   Reply With Quote
Old 7th August 2008, 18:43   #58  |  Link
Sagekilla
x264aholic
 
Join Date: Jul 2007
Location: New York
Posts: 1,752
IIRC, I saw somewhere that you could do a pseudo scene-change based on change in luminance, and depending on that it could ramp up a filter to process more if there was fast motion or less if low motion.
Sagekilla is offline   Reply With Quote
Old 7th August 2008, 18:55   #59  |  Link
martino
masktools2 (ab)user
 
martino's Avatar
 
Join Date: Oct 2006
Location: PAL-I :(
Posts: 235
http://avisynth.org/mediawiki/Condit...ring:_part_III
It's not thought through well. I've got a badly modified version with some fixes, so if you want to use it as a reference or something just ask. Also masktools has some scenechange stuff, as well as mvtools IIRC.
martino is offline   Reply With Quote
Old 7th August 2008, 19:00   #60  |  Link
Adub
Fighting spam with a fish
 
Adub's Avatar
 
Join Date: Sep 2005
Posts: 2,687
Blast you Didee!!! Blast you!!

It takes nearly a minute to render 1 frame! That is insane!! Hell, I can't see the artifacts when the clip is in motion. It was pure chance that I managed to spot it when stepping through frames.
__________________
FAQs:Bond's AVC/H.264 FAQ
Site:Adubvideo
Adub is offline   Reply With Quote
Reply

Tags
anime, antialiasing, avisynth

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 08:39.


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