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. Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se |
|
|
#1 | Link |
|
Guest
Posts: n/a
|
ColorMatrix for Vapoursynth
So I've finished the initial porting of ColorMatrix to Vapoursynth. It can be downloaded here. Source code is on Github here. It seems to work fine on the few test clips I tried but I can't say I tested it fully so let me know if you stumble upon any issues. There is still further cleanup and removal of Windows dependencies to finish up, but this should be enough to at least test.
Parameters are the same as the original ColorMatrix the only difference is that the bool values have been replaced with ints (0 for false and 1 for true for anyone who is unfamiliar). Usage: Code:
>>> import vapoursynth as vs
>>> core = vs.Core()
>>> core.std.LoadPlugin('/path/to/ColorMatrix.dll')
Code:
>>> ret = core.colormatrix.ColorMatrix(clip) Last edited by SassBot; 17th October 2012 at 19:57. |
|
|
|
#4 | Link |
|
Guest
Posts: n/a
|
Yeah, that's a goal. Most of the Windows dependency is in the threading it uses that isn't really necessary anymore (and it actually borks with the parallelizing that VapourSynth and causes green frames to happen at intervals so the filter is set to run serially) and making the asm portable.
Last edited by SassBot; 17th October 2012 at 22:43. |
|
|
|
#5 | Link | |
|
Professional Code Monkey
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,647
|
Quote:
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet Last edited by Myrsloik; 17th October 2012 at 23:00. Reason: me being sleepy |
|
|
|
|
|
|
#6 | Link |
|
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
|
Actually, the C routines are just as fast as the SSE2 routines. To double check that, I just compiled a Colormatrix dll so it uses only the C routines (removed the asm code completely). I get 300 fps on an old Core 2 Duo with 2.5 GHz, single thread.
|
|
|
|
|
|
#9 | Link |
|
Professional Code Monkey
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,647
|
So you are seriously going to port the asm despite people reporting the same speed without it?
This is just ridiculous. At least benchmark it properly to see that the asm gives a 50% boost or more or it must be truly horribly written. What is it with avisynth filter writers and inline asm anyway?
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet |
|
|
|
|
|
#11 | Link |
|
Professional Code Monkey
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,647
|
The reason I object isn't that you're copying the asm as such. asm can be a fun hobby. The real reason is because of the maintainability going down the drain.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet |
|
|
|
|
|
#12 | Link | |
|
Excessively jovial fellow
Join Date: Jun 2004
Location: rude
Posts: 1,100
|
Quote:
Avisynth filter writers frequently suffer from the Gentoo Ricer Syndrome and write hilariously unoptimized algorithms in assembler even though they don't really understand what they're doing, use ricer compiler switches that don't do what they think they do and use needlessly unreadable bitwise operations, all because "it's faster" and then never do any actual benchmarks. All of this are contributing factors as to why a lot of Avisynth filters are unmaintainable and unportable messes. The documentation really doesn't help in this regard either; the "simple filter example" that is supposed to teach people how you use the API very quickly goes completely bananas and ends up in a ridiculous mess of trying to teach you how to write "optimized" inline assembler. If you have an opportunity to clean this up, please please please do so. Unmaintainable open source code could just as well be closed source. Maintaining existing assembler is really hard even if it's well written and documented; in this case it clearly isn't so just scrap it and let someone write new code from scratch if they want to optimize it. Last edited by TheFluff; 18th October 2012 at 23:41. |
|
|
|
|
|
|
#13 | Link |
|
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
|
I tested again on my i2500K and got about 20% more speed with SSE2 compared to the C routines.
However, I have always used the C routines because of this little note in the Colormatrix manual: Due to rounding differences, the output from the mmx and sse2 routines (only present for YV12) is not exactly the same as the output from the c routine (the c routine is more accurate). The maximum difference between the simd and c routines is +-1 on the Y/U/V planes. And, I really don't care if the filter runs with 400 or 500 fps.
|
|
|
|
|
|
#14 | Link |
|
Guest
Posts: n/a
|
Yeah, I saw from 15-25% speedup on the 3 systems I tested between forcing the pure C and the SSE2. So it's enough that I think the mostly minimal copy-and-paste effort is worth it. It's consisted of cutting, pasting, clapping on the prologue and ret macros and renaming some arguments. If it was going to take days or weeks of time, then I'd agree, but it's pretty simplistic "porting".
|
|
|
|
#15 | Link | ||
|
Guest
Posts: n/a
|
Quote:
![]() ![]() Quote:
Last edited by SassBot; 19th October 2012 at 03:35. |
||
|
|
|
#16 | Link | |
|
Super Moderator
![]() Join Date: Nov 2001
Location: Netherlands
Posts: 6,375
|
Quote:
|
|
|
|
|
|
|
#18 | Link |
|
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,405
|
The Assmembler Optimizing section is in the SDK.
http://avisynth.org/mediawiki/Filter...ler_optimizing
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? |
|
|
|
|
|
#20 | Link |
|
Guest
Posts: n/a
|
I can only hope you're being sarcastic... Subtract the two images in Avisynth and you essentially get an almost perfect gray image. Running coloryuv between the two versions gives a difference between each plane as .01. There is no way the difference is even remotely perceptible. If you aren't being sarcastic then you are basically imaging a difference.
Last edited by SassBot; 19th October 2012 at 17:52. |
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|