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.

 

Go Back   Doom9's Forum > Capturing and Editing Video > VapourSynth

Reply
 
Thread Tools Search this Thread Display Modes
Old 12th August 2014, 18:21   #1  |  Link
HolyWu
Registered User
 
HolyWu's Avatar
 
Join Date: Aug 2006
Location: Taiwan
Posts: 654
Yadifmod

https://github.com/HomeOfVapourSynth...Synth-Yadifmod

Last edited by HolyWu; 13th May 2016 at 16:00.
HolyWu is offline   Reply With Quote
Old 12th August 2014, 20:57   #2  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Ikea Chair
Posts: 2,031
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:
Code:
 d.mode = int64ToIntS(vsapi->propGetInt(in, "mode", 0, &err));
    if (err)
        d.mode = 0;
Can be changed to:
Code:
 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:
Code:
"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.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 13th August 2014, 17:02   #3  |  Link
HolyWu
Registered User
 
HolyWu's Avatar
 
Join Date: Aug 2006
Location: Taiwan
Posts: 654
OK. 9-16 bits support is added. Link is updated in the first post.
HolyWu is offline   Reply With Quote
Old 13th August 2014, 18:12   #4  |  Link
jackoneill
unsigned int
 
jackoneill's Avatar
 
Join Date: Oct 2012
Location: 🇪🇺
Posts: 725
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.
__________________
Buy me a "coffee" and/or hire me to write code!

Last edited by jackoneill; 13th August 2014 at 18:17.
jackoneill is offline   Reply With Quote
Old 13th August 2014, 18:15   #5  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Ikea Chair
Posts: 2,031
Quote:
Originally Posted by jackoneill View Post
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.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 16th August 2014, 09:54   #6  |  Link
HolyWu
Registered User
 
HolyWu's Avatar
 
Join Date: Aug 2006
Location: Taiwan
Posts: 654
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.
HolyWu is offline   Reply With Quote
Old 16th August 2014, 10:33   #7  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Ikea Chair
Posts: 2,031
Quote:
Originally Posted by HolyWu View Post
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. 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.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 17th August 2014, 19:56   #8  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: UK
Posts: 2,412
Is nnedi3 in vs already capable of 8bit+ precision?
kolak is offline   Reply With Quote
Old 18th August 2014, 01:53   #9  |  Link
jackoneill
unsigned int
 
jackoneill's Avatar
 
Join Date: Oct 2012
Location: 🇪🇺
Posts: 725
Quote:
Originally Posted by kolak View Post
Is nnedi3 in vs already capable of 8bit+ precision?
As mentioned in the readme.rst, not yet.
__________________
Buy me a "coffee" and/or hire me to write code!
jackoneill is offline   Reply With Quote
Old 18th August 2014, 15:48   #10  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: UK
Posts: 2,412
Thanks- so we have to wait for 10bit quite decent deinterlacing pipe.
kolak is offline   Reply With Quote
Old 21st August 2014, 18:19   #11  |  Link
HolyWu
Registered User
 
HolyWu's Avatar
 
Join Date: Aug 2006
Location: Taiwan
Posts: 654
Released r4.

Fix a minor bug that causes optional arguments can't be optional.
HolyWu is offline   Reply With Quote
Old 14th May 2015, 12:41   #12  |  Link
HolyWu
Registered User
 
HolyWu's Avatar
 
Join Date: Aug 2006
Location: Taiwan
Posts: 654
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 is offline   Reply With Quote
Old 9th June 2015, 19:32   #13  |  Link
HolyWu
Registered User
 
HolyWu's Avatar
 
Join Date: Aug 2006
Location: Taiwan
Posts: 654
Update r8.
  • Support 32-bit float input.
  • Fix division by zero issue when normalizing the unknown frame rate.
HolyWu is offline   Reply With Quote
Old 13th May 2016, 16:00   #14  |  Link
HolyWu
Registered User
 
HolyWu's Avatar
 
Join Date: Aug 2006
Location: Taiwan
Posts: 654
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.
HolyWu is offline   Reply With Quote
Old 13th June 2016, 14:37   #15  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: Chamber 36
Posts: 5,858
I get an error with the x64 build:

Code:
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
Code:
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()
stax76 is offline   Reply With Quote
Old 13th June 2016, 15:35   #16  |  Link
Are_
Registered User
 
Join Date: Jun 2012
Location: Ibiza, Spain
Posts: 282
Quote:
Originally Posted by stax76 View Post
I get an error with the x64 build:

Code:
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
Code:
clip = core.yadifmod.Yadifmod(clip, core.nnedi3.nnedi3(clip), order = 1, field = -1, mode = 0)
You forgot about the "core".
Are_ is offline   Reply With Quote
Old 13th June 2016, 16:02   #17  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: Chamber 36
Posts: 5,858
thanks
stax76 is offline   Reply With Quote
Old 1st May 2017, 10:22   #18  |  Link
HolyWu
Registered User
 
HolyWu's Avatar
 
Join Date: Aug 2006
Location: Taiwan
Posts: 654
Update r10.
  • Add AVX and AVX2 code path.
  • Add opt parameter.
HolyWu is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 23:53.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.