Log in

View Full Version : Yadifmod


HolyWu
12th August 2014, 17:21
https://github.com/HomeOfVapourSynthEvolution/VapourSynth-Yadifmod

Myrsloik
12th August 2014, 19:57
Nice.

I looked at the documentation and it lists field as an optional argument but no clear default. I'd put "int field=order" just to make it really obvious. Likewise it doesn't say if all or no planes are processed by default.

Only one small code hint:
d.mode = int64ToIntS(vsapi->propGetInt(in, "mode", 0, &err));
if (err)
d.mode = 0;
Can be changed to:
d.mode = int64ToIntS(vsapi->propGetInt(in, "mode", 0, &err));
Since propGet* returns 0/NULL on failure.

You could also treat order like a bool so you don't have to check the range of it.

This error message is sometimes wrong:"Yadifmod: edeint clip must have the same number of frames as main clip"For some combinations it needs twice the number of frames.

Will you try to extend it so it work with 9-16 bits too? It doesn't look that hard to modify.

HolyWu
13th August 2014, 16:02
OK. 9-16 bits support is added. Link is updated in the first post.

jackoneill
13th August 2014, 17:12
Might I suggest you use more functions, so you don't have so much code in GetFrame? It's good for readability.

It's also good to use the multiplication and division operators when you mean to multiply and divide, instead of bit shifts. Compilers are smart enough to turn "x * 2" into "x << 1" on their own.

Myrsloik
13th August 2014, 17:15
Might I suggest you use more functions, so you don't have so much code in GetFrame? It's good for readability.

And since we're using c++ the processing itself looks it could be easily templated for less code duplication.

HolyWu
16th August 2014, 08:54
Released r3.

Add SIMD operations. The provided binary package contains two DLLs for SSE2 and AVX2 each. Roughly test on my E3-1231 v3, the SSE2 version is about 1x~2x% faster than C version, while the AVX2 version is about only 5% faster than SSE2 version.

Myrsloik
16th August 2014, 09:33
Released r3.

Add SIMD operations. The provided binary package contains two DLLs for SSE2 and AVX2 each. Roughly test on my E3-1231 v3, the SSE2 version is about 1x~2x% faster than C version, while the AVX2 version is about only 5% faster than SSE2 version.

Interesting... I've never seen anyone actually use Agner Fog's vector classes before.

The speed observations are normal. Yadifmod is a fairly simple filter so in the end memory bandwidth becomes the limiting factor. You usually don't gain that much from going beyond SSE2 unless there's a particular instruction you need.

I strongly disagree with your packaging though. The best code path should be automatically chosen. There's no excuse for having multiple different dlls for this kind of code. If you need hints on how to detect cpu features you can simply borrow/study the cpu* files from libav (https://git.libav.org/?p=libav.git;a=tree;f=libavutil/x86;h=7f0237a7b1583d69a861ae9950761ef4a2fc53bd;hb=HEAD). I looked at the documentation for the vector classes but couldn't see an easy way to use multiple vector sizes at once in the same project though. You may have to use a messy trick with multiple files to make it work.

Personally I wouldn't have bothered to release an AVX2 version at all considering the very small gains.

kolak
17th August 2014, 18:56
Is nnedi3 in vs already capable of 8bit+ precision?

jackoneill
18th August 2014, 00:53
Is nnedi3 in vs already capable of 8bit+ precision?

As mentioned in the readme.rst (https://github.com/dubhater/vapoursynth-nnedi3#things-to-do), not yet.

kolak
18th August 2014, 14:48
Thanks- so we have to wait for 10bit quite decent deinterlacing pipe.

HolyWu
21st August 2014, 17:19
Released r4.

Fix a minor bug that causes optional arguments can't be optional.

HolyWu
14th May 2015, 11:41
Update r7.


Yadifmod now will use the field order specified in the source frames (_FieldBased frame property) and will only fall back to the specified order if not present.
The framerate and the frame duration are properly adjusted and normalized for double rate output.
Return an error if the returned clip is longer than INT_MAX.

HolyWu
9th June 2015, 18:32
Update r8.


Support 32-bit float input.
Fix division by zero issue when normalizing the unknown frame rate.

HolyWu
13th May 2016, 15:00
Update r9.


Actually return an error when the value of the order or field parameter is out of range.
The output frame's _FieldBased property is now set to 0.

stax76
13th June 2016, 13:37
I get an error with the x64 build:


Python exception: name 'yadifmod' is not defined
Traceback (most recent call last):
File "src\cython\vapoursynth.pyx", line 1491, in vapoursynth.vpy_evaluateScript (src\cython\vapoursynth.c:26897)
File "D:\Temp\Video\Eli_temp\Eli_Editor.vpy", line 7, in <module>
clip = yadifmod.Yadifmod(clip, nnedi3.nnedi3(clip), order = 1, field = -1, mode = 0)
NameError: name 'yadifmod' is not defined



import vapoursynth as vs
core = vs.get_core()
core.std.LoadPlugin(r"D:\Projekte\GitHub\staxrip\bin\Apps\Plugins\both\ffms2\ffms2.dll")
core.std.LoadPlugin(r"D:\Projekte\GitHub\staxrip\bin\Apps\Plugins\vs\nnedi3\libnnedi3.dll")
core.std.LoadPlugin(r"D:\Projekte\GitHub\staxrip\bin\Apps\Plugins\vs\Yadifmod\Yadifmod.dll")
clip = core.ffms2.Source(r"D:\Temp\Video\Eli.mp4", cachefile = r"D:\Temp\Video\Eli_temp\Eli.ffindex")
clip = yadifmod.Yadifmod(clip, nnedi3.nnedi3(clip), order = 1, field = -1, mode = 0)
clip.set_output()

Are_
13th June 2016, 14:35
I get an error with the x64 build:


Python exception: name 'yadifmod' is not defined
Traceback (most recent call last):
File "src\cython\vapoursynth.pyx", line 1491, in vapoursynth.vpy_evaluateScript (src\cython\vapoursynth.c:26897)
File "D:\Temp\Video\Eli_temp\Eli_Editor.vpy", line 7, in <module>
clip = yadifmod.Yadifmod(clip, nnedi3.nnedi3(clip), order = 1, field = -1, mode = 0)
NameError: name 'yadifmod' is not defined



clip = core.yadifmod.Yadifmod(clip, core.nnedi3.nnedi3(clip), order = 1, field = -1, mode = 0)


You forgot about the "core".

stax76
13th June 2016, 15:02
thanks :)

HolyWu
1st May 2017, 09:22
Update r10.


Add AVX and AVX2 code path.
Add opt parameter.