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 > Avisynth Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 19th October 2012, 15:08   #1  |  Link
thewebchat
Advanced Blogging
 
Join Date: May 2009
Posts: 483
Example plugins for Vapoursynth

Download link.

Here are some simple plugin examples for vapoursynth. Included are:

vsmatrix -- do arbitrary affine transformations on RGB/YUV triplets
vsrandom -- generate normally distributed random numbers

These examples show one way of supporting extended colorspaces in VapourSynth without duplicating large blocks of code. More practically, vsmatrix may be used to convert between Rec.601 and Rec.709 matrix coefficients, as documented in matrix_conversions.txt.

Both plugins support all sample types allowed by VapourSynth. Performance is quite reasonable as well, at 16 ms/frame for vsmatrix and 45 ms/frame for vsrand at 1920x1080x8bpp.

Note that I've never written a line of code in my life before this, so please excuse any errors (but feel free to note them).

Last edited by thewebchat; 20th October 2013 at 07:53. Reason: fix link
thewebchat is offline   Reply With Quote
Old 19th October 2012, 15:53   #2  |  Link
SassBot
Guest
 
Posts: n/a
What's the license on the code? Also, the vsmatrix is nice although am I reading your code correctly in that it requires you to pass in the coefficients manually? I'm considering now to just take your code and extend it a bit and just make that the new ColorMatrix base and throw away the other code completely.

Last edited by SassBot; 19th October 2012 at 16:00.
  Reply With Quote
Old 19th October 2012, 16:54   #3  |  Link
thewebchat
Advanced Blogging
 
Join Date: May 2009
Posts: 483
The filter is derived from invert_example.cpp from Vapoursynth, so therefore it has the same license as Vapoursynth.
thewebchat is offline   Reply With Quote
Old 15th November 2012, 20:29   #4  |  Link
thewebchat
Advanced Blogging
 
Join Date: May 2009
Posts: 483
Updated examples for Vapoursynth R15 API.
thewebchat is offline   Reply With Quote
Old 16th November 2012, 02:23   #5  |  Link
Mug Funky
interlace this!
 
Mug Funky's Avatar
 
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,547
what do i need to make these compile in MSYS?

i'm getting piles of errors about _malloc type stuff.

Code:
$ make
g++ -std=c++11 -Wall -Wextra -Wno-unused-parameter -O3 -shared -g vsmatrix.cpp -o vsmatrix.dylib
In file included from vsmatrix.cpp:3:0:
VapourSynth/VSHelper.h: In function 'T* vs_aligned_malloc(size_t, size_t)':
VapourSynth/VSHelper.h:48:44: error: there are no arguments to '_aligned_malloc' that depend on a template parameter, so a declaration of '_aligned_malloc' must be available [-fpermissive]
VapourSynth/VSHelper.h:48:44: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
VapourSynth/VSHelper.h: In function 'void vs_aligned_free(void*)':
VapourSynth/VSHelper.h:58:2: error: '_aligned_free' was not declared in this scope
make: *** [vsmatrix.dylib] Error 1
__________________
sucking the life out of your videos since 2004
Mug Funky is offline   Reply With Quote
Old 16th November 2012, 02:37   #6  |  Link
Chikuzen
typo lover
 
Chikuzen's Avatar
 
Join Date: May 2009
Posts: 597
g++ -o vsmatrix.dll -shared -std=c++11 -Wall -Wextra -Wno-unused-parameter -O3 -g0 -Wl,--dll,--add-stdcall-alias vsmatrix.cpp

maybe, this is OK.

EDIT:
hmm, VSHelper.h does not consider about mingw.

Code:
@@ -32,6 +32,11 @@
 #define inline _inline
 #endif
 
+#ifdef __MINGW32__
+#define __MSVCRT_VERSION__ 0x0700
+#include <malloc.h>
+#endif
+
 #ifdef _WIN32
 #define VS_ALIGNED_MALLOC(pptr, size, alignment) *(pptr) = _aligned_malloc((size), (alignment))
 #define VS_ALIGNED_FREE(ptr) _aligned_free((ptr))
you need this patch for VSHelper.h
__________________
my repositories

Last edited by Chikuzen; 16th November 2012 at 03:17.
Chikuzen is offline   Reply With Quote
Old 16th November 2012, 04:11   #7  |  Link
Mug Funky
interlace this!
 
Mug Funky's Avatar
 
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,547
that's done the trick! thanks muchly!
__________________
sucking the life out of your videos since 2004
Mug Funky is offline   Reply With Quote
Old 16th November 2012, 16:21   #8  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Ikea Chair
Posts: 1,869
Quote:
Originally Posted by Chikuzen View Post
g++ -o vsmatrix.dll -shared -std=c++11 -Wall -Wextra -Wno-unused-parameter -O3 -g0 -Wl,--dll,--add-stdcall-alias vsmatrix.cpp

maybe, this is OK.

EDIT:
hmm, VSHelper.h does not consider about mingw.

Code:
@@ -32,6 +32,11 @@
 #define inline _inline
 #endif
 
+#ifdef __MINGW32__
+#define __MSVCRT_VERSION__ 0x0700
+#include <malloc.h>
+#endif
+
 #ifdef _WIN32
 #define VS_ALIGNED_MALLOC(pptr, size, alignment) *(pptr) = _aligned_malloc((size), (alignment))
 #define VS_ALIGNED_FREE(ptr) _aligned_free((ptr))
you need this patch for VSHelper.h
Partially applied since malloc.h should be included for all windows compilation. The mingw specific crt version to target is something probably best defined on the command line when compiling and won't be added.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 11th December 2012, 02:16   #9  |  Link
thewebchat
Advanced Blogging
 
Join Date: May 2009
Posts: 483
Added a (slow) method of directly computing random numbers instead of looking it up in a giant LUT. If someone is actually interested in using this, I may consider adding functionality to actually put noise on a frame.
thewebchat is offline   Reply With Quote
Old 18th October 2013, 22:49   #10  |  Link
sl1pkn07
Pajas Mentales...
 
Join Date: Dec 2004
Location: Spanishtán
Posts: 442
the link is dead

greetings
sl1pkn07 is offline   Reply With Quote
Old 18th October 2013, 23:32   #11  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,085
Quote:
Originally Posted by sl1pkn07 View Post
the link is dead
Here you go.

Quote:
Originally Posted by thewebchat View Post
If someone is actually interested in using this, I may consider adding functionality to actually put noise on a frame.
Hmmm, must of missed this.
Would be nice to have an AddGrain equivalent for VS.

Last edited by Reel.Deel; 18th October 2013 at 23:34. Reason: Link
Reel.Deel is offline   Reply With Quote
Old 18th October 2013, 23:36   #12  |  Link
sl1pkn07
Pajas Mentales...
 
Join Date: Dec 2004
Location: Spanishtán
Posts: 442
tnx man!

greetings
sl1pkn07 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 06:20.


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