Update of nnedi3 to port it on x64.
jpsdr / nnedi3 Goto Github PK
View Code? Open in Web Editor NEWUpdate of nnedi3 to new avs 2.6 API and port to x64.
Update of nnedi3 to new avs 2.6 API and port to x64.
Hi!
When using QTGMC (v3.364) with the most recent release of NNEDI3 (v0.9.4.54) I get very poor results. Strange artefacts appear, parts of the image shift and flicker. Also, QTGMC will output only every other frame, i. e. I get a double-fps video that runs at double speed and ends half way, with the second half filled up with black frames.
But, every other version of NNEDI3 works flawlessly. Perfect image and full-length double-fps video as expected.
Please compare the two example videos (fps adjusted).
I'm afraid I don't know if this is actually a problem of NNEDI3 or QTGMC, but I felt I had to bring it to your attention.
Max
For this plugin you are offering several compilations (dlls), each one in a folder named after a SIMD instruction set.
Does that mean each of these compilations has just one SIMD optimization avaiable?
I have this doubt because other plugins (mvtools, etc) come with all the optimizations in a single dll. It seems like these automatically use the best one avaiable.
I'm using Visual Studio 2013 and when I try to compile the x64 version of the code it gives me an "error A1000" for each of the x64 asm files. This only happens when the path to the asm files contains spaces. If there are no spaces the code compiles fine.
i.e. I:\source\nnedi3\nnedi3_asm_x64.asm
is fine, but
I:\source files\nnedi3\nnedi3_asm_x64.asm
will not compile.
http://ale.riolo.co.uk/2009/08/how-to-fix-fatal-error-a1000-while.html
As per the above link, this seems to be related to ml64 being unable to handle spaces in file names, but even putting quotes around the variables in the custom build command lines of each asm file didn't fix the errors for me. Although I'm not positive that those are the correct references to ml64.
It would be great if you could look into this and see if there is some way to change the build process so that it is possible to compile the x64 code inside directories with spaces.
When using double rate output (field=-2), if the clip's field order changes at some point during the clip, nnedi3 doesn't respond to it and just keeps using the same field order that the clip started out with.
Bob and TDeint do not have this issue and respond to the field order changing (example below).
Test clip: https://drive.google.com/file/d/1KdE0np8016zr7ovRassdbH7OtbKU7e-a/view?usp=sharing
# entirely TFF source clip
LWLibavVideoSource("480i 3-2 and 1-1 TFF.mkv", repeat=true)
scene1 = last.Trim(102,224).AssumeTFF() # should appear correct since source is TFF
scene2 = last.Trim(225,393).AssumeBFF() # should appear incorrect if deint filter is obeying
test = scene1 ++ scene2
ScriptClip(test ,
\ """
field_order = GetParity(current_frame)==true ? "TFF" : "BFF"
frame_number = "frame: " + String(current_frame)
SubTitle(field_order + "\n" + frame_number, lsp=10)
\ """, after_frame=true, local=false)
# results:
# bob() # PASS (scene2 appears incorrect, as it should)
# tdeint(mode=1, order=-1) # PASS (scene2 appears incorrect, as it should)
nnedi3(field=-2) # FAIL (scene2 doesn't appear incorrect)
# bwdif(field=-2) also passes the test, but only if I delete the "_FieldBased" frame property
beforehand - implying that bwdif preferences "_FieldBased" over Avisynth's parity flag.
Hi @jpsdr,
thank you for your good work. I'm wondering, if there are any plans on porting NNEDI3 to AVS+ & Linux. I got it compiling with cmake/make for some parts, but got:
nnedi3/PlanarFrame.cpp: In function ‘int CPUCheckForExtensions()’:
nnedi3/PlanarFrame.cpp:57:3: error: ‘__cpuid’ was not declared in this scope
57 | __cpuid(cpuinfo, 1);
| ^~~~~~~
nnedi3/PlanarFrame.cpp:87:42: error: ‘_XCR_XFEATURE_ENABLED_MASK’ was not declared in this scope
87 | unsigned long long xgetbv0 = _xgetbv(_XCR_XFEATURE_ENABLED_MASK);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
nnedi3/PlanarFrame.cpp:87:34: error: ‘_xgetbv’ was not declared in this scope; did you mean ‘xgetbv0’?
87 | unsigned long long xgetbv0 = _xgetbv(_XCR_XFEATURE_ENABLED_MASK);
| ^~~~~~~
| xgetbv0
After adding #include <x86gprintrin.h>
to PlanarFrame.cpp I was left with:
nnedi3/PlanarFrame.cpp: In function ‘int CPUCheckForExtensions()’:
nnedi3/PlanarFrame.cpp:57:3: error: ‘__cpuid’ was not declared in this scope
57 | __cpuid(cpuinfo, 1);
| ^~~~~~~
nnedi3/PlanarFrame.cpp:87:42: error: ‘_XCR_XFEATURE_ENABLED_MASK’ was not declared in this scope
87 | unsigned long long xgetbv0 = _xgetbv(_XCR_XFEATURE_ENABLED_MASK);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
Now finally with
#ifdef __linux__
#include <x86gprintrin.h>
#define _aligned_malloc(size, alignment) aligned_alloc(alignment, size)
#define _aligned_free(ptr) free(ptr)
#define _XCR_XFEATURE_ENABLED_MASK 0
#define __cpuid(out, infoType)\
asm("cpuid": "=a" (out[0]), "=b" (out[1]), "=c" (out[2]), "=d" (out[3]): "a" (infoType));
#endif
I'm "only" left with:
In file included from /usr/lib/gcc/x86_64-linux-gnu/11/include/x86gprintrin.h:93,
from nnedi3/PlanarFrame.cpp:32:
/usr/lib/gcc/x86_64-linux-gnu/11/include/xsaveintrin.h: In function ‘int CPUCheckForExtensions()’:
/usr/lib/gcc/x86_64-linux-gnu/11/include/xsaveintrin.h:60:1: error: inlining failed in call to ‘always_inline’ ‘long long int _xgetbv(unsigned int)’: target specific option mismatch
60 | _xgetbv (unsigned int __A)
| ^~~~~~~
nnedi3/PlanarFrame.cpp:93:41: note: called from here
93 | unsigned long long xgetbv0 = _xgetbv(_XCR_XFEATURE_ENABLED_MASK);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In the latest commit ec3d992, nnedi3_asm_FMA_x64.asm is excluded from building from all x64 configurations, leading to linking failures by default.
Please include the file in the build, in the next git commit. Thank you.
Would it be possible to get the documentation to train my own model? I looked into the readme and source code briefly, please correct me if I'm incorrect
Hi, I was wondering if v0.9.4.9 is the latest version? I ask this because release page says "2 commits to master since this release" with one of commits being "Correction in x64 ASM file".
I'm trying to use nnedi3 in avisynth+ 64bit.
I've downloaded the package
https://github.com/jpsdr/NNEDI3/releases/download/v0.9.4.7/NNEDI3_v0_9_4_7.7z
and used this file in my script (on my windows server 2008 with xenon cpu):
NNEDI3_v0_9_4_7/x64/Release_Intel_W7_Xeon_AVX512/nnedi3.dll
the first call to nnedi3_rpow2
causes this exception: System Exception - Illegal Instruction
I've found this older version of nnedi3 built for 64bit which works fine (though has a little bit different syntax -> no etype parameter, and pscrn is boolean)
http://bengal.missouri.edu/~kes25c/nnedi3_64.dll
From version 0.9.4.39 on, running the follwing script causes the mentioned exception to occur:
(The script does not necessarily do anything useful)
vint = AVISource("Bomberman Earthquake OVA.avi", audio=true) #YUY2 Source
vint = vint.trim(716,0)
vint
AssumeTFF()
SeparateFields()
#ShowFrameNumber(scroll=true)
separated = last
#PointResize(Width(), Height()*2)
f0 = separated.SelectEvery(5,0,1).Weave()
f1 = separated.SelectEvery(5,3,4).Weave()
Interleave(f0,f1)
f0
trim(5210,5222)
sanimebob(1,usedaa3mod=true) #uses QTGMC 3.357s, which uses NNEDI3
srestore(12.000/1.001)
AVSMeter reported the exception was caused by module NNEDI3.
I'm using AviSynth+ 0.1 (r2455, MT, i386), with x86/Release_W7 of NEEDI3.
It seems like version 0.9.4.38 won't crash.
Hi,
ColorBars(width=1920, height=1080, pixel_type="yv12")
Crop(0, 138, -0, -138)
PointResize(1920, 1206)
nnedi3()
has green lines at the bottom. Tried the latest version and old version from 2017/2016 but those lines are always there.
It would be nice to make nnedi3() and nnedi3_rpow2() support Y8, which is often used to speedup filtering by processing planes separately after extracting them with ConvertToY8, UToY8, VToY8 - zero-cost plane copying in case of a planar source.
Support for YV16 would also be quite useful since YUY2 can be losslessly converted into planar YV16 for further filtering.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.