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.

Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se

 

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

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 17th May 2010, 02:03   #14  |  Link
WorBry
Registered User
 
Join Date: Jan 2004
Location: Here, there and everywhere
Posts: 1,197
Thanks for your comments. All suggestions for improvement are most welcome.

Quote:
Originally Posted by Gavino View Post
Are the formulae for Additive and Subtractive correct?
For sure, the formulae per se are 'correct'.

Quote:
Note that the opacity is only applied on one branch of the conditionals. That doesn't matter for Lighten and Darken, since the result is unchanged, but not for Additive and Subtractive - is this intended? Should it not be
(BLMode=="Additive") ? "x y + 255 > 255 x y + ? "+String(Opac)+" * x 1 "+String(Opac)+" - * + " etc
For the Opacity component of the mt_lutxy expression strings, I took the same as approach as Didee's earlier Hardlight functions:

http://forum.doom9.org/showpost.php?...32&postcount=2

And taking, for example, 'Additive':

Code:
(x + y ) > 255 ? 255 : (( x + y) * "+String(Opac)+" ) + (x * (1 - "+String(Opac)+" ))
....seems right to me and mt_polish (using a arbitary value instead of "+String(Opac)+" ) literally translates this to:

Code:
x y + 255 > 255 x y + "+String(Opac)+"  * x 1 "+String(Opac)+"  - * + ?
i.e. puts the ? ('If' condition) at the end of the string (stack?), which is how it is now in Blend_MT.

Reverse translation (mt_infix) of:

Code:
"x y + 255 > 255 x y + ? "+String(Opac)+" * x 1 "+String(Opac)+" - * + "
literally gives:
Code:
((((x + y) > 255 )) ? 255 : (x + y)) * "+String(Opac)+" ) + (x * (1 - "+String(Opac)+" )))
Which seems to be the same thing. Both '?' options work and give the same result, so I am not sure, which is the 'more correct' ?

Quote:
I think it would make the formulae more readable and checkable if you defined the opacity expressions as variables, eg
Opacity = String(Opac)+" * x 1 "+String(Opac)+" - * + "
instead of repeating them everywhere.
Yes, I've been thinking of ways to cut down on the repetition, and will have a look at that, bearing in mind that there are six opacity determinants in all (Opac, Opac1, Opac2, SOpac, SOpac1, SOpac2).

I did at one point (posts #10 and #11) consider applying the blend opacity through a second mt_lutxy expression, but would that (obviously) would mean two lut calcs (each with their own rounding errors) instead of one, and make it more difficult to work in separate opacity determinants for <128 and >128 with the Hardlight, Softlight and Overlay modes.

Quote:
Also, if you call the function with an unrecognised BLMode, it gives the error "I don't know what Bl1Expr means".
Better would be to replace the final Bl1Expr in the code above with something like
Assert(false, "Invalid BLMode String")
Quite agree. Added it. Thanks.
__________________
Nostalgia's not what it used to be

Last edited by WorBry; 17th May 2010 at 02:23.
WorBry is offline   Reply With Quote
 

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


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