View Full Version : Dither - a complementary script to fmtconv
feisty2
11th December 2014, 16:29
link https://github.com/IFeelBloated/VaporSynth-Functions/blob/master/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
feisty2
11th December 2014, 16:37
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?
:(
jackoneill
11th December 2014, 17:09
With 16 bit clips, this
clip = self.Expr ([src1, src2], ["x y + 32768 -"])
is the same as
clip = core.std.MergeDiff(src1, src2)
only MergeDiff is likely faster.
Also with 16 bit clips,
clip = self.Expr ([src1, src2], ["x y - 32768 +"])
is the same as
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.
feisty2
11th December 2014, 17:26
Noted, will edit them when my Iceland trip is over
:)
Myrsloik
11th December 2014, 19:12
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...
Reel.Deel
12th December 2014, 02:32
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 (http://forum.doom9.org/showthread.php?t=165771&page=34) :eek:
feisty2
12th December 2014, 05:06
update:
did the suggested edits mentioned earlier
fixed a bug in limit_dif16 expr when ref clip != src clip
feisty2
14th December 2014, 07:12
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
feisty2
18th December 2014, 15:51
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
feisty2
18th December 2014, 16:00
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
GMJCZP
18th December 2014, 16:18
Here (https://www.dropbox.com/sh/3i81ttxf028m1eh/AAABkQn4Y5w1k-toVhYLasmwa?dl=0).
Based in here (http://forum.doom9.org/showthread.php?p=1620108#post1620108).
Inside the package look for Vapoursynth folder.
feisty2
18th December 2014, 16:20
Here (https://www.dropbox.com/sh/3i81ttxf028m1eh/AAABkQn4Y5w1k-toVhYLasmwa?dl=0).
Based in here (http://forum.doom9.org/showthread.php?p=1620108#post1620108).
Inside the package look for Vapoursynth folder.
nice, thx!:)
GMJCZP
18th December 2014, 16:23
We must support new generations ;) .
TurboPascal7
18th December 2014, 17:16
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?
feisty2
18th December 2014, 17:53
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
colours
18th December 2014, 17:56
"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.
feisty2
19th December 2014, 06:04
update:
sbr16 and clamp16 are back (rewritten to vaporsynth style)
feisty2
6th February 2015, 09:15
update:
new func resize16nr, a few mods
RTW47
6th February 2015, 12:38
if dif == True: could be replaced with just if dif:
if fulls == False: could be replaced with if not fulls:
etc.
feisty2
6th February 2015, 12:43
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
vBulletin® v3.8.11, Copyright ©2000-2024, vBulletin Solutions Inc.