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 11th May 2012, 15:07   #1  |  Link
lisztfr9
Registered User
 
Join Date: Apr 2010
Posts: 175
mt_lutxy

Hi,

I can't get started with this function...

mt_lutxy

mt_lutxy : clip clip1, clip clip2, string expr("x"), string yexpr("x"), string uexpr("x"), string vexpr("x")

It applies a two-parameters function defined by expr to all the pixels. The function is written is reverse polish notation.
If yexpr, uexpr or vexpr isn't defined, expr is used instead.

1) How pixels of the clip 2 are used for calculation ?

- expr("x")

I guess the other expressions applies to Y, U, V ?

mt_lutxy(o,g,"x x y - abs "+string(z)+" / 1 "+string(pow)+" / ^ "+string(z)+" * "+string(str)+
\ " * x y - 2 ^ x y - 2 ^ "+string(ldmp)+" + / * x y - x y - abs 0.001 + / * +",U=2,V=2)


Ok, i know what reverse polish notation is, but i'm unable to understand this. It would be nice to have at least 1 example somewhere, to start with, explaining how the function is working on a simple task....

x y looks like Cartesian coordinates...

what does x x y ?

* x y - 2 ^ x y - 2 where comes clip2 in calculation ... ?

reverse notation, why is the * before the x, y :

* x y - x y ?

TIA, L
lisztfr9 is offline   Reply With Quote
Old 11th May 2012, 15:26   #2  |  Link
lisztfr9
Registered User
 
Join Date: Apr 2010
Posts: 175
mt_average

mt_average : clip clip1, clip clip2

Equivalent to mt_lutxy("x y + 2 /"), but faster.

Ok, this is x + y / 2.
lisztfr9 is offline   Reply With Quote
Old 11th May 2012, 16:39   #3  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
Quote:
Originally Posted by lisztfr9 View Post
How pixels of the clip 2 are used for calculation ?
For each pixel, the output value is calculated from the relevant expression, with x as the value of the pixel in clip1 and y the pixel in clip2.

For RPN, see http://en.wikipedia.org/wiki/Reverse_Polish_notation.

Note also the functions mt_polish and mt_infix for converting between RPN and 'normal' (infix) expression form.
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 12th May 2012, 09:46   #4  |  Link
lisztfr9
Registered User
 
Join Date: Apr 2010
Posts: 175
Ok, but why is it so confusing ?

because this is not RPN :

(o,g,"x x y - abs "+string(z)+"

The first "x" must belong to the syntax of the function, but seems also be a part of an RPN expression.

But for being RPN, it would need 2 operators behind, where there is only 1.

Also, there are 2 levels of quotes, around variables and around expressions ! The "abs" statement, applies to a parameter inside quotes, which usually enclose strings variables.

And finally, x y usually refer to coordinated along X and Y axis in a plan...

Last edited by lisztfr9; 12th May 2012 at 09:53. Reason: typo
lisztfr9 is offline   Reply With Quote
Old 12th May 2012, 10:55   #5  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
Quote:
Originally Posted by lisztfr9 View Post
this is not RPN :

(o,g,"x x y - abs "+string(z)+"

The first "x" must belong to the syntax of the function, but seems also be a part of an RPN expression.

But for being RPN, it would need 2 operators behind, where there is only 1.

Also, there are 2 levels of quotes, around variables and around expressions ! The "abs" statement, applies to a parameter inside quotes, which usually enclose strings variables.
The added source of confusion here is that the expression string is being constructed dynamically by string concatenation. This is necessary because it needs to include the literal value of 'z' which is a script variable, so the string() function is used. Similarly for the other variables in the original expression.

You cannot in general make sense of a fragment of RPN without considering the whole string. The operator that goes with a particular operand may be much further on in the string.

Quote:
And finally, x y usually refer to coordinated along X and Y axis in a plan...
They have that interpretation in mt_lutspa, but forget that here - in mt_lutxy, they refer to the pixels from the two clips.
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 12th May 2012, 17:34   #6  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
For anyone wanting to play with RPN, there is a FreeWare RPN calculator Excalibur v2.00
(from 2006), have not as yet played with it much but it looks quite good.
Below from text on SoftPedia (home site no longer on-line).

Code:
Excalibur description
A full featured RPN-only calculator

The Excalibur application was designed to be a full featured RPN-only calculator. This is a serious calculator for serious users.
Excalibur takes up a small amount of resources for all it does so well.

Here are some key features of "Excalibur":

· Powerful RPN entry. 300 Functions (scientific, business, conversion, computer science, physics, complex numbers, geometry, vectors, etc). 
Full 4 or 8-level stack.
· International support for different comma and decimal point formats. Programmable, macros, registers, custom button banks, etc.
http://www.softpedia.com/get/Science...xcalibur.shtml
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 12th May 2012, 17:39   #7  |  Link
06_taro
soy sauce buyer
 
Join Date: Mar 2010
Location: United Kingdom
Posts: 164
mt_polish( any_infix_notation ) returns reverse polish notation
mt_infix( any_rpn ) returns infix notation
e.g., mt_lutxy(a, b, "x y +") equals to mt_lutxy(a, b, mt_polish("x + y"))
06_taro is offline   Reply With Quote
Old 12th May 2012, 18:17   #8  |  Link
Overdrive80
Anime addict
 
Overdrive80's Avatar
 
Join Date: Feb 2009
Location: Spain
Posts: 673
Quote:
Originally Posted by 06_taro View Post
mt_polish( any_infix_notation ) returns reverse polish notation
mt_infix( any_rpn ) returns infix notation
e.g., mt_lutxy(a, b, "x y +") equals to mt_lutxy(a, b, mt_polish("x + y"))
If I only use mt_polish("x + y"), will shows it in screen infix result??? Or I would need other more function as subtitle(....)?

Regards
__________________
Intel i7-6700K + Noctua NH-D15 + Z170A XPower G. Titanium + Kingston HyperX Savage DDR4 2x8GB + Radeon RX580 8GB DDR5 + ADATA SX8200 Pro 1 TB + Antec EDG750 80 Plus Gold Mod + Corsair 780T Graphite
Overdrive80 is offline   Reply With Quote
Old 12th May 2012, 18:40   #9  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
Quote:
Originally Posted by Overdrive80 View Post
If I only use mt_polish("x + y"), will shows it in screen infix result??? Or I would need other more function as subtitle(....)?
mt_polish() returns a string, so if you want to see it on the screen you can use Subtitle(mt_polish("x + y")).

Note that you can get away with never learning RPN at all and just use mt_polish("...") instead for your expressions.
I don't know why more people don't use it in published scripts - it's much easier to understand.
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 12th May 2012, 19:08   #10  |  Link
Overdrive80
Anime addict
 
Overdrive80's Avatar
 
Join Date: Feb 2009
Location: Spain
Posts: 673
Thanks Gavino.
__________________
Intel i7-6700K + Noctua NH-D15 + Z170A XPower G. Titanium + Kingston HyperX Savage DDR4 2x8GB + Radeon RX580 8GB DDR5 + ADATA SX8200 Pro 1 TB + Antec EDG750 80 Plus Gold Mod + Corsair 780T Graphite
Overdrive80 is offline   Reply With Quote
Old 13th May 2012, 14:38   #11  |  Link
lisztfr9
Registered User
 
Join Date: Apr 2010
Posts: 175
Thanks to all.

ScriptClip("""subtitle("<other_variable>" + string(mt_polish("x + y")))""")

(many quotes...)

Subtitle(last, mt_polish("x + y"),10, 20)
lisztfr9 is offline   Reply With Quote
Old 13th May 2012, 14:59   #12  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
Quote:
Originally Posted by lisztfr9 View Post
ScriptClip("""subtitle("<other_variable>" + string(mt_polish("x + y")))""")
Not sure if you were asking a question there.

string() is unnecessary as mt_polish already returns a string.
ScriptClip() is also unnecessary unless the other variable involves some run-time function.
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino 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 09:02.


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