View Full Version : Port of NNEDI under new v2.6 AVS API
Pages :
1
2
3
4
5
6
7
8
9
10
11
12
[
13]
jpsdr
23rd October 2022, 14:16
Ah, ok... If you where using the whole package AND several of my filters, you'll reach the user limit sooner as there is only one threadpool for everyone (but it's the purpose to avoid creating a lot of thread), and using the dll of each filter instead, each filter having its onw threadpool, the limit is reached leater because there is one threadpool/filter, and the limit is by threadpool, but it will produce more threads.
StainlessS
23rd October 2022, 15:08
In DBSC script, I am usually quite happy to use Spline36Resize(), however for a particular case I wanted to use Nnedi3.
We find scene cuts and for each one, trim() and find current border and crop it, then resize that to input size (only a bit bigger).
However, for this job I also was wanting to resize to 1:1 SAR at some later point (after DBSC) so thought maybe best to do a single resize
inside of the DBSC script instead of having two upsize steps.
(Src = DVD PAL 4:3, resize wider for 1:1 SAR, eg 768x576)
Spline36Resize is ok for the smaller upsize, I guess a man on a galloping horse could not spot the difference. :)
agressiv
31st October 2022, 03:06
I'm having corruption using nnedi_rpow2 when any sort of Prefetch command is enabled on my 16-core Ryzen 5950x. My 6-core Intel never has a problem no matter what I set Prefetch to.
* Symptom: Stuttering/sync loss for an encode (first 30 frames or so - basically about 5-10 frames will "repeat" themselves
* Remove nnedi_rpow2, problem never occurs
* Tried removing all other filters
* Even setting AVS Prefetch to "2" has same behavior.
* Tried combinations of threads=1, prefetch=1 etc in the nnedi_rpow2 parameters
* Tried changing to MT_SERIALIZED, MT_NICE_FILTER, no effect
* If I remove Prefetch from the Avisynth script itself, it works fine (but obviously much slower because I'm using McDegrainSharp as well)
I'm not sure if it's the high core count or just AMD itself, anyone else ever see this?
Edit: AviSynth+ 3.7.2 64-bit
Boulder
31st October 2022, 06:32
I'm having corruption using nnedi_rpow2 when any sort of Prefetch command is enabled on my 16-core Ryzen 5950x. My 6-core Intel never has a problem no matter what I set Prefetch to.
* Symptom: Stuttering/sync loss for an encode (first 30 frames or so - basically about 5-10 frames will "repeat" themselves
* Remove nnedi_rpow2, problem never occurs
* Tried removing all other filters
* Even setting AVS Prefetch to "2" has same behavior.
* Tried combinations of threads=1, prefetch=1 etc in the nnedi_rpow2 parameters
* Tried changing to MT_SERIALIZED, MT_NICE_FILTER, no effect
* If I remove Prefetch from the Avisynth script itself, it works fine (but obviously much slower because I'm using McDegrainSharp as well)
I'm not sure if it's the high core count or just AMD itself, anyone else ever see this?
Edit: AviSynth+ 3.7.2 64-bit
I've seen similar things happen with MVTools functions. Try adding RequestLinear(clim=100) right after the source line and see if it helps. That one's in the TIVTC package I think.
FranceBB
31st October 2022, 06:42
Just FYI, the whole point of having plugins_JPSDR.dll is for them to create their own optimised and multithreaded theadpool. TL;DR you guys don't really need Prefetch() with Jean Philippe's plugins. Heck, you'll get better performances without it than with it. ;)
agressiv
31st October 2022, 14:20
Thanks! This RequestLinear() bit seems to fix it. I'll mess with it some more.
I'd love to not have to use Prefetch at all, but most of the MvTools (McDegrainSharp) stuff needs it or it's a huge performance hit - unless you know of a way around that?
FranceBB
31st October 2022, 14:49
most of the MvTools (McDegrainSharp) stuff needs it or it's a huge performance hit - unless you know of a way around that?
Unfortunately there's no way around MVTools.
There used to be a way with avstp.dll but it ended up being buggy and causing freezes, so now that it has been removed, MVTools will run single-threaded unless you use Prefetch, which is really a shame...
Ferenc is trying to fix it, but none of us seem to understand what is going on... (and if even the Supreme Grandmaster Ferenc Pinter can't properly get what's causing it, no one can).
Here: https://github.com/pinterf/mvtools/issues/46
kedautinh12
31st October 2022, 15:00
Maybe next gen handsome FranceBB can :D
StainlessS
31st October 2022, 15:06
I dont have problems using nnedi_rpow2("Spline36Resize") and McDegrainSharp(). [maybe a bit stutter on start only in player <eg VD2>, not encode]
I do use SetMTMode.avsi in Plugins.
last few lines
#########################################
# Filters from MVTools v2.6.0.5 (from http://forum.doom9.org/showthread.php?p=1386559#post1386559 ) Tested On 2016/03/06
SetFilterMTMode("MSuper", MT_MULTI_INSTANCE)
SetFilterMTMode("MAnalyse", MT_MULTI_INSTANCE)
SetFilterMTMode("MFlowFps", MT_MULTI_INSTANCE)
SetFilterMTMode("MRecalculate", MT_MULTI_INSTANCE)
#########################################
#Filters from EEDI2 v0.9.2 (from http://forum.doom9.org/showthread.php?t=173238 ) Tested On 2016/03/06
SetFilterMTMode("EEDI2", MT_MULTI_INSTANCE)
########################################
SetFilterMTMode("MPP_SharedMemoryClient", 2) # real.finder
SetFilterMTMode("MPP_SharedMemoryServer", 3) # real.finder
########################################
SetFilterMTMode("RoboCrop", MT_SERIALIZED) # ADDED by me (always used close to source filter)
SetFilterMTMode("AutoLevels", MT_SERIALIZED)
#########################################
#keep it the last line please
if (FunctionExists("avstp_set_threads")) {
# this isn't actually optimal, because it will also disable avstp threads if running
# on a single-threaded filter chain
avstp_set_threads(0, 1) #disable threading in dither
}
However, in my usual render script I detect if upsize [where we would use nnedi_rpow2] and also McDegrainSharp, and if so then
I use McDegrainSharp before upsize and after Spline36Resize if downsizing.
EDIT:
In my SetMTMode.avsi there is this line below [but no entry for nnedi_rpow2()]
SetFilterMTMode("NNEDI3", MT_MULTI_INSTANCE)
EDIT: "in my usual render script",
a BIG script function that takes a LOT of Global vars [with defaults if not existing] to configure the outcome.
We use Avisynthesizer_Mod / DGIndex / DGIndexNV templates to create scripts with default config Globals, and tweak
a few globals where required.
EDIT:
First few lines of a DGIndex / DGIndxNV template (can work Ok for both dgindex and dgindexNV)
#ASYNTHER Progressive_169_Robo
VideoFileName ="__vid__"
AudioFileName =LCase("__aud__")
AudioDelay =Value("__del__")
###############
vExt = GetFilenameExtension(VideoFileName)
If(vExt == ".dgi") { DGSource(VideoFileName) } # DGIndexNV
Else { Mpeg2Source(VideoFileName).TFM(d2v=VideoFileName) } # DGIndex : Auto check via TFM illegal transitions
AudioExt = GetFilenameExtension(AudioFileName)
Audio= (AudioExt==".ac3") ? NICAC3Source(AudioFileName,channels=2,DRC=0)
\ : (AudioExt==".mpa"||AudioExt=="mp1"||AudioExt==".mp2"||AudioExt==".mp3") ? NicMPG123Source(AudioFileName,Normalize=False)
\ : (AudioExt==".wav") ? RaWavSource(AudioFileName)
\ : (AudioExt==".dts") ? NicDTSSource(AudioFileName)
\ : (AudioExt==".w64") ? RaWavSource(AudioFileName,samplerate=6)
\ : 0
Assert(!isInt(Audio),"NO AUDIO")
(!isInt(Audio)) ? AudioDub(Audio).DelayAudio(AudioDelay).Trim(0,0) : NOP # Trim, chop/add audio to length
(!isInt(Audio) && AudioRate() <> 44100) ? ResampleAudio(44100) : NOP
#AssumeTFF # not needed, both DGIndexNV and DGIndex set field order
#ConvertToYV24(Interlaced=False) # Optional
###########################
#Return last
###########################
### Status
Global G_FILECOUNT=1
### Debugging
Global G_DEBUG=True
### DeBlock(G_DEBLOCK)
Global G_DEBLOCK=0 # Debloock setting
### QueryBorderCrop AND AutoContrast
Global G_SAMPLES=40
### QueryBorderCrop
Global G_QBC=True # Switch On Border Cropping
Global G_QBC_THRESH=-40.0 Global G_QBC_IGNORE = 0.2
Global G_QBC_LEFTADD=0 Global G_QBC_TOPADD=0 Global G_QBC_RIGHTADD=0 Global G_QBC_BOTADD=0 # Additional cropping if still some border
Global G_QBC_WMOD=2 Global G_QBC_HMOD=2 # Width/height multiple of these
Global G_QBC_RLBT=$F # Bits left to right, R,L,B,T # Edges to crop
Global G_QBC_LACED=False
Global G_QBC_SHOW=false
### AutoLevels
Global G_AL_AUTOALEVELS=False
Global G_AL_IGNORE_LO = 100.0/512
Global G_AL_IGNORE_HI = G_AL_IGNORE_LO
Global G_AL_RADIUS = 30
Global G_AL_SC2TH = 8
Global G_AL_SC2PERC = 100.0/3
Global G_AL_MINRNG = 110
Global G_AL_INPUTLO = RT_UNDEFINED
Global G_AL_INPUTHI = RT_UNDEFINED
Global G_AL_AUTOGAMMA = 1 # 1 = NO Change, 0=Auto, else Gamma
Global G_AL_MIDPOINT = 0.5
Global G_AL_GAMMAX = 1.5 Global G_AL_GAMMIN=1.0/G_AL_GAMMAX
Global G_AL_BORD_L = 16 Global G_AL_BORD_T=16 Global G_AL_BORD_R=16 Global G_AL_BORD_B=16
Global G_AL_DEBUG = False
Global G_AL_PRELIMITER = True
Global G_AL_MERGE = 0.3
jpsdr
20th November 2022, 15:14
New version, see first post.
@StainlessS
Can you check if this new version still have the issue of "not being able to get UserId" on your "insane" script :D ?
StainlessS
20th November 2022, 19:29
Thanks, will do but not right now, doin' significant re-write.
EDIT:
insane" script
The script is maybe a prototype to find something that works prior to conversion to C/CPP.
(I'm currently tryin' to figure out how it works - you get more stupid as you get older.)
[ SHUT-UP! FranceBB. ]
jpsdr
26th February 2023, 12:35
New version, see first post.
jpsdr
20th November 2023, 21:56
New version, see first post, but nothing big...
jpsdr
25th March 2025, 18:15
New version, see first post.
Katie Boundary
17th April 2025, 07:43
For future reference: 0.9.4.31 is the last version for which the files that were "compiled for XP" actually work with XP.
jpsdr
17th April 2025, 16:40
That's odd, because i don't see what changes could have been that suddenly made not working under XP (i don't remember using system features not XP compatible), but as i'm not using XP anymore...
Katie Boundary
19th April 2025, 00:50
That's odd, because i don't see what changes could have been that suddenly made not working under XP (i don't remember using system features not XP compatible), but as i'm not using XP anymore...
I think you introduced a Visual C++ 2015/UCRT dependency.
EDIT:
05/12/2016 v0.9.4.32
+ Update to new avisynth header and add support for RGB32, RGBPlanar and alpha channel on avs+.
+ Add A paremeter (for alpha channel) on nnedi3.
* Update asmlib to 2.50
* Use /MD (dynamic link) instead of /MT (static link) for building.
jpsdr
19th April 2025, 11:35
Meaning you have to use an XP compatible version of the redistributable libraries. I don't know if it's still the case for the actual ones (https://aka.ms/vs/17/release/VC_redist.x86.exe & https://aka.ms/vs/17/release/VC_redist.x64.exe).
Katie Boundary
20th April 2025, 08:24
Meaning you have to use an XP compatible version of the redistributable libraries.
I am. Visual C++ 2015-2019, version 14.29, is not easy to find these days.
It seems that there's a part of VS 2015-2019 that just doesn't normally work in XP. You were able to force it to work in XP by statically linking to it, but then it broke when you switched to dynamic linking.
jpsdr
21st April 2025, 17:05
I've made a new build of resample, nnedi and the plugin pack, the XP version only is build with static link (/MT).
Katie Boundary
21st April 2025, 23:00
(cross-post)
Okay, I think I solved the dll mystery.
MSVC 2019 installs on XP.
MSVC 2022 doesn't install on XP.
This was the criterion that I was using to try to find "XP-compatible" versions of Visual C++. However, it is flawed. There is an EXTREMELY narrow range of MSVC 2019 versions that will install on XP, but not quite work properly with it. After removing MSVC 2019 version 14.29.30129 and replacing it with MSVC 2019 version 14.27.29112, all AVIsynth filters work as intended.
tl;dr it's all Microsoft's fault
I've made a new build of resample, nnedi and the plugin pack, the XP version only is build with static link (/MT).
Well, I'm glad we now have two solutions :D
jpsdr
20th July 2025, 10:19
New version, see first post.
jpsdr
29th November 2025, 12:09
First post updated.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.