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 November 2013, 18:07   #1081  |  Link
handaimaoh
Registered User
 
Join Date: Nov 2013
Posts: 80
Quote:
Originally Posted by mastrboy View Post
There's a speed difference between SCSelect and using Avisynth's built-in runtime functions (xDifferenceFromPrevious/xDifferenceToNext), SCSelect is quite faster, no idea if the same would apply to vapoursynth's internal functions though...
Before any final decision is made I'll do some speed tests. If SCSelect is still substantially faster it'll be kept around until something else can replace it. It's not a ton of code as is.
handaimaoh is offline   Reply With Quote
Old 11th November 2013, 18:23   #1082  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 5,797
SCSelect_Like function in script (behaves identically and not very good) from here:- http://forum.doom9.org/showthread.ph...23#post1644023

Code:
Avisource("D:\avs\test.avi")

# RemoveDirt's SCSelect(clip input, clip scene_begin, clip scene_end, clip global_motion, float dfactor, bool debug, bool planar)

Function SCSelect_Like(clip dclip,clip Start,clip End,clip Motion, float "dfactor",bool "debug") {
    # Start, End, Motion MUST all be same, dclip can be other colorspace/size (unlike SCSelect).
    dfactor=Float(Default(dfactor,4.0))
    debug=Default(debug,false)
    Global SCM_A=0.0 Global SCM_B=0.0 Global SCM_SC=0 Global SCM_Prev=-1
    Motion.ScriptClip("""
        NotNext = (current_frame!=SCM_Prev+1)
        Global SCM_A=(NotNext)? RT_LumaDifference(dclip,dclip,n=current_frame-1,n2=current_frame)  : SCM_B
        Global SCM_B=           RT_LumaDifference(dclip,dclip,n=current_frame,n2=current_frame+1)
        # 0 = Start of scene, 1 = End of scene, 2 = Global motion
        Global SCM_SC=(current_frame==FrameCount-1)?1:(SCM_A>dfactor*SCM_B || current_frame==0)?0:(SCM_B>dfactor*SCM_A)?1:2
        (SCM_SC==0) ? Start : (SCM_SC==1) ? End : Last      # Choose Start, End or Motion(ie Last)
        (debug)?RT_Subtitle("%d ] %6.2f %6.2f SC=%d",current_frame,SCM_A,SCM_B,SCM_SC):NOP
        Global SCM_Prev=current_frame
        Return Last
    """,args="dfactor,Start,End,Dclip,debug")          # Needs Grunt for args
    return Last
}

Start=Subtitle("START OF SCENE",align=3,size=30)
End=Subtitle("END OF SCENE", align=1,size=30)
Motion=Subtitle("GLOBAL MOTION",align=5,size=30)
L=SCSelect_Like(Last,Start,End,Motion,debug=true)
R=SCSelect(Last,Start,End,Motion)
StackHorizontal(L,R)
__________________
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 11th November 2013, 18:28   #1083  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Ikea Chair
Posts: 1,838
Quote:
Originally Posted by mastrboy View Post
There's a speed difference between SCSelect and using Avisynth's built-in runtime functions (xDifferenceFromPrevious/xDifferenceToNext), SCSelect is quite faster, no idea if the same would apply to vapoursynth's internal functions though...
I think most of the speed difference is because avisynth recalculates the metric for both frames if you use scriptclip and friends. In vapoursynth the metric would be attached to frames and cached.

Experimentation welcome. Just keep in mind i didn't write any asm for the vapoursynth functions planedifference and planeaverage yet so for now it will be slightly slower.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 11th November 2013, 18:34   #1084  |  Link
Are_
Registered User
 
Join Date: Jun 2012
Location: Ibiza, Spain
Posts: 259
On latest git from vapoursynth:
Code:
Python 3.3.2 (default, Aug 18 2013, 22:19:13)
[GCC 4.8.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import vapoursynth as vs
terminate called after throwing an instance of 'std::regex_error'
  what():  regex_error
Aborted
It looks like it's compiler's fault.

Anybody knows if this is supported on other compilers (4.9 looks far away for me)?
Are_ is offline   Reply With Quote
Old 11th November 2013, 20:14   #1085  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Ikea Chair
Posts: 1,838
Quote:
Originally Posted by Are_ View Post
On latest git from vapoursynth:
Code:
Python 3.3.2 (default, Aug 18 2013, 22:19:13)
[GCC 4.8.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import vapoursynth as vs
terminate called after throwing an instance of 'std::regex_error'
  what():  regex_error
Aborted
It looks like it's compiler's fault.

Anybody knows if this is supported on other compilers (4.9 looks far away for me)?
I use it for some trivial checks so I'll just rewrite it without regexp. I believe clang implements everything properly. Or you can just wait a day or two and I'll have it unbroken. There are like 0 functionality changes since r21, only cleanups and rewrites.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 11th November 2013, 20:27   #1086  |  Link
Are_
Registered User
 
Join Date: Jun 2012
Location: Ibiza, Spain
Posts: 259
Nice to know there's an easy fix. Thx
Are_ is offline   Reply With Quote
Old 11th November 2013, 22:24   #1087  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Ikea Chair
Posts: 1,838
Quote:
Originally Posted by Are_ View Post
Nice to know there's an easy fix. Thx
I should be fixed now, I guess. Report any other new linux issues you find.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 11th November 2013, 23:27   #1088  |  Link
Joachim Buambeki
Registered User
 
Join Date: May 2010
Location: Germany, Munich
Posts: 49
Great work so far Myrsloik. :-)

What about making Vapoursynth OpenFX compatible?
That would open the power of Vapoursynth to a lot of users, professionals and users of the free but powerful Resolve Lite but I am sure users of other apps like Nuke etc. would would also profit from it.

JB

Last edited by Joachim Buambeki; 12th November 2013 at 00:27.
Joachim Buambeki is offline   Reply With Quote
Old 11th November 2013, 23:44   #1089  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: UK
Posts: 2,309
This is a nice idea
kolak is offline   Reply With Quote
Old 12th November 2013, 00:39   #1090  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Ikea Chair
Posts: 1,838
Quote:
Originally Posted by Joachim Buambeki View Post
Great work so far Myrsloik. :-)

What about making Vapoursynth OpenFX compatible?
That would open the power of Vapoursynth to a lot of users, professionals and users of the free but powerful Resolve Lite but I am sure users of other apps like Nuke etc. would would also profit from it.

JB
To do what exactly? Be a simple source plugin?
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 12th November 2013, 09:09   #1091  |  Link
Are_
Registered User
 
Join Date: Jun 2012
Location: Ibiza, Spain
Posts: 259
If I prevent removegrain from building everything works great (also just as an informative note, clang throws the same error at runtime when regex are used).

gcc and clang complain on the new code:
gcc buildlog
Code:
../src/filters/removegrain/clense.cpp:152:19: error: cast from ‘void*’ to ‘int’ loses precision [-fpermissive]
     d.mode = (int)userData;
clang buildlog
Code:
../src/filters/removegrain/clense.cpp:152:14: error: cast from pointer to smaller type 'int' loses information
    d.mode = (int)userData;
             ^~~~~~~~~~~~~
1 error generated.
../src/filters/removegrain/removegrainvs.cpp:1241:3: error: constant expression evaluates to -294912 which cannot be narrowed to type 'uint32_t' (aka 'unsigned int') [-Wc++11-narrowing]
{ -0x8000 * 9, -0x8000 * 9, -0x8000 * 9, -0x8000 * 9 };
  ^~~~~~~~~~~
../src/filters/removegrain/removegrainvs.cpp:1241:3: note: override this message by inserting an explicit cast
{ -0x8000 * 9, -0x8000 * 9, -0x8000 * 9, -0x8000 * 9 };
  ^~~~~~~~~~~
Are_ is offline   Reply With Quote
Old 12th November 2013, 11:57   #1092  |  Link
Joachim Buambeki
Registered User
 
Join Date: May 2010
Location: Germany, Munich
Posts: 49
Quote:
Originally Posted by Myrsloik View Post
To do what exactly? Be a simple source plugin?
I am not sure what you mean with "source plugin", but my idea was to select Vapoursynth as a filter in the host application and then you can open a console or something similar where you can type in the filter effect (without the import video stuff of course because it does that automaticaly).
What would be even cooler if it would be possible if one could create wrappers to directly call a certain filter (script) from Vapoursynth like a regular plugin.

A similar suport for After Effects would be great but that would mean that a separare plugin would have to be written, since AE isn't OpenFX compatible unfortunately.


I can only guess but support for these applications should also speed up development of Vapoursynth alot if communicated through the right channels (forums where those people are - CreativeCow, LiftGammaGain, etc.). There should be a fair amount of pros that would be willing to donate their time to help with development I suppose.

Last edited by Joachim Buambeki; 12th November 2013 at 12:03.
Joachim Buambeki is offline   Reply With Quote
Old 12th November 2013, 14:08   #1093  |  Link
Mystery Keeper
Beyond Kawaii
 
Mystery Keeper's Avatar
 
Join Date: Feb 2008
Location: Russia
Posts: 683
I'm trying to write a VapourSynth Python script function. When I pass an argument as None, I want AviSynth filter to use the default value for that argument. How can I do that? Can I form a string of AviSynth filter call and "Evaluate" it?
__________________
...desu!

Last edited by Mystery Keeper; 12th November 2013 at 14:12.
Mystery Keeper is offline   Reply With Quote
Old 12th November 2013, 14:16   #1094  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Ikea Chair
Posts: 1,838
Quote:
Originally Posted by Mystery Keeper View Post
I'm trying to write a VapourSynth phyton script function. When I pass an argument as None, I want AviSynth filter to use the default value for that argument. How can I do that? Can I form a string of AviSynth filter call and "Evaluate" it?
Something like this can be done in python:
Code:
d = dict(arg1=1, arg2=2) #args you always set here
if arg3 is not None: # optional arg that shouldn't be set when None
  d['arg3name'] = arg3
clip = core.avs.AvsFunction(**d)
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 12th November 2013, 15:07   #1095  |  Link
Mystery Keeper
Beyond Kawaii
 
Mystery Keeper's Avatar
 
Join Date: Feb 2008
Location: Russia
Posts: 683
Awesome! I can actually specify different AND matching arguments for multiple calls that way. Thanks a lot, Myrsloik!
__________________
...desu!
Mystery Keeper is offline   Reply With Quote
Old 12th November 2013, 16:56   #1096  |  Link
Mystery Keeper
Beyond Kawaii
 
Mystery Keeper's Avatar
 
Join Date: Feb 2008
Location: Russia
Posts: 683
1) Is there mt_diff analog for VapourSynth? I can do it like this:
Code:
def absdiff(x, y):
	return min(max(0, 127 + x - y), 255)

diff = core.std.Lut2([a, b], function = absdiff)
But it is bitdepth-specific and likely not very fast.

2) Is there HistogramAdjust analog for VapourSynth, or should we ask the author for port?
__________________
...desu!
Mystery Keeper is offline   Reply With Quote
Old 12th November 2013, 17:06   #1097  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Ikea Chair
Posts: 1,838
Quote:
Originally Posted by Mystery Keeper View Post
1) Is there mt_diff analog for VapourSynth? I can do it like this:
Code:
def absdiff(x, y):
	return min(max(0, 127 + x - y), 255)

diff = core.std.Lut2([a, b], function = absdiff)
But it is bitdepth-specific and likely not very fast.

2) Is there HistogramAdjust analog for VapourSynth, or should we ask the author for port?
1. No

2. No again
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 15th November 2013, 11:31   #1098  |  Link
Mystery Keeper
Beyond Kawaii
 
Mystery Keeper's Avatar
 
Join Date: Feb 2008
Location: Russia
Posts: 683
AvsPMod silently crashed after several minutes of experimenting with this script. VirtualDub silently crashed after processing ~120000 of ~150000 frames.
Script uses this function.

Code:
avisynth_plugins_path = 'E:\\avisynth-plugins\\'
vapoursyth_plugins_path = 'E:\\vapoursynth-plugins\\x32\\'

import vapoursynth as vs
import sys
sys.path.append(vapoursyth_plugins_path + 'E:\\vapoursynth-plugins\\py\\')
core = vs.get_core(threads=8)

core.set_max_cache_size(3500)

import os
for filename in os.listdir(vapoursyth_plugins_path):
	if filename[-4:] != '.dll':
		continue
	core.std.LoadPlugin(vapoursyth_plugins_path + filename)

core.avs.LoadPlugin(path = avisynth_plugins_path + 'mvtools2.dll')

core.std.LoadPlugin(path = 'D:\\Programming\\TempLinearApproximate-VapourSynth\\build\\release-x32\\templinearapproximate.dll')

d2vfile = 'F:\\Video to Process\\Riaru Onigokko 2\\VTS_01_1.d2v'

ret = core.d2v.Source(input=d2vfile)

def pcToTv(input):
	c = core.fmtc.resample (clip=input, css="444")
	c = core.fmtc.matrix (clip=c, mats="601", matd="709")
	c = core.fmtc.resample (clip=c, css="420")
	c = core.fmtc.bitdepth (clip=c, bits=8)
	return c

z = pcToTv(ret)

sys.path.append('D:\\Programming\\TempLinearApproximate-VapourSynth\\')
import MCDenoise

tlamc = MCDenoise.MCDenoise()
tlaArguments = dict(radius=2, BlockSize=8, Overlap=4, SubPel=4, SubPelInterp=2, Search=5, SearchParam=2, PelSearch=4, DCT=10, ThSAD=200)
ret = tlamc.TempLinearApproximate(ret, **tlaArguments)
ret = tlamc.TempLinearApproximate(ret, **tlaArguments)
ret = core.f3kdb.F3kdb(ret, dither_algo=2, grainy=0, grainc=0, keep_tv_range=True)

ret = pcToTv(ret)

ret.set_output()

def absdiff(x, y):
	return min(max(0, 127 + x - y), 255)

unfiltered = core.text.Text(z, "unfiltered")
filtered = core.text.Text(ret, "filtered")
stack = core.std.StackHorizontal([unfiltered, filtered])
diffhist = core.std.Lut2([z, ret], function = absdiff)
#diffhist = core.generic.Levels(diffhist, planes=0, gamma = 3)
diffhist = core.text.Text(diffhist, "Difference")
filteredhist = core.generic.Levels(ret, planes=0, gamma = 2)
filteredhist = core.text.Text(filteredhist, "Filtered amplified")
diffstack = core.std.StackHorizontal([diffhist, filteredhist])
compare = core.std.StackVertical([stack, diffstack])
#compare.set_output()
__________________
...desu!
Mystery Keeper is offline   Reply With Quote
Old 15th November 2013, 11:44   #1099  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Ikea Chair
Posts: 1,838
Quote:
Originally Posted by Mystery Keeper View Post
AvsPMod silently crashed after several minutes of experimenting with this script. VirtualDub silently crashed after processing ~120000 of ~150000 frames.
Script uses this function.
Did you notice anything like the memory use going up or the script getting slower over time?
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 15th November 2013, 11:50   #1100  |  Link
Mystery Keeper
Beyond Kawaii
 
Mystery Keeper's Avatar
 
Join Date: Feb 2008
Location: Russia
Posts: 683
The processing speed fluctuates relatively much. 5-11 FPS. But I don't know about the time when it crashed. Is there a way to profile at least the memory use without having to constantly monitor it? Is it possible to have on demand FPS and memory usage profiling and logging functionality in VapourSynth?
__________________
...desu!
Mystery Keeper is offline   Reply With Quote
Reply

Tags
speed, vaporware, vapoursynth

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 16:35.


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