View Full Version : nnedi3 - OpenCL rewrite
SEt
26th January 2015, 00:51
They confirmed the issue – let's hope it's fixed in next version. The most stable so far is 14.4 btw.
anonymlol
7th March 2015, 13:23
The script below crashes sometimes. The error points to nnedi3ocl.avsi.
(I originally posted this here (http://forum.doom9.org/showthread.php?t=162656&page=3) because I thought avs4x26x was causing the crashes.)
DGSource("src.dgi")
mrdaa2(resharpen=0)
flash3kyuu_deband_f3kdb(grainY=0, grainC=0, output_mode=2, output_depth=16)
mrdaa2 is a slightly modified version of MrdaaLame(). (http://forum.doom9.org/showthread.php?t=167480)
# modified version of mandarinka's MrdaaLame (http://forum.doom9.org/showthread.php?t=167480) by anonymlol
# Based on Daa: Anti-aliasing with contra-sharpening by Didée, modded by Terranigma for nnedi and by thetoof for merge
# fixed chroma shift by OnDeed
function Mrdaa2(clip c, float "resharpen", bool "OpenCL") {
resharpen = Default(resharpen, 0)
OpenCL = Default(OpenCL, true)
dblshift = (OpenCL) ? c.nnedi3x(field=1, dh=true).fturnright().nnedi3x(field=1, dh=true).fturnleft()
\ : c.nnedi3(field = 1,dh=true).fturnright().nnedi3(field = 1,dh=true).fturnleft()
dbl = dblshift.Spline36Resize(c.width,c.height,-0.5,-0.5,c.width*2,c.height*2).MergeChroma(dblshift.Spline36Resize(c.width,c.height,-1.0,-1.0,c.width*2,c.height*2))
dblD = mt_makediff(c,dbl,U=3,V=3)
shrpD = mt_makediff(dbl,dbl.blur(resharpen*0.2,MMX=false),U=3,V=3)
DD = shrpD.repair(dblD,13)
return dbl.mt_adddiff(DD,U=3,V=3)
}
edit: Got some errors in cmd this time: http://puu.sh/gpUdx/c37b6d35e5.png
This crashes:
dblshift = (OpenCL) ? c.nnedi3x(field=1, dh=true).fturnright().nnedi3x(field=1, dh=true).fturnleft()
\ : c.nnedi3(field = 1,dh=true).fturnright().nnedi3(field = 1,dh=true).fturnleft()
It doesn't crash when I remove the condition:
dblshift = c.nnedi3x(field=1, dh=true).fturnright().nnedi3x(field=1, dh=true).fturnleft()
I'll remove the condition for now and use it with nnedi3ocl as default.
Remove that fturn perversion – this filter can scale both height and width in one step.
MysteryX
11th July 2015, 17:35
I'm curious about something with the NNEDI3 OpenCL implementation. It has been reported to not perform any better than the standard version. Shouldn't that depend purely on the graphic card, or is the CPU still the bottleneck?
I'm currently writing code to run HLSL shaders in AviSynth, and I wonder how the NNEDI3 HLSL implementation, which runs entirely on the GPU, would compare to this performance-wise
https://github.com/zachsaw/MPDN_Extensions/tree/master/Extensions/RenderScripts/NNEDI3
Ghostlamer
15th August 2015, 16:11
Can anyone check current nnedi3 under Windows 10, works or not?, with the latest nvidia drivers.
DJATOM
12th September 2015, 16:53
Can anyone check current nnedi3 under Windows 10, works or not?, with the latest nvidia drivers.
Yup, it works on my win10pro with gtx750.
yup
13th January 2016, 08:06
Hi All!
I am upgrade my PC using Nvidia GTX 960 card (before use Intel HD4000).
Now my script with nnedi3ocl do not work, I see green output.
Any suggestions and advice please.
yup.
yup
10th February 2016, 15:17
I am try reinstall Avisynth, problem do not go.
I am also try check on another PC under Windows 10, opencl version nnedi3 work without problem.
Please advice roadmap for solving problem. If need additional info I can send.
My sytem Windows 7 64 home premium, 8 Gb, i7, GTX 960 (before internal Intel Graphics). Sytem and drivers updated.
yup.
SSH4
14th February 2016, 17:35
What with field= -2, 2 and 3?
nnedi3ocl do not have them?
-2 = double rate (alternates each frame), uses avisynth's internal parity value to start
2 = double rate (alternates each frame), starts with bottom
3 = double rate (alternates each frame), starts with top
without this not possible use nnedi3ocl in QTGMC :(
SSH4
15th February 2016, 08:05
Well. Find workaround for field=-2 in old nnedi thread.
Function nnedi3xFieldMinus2(clip Input)
{
Input.SeparateFields()
GetParity(Input) ? Interleave( SelectEven().nnedi3ocl(dh=true,Field = 1), SelectOdd().nnedi3ocl(dh=true,Field = 0) )
\ : Interleave( SelectEven().nnedi3ocl(dh=true,Field = 0), SelectOdd().nnedi3ocl(dh=true,Field = 1) )
AssumeFrameBased()
GetParity(Input) ? AssumeTFF() : AssumeBFF()
}
yup
27th February 2016, 07:54
Hi All!
I am upgrade my PC using Nvidia GTX 960 card (before use Intel HD4000).
Now my script with nnedi3ocl do not work, I see green output.
Any suggestions and advice please.
yup.
I am try reinstall Avisynth, problem do not go.
I am also try check on another PC under Windows 10, opencl version nnedi3 work without problem.
Please advice roadmap for solving problem. If need additional info I can send.
My sytem Windows 7 64 home premium, 8 Gb, i7, GTX 960 (before internal Intel Graphics). Sytem and drivers updated.
yup.
I am upgrade my PC up to Windows 10 and problem gone, now nnedi3 OpenCL plugin work fine.
Probably adding new video card broken some relations.
yup.
yup
16th March 2016, 12:07
High all!
Lucky life continue until Geforce driver updated to 362.00.
See error during load simle script in VirtyualDub
https://www.dropbox.com/s/k4gsunhr29bcwoc/nnediocl.png?dl=0
Language my windows is Russian.
Translation Video driver do not respond and was recovered,
Video driver Nvidia Windows Kernel Mode Driver , Version 362.00 do not respond and was recovered.
Any suggesrtions, please.
yup.
Bloax
16th March 2016, 16:33
Can you run other GPU-calculated things - like this (https://github.com/lltcggie/waifu2x-caffe/releases/) - without driver crashes?
If not then I can only suggest wiping (http://www.guru3d.com/files-details/display-driver-uninstaller-download.html) the drivers and installing an older version that still works.
yup
16th March 2016, 18:22
Bloax!
I spent some time for finding gui
http://forum.videohelp.com/threads/372157-New-upscaling-algorithm-waifu2x?p=2423628&viewfull=1#post2423628
I am try upscale image to 2-4 time using CUDA (not cuDNN) all work.
Also for me work without problem KNlmeansCL plugin.
yup.
Atak_Snajpera
21st March 2016, 19:12
Am I blind or this plugin does not have device_id switch like KNLMeansCL ? What opencl device will this plugin use if user has AMD APU + Dedicated AMD GPU?
Atak_Snajpera
3rd April 2016, 17:45
In case of multiple OpenCL platforms the order of preference: AMD GPU -> any GPU -> the rest. No manual choice yet.
Manual choice is a big "must have" in my opinion. I wanted to test this plugin on CPU because OpenCL support on my Radeon 4850 is very very limited (OpenCL 1.0 only). Unfortunately plugin automatically uses my GPU and this what I get
http://i.cubeupload.com/yIGcZb.png
Two options should be added device_type and device_id
Tormaid
15th April 2016, 20:06
Really great work. Any chance you'd consider making a vapoursynth version down the line?
Mangix
16th April 2016, 00:43
Manual choice is a big "must have" in my opinion. I wanted to test this plugin on CPU because OpenCL support on my Radeon 4850 is very very limited (OpenCL 1.0 only). Unfortunately plugin automatically uses my GPU and this what I get
http://i.cubeupload.com/yIGcZb.png
Two options should be added device_type and device_id
acceptable performance on CPU depends on SSE optimizations, which are not present. OpenCL is not magic.
Groucho2004
16th April 2016, 12:58
I wanted to test this plugin on CPU because OpenCL support on my Radeon 4850 is very very limited (OpenCL 1.0 only).
What's the point in using this filter instead of the "normal" nnedi3 when it's not supported by the GPU?
Atak_Snajpera
17th April 2016, 11:08
For science!
Groucho2004
17th April 2016, 11:25
For science!
Ah, OK. I can relate to that. :)
asarian
17th April 2016, 15:31
Is this still in development? I could see myself 'hack' a copy of the QTGMC script to use this OpenCL-nnedi3, instead of the original one. Seems it's 3 years old, though.
luigizaninoni
19th June 2016, 15:33
and still no 64-bit version ? Avisynth+ 64-bit is very stable now
yup
16th August 2016, 18:24
High all!
Lucky life continue until Geforce driver updated to 362.00.
See error during load simle script in VirtyualDub
https://www.dropbox.com/s/k4gsunhr29bcwoc/nnediocl.png?dl=0
Language my windows is Russian.
Translation Video driver do not respond and was recovered,
Video driver Nvidia Windows Kernel Mode Driver , Version 362.00 do not respond and was recovered.
Any suggesrtions, please.
yup.
After upgrade to Avisynth+, I am try this plugin one more and find in old plugin directory file nnedi3ocl.clb. I am copy all files excluding one, and now all work fine.
yup.
edcrfv94
30th September 2016, 02:33
anti-aliasing need nsize=6, qual=2, pscrn=4, nns=4, nnedi3ocl will any plan completely relaced nnedi3?
TheProfosist
5th November 2016, 09:49
I cant seem to get this to do anything it just crashes AvsPmod everytime I add it.
misakitchi
11th January 2021, 12:49
I modded Santiag script (Anti-Aliasing) to use NNEDI3ocl and its very good! Thanks! :)
Is there a new version of NNEDI3ocl since 2013...??
I find this page:
https://github.com/zachsaw/MPDN_Extensions/tree/master/Extensions/RenderScripts/OCL_NNEDI3
Are thoses 2 files updated/better?
Edit:
I tested the "new" version of MPDN from zachsaw
And i have Error! :(
"nnedi3ocl: can't allocate OpenCL Resources"
So i keep the original version
PS: My Computer: AMD FX-8350 + Radeon HD 7800 Series
If someone is interested in my modded Santiag script, i can give the code here
# santiag v1.6
# Simple antialiasing
# OpenCL MOD
# santiagocl(strh=0, strv=0, type="nnedi3", nns=1, nsize=0, halfres=false, scaler_post="Spline36Resize")
# Note: variable "threads" was removed
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
# and/or modify it under the terms of the Do What The Fuck You Want
# To Public License, Version 2, as published by Sam Hocevar. See
# http://sam.zoy.org/wtfpl/COPYING for more details.
# type = "nnedi3", "eedi2", "eedi3" or "sangnom"
# "eedi3" requires v0.9.2 or later
# "sangnom" requires sangnom2
Function santiagocl (clip c, int "strh", int "strv", string "type", int "nns", int "aa", int "aac", int "nsize", int "vcheck", int "fw", int "fh", bool "halfres", string "scaler_post", int "maskt", string "typeh", string "typev")
{
strh = Default (strh, 1)
strv = Default (strv, 1)
type = Default (type, "nnedi3")
typeh = Default (typeh, type)
typev = Default (typev, type)
halfres = Default (halfres, false)
scaler_post = Default (scaler_post, "Spline36Resize")
c
w = Width ()
h = Height ()
fwh = (strv < 0) ? fw : w
fhh = (strv < 0) ? fh : h
(strh >= 0) ? santiag_dir (strh, typeh, halfres, scaler_post, nns=nns, aa=aa, aac=aac, nsize=nsize, vcheck=vcheck, maskt=maskt, fw=fwh, fh=fhh) : last
(strv >= 0) ? TurnLeft ().santiag_dir (strv, typev, halfres, scaler_post, nns=nns, aa=aa, aac=aac, nsize=nsize, vcheck=vcheck, maskt=maskt, fw=fh, fh=fw ).TurnRight () : last
fwx = Default (fw, w)
fhx = Default (fh, h)
(strh < 0 && strv < 0) ? Eval (scaler_post + " (fwx, fhx)") : last
}
Function santiag_dir (clip c, int strength, string type, bool halfres, string scaler_post, int "nns", int "aa", int "aac", int "nsize", int "vcheck", int "maskt", int "fw", int "fh")
{
c
w = Width ()
h = Height ()
fw = Default (fw, w)
fh = Default (fh, h)
multi = (IsYUV () && ! IsYV12 ())
c_y = (multi ) ? ConvertToYV12 () : last
c_u = (multi && ! IsY8 ()) ? UToY ().ConvertToYV12 () : last
c_v = (multi && ! IsY8 ()) ? VToY ().ConvertToYV12 () : last
c_y = c_y.santiag_stronger (strength, type, halfres, multi, nns=nns, aa=aa, aac=aac, nsize=nsize, vcheck=vcheck, maskt=maskt)
c_u = (multi && ! IsY8 ()) ? c_u.santiag_stronger (strength, type, halfres, true , nns=nns, aa=aa, aac=aac, nsize=nsize, vcheck=vcheck, maskt=maskt) : c_u
c_v = (multi && ! IsY8 ()) ? c_v.santiag_stronger (strength, type, halfres, true , nns=nns, aa=aa, aac=aac, nsize=nsize, vcheck=vcheck, maskt=maskt) : c_v
(multi && ! IsY8 ()) ? YToUV (c_u, c_v, c_y)
\ : IsY8 () ? c_y.ConvertToY8 ()
\ : c_y
Eval (scaler_post + " (fw, fh, src_left=0, src_top=(halfres)?0:0.5, src_width=Width (), src_height=Height ())")
}
Function santiag_stronger (clip c, int strength, string type, bool halfres, bool lumaonly, int "nns", int "aa", int "aac", int "nsize", int "vcheck", int "maskt")
{
strength = (strength < 0) ? 0 : strength
field = strength % 2
dh = (strength <= 0 && ! halfres)
(strength > 0) ? c.santiag_stronger (strength - 1, type, halfres, lumaonly, nns=nns, aa=aa, aac=aac, nsize=nsize, vcheck=vcheck, maskt=maskt) : c
(type == "nnedi3" ) ? santiag_nnedi3 (dh, field, lumaonly, nns=nns, nsize=nsize)
\ : (type == "eedi2" ) ? santiag_eedi2 (dh, field)
\ : (type == "eedi3" ) ? santiag_eedi3 (dh, field, lumaonly, nns=nns, nsize=nsize, vcheck=vcheck, maskt=maskt)
\ : (type == "sangnom") ? santiag_sangnom (dh, field, aa=aa, aac=aac)
\ : Assert (false, "Santiag: unexpected value for type.")
}
# NNEDI3 OpenCL
Function santiag_nnedi3 (clip c, bool dh, int field, bool lumaonly, int "nns", int "nsize")
{
c.nnedi3ocl (dh=dh, field=field, nns=nns, nsize=nsize, u=!lumaonly, v=!lumaonly)
}
Function santiag_eedi2 (clip c, bool dh, int field)
{
c
w = Width ()
h = Height ()
(dh) ? last : PointResize (w, h / 2, 0, 1-field, w, h)
eedi2 (field=field)
}
# maskt = 24
Function santiag_eedi3 (clip c, bool dh, int field, bool lumaonly, int "nns", int "nsize", int "vcheck", int "maskt")
{
chroma = (lumaonly) ? 1 : 3
sclip = c.santiag_nnedi3 (dh, field, lumaonly, nns=nns, nsize=nsize)
mclip_flag = (Defined (maskt) && maskt > 0)
mclip = (mclip_flag && dh) ? sclip.BicubicResize (c.Width (), c.Height (), src_top=0.5-field) : sclip
mclip = (mclip_flag)
\ ? mclip.mt_edge (mode="1 2 1 0 0 0 -1 -2 -1 1", thY1=0, thY2=255, u=chroma, v=chroma)
\ .mt_binarize (threshold=maskt, y=3, u=chroma, v=chroma)
\ .mt_expand (y=3, u=chroma, v=chroma)
\ : santiag_undef ()
c.eedi3 (dh=dh, field=field, vcheck=vcheck, sclip=sclip, mclip=mclip, u=!lumaonly, v=!lumaonly)
}
Function santiag_sangnom (clip c, bool dh, int field, int "aa", int "aac")
{
c
w = Width ()
h = Height ()
(dh) ? Spline36Resize (w, h * 2, 0, -0.25, w, h) : last
SangNom2 (order=field, aa=aa, aac=aac)
}
Function santiag_undef () { }
Kisa_AG
12th January 2021, 17:44
If someone is interested in my modded Santiag script, i can give the code here
Yes, please!
kedautinh12
13th January 2021, 01:28
Yes, please!
Code he was posted above
mogobime
20th June 2022, 16:00
As there is no usable x64 Avisynth – no x64 version for now. This plugin wouldn't benefit from it anyway.
nnedi3ocl is basic functionality implemented as plugin. nnedi3x and nnedi3x_rpow2 – scripts that extended beyond that. Basically, what is reasonable to do in script – should be done in script.
GTX 560 should work just fine. Slower than similar Radeons or CC2.0 cards, but still ok.
Hi,
First a few words to myself and why I try to contact you. I'm currently writing a script, which tries to calculate prefetches for every single filter (which is worth to be "extra" prefetched) in an avisynth+ script with the help of a constantly growing database which contains how many threads a filter normally creates per prefetch to not overload the cpu in complex scripts.
Such AviSynth+ scripts with prefetches set after every filter sometimes seem to be even faster than VapourSynth scripts using the same filters.
So I think AviSynth+ is still noteworthy nowadays, especially for non high end systems.
Since times have changed and AviSynth+ 64 bit works great and is really fast if filter prefetching is used correctly, I wanted to ask you if you see any chance to port nnedi3ocl to 64 bit, so it can be used in an 64 bit environment which can address more than 3 GB of memory, which is necessary in times of 4K.
With current basic GPU hardware this might speed up many nnedi3 based filters in 64 bit AviSynth+ and also improve quality of filtering by abandoning the prescreener.
So it would be nice to hear from you.
cu, mogobime
kedautinh12
19th November 2022, 06:41
NNEDI3CL 1.0.5
https://github.com/Asd-g/AviSynthPlus-NNEDI3CL/releases
kedautinh12
28th November 2022, 04:21
NNEDI3CL 1.0.6
https://github.com/Asd-g/AviSynthPlus-NNEDI3CL/releases
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.