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 Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 8th January 2006, 10:46   #121  |  Link
Manao
Registered User
 
Join Date: Jan 2002
Location: France
Posts: 2,856
I didn't even remember having written that in the readme, so don't feel sorry ( anyway, even in my best day, I wouldn't call that a readme )

Anyway, "ceiled to the closest power of 2" --> 16 is ceiled to 32. It was wanted, by design, but thinking about it, the reasons for which I wanted that aren't that good ( or, rather, I don't remember why the hell did I force such a constraint, it might have been something along the lines "they don't care about the normalization factor, so lets choose one that pleases me, and lets take a huge useless security margin to avoid to have to think about whether or not the computation overflows" ).

So I'll think a bit more about it, and change it if it's useless.
__________________
Manao is offline   Reply With Quote
Old 8th January 2006, 11:44   #122  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,558
But... 16 is a power of 2. I think I see what you're saying about overflow though, is it actually a big danger? The way it is now it pretty much by design will never use the expected normalization. (And oops, I was comparing two different things, I guess "16 0 0..." is the same way.)

If I specify a power-of-two value, will it use the mmx codepath?
foxyshadis is offline   Reply With Quote
Old 8th January 2006, 17:27   #123  |  Link
Manao
Registered User
 
Join Date: Jan 2002
Location: France
Posts: 2,856
Yes, it will use mmx if it can.

I removed the silly limitation ( 16 isn't changed into 32 ), and added some candies.

http://manao4.free.fr/masktools-v2.0a17.zip

Changes from alpha 16 to alpha 17 :
Code:
 * changed : behavior of mt_edge with a custom kernel : the automatic normalization factor
is now the sum of the absolute value of the coefficients, ceiled to the next power of two 
if that power is <= 128 ( else, it isn't ceiled ).
 * added : cartoon mode for mt_edge
 * added : modified mfToon script, for masktools v2. mfToonLite's speed goes from 30 fps
to 70 fps, mfToon from 4.5 to 6.5.
The script is based on mfToon v0.53, it doesn't give a binary identic output, because of the bug in the previous masktools that I definitely don't want to emulate. But it looks alike.
__________________

Last edited by Manao; 8th January 2006 at 17:29.
Manao is offline   Reply With Quote
Old 9th January 2006, 01:40   #124  |  Link
Egh
Registered User
 
Join Date: Jun 2005
Posts: 630
Quote:
Originally Posted by Manao

http://manao4.free.fr/masktools-v2.0a17.zip

* added : cartoon mode for mt_edge
A lamish question: what is cartoon mode for?

And more important: is there a mirror for new builds?
E.g. currently i can't access the site to grab last build... ^^
Egh is offline   Reply With Quote
Old 9th January 2006, 02:28   #125  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,389
Temporarily mirrored: MaskTools 2.0a17
__________________
- 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 12th January 2006, 19:40   #126  |  Link
mg262
Clouded
 
mg262's Avatar
 
Join Date: Jul 2003
Location: Cambridge, UK
Posts: 1,148
Manao,

I just saw this on another thread:

Code:
mt_merge(NR,some_other_clip,MyMoMask.fity2uv(),U=3,V=3)
And it made me think that actually this is quite a common usage... having a grayscale (i.e. ideally Y8, luma only) mask and wanting to use it to merge all the planes of two other planar clips. Would you consider it as an addition to MaskTools ?
__________________
a.k.a. Clouded. Come and help by making sure your favourite AVISynth filters and scripts are listed.
mg262 is offline   Reply With Quote
Old 12th January 2006, 19:58   #127  |  Link
Manao
Registered User
 
Join Date: Jan 2002
Location: France
Posts: 2,856
I might. It doesn't go well into the framework I designed, but that can be changed, and I'll have to write another mmx function to process efficiently the chroma channels, so it may take some times. Most of all, I'll have to think of a new parameter name (*sigh*).
__________________
Manao is offline   Reply With Quote
Old 14th January 2006, 21:43   #128  |  Link
Manao
Registered User
 
Join Date: Jan 2002
Location: France
Posts: 2,856
Ok, new version is up. I asked mg262 if I could include his LimitedSupport filters into the masktools, and he kindly agreed. Hopefully, the conversion was made without new bug.

In addition, I put inside the zip "Limitedsharpenfaster.avsi", adapted to these filters. Finally, mg262's great idea about a "chroma" parameter has also been added.

I didn't forget his request for mt_merge, it'll come soon I guess.

http://manao4.free.fr/masktools-v2.0a18.zip

Changelog from alpha 17 to alpha 18 :
Code:
 * added : mt_makediff, mt_adddiff, mt_average and mt_clamp, ported from mg262's
limitedsupport plugin. The asm code is his, though it has been ported to nasm. They
respectively amount to MakeDiff, AddDiff, SimpleAverage and Clamp.
 * added : mt_edge : "prewitt" kernel, taken from mg262's Prewitt filter. Unlike mg262's filter,
there's no multiplier ( it's always 1 ), but mt_edge's thresholds still apply. Results,
and speed, are identical except for the borders, which are now filtered.
 * added : "chroma" parameter, taken from mg262's excellent idea. It's a string that,
if used, overrides U and V values. It can be either "process", "copy", "copy first",
"copy second" or a number. "copy" and "copy second" work alike.
 * added : vmToon-0.74, adapted to masktools 2.0.
 * added : LimitedSharpenFaster, with LimitedSupport functions imported into the masktools.
__________________
Manao is offline   Reply With Quote
Old 20th January 2006, 08:07   #129  |  Link
aberforthsgoat
Registered User
 
Join Date: Oct 2004
Location: Zürich, Switzerland
Posts: 29
Say Manao,

I'm getting an error message now: "there is no function named 'mt_average.'" I'm guessing that this is one of the parts you have ported from mg262 - have I done something wrong?

Mike
aberforthsgoat is offline   Reply With Quote
Old 20th January 2006, 09:18   #130  |  Link
Manao
Registered User
 
Join Date: Jan 2002
Location: France
Posts: 2,856
Did you properly replaced the old mt_masktools.dll by the new one ? Because I don't have the problem on my computer.
__________________
Manao is offline   Reply With Quote
Old 20th January 2006, 09:38   #131  |  Link
aberforthsgoat
Registered User
 
Join Date: Oct 2004
Location: Zürich, Switzerland
Posts: 29
Quote:
Originally Posted by Manao
Did you properly replaced the old mt_masktools.dll by the new one ? Because I don't have the problem on my computer.
Aaargh!! - I just checked the timestamp on the new dll - and I think I pulled a pretty swift trick: Instead of copying the new dll into my plugin directory, I think I copied the old dll into the download directory, overwriting the old one. A downloaded again, and life seems to be improving.

Sorry for the mix up,

Mike
aberforthsgoat is offline   Reply With Quote
Old 20th January 2006, 21:39   #132  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,389
Hi again,

and today's bug is ... drummroll ... none! (I didn't search )

But I've a suggestion for a certain computation, which should or could fit well into mt_edge:

One thing I seem to do rather often is the following:
Code:
mt_lutxy(clp.mt_expand(),clp.mt_inpand,"x y - [factor] *")
(at times also for chroma).

Basically this is an edge mask, at least it looks like one. But in contrast to most other edgemasks, this one delivers a well defined result: the "span", or the value range, that is covered by the pixels in a 3x3 neighborhood.
While at times it deals well as a simply-an-edgemask, it might be of interest when doing comparisons between two clips. (Actually it is, surprise )

Scripting it is obviously no problem. But I think it would run *way* faster with a dedicated implementation. When scripted, there are two 3x3 kernel operations to be done, plus a 2-clip lookup. But the required minimum is only one 3x3 kernel operation, anything more is unnecessary overhead. (And when doing lots of comparisons, it will count.)

What doesn't fit so well into mt_edge's framework is the [factor] thingy, I see. But then, that one most probably is only for purposes of visualization, hence could be done with an additional mt_lut, or later on when an actual comparison is done with mt_lutxy.
The important thing would be to do the funky "Lutxy(expand,inpand)" in one loop.

End of suggestion.
__________________
- 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 20th January 2006, 21:57   #133  |  Link
Manao
Registered User
 
Join Date: Jan 2002
Location: France
Posts: 2,856
Suggestion noted. Actually, I rather like the edge mask built by expand - inpand, and used it back in the time when I was actually encoding things.

I'm still in the process of cleaning up a bit my framework, in order to make easily and cleanly possible mg262's mt_merge filter that applies directly the luma mask to all three components, so it might take a while ( well, actually, i don't know, it might be fast too ^^ ).

BTW, I was also thinking of another filter, more generic this time. Lets say you give it a list of pixels, a lut ( to apply to all these pixels, taking the central pixel's value into account ), and a way of collecting the result ( average, median, min, max, variance, whatever ( why not even a matrix )). You end up with a filter that gives you quite a lot of liberties, though it'll be slow. But I'm sure you would find a use to such a thing, wouldn't you ?
__________________
Manao is offline   Reply With Quote
Old 20th January 2006, 22:36   #134  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,389
Heya, that sounds interesting. However much more complicated than anything I ever would even dare to suggest
Though right now, I don't see what is "a list of pixels" ?

Smells like the way to a solution to a problem that's always buggin' me: evaluation of "spatial correlation" properties. (Imagine you build a signed difference of two clips - with the naked eye, you see immediately where the difference is just noise, and where there are real "structures" in the difference map ... but forcing a dumb-as-grass computer to properly reckognize this is not all that trivial.)

Go on, Manao. We're all on edge.
__________________
- 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 20th January 2006, 23:32   #135  |  Link
Manao
Registered User
 
Join Date: Jan 2002
Location: France
Posts: 2,856
Quote:
Though right now, I don't see what is "a list of pixels"
It's the list of the surrounding pixels you want to take into account. Basically, it's the same thing than inpand/expand's custom kernels. But instead of doing what inpand / expand do ( ie, finding the min / max of the list of surrounding pixels ), that one will let you choose what you want to find ( well, almost ).
__________________
Manao is offline   Reply With Quote
Old 21st January 2006, 17:27   #136  |  Link
Manao
Registered User
 
Join Date: Jan 2002
Location: France
Posts: 2,856
Ok, finally, it was sooner than later. Here's a new version :

http://manao4.free.fr/masktools-v2.0a19.zip

Changes from alpha 18 to alpha 19 :
Code:
 * code refactoring
 * fixed : bug with asm and width lower than 64
 * fixed : doesn't prepend (0, 0) pixel to the forms helpers
 * added : "min/max" mode to mt_edge. The edge value is local max - local min ( taken on a
3x3 square ).
 * added : mt_lutf : a frame lut
 * added : mt_luts : a spatial lut
And here is the documentation for the new filters
Code:
 * mt_lutf : clip, clip, string mode("avg"), string expr("y"), string yexpr("y"), string uexpr("y"), string vexpr("y")
   + mt_lutf takes two clips into account. It'll compute the "mode" operation over the
 pixels of the first clip, and then apply the lut on the second clip, with x = computed "mode"
 value, and y the usual lut variable. "mode" can be "avg", "std", "min", "max", and
 "range" = "max" - "min".
 
 * mt_luts : clip, clip, string mode("avg"), string pixels(""), string expr("x"), string yexpr("x"), string uexpr("x"), string vexpr("x")
   + mt_luts takes two clips into account. It'll compute the "mode" operation over the
 result of the lut expression, with the pixel of the first clip as x, and the neighbouring 
 pixel of the second clip as y. Since that doesn't make any sense when explained so bluntly,
 lets give some examples : 
     - mt_luts( c1, c1, mode = "avg", pixels = mt_square( 1 ), expr = "y" ) does a convolution
 by a 3x3 kernel filled with ones.
     - mt_luts( c1, c1, mode = "min", pixels = mt_square( 1 ), expr = "y" ) does an inpand
     - mt_luts( c1, c1, mode = "range", pixels = mt_square( 1 ), expr = "y" ) does a
 mt_edge( mode = "min/max" )
     - mt_luts( c1, c1, mode = "std", pixels = mt_square( 1 ), expr = "y" ) gives the local
 standard deviation of the clip
     - mt_luts( c1, c1, mode = "max", pixels = mt_square( 1 ), expr = "x y - abs" ) gives
 the maximum difference between the surrounding pixels and the center.
As you can see, the "modes" play a great part in the behavior of the filter. I wasn't really inspired when I created those 5 modes, so feel free to bug me whenever you find an interesting idea for them.
__________________
Manao is offline   Reply With Quote
Old 21st January 2006, 19:35   #137  |  Link
Manao
Registered User
 
Join Date: Jan 2002
Location: France
Posts: 2,856
Mmm, I borked something just before releasing it. I erased some files and restored them to an incorrect version. That resulted in most filters being mainly borked...

I'll correct that ASAP.
__________________
Manao is offline   Reply With Quote
Old 21st January 2006, 20:15   #138  |  Link
Manao
Registered User
 
Join Date: Jan 2002
Location: France
Posts: 2,856
Fixed : http://manao4.free.fr/masktools-v2.0a20.zip
__________________
Manao is offline   Reply With Quote
Old 21st January 2006, 20:34   #139  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,389
Huh, that was fast! And what nice things to play with - if I only think of how dreadful it was to juggle around with masks to get something ~similar~ like standard deviation ...

A bunch of new possibilities has opened (... though it might take some time to actually realize all of 'em).

Many many thanks, Manao!
__________________
- 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 22nd January 2006, 08:17   #140  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,558
http://forum.doom9.org/showthread.ph...816#post772816

Can you check this out, Manao? I haven't had time to investigate whether it was a script translation error or actual filter error for certain.
foxyshadis 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 11:24.


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