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 > VapourSynth

Reply
 
Thread Tools Search this Thread Display Modes
Old 11th December 2014, 16:29   #1  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
Dither - a complementary script to fmtconv

link https://github.com/IFeelBloated/Vapo...ster/Dither.py
dependency
fmtconv http://forum.doom9.org/showthread.php?t=166504


I never used Python once till yesterday, after a whole day of tutorial reading, I decided to port some popular functions from dither to vaporsynth mainly to see if I already handled what I got today or not
the only dependency of the script is "fmtconv"
I'm no programming expert, actually still a punk ass teen in high school according to my mom
so please correct me if something's wrong
hope it would be

Last edited by feisty2; 6th February 2015 at 13:20.
feisty2 is offline   Reply With Quote
Old 11th December 2014, 16:37   #2  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
the only thing on my mind after writing this is omfg, no "^" in Expr function, seriously? why?
I'm gonna have to replace simple x y ^ to complex x log y * exp for what?
feisty2 is offline   Reply With Quote
Old 11th December 2014, 17:09   #3  |  Link
jackoneill
unsigned int
 
jackoneill's Avatar
 
Join Date: Oct 2012
Location: 🇪🇺
Posts: 760
With 16 bit clips, this
Code:
clip = self.Expr ([src1, src2], ["x y + 32768 -"])
is the same as
Code:
clip = core.std.MergeDiff(src1, src2)
only MergeDiff is likely faster.

Also with 16 bit clips,
Code:
clip = self.Expr ([src1, src2], ["x y - 32768 +"])
is the same as
Code:
clip = core.std.MakeDiff(src1, src2)
only MakeDiff is likely faster.

It's a good idea to always use the same number of spaces when indenting your Python code.
__________________
Buy me a "coffee" and/or hire me to write code!
jackoneill is offline   Reply With Quote
Old 11th December 2014, 17:26   #4  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
Noted, will edit them when my Iceland trip is over
feisty2 is offline   Reply With Quote
Old 11th December 2014, 19:12   #5  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,597
Quote:
Originally Posted by feisty2 View Post
the only thing on my mind after writing this is omfg, no "^" in Expr function, seriously? why?
I'm gonna have to replace simple x y ^ to complex x log y * exp for what?
Correct. I could add it but in the end it'd be an alias for the same expression anyway.

Some day I'll do proper runtime code generation instead...
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 12th December 2014, 02:32   #6  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,672
Quote:
Originally Posted by Myrsloik View Post
Correct. I could add it but in the end it'd be an alias for the same expression anyway.

Some day I'll do proper runtime code generation instead...
I wouldn't mind seeing ^ even if it's just an alias, it'll make using existing expressions much easier. Wow, time flies, I asked about this almost 2 years ago
Reel.Deel is offline   Reply With Quote
Old 12th December 2014, 05:06   #7  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
update:
did the suggested edits mentioned earlier
fixed a bug in limit_dif16 expr when ref clip != src clip

Last edited by feisty2; 12th December 2014 at 10:20.
feisty2 is offline   Reply With Quote
Old 14th December 2014, 07:12   #8  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
update:
new function "clamp16", 16bpc version of "mt_clamp"
new function "SBR16", what's this actually? I dunno, just many scripts require it, looks like gaussian blur to me

Last edited by feisty2; 14th December 2014 at 14:08.
feisty2 is offline   Reply With Quote
Old 18th December 2014, 15:51   #9  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
update:
completely rewritten
special thanks to @ Are_ for excellent script example
"class" stuff has been canceled
no more dizzy and messy avisynth script look like machine codes ("linear_and_gamma" function)

update2:
removed "merge16", it's useless, cuz I just found out "MaskedMerge" works at 16bpc

update3:
little fixes, please let me know if there's still something wrong or unnecessary or just stupid

Last edited by feisty2; 19th December 2014 at 05:10.
feisty2 is offline   Reply With Quote
Old 18th December 2014, 16:00   #10  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
btw, could someone kind tell me where can I find the lwlibavvideosource binary for vaporsynth?
I searched both google and forum, all builds I found work on avs only
feisty2 is offline   Reply With Quote
Old 18th December 2014, 16:18   #11  |  Link
GMJCZP
Registered User
 
GMJCZP's Avatar
 
Join Date: Apr 2010
Location: I have a statue in Hakodate, Japan
Posts: 760
Here.

Based in here.

Inside the package look for Vapoursynth folder.
GMJCZP is offline   Reply With Quote
Old 18th December 2014, 16:20   #12  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
Quote:
Originally Posted by GMJCZP View Post
Here.

Based in here.

Inside the package look for Vapoursynth folder.
nice, thx!
feisty2 is offline   Reply With Quote
Old 18th December 2014, 16:23   #13  |  Link
GMJCZP
Registered User
 
GMJCZP's Avatar
 
Join Date: Apr 2010
Location: I have a statue in Hakodate, Japan
Posts: 760
We must support new generations .
GMJCZP is offline   Reply With Quote
Old 18th December 2014, 17:16   #14  |  Link
TurboPascal7
Registered User
 
TurboPascal7's Avatar
 
Join Date: Jan 2010
Posts: 270
Quote:
Originally Posted by feisty2 View Post
Code:
          
    if gcor != 1.0:
       g2l = "{g2l} 0 >= {g2l} log {gcor} * exp {g2l} ?".format (g2l=g2l, gcor=gcor)
    else:
       g2l = g2l

    if sigmoid is True:
       g2l = build_sigmoid_expr (g2l , True , thr, cont)
       l2g = build_sigmoid_expr (expr , False , thr, cont)
    else:
       g2l = g2l
       l2g = expr

    if gcor != 1.0:
       l2g = "{l2g} 0 >= {l2g} log {gcor} * exp {l2g} ?".format (l2g=l2g, gcor=gcor)
    else:
       l2g = l2g
I know that I'm being a very bad person here and not helping anything, but could you please explain why the hell you're doing this?
__________________
Me on GitHub | AviSynth+ - the (dead) future of AviSynth
TurboPascal7 is offline   Reply With Quote
Old 18th December 2014, 17:53   #15  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
It's from the original dither (avisynth version), something's wrong?
Please tell me how I messed things up
And merry Xmas in advance

Edit: will fix "is" issue when I get back to hotel in the afternoon

Last edited by feisty2; 18th December 2014 at 18:04.
feisty2 is offline   Reply With Quote
Old 18th December 2014, 17:56   #16  |  Link
colours
Registered User
 
colours's Avatar
 
Join Date: Mar 2014
Posts: 308
"x = x" effectively does nothing.

Avisynth scripts just tend to have statements of the form "x = condition ? x : y" because the ternary conditional operator requires a result regardless of whether the condition is true or false.
__________________
Say no to AviSynth 2.5.8 and DirectShowSource!
colours is offline   Reply With Quote
Old 19th December 2014, 06:04   #17  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
update:
sbr16 and clamp16 are back (rewritten to vaporsynth style)
feisty2 is offline   Reply With Quote
Old 6th February 2015, 09:15   #18  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
update:
new func resize16nr, a few mods
feisty2 is offline   Reply With Quote
Old 6th February 2015, 12:38   #19  |  Link
RTW47
Rome Total War
 
RTW47's Avatar
 
Join Date: Mar 2013
Location: C:\Python33
Posts: 39
if dif == True: could be replaced with just if dif:
if fulls == False: could be replaced with if not fulls:
etc.
__________________
GOTO:EOF

Last edited by RTW47; 6th February 2015 at 14:32. Reason: #P.S
RTW47 is offline   Reply With Quote
Old 6th February 2015, 12:43   #20  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
Quote:
Originally Posted by RTW47 View Post
if dif == True: could be replaced with just if dif:
etc.
alright, those were things I wrote when I was even more of a newbie than I am now, will edit them soon

update:
fixed an error in linear_and_gamma

Last edited by feisty2; 6th February 2015 at 13:17.
feisty2 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 05:08.


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