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. |
5th January 2020, 23:08 | #5041 | Link |
Guest
Posts: n/a
|
In that case, I wish that somebody would do it now, because all I really need is the core (by which I mean "built in", no external plugins) functionality of AviSynth(+), especially audio (as long as there would be a way to render it). It wouldn't matter to me that the only way of loading something would be to use ffmpeg, because (as you say) virtually everything on Linux uses that in the background anyway.
|
6th January 2020, 01:35 | #5044 | Link |
...?
Join Date: Nov 2005
Location: Florida
Posts: 1,420
|
AvxSynth is what is currently available. As long as the stuff you need isn't AviSynth 2.6- or Plus-specific, it can suffice for the time being.
These instructions were written on Ubuntu 19.10. Whether Debian's basal repos use the same package names, I don't know. The version of FFmpeg provided with at least Debian Stretch has --enable-avisynth active by default, and this will also apply to anything built against it (like the kdenlive example above). Code:
# Dependencies: sudo apt-get install build-essential checkinstall git yasm liblog4cpp5-dev liblog4cpp5v5 libcairo2-dev libpango1.0-dev libjpeg-dev # Build AvxSynth: git clone git://github.com/avxsynth/avxsynth.git && \ cd avxsynth # The following are necessary because avxframeserver fails to build: sed -i '433d' configure.ac && \ sed -i -e '31d' -e '29d' Makefile.am # Continue: autoreconf -fiv && \ CPPFLAGS="-fpermissive -march=native" ./configure --enable-silent-rules --disable-avxedit --disable-ffms2 --with-pic && \ make -j$(nproc) && \ sudo checkinstall --pkgname=avxsynth --pkgversion="1:$(grep "Version" \ avxsynth.pc | cut -f2 -d " ")+$(git rev-list --count HEAD)-g$(git rev-parse \ --short HEAD)-$(date +%Y%m%d)" --backup=no --deldoc=yes --delspec=yes \ --deldesc=yes --strip=yes --stripso=yes --addso=yes --fstrans=no --default # Build FFmpeg or install the -dev libraries relating to it (avcodec, avformat, avutil, avfilter, avdevice, swscale, postproc, swresample): # Build FFMS2 for AvxSynth (and retain plugin compatibility with VapourSynth): git clone git://github.com/qyot27/ffms2_cplugin.git ffms2 && \ cd ffms2 && \ git checkout c_plugin && \ ./configure --enable-vapoursynth --enable-avxsynth --enable-shared --extra-cppflags="-march=native" --enable-pic && \ make -j$(nproc) && \ sudo checkinstall --pkgname=ffms2 --pkgversion="1:$(./version.sh)-git" \ --backup=no --deldoc=yes --delspec=yes --deldesc=yes --strip=yes --stripso=yes \ --addso=yes --fstrans=no --default Last edited by qyot27; 6th January 2020 at 01:58. |
6th January 2020, 16:53 | #5046 | Link |
Registered User
Join Date: Jun 2002
Location: On thin ice
Posts: 6,837
|
I've looked at the code from avs2pipemod, avsr and AvisynthWrapper and they all create a global variable to save the return value from GetAVSLinkage but they are not really doing anything with this variable, what's the point?
__________________
https://github.com/stax76/software-list https://www.youtube.com/@stax76/playlists |
6th January 2020, 18:05 | #5047 | Link | |
Guest
Posts: n/a
|
Many thanks! That's what I'm running as well. I hope that instructions for AviSynth+ might appear at some point, but I'm very grateful for these.
Quote:
Doubtless, and I know what VapourSynth is, but there are still advantages to AviSynth, so it would be beneficial to have both. |
|
6th January 2020, 20:37 | #5048 | Link | |
...?
Join Date: Nov 2005
Location: Florida
Posts: 1,420
|
Quote:
Code:
sudo apt-get install libavcodec-dev libavformat-dev libavutil-dev libavfilter-dev libavdevice-dev libswscale-dev libpostproc-dev libswresample-dev |
|
6th January 2020, 21:06 | #5049 | Link | |
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
|
Quote:
__________________
Groucho's Avisynth Stuff Last edited by Groucho2004; 6th January 2020 at 21:08. |
|
6th January 2020, 21:37 | #5050 | Link | |
Registered User
Join Date: Jun 2002
Location: On thin ice
Posts: 6,837
|
Quote:
I've forgotten half I knew about C++, so I'm reading this tutorial to refresh it, so far am here: https://www.learncpp.com/cpp-tutoria...null-pointers/ In managed code it might be necessary to use a variable so the GC don't collect it but since there is no GC in native code I don't understand why this variable exists.
__________________
https://github.com/stax76/software-list https://www.youtube.com/@stax76/playlists |
|
9th January 2020, 16:12 | #5052 | Link |
Registered User
Join Date: Jun 2002
Location: On thin ice
Posts: 6,837
|
I notice now it produces a linker error without this AVS_linkage variable...
__________________
https://github.com/stax76/software-list https://www.youtube.com/@stax76/playlists |
9th January 2020, 22:30 | #5053 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
stax, look in avs 2.6, or avs+ header.
The OLD v2.58 BAKED code that existed in v2.58 header was not very portable between avs versions, plugins compiled with such were basically locked to the code in the header. The avs 2.60 header [after v2.60Alpha 4] implemented AVS_Linkage stuff when using the new AvisynthPluginInit3(), so that code is no longer BAKED into the plugin from the header, but instead it can use code from within avisynth itself, and so is able to better adapt. A plugin using eg Avs+ header but running under avs 2.60 standard, can still inquire stuff like bit depth, even though such functionality does not exist in avs 2.6 std(nor exists in 2.58). [EDIT: There are kludges in the avs+ header to implement code not existing in the active version of avisynth] For this more flexible whatsit to work proper, it is necessary to initialize AVS_Linkage with the pointer to vectors [EDIT: which is supplied by the server, usually avisynth] when calling the instance of AvisynthPluginInit3() coded within a plugin, this replaces most of the previously BAKED-in code. avs+ header Code:
/* * Avisynth C++ plugin API code function pointers. * * In order to maintain binary compatibility with * future version do not change the order of the * existing function pointers. It will be baked * into all existing plugins. * * Add new function pointers to the end of the * structure. The linkage macros generate some * protection code to ensure newer plugin do not * call non-existing functions in an older host. */ struct AVS_Linkage { // const AVS_Linkage *AVS_linkage is a pointer to struct of (mostly) function pointers to call int Size; /**********************************************************************/ // struct VideoInfo bool (VideoInfo::*HasVideo)() const; bool (VideoInfo::*HasAudio)() const; bool (VideoInfo::*IsRGB)() const; bool (VideoInfo::*IsRGB24)() const; bool (VideoInfo::*IsRGB32)() const; bool (VideoInfo::*IsYUV)() const; // ... much more Code:
/* New 2.6 requirement!!! */ // Declare and initialise server pointers static storage. const AVS_Linkage *AVS_linkage = 0; // UNSET as yet for current plugin, each plugin has its own instance /* New 2.6 requirement!!! */ // DLL entry point called from LoadPlugin() to setup a user plugin. extern "C" __declspec(dllexport) const char* __stdcall AvisynthPluginInit3(IScriptEnvironment* env, const AVS_Linkage* const vectors) { // Above vectors, pointer provided by avisynth server (v2.6, avs+ or std) enabling non baked-in stuff /* New 2.6 requirment!!! */ // Save the server pointers. AVS_linkage = vectors; // make everything work like magic, plug vectors into AVS_linkage env->AddFunction("TitleBar", "c[Tit]s[ShowFrameNo]b[Col]i[ColChr]s[Esc]b", Create_TitleBar, 0); // Some plugin, can now use avisynth server funcs via AVS_linkage return "'TitleBar' TitleBar plugin"; // A freeform name of the plugin. } hope that 'above sort of' explains it [it is likely that it could be explained better if anyone cares to - I'm happy to accept that 'it works']. EDIT: Some of the Kludgy stuff in avs+ header Code:
// AVS+ extensions // 20161005: // Mapping of AVS+ extensions to classic 2.6 functions. // In order to use these extended AVS+ functions for plugins that should work // either with AVS+ or with Classic (8 bit) Avs 2.6 ans earlier AVS+ versions, there is an // automatic fallback mechanism. // From AVS+'s point of view these are not "baked" codes, the primary functions should exist. // Examples: // Is444() is mapped to IsYV24() for classic AVS2.6 // ComponentSize() returns constant 1 (1 bytes per pixel component) // BitsPerComponent() returns constant 8 (Classic AVS2.6 is 8 bit only) // Returns the number of color channels or planes in a frame int NumComponents() const AVS_BakedCode(return AVS_LinkCallOptDefault(NumComponents, (((AVS_LinkCall(IsYUV)()) && !(AVS_LinkCall(IsY8)())) ? 3 : AVS_LinkCall(BytesFromPixels)(1)) ) ) // Returns the size in bytes of a single component of a pixel int ComponentSize() const AVS_BakedCode(return AVS_LinkCallOptDefault(ComponentSize, 1)) // Returns the bit depth of a single component of a pixel int BitsPerComponent() const AVS_BakedCode(return AVS_LinkCallOptDefault(BitsPerComponent, 8)) // simply return 8 if avs std (provided as default if non avs+ avisynth) To better understand, maybe peruse link pointed to by Groucho [not just that post, entire thread]:- https://forum.doom9.org/showthread.php?t=101730 EDIT: Also take a peek at these two later posts in same thread by IanB some years later, https://forum.doom9.org/showthread.p...92#post1567792 https://forum.doom9.org/showthread.p...72#post1580772 There may be more on same subject when avs+ was introduced. EDIT: And avisynth v2.60Alpha4 thread, where AVS_linkage and AvisynthPluginInit3() introduced for real:- https://forum.doom9.org/showthread.php?t=166951
__________________
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 ??? Last edited by StainlessS; 10th January 2020 at 00:53. |
10th January 2020, 07:54 | #5054 | Link |
Registered User
Join Date: Jun 2002
Location: On thin ice
Posts: 6,837
|
@StainlessS
Thanks for the explanation! If I remember right then host apps like MeGUI or avs2pipemod set the variable to null on shutdown, that does not seem to be necessary, I think MeGUI sets it to null even if there are still instances active, isn't that wrong? https://sourceforge.net/p/megui/code...nthWrapper.cpp
__________________
https://github.com/stax76/software-list https://www.youtube.com/@stax76/playlists |
10th January 2020, 12:18 | #5055 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
No idea, I aint not played with host apps [maybe Grouchy nose]
__________________
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 ??? |
10th January 2020, 12:36 | #5056 | Link | |
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
|
Quote:
In the code to which you linked, the "AVS_linkage = 0;" statement is preceded by the proper "DeleteScriptEnvironment()" which is correct. The "delete pstr->env;" statement for Avisynth 2.5x is however not recommended, see here.
__________________
Groucho's Avisynth Stuff Last edited by Groucho2004; 10th January 2020 at 12:41. |
|
10th January 2020, 14:24 | #5057 | Link | |
Registered User
Join Date: Jun 2002
Location: On thin ice
Posts: 6,837
|
Quote:
I think this thing is too complicated for me to fully understand it. I understand that it's a static variable and that it holds function pointers, aren't those function pointers related to a particular script environment? In that case to me it appears that it should be set to null after the script is loaded and not when the script environment is shut down.
__________________
https://github.com/stax76/software-list https://www.youtube.com/@stax76/playlists |
|
10th January 2020, 14:30 | #5058 | Link |
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
|
I'm not far behind you in that regard. I just did in my programs what IanB recommended in various posts spread across this forum. That was years ago, I have not thought about it since.
__________________
Groucho's Avisynth Stuff |
11th January 2020, 02:22 | #5059 | Link |
Registered User
Join Date: Jun 2002
Location: On thin ice
Posts: 6,837
|
I've built a sample application for learning and testing purpose, maybe the code can help somebody. What it does is render a AviSynth script using Direct2D, it uses a trackbar/slider, no playback. I don't think Direct2D can render YV12 so it invokes ConvertToRGB32, it also invokes FlipVertical, no clue why AviSynth/VapourSynth RGB32 isn't directly D2D compatible without FlipVertical.
Code: https://pastebin.com/59f8xUqA I'll also build a VapourSynth equivalent of this sample in case somebody is interested in code for that.
__________________
https://github.com/stax76/software-list https://www.youtube.com/@stax76/playlists |
|
|