pylorak/avisynth — pull request #12 by tp7 (2013-11-16 11:34:02+00:00)
Title: x64 support in core filters, part 1

This is the first and the largest part of x64 support in core filters.

#### Important changes ####
* Almost all filters now have plain C, MMX/ISSE and SSE2 versions, implemented using intrinsic functions (old code used a mix of inline asm, Softwire and external asm). Some filters also optimized for SSSE3 where it provided noticeable speadup and was easy enough to add.

Exceptions: YUY2 Tweak path doesn't have an SSE2 version. It is triggered only in certain conditions and disabled by default and I believe it should be removed.

RGB24<->RGB32 conversions are optimized only for MMX and SSSE3 because fast SSE2 optimizations is not trivial and most likely will not be faster than the optimized C path.

* MMX support on the core level is dropped if there's a faster ISSE version. This affects mostly Pentium II and maybe some older models of Pentium I.
Affected filters: YUY2 <-> YV12 conversion, Overlay, all Layer modes on RGB32 and some modes in YUY2.
* Mode 1 is removed from TemporalSoften. Mode parameter is simply ignored.
* MMX parameter in Blur is ignored.
* ISSE version of HorizontalReduceBy2 YUY2 filter was removed because it was slower than the C code.
* Due to SSSE3 optimizations, minimal required version of Visual Studio is 2008.

#### Notes on performance ####
All P4-specific optimizations were removed. The general rule was "not slower than original on Nehalem+ CPUs", which holds true for all modified filters. MMX code is not always faster than the original but SSE2 is. New SSE2 implementation is 10-150% faster than the best old version, depending on the particular filter. Turn functions got additional optimizations so you can expect 4-6 times better performance for those on planar colorspaces and RGB32.

I did not test it on CPUs older than Nehalem. I expect performance to get worse on P4 and I'm not sure about some filters on Core 2. Additional testing is needed but I can't do that myself and I don't think we should spend time optimizing for marginal profit on older than 5 years CPUs.

#### To do ####
* Slight refactoring when we accept some kind of a coding guidelines. Right now the codebase is not consistent at all.
* MMX code of audio filters is not ported. C path should still work.
* Softwire dependency cannot be removed yet since resizers depend on it.
* Some Turn functions could be optimized a bit more if it is needed for resizers.