Log in

View Full Version : MaskTools 2.0a48


Pages : 1 2 3 4 [5] 6 7 8 9 10 11 12 13

redfordxx
15th June 2006, 22:26
Hi Manao,
it's again me --- the troublemaker.

I have a suggestion of new feature. Of course, it comes from what I do and I need and I know neither how many other users will appreciate it, nor how difficult to add this feature.

And as you are the judge, I only show what I have in mind.

IDEA: Sometimes there are more values calculated than necessary. Example: I want to calculate range value per each 8x8 block. When I do it with mt_luts("range",mt_freerectangle(0,0,7,7)...) there is calculated 64x more values than necessary, because I need only the first pixel in every block.

SUGGESTION: How about adding another optional common parameter or pair of parameters where would be set which pixels the operation should be applied to. When I should present the maximalistic version, there could be defined repeating cycle in each axis, list of pixels within the cycles to be processed and logical operator between h and v axis.

EXAMPLES:Calculating range for each 8x8 block
mt_luts("range",mt_freerectangle(0,0,7,7),applyto="h % 8 = (0) & v % 8 = (0)",...)
Calculating avg of 8x8 pixels every 4 pixels horizontaly
mt_luts("range",mt_freerectangle(0,0,7,7),applyto="h % 4 = (0)",...)
First half of deblock_qed looks like "block, block...". It could look like:
original.mt_lut(y=-255).mt_lut("0",applyto="h % 8 =(0,7) | v % 8 =(0,7)")

well..sorry for bothering...

redfordxx
3rd December 2006, 02:20
Hi Manao,
today I'll be brief. Would you consider adding a "bias" parameter for mt_convolution like in GeneralConvolution?
Would be useful in cases like
mt_convolution("0 -1 1","1",bias=128...)

until then I share for those might find useful...

function rd_convolution(clip o, string "horizontal", string "vertical", bool "saturate", float "total", int "bias", int "y", int "u", int "v")
{
bias=default(bias,0)
rdhorizontal=default(horizontal,"1 1 1")
rdvertical=default(vertical,"1 1 1")
rdsaturate=default(saturate,true)
rdtotal=default(total,1.0)
rdy=default(y,3)
rdu=default(u,1)
rdv=default(v,1)
p=o.mt_convolution(rdhorizontal, rdvertical, bias==0 ? rdsaturate : true, rdtotal, rdy, rdu, rdv)
a= bias==0 ? p : mt_convolution(o, rdhorizontal, rdvertical, false, rdtotal, rdy, rdu, rdv)
bias==0 ? p : mt_lutxy(rdsaturate==true ? p : a, a, "x y == y 0 y - ? " + String(bias) + " +",y=rdy,u=rdu,v=rdv)
}

martino
16th January 2007, 14:47
I keep getting "there is no function named DEdgeMask" when trying to use LimitedSharpen and "there is no function named YV12LUTxy" when using aWarpSharpDering.

What am I doing wrong?

foxyshadis
16th January 2007, 19:14
Not having both masktools 1 and 2. (Those functions are part of v1.)

martino
16th January 2007, 23:19
So I need to have both installed...

d'oh

AssassiNBG
22nd March 2007, 21:23
So I need to have both installed...

d'oh

You just have to load both dlls into your script. (1.5.8 and 2.0a30)

And now onto my question. I have a function that uses edgemask() from masktools version 1.5.8. Since it is conflicting with fft3dgpu, I would like to modify this function to use mt_edge instead (from mt 2.0a30) I had a look at the documentation, but I couldn't understand much. I've never written a function before, or have paid much attention to the ones I copied from the board.

I hope at least the developer of masktools could help me out.

You can see the fft3dgpu development thread for reference about the problem.

tsp
29th March 2007, 17:26
is mt_polish broken in 2.0a30? It's complaining that spirit parser is not available with this script:

blackness().converttoyv12()
subtitle(mt_polish("x+y"))

jmac698
6th April 2007, 22:16
colorbars(pixel_type="YV12")
yv12lut() returns a bright green image (expected original image).

mt_lut(yexpr="x 161 = 0 x ?",uexpr="128",vexpr="128",y=3,u=3,v=3)
doesn't work, no test is true for equality. != does work and can be used as a workaround.

krieger2005
6th April 2007, 23:17
equal-sign changed from "=" to "=="

jmac698
7th April 2007, 04:46
agreed, but 1.5.8 still has a bug, but I guess that's irrelevant now.

Manao
7th April 2007, 06:43
By default, yv12lut trash the chroma planes, so their values is random. It's not a bug.

Tsp : noted, next version will have mt_polish back ( i must have disabled it because it was so slow to compile ).

redfordxx : noted too

Didée
12th April 2007, 02:32
noted
noted too
Oh, while you're holding the pencil anyway ... ;)

Proposal: New mode for mt_LutS: masking of "pixel's extremity"

Explanation: in a pixel's neighborhood, there's a darkest and a brightest pixel. Then ...

Method1: extremity = abs((pixel-min)/(max-min)-0.5)*2*255
(In the very middle between max and min, extremity is zero. At min and at max, extremity is maximal.)
(Used that several times.)

Method2: extremity = (pixel-min)/(max-min)*255
(Zero extremity gives mask=128. mask=0 means "pixel has 100% extremity @ dark". mask=255 means "pixel has 100% extremity @ bright".)
(Never used this one, but seems feasable, for completeness.)

Several times I found this useful during toying-around, but it's rather laborious to script with the current filters: three values are needed for computing, the complete list goes: one (or 2 or 3) inpand's, one (or 2 or 3) expand's, and three instances of LutXY: a=lutxy(min,max), b=lutxy(pixel,min), mask=lutxy(a,b). A good bunch of filter instances that is.

So I thought, perhaps(!) it is easier(?) when integrated into mt_LutS ... A new mode, "extremity1/2" or whatever, and via "pixels=" one can define the neighborhood that is to search for the local min and max.


Not earthbreaking, not of major importance. Just an idea. ;)

Dr.Khron
23rd April 2007, 16:56
Not sure if this thread is the correct place for this, but here I go...
Been fooling around with VMtoon. (the anime sites tend to rave about its predecessor, MFToon).

Got it all set up and it produced a horrible result: it turned most of the black outlines into white pixels! Hopefully, I'm doing something wrong.

http://img255.imageshack.us/img255/166/lisagl0.jpg

Turning down the power with VMtoon(strength=20) reduced the effect, but then it didn't sharpen either.
Here is my script:
LoadPlugin("C:\Program Files\AviSynth 2.5\MyPlugins\mt_masktools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\MyPlugins\WarpSharp.dll")

import("C:\Program Files\AviSynth 2.5\MyPlugins\vmToon-v0.74.avsi")

#import Mpeg video and correct colors
DGDecode_mpeg2source("D:\Ripping\D2V.d2v")

#De-interlace
edeintted = AssumeTFF().SeparateFields().SelectEven().EEDI2(field=-1)
tdeintted = TDeint(edeint=edeintted,order=1)
tfm(order=1,clip2=tdeintted).tdecimate(hybrid=1)

#crop
crop( 8, 0, -8, 0)

#Resize
LanczosResize(640,480) # Lanczos (Sharp)

#noise filter
FluxSmoothST(7,9)

vmtoon()

foxyshadis
23rd April 2007, 17:19
A few things to test, to see what eliminates the effect.

Remove resizing: ssw=0 & ssh=0
Remove xsharpen: xstren=0
Remove thinning: thinning=0
Remove darkening: strength=0

If only one is missing the white, that'll quickly narrow it down; if it's more, it could be tougher.

Dr.Khron
24th April 2007, 00:13
vmtoon(ssw=0)
vmtoon(ssh=0)
vmtoon(ssw=0, ssh=0)
Using any of thse returns the same error:
"Resize: Width must be bigger then or equal to 4."

vmtoon(xstren=0)
Result: fixes the problem.

vmtoon(thinning=0)
Seems to make the problem slightly worse.

vmtoon(strength=0)
Seems to fix the problem, but makes the sharpening wierd: the black edge lines break up a little.

Leak
24th April 2007, 08:57
vmtoon(ssw=0)
vmtoon(ssh=0)
vmtoon(ssw=0, ssh=0)
Using any of thse returns the same error:
"Resize: Width must be bigger then or equal to 4."
I guess using 1 instead of 0 here would be the "do nothing" option...

foxyshadis
24th April 2007, 13:53
Ooops, ss has to be 1, not 0. >.>

So Xsharpen might be overflowing? Hrm. I'll see if I can get that to happen here.

Dr.Khron
24th April 2007, 16:27
I've now confirmed that:
vmtoon(ssw=1)
vmtoon(ssh=1)
vmtoon(ssw=1, ssh=1)

Do not fix the problem, they only make it worse.

Thanks for all the help, let me know if you need a few frames to check it out.
Would posting screen shots of the output with those different settings help?

foxyshadis
24th April 2007, 22:20
I wasn't able to reproduce, but I'm not sure I have the right source to do so. If you could replace vmtoon() with ImageWriter(file="x:\wherever\sample",start=x,end=y,type="ebmp") where x to y are representative frames, and then zip them up, I can try to find out where it's overflowing.

Dr.Khron
24th April 2007, 23:38
Here you go:

http://www.mytempdir.com/1307532

It only 3 frames, I wasn't sure if that was enough.
Anyway, if you couldn't reproduce it, its probably somehting to do with my set up. I just did a clean install of everything though, and I was careful to get the latest DLLs...

EDIT:
I tried using an older version, mftoon2 (mfToon-v0.54.avsi), but it keeps telling me that the "Unsharpmask" function cannot be found... I can't this function anywhere. Is it part of an older package I might be missing?

IanB
25th April 2007, 09:31
Someones got a bug in there code. This is typical when one doesn't clamp arithmetic results to 0 at the low end and 255 at the high end.

In 8 bit unsigned arithmetic 0-1=255 (0=black, 255=white)

Manao
1st August 2007, 21:00
New version : v2.0a31 (http://manao4.free.fr/masktools-v2.0a31.zip)

Changelog : * fixed : mt_hysteresis was randomly crashing.
* fixed : mt_polish is back.
* added : round, clip, min, max and = for lut.
* adapted : to msvc8 / yasm.

Manao
1st August 2007, 21:03
Didee : what you asked for isn't possible with a lut, it would require too big a lut.

Dr Khron, foxyshadis : does anybody still have the problem on the edges reported by Dr Khron ? If yes, can I have something to help me reproduce it ?

Terranigma
1st August 2007, 22:06
Thanks for the update Manao :)

Terranigma
1st August 2007, 23:27
Manao, was there some sort of speed tweak involved as well? Seems like it, but maybe i'm just off my engines.

Manao
2nd August 2007, 19:08
I didn't do anything to make it faster.

Manao
5th August 2007, 14:27
New version : v2.0a32 (http://manao4.free.fr/masktools-v2.0a32.zip)

Changelog : * added : mt_lutxyz
* added : mt_lutsx
* fixed : small memory leak in mt_luts

Basically, mt_lutsx is the filter Didee previously required, and mt_lutxyz is a three clip lut. I changed my position on what "too big" is for a lut. Those filters take some time to initialize ( 3*2^24 values to compute ), something like 5 seconds can be expected. Each instance of those filters takes up 48 MB too.

check
10th August 2007, 18:19
Just letting you know there's a typo in the filterlist in the .htm help. 'mt_rectange'

Spuds
20th December 2007, 03:18
Not so much a bug as an observation or just a plain mistake on my part.

I was using mt_lutf to see if a frame was over / under a very low threshold, something like:
lutf(mask,mask,mode="avg",expr="x 0.1 > y 0 ?")

and comparing the results to:
ConditionalFilter(mask, nullclp, mask, "AverageLuma()", "<", string(0.1),false)

I was getting different results on what frames got through and realized the mt_lutf was doing the comparison not on the float but on the rounded value of average. I know the final result is a round but expected the float to be maintained through the comparison.

Also found that the averageluma approach was about 30% faster.

Didée
20th December 2007, 03:41
Interesting finding on the rounding thing.
The speed difference probably isn't surprising: averageluma operates on just one single clip. LutF/LutS always operate on two input clips, could be this makes the internal pixel shuffling a bit slower.

Manao
20th December 2007, 06:58
LutF/S are completely unoptimized, so it doesn't suprises me if they are slow.

As for the rounding, I'll add that to the documentation. It makes sense for me, since the average becomes an entry to a LUT, it must be rounded, but I guess that a programmer's POV, not really a user's POV :)

Fizick
20th December 2007, 17:16
manao, why in your signature the stable version is 2.0a31 and not 2.0a32? :)

yup
28th February 2008, 10:24
Hi folks!
Can I use MaskTools V.2 in Avisynth 2.57 with planar YUY2?
I can get planar using SSETools.AVISource("a.avi")#YUY2 source
SeparateFields()
Interleaved2Planar()
MaskTools V.2 function
Planar2Interleaved()
Weave()

This will be work?
yup.

Boulder
28th February 2008, 10:28
MaskTools requires YV12 input, so you need to convert to YV12 before using any MaskTools functions.

yup
28th February 2008, 10:44
Hi Boulder!
This sentence from document.
The filters have a set of common parameters, that mainly concerns what processing to do on each planes. They all work only in YV12 ( though with Avisynth 2.6, support for all planar format will be available ).
We need waiting Avisynth 2.6? I right?
yup.

Boulder
28th February 2008, 10:47
I don't know the inner workings of MaskTools, it could (and probably does) mean that the MaskTools code needs some rewriting too.

Manao
28th February 2008, 10:58
Internally, it supports everything from 4:0:0 to 4:4:4 planar. I'll see what I can do for avs 2.5 and interleave2planar. It already works for avs 2.6.

Manao
28th February 2008, 19:56
Done : http://manao4.free.fr/masktools-v2.0a33.zip

XBoy
29th February 2008, 04:14
How about x64 support?

Manao
29th February 2008, 04:18
I can quickly make a x64 version with assembly disabled. I don't think that's what you want, but without having a 64bit OS, I won't do anything more.

yup
29th February 2008, 10:42
Manao!
:thanks:
I try and report.
yup.

yup
29th February 2008, 13:56
Hi Manao!
I tested now You new version, script simple
LoadPlugin("SSEToolsS.dll")
LoadPlugin("mt_masktools-25.dll")
AVISource("flower.avi")
AssumeTFF()
SeparateFields()
Interleaved2Planar()
mt_luts(last, last, mode="median",pixels=" 0 0 0 1 0 -1", expr="y", U=1, V=1)
Planar2Interleaved()
result
http://img264.imageshack.us/img264/5620/mtplanarqr8.th.png (http://img264.imageshack.us/my.php?image=mtplanarqr8.png)
Source analog capture YUY2 colorspace.
yup.

Manao
29th February 2008, 20:09
Hopefully, fixed : http://manao4.free.fr/masktools-v2.0a34.zip

yup
1st March 2008, 10:21
Manao!
:thanks:
Now all work. I try implement LSF for YUY2 colorspace, my source analog capture.
yup.

XBoy
6th March 2008, 04:30
I can quickly make a x64 version with assembly disabled. I don't think that's what you want, but without having a 64bit OS, I won't do anything more.

how about having the asm compiling in yasm?

Manao
6th March 2008, 08:30
If you knew what you were talking about, you'd already see that I use yasm. yasm != 64bit compatibility.

Manao
19th April 2008, 10:12
http://manao4.free.fr/masktools-v2.0a35.zip

A new filter, mt_lutspa, which comes in handy whenever you need to create mask/picture/whatever that can be mathematically defined.

For example :mt_lutspa(clip,false,"x 32 % 16 < 0 255 ?", chroma = "128"Creates vertical white & black stripes, and : mt_lutspa(clip, false, "x 32 % 16 < 0 1 ? y 32 % 16 < 0 1 ? + 1 == 0 255 ?", chroma = "128")Creates a black and white checker board.

halsboss
21st April 2008, 10:54
Hello, searched but didn't spot when to use mt_masktools-25.dll or mt_masktools-26.dll - any hints (nothing said in the readme of the latest version)... I have avisynth 2.5.7

Manao
21st April 2008, 11:39
mt_masktools-25.dll is for avisynth 2.5.x
mt_masktools-26.dll is for avisynth 2.6

Nikos
23rd April 2008, 15:14
In masktools Round(1.5)=2 or 1.