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
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 20th January 2020, 22:36   #3701  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: On thin ice
Posts: 6,837
@Myrsloik

I found a solution that should be fine for me, moving the cleanup code past the message loop, apparently it has something to do with the message system. Sorry for not finding it earlier and thanks for trying to help.
stax76 is offline   Reply With Quote
Old 21st January 2020, 00:32   #3702  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,555
Quote:
Originally Posted by stax76 View Post
@Myrsloik

I found a solution that should be fine for me, moving the cleanup code past the message loop, apparently it has something to do with the message system. Sorry for not finding it earlier and thanks for trying to help.
Definitely looks like some kind of memory corruption but I can't explain why it happens. A true mystery. It crashes in vpy_clearEnvironment() which gets called twice in a row (impossible) and I can't explain that at all.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 21st January 2020, 11:23   #3703  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: On thin ice
Posts: 6,837
Quote:
Originally Posted by Myrsloik View Post
Definitely looks like some kind of memory corruption but I can't explain why it happens. A true mystery. It crashes in vpy_clearEnvironment() which gets called twice in a row (impossible) and I can't explain that at all.
I've set few breakpoints and stepped through the code, turned out that WM_DESTROY is not only sent to the main window but also to the child windows so the code runs more than once...

https://docs.microsoft.com/en-us/win...msg/wm-destroy
stax76 is offline   Reply With Quote
Old 21st January 2020, 15:28   #3704  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,555
Quote:
Originally Posted by stax76 View Post
I've set few breakpoints and stepped through the code, turned out that WM_DESTROY is not only sent to the main window but also to the child windows so the code runs more than once...

https://docs.microsoft.com/en-us/win...msg/wm-destroy
So it was your fault after all...

Your code sample was helpful to the development of audio support anyway since it exposed another bug.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 25th January 2020, 12:12   #3705  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
I trying out the vapousynth sdk to build a filter, I want to start off by testing out the examples in the sdk folder, but I don't know how to compile them into dll. Can I get some instruction?
lansing is offline   Reply With Quote
Old 25th January 2020, 12:52   #3706  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,555
Quote:
Originally Posted by lansing View Post
I trying out the vapousynth sdk to build a filter, I want to start off by testing out the examples in the sdk folder, but I don't know how to compile them into dll. Can I get some instruction?
From the VS2019 startup screen select "create a new project".

Then "windows desktop wizard" and when asked select dll as project type and check "empty project". Add the sdk source file and then add the location of vapoursynth.h to the include dirs (or simply stuff it in the same dir as the source code if you're lazy).

Something like that.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 25th January 2020, 18:54   #3707  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
Quote:
Originally Posted by Myrsloik View Post
From the VS2019 startup screen select "create a new project".

Then "windows desktop wizard" and when asked select dll as project type and check "empty project". Add the sdk source file and then add the location of vapoursynth.h to the include dirs (or simply stuff it in the same dir as the source code if you're lazy).

Something like that.
For some reason the header files were not detected, got the same problem if I put them in the header folder.


Last edited by lansing; 25th January 2020 at 18:57.
lansing is offline   Reply With Quote
Old 25th January 2020, 19:22   #3708  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: On thin ice
Posts: 6,837
In the project properties there is a VC++ Directory section where you can set include and lib directories.
stax76 is offline   Reply With Quote
Old 25th January 2020, 20:07   #3709  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
Quote:
Originally Posted by stax76 View Post
In the project properties there is a VC++ Directory section where you can set include and lib directories.
Thanks it works
lansing is offline   Reply With Quote
Old 26th January 2020, 14:30   #3710  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,555
Go try the builds with audio support.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 27th January 2020, 21:06   #3711  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
update on the syntactic sugar: https://github.com/IFeelBloated/vapo...ster/sugar.hpp

new function: View(y, x)
creates an offset view of the src plane centered on (y, x), you can also create a second/third/... order view on a view to manipulate the relative coordinates of, well, relative coordinates. high order views are useful to algorithms with nested search windows (eg. NLMeans, you got a sliding similarity window(s) inside a sliding search window(a)).

the previous box blur example
Code:
auto srcp = MakePlane<const float>(srcp8, width, height, Repeat);
auto dstp = MakePlane<float>(dstp8, width, height, Zero);

for (auto y : Range{ height })
     for (auto x : Range{ width })
             dstp[y][x] = (srcp[y-1][x-1] + srcp[y-1][x] + srcp[y-1][x+1] + srcp[y][x-1] + srcp[y][x] + srcp[y][x+1] + srcp[y+1][x-1] + srcp[y+1][x] + srcp[y+1][x+1]) / 9;
could now be further simplified to
Code:
auto srcp = MakePlane<const float>(srcp8, width, height, Repeat);
auto dstp = MakePlane<float>(dstp8, width, height, Zero);

for (auto y : Range{ height })
     for (auto x : Range{ width }) {
             auto center = srcp.View(y, x);
             dstp[y][x] = (center[-1][-1] + center[-1][0] + center[-1][1] + center[0][-1] + center[0][0] + center[0][1] + center[1][-1] + center[1][0] + center[1][1]) / 9;
     }
feisty2 is offline   Reply With Quote
Old 27th January 2020, 22:06   #3712  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
@Myrsloik
can you somehow merge these helper functions into VSAPI so it would be easier for filter developers to code or prototype new filters? I don't wanna keep it homegrown.
feisty2 is offline   Reply With Quote
Old 27th January 2020, 22:56   #3713  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
I got a crash from the audio test build while running benchmark in vsedit. It works fine when I switch back to R48.

Code:
core.avs.LoadPlugin(vd_filter)
core.avs.LoadVirtualdubPlugin(neatvideo_vdf, "NeatVideo", 2)

clip = core.lsmas.LWLibavSource(src, prefer_hw=1)
rgb_clip = core.resize.Bicubic(clip, matrix_in_s="709", format=vs.COMPATBGR32)

denoise_clip = core.avs.NeatVideo_2(rgb_clip, profilePath, presetPath)

denoise_clip.set_output()
lansing is offline   Reply With Quote
Old 27th January 2020, 23:26   #3714  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,555
Quote:
Originally Posted by feisty2 View Post
@Myrsloik
can you somehow merge these helper functions into VSAPI so it would be easier for filter developers to code or prototype new filters? I don't wanna keep it homegrown.
No, this is definitely not something the API should handle. Not that it'd be possible anyway to expose a huge lump of C++ templates in a header through a C API anyway...
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 28th January 2020, 09:02   #3715  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,555
Quote:
Originally Posted by lansing View Post
I got a crash from the audio test build while running benchmark in vsedit. It works fine when I switch back to R48.

Code:
core.avs.LoadPlugin(vd_filter)
core.avs.LoadVirtualdubPlugin(neatvideo_vdf, "NeatVideo", 2)

clip = core.lsmas.LWLibavSource(src, prefer_hw=1)
rgb_clip = core.resize.Bicubic(clip, matrix_in_s="709", format=vs.COMPATBGR32)

denoise_clip = core.avs.NeatVideo_2(rgb_clip, profilePath, presetPath)

denoise_clip.set_output()
Is it reproducible with blankclip?
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 28th January 2020, 09:57   #3716  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
Quote:
Originally Posted by Myrsloik View Post
No, this is definitely not something the API should handle. Not that it'd be possible anyway to expose a huge lump of C++ templates in a header through a C API anyway...
well I could wrap everything into a C++ wrapper and enable a python scripting kind of filter writing experience with various syntactic sugar in c++20, but there's already vsxx so I don't know...
feisty2 is offline   Reply With Quote
Old 28th January 2020, 11:04   #3717  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
Quote:
Originally Posted by Myrsloik View Post
Is it reproducible with blankclip?
Yes, I tested with QTGMC, also crashed.

Code:
import vapoursynth as vs
import havsfunc as haf
core = vs.get_core()

clip = core.std.BlankClip(width=1920, height=1080, format=vs.YUV420P8, length=10000)
clip = haf.QTGMC(clip, TFF=True)

clip.set_output()
I previewed the script, do a couple of seeks and it crashed. Every seek took about 1G of memory.
lansing is offline   Reply With Quote
Old 28th January 2020, 16:45   #3718  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
@Myrsloik
can I store vsapi, in and out as global variables and for each filter in the plugin, refresh them in xxxCreate()? will there be some unknown conflict? I assume this should work since you can only invoke one filter in the plugin with each function call?

I haven't finished but basically, it's https://github.com/IFeelBloated/vapo...ample).cxx#L70
feisty2 is offline   Reply With Quote
Old 28th January 2020, 18:25   #3719  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,555
Quote:
Originally Posted by feisty2 View Post
@Myrsloik
can I store vsapi, in and out as global variables and for each filter in the plugin, refresh them in xxxCreate()? will there be some unknown conflict? I assume this should work since you can only invoke one filter in the plugin with each function call?

I haven't finished but basically, it's https://github.com/IFeelBloated/vapo...ample).cxx#L70
That won't work for several reasons:
1. You can get different vsapi pointers to different filters. This is how different api versions are handled.
2. Multithreaded filter creation is actually a thing. So you'll have races when using globals for in and out.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 28th January 2020, 20:04   #3720  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
well, then I guess the simplest solution is to make the global variables templated, so each filter has the access to its own copy
feisty2 is offline   Reply With Quote
Reply

Tags
speed, vaporware, vapoursynth


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 23:53.


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