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. |
![]() |
#4221 | Link |
I'm Siri
Join Date: Oct 2012
Location: Providence, RI
Posts: 2,509
|
@Myrsloik
what are some of the other things I need to do to make my project the preferred C++ wrapper for VS over vsxx?
__________________
If I got new ideas, will post here: https://github.com/IFeelBloated |
![]() |
![]() |
![]() |
#4222 | Link |
Professional Code Monkey
Join Date: Jun 2003
Location: Ikea Chair
Posts: 2,279
|
Find 3 people who prefer it I guess? I don't use either so I have no opinion about which one is better...
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet |
![]() |
![]() |
![]() |
#4226 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 8,864
|
I'm sure that its lovely Feisty, Myrsloik and VideoH are just being, well themselves really
![]()
__________________
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 ??? |
![]() |
![]() |
![]() |
#4227 | Link |
I'm Siri
Join Date: Oct 2012
Location: Providence, RI
Posts: 2,509
|
that is simply not true. the source code is publicly available and extremely easy to understand. anyone reasonably familiar with the C++ language should be able to manipulate the wrapper (adding more functionality, fixing bugs, etc.) however he or she wants with zero difficulty.
__________________
If I got new ideas, will post here: https://github.com/IFeelBloated |
![]() |
![]() |
![]() |
#4229 | Link |
I'm Siri
Join Date: Oct 2012
Location: Providence, RI
Posts: 2,509
|
also not true. the wrapper covers all functions provided by the C API, so anything you can do with the low level API, you can do the same with the C++ wrapper, plus the much cleaner and more concise syntax while also being less error prone. there is no performance cost (as long as you choose not to enable some dynamic features like automatic padding which are meant for fast prototyping), everything is built upon zero cost abstraction. even experienced developers should enjoy some benefits like RAII and expect less memory errors.
someone must be a masochist to prefer Code:
auto std = vsapi->getPluginByNs("std", core); auto args = vsapi->createMap(); vsapi->propSetNode(args, "clip", node, paAppend); vsapi->freeNode(node); auto ret = vsapi->invoke(std, "Transpose", args); vsapi->freeMap(args); node = vsapi->propGetNode(ret, "clip", 0, nullptr); vsapi->freeMap(ret); Code:
auto TransposedClip = Core["std"]["Transpose"]("clip", InputClip);
__________________
If I got new ideas, will post here: https://github.com/IFeelBloated |
![]() |
![]() |
![]() |
#4230 | Link | |
I'm Siri
Join Date: Oct 2012
Location: Providence, RI
Posts: 2,509
|
Quote:
for now, you can find various examples here: https://github.com/IFeelBloated/vsFi...aster/Examples GaussBlur - simple 3x3 convolutional filter TemporalMedian - a temporal filter Rec601ToRGB - an example showing how to write filters that manipulate frame properties, and output a video clip of a different format than its input Crop - an example showing how to write filters that deal with various bitdepths, and output a video clip with a different image size ModifyFrame - an example showing how to write filters that interact with Python scripts. Palette - an example showing how to write filters with multiple outputs SeparableConvolution - an example showing how to write filters that invoke external filters and itself GaussBlurFast - an example showing how to write filters without automatic padding. msvc is not currently supported, because it lacks many core language features of C++20 (mainly concepts). you need at least GCC 10.2 to compile the examples
__________________
If I got new ideas, will post here: https://github.com/IFeelBloated |
|
![]() |
![]() |
![]() |
#4233 | Link |
Useful n00b
Join Date: Jul 2014
Posts: 1,368
|
Because Visual Studio on Windows has such a tiny usage. I'm the only one that would be stupid enough to have such an environment.
Hey, he called me a masochist for not using his stuff. How about you mind your own business? Or how about you ask him to create some documentation, for God's sake? The only joke here is the never-DG guys continually twisting themselves into pretzels. Pitiful. Last edited by videoh; 20th January 2021 at 03:14. |
![]() |
![]() |
![]() |
#4234 | Link |
I'm Siri
Join Date: Oct 2012
Location: Providence, RI
Posts: 2,509
|
it's nobody's problem, msvc is well known to be slow on supporting new C++ features (it's also not the worst tho, apple clang is far worse than msvc in terms of C++20 support). things will get there eventually. the main problem with msvc currently is that it does not provide complete support for concepts, a major C++20 feature that the wrapper relies on heavily.
and the masochist thing is not personal, using the low level API not only requires more work to do the same thing, it is also very error prone in certain cases, especially when dealing with reference counted objects. you won't believe how easy and how likely it is to forget calling that "free" function marked in red in the following code block Code:
auto std = vsapi->getPluginByNs("std", core); auto args = vsapi->createMap(); vsapi->propSetNode(args, "clip", node, paAppend); vsapi->freeNode(node); // manually releasing resource acquired in a foreign scope, highly error prone. auto ret = vsapi->invoke(std, "Transpose", args); vsapi->freeMap(args); node = vsapi->propGetNode(ret, "clip", 0, nullptr); vsapi->freeMap(ret);
__________________
If I got new ideas, will post here: https://github.com/IFeelBloated |
![]() |
![]() |
![]() |
#4236 | Link | |
ангел смерти
![]() Join Date: Nov 2004
Location: Lost
Posts: 9,563
|
Quote:
You're intentionally cutting your userbase off in order to experiment with bleeding edge features, which is fine in the abstract, but marks the project as unsuitable for anyone else. |
|
![]() |
![]() |
![]() |
#4237 | Link |
I'm Siri
Join Date: Oct 2012
Location: Providence, RI
Posts: 2,509
|
the latest version of all 3 mainstream compilers (GCC, Clang, MSVC) have supported many C++20 features, both GCC and Clang have implemented full support for concepts, and MSVC has partial support for it. I can imagine that MSVC should be able to catch up in the following months and my project should work with all mainstream compilers by the time I finish writing the documentation. CentOS is dead so not supporting it is no big deal, regardless of that, GCC is capable of bootstrapping, just download the source code of the latest version and build it with whatever version you already have, you certainly don't need to reinstall your OS to run the latest version of GCC. what's the point really to use Linux if you can't even compile GCC from scratch...
concepts is a must-have in order to design a flexible interface in C++, it is by far the only facility to express type-level equivariance in C++, take the following polymorphic function f() for example: Code:
auto f(auto&& x) { if constexpr (requires { { x.g() }->Iterable; }) if constexpr (requires { { *x.g().begin() }->SubtypeOf<VideoInfo>; }) return std::vector<VideoNode>{}; else if constexpr (requires { { *x.g().begin() }->SubtypeOf<AudioInfo>; }) return std::vector<AudioNode>{}; else static_assert(AlwaysFalse<decltype(x)>, "Type Error!"); else if constexpr (requires { { x.g() }->SubtypeOf<VideoInfo>; }) return VideoNode{}; else if constexpr (requires { { x.g() }->SubtypeOf<AudioInfo>; }) return AudioNode{}; else static_assert(AlwaysFalse<decltype(x)>, "Type Error!"); } you simply cannot write such f() without concepts. you can try mimicking it using SFINAE in older versions of C++ and I guarantee that your code will be an unreadable and unmaintainable mess in no time. therefore concepts is absolutely essential if you agree that the user's freewill matters. edit: simple proof that shows f() is indeed equivariant at the type level for types that it can handle. let F() denote f() at the type level, [] denote a type operator that transforms any type T to std::vector<T>. we have that: F([VideoInfo]) = [VideoNode] [F(VideoInfo)] = [VideoNode] F([AudioInfo]) = [AudioNode] [F(AudioInfo)] = [AudioNode] therefore F() satisfies F(G∙T) = G∙F(T), where G = [], T = VideoInfo, AudioInfo.
__________________
If I got new ideas, will post here: https://github.com/IFeelBloated Last edited by feisty2; 22nd January 2021 at 13:47. |
![]() |
![]() |
![]() |
#4238 | Link |
Registered User
Join Date: May 2011
Posts: 180
|
Not that is important, but tried to subclass videonode, if for example could use custom attributes like clip.rgb, clip.isError etc:
Code:
class My_videonode(vs.VideoNode): def __init__(self, clip, *args, **kwargs): super(My_videonode, self).__init__(*args,**kwargs) my_videonode = My_videonode(clip1) from here: https://github.com/vapoursynth/vapou...synth.pyx#L954 is it possible, or is it stupid idea, it could be done differently sure, or forget it? |
![]() |
![]() |
![]() |
#4239 | Link |
I'm Siri
Join Date: Oct 2012
Location: Providence, RI
Posts: 2,509
|
use VaporMagik, it allows you to do dangerous things to native extensions, not just VideoNode, you can even modify the behavior of built-in types like list or int
__________________
If I got new ideas, will post here: https://github.com/IFeelBloated |
![]() |
![]() |
![]() |
#4240 | Link |
Registered User
Join Date: May 2011
Posts: 180
|
thank you,
I think I saw it before, really advanced script for me, thinking what it would be good for :-) . I tried to butcher it a bit and came up with this, which works. So I might use it. Interesting. I realized also I could also use collections.namedtuple lib, not sure how I would implement it yet. But your VaporMagik seams to be fun: Code:
import ctypes import builtins class PyObject(ctypes.Structure): pass PyObject._fields_ = [ ('ob_refcnt', ctypes.c_ssize_t), ('ob_type', ctypes.POINTER(PyObject)), ] class NativeMappingProxy(PyObject): _fields_ = [('UnderlyingDictionary', ctypes.POINTER(PyObject))] def Dereference(Pointer): ObjectHolder = [] ctypes.pythonapi.PyList_Append(ctypes.py_object(ObjectHolder), Pointer) return ObjectHolder[0] def ExposeAttributeDictionary(Type): AttributeMaps = Type.__dict__ TransparentAttributeMaps = NativeMappingProxy.from_address(id(AttributeMaps)) return Dereference(TransparentAttributeMaps.UnderlyingDictionary) def SetTypeAttribute(Type, Name, Attribute): AttributeDictionary = ExposeAttributeDictionary(Type) AttributeDictionary[Name] = Attribute ctypes.pythonapi.PyType_Modified(ctypes.py_object(Type)) @property def rgb(self): return self.resize.Bicubic(format=vs.RGB24) SetTypeAttribute(vs.VideoNode, 'rgb', rgb) clip = core.avisource.AVISource(file.avi) print(clip) print(clip.rgb) Last edited by _Al_; 22nd January 2021 at 21:45. |
![]() |
![]() |
![]() |
Tags |
speed, vaporware, vapoursynth |
Thread Tools | Search this Thread |
Display Modes | |
|
|