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. |
7th December 2018, 03:26 | #4322 | Link |
Registered User
Join Date: Mar 2012
Location: Texas
Posts: 1,665
|
AviSynth+ FilterGraph
I found something really cool from the AviSynth+ nekopanda fork. It is a function to output the flow of filter processing as a graph. See following pictures:
QTGMC(): https://i.imgur.com/JMWKKaO.png SMDegrain(): https://i.imgur.com/56xKzxl.png https://github.com/nekopanda/AviSynt...ilterGraph.cpp Any possibility of this filter being incorporated into Avs+? There are other features in this fork as well: https://github.com/nekopanda/AviSynt...i/Avisynth-Neo https://github.com/nekopanda/AviSynt...e-New-Features |
7th December 2018, 07:43 | #4323 | Link |
Registered User
Join Date: Jan 2014
Posts: 2,314
|
Yep, I know it, I was just looking into it yesterday. Good and brave modifications, Avisynth++. Also fixed some MT problems with runtime filters which I did't understand two years ago when I tried to fix it, and since then it was forgotten.
EDIT: Yesterday I was already trying to integrate the older ScriptClip related fixes. But in general the source code of the core (caching, video frame storage and allocations, frame properties (!), threading) became so much different and reworked that now it is not easy - or maybe impossible - to simply cherry-pick only one or two features. I have to mention though that as seen on QTGMC or TemporalDegrain when using CPU-only method it consumes more memory and is a bit slower than the current Avisynth+ version (x64, Win10, i7-7770). But it's the question of time when it's getting solved. Last edited by pinterf; 7th December 2018 at 10:59. Reason: add experiences |
14th December 2018, 01:35 | #4325 | Link |
Formerly davidh*****
Join Date: Jan 2004
Posts: 2,496
|
This is probably a silly idea and probably not worth implementing even if it isn't, but is there any way for a plugin to set global AviSynths variable that can be used in the script? I'm thinking of those parameters were numbers just won't cut it, so they have to be specified as strings - like specifying a matrix for RGB->YUV conversion.
That seems really clunky, though, so I was wondering if there was a way to do something like this: Code:
foo(clip, quality=FOO_BILINEAR) foo(clip, quality=FOO_BICUBIC) |
14th December 2018, 04:47 | #4326 | Link |
Broadcast Encoder
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,903
|
Hi Ferenc.
I personally use Avisynth+ x86 32bit (both on my x64 and on my legacy x86 32bit systems) and I rely on that due to filters compatibility/consistency. Whenever I have to allocate more than 4GB of RAM, I use MP_Pipeline, but it's not that fast and it doesn't support audio. Anyway, do you think it can be modified to support audio, improved and included inside Avisynth+ x86 32bit? Having a better and updated version of MP_Pipeline that also supports audio would be great, especially nowadays 'cause high bit depth and high resolutions require a lot of RAM. I know that you have many things to do before even considering this one, but it's just a hint, whenever you have time. ^^ Thank you in advance and sorry if it's not 100% related to the Avisynth+ development (you are doing a great job by the way). ^_^ |
14th December 2018, 10:15 | #4327 | Link | |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
David,
Some Stuff (SetVar and SetGlobalVar pretty much the same usage):- http://avisynth.nl/index.php/Filter_...I#SetGlobalVar http://avisynth.nl/index.php/Filter_...API#SaveString https://forum.doom9.org/showthread.p...21#post1572321 https://forum.doom9.org/showthread.p...ar#post1843591 If setting some kind of var (Local or Global) from within eg GetFrame, then suggest that in Constructor, check for existence of the var, and if does not exist, create it with dummy value (using env->SaveString for the variable name, so you know for sure that the name already exists when in GetFrame), also, if eg var type is string and with a known max possible size, then create dummy max size string for it and also SaveString. In GetFrame, can then assume that var name already exists (and saved with SaveString), and so can just set value in already allocated and saved buffer. EDIT: If using preallocated buffer, then just write to that buffer, dont SetVar, assuming that you kept address of SaveString buffer, otherwise get the used buffer via GetVar, and extract the pointer to the buffer from the AVSValue and write to that buffer. Quote:
string literals are at constant address and read only. Saving Strings, related to SetVar; https://forum.doom9.org/showthread.p...36#post1633936 EDIT: ApparentFPS constructor Code:
ApparentFPS::ApparentFPS(PClip _child,double _DupeThresh,double _FrameRate,int _Samples,double _ChromaWeight, const char*_Prefix,bool _Show,bool _Verbose,bool _Debug, int _Mode,int _Matrix,int _BlkW,int _BlkH,int _oLapX,int _oLapY, IScriptEnvironment* env) : GenericVideoFilter(_child),DupeThresh(_DupeThresh),FrameRate(_FrameRate),Samples(_Samples), ChromaWeight(_ChromaWeight),Prefix(_Prefix),Show(_Show),Verbose(_Verbose),Debug(_Debug), Mode(_Mode),Matrix(_Matrix),BlkW(_BlkW),BlkH(_BlkH),oLapX(_oLapX),oLapY(_oLapY) { # ifdef AVISYNTH_PLUGIN_25 if(vi.IsPlanar() && vi.pixel_type != 0xA0000008) { // Here Planar but NOT YV12, If v2.5 Plugin Does NOT support ANY v2.6+ ColorSpaces env->ThrowError("ApparentFPS: ColorSpace unsupported in ApparentFPS v2.5\n"); } # endif num_frames = vi.num_frames; Dif = 0.0; AppFPS = 0.0; MaxAppFPS = 0.0; MaxBelowDupeDif = 0.0; MinAboveDupeDif = 255.0; Unique = 0; Valid = 0; UniqMax = 0; LftSpan = 0; RgtSpan = 0; Prev_n = -666; int i; for(i=5;--i>=0;) VarNames[i][0]='\0'; if(*Prefix != '\0') { char *names[5]={"ApparentFPS","MaxApparentFPS","MaxBelowDupeDif","MinAboveDupeDif","CurrentDif"}; int pfixlen=int(strlen(Prefix)); if(pfixlen>128) pfixlen=128; for(i=5;--i>=0;) { char * p = VarNames[i]; memcpy(p,Prefix,pfixlen); char *d=p+pfixlen; const char *np=names[i]; for(;*d++=*np++;); // strcat variable name part AVSValue var = GetVar(env,p); env->SetVar(var.Defined() ? p : env->SaveString(p),(i==3)?255.0:0.0); // Make sure name exists, init with dummy value } } } Code:
PVideoFrame __stdcall ApparentFPS::GetFrame(int n, IScriptEnvironment* env) { ... if(*Prefix != '\0') { env->SetVar(VarNames[0],AppFPS); env->SetVar(VarNames[1],MaxAppFPS); env->SetVar(VarNames[2],MaxBelowDupeDif); env->SetVar(VarNames[3],MinAboveDupeDif); env->SetVar(VarNames[4],Dif); } ... } EDIT: Again here: Code:
AVSValue __cdecl GetVar(IScriptEnvironment* env, const char* name) { try {return env->GetVar(name);} catch (IScriptEnvironment::NotFound) {} return AVSValue();} EDIT: Also AtExit function, maybe to release buffers if you allocate them for strings yourself. http://avisynth.nl/index.php/Filter_SDK/Non-clip_sample EDIT: Not sure, think you can forget AtExit above, I seem to remember that it is called AFTER plugins are destroyed, so may not work. EDIT: Think maybe above wrong, plugins do still exist, its the filter graph that is already destroyed (otherwise there would be no point in the AtExit function if plugins already gone, basically dont count on any avisynth structures existing during call from AtExit). EDIT: Return constants rather than variables, simple really. Code:
#include <windows.h> #ifdef AVISYNTH_PLUGIN_25 #include "avisynth25.h" #else #include "avisynth.h" #endif AVSValue __cdecl Foo_Bilinear(AVSValue args, void* user_data, IScriptEnvironment* env) { return "12345678"; // Constant address read only, no need to SaveString } AVSValue __cdecl Foo_BiCubic(AVSValue args, void* user_data, IScriptEnvironment* env) { return "87654321"; } AVSValue __cdecl Foo_PI(AVSValue args, void* user_data, IScriptEnvironment* env) { return 3.1415926f; } AVSValue __cdecl Foo_Life(AVSValue args, void* user_data, IScriptEnvironment* env) { return 42; } #ifdef AVISYNTH_PLUGIN_25 extern "C" __declspec(dllexport) const char* __stdcall AvisynthPluginInit2(IScriptEnvironment* env) { #else const AVS_Linkage *AVS_linkage = 0; extern "C" __declspec(dllexport) const char* __stdcall AvisynthPluginInit3(IScriptEnvironment* env, const AVS_Linkage* const vectors) { AVS_linkage = vectors; #endif env->AddFunction("FOO_BILINEAR", "", Foo_Bilinear, 0); env->AddFunction("FOO_BICUBIC", "", Foo_BiCubic, 0); env->AddFunction("FOO_PI", "", "", Foo_PI, 0); env->AddFunction("FOO_Life", "", Foo_Life, 0); return "`DHorman Presets' DHorman plugin"; }
__________________
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; 19th December 2018 at 04:44. |
|
14th December 2018, 19:37 | #4328 | Link |
Formerly davidh*****
Join Date: Jan 2004
Posts: 2,496
|
Thanks Stainless. I think env->SetGlobalVar does what I want. Whether it's a good idea or not... well, I don't know if it will suit everyone, but I like what I can do with it and I will probably use it in filters in the future, with suitable variable names that are extermely unlikely to clash with anyone's scripts.
Another thought I had, and again it's probably a bit too odd an idea to implement, is that it'd be great if plugins could provide their own short help text. Instead of having to keep looking things up, there could be an "Explain" or "Help" function that you could call with a filter name, and it would give (thrown as an exception, perhaps) a list of its known parameters, and maybe some brief text for each one. I see that AvisynthPluginInit3 expects you to return a string, but don't know of any way to call that string up in a script. |
14th December 2018, 20:13 | #4329 | Link | |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Quote:
of the string for freeing via Avisynth, and leaving Avisynth in charge of it and responsible for the freeing of the memory block. (otherwise memory leaks). [Above incase you meant that you were not gonna bother with SaveString]. I have never seen the string returned by AvisynthPluginInit2/3 used by anything (with possible exception of AvsEdit, not sure if it used it, and perhaps AvsPMod does too). [EDIT: At least one plugin (dont remember which) returns 0 where it should return that string, so a program trying to access it as a string might cause a system exception/access violation] I guess that some kind of simple (even script) function could be knocked up to show doc text on video clip, would need (how I see it) an RT_Stats DBase with eg string name of function, and string name of a txt file on hard drive. Look for name of function in DBase, if not found then error. Else read in associated string filename from DB, and read text from doc file, and RT_Subtlte as in the RT_Stats subtitle demo in the avs folder of RT_Stats. So would use something like return Man("amp"). Demo From RT_Stats using RT_Subtitle (In the AVS directory). RT_SCROLLDEMO.avs (will open fileselector, you choose an avi file, and then a text file and it will display that text upon the avi). Code:
avi = RT_FSelOpen("Please select an AVI file",Filt="*.AVI|*.AVI") Assert(avi.IsString,"RT_FSelOpen: Error="+String(avi)) AVISource(AVI) txt = RT_FSelOpen("And now select a Text file",Filt="*.txt|*.txt") Assert(txt.IsString,"RT_FSelOpen: Error="+String(txt)) Txt=RT_ReadTxtFromFile(txt) Lines=RT_TxtQueryLines(Txt) # config DELAY=100 ALIGN=1 # As Numeric KeyPad SCROLL=0 # 0 = Upwards : 1 = Downwards : 2 = Right to Left : 3 = Left to right : 4 = Karaoke # ORG=Last Last=(SCROLL==4)? ORG.Blankclip(height=80) : Last CMD_0 = """RT_Subtitle("%s",Txt,align=ALIGN,y=height+DELAY-current_frame,expx=true,expy=true)""" CMD_1 = """RT_Subtitle("%s",Txt,align=ALIGN,y=-(Lines*20+DELAY) + current_frame,expx=true,expy=true)""" CMD_2 = """RT_Subtitle("%s",Txt,align=ALIGN,x=width+DELAY-current_frame,expx=true,vcent=true)""" CMD_3 = """RT_Subtitle("%s",Txt,align=ALIGN,x=-(width+DELAY)+current_frame,expx=true,vcent=true)""" CMD_4 = """RT_Subtitle("%s",Txt,align=ALIGN,y=height+DELAY-current_frame,expx=true,expy=true)""" CMD_5 = """RT_Subtitle("BAD SCROLL COMMAND (0->4)")""" CMD = (SCROLL<0 || SCROLL>4) ? CMD_5 : Select(Scroll,CMD_0,CMD_1,CMD_2,CMD_3,CMD_4) ScriptClip(CMD) Return (SCROLL==4)? StackVertical(ORG,Last) : Last Doc files could actually be stored as string in a DB, but strings are of fixed max size and so might have to allocate eg 64KB (in DB) each, even for tiny doc files. EDIT: Even script functions could be stored in DBase, and an Eval/GScript would implant them in current script. EDIT: For the man thing, could even have a DBase of DBase Names, where each sub DBase record might hold eg an argument name as string, and min value, max value, and some short (eg 1KB) description of the arg. (perhaps more) EDIT: Each DBase, also has 10 user string attributes (Max 1024 len) for whatever you wish, and 1024 Int or Float user attributes, again for whatever you want, perhaps link to website download or whatever [for StringUserAttrib(0)], and version number for Float UserAttrib(0).
__________________
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; 14th December 2018 at 21:12. |
|
15th December 2018, 00:30 | #4330 | Link | |
Registered User
Join Date: Feb 2012
Posts: 82
|
Quote:
|
|
16th December 2018, 12:17 | #4331 | Link |
Registered User
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,079
|
After using AVS+ for a few months on my Core i5 (two physical cores plus hyperthreading) I decided to revert back to AviSynth 2.61 Alpha.
I don't have any use for high bit depth and all the new fancy color spaces. I also cannot use the 64-bit version because I absolutely need to use some 32-bit plugins. All I wanted was a speed boost by using MT modes for my AVS plugins, but I was quite disappointed. My main sources are captured HD files in the HEVC format. My source filters are DSS2Mod and ffms2 (I do not like LSMASH, and I cannot use DGDecNV). And for both source filters the decoding speed is unacceptable with these HEVC sources. With DSS2Mod the speed tends to be OK at the start, but after a while the speed drops to a snail's pace. With ffms2 it is even worse, speed is about one tenth compared to disabling MT. With AVS+ the solution is to disable MT, but why would I want to do this? Under AviSynth 2.61 Alpha I get even better speed. Cheers manolito |
16th December 2018, 12:31 | #4332 | Link |
Registered User
Join Date: Dec 2005
Location: Germany
Posts: 1,795
|
Maybe the bottleneck is the hdd (cache is full)? How huge are the files?
You can combine 64bit with 32bit filters (and speed up things) with MP_Pipeline: https://forum.doom9.org/showthread.php?t=163281
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth VapourSynth Portable FATPACK || VapourSynth Database Last edited by ChaosKing; 16th December 2018 at 12:35. |
16th December 2018, 12:43 | #4333 | Link | |
Broadcast Encoder
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,903
|
Quote:
|
|
16th December 2018, 14:48 | #4334 | Link |
Formerly davidh*****
Join Date: Jan 2004
Posts: 2,496
|
Bug? When calling extracttoy on a Y8 clip, AviSynth+ complains that there are no chroma channels.
Edit: also minor cosmetic issue: colorbars with pixel_types YV12 and YV24 do not line up exactly. I'm guessing because the bars have to align with chroma subsampling in the YV12 case, but (if someone was so inclined) I would suggest YV24 should be forced to do the same for consistency (with 4:2:0 and 4:1:1 as well), even though it isn't subsampled. Last edited by wonkey_monkey; 16th December 2018 at 14:54. |
18th December 2018, 13:55 | #4336 | Link |
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
|
Any chance you'd put a new release under our trees before the holidays?
__________________
Groucho's Avisynth Stuff |
18th December 2018, 16:29 | #4338 | Link |
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
|
__________________
Groucho's Avisynth Stuff |
18th December 2018, 17:17 | #4339 | Link | |
Registered User
Join Date: Nov 2009
Posts: 2,361
|
Quote:
I get "illegal instruction" message. Using: Code:
Setfiltermtmode("dfttest", 2) |
|
18th December 2018, 18:27 | #4340 | Link |
Registered User
Join Date: Jan 2014
Posts: 2,314
|
O.K., it's been a long time since I released any update here, no big things included, only a new build. A sort of a maintenance release.
Download Avisynth+ r2768-MT The files-only section also contains an x86 build for SSE-only processors. This release features an interesting language extension: inline assignments, contributed by a new fellow developer addewyd. Enjoy. Code:
# Avisynth+ r2768 (20181218) https://forum.doom9.org/showthread.php?t=168856 - New: Expr: allow input clips to have more planes than an implicitely specified output format Expr(aYV12Clip, "x 255.0 /", format="Y32") # target is Y only which needs only Y plane from YV12 -> no error - New: Expr: Y-plane-only clip(s) can be used as source planes when a non-subsampled (rgb or 444) output format implicitely specified Expr(Y, "x", "x 2.0 /", "x 3.0 /", format="RGBPS") # r, g and b expression uses Y plane Expr(Grey_r, Grey_g, Grey_b, "x", "y 2.0 /", "z 3.0 /", format="RGBPS") # r, g and b expression uses Y plane - Fix: ConvertToYUY2() error message for non-8 bit sources. - Fix: Y32 source to 32 bit 420,422,444 (introduced in the zero-chroma-center transition project) - Fix: ShowY, ShowU, ShowV crash for YUV (non-YUVA) sources - Speedup: ConvertToY12/16... for RGB or YUY2 sources where 4:4:4 or YV16 intermediate clip was used internally (~1.5-2x speed, was a regression in Avs+, use intermediate cache again) - Fix: Allow ExtractY on greyscale clips - ImageReader/ImageSource: use cache before FreezeFrame when result is a multiframe clip (fast again, regression since an early AVS+ version) - Resizers: don't use crop at special edge cases to avoid inconsistent results across different parameters/color spaces - Fix: Histogram 'classic': rare incomplete histogram shown in multithreading environment - Fix: ImageReader and ImageWriter: if path is "" then it works from/to the current directory. - GeneralConvolution: Allow 7x7 and 9x9 matrices (was: 3x3 and 5x5) - GeneralConvolution: All 8-32 bit formats (was: RGB32 only): YUY2 is converted to/from YV16, RGB24/32/48/64 are treated as planar RGB internally Since 32 bit float input is now possible, matrix elements and bias parameter now is of float type. For 8-16 bit clips the matrix is converted to integer before use. - GeneralConvolution: Allow chroma subsampled formats to have their luma _or_ chroma processed. E.g. set chroma=false for a YV12 input. - GeneralConvolution: new parameters: boolean luma (true), boolean chroma(true), boolean alpha(true) Default: process all planes. For RGB: luma and chroma parameters are ignored. Unprocessed planes are copied. Using alpha=false makes RGB32 processing faster, usually A channel is not needed. - GeneralConvolution: MT friendly parameter parsing - New: UTF8 filename support in AviSource, AVIFileSource, WAVSource, OpenDMLSource and SegmentedAVISource All functions above have a new bool utf8 parameter. Default value is false. - Experimental: new syntax element (by addewyd): assignment operator ":=" which returns the assigned value itself. (Assignment within an expression) Examples: w := h := 256 b := blankclip(width=w * 2, height = h * 3, length=40, pixel_type="yv12") bm = blankclip(width=w, height = w).letterbox(2,0,2,0, color=$ff) b for(j = 0, 1, 1) { for(i = 0, 1, 1) { e = 0 + i * 16 + j * 16 * 4 ce = string(e) c = bm.subtitle("Y = 0x" + hex(e) + " " + ce) eval("c" + string(i) + string(j) + " := c") b := b.overlay(c, x = i * w, y = j * h) } } cx = c00.trim(0, 9) + c01.trim(0, 9) + c10.trim(0, 9) + c11.trim(0, 9) b := overlay(cx, x = 0, y = w * 2) /* defined NEW_AVSVALUE at build */ array = [99, 101, "303", cnt := 4] for(j = 0, cnt - 1, 1) { b := subtitle(string(array[ind := j]), x = 100, y=(j+1) * 20) } g := b.tstfunc(kf := "first", ks := "second") g := subtitle((s := 4) > 0 ? t := "left" : t := "right", y = 100) g := subtitle(string(s) + " " + t + " " + ks, y = 150) eval("""h := g.subtitle("G", x=200, y = 20)""") h.subtitle("H " + string(ind), x = 300, y = 20) function tstfunc(c, d, e) { if (f := 1 < 2) { c.subtitle(string(f) + e, y = 50) } else { c.subtitle(d, y = 50) } } Last edited by pinterf; 18th December 2018 at 18:29. |
Thread Tools | Search this Thread |
Display Modes | |
|
|